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

import oracle.toplink.internal.ox.StrBuffer;
import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
import kr.co.hsnc.common.sql.WAFSQLException;
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;

/**
 * 
 * @version 1.0
 */
public class ContSignBiz extends Biz {
	FileManager FileManager = new FileManager();
	public ContSignBiz(HandlerStorage storage) {
		super(storage);
	}

	public void doBiz() throws Exception {
    	//WAFLogger.debug("### ContSignBiz_외주");
    	//WAFLogger.debug("### storage : " + storage.getUser());
    	//WAFLogger.debug("### params : " + params);
		
		ValueObject vo = new ValueObject();

		vo = getContInfo(params.get("sign_cont_mod_id"), params.get("acct_id"));
		
    	//WAFLogger.debug("### vo.size() : " + vo.get("CON_DOC_NO"));
        //String doctitle = "-"+vo.get("CST_DOC_NAME")+ "_" +vo.get("DEPT_NM");
        //2015.8.10 조재윤과장 요청 변경.
        String doctitle = "["+vo.get("DEPT_NM") + "]" + vo.get("CST_DOC_NAME");
        vo.set("doctitle", doctitle);   	
    	
		storage.addValueObject("ContInfo", vo);

		//자동 저장 파일
		RowSet rowSet = getTemplateFile(params.get("sign_cont_mod_id"));
		storage.addRowSet("AUTOFILE_LIST", rowSet);          
   }
	
	 /**
     * 계약서식 조회 combo 조회
	 * @param 
	 * @param 
	 * @return RowSet 
	 */
	public RowSet getTemplateFile(String sub_cont_cd){

        Search search = new SearchImpl();
        RowSet listRowSet = null;
        String sqlstr = "";
        
        try {
            sqlstr += " SELECT FILE_ID, UNIQUE_FILE_NAME, FILE_PATH, FILE_EXT,          \n"   
            		+ "		TRIM(          \n"              
            		+ "        CASE                         \n"
				    + "       WHEN FILE_SIZE < 1024 THEN TO_CHAR(FILE_SIZE, '999,999') || ' Byte'          \n"
				    + "       ELSE          \n"
				    + "            CASE                WHEN FILE_SIZE < (1024*1024) THEN TO_CHAR(FLOOR(FILE_SIZE / 1024), '999,999') || ' KByte'          \n"
				    + "             ELSE  TO_CHAR(FLOOR(FILE_SIZE / (1024*1024)), '999,999,999') || ' MByte'          \n"
				    + "            END                           \n"                              
				    + "      END ) AS FILE_SIZE, FILE_NAME         \n"
                    + " FROM CONT_OUT_FILE      					\n"
                    + " WHERE SUB_CONT_MOD_ID =  '"+sub_cont_cd+"'		\n"
		            + " ORDER BY FILE_ID ASC      				\n";
             
            search.setStatement(sqlstr);
            listRowSet = search.execute();
			
		}catch(Exception e){
			e.printStackTrace();
		}finally{

			if( listRowSet == null ){
            	listRowSet = new RowSetImpl();
            }
            
			return listRowSet;
		}
	}
	public ValueObject getContInfo(String sign_cont_mod_id, String acct_id) {
		Search search = new SearchImpl();
		RowSet listRowSet = null;
		StrBuffer sqlstr = new StrBuffer();
		ValueObject rowObject = null;

		try {
			
			sqlstr.append("        SELECT DEPART_DEPT_NM -- 요청부서                                                                                                                       \n");                                
			sqlstr.append("        ,M_MEMBER_NAME -- 사업주명                                                                                                                              \n");                                
			sqlstr.append("        ,S_MEMBER_NAME -- 공급자                                                                                                                                \n");                                
			sqlstr.append("        ,F_GET_USER_NM('"+acct_id+"') AS USER_NAME                                                                                                              \n");
			sqlstr.append("        ,CRE_DATE                                                                                                                                               \n");
			sqlstr.append("        ,SUB_CONT_MOD_ID                                                                                                                                        \n");
			sqlstr.append("        ,ORD_DOC_NO    --계약번호                                                                                                                               \n");                               
			sqlstr.append("        ,GET_DEPT_NM(DEPT_CD) AS DEPT_NM  --현장명                                                                                                              \n");                                               
			sqlstr.append("        ,CST_DOC_NAME -- 계약명                                                                                                                                 \n");                                
			sqlstr.append("        ,FRST_ORD_SUPPLY_AMT -- 원계약금액                                                                                                                      \n");                                
			sqlstr.append("        ,CHG_ORD_SUPPLY_AMT-- 현_계약금액                                                                                                                       \n");                                
			sqlstr.append("        ,CASE WHEN NVL(FRST_ORD_SUPPLY_AMT,0) > 0 AND NVL(CHG_ORD_SUPPLY_AMT,0) > 0THEN                                                                         \n");              
			sqlstr.append("        CASE WHEN FRST_ORD_SUPPLY_AMT > CHG_ORD_SUPPLY_AMT THEN F_GET_D_CURRENCY((FRST_ORD_SUPPLY_AMT - CHG_ORD_SUPPLY_AMT),digit)||' (▼)'                     \n");                                       
			sqlstr.append("        WHEN FRST_ORD_SUPPLY_AMT < CHG_ORD_SUPPLY_AMT THEN F_GET_D_CURRENCY((CHG_ORD_SUPPLY_AMT - FRST_ORD_SUPPLY_AMT),digit)||' (▲)'                          \n");                                       
			sqlstr.append("        ELSE '변동 없음'                                                                                                                                        \n");              
			sqlstr.append("        END                                                                                                                                                     \n");              
			sqlstr.append("        END ORD_SUPPLY_NM                                                                                                                                       \n");              
			sqlstr.append("        ,CASE WHEN NVL(CHG_EXE_AMT,0) > 0 AND NVL(CHG_ORD_SUPPLY_AMT,0) > 0THEN                                                                         \n");              
			sqlstr.append("        CASE WHEN CHG_EXE_AMT != CHG_ORD_SUPPLY_AMT THEN  F_GET_D_CURRENCY(ROUND(CHG_ORD_SUPPLY_AMT / CHG_EXE_AMT * 100,1),1)||'%' END          \n");                                   
			sqlstr.append("        END ORD_SUPPLY_BIGO                                                                                                                                     \n");              
			sqlstr.append("        ,FRST_CON_AMT -- 원도급금액                                                                                                                             \n");                                                                                        
			sqlstr.append("        ,CHG_CON_AMT -- 현_도급금액                                                                                                                             \n");                                                                                        
			sqlstr.append("        ,CASE WHEN NVL(FRST_CON_AMT,0) > 0 AND NVL(CHG_CON_AMT,0) > 0THEN                                                                                       \n");              
			sqlstr.append("        CASE WHEN FRST_CON_AMT > CHG_CON_AMT THEN F_GET_D_CURRENCY((FRST_CON_AMT - CHG_CON_AMT),0)||' (▼)'                                                     \n");                                   
			sqlstr.append("        WHEN FRST_CON_AMT < CHG_CON_AMT THEN F_GET_D_CURRENCY((CHG_CON_AMT - FRST_CON_AMT),0)||' (▲)'                                                          \n");                                   
			sqlstr.append("        ELSE '변동 없음'                                                                                                                                        \n");              
			sqlstr.append("        END                                                                                                                                                     \n");              
			sqlstr.append("        END CON_AMT_NM                                                                                                                                          \n");              
			sqlstr.append("        ,CASE WHEN NVL(FRST_CON_AMT,0) > 0 AND NVL(CHG_CON_AMT,0) > 0THEN                                                                                       \n");              
			//sqlstr.append("        CASE WHEN FRST_CON_AMT != CHG_CON_AMT THEN F_GET_D_CURRENCY(ROUND(CHG_CON_AMT / FRST_CON_AMT * 100,1),1)||'%' END                                       \n");
			sqlstr.append("        CASE WHEN FRST_CON_AMT != CHG_CON_AMT THEN F_GET_D_CURRENCY(ROUND(CHG_ORD_SUPPLY_AMT / CHG_CON_AMT * 100,1),1)||'%' END                                       \n");
			sqlstr.append("        END CON_AMT_BIGO                                                                                                                                        \n");              
			sqlstr.append("        ,FRST_EXE_AMT -- 원_실행금액                                                                                                                            \n");                                                                                        
			sqlstr.append("        ,CHG_EXE_AMT -- 현_실행금액                                                                                                                             \n");                                                                                        
			sqlstr.append("        ,CASE WHEN NVL(FRST_EXE_AMT,0) > 0 AND NVL(CHG_EXE_AMT,0) > 0THEN                                                                                       \n");              
			sqlstr.append("        CASE WHEN FRST_EXE_AMT > CHG_EXE_AMT THEN F_GET_D_CURRENCY((FRST_EXE_AMT - CHG_EXE_AMT),0)||' (▼)'                                                     \n");                                   
			sqlstr.append("        WHEN FRST_EXE_AMT < CHG_EXE_AMT THEN F_GET_D_CURRENCY((CHG_EXE_AMT - FRST_EXE_AMT),0)||' (▲)'                                                          \n");                                   
			sqlstr.append("        ELSE '변동 없음'                                                                                                                                        \n");              
			sqlstr.append("        END                                                                                                                                                     \n");              
			sqlstr.append("        END EXE__NM                                                                                                                                             \n");              
			sqlstr.append("        ,CASE WHEN NVL(FRST_EXE_AMT,0) > 0 AND NVL(CHG_EXE_AMT,0) > 0THEN                                                                                       \n");              
			//sqlstr.append("        CASE WHEN FRST_EXE_AMT != CHG_EXE_AMT THEN F_GET_D_CURRENCY(ROUND(CHG_EXE_AMT / FRST_EXE_AMT * 100,1),1)||'%' END                                       \n");
			sqlstr.append("        CASE WHEN FRST_EXE_AMT != CHG_EXE_AMT THEN F_GET_D_CURRENCY(ROUND(CHG_ORD_SUPPLY_AMT / CHG_EXE_AMT * 100,1),1)||'%' END                                       \n");
			sqlstr.append("        END EXE__BIGO                                                                                                                                           \n");              
			sqlstr.append("        ,CASE WHEN FRST_ORD_END_DATE IS NOT NULL AND CHG_ORD_END_DATE IS NOT NULL THEN                                                                          \n");              
			sqlstr.append("        CASE WHEN FRST_ORD_END_DATE - CHG_ORD_END_DATE < 0 THEN '연장('||TO_NUMBER(CHG_ORD_END_DATE - FRST_ORD_END_DATE  )||'일)'                               \n");                  
			sqlstr.append("        WHEN FRST_ORD_END_DATE - CHG_ORD_END_DATE > 0 THEN '단축('||TO_NUMBER(FRST_ORD_END_DATE - CHG_ORD_END_DATE )||'일)'                                     \n");                  
			sqlstr.append("        ELSE '(변경없음)'                                                                                                                                            \n");               
			sqlstr.append("        END                                                                                                                                                     \n");              
			sqlstr.append("        END ORD_DATE_NM                                                                                                                                         \n");              
			sqlstr.append("        ,TO_CHAR(CHG_ORD_START_DATE, 'YYYY-MM-DD') AS CHG_ORD_START_DATE -- 현_납품시작일                                                                       \n");                                                                                     
			sqlstr.append("        ,FRST_ORD_END_DATE -- 원_납품종료일                                                                                                                     \n");                                                                                    
			sqlstr.append("        ,TO_CHAR(CHG_ORD_END_DATE, 'YYYY-MM-DD') AS  CHG_ORD_END_DATE-- 현_납품종료일                                                                           \n");                                                                                   
			sqlstr.append("        ,IN_SPE_INFO -- 내부특기사항                                                                                                                            \n");                                                                                        
			sqlstr.append("        ,IN_CHG_INFO -- 내부변경사유                                                                                                                            \n");                                                                                        
			sqlstr.append("        ,DIGIT AS DIGIT                                                                                                                                         \n");                                                                           
			sqlstr.append("        ,CASE WHEN CURRENCY_GB = 'KRW' THEN '일금'                                                                                                              \n");                                                                                                      
			sqlstr.append("                   ELSE CHG_CODE09                                                                                                                              \n");                                                                                      
			sqlstr.append("         END BEF_HAN                                                                                                                                            \n");                                                                       
			sqlstr.append("        ,CASE WHEN CURRENCY_GB = 'KRW' THEN '원정'                                                                                                              \n");                                                                                                    
			sqlstr.append("                   ELSE CHG_CODE06                                                                                                                              \n");                                                                                      
			sqlstr.append("         END ATF_HAN                                                                                                                                            \n");                                                                        
			sqlstr.append("        , F_GET_HANGUL2(CHG_ORD_SUPPLY_AMT) CHG_ORD_SUPPLY_AMT_HAN                                                                                              \n");                                                                                                                       
			sqlstr.append("        , DEPT_CD                                                                                                                                               \n");                                                                     
			sqlstr.append("        , MOD_NO                                                                                                                                             \n");                                                                     
			sqlstr.append("        FROM(                                                                                                                                                   \n");               
			sqlstr.append("        SELECT (SELECT DEPART_DEPT_NM FROM PUB0120T WHERE ACCT_ID = '"+acct_id+"') DEPART_DEPT_NM -- 요청부서	\n");             
			sqlstr.append("        ,B.MEMBER_NAME M_MEMBER_NAME -- 사업주명                                                                                                                \n");                                                                                
			sqlstr.append("        ,C.MEMBER_NAME S_MEMBER_NAME -- 공급자                                                                                                                  \n");                                                                                
			sqlstr.append("        ,A.BUILD_NAME  AS CST_DOC_NAME-- 계약명                                                                                                                 \n");                                                                                                      
			sqlstr.append("        ,(SELECT CON_SUPPLY_AMT FROM SUB2000T WHERE SUB_CONT_ID = A.SUB_CONT_ID AND MOD_NO = A.MOD_NO - 1) FRST_ORD_SUPPLY_AMT -- 원계약금액                               \n");                                                
			sqlstr.append("        ,A.CON_SUPPLY_AMT CHG_ORD_SUPPLY_AMT-- 현_계약금액                                                                                                      \n");                                                                            
			sqlstr.append("        ,A.FRST_CON_AMT -- 원도급금액                                                                                                                           \n");                                                                            
			sqlstr.append("        ,A.CHG_CON_AMT -- 현_도급금액                                                                                                                           \n");                                                                            
			sqlstr.append("        ,A.FRST_EXE_AMT -- 원_실행금액                                                                                                                          \n");                                                                        
			sqlstr.append("        ,A.CHG_EXE_AMT -- 현_실행금액                                                                                                                           \n");                                                                            
			sqlstr.append("        ,(SELECT END_WORK_DATE FROM SUB2000T WHERE SUB_CONT_ID = A.SUB_CONT_ID AND MOD_NO = A.MOD_NO - 1) FRST_ORD_END_DATE -- 원_납품종료일                               \n");                                     
			sqlstr.append("        ,A.START_WORK_DATE CHG_ORD_START_DATE -- 현_납품시작일                                                                                                  \n");                                                                 
			sqlstr.append("        ,A.END_WORK_DATE CHG_ORD_END_DATE -- 현_납품종료일                                                                                                      \n");                                                                     
			sqlstr.append("        ,A.IN_SPE_INFO -- 내부특기사항                                                                                                                          \n");                                                                            
			sqlstr.append("        ,A.IN_CHG_INFO -- 내부변경사유                                                                                                                          \n");                                                                            
			sqlstr.append("        ,TO_CHAR(SYSDATE, 'YYYY-MM-DD') AS CRE_DATE -- 작성일                                                                                                   \n");                                      
			sqlstr.append("        ,A.CON_DOC_NO               AS ORD_DOC_NO                                                                                                               \n");         
			sqlstr.append("        ,A.DEPT_CD                                                                                                                                              \n");
			sqlstr.append("        ,A.CON_CUR_CD          AS CURRENCY_GB                                                                                                                   \n");             
			sqlstr.append("        ,D.CHG_CODE06                                                                                                                                           \n");
			sqlstr.append("        ,D.CHG_CODE09                                                                                                                                           \n");
			sqlstr.append("        ,D.CHG_CODE01     AS DIGIT                                                                                                                              \n");      
			sqlstr.append("        ,A.SUB_CONT_MOD_ID                                                                                                                                      \n");  
			sqlstr.append("        ,A.MOD_NO                                                                                                                                         \n");  
			sqlstr.append("        FROM SUB2000T A                                                                                                                                         \n");    
			sqlstr.append("        ,CONT_OUT_SUPP B                                                                                                                                        \n");    
			sqlstr.append("        ,CONT_OUT_SUPP C                                                                                                                                        \n");    
			sqlstr.append("        ,(SELECT CHG_CODE06, CHG_CODE09 , DETAILCD , CHG_CODE01  FROM EBID_COM911T WHERE BASECD = '911' ) D                                                    \n");    
			sqlstr.append("        WHERE A.SUB_CONT_MOD_ID = B.SUB_CONT_MOD_ID                                                                                                             \n");    
			sqlstr.append("        AND A.SUB_CONT_MOD_ID = C.SUB_CONT_MOD_ID                                                                                                               \n");                                
			sqlstr.append("        AND A.CON_CUR_CD = D.DETAILCD                                                                                                                           \n");                   
			sqlstr.append("        AND B.SIGN_SEQ = 1                                                                                                                                      \n");                                
			sqlstr.append("        AND C.SIGN_SEQ = 2                                                                                                                                      \n");                                
			sqlstr.append("        AND A.SUB_CONT_MOD_ID =  '"+sign_cont_mod_id+"'	                                                                                                                          \n");                                      
			sqlstr.append("        )                                                                                                                                                       \n");
			        
			        
			                                                                                                                                                                                                                                   
			        
			        
			        
			        ;
			        
			    
			
			
			/*
        	sqlstr.append(" 	SELECT A.SUB_CONT_MOD_ID	\n");
        	sqlstr.append(" 	     , A.CON_DOC_NO	\n");
        	sqlstr.append(" 	     , A.MOD_NO	\n");	
        	sqlstr.append(" 	     , DECODE(A.MOD_GB, NULL, '00', A.MOD_GB) AS MOD_GB	\n");	
        	sqlstr.append(" 	     , A.DEPT_NAME	\n");	
        	sqlstr.append(" 	     , A.BUILD_NAME	\n");	
        	sqlstr.append(" 	     , A.CON_DATE	\n");	
        	sqlstr.append(" 	     , A.DEALER_NM	\n");	
        	sqlstr.append(" 	     , A.CON_AMT	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.START_WORK_DATE,'YYYY-MM-DD') AS START_WORK_DATE	\n");	
        	sqlstr.append(" 	     , A.ELEC_CON_YN	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.START_WORK_DATE,'YYYY') AS START_WORK_DATE_YEAR 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.START_WORK_DATE,'MM') AS START_WORK_DATE_MONTH 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.START_WORK_DATE,'DD') AS START_WORK_DATE_DAY 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.END_WORK_DATE,'YYYY-MM-DD') AS END_WORK_DATE	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.END_WORK_DATE,'YYYY') AS END_WORK_DATE_YEAR 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.END_WORK_DATE,'MM') AS END_WORK_DATE_MONTH 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.END_WORK_DATE,'DD') AS END_WORK_DATE_DAY 	\n");	
        	sqlstr.append(" 	     , A.CON_GB 	\n");	
        	sqlstr.append(" 	     , A.CON_CUR_CD 	\n");														//추가 (2014-09-19)
        	sqlstr.append(" 	     , A.UND_CON_NAME 	\n");	
        	sqlstr.append(" 	     , A.SUB_UND_CON_NAME 	\n");	
        	sqlstr.append(" 	     , A.WORK_PLACE 	\n");	
        	sqlstr.append(" 	     , A.CON_SUPPLY_AMT 	\n");	
        	sqlstr.append(" 	     , A.LABOR_AMT 	\n");	     	
        	sqlstr.append(" 	     , A.CON_SUPPLY_TAMT 	\n");	
        	sqlstr.append(" 	     , A.CON_SUPPLY_NAMT 	\n");	
        	sqlstr.append(" 	     , A.CON_SURTAX_AMT 	\n");	
        	sqlstr.append(" 	     , A.PREPAY_AMT 	\n");	
        	sqlstr.append(" 	     , A.PREPAY_RATE 	\n");	
        	sqlstr.append(" 	     , A.PAY_WAY_BILL 	\n");	
        	sqlstr.append(" 	     , A.PAY_WAY_CASH 	\n");	

        	sqlstr.append(" 	     , A.PREPAY_SUPPLY_AMT 	\n");	
        	sqlstr.append(" 	     , A.PREPAY_SUPPLY_TAMT 	\n");	
        	sqlstr.append(" 	     , A.PREPAY_SUPPLY_NAMT 	\n");	
        	sqlstr.append(" 	     , A.PREPAY_SURTAX_AMT 	\n");	
        	sqlstr.append(" 	     , A.CON_EST_GUAR_AMT 	\n");	
        	sqlstr.append(" 	     , A.CON_EST_GUAR_RATE 	\n");	
        	sqlstr.append(" 	     , A.DEF_EST_GUAR_RATE 	\n");	
        	sqlstr.append(" 	     , A.DELAY_RATE 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.CON_DATE,'YYYY') AS CON_DATE_YEAR 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.CON_DATE,'MM') AS CON_DATE_MONTH 	\n");	
        	sqlstr.append(" 	     , TO_CHAR(A.CON_DATE,'DD') AS CON_DATE_DAY 	\n");	
        	sqlstr.append(" 	     , A.STATUS_CD 	\n");	
        	sqlstr.append(" 	     , F_GET_CODE_NAME('CONT_STATUS_CD',A.STATUS_CD) AS STATUS_NM 	\n");	
        	sqlstr.append(" 	     , A.MONTH_ACMP_CNT 	\n");	
        	sqlstr.append(" 	     , A.OBJ_RCPT_DAY 	\n");	
        	sqlstr.append(" 	     , A.TEMPLATE_CD 	\n");	
        	sqlstr.append(" 	     , A.TRUE_RANDOM 	\n");
        	sqlstr.append(" 	     , A.CONT_HASH 	\n");	
        	sqlstr.append(" 	     , A.MODI_REQ_REASON 	\n");	
        	sqlstr.append(" 	     , A.MODI_REQ_DT 	\n");	
        	sqlstr.append(" 	     , A.CON_SPE_TXT 	\n");			
        	sqlstr.append(" 	     , TO_CHAR(A.UPD_DATE,'YYYY-MM-DD') AS UPD_DATE 	\n");			
        	
        	sqlstr.append(" 	     , B.DEMANDED_NO	\n");	
        	sqlstr.append(" 	     , B.DEMANDED_TITLE	\n");	
        	sqlstr.append(" 	     , TO_CHAR(B.REQUEST_DATE,'YYYY-MM-DD') AS REQUEST_DATE	\n");	
        	sqlstr.append(" 	     , B.REQ_DEPT_NM	\n");	
        	sqlstr.append(" 	     , B.EMP_NO	\n");	
        	sqlstr.append(" 	     , B.EMP_NM	\n");	
        	sqlstr.append("       	 , GET_OUT_ITEM_NM(B.OUT_ITEM_CD) AS OUT_ITEM_NM						\n");			//2014*-10-02 공종 추가
        	sqlstr.append(" 	     , A.ACCT_GB 	\n");	
        	sqlstr.append(" 	     , A.PAY_GROUP 	\n");	
        	sqlstr.append(" 	     , A.PROOF_CD 	\n");	
        	sqlstr.append(" 	     , A.PAYMENT_TERMS 	\n");	
        	sqlstr.append(" 	     , A.PAY_ITEM 	\n");	
        	sqlstr.append(" 	     , A.COST_CODE 	\n");	
        	sqlstr.append(" 	     , A.COST_TYPE 	\n");	
        	sqlstr.append(" 	     , A.DEPT_CD 	\n");		        	
        	sqlstr.append(" 	     , F_GET_PAY_ITEM_EST_DESC(A.PAY_ITEM,A.COST_CODE,A.COST_TYPE,A.DEPT_CD) AS PAY_ITEM_NM	\n");
        	sqlstr.append(" 	     , (SELECT AC_UNIT_CD FROM ACZ10100V Z WHERE  Z.DEPT_CD = A.DEPT_CD) AS  AC_UNIT_CD	\n");

        	sqlstr.append(" 	     , DECODE(D.CORP_ID, '', 0, D.CORP_ID)  AS O_CORP_ID	\n");	
        	sqlstr.append(" 	     , DECODE(D.MEMBER_NAME, '', C.CORP_KOR, D.MEMBER_NAME)  AS O_MEMBER_NAME	\n");	
        	sqlstr.append(" 	     , DECODE(D.ADDRESS, '', C.ADDRESS, D.ADDRESS) AS O_ADDRESS	\n");	
        	sqlstr.append(" 	     , DECODE(D.BOSS_NAME, '', C.REP_NAME, D.BOSS_NAME) AS O_BOSS_NAME	\n");	
        	sqlstr.append(" 	     , D.USER_NAME AS O_USER_NAME	\n");	
        	sqlstr.append(" 	     , D.TEL_NUM AS O_TEL_NUM	\n");	
        	sqlstr.append(" 	     , D.DIVISION AS O_DIVISION	\n");	
        	sqlstr.append(" 	     , D.POSITION AS O_POSITION	\n");	
        	sqlstr.append(" 	     , D.HP AS O_HP	\n");	
        	sqlstr.append(" 	     , D.EMAIL AS O_EMAIL	\n");	
        	sqlstr.append(" 	     , TO_CHAR(D.SIGN_DATE,'YYYY-MM-DD HH24:MI:SS') AS O_SIGN_DATE	\n");	
        	sqlstr.append(" 	     , D.VENDCD AS O_VENDCD	\n");		        	
        	sqlstr.append(" 	     , E.CORP_ID  AS C_CORP_ID	\n");	
        	sqlstr.append(" 	     , E.MEMBER_NAME AS C_MEMBER_NAME	\n");	
        	sqlstr.append(" 	     , E.ADDRESS AS C_ADDRESS	\n");	
        	sqlstr.append(" 	     , E.BOSS_NAME AS C_BOSS_NAME	\n");	
        	sqlstr.append(" 	     , E.USER_NAME AS C_USER_NAME	\n");	
        	sqlstr.append(" 	     , E.TEL_NUM AS C_TEL_NUM	\n");	
        	sqlstr.append(" 	     , E.DIVISION AS C_DIVISION	\n");	
        	sqlstr.append(" 	     , E.POSITION AS C_POSITION	\n");	
        	sqlstr.append(" 	     , E.HP AS C_HP	\n");		        	
        	sqlstr.append(" 	     , E.VENDCD AS C_VENDCD	\n");		        	
        	sqlstr.append(" 	     , E.EMAIL AS C_EMAIL	\n");	
        	sqlstr.append(" 	     , TO_CHAR(E.SIGN_DATE,'YYYY-MM-DD HH24:MI:SS') AS C_SIGN_DATE	\n");			//TO_DATE(E.SIGN_DATE, 'YYYYMMDDHH24MISS')

			sqlstr.append("  FROM SUB2000T A, BID_MASTER B, HEAD_OFFICE_INFO C, CONT_OUT_SUPP D, CONT_OUT_SUPP E	\n");
			sqlstr.append("  WHERE A.BID_NO = B.BID_NO(+) 	\n");
			sqlstr.append("  AND A.BID_DEG = B.BID_DEG(+)	\n");
			sqlstr.append("  AND A.SUB_CONT_MOD_ID = D.SUB_CONT_MOD_ID(+)	\n");
			sqlstr.append("  AND D.SIGN_SEQ(+) = 1 --원사업자	\n");
			sqlstr.append("  AND A.SUB_CONT_MOD_ID = E.SUB_CONT_MOD_ID(+)	\n");
			sqlstr.append("  AND E.SIGN_SEQ(+) = 2 --계약업체정보  	\n");
			sqlstr.append("  AND A.SUB_CONT_MOD_ID = '"+sign_cont_mod_id+"'							\n");
			
			
			*/
			search.setStatement(sqlstr.toString());
			listRowSet = search.execute();
			//WAFLogger.debug("size : " + listRowSet.size());
			rowObject = RowSetUtility.getValueObject(listRowSet.getRow(0));
			
		} catch (Exception e) {
			WAFLogger.error(this.getClass().getName()
					+ " --> getBidMaster() : " + e.getMessage());
			WAFLogger.error("SQL : " + search.getStatement());
			WAFLogger.error(e);
			return null;
		} finally {
			if (rowObject == null)
				rowObject = new ValueObject();
			return rowObject;
		}
	}

	public RowSet getSuppInfo(String sign_cont_mod_id) {
		Search search = new SearchImpl();
		RowSet listRowSet = null;
		StrBuffer sqlstr = new StrBuffer();
		try {
			sqlstr.append("SELECT A.VENDOR_NAME		\n");
			sqlstr.append(",A.RECM_DEPT_NM		\n");
			sqlstr.append(",B.CREDIT_GRADE		\n");
			sqlstr.append(",(SELECT CST_DOC_NAME FROM PUR1000T WHERE PUR_CONT_ID = C.PUR_CONT_ID) AS CST_DOC_NAME		\n");
			sqlstr.append("FROM BID_SUPP A		\n");
			sqlstr.append(", SUPP_INFO B		\n");
			sqlstr.append(", (SELECT MAX(PUR_CONT_ID) AS PUR_CONT_ID,CORP_ID FROM PUR1000T GROUP BY CORP_ID) C		\n");
			sqlstr.append("WHERE A.VENDOR_CD = B.CORP_ID(+)		\n");
			sqlstr.append("AND A.VENDOR_CD = C.CORP_ID(+)		\n");
			sqlstr.append("AND BID_NO = '" + sign_cont_mod_id + "'			\n");
			search.setStatement(sqlstr.toString());
			//WAFLogger.debug(sqlstr);
			listRowSet = search.execute();
		} catch (Exception e) {
			WAFLogger.error(this.getClass().getName() + " --> getSuppInfo() : "
					+ e.getMessage());
			WAFLogger.error("SQL : " + search.getStatement());
			WAFLogger.error(e);
			return null;
		} finally {
			if (listRowSet == null)
				listRowSet = null;
			return listRowSet;
		}
	}
}
