/**
 *
 * @(#)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.supplier.portal.payment.biz;


import oracle.toplink.internal.ox.StrBuffer;
import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.sql.Row;
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.sql.util.RowSetUtility;
import kr.co.hsnc.common.util.ValueObject;
import kr.co.udapsoft.ebid.buyer.common.file.FileManager;

import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

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

	public void doBiz() throws Exception {

		//System.out.println("협력업체포탈 기성신청현황 상세 INIT");
		//System.out.println(params.get("selectSubContId"));		//외주계약서ID
		//System.out.println(params.get("selectSubContModId"));	//외주변경계약서ID
		//System.out.println(params.get("acmpId"));				//기성ID
		//System.out.println(params.get("acmpYyyymm"));			//기성년월
		//System.out.println(params.get("conCorpId"));			//계약업체ID
		//System.out.println(params.get("acmpNo"));				//기성차수
		
		//신청구분ComboList
		//RowSet rowSet = getPerpayReqDiv();
		//storage.addRowSet("perpayReqDivComboList", rowSet);
		
		//계약 정보, 세금계산서 정보  
		//ValueObject prePayment = getPrePayment(params);
		//storage.addValueObject("prePayment", prePayment);
		
		//기성정보
		ValueObject acmpData = getAcmpData(params);
		
		//기성검사 첨부파일
	    RowSet acmpFileRow = getAcmpFileRowSet("RESOLUTION_"+params.get("acmpId"), "10");
	    //준공검사 첨부파일
	    RowSet compFileRow = getAcmpFileRowSet("RESOLUTION_"+params.get("acmpId"), "90");
	    
	    storage.addRowSet("acmpFileRow", acmpFileRow);
	    storage.addRowSet("compFileRow", compFileRow);
		
		//첨부파일
        storage.addValueObject("AttachFile", getfilelist("RESOLUTION_"+params.get("acmpId"),"","AttachFile"));
        
		//보증정보
        RowSet contOutWarr = getContOutWarr(params);
		storage.addRowSet("contOutWarr", contOutWarr);
		
 	    // 각국 통화코드에 따른 소숫점 이하 자릿수 구하기
        RowSet rowSet = getUseCurrencyGBRowSet();
        storage.addRowSet("digitRowSet", rowSet);  
        
        // 계약통화 자릿수 구하기
        String digit = getDigit(rowSet, (String)acmpData.get("con_cur_cd"));
        acmpData.set("digit", digit);
        
        storage.addValueObject("acmpData", acmpData);		
		
        
	}

    /**
     * 첨부파일 조회.
	 * @param 
	 * @param 
	 * @return ValueObject
	 */
	private ValueObject getfilelist(String filegb,String id,String returnid){
		ValueObject vo = new ValueObject();
		RowSet rowSet = FileManager.getFileList(filegb, id);
		String str="";
		
	        for(int i=0;i<rowSet.size();i++){
	        	Row row=rowSet.getRow(i);
	        	String fileName = "";    	
	        	
	            Search search = new SearchImpl();
	            RowSet listRowSet = null;
	            StringBuffer sql = new StringBuffer();
	            ValueObject rowObject = null;
	        	
	            try {
	            	
	            	sql.append("	SELECT A.DETAILCD,								\n");
	            	sql.append("		   A.DETAILNM								\n");
	            	sql.append("	FROM EBID_COM911T A							\n");
	            	sql.append("	WHERE A.BASECD = 'SUB_ACMP_FILE'				\n");
	            	sql.append("	AND A.DETAILCD = '"+row.get("ID")+"'			\n");
	            	
	        		//System.out.println(sql);
	            	
	                search.setStatement(sql.toString());
	                
	                listRowSet = search.execute();
	                
	                if(listRowSet.size() != 0){
	                	rowObject = RowSetUtility.getValueObject(listRowSet.getRow(0));
	                	fileName = rowObject.get("DETAILNM"); 
	                }
	                
	            }
	            catch(Exception e) {
	                WAFLogger.error(this.getClass().getName() + " --> getContOutWarr() : " + e.getMessage());
	                WAFLogger.error("SQL : " + search.getStatement());
	                WAFLogger.error(e);
	                return null;
	            }
	            finally {

	            	if( listRowSet == null ) listRowSet = new RowSetImpl();
	            	
	            }
	        	
	        	str += (i+1)+" : "+fileName+row.get("FILE_NAME")+" ("+ row.get("FILE_SIZE")+")";
	        	if(i+1!=rowSet.size()){
	        		str +="\r\n";
	        	}
	        }
	        vo.set(returnid, str);
		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 ValueObject
     *@return ValueObject
     *기   능 : 기성신청현황 상세(외주) 기성정보 조회
     *@author OK
     *@version 2014. 6. 30.
     *@since JDK1.7
     */
    public ValueObject getAcmpData(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet listRowSet = null;
        StringBuffer sql = new StringBuffer();
        ValueObject rowObject = null;
        String sqlstr = "";
        
        try {
      	  	sql.append("		   SELECT A.ACMP_ID  --기성ID																						\n");
      	  	sql.append(" 				,A.DEPT_CD--현장코드																							\n");
      	  	sql.append(" 				,B.DEPT_NAME--현장명																							\n");
      	  	sql.append(" 				,A.SUB_CONT_ID--계약ID																						\n");
      	  	sql.append(" 				,B.SUB_CONT_MOD_ID--변경계약ID																						\n");
      	  	sql.append(" 				,B.CON_DOC_NO--계약번호																						\n");
      	  	sql.append(" 				,B.BUILD_NAME--계약명																						\n");
      	  	sql.append(" 				,C.CORP_REG_NO--사업자번호																					\n");
      	  	sql.append(" 				,C.CORP_KOR   --계약업체명																					\n");
      	  	sql.append(" 				,A.CON_CORP_ID--계약업체																					\n");
      	  	sql.append(" 				,TO_CHAR(B.CON_DATE, 'YYYY-MM-DD') CON_DATE--계약일자																					\n");
      	  	sql.append(" 				,TO_CHAR(B.START_WORK_DATE, 'YYYY-MM-DD') START_WORK_DATE--계약시작일																					\n");
      	  	sql.append(" 				,TO_CHAR(B.END_WORK_DATE, 'YYYY-MM-DD') END_WORK_DATE--계약종료일																					\n");
      	  	sql.append(" 				,B.CON_AMT AS CON_AMT--계약금																					\n");
      	  	sql.append(" 				,B.CON_SUPPLY_AMT--계약공급가																					\n");
      	  	sql.append(" 				,B.CON_SUPPLY_TAMT--계약공급가_과세																					\n");
      	  	sql.append(" 				,B.CON_SUPPLY_NAMT--계약공급가_면세																					\n");
      	  	sql.append(" 				,B.CON_SURTAX_AMT--계약금_부가세																					\n");
      	  	
/*      	sql.append(" 				,B.PREPAY_AMT--선급금																					\n");
      	  	sql.append(" 				,B.PREPAY_SUPPLY_AMT--선급금공급가																					\n");
      	  	sql.append(" 				,B.PREPAY_SUPPLY_TAMT--선급금공급가_과세																					\n");
      	  	sql.append(" 				,B.PREPAY_SUPPLY_NAMT--선급금공급가_면세																					\n");
      	  	sql.append(" 				,B.PREPAY_SURTAX_AMT--선급금부가세																					\n");
*/
      	  	
sql.append(" 				,NVL(D.PREPAY_SUPPLY_AMT,0) + NVL(D.PREPAY_SURTAX_AMT,0)  as PREPAY_AMT--선급금										\n");
sql.append(" 				,NVL(D.PREPAY_SUPPLY_AMT,0) as PREPAY_SUPPLY_AMT																	\n");
sql.append(" 				,NVL(D.PREPAY_SUPPLY_TAMT,0)  as PREPAY_SUPPLY_TAMT 																\n");
sql.append(" 				,NVL(D.PREPAY_SUPPLY_NAMT,0)  as PREPAY_SUPPLY_NAMT																	\n");
sql.append(" 				,NVL(D.PREPAY_SURTAX_AMT,0)   as PREPAY_SURTAX_AMT																	\n");
      	  	
      	  	sql.append("				,F.CON_AMT AS FIRST_CON_AMT--최초계약금																		\n");
      	  	sql.append("				,F.CON_SUPPLY_AMT AS FIRST_CON_SUPPLY_AMT--최초계약공급가													\n");
      	  	sql.append("				,F.CON_SUPPLY_TAMT AS FIRST_CON_SUPPLY_TAMT--최초계약공급가_과세												\n");
      	  	sql.append("				,F.CON_SUPPLY_NAMT AS FIRST_CON_SUPPLY_NAMT--최초계약공급가_면세												\n");
      	  	sql.append("				,F.CON_SURTAX_AMT AS FIRST_CON_SURTAX_AMT--최초계약금_부가세   												\n");
      	  	sql.append("				,F.PREPAY_AMT AS FIRST_PREPAY_AMT--최초선급금																\n");
      	  	sql.append("				,F.PREPAY_SUPPLY_AMT AS FIRST_PREPAY_SUPPLY_AMT--최초선급금공급가											\n");
      	  	sql.append("				,F.PREPAY_SUPPLY_TAMT AS FIRST_PREPAY_SUPPLY_TAMT--최초선급금공급가_과세										\n");
      	  	sql.append("				,F.PREPAY_SUPPLY_NAMT AS FIRST_PREPAY_SUPPLY_NAMT--최초선급금공급가_면세										\n");
      	  	sql.append("				,F.PREPAY_SURTAX_AMT AS FIRST_PREPAY_SURTAX_AMT--최초선급금부가세											\n");
      	  	
      	  	sql.append(" 				,(NVL(D.SUPPLY_AMT,0) + NVL(D.SURTAX_AMT,0)) SL_PREPAY_AMT --선급발생금																					\n");
      	  	sql.append(" 				,NVL(D.SUPPLY_AMT, 0) SL_PREPAY_SUPPLY_AMT--선급발생_공급가																					\n");
      	  	sql.append(" 				,NVL(D.SUPPLY_TAMT, 0) SL_PREPAY_SUPPLY_TAMT--선급발생_공급가_과세																					\n");
      	  	sql.append(" 				,NVL(D.SUPPLY_NAMT, 0) SL_PREPAY_SUPPLY_NAMT--선급발생_공급가_면세																					\n");
      	  	sql.append(" 				,NVL(D.SURTAX_AMT, 0) SL_PREPAY_SURTAX_AMT--선급발생_부가세																					\n");
      	  	
sql.append(" 				,NVL(D.F_CON_SUPPLY_AMT, 0) F_CON_SUPPLY_AMT --선급금대상계약금액													\n");
sql.append(" 				,to_char(to_date(D.F_TAX_DY, 'yyyymmdd'), 'yyyy-mm-dd') F_TAX_DY	--외화의 경우 환율일자							\n");
      	  	
      	  	sql.append(" 				,A.ACMP_YYYYMM--기성년월																					\n");
      	  	sql.append(" 				,TO_CHAR(TO_DATE(A.ACMP_YYYYMM, 'YYYYMM'), 'YYYY-MM') ACMP_YYYY_MM--기성년월																					\n");
      	  	sql.append(" 				,A.ACMP_NO--기성차수																					\n");
      	  	sql.append(" 				,TO_CHAR(A.ACMP_DATE, 'YYYY-MM-DD') ACMP_DATE--기성일자																					\n");
      	  	sql.append(" 				,A.CON_CUR_CD--계약통화																					\n");
      	  	sql.append(" 				,F_GET_CODE_NAME('911', A.CON_CUR_CD) CON_CUR_NM--계약통화																					\n");
      	  	sql.append(" 				,B.PROOF_CD--증빙구분																					\n");
      	  	sql.append(" 				,F_GET_CODE_NAME('PROOF_CD', A.PROOF_CD) PROOF_NM --증빙구분																					\n");
      	  	sql.append(" 				,TO_CHAR(A.CON_START_DATE, 'YYYY-MM-DD') CON_START_DATE--기성공사시작일																					\n");
      	  	sql.append(" 				,TO_CHAR(A.CON_END_DATE, 'YYYY-MM-DD') CON_END_DATE--기성공사종료일																					\n");
      	  	sql.append(" 				,A.CHECK_COMP--검사인_소속																					\n");
      	  	sql.append(" 				,A.CHECK_MAN--검사인_성명																					\n");
      	  	sql.append(" 				,A.CHECK_TEL--검사인_연락처																					\n");
      	  	sql.append(" 				,A.ATTEN_COMP--입회인_소속																					\n");
      	  	sql.append(" 				,A.ATTEN_MAN--입회인_성명																					\n");
      	  	sql.append(" 				,A.ATTEN_TEL--입회인_연락처																					\n");
      	  	
      	  	sql.append(" 				,ROUND((A.PRE_FUND_AMT/B.CON_SUPPLY_AMT)*100,2) PRE_FUND_RATE--전월기성율																					\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_TAMT,0),0,0,ROUND((A.PRE_FUND_TAMT/B.CON_SUPPLY_TAMT)*100,2)) PRE_FUND_TRATE--전월기성율_과세   																					\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_NAMT,0),0,0,ROUND((A.PRE_FUND_NAMT/B.CON_SUPPLY_NAMT)*100,2)) PRE_FUND_NRATE--전월기성율_면세   																					\n");
      	  	sql.append(" 				,A.PRE_FUND_AMT--전월기성금액																					\n");
      	  	sql.append(" 				,A.PRE_FUND_TAMT--전월기성금액_과세																					\n");
      	  	sql.append(" 				,A.PRE_FUND_NAMT--전월기성금액_면세																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_AMT, 0),0,0,ROUND((A.PRE_PAY_DEDUCT_AMT/D.SUPPLY_AMT)*100,2)) PRE_PAY_DEDUCT_RATE--전월선급공제율																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_TAMT, 0),0,0,ROUND((A.PRE_PAY_DEDUCT_TAMT/D.SUPPLY_TAMT)*100,2)) PRE_PAY_DEDUCT_TRATE--전월선급공제율_과세   																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_NAMT, 0),0,0,ROUND((A.PRE_PAY_DEDUCT_NAMT/D.SUPPLY_NAMT)*100,2)) PRE_PAY_DEDUCT_NRATE--전월선급공제율_면세																					\n");   
      	  	sql.append(" 				,A.PRE_PAY_DEDUCT_AMT--전월선급공제금액																					\n");
      	  	sql.append(" 				,A.PRE_PAY_DEDUCT_TAMT--전월선급공제금액_과세																					\n");
      	  	sql.append(" 				,A.PRE_PAY_DEDUCT_NAMT--전월선급공제금액_면세																					\n");
      	  	sql.append(" 				,A.PRE_REQU_SUPPLY_AMT--전월청구_공급가																					\n");
      	  	sql.append(" 				,A.PRE_REQU_SUPPLY_TAMT--전월청구_공급가_과세																					\n");
      	  	sql.append(" 				,A.PRE_REQU_SUPPLY_NAMT--전월청구_공급가_면세																					\n");
      	  	sql.append(" 				,A.PRE_REQU_SURTAX_AMT--전월청구_부가세																					\n");
      	  	sql.append(" 				,A.PRE_REQU_SURTAX_AMT PRE_REQU_SURTAX_TAMT--전월청구_부가세_과세																					\n");
      	  	sql.append(" 				,0 PRE_REQU_SURTAX_NAMT--전월청구_부가세_면세																					\n");
      	  	sql.append(" 				,A.PRE_REQU_AMT--전월청구액																					\n");
      	  	sql.append(" 				,(A.PRE_REQU_SUPPLY_TAMT + A.PRE_REQU_SURTAX_AMT) PRE_REQU_TAMT--전월청구액_과세																					\n");
      	  	sql.append(" 				,A.PRE_REQU_SUPPLY_NAMT PRE_REQU_NAMT --전월청구액_면세																					\n");
      	  	
      	  	sql.append(" 				,ROUND((A.FUND_AMT/B.CON_SUPPLY_AMT)*100,2) FUND_RATE--금회기성율																					\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_TAMT,0),0,0,ROUND((A.FUND_TAMT/B.CON_SUPPLY_TAMT)*100,2)) FUND_TRATE--금회기성율_과세																					\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_NAMT,0),0,0,ROUND((A.FUND_NAMT/B.CON_SUPPLY_NAMT)*100,2)) FUND_NRATE--금회기성율_면세																					\n");
      	  	sql.append(" 				,A.FUND_AMT--금회기성금액																					\n");
      	  	sql.append(" 				,A.FUND_TAMT--금회기성금액_과세																					\n");
      	  	sql.append(" 				,A.FUND_NAMT--금회기성금액_면세																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_AMT, 0),0,0,ROUND((A.PAY_DEDUCT_AMT/D.SUPPLY_AMT)*100,2)) PAY_DEDUCT_RATE--금회선급공제율																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_TAMT, 0),0,0,ROUND((A.PAY_DEDUCT_TAMT/D.SUPPLY_TAMT)*100,2)) PAY_DEDUCT_TRATE--금회선급공제율_과세   																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_NAMT, 0),0,0,ROUND((A.PAY_DEDUCT_NAMT/D.SUPPLY_NAMT)*100,2)) PAY_DEDUCT_NRATE--금회선급공제율_면세   																					\n");
      	  	sql.append(" 				,A.PAY_DEDUCT_AMT--금회선급공제금액																					\n");
      	  	sql.append(" 				,A.PAY_DEDUCT_TAMT--금회선급공제금액_과세																					\n");
      	  	sql.append(" 				,A.PAY_DEDUCT_NAMT--금회선급공제금액_면세																					\n");
      	  	sql.append(" 				,A.REQU_SUPPLY_AMT--금회청구_공급가																					\n");
      	  	sql.append(" 				,A.REQU_SUPPLY_TAMT--금회청구_공급가_과세																					\n");
      	  	sql.append(" 				,A.REQU_SUPPLY_NAMT--금회청구_공급가_면세																					\n");
      	  	sql.append(" 				,A.REQU_SURTAX_AMT--금회청구_부가세																					\n");
      	  	sql.append(" 				,A.REQU_SURTAX_AMT REQU_SURTAX_TAMT--금회청구_부가세_과세																					\n");
      	  	sql.append(" 				,0 REQU_SURTAX_NAMT--금회청구_부가세_면세																					\n");
      	  	sql.append(" 				,A.REQU_AMT--금회청구액																					\n");
      	  	sql.append(" 				,(A.REQU_SUPPLY_TAMT + A.REQU_SURTAX_AMT) REQU_TAMT--금회청구액_과세																					\n");
      	  	sql.append(" 				,A.REQU_SUPPLY_NAMT REQU_NAMT --금회청구액_면세																					\n");
      	  	
      	  	sql.append(" 				,ROUND((A.TOT_FUND_AMT/B.CON_SUPPLY_AMT)*100,2) TOT_FUND_RATE--누계기성율												\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_TAMT,0),0,0,ROUND((A.TOT_FUND_TAMT/B.CON_SUPPLY_TAMT)*100,2)) TOT_FUND_TRATE--누계기성율_과세																					\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_NAMT,0),0,0,ROUND((A.TOT_FUND_NAMT/B.CON_SUPPLY_NAMT)*100,2)) TOT_FUND_NRATE--누계기성율_면세																					\n");
      	  	sql.append(" 				,A.TOT_FUND_AMT--누계기성금액																					\n");
      	  	sql.append(" 				,A.TOT_FUND_TAMT--누계기성금액_과세																					\n");
      	  	sql.append(" 				,A.TOT_FUND_NAMT--누계기성금액_면세																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_AMT, 0),0,0,ROUND((A.TOT_PAY_DEDUCT_AMT/D.SUPPLY_AMT)*100,2)) TOT_PAY_DEDUCT_RATE--누계선급공제율																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_TAMT, 0),0,0,ROUND((A.TOT_PAY_DEDUCT_TAMT/D.SUPPLY_TAMT)*100,2)) TOT_PAY_DEDUCT_TRATE--누계선급공제율_과세																					\n");   
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_NAMT, 0),0,0,ROUND((A.TOT_PAY_DEDUCT_NAMT/D.SUPPLY_NAMT)*100,2)) TOT_PAY_DEDUCT_NRATE--누계선급공제율_면세																					\n");   
      	  	sql.append(" 				,A.TOT_PAY_DEDUCT_AMT--누계선급공제금액																					\n");
      	  	sql.append(" 				,A.TOT_PAY_DEDUCT_TAMT--누계선급공제금액_과세																					\n");
      	  	sql.append(" 				,A.TOT_PAY_DEDUCT_NAMT--누계선급공제금액_면세																					\n");
      	  	sql.append(" 				,A.TOT_REQU_SUPPLY_AMT--누계청구_공급가																					\n");
      	  	sql.append(" 				,A.TOT_REQU_SUPPLY_TAMT--누계청구_공급가_과세																					\n");
      	  	sql.append(" 				,A.TOT_REQU_SUPPLY_NAMT--누계청구_공급가_면세																					\n");
      	  	sql.append(" 				,A.TOT_REQU_SURTAX_AMT--누계청구_부가세																					\n");
      	  	sql.append(" 				,A.TOT_REQU_SURTAX_AMT TOT_REQU_SURTAX_TAMT--누계청구_부가세_과세																					\n");
      	  	sql.append(" 				,0 TOT_REQU_SURTAX_NAMT--누계청구_부가세_면세																					\n");
      	  	sql.append(" 				,A.TOT_REQU_AMT--누계청구액																					\n");
      	  	sql.append(" 				,(A.TOT_REQU_SUPPLY_TAMT + A.TOT_REQU_SURTAX_AMT) TOT_REQU_TAMT--누계청구액_과세																					\n");
      	  	sql.append(" 				,A.TOT_REQU_SUPPLY_NAMT TOT_REQU_NAMT --누계청구액_면세																					\n");
      	  	
      	  	sql.append(" 				,ROUND(((B.CON_SUPPLY_AMT - A.TOT_FUND_AMT)/B.CON_SUPPLY_AMT)*100,2) RES_FUND_RATE--잔여기성율																					\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_TAMT,0),0,0,ROUND(((B.CON_SUPPLY_TAMT - A.TOT_FUND_TAMT)/B.CON_SUPPLY_TAMT)*100,2)) RES_FUND_TRATE--잔여기성율_과세																					\n");
      	  	sql.append(" 				,DECODE(NVL(B.CON_SUPPLY_NAMT,0),0,0,ROUND(((B.CON_SUPPLY_NAMT - A.TOT_FUND_NAMT)/B.CON_SUPPLY_NAMT)*100,2)) RES_FUND_NRATE--잔여기성율_면세																					\n");
      	  	sql.append(" 				,(B.CON_SUPPLY_AMT - A.TOT_FUND_AMT) RES_FUND_AMT --잔여기성금액																					\n");
      	  	sql.append(" 				,(B.CON_SUPPLY_TAMT - A.TOT_FUND_TAMT) RES_FUND_TAMT--잔여기성금액_과세																					\n");
      	  	sql.append(" 				,(B.CON_SUPPLY_NAMT - A.TOT_FUND_NAMT) RES_FUND_NAMT--잔여기성금액_면세																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_AMT,0),0,0,ROUND(((D.SUPPLY_AMT - A.TOT_PAY_DEDUCT_AMT)/D.SUPPLY_AMT)*100,2)) RES_PAY_DEDUCT_RATE--잔여선급공제율																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_TAMT,0),0,0,ROUND(((D.SUPPLY_TAMT - A.TOT_PAY_DEDUCT_TAMT)/D.SUPPLY_TAMT)*100,2)) RES_PAY_DEDUCT_TRATE--잔여선급공제율_과세																					\n");
      	  	sql.append(" 				,DECODE(NVL(D.SUPPLY_NAMT,0),0,0,ROUND(((D.SUPPLY_NAMT - A.TOT_PAY_DEDUCT_NAMT)/D.SUPPLY_NAMT)*100,2)) RES_PAY_DEDUCT_NRATE--잔여선급공제율_면세																					\n");
      	  	sql.append(" 				,(NVL(D.SUPPLY_AMT, 0) - A.TOT_PAY_DEDUCT_AMT) RES_PAY_DEDUCT_AMT --잔여선급공제금액																					\n");
      	  	sql.append(" 				,(NVL(D.SUPPLY_TAMT, 0) - A.TOT_PAY_DEDUCT_TAMT) RES_PAY_DEDUCT_TAMT--잔여선급공제금액_과세																					\n");
      	  	sql.append(" 				,(NVL(D.SUPPLY_NAMT, 0) - A.TOT_PAY_DEDUCT_NAMT) RES_PAY_DEDUCT_NAMT--잔여선급공제금액_면세																					\n");
      	  	sql.append(" 				,A.ACMP_REMARK--특기사항																								\n");

      	  	sql.append(" 				,A.TAX_METHOD_CD--세금계산서 발행방법																					\n");
      	  	sql.append(" 				,A.TAX_DY--작성일자																									\n");
      	  	sql.append(" 				,A.TAX_CHARG_NM--담당자명																								\n");
      	  	sql.append(" 				,A.TAX_CHARG_HP--담당자핸드폰번호																						\n");
      	  	sql.append(" 				,A.TAX_CHARG_EMAIL--담당자이메일																						\n");
      	  	sql.append(" 				,B.MOD_NO--계약차수																									\n");
      	  	sql.append(" 				,A.STATUS_CD	--상태값																								\n");
      	  	sql.append(" 				,F_GET_CODE_NAME('ACMP_STATUS_CD', A.STATUS_CD) AS STATUS_NM     --상태명											\n");
      	  	sql.append(" 				,C.BOSS_NAME	--대표자 이름																							\n");
      	  	sql.append(" 				,DECODE(A.SUPP_SIGN_DT, null, '미서명', to_char(A.SUPP_SIGN_DT, 'yyyy-mm-dd HH24:MI:SS')) AS  SUPP_SIGN_DT     --서명일시																							\n");
            sql.append(" 				,replace(A.RTN_REASON, chr(13)||chr(10), '<BR>') AS RTN_REASON             --반려사유 								\n");
      	  	sql.append(" 				,to_char(to_date(RTN_DATE, 'yyyymmdd'), 'yyyy-mm-dd') AS RTN_DATE     --반려일자										\n");
      	  
      	  	sql.append(" 				,D1.USER_NAME  AS RES_USER_NAME																	\n");
      	  	sql.append(" 				,D1.HP AS RES_HP																				\n");
      		sql.append(" 				,D1.EMAIL AS RES_EMAIL																			\n");
      	
      		sql.append(" 				,NVL(A.SUPP_DIRECT_YN,'N') AS SUPP_DIRECT_YN													\n");
      		sql.append(" 				,NVL(A.LABOR_USE_YN,'N') AS LABOR_USE_YN														\n");
      		sql.append(" 				,B.DEF_EST_GUAR_RATE																			\n");
      		
      		sql.append(" 				,(SELECT NVL (  MAX (CHG_CODE10), 'INPUT_VAT') FROM EBID_COM911T											\n");
      		sql.append(" 				  WHERE BASECD = 'PROOF_CD'																						\n");
      		sql.append(" 				  AND DETAILCD = (SELECT DECODE(PROOF_CD, 'Z99', '23', PROOF_CD)       							\n");
      		sql.append(" 				                  FROM SUB2000T																				\n");
      		sql.append(" 				                  WHERE SUB_CONT_MOD_ID = B.SUB_CONT_MOD_ID)												\n");
      		sql.append(" 				) AS INPUTVATDIV																							\n");
      		
      		sql.append(" 				,D2.BEF_TOT_FUND_AMT														\n");
      		sql.append(" 				,D2.BEF_TOT_PAY_DEDUCT_AMT													\n");
      		
      	  	sql.append("			FROM SUB1040T A																					\n");
      	  	sql.append(" 				,SUB2000T B																					\n");
      	  	sql.append(" 				,SUB1020T C																					\n");
		      sql.append(" 				,( 																															\n");
		      sql.append(" 				  select sub_cont_id																										\n");
		      sql.append(" 				  		, PREPAY_SUPPLY_AMT																				\n");
		      sql.append(" 				  		, PREPAY_SUPPLY_TAMT																				\n");
		      sql.append(" 				  		, PREPAY_SUPPLY_NAMT																			\n");
		      sql.append(" 				  		, PREPAY_SURTAX_AMT																				\n");
		      sql.append(" 				  		, REQ_PREPAY_SUPPLY_AMT    SUPPLY_AMT																				\n");
		      sql.append(" 				  		, REQ_PREPAY_SUPPLY_TAMT  SUPPLY_TAMT  --  선급금공급가_과세															\n");
		      sql.append(" 				  		, REQ_PREPAY_SUPPLY_NAMT  SUPPLY_NAMT  --   신청_선급금_면세															\n");
		      sql.append(" 				  		, REQ_PREPAY_SURTAX_AMT    SURTAX_AMT  -- 신청_선급금_부가세															\n");
		      sql.append(" 				  		, TAX_DY F_TAX_DY	-- 외화의 경우 환율일자																						\n");
		      sql.append(" 				  		, CASE WHEN (select AA.CON_SUPPLY_TAMT  AS F_CON_SUPPLY_AMT from sub2000t AA, sub1030t BB where BB.sub_cont_mod_id = a.min_sub_cont_mod_id and AA.sub_cont_mod_id = BB.sub_cont_mod_id) <							\n");
		      sql.append(" 				  		            (select AA.CON_SUPPLY_TAMT  AS F_CON_SUPPLY_AMT from sub2000t AA, sub1030t BB where BB.sub_cont_mod_id = a.max_sub_cont_mod_id and AA.sub_cont_mod_id = BB.sub_cont_mod_id)   THEN				\n");
		      sql.append(" 				  		  	(select AA.CON_SUPPLY_TAMT  AS F_CON_SUPPLY_AMT from sub2000t AA, sub1030t BB where BB.sub_cont_mod_id = a.min_sub_cont_mod_id and AA.sub_cont_mod_id = BB.sub_cont_mod_id)										\n");
		      sql.append(" 				  		  ELSE																																																							\n");
		      sql.append(" 				  		  	(select AA.CON_SUPPLY_TAMT  AS F_CON_SUPPLY_AMT from sub2000t AA, sub1030t BB where BB.sub_cont_mod_id = a.max_sub_cont_mod_id and AA.sub_cont_mod_id = BB.sub_cont_mod_id)										\n");
		      sql.append(" 				  		  END AS F_CON_SUPPLY_AMT																																																		\n");
		      sql.append(" 				  		, a.min_sub_cont_mod_id																						\n");
		      sql.append(" 				  		, a.max_sub_cont_mod_id																						\n");
		      sql.append(" 				  from(																														\n");
		      sql.append(" 				  		select sub_cont_id																									\n");
		      sql.append(" 				  			   , sum(PREPAY_SUPPLY_AMT) PREPAY_SUPPLY_AMT   --													\n");
		      sql.append(" 				  			   , sum(PREPAY_SUPPLY_TAMT) PREPAY_SUPPLY_TAMT   --													\n");
		      sql.append(" 				  			   , sum(PREPAY_SUPPLY_NAMT) PREPAY_SUPPLY_NAMT   --													\n");
		      sql.append(" 				  			   , sum(PREPAY_SURTAX_AMT) PREPAY_SURTAX_AMT   --												\n");
		      sql.append(" 				  			   , sum(REQ_PREPAY_SUPPLY_AMT) REQ_PREPAY_SUPPLY_AMT   --  선급금공급가_공급가													\n");
		      sql.append(" 				  			   , sum(REQ_PREPAY_SUPPLY_TAMT) REQ_PREPAY_SUPPLY_TAMT   --  선급금공급가_과세										\n");
		      sql.append(" 				  		       , sum(REQ_PREPAY_SUPPLY_NAMT) REQ_PREPAY_SUPPLY_NAMT    --   신청_선급금_면세												\n");
		      sql.append(" 				  		       , sum(REQ_PREPAY_SURTAX_AMT) REQ_PREPAY_SURTAX_AMT -- 신청_선급금_부가세									\n");
		      sql.append(" 				  		       , min(sub_cont_mod_id) min_sub_cont_mod_id													\n");
		      sql.append(" 				  		       , max(sub_cont_mod_id) max_sub_cont_mod_id													\n");
		      sql.append(" 				  		       , min(TAX_DY) TAX_DY -- 외화의 경우 환율일자														\n");
		      sql.append(" 				  		FROM SUB1030T A              									\n");
		      sql.append(" 				  		WHERE A.SUB_CONT_ID = '"+ params.get("selectSubContId") +"'													\n");
		      //sql.append(" 				  		AND A.CON_CORP_ID = '"+ params.get("conCorpId") +"'																\n");
		      sql.append(" 				  		and A.status_cd = '10'																\n");
		      sql.append(" 				  		and A.sub_cont_mod_id <= '"+params.get("selectSubContModId")+"'																\n");
		      sql.append(" 				  group by sub_cont_id																\n");
		      sql.append(" 				 	) a															\n");
		      sql.append("              ) D																																							\n");
      	  	
      	  	// 최초계약금액의 선급금을 지불하기위해 수정	By hanwool 	2012-09-18
      	  	sql.append("				,(SELECT * FROM SUB2000T																						\n");
      	  	sql.append("				  WHERE  MOD_NO = '0'																							\n");
      	  	sql.append("						AND SUB_CONT_ID = '"+ params.get("selectSubContId") +"' ) F																				\n");
      	  	sql.append("				, cont_out_supp     D1																				\n");
      	  	
      	  	// 이전 기성차수의 금회누계 기성금, 선급금 합계	2023-05-31
      	  	sql.append("				,(SELECT '"+ params.get("acmpId") +"' AS ACMP_ID,TOT_FUND_AMT AS BEF_TOT_FUND_AMT,TOT_PAY_DEDUCT_AMT AS BEF_TOT_PAY_DEDUCT_AMT			\n");
      		sql.append("					FROM SUB1040T																														\n");
      		sql.append("				   WHERE SUB_CONT_ID = (SELECT SUB_CONT_ID FROM SUB1040T WHERE ACMP_ID = '"+ params.get("acmpId") +"')									\n");
      		sql.append("					 AND TO_NUMBER(ACMP_NO) = (SELECT TO_NUMBER (ACMP_NO) FROM SUB1040T WHERE ACMP_ID = '"+ params.get("acmpId") +"') - 1) D2			\n");
      	  	
      	  	sql.append("		 	WHERE A.ACMP_ID = '"+ params.get("acmpId") +"' -- 변수 기성ID																					\n"); 
      	  	sql.append("		 	AND A.SUB_CONT_ID = B.SUB_CONT_ID																					\n");
      	  	sql.append("		 	AND A.MOD_NO = B.MOD_NO																					\n");
      	  	sql.append("		 	AND A.CON_CORP_ID = C.CON_CORP_ID																					\n");
      	  	sql.append("		 	AND B.SUB_CONT_MOD_ID = D1.SUB_CONT_MOD_ID																					\n");
      	  	sql.append("		 	AND D1.sign_seq = '1'																					\n");
      	  	sql.append("		 	AND A.SUB_CONT_ID = D.SUB_CONT_ID (+)		                            				\n");
      	  	sql.append("		 	AND A.ACMP_ID = D2.ACMP_ID(+)				                            				\n");
      	
      	  	search.setStatement(sql.toString());
      	  	System.out.println(sql.toString());
      	  	
            listRowSet = search.execute();
            rowObject = RowSetUtility.getValueObject(listRowSet.getRow(0));
            
        }
        catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> getPrePayment() : " + e.getMessage());
            WAFLogger.error("SQL : " + search.getStatement());
            WAFLogger.error(e);
            return null;
        }
        finally {

            if( rowObject == null ) rowObject = new ValueObject();
            return rowObject;
        }
    }
    
    /**
     *@param ValueObject
     *@return ValueObject
     *기   능 : 외주계약 보증정보 데이터 조회
     *@author OK
     *@version 2014. 6. 23.
     *@since JDK1.7
     */
    public RowSet getContOutWarr(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet listRowSet = null;
        ValueObject rowObject = null;
        StrBuffer sqlstr = new StrBuffer();
        try {
        	sqlstr.append("	SELECT  WARR_GUBUN	\n");
        	sqlstr.append("	    , WARR_GUBUN_NM	\n");
        	sqlstr.append("	    , MAX(MOD_NO) AS MOD_NO	\n");
        	sqlstr.append("	    , NVL(MAX(WARR_SEQ), (SELECT NVL(MAX(WARR_SEQ),0) + 1 FROM CONT_OUT_WARR WHERE SUB_CONT_MOD_ID = '"+ params.get("selectSubContModId") +"')) AS WARR_SEQ	\n");
        	sqlstr.append("	    , MAX(WARR_WAMT) AS WARR_WAMT	\n");
        	sqlstr.append("	    , MAX(VIEW_DIV) AS VIEW_DIV	\n");
        	sqlstr.append("	    , MAX(CAUSECODE) AS CAUSECODE	\n");
        	sqlstr.append("	    , MAX(CAUSECODE_NM) AS CAUSECODE_NM	\n");
        	sqlstr.append("	    , MAX(GUAR_ORGAN_CODE) AS GUAR_ORGAN_CODE	\n");
        	sqlstr.append("	    , MAX(WARR_GOFFICE_ID) AS WARR_GOFFICE_ID	\n");
        	sqlstr.append("	    , MAX(WARR_GOFFICE) AS WARR_GOFFICE	\n");
        	sqlstr.append("	    , MAX(GUAR_STATUS) AS GUAR_STATUS	\n");
        	sqlstr.append("	    , MAX(GUAR_STATUS_NM) AS GUAR_STATUS_NM	\n");
        	sqlstr.append("	    , MAX(PAPERDATE) AS PAPERDATE	\n");
        	sqlstr.append("	    , MAX(WARR_WGNO) AS WARR_WGNO	\n");
        	sqlstr.append("	    , MAX(WARR_SDATE) AS WARR_SDATE	\n");
        	sqlstr.append("	    , MAX(WARR_EDATE) AS WARR_EDATE	\n");
        	sqlstr.append("	    , MAX(GUAR_ONOFF_NM) AS GUAR_ONOFF_NM	\n");
        	sqlstr.append("	    , MAX(GUAR_ONOFF_YN) AS GUAR_ONOFF_YN	\n");
        	sqlstr.append("	    , MAX(GRTREQNO) AS GRTREQNO	\n");      
        	sqlstr.append("	     FROM (	\n");
        	sqlstr.append("	              SELECT WARR_GUBUN	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('GAUR_KIND',WARR_GUBUN) AS WARR_GUBUN_NM	\n");
        	sqlstr.append("	                   , MOD_NO	\n");
        	sqlstr.append("	                   , WARR_SEQ	\n");
        	sqlstr.append("	                   , WARR_WAMT	\n");
        	sqlstr.append("	                   , VIEW_DIV	\n");
        	sqlstr.append("	                   , CAUSECODE	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE',CAUSECODE) AS CAUSECODE_NM	\n");
        	sqlstr.append("	                   , GUAR_ORGAN_CODE	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('GUAROFFICEID',GUAR_ORGAN_CODE) AS WARR_GOFFICE_ID	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('GUARORGAN',GUAR_ORGAN_CODE) AS WARR_GOFFICE	\n");
        	sqlstr.append("	                   , GUAR_STATUS	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('GUAR_STATUS',GUAR_STATUS) AS GUAR_STATUS_NM	\n");
        	sqlstr.append("	                   , PAPERDATE	\n");
        	sqlstr.append("	                   , WARR_WGNO	\n");
        	sqlstr.append("	                   , WARR_SDATE	\n");
        	sqlstr.append("	                   , WARR_EDATE 	\n");
        	sqlstr.append("	                   , DECODE(GUAR_ONOFF_YN,'Y','온라인','N','오프라인') AS GUAR_ONOFF_NM	\n");
        	sqlstr.append("	                   , GUAR_ONOFF_YN 	\n");
        	sqlstr.append("	                   , GRTREQNO 	\n");    
        	sqlstr.append("	                FROM CONT_OUT_WARR 	\n");
        	sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ params.get("selectSubContModId") +"' 	\n");
        	sqlstr.append("	                     AND WARR_GUBUN IN ('5')	\n");
        	sqlstr.append("		\n");
        	sqlstr.append("	              UNION ALL	\n");
        	sqlstr.append("		\n");
        	sqlstr.append("	              SELECT '5' AS WARR_GUBUN	\n");
        	sqlstr.append("	                   , '하자이행보증' AS WARR_GUBUN_NM	\n");
           	sqlstr.append("	                   , B.MOD_NO	\n");
        	sqlstr.append("	                   , NULL AS WARR_SEQ	\n");
        	sqlstr.append("	                   , 0 AS WARR_WAMT	\n");
        	sqlstr.append("	                   , 'ACMP' AS VIEW_DIV	\n");
        	sqlstr.append("	                   , '10' AS CAUSECODE	\n");
        	sqlstr.append("	                   , F_GET_CODE_NAME('CAUSECODE','10') AS CAUSECODE_NM	\n");
        	sqlstr.append("	                   , '' AS GUAR_ORGAN_CODE	\n");
        	sqlstr.append("	                   , '' AS WARR_GOFFICE_ID	\n");        	        	
        	sqlstr.append("	                   , '' AS WARR_GOFFICE	\n");
        	sqlstr.append("	                   , '' AS GUAR_STATUS	\n");
        	sqlstr.append("	                   , '' AS GUAR_STATUS_NM	\n");
        	sqlstr.append("	                   , '' AS PAPERDATE	\n");
        	sqlstr.append("	                   , '' AS WARR_WGNO	\n");
        	sqlstr.append("	                   , '' AS WARR_SDATE	\n");
        	sqlstr.append("	                   , '' AS WARR_EDATE 	\n");
        	sqlstr.append("	                   , '' AS GUAR_ONOFF_NM 	\n");
        	sqlstr.append("	                   , '' AS GUAR_ONOFF_YN 	\n");
        	sqlstr.append("	                   , '' AS GRTREQNO 	\n");    
        	sqlstr.append("	                FROM DUAL A, SUB2000T B  	\n");
        	sqlstr.append("	               WHERE SUB_CONT_MOD_ID = '"+ params.get("selectSubContModId") +"'	\n");
        	sqlstr.append("	                     AND B.DEF_GUAR_AMT > 0	\n");
        	sqlstr.append("	        )        	\n");
        	sqlstr.append("	GROUP BY  WARR_GUBUN, WARR_GUBUN_NM, CAUSECODE, CAUSECODE_NM	\n");
       	
            //System.out.println(sqlstr);
            search.setStatement(sqlstr.toString());
            listRowSet = search.execute();
            
        }
        catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> getContOutWarr() : " + e.getMessage());
            WAFLogger.error("SQL : " + search.getStatement());
            WAFLogger.error(e);
            return null;
        }
        finally {

            if( rowObject == null ) rowObject = new ValueObject();
        }
        return listRowSet;
    }  

    
    
    /** 첨부서류 
     * @return
     * @throws Exception
     */
    public RowSet getAcmpFileRowSet(String acmp_id, String code) throws Exception {
        Search search = new SearchImpl();
        RowSet listRowSet = null;
        StringBuffer sql = new StringBuffer();
        try {
/*    		sql.append("	SELECT A.DETAILCD								\n");
    		sql.append(" 		   ,A.DETAILNM								\n");
    		sql.append(" 		   ,B.DOC_CD								\n");
    		sql.append("	FROM EBID_COM911T A, SUB1045T!CCSIF B			\n");
    		sql.append("	WHERE A.BASECD = 'SUB_ACMP_FILE'				\n");
    		sql.append("	AND A.DETAILCD = B.DOC_CD(+)					\n");
    		sql.append("	AND B.ACMP_ID(+) = "+acmp_id+"						\n");
    		sql.append("	AND A.CHG_CODE01 = '"+code+"'					\n");
    		sql.append("	ORDER BY A.DETAILCD					\n");*/

    		sql.append("	SELECT distinct A.DETAILCD,								\n");
    		sql.append(" 		   A.DETAILNM,								\n");
    		sql.append(" 		   B.ID AS DOC_CD							\n");
    		sql.append("	FROM EBID_COM911T A, PUB0510T B				\n");
    		sql.append("	WHERE A.BASECD = 'SUB_ACMP_FILE'				\n");
    		sql.append("	AND A.DETAILCD = B.ID(+)						\n");
    		sql.append("	AND A.CHG_CODE01 = '"+code+"'					\n");
    		sql.append("	AND B.FILE_GB(+) = '"+acmp_id+"'				\n");
    		sql.append("	AND DETAILCD NOT IN ('560', '570')				\n");
    		sql.append("	ORDER BY A.DETAILCD								\n");
    		
    		//System.out.println(sql);
        	
            search.setStatement(sql.toString());
            
            listRowSet = search.execute();
            WAFLogger.debug(sql.toString());
            
           
            
        } catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> getListRowSet() : \n" + e.getMessage());
            WAFLogger.error("SQL : " + search.getStatement());
            WAFLogger.error(e);
            
        } finally {
            if( listRowSet == null ) listRowSet = new RowSetImpl();
           
        }
        
        return listRowSet;
    }
    private String getDigit(RowSet listRowSet, String currencyGB) {
    	ValueObject row = null;
        int size = (listRowSet != null ? listRowSet.size() : 0);

	    if( listRowSet != null && listRowSet.size() > 0) {

            for( int i = 0 ; i < size ; i++ ) {

                row = RowSetUtility.getValueObject(listRowSet.getRow(i));
                
                if (currencyGB.equals((String)row.get("DETAILCD"))) {
                	return (String)row.get("CHG_CODE01");
                }
            }
	    }
	    
	    return "6";
    }
    
	public RowSet getUseCurrencyGBRowSet() {

        Search search = new SearchImpl();
        RowSet rowSet = null;
        String sqlstr = "";
        try {
        	
        	sqlstr += " SELECT DETAILCD, DETAILNM, F_GET_CURRENCY_DIGIT(DETAILCD) CHG_CODE01 FROM EBID_COM911T      	\n"
            		+ " WHERE BASECD = '911'                    														\n"
            		+ " ORDER BY CHG_CODE20                       														\n" ; 
    
            search.setStatement(sqlstr);
            rowSet = search.execute();
        }
        catch(Exception e) {
    
            WAFLogger.error("SQL : " + search.getStatement());
            WAFLogger.error(e);
        }
        finally {
            if( rowSet == null ) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
	
}
