<%--
  - FileName   : resolutionRequest.jsp
  - Author(s)  : ok
  - Date       : 2014.06.30
  - Copyright  : Copyright (c) 2013 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();
    
    //ValueObject prePayment = storage.getValueObject("prePayment");	//계약정보, 세금계산서정보
    ValueObject acmpData = storage.getValueObject("acmpData");	//기성정보
    
    RowSet warrList = storage.getRowSet("contOutWarr");	//보증정보

    ValueObject AttachFile = storage.getValueObject("AttachFile");
    
    //기성검사 첨부서류
	RowSet acmpFileRow = storage.getRowSet("acmpFileRow");
	//준공검사 첨부서류
	RowSet compFileRow = storage.getRowSet("compFileRow");
		
    String check1 = "";
    String check2 = "";
    String checkString = "";
    if("2".equals(acmpData.get("TAX_METHOD_CD"))){
    	check2 = "checked";
    	checkString = "순발행(업체직접 발행)";
    }else{
    	check1 = "checked";
    	checkString = "역발행(SGC이앤씨 발행)";
    }
    
 	String payCheckYN1 = "";
 	String payCheckYN2 = "";
 	String payCheckYNString = "";
 	if("Y".equals(acmpData.get("SUPP_DIRECT_YN"))){
 		payCheckYN1 = "checked";
 		payCheckYNString = "예";
 	}else{
 		payCheckYN2 = "checked";
 		payCheckYNString = "아니오";
 	}
    
	String digit = (String)acmpData.get("digit");
	int intDigit = Integer.parseInt(digit);
    
%>
<SCRIPT language="JavaScript">
	/*예약함수*/
	var sheet1;
	var sheet1Row;
	var sheet1PageNo = 1;
	var pageLastRowIndex = 1;
	var validationResult = false;
	var filterShow = false;
	
	var serverName = '<%=request.getServerName() %>';

	var g_digit = <%= intDigit %>;			// 소숫점 이하 자릿수
	
	function _onReady(){

		//상세화면 재조회
		jQuery("#btnSearch").click(function() {
			jQuery("#fevent").val("");
			jQuery("#form1").attr("action", "/payment/outside/ResolutionRequest.screen");
			jQuery("#form1").attr("target", "_self");
			jQuery("#form1").attr("method", "post");
			jQuery("#form1").submit();
		});
		
		//리스트 페이지 이동
		jQuery("#btnList").click(function() {
			
			jQuery("#fevent").val("");
			jQuery("#form1").attr("action", "/payment/outside/PayRequestList.screen");
			jQuery("#form1").attr("target", "_self");
			jQuery("#form1").attr("method", "post");
			jQuery("#form1").submit();
		});
		 

		jQuery("#btnDelete").click(function() {
			var f = document.form1;
			
			if(jQuery("#statusCd").val() != "01" && jQuery("#statusCd").val() != "91"){ //2020.03.26 반려(91) 추가
				alert("작성중인 기성만 삭제 가능합니다.");
				return;
			}

			if(jQuery("#acmpId").val() == ""){
				alert("삭제되었습니다.");
				return;
			}
			//입력데이터 저장 
			if (confirm("삭제 하시겠습니까?")) {
				jQuery("#fevent").val("DELETE_DATA");
				submitXmlRequest("/portal/payment/ResolutionRequest_form.screen", "DELETE_DATA", f, "SUCCESS");
			}
		});		

		jQuery("#btnSave").click(function() {
		
			var f = document.form1;
			jQuery("#fevent").val("SAVE_DATA");
			//필수 입력항목 check
			if(requiredItemsCheck() == false){
				return;
			}
			//이전 기성차수의 누계기성(기성, 선급금) 합계와 당월 기성차수의 전회(기성, 선급금) 금액비교 check
			if(payCompareCheck() == false){
				return;
			}
			//입력데이터 저장 
			if (confirm("저장 하시겠습니까?")) {
				jQuery("#btnAppReqSelect").val("0");
				submitXmlRequest("/portal/payment/ResolutionRequest_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;
			}
			//이전 기성차수의 누계기성(기성, 선급금) 합계와 당월 기성차수의 전회(기성, 선급금) 금액비교 check
			if(payCompareCheck() == false){
				return;
			}
			//입력데이터 저장 
			if (confirm("기성신청 하시겠습니까?")) {
				
				submitXmlRequest("/portal/payment/ResolutionRequest_form.screen", "SAVE_DATA", f, "SUCCESS");
			}else{
				jQuery("#btnAppReqSelect").val("0");	//0:저장처리, 1:기성신청처리
			}
			
		});		
		
		
		jQuery("#requSurtaxAmt").blur(function () {
			var fundTamtValue = jQuery("#fundTamt").val().replace(/(\,|\:)/g,"");	//기성 금회 과세
			
			var requSurtaxAmt = Number(jQuery("#requSurtaxAmt").val().replace(/(\,|\:)/g,""));	//부가세
			var requSupplyTamt = jQuery("#requSupplyTamt").val().replace(/(\,|\:)/g,"");

			if(jQuery("#inputVatDiv").val() == "INPUT_EXEMPT"){
				if(requSurtaxAmt > 0){
					alert("영세율 대상건입니다.");
					jQuery("#requSurtaxAmt").val(0);
					jQuery("#requSurtaxAmt").focus();
					return;
				}
				if(requSurtaxAmt == ""){
					jQuery("#requSurtaxAmt").val(0);
				}
			}else{
				if(fundTamtValue > 0 && ( requSurtaxAmt == 0 || requSurtaxAmt == "") ){
					alert("부가세 0을 입력 할수 없습니다.");
					jQuery("#requSurtaxAmt").val(0);
					jQuery("#requSurtaxAmt").focus();
					return;
				}				
			}
			
			var requAmt = Number(requSupplyTamt) + Number(requSurtaxAmt);
			jQuery("#requAmt").val(requAmt.toFixed(g_digit));
			jQuery("#trequSurtaxAmt").val(requSurtaxAmt.toFixed(g_digit));	//청구 부가세 금회 합계
			
			var requSupplyAmt = jQuery("#requSupplyAmt").val().replace(/(\,|\:)/g,"");	//청구액 공급액 금회 합계
			var trequAmt = Number(requSupplyAmt) + Number(requSurtaxAmt);
			jQuery("#trequAmt").val(trequAmt.toFixed(g_digit));
			
			var totRequSupplyTamt = jQuery("#totRequSupplyTamt").val().replace(/(\,|\:)/g,"");	//청구 공급액 누계 과세 
			jQuery("#totRequSurtaxAmt").val(requSurtaxAmt.toFixed(g_digit));	//청구 부가세 누계 과세
			var totRequAmt = Number(totRequSupplyTamt) + Number(requSurtaxAmt);
			jQuery("#totRequAmt").val(totRequAmt.toFixed(g_digit));	//청구 합계 누계 과세
			
			var totRequSupplyAmt = jQuery("#totRequSupplyAmt").val().replace(/(\,|\:)/g,"");//청구 공급액 누계 합계
			jQuery("#ttotRequSurtaxAmt").val(requSurtaxAmt.toFixed(g_digit));//청구 부가세 누계 합계
			var ttotRequAmt = Number(totRequSupplyAmt) + Number(requSurtaxAmt);
			jQuery("#ttotRequAmt").val(ttotRequAmt.toFixed(g_digit));	//청구 합계 누계 합계
			
			var preRequSurtaxAmtValue = Number(jQuery("#preRequSurtaxAmt").val().replace(/(\,|\:)/g,""));	//청구 부가세 전회 과세
			var totRequSurtaxAmtValue = preRequSurtaxAmtValue + requSurtaxAmt;
			jQuery("#totRequSurtaxAmt").val(totRequSurtaxAmtValue.toFixed(g_digit));
			
			var tpreRequSurtaxAmtValue = Number(jQuery("#tpreRequSurtaxAmt").val().replace(/(\,|\:)/g,""));
			var ttotRequSurtaxAmtValue = tpreRequSurtaxAmtValue + requSurtaxAmt;
			jQuery("#ttotRequSurtaxAmt").val(ttotRequSurtaxAmtValue);
			
			var totRequSupplyTamtValue = Number(jQuery("#totRequSupplyTamt").val().replace(/(\,|\:)/g,""));
			var totRequAmtValue = totRequSupplyTamtValue + ttotRequSurtaxAmtValue;
			jQuery("#totRequAmt").val(totRequAmtValue);
			
			var totRequSupplyAmtValue = Number(jQuery("#totRequSupplyAmt").val().replace(/(\,|\:)/g,""));
			var ttotRequAmtValue = totRequSupplyAmtValue + ttotRequSurtaxAmtValue;
			jQuery("#ttotRequAmt").val(ttotRequAmtValue.toFixed(g_digit)); 
			
			jQuery("#requAmt, #trequSurtaxAmt, #trequAmt, #totRequAmt, #ttotRequAmt, #totRequSurtaxAmt, #ttotRequSurtaxAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
		});
		
		jQuery("#btnItem").click(function () {
			//2018.10.25 기성내역입력  		
			var win_id = "ItemPop";	
			var link = "/payment/outside/PayItemPopup.screen";
			var editFile = "N";
			if(jQuery("#statusCd").val() == "01" || jQuery("#statusCd").val() == "02" || jQuery("#statusCd").val() == "91"){editFile="Y";} //2020.03.26 반려(91) 추가
			
			link += "?pop_win_id="+win_id+"&ACMP_ID="+jQuery("#acmpId").val()+"&SUB_CONT_ID="+jQuery("#selectSubContId").val()+"&EDIT_YN="+editFile+"&digit="+g_digit;
			 
			fLayerPop(win_id, link, 950,500, '','', 'NO');
		});
		
		jQuery("#fundTamt").dblclick(function () {
			jQuery("#btnItem").click();
		});
		
		//2018.11.22 선급금공제 수정시 계산   2019.1.29
		jQuery("#payDeductTamt").blur(function () {

			var prepayedTAmt = jQuery("#slPrepaySupplyTmat").val().replace(/(\,|\:)/g,""); //선급금 과세 지급액
			var prepayedNAmt = jQuery("#slPrepaySupplyNamt").val().replace(/(\,|\:)/g,""); //선급금 면세 지급액
			var prepayedAmt = Number(prepayedTAmt) + Number(prepayedNAmt);//jQuery("#slPrepayAmt").val().replace(/(\,|\:)/g,""); //선급금 합계 지급액
			
			var conTamt = jQuery("#conSupplyTamt").val().replace(/(\,|\:)/g,""); //계약과세
			var conNamt = jQuery("#conSupplyNamt").val().replace(/(\,|\:)/g,""); //계약면세 
			var conVat = jQuery("#conSurtaxAmt").val().replace(/(\,|\:)/g,""); //계약부가세 
	
			var deductTAmt = jQuery("#payDeductTamt").val().replace(/(\,|\:)/g,""); //금회 과세 선급금 공제금액 
			var deductNAmt =  jQuery("#payDeductNamt").val().replace(/(\,|\:)/g,""); //Number(conNamt) * Number(deductTAmt) / Number(conTamt) ;  //금회 면세 선급금 공제금액  			
			var deductAmt = Number(deductTAmt)+Number(deductNAmt);
			
			var deductTAmtSum = jQuery("#prePayDeductTamt").val().replace(/(\,|\:)/g,""); //전화 과세 선급금 누계 
			var deductNAmtSum = jQuery("#prePayDeductNamt").val().replace(/(\,|\:)/g,""); //전회 면세 선급금 누계 
			var deductAmtSum = jQuery("#prePayDeductAmt").val().replace(/(\,|\:)/g,""); //전회 합계 선급금 누계 

			if (Number(prepayedTAmt) - Number(deductTAmtSum) - Number(deductTAmt) < 0){
				//alert("선급 과세 잔여가 마이너스 입니다.");
				//return;
			}
			if (Number(prepayedNAmt) - Number(deductNAmtSum) - Number(deductNAmt) < 0){
				//alert("선급 면세 잔여가 마이너스 입니다.");
				//return;
			}
			
			jQuery("#payDeductNamt").val(Number(deductNAmt).toFixed(g_digit));  //금회 면세 선급금 공제금액 
			jQuery("#payDeductAmt").val((Number(deductNAmt) + Number(deductTAmt)).toFixed(g_digit));  //금회 합계 선급금 공제금액 
			jQuery("#totPayDeductTamt").val((Number(deductTAmtSum)+Number(deductTAmt)).toFixed(g_digit));  //선급과세누계
			jQuery("#totPayDeductNamt").val((Number(deductNAmtSum)+Number(deductNAmt)).toFixed(g_digit));  //선급면세누계
			jQuery("#totPayDeductAmt").val((Number(deductAmtSum)+Number(deductAmt)).toFixed(g_digit));  //선급누계			
			jQuery("#resPayDeductTamt").val((Number(prepayedTAmt) - Number(deductTAmtSum)-Number(deductTAmt)).toFixed(g_digit));  //잔여 과세
			jQuery("#resPayDeductNamt").val((Number(prepayedNAmt) - Number(deductNAmtSum)-Number(deductNAmt)).toFixed(g_digit));  //잔여 면세
			jQuery("#resPayDeductAmt").val(Number(jQuery("#resPayDeductTamt").val().replace(/(\,|\:)/g,""))+Number(jQuery("#resPayDeductNamt").val().replace(/(\,|\:)/g,"")));//잔여 합계
			
			var reqTAmt = Number(jQuery("#fundTamt").val().replace(/(\,|\:)/g,""))- Number(deductTAmt); //청구금회 과세
			var reqNAmt = Number(jQuery("#fundNamt").val().replace(/(\,|\:)/g,""))- Number(deductNAmt); //청구금회 면세
			var reqAmt = Number(jQuery("#fundAmt").val().replace(/(\,|\:)/g,""))- Number(deductAmt);    //청구금회 합계
			jQuery("#requSupplyTamt").val(reqTAmt.toFixed(g_digit));
			jQuery("#requSupplyNamt").val(reqNAmt.toFixed(g_digit)) ;
			jQuery("#requSupplyAmt").val(reqAmt.toFixed(g_digit)) ;
			var reqTAmtSum = jQuery("#preRequSupplyTamt").val().replace(/(\,|\:)/g,"") ; //청구금회 과세누계
			var reqNAmtSum = jQuery("#preRequSupplyNamt").val().replace(/(\,|\:)/g,"") ; //청구금회 면세누계
			var reqAmtSum = jQuery("#preRequSupplyAmt").val().replace(/(\,|\:)/g,"") ;  //청구금회 합계누계
			
			jQuery("#totRequSupplyTamt").val((Number(reqTAmtSum) + Number(reqTAmt)).toFixed(g_digit));
			jQuery("#totRequSupplyNamt").val((Number(reqNAmtSum) + Number(reqNAmt)).toFixed(g_digit));
			jQuery("#totRequSupplyAmt").val((Number(reqAmtSum) + Number(reqAmt)).toFixed(g_digit));
			
			
			var vatAmt = (Number(reqTAmt) * 10) / 100;  //금회 부가세  
			if (Number(conVat) == 0 ){
				vatAmt = 0 ;
			}
			jQuery("#requSurtaxAmt").val(vatAmt.toFixed(g_digit));
			jQuery("#trequSurtaxAmt").val(vatAmt.toFixed(g_digit));
			
			var preTaxamt = jQuery("#preRequSurtaxAmt").val().replace(/(\,|\:)/g,"") ;  
			jQuery("#totRequSurtaxAmt").val((Number(preTaxamt) + Number(vatAmt)).toFixed(g_digit) );  
			jQuery("#ttotRequSurtaxAmt").val((Number(preTaxamt) + Number(vatAmt)).toFixed(g_digit) );
			
			jQuery("#requAmt").val((Number(reqTAmt) + Number(vatAmt)).toFixed(g_digit));  //과세금회합계 청구+부가세
			jQuery("#trequSupplyNamt").val(reqNAmt.toFixed(g_digit)); //면세금회합계 청구+부가세
			jQuery("#trequAmt").val((Number(reqTAmt) + Number(vatAmt) + Number(reqNAmt)).toFixed(g_digit));  //청구합계 
			

			
			var preReqTAmt = jQuery("#preRequAmt").val().replace(/(\,|\:)/g,"");           //누계 청구 과세 합계
			var preReqNAmt = jQuery("#tpreRequSupplyNamt").val().replace(/(\,|\:)/g,"") ;  //누계 청구 면세 합계
			var preReqAmt = jQuery("#tpreRequAmt").val().replace(/(\,|\:)/g,"")  ;         //누계 청구 합계
			jQuery("#totRequAmt").val((Number(preReqTAmt) + Number(reqTAmt) + Number(vatAmt)).toFixed(g_digit));
			jQuery("#ttotRequSupplyNamt").val((Number(preReqNAmt) + Number(reqNAmt)).toFixed(g_digit));
			jQuery("#ttotRequAmt").val((Number(preReqAmt) + Number(reqTAmt) + Number(vatAmt) + Number(reqNAmt)).toFixed(g_digit)); 
			
			//선급비율
			if (Number(prepayedTAmt) > 0 ){
				var preTrate = (Number(deductTAmt) / Number(prepayedTAmt)) * 100; //금회 과세비율
				jQuery("#payDeductTRate").val(preTrate.toFixed(2)); //금회과세
				
				preTrate = ((Number(deductTAmtSum) + Number(deductTAmt)) / Number(prepayedTAmt)) * 100; //과세 누계비율 
				jQuery("#totPayDeductTRate").val(preTrate.toFixed(2));  //과세누계
				jQuery("#resPayDeductTRate").val((100-preTrate).toFixed(2));   //과세잔여 
			}
			if (Number(prepayedNAmt) > 0 ){
				var preNrate = (Number(deductNAmt) / Number(prepayedNAmt)) * 100; //금회 면세비율
				jQuery("#payDeductNRate").val(preNrate.toFixed(2)); //금회면세
				
				preNrate = ((Number(deductNAmtSum) + Number(deductNAmt)) / Number(prepayedNAmt)) * 100; //면세 누계비율 
				jQuery("#totPayDeductNRate").val(preNrate.toFixed(2));  //면세누계
				jQuery("#resPayDeductNRate").val((100-preNrate).toFixed(2));   //면세잔여
			}
			if (Number(prepayedAmt) > 0 ){
				var prerate = (Number(deductAmt) / Number(prepayedAmt)) * 100; //금회 합계비율
				jQuery("#payDeductRate").val(prerate.toFixed(2));  //금회합계
				
				prerate = ((Number(deductAmtSum) + Number(deductAmt)) / Number(prepayedAmt)) * 100; //합계 누계비율 
				jQuery("#totPayDeductRate").val(prerate.toFixed(2));    //합계누계
				jQuery("#resPayDeductRate").val((100-prerate).toFixed(2));     //합계잔여
			}
			 
			
			jQuery("#payDeductNamt, #payDeductAmt, #totPayDeductTamt, #totPayDeductNamt, #totPayDeductAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			jQuery("#resPayDeductTamt, #resPayDeductNamt, #resPayDeductAmt, #requSupplyTamt, #requSupplyNamt, #requSupplyAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
			jQuery("#totRequSupplyTamt, #totRequSupplyNamt, #totRequSupplyAmt, #requSurtaxAmt, #trequSurtaxAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
			jQuery("#totRequSurtaxAmt, #ttotRequSurtaxAmt, #requAmt, #trequSupplyNamt, #trequAmt, #totRequAmt, #ttotRequSupplyNamt, #ttotRequAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
		});
		
		jQuery("#fundTamt").blur(function () {  //2019.1.29
			//금회 계산 처리			
			var fundTamtValue = jQuery("#fundTamt").val().replace(/(\,|\:)/g,"");	//기성 금회 과세
			fundTamtValue = Number(fundTamtValue).toFixed(g_digit);
			//입력한 선급금 과세가 빈값일 경우 0으로 셋팅
			if (fundTamtValue == "") {
				fundTamtValue = "0";
				jQuery("#fundTamt").val("0");
			}else{
				jQuery("#fundTamt").val(fundTamtValue);
				jQuery("#fundTamt").each(function(index){
					jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
				});
			}
			var conSupplyTamtValue = jQuery("#conSupplyTamt").val().replace(/(\,|\:)/g,"");	//계약금 과세
			var fconSupplyTamtValue = jQuery("#F_CON_SUPPLY_AMT").val().replace(/(\,|\:)/g,"");	//당초 계약금
			conSupplyTamtValue = Number(conSupplyTamtValue).toFixed(g_digit);
			fconSupplyTamtValue = Number(fconSupplyTamtValue).toFixed(g_digit);
			if(Number(fundTamtValue) > Number(conSupplyTamtValue)){
				alert("입력한 금회 기성 과세액이 계약 과세금 보다 큽니다.");
				jQuery("#fundTamt").focus();
				return;
			}
			
			var conSupplyNamt = jQuery("#conSupplyNamt").val().replace(/(\,|\:)/g,"");   //계약금 공급가액 면세
			var fundNamt = jQuery("#fundNamt").val().replace(/(\,|\:)/g,"");//Number(conSupplyNamt) * (Number(fundTamtValue) / Number(conSupplyTamtValue));2019.03.15
			jQuery("#fundNamt").val(Number(fundNamt).toFixed(g_digit));
			//var fundNamtValue = jQuery("#fundNamt").val().replace(/(\,|\:)/g,"");   //기성 금회 면세
			var fundNamtValue = fundNamt;
			fundNamtValue = Number(fundNamtValue).toFixed(g_digit);
			//입력한 선급금 면세가 빈값일 경우 0으로 셋팅
			if (fundNamtValue == "") {
				fundNamtValue = "0";
				jQuery("#fundNamt").val("0");
			}
			var conSupplyNamtValue = jQuery("#conSupplyNamt").val().replace(/(\,|\:)/g,"");	//계약금 면세
			conSupplyNamtValue = Number(conSupplyNamtValue).toFixed(g_digit);
			if(Number(fundNamtValue) > Number(conSupplyNamtValue)){
				alert("입력한 금회 기성 면세액이 계약 면세금 보다 큽니다.");
				jQuery("#fundNamt").focus();
				return;
			}
	
			//금회 과세 기성율
			if(fconSupplyTamtValue == 0){
				var fundTRate = Number(fundTamtValue) / Number(conSupplyTamtValue) * 100;
				jQuery("#fundTRate").val(fundTRate.toFixed(2));
			}else{
				
				var fundTRate = Number(fundTamtValue) / Number(conSupplyTamtValue) * 100;
				//var fundTRate = fundTamtValue / fconSupplyTamtValue * 100;
				var f_rate = Number(fundTamtValue) / Number(fconSupplyTamtValue) * 100;	//당초 계약금으로 계산
				jQuery("#fundTRate").val(fundTRate.toFixed(2));
				jQuery("#payDeductTRate").val(f_rate.toFixed(2));	//선급공제 금회 과세 율
			}
			
			//금회 면세 기성율
			var fundNRate = 0;
			if(Number(conSupplyNamtValue) == 0){
				jQuery("#fundNRate").val(fundNRate.toFixed(2));
			
			}else{
				
				fundNRate = Number(fundNamtValue) / Number(conSupplyNamtValue) * 100;
				jQuery("#fundNRate").val(fundNRate.toFixed(2));
				jQuery("#payDeductNRate").val(fundNRate.toFixed(2));	//선급공제 금회 과세 율
			}

			
			var fundAmtValue = Number(fundNamtValue) + Number(fundTamtValue);
			jQuery("#fundAmt").val(Number(fundAmtValue).toFixed(g_digit));		//기성 금회 합계
			
			var conSupplyAmtValue = Number(conSupplyTamtValue) + Number(conSupplyNamtValue);//계약 공급액
			var fundRateValue = (Number(fundAmtValue) / Number(conSupplyAmtValue)) * 100;
			jQuery("#fundRate").val(fundRateValue.toFixed(2));	//기성 금회 기성율
			
 			var slPrepaySupplyTmatValue = jQuery("#slPrepaySupplyTmat").val().replace(/(\,|\:)/g,"");	//계약 선급금지급 과세
			var slPrepaySupplyNamtValue = jQuery("#slPrepaySupplyNamt").val().replace(/(\,|\:)/g,"");	//계약 선급금지급 면세
			var slPrepaySupplyAmtValue = Number(slPrepaySupplyTmatValue) + Number(slPrepaySupplyNamtValue);	//계약 선급금지급 공급가액
			
			//var payDeductTamtValue = Number(slPrepaySupplyTmatValue) * Number( fundTRate.toFixed(2) / 100);
			if(fconSupplyTamtValue == 0){
			    var payDeductTamtValue = 0;
				jQuery("#payDeductTamt").val(0);	//선급공제 금회 과세
				jQuery("#payDeductNamt").val(0);	//선급공제 금회 면세
				jQuery("#payDeductNRate").val("0.00");	//선급공제 금회 과세 율
			
			}else{
				//2016.7.28 선급금 마이너스인 경우 처리  
				var f_rate = fundTamtValue / fconSupplyTamtValue * 100;	//당초 계약금으로 계산
				var payDeductTamtValue = Number(slPrepaySupplyTmatValue) * Number(f_rate) / 100;
				//2016.7.28 선급공제액 > 선급잔액보다 크면 
				/*if (Number(payDeductTamtValue) > Number(jQuery("#resPayDeductTamt").val().replace(/(\,|\:)/g,"")) ) {
					payDeductTamtValue = Number(jQuery("#resPayDeductTamt").val().replace(/(\,|\:)/g,""));  //선급잔액->선급공제액으로 
					var p_rate = Number(payDeductTamtValue)/Number(jQuery("#prepaySupplyTamt").val().replace(/(\,|\:)/g,""))*100; //선급비율=공제금액/선급액 
					jQuery("#payDeductTRate").val(p_rate.toFixed(2));//선급금율=공제금액/선급액*100
				}*/
		 
				jQuery("#payDeductTamt").val(payDeductTamtValue.toFixed(g_digit));	//선급공제 금회 과세
				//var payDeductNamtValue = Number(slPrepaySupplyNamtValue * fundNRate.toFixed(2)  / 100);
				
				
				var payDeductNamtValue = Number(slPrepaySupplyNamtValue) * parseFloat_isNaN(Number(payDeductTamtValue) / Number(slPrepaySupplyTmatValue));
				jQuery("#payDeductNamt").val(Number(payDeductNamtValue).toFixed(g_digit));	//선급공제 금회 면세
				var updse = payDeductNamtValue.toFixed(g_digit) / slPrepaySupplyNamtValue * 100;
				if(Number(slPrepaySupplyNamtValue) == 0){
					jQuery("#payDeductNRate").val("0.00");	//선급공제 금회 과세 율
				}else{
					jQuery("#payDeductNRate").val(updse.toFixed(2));	//선급공제 금회 과세 율
				}
			}
			var payDeductAmtValue = Number(payDeductTamtValue) + Number(jQuery("#payDeductNamt").val().replace(/(\,|\:)/g,""));
			jQuery("#payDeductAmt").val(payDeductAmtValue.toFixed(g_digit));		//선급공제 금회 합계
			
			if(payDeductAmtValue == "0"){
				var payDeductRateValue = "0.00";
				jQuery("#payDeductRate").val(payDeductRateValue);	//선급공제 금회 기성율
			}else{
				var payDeductRateValue = (Number(payDeductAmtValue) / Number(slPrepaySupplyAmtValue)) * 100;
				jQuery("#payDeductRate").val(Number(payDeductRateValue).toFixed(2));	//선급공제 금회 기성율
			}
			
		 	var requSupplyTamtValue = Number(fundTamtValue) -  Number(jQuery("#payDeductTamt").val().replace(/(\,|\:)/g,""));
			jQuery("#requSupplyTamt").val(requSupplyTamtValue.toFixed(g_digit));	//청구 공급액 금회 과세
			var requSupplyNamtValue = Number(fundNamtValue) - Number(jQuery("#payDeductNamt").val().replace(/(\,|\:)/g,""));
			jQuery("#requSupplyNamt").val(requSupplyNamtValue.toFixed(g_digit));	//청구 공급액 금회 면세			
			var requSupplyAmtValue = Number(fundAmtValue) - Number(payDeductAmtValue);
			jQuery("#requSupplyAmt").val(requSupplyAmtValue.toFixed(g_digit));	//청구 공급액 금회 합계			
			
			
			var requSurtaxAmt = Number(jQuery("#requSurtaxAmt").val().replace(/(\,|\:)/g,""));	//부가세
			//if(requSurtaxAmt == 0){
				var requSurtaxAmtValue = (requSupplyTamtValue * 10) / 100 
				//jQuery("#requSurtaxAmt").val(requSurtaxAmtValue.toFixed(g_digit));	//청구 부가세 금회 과세
				if(jQuery("#inputVatDiv").val() == "INPUT_EXEMPT"){
					jQuery("#requSurtaxAmt").val(0);	//청구 부가세 금회 과세
					jQuery("#trequSurtaxAmt").val(0);	//청구 부가세 금회 합계
				}else{
					jQuery("#requSurtaxAmt").val(doFloor(requSurtaxAmtValue,g_digit));	//청구 부가세 금회 과세	
					var trequSurtaxAmtValue = (requSupplyTamtValue * 10) / 100
					//jQuery("#trequSurtaxAmt").val(trequSurtaxAmtValue.toFixed(g_digit));	//청구 부가세 금회 합계 2016.6.8 수정. 부가세 오차 
					jQuery("#trequSurtaxAmt").val(doFloor(trequSurtaxAmtValue, g_digit));	
				}
				
				//금회
				jQuery("#requSurtaxAmt, #trequSurtaxAmt").each(function(index){
					jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
				});

			//}
			var requSurtaxAmtValue = Number(jQuery("#requSurtaxAmt").val().replace(/(\,|\:)/g,""));
			var trequSurtaxAmtValue = Number(jQuery("#trequSurtaxAmt").val().replace(/(\,|\:)/g,""));

			var requAmtValue = Number(requSupplyTamtValue) + Number(requSurtaxAmtValue);
			jQuery("#requAmt").val(requAmtValue.toFixed(g_digit));	//청구액 합계 금회 과세  
			jQuery("#trequSupplyNamt").val(requSupplyNamtValue.toFixed(g_digit));	//청구액 합계 금회 면세  
			var trequAmtValue = Number(requSupplyAmtValue) + Number(trequSurtaxAmtValue);
			jQuery("#trequAmt").val(trequAmtValue.toFixed(g_digit));	//청구액 합계 금회 합계
			
			var requAmtValue = Number(jQuery("#requAmt").val().replace(/(\,|\:)/g,""));
			var trequAmtValue = Number(jQuery("#trequAmt").val().replace(/(\,|\:)/g,""));
			
			//금회
			jQuery("#fundAmt, #fundNamt, #payDeductTamt, #payDeductNamt, #payDeductAmt, #requSupplyTamt, #requSupplyNamt, #requSupplyAmt, #requAmt, #trequSupplyNamt, #trequAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
				
			//누계기성 계산 처리			
			var preFundTamtValue = jQuery("#preFundTamt").val().replace(/(\,|\:)/g,"");	//기성 전회 과세
			var totFundTamtValue = Number(preFundTamtValue) + Number(fundTamtValue);
			jQuery("#totFundTamt").val(totFundTamtValue.toFixed(g_digit));	//기성 누계기성 과세

			//누계기성 과세 율
			if(fconSupplyTamtValue == 0){
				jQuery("#totPayDeductTRate").val("0.00");
				var totFundTRate = Number(totFundTamtValue) / Number(conSupplyTamtValue) * 100;
				jQuery("#totFundTRate").val(totFundTRate.toFixed(2));
			}else{
				var totFundTRate = Number(totFundTamtValue) / Number(conSupplyTamtValue) * 100;
				jQuery("#totFundTRate").val(totFundTRate.toFixed(2));
				jQuery("#totPayDeductTRate").val(totFundTRate.toFixed(2));
			}

			var preFundNamtValue = jQuery("#preFundNamt").val().replace(/(\,|\:)/g,"");	//기성 전회 면세
			var totFundNamtValue = Number(preFundNamtValue) + Number(fundNamtValue);
			jQuery("#totFundNamt").val(totFundNamtValue);	//기성 누계기성 면세

			var totFundNRate = Number(totFundNamtValue) / Number(conSupplyNamtValue) * 100;

			if(Number(slPrepaySupplyNamtValue) == 0){
				totFundNRate = 0;
				jQuery("#totPayDeductNRate").val("0.00");
			}else{
				jQuery("#totFundNRate").val(totFundNRate.toFixed(2));
				jQuery("#totPayDeductNRate").val(totFundNRate.toFixed(2));
			}
			
			var preFundAmtValue = jQuery("#preFundAmt").val().replace(/(\,|\:)/g,"");	//기성 전회 합계
			preFundAmtValue = Number(preFundAmtValue).toFixed(g_digit);
	
			var totFundAmtValue = Number(preFundAmtValue) + Number(fundAmtValue);
			totFundAmtValue = Number(totFundAmtValue).toFixed(g_digit);
			jQuery("#totFundAmt").val(totFundAmtValue);	//기성 누계기성 합계
			var totFundRateValue = (Number(totFundAmtValue) / Number(conSupplyAmtValue)) * 100;
			jQuery("#totFundRate").val(totFundRateValue.toFixed(2));	//누계 기성율 과세
			
			var prePayDeductTamtValue = jQuery("#prePayDeductTamt").val().replace(/(\,|\:)/g,"");	//선급공제 전회 과세
			var totPayDeductTamtValue = Number(prePayDeductTamtValue) + Number(payDeductTamtValue);
			jQuery("#totPayDeductTamt").val(totPayDeductTamtValue.toFixed(g_digit));	//선급공제 누계 과세
			
			var prePayDeductNamtValue = jQuery("#prePayDeductNamt").val().replace(/(\,|\:)/g,"");	//선급공제 전회 면세
			var totPayDeductNamtValue = Number(prePayDeductNamtValue) + Number(jQuery("#payDeductNamt").val().replace(/(\,|\:)/g,""));
			jQuery("#totPayDeductNamt").val(totPayDeductNamtValue.toFixed(g_digit));	//선급공제 누계 면세

			var prePayDeductAmtValue = jQuery("#prePayDeductAmt").val().replace(/(\,|\:)/g,"");	//선급공제 전회 합계
			var totPayDeductAmtValue = Number(prePayDeductAmtValue) + Number(payDeductAmtValue);
			jQuery("#totPayDeductAmt").val(totPayDeductAmtValue.toFixed(g_digit));	//선급공제 누계 합계
			
			if(totPayDeductAmtValue == "0"){
				var totPayDeductRateValue = "0.00";
				jQuery("#totPayDeductRate").val(totPayDeductRateValue);	//누계 기성율 과세
			}else{
				var totPayDeductRateValue = (Number(totPayDeductAmtValue) / Number(slPrepaySupplyAmtValue)) * 100;
				jQuery("#totPayDeductRate").val(totPayDeductRateValue.toFixed(2));	//누계 기성율 과세
			}

			var preRequSupplyTamtValue = jQuery("#preRequSupplyTamt").val().replace(/(\,|\:)/g,"");	//청구 공급액 전회 과세
			var totRequSupplyTamtValue = Number(preRequSupplyTamtValue) + Number(requSupplyTamtValue);
			jQuery("#totRequSupplyTamt").val(totRequSupplyTamtValue.toFixed(g_digit));	//청구 공급액 누계 과세
			
			var preRequSupplyNamtValue = jQuery("#preRequSupplyNamt").val().replace(/(\,|\:)/g,"");	//청구 공급액 전회 면세
			var totRequSupplyNamtValue = Number(preRequSupplyNamtValue) + Number(requSupplyNamtValue);
			jQuery("#totRequSupplyNamt").val(totRequSupplyNamtValue.toFixed(g_digit));	//청구 공급액 누계 면세

			var preRequSupplyAmtValue = jQuery("#preRequSupplyAmt").val().replace(/(\,|\:)/g,"");	//청구 공급액 전회 합계
			var totRequSupplyAmtValue = Number(preRequSupplyAmtValue) + Number(requSupplyAmtValue);
			jQuery("#totRequSupplyAmt").val(totRequSupplyAmtValue.toFixed(g_digit));	//청구 공급액 누계 합계
			
			var preRequSurtaxAmtValue = jQuery("#preRequSurtaxAmt").val().replace(/(\,|\:)/g,"");	//청구 부가세 전회 과세
			var totRequSurtaxAmtValue = Number(preRequSurtaxAmtValue) + Number(requSurtaxAmtValue);
			jQuery("#totRequSurtaxAmt").val(totRequSurtaxAmtValue.toFixed(g_digit));	//청구 부가세 누계 과세

			var tpreRequSurtaxAmtValue = jQuery("#tpreRequSurtaxAmt").val().replace(/(\,|\:)/g,"");	//청구 부가세 전회 합계
			var ttotRequSurtaxAmtValue = Number(tpreRequSurtaxAmtValue) + Number(requSurtaxAmtValue);
			jQuery("#ttotRequSurtaxAmt").val(ttotRequSurtaxAmtValue.toFixed(g_digit));	//청구 부가세 누계 합계

			var preRequAmtValue = jQuery("#preRequAmt").val().replace(/(\,|\:)/g,"");	//청구 합계 전회 과세
			var totRequAmtValue = Number(preRequAmtValue) + Number(requAmtValue);
			jQuery("#totRequAmt").val(totRequAmtValue.toFixed(g_digit));	//청구 합계 누계 과세

 			var tpreRequSupplyNamtValue = jQuery("#tpreRequSupplyNamt").val().replace(/(\,|\:)/g,"");	//청구 합계 전회 면세
			var ttotRequSupplyNamtValue = Number(tpreRequSupplyNamtValue) + Number(requSupplyNamtValue);
			jQuery("#ttotRequSupplyNamt").val(ttotRequSupplyNamtValue.toFixed(g_digit));	//청구 합계 누계 면세

 			var tpreRequAmtValue = jQuery("#tpreRequAmt").val().replace(/(\,|\:)/g,"");	//청구 합계 전회 합계
			var ttotRequAmtValue = Number(tpreRequAmtValue) + Number(trequAmtValue);
			jQuery("#ttotRequAmt").val(ttotRequAmtValue.toFixed(g_digit));	//청구 합계 누계 과세			

			//누계기성																								 
			jQuery("#totFundTamt, #totFundNamt, #totFundAmt, #totPayDeductTamt, #totPayDeductNamt, #totPayDeductAmt, #totRequSupplyTamt, #totRequSupplyNamt, #totRequSurtaxAmt, #ttotRequSurtaxAmt, #totRequAmt, #totRequSupplyAmt, #ttotRequSupplyNamt, #ttotRequAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});			

			//잔여 계산처리
			var resFundTamtValue = Number(conSupplyTamtValue) - Number(totFundTamtValue);
			jQuery("#resFundTamt").val(resFundTamtValue.toFixed(g_digit));	//기성 잔여 과세
			jQuery("#resFundTamt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
			if(fconSupplyTamtValue == 0){
				var resFundTRate = Number(resFundTamtValue) / Number(conSupplyTamtValue) * 100;
				jQuery("#resFundTRate").val(resFundTRate.toFixed(2));
				jQuery("#resPayDeductTRate").val("0.00");
			}else{
				var resFundTRate = Number(resFundTamtValue) / Number(conSupplyTamtValue) * 100;
				jQuery("#resFundTRate").val(resFundTRate.toFixed(2));
				jQuery("#resPayDeductTRate").val(resFundTRate.toFixed(2));
				
			}
				
			var resFundNamtValue = Number(conSupplyNamtValue) - Number(totFundNamtValue);
			jQuery("#resFundNamt").val(resFundNamtValue);	//기성 잔여 면세

			var resFundNRate = Number(resFundNamtValue) / Number(conSupplyNamtValue) * 100;
			
			if(Number(slPrepaySupplyNamtValue) == 0){
				resFundNRate = 0;
				jQuery("#resFundNRate").val("0.00");
			}else{
				jQuery("#resFundNRate").val(resFundNRate.toFixed(2));
				jQuery("#resPayDeductNRate").val(resFundNRate.toFixed(2));
			}
			
			jQuery("#resFundNamt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			var resFundAmtValue = Number(conSupplyAmtValue) - Number(totFundAmtValue);
			jQuery("#resFundAmt").val(resFundAmtValue.toFixed(g_digit));	//기성 잔여 합계
			jQuery("#resFundAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});
			
			var resFundRateValue = (Number(resFundAmtValue) / Number(conSupplyAmtValue)) * 100;
			jQuery("#resFundRate").val(resFundRateValue.toFixed(2));	//누계 기성율 과세
			
			var resPayDeductTamtValue = Number(slPrepaySupplyTmatValue).toFixed(g_digit) - Number(totPayDeductTamtValue).toFixed(g_digit);
			jQuery("#resPayDeductTamt").val(Number(resPayDeductTamtValue).toFixed(g_digit));	//선급공제 잔여 과세
			var resPayDeductNamtValue = Number(slPrepaySupplyNamtValue) - Number(totPayDeductNamtValue);
			jQuery("#resPayDeductNamt").val(Number(resPayDeductNamtValue).toFixed(g_digit));	//선급공제 잔여 면세
			var resPayDeductAmtValue = Number(slPrepaySupplyAmtValue) - Number(totPayDeductAmtValue);
			jQuery("#resPayDeductAmt").val(Number(resPayDeductAmtValue).toFixed(g_digit));	//선급공제 잔여 합계
		
			if(resPayDeductAmtValue == "0"){
				var resPayDeductRateValue = "0.00";
				//jQuery("#resPayDeductRate").val(resPayDeductRateValue.toFixed(2));	//선급공제 잔여 기성율			
				jQuery("#resPayDeductRate").val(resPayDeductRateValue);	//선급공제 잔여 기성율			
			}else{
				var resPayDeductRateValue = (Number(resPayDeductAmtValue) / Number(slPrepaySupplyAmtValue)) * 100;
				jQuery("#resPayDeductRate").val(Number(resPayDeductRateValue).toFixed(2));	//선급공제 잔여 기성율
			}
			
			//잔여																								 
			jQuery("#resPayDeductTamt, #resPayDeductNamt, #resPayDeductAmt").each(function(index){
				jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
			});				
			
			//하자이행율이 100%이상이면 보증정보 표시
			setGuarOutList();
					
		});		
		pageinit();
		
	}
	
	function fPayDeduct(argGb)
	{
	    alert("call");	
		
	}
	
	//2018.10.25
	function RtnClose(returnValue, returnn){
		setTimeout(function(){fLayerPopClose('ItemPop');},100);	
        jQuery("#fundTamt").val(returnValue);
		jQuery("#fundNamt").val(returnn); 
		jQuery("#fundTamt").blur(); 
		jQuery("#fundNamt").blur();  //2019.05.24 추가. 면세만 있는경우 합계 계산이 안됨. 
		
        var f = document.form1;
		jQuery("#fevent").val("SAVE_DATA");
		 
		submitXmlRequest("/portal/payment/ResolutionRequest_form.screen", "SAVE_DATA", f, "SUCCESS"); 
	}
	
	//페이지 초기처리
	function pageinit(){
		
		//상태값에 따른 입력항목 리드온리 처리 03:기성신청
		if(jQuery("#statusCd").val() == "03" || jQuery("#statusCd").val() == "10"){
			inputDataSet();	
		}
		
		//발행방법에 따른 페이지 셋팅
		//taxDataSet();
		
		//버튼표시 셋팅
		btnCtr();
		
		//작성일자(증빙일자)
		seTaxDate();
		
		//면세금액에 따른 금회면세 사용자 입력 가능유무
		if(jQuery("#conSupplyNamt").val() == "0"){
			
			//jQuery("#fundNamt").attr('disabled','disabled');
			//jQuery("#fundNamt").attr("style", "background-color: #dedede");
			//jQuery("#fundNamt").attr("style", "border:0px solid #6a6a6a");
			//jQuery("#fundNamt").attr("style", "width:100%");
			
/*  			jQuery("#fundNamt").attr("style", "background-color: #dedede");
			jQuery("#fundNamt").attr("style", "border:0px solid #6a6a6a");
			jQuery("#fundNamt").attr("readonly",true); */
			
		}
		
		//하자이행보증정보 view유무
		setGuarOutList();
		
	}

	function setGuarOutList(){
		
		var defEstGuarRateValue = Number(jQuery("#defEstGuarRate").val());	//하자보수보증금율 
		var preFundRateValue = Number(jQuery("#preFundRate").val());		//전회 누계기성율
		//var preFundRateValue = 90;		//전회 누계기성율
		var checkRate1 = defEstGuarRateValue + preFundRateValue;
		var totFundRateValue = Number(jQuery("#totFundRate").val());		//누계기성율
		var checkRate2 = defEstGuarRateValue + totFundRateValue;
		var resFundAmtValue = Number(jQuery("#resFundAmt").val());			//잔여기성합계
		
		/* if(Number(checkRate1) > 100){
			jQuery('#warr1').show();
			jQuery('#warr2').show();
		}else if(Number(checkRate2) > 100){
			jQuery('#warr1').show();
			jQuery('#warr2').show();
		} */
		if(defEstGuarRateValue > 0 && resFundAmtValue <= 0){
			jQuery('#warr1').show();
			jQuery('#warr2').show();
		}
		else{
			jQuery('#warr1').hide();
			jQuery('#warr2').hide();
		}
		
	}
	
	//저장 후  기성신청 처리
	function btnAppReqProcess(){
		
		if(fMakeItemInfo()){
			//alert("저장처리");
			var f = document.form1;
			jQuery("#fevent").val("REQ_DATA");
			submitXmlRequest("/portal/payment/ResolutionRequest_form.screen", "REQ_DATA", f, "SUCCESS");			
		}

	}
	
	function seTaxDate(){
	    
		var date = new Date();
		var day   = date.getDate();
		var month = date.getMonth()+1;
		var year = date.getFullYear();
		//작년 구하기
		date.setFullYear(date.getFullYear() -1 );
		var last_year = date.getFullYear();

		var newDay = new Date( get_year(), get_month(), "");
	    var lastDay = newDay.getDate();
	    var yyyymmdd = get_year() +'-'+ get_month() +"-"+ lastDay;

	    //test
	    /* year = 2023;
	    last_year = 2022;
	    month = 12;
	    day = 7; */
		
	    if(month == 1){	//1월
	    	if(day < 7){
	    		year = last_year;
				month = 12;
	    	}
		}else{	//2~12월
			if(day < 7){
				month = month-1;
	    	}
		}
	    newDay = new Date( year, month, 0);
	    lastDay = newDay.getDate();

		if(month < 10){
			month = "0" + month;
		}
	    yyyymmdd = year+'-'+month+'-'+lastDay;	
	    
	    if(jQuery('#date1').val() == ""){
	    	jQuery('#date1').val(yyyymmdd);	
	    }
    		
	}
	
	function btnCtr(){
		
		//alert(jQuery("#statusCd").val());
		if(jQuery("#statusCd").val() == "01"){		//작성상태(01): 목록, 삭제, 저장, 기성신청 표시 
			jQuery("#btnList").show();
			jQuery("#btnDelete").show();
			jQuery("#btnSave").show();
			jQuery("#btnAppReq").show();
		}
		
		if(jQuery("#statusCd").val() == "02"){		//기성신청요청(02) : 목록, 저장, 기성신청 표시
			jQuery("#btnList").show();
			jQuery("#btnDelete").hide();
			jQuery("#btnSave").show();
			jQuery("#btnAppReq").show();
		}

		if(jQuery("#statusCd").val() == "03"){		//기성신청(03) : 목록 표시
			jQuery("#btnList").show();
			jQuery("#btnDelete").hide();
			jQuery("#btnSave").hide();
			jQuery("#btnAppReq").hide();
		}

		if(jQuery("#statusCd").val() == "04"){		//기성신청(04) : 목록 표시
			jQuery("#btnList").show();
			jQuery("#btnDelete").hide();
			jQuery("#btnSave").hide();
			jQuery("#btnAppReq").hide();
		}

		if(jQuery("#statusCd").val() == "10"){		//기성완료(10) : 목록 표시
			jQuery("#btnList").show();
			jQuery("#btnDelete").hide();
			jQuery("#btnSave").hide();
			jQuery("#btnAppReq").hide();
		}

		if(jQuery("#statusCd").val() == "91"){		//반려(91) : 목록, 저장, 기성신청 표시
			jQuery("#btnList").show();
			jQuery("#btnDelete").show();
			jQuery("#btnSave").show();
			jQuery("#btnAppReq").show();
		}
		
	}
	
	function taxDataSet(){
		
		var radioCheck	= jQuery(':radio[name="chk_info"]:checked').val();
		//alert(radioCheck);
		if(radioCheck == "1"){
			jQuery("#taxAttachments").hide();
		}else{
			jQuery("#taxAttachments").show();
		}
	}
	
	//상태가 03:기성신청 일때 입력항목 리드온리
	function inputDataSet(){
		
		jQuery("#taxChargNm").attr("readonly",true);
		jQuery("#taxChargNm").css({'background-color' : '#f0f0f0'});
		jQuery("#taxChargNm").css({'border' : '0px solid #f0f0f0'});

		jQuery("#taxChargHp").attr("readonly",true);
		jQuery("#taxChargHp").css({'background-color' : '#f0f0f0'});
		jQuery("#taxChargHp").css({'border' : '0px solid #f0f0f0'});

		jQuery("#taxChargEmail").attr("readonly",true);
		jQuery("#taxChargEmail").css({'background-color' : '#f0f0f0'});
		jQuery("#taxChargEmail").css({'border' : '0px solid #f0f0f0'});

		jQuery("#fundTamt").attr("readonly",true);
		jQuery("#fundTamt").css({'background-color' : '#f0f0f0'});
		jQuery("#fundTamt").css({'border' : '0px solid #f0f0f0'});
		
		//jQuery("#fundNamt").attr("readonly",true);
		//jQuery("#fundNamt").css({'background-color' : '#f0f0f0'});
		//jQuery("#fundNamt").css({'border' : '0px solid #f0f0f0'});

		jQuery("#requSurtaxAmt").attr("readonly",true);
		jQuery("#requSurtaxAmt").css({'background-color' : '#f0f0f0'});
		jQuery("#requSurtaxAmt").css({'border' : '0px solid #f0f0f0'});

		//jQuery("#fundTamt").attr("disabled",true);
		//jQuery("#fundNamt").attr("disabled",true);
		
	}
	

	
	//저장 및 선급금 신청시 필수항목 Check
	function requiredItemsCheck(){
		
		var date1 			= jQuery('#date1').val();			//작성일자(증빙일자)
		var taxChargNm 		= jQuery('#taxChargNm').val();		//담당자명
		var taxChargHp		= jQuery('#taxChargHp').val();		//담당자 핸드폰번호
		var taxChargEmail	= jQuery('#taxChargEmail').val();	//담당자 이메일
		var resFundRate		= jQuery('#resFundRate').val();		//잔여기성 기성율 
		var fundRate		= jQuery('#fundRate').val();		//금회_기성 기성율
		
		var resDeductTrate 		= jQuery('#resPayDeductTRate').val();
		var resPayDeductNrate 	= jQuery('#resPayDeductNRate').val();
		var resPayDeductRate 	= jQuery('#resPayDeductRate').val();
		var resPayDeductTamt 	= jQuery('#resPayDeductTamt').val();
		var resPayDeductNamt 	= jQuery('#resPayDeductNamt').val();
		var resPayDeductAmt 	= jQuery('#resPayDeductAmt').val();
		
		if(date1 == "" ){
			alert("입력필수입니다.");
			jQuery('#date1').focus();
			return false;
		}
		if(taxChargNm == ""){
			alert("담당자명은 입력필수입니다.");
			jQuery('#taxChargNm').focus();
			return false;
		}
		
		if(taxChargHp == ""){
			alert("담당자 핸드폰 번호는 입력필수입니다.");
			jQuery('#taxChargHp').focus();
			return false;
		}else{
			var rgEx = /(01[016789])[-](\d{4}|\d{3})[-]\d{4}$/g;  
			var strValue = taxChargHp;
			var chkFlg = rgEx.test(strValue);   
			if(!chkFlg){
				alert("올바른 휴대폰번호가 아닙니다.");
				jQuery('#taxChargHp').focus();
				return false;
			}
		}
		
		if(taxChargEmail == ""){
			alert("담당자 이메일은 입력필수입니다.");
			jQuery('#taxChargEmail').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(taxChargEmail)) {
                alert('올바른 이메일 주소가 아닙니다.');
                jQuery('#taxChargEmail').focus();
                return false;
            }
		}
		
		//잔여기성율 마이너스 check
		if(Number(resFundRate) < 0){
			alert("잔여기성이 0보다 작을수 없습니다.");
			jQuery('#fundTamt').focus();
			return false;
		}
		
		//잔여기성율 마이너스 check
		if(Number(resDeductTrate) < 0){
			alert("선급금 잔여 과세율이 0보다 작을수 없습니다.");
			jQuery('#fundTamt').focus();
			return false;
		}
		//잔여기성율 마이너스 check
		if(Number(resPayDeductNrate) < 0){
			alert("선급금 잔여 면세율이 0보다 작을수 없습니다.");
			jQuery('#fundTamt').focus();
			return false;
		}
		
		//잔여기성율 마이너스 check
		if(Number(resPayDeductRate) < 0){
			alert("선급금 잔여율이 0보다 작을수 없습니다.");
			jQuery('#fundTamt').focus();
			return false;
		}
		//잔여기성율 마이너스 check
		if(Number(resPayDeductTamt) < 0){
			alert("선급금 잔여 과세금액이 0보다 작을수 없습니다.");
			jQuery('#fundTamt').focus();
			return false;
		}
		//잔여기성율 마이너스 check
		if(Number(resPayDeductNamt) < 0){
			alert("선급금 잔여 면세금액이 0보다 작을수 없습니다.");
			jQuery('#fundTamt').focus();
			return false;
		}
		//잔여기성율 마이너스 check
		if(Number(resPayDeductAmt) < 0){
			alert("선급금 잔여 금액이 0보다 작을수 없습니다.");
			jQuery('#fundTamt').focus();
			return false;
		}
		
		//금회기성율이 0% check 2019.05.13
		/*if(Number(fundRate) == 0){
			alert("금회 기성금액을 입력하세요.");
			jQuery('#fundTamt').focus();
			return false;
		}*/
		
		if(jQuery("#acmpYyyymm").val() != date1.substring(0,7)){
			alert("기성년월과 작성년월이 다릅니다.");
			jQuery('#date1').focus();
			return false;
		}
 
 		if(jQuery("#btnAppReqSelect").val() == "1"){	//선급금신청요청시에는 해당하는 첨부파일이 모두 등록되어있어야함.
		
 			var defEstGuarRateValue = Number(jQuery("#defEstGuarRate").val());	//하자보수보증금율 
 			var preFundRateValue = Number(jQuery("#preFundRate").val());		//전회 누계기성율
 			//var preFundRateValue = 90;		//전회 누계기성율
 			var checkRate1 = defEstGuarRateValue + preFundRateValue;
 			var totFundRateValue = Number(jQuery("#totFundRate").val());		//누계기성율
 			var checkRate2 = defEstGuarRateValue + totFundRateValue;
 			var resFundAmtValue = Number(jQuery("#resFundAmt").val());			//잔여기성합계

 			/* if(checkRate1 > 100 || checkRate2 > 100){
				//하자이행보증 정보가 존재하는지Check
				if(jQuery("#warrWgno").val() == ""){
					alert("하자이행보증 정보가 없습니다.");
 					return false;
				}
 			} */
 			if(resFundAmtValue <= 0){
 				//하자이행보증 정보가 존재하는지Check
				if(jQuery("#warrWgno").val() == ""){
					alert("하자이행보증 정보가 없습니다.");
 					return false;
				}
 			}
		}
	}
	
	//이전 기성차수의 누계기성(기성, 선급금) 합계와 당월 기성차수의 전회(기성, 선급금) 금액비교 check
	function payCompareCheck(){
		var befTotFundAmtValue   = "<%=acmpData.get("BEF_TOT_FUND_AMT")%>";			//이전 기성차수 누계기성합계
		var befTotPayDeductValue = "<%=acmpData.get("BEF_TOT_PAY_DEDUCT_AMT")%>";	//이전 기성차수 누계선급금합계
		var preFundAmtValue      = "<%=acmpData.get("PRE_FUND_AMT")%>";				//현재 기성차수 전회기성합계
		var prePayDeductAmtValue = "<%=acmpData.get("PRE_PAY_DEDUCT_AMT")%>";		//현재 기성차수 전회선급금합계
		//alert("befTotFundAmtValue : "+befTotFundAmtValue+", preFundAmtValue : "+preFundAmtValue+", befTotPayDeductValue : "+befTotPayDeductValue+", prePayDeductAmtValue : "+prePayDeductAmtValue);
		if(befTotFundAmtValue == "" || befTotFundAmtValue == null) befTotFundAmtValue = "0";
		if(befTotPayDeductValue == "" || befTotPayDeductValue == null) befTotPayDeductValue = "0";
		
		if(befTotFundAmtValue != preFundAmtValue){
			alert("전회기성금이 맞지 않습니다.\n관리자에게 문의하십시오.");
			return false;	
		}
		
		if(befTotPayDeductValue != prePayDeductAmtValue){
			alert("전회선급금이 맞지 않습니다.\n관리자에게 문의하십시오.");
			return false;	
		}
	}
	
	function doResult(resultObj) {
		try {
			
			if( resultObj.getRequestEvent() == "SAVE_DATA" ) {
				if( resultObj.getSuccess() ) {			
					
					document.form1.isSubmit = false;
					
					if(jQuery("#btnAppReqSelect").val() == "0"){	
						
						alert("저장되었습니다.");		
						//jQuery("#btnList").click();
						jQuery("#btnSearch").click();
						
					}else{
						
						jQuery("#btnAppReqSelect").val("0");
						btnAppReqProcess();
						
					}
					
				}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();
					jQuery("#btnSearch").click();
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}
			
			if( resultObj.getRequestEvent() == "GET_DATA" ) {
				
				if( resultObj.getSuccess() ) {

					var subContModId = resultObj.getValueObject().get("SUB_CONT_MOD_ID");
					if(subContModId != ""){
						jQuery("#subContModId").val(subContModId);
						
						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() == "GET_ATTACHFILE" ) {
				if( resultObj.getSuccess() ) {				
					document.form1.p_AttachFile.value = resultObj.getValueObject().get("AttachFile");
				}else {
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}
			
		}
		catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}


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

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

	//첨부파일   
	function doAttachFile(obj,No) {
		if(obj.value == ''){
			alert("데이터를 저장 후, 파일을 첨부할 수가 있습니다.");
		}
		else if(obj.value != ''){ 
			if(No == 1){
				viewFileListNew1('RESOLUTION_'+obj.value, No, document.getElementById("fileMapIDDiv"), "Y", "payment/purchase/"+obj.value);
			}else{
				var upLoadFlg = "Y";
				if(jQuery("#statusCd").val() == "03" || jQuery("#statusCd").val() == "10"){	//상태값이 기성신청(03), 기성완료(10) 일때는 첨부파일 다운로드만 가능
					upLoadFlg = "Y";//2019.03.28 첨부파일 항상오픈.상태값 조정필요.  
				}
				viewFileListNew1('RESOLUTION_'+obj.value, No, document.getElementById("fileMapIDDiv"), upLoadFlg, "payment/purchase/"+obj.value);
			}
		} 
	}

	function viewFileListNew1(fileGB, id, obj, isModify, isDrectory, iframeID, user_filename) {
		
		var win_id = "_viewFileList";
		var link = "/common/file/FileListNew.screen";
		    link += "?pop_win_id="+win_id;
		    link += "&extFunction=viewFileListClose1";
		    link += "&file_gb=" + fileGB;
		    link += "&id=" + id;
		    
		    if( obj.id != null )
			    link += "&obj_id=" + obj.id;
		    if( iframeID != null )
		    	link += "&iframeID=" + iframeID;
		    
			if( isModify != null )
				link += "&is_modify=" + isModify;
			if( isDrectory != null )
				link += "&sys_gb=" + isDrectory;	    
			if( user_filename != null )
				link += "&user_filename=" + user_filename;	 
		
		fLayerPop(win_id, link, 750,430, '', '', 'NO', '200');
	}
	
	//첨부목록 조회
	function getFileListForTextarea(){
		 
		document.form1.p_AttachFile.value = "";
		var f = document.form1;  
		jQuery("#fevent").val("GET_ATTACHFILE");
		submitXmlRequest("/portal/payment/ResolutionRequest_form.screen", "GET_ATTACHFILE", f, "VALUEOBJECT");	
	}
	
	//보증정보 조회
	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;
	 	
		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 open_apppend_file_popup_new(form, fileConnGB, fileConnID, isReadOnly, check_file_cd) {
 
		
 		if (!form) {
			dlgAlert('form 인자를 지정하여 주세요.');
			return false;
		}
		if (!fileConnGB) {
			dlgAlert('fileConnGB 인자를 지정하여 주세요.');
			return false;
		}
		if (!fileConnID) {
			dlgAlert('fileConnID 인자를 지정하여 주세요.');
			return false;
		}

		var url = '/common/file/Append_file_popup_new.screen?fileConnGB=' + fileConnGB + '&fileConnID=' + fileConnID + '&check_file_cd='+ check_file_cd;
		
		if (isReadOnly) {
	 		url += '&readOnly=true';
		} else {
			if (!form.fileMapID) {
				dlgAlert('fileMapID 필드가 존재하지 않습니다.');
				return false;
			}
		}

	}	
	
	
	function fMakeItemInfo(){
		//SGC이앤씨 담당자 기성생성, erp전달->결재진행.
		return true;	
	}
	//보증정보팝업 호출
	function popContWarr(wG, wSeq, wCauseCd) {
		
		var win_id = "contOutWarrPopup";			

		var param = "";
		var param = "?subContModId=" + jQuery("#selectSubContModId").val();
		var param = param + "&warrGubun=" + wG;
		var param = param + "&warrSeq=" + wSeq;
		var param = param + "&causeCode=" + wCauseCd;
		var param = param + "&viewDiv=ACMP";
//		var param = param + "&prepayId=" + jQuery("#prepayId").val();
		var param = param + "&pop_win_id=" + win_id;
		
		var url = "/portal/guar/contOutWarrPopup.screen"+param;
		
		fLayerPop(win_id, url, 560,350, '','', 'NO');
	}	
	//보증정보팝업 종료후 액션
	function popContWarrClose(returnValue){
		if(returnValue == null){
			fLayerPopClose('contOutWarrPopup');
		}else{
			fLayerPopClose('contOutWarrPopup');
			//location.reload();
			jQuery("#btnSearch").click();
		}
	}
	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";}
			viewFileListNew(fileGB, obj.value, fObj.p_AttachFileGuar1, editFile, fileDir, "contOutWarrPopup");
		} 
	} 
</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="selectSubContId" id="selectSubContId" value="<%=params.get("selectSubContId") %>">
	<INPUT type="hidden" name="selectSubContModId" id="selectSubContModId" value="<%=params.get("selectSubContModId") %>">
	<INPUT type="hidden" name="acmpId" id="acmpId" value="<%=params.get("acmpId") %>">
	<INPUT type="hidden" name="subContModId" id="subContModId" value="<%=acmpData.get("SUB_CONT_MOD_ID") %>">
	<INPUT type="hidden" name="modNo" id="modNo" value="<%=acmpData.get("MOD_NO") %>">	<!-- 변경계약MAX차수 -->
	<INPUT type="hidden" name="statusCd" id="statusCd" value="<%=acmpData.get("STATUS_CD") %>">	<!-- 기성 상태값 -->
	
	<INPUT type="hidden" name="btnAppReqSelect" id="btnAppReqSelect" value="0">	<!-- 기성신청상태구분 -->
	<INPUT type="hidden" name="inputVatDiv" id="inputVatDiv" value="<%=acmpData.get("INPUTVATDIV") %>">	
	
	<INPUT type="hidden" id="F_CON_SUPPLY_AMT" name="F_CON_SUPPLY_AMT" 	value='<%= Formatter2.currency(acmpData.get("F_CON_SUPPLY_AMT"), intDigit) %>'>	<!-- 선급금대상계약금액 -->	
	<INPUT type="hidden" id="F_TAX_DY" name="F_TAX_DY" 	value='<%= acmpData.get("F_TAX_DY") %>'>	
	
	<!--  임시 FILE MAP ID 값 -->
	<INPUT type="hidden" name="fileMapID" id="fileMapID" value="" onPropertyChange="JavaScript:getFileListForTextarea();">
	
	<INPUT type='hidden' id="signeddata" name="signeddata" value="">
	<INPUT type='hidden' id="CONT_SIGNDN" name="CONT_SIGNDN" value="">
	
	
	<!-- 검색 조건 계약명 -->
	<INPUT type='hidden' id="searchBuildName" name="searchBuildName" value="<%=params.get("searchBuildName") %>">
	<INPUT type='hidden' id="searchDeptName" name="searchDeptName" value="<%=params.get("deptName") %>">
	<INPUT type='hidden' id="searchStatusCd" name="searchStatusCd" value="<%=params.get("detailcd") %>">
	
	<INPUT type='hidden' id="resUserName" name="resUserName" value="<%=acmpData.get("RES_USER_NAME") %>">	<!-- 계약담당자 -->
	<INPUT type='hidden' id="resHp" name="resHp" value="<%=acmpData.get("RES_HP") %>">	<!-- 계약담당자 핸드폰번호 -->
	<INPUT type='hidden' id="resEmail" name="resEmail" value="<%=acmpData.get("RES_EMAIL") %>">	<!-- 계약담당자 이메일 -->
	<INPUT type='hidden' id="conDocNo" name="conDocNo" value="<%=acmpData.get("CON_DOC_NO") %>">	<!-- 발주계약번호 -->
	
	<INPUT type='hidden' id="defEstGuarRate" name="defEstGuarRate" value="<%=acmpData.get("DEF_EST_GUAR_RATE") %>">	<!-- 하자보수보증금율 -->
	
	<!-- 제목 및 버튼 -->
	<table width="100%">
		<colgroup>
			<col width="500" />
			<col width="*" />
		</colgroup>
		<tr>
	   		<th>		
				<div align="left" id="title">
					<ul>
						<li>외주_기성현황 상세(<span style="font-size: 11px"><%=acmpData.get("STATUS_NM")%></span>)</li>
					</ul>
				</div> 
			</th>	
				<td align="right">
					<span class="btnSearch center"><a href="javascript:void(0);" id="btnSave">저장</a></span>
					<span class="btnSearch center"><a href="javascript:void(0);" id="btnDelete">삭제</a></span>
					<span class="btnSearch center"><a href="javascript:void(0);" id="btnAppReq">확정(ERP전송)</a></span>
					<span class="btnSearch center"><a href="javascript:void(0);" id="btnList">목록</a></span>
					<span class="btnSearch center"><a href="javascript:void(0);" id="btnSearch" style="display: none;">조회</a></span>
			   </td>
	   	</tr>
   	</table>	
   	<%
   	if(!acmpData.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> 
			<th style="text-align: left;">반려일</th>
			<TD><%=acmpData.get("RTN_DATE")%></TD>
		</TR>
		<TR> 
			<th style="text-align: left;">반려사유</th>
			<TD><%=acmpData.get("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> 
			<th style="text-align: left;">현장명</th>
			<TD><%= InputText.get("deptName", acmpData.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", acmpData.get("BUILD_NAME"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">통화</th>
			<TD><%= InputText.get("conCurNm", acmpData.get("CON_CUR_NM"), 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("corpRegNo", acmpData.get("CORP_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("corpKor", acmpData.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", acmpData.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", acmpData.get("START_WORK_DATE") +"~"+ acmpData.get("END_WORK_DATE"), 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">계약금액</th>
			<TD><%= InputText.get("conConAmt", Formatter2.currency(acmpData.get("CON_SUPPLY_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("conPrepayAmt", Formatter2.currency(acmpData.get("PREPAY_SUPPLY_AMT"),intDigit)+" (부가세 별도)", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
		</TR>
	</TABLE>
	
	<div class="application-info magT15">
		<div class="application-sub-title">
			<span class="title">세금계산서 정보</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 %> disabled='disabled' style="display: none;"/>
				<input type="radio" id="chk_2" name="chk_info" value="2" onclick="taxDataSet();" <%= check2 %> disabled='disabled' style="display: none;"/>
				<%= checkString %>
			</TD>
			<th class="required" style="text-align: left;">작성일자(증빙일자)</th>
			<TD><%= InputText.get("date1", Formatter.formatDate(acmpData.get("TAX_DY"), "-"), 30, 10, "Center, date, PerSize, readonly", "date", "") %>
				<A href="JavaScript:calendar('date1');"><IMG src="/img/buyer/btn/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A>
			</TD>
		</TR>
		<TR> 
			<th class="required" style="text-align: left;">담당자명</th>
			<TD><%= InputText.get("taxChargNm", acmpData.get("TAX_CHARG_NM"), 100, 10, "string, left, PerSize", "string") %></TD>
			<th class="required" style="text-align: left;">담당자 핸드폰번호</th>
			<TD><%-- <%= InputText.get("taxChargHp", acmpData.get("TAX_CHARG_HP"), 5, 13, "string, left", "string") %> --%>
				<input type="text" id="taxChargHp" name="taxChargHp" value="<%=acmpData.get("TAX_CHARG_HP") %>" style="width: 44%" size="13" maxlength="13" alt="left">&nbsp;ex)010-0000-0000</TD>			
			<th class="required" style="text-align: left;">담당자 이메일</th>
			<TD><%= InputText.get("taxChargEmail", acmpData.get("TAX_CHARG_EMAIL"), 100, 45, "string, left, PerSize", "string") %></TD>
		</TR>
	</TABLE>
	
	<div class="application-info magT15">
		<div class="application-sub-title">
			<span class="title">기성 정보</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><%= InputText.get("acmpYyyymm", params.get("acmpYyyymm"), 100, 30, "class=input_blank, readOnly=white, string, center, PerSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">기성차수</th>
			<TD><%= InputText.get("acmpNo", acmpData.get("ACMP_NO"), 100, 30, "class=input_blank, readOnly=white, string, left, PerSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">신청(서명)일시</th>
			<TD><%= InputText.get("custSignDate", acmpData.get("SUPP_SIGN_DT") , 100, 30, "class=input_blank, readOnly=white, string, left, PerSize, tabIndex=-1", "string") %></TD>
		</TR>
		<TR> 
			<th style="text-align: left;">하도급직불여부</th>
			<TD>
			    &nbsp;<input type="radio" name="SUPP_DIRECT_YN" value="Y"' <%=acmpData.get("SUPP_DIRECT_YN").equals("Y") ? "checked=\"checked\"" : ""%>>예
				&nbsp;<input type="radio" name="SUPP_DIRECT_YN" value="N"' <%=acmpData.get("SUPP_DIRECT_YN").equals("N") ? "checked=\"checked\"" : ""%>>아니오
			</TD>
			<th style="text-align: left;">노무비닷컴여부</th>
			<TD colspan="3">
			    &nbsp;<input type="radio" name="LABOR_USE_YN" value="Y"' onclick="return(false)" <%=acmpData.get("LABOR_USE_YN").equals("Y") ? "checked=\"checked\"" : ""%>>예
				&nbsp;<input type="radio" name="LABOR_USE_YN" value="N"' onclick="return(false)" <%=acmpData.get("LABOR_USE_YN").equals("N") ? "checked=\"checked\"" : ""%>>아니오
			</TD>
		</TR>
	</TABLE>
	
	<img src="/img/com/blank.gif" height="10px" />
	
	<TABLE class="form-table" style="table-layout: fixed;">
		<colgroup>
			<col width="2%" />
			<col width="5%" />
			<col width="6%" />
			<col width="6%" />
			<col width="6%" />
			<col width="5%" />
			<col width="6%" />
			<col width="6%" />
			<col width="6%" />
			<col width="5%" />
			<col width="6%" />
			<col width="6%" />
			<col width="6%" />
			<col width="5%" />
			<col width="6%" />
			<col width="6%" />
			<col width="6%" />
			<col width="*" />
		</colgroup>
		<TR>
			<th rowspan="2" colspan="2">구분</th>
			<th rowspan="2" colspan="4">합계</th>
			<th colspan="8">공급가액</th>
			<th rowspan="2" colspan="4">부가세</th>
		</TR>
		<TR>
			<th colspan="4">과세</th>
			<th colspan="4">면세</th>
		</TR>
		<TR> 
			<th colspan="2">계약금</th>
			<TD colspan="4"><%= InputText.get("conAmt", Formatter2.currency(acmpData.get("CON_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("conSupplyTamt", Formatter2.currency(acmpData.get("CON_SUPPLY_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("conSupplyNamt", Formatter2.currency(acmpData.get("CON_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("conSurtaxAmt", Formatter2.currency(acmpData.get("CON_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
		</TR>  				  				
		<TR> 
			<th colspan="2">선급금</th>
			<TD colspan="4"><%= InputText.get("perpayAmt", Formatter2.currency(acmpData.get("PREPAY_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("prepaySupplyTamt", Formatter2.currency(acmpData.get("PREPAY_SUPPLY_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("prepaySupplyNamt", Formatter2.currency(acmpData.get("PREPAY_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("prepaySurtaxAmt", Formatter2.currency(acmpData.get("PREPAY_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
		</TR>  				  				
		<TR> 
			<th colspan="2">선급금 지급</th>
			<TD colspan="4"><%= InputText.get("slPrepayAmt", Formatter2.currency(acmpData.get("SL_PREPAY_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("slPrepaySupplyTmat", Formatter2.currency(acmpData.get("SL_PREPAY_SUPPLY_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("slPrepaySupplyNamt", Formatter2.currency(acmpData.get("SL_PREPAY_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD colspan="4"><%= InputText.get("slPrepaySurtaxAmt", Formatter2.currency(acmpData.get("SL_PREPAY_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
		</TR> 
	</TABLE>
	
	<img src="/img/com/blank.gif" height="10px" />
  
	<table width="100%"><tr><td align="right"><span class="btnSearch center"><a href="javascript:void(0);" id="btnItem">기성입력</a></span></td></tr></table>
	
	<TABLE class="form-table" style="table-layout: fixed;">
		<colgroup>
			<col width="2%" />
			<col width="5%" />
			
			<col width="8%" />
			<col width="7%" />
			<col width="8%" />
			<col width="8%" />
			<col width="7%" />
			<col width="8%" />
			<col width="8%" />
			<col width="7%" />
			<col width="8%" />
			<col width="8%" />
			<col width="7%" />
			<col width="*" />
		</colgroup>
		<TR>
			<th rowspan="2" colspan="2">구분</th>
			<th colspan="3">전회까지</th>
			<th colspan="3" class="required">금회</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 colspan="1">율</th>
	<TD><%= InputText.get("preFundTate", Formatter2.currency(acmpData.get("PRE_FUND_TRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
	<TD><%= InputText.get("preFundNate", Formatter2.currency(acmpData.get("PRE_FUND_NRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("preFundRate", Formatter2.currency(acmpData.get("PRE_FUND_RATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
	<TD><%= InputText.get("fundTRate", Formatter2.currency(acmpData.get("FUND_TRATE"), 2), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
	<TD><%= InputText.get("fundNRate", Formatter2.currency(acmpData.get("FUND_NRATE"), 2), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("fundRate", Formatter2.currency(acmpData.get("FUND_RATE"), 2), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
	<TD><%= InputText.get("totFundTRate", Formatter2.currency(acmpData.get("TOT_FUND_TRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
	<TD><%= InputText.get("totFundNRate", Formatter2.currency(acmpData.get("TOT_FUND_NRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totFundRate", Formatter2.currency(acmpData.get("TOT_FUND_RATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
	<TD><%= InputText.get("resFundTRate", Formatter2.currency(acmpData.get("RES_FUND_TRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
	<TD><%= InputText.get("resFundNRate", Formatter2.currency(acmpData.get("RES_FUND_NRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resFundRate", Formatter2.currency(acmpData.get("RES_FUND_RATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
		</TR>
		<TR>
			<th colspan="1">금액</th>
			<TD><%= InputText.get("preFundTamt", Formatter2.currency(acmpData.get("PRE_FUND_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("preFundNamt", Formatter2.currency(acmpData.get("PRE_FUND_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("preFundAmt", Formatter2.currency(acmpData.get("PRE_FUND_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("fundTamt", Formatter2.currency(acmpData.get("FUND_TAMT"),intDigit), 100, 16, "class=input byteChk ,float, right, perSize, tabIndex=-1, readOnly", "float") %></TD>
			<TD><%= InputText.get("fundNamt", Formatter2.currency(acmpData.get("FUND_NAMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("fundAmt", Formatter2.currency(acmpData.get("FUND_AMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("totFundTamt", Formatter2.currency(acmpData.get("TOT_FUND_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totFundNamt", Formatter2.currency(acmpData.get("TOT_FUND_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totFundAmt", Formatter2.currency(acmpData.get("TOT_FUND_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resFundTamt", Formatter2.currency(acmpData.get("RES_FUND_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resFundNamt", Formatter2.currency(acmpData.get("RES_FUND_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resFundAmt", Formatter2.currency(acmpData.get("RES_FUND_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
		</TR>		
		<TR>
			<th rowspan="2" >선급 공제</th><th colspan="1">율</th>
			<TD><%= InputText.get("prePayDeductTRate", Formatter2.currency(acmpData.get("PRE_PAY_DEDUCT_TRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("prePayDeductNRate", Formatter2.currency(acmpData.get("PRE_PAY_DEDUCT_NRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("prePayDeductRate", Formatter2.currency(acmpData.get("PRE_PAY_DEDUCT_RATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("payDeductTRate", Formatter2.currency(acmpData.get("PAY_DEDUCT_TRATE"), 2), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("payDeductNRate", Formatter2.currency(acmpData.get("PAY_DEDUCT_NRATE"), 2), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("payDeductRate", Formatter2.currency(acmpData.get("PAY_DEDUCT_RATE"), 2), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("totPayDeductTRate", Formatter2.currency(acmpData.get("TOT_PAY_DEDUCT_TRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totPayDeductNRate", Formatter2.currency(acmpData.get("TOT_PAY_DEDUCT_NRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totPayDeductRate", Formatter2.currency(acmpData.get("TOT_PAY_DEDUCT_RATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resPayDeductTRate", Formatter2.currency(acmpData.get("RES_PAY_DEDUCT_TRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resPayDeductNRate", Formatter2.currency(acmpData.get("RES_PAY_DEDUCT_NRATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resPayDeductRate", Formatter2.currency(acmpData.get("RES_PAY_DEDUCT_RATE"), 2), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
		</TR>  	
		<TR>
			<th colspan="1">금액</th>
			<TD><%= InputText.get("prePayDeductTamt", Formatter2.currency(acmpData.get("PRE_PAY_DEDUCT_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("prePayDeductNamt", Formatter2.currency(acmpData.get("PRE_PAY_DEDUCT_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("prePayDeductAmt", Formatter2.currency(acmpData.get("PRE_PAY_DEDUCT_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("payDeductTamt", Formatter2.currency(acmpData.get("PAY_DEDUCT_TAMT"),intDigit), 100, 16, "class=input byteChk,  float,  right, perSize", "float") %></TD>
			<%if (acmpData.get("CON_SUPPLY_TAMT").equals("0")   ) {%>
			<TD><%= InputText.get("payDeductNamt", Formatter2.currency(acmpData.get("PAY_DEDUCT_NAMT"),intDigit), 100, 16, "class=input byteChk, float, right, perSize", "float") %></TD>
			<%} else { %>
			<TD><%= InputText.get("payDeductNamt", Formatter2.currency(acmpData.get("PAY_DEDUCT_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, byteChk, float, right, perSize", "float") %></TD>
			<%} %>
			<TD><%= InputText.get("payDeductAmt", Formatter2.currency(acmpData.get("PAY_DEDUCT_AMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("totPayDeductTamt", Formatter2.currency(acmpData.get("TOT_PAY_DEDUCT_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totPayDeductNamt", Formatter2.currency(acmpData.get("TOT_PAY_DEDUCT_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totPayDeductAmt", Formatter2.currency(acmpData.get("TOT_PAY_DEDUCT_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resPayDeductTamt", Formatter2.currency(acmpData.get("RES_PAY_DEDUCT_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resPayDeductNamt", Formatter2.currency(acmpData.get("RES_PAY_DEDUCT_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("resPayDeductAmt", Formatter2.currency(acmpData.get("RES_PAY_DEDUCT_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
		</TR>  	
		<TR>
			<th rowspan="3" >청<br>구<br>액</th>
			<th>공급액</th>
			<TD><%= InputText.get("preRequSupplyTamt", Formatter2.currency(acmpData.get("PRE_REQU_SUPPLY_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("preRequSupplyNamt", Formatter2.currency(acmpData.get("PRE_REQU_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("preRequSupplyAmt", Formatter2.currency(acmpData.get("PRE_REQU_SUPPLY_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("requSupplyTamt", Formatter2.currency(acmpData.get("REQU_SUPPLY_TAMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("requSupplyNamt", Formatter2.currency(acmpData.get("REQU_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("requSupplyAmt", Formatter2.currency(acmpData.get("REQU_SUPPLY_AMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("totRequSupplyTamt", Formatter2.currency(acmpData.get("TOT_REQU_SUPPLY_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totRequSupplyNamt", Formatter2.currency(acmpData.get("TOT_REQU_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("totRequSupplyAmt", Formatter2.currency(acmpData.get("TOT_REQU_SUPPLY_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD class="bgEF"></TD>
			<TD class="bgEF"></TD>
			<TD class="bgEF"></TD>
		</TR>
		<TR>
			<th>부가세</th>
			<TD><%= InputText.get("preRequSurtaxAmt", Formatter2.currency(acmpData.get("PRE_REQU_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("preRequSurtaxNamt", Formatter2.currency(acmpData.get("PRE_REQU_SURTAX_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("tpreRequSurtaxAmt", Formatter2.currency(acmpData.get("PRE_REQU_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("requSurtaxAmt", Formatter2.currency(acmpData.get("REQU_SURTAX_AMT"),intDigit), 100, 16, "class=input byteChk ,float, right, perSize", "float") %></TD>
			<TD><%= InputText.get("trequSurtaxNamt", Formatter2.currency(acmpData.get("REQU_SURTAX_NAMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("trequSurtaxAmt", Formatter2.currency(acmpData.get("REQU_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("totRequSurtaxAmt", Formatter2.currency(acmpData.get("TOT_REQU_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("ttotRequSurtaxNamt", Formatter2.currency(acmpData.get("TOT_REQU_SURTAX_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("ttotRequSurtaxAmt", Formatter2.currency(acmpData.get("TOT_REQU_SURTAX_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD class="bgEF" ></TD>
			<TD class="bgEF" ></TD>
			<TD class="bgEF" ></TD>
		</TR>  				  							  				
		<TR>
			<th>합계</th>
			<TD><%= InputText.get("preRequAmt", Formatter2.currency(acmpData.get("PRE_REQU_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("tpreRequSupplyNamt", Formatter2.currency(acmpData.get("PRE_REQU_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("tpreRequAmt", Formatter2.currency(acmpData.get("PRE_REQU_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("requAmt", Formatter2.currency(acmpData.get("REQU_TAMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("trequSupplyNamt", Formatter2.currency(acmpData.get("REQU_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("trequAmt", Formatter2.currency(acmpData.get("REQU_AMT"),intDigit), 100, 16, "class=input_blank, string, right, perSize, tabIndex=-1, readOnly", "string") %></TD>
			<TD><%= InputText.get("totRequAmt", Formatter2.currency(acmpData.get("TOT_REQU_TAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("ttotRequSupplyNamt", Formatter2.currency(acmpData.get("TOT_REQU_SUPPLY_NAMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD><%= InputText.get("ttotRequAmt", Formatter2.currency(acmpData.get("TOT_REQU_AMT"),intDigit), 100, 16, "class=input_blank, readOnly=white, string, right, perSize, tabIndex=-1", "string") %></TD>
			<TD class="bgEF" ></TD>
			<TD class="bgEF" ></TD>
			<TD class="bgEF" ></TD>
		</TR>  				
	</TABLE>

	<img src="/img/com/blank.gif" height="10px" />
	
	<TABLE class="form-table">
		<colgroup>
			<col width="7%" />
			<col width="43%" />
			<col width="7%" />
			<col width="43%" />
		</colgroup>
		
		<TR>
			<th>기성검사<br>첨부서류</th>
			<TD>
				<TABLE class="inner_table" border="0" >
				<%
				if(acmpFileRow.size() > 0){
					int i_mod = 0;
					for(int i = 0; acmpFileRow.size() > i; i++){
						i_mod = i%3;
						if(i_mod == 0){ %>
							<TR>
					<%	} %>
								<td width="2%">
								<input type="checkbox" name="doc_cd" value="<%=acmpFileRow.getRow(i).get("DETAILCD") %>" style="cursor:pointer;" onClick="fileCheck(this,'<%=acmpFileRow.getRow(i).get("DETAILCD") %>')" <%if(!acmpFileRow.getRow(i).get("DOC_CD").equals("")){out.print("checked");} %>>
								</td>
								<td width="20%">
								<%-- <%=acmpFileRow.getRow(i).get("DETAILNM").replace(" ", "<BR>") %> --%>
								<%=acmpFileRow.getRow(i).get("DETAILNM") %>
								</td>
								<td width="7%" height="24">
								<IMG src="/img/supplier/button/bt_attach_file.gif" id="<%=acmpFileRow.getRow(i).get("DETAILCD") %>" alt="첨부파일 관리" align="top" style="display:<%if(!acmpFileRow.getRow(i).get("DOC_CD").equals("")){out.print("inline");}else{out.print("none");} %>" onClick="doAttachFile(document.form1.acmpId, '<%=acmpFileRow.getRow(i).get("DETAILCD") %>');" 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>
			<th>준공검사<br>첨부서류</th>
			<TD>
				<TABLE class="inner_table" border="0" >
					<%
					if(compFileRow.size() > 0){
						int i_mod = 0;
						for(int i = 0; compFileRow.size() > i; i++){
							
							i_mod = i%3;
							if(i_mod == 0){ %>
								<TR>
						<%	} %>
									<td width="2%">
									<input type="checkbox" name="doc_cd" value="<%=compFileRow.getRow(i).get("DETAILCD") %>" style="cursor:pointer;" onClick="fileCheck(this,'<%=compFileRow.getRow(i).get("DETAILCD") %>');" <%if(!compFileRow.getRow(i).get("DOC_CD").equals("")){out.print("checked");} %> />
									</td>
									<td width="20%">
									<%=compFileRow.getRow(i).get("DETAILNM") %>
									</td>
									<td width="7%"  height="24">
									<IMG src="/img/supplier/button/bt_attach_file.gif" id="<%=compFileRow.getRow(i).get("DETAILCD") %>" alt="첨부파일 관리" align="top" style="display:<%if(!compFileRow.getRow(i).get("DOC_CD").equals("")){out.print("inline");}else{out.print("none");} %>" onClick="doAttachFile(document.form1.acmpId, '<%=compFileRow.getRow(i).get("DETAILCD") %>');" 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>
		</TR>
	</TABLE>
	
	<img src="/img/com/blank.gif" height="10px" />
	
	<TABLE class="form-table">
		<colgroup>
			<col width="7%" />
			<col width="43%" />
			<col width="7%" />
			<col width="43%" />
		</colgroup>
		<TR height="90">
			<th>기성첨부</th>
			<TD>
				<TEXTAREA name="p_AttachFile" id="p_AttachFile" cols="70" rows="3" readOnly class="input ctrlTarget" style="height: 85px; overflow-y:auto"><%= AttachFile.get("AttachFile") %></TEXTAREA>					
			</TD>
			<th>특기사항</th>
			<TD>
				<TEXTAREA name="acmp_remark" id="acmp_remark" cols="70" rows="3" maxlength="1000" class="input byteChk ctrlTarget" style="height: 85px; overflow-y:auto"><%=acmpData.get("ACMP_REMARK") %></TEXTAREA>
			</TD>
		</TR>
	</TABLE>

<%
	/*
		보증 목록을  include 시킴 (2014-10-17) 김명호
	*/	
%>
<%@ include file="/jsp/ko_KR/supplier/portal/common/guar/guarOutList.jsp" %>


</FORM>
<div id="CONTROL_LAYER" style="position:absolute; z-index:10; visibility:hidden;">

<!-- <script src="/js/crosscert/deployJava.js"></script> -->

<script>

/* 
	var browser2 = deployJava.browserName2;
	if(browser2 == "MSIE"){

		//alert("IE");
		// IE이면 기존 Active-X 브라우저를 사용한다.

		document.write('<object id="CC_Object_id" classid="CLSID:A099920B-630C-426B-91EC-737685CEEE17" codebase="/js/crosscert/AxCrossCert.cab#Version=2,6,7,0" width=0  height=0>');
		document.write('</OBJECT>');

	}else{
		//alert("타브라우저");
		
			
		var browser = deployJava.browserName2;
		//alert("browser:" + browser);

		if(browser == "MSIE"){			
			
		}else{
			var status = true;
			status = deployJava.versionCheck('1.6.0_20+')
			//alert("status: "  + status);
			if (status == false) {
				var userInput = confirm("You need the latest Java(TM) Runtime Environment. Would you like to update now?");
				if (userInput == true) {
					// Set deployJava.returnPage to make sure user comes back to  
					// your web site after installing the JRE 
					deployJava.setInstallerType("online");
					// install latest JRE or redirect user to another page to get JRE from. 
					deployJava.installLatestJRE();
					status = true;
				} else {
					status = false;
				}
			}
			
			if (status == false) {
			} else {
				//사용자 운영체제 확인
				//운영체제에 맞는 library jar파일 설정을 위함
				var isWin = (window.navigator.platform =='Win32')||(window.navigator.platform=='Windows');
				var isMac = (window.navigator.platform =='Mac68K')||(window.navigator.platform == 'MacPPC') || (window.navigator.platform == 'MacIntel') || (window.navigator.platform.indexOf("Mac") > -1 ) ;
				var isUnix = !isWin && !isMac;

				var library_jar = "/cc_multi_2014_etech/win_library.jar";
				
				if (browser == "Safari"){
					//alert("Safari");
					var tag = "";
					tag += '<div id="CONTROL_LAYER" style="position:absolute; z-index:10; visibility:hidden;">';
					tag += '<APPLET name="CC_Object_id" code="com.crosscert.jws.app.CC_MultiBrowserApplet.class" archive="/js/crosscert/CC_MultiBrowser.jar" WIDTH="0" HEIGHT="0" MAYSCRIPT="true">';
					tag += '<PARAM name="type" value="application/x-java-applet;jpi-version=1.6.0_20">';
					tag += '<param name="ARCHIVE" value="/js/crosscert/CC_MultiBrowser.jar,'+ library_jar + '" >';
					tag += '<param name="codebase_lookup" value="false">';
					tag += '</APPLET></div>';

					document.write(tag);
				}else{
					var attributes = {id:'CC_Object_id', name:'CC_Object_id', code:'com.crosscert.jws.app.CC_MultiBrowserApplet.class', archive:'/js/crosscert/CC_MultiBrowser.jar,/js/crosscert/win_library.jar',  width:'0', height:'0'} ; 
					var parameters = {jnlp_href:'/js/crosscert/CC_MultiBrowser.jnlp', codebase_lookup: 'false'} ;
					var javaVersion = '1.6';
					deployJava.runApplet(attributes, parameters, javaVersion); 
				}
			}
		}
	}

	 */
	
</script>
</div>

<!-- <script language="javascript" src="/js/crosscert/init.js"></script> -->