package kr.co.udapsoft.common.commonSign.util;

import java.awt.Color;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.Connection;

import javax.servlet.http.HttpServletRequest;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;

/*
 * 외주기성고 계산서 : http://172.17.217.243/lib/dlgReport.screen?&WINDOW_TITLE=%20&REPORT_NAME=%2Fjsp%2Fko_kr%2Fsub%2Freport%2FSUBAcmpBillList.mrd&REPORT_OPTION=%2Frf&HIDE_STATUS_BAR=false&HIDE_TOOL_BAR=false&ZOOM_RATIO=100&HIDE_STATUS_DLG=false&P_0=6250A10401&P_1=200808&P_2='SUBO06110064'%2C'SUBO06110089'%2C'SUBO07010064'%2C'SUBO07030114'%2C'SUBO07030116'%2C'SUBO07050041'%2C'SUBO07070043'%2C'SUBO08040034'%2C'SUBO08040127'%2C'SUBO08050150'%2C'SUBO08070004'%2C'SUBO08070023'%2C'SUBO08070026'%2C'SUBO06110066'%2C'SUBO07010039'%2C'SUBO06110040'%2C'SUBO07020049'%2C'SUBO07090060'%2C'SUBO07110105'%2C'SUBO07110107'%2C'SUBO07120076'%2C'SUBO07120085'%2C'SUBO07120109'%2C'SUBO07120131'%2C'SUBO07120133'%2C'SUBO08010025'%2C'SUBO08010058'%2C'SUBO08020050'%2C'SUBO08030015'%2C'SUBO08040100'%2C'SUBO08040141'%2C'SUBO08060015'%2C'SUBO08060040'%2C'SUBO08060078'%2C'SUBO08070074'%2C'SUBO07010081'%2C'SUBO07030115'%2C'SUBO07060089'%2C'SUBO07070013'%2C'SUBO07070053'%2C'SUBO07070086'%2C'SUBO07070088'%2C'SUBO07070089'%2C'SUBO07100113'%2C'SUBO07100118'%2C'SUBO07100124'%2C'SUBO07110030'%2C'SUBO08030034'%2C'SUBO08030122'%2C'SUBO06120108'%2C'SUBO07020069'%2C'SUBO07020083'%2C'SUBO07030125'%2C'SUBO07050062'%2C'SUBO07060070'%2C'SUBO07070051'%2C'SUBO07070119'%2C'SUBO07070122'%2C'SUBO07100123'%2C'SUBO07120055'%2C'SUBO07120062'%2C'SUBO07120113'%2C'SUBO08030075'%2C'SUBO08060115'%2C'SUBO08060118'%2C'SUBO08070006'%2C'SUBO08070037'%2C'SUBO08070167'%2C'SUBO08070168'%2C'SUBO08080030'%2C'SUBO06120082'%2C'SUBO07030006'%2C'SUBO07030110'%2C'SUBO07040059'%2C'SUBO07040075'%2C'SUBO07090007'%2C'SUBO07110067'%2C'SUBO07120004'%2C'SUBO07120081'%2C'SUBO08010023'%2C'SUBO08010104'%2C'SUBO08010171'%2C'SUBO08030099'%2C'SUBO08040027'%2C'SUBO08040089'%2C'SUBO08060018'%2C'SUBO08090001'&P_SIZE=3
 * 
 */

import com.udapsoft.waf.system.HandlerStorage;

import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.config.WAFConfig;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
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;

public class SACDOCreatePDF8 {

	public static BaseFont bfKorean = null;

	/*
	 * private static Font FontKorean = null;
	 */

	public static Font FontBold = null;

	private static String strClassName = (new Throwable()).getStackTrace()[0]
			.getClassName();

	// private static String strFileName = "d:\\temp\\pdf\\" + strClassName +
	// ".pdf";
	private static String strFileName = WAFConfig.get("waf.repository.path")
			+ "\\" + strClassName + ".pdf";

	private static Color borderColor = Color.BLACK;

	private static String strGubun = null;

	private static float BorderW = 0.1f;

	private static Rectangle border = new Rectangle(0f, 0f);
	private static boolean isGray = false;
	private static boolean LineisGray = false;  //데이터 로 

	/**
	 * @param args
	 */
	public void doBiz1(Connection con, OutputStream outputStream, String tmpslipID,  HttpServletRequest request) {
 
        WAFLogger.debug("\n\t #################### 기성 검사 보고서 시작");
        
		// step 1
		Document document = new Document(PageSize.A4, 25f, 25f, 35f, 10f);
  
		try {
	 
    		// step 2
  			PdfWriter writer = PdfWriter.getInstance(document, outputStream);

			// step 3
			document.open();

			BaseFont bfKorean = BaseFont.createFont("HYGoThic-Medium", "UniKS-UCS2-H", BaseFont.NOT_EMBEDDED);

			Font FontTitle = new Font(bfKorean,10, Font.NORMAL);
			Font FontTitle3 = new Font(bfKorean, 9, Font.NORMAL);
			Font FontTitle1 = new Font(bfKorean, 8, Font.NORMAL);
			FontTitle.setColor(borderColor);

			Font FontData = new Font(bfKorean, 4.8f, Font.NORMAL);
			Font FontTitle2 = new Font(bfKorean, 20, Font.BOLD);

			PdfPTable table = null;
			PdfPCell cell = null;

			/*
			 * 정보 검색 시작 ---------------------------------------------
			 */
			
			ValueObject params = new ValueObject();
			HandlerStorage storage = new HandlerStorage();
			storage.setParams(params);
			
			ValueObject listRowSet = null;
			RowSet rowSet = null;
			/*
			 * 정보 검색 시작 ---------------------------------------------
			 */
			
			String subContModId = getSubContModId(con,tmpslipID);
			
			listRowSet = getPayReqList1(con, tmpslipID,subContModId);
			
			rowSet = getPayReqList2(tmpslipID);
			// 정보 검색 끝 ---------------------------------------------
			
			/*
			 * ===========================================================================================
			 * 제목 생성
			 * ===========================================================================================
			 */
			makeTitle(document, FontTitle, FontTitle2 , listRowSet,  request);

			//본문생성
			setBorder(border, true, true, true, true);
			
			
            //1행
		    PdfPTable table11 = new PdfPTable(9);
		    table11.setWidthPercentage(100);
		    table11.setSpacingBefore(7f);
		    table11.setSpacingAfter(7f);
            float[] table11Width = {12f,12f,3f,15f,3f,15f,3f,12f,6f};
            table11.setWidths(table11Width);
            
          
            
            // 1행
            PT_addCell(table11, new String [] { "계 약 번 호" }, FontTitle, border,
    				Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            PT_addCell(table11, listRowSet.get("CON_DOC_NO"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f ,false);
            PT_addCell(table11, new String [] { "작 성 일 자" }, FontTitle, border,
    				Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false);          
            PT_addCell(table11,  listRowSet.get("ACMP_DATE"), FontTitle, border,
    				Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f,false);

            //2019.08.29 주석
            //PT_addCell(table11, new String [] { "주 관 부 서" }, FontTitle, border,
            //		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            //PT_addCell(table11,listRowSet.get("DEPART_DEPT_NM"), FontTitle, border,
            //		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f ,false);
            //PT_addCell(table11, new String [] { "협 조 부 서" }, FontTitle, border,
            //		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false);          
            //PT_addCell(table11, listRowSet.get("ACC_DEPT_NM"), FontTitle, border,
            //		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f,false);
/*            PT_addCell(table11,  new String [] { "구매부 외주팀" }, FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f,false);
*/
            
            PT_addCell(table11, new String [] { "PROJECT 명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            PT_addCell(table11, listRowSet.get("DEPT_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f ,false);
            PT_addCell(table11, new String [] { "투 자 코 드" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false);          
            PT_addCell(table11,  listRowSet.get("CONCD"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f,false);
            

            PT_addCell(table11, new String [] { "계   약   명 " }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            PT_addCell(table11,  listRowSet.get("BUILD_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 8, 25f ,false);
            
    		
            PT_addCell(table11, new String [] { "공사비 내역\n(부가세 별도)" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 275f ,false);
            
            
            PdfPTable table21 = new PdfPTable(8);
            float[] table21Width = {13f,3f,14f,3f,14f,3f,14f,12f};
            table21.setWidths(table21Width);
            PdfPCell permission = new PdfPCell(table21);
            
           
            
            PT_addCell(table21, new String [] { "구        분" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);          
            PT_addCell(table21, new String [] { "과        세" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false);          
            PT_addCell(table21, new String [] { "면        세" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false);          
            PT_addCell(table21, new String [] { "합        계" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 3, 25f ,false);          
            
            
            PT_addCell(table21, new String [] { "총   공   사   비" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);    
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("CON_SUPPLY_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("CON_SUPPLY_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_SUPPLY_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  new String [] { " " }, FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);

            
            PT_addCell(table21, new String [] { "전회까지 기성고" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);     
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_FUND_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_FUND_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_FUND_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_FUND_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);

            
            PT_addCell(table21, new String [] { "금  회  기  성 고" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);   
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("FUND_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("FUND_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("FUND_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("FUND_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);

            
            PT_addCell(table21, new String [] { "미      성      고" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);  
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("RES_FUND_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("RES_FUND_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("RES_FUND_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,   listRowSet.get("RES_FUND_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);

            
            PT_addCell(table21, new String [] { "기   지   불   액" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_PAYED_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_PAYED_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_PAYED_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21, listRowSet.get("PRE_PAYED_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);

            
            PT_addCell(table21, new String [] { "금  회  청  구 액" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);     
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("REQU_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("REQU_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("REQU_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("REQU_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);

            
            PT_addCell(table21, new String [] { "잔                액" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);      
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("RES_REQU_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("RES_REQU_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("RES_REQU_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("RES_REQU_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            
            
            PT_addCell(table21, new String [] { "선    급    금" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);      
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PREPAY_SUPPLY_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PREPAY_SUPPLY_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("PREPAY_SUPPLY_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PREPAY_SUPPLY_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            
            
            PT_addCell(table21, new String [] { "선    급    금\n전  회  공  제" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);      
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_PAY_DEDUCT_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_PAY_DEDUCT_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_PAY_DEDUCT_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PRE_PAY_DEDUCT_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            
            
            PT_addCell(table21, new String [] { "선    급    금\n금  회  공  제" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);      
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PAY_DEDUCT_TAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PAY_DEDUCT_NAMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table21,  listRowSet.get("CON_P"), FontTitle3, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, false, true, true);
            PT_addCell(table21,  listRowSet.get("PAY_DEDUCT_AMT"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);
            setBorder(border, false, true, true, true);
            PT_addCell(table21,  listRowSet.get("PAY_DEDUCT_RATE"), FontTitle3, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f,false);


            permission.setColspan(8);
            table11.addCell(permission);

            setBorder(border, true, false, true, false);
            PT_addCell(table11, new String [] { "위와 같이 기성검사 내역을 보고 합니다." }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 8, 25f,false);
            setBorder(border, false, true, true, false);
            PT_addCell(table11, new String [] { " " }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 25f,false);
            
            
            setBorder(border, true, false, false, false);
            PT_addCell(table11, listRowSet.get("ACMP_DATE").substring(0, 4) + "년    "  + listRowSet.get("ACMP_DATE").substring(5, 7) + "월" + listRowSet.get("ACMP_DATE").substring(8, 10) + "일            ", FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 8, 25f,false);
            setBorder(border, false, true, false, true);
            PT_addCell(table11, new String [] { " " }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 25f,false);
            
            setBorder(border, true, true, true, true);
            PT_addCell(table11, new String [] { "공 사 업 체" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table11, new String [] { "(업체명)" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);  
            setBorder(border, false, false, true, true);
            PT_addCell(table11, listRowSet.get("CORP_KOR"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f ,false);  
            setBorder(border, false, false, true, true);
            PT_addCell(table11, new String [] { "(대표자명)" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);     
            setBorder(border, false, false, true, true);
            PT_addCell(table11, listRowSet.get("REP_NAME"), FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false); 
            setBorder(border, false, true, true, true);
            PT_addCell(table11, new String [] { " " }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);          

            
            setBorder(border, true, true, true, true);
            PT_addCell(table11, new String [] { "검    사    인" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table11, new String [] { "(소   속)" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);    
            setBorder(border, false, false, true, true);
            PT_addCell(table11, listRowSet.get("CHECK_COMP"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f ,false);    
            setBorder(border, false, false, true, true);
            PT_addCell(table11, new String [] { "(성     명)" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false); 
            setBorder(border, false, false, true, true);
            PT_addCell(table11, listRowSet.get("CHECK_MAN"), FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false); 
            setBorder(border, false, true, true, true);
            PT_addCell(table11, new String [] { "" }, FontTitle1, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);          

            
            setBorder(border, true, true, true, true);
            PT_addCell(table11, new String [] { "입    회    인" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);
            setBorder(border, true, false, true, true);
            PT_addCell(table11, new String [] { "(소   속)" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false); 
            setBorder(border, false, false, true, true);
            PT_addCell(table11, listRowSet.get("ATTEN_COMP"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 25f ,false);  
            setBorder(border, false, false, true, true);
            PT_addCell(table11, new String [] { "(성     명)" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false); 
            setBorder(border, false, false, true, true);
            PT_addCell(table11, listRowSet.get("ATTEN_MAN"), FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 25f ,false);   
            setBorder(border, false, true, true, true);
            PT_addCell(table11, new String [] { "" }, FontTitle1, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);          

            
            setBorder(border, true, true, true, true);
            PT_addCell(table11, new String [] { "세금계산서\n발행방법" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 35f ,false);
            
            PdfPTable table41 = new PdfPTable(3);
            float[] table41Width = {35f,35f,35f};
            table41.setWidths(table41Width);
            PdfPCell permission3 = new PdfPCell(table41);
            
            String check1 = "";
            String check2 = "";
            String check3 = "";
            
            check1 = (listRowSet.get("TAX_METHOD_CD").equals("1")?"●":"○")+" 역발행(SGC이앤씨 발행)";
            check2 = (listRowSet.get("TAX_METHOD_CD").equals("2")?"●":"○")+" 순발행(업체 직접 발행)";
            check3 = (listRowSet.get("TAX_METHOD_CD").equals("3")?"●":"○")+" Invoice";
            
            setBorder(border, true, false, true, false);
            PT_addCell(table41, check1 , FontTitle, border,
        			Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);     
            setBorder(border, false, false, true, false);
            PT_addCell(table41, check2, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);  
            setBorder(border, false, true, true, false);
            PT_addCell(table41, check3, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 25f ,false);          

            setBorder(border, true, true, true, true);
            permission3.setColspan(8);
            table11.addCell(permission3);
            
            
            PT_addCell(table11, new String [] { "특 기 사 항" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 140f ,false);
            PT_addCell(table11, listRowSet.get("ACMP_REMARK"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_TOP, 8, 140f ,false);

            
            
            PT_addCell(table11, new String [] { "첨 부 서 류" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 75f ,false);
            
      
            PdfPTable table31 = new PdfPTable(3);
            float[] table31Width = {25f,25f,25f};
            table31.setWidths(table31Width);
            PdfPCell permission2 = new PdfPCell(table31);
            
            
            setBorder(border, true, false, true, false);
            PT_addCell(table31, rowSet.getRow(0).get("DOC_NM") , FontTitle, border,
        			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);     
            setBorder(border, false, false, true, false);
            PT_addCell(table31, rowSet.getRow(1).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);  
            setBorder(border, false, true, true, false);
            PT_addCell(table31, rowSet.getRow(2).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);          


            setBorder(border, true, false, false, false);
            PT_addCell(table31, rowSet.getRow(3).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);  
            setBorder(border, false, false, false, false);
            PT_addCell(table31, rowSet.getRow(4).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);   
            setBorder(border, false, true, false, false);
            PT_addCell(table31, rowSet.getRow(5).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);          
        	
            
            setBorder(border, true, false, false, false);
            PT_addCell(table31, rowSet.getRow(6).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);  
            setBorder(border, false, false, false, false);
            PT_addCell(table31, rowSet.getRow(7).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);      
            setBorder(border, false, true, false, false);
            PT_addCell(table31, rowSet.getRow(8).get("DOC_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 25f ,false);          
        	
            setBorder(border, true, true, true, true);
            permission2.setColspan(8);
            table11.addCell(permission2);
            
            document.add(table11);
            


            
		} catch (DocumentException de) {
			WAFLogger.debug("de.getMessage() = " + de.getMessage());
		} catch (IOException ioe) {
			WAFLogger.debug("ioe.getMessage() = " + ioe.getMessage());
		} catch (Exception e) {
			WAFLogger.debug("[Exception] ... " + e);
		}

		// step 5
		document.close();
		WAFLogger.debug("\n\t #################### "+ strFileName +" 생성완료 SACDOCreatePDF8");
	}
	/*
	 * ===========================================================================================
	 * A. 타이틀
	 * ===========================================================================================
	 */
	

	private static void makeTitle(Document document, Font FontTitle,
			Font FontTitle2, ValueObject listRowSet,  HttpServletRequest request) throws Exception {
		

		PdfPTable tbl_Title = new PdfPTable(2);
		tbl_Title.setWidthPercentage(40f);
		float[] tbl_TitleWidths = {10f,10f};
		tbl_Title.setWidths(tbl_TitleWidths); 
        
		PdfPCell title= new PdfPCell(new Paragraph("기성 검사 보고서", FontTitle2));
		title.setColspan(2);
		title.setHorizontalAlignment(Element.ALIGN_CENTER);
		title.setVerticalAlignment(Element.ALIGN_MIDDLE);
		title.setFixedHeight(40f);
		title.setBorder(0);
		title.setBorderWidthBottom(1);
		
		tbl_Title.addCell(title);
		
		PdfPCell titleB = new PdfPCell(new Paragraph("( 제 " + listRowSet.get("ACMP_NUMBER") + " 회 )", FontTitle));
		titleB.setColspan(2);
		titleB.setFixedHeight(30f);
		titleB.setBorder(0);
		titleB.setHorizontalAlignment(1);
		titleB.setVerticalAlignment(5);
		
		tbl_Title.addCell(titleB);
		
		//PT_addCell(tbl_Title, "대 금 지 급", FontTitle2, borderTemp,
		//		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 2, 28f, false);
		
		document.add(tbl_Title);
		
		Image img = null;
		if(request == null)
		{
			//img = Image.getInstance(new URL("http://edreams21.co.kr/img/invoice/Title_bg1.gif"));
		}
		else
		{
			//img = Image.getInstance(new URL(request.getScheme(), request.getServerName(), request.getServerPort(), "/img/invoice/Title_bg1.gif"));
		}
		
		
//		img.scaleToFit(300f, 40f);
//		img.setAbsolutePosition(310, 554);
//		img.setAbsolutePosition(203, 246);
//		img.setAbsolutePosition(180, 310);
		
//		document.add(img);
	}

	/*
	 * ===========================================================================================
	 * B. 데이터 입력
	 * ===========================================================================================
	 */
	

	/*
	 * ===========================================================================================
	 * 기타
	 * ===========================================================================================
	 */
	// PdfPCell을 리턴하자
	private static PdfPCell PC_addCell(String strText, Font FontTitle,
			Rectangle border, int HA, int VA, int CS) {

		// 추가할 Cell 생성
		PdfPCell cell = new PdfPCell(new Paragraph(strText, FontTitle));

		// PdfPCell cell = new PdfPCell(new Paragraph(strText));

		// Cell Border 설정
		// setBorder(cell, blnLEFT, blnRIGHT, blnTOP, blnBOTTOM);

		cell.cloneNonPositionParameters(border);

		// 가로/세로 정렬
		cell.setHorizontalAlignment(HA);
		cell.setVerticalAlignment(VA);

		// setColspan
		if (CS > 1)
			cell.setColspan(CS);

		// cell.setPadding(0);
		
		if( isGray )
			cell.setGrayFill(0.8f);
		//if( LineisGray )
		//	cell.setGrayFill(0.9f);
		//cell.setBackgroundColor(arg0)
		
		
		return cell;
	}

	// Cell Border 설정
	private static void setBorder(Rectangle border, boolean blnLEFT,
			boolean blnRIGHT, boolean blnTOP, boolean blnBOTTOM) {
		border.setBorderColor(borderColor);

		if (blnLEFT) {
			border.setBorderWidthLeft(BorderW);
		} else {
			border.setBorderWidthLeft(0);
		}

		if (blnRIGHT) {
			border.setBorderWidthRight(BorderW);
		} else {
			border.setBorderWidthRight(0);
		}

		if (blnTOP) {
			border.setBorderWidthTop(BorderW);
		} else {
			border.setBorderWidthTop(0);
		}

		if (blnBOTTOM) {
			border.setBorderWidthBottom(BorderW);
		} else {
			border.setBorderWidthBottom(0);
		}
		
		
	}

	// PdfPTable에 Cell 을 추가하자
	private static void PT_addCell(PdfPTable table, String[] arrText,
			Font FontTitle, Rectangle border, int HA, int VA, int CS) {

		for (int i = 0; i < arrText.length; i++) {
			PT_addCell(table, arrText[i], FontTitle, border, HA, VA, CS);
		}
	}
	
	private static void PT_addCell(PdfPTable table, String[] arrText,
			Font FontTitle, Rectangle border, int HA, int VA, int CS, float RH, boolean CL) {		
		
		for (int i = 0; i < arrText.length; i++) {
			PT_addCell(table, arrText[i], FontTitle, border, HA, VA, CS, RH, CL);
		}
	}

	private static void PT_addCell(PdfPTable table, String strText,
			Font FontTitle, Rectangle border, int HA, int VA, int CS) {

		// 추가할 Cell 생성
		PdfPCell cell = PC_addCell(strText, FontTitle, border, HA, VA, CS);

		table.addCell(cell);
	}

	// PdfPTable에 Cell 을 추가하자(행높이 추가)
	private static void PT_addCell(PdfPTable table, String strText,
			Font FontTitle, Rectangle border, int HA, int VA, int CS, float RH, boolean CL) {
		
		// 추가할 Cell 생성
		PdfPCell cell = PC_addCell(strText, FontTitle, border, HA, VA, CS);
		// 셀 높이
		if (RH > 0)
			cell.setFixedHeight(RH);
		
		if (CL) {
			cell.setBackgroundColor(Color.lightGray);
		} else {
			cell.setBackgroundColor(Color.white);
		}
		table.addCell(cell);
	}
	
	public ValueObject getPayReqList1(Connection con, String tmpslipID, String subContModId ){
		
		Persistent persistent_c = null;
		Search search = new SearchImpl();
		ValueObject vo = null;
		RowSet rowSet = new RowSetImpl();
		StringBuffer  sql = new StringBuffer();
		
		try{
				
			persistent_c = new PersistentImpl(con);
				
			sql.append(" 					SELECT         A.ACMP_NO                                                                                                                                                                                        																								\n");
			sql.append("                                   , B.CON_DOC_NO                                                                                                                                                                                                                                   \n");
			sql.append("                                   , TO_CHAR(to_date(A.TAX_DY, 'YYYY.MM.DD'),'YYYY.MM.DD') ACMP_DATE                                                                                                                                                                                \n");
			sql.append("                                   , B.DEPT_NAME                                                                                                                                                                                                                                    \n");
			sql.append("                                   , A.DEPT_CD                                                                                                                                                                                                                                      \n");
			sql.append("                                   , B.BUILD_NAME                                                                                                                                                                                                                                   \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(B.CON_SUPPLY_AMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )     AS CON_SUPPLY_AMT                                                                                                                            \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(B.CON_SUPPLY_TAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )    AS CON_SUPPLY_TAMT                                                                                                                           \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(B.CON_SUPPLY_NAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )    AS CON_SUPPLY_NAMT                                                                                                                           \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.PRE_FUND_AMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) PRE_FUND_AMT                                                                                                                                       \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.PRE_FUND_TAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) PRE_FUND_TAMT                                                                                                                                     \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.PRE_FUND_NAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) PRE_FUND_NAMT                                                                                                                                     \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.FUND_AMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) FUND_AMT                                                                                                                                               \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.FUND_TAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) FUND_TAMT                                                                                                                                             \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.FUND_NAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) FUND_NAMT                                                                                                                                             \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL( (B.CON_SUPPLY_AMT - A.TOT_FUND_AMT), 0 ), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) RES_FUND_AMT                                                                                                                \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL( (B.CON_SUPPLY_TAMT - A.TOT_FUND_TAMT), 0 ) , F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) RES_FUND_TAMT                                                                                                            \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL( (B.CON_SUPPLY_NAMT - A.TOT_FUND_NAMT), 0 ) , F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) RES_FUND_NAMT                                                                                                            \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL((A.PRE_REQU_SUPPLY_TAMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_TAMT) SUPPLY_AMT      --2015.10.5                                                                                                                                          \n");
			sql.append("                                                                                                                                      FROM SUB1030T B         \n");//2016.7.5 중복제거 SUB1050T C, SAC01001 D 
			sql.append("                                                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                   \n");
			sql.append("                                                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 )), 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )  PRE_PAYED_TAMT                           \n"); 
			sql.append("                                   , F_GET_D_CURRENCY(NVL((A.PRE_REQU_SUPPLY_NAMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_NAMT) SUPPLY_AMT    --2015.10.5                                                                                                                                            \n");
			sql.append("                                                                                                      FROM SUB1030T B                                                                                                                                      \n");
			sql.append("                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                                                   \n");
			sql.append("                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 )), 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )  PRE_PAYED_NAMT                                                           \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL((A.PRE_REQU_SUPPLY_AMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_AMT) SUPPLY_AMT    --2015.10.5                                                                                                                                                \n");
			sql.append("                                                                                                      FROM SUB1030T B                                                                                                                                       \n");
			sql.append("                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                                                   \n");
			sql.append("                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 )), 0)                                                                                                                               \n");
			sql.append("                                                                                    , F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )  PRE_PAYED_AMT                                                                                                                             \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.REQU_SUPPLY_AMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) REQU_AMT                                                                                                                                        \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL( (A.REQU_SUPPLY_TAMT), 0 ), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) REQU_TAMT                                                                                                                                  \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL(A.REQU_SUPPLY_NAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) REQU_NAMT                                                                                                                                      \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL( (B.CON_SUPPLY_AMT - (A.TOT_REQU_SUPPLY_AMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_AMT) SUPPLY_AMT    --2015.10.5                                                                                                                         \n");
			sql.append("                                                                                                      FROM SUB1030T B                                                                                                                                       \n");
			sql.append("                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                                                   \n");
			sql.append("                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 )) ) , 0 ), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) RES_REQU_AMT                                                          \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL( (B.CON_SUPPLY_TAMT - (A.TOT_REQU_SUPPLY_TAMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_TAMT) SUPPLY_AMT        --2015.10.5                                                                                                                  \n");
			sql.append("                                                                                                      FROM SUB1030T B                                                                                                                                      \n");
			sql.append("                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                                                   \n");
			sql.append("                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 )) ), 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) RES_REQU_TAMT                                                           \n");
			sql.append("                                   , F_GET_D_CURRENCY(NVL( (B.CON_SUPPLY_NAMT - (A.TOT_REQU_SUPPLY_NAMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_NAMT) SUPPLY_AMT   --2015.10.5                                                                                                                        \n");
			sql.append("                                                                                                      FROM SUB1030T B                                                                                                                                       \n");
			sql.append("                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                                                   \n");
			sql.append("                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 )) ), 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) ) RES_REQU_NAMT                                                           \n");
			sql.append("                                   , A.CHECK_COMP                                                                                                                                                                                                                                   \n");
			sql.append("                                   , A.CHECK_MAN                                                                                                                                                                                                                                    \n");
			sql.append("                                   , A.CHECK_TEL                                                                                                                                                                                                                                    \n");
			sql.append("                                   , A.ATTEN_COMP                                                                                                                                                                                                                                   \n");
			sql.append("                                   , A.ATTEN_MAN                                                                                                                                                                                                                                    \n");
			sql.append("                                   , A.ATTEN_TEL                                                                                                                                                                                                                                    \n");
			sql.append("                                   , SUBSTR(C.CORP_KOR,1) AS CORP_KOR                                                                                                                                                                                                                \n");
			sql.append("                                   , F.REP_NAME          as REP_NAME                                                                                                                                                                                                                \n");
			sql.append("                                   , A.ACMP_REMARK                                                                                                                                                                                                                                  \n");
			sql.append("                                   , '( ' || ROUND( (A.REQU_SUPPLY_AMT/B.CON_SUPPLY_AMT) *100 , 2) || '% )' REQU_RATE                                                                                                                                                               \n");
			sql.append("                                   , '( ' || ROUND( (A.PRE_FUND_AMT/B.CON_SUPPLY_AMT)*100,2) || '% )' PRE_FUND_RATE                                                                                                                                                                 \n");
			sql.append("                                   , '( ' || ROUND( (A.FUND_AMT/B.CON_SUPPLY_AMT)*100,2) || '% )' FUND_RATE                                                                                                                                                                         \n");
			sql.append("                                   , '( ' || ROUND( ( (B.CON_SUPPLY_AMT - A.TOT_FUND_AMT) / B.CON_SUPPLY_AMT ) * 100 , 2) || '% )'  RES_FUND_RATE                                                                                                                                   \n");
			sql.append("                                   , '( ' || ROUND( NVL( ( ((A.PRE_REQU_SUPPLY_AMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_AMT) SUPPLY_AMT   --2015.10.5                                                                                                                                             \n");
			sql.append("                                                                                                      FROM SUB1030T B                                                                                                                                        \n");
			sql.append("                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                                                   \n");
			sql.append("                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 )) ) / B.CON_SUPPLY_AMT) * 100, 0), 2) || '% )' PRE_PAYED_RATE                                                                       \n");
			sql.append("                                    , '( ' || ROUND( NVL( (((B.CON_SUPPLY_AMT -  (A.TOT_REQU_SUPPLY_AMT +  NVL( (SELECT SUM(REQ_PREPAY_SUPPLY_AMT) SUPPLY_AMT    --2015.10.5                                                                                                                       \n");
			sql.append("                                                                                                      FROM SUB1030T B                                                                                                                                      \n");
			sql.append("                                                                                                        WHERE DECODE(B.CONVERSION_YN, 'Y', '10', B.STATUS_CD) >= '10'                                                                                                                   \n");
			sql.append("                                                                                                        AND A.SUB_CONT_ID = B.SUB_CONT_ID) , 0 ))) / B.CON_SUPPLY_AMT) * 100) , 0 ), 2) || '% )' RES_REQU_RATE                                                                      \n");
			sql.append("                                   , D.DEPART_DEPT_NM                                                                                                                                                                                                                               \n");
			sql.append("                                   , A.ACMP_NO  ACMP_NUMBER																																																							\n");
			sql.append("                                   , (SELECT CHG_CODE09 FROM EBID_COM911T WHERE BASECD = '911' AND DETAILCD = A.CON_CUR_CD )         AS CON_P                                                                                                                                            \n");
			sql.append("                                   , ''         AS CONCD                                                                                                                                                                         \n");
			sql.append("                                   , (SELECT DEPART_DEPT_NM FROM PUB0120T WHERE ACCT_ID = B.CON_CHARGE_ID  )  ACC_DEPT_NM                                                                                                                                                                               \n");
			sql.append("									, F_GET_D_CURRENCY(NVL(H.PREPAY_SUPPLY_AMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )		AS PREPAY_SUPPLY_AMT										\n");
			sql.append("									, F_GET_D_CURRENCY(NVL(H.PREPAY_SUPPLY_TAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )		AS PREPAY_SUPPLY_TAMT										\n");
			sql.append("									, F_GET_D_CURRENCY(NVL(H.PREPAY_SUPPLY_NAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )		AS PREPAY_SUPPLY_NAMT										\n");
    	    sql.append("									, F_GET_D_CURRENCY(NVL(A.PRE_PAY_DEDUCT_AMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )		AS PRE_PAY_DEDUCT_AMT										\n");
    	    sql.append("									, F_GET_D_CURRENCY(NVL(A.PRE_PAY_DEDUCT_TAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )	AS PRE_PAY_DEDUCT_TAMT										\n");
    	    sql.append("									, F_GET_D_CURRENCY(NVL(A.PRE_PAY_DEDUCT_NAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )	AS PRE_PAY_DEDUCT_NAMT										\n");
    	    sql.append("									, F_GET_D_CURRENCY(NVL(A.PAY_DEDUCT_AMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )			AS PAY_DEDUCT_AMT												\n");
    	    sql.append("									, F_GET_D_CURRENCY(NVL(A.PAY_DEDUCT_TAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )		AS PAY_DEDUCT_TAMT												\n");
    	    sql.append("									, F_GET_D_CURRENCY(NVL(A.PAY_DEDUCT_NAMT, 0), F_GET_CURRENCY_DIGIT( NVL(A.CON_CUR_CD, 'KRW') ) )		AS PAY_DEDUCT_NAMT												\n");
    	    sql.append("									, ''	AS PREPAY_SUPPLY_RATE																															\n");
    	    sql.append("									, '( ' || TO_CHAR(DECODE(NVL(H.PREPAY_SUPPLY_AMT, 0),0,0,ROUND((A.PRE_PAY_DEDUCT_AMT/H.PREPAY_SUPPLY_AMT)*100,2)),'FM990.00') || '% )'	AS PRE_PAY_DEDUCT_RATE	\n");
    	    sql.append("									, '( ' || TO_CHAR(DECODE(NVL(H.PREPAY_SUPPLY_AMT, 0),0,0,ROUND((A.PAY_DEDUCT_AMT/H.PREPAY_SUPPLY_AMT)*100,2)),'FM990.00') || '% )' AS PAY_DEDUCT_RATE			\n");
    	    sql.append("									, A.TAX_METHOD_CD																																				\n");
			sql.append("                       FROM SUB1040T A                                                                                                                                                                                                                                              \n");
			sql.append("                                ,SUB2000T B                                                                                                                                                                                                                                         \n");
			sql.append("                                ,SUB1020T C                                                                                                                                                                                                                                         \n");
			sql.append("                                ,(SELECT ACCT_ID, DEPART_DEPT_CD, DEPART_DEPT_NM FROM PUB0120T) D                                                                                                                                                                                      \n");
			sql.append("                                ,(SELECT COUNT(*) ACMP_NUMBER, SUB_CONT_ID FROM SUB1040T GROUP BY SUB_CONT_ID) E                                                                                                                                                                    \n");
			sql.append("                                ,(SELECT CORP_ID, REP_NAME FROM SUB9000T_V)     F                                                                                                                                                                                                   \n");
			sql.append("	 							,(															\n");
	    	sql.append("	 							SELECT	SUB_CONT_ID											\n");
	    	sql.append("	 							        ,CON_CORP_ID										\n");
	    	sql.append("	 							        ,SUM(REQ_PREPAY_SUPPLY_AMT) AS PREPAY_SUPPLY_AMT	\n");
	    	sql.append("	 							        ,SUM(REQ_PREPAY_SUPPLY_TAMT) AS PREPAY_SUPPLY_TAMT	\n");
	    	sql.append("	 							        ,SUM(REQ_PREPAY_SUPPLY_NAMT) AS PREPAY_SUPPLY_NAMT	\n");
	    	sql.append("	 							FROM		SUB1030T										\n");
	    	sql.append("	 							WHERE		STATUS_CD = '10'								\n");
	    	sql.append("	 							AND		SUB_CONT_MOD_ID <= "+subContModId+"					\n");
	    	sql.append("	 							GROUP BY SUB_CONT_ID, CON_CORP_ID							\n");
	    	sql.append("	 							) H															\n");
			sql.append("                       WHERE A.SUB_CONT_ID = B.SUB_CONT_ID                                  \n");
			sql.append("                       AND A.MOD_NO = B.MOD_NO                                              \n");
			sql.append("                       AND A.CON_CORP_ID = C.CON_CORP_ID                                    \n");
			sql.append("                       AND B.REQ_USERID = D.ACCT_ID(+)                                      \n");
			sql.append("                       AND E.SUB_CONT_ID = A.SUB_CONT_ID                                    \n");
			sql.append("                       AND C.CORP_ID = F.CORP_ID(+)                                         \n");
			sql.append("                       AND C.MAIN_CORP = 'Y'                                                \n");
			sql.append("	 					AND A.SUB_CONT_ID = H.SUB_CONT_ID(+)									\n");
			sql.append("                       AND A.ACMP_ID =  '"+tmpslipID+"'                                                                                                                                                                                                                                       \n");
			
			
			//search.setStatement(sql.toString());
			//rowSet = search.execute();
			System.out.println(sql.toString());
			persistent_c.setStatement(sql.toString());
			rowSet = persistent_c.query();
			
			if(rowSet.size()>0){
				vo = RowSetUtility.getValueObject(rowSet.getRow(0));
			}
			
		}catch(Exception e){
			WAFLogger.error("SQL : " + search.getStatement());
            WAFLogger.error(e);
		}finally{
			if( vo == null) vo = new ValueObject();
		}
		return vo;
		
		
	}
	
	public RowSet getPayReqList2(String tmpslipID ){
		Search search = new SearchImpl();
		RowSet rowSet = new RowSetImpl();
		StringBuffer  sql = new StringBuffer();
		
		try{
			sql.append("				SELECT DOC_NM                                                                                      	\n");
			sql.append("				FROM                                                                                              	\n");
			sql.append("				(                                                                                                 	\n");
			sql.append("				SELECT DECODE(NVL(B.ID,''),'','□','■') || '  ' || A.DETAILNM  AS  DOC_NM, ROWNUM AS RO				\n");	
			sql.append("				    	,A.DETAILCD                                                              	\n");
			sql.append("				    FROM EBID_COM911T A, PUB0510T B                                                              	\n");
			sql.append("				    WHERE A.BASECD = 'SUB_ACMP_FILE'                                                              	\n");
			sql.append("				    AND A.DETAILCD = B.ID(+)	                                                                  	\n");
			sql.append("	    			AND B.FILE_GB(+) = 'RESOLUTION_"+tmpslipID+"'                                             		\n");
			sql.append("				    AND A.CHG_CODE01 = '10'                                                                        	\n");
			sql.append("				    AND DETAILCD NOT IN ('560', '570')                                                             	\n");
			sql.append("				)   A                                                                                             	\n");
			sql.append("				, ( SELECT  LEVEL AS RO2                                                                          	\n");
			sql.append("				        FROM DUAL                                                                                 	\n");
			sql.append("				      CONNECT BY LEVEL <= 9) B                                                                     	\n");
			sql.append("				WHERE A.RO(+) =B.RO2                                                                              	\n");
			sql.append("				ORDER BY A.DETAILCD 																					\n");
			
			search.setStatement(sql.toString());
			
			rowSet = search.execute();
			
		}catch(Exception e){
			WAFLogger.error("SQL : " + search.getStatement());
			WAFLogger.error(e);
		}finally{
			if( rowSet == null) rowSet = new RowSetImpl();
		}
		return rowSet;
		
		
	}

	public String getSubContModId( Connection con, String acmp_id){
		
		Persistent persistent_c = null;
		Search search = new SearchImpl();
		RowSet rowSet = new RowSetImpl();
		StringBuffer  sql = new StringBuffer();
    	String rtnStr = "";
    	
    	try {
    		persistent_c = new PersistentImpl(con);
    		sql.append("	SELECT	A.SUB_CONT_MOD_ID				\n");
    		sql.append("	FROM	SUB2000T A				\n");
    		sql.append("			,SUB1040T C				\n");
    		sql.append("	WHERE	A.SUB_CONT_ID = C.SUB_CONT_ID	\n");
    		sql.append("	AND		A.MOD_NO = C.MOD_NO				\n");
    		sql.append("	AND		C.ACMP_ID = "+acmp_id+"			\n");
    		
    		persistent_c.setStatement(sql.toString());
			rowSet = persistent_c.query();
			
			if(rowSet.size()>0){
    			rtnStr = rowSet.getRow(0).get("SUB_CONT_MOD_ID");
    		}
    		
    	} catch(Exception e) {
    		WAFLogger.error(this.getClass().getName() + " --> getSubContModId() : \n" + e.getMessage());
    		WAFLogger.error("SQL : " + search.getStatement());
    		WAFLogger.error(e);
    		
    	} finally {
    		if( rtnStr == null ) rtnStr = "";
    		
    	}
    	
    	return rtnStr;
	}

}
