/**
 *
 * @(#)author  [ok]
 * @(#)version 1.0
 * @(#)date    2014. 06. 30
 * @(#)since   JDK 1.7.2
 *
 * Copyright (c) www.udapsoft.co.kr, Inc.
 * All rights reserved.
 * This software is the proprietary information of udapsoft, Inc.
 */
package kr.co.udapsoft.ebid.portal.payment.biz;


import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
import kr.co.hsnc.common.sql.search.Search;
import kr.co.hsnc.common.sql.search.SearchImpl;
import kr.co.hsnc.common.util.ValueObject;

import com.udapsoft.waf.common.ui.InitCombo;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

public class ResolutionRequestListInitBiz extends Biz {
	
	public ResolutionRequestListInitBiz(HandlerStorage storage) {
		super(storage);
	}

	public void doBiz() throws Exception {

		System.out.println("협력업체포탈 기성신청현황 리스트 페이지 INIT");
		
		//검색 조건에 ComboBox데이터 설정 [상태]
		RowSet rowSet = getStatus_searchCombo();
		storage.addRowSet("statusComboList", rowSet);
		
		//시트의 ComboBox데이터 설정 [상태]
		//ValueObject vo = getPerpayStatus_sheetCombo();
		//storage.addObject("selectText", vo.getObject("DETAILCD"));
		//storage.addObject("selectValue", vo.getObject("DETAILNM"));
		
		//시트의 ComboBox데이터 설정 [신청구분]
		//vo = getPerpayReqDiv_sheetCombo();
		//storage.addObject("selectText1", vo.getObject("DETAILCD"));
		//storage.addObject("selectValue1", vo.getObject("DETAILNM"));

		storage.setSuccess(true);
	}

    /**
     * 기성신청현황 상태Combox 데이터를 조회 한다.
	 * @param 
	 * @param 
	 * @return ValueObject
	 */
	public RowSet getStatus_searchCombo(){

        Search search = new SearchImpl();
        RowSet listRowSet = null;
        String sqlstr = "";
        
        try {
            sqlstr += " SELECT '1' AS DETAILCD, '기성대상' AS DETAILNM FROM DUAL             		\n"
                    + " UNION ALL      															\n"
                    + " SELECT '2' AS DETAILCD, '작성중' AS DETAILNM FROM DUAL					\n"
                    + " UNION ALL      															\n"
                    + " SELECT '3' AS DETAILCD, '기성신청' AS DETAILNM FROM DUAL					\n"
                    + " UNION ALL      															\n"
                    + " SELECT '9' AS DETAILCD, '반려' AS DETAILNM FROM DUAL			     		\n";
             
            search.setStatement(sqlstr);
            listRowSet = search.execute();
			
		}catch(Exception e){
			e.printStackTrace();
		}finally{

			if( listRowSet == null ){
            	listRowSet = new RowSetImpl();
            }
            
			return listRowSet;
		}
	}
	
    /**
     * 선급금 신청 상태를 조회 한다.
	 * @param 
	 * @param 
	 * @return ValueObject
	 */
	public ValueObject getPerpayStatus_sheetCombo(){

		ValueObject vo = new ValueObject();
		try{
			RowSet rowSet = getStatus_searchCombo();
			
			InitCombo initCombo  = new InitCombo();
			initCombo.makeComboData(rowSet,"DETAILCD", "DETAILNM");
		
			vo.set("DETAILCD", initCombo.getCode());
			vo.set("DETAILNM", initCombo.getCodeName());
		    
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if( vo == null ){
				vo = new ValueObject();
            }
			return vo;
		}
		
	}

	
    /**
     * 선급금 신청 신청구분를 조회 한다.
	 * @param 
	 * @param 
	 * @return ValueObject
	 */
	public RowSet getPerpayReqDiv(){

        Search search = new SearchImpl();
        RowSet listRowSet = null;
        String sqlstr = "";
        
        try {
            sqlstr += " SELECT DETAILCD, DETAILNM             	\n"
                    + " FROM EBID_COM911T      					\n"
                    + " WHERE BASECD = 'REG_DIV_CD'     		\n";
             
            search.setStatement(sqlstr);
            listRowSet = search.execute();
			
		}catch(Exception e){
			e.printStackTrace();
		}finally{

			if( listRowSet == null ){
            	listRowSet = new RowSetImpl();
            }
            
			return listRowSet;
		}
	}
	
    /**
     * 선급금 신청구분를 조회 한다.
	 * @param 
	 * @param 
	 * @return ValueObject
	 */
	public ValueObject getPerpayReqDiv_sheetCombo(){

		ValueObject vo = new ValueObject();
		//String RIGHT_ID = "";
		//String RIGHT_NAME = "";
		try{
			RowSet rowSet = getPerpayReqDiv();
			
			InitCombo initCombo  = new InitCombo();
			initCombo.makeComboData(rowSet,"DETAILCD", "DETAILNM");
		
			vo.set("DETAILCD", initCombo.getCode());
			vo.set("DETAILNM", initCombo.getCodeName());
		    
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if( vo == null ){
				vo = new ValueObject();
            }
			return vo;
		}
	}
	
}
