<%--
  - FileName   : payInstallResult.jsp
  - Author(s)  : ok
  - Date       : 2014.08.25
  - Copyright  : Copyright (c) 2014 www.udapsoft.co.kr, Inc.
  - Description: 대금신청상세(구매_중도금,잔금) -설치
--%>
    
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ page import="kr.co.hsnc.common.util.Formatter"%>
<%@ page import="com.udapsoft.waf.common.util.Formatter2"%>

<%@ include file="/jsp/work/taglib.jsp"%>
<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
<%
	ctx.init(request, response);
	HandlerStorage storage = ctx.getHandlerStorage();
	ValueObject params = storage.getParams();
	ValueObject user = storage.getUser();
	String event = storage.getEvent();
	
	RowSet warrList = storage.getRowSet("contOutWarr");	//보증정보
/* 	
	RowSet perpayReqDivComboList = storage.getRowSet("perpayReqDivComboList"); //신청구분 ComboList Data
	
	ValueObject file_giveup = storage.getValueObject("PREPAYMENTS_GIVEUP");
	ValueObject file_taxbill = storage.getValueObject("TAX_BILL");

*/

	ValueObject prePayment = storage.getValueObject("prePayment");			//기본정보, 세금계산서정보, 선급금정보
	ValueObject vendorPrintInfo = storage.getValueObject("vendorPrintInfo");//Vendor Print
	ValueObject planApprInfo = storage.getValueObject("planApprInfo");//설계평가
	ValueObject ContInfo = storage.getValueObject("ContInfo");			//분계유형	
	RowSet prePaymentList = storage.getRowSet("prePaymentList");	//대금내역
	
	String check1 = "";
	String check2 = "";
	String check3 = "";
	if("3".equals(prePayment.get("TAX_METHOD_CD"))){
		check3 = "checked";
	}else if("2".equals(prePayment.get("TAX_METHOD_CD"))){
		check2 = "checked";
	}else{
		check1 = "checked";
	}
	String digit = (String)prePayment.get("digit");
	int intDigit = Integer.parseInt(digit);
  
    //기타 첨부서류
	RowSet purchaseFileRow = storage.getRowSet("purchaseFileRow");
    
	String acctid = storage.getUser().get("ACCT_ID");

	String creby = user.get("ACCT_ID");
 	String updby = user.get("ACCT_ID");
 	if(!"".equals(prePayment.get("CRE_BY")) && !"".equals(prePayment.get("UPD_BY"))){
 		creby = prePayment.get("CRE_BY");
 		updby = prePayment.get("UPD_BY");
 	}
 	String plan_appr_yn = planApprInfo.get("PLAN_APPR_YN");
 	String plan_appr_status = planApprInfo.get("PLAN_APPR_STATUS");
 	String plan_appr_send_yn = planApprInfo.get("PLAN_APPR_SEND_YN");
 	
 	//베트남 환율정보 0원으로 표기되는 부분 수정(23.07.10)
 	String CURRENCY_GB = (String)prePayment.get("CURRENCY_GB");
 	int currency_digit = intDigit;
 	if(CURRENCY_GB.equals("VND")) currency_digit = 4;	//통화가 vnd인 경우 소숫점 4자리까지 표기
%>
<SCRIPT language="JavaScript">
	/*예약함수*/
	var sheet1;
	var sheet1Row;
	var sheet1PageNo = 1;
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	
	var g_digit = <%= intDigit %>;			// 소숫점 이하 자릿수
	
	function _onReady(){

		jQuery("#spanBbtnContCopy").show();
		
		jQuery(document).delegate('#date1','change', function() {
			var f = document.form1;
			jQuery("#fevent").val("GET_RATE");
			//반려가 가능한 상태인지 확인한다.
			submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "GET_RATE", f, "VALUEOBJECT");
	    });
						
		//2016.11.10  외국환거래신고
		 $("#btn_foreign").click(function() {//저장
			   var corpId = "<%=prePayment.get("CORP_ID")%>";
		 	   var win_id = "ForeignCheckPop";			
				var editYN = "N";
					
				if (jQuery("#statusCd").val() == "00"|| jQuery("#statusCd").val() == "03"|| jQuery("#statusCd").val() == "05"|| jQuery("#statusCd").val() == "99"){
					editYN="Y";
				}
				var link = "/bid/purchase/ForeignCheckPop.screen";   
				link += "?pop_win_id="+win_id+"&BID_NO="+$("#purContId").val()+"&BID_DEG="+$("#payreqId").val()+"&VENDOR_CD=" + corpId + "&editYN="+ editYN + "&WHO5=P"
				link += "&P_USER=" + "<%=user.get("USER_SABUN")%>";
				fLayerPop(win_id, link, 950,600, '','', 'NO');
		 });
		
	    $("#btnFixAppr").click(function() {
		    
<%-- 		    var corp_no = "<%=prePayment.get("corp_reg_no")%>";
		    var corp_id = "<%= prePayment.get("corp_id")%>";
		    var dept_cd = "<%= prePayment.get("dept_cd")%>";
		    var dept_name = "<%= prePayment.get("dept_nm")%>";
		    var payreq_id = "<%=prePayment.get("PAYREQ_ID")%>";
		    
// 			var url = "/supplier/purchase/PuSuppFixApprPop.screen?corp_no="+corp_no+"&corp_id="+corp_id+"&dept_cd="+dept_cd+"&dept_name="+dept_name+"&payreq_id="+payreq_id; 
// 			openPopup(url, "ItemWindow", "yes", 1024, 800);	
			
			var url = "/supplier/purchase/PuSuppFixApprPop.screen";
			var win_id = "_ItemWindow";
			url += "?pop_win_id="+win_id;
			url += "&corp_no="+corp_no;
			url += "&corp_id="+corp_id;
			url += "&dept_cd="+dept_cd;
			url += "&dept_name="+dept_name;
			url += "&payreq_id="+payreq_id;
			
			fLayerPop(win_id, url, 1024,400, '', '', 'NO'); --%>
			
			var corpId = "<%=prePayment.get("CORP_ID")%>";
			var apprArrId = "<%=prePayment.get("APPR_ARR_ID")%>";
			var apprDocCd = "<%=prePayment.get("APPR_DOC_CD")%>";
			var apprDy = "<%=prePayment.get("APPR_DY")%>";
			if(typeof apprArrId == "undefined" || apprArrId == "" || apprArrId ==  null  ){
				alert("정기평가표가 등록되어 있지 않습니다.");
				//return;
			}else{
				
				var f = document.form1;
		        var reportInfo = new ReportInfo();
		        if(apprDocCd == "03")	//	manufacturer의 경우
		        {
		        	reportInfo.title = "기자재공급업체 정기평가표(Manufacturer)";
		        	if ("<%=prePayment.get("ADM_YEAR")%>" == "2014")
		            	reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport3.mrd";
		        	else if ("<%=prePayment.get("ADM_YEAR")%>" == "2016")
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport3_2016.mrd";
		        	else if ("<%=prePayment.get("ADM_YEAR")%>" == "2019")
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport3_2019.mrd";		        	
		        	else if ("<%=prePayment.get("ADM_YEAR")%>" == "2020")
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport3_2020.mrd";  
		        	else
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport3_2023.mrd";
		        }else
		        {
		        	reportInfo.title = "기자재공급업체 정기평가표(Agent)";
		        	if ("<%=prePayment.get("ADM_YEAR")%>" == "2014")
		           		 reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport4.mrd";
		        	else if ("<%=prePayment.get("ADM_YEAR")%>" == "2016")
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport4_2016.mrd";
		        	else if ("<%=prePayment.get("ADM_YEAR")%>" == "2019")
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport4_2019.mrd";		        	
		        	else if ("<%=prePayment.get("ADM_YEAR")%>" == "2020")
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport4_2020.mrd";  
		        	else
		        		reportInfo.reportName = "/report/mrd/buyer/supplier/purchase/PuSupplierReport4_2020.mrd";
		        }
	            reportInfo.set(corpId);
	            reportInfo.set(apprArrId);
	            reportInfo.set(apprDocCd);
	            reportInfo.set(apprDy.substring(0,4));
	            
		        reportInfo.width = 1000;                         	// Default: 1024
		        reportInfo.height = 700;                         	// Default: 768
//	 	        reportInfo.reportOption = "/rf /rsn ["+f.defaultDS.value+"]"; 	             	// Default: '/rf'
		        reportInfo.showPopup();
			}
		});
	    
	    //설계평가 요청하기(설계평가자에게 메일 발송)
	    $("#btnPlanApprReq").click(function() { 	    	 
			if(confirm('설계평가자에게 작성요청메일 발송하시겠습니까? ')){
				var f = document.form1;
				jQuery("#fevent").val("PLAN_REQ");				
				submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "PLAN_REQ", f, "SUCCESS");	
				}	    	
		});
	    
	    //VP요청 2015.3.9
		jQuery("#btnVpApp").click(function() { 
			var f = document.form1;
			jQuery("#fevent").val("CHK_VP");
			submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "CHK_VP", f, "VALUEOBJECT");
		});
	  
		//리스트 페이지 이동
		jQuery("#btnList").click(function() {
			jQuery("#fevent").val("");
			jQuery("#form1").attr("action", "/payment/purchase/PayRequestList.screen");
			jQuery("#form1").attr("target", "_self");
			jQuery("#form1").attr("method", "post");
			jQuery("#form1").submit();
		});
		 

		jQuery("#btnDelete").click(function() {
			var f = document.form1;
			//필수 입력항목 check
			if(jQuery("#prepayId").val() == ""){
				alert("삭제되었습니다.");
				return;
			}
			//입력데이터 저장 
			if (confirm("삭제 하시겠습니까?")) {
				jQuery("#fevent").val("DELETE_DATA");
				submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "DELETE_DATA", f, "SUCCESS");
			}
		});		

		jQuery("#btnSave").click(function() {
		
			var f = document.form1;
			jQuery("#fevent").val("SAVE_DATA");
			//필수 입력항목 check
			if(requiredItemsCheck() == false){
				return;
			}
			
			//2015.11.16 외화 부가세 확인   "Z99"->부가세 0
			var conCurCd = jQuery("#conCurCd").val();
			 
			if(conCurCd != "KRW" && jQuery("#bugase").val() != "INPUT_VAT" ){  ///2019.03.21  jQuery("#proof_cd").val() != "Z99"
				var curReqAmt = jQuery("#curReqAmt").val().replace(/(\,|\:)/g,"");	
				var curReqVatamt = jQuery("#curReqVatamt").val().replace(/(\,|\:)/g,"");	
		
				if (Number(curReqAmt)/10 != Number(curReqVatamt) )
				{
					if (!confirm("외화 부가세 금액이 10%가 아닙니다. 저장 하시겠습니까?"))
					{
						return;
					}					
				}
				submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "SAVE_DATA", f, "SUCCESS");
			}
			else
			{
				//입력데이터 저장 
				if (confirm("저장 하시겠습니까?")) {
					submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "SAVE_DATA", f, "SUCCESS");
				}
		    }
		}); 
		
		jQuery("#btnAppReq").click(function() {
			
			var f = document.form1;
			jQuery("#btnAppReqSelect").val("1");	//0:저장처리, 1:대금신청요청 
			
			jQuery("#fevent").val("SAVE_DATA");
			//필수 입력항목 check
			if(requiredItemsCheck() == false){
				return;
			}
							
			//설계평가 입력 유무 
			if ("<%=plan_appr_yn%>" =="Y" && "<%=plan_appr_status%>" != "02") {
				if(!confirm('설계평가표 작성이 완료되지 않았습니다. \n계속하시겠습니까? ')){
					return;	
				}								
			}			
			
			//입력데이터 저장 
			if (confirm(jQuery("#btnText").text()+" 하시겠습니까?")) {
				submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "SAVE_DATA", f, "SUCCESS");
			}
			
		});		
		
		//반려
		jQuery("#btnRejection2").click(function() {
			
			var f = document.form1;
			if(!confirm('업체에 반려요청 됩니다.\n계속하시겠습니까?')){
				return;
			}
			f.rejectDiv.value = "21";
			jQuery("#fevent").val("CHK_REJECT");
			//반려가 가능한 상태인지 확인한다.
			submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "CHK_REJECT", f, "VALUEOBJECT");
			
		});

		//현장반려
		jQuery("#btnRejection1").click(function() {
			
			var f = document.form1;
			if(!confirm('반려시 데이터가 삭제됩니다.\n계속하시겠습니까?')){
				return;
			}
			f.rejectDiv.value = "20";
			jQuery("#fevent").val("CHK_REJECT");
			//반려가 가능한 상태인지 확인한다.
			submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "CHK_REJECT", f, "VALUEOBJECT");
			
		});
		
		jQuery("#btnApproval").click(function() {
			
			//통화가KRW가 아니고 분계유형에 증빙종류[기타]이면 invlice고정
			var conCurCd = jQuery("#conCurCd").val();
			var proof_cd = jQuery("#proof_cd option:selected").val();
			if(conCurCd != "KRW"){
				var rateEx = Number(jQuery("#rateEx").val());
				//if(rateEx == 0 ){
			    if(Number(rateEx) * 100 == 0 ){
					alert('환율이 없습니다.');
					return;
				}
			}
			
			//설계평가 입력 유무 
			if ("<%=plan_appr_yn%>" =="Y" && "<%=plan_appr_status%>" != "02") {
				if(!confirm('설계평가표 작성이 완료되지 않았습니다. \n계속하시겠습니까? ')){
					return;	
				}								
			}
			
			//금회누계의 기성율이 100로 이상이면 잔금처리이므로 업체평가가 등록되 있는지 Check처리한다.
			var curBefAcmpPercent = Number(jQuery("#curBefAcmpPercent").val());	//누계기성율
			if(curBefAcmpPercent > 99.999999999){
 				//업체평가가 등록되어 있어야 결재가 가능하다.
				var corpId = "<%=prePayment.get("CORP_ID")%>";
				var apprArrId = "<%=prePayment.get("APPR_ARR_ID")%>";
				var apprDocCd = "<%=prePayment.get("APPR_DOC_CD")%>";
				var apprDy = "<%=prePayment.get("APPR_DY")%>";
				var APPR_NOTE = "<%=prePayment.get("APPR_NOTE")%>";
				
				if(typeof apprArrId == "undefined" || apprArrId == "" || apprArrId ==  null ){  //|| Number(APPR_NOTE) < 1
					alert("정기평가표가 등록되어 있지 않습니다. ");
					//return;
				}
			}
			 //2016.5.12 외국환거래 확인   
			if("<%=prePayment.get("CURRENCY_GB")%>" != "KRW" && jQuery("#FOREIGN_CHK").val()=="A" ){
				alert("외국환거래 신고대상여부를 확인해 주세요");
				return;
			}
			 
			var f = document.form1;
			jQuery("#fevent").val("CHK_APPVAR");
			//결재가 가능한 상태인지 확인한다.
			submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "CHK_APPVAR", f, "VALUEOBJECT");
			
		});	
		
		//Invoice결재
		jQuery("#btnInvoiceApproval").click(function() {
			//설계평가 입력 유무 
			if ("<%=plan_appr_yn%>" =="Y" && "<%=plan_appr_status%>" != "02") {
				if(!confirm('설계평가표 작성이 완료되지 않았습니다. \n계속하시겠습니까? ')){
					return;	
				}								
			}			
			//금회누계의 기성율이 100로 이상이면 잔금처리이므로 업체평가가 등록되 있는지 Check처리한다.
			var curBefAcmpPercent = Number(jQuery("#curBefAcmpPercent").val());	//누계기성율
			if(curBefAcmpPercent > 99.99999999){
				//업체평가가 등록되어 있어야 결재가 가능하다.
				var corpId = "<%=prePayment.get("CORP_ID")%>";
				var apprArrId = "<%=prePayment.get("APPR_ARR_ID")%>";
				var apprDocCd = "<%=prePayment.get("APPR_DOC_CD")%>";
				var apprDy = "<%=prePayment.get("APPR_DY")%>";
				var APPR_NOTE = "<%=prePayment.get("APPR_NOTE")%>";
				if(typeof apprArrId == "undefined" || apprArrId == "" || apprArrId ==  null){// || Number(APPR_NOTE) < 1
					alert("정기평가표가 등록되어 있지 않습니다. ");
					//return;
				}
			}
            
			//2016.5.12 외국환거래 확인   
			if("<%=prePayment.get("CURRENCY_GB")%>" != "KRW" && jQuery("#FOREIGN_CHK").val()=="A" ){
				alert("외국환거래 신고대상여부를 확인해 주세요");
				return;
			}
			
			//2017.08.02 환율체크
			if("<%=prePayment.get("CURRENCY_GB")%>" != "KRW"){
				var rateEx = Number(jQuery("#rateEx").val());
				if(Number(rateEx) * 100 == 0 ){
				//if(rateEx == 0 ){
					alert('환율이 없습니다.');
					return;
				}
			}
			
			var f = document.form1;
			jQuery("#btnAppReqSelect").val("2"); //0:저장처리, 1:선급신청처리, 2:Invoice결재
			//필수 입력항목 check
			if (requiredItemsCheck() == false) {
				return;
			}
			
		 	var f = document.form1;
			jQuery("#fevent").val("CHK_APPVAR");
			//결재가 가능한 상태인지 확인한다.
			submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "CHK_APPVAR", f, "VALUEOBJECT");
		});	
		
		//2016.11.10
		jQuery("#curPrepayVat").blur(function () {
			//금회 기성       부가세,합계, 누계 부가세,합계, 잔여 부가세,합계
			//금회 선급공제            합계, 누계 부가세,합계, 잔여 부가세,합계
			//기성 curAcmpVat, curAcmpAmt  / curBefAcmpVat, curBefAcmpAmt / remainderAcmpVat, remainderAcmpAmt
			//선급 curPrepayDeductamt / curBefPrepayVat, curBefPrepayAmt / remainderPrepayVat, remainderPrepayAmt
			//청구 curReqVatamt, curReqApplyamt / curPayedVat, curPayedAmt
			
			var conPrepayAmtVal = jQuery("#conPrepayAmt").val().replace(/(\,|\:)/g,"");			//선급금액
 			var conPrepayVatVal = jQuery("#reqPrepayStax").val().replace(/(\,|\:)/g,"");	
 			var conConAmtVal = jQuery("#conConAmt").val().replace(/(\,|\:)/g,"");				//계약금
 			var conConVatVal = 	conConAmtVal /100 * 10;	
 			if (Number(jQuery("#curBefAcmpVat").val().replace(/(\,|\:)/g,""))  == 0  ){
				 conConVatVal = 0;
			}//|| Number(jQuery("#remainderAcmpVat").val().replace(/(\,|\:)/g,""))  < 0 
 			//선급공제 
			var curPrepayDeductamt = Number(jQuery("#curPrepayApplyamt").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPrepayVat").val().replace(/(\,|\:)/g,""));       //선급공제합계 = 선급공급 + 선급부가
			var curBefPrepayVat = Number(jQuery("#befPrepayVat").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPrepayVat").val().replace(/(\,|\:)/g,""));               //누계선급부가세=전회부가세+금회부가세
			var curBefPrepayAmt = Number(jQuery("#curBefPrepaySupplyamt").val().replace(/(\,|\:)/g,"")) + Number(curBefPrepayVat);                                           //누계합계 = 누계공급+누계부가
			var remainderPrepayVat = Number(conPrepayVatVal) - Number(curBefPrepayVat);                                                                                      //선급잔여부가세=선급부가세-누계부가세
			var remainderPrepayAmt = Number(jQuery("#remainderPrepaySupplyamt").val().replace(/(\,|\:)/g,"")) + Number(remainderPrepayVat);                                 //선급잔여합계 = 잔여공급액+잔여부가세 
			jQuery("#curPrepayDeductamt").val(curPrepayDeductamt.toFixed(g_digit));
			jQuery("#curBefPrepayVat").val(curBefPrepayVat.toFixed(g_digit));
			jQuery("#curBefPrepayAmt").val(curBefPrepayAmt.toFixed(g_digit));
			jQuery("#remainderPrepayVat").val(remainderPrepayVat.toFixed(g_digit));
			jQuery("#remainderPrepayAmt").val(remainderPrepayAmt.toFixed(g_digit));
			jQuery("#curPrepayDeductamt, #curBefPrepayVat, #curBefPrepayAmt, #remainderPrepayVat, #remainderPrepayAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
			//기성
			var curAcmpVat = Number(jQuery("#curPrepayVat").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curReqVatamt").val().replace(/(\,|\:)/g,"")) ;               //금회부가세=선급부가세+청구부가세
			var curAcmpAmt= Number(jQuery("#curPrepayDeductamt").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curReqApplyamt").val().replace(/(\,|\:)/g,"")) ;        //금회금액 =선급액+청구액
			var curBefAcmpVat = Number(jQuery("#curBefPrepayVat").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPayedVat").val().replace(/(\,|\:)/g,"")) ;          //누계부가세=선급누계부가세+청구누계부가세
			var curBefAcmpAmt = Number(jQuery("#curBefPrepayAmt").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPayedAmt").val().replace(/(\,|\:)/g,"")) ;          //누계합계=선급누계합계+청구누계합계
			var remainderAcmpVat = conConVatVal - Number(curBefAcmpVat);                                                                                                 //잔여부가세 = 계약부가세-누계부가세 
			var remainderAcmpAmt = Number(jQuery("#remainderAcmpSupplyamt").val().replace(/(\,|\:)/g,"")) + Number(remainderAcmpVat);                                    //잔여합계=잔여공급액+잔여부가세
			jQuery("#curAcmpVat").val(curAcmpVat.toFixed(g_digit));
			jQuery("#curAcmpAmt").val(curAcmpAmt.toFixed(g_digit));
			jQuery("#curBefAcmpVat").val(curBefAcmpVat.toFixed(g_digit));
			jQuery("#curBefAcmpAmt").val(curBefAcmpAmt.toFixed(g_digit));
			jQuery("#remainderAcmpVat").val(remainderAcmpVat.toFixed(g_digit));
			jQuery("#remainderAcmpAmt").val(remainderAcmpAmt.toFixed(g_digit));
			jQuery("#curAcmpVat, #curAcmpAmt, #curBefAcmpVat, #curBefAcmpAmt, #remainderAcmpVat, #remainderAcmpAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
			
		});	
		jQuery("#curReqVatamt").blur(function () {
			
			//전회 청구
 			var payedApplyamt = jQuery("#payedApplyamt").val().replace(/(\,|\:)/g,"");	//전회 청구 공급가액
 			var payedVat = jQuery("#payedVat").val().replace(/(\,|\:)/g,"");			//전회 청구 부가세
 			var payedAmt = jQuery("#payedAmt").val().replace(/(\,|\:)/g,"");			//전회 청구 합계

			var curReqAmt = jQuery("#curReqAmt").val().replace(/(\,|\:)/g,"");	
			curReqAmt = Number(curReqAmt).toFixed(g_digit);

			var curReqVatamt = jQuery("#curReqVatamt").val().replace(/(\,|\:)/g,"");
			curReqVatamt = Number(curReqVatamt).toFixed(g_digit);
			jQuery("#curReqVatamt").val(Number(curReqVatamt).toFixed(g_digit));
			
			var curReqApplyamtVal = Number(curReqAmt) + Number(curReqVatamt);	//금회 실지급 합계
 			jQuery("#curReqApplyamt").val(Number(curReqApplyamtVal).toFixed(g_digit));
			
 			//var curPayedSupplyamt	= Number(curReqAmt) - Number(payedApplyamt);	
 			//jQuery("#curPayedSupplyamt").val(Number(curPayedSupplyamt).toFixed(g_digit));	//금회누계 공급가액 청구액 금액

 			var curPayedVat = Number(payedVat) + Number(curReqVatamt);
 			jQuery("#curPayedVat").val(Number(curPayedVat).toFixed(g_digit));	//금회누계 부가세 청구액 금액
 			
 			var curPayedSupplyamt = jQuery("#curPayedSupplyamt").val().replace(/(\,|\:)/g,"");
 			curPayedSupplyamt = Number(curPayedSupplyamt).toFixed(g_digit);
 			
 			var curPayedAmt = Number(curPayedSupplyamt) + Number(curPayedVat);
 			jQuery("#curPayedAmt").val(Number(curPayedAmt).toFixed(g_digit));	//금회누계 합계 청구액 금액
 			
 			jQuery("#curReqVatamt, #curReqApplyamt, #curPayedVat, #curPayedAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			
 			//2016.11.10 기성수정
 			var conPrepayAmtVal = jQuery("#conPrepayAmt").val().replace(/(\,|\:)/g,"");			//선급금액
 			var conPrepayVatVal = jQuery("#reqPrepayStax").val().replace(/(\,|\:)/g,"");	
 			var conConAmtVal = jQuery("#conConAmt").val().replace(/(\,|\:)/g,"");				//계약금
 			var conConVatVal = 	conConAmtVal /100 * 10;	
 			if (Number(jQuery("#curBefAcmpVat").val().replace(/(\,|\:)/g,""))  == 0 ){
				 conConVatVal = 0;
			}//|| Number(jQuery("#remainderAcmpVat").val().replace(/(\,|\:)/g,""))  < 0 
 			//선급공제 
			var curPrepayDeductamt = Number(jQuery("#curPrepayApplyamt").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPrepayVat").val().replace(/(\,|\:)/g,""));       //선급공제합계 = 선급공급 + 선급부가
			var curBefPrepayVat = Number(jQuery("#befPrepayVat").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPrepayVat").val().replace(/(\,|\:)/g,""));               //누계선급부가세=전회부가세+금회부가세
			var curBefPrepayAmt = Number(jQuery("#curBefPrepaySupplyamt").val().replace(/(\,|\:)/g,"")) + Number(curBefPrepayVat);                                           //누계합계 = 누계공급+누계부가
			var remainderPrepayVat = Number(conPrepayVatVal) - Number(curBefPrepayVat);                                                                                      //선급잔여부가세=선급부가세-누계부가세
			var remainderPrepayAmt = Number(jQuery("#remainderPrepaySupplyamt").val().replace(/(\,|\:)/g,"")) + Number(remainderPrepayVat);                                 //선급잔여합계 = 잔여공급액+잔여부가세 
			jQuery("#curPrepayDeductamt").val(curPrepayDeductamt.toFixed(g_digit));
			jQuery("#curBefPrepayVat").val(curBefPrepayVat.toFixed(g_digit));
			jQuery("#curBefPrepayAmt").val(curBefPrepayAmt.toFixed(g_digit));
			jQuery("#remainderPrepayVat").val(remainderPrepayVat.toFixed(g_digit));
			jQuery("#remainderPrepayAmt").val(remainderPrepayAmt.toFixed(g_digit));
			jQuery("#curPrepayDeductamt, #curBefPrepayVat, #curBefPrepayAmt, #remainderPrepayVat, #remainderPrepayAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
 			//기성
			var curAcmpVat = Number(jQuery("#curPrepayVat").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curReqVatamt").val().replace(/(\,|\:)/g,"")) ;               //금회부가세=선급부가세+청구부가세
			var curAcmpAmt= Number(jQuery("#curPrepayDeductamt").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curReqApplyamt").val().replace(/(\,|\:)/g,"")) ;        //금회금액 =선급액+청구액
			var curBefAcmpVat = Number(jQuery("#curBefPrepayVat").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPayedVat").val().replace(/(\,|\:)/g,"")) ;          //누계부가세=선급누계부가세+청구누계부가세
			var curBefAcmpAmt = Number(jQuery("#curBefPrepayAmt").val().replace(/(\,|\:)/g,"")) + Number(jQuery("#curPayedAmt").val().replace(/(\,|\:)/g,"")) ;          //누계합계=선급누계합계+청구누계합계
			var remainderAcmpVat = conConVatVal - Number(curBefAcmpVat);                                                                                                 //잔여부가세 = 계약부가세-누계부가세 
			var remainderAcmpAmt = Number(jQuery("#remainderAcmpSupplyamt").val().replace(/(\,|\:)/g,"")) + Number(remainderAcmpVat);                                    //잔여합계=잔여공급액+잔여부가세
			jQuery("#curAcmpVat").val(curAcmpVat.toFixed(g_digit));
			jQuery("#curAcmpAmt").val(curAcmpAmt.toFixed(g_digit));
			jQuery("#curBefAcmpVat").val(curBefAcmpVat.toFixed(g_digit));
			jQuery("#curBefAcmpAmt").val(curBefAcmpAmt.toFixed(g_digit));
			jQuery("#remainderAcmpVat").val(remainderAcmpVat.toFixed(g_digit));
			jQuery("#remainderAcmpAmt").val(remainderAcmpAmt.toFixed(g_digit));
			jQuery("#curAcmpVat, #curAcmpAmt, #curBefAcmpVat, #curBefAcmpAmt, #remainderAcmpVat, #remainderAcmpAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			}); 			
		});	
		
		
		
		//jQuery("#curAcmpVat, #curPrepayApplyamt, #curPrepayVat").blur(function () {
        //2018.3.26 선급부가세 수정. 0이면 잔금         
        jQuery("#curPrepayVat").blur(function () {
				//잔여가 0이면 잔금으로 설정
	 			//setDepostiCd(); //2019.08.02 사용자가 선택 후 아래에서 금액 변경 시 자동으로 바뀌면서 혼란이 생김 
	 			
				//하자이행율이 100%이상이면 보증정보 표시
				setGuarOutList();
		});
		jQuery("#curPrepayApplyamt").blur(function () {
  
			if(jQuery("#statusCd").val() == "10"){	//완료건에 대해서는 금액 계산을 하지않는다.
				return;
			}
	        //2016.11.9 기존 기성금액 고정. 청구액 변경-->청구액 고정. 기성금액 합산
	        var tmp1 = jQuery("#curPrepayApplyamt").val().replace(/(\,|\:)/g,"");
	        var tmp2 = jQuery("#curReqAmt").val().replace(/(\,|\:)/g,"");
	        var tmp1 = Number(tmp1) + Number(tmp2);
	        jQuery("#curAcmpApplyamt").val(tmp1.toFixed(g_digit));
		    jQuery("#curAcmpApplyamt").each(function(index){
			     jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
		    });
		    
 			var conConAmtVal = jQuery("#conConAmt").val().replace(/(\,|\:)/g,"");				//계약금
 			var conConVatVal = 	conConAmtVal /100 * 10;									//계약금 부가세 2016.5.25 
 			if (Number(jQuery("#curBefAcmpVat").val().replace(/(\,|\:)/g,""))  == 0 ){
 				 conConVatVal = 0;
 			}
 			var conPrepayAmtVal = jQuery("#conPrepayAmt").val().replace(/(\,|\:)/g,"");			//선급금액
 			var conPrepayVatVal = jQuery("#reqPrepayStax").val().replace(/(\,|\:)/g,"");	   //선급금액 부가세 2016.5.25 선급부가세 계산 수정 conPrepayAmtVal /100 * 10;
 			 
			//전회 청구
 			var befAcmpApplyAmtVal = jQuery("#befAcmpApplyAmt").val().replace(/(\,|\:)/g,"");	//전회 청구 공급가액
 			var befAcmpVatVal = jQuery("#befAcmpVat").val().replace(/(\,|\:)/g,"");				//전회 청구 부가세
 			var befAcmpAmtVal = jQuery("#befAcmpAmt").val().replace(/(\,|\:)/g,"");				//전회 청구 합계
 			var befAcmpPercentVal = jQuery("#befAcmpPercent").val().replace(/(\,|\:)/g,"");		//전회 청구 지급율
 			
 			var curAcmpApplyamtVal = jQuery("#curAcmpApplyamt").val().replace(/(\,|\:)/g,"");	//금회 청구 공급가액
 			var befPrepayApplyAmtVal = jQuery("#befPrepayApplyAmt").val().replace(/(\,|\:)/g,"");	//전회 선급 공급가액
 			//금회 선급
 			var curPrepayApplyamtVal = jQuery("#curPrepayApplyamt").val().replace(/(\,|\:)/g,"");	//금회 선급 공급가액
 			var curPrepayApplyamtVal = Number(curPrepayApplyamtVal).toFixed(g_digit);	//금회 선급 공급가액
 			var curBefPrepaySupplyamtVal = Number(befPrepayApplyAmtVal) + Number(curPrepayApplyamtVal);	//누계 선급 공급가액
 			var curBefPrepaySupplyamtVal = Number(curBefPrepaySupplyamtVal).toFixed(g_digit);	//누계 선급 공급가액

 			if(curPrepayApplyamtVal == ""){
 				curPrepayApplyamtVal = 0;
 				jQuery("#curPrepayApplyamt").val(0);	
 			}else{
 				
 				var reqPrepaySamtVal = jQuery("#reqPrepaySamt").val().replace(/(\,|\:)/g,"");		//선급금 청구금액 공급가
 				if(parseFloat(curBefPrepaySupplyamtVal) > parseFloat(reqPrepaySamtVal)  ){
 					alert("선급금 청구금액 공급가 보다 선급금공제액이 큽니다.");
 					curPrepayApplyamtVal = jQuery("#orgCurPrepayApplyamt").val();
 					jQuery("#curPrepayApplyamt").val(Number(curPrepayApplyamtVal).toFixed(g_digit));
 					jQuery("#curPrepayApplyamt").focus();
 					return;
 					
 				}else{
 				
	 				if(parseFloat(curPrepayApplyamtVal) > parseFloat(curAcmpApplyamtVal) ){	//입력한 선급금공제금액이 금회기성고공급가액보다 클수 없다.
	 					alert("선급금 공제액이 금회 기성고보다 큽니다.");
	 					curPrepayApplyamtVal = jQuery("#orgCurPrepayApplyamt").val();
	 					jQuery("#curPrepayApplyamt").val(curPrepayApplyamtVal);
	 					jQuery("#curPrepayApplyamt").focus();
	 				}else{
	 					
	 					jQuery("#curPrepayApplyamt").val(curPrepayApplyamtVal);	//입력한 선급금공제 금회 공급가액 표시 
	 					
	 					if( jQuery("#bugase").val() == "INPUT_VAT" ){	//분계유형에따른 부가세 계산
	 						var bugaseVal = curAcmpApplyamtVal / 100 * 10;
	 						//jQuery("#curAcmpVat").val(Math.floor(bugaseVal));		//기성고 금회 부가세
	 						jQuery("#curAcmpVat").val(Number(bugaseVal).toFixed(g_digit));		//기성고 금회 부가세
	 						
	 						var bugaseVatVal = curPrepayApplyamtVal / 100 * 10;
	 						//jQuery("#curPrepayVat").val(Math.floor(bugaseVatVal));	//선급금공제 금회 부가세
	 						jQuery("#curPrepayVat").val(Number(bugaseVatVal).toFixed(g_digit));	//선급금공제 금회 부가세
	 						
	 					}else{
	 						
	 						jQuery("#curAcmpVat").val("0");		//기성고 금회 부가세
	 						jQuery("#curPrepayVat").val("0");	//선급금공제 금회 부가세
	 					}
	 				}
 				}
 			}			
			
 			//금회 청구
			
			var curAcmpVatVal = jQuery("#curAcmpVat").val().replace(/(\,|\:)/g,"");				//금회 청구 부가세
 			if(curAcmpVatVal == ""){
 				curAcmpVatVal = 0;
 				jQuery("#curAcmpVat").val(0);	
 			}else{
 				jQuery("#curAcmpVat").val(Number(curAcmpVatVal).toFixed(g_digit));	
 			}
			
			var curAcmpAmtVal =  Number(curAcmpApplyamtVal) + Number(curAcmpVatVal);	//금회 청구 합계
			curAcmpAmtVal =  Number(curAcmpAmtVal).toFixed(g_digit);
			jQuery("#curAcmpAmt").val(curAcmpAmtVal);	
 			jQuery("#curAcmpAmt, #curAcmpVat").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			var curAcmpPercentVal = Number(curAcmpApplyamtVal) / Number(conConAmtVal) * 100;	//금회 청구 지급율
 			jQuery("#curAcmpPercent").val(curAcmpPercentVal.toFixed(1));

 			//누계 청구
 			var curBefAcmpSupplyamtVal = Number(befAcmpApplyAmtVal) + Number(curAcmpApplyamtVal);	//누계 청구 공급가액
 			jQuery("#curBefAcmpSupplyamt").val(Number(curBefAcmpSupplyamtVal).toFixed(g_digit));
 			var curBefAcmpVatVal = Number(befAcmpVatVal) + Number(curAcmpVatVal);	//누계 청구 부가세
 			jQuery("#curBefAcmpVat").val(Number(curBefAcmpVatVal).toFixed(g_digit));
			var curBefAcmpAmtVal =  Number(curBefAcmpSupplyamtVal) + Number(curBefAcmpVatVal);	//누계 청구 합계
			jQuery("#curBefAcmpAmt").val(Number(curBefAcmpAmtVal).toFixed(g_digit));
 			var curBefAcmpPercentVal = Number(curBefAcmpSupplyamtVal) / Number(conConAmtVal) * 100;	//누계 청구 지급율
 			jQuery("#curBefAcmpPercent").val(curBefAcmpPercentVal.toFixed(1));
 			jQuery("#curBefAcmpSupplyamt, #curBefAcmpVat, #curBefAcmpAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});

 			//잔여 청구
 			//2016.11.15추가 
 			if (Number(jQuery("#curBefAcmpVat").val().replace(/(\,|\:)/g,""))  == 0 ){
				 conConVatVal = 0;
			}
 			var remainderAcmpSupplyamtVal = Number(conConAmtVal) - Number(curBefAcmpSupplyamtVal);	//잔여 청구 공급가액
 			jQuery("#remainderAcmpSupplyamt").val(Number(remainderAcmpSupplyamtVal).toFixed(g_digit));	
 			var remainderAcmpVatVal = Number(conConVatVal) - Number(curBefAcmpVatVal);		//잔여 청구 부가세
 			jQuery("#remainderAcmpVat").val(Number(remainderAcmpVatVal).toFixed(g_digit));
 			var remainderAcmpAmtVal = Number(remainderAcmpSupplyamtVal) + Number(remainderAcmpVatVal);	//잔여 청구 합계
 			jQuery("#remainderAcmpAmt").val(Number(remainderAcmpAmtVal).toFixed(g_digit));
 			var remainderAcmpPercentVal = Number(remainderAcmpSupplyamtVal) / Number(conConAmtVal) * 100;	//누계 청구 지급율
 			jQuery("#remainderAcmpPercent").val(remainderAcmpPercentVal.toFixed(1));
 			jQuery("#remainderAcmpSupplyamt, #remainderAcmpVat, #remainderAcmpAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			
 			//전회 선급
 			var befPrepayVatVal = jQuery("#befPrepayVat").val().replace(/(\,|\:)/g,"");				//전회 선급 부가세
 			var befPrepayAmtVal = jQuery("#befPrepayAmt").val().replace(/(\,|\:)/g,"");				//전회 선급 합계
 			var befPrepayPercentVal = jQuery("#befPrepayPercent").val().replace(/(\,|\:)/g,"");		//전회 선급 지급율 		
 			
 			var curPrepayVatVal = jQuery("#curPrepayVat").val().replace(/(\,|\:)/g,"");	//금회 선급 부가세
 			if(curPrepayVatVal == ""){
 				curPrepayVatVal = 0;
 				jQuery("#curPrepayVat").val(0);	
 			}else{
 				jQuery("#curPrepayVat").val(Number(curPrepayVatVal).toFixed(g_digit));	
 			}
 			var curPrepayDeductamtVal =  Number(curPrepayApplyamtVal) + Number(curPrepayVatVal);	//금회 선급 합계
 			jQuery("#curPrepayDeductamt").val(Number(curPrepayDeductamtVal).toFixed(g_digit));
 			
 			if(parseFloat(curPrepayApplyamtVal) == "0"){
 				var curPrepayPercentVal = 0.0;	//금회 선급 지급율
 			}else{
 				var curPrepayPercentVal = Number(curPrepayApplyamtVal) / Number(conPrepayAmtVal) * 100;	//금회 선급 지급율
 			}
 			jQuery("#curPrepayPercent").val(curPrepayPercentVal.toFixed(1));
 			
 			jQuery("#curPrepayApplyamt, #curPrepayVat, #curPrepayDeductamt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});

 			//누계 선급
 			jQuery("#curBefPrepaySupplyamt").val(Number(curBefPrepaySupplyamtVal).toFixed(g_digit));
 			var curBefPrepayVatVal = Number(befPrepayVatVal) + Number(curPrepayVatVal);	//누계 선급 부가세
 			jQuery("#curBefPrepayVat").val(Number(curBefPrepayVatVal).toFixed(g_digit));
			var curBefPrepayAmtVal =  Number(befPrepayAmtVal) + Number(curPrepayDeductamtVal);	//누계 청구 합계
			jQuery("#curBefPrepayAmt").val(Number(curBefPrepayAmtVal).toFixed(g_digit));
 			
			if(parseFloat(curBefPrepaySupplyamtVal) == "0"){
				var curBefPrepayPercentVal = 0.0;	//누계 선급 지급율
 			}else{
 				var curBefPrepayPercentVal = Number(curBefPrepaySupplyamtVal) / Number(conPrepayAmtVal) * 100;	//누계 선급 지급율
 			}
 			
 			jQuery("#curBefPrepayPercent").val(curBefPrepayPercentVal.toFixed(1));
 			jQuery("#curBefPrepaySupplyamt, #curBefPrepayVat, #curBefPrepayAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
 			//잔여 선급
 			var remainderPrepaySupplyamtVal = Number(conPrepayAmtVal) - Number(curBefPrepaySupplyamtVal);	//잔여 선급 공급가액

 			jQuery("#remainderPrepaySupplyamt").val(Number(remainderPrepaySupplyamtVal).toFixed(g_digit));	
 			var remainderPrepayVatVal = Number(conPrepayVatVal) - Number(curBefPrepayVatVal);		//잔여 선급 부가세
 			jQuery("#remainderPrepayVat").val(Number(remainderPrepayVatVal).toFixed(g_digit));
 			var remainderPrepayAmtVal = Number(remainderPrepaySupplyamtVal) + Number(remainderPrepayVatVal);	//잔여 선급 합계
 			jQuery("#remainderPrepayAmt").val(Number(remainderPrepayAmtVal).toFixed(g_digit));
			if(parseFloat(remainderPrepaySupplyamtVal) == "0"){
				var remainderPrepayPercentVal = 0.0;	//잔여 선급 지급율
 			}else{
 				var remainderPrepayPercentVal = Number(remainderPrepaySupplyamtVal) / Number(conPrepayAmtVal) * 100;	//잔여 선급 지급율
 			}
 			jQuery("#remainderPrepayPercent").val(remainderPrepayPercentVal.toFixed(1));
 			jQuery("#remainderPrepaySupplyamt, #remainderPrepayVat, #remainderPrepayAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			
 			//전회 실지급
 			var payedApplyamtVal = Number(befAcmpApplyAmtVal) - Number(befPrepayApplyAmtVal);	//전회 실지급 공급가액
 			jQuery("#payedApplyamt").val(Number(payedApplyamtVal).toFixed(g_digit));
 			var payedVatVal = Number(befAcmpVatVal) - Number(befPrepayVatVal);	//전회 실지급 부가세
 			jQuery("#payedVat").val(Number(payedVatVal).toFixed(g_digit));
 			var payedAmtVal = Number(payedApplyamtVal) + Number(payedVatVal);	//전회 실지급 합계
 			jQuery("#payedAmt").val(Number(payedAmtVal).toFixed(g_digit));
 			var payedPercentVal = Number(payedApplyamtVal) / Number(conConAmtVal) * 100;	//전회 실지급 지급율
 			jQuery("#payedPercent").val(payedPercentVal.toFixed(1));
 			jQuery("#payedApplyamt, #payedVat, #payedAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			
 			//금회 실지급
 			var curReqAmtVal	=	Number(curAcmpApplyamtVal) - Number(curPrepayApplyamtVal);	//금회 실지급 공급가액
 			jQuery("#curReqAmt").val(Number(curReqAmtVal).toFixed(g_digit));
 			//var curReqVatamtVal	=	parseFloat(curAcmpVatVal) - parseFloat(curPrepayVatVal);	//금회 실지급 부가세
 			if( jQuery("#bugase").val() == "INPUT_VAT" ){	//분계유형에따른 부가세 계산
 				var curReqVatamtVal	= curReqAmtVal / 100 * 10;	//금회 실지급 부가세
 			}else{
 				var curReqVatamtVal	= 0;	//금회 실지급 부가세
 			}
 			jQuery("#curReqVatamt").val(Number(curReqVatamtVal).toFixed(g_digit));
 			var curReqApplyamtVal = Number(curReqAmtVal) + Number(curReqVatamtVal);	//금회 실지급 합계
 			jQuery("#curReqApplyamt").val(Number(curReqApplyamtVal).toFixed(g_digit));
 			var curReqPercentVal = Number(curReqAmtVal) / Number(conConAmtVal) * 100;	//금회 실지급 지급율
 			jQuery("#curReqPercent").val(curReqPercentVal.toFixed(1));
 			jQuery("#curReqAmt, #curReqVatamt, #curReqApplyamt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			
 			//누계 실지급
 			var curPayedSupplyamtVal	= Number(curBefAcmpSupplyamtVal) - Number(curBefPrepaySupplyamtVal);	//누계 실지급 공급가액
 			jQuery("#curPayedSupplyamt").val(Number(curPayedSupplyamtVal).toFixed(g_digit));
 			var curPayedVatVal			= Number(curBefAcmpVatVal) - Number(curBefPrepayVatVal);	//누계 실지급 부가세
 			jQuery("#curPayedVat").val(Number(curPayedVatVal).toFixed(g_digit));
 			var curPayedAmtVal			= Number(curPayedSupplyamtVal) + Number(curPayedVatVal);	//누계 실지급 합계
 			jQuery("#curPayedAmt").val(Number(curPayedAmtVal).toFixed(g_digit));
 			var curPayedPercentVal		= Number(curPayedSupplyamtVal) / Number(conConAmtVal) * 100;	//누계 실지급 지급율
 			jQuery("#curPayedPercent").val(curPayedPercentVal.toFixed(1));
 			jQuery("#curPayedSupplyamt, #curPayedVat, #curPayedAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			
 			//잔여 실지급
 			var remainderSupplyamtVal	=	Number(remainderAcmpSupplyamtVal) - Number(remainderPrepaySupplyamtVal);	//잔여 실지급 공급가액
 			jQuery("#remainderSupplyamt").val(Number(remainderSupplyamtVal).toFixed(g_digit));
 			var remainderVatVal			=	Number(remainderAcmpVatVal) - Number(remainderPrepayVatVal);				//잔여 실지급 부가세
 			jQuery("#remainderVat").val(Number(remainderVatVal).toFixed(g_digit));
 			var remainderAmtVal			=	Number(remainderSupplyamtVal) + Number(remainderVatVal);	//잔여 실지급 합계
 			jQuery("#remainderAmt").val(Number(remainderAmtVal).toFixed(g_digit));
 			var remainderPercentVal		=	Number(remainderSupplyamtVal) / Number(conConAmtVal) * 100;	//잔여 실지급 지급율
 			jQuery("#remainderPercent").val(remainderPercentVal.toFixed(1));
 			jQuery("#remainderSupplyamt, #remainderVat, #remainderAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
 			
 			
 			//잔여가 0이면 잔금으로 설정
 			//setDepostiCd(); //2019.08.02 사용자가 선택 후 아래에서 금액 변경 시 자동으로 바뀌면서 혼란이 생김
 			
			//하자이행율이 100%이상이면 보증정보 표시
			setGuarOutList();
 			
		});
		
		//보증정보팝업 호출
		jQuery("#contOutWarr").click(function() {
			
			if(jQuery("#prepayId").val() == ""){
				alert("데이터를 저장 후, 보증정보를 입력할 수가 있습니다.");
				return;
			}
			
			var param = "";
			var param = "?subContModId=" + jQuery("#subContModId").val();
			var param = param + "&warrGubun=3";
			//var param = param + "&warrSeq=" + jQuery("#warrSeq").val();
			var param = param + "&warrSeq=1";
			
 			var url = "/payment/outside/ContOutWarrPopup.screen"+param;
			result = window.showModalDialog(url,'contOutWarr','dialogWidth:550px;dialogHeight:540px;center:yes;help:no;status:no;scroll:no;resizable:no');
			
			callback_getContWarr();
			
		});
		
		jQuery("#btnContCopy").click(function () {
			var f = document.form1;		
			submitXmlRequest("/payment/purchase/PayItemResult_form.screen", "SAVE_CONT_COPY_FILE", f);
		});
		
		pageinit();
		
	}
	
	//페이지 초기처리
	function pageinit(){
		
		//대금신청(신청상태)
		//setAmountData();
		
		//작성일자(증빙일자)
		seTaxDate();
		
		//신청구분 선택불가
		//appDivSet();
		
		//입력항목 초기처리
		//inputDataSet();
		
		//발행방법에 따른 페이지 셋팅
		taxDataSet();
		
		//버튼표시 셋팅
		btnCtr();

		//상태에 따른 입력항목 readOnly
		inputReadOnlyset();
	
		getFileListForTextarea();
		
		//하자이행보증정보 view유무
		setGuarOutList();
		
		//Vender Print 초기처리
		setVenderPrintInit();
	}

	function setGuarOutList(){
		
		var defEstGuarRateValue = Number(jQuery("#defEstGuarRate").val());	//하자보수보증금율 
		var preFundRateValue = Number(jQuery("#befAcmpPercent").val());		//전회 누계기성율
		//var preFundRateValue = 90;		//전회 누계기성율
		var checkRate1 = defEstGuarRateValue + preFundRateValue;
		var totFundRateValue = Number(jQuery("#curBefAcmpPercent").val());	//누계기성율
		var checkRate2 = defEstGuarRateValue + totFundRateValue;
		var acmpNoValue = jQuery("#depositSeq").val();						//지급차수
		
		if(Number(checkRate1) > 100){
			jQuery('#warr1').show();
			jQuery('#warr2').show();
		}else if(Number(checkRate2) > 100){
			jQuery('#warr1').show();
			jQuery('#warr2').show();
		}else{
			jQuery('#warr1').hide();
			jQuery('#warr2').hide();
		}
		
	}
	
	//신청대상일때 계약선급금액을 선급신청금액에 초기 입력한다.
	function setAmountData() {
		if(jQuery("#statusCd").val() == "00"){	//신청대상
			var subPrepaySupplyTamtValue = jQuery("#subPrepaySupplyTamt").val();	//계약 선급금액
			jQuery("#reqPrepaySupplyTamt").val(subPrepaySupplyTamtValue);			//선급 신청금액
			
			var subPrepaySupplyNamtValue = jQuery("#subPrepaySupplyNamt").val();	//계약 면세금액
			jQuery("#reqPrepaySupplyNamt").val(subPrepaySupplyNamtValue);			//선급 면세금액
		}
	}
	
	function appDivSet() {
		jQuery("#perpayReqDiv").attr("disabled", true);
		
		jQuery("#reqPrepaySupplyTamt, #reqPrepaySupplyNamt").blur();

	}
	
	function seTaxDate(){
	    
		var newDay = new Date( get_year(), get_month(), "");
	    var lastDay = newDay.getDate();
	    var yyyymmdd = get_year() +'-'+ get_month() +"-"+ lastDay;
	    
	    if(jQuery('#date1').val() == ""){
	    	jQuery('#date1').val(yyyymmdd);	
	    }
	    jQuery('#lastDate').val(yyyymmdd);
	    
	}
	
	
	function btnCtr(){
		
		var radioCheck = jQuery(':radio[name="chk_info"]:checked').val(); //세금계산서 발행방법

		if(radioCheck == "3"){	//Invoice
			if(jQuery("#statusCd").val() == "05" || jQuery("#statusCd").val() == "99"){
				jQuery("#spanBtnSave").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnAppReq").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").show();
				jQuery("#spanBtnRejection1").show();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnList").show();
				jQuery("#spanTaxSave").hide();
			}else {
				jQuery("#spanBtnSave").hide();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnAppReq").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnList").show();
				jQuery("#spanTaxSave").hide();
			}
		}else{
			
			if(jQuery("#statusCd").val() == "00"){	//00:신청대상는 목록, 삭제, 저장 표시
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").show();
				
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
				
			}
	
			if(jQuery("#statusCd").val() == "01"){	//01:작성상태는 목록, 삭제, 저장, 대금신청요청 표시
	
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").show();
				
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").show();
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
				
			}
			
			if(jQuery("#statusCd").val() == "02"){	//02:대금요청상태는 목록, 삭제, 저장, 대금신청요청 표시
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").show();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				if(radioCheck == "1"){
					jQuery("#spanBtnInvoiceApproval").hide(); 	//추후 숨김으로
				}else{
					jQuery("#spanBtnInvoiceApproval").show(); 	//추후 숨김으로
				}
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
				
			}
			
			if(jQuery("#statusCd").val() == "03"){	//03:대금신청상태는 목록, 반려, 결재
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").show();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				if( jQuery("#vpYN").val() == 'N' ){
					jQuery("#spanBtnApproval").show(); 	//추후 숨김으로
					jQuery("#spanBtnRejection2").show(); 	//추후 숨김으로
				}else {
					jQuery("#spanBtnApproval").hide(); 	//추후 숨김으로
					jQuery("#spanBtnRejection2").hide(); 	//추후 숨김으로
				}
				jQuery("#spanBtnAppReq").hide();  
				
				jQuery("#spanGubSave").show();
				jQuery("#spanTaxSave").show();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
			}
	
			if(jQuery("#statusCd").val() == "04"){	//04:결재중상태는 목록
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
			}
			
			if(jQuery("#statusCd").val() == "05"){	//05:현장신청 : 현장결재 완료된 상태. SAVE버튼 보여야 함. 
				
				jQuery("#spanBtnList").show();
				if(radioCheck == "2"){ //순발행 
					if( jQuery("#vpYN").val() == 'N' ){
						jQuery("#spanBtnDelete").hide();
						jQuery("#spanBtnSave").show();
						jQuery("#spanBtnApproval").show(); 	//2015.3.9 추후 숨김으로
						jQuery("#spanBtnRejection2").hide(); 	//추후 숨김으로
						jQuery("#spanBtnAppReq").show();
						jQuery("#spanBtnVpApp").hide();  //2015.3.9 
					}else{
						jQuery("#spanBtnDelete").hide();
						jQuery("#spanBtnSave").show();       //2015.3.6 수정 
						jQuery("#spanBtnApproval").hide(); 	//수정  추후 숨김으로
						jQuery("#spanBtnRejection2").hide(); 	//추후 숨김으로
						jQuery("#spanBtnAppReq").hide();     //2015.3.6
						jQuery("#spanBtnVpApp").show();  //2015.3.9 
					}
				}else{ //역발행
					jQuery("#spanBtnDelete").hide();
					jQuery("#spanBtnSave").show();  //2015.3.6 수정 
					jQuery("#spanBtnAppReq").show();
					jQuery("#spanBtnApproval").hide(); 	//추후 숨김으로
					jQuery("#spanBtnVpApp").hide();  //2015.3.9 	
				}
				
				jQuery("#spanBtnRejection1").show();
				if(radioCheck == "1"){
					jQuery("#spanBtnInvoiceApproval").hide(); 	//추후 숨김으로
				}else{
					jQuery("#spanBtnInvoiceApproval").hide(); 	//추후 숨김으로
				}
				
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				//jQuery("#purSuppFixAppr").show();
			}
			
			if(jQuery("#statusCd").val() == "10"){	//10:결재완료상태는 목록
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				
				//jQuery("#purSuppFixAppr").show();
			}		
			
			if(jQuery("#statusCd").val() == "40"){	//40:VP심사중
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").show();
				jQuery("#spanTaxSave").show();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
			}

			if(jQuery("#statusCd").val() == "50"){	//50:VP반려
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").show(); //2015.3.10
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").show();
				
				jQuery("#spanGubSave").show();
				jQuery("#spanTaxSave").show();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
			}
			
			if(jQuery("#statusCd").val() == "60"){	//60:VP승인
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").show();
				jQuery("#spanBtnApproval").show();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").show();
				jQuery("#spanTaxSave").show();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
			}
			
			if(jQuery("#statusCd").val() == "98"){	//98:현장반려
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();  //2015.3.9 
				
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").hide();
			}
			
			if(jQuery("#statusCd").val() == "99"){	//99:반려상태는 목록, 삭제, 저장, 대금신청요청 표시
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				//2015.9.3
				if (radioCheck == "2" && jQuery("#vpYN").val() == 'N' )  //순발행. VP없으면 저장가능. 
				{
					jQuery("#spanBtnSave").show();  
				}
				else{
					jQuery("#spanBtnSave").hide();  
				}
				
				jQuery("#spanBtnRejection1").show();//2015.03.10
 				jQuery("#spanBtnRejection2").hide();  
				jQuery("#spanBtnApproval").hide();   
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").show();  
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				
				//jQuery("#purSuppFixAppr").show();
			}		
			
			if(jQuery("#statusCd").val() == "06"){	//06 대금결재중 
				
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").hide();
				jQuery("#spanBtnSave").hide();
				
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 
				//jQuery("#purSuppFixAppr").show();
			}
			
			if(jQuery("#statusCd").val() == "91"){
				jQuery("#spanBtnList").show();
				jQuery("#spanBtnDelete").show();
				jQuery("#spanBtnSave").hide();
				jQuery("#spanBtnRejection1").hide();
				jQuery("#spanBtnRejection2").hide();
				jQuery("#spanBtnApproval").hide();
				jQuery("#spanBtnInvoiceApproval").hide();
				jQuery("#spanBtnAppReq").hide();
				jQuery("#spanGubSave").hide();
				jQuery("#spanTaxSave").hide();
				jQuery("#spanBtnVpApp").hide();  //2015.3.9 	
			}
		}
		
		var curBefAcmpPercent = Number(jQuery("#curBefAcmpPercent").val());
		if(curBefAcmpPercent > 99.9999999){
			jQuery("#purSuppFixAppr").show();
		}
		
		<%-- if ("<%=plan_appr_yn%>" =="Y" && "<%=plan_appr_status%>" != "02") { --%>
		if ("<%=plan_appr_yn%>" =="Y" && "<%=plan_appr_send_yn%>" != "Y") {	
			jQuery("#purSuppPlanAppr").show();								
		}
	}

	function inputReadOnlyset() {

		//분개유형 비활성화
		var acctGb = '<%=ContInfo.get("acct_gb")%>';
		jQuery('#acct_gb').attr('disabled', 'true');
/* 		if(acctGb == '1' || acctGb == '2' || acctGb == '3' ){
			jQuery('#proof_cd').attr('disabled', 'true');
			jQuery('#pay_group').attr('disabled', 'true');
			jQuery('#payment_terms_id').attr('disabled', 'true');
			jQuery("#spanGubSave").css("display", "none");
		} */
		//2016.6.9 원화일때 PAYMENT TERMS수정불가
	    if(jQuery("#conCurCd").val() == "KRW"){
			jQuery("#payment_terms_id").attr("disabled",'true');
			jQuery("#pay_group").attr("disabled",'true'); 
		}
		
		if(jQuery("#conCurCd").val() == "KRW"){
			jQuery("#chk_3").attr("disabled",true);
		}
		
		if (jQuery("#statusCd").val() == "10" || jQuery("#statusCd").val() == "04" || jQuery("#statusCd").val() == "98") { //입력불가상태
			
 			jQuery("#userName").attr("readonly", true);
			jQuery("#userName").css({'background-color' : '#F0F0F0'});
			jQuery("#userName").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#hp").attr("readonly", true);
			jQuery("#hp").css({'background-color' : '#F0F0F0'});
			jQuery("#hp").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#eMail").attr("readonly", true);
			jQuery("#eMail").css({'background-color' : '#F0F0F0'});
			jQuery("#eMail").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#curAcmpVat").attr("readonly", true);
			jQuery("#curAcmpVat").css({'background-color' : '#F0F0F0'});
			jQuery("#curAcmpVat").css({'border' : '1px solid #bcbcbc'});

			jQuery("#curPrepayApplyamt").attr("readonly", true);
			jQuery("#curPrepayApplyamt").css({'background-color' : '#F0F0F0'});
			jQuery("#curPrepayApplyamt").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#curPrepayVat").attr("readonly", true);
			jQuery("#curPrepayVat").css({'background-color' : '#F0F0F0'});
			jQuery("#curPrepayVat").css({'border' : '1px solid #bcbcbc'});
			
			//jQuery("#selectDepositCd").attr("disabled", true);
			
		}else if(jQuery("#statusCd").val() == "03"){
			
			jQuery("#curAcmpVat").attr("readonly", true);
			jQuery("#curAcmpVat").css({'background-color' : '#F0F0F0'});
			jQuery("#curAcmpVat").css({'border' : '1px solid #bcbcbc'});

			jQuery("#curPrepayApplyamt").attr("readonly", true);
			jQuery("#curPrepayApplyamt").css({'background-color' : '#F0F0F0'});
			jQuery("#curPrepayApplyamt").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#curPrepayVat").attr("readonly", true);
			jQuery("#curPrepayVat").css({'background-color' : '#F0F0F0'});
			jQuery("#curPrepayVat").css({'border' : '1px solid #bcbcbc'});
			
			//jQuery("#selectDepositCd").attr("disabled", true);
			
		}
		
		WarrantyDiv();
	}
	
	function taxDataSet(){
		
		//통화가KRW가 아니고 분계유형에 증빙종류[기타]이면 invlice고정
		var conCurCd = jQuery("#conCurCd").val();
		var proof_cd = jQuery("#proof_cd option:selected").val();
		if(conCurCd != "KRW" && proof_cd == "Z99"){
			//jQuery("#chk_3").attr("checked", true);
			jQuery("#chk_1").attr("disabled",true);
			jQuery("#chk_2").attr("disabled",true);
		}else if(conCurCd != "KRW" && proof_cd != "Z99"){
			jQuery("#chk_3").attr("disabled",true);
		}		
		
/* 		var radioCheck = jQuery(':radio[name="chk_info"]:checked').val(); //세금계산서 발행방법
		if (radioCheck == "1") { //역발행
			jQuery("#taxAttachments").hide();
			jQuery("#taxTrRow").hide();
			jQuery("#invoiceAttachments").hide();
			jQuery("#invoiceTrRow").hide();
		} else if (radioCheck == "2"){	//순발행
			jQuery("#taxAttachments").show();
			jQuery("#taxTrRow").show();
			jQuery("#invoiceAttachments").hide();
			jQuery("#invoiceTrRow").hide();
		}else{
			jQuery("#taxAttachments").hide();
			jQuery("#taxTrRow").hide();
			jQuery("#invoiceAttachments").show();
			jQuery("#invoiceTrRow").show();
		} */
		
		btnCtr();
	}
	
	//잔여/중도금 설정
	function setDepostiCd(){
		var remainderAcmpAmtValue = jQuery("#remainderAcmpAmt").val();	//기성고_잔여_합계
		if(Number(remainderAcmpAmtValue) == 0){
			jQuery("#selectDepositCd").val("3");	//잔금
		}else{
			jQuery("#selectDepositCd").val("2");	//중도금
		}		
	}
	
	
	function inputDataSet(){
		
		jQuery("#perpayReqDiv").attr("disabled",true);
		
		if(jQuery("#perpayReqDiv option:selected").val() == "1"){
			
			jQuery("#giveAmt").val("0");	//선급_포기금액_합계
			jQuery("#reqPrepayAmt").attr("readonly",true);
			jQuery("#reqPrepayAmt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepayAmt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#reqPrepayAmt").val(jQuery("#perpayAmt").val());
			
			jQuery("#giveSupplyTamt").val("0");		//선급_포기금액_과세
			jQuery("#reqPrepaySupplyTamt").attr("readonly",true);
			jQuery("#reqPrepaySupplyTamt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySupplyTamt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#reqPrepaySupplyTamt").val(jQuery("#subPrepaySupplyTamt").val());
	
			jQuery("#giveSupplyNamt").val("0");		//선급_포기금액_면세
			jQuery("#reqPrepaySupplyNamt").attr("readonly",true);
			jQuery("#reqPrepaySupplyNamt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySupplyNamt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#reqPrepaySupplyNamt").val(jQuery("#subPrepaySupplyNamt").val());

			jQuery("#giveSurtaxAmt").val("0");		//선급_포기금액_부가세
			jQuery("#reqPrepaySurtaxAmt").attr("readonly",true);
			jQuery("#reqPrepaySurtaxAmt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySurtaxAmt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#reqPrepaySurtaxAmt").val(jQuery("#subPrepaySurtaxAmt").val());
			
			jQuery("#givePercent").val("0.0");

			var reqPrepayAmt = jQuery("#reqPrepayAmt").val();
			reqPrepayAmt = reqPrepayAmt.replace(/(\,|\:)/g,"");
			var conAmt = jQuery("#conAmt").val();
			conAmt = conAmt.replace(/(\,|\:)/g,"");
			var givePercent = (reqPrepayAmt / conAmt) * 100;
			
			jQuery("#reqPrepayPercent").val(givePercent.toFixed(1));			
			
			giveDataSet();
			
			warrCtr('S');	//S:보이기, H:숨기기
			
		}else if(jQuery("#perpayReqDiv option:selected").val() == "2"){
			
			jQuery("#reqPrepayAmt").attr("readonly",true);
			jQuery("#reqPrepayAmt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepayAmt").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#reqPrepaySupplyTamt").attr("readonly",false);
			jQuery("#reqPrepaySupplyTamt").css({'background-color' : '#ffffff'});
			jQuery("#reqPrepaySupplyTamt").css({'border' : '1px solid #595a5a'});

			if(jQuery("#conSupplyNamt").val() == "0"){
				jQuery("#reqPrepaySupplyNamt").attr("readonly",true);
				jQuery("#reqPrepaySupplyNamt").css({'background-color' : '#dedede'});
				jQuery("#reqPrepaySupplyNamt").css({'border' : '1px solid #bcbcbc'});
			}else{
				jQuery("#reqPrepaySupplyNamt").attr("readonly",false);
				jQuery("#reqPrepaySupplyNamt").css({'background-color' : '#ffffff'});
				jQuery("#reqPrepaySupplyNamt").css({'border' : '1px solid #595a5a'});
			}
			jQuery("#reqPrepaySurtaxAmt").attr("readonly",true);
			jQuery("#reqPrepaySurtaxAmt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySurtaxAmt").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#reqPrepaySupplyTamt").val(jQuery("#orgReqPrepaySupplyTamt").val());
			jQuery("#reqPrepaySupplyNamt").val(jQuery("#orgReqPrepaySupplyNamt").val());
			jQuery("#reqPrepaySupplyTamt").blur();
			
			giveDataSet();
			
			warrCtr('S');	//S:보이기, H:숨기기
			
		}else if(jQuery("#perpayReqDiv option:selected").val() == "3"){
			
			jQuery("#reqPrepayAmt").val("0");	//선급_신청금액_합계
			jQuery("#reqPrepayAmt").attr("readonly",true);
			jQuery("#reqPrepayAmt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepayAmt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#giveAmt").val(jQuery("#perpayAmt").val());
			
			jQuery("#reqPrepaySupplyTamt").val("0");	//선급_신청금액_과세
			jQuery("#reqPrepaySupplyTamt").attr("readonly",true);
			jQuery("#reqPrepaySupplyTamt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySupplyTamt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#giveSupplyTamt").val(jQuery("#subPrepaySupplyTamt").val());
			
			jQuery("#reqPrepaySupplyNamt").val("0");	//선급_신청금액_면세
			jQuery("#reqPrepaySupplyNamt").attr("readonly",true);
			jQuery("#reqPrepaySupplyNamt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySupplyNamt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#giveSupplyNamt").val(jQuery("#subPrepaySupplyNamt").val());

			jQuery("#reqPrepaySurtaxAmt").val("0");		//선급_신청금액_부가세
			jQuery("#reqPrepaySurtaxAmt").attr("readonly",true);
			jQuery("#reqPrepaySurtaxAmt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySurtaxAmt").css({'border' : '1px solid #bcbcbc'});
			jQuery("#giveSurtaxAmt").val(jQuery("#subPrepaySurtaxAmt").val());

			jQuery("#reqPrepayPercent").val("0.0");
			
			var giveAmt = jQuery("#giveAmt").val();
			giveAmt = giveAmt.replace(/(\,|\:)/g,"");
			var conAmt = jQuery("#conAmt").val();
			conAmt = conAmt.replace(/(\,|\:)/g,"");
			var givePercent = (giveAmt / conAmt) * 100;
			
			jQuery("#givePercent").val(givePercent.toFixed(1));
			
			giveDataSet();
			
			//포기일때 보증정보는 필요없으므로 숨김처ㅣ
			warrCtr('H');	//S:보이기, H:숨기기
			
		}
	}
	
	//2016.11.10 외국환거래신고 
	function PopClose(win_id,result){
		if( result != null ){
		    if(result[0] == 2){  //2016.5.12 외국환거래신고 
				setTimeout(function(){	fLayerPopClose(win_id);},100);
				if(result[1].length> 0)alert(result[1]);
				$("#FOREIGN_CHK").val(result[2]); 
				$("#FOREIGN_NM").val(result[3]); 
			}
		}else{
			setTimeout(function(){	fLayerPopClose(win_id);	},100);
		}
		
	}
	
	function warrCtr(gubun){
		
		if (gubun == "H") { //숨김
			var warrWamt = jQuery("#warrWamt").val().replace(/(\,|\:)/g, "");
			if(warrWamt == "0" || warrWamt == ""){
				
				jQuery('#warr1').slideUp();
				jQuery('#warr2').slideUp();				

			}else{
				
				alert("보증정보가 존재합니다.");
				//jQuery("#reqPrepaySupplyTamt").val(jQuery("#warrWamt").val());
			}
			
		} else {
			
			jQuery('#warr1').show("slow");
			jQuery('#warr2').show("slow");
			
		}
	}
	
	function reDisplay() {
		
		jQuery("#fevent").val("");
		jQuery("#form1").attr("action", "/payment/purchase/PayInstallResult.screen");
		jQuery("#form1").attr("target", "_self");
		jQuery("#form1").attr("method", "post");
		jQuery("#form1").submit();
		
	}
	
	function doList() {
		
		jQuery("#fevent").val("");
		jQuery("#form1").attr("action", "/payment/purchase/PayRequestList.screen");
		jQuery("#form1").attr("target", "_self");
		jQuery("#form1").attr("method", "post");
		jQuery("#form1").submit();
		
	}
	
	//저장 및 대금 신청시 필수항목 Check
	function requiredItemsCheck(){
		
		var date1 		= jQuery('#date1').val();		//작성일자(증빙일자)
		var userName 	= jQuery('#userName').val();	//담당자명
		var hp 			= jQuery('#hp').val();			//담당자 핸드폰번호
		var eMail 		= jQuery('#eMail').val();		//담당자 이메일
		
		if(date1 == "" ){
			alert("입력필수입니다.");
			jQuery('#date1').focus();
			return false;
		}
		if(userName == ""){
			alert("담당자명은 입력필수입니다.");
			jQuery('#userName').focus();
			return false;
		}
		if(hp == ""){
			alert("담당자 핸드폰 번호는 입력필수입니다.");
			jQuery('#hp').focus();
			return false;
		}/*else{
			var rgEx = /(01[016789])[-](\d{4}|\d{3})[-]\d{4}$/g;  
			var strValue = hp;
			var chkFlg = rgEx.test(strValue);   
			if(!chkFlg){
				alert("올바른 휴대폰번호가 아닙니다.");
				jQuery('#hp').focus();
				return false;
			}
		}계약서에 명시된 번호이므로 신뢰. 2019.04.24*/
		if(eMail == ""){
			alert("담당자 이메일은 입력필수입니다.");
			jQuery('#eMail').focus();
			return false;
		}else{
			var regEmail = /([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
			if(!regEmail.test(eMail)) {
                alert('올바른 이메일 주소가 아닙니다.');
                jQuery('#eMail').focus();
                return false;
            }
		}

		//금액Check처리
		var remainderAcmpAmtValue	 = jQuery("#remainderAcmpAmt").val();	//기성고_잔여_합게
		var remainderPrepayAmtValue  = jQuery("#remainderPrepayAmt").val();	//선급금공제_잔여_합게
		var curReqVatamtValue		 = jQuery("#curReqVatamt").val().replace(/(\,|\:)/g,"");		//청구액_금회_부가세 2015.11.16
		if(Number(remainderAcmpAmtValue) < 0 || Number(remainderPrepayAmtValue) < 0 || Number(curReqVatamtValue) < 0){
			alert("금액을 확인바랍니다.");
			return false;
		}
		//2016.5.25 기성잔여가 0일때, 선급금이 0이 아니면 
		if(Number(remainderAcmpAmtValue) == 0 && Number(remainderPrepayAmtValue) != 0  ){
			alert("선급공제 잔여액을  확인바랍니다.");
			return false;
		}
		
		
		if(jQuery("#proof_cd").val() == "Z99"){
		 	if(Number(curReqVatamtValue) > 0 ){
				alert("청구액 금회 부가세가 0이여야 합니다");
				return false;
			}
		}
		
		if(jQuery("#btnAppReqSelect").val() == "1"){	//대신청요청시에는 해당하는 첨부파일이 모드 등록되어있어야함.

			//01:작성중, 02:대금요청, 03:대금신청, 04:결재, 10:결재완료, 99:반려
/* 			if (jQuery("#perpayReqDiv").val() == "1") { //선급신청
				jQuery("#selectStatusCd").val("20");
			} else if (jQuery("#perpayReqDiv").val() == "2") { //부분신청
				jQuery("#selectStatusCd").val("20");
			} else if (jQuery("#perpayReqDiv").val() == "3") { //포기신청
				jQuery("#selectStatusCd").val("21");
			} else {
				alert("신청구분을 선택하세요");
				return;
			} */

		}
	}
	
	function doResult(resultObj) {
		try {
			
			if( resultObj.getRequestEvent() == "SAVE_DATA" ||  resultObj.getRequestEvent() == "SAVE_SEGUM" ||  resultObj.getRequestEvent() == "SAVE_GUA") {
				if( resultObj.getSuccess() ) {				
					document.form1.isSubmit = false;
					
					if(jQuery("#btnAppReqSelect").val() == "0"){

						alert("저장되었습니다.");		
						//jQuery("#btnList").click();	
						reDisplay();
						
					}else if (jQuery("#btnAppReqSelect").val() == "1"){
						
						jQuery("#btnAppReqSelect").val("0");
						btnAppReqProcess();
						
					} else {
					
						jQuery("#btnAppReqSelect").val("0");
						approvalStart();
					}
					
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}

			if( resultObj.getRequestEvent() == "DELETE_DATA" ) {
				if( resultObj.getSuccess() ) {				
					alert("삭제되었습니다.");			
					jQuery("#btnList").click();
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}

			if( resultObj.getRequestEvent() == "REQ_DATA" ) {
				if( resultObj.getSuccess() ) {				
					alert("신청요청하였습니다.");			
					jQuery("#btnList").click();
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}
			
			//2015.3.10
			if( resultObj.getRequestEvent() == "CHK_VP" ) {
				if( resultObj.getSuccess() ) {				
					alert("VP신청 하였습니다.");			
					jQuery("#btnList").click();
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}
			
			
/* 			if( resultObj.getRequestEvent() == "APPROVAL" ) {
				if( resultObj.getSuccess() ) {				
					
					alert("선급금 결재 완료하였습니다..");			
					jQuery("#btnList").click();
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			} */
			
			if( resultObj.getRequestEvent() == "BUDGET_CHECK" ) {
				var vo = resultObj.getValueObject();
    			var check = vo.get('checkFlag');
    			if(check == 0){
    				document.form1.isSubmit = false;
    				//approvalStart();
    				//저장처리
					saveData();    				
    			}else{
    				document.form1.isSubmit = false;
    				// 예산통제하는 현장일 경우 집행내역 코드로 예산금액과 전체실적누계, 금회지급액을 구한다
    				//getBudgetControlAMT(); 2018.11.26 GET_BUDGET_AMT 확인해제. check ==0으로 처리. 
    			}
			}
			if(resultObj.getRequestEvent() == "SAVE_ATTC"){
				document.form1.isSubmit = false;
				approvalRun();
			}			
			if(resultObj.getRequestEvent() == "GET_BUDGET_AMT"){
				// 구해온 금액을 가지고 예산과 실적을 비교한다
				var vo = resultObj.getValueObject();
				document.form1.isSubmit = false;
				doBudgetAmtResult(vo);
			}
			
			if( resultObj.getRequestEvent() == "SAVE_DRAFT" ) {
		    	//document.form1.draft_div_id.value = "";	
				document.form1.isSubmit = false;
				if( resultObj.getSuccess() ) {
					var status = resultObj.getMessage();
					if(status == '1'){
							//approvalRun();
					}else if(status == '2'){
						alert("결재할수 없습니다. 확인바랍니다.");
					}else{
						//approvalRun();
					}
				}else {
					dlgErrorMsg(resultObj);
				}	
			}

			if( resultObj.getRequestEvent() == "GET_ATTACHFILE" ) {
				if( resultObj.getSuccess() ) {				
					document.form1.p_AttachFile.value = resultObj.getValueObject().get("AttachFile");
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}

			if( resultObj.getRequestEvent() == "CHK_REJECT" ) {
				var vo = resultObj.getValueObject();
    			var check = vo.get('checkFlag');
    			if(check == 0){	//가능
					
    				document.form1.isSubmit = false;
   					runRejection();
    			}else{
    				
    				document.form1.isSubmit = false;
					alert("이미 결제중입니다.");
    				
    			}
			}
			
			if( resultObj.getRequestEvent() == "CHK_APPVAR" ) {
				var vo = resultObj.getValueObject();
    			var check = vo.get('checkFlag');
    			
    			if(check == 0){	//가능
					
    				document.form1.isSubmit = false;
    			
    				if (jQuery("#btnAppReqSelect").val() == "2") {	//Invoice결재
    					
    					//runInvoice();
    					runApproval();
    				
    				}else{
    					jQuery("#btnAppReqSelect").val("0");
	    				runApproval();
    				}
					
    			}else{
    				
    				if(check == 99){
	    				document.form1.isSubmit = false;
	    				//alert("첨부파일 세금계산서 OR Invoice가 없습니다.");
	    				
						if (jQuery("#btnAppReqSelect").val() == "2") {	//Invoice결재
							if( jQuery(':radio[name="chk_info"]:checked').val() == "2" || jQuery(':radio[name="chk_info"]:checked').val() == "3" ){
								alert("경영정보시스템의 전표상신 화면에서 세금계산서 첨부 후 완료 바랍니다.\n\r \n\r※ 세금계산서 첨부후 승인작업을 하지 않을경우 재경팀으로 대금정보가 이관 되지 않습니다.");
							}
	    					//runInvoice();
	    					runApproval();
						}
						
    				}else{
    					
	    				document.form1.isSubmit = false;
						alert("이미 결제중입니다.");
						
    				}
    				
    			}
			}

			if( resultObj.getRequestEvent() == "GET_RATE" ) {
				var vo = resultObj.getValueObject();
				document.form1.isSubmit = false;
				var rate = vo.get('rate');
				var rateAmt = vo.get('rateAmt');
				var rateVamt = vo.get('rateVamt');
							
				jQuery("#rateEx").val(rate);
				jQuery("#rateAmt").val(rateAmt);
				jQuery("#rateVamt").val(rateVamt);
				jQuery("#rateAmt, #rateVamt").each(function(index) {  //#rateEx, 
					jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
				});
				
			}
			
			if( resultObj.getRequestEvent() == "GET_DATA" ) {
				
				if( resultObj.getSuccess() ) {

					var subContId = resultObj.getValueObject().get("SUB_CONT_ID");
					if(subContId != ""){
						jQuery("#subContId").val(subContId);
						
						var warrGubun = resultObj.getValueObject().get("WARR_GUBUN");
						jQuery("#warrGubun").val(warrGubun);
						
						var warrSeq = resultObj.getValueObject().get("WARR_SEQ");
						jQuery("#warrSeq").val(warrSeq);
						
						var causeCode = resultObj.getValueObject().get("CAUSECODE");
						jQuery("#causeCode").val("당초");

						var guarOnoffYn = resultObj.getValueObject().get("GUAR_ONOFF_YN");
						jQuery("#guarOnoffYn").val(guarOnoffYn);

						var warrGoffice = resultObj.getValueObject().get("WARR_GOFFICE");
						jQuery("#warrGoffice").val(warrGoffice);

						var guarStatus = resultObj.getValueObject().get("GUAR_STATUS");
						jQuery("#guarStatus").val(guarStatus);
						
						var paperDate = resultObj.getValueObject().get("PAPERDATE");
						jQuery("#paperDate").val(paperDate);

						var warrWgno = resultObj.getValueObject().get("WARR_WGNO");
						jQuery("#warrWgno").val(warrWgno);

						var warrWamt = resultObj.getValueObject().get("WARR_WAMT");
						jQuery("#warrWamt").val(warrWamt);
						jQuery("#warrWamt").each(function(index){
							jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
						});
						
						var warrSdateEdate = resultObj.getValueObject().get("WARR_SDATE_EDATE");
						jQuery("#warrSdateEdate").val(warrSdateEdate);
						
					}

				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}
			
			if( resultObj.getRequestEvent() == "PLAN_REQ" ) {
				if( resultObj.getSuccess() ) {				
					alert("설계평가 작성요청 하였습니다.");			
					jQuery("#btnList").click();
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}
			
			if( resultObj.getRequestEvent() == "SAVE_CONT_COPY_FILE" ) {
				if( resultObj.getSuccess() ) {
					alert("계약서 사본을 첨부하였습니다.");
					document.form1.isSubmit = false;
					getFileListForTextarea();
				}else {
					dlgErrorMsg(resultObj);
				}
			}
			
		}
		catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}

	//저장 후  기성시청 처리
	function btnAppReqProcess(){
		
		var f = document.form1;
		jQuery("#fevent").val("REQ_DATA");
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "REQ_DATA", f, "SUCCESS");

	}

	function saveData(){
		var f = document.form1;
		jQuery("#btnAppReqSelect").val("2"); 
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "SAVE_DATA", f, "SUCCESS");
	}

	

	function doKeyPress() {
		
	    if( event.keyCode == 13 ) {
			doSearch(document.all.sheet1)
	    }
	}	

	function calendar(thisDayObj){
		dlgCalendar(thisDayObj);
	}		

	//첨부파일   
	function doAttachFile(obj,No,fileName) {
		
		if(obj.value == ''){
			alert("데이터를 저장 후, 파일을 첨부할 수가 있습니다.");
		}
		else if(obj.value != ''){
			
			if(No == 1){
				viewFileListNew('PURCHASE_'+obj.value, No, document.getElementById("fileMapIDDiv"), "Y", "payment/purchase/"+obj.value);
			}else{
				var upLoadFlg = "Y";
				if(jQuery("#statusCd").val() == "10"){	//상태값이 기성신청(03), 결재완료(10) 일때는 첨부파일 다운로드만 가능
					upLoadFlg = "N";
					//2016.6.2 6월 30일까지 기타는 등록가능(외국환거래 신고여부 첨부)
				    /*if (No == '240')
				    {
				    	upLoadFlg = "Y";
				    }*/
					
				    ////2017.1.9 admin  등록가능.
					if (<%=storage.getUser().get("RIGHT_NAME").equals("ADMIN NEW")%>){
						upLoadFlg = "Y";
					}
				}
				
				if(jQuery("#taxStatus").val()<= 3){
					upLoadFlg = "Y";
				}
				
				viewFileListNew('PURCHASE_'+obj.value, No, document.getElementById("fileMapIDDiv"), upLoadFlg, "payment/purchase/"+obj.value, null, fileName);
			}
		} 

		//기성첨부파일 목록 조회
		//getFileListForTextarea();
		
	}
	
	//첨부목록 조회
	function getFileListForTextarea(){
		document.form1.p_AttachFile.value = "";
		var f = document.form1;  
		jQuery("#fevent").val("GET_ATTACHFILE");
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "GET_ATTACHFILE", f, "VALUEOBJECT");	
	}
	
	function doAttachFilePop(obj, No, fObj, fileGB, fileDir) {
		var editFile = "";
		 if(obj==''){
			alert("After you have saved, you can attach a file.");
		}
		else if(obj != ''){ 
			if(fObj.guarStatus.value != "02"){editFile="N";}else{editFile="Y";}
			if (<%=storage.getUser().get("RIGHT_NAME").equals("ADMIN NEW")%>) {editFile="Y"; }//2018.06.01수정 
			viewFileListNew(fileGB, obj.value, fObj.p_AttachFileGuar1, editFile, fileDir, "contPurWarrPopup");
		} 
	} 
	
	//보증정보 조회
	function callback_getContWarr(){
		
		//alert("보증정보 조회");
		fLayerPopClose('contOutWarrPop');
		var f = document.form1;
		jQuery("#fevent").val("GET_DATA");
		submitXmlRequest("/portal/payment/AdvencePayRequest_form.screen", "GET_DATA", f, "VALUEOBJECT");
		
	}

	function fileCheck(checkObj, val){
		var f = document.form1;
		
		//alert(checkObj.value);
		//alert(checkObj.checked);
		//alert(val);
		
		var obj = eval("document.getElementById('" + val + "')");
		
		if(obj.style.display == "none"){
			obj.style.display = "inline";
			checkObj.checked = true;
		}else{
			obj.style.display = "none";
			checkObj.checked = false;
		}
	} 
	
	//보증정보 조회
	function callback_getContWarr(){
		
		var f = document.form1;
		jQuery("#fevent").val("GET_DATA");
		submitXmlRequest("/payment/outside/AdvencePayment_form.screen", "GET_DATA", f, "VALUEOBJECT");
		
	}

	function doBudgetAmtResult(vo){
		var amtVO = vo;
		var yyyymm = amtVO.get('YYYYMM');
		var dept_cd = amtVO.get('DEPT_CD');
		var payitem = amtVO.get('PAYITEM');
		var estamt = amtVO.get('ESTAMT');		 		// 집행내역 예산금액
		var cur_amt = amtVO.get('CUR_AMT');		 		// 이번달 전체실적누계 금액
		var remainder_amt = amtVO.get('REMAINDER_AMT'); // 예산대비 실적 잔액
		var supply_amt = amtVO.get('SUPPLY_AMT');	 	// 외화일 경우 외화로 원화금액 환산한 금회대금지급 금액
		var cal_amt = amtVO.get('CAL_AMT'); 			// 예산 - 전체실적누계 - 금회대금지금
		var estdesc = amtVO.get('ESTDESC');
		var cnt = amtVO.get('CNT');
 
		if(cnt == 999){
			//alert('전월이 마감되지 않았거나 해당월은 작성할 수 없습니다.');
			//approvalStart();
			//저장처리
			saveData();
		}else{
			if( cal_amt > 0){
				//approvalStart();
				//저장처리
				saveData();
			}else{
				alert('집행내역 [ ' + estdesc + ']의 잔액이 부족하여 전표생성이 불가합니다.<br>'+'예산금액:' + estamt + '   실적누계금액:' + cur_amt + '<br>잔액:' + remainder_amt + '   금회작성금액:' + supply_amt + '<br>해당 현장의 PE에게 문의하세요.');
			}
		}
	}
	
	//
	function getBudgetControlAMT(){
		document.form1.isSubmit = false;
		var f = document.form1;
		jQuery("#fevent").val("BUDGET_CHECK");
		//입력데이터 저장 
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "GET_BUDGET_AMT", f, "VALUEOBJECT");
		
	}
	
	function approvalStart(){
		
		document.form1.isSubmit = false;
		var f = document.form1;
		jQuery("#fevent").val("SAVE_ATTC");
		//입력데이터 저장 
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "SAVE_ATTC", f, "SUCCESS");
		
	}
	
	function runApproval(){
		//예산통제 BUDGET_CHECK 처리
		var f = document.form1;
		jQuery("#fevent").val("BUDGET_CHECK");
		//입력데이터 저장 
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "BUDGET_CHECK", f, "VALUEOBJECT");			
	}
	
	//결재가능여부
	function approvalCheck(){
		var f = document.form1;
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "SAVE_DRAFT", f, "success");
	}
	
	//결재
	function approvalRun(){
		document.form1.isSubmit = false;
		var f = document.form1;
		var tmpslip_payreqId = f.payreqId.value;
		var tmpslip_purContId = f.purContId.value;
		var acctid = f.acctid.value;
		dlgSignForm('ebid_ppyD', '/payment/purchase/PayRequestSign.screen?tmpslip_payreqId='+tmpslip_payreqId+'^tmpslip_purContId='+tmpslip_purContId+'^acctid='+acctid+'^acct_type=1^sign_type=1' );
	}
	
	//결재
	function dlgSignForm( sign_class_cd, uri ) {
		
		var f = document.form1;
		var sheet1 = document.all.sheet1;

		var tmpslip_payreqId = f.payreqId.value;
		var tmpslip_purContId = f.purContId.value;
		var url = "/slipSign/paySign_form.screen";
		url += "?sign_class_cd=" + sign_class_cd;
		url += "&uri="           + uri;
		url += "&tmpslip_payreqId="  + tmpslip_payreqId;
		url += "&tmpslip_purContId="    + tmpslip_purContId;
		url += "&slip_dept="     + f.p_dept_cd.value;
		url += "&slip_dt="    	 + f.date1.value;
		url += "&acct_type=1";
		
		if(confirm("결재 하시겠습니까?") ){
			//f.slip_dt.value = '';
			//f.sign_chk.value = "Y";
			openWindowCenter(url, "sign_form", 200, 100, "");
		}else{
			return;
		}
	}
	
	function runRejection(){
		
		var pageDiv = '21';
		var f = document.form1;
		pageDiv = f.rejectDiv.value ; //20 삭제.erp반려  21업체반려
		
		var win_id = "Rejection";
		var link = "/payment/outside/RejectionPopup.screen";
		    link += "?pop_win_id="+win_id;
		    link += "&payreqId=" + jQuery("#payreqId").val();
		    link += "&pageDiv="+ pageDiv;
		    fLayerPop(win_id, link, 620, 220, '', '', 'NO');
		    
	}
	
	function runInvoice(){
		
		var f = document.form1;
		jQuery("#btnAppReqSelect").val("2"); //0:저장처리, 1:선급신청처리
		jQuery("#fevent").val("SAVE_DATA");
		
		submitXmlRequest("/payment/purchase/PayInstallResult_form.screen", "SAVE_DATA", f, "SUCCESS");

	}

	function RejectionPopupClose(){
		//alert();
		setTimeout(function(){fLayerPopClose('Rejection');},100);
		doList();
	}

	function WarrantyDiv(){
		
		//alert(jQuery("#selectDepositCd option:selected").val());
		if(jQuery("#selectDepositCd option:selected").val() == "2"){	//중도금
			jQuery("#warr1").show();
			jQuery("#warr2").show();
		}else{
			jQuery("#warr1").show();
			jQuery("#warr2").show();
		}
		
	}
	
	//보증정보팝업 호출
	function popContWarr(wG, wSeq, wCauseCd) {
		
		var win_id = "contPurWarrPopup";			

		var param = "";
		var param = "?purContModId=" + jQuery("#subContModId").val();
		var param = param + "&warrGubun=" + wG;
		var param = param + "&warrSeq=" + wSeq;
		var param = param + "&causeCode=" + wCauseCd;
		if(wG=="3"){
			var param = param + "&viewDiv=PREPAY";
			var param = param + "&prepayId=" + jQuery("#payreqId").val();
		}else{
			var param = param + "&viewDiv=PAYREQ";
			var param = param + "&PreqStatusCd=" + jQuery("#statusCd").val();
			
		}
		var param = param + "&pop_win_id=" + win_id;
		var param = param + "&sModule=EB";
		
		var url = "/portal/guar/contPurWarrPopup.screen"+param;
		
		fLayerPop(win_id, url, 560,350, '','', 'NO');
	}	
	//보증정보팝업 종료후 액션
	function popContWarrClose(returnValue){
		if(returnValue == null){
			fLayerPopClose('contPurWarrPopup');
		}else{
			fLayerPopClose('contPurWarrPopup');
			location.reload();
		}
	}
	
	function SearchUser(NAME,CODE,DEPT_YN){
	
		CODE = "";
		NAME = "";
		GB = "PUREMP";
/* 		if(CODE == "PUREMPNO"){
			CODE = "";
			NAME = "";
			GB = "PUREMP";
		}else if(CODE == "SITEDESCCHRGPRSNID"){
			CODE = "";
			NAME = "";
			GB = "SITEDESCCHRGPRSN";
		}else{
			GB = "";
		} */

		var win_id = "_searchUserPopup";
		var link = "/lib/dlgSearchUserPop.screen";
		    link += "?pop_win_id="+win_id;
		    link += "&NAME="+NAME;
		    link += "&CODE="+CODE;
		    link += "&GB="+GB;
		    if(DEPT_YN == "Y")
		    	link += "&deptNameYn=purchase";
		fLayerPop(win_id, link, 700,400, '', '', 'NO');
	}
	
	function SearchUserClose(result){
		
/* 		if(result[10] == "PUREMP"){
			$("#PUREMPNO").val(result[9])//ACCT_ID
			$("#PUREMPNM").val(result[1])//이름
			$("#PO_EMPNM").val(result[6])//연락처
		}else if(result[10] == "SITEDESCCHRGPRSN"){
			$("#SITEDESCCHRGPRSNID").val(result[9])//ACCT_ID
			$("#SITEDESCCHRGPRSNNM").val(result[1])//이름
			$("#SITEDESCTELNO").val(result[6])//연락처
			$("#SITEDESCEMAIL").val(result[8])//이메일
		} */
/* 		alert(result[0]);
		alert(result[1]);
		alert(result[2]);
		alert(result[3]);
		alert(result[4]);
		alert(result[5]);
		alert(result[6]);
		alert(result[7]);
		alert(result[8]);
		alert(result[9]);
		alert(result[10]); */
		
		jQuery("#VP_CHK_EMPNO").val(result[9])//ACCT_ID
		jQuery("#VP_CHK_EMPNM").val(result[1])//이름
		jQuery("#EPART_DEPT_NAME").val(result[3])//부서
		
		setTimeout(function(){	fLayerPopClose('_searchUserPopup');},100);
	}
	
	function setVenderPrintInit(){
	    
		var vpYN = jQuery("#vpYN").val();
		if(vpYN != "Y"){
			
			jQuery("#vpDiv1").css("display", "none");
			jQuery("#vpDiv2").css("display", "none");
		}else{
			
			if(jQuery("#vpRtnReason").val() == ""){
				jQuery("#return_reson_area").css("display", "none");
			}
		}
<%-- 		var status = "<%=status%>";
	    if(status != "50")
        {
	        $("#return_reson_area").css("display", "none");
        }
	    
	    if(status == "50" || status == "60" )
        {
	        $("#opinion").attr("readonly", true);
	        $("#btn_save_area").css("display", "none");
	        $("#btn_confim_area").css("display", "none");
	        $("#btn_return_area").css("display", "none");
        }
		 --%>
	}


	function chProofCd(obj){
		
		//통화가KRW가 아니고 분계유형에 증빙종류[기타]이면 invlice고정
 		var conCurCd = jQuery("#conCurCd").val();
		var proof_cd = obj.value
		
		if(conCurCd != "KRW"){
			if(proof_cd == "Z99"){
				jQuery("#chk_1").prop("checked", false);
				jQuery("#chk_2").prop("checked", false);
				jQuery("#chk_3").prop("checked", true);

				jQuery("#chk_1").attr("disabled",true);
				jQuery("#chk_2").attr("disabled",true);
				jQuery("#chk_3").attr("disabled",false);
				btnCtr();
			}else if(proof_cd != "Z99"){
				jQuery("#chk_1").prop("checked", true);
				jQuery("#chk_2").prop("checked", false);
				jQuery("#chk_3").prop("checked", false);
				
				jQuery("#chk_1").attr("disabled",false);
				jQuery("#chk_2").attr("disabled",false);
				jQuery("#chk_3").attr("disabled",true);
				btnCtr();
			}		
	
/* 			var radioCheck = jQuery(':radio[name="chk_info"]:checked').val(); //세금계산서 발행방법
			if (radioCheck == "1") { //역발행
				jQuery("#taxAttachments").hide();
				jQuery("#taxTrRow").hide();
				jQuery("#invoiceAttachments").hide();
				jQuery("#invoiceTrRow").hide();
			} else if (radioCheck == "2"){	//순발행
				jQuery("#taxAttachments").show();
				jQuery("#taxTrRow").show();
				jQuery("#invoiceAttachments").hide();
				jQuery("#invoiceTrRow").hide();
			}else{
				jQuery("#taxAttachments").hide();
				jQuery("#taxTrRow").hide();
				jQuery("#invoiceAttachments").show();
				jQuery("#invoiceTrRow").show();
			} */
		}
	}
</SCRIPT>


<modular:search id="form1">
	<modular:key id="fevent" />
</modular:search>

<form id="form1" name="form1" method="post" modular:type="search">

	<div style="display:none;" id="fileMapIDDiv" class="attach_file_view" onPropertyChange="JavaScript:getFileListForTextarea();">
	</div>
	<INPUT type="hidden" name="fevent" id="fevent" value="">
	<INPUT type="hidden" name="acctid" id="acctid" value="<%=acctid%>">
	<INPUT type="hidden" name="payreqId" id="payreqId" value="<%=prePayment.get("PAYREQ_ID") %>">	<!-- 발주계약ID -->
	<INPUT type="hidden" name="purContId" id="purContId" value="<%=prePayment.get("PUR_CONT_ID") %>">	<!-- 발주계약ID -->
	<INPUT type="hidden" name="subContModId" id="subContModId" value="<%=prePayment.get("PUR_CONT_MOD_ID") %>">
	<INPUT type="hidden" name="dept_cd" id="dept_cd" value="<%=prePayment.get("DEPT_CD") %>">	<!-- 현장코드 -->
	<INPUT type="hidden" name="p_dept_cd" id="p_dept_cd" value="<%=prePayment.get("P_DEPT_CD") %>">	<!-- 현장코드 --> 
	<INPUT type="hidden" name="lastDate" id="lastDate" value="">
	<INPUT type="hidden" name=pItem id="pItem" value="<%=ContInfo.get("P_ITEM") %>">
	<INPUT type='hidden' name="FOREIGN_CHK" value="<%=prePayment.get("FOREIGN_CHK")%>">
	
	<!-- 리스트 검색조건 보존 시작-->
	<INPUT type='hidden' id="searchDeptCd" name="searchDeptCd" value="<%=params.get("searchDeptCd")%>">	<!-- 현장코드 -->
	<INPUT type='hidden' id="searchDeptNm" name="searchDeptNm" value="<%=params.get("searchDeptNm")%>">	<!-- 현장명 -->
	<INPUT type='hidden' id="searchBuildName" name="searchBuildName" value="<%=params.get("searchBuildName")%>">	<!-- 계약명 -->
	<INPUT type='hidden' id="searchDateStart" name="searchDateStart" value="<%=params.get("searchDateStart")%>">	<!-- 작성 시작일 -->
	<INPUT type='hidden' id="searchDateEnd" name="searchDateEnd" value="<%=params.get("searchDateEnd")%>">			<!-- 작성 종료일 -->
	<INPUT type='hidden' id="searchStatusCd" name="searchStatusCd" value="<%=params.get("searchStatusCd")%>">			<!-- 상태값 -->
	<INPUT type='hidden' id="searchCorp" name="searchCorp" value="<%=params.get("searchCorp")%>">			<!-- 업체명 -->
	
	<!-- 리스트 검색조건 보존 종료-->
	
	<INPUT type="hidden" name="btnAppReqSelect" id="btnAppReqSelect" value="0">	<!-- 결재 및 저장 구분 0:저장, 1:결재 -->
	
	<INPUT type='hidden' id="conConAmt" name="conConAmt" value="<%=prePayment.get("ORD_AMT")%>">					<!-- 계약금액 -->
	<INPUT type='hidden' id="conPrepayAmt" name="conPrepayAmt" value="<%=prePayment.get("PREPAY_SUPPLY_AMT")%>">	<!-- 선급금액 -->
	
	<INPUT type="hidden" name="F_CON_SUPPLY_AMT" 	value='<%= prePayment.get("F_CON_SUPPLY_AMT") %>'>	<!-- 선급금대상계약금액 -->	
	<INPUT type="hidden" name="F_TAX_DY" 	value='<%= prePayment.get("F_TAX_DY") %>'>
	
	<INPUT type="hidden" name="statusCd" id="statusCd" value="<%=prePayment.get("REQ_STATUS") %>">	<!-- 상태값 -->
	
	<INPUT type="hidden" name="creBy" id="creBy" value="<%=creby %>">
	<INPUT type="hidden" name="updBy" id="updBy" value="<%=updby %>">
	
	<INPUT type='hidden' id="rejectDiv" name="rejectDiv" value="">	<!-- 반려구분 0:현장,1:조달 -->
	<INPUT type='hidden' id="vpYN" name="vpYN" value="<%=prePayment.get("VP_YN") %>">	
	
	<!--  임시 FILE MAP ID 값 -->
	<INPUT type="hidden" name="fileMapID" value="" onPropertyChange="JavaScript:getFileListForTextarea();">
	<INPUT type="hidden" name="bugase" id="bugase" value="<%=prePayment.get("CHG_CODE10") %>">	
	<INPUT type="hidden" name="orgCurPrepayApplyamt" id="orgCurPrepayApplyamt" value="<%=prePayment.get("CUR_PREPAY_APPLYAMT") %>">
	<INPUT type="hidden" name="SUPP_DIRECT_YN" id="SUPP_DIRECT_YN" value="N">	<!-- 하도급직불여부 제거 -->

	<INPUT type='hidden' id="resUserName" name="resUserName" value="<%=prePayment.get("RES_USER_NAME") %>">	<!-- 계약담당자 -->
	<INPUT type='hidden' id="resDivsion" name="resDivsion" value="<%=prePayment.get("RES_DIVISION") %>">	<!-- 계약담당자 -->
	<INPUT type='hidden' id="resHp" name="resHp" value="<%=prePayment.get("RES_HP") %>">	<!-- 계약담당자 핸드폰번호 -->
	<INPUT type='hidden' id="resEmail" name="resEmail" value="<%=prePayment.get("RES_EMAIL") %>">	<!-- 계약담당자 이메일 -->
	<INPUT type='hidden' id="conDocNo" name="conDocNo" value="<%=prePayment.get("ORD_DOC_NO") %>">	<!-- 발주계약번호 -->
	<INPUT type='hidden' id="corpId" name="corpId" value="<%=prePayment.get("CORP_ID") %>">
	<INPUT type='hidden' id="apprArrId" name="apprArrId" value="<%=prePayment.get("APPR_ARR_ID") %>">
	<INPUT type='hidden' id="apprDocCd" name="apprDocCd" value="<%=prePayment.get("APPR_DOC_CD") %>">
	<INPUT type='hidden' id="apprDy" name="apprDy" value="<%=prePayment.get("APPR_DY") %>">
	<INPUT type='hidden' id="taxStatus" name="taxStatus" value="<%=prePayment.get("TAX_STATUS") %>">
	
	<INPUT type='hidden' id="defEstGuarRate" name="defEstGuarRate" value="<%=prePayment.get("DEF_GUAR_AMT_RATE") %>">	<!-- 하자보수보증금율 -->
	
	<!-- 제목 및 버튼 -->
	<table width="100%">
		<colgroup>
			<col width="300" />
			<col width="*" />
		</colgroup>
		<tr>
	   		<th>
		   		<div align="left" id="title">
					<ul>
			    		<li>구매_대금신청 상세(<%=prePayment.get("STATUS_NM")%>)</li>			    		
			    	</ul>
				</div>
			</th>
			<td align="right">			
				<span id="spanBbtnContCopy" class="btnSearch center" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnContCopy" >계약서사본</a></span>
				<span id="purSuppFixAppr" name="purSuppFixAppr" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnFixAppr">정기평가표</a></span>
				<span id="purSuppPlanAppr" name="purSuppPlanAppr" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnPlanApprReq">설계평가요청</a></span>
				<span id="spanBtnSave" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnSave">저장</a></span>
				<span id="spanBtnDelete" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnDelete">삭제</a></span>
				<span id="spanBtnAppReq" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnAppReq"><span id="btnText">대금신청요청</span></a></span>
				<span id="spanBtnApproval" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnApproval">결재</a></span>
				<span id="spanBtnInvoiceApproval" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnInvoiceApproval">결재</a></span>
				<span id="spanBtnRejection2" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnRejection2">업체반려</a></span>
				<span id="spanBtnRejection1" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnRejection1">ERP반려</a></span>
				<span id="spanBtnVpApp"      class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnVpApp">VP신청</a></span>
				<span id="spanBtnList" class="btnSearch center" style="display: none"><a href="javascript:void(0);" id="btnList">목록</a></span>				
			</td>
		</tr>
	</table>
<%
if(!prePayment.get("RTN_REASON").equals("")){
%>
 	<div class="application-info  magT10">
		<div class="application-sub-title">
			<span class="title">반려정보</span>
		</div>
		<div class="application-location"></div>
	</div>
	<TABLE class="form-table">
		<colgroup>
			<col width="13%" />
			<col width="*" />
		</colgroup>

		<TR height="25">
			<th style="text-align: left;">반려일</th>
			<TD><%=Formatter2.formatDate(prePayment.get("RTN_DATE"), "-")%></TD>
		</TR>
		<TR>
			<th style="text-align: left;">반려사유</th>
			<TD><%=prePayment.get("RTN_REASON")%></TD>
		</TR>
	</TABLE>
<%
}else if(!prePayment.get("TAX_RTN_REASON").equals("")){
%>
	<div class="application-info  magT10">
		<div class="application-sub-title">
			<span class="title">반려정보</span>
		</div>
		<div class="application-location"></div>
	</div>
	<TABLE class="form-table">
		<colgroup>
			<col width="13%" />
			<col width="*" />
		</colgroup>

		<TR height="25">
			<th style="text-align: left;">반려일</th>
			<TD><%=prePayment.get("TAX_RTN_DATE")%></TD>
		</TR>
		<TR>
			<th style="text-align: left;">반려사유</th>
			<TD><%=prePayment.get("TAX_RTN_REASON")%></TD>
		</TR>
	</TABLE>
<%
}
%>
	<div class="application-info  magT10">
		<div class="application-sub-title">
			<span class="title">계약정보</span>
		</div>
		<div class="application-location"></div>
	</div>
	 
	<TABLE class="form-table">
		<colgroup>
			<col width="13%" />
			<col width="20%" />
			<col width="13%" />
			<col width="20%" />
			<col width="13%" />
			<col width="*" />
		</colgroup>
		<TR height="25">		
			<th style="text-align: left;">현장명</th>
			<TD><%= InputText.get("deptName", prePayment.get("DEPT_NAME"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">계약명</th>
			<TD><%= InputText.get("buildName", prePayment.get("CST_DOC_NAME"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">통화</th>
			<TD><%= InputText.get("conCurCd", prePayment.get("CURRENCY_GB"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
		</TR>
		<TR>
			<th style="text-align: left;">사업자번호</th>
			<TD><%= InputText.get("vendCd", prePayment.get("REG_NO"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>

			<th style="text-align: left;">계약업체명</th>
			<TD><%= InputText.get("memberName", prePayment.get("CORP_KOR"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>

			<th style="text-align: left;">대표이사</th>
			<TD><%= InputText.get("bossName", prePayment.get("BOSS_NAME"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
		</TR>
		<TR>
			<th style="text-align: left;">계약기간</th>
			<TD><%= InputText.get("startEndWorkDate", prePayment.get("ORD_START_END_DATE"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">계약금액</th>
			<TD><%= InputText.get("conConAmtNm", Formatter2.currency(prePayment.get("ORD_AMT"), intDigit)+" (부가세 별도)", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">선급금액</th>
			<TD><%= InputText.get("conPrepayAmtNm", Formatter2.currency(prePayment.get("PREPAY_SUPPLY_AMT"), intDigit)+" (부가세 별도)", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
		</TR>
		<TR> 
			<th style="text-align: left;">담당자명</th>  
			<TD><%= InputText.get("userName", prePayment.get("RES_USER_NAME"), 98, 6, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">담당자 핸드폰번호</th>
			<TD><%= InputText.get("hp", prePayment.get("RES_HP"), 98, 40, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">담당자 이메일</th>
			<TD><%= InputText.get("eMail", prePayment.get("RES_EMAIL"), 98, 40, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
  		</TR>
		<TR>
			<th style="text-align: left;">지급사유</th>
			<TD>
			<INPUT type="text" name="jigubsayu" id="jigubsayu" maxlength="1000" style="width:99%;" value="<%=prePayment.get("DDD") %>">
			</TD>
			<th style="text-align: left;">외국환거래 신고대상</th>
			<TD colspan="3"><%if (prePayment.get("CURRENCY_GB").equals("KRW")) { %>
	                 &nbsp; 비대상
	            <%}else{ %>
	               &nbsp;<%= InputText.get("FOREIGN_NM", prePayment.get("FOREIGN_NM"), 10, 10, "readOnly") %>
	               &nbsp;<span class="btnSearch center" id="btn_foreign"><a href="javascript:void(0);">검토</a></span>
	            <%} %>
	        </TD>
			<%-- <th style="text-align: left;">하도급직불여부</th>
			<TD colspan="3">
			    &nbsp;<input type="radio" name="SUPP_DIRECT_YN" value="Y"' <%=prePayment.get("SUPP_DIRECT_YN").equals("Y") ? "checked=\"checked\"" : ""%>>예
				&nbsp;<input type="radio" name="SUPP_DIRECT_YN" value="N"' <%=prePayment.get("SUPP_DIRECT_YN").equals("N") ? "checked=\"checked\"" : ""%>>아니오
			</TD> --%>			
		</TR>
	</TABLE>
	<!-- 계약정보 : 끝 -->

<%
	/*
		분개유형 
	*/
%>
<%@ include file="/jsp/ko_KR/buyer/cont/outside/payItem_typeA.jsp" %>

	<!-- 세금계산서정보 : 시작 -->
	<div class="application-info  magT10">
		<div class="application-sub-title">
			<span class="title">세금계산서 정보</span>
		</div>
		<div class="application-location">
			<span id="spanTaxSave" class="btnSearch center" style="display: none"><a href="javascript:void(0);" onclick="gubSave('1');" id="btnGubSave">세금계산서저장</a></span>
		</div>
	</div>
	
	<TABLE class="form-table">
		<colgroup>
			<col width="13%" />
			<col width="20%" />
			<col width="13%" />
			<col width="20%" />
			<col width="13%" />
			<col width="*" />
		</colgroup>
		<TR>
			<th style="text-align: left;">세금계산서 발행방법</th>
			<TD colspan="3">
				<input type="radio" id="chk_1" name="chk_info" value="1" onclick="taxDataSet();" <%= check1 %>>역발행(SGC이앤씨 발행)
				&nbsp;<input type="radio" id="chk_2" name="chk_info" value="2" onclick="taxDataSet();" <%= check2 %>>순발행(업체직접 발행)
				&nbsp;<input type="radio" id="chk_3" name="chk_info" value="3" onclick="taxDataSet();" <%= check3 %>>&nbsp;Invoice
			</TD>

			<th style="text-align: left;">증빙일자</th>
			<TD><%= InputText.get("date1", Formatter2.formatDate(prePayment.get("TAX_DY"), "-"), 30, 10, "Center, date, PerSize, readonly", "date", "") %>
				<A href="JavaScript:calendar('date1');"><IMG src="/img/supplier/template/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A>
			</TD>
  		</TR> 		
		<TR>
			<TH>환율</th>
			<TD>
				<%-- <%= InputText.get("rateEx", Formatter2.currency(prePayment.get("rateEx"), intDigit), 98, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %> --%>
				<%= InputText.get("rateEx", Formatter2.currency(prePayment.get("rateEx"), currency_digit), 98, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %>
			</TD>
			<TH>환율연산금액</th>
			<TD colspan="3">공급가:<%= InputText.get("rateAmt", Formatter2.currency(prePayment.get("rateAmt"), intDigit), 20, 30, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %>, 부가세:<%= InputText.get("rateVamt", Formatter2.currency(prePayment.get("rateVamt"), intDigit), 20, 30, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %>
				 
			</TD>
		</TR>
	</TABLE>
	<!-- 세금계산서정보 : 끝 -->
	
   	<div class="application-info  magT10">
		<div class="application-sub-title">
			<span class="title">대금정보</span>
		</div>
		<div class="application-location">
		</div>
	</div>

	<TABLE class="form-table">
		<colgroup>
			<col width="13%" />
			<col width="20%" />
			<col width="13%" />
			<col width="20%" />
			<col width="13%" />
			<col width="*" />
		</colgroup>

		<TR height="25">
			<th style="text-align: left;">대금구분</th>
			<TD><%= InputText.get("payDiv", "계획분할", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">지급구분</th>
			<TD>
			<select name="selectDepositCd" id="selectDepositCd" onchange="WarrantyDiv()" disabled="disabled">
       			<option value="2">중도금</option>
       			<option value="3">잔금</option>
			</select>
			<script>
				setSelect(form1.selectDepositCd, '<%=prePayment.get("DEPOSIT_CD")%>');
			</script>
			</TD>
			<th style="text-align: left;">지급차수</th>
			<TD><%= InputText.get("depositSeq", prePayment.get("DEPOSIT_SEQ"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
		</TR>
		<TR>
			<th style="text-align: left;">선급금 청구금액</th>
			<TD colspan="3">				
			합계금액:<%= InputText.get("reqPrepayAmt", Formatter2.currency(prePayment.get("PREPAY_AMT"), intDigit), 20, 16, "number, right, perSize, readonly, tabIndex=-1", "number") %>
			(공급가:<%= InputText.get("reqPrepaySamt", Formatter2.currency(prePayment.get("PREPAY_SUPPLY_AMT"), intDigit), 20, 16, "number, right, perSize, readonly, tabIndex=-1", "number") %>
			,부가세:<%= InputText.get("reqPrepayStax", Formatter2.currency(prePayment.get("PREPAY_SURTAX_AMT"), intDigit), 20, 16, "number, right, perSize, readonly, tabIndex=-1", "number") %>
			)							
			</TD>

			<th style="text-align: left;">업체신청일시</th>
			<TD><%= InputText.get("custSignDate", prePayment.get("CUST_SIGN_DATE"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
		</TR>
	</TABLE>
	
	<img src="/img/com/blank.gif" height="10px" />
	
	<TABLE class="list-form-table">
		<colgroup>
			<col width="3%" />
			<col width="3%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
			<col width="5%" />
		</colgroup>
		<tr>
			<th colspan="2" rowspan="2"></th>
			<th colspan="3">전회누계</th>
			<th colspan="3">금회</th>
			<th colspan="3">금회누계</th>
			<th colspan="3">잔여</th>
		</tr>
		<tr>
			<th>공급가액</th>
			<th>부가세</th>
			<th>합계</th>
			<th>공급가액</th>
			<th>부가세</th>
			<th>합계</th>
			<th>공급가액</th>
			<th>부가세</th>
			<th>합계</th>
			<th>공급가액</th>
			<th>부가세</th>
			<th>합계</th>
		</tr>		
		<tr>
			<th rowspan="2">기성</th>
			<th>율</th>
			<td><%= InputText.get("befAcmpPercent", Formatter2.currency(prePayment.get("BEF_ACMP_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<td><%= InputText.get("curAcmpPercent", Formatter2.currency(prePayment.get("CUR_ACMP_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<td><%= InputText.get("curBefAcmpPercent", Formatter2.currency(prePayment.get("CUR_BEF_ACMP_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<td><%= InputText.get("remainderAcmpPercent", Formatter2.currency(prePayment.get("REMAINDER_ACMP_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
		</tr>
		<tr>
			<th>금액</th>
			<td><%= InputText.get("befAcmpApplyAmt", Formatter2.currency(prePayment.get("BEF_ACMP_APPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("befAcmpVat", Formatter2.currency(prePayment.get("BEF_ACMP_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("befAcmpAmt", Formatter2.currency(prePayment.get("BEF_ACMP_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curAcmpApplyamt", Formatter2.currency(prePayment.get("CUR_ACMP_APPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curAcmpVat", Formatter2.currency(prePayment.get("CUR_ACMP_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curAcmpAmt", Formatter2.currency(prePayment.get("CUR_ACMP_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curBefAcmpSupplyamt", Formatter2.currency(prePayment.get("CUR_BEF_ACMP_SUPPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curBefAcmpVat", Formatter2.currency(prePayment.get("CUR_BEF_ACMP_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curBefAcmpAmt", Formatter2.currency(prePayment.get("CUR_BEF_ACMP_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("remainderAcmpSupplyamt", Formatter2.currency(prePayment.get("REMAINDER_ACMP_SUPPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("remainderAcmpVat", Formatter2.currency(prePayment.get("REMAINDER_ACMP_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("remainderAcmpAmt", Formatter2.currency(prePayment.get("REMAINDER_ACMP_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
		</tr>		
		<tr>
			<th rowspan="2">선급<BR/>공제</th>
			<th>율</th>
			<td><%= InputText.get("befPrepayPercent", Formatter2.currency(prePayment.get("BEF_PREPAY_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<td><%= InputText.get("curPrepayPercent", Formatter2.currency(prePayment.get("CUR_PREPAY_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<td><%= InputText.get("curBefPrepayPercent", Formatter2.currency(prePayment.get("CUR_BEF_PREPAY_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<td><%= InputText.get("remainderPrepayPercent", Formatter2.currency(prePayment.get("REMAINDER_PREPAY_PERCENT"),1), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="2"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
		</tr>
		<tr>
			<th>금액</th>
			<td><%= InputText.get("befPrepayApplyAmt", Formatter2.currency(prePayment.get("BEF_PREPAY_APPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("befPrepayVat", Formatter2.currency(prePayment.get("BEF_PREPAY_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("befPrepayAmt", Formatter2.currency(prePayment.get("BEF_PREPAY_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curPrepayApplyamt", Formatter2.currency(prePayment.get("CUR_PREPAY_APPLYAMT"),intDigit), 99, 16, "class=input byteChk ,float, right, perSize", "float") %></td>
			<%-- <td><%= InputText.get("curPrepayVat", Formatter2.currency(prePayment.get("CUR_PREPAY_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<td><%= InputText.get("curPrepayVat", Formatter2.currency(prePayment.get("CUR_PREPAY_VAT"),intDigit), 99, 16, "class=input byteChk ,float, right, perSize", "float") %></td>
			<td><%= InputText.get("curPrepayDeductamt", Formatter2.currency(prePayment.get("CUR_PREPAY_DEDUCTAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curBefPrepaySupplyamt", Formatter2.currency(prePayment.get("CUR_BEF_PREPAY_SUPPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curBefPrepayVat", Formatter2.currency(prePayment.get("CUR_BEF_PREPAY_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curBefPrepayAmt", Formatter2.currency(prePayment.get("CUR_BEF_PREPAY_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("remainderPrepaySupplyamt", Formatter2.currency(prePayment.get("REMAINDER_PREPAY_SUPPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("remainderPrepayVat", Formatter2.currency(prePayment.get("REMAINDER_PREPAY_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("remainderPrepayAmt", Formatter2.currency(prePayment.get("REMAINDER_PREPAY_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
		</tr>
		<tr>
			<th rowspan="1">청구액</th>
			<th>금액</th>
			<td><%= InputText.get("payedApplyamt", Formatter2.currency(prePayment.get("PAYED_APPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("payedVat", Formatter2.currency(prePayment.get("PAYED_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("payedAmt", Formatter2.currency(prePayment.get("PAYED_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<!-- 2017.1.18 잔여1-2원 관리자 정산   -->
			<%if (user.get("right_name").equals("ADMIN NEW")) { %>
			<td><%= InputText.get("curReqAmt", Formatter2.currency(prePayment.get("CUR_REQ_AMT"),intDigit), 99, 16, "class=input byteChk ,float, right, perSize", "float") %></td>
			<%}else { %>
			<td><%= InputText.get("curReqAmt", Formatter2.currency(prePayment.get("CUR_REQ_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<%} %>
			<td><%= InputText.get("curReqVatamt", Formatter2.currency(prePayment.get("CUR_REQ_VATAMT"),intDigit), 99, 16, "class=input byteChk ,float, right, perSize", "float") %></td>
			<td><%= InputText.get("curReqApplyamt", Formatter2.currency(prePayment.get("CUR_REQ_APPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curPayedSupplyamt", Formatter2.currency(prePayment.get("CUR_PAYED_SUPPLYAMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curPayedVat", Formatter2.currency(prePayment.get("CUR_PAYED_VAT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td><%= InputText.get("curPayedAmt", Formatter2.currency(prePayment.get("CUR_PAYED_AMT"),intDigit), 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td>
			<td colspan="3"></td>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
			<%-- <td><%= InputText.get("blank", "", 99, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></td> --%>
		</tr>
	</TABLE>

	<!-- Vendor Print : 시작 -->
	<div class="application-info  magT15" id="vpDiv1">
		<div class="application-sub-title">
			<span class="title">Vendor Print</span>
		</div>
		<div class="application-location">
		</div>
	</div>
	
	<TABLE class="form-table"  id="vpDiv2">
		<colgroup> 
			<col width="13%" />
			<col width="19%" />
			<col width="15%" />
			<col width="19%" />
			<col width="15%" />
			<col width="19%" />
			<col width="*" />
		</colgroup>
		<TR>
			<th style="text-align: left;">검토부서</th>
			<TD>
				<%= InputText.get("EPART_DEPT_NAME", vendorPrintInfo.get("EPART_DEPT_NAME"), 99, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %>
			</TD>
			<th style="text-align: left;">검토자</th>
			<TD>
			<INPUT type='hidden' name="VP_CHK_EMPNO" value="<%=vendorPrintInfo.get("VP_CHK_EMPNO")%>">
				<%= InputText.get("VP_CHK_EMPNM", vendorPrintInfo.get("VP_CHK_EMPNM"), 98, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %>
				<%-- <IMG id=btnevalemp src="/img/buyer/button/bt_search_right.gif" alt="검토자" border="0" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:SearchUser('<%=vendorPrintInfo.get("VP_CHK_EMPNM")%>','<%=vendorPrintInfo.get("VP_CHK_EMPNO")%>','N');"> --%>
			</TD>
			<th style="text-align: left;">검토일자</th>
			<TD colspan="2">
				<%= InputText.get("VP_END_DY", Formatter2.formatDate(vendorPrintInfo.get("VP_END_DY"), "-"), 40, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %>
				<!-- <A href="JavaScript:calendar('VP_END_DY');"><IMG src="/img/supplier/template/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A> -->
			</TD>
		</TR>
		<TR>
			<th style="text-align: left;">검토항목</th>
			<TD colspan="3">
				<%= InputText.get("VP_DESC", vendorPrintInfo.get("VP_DESC"), 99, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %>
			</TD>
			<th style="text-align: left;">상태</th>
			<TD colspan="2">
				<%= InputText.get("VP_STATUS_NM", vendorPrintInfo.get("VP_STATUS_NM"), 99, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %>
			</TD>
		</TR>
		<tr height="25" id="return_reson_area">
			<th style="text-align: left;">반려사유</th>
			<td colspan="5">
				<TEXTAREA name="vpRtnReason" id="vpRtnReason" rows="3" readOnly class="input ctrlTarget" style="width:98%; height: 98%; overflow-y:auto"><%= vendorPrintInfo.get("VP_RTN_REASON") %></TEXTAREA>
			</TD>
		</tr>
		<tr height="25"> 
			<th>의견</th>
			<td colspan="5">
			    <TEXTAREA name="opinion" id="opinion" style="width:98%; height:70px; overflow-y:auto" maxlength="100" class="input byteChk ctrlTarget" readOnly><%=vendorPrintInfo.get("VP_OPINION") %></textarea>
			</td>					
  		</tr>		
	</TABLE>
	<!-- Vendor Print : 끝 -->
		
   	<div class="application-info  magT10">
		<div class="application-sub-title">
			<span class="title">첨부 및 기타서류</span>
		</div>
		<div class="application-location">
		</div>
	</div>
		
	<TABLE class="form-table">
		<colgroup>
			<col width="25%" />
			<col width="*" />
			<col width="20%" />
			<col width="20%" />
		</colgroup>
		<TR>
			<th style="text-align: Center;" colspan="2">첨부서류</th>
			<th style="text-align: Center;" colspan="1">파일첨부</th>
			<th style="text-align: Center;" colspan="1">특기사항</th>
  		</TR>
 		<TR height="140">
 			<TD colspan="2">
 			<TABLE class="inner_table" border="0" >
				<%
				if(purchaseFileRow.size() > 0){
					int i_mod = 0;
					for(int i = 0; purchaseFileRow.size() > i; i++){
						i_mod = i%3;
						if(i_mod == 0){ %>
							<TR>
					<%	} %>
								<td width="2%">
								<input type="checkbox" name="doc_cd" value="<%=purchaseFileRow.getRow(i).get("DETAILCD") %>" style="cursor:pointer;" onClick="fileCheck(this,'<%=purchaseFileRow.getRow(i).get("DETAILCD") %>')" <%if(!purchaseFileRow.getRow(i).get("DOC_CD").equals("")){out.print("checked");} %>>
								</td>
								<td width="20%">
								<%-- <%=acmpFileRow.getRow(i).get("DETAILNM").replace(" ", "<BR>") %> --%>
								<%=purchaseFileRow.getRow(i).get("DETAILNM") %>
								</td>
								<td width="7%" height="24">
								<IMG src="/img/supplier/button/bt_attach_file.gif" id="<%=purchaseFileRow.getRow(i).get("DETAILCD") %>" alt="첨부파일 관리" align="top" style="display:<%if(!purchaseFileRow.getRow(i).get("DOC_CD").equals("")){out.print("inline");}else{out.print("none");} %>" onClick="doAttachFile(document.form1.payreqId, '<%=purchaseFileRow.getRow(i).get("DETAILCD") %>', '<%=purchaseFileRow.getRow(i).get("DETAILNM")%>');" class="button">
								</td>
					<%	if(i_mod == 2) { %>		
							</TR>
					<%	} %>		
				<%
					}
					for(int i=i_mod+1; i<3; i++){ %>
						<td></td>
				<%	}
					if(i_mod == 0 || i_mod == 1){ %>
						</TR>	
				<%	}
				}
				%>
			</TABLE>		
			</TD>
			<TD><TEXTAREA name="p_AttachFile" id="p_AttachFile" rows="12" readOnly class="input ctrlTarget" style="width:98%; height: 98%; overflow-y:auto"></TEXTAREA></TD>
			<TD><TEXTAREA name="reMarks" id="reMarks" rows="12" maxlength="1000" class="input byteChk ctrlTarget" style="width:98%; height: 98%; overflow-y:auto"><%=prePayment.get("RE_MARKS")%></TEXTAREA></TD>
		</TR>
	</TABLE>

	<!-- 보증정보 : 시작 -->
<%
	/*
		보증 목록을  include 시킴 (2014-10-16) 김명호
	*/
if(!prePayment.get("REQ_STATUS").equals("98")){
%>
	<%@ include file="/jsp/ko_KR/buyer/cont/purchase/guarList.jsp"%>
<%
}
%>
</FORM>