/**
 * @(#)file    ChgItemBiz.java
 * @(#)author  Kim Myung Ho
 * @(#)version 1.0
 * @(#)date    2014-08-11
 * @(#)since   JDK 1.4.2
 */
package kr.co.udapsoft.ebid.buyer.bid.outside.biz;


import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;

import oracle.toplink.internal.ox.StrBuffer;
import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.config.WAFConfig;
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.WAFSQLException;
import kr.co.hsnc.common.sql.persistent.Persistent;
import kr.co.hsnc.common.sql.persistent.PersistentImpl;
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.common.code.CommCodeManager;
import kr.co.udapsoft.common.util.Crosscert;
import kr.co.udapsoft.common.util.PDFMaker;
import kr.co.udapsoft.ebid.buyer.common.file.FileManager;
import kr.co.udapsoft.ebid.buyer.sycs.user.biz.UserCommon;

import com.udapsoft.modular.web.ibsheet7.IBSheet7Factory;
import com.udapsoft.modular.web.ibsheet7.util.IBSheet7Utils;
import com.udapsoft.waf.common.ui.InitCombo;
import com.udapsoft.waf.common.util.StringUtils;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

   
public class OrdItemBiz extends Biz {

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

	public void doBiz() throws Exception {
        
		//변경 내역
		params.set("sheet1", getItemList(params));
		
		storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request)); 
	}

	
	/**
	 * 계약 변경 내역 목록
	 * @param Params
	 * @return
	 */
	private RowSet getItemList(ValueObject param) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        
        StrBuffer sql = new StrBuffer();
        try{
        	sql.append(" SELECT DEMANDED_ID	                                            \n");
        	sql.append("       ,SQ_CORD	                                                \n");
        	sql.append("       ,NO_CORD	                                                \n");
        	sql.append("       ,CD_CSTR	                                                \n");
        	sql.append("       ,DL_CSTR	                                                \n");
        	sql.append("       ,SEQ_BUDGET	                                            \n");
        	sql.append("       ,SQ_BUDGET	                                            \n");
        	sql.append("       ,NM_CSTR	                                                \n");
        	sql.append("       ,AMT_ORD	TOT_CONT_AMT                                    \n");
        	sql.append("       ,AMT_ACT TOT_EXE_AMT                                     \n");
        	sql.append("       ,AMT_TRNS_ORD CONT_AMT                                   \n");
        	sql.append("       ,AMT_TRNS_ACT EXE_AMT                                    \n");
        	sql.append("  FROM PMM_DEMANDED_DETAIL  	                                \n");
        	sql.append(" WHERE DEMANDED_ID = "+ params.get("DEMANDED_ID") +" 	     	\n");
        	
            search.setStatement(sql.toString());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);  
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
        }
        finally {    
            if(rowSet == null){
            	rowSet = new RowSetImpl();
            }
        }
        return rowSet;
	} 
	
}


