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

/*
 * 외주기성고 계산서 : 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 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.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;

import kr.co.udapsoft.common.util.PCMSUtil;
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 SACDOCreatePDF6 {

	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 doBiz(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, 12, 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;
			/*
			 * 정보 검색 시작 ---------------------------------------------
			 */
			
			listRowSet = getPayReqList(tmpslipID);
			
			// 정보 검색 끝 ---------------------------------------------
			
			/*
			 * ===========================================================================================
			 * 제목 생성
			 * ===========================================================================================
			 */
			makeTitle(document, FontTitle, FontTitle2,  request);

			//본문생성
			setBorder(border, true, true, true, true);
			
			
            //1행
		    PdfPTable table11 = new PdfPTable(4);
		    table11.setWidthPercentage(100);
		    table11.setSpacingBefore(7f);
		    table11.setSpacingAfter(7f);
            float[] table11Width = {15f,40f,15f,15f};
            table11.setWidths(table11Width);
            
          
            
            // 1행
            PT_addCell(table11, new String [] { "현장" }, FontTitle, border,
    				Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + "(" + listRowSet.get("DEPT_CD") + ")" + listRowSet.get("DEPT_NM") , FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
 
            PT_addCell(table11, new String [] { "발주처" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("DEALRER_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "계약번호" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("CON_DOC_NO"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f,false);
            PT_addCell(table11, new String [] { "계약일자" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("CON_DATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f,false);
            
            PT_addCell(table11, new String [] { "계약명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("BUILD_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);

            PT_addCell(table11, new String [] { "원도급공사명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("UND_CON_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f,false);
            
            PT_addCell(table11, new String [] { "하도급공사명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("SUB_UND_CON_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f,false);
            
            PT_addCell(table11, new String [] { "공사장소" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("WORK_PLACE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "공사기간" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("WORK_DATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);

            PT_addCell(table11, new String [] { "계약금액" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 90f ,false);
            
            
            PdfPTable table21 = new PdfPTable(4);
            float[] table21Width = {13f,25f,5f,25f};
            table21.setWidths(table21Width);
            PdfPCell permission = new PdfPCell(table21);
            setBorder(border, false, false, false, false);
            
            
            
            
            PT_addCell(table21, new String [] { "합   계 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_amt").equals("0")){ 
            	PT_addCell(table21,  "일금" + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,"(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
			} 

            PT_addCell(table21, new String [] { "공급가 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_amt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0) + "원정" +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "- 과세 :" }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_tamt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0) + "원정" +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "- 면세 :" }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_namt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0) + "원정" +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "부가세 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_surtax_amt").equals("0")){ 
            	PT_addCell(table21, "일금"  + PCMSUtil.toHangule_decimal("0")  , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,  "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,   "(" + "￦"+ PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 

            permission.setColspan(3);
            table11.addCell(permission);
            setBorder(border, true, true, true, true);
            
            PT_addCell(table11, new String [] { "선급금" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 90f ,false);
            
            
            PdfPTable table31 = new PdfPTable(4);
            float[] table31Width = {13f,25f,5f,25f};
            table31.setWidths(table31Width);
            PdfPCell permission2 = new PdfPCell(table31);
            setBorder(border, false, false, false, false);
            
            PT_addCell(table31, new String [] { "합   계 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("req_amt").equals("0")){ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0) + "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table31, new String [] { "공급가 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("supply_amt").equals("0")){ 
            	PT_addCell(table31, "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0)+  "원정" +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + "￦" +PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table31, new String [] { "부가세 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f,false);
            if(listRowSet.get("surtax_amt").equals("0")){ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0) +  "원정" +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금" + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { "원정" }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + "￦" + PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0) +  "원정"  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            permission2.setColspan(3);
            table11.addCell(permission2);
            setBorder(border, true, true, true, true);
    
            
            PT_addCell(table11, new String [] { "지급조건" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11,  "  " + listRowSet.get("PAY_COND_GB_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "지급조건기술" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("PAY_CONTENT"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "지체상금" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("DELAY_RATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "업체명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("CORP_KOR"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "특이사항" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_TOP, 1, 100f ,false);
            PT_addCell(table11, "  " + listRowSet.get("CON_SPE_TXT"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 100f ,false);
            
            /*
            */
            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 +" 생성완료");
	}

	/*
	 * ===========================================================================================
	 * A. 타이틀
	 * ===========================================================================================
	 */
	
	/**
	 * @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, 9, 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;
			/*
			 * 정보 검색 시작 ---------------------------------------------
			 */
			
			listRowSet = getPayReqList1(con, tmpslipID);
			
			// 정보 검색 끝 ---------------------------------------------
			
			/*
			 * ===========================================================================================
			 * 제목 생성
			 * ===========================================================================================
			 */
			makeTitle(document, FontTitle, FontTitle2,  request);

			//본문생성
			setBorder(border, true, true, true, true);
			
			
            //1행
		    PdfPTable table11 = new PdfPTable(4);
		    table11.setWidthPercentage(100);
		    table11.setSpacingBefore(7f);
		    table11.setSpacingAfter(7f);
            float[] table11Width = {15f,40f,15f,15f};
            table11.setWidths(table11Width);
            
          
            
            // 1행
            PT_addCell(table11, new String [] { "현장" }, FontTitle, border,
    				Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + "(" + listRowSet.get("DEPT_CD") + ")" + listRowSet.get("DEPT_NM") , FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
 
            PT_addCell(table11, new String [] { "발주처" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("DEALRER_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "계약번호" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("CON_DOC_NO"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f,false);
            PT_addCell(table11, new String [] { "계약일자" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("CON_DATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f,false);
            
            PT_addCell(table11, new String [] { "계약명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("BUILD_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);

            PT_addCell(table11, new String [] { "원도급공사명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("UND_CON_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f,false);
            
            PT_addCell(table11, new String [] { "하도급공사명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("SUB_UND_CON_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f,false);
            
            PT_addCell(table11, new String [] { "공사장소" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("WORK_PLACE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "공사기간" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("WORK_DATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);

            PT_addCell(table11, new String [] { "계약금액" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 90f ,false);
            
            
            PdfPTable table21 = new PdfPTable(4);
            float[] table21Width = {13f,25f,5f,25f};
            table21.setWidths(table21Width);
            PdfPCell permission = new PdfPCell(table21);
            setBorder(border, false, false, false, false);
            
            
            
            //2016.7.19 원정 listRowSet.get("CON_CUR_WON"), ￦ listRowSet.get("CON_CUR_NAME")
            PT_addCell(table21, new String [] { "합   계 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_amt").equals("0")){ 
            	PT_addCell(table21,  "일금" + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON")}, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,"(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0)    +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
			} 

            PT_addCell(table21, new String [] { "공급가 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_amt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "- 과세 :" }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_tamt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME")+ PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "- 면세 :" }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_namt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "부가세 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_surtax_amt").equals("0")){ 
            	PT_addCell(table21, "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,  "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0)    +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,   "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0)    +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 

            permission.setColspan(3);
            table11.addCell(permission);
            setBorder(border, true, true, true, true);
            
            PT_addCell(table11, new String [] { "선급금" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 90f ,false);
            
            
            PdfPTable table31 = new PdfPTable(4);
            float[] table31Width = {13f,25f,5f,25f};
            table31.setWidths(table31Width);
            PdfPCell permission2 = new PdfPCell(table31);
            setBorder(border, false, false, false, false);
            
            PT_addCell(table31, new String [] { "합   계 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("req_amt").equals("0")){ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON")}, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON")}, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table31, new String [] { "공급가 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("supply_amt").equals("0")){ 
            	PT_addCell(table31, "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0)  +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") +PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table31, new String [] { "부가세 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f,false);
            if(listRowSet.get("surtax_amt").equals("0")){ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] {listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0)   +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금" + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] {listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0)    +  ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            permission2.setColspan(3);
            table11.addCell(permission2);
            setBorder(border, true, true, true, true);
    
            
            PT_addCell(table11, new String [] { "지급조건" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11,  "  " + listRowSet.get("PAY_COND_GB_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "지급조건기술" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("PAY_CONTENT"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "지체상금" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("DELAY_RATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "업체명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("CORP_KOR"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "특이사항" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_TOP, 1, 100f ,false);
            PT_addCell(table11, "  " + listRowSet.get("CON_SPE_TXT"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 100f ,false);
            
            /*
            */
            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 +" 생성완료");
	}
	
	private static void makeTitle(Document document, Font FontTitle,
			Font FontTitle2,  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);
		
		document.add(tbl_Title);
		
		
	}

	/*
	 * ===========================================================================================
	 * 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 getPayReqList(String tmpslipID ){
		Search search = new SearchImpl();
		ValueObject vo = null;
		RowSet rowSet = new RowSetImpl();
		StringBuffer  sql = new StringBuffer();
		
		try{
			
			sql.append("		   		    SELECT MAIN.TMPSLIP_ID                                                                                                                              \n");
			sql.append("		                 , TO_CHAR(MAIN.PROOFDATE, 'YYYY-MM-DD')    PROOFDATE                                                                                           \n");
			sql.append("		                 , MAIN.DEPT_CD                                                                                                                                 \n");
			sql.append("		                 , CONTRACT.DEALER_NM                      AS DEALRER_NM                                                                                        \n");
			sql.append("		                 , CONTRACT.DEPT_NAME                      AS DEPT_NM                                                                                           \n");
			sql.append("		                 , CONTRACT.CON_DOC_NO                     AS CON_DOC_NO                                                                                        \n");
			sql.append("		                 , TO_CHAR(CONTRACT.CON_DATE,'YYYY-MM-DD') AS CON_DATE                                                                                        	\n");
			sql.append("		                 , CONTRACT.BUILD_NAME                     AS BUILD_NAME                                                                                        \n");
			sql.append("		                 , CONTRACT.UND_CON_NAME                   AS UND_CON_NAME                                                                                      \n");
			sql.append("		                 , CONTRACT.SUB_UND_CON_NAME               AS SUB_UND_CON_NAME                                                                                  \n");
			sql.append("		                 , CONTRACT.WORK_PLACE                     AS WORK_PLACE                                                                                        \n");
			sql.append("		                 , CONTRACT.CON_SUPPLY_AMT                 AS con_supply_amt                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_SUPPLY_TAMT                 AS con_supply_tamt                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_SUPPLY_NAMT                 AS con_supply_namt                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_SURTAX_AMT                                                                                                                      \n");
			sql.append("		                 , CONTRACT.CON_AMT                                                                                                                             \n");
			sql.append("		                 , CONTRACT.LABOR_AMT                                                                                                                           \n");
			sql.append("		                 , CONTRACT.PREPAY_SUPPLY_AMT             AS PREPAY_SUPPLY_AMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_SUPPLY_TAMT            AS PREPAY_SUPPLY_TAMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_SUPPLY_NAMT            AS PREPAY_SUPPLY_NAMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_SURTAX_AMT             AS PREPAY_SURTAX_AMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_AMT                    AS PREPAY_AMT                                                                                         \n");
			sql.append("		                 , PAY_TYPE.CHG_CODE01  			      AS PAY_COND_GB_NM                                                                          			\n");
			sql.append("		                 , CONTRACT.PAY_CONTENT                   AS PAY_CONTENT                                                                           				\n");
			sql.append("		                 , (TO_CHAR(CONTRACT.START_WORK_DATE,'YYYY-MM-DD') || ' ~ ' || TO_CHAR(CONTRACT.END_WORK_DATE,'YYYY-MM-DD') ) WORK_DATE                         \n");
			sql.append("		                 , CONTRACT.CON_EST_GUAR_RATE             AS CON_EST_GUAR_RATE                                                                                  \n");
			sql.append("		                 , CONTRACT.CON_EST_GUAR_AMT                                                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_GUAR_TERM                AS CON_GUAR_TERM                                                                                       \n");
			sql.append("		                 , CONTRACT.DEF_EST_GUAR_RATE            AS DEF_EST_GUAR_RATE                                                                                   \n");
			sql.append("		                 , CONTRACT.DEF_GUAR_AMT                                                                                                                        \n");
			sql.append("		                 , CONTRACT.DEF_EST_TERM                 AS DEF_EST_TERM                                                                                        \n");
			sql.append("		                 , CONTRACT.LABOR_GUAR_JOIN_AMT_GB       AS LABOR_GUAR_JOIN_AMT_GB                                                                              \n");
			sql.append("		                 , CONTRACT.CON_SPE_TXT                  AS CON_SPE_TXT                                                                                         \n");
			sql.append("		                 , CONTRACT.DELAY_RATE        AS DELAY_RATE                                                                                                     \n");
			sql.append("		                 , CUR_CD.CHG_CODE02          as CON_CUR_NAME                                                                                                   \n");
			sql.append("		                 , CUR_CD.CHG_CODE06          as CON_CUR_WON                                                                                                    \n");
			sql.append("		                 , CUR_CD.CHG_CODE01          as CON_CUR_DIGIT                                                                                                  \n");
			sql.append("		                 , MAIN.DCERTI_NO                                                                                                                               \n");
			sql.append("		                 , SUBVENDOR.CORP_KOR        AS CORP_KOR                                                                                                        \n");
			sql.append("		                 , SUBVENDOR.CORP_ID                                                                                                                            \n");
			sql.append("		                 , MAIN.PREREQTFLG                                                                                                                              \n");
			sql.append("		                 , MAIN.ACMP_NO                                                                                                                                 \n");
			sql.append("		                 , MAIN.PROOF_CLASS                                                                                                                             \n");
			sql.append("		                 , MAIN.ORDACCDESC                                                                                                                              \n");
			sql.append("		                 , MAIN.CON_CUR_CD                                                                                                                              \n");
			sql.append("		                 , MAIN.SUPPLY_AMT                          SUPPLY_AMT                                                                                                    \n");
			sql.append("		                 , MAIN.SURTAX_AMT                          SURTAX_AMT                                                                                                    \n");
			sql.append("		                 , MAIN.SUPPLY_AMT + MAIN.SURTAX_AMT        REQ_AMT                                                                                             \n");
			sql.append("		                 , CONTRACT.CON_CHARGE_ID                                                                                                                       \n");
			sql.append("		                 , CONTRACT.CON_CHARGE_NAME                                                                                                                     \n");
			sql.append("		                 , MAIN.DEALR_CD                                                                                                                                \n");
			sql.append("		                 , MAIN.PAYITEM                                                                                                                                 \n");
			sql.append("		                 , MAIN.COSTCODE                                                                                                                                \n");
			sql.append("		                 , MAIN.COSTTYPE                                                                                                                                \n");
			sql.append("		                 , MAIN.ACC_CLASS                                                                                                                               \n");
			sql.append("		                 , MAIN.PAY_GROUP                                                                                                                               \n");
			sql.append("		                 , MAIN.PAYMENT_TERMS                                                                                                                           \n");
			sql.append("		                 , MAIN.TMPSLIP_DEPT                                                                                                                            \n");
			sql.append("		                 , MAIN.TMPSLIP_DT                                                                                                                              \n");
			sql.append("		                 , MAIN.TMPSLIP_NO                                                                                                                              \n");
			sql.append("		                 , MAIN.TMPSLIP_YN                                                                                                                              \n");
			sql.append("		                 , MAIN.SLIP_YN                                                                                                                                 \n");
			sql.append("		                 , MAIN.ACMP_ID                                                                                                                                 \n");
			sql.append("		                 , MAIN.PREPAY_ID                                                                                                                               \n");
			sql.append("		                 , PREPAY.CON_CORP_ID                                                                                                                           \n");
			sql.append("		                 , CONTRACT.SUB_CONT_ID                                                                                                                         \n");
			sql.append("		                  , CASE                                                                                                                                        \n");
			sql.append("		                        WHEN (SLIP.STATUS_CD = '1') AND (SLIP.RETURN_CD = 'Y') THEN '-1'                                                                        \n");
			sql.append("		                        ELSE SLIP.STATUS_CD                                                                                                                     \n");
			sql.append("		                      END                                      STATUS_CD                                                                                        \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		              FROM SUB1050T            MAIN                                                                                                                     \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN SUB1030T            PREPAY                                                                                                                   \n");
			sql.append("		                ON MAIN.PREPAY_ID = PREPAY.PREPAY_ID                                                                                                            \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN SUB1020T         SUBVENDOR                                                                                                                  	\n");
			sql.append("		                ON SUBVENDOR.MAIN_CORP = 'Y'                                                                                                   					\n");
			sql.append("		               AND PREPAY.CON_CORP_ID = SUBVENDOR.CON_CORP_ID                                                                                                   \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN SUB1000T             CONTRACT                                                                                                                \n");
			sql.append("		                ON PREPAY.SUB_CONT_ID = CONTRACT.SUB_CONT_ID                                                                                                    \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN SAC01001            SLIP                                                                                                                     \n");
			sql.append("		                   ON MAIN.TMPSLIP_DEPT = SLIP.TMPSLIP_DEPT                                                                                                     \n");
			sql.append("		                  AND MAIN.TMPSLIP_DT     = SLIP.TMPSLIP_DT                                                                                                     \n");
			sql.append("		                  AND MAIN.TMPSLIP_NO      = SLIP.TMPSLIP_NO                                                                                                    \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN COM911T    CON_KIND                                                                                                                          \n");
			sql.append("		                  ON CON_KIND.BASECD = 'SUB_CON_KIND'                                                                                                           \n");
			sql.append("		                AND  CONTRACT.CON_GB = CON_KIND.DETAILCD                                                                                                        \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN COM911T    PAY_TYPE                                                                                                                          \n");
			sql.append("		                  ON PAY_TYPE.BASECD = 'SUB_ACMP_PAY_TYPE'                                                                                                      \n");
			sql.append("		                AND  CONTRACT.PAY_COND_GB = PAY_TYPE.DETAILCD                                                                                                   \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN COM911T    CUR_CD                                                                                                                            \n");
			sql.append("		                  ON CUR_CD.BASECD = '911'                                                                                                                    	\n");
			sql.append("		                AND  CONTRACT.CON_CUR_CD = CUR_CD.DETAILCD                                                                                                      \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		             WHERE PREREQTFLG     = 'PREPAY'                                                                                                                    \n");
			sql.append("		               AND TMPSLIP_ID 	  = "+tmpslipID+"                                                                                                               \n");
			sql.append("		             ORDER BY PROOFDATE desc, DEPT_NAME, CON_DOC_NO, CORP_KOR  																							\n");
			          
			         
			search.setStatement(sql.toString());
			
			rowSet = search.execute();
			
			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 ValueObject getPayReqList1(Connection con, String tmpslipID ){
		
		ValueObject vo = null;
		RowSet rowSet = new RowSetImpl();
		StringBuffer  sql = new StringBuffer();
		
		Persistent pSelect  = null;
		
		try{
			
			pSelect = new PersistentImpl(con);
			
			sql.append("		   		    SELECT MAIN.TMPSLIP_ID                                                                                                                              \n");
			sql.append("		                 , TO_CHAR(MAIN.PROOFDATE, 'YYYY-MM-DD')    PROOFDATE                                                                                           \n");
			sql.append("		                 , MAIN.DEPT_CD                                                                                                                                 \n");
			sql.append("		                 , CONTRACT.DEALER_NM                      AS DEALRER_NM                                                                                        \n");
			sql.append("		                 , CONTRACT.DEPT_NAME                      AS DEPT_NM                                                                                           \n");
			sql.append("		                 , CONTRACT.CON_DOC_NO                     AS CON_DOC_NO                                                                                        \n");
			sql.append("		                 , TO_CHAR(CONTRACT.CON_DATE,'YYYY-MM-DD') AS CON_DATE                                                                                        	\n");
			sql.append("		                 , CONTRACT.BUILD_NAME                     AS BUILD_NAME                                                                                        \n");
			sql.append("		                 , CONTRACT.UND_CON_NAME                   AS UND_CON_NAME                                                                                      \n");
			sql.append("		                 , CONTRACT.SUB_UND_CON_NAME               AS SUB_UND_CON_NAME                                                                                  \n");
			sql.append("		                 , CONTRACT.WORK_PLACE                     AS WORK_PLACE                                                                                        \n");
			sql.append("		                 , CONTRACT.CON_SUPPLY_AMT                 AS con_supply_amt                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_SUPPLY_TAMT                 AS con_supply_tamt                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_SUPPLY_NAMT                 AS con_supply_namt                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_SURTAX_AMT                                                                                                                      \n");
			sql.append("		                 , CONTRACT.CON_AMT                                                                                                                             \n");
			sql.append("		                 , CONTRACT.LABOR_AMT                                                                                                                           \n");
			sql.append("		                 , CONTRACT.PREPAY_SUPPLY_AMT             AS PREPAY_SUPPLY_AMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_SUPPLY_TAMT            AS PREPAY_SUPPLY_TAMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_SUPPLY_NAMT            AS PREPAY_SUPPLY_NAMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_SURTAX_AMT             AS PREPAY_SURTAX_AMT                                                                                  \n");
			sql.append("		                 , CONTRACT.PREPAY_AMT                    AS PREPAY_AMT                                                                                         \n");
			sql.append("		                 , PAY_TYPE.CHG_CODE01  			      AS PAY_COND_GB_NM                                                                          			\n");
			sql.append("		                 , CONTRACT.PAY_CONTENT                   AS PAY_CONTENT                                                                           				\n");
			sql.append("		                 , (TO_CHAR(CONTRACT.START_WORK_DATE,'YYYY-MM-DD') || ' ~ ' || TO_CHAR(CONTRACT.END_WORK_DATE,'YYYY-MM-DD') ) WORK_DATE                         \n");
			sql.append("		                 , CONTRACT.CON_EST_GUAR_RATE             AS CON_EST_GUAR_RATE                                                                                  \n");
			sql.append("		                 , CONTRACT.CON_EST_GUAR_AMT                                                                                                                    \n");
			sql.append("		                 , CONTRACT.CON_GUAR_TERM                AS CON_GUAR_TERM                                                                                       \n");
			sql.append("		                 , CONTRACT.DEF_EST_GUAR_RATE            AS DEF_EST_GUAR_RATE                                                                                   \n");
			sql.append("		                 , CONTRACT.DEF_GUAR_AMT                                                                                                                        \n");
			sql.append("		                 , CONTRACT.DEF_EST_TERM                 AS DEF_EST_TERM                                                                                        \n");
			sql.append("		                 , CONTRACT.LABOR_GUAR_JOIN_AMT_GB       AS LABOR_GUAR_JOIN_AMT_GB                                                                              \n");
			sql.append("		                 , CONTRACT.CON_SPE_TXT                  AS CON_SPE_TXT                                                                                         \n");
			sql.append("		                 , CONTRACT.DELAY_RATE        AS DELAY_RATE                                                                                                     \n");
			sql.append("		                 , CUR_CD.CHG_CODE02          as CON_CUR_NAME                                                                                                   \n");
			sql.append("		                 , CUR_CD.CHG_CODE06          as CON_CUR_WON                                                                                                    \n");
			sql.append("		                 , CUR_CD.CHG_CODE01          as CON_CUR_DIGIT                                                                                                  \n");
			sql.append("		                 , MAIN.DCERTI_NO                                                                                                                               \n");
			sql.append("		                 , SUBVENDOR.CORP_KOR        AS CORP_KOR                                                                                                        \n");
			sql.append("		                 , SUBVENDOR.CORP_ID                                                                                                                            \n");
			sql.append("		                 , MAIN.PREREQTFLG                                                                                                                              \n");
			sql.append("		                 , MAIN.ACMP_NO                                                                                                                                 \n");
			sql.append("		                 , MAIN.PROOF_CLASS                                                                                                                             \n");
			sql.append("		                 , MAIN.ORDACCDESC                                                                                                                              \n");
			sql.append("		                 , MAIN.CON_CUR_CD                                                                                                                              \n");
			sql.append("		                 , MAIN.SUPPLY_AMT                          SUPPLY_AMT                                                                                                    \n");
			sql.append("		                 , MAIN.SURTAX_AMT                          SURTAX_AMT                                                                                                    \n");
			sql.append("		                 , MAIN.SUPPLY_AMT + MAIN.SURTAX_AMT        REQ_AMT                                                                                             \n");
			sql.append("		                 , CONTRACT.CON_CHARGE_ID                                                                                                                       \n");
			sql.append("		                 , CONTRACT.CON_CHARGE_NAME                                                                                                                     \n");
			sql.append("		                 , MAIN.DEALR_CD                                                                                                                                \n");
			sql.append("		                 , MAIN.PAYITEM                                                                                                                                 \n");
			sql.append("		                 , MAIN.COSTCODE                                                                                                                                \n");
			sql.append("		                 , MAIN.COSTTYPE                                                                                                                                \n");
			sql.append("		                 , MAIN.ACC_CLASS                                                                                                                               \n");
			sql.append("		                 , MAIN.PAY_GROUP                                                                                                                               \n");
			sql.append("		                 , MAIN.PAYMENT_TERMS                                                                                                                           \n");
			sql.append("		                 , MAIN.TMPSLIP_DEPT                                                                                                                            \n");
			sql.append("		                 , MAIN.TMPSLIP_DT                                                                                                                              \n");
			sql.append("		                 , MAIN.TMPSLIP_NO                                                                                                                              \n");
			sql.append("		                 , MAIN.TMPSLIP_YN                                                                                                                              \n");
			sql.append("		                 , MAIN.SLIP_YN                                                                                                                                 \n");
			sql.append("		                 , MAIN.ACMP_ID                                                                                                                                 \n");
			sql.append("		                 , MAIN.PREPAY_ID                                                                                                                               \n");
			sql.append("		                 , PREPAY.CON_CORP_ID                                                                                                                           \n");
			sql.append("		                 , CONTRACT.SUB_CONT_ID                                                                                                                         \n");
			/*
			sql.append("		                  , CASE                                                                                                                                        \n");
			sql.append("		                        WHEN (SLIP.STATUS_CD = '1') AND (SLIP.RETURN_CD = 'Y') THEN '-1'                                                                        \n");
			sql.append("		                        ELSE SLIP.STATUS_CD                                                                                                                     \n");
			sql.append("		                      END                                      STATUS_CD                                                                                        \n");
			sql.append("		                                                                                                                                                                \n");
			*/
			sql.append("		              FROM SUB1050T            MAIN                                                                                                                     \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN SUB1030T            PREPAY                                                                                                                   \n");
			sql.append("		                ON MAIN.PREPAY_ID = PREPAY.PREPAY_ID                                                                                                            \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN SUB1020T         SUBVENDOR                                                                                                                  	\n");
			sql.append("		                ON SUBVENDOR.MAIN_CORP = 'Y'                                                                                                   					\n");
			sql.append("		               AND PREPAY.CON_CORP_ID = SUBVENDOR.CON_CORP_ID                                                                                                   \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN SUB1000T             CONTRACT                                                                                                                \n");
			sql.append("		                ON PREPAY.SUB_CONT_ID = CONTRACT.SUB_CONT_ID                                                                                                    \n");
			sql.append("		                                                                                                                                                                \n");
			/*
			sql.append("		   LEFT OUTER JOIN SAC01001            SLIP                                                                                                                     \n");
			sql.append("		                   ON MAIN.TMPSLIP_DEPT = SLIP.TMPSLIP_DEPT                                                                                                     \n");
			sql.append("		                  AND MAIN.TMPSLIP_DT     = SLIP.TMPSLIP_DT                                                                                                     \n");
			sql.append("		                  AND MAIN.TMPSLIP_NO      = SLIP.TMPSLIP_NO                                                                                                    \n");
			sql.append("		                                                                                                                                                                \n");
			*/
			sql.append("		   LEFT OUTER JOIN EBID_COM911T    CON_KIND                                                                                                                          \n");
			sql.append("		                  ON CON_KIND.BASECD = 'SUB_CON_KIND'                                                                                                           \n");
			sql.append("		                AND  CONTRACT.CON_GB = CON_KIND.DETAILCD                                                                                                        \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN EBID_COM911T    PAY_TYPE                                                                                                                          \n");
			sql.append("		                  ON PAY_TYPE.BASECD = 'SUB_ACMP_PAY_TYPE'                                                                                                      \n");
			sql.append("		                AND  CONTRACT.PAY_COND_GB = PAY_TYPE.DETAILCD                                                                                                   \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		   LEFT OUTER JOIN EBID_COM911T    CUR_CD                                                                                                                            \n");
			sql.append("		                  ON CUR_CD.BASECD = '911'                                                                                                                    	\n");
			sql.append("		                AND  CONTRACT.CON_CUR_CD = CUR_CD.DETAILCD                                                                                                      \n");
			sql.append("		                                                                                                                                                                \n");
			sql.append("		             WHERE PREREQTFLG     = 'PREPAY'                                                                                                                    \n");
			sql.append("		               AND TMPSLIP_ID 	  = "+tmpslipID+"                                                                                                               \n");
			sql.append("		             ORDER BY PROOFDATE desc, DEPT_NAME, CON_DOC_NO, CORP_KOR  																							\n");
			          
			System.out.println(sql.toString());
			pSelect.setStatement(sql.toString());
			rowSet = pSelect.query();
			if(rowSet.size()>0){
				vo = RowSetUtility.getValueObject(rowSet.getRow(0));
			}
			
		}catch(Exception e){
			WAFLogger.error("SQL : " + sql.toString());
            WAFLogger.error(e);
		}finally{
			if( vo == null) vo = new ValueObject();
		}
		return vo;
		
		
	}
	
	
	/**
	 * @param args
	 */
	public void doBiz1Rtn(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, 9, 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;
			/*
			 * 정보 검색 시작 ---------------------------------------------
			 */
			
			listRowSet = getPayReqList1(con, tmpslipID);
			
			// 정보 검색 끝 ---------------------------------------------
			
			/*
			 * ===========================================================================================
			 * 제목 생성
			 * ===========================================================================================
			 */
			makeTitle(document, FontTitle, FontTitle2,  request);

			//본문생성
			setBorder(border, true, true, true, true);
			
			
            //1행
		    PdfPTable table11 = new PdfPTable(4);
		    table11.setWidthPercentage(100);
		    table11.setSpacingBefore(7f);
		    table11.setSpacingAfter(7f);
            float[] table11Width = {15f,40f,15f,15f};
            table11.setWidths(table11Width);
            
          
            
            // 1행
            PT_addCell(table11, new String [] { "현장" }, FontTitle, border,
    				Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + "(" + listRowSet.get("DEPT_CD") + ")" + listRowSet.get("DEPT_NM") , FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
 
            PT_addCell(table11, new String [] { "발주처" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("DEALRER_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "계약번호" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("CON_DOC_NO"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f,false);
            PT_addCell(table11, new String [] { "계약일자" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("CON_DATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f,false);
            
            PT_addCell(table11, new String [] { "계약명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("BUILD_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);

            PT_addCell(table11, new String [] { "원도급공사명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("UND_CON_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f,false);
            
            PT_addCell(table11, new String [] { "하도급공사명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            PT_addCell(table11, "  " +listRowSet.get("SUB_UND_CON_NAME"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f,false);
            
            PT_addCell(table11, new String [] { "공사장소" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("WORK_PLACE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "공사기간" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " +listRowSet.get("WORK_DATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);

            PT_addCell(table11, new String [] { "계약금액" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 90f ,false);
            
            
            PdfPTable table21 = new PdfPTable(4);
            float[] table21Width = {13f,25f,5f,25f};
            table21.setWidths(table21Width);
            PdfPCell permission = new PdfPCell(table21);
            setBorder(border, false, false, false, false);
            
            
            
          //2016.7.19 원정 listRowSet.get("CON_CUR_WON"), ￦listRowSet.get("CON_CUR_NAME")
            PT_addCell(table21, new String [] { "합   계 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_amt").equals("0")){ 
            	PT_addCell(table21,  "일금" + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,"(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_amt"), 0) +    ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
			} 

            PT_addCell(table21, new String [] { "공급가 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_amt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "- 과세 :" }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_tamt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_tamt"), 0) +    ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "- 면세 :" }, FontTitle, border,
            		Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_supply_namt").equals("0")){ 
            	PT_addCell(table21,  "일금"  +  PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  +  PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, "(" +  listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_supply_namt"), 0) +    ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table21, new String [] { "부가세 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("con_surtax_amt").equals("0")){ 
            	PT_addCell(table21, "일금"  + PCMSUtil.toHangule_decimal("0")  , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] {listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,  "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0) +    ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table21, "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table21,   "(" + listRowSet.get("CON_CUR_NAME")+ PCMSUtil.convertFloor(listRowSet.getDouble("con_surtax_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 

            permission.setColspan(3);
            table11.addCell(permission);
            setBorder(border, true, true, true, true);
            
            PT_addCell(table11, new String [] { "선급금" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 90f ,false);
            
            
            PdfPTable table31 = new PdfPTable(4);
            float[] table31Width = {13f,25f,5f,25f};
            table31.setWidths(table31Width);
            PdfPCell permission2 = new PdfPCell(table31);
            setBorder(border, false, false, false, false);
            
            PT_addCell(table31, new String [] { "합   계 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("req_amt").equals("0")){ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("req_amt"), 0) +    ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table31, new String [] { "공급가 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            if(listRowSet.get("supply_amt").equals("0")){ 
            	PT_addCell(table31, "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0)+   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0).toString()) , FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") +PCMSUtil.convertFloor(listRowSet.getDouble("supply_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            PT_addCell(table31, new String [] { "부가세 :" }, FontTitle, border,
            		Element.ALIGN_MIDDLE, Element.ALIGN_MIDDLE, 1, 30f,false);
            if(listRowSet.get("surtax_amt").equals("0")){ 
            	PT_addCell(table31,  "일금"  + PCMSUtil.toHangule_decimal("0"), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            }else{ 
            	PT_addCell(table31,  "일금" + PCMSUtil.toHangule_decimal(PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0).toString()), FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            	PT_addCell(table31, new String [] { listRowSet.get("CON_CUR_WON") }, FontTitle, border,
            			Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 1, 30f ,false); 
            	PT_addCell(table31, "(" + listRowSet.get("CON_CUR_NAME") + PCMSUtil.convertFloor(listRowSet.getDouble("surtax_amt"), 0) +   ")", FontTitle, border,
            			Element.ALIGN_RIGHT, Element.ALIGN_MIDDLE, 1, 30f ,false);          
            } 
            
            permission2.setColspan(3);
            table11.addCell(permission2);
            setBorder(border, true, true, true, true);
    
            
            PT_addCell(table11, new String [] { "지급조건" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11,  "  " + listRowSet.get("PAY_COND_GB_NM"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "지급조건기술" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("PAY_CONTENT"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "지체상금" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("DELAY_RATE"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "업체명" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_MIDDLE, 1, 30f ,false);
            PT_addCell(table11, "  " + listRowSet.get("CORP_KOR"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 30f ,false);
            
            PT_addCell(table11, new String [] { "특이사항" }, FontTitle, border,
            		Element.ALIGN_CENTER, Element.ALIGN_TOP, 1, 100f ,false);
            PT_addCell(table11, "  " + listRowSet.get("CON_SPE_TXT"), FontTitle, border,
            		Element.ALIGN_LEFT, Element.ALIGN_MIDDLE, 3, 100f ,false);
            
            /*
            */
            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 +" 생성완료");
	}
}
