<%--
  - FileName   : payRequest.jsp
  - Author(s)  : ok
  - Date       : 2014.06.17
  - 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="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 perpayReqDivComboList = storage.getRowSet("perpayReqDivComboList"); //신청구분 ComboList Data
	ValueObject prePayment = storage.getValueObject("prePayment");	//기본정보, 세금계산서정보, 선급금정보 
	ValueObject contOutWarr = storage.getValueObject("contOutWarr");	//보증정보
	
	ValueObject file_giveup = storage.getValueObject("PREPAYMENTS_GIVEUP");
	ValueObject file_taxbill = storage.getValueObject("TAX_BILL");

*/

	String check1 = "";
	String check2 = "";
	//if("2".equals(prePayment.get("TAX_METHOD_CD"))){
	if("2".equals("2")){
		check2 = "checked";
	}else{
		check1 = "checked";
	}

	String digit = "2"; //(String)prePayment.get("digit");
	int intDigit = Integer.parseInt(digit);
  
    //기타 첨부서류
	RowSet purchaseFileRow = storage.getRowSet("purchaseFileRow");
    
%>
<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("#btnList").click(function() {
		
			jQuery("#fevent").val("");
			jQuery("#form1").attr("action", "/payment/outside/AdvencePaymentList.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/outside/AdvencePayment_form.screen", "DELETE_DATA", f, "SUCCESS");
			}
		});		

		jQuery("#btnSave").click(function() {
		
			var f = document.form1;
			jQuery("#fevent").val("SAVE_DATA");
			//필수 입력항목 check
			if(requiredItemsCheck() == false){
				return;
			}
			//입력데이터 저장 
			if (confirm("저장 하시겠습니까?")) {
				submitXmlRequest("/payment/outside/AdvencePayment_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 (confirm(jQuery("#btnText").text()+" 하시겠습니까?")) {
				submitXmlRequest("/payment/outside/AdvencePayment_form.screen", "SAVE_DATA", f, "SUCCESS");
			}
			
		});		
		
		//반려
		jQuery("#btnRejection").click(function() {
			
			var param = "";
			var param = "?prepayId=" + jQuery("#prepayId").val();
			param = param + "&pageDiv=0";	//0:선급, 1:기성
			
 			var url = "/payment/outside/RejectionPopup.screen"+param;
			result = window.showModalDialog(url,'rejection','dialogWidth:600px;dialogHeight:250px;center:yes;help:no;status:no;scroll:no;resizable:no');
			if(result != null){
				if(result[0] == "1"){
					reDisplay();
					//goList();	
				}
			}
			
		});
		
		//결재
		jQuery("#btnApproval").click(function() {

			if (!dlgConfirm("기성결재를  진행하시겠습니까?")) {
				return;
			}
			
/* 			var acmp_id = f.acmp_id.value;
			
			var completion_count = 0; //준공계약수
			var acmp_count = 0; //기성계약수

			var sign_class_cd = 'exprogresspayment';
//			var uri =  '/subcontract/SUBAcmpSign.screen?acmp_id=' + acmp_id + '^dept_cd=' + f.q_dept_cd.value + '^dept_nm=' + encodeURIComponent(f.q_dept_nm.value) + '^acmp_yyyymm=' + f.q_acmp_yyyymm.value;
			var uri =  '/subcontract/SUBAcmpSign.screen?acmp_id=' + acmp_id + '^dept_cd=' + f.q_dept_cd.value + '^acmp_yyyymm=' + f.q_acmp_yyyymm.value;
			
			
			var url = "/subcontract/SUBAcmpSign_form.screen";
			url += "?sign_class_cd=" + sign_class_cd;
			url += "&uri="           + uri;
			url += "&acmp_id="  	 + acmp_id;
			url += "&dept_cd="    	 + f.q_dept_cd.value;
			url += "&acmp_yyyymm="   + f.q_acmp_yyyymm.value; */
			
			//openWindowCenter(url, "sign_form", 200, 100, "");
			alert("확인후 개발할것 일단 완료 상태로 변경함.");
			
			var f = document.form1;
			
			submitXmlRequest("/payment/outside/AdvencePayment_form.screen", "APPROVAL", f, "SUCCESS");
			
		});	
		
		jQuery("#reqPrepaySupplyTamt, #reqPrepaySupplyNamt").blur(function () {
			
				var reqPrepaySupplyTamt = jQuery("#reqPrepaySupplyTamt").val();
				
				reqPrepaySupplyTamt = reqPrepaySupplyTamt.replace(/(\,|\:)/g,"");	//신청금액 과세
				var subPrepaySupplyTamt = jQuery("#subPrepaySupplyTamt").val();
				subPrepaySupplyTamt = subPrepaySupplyTamt.replace(/(\,|\:)/g,"");	//선급금액 과세
				if(Number(subPrepaySupplyTamt) < Number(reqPrepaySupplyTamt)){	
					alert('선급금보다 신청금액이 큽니다.');
					reqPrepaySupplyTamt = subPrepaySupplyTamt;
					jQuery("#reqPrepaySupplyTamt").val(subPrepaySupplyTamt);
					jQuery("#giveSupplyTamt").val("0");
					jQuery('#reqPrepaySupplyTamt').focus();
				}else{
					var giveSupplyTamt = subPrepaySupplyTamt - reqPrepaySupplyTamt;
					jQuery("#giveSupplyTamt").val(giveSupplyTamt);
					jQuery("#giveSupplyTamt").each(function(index){
						jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
					});
				}
				
				var reqPrepaySupplyNamt = jQuery("#reqPrepaySupplyNamt").val();
				reqPrepaySupplyNamt = reqPrepaySupplyNamt.replace(/(\,|\:)/g,"");	//신청금액 면세
				var subPrepaySupplyNamt = jQuery("#subPrepaySupplyNamt").val();
				subPrepaySupplyNamt = subPrepaySupplyNamt.replace(/(\,|\:)/g,"");	//선급금액 면세
 				if(Number(subPrepaySupplyNamt) < Number(reqPrepaySupplyNamt)){	
					alert('신청금액 면세가 선급금액 면세보다 큽니다.');
					jQuery("#reqPrepaySupplyNamt").val(subPrepaySupplyNamt);
					jQuery("#giveSupplyNamt").val("0");
					jQuery('#reqPrepaySupplyNamt').focus();
				}else{
					var giveSupplyNamt = subPrepaySupplyNamt - reqPrepaySupplyNamt;
					jQuery("#giveSupplyNamt").val(giveSupplyNamt);
					jQuery("#giveSupplyNamt").each(function(index){
						jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
					});
				}
				
				//부가세 
				var reqPrepaySurtaxAmt = (reqPrepaySupplyTamt * 10) / 100;
				var subPrepaySurtaxAmt = jQuery("#subPrepaySurtaxAmt").val();
				subPrepaySurtaxAmt = subPrepaySurtaxAmt.replace(/(\,|\:)/g,"");		//선급금액 부과세								
				var giveSurtaxAmt = subPrepaySurtaxAmt - reqPrepaySurtaxAmt;
				jQuery("#reqPrepaySurtaxAmt").val(reqPrepaySurtaxAmt);
				jQuery("#reqPrepaySurtaxAmt").each(function(index){
					jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
				});
				jQuery("#giveSurtaxAmt").val(giveSurtaxAmt);
				jQuery("#giveSurtaxAmt").each(function(index){
					jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
				});
				
				//신청금액을 구한다.
				var reqPrepayAmt = Number(reqPrepaySupplyTamt) + Number(reqPrepaySupplyNamt) + Number(reqPrepaySurtaxAmt);
				var perpayAmt = jQuery("#perpayAmt").val();
				perpayAmt = perpayAmt.replace(/(\,|\:)/g,"");	//선급금액
				var giveAmt = perpayAmt - reqPrepayAmt;
				jQuery("#reqPrepayAmt").val(reqPrepayAmt);
				jQuery("#reqPrepayAmt").each(function(index){
					jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
				});
				jQuery("#giveAmt").val(giveAmt);
				jQuery("#giveAmt").each(function(index){
					jQuery(this).val(jQuery(this).val().split(/(?=(?:\d{3})+(?:\.|$))/g).join(','));
				});

				//요율
				var conAmt = jQuery("#conAmt").val();
				conAmt = conAmt.replace(/(\,|\:)/g,"");
				var reqPrepayPercent = (reqPrepayAmt / conAmt) * 100;	//신청금액 요율
				var givePercent	= (giveAmt / conAmt) * 100;	//포기금액 요율
				jQuery("#reqPrepayPercent").val(reqPrepayPercent.toFixed(1));
				jQuery("#givePercent").val(givePercent.toFixed(1));
				
				//입력한 선급금 과세가 빈값일 경우 0으로 셋팅
				if(reqPrepaySupplyTamt == ""){
					reqPrepaySupplyTamt = "0";
					jQuery("#reqPrepaySupplyTamt").val("0");
				}
				
				//입력한 선급금 면세가 빈값일 경우 0으로 셋팅
				if(reqPrepaySupplyNamt == ""){
					reqPrepaySupplyNamt = "0";
					jQuery("#reqPrepaySupplyNamt").val("0");
				}
				
				if(reqPrepaySupplyTamt == "0" && reqPrepaySupplyNamt == "0"){	//선급포기
					jQuery("#perpayReqDiv").val("3");
					jQuery("#btnText").text("선급포기신청요청");
					//포기일때 보증정보는 필요없으므로 숨김처ㅣ
					warrCtr('H');	//S:보이기, H:숨기기

				}else if(Number(reqPrepaySupplyTamt) == Number(subPrepaySupplyTamt) && Number(reqPrepaySupplyNamt) == Number(subPrepaySupplyNamt)) {	//신청
					jQuery("#perpayReqDiv").val("1");
					jQuery("#btnText").text("선급신청요청");
					//포기일때 보증정보는 필요없으므로 숨김처ㅣ
					warrCtr('S');	//S:보이기, H:숨기기

				}else{
					jQuery("#perpayReqDiv").val("2");
					jQuery("#btnText").text("부분신청요청");
					//포기일때 보증정보는 필요없으므로 숨김처ㅣ
					warrCtr('S');	//S:보이기, H:숨기기

				}
				
				giveDataSet();
				
			//}//end if
		});
		
		//보증정보팝업 호출
		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();
			
		});
		
		pageinit();
		
	}
	
	//페이지 초기처리
	function pageinit(){
		
		//계약 선급금을 신청선급에 초기 셋팅(신청상태)
		//setAmountData();
		
		//작성일자(증빙일자)
		//seTaxDate();
		
		//신청구분 선택불가
		//appDivSet();
		
		//입력항목 초기처리
		//inputDataSet();
		
		//발행방법에 따른 페이지 셋팅
		//taxDataSet();
		
		//버튼표시 셋팅
		//btnCtr();

		//상태에 따른 입력항목 readOnly
		//inputReadOnlyset();
		
	}

	//신청대상일때 계약선급금액을 선급신청금액에 초기 입력한다.
	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);	
	    }
    		
	}
	
	function btnCtr(){
		
		//alert(jQuery("#statusCd").val());
		if(jQuery("#statusCd").val() == "00" || jQuery("#statusCd").val() == ""){	//00:작성상태는 목록, 저장버튼 표시
			jQuery("#btnAppReq").hide();
			jQuery("#btnDelete").hide();
			jQuery("#btnRejection").hide();
			jQuery("#btnApproval").hide();
		}
		
		if(jQuery("#statusCd").val() == "10"){	//10:작성상태는 목록, 저장, 선급신청버튼 표시
			jQuery("#btnDelete").hide();
			jQuery("#btnRejection").hide();
			jQuery("#btnApproval").hide();
		}
		
		if(jQuery("#statusCd").val() == "20"){	//20:선급신청요청상태는 목록, 저장, 선급신청 버튼 표시
			jQuery("#btnDelete").hide();
			jQuery("#btnRejection").hide();
			jQuery("#btnApproval").hide();
		}
		if(jQuery("#statusCd").val() == "21"){	//21:선급포기요청상태는 목록, 저장, 선급신청 버튼 표시
			jQuery("#btnDelete").hide();
			jQuery("#btnRejection").hide();
			jQuery("#btnApproval").hide();
		}

		
		if(jQuery("#statusCd").val() == "30"){	//30:선급신청상태는 목록 버튼 표시
			jQuery("#btnAppReq").hide();
			jQuery("#btnDelete").hide();
		}
		
		if(jQuery("#statusCd").val() == "40"){	//40:결재중상태는 목록 버튼 표시
			jQuery("#btnAppReq").hide();
			jQuery("#btnDelete").hide();
		}		
		
		if(jQuery("#statusCd").val() == "50"){	//50:선급완료상태는 목록 버튼 표시
			jQuery("#btnSave").hide();
			jQuery("#btnAppReq").hide();
			jQuery("#btnDelete").hide();
			jQuery("#btnRejection").hide();
			jQuery("#btnApproval").hide();
		}		

		if(jQuery("#statusCd").val() == "51"){	//51:선급포기상태는 목록 버튼 표시
			jQuery("#btnSave").hide();
			jQuery("#btnAppReq").hide();
			jQuery("#btnDelete").hide();
			jQuery("#btnRejection").hide();
			jQuery("#btnApproval").hide();
		}

		if(jQuery("#statusCd").val() == "91"){	//91:반려상태는 목록, 저장 버튼 표시
			//jQuery("#btnAppReq").hide();
			jQuery("#btnDelete").hide();
			jQuery("#btnRejection").hide();
			jQuery("#btnApproval").hide();
		}
	}

	function inputReadOnlyset() {

		if (jQuery("#statusCd").val() == "30" || jQuery("#statusCd").val() == "40" || jQuery("#statusCd").val() == "50" || jQuery("#statusCd").val() == "51") { //입력불가상태
			
			jQuery("#userName").attr("readonly", true);
			jQuery("#userName").css({'background-color' : '#dedede'});
			jQuery("#userName").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#hp").attr("readonly", true);
			jQuery("#hp").css({'background-color' : '#dedede'});
			jQuery("#hp").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#eMail").attr("readonly", true);
			jQuery("#eMail").css({'background-color' : '#dedede'});
			jQuery("#eMail").css({'border' : '1px solid #bcbcbc'});
			
			jQuery("#reqPrepaySupplyTamt").attr("readonly", true);
			jQuery("#reqPrepaySupplyTamt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySupplyTamt").css({'border' : '1px solid #bcbcbc'});

			jQuery("#reqPrepaySupplyNamt").attr("readonly", true);
			jQuery("#reqPrepaySupplyNamt").css({'background-color' : '#dedede'});
			jQuery("#reqPrepaySupplyNamt").css({'border' : '1px solid #bcbcbc'});
		}
	}
	
	function taxDataSet(){
		
		var radioCheck	= jQuery(':radio[name="chk_info"]:checked').val();	//세금계산서 발행방법
		if(radioCheck == "1"){
			jQuery("#taxAttachments").hide();
			jQuery("#taxTrRow").hide();
		}else{
			jQuery("#taxAttachments").show();
			jQuery("#taxTrRow").show();
		}
	}
	
	function giveDataSet(){
		
		if(jQuery("#perpayReqDiv option:selected").val() == "1"){
			jQuery("#giveAttachments").hide();
		}else{
			jQuery("#giveAttachments").show();	
		}		
	}
	
	
	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("#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",false);
			jQuery("#reqPrepaySupplyTamt").css({'background-color' : '#ffffff'});
			jQuery("#reqPrepaySupplyTamt").css({'border' : '1px solid #595a5a'});
			//jQuery("#reqPrepaySupplyTamt").val(jQuery("#subPrepaySupplyTamt").val());

			if(jQuery("#conSupplyNamt").val() == "0"){
				//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());
			}else{
				//jQuery("#giveSupplyNamt").val("0");
				jQuery("#reqPrepaySupplyNamt").attr("readonly",false);
				jQuery("#reqPrepaySupplyNamt").css({'background-color' : '#ffffff'});
				jQuery("#reqPrepaySupplyNamt").css({'border' : '1px solid #595a5a'});
				//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");

			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)); */	

			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:숨기기
			
		}
	}
	
	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/outside/AdvencePayment.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;
			}
		}
		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;
            }
		}

		if(jQuery("#btnAppReqSelect").val() == "1"){	//선급금신청요청시에는 해당하는 첨부파일이 모드 등록되어있어야함.

			//10:작성중, 20:선급금 신청요청, 21:선금금 포기요청, 30:선급금 신청, 40:결재중, 50:선금완료, 51:포기완료, 91:반려
			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;
			}

			/* 			
			var radioCheck	= jQuery(':radio[name="chk_info"]:checked').val();
			if(radioCheck == "2"){	//순발행일때 세금계산서 첨부파일이 등록되어있어야함.
				var fileName2 = jQuery('#p_AttachFile2').val();
				if(fileName2 == ""){
					alert("세금계산서 첨부파일 필수입니다.");
					return false;
				}
			}
			
			var reqDivGubun = jQuery("#perpayReqDiv option:selected").val();
			if(reqDivGubun == "2" || reqDivGubun == "3"){
				var fileName1 = jQuery('#p_AttachFile1').val();
				if(fileName1 == ""){
					alert("선급금 포기각서 첨부파일 필수입니다.");
					return false;
				}
			}
			
			if(reqDivGubun == "1" || reqDivGubun == "2"){
				var subContId = jQuery('#subContId').val();
				if(subContId == ""){
					alert("보증정보 입력 필수입니다.");
					return false;
				}
			}
*/		
			//보증정보 첨부확인Check
 			alert("기능신청시 첨부파일 확인 처리 개발중 일단 진행");	
		}
	}
	
	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();	
						reDisplay();
						
					}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();
				}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() == "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;
			}			
			
		}
		catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}

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

	}

	

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

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

	//첨부파일   
	function doAttachFile(obj,No) {
		
		//alert(obj.value);
		if(obj.value == ''){
			//alert("After you have saved, you can attach a file.");
			alert("데이터를 저장 후, 파일을 첨부할 수가 있습니다.");
		}
		else if(obj.value != ''){ 
			if(No == 1){
				//viewFileList('PREPAYMENTS_GIVEUP', obj.value, document.form1.p_AttachFile1, "N", "N", "Y", "N");
				viewFileListNew('PURCHASE_'+obj.value, No, document.form1.p_AttachFile, "Y", "cont/cont-1001");
			}else{
				//alert(No);
				var upLoadFlg = "Y";
				if(jQuery("#statusCd").val() == "03" || jQuery("#statusCd").val() == "10"){	//상태값이 기성신청(03), 기성완료(10) 일때는 첨부파일 다운로드만 가능
					upLoadFlg = "N";
				}
				viewFileListNew('PURCHASE_'+obj.value, No, document.form1.p_AttachFile, upLoadFlg, "cont/cont-1001");
			}
		} 

		//기성첨부파일 목록 조회
		getFileListForTextarea();
		
	}
	
	//첨부목록 조회
	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;
		
		//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");
		
	}
</SCRIPT>


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

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

	<INPUT type="hidden" name="fevent" id="fevent" value="">
	<INPUT type="hidden" name="payreqId" id="payreqId" value="">
	
<%-- 	<INPUT type="hidden" name="selectSubContModId" id="selectSubContModId" value="<%=params.get("selectSubContModId") %>">
	<INPUT type="hidden" name="subContModId" id="subContModId" value="<%=prePayment.get("SUB_CONT_MOD_ID") %>">
	<INPUT type="hidden" name="prepayId" id="prepayId" value="<%=prePayment.get("PREPAY_ID") %>">
	<INPUT type="hidden" name="corpId" id="corpId" value="<%=prePayment.get("CON_CORP_ID") %>">
	
	<INPUT type="hidden" name="orgReqPrepaySupplyTamt" id="orgReqPrepaySupplyTamt" value="<%=prePayment.get("REQ_PREPAY_SUPPLY_TAMT") %>">
	<INPUT type="hidden" name="orgReqPrepaySupplyNamt" id="orgReqPrepaySupplyNamt" value="<%=prePayment.get("REQ_PREPAY_SUPPLY_NAMT") %>">
	
	<INPUT type="hidden" name="statusCd" id="statusCd" value="<%=prePayment.get("STATUS_CD") %>">
	<INPUT type="hidden" name="subContId" id="subContId" value="<%=prePayment.get("SUB_CONT_ID") %>">
	
	<INPUT type="hidden" name="warrGubun" id="warrGubun" value="<%=contOutWarr.get("WARR_GUBUN") %>">
	<INPUT type="hidden" name="warrSeq" id="warrSeq" value="<%=contOutWarr.get("WARR_SEQ") %>">

	<INPUT type="hidden" name="btnAppReqSelect" id="btnAppReqSelect" value="0">	
	<!-- 기성신청상태구분 -->
	<INPUT type="hidden" name="selectStatusCd" id="selectStatusCd" value="">
	
	<!-- 리스트 페이지 검색 조건 -->
	<INPUT type='hidden' id="searchBuildName" name="searchBuildName" value="<%=params.get("searchBuildName") %>">	<!-- 계약명 -->
	<INPUT type='hidden' id="searchStatusCd" name="searchStatusCd" value="<%=params.get("searchStatusCd") %>">	<!-- 상태값 -->
	<INPUT type='hidden' id="dept_cd" name="dept_cd" value="<%=params.get("dept_cd") %>">	
	<INPUT type='hidden' id="dept_nm" name="dept_nm" value="<%=params.get("dept_nm") %>">	 --%>
	
	<!-- 제목 및 버튼 -->
	<table width="100%">
		<colgroup>
			<col width="500" />
			<col width="*" />
		</colgroup>
		<tr>
	   		<th>
		   		<div align="left" id="title">
					<ul>
			    		<%-- <li>선급금관리 상세(<%=prePayment.get("STATUS_NM")%>)</li> --%>
			    		<li>선급금관리 상세(상태값)</li>
			    	</ul>
				</div>
			</th>
			<td align="right">
				<span class="btnSearch center"><a href="javascript:void(0);" id="btnList">목록</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="btnSave">저장</a></span>
				<span class="btnSearch center"><a href="javascript:void(0);" id="btnRejection">반려</a></span>
				<span class="btnSearch center"><a href="javascript:void(0);" id="btnApproval">결재</a></span>
				<span class="btnSearch center"><a href="javascript:void(0);" id="btnAppReq"><span id="btnText">선급신청요청</span></a></span></td>
			</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><%=prePayment.get("RTN_DATE")%></TD>
		</TR>
		<TR>
			<th style="text-align: left;">반려사유</th>
			<TD><%=prePayment.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 height="25">
			<th style="text-align: left;">현장명</th>
			<TD><%= InputText.get("deptName", "테스트현장명", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">계약명</th>
			<TD><%= InputText.get("buildName", "테스트계약", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">통화</th>
			<TD><%= InputText.get("conCurCd", "KRW", 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", "119-81-874847", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>

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

			<th style="text-align: left;">대표이사</th>
			<TD><%= InputText.get("bossName", "윤웅희", 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", "2014-01-01 ~ 2014-12-31", 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("5845000", 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("584500", intDigit)+" (부가세 별도)", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
		</TR>
		<TR height="55">
			<th style="text-align: left;">대금지불방법</th>
			<TD colspan="5"><textarea name="" id="" style="width:98%; height:53px; overflow-y:auto" maxlength="100" class="input byteChk ctrlTarget">계약금:계약 후 30%(현금)<Br>중도금:납품 후60%(전자어음)<br>잔 금:시운전 후 10%(전자어음)</textarea></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", "납품", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">지급구분</th>
			<TD><%= InputText.get("buildName", "선급금", 100, 30, "class=input_blank, readOnly=white, string, left, perSize, tabIndex=-1", "string") %></TD>
			<th style="text-align: left;">지급차수</th>
			<TD><%= InputText.get("conCurCd", "1", 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="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">
			합계금액:<%= InputText.get("vendCd", "", 20, 16, "number, right, perSize, readonly, tabIndex=-1", "number") %>
			(청구금액:<%= InputText.get("vendCd", "", 20, 16, "number, right, perSize, readonly, tabIndex=-1", "number") %>
			,부가세:<%= InputText.get("vendCd", "", 20, 16, "number, right, perSize, readonly, tabIndex=-1", "number") %>
			)							
			</TD>

			<th style="text-align: left;">업체신청일시</th>
			<TD><%= InputText.get("memberName", "미서명", 100, 30, "class=input_blank, readOnly=white, string, left, 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>
			<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 %>>순발행(업체직접 발행)
			</TD>

			<th style="text-align: left;">작성일자(증빙일자)</th>
			<TD><%= InputText.get("date1", Formatter2.formatDate("20141231", "-"), 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("userName", "김대금", 100, 6, "string, left, perSize", "string") %></TD>
			<th class="required" style="text-align: left;">담당자 핸드폰번호</th>
			<TD>
			<input type="text" id="hp" name="hp" value="010-9878-9878" 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("eMail", "EMAIL@NC.COM", 100, 40, "string, left, perSize", "string") %></TD>
  		</TR>
	</TABLE>
	<!-- 세금계산서정보 : 끝 -->
	
   	<div class="application-info  magT10">
		<div class="application-sub-title">
			<span class="title">첨부 및 기타서류</span>
		</div>
		<div class="application-location">
	</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") %>');" 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="acmp_remark" id="acmp_remark" rows="12" maxlength="1000" class="input byteChk ctrlTarget" style="width:98%; height: 98%; overflow-y:auto"></TEXTAREA></TD>
		</TR>
	</TABLE>
	<!-- 세금계산서정보 : 끝 -->		
		
	</div>	
</FORM>