/**
 * @(#)file    PreRequestSignBiz.java
 * @(#)author  OK
 * @(#)version 1.0
 *
 * Copyright (c) www.udapsoft.co.kr, Inc.
 */
package kr.co.udapsoft.ebid.buyer.payment.purchase.biz;

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.util.ValueObject;
import kr.co.udapsoft.ebid.buyer.common.file.FileManager;

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

/**
 * 
 * @version 1.0
 */
public class PayItemPurDashBoardPopBiz extends Biz {

	public PayItemPurDashBoardPopBiz(HandlerStorage storage) {
		super(storage);
	}

    public void doBiz() throws Exception {
    	
        if(storage.getEvent().equals(""))
        {
            ValueObject vo = new ValueObject();
            RowSet DashList1 = null;
            RowSet DashList2 = null;
            RowSet DashList3 = null;
            RowSet DashList4 = null;
            
            DashList1 = getDashList1(params);
            DashList2 = getDashList2(params);
            DashList3 = getDashList3(params);
            DashList4 = getDashList4(params); //보증

            storage.addRowSet("DashList1", DashList1);  //대금
            storage.addRowSet("DashList2", DashList2);  //계약
            storage.addRowSet("DashList3", DashList3);  //입찰
            storage.addRowSet("DashList4", DashList4);  //보증
        }
        else if(storage.getEvent().equals("GET_FILE_LIST"))
        {
            RowSet fileList = null;
            
            fileList = getTemplateFile(params.get("p_pur_cont_mod_id"));
            
            storage.addRowSet("fileList", fileList);
        }
   }
    
    
    public RowSet getTemplateFile(String pur_cont_cd){

        Search search = new SearchImpl();
        RowSet listRowSet = null;
        StringBuffer sql = new StringBuffer();
        
        try {
            sql.append(" SELECT FILE_ID, UNIQUE_FILE_NAME, FILE_PATH, FILE_EXT,                                                                  		\n");
            sql.append("     TRIM(                                                                                                               		\n");
            sql.append("        CASE                                                                                                             		\n");
            sql.append("       WHEN FILE_SIZE < 1024 THEN TO_CHAR(FILE_SIZE, '999,999') || ' Byte'                                               		\n");
            sql.append("       ELSE                                                                                                              		\n");
            sql.append("            CASE                WHEN FILE_SIZE < (1024*1024) THEN TO_CHAR(FLOOR(FILE_SIZE / 1024), '999,999') || ' KByte'		\n");
            sql.append("             ELSE  TO_CHAR(FLOOR(FILE_SIZE / (1024*1024)), '999,999,999') || ' MByte'                                    		\n");
            sql.append("            END                                                                                                          		\n");
            sql.append("      END ) AS FILE_SIZE, FILE_NAME, PUR_CONT_MOD_ID                                                                                      		\n");
            sql.append(" FROM CONT_PUR_FILE                                                                                                      		\n");
            sql.append(" WHERE PUR_CONT_MOD_ID = ?                                                                                              		\n");
            sql.append(" ORDER BY FILE_ID ASC                                                                                                    		\n");
            search.addParameter(pur_cont_cd);
            
            WAFLogger.debug(sql);
            search.setStatement(sql);
            listRowSet = search.execute();
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            if( listRowSet == null ){
                listRowSet = new RowSetImpl();
            }
        }
        return listRowSet;
    }
    
    
//    public RowSet getTemplateFileOut(String sub_cont_cd){
//
//        Search search = new SearchImpl();
//        RowSet listRowSet = null;
//        StringBuffer sql = new StringBuffer();
//        
//        try {
//            sql.append(" SELECT FILE_ID, UNIQUE_FILE_NAME, FILE_PATH, FILE_EXT,                                                   		\n");
//            sql.append("     TRIM(                                                                                                		\n");
//            sql.append("        CASE                                                                                              		\n");
//            sql.append("       WHEN FILE_SIZE < 1024 THEN TO_CHAR(FILE_SIZE, '999,999') || ' Byte'                                		\n");
//            sql.append("       ELSE                                                                                               		\n");
//            sql.append("            CASE WHEN FILE_SIZE < (1024*1024) THEN TO_CHAR(FLOOR(FILE_SIZE / 1024), '999,999') || ' KByte'		\n");
//            sql.append("             ELSE TO_CHAR(FLOOR(FILE_SIZE / (1024*1024)), '999,999,999') || ' MByte'                      		\n");
//            sql.append("            END                                                                                           		\n");
//            sql.append("      END ) AS FILE_SIZE, FILE_NAME                                                                       		\n");
//            sql.append(" FROM CONT_OUT_FILE                                                                                       		\n");
//            sql.append(" WHERE SUB_CONT_MOD_ID = ?                                                                                		\n");
//            sql.append(" ORDER BY FILE_ID ASC                                                                                     		\n");
//            search.addParameter(sub_cont_cd);
//             
//            WAFLogger.debug(sql);
//            search.setStatement(sql);
//            listRowSet = search.execute();
//        }catch(Exception e){
//            e.printStackTrace();
//        }finally{
//
//            if( listRowSet == null ){
//                listRowSet = new RowSetImpl();
//            }
//            return listRowSet;
//        }
//    }
    
    /**
     * 첨부파일
     * @param filegb
     * @param id
     * @param returnid
     * @return
     */
    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);
                str += (i+1)+" : "+row.get("FILE_NAME")+" ("+ row.get("FILE_SIZE")+")";
                if(i+1!=rowSet.size()){
                    str +="\r\n";
                }
            }
            vo.set(returnid, str);
        return vo;
    }
    
    private ValueObject getfilelistALL(String filegb,String id,String returnid){
        ValueObject vo = new ValueObject();
        RowSet rowSet = getFileListRowSet(filegb, id, null, null, null, null, null);
        String str="";
            for(int i=0;i<rowSet.size();i++){
                Row row=rowSet.getRow(i);
                str += (i+1)+" : "+row.get("FILE_NAME")+" ("+ row.get("FILE_SIZE")+")";
                if(i+1!=rowSet.size()){
                    str +="\r\n";
                }
            }
            vo.set(returnid, str);
        return vo;
    }
    
    
    private RowSet getFileListRowSet(String fileGB, String ID, String openCorpYN, String useConYN, String addGB, String isTechreq, String modNo) {

        Search search = new SearchImpl();
        RowSet rowSet = null;
        StringBuffer sql = new StringBuffer();
        try {
        	
        	sql.append(" SELECT   B.FILE_ID,                                                                                     		\n");
            sql.append("           B.FILE_NAME,                                                                                  		\n");
            sql.append("           B.REAL_FILE_NAME,                                                                             		\n");
            sql.append("           TRIM(                                                                                         		\n");
            sql.append("           CASE                                                                                          		\n");
            sql.append("           WHEN FILE_SIZE < 1024 THEN TO_CHAR(FILE_SIZE, '999,999') || ' Byte'                           		\n");
            sql.append("           ELSE                                                                                          		\n");
            sql.append("                CASE                                                                                     		\n");
            sql.append("                WHEN FILE_SIZE < (1024*1024) THEN TO_CHAR(FLOOR(FILE_SIZE / 1024), '999,999') || ' KByte'		\n");
            sql.append("                ELSE  TO_CHAR(FLOOR(FILE_SIZE / (1024*1024)), '999,999,999') || ' MByte'                 		\n");
            sql.append("                END                                                                                      		\n");
            sql.append("           END ) AS FILE_SIZE,                                                                           		\n");
            sql.append("           B.CRE_DATE AS CRE_DATE,                                                                       		\n");
            sql.append("           A.FILE_MAP_ID, A.FILE_GB, A.ID, A.OPEN_CORP_YN,                                               		\n");
            sql.append("           A.O_FILE_GB, O_ID, USE_CON_YN, TECHREQ_OPEN_YN,                                               		\n");
            sql.append("           A.CRE_BY, A.UPD_BY, B.FILE_EXT,B.CONTENT_TYPE,                                                		\n");
            sql.append("           B.FILE_PATH                                                                                   		\n");
            sql.append("  FROM     PUB0510T A ,                                                                                  		\n");
            sql.append("           PUB0500T B                                                                                    		\n");
            sql.append("  WHERE    A.FILE_ID = B.FILE_ID                                                                         		\n");
            sql.append("  AND      A.FILE_GB = ?                                                                                 		\n");
            search.addParameter(fileGB);
            
            if( openCorpYN != null && !openCorpYN.equalsIgnoreCase("") && !openCorpYN.equalsIgnoreCase("ALL") ) {
            	sql.append("  AND      A.OPEN_CORP_YN = ?                                                                                 		\n");
            	search.addParameter(openCorpYN);
            }          

            if( useConYN != null && !useConYN.equalsIgnoreCase("") && !useConYN.equalsIgnoreCase("ALL") ) {
	            	sql.append("  AND      A.USE_CON_YN = ?                                                                                 		\n");
	            	search.addParameter(useConYN);
            }        

            if( isTechreq != null && !isTechreq.equals("") && !isTechreq.equalsIgnoreCase("ALL") ) {//기술검토의뢰 할때 보여지는 파일
	            	sql.append("  AND      A.TECHREQ_OPEN_YN = ?                                                                                 		\n");
	            	search.addParameter(isTechreq);
            } 

            if( addGB == null || addGB.equalsIgnoreCase("") ) {
                addGB = "F";
            }

            if( addGB != null && !addGB.equalsIgnoreCase("") && !addGB.equalsIgnoreCase("ALL") ) {
	            	sql.append("  AND      A.ADD_GB = ?                                                                                 		\n");
	            	search.addParameter(addGB);
            }
            
            //추가 2004.08.02
            if( (fileGB.equals("PUR_M_CST")||fileGB.equals("SUB_M_CST")) && !modNo.equals("") ) {
	            	sql.append("  AND      A.MOD_NO = ?                                                                                 		\n");
	            	search.addParameter(modNo);
            }

            sql.append("  ORDER BY A.FILE_ID		\n");
            
            search.setStatement(sql);
            WAFLogger.debug("=========FileManager::::첨부파일 목록 start==========");
            WAFLogger.debug(sql);
            WAFLogger.debug(search.getParameters());
            WAFLogger.debug("=========FileManager::::첨부파일 목록 end==========");
            rowSet = search.execute();
        }
        catch(Exception e) {

            WAFLogger.error(this.getClass().getName() + " --> getFileListRowSet() : " + e.getMessage());
            WAFLogger.error("SQL : " + search.getStatement());
            WAFLogger.error(e);
        }
        finally {

            if( rowSet == null ) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    //대금정보 
    private RowSet getDashList1(ValueObject Params) throws Exception
    {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        
        try
        {           
            sqlStr.append(" SELECT                                                                                                                                                  \n");
            sqlStr.append("         DEPOSIT_CD                                                                                                                                             \n");
            sqlStr.append("         ,DEPOSIT_NM                                                                                                                                             \n");
            sqlStr.append("         ,PREPAY_PROC_GB                                                                                                                                             \n");
            sqlStr.append("         ,STATUS_NM                                                                                                                                             \n");
            sqlStr.append("         ,PREPAY_ID                                                                                                                                             \n");
            sqlStr.append("         ,PUR_CONT_MOD_ID                                                                                                                                             \n");
            sqlStr.append("         ,PUR_CONT_ID                                                                                                                                             \n");
            sqlStr.append("         ,TAX_METHOD_CD                                                                                                                                             \n");
            sqlStr.append("         ,CONVERSATION_ID1                                                                                                                                             \n");
            sqlStr.append("         ,CONVERSATION_ID2                                                                                                                                             \n");
            sqlStr.append("         ,(SELECT COUNT(*) CNT  FROM  PUB0510T A,  PUB0500T B WHERE A.FILE_ID = B.FILE_ID AND A.FILE_GB = 'PREPAYMENTS_GIVEUP'  AND   A.ADD_GB = 'F'  AND      A.ID      = NVL(PREPAY_ID, A.ID) )  FILE_NAME         \n");                                                                                                                                             
            sqlStr.append("         ,(SELECT COUNT(*) CNT  FROM  PUB0510T A,  PUB0500T B WHERE A.FILE_ID = B.FILE_ID AND A.FILE_GB = 'PURCHASE_' || PUR_CONT_ID  AND   A.ADD_GB = 'F'  )  FILE_NAME                 \n");
            sqlStr.append("         ,WARR_GUBUN                                                                                                                                             \n");
            sqlStr.append("         ,WARR_GUBUN_NM                                                                                                                                             \n");
            sqlStr.append("         ,GUAR_ONOFF_YN                                                                                                                                                                                                                                                                                         \n");
            sqlStr.append("         ,WARR_SEQ                                                                                                                                                                                                                                                                                         \n");
            sqlStr.append("         ,CAUSECODE                                                                                                                                                                                                                                                                                         \n");
            sqlStr.append("         ,GUAR_STATUS                                                                                                                                                                                                                                                                                         \n");
            sqlStr.append("         ,WARR_GOFFICE_ID                                                                                                                                                                                                                                                                                         \n");
            sqlStr.append("         ,GRTREQNO                                                                                                                                                                                                                                                                                         \n");
            sqlStr.append("         ,MOD_NO                                                                                                                                                                                             \n");
            sqlStr.append("         ,DOC_ID , YEAR                                                                                                                                                                                            \n");
            sqlStr.append("            FROM (                                                                                                                                            \n");
            sqlStr.append("                        --구매 선급금                                                                                                                                            \n");
            sqlStr.append("                        SELECT                                                                                                                                                                                                               \n");
            sqlStr.append("                                    '1' AS DEPOSIT_CD                          --선급금, 중도금 구분                                                                                                                                            \n");
            sqlStr.append("                                    ,F_GET_PUR_STATUS ('1', 'PUR_PAY_ACMP_GB' )  AS DEPOSIT_NM                          --선급금, 중도금 구분                                                                                                                                            \n");
            sqlStr.append("                                    ,B.PREPAY_PROC_GB   AS PREPAY_PROC_GB                  --선급 진행상태                                                                                                                                              \n");
            sqlStr.append("                                    , F_GET_CODE_NAME('PREPAY_STATUS_CD', NVL(B.PREPAY_PROC_GB, '00')) AS STATUS_NM          --선급상태명                                                                                                                                            \n");
            sqlStr.append("                                    ,B.PREPAY_ID               AS PREPAY_ID                           --선급내역ID                                                                                                                                                                                                               \n");
            sqlStr.append("                                    ,A.PUR_CONT_MOD_ID AS PUR_CONT_MOD_ID               -- 발주계약변경ID                                                                                                                                            \n");
            sqlStr.append("                                    ,A.PUR_CONT_ID         AS PUR_CONT_ID                      --  발주계약ID                                                                                                                                            \n");
            sqlStr.append("                                    ,B.TAX_METHOD_CD   AS TAX_METHOD_CD   -- 정발행 역발행 구분                                                                                                                                            \n");
            sqlStr.append("                                    ,C.CONVERSATION_ID   AS  CONVERSATION_ID1 --세금계산서ID                                                                                                                                            \n");
            sqlStr.append("                                    ,D.CONVERSATION_ID   AS  CONVERSATION_ID2 --계산서ID                                                                                                                                            \n");
            sqlStr.append("                                    ,''                                  AS  FILE_NAME        --포기각서                                                                                                                                            \n");
            sqlStr.append("                                    ,''                                AS  ATTCH_NAME    --첨부문서                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_GUBUN                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_GUBUN_NM                                                                                                                                            \n");
            sqlStr.append("                                    ,E.GUAR_ONOFF_YN                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_SEQ                                                                                                                                            \n");
            sqlStr.append("                                    ,E.CAUSECODE                                                                                                                                            \n");
            sqlStr.append("                                    ,E.GUAR_STATUS                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_GOFFICE_ID                                                                                                                                            \n");
            sqlStr.append("                                    ,E.GRTREQNO                                                                                                                                            \n");
            sqlStr.append("                                    ,E.MOD_NO                                                                                                                                            \n");
            sqlStr.append("                                    ,SIGN.DOC_ID    , SIGN.YEAR                                                                                                                                        \n");
            sqlStr.append("                        FROM PUR2000T A, PUR1030T B,                                                                                                                                            \n");
            sqlStr.append("                                (                                                                                                                                            \n");
            sqlStr.append("                                    SELECT                                                                                                                                                                                                       \n");
            sqlStr.append("                                            D.PUR_CONT_MOD_ID                                                                                                                                                                                                                                                   \n");
            sqlStr.append("                                            ,MAX(A.CONVERSATION_ID) CONVERSATION_ID                                                                                                                                                                                                                                                  \n");
            sqlStr.append("                                   FROM XXSB_DTI_MAIN@SMBLIF A                                                                                                                                                                                                                                             \n");
            sqlStr.append("                                          ,XXSB_DTI_STATUS@SMBLIF B                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                          ,ETEC_ERPIF.TAX_INT_INFO C                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                          ,PUR1030T D                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                          ,PUR2000T E                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                          ,XXSB_DTI_NTS@SMBLIF F                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    WHERE C.PAY_DIV = 'P_PREPAY'                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = B.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = C.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND C.PAY_KEY = D.PREPAY_ID                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                    AND D.PUR_CONT_MOD_ID = E.PUR_CONT_MOD_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = F.CONVERSATION_ID(+)                                                                                                                                             \n");
            sqlStr.append("                                    AND A.DTI_TYPE = '01'                                                                                                                                              \n");
            sqlStr.append("                                    GROUP BY D.PUR_CONT_MOD_ID                                                                                                                                         \n");
            sqlStr.append("                                ) C,                                                                                                                                                                                                             \n");
            sqlStr.append("                                (                                                                                                                                            \n");
            sqlStr.append("                                    SELECT                                                                                                                                                                                                       \n");
            sqlStr.append("                                            D.PUR_CONT_MOD_ID                                                                                                                                                                                                                                                   \n");
            sqlStr.append("                                            ,MAX(A.CONVERSATION_ID) CONVERSATION_ID                                                                                                                                                                                                                                                  \n");
            sqlStr.append("                                   FROM XXSB_DTI_MAIN@SMBLIF A                                                                                                                                                                                                                                             \n");
            sqlStr.append("                                          ,XXSB_DTI_STATUS@SMBLIF B                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                          ,ETEC_ERPIF.TAX_INT_INFO C                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                          ,PUR1030T D                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                          ,PUR2000T E                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                          ,XXSB_DTI_NTS@SMBLIF F                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    WHERE C.PAY_DIV = 'P_PREPAY'                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = B.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = C.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND C.PAY_KEY = D.PREPAY_ID                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                    AND D.PUR_CONT_MOD_ID = E.PUR_CONT_MOD_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = F.CONVERSATION_ID(+)                                                                                                                                             \n");
            sqlStr.append("                                    AND A.DTI_TYPE = '02'                                                                                                                                              \n");
            sqlStr.append("                                    GROUP BY D.PUR_CONT_MOD_ID                                                                                                                                         \n");
            sqlStr.append("                                ) D                                                                                                                                                                                                             \n");
            sqlStr.append("                                ,(                                                                                                                                                                                                             \n");
            sqlStr.append("                                            SELECT WARR_GUBUN, F_GET_CODE_NAME('GAUR_KIND',WARR_GUBUN) AS WARR_GUBUN_NM,  GUAR_ONOFF_YN, PUR_CONT_ID, PUR_CONT_MOD_ID, WARR_SEQ, CAUSECODE, GUAR_STATUS                                                     \n");
            sqlStr.append("                                            ,F_GET_CODE_NAME('GUAROFFICEID',GUAR_ORGAN_CODE) AS WARR_GOFFICE_ID, GRTREQNO, MOD_NO                                                   \n");
            sqlStr.append("                                                FROM  CONT_PUR_WARR  WHERE WARR_GUBUN IN ('3') AND CAUSECODE IN ('11')                                                                                                                                                       \n");
            sqlStr.append("                                 ) E                                                                                                                                             \n");
            sqlStr.append("                 			 ,(SELECT KEY_COL2 AS PUR_CONT_MOD_ID, KEY_COL2 AS PREPAY_ID, MAX(DOC_ID) AS DOC_ID ,  TO_CHAR(MAX(CRE_DATE), 'YYYYMMDD') YEAR     \n");
            sqlStr.append("                 			   FROM SIGN001T                              \n");
            sqlStr.append("                  			   WHERE SIGN_CLASS_CD = 'ebid_pprpyD'                     \n");
            sqlStr.append("                  			   AND SIGN_DECI_CLASS = '14'                        \n");
            sqlStr.append("                  			   GROUP BY KEY_COL1, KEY_COL2 ) SIGN                \n");
            sqlStr.append("                        WHERE A.PUR_CONT_MOD_ID = B.PUR_CONT_MOD_ID                                                                                                                                            \n");
            sqlStr.append("                        AND B.PUR_CONT_MOD_ID = C.PUR_CONT_MOD_ID(+)                                                                                                                                            \n");
            sqlStr.append("                        AND B.PUR_CONT_MOD_ID = D.PUR_CONT_MOD_ID(+)                                                                                                                                           \n");
            sqlStr.append("                        AND B.PUR_CONT_MOD_ID = E.PUR_CONT_MOD_ID(+)                                                                                                                                             \n");
            sqlStr.append("                        AND B.PREPAY_ID = SIGN.PREPAY_ID (+)                                                                                                                                                                                                                                                \n");
            sqlStr.append("                        AND A.CON_CLS_YN = '9'                                                                                                                                                                                                                                                                    \n");
            sqlStr.append("                        AND B.PREPAY_AMT > 0                                                                                                                                            \n");
            sqlStr.append("                        UNION ALL                                                                                                                                            \n");
            sqlStr.append("                        --구매 대금                                                                                                                                            \n");
            sqlStr.append("                        SELECT                                                                                                                                             \n");
            sqlStr.append("                                    B.DEPOSIT_CD AS DEPOSIT_CD   --선급금, 중도금 구분                                                                                                                                            \n");
            sqlStr.append("                                    ,F_GET_PUR_STATUS ( B.DEPOSIT_CD, 'PUR_PAY_ACMP_GB' )|| '(' ||    F_GET_PUR_STATUS (     B.DEPOSIT_SEQ , 'PUR_PAY_ACMP_CHASU' ) || ')' DEPOSIT_NM   --선급금, 중도금 구분                                                                                                                                            \n");
            sqlStr.append("                                    ,B.REQ_STATUS   AS PREPAY_PROC_GB                  --대금 진행상태                                                                                                                                            \n");
            sqlStr.append("                                    , F_GET_CODE_NAME('PURCHASE_STATUS_CD', B.REQ_STATUS) AS STATUS_NM          --대금지행상태명                                                                                                                                              \n");
            sqlStr.append("                                    ,B.PAYREQ_ID               AS PREPAY_ID                           --대금내역ID                                                                                                                                            \n");
            sqlStr.append("                                    ,A.PUR_CONT_MOD_ID AS PUR_CONT_MOD_ID               -- 발주계약변경ID                                                                                                                                            \n");
            sqlStr.append("                                    ,A.PUR_CONT_ID         AS PUR_CONT_ID                      --  발주계약ID                                                                                                                                            \n");
            sqlStr.append("                                    ,B.TAX_METHOD_CD   AS TAX_METHOD_CD   -- 정발행 역발행 구분                                                                                                                                            \n");
            sqlStr.append("                                    ,C.CONVERSATION_ID   AS  CONVERSATION_ID1 --세금계산서ID                                                                                                                                            \n");
            sqlStr.append("                                    ,D.CONVERSATION_ID   AS  CONVERSATION_ID2 --계산서ID                                                                                                                                            \n");
            sqlStr.append("                                    ,''             AS  FILE_NAME        --포기각서                                                                                                                                            \n");
            sqlStr.append("                                    ,''                                AS  ATTCH_NAME    --첨부문서                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_GUBUN                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_GUBUN_NM                                                                                                                                            \n");
            sqlStr.append("                                    ,E.GUAR_ONOFF_YN                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_SEQ                                                                                                                                            \n");
            sqlStr.append("                                    ,E.CAUSECODE                                                                                                                                            \n");
            sqlStr.append("                                    ,E.GUAR_STATUS                                                                                                                                            \n");
            sqlStr.append("                                    ,E.WARR_GOFFICE_ID                                                                                                                                            \n");
            sqlStr.append("                                    ,E.GRTREQNO                                                                                                                                            \n");
            sqlStr.append("                                    ,E.MOD_NO                                                                                                                                            \n");
            sqlStr.append("                                    ,SIGN.DOC_ID  , SIGN.YEAR                                                                                                                                          \n");
            sqlStr.append("                        FROM (                                                                                                                                             \n");
            sqlStr.append("                                    SELECT A.*                                                                                                                                            \n");
            sqlStr.append("                                    FROM PUR2000T A, PUR1000T B                                                                                                                                            \n");
            sqlStr.append("                                    WHERE  A.PUR_CONT_ID = B.PUR_CONT_ID                                                                                                                                            \n");
            sqlStr.append("                                  ) A, PUR1100T B,                                                                                                                                            \n");
            sqlStr.append("                                  (                                                                                                                                            \n");
            sqlStr.append("                                    SELECT                                                                                                                                                                                  \n");
            sqlStr.append("                                                D.PUR_CONT_MOD_ID                                                                                                                                                                                                                                                   \n");
            sqlStr.append("                                                ,MAX(A.CONVERSATION_ID) CONVERSATION_ID                                                                                                                                                                                                                                                  \n");
            sqlStr.append("                                    FROM XXSB_DTI_MAIN@SMBLIF A                                                                                                                                                                                                                                             \n");
            sqlStr.append("                                            ,XXSB_DTI_STATUS@SMBLIF B                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                            ,ETEC_ERPIF.TAX_INT_INFO C                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                            ,PUR1100T D                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                            ,PUR2000T E                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                            ,XXSB_DTI_NTS@SMBLIF F                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    WHERE C.PAY_DIV = 'P_PAYREQ'                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = B.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = C.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND C.PAY_KEY = D.PAYREQ_ID                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                    AND D.PUR_CONT_MOD_ID = E.PUR_CONT_MOD_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = F.CONVERSATION_ID(+)                                                                                                                                            \n");
            sqlStr.append("                                    AND A.DTI_TYPE = '01'                                                                                                                                              \n");
            sqlStr.append("                                    GROUP BY D.PUR_CONT_MOD_ID                                                                                                                                         \n");
            sqlStr.append("                                   ) C,                                                                                                                                            \n");
            sqlStr.append("                                  (                                                                                                                                            \n");
            sqlStr.append("                                    SELECT                                                                                                                                                                                  \n");
            sqlStr.append("                                                D.PUR_CONT_MOD_ID                                                                                                                                                                                                                                                   \n");
            sqlStr.append("                                                ,MAX(A.CONVERSATION_ID) CONVERSATION_ID                                                                                                                                                                                                                                                  \n");
            sqlStr.append("                                    FROM XXSB_DTI_MAIN@SMBLIF A                                                                                                                                                                                                                                             \n");
            sqlStr.append("                                            ,XXSB_DTI_STATUS@SMBLIF B                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                            ,ETEC_ERPIF.TAX_INT_INFO C                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                            ,PUR1100T D                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                            ,PUR2000T E                                                                                                                                                                                                                                                        \n");
            sqlStr.append("                                            ,XXSB_DTI_NTS@SMBLIF F                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    WHERE C.PAY_DIV = 'P_PAYREQ'                                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = B.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = C.CONVERSATION_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND C.PAY_KEY = D.PAYREQ_ID                                                                                                                                                                                                                                            \n");
            sqlStr.append("                                    AND D.PUR_CONT_MOD_ID = E.PUR_CONT_MOD_ID                                                                                                                                                                                                                                \n");
            sqlStr.append("                                    AND A.CONVERSATION_ID = F.CONVERSATION_ID(+)                                                                                                                                            \n");
            sqlStr.append("                                    AND A.DTI_TYPE = '02'                                                                                                                                              \n");
            sqlStr.append("                                    GROUP BY D.PUR_CONT_MOD_ID                                                                                                                                         \n");
            sqlStr.append("                                   ) D                                                                                                                                            \n");
            sqlStr.append("                                   ,(        SELECT WARR_GUBUN, F_GET_CODE_NAME('GAUR_KIND',WARR_GUBUN) AS WARR_GUBUN_NM,  GUAR_ONOFF_YN, PUR_CONT_ID, PUR_CONT_MOD_ID, WARR_SEQ, CAUSECODE, GUAR_STATUS                                                     \n");
            sqlStr.append("                                            ,F_GET_CODE_NAME('GUAROFFICEID',GUAR_ORGAN_CODE) AS WARR_GOFFICE_ID, GRTREQNO, MOD_NO                                                   \n");
            sqlStr.append("                                                FROM  CONT_PUR_WARR  WHERE WARR_GUBUN IN ('5') --AND CAUSECODE IN ('11')                                                                                                                                                       \n");
            sqlStr.append("                                   ) E                                                                                                                                             \n");

            sqlStr.append("                 			 ,(SELECT KEY_COL2 AS PUR_CONT_MOD_ID, KEY_COL2 AS PAYREQ_ID, MAX(DOC_ID) AS DOC_ID    ,  TO_CHAR(MAX(CRE_DATE), 'YYYYMMDD') YEAR     \n");
            sqlStr.append("                 			   FROM SIGN001T                              \n");
            sqlStr.append("                  			   WHERE SIGN_CLASS_CD = 'ebid_ppyD'                     \n");
            sqlStr.append("                  			   AND SIGN_DECI_CLASS = '14'                        \n");
            sqlStr.append("                  			   GROUP BY KEY_COL1, KEY_COL2 ) SIGN                \n");

            sqlStr.append("                        WHERE A.PUR_CONT_MOD_ID = B.PUR_CONT_MOD_ID                                                                                                                                            \n");
            sqlStr.append("                        AND B.PUR_CONT_MOD_ID = C.PUR_CONT_MOD_ID(+)                                                                                                                                             \n");
            sqlStr.append("                        AND C.PUR_CONT_MOD_ID = D.PUR_CONT_MOD_ID(+)                                                                                                                                             \n");
            sqlStr.append("                        AND B.PUR_CONT_MOD_ID = E.PUR_CONT_MOD_ID(+)                                                                                                                                             \n");
            sqlStr.append("                        AND B.PAYREQ_ID = SIGN.PAYREQ_ID(+)                                                                                                                                             \n");
            sqlStr.append("                    ) A                                                                                                                                            \n");
            sqlStr.append("            WHERE 1=1                                                                                                                                            \n");
            sqlStr.append("            AND A.PUR_CONT_ID = ?    --'7063' ;                                                                                                                                             \n");
            sqlStr.append("            ORDER BY PREPAY_ID                                                                                                                                          \n");
                        
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("purContId"));
            
            
            WAFLogger.debug(sqlStr.toString());
            WAFLogger.debug(search.getParameters());
            
            rowSet = search.execute();
        }
        catch (Exception se) {
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            
            se.printStackTrace();
            throw new Exception(se);
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
        }
        return rowSet;
    }
    
    //계약정보 
    private RowSet getDashList2(ValueObject Params) throws Exception
    {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        
        try
        {           
            sqlStr.append("         SELECT DECODE(A.MOD_NO,0,'당초계약','변경계약') MOD_DESC -- 구분                                                \n");
            sqlStr.append("                   ,A.MOD_NO -- 차수                                                                                                            \n");
            sqlStr.append("                   ,A.ORD_DOC_NO -- 계약번호                                                                                  \n");
            sqlStr.append("                   ,A.CST_DOC_NAME -- 계약명                                                                                                                             \n");
            sqlStr.append("                   ,A.PUR_CONT_ID                                                                                                               \n");
            sqlStr.append("                   ,A.PUR_CONT_MOD_ID                                                                                                               \n");
            sqlStr.append("                   ,(SELECT COUNT(*) CNT FROM  CONT_PUR_FILE  WHERE PUR_CONT_MOD_ID =  A.PUR_CONT_MOD_ID) AUTO_CNT                       \n");
            sqlStr.append("                   ,(SELECT COUNT(*) CNT FROM  PUB0510T A,  PUB0500T B WHERE A.FILE_ID = B.FILE_ID AND A.FILE_GB = 'PUR_CONT_MOD_ID'  AND   A.ADD_GB = 'F'  AND A.ID      = NVL(A.PUR_CONT_MOD_ID, A.ID) )  FILE_CNT         \n");
            sqlStr.append("                   ,DECODE(A.MOD_NO, 0, SIGN3.DOC_ID, SIGN4.DOC_ID) AS DOC_ID0                                                \n");//2016.4.12 발주의뢰,변경청구
            sqlStr.append("                   ,DECODE(A.MOD_NO, 0, SIGN3.YEAR, SIGN4.YEAR) AS YEAR0                                                \n");//2016.4.12 발주의뢰,변경청구
            sqlStr.append("                   ,DECODE(A.MOD_NO, 0, SIGN.DOC_ID, SIGN2.DOC_ID) AS DOC_ID                                                \n");
            sqlStr.append("                   ,DECODE(A.MOD_NO, 0, SIGN.YEAR, SIGN2.YEAR) AS YEAR                                                \n");
            
            //DECODE(AUTH_CHK.CNT, 0, , '')--2015.11.4 회계,구매,외주,전산만 시행결의 확인가능. 
            sqlStr.append("              FROM PUR2000T A                                                                                                                                               \n");
            sqlStr.append("                  ,(SELECT KEY_COL1 AS BID_NO, KEY_COL2 AS BID_DEG, KEY_COL3 CORP_ID, MAX(DOC_ID) AS DOC_ID  ,  TO_CHAR(MAX(CRE_DATE), 'YYYYMMDD') YEAR  \n");
            sqlStr.append("                    FROM SIGN001T                              \n");
            sqlStr.append("                   WHERE SIGN_CLASS_CD = 'ebid_ppoD'                     \n");
            sqlStr.append("                   AND SIGN_DECI_CLASS = '14'                        \n");
            sqlStr.append("                   GROUP BY KEY_COL1, KEY_COL2, KEY_COL3 ) SIGN                \n");
            sqlStr.append("                  ,(SELECT KEY_COL1 AS PUR_CONT_MOD_ID, MAX(DOC_ID) AS DOC_ID  ,  TO_CHAR(MAX(CRE_DATE), 'YYYYMMDD') YEAR  \n");
            sqlStr.append("                    FROM SIGN001T                              \n");
            sqlStr.append("                   WHERE SIGN_CLASS_CD = 'ebid_pcpoD'                     \n");
            sqlStr.append("                   AND SIGN_DECI_CLASS = '14'                        \n");
            sqlStr.append("                   GROUP BY KEY_COL1, KEY_COL2 ) SIGN2                \n");
            sqlStr.append("                  --구매 발주의뢰                                                   \n");
            sqlStr.append("                  , (SELECT MAX(DOC_ID) DOC_ID, A.PUR_CONT_MOD_ID ,  TO_CHAR(MAX(C.CRE_DATE), 'YYYYMMDD') YEAR                            \n");
            sqlStr.append("                  FROM PUR2000T A                            \n");
            sqlStr.append("                  ,BID_MASTER B                            \n");
            sqlStr.append("                  ,SIGN001T C                            \n");
            sqlStr.append("                  WHERE  A.BID_NO = B.BID_NO                            \n");
            sqlStr.append("                  AND A.BID_DEG = B.BID_DEG                            \n");
            sqlStr.append("                  AND C.SIGN_CLASS_CD = ( 'prD')                            \n");
            sqlStr.append("                  AND C.KEY_COL1 = B.DEMANDED_ID                            \n");
            sqlStr.append("                  AND C.KEY_COL2 = B.DEPT_CD                            \n");
            sqlStr.append("                  AND A.PUR_CONT_ID =   ?                             \n");
            sqlStr.append("                  AND C.SIGN_DECI_CLASS = 14                             \n");
            sqlStr.append("                  GROUP BY   A.PUR_CONT_MOD_ID                             \n");
            sqlStr.append("                  UNION ALL                            \n");
            sqlStr.append("                  --배관 발주의뢰                             \n");
            sqlStr.append("                  SELECT MAX(DOC_ID) DOC_ID, A.PUR_CONT_MOD_ID,  TO_CHAR(MAX(C.CRE_DATE), 'YYYYMMDD') YEAR                                \n");
            sqlStr.append("                  FROM PUR2000T  A                            \n");
            sqlStr.append("                  ,ETECEPC.MR_REQ_PO  B  --배관테이블 검색.                             \n");
            sqlStr.append("                  ,SIGN001T C                            \n");
            sqlStr.append("                  WHERE  A.REQ_DOC_NO = B.MR_NO                            \n");
            sqlStr.append("                  AND C.SIGN_CLASS_CD = 'ebid_mrD'                            \n");
            sqlStr.append("                  AND C.KEY_COL1 = B.REQ_ID                            \n");
            sqlStr.append("                  AND C.KEY_COL2 = B.REQ_PO_ID                            \n");
            sqlStr.append("                  AND A.PUR_CONT_ID = ?                              \n"); 
            sqlStr.append("                  AND C.SIGN_DECI_CLASS = 14                             \n");
            sqlStr.append("                  AND B.PO_TYPE = 'I'                            \n");
            sqlStr.append("                  GROUP BY   A.PUR_CONT_MOD_ID                             \n");
            sqlStr.append("                  ) SIGN3                          \n");
            sqlStr.append("                  --변경계약 요청                             \n");
            sqlStr.append("                  ,(SELECT  MAX(B.ERP_SIGN_DOC_ID) DOC_ID, A.PUR_CONT_MOD_ID,  MAX(B.ERP_SIGN_YEAR) AS YEAR                              \n");
            sqlStr.append("                  FROM PUR2000T  A                            \n");
            sqlStr.append("                  ,PUR2000T  A1                            \n");
            sqlStr.append("                  ,PMM_DEMANDED_REQUEST B                            \n");
            sqlStr.append("                  WHERE A.PUR_CONT_ID = A1.PUR_CONT_ID                            \n");
            sqlStr.append("                  AND A.MOD_NO -1 = A1.MOD_NO                             \n");
            sqlStr.append("                  AND A1.REQ_DOC_NO = B.DEMANDED_NO                            \n");
            sqlStr.append("                  AND B.PR_TYPE = '30'                            \n");
            sqlStr.append("                  AND A.PUR_CONT_ID = ?                             \n");
            sqlStr.append("                  GROUP BY A.PUR_CONT_MOD_ID  ) SIGN4                              \n");
            //sqlStr.append("                  ,(SELECT COUNT(*) CNT                         \n");
            //sqlStr.append("                      FROM PUB0350T                          \n");
            //sqlStr.append("                     WHERE ACCT_ID = ?                       \n");
            //sqlStr.append("                       AND RIGHT_ID = 164 ) AUTH_CHK                         \n");
            
            sqlStr.append("                   WHERE PUR_CONT_ID = ?                                                                                                                               \n");
            sqlStr.append("                     AND A.BID_NO = SIGN.BID_NO(+)                                                                                                                             \n");
            sqlStr.append("                     AND A.BID_DEG = SIGN.BID_DEG(+) AND A.CORP_ID = SIGN.CORP_ID(+)                                      \n");
            sqlStr.append("                     AND A.PUR_CONT_MOD_ID = SIGN2.PUR_CONT_MOD_ID(+)                                                     \n");
            sqlStr.append("                     AND A.PUR_CONT_MOD_ID = SIGN3.PUR_CONT_MOD_ID(+)                                                     \n");
            sqlStr.append("                     AND A.PUR_CONT_MOD_ID = SIGN4.PUR_CONT_MOD_ID(+)                                                     \n");
            sqlStr.append("                     AND (A.STATUS_CD = '50' OR A.CON_RUN_STS = '9')                                                                                                                              \n");
            sqlStr.append("                  ORDER BY A.MOD_NO                                                                                       \n");
            
            search.setStatement(sqlStr.toString());
            //search.addParameter(storage.getUser().getInt("ACCT_ID")); 2015.11.4
            search.addParameter(params.get("purContId"));
            search.addParameter(params.get("purContId"));
            search.addParameter(params.get("purContId"));
            search.addParameter(params.get("purContId"));
            
            WAFLogger.debug(sqlStr.toString());
            
            rowSet = search.execute();
        }
        catch (Exception se) {
        	WAFLogger.error(se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            
            se.printStackTrace();
            throw new Exception(se);
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
        }
        return rowSet;
    }
    
    //입찰정보
    private RowSet getDashList3(ValueObject Params) throws Exception
    {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        
        try
        {           
            sqlStr.append("        SELECT B.BID_NO -- 입찰번호                                          \n");
            sqlStr.append("                ,B.BID_DEG -- 입찰차수                                          \n");
            sqlStr.append("                ,BID_MASTER_NM -- 입찰명                                          \n");
            sqlStr.append("                ,B.DEMANDED_ID                                         \n");
            sqlStr.append("                ,B.DOC_ETC_IN                                         \n");
            sqlStr.append("                ,B.DOC_ETC_OUT                                         \n");
            sqlStr.append("                ,C.FILE_GB                                         \n");
            sqlStr.append("                ,B.PBC_CBE_TYPE_CD                                         \n");
            sqlStr.append("                ,(SELECT COUNT(*) CNT  FROM  PUB0510T A,  PUB0500T B WHERE A.FILE_ID = B.FILE_ID AND A.FILE_GB = 'BID_IN_1'  AND   A.ADD_GB = 'F'   AND A.ID  = NVL(B.DEMANDED_ID, A.ID) ) BID_IN_CNT                                         \n");
            sqlStr.append("                ,(SELECT COUNT(*) CNT  FROM  PUB0510T A,  PUB0500T B WHERE A.FILE_ID = B.FILE_ID AND A.FILE_GB = 'BID_OUT_1'  AND   A.ADD_GB = 'F'   AND A.ID  = NVL(B.DEMANDED_ID, A.ID) ) BID_OUT_CNT                                         \n");
            sqlStr.append("                ,(SELECT COUNT(*) CNT  FROM  PUB0510T A,  PUB0500T B WHERE A.FILE_ID = B.FILE_ID AND A.FILE_GB = C.FILE_GB  AND   A.ADD_GB = 'F'   AND A.ID  = NVL(B.DEMANDED_ID, A.ID) ) CORP_CNT                                         \n");
            
            sqlStr.append("                ,SIGN.DOC_ID, SIGN.YEAR                                         \n");
            
            sqlStr.append("                FROM PUR2000T A                                          \n");
            sqlStr.append("                 ,BID_MASTER B                                          \n");
            sqlStr.append("                  ,BID_SUPP C                                          \n");
            //sqlStr.append("                  ,(SELECT KEY_COL1 AS BID_NO, KEY_COL2 AS BID_DEG, MAX(DOC_ID) AS DOC_ID  ,  TO_CHAR(MAX(CRE_DATE), 'YYYYMMDD') YEAR  \n");
            sqlStr.append("                  ,(SELECT KEY_COL1 AS BID_NO, MAX(DOC_ID) AS DOC_ID  ,  TO_CHAR(MAX(CRE_DATE), 'YYYYMMDD') YEAR  \n");
            sqlStr.append("                    FROM SIGN001T                              \n");
            sqlStr.append("                   WHERE SIGN_CLASS_CD IN ('ebid_pinqD' ,'ebid_prebqD')                    \n");
            sqlStr.append("                   AND SIGN_DECI_CLASS = '14'                        \n");
            sqlStr.append("                   GROUP BY KEY_COL1 ) SIGN                \n");

            sqlStr.append("                WHERE A.BID_NO = B.BID_NO                                          \n");
            sqlStr.append("                AND A.BID_DEG = B.BID_DEG                                          \n");
            sqlStr.append("                AND B.BID_NO = C.BID_NO                                         \n");
            sqlStr.append("                AND B.BID_DEG = C.BID_DEG                                         \n");
            sqlStr.append("                AND B.BID_NO = SIGN.BID_NO(+)                                         \n");
           // sqlStr.append("                AND B.BID_DEG = SIGN.BID_DEG(+)                                         \n");
            sqlStr.append("                AND C.SUCC_YN = 'Y'                                         \n");
            sqlStr.append("                AND A.PUR_CONT_MOD_ID in (SELECT MIN(PUR_CONT_MOD_ID) FROM PUR2000T WHERE PUR_CONT_ID = ?)                                          \n");
                          
                        
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("purContId"));
            
            WAFLogger.debug(sqlStr.toString());
            
            rowSet = search.execute();
        }
        catch (Exception se) {
        	WAFLogger.error(se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            
            se.printStackTrace();
            throw new Exception(se);
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
        }
        return rowSet;
    }
    
    //보증정보
    private RowSet getDashList4(ValueObject Params) throws Exception
    {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try
        {           
            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("                    , TO_CHAR(TO_DATE(PAPERDATE, 'YYYYMMDD'), 'YYYY-MM-DD') PAPERDATE  \n");
            sqlStr.append("                    , WARR_WGNO  \n");
            sqlStr.append("                    , TO_CHAR(TO_DATE(WARR_SDATE, 'YYYYMMDD'), 'YYYY-MM-DD') WARR_SDATE  \n");
            sqlStr.append("                    , TO_CHAR(TO_DATE(WARR_EDATE, 'YYYYMMDD'), 'YYYY-MM-DD') 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("                    , PUR_CONT_MOD_ID   \n");
            sqlStr.append("                 FROM CONT_PUR_WARR  \n");
            sqlStr.append("                WHERE PUR_CONT_ID = ?     \n");
            sqlStr.append("                ORDER BY WARR_GUBUN ASC     \n");
                          
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("purContId"));
            
            WAFLogger.debug(sqlStr.toString());
            
            rowSet = search.execute();
        }
        catch (Exception se) {
        	WAFLogger.error(se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            
            se.printStackTrace();
            throw new Exception(se);
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
        }
        return rowSet;
    }
    
}
