<%--
  - FileName   : subconPayOutOffPopup.jsp
  - Author(s)  : ok
  - Date       : 2014.09.10
  - 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"%>

<%@ 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();
    //System.out.println("Outside params : " + event);

    ValueObject contOutWarr = storage.getValueObject("WarrContInfo");		//보증정보
    
	//보증기관명 ComboList
	RowSet contorgbncodeComboList = storage.getRowSet("contorgbncodeComboList");
	//장기계속구분 ComboList
	RowSet longgbnComboList = storage.getRowSet("longgbnComboList");
	
    ValueObject attFile = storage.getValueObject("attFileList");	//첨부파일
    
    String sWarrGubun = params.get("warrGubun");
%>
<SCRIPT language="JavaScript">
	var	sGuarOnoffYn	=	"Y";
	var sGuarStatus 	= "<%=contOutWarr.get("GUAR_STATUS")%>";
	
	function _onReady(){

		jQuery("#btnSave").click(function() {
		
			//필수 입력항목 check
		//	alert(save());
			if(save()){
				var f = document.form1;
				jQuery("#fevent").val("FORM_SAVE_ON");
				submitXmlRequest("/portal/guar/subconPayOutPopup_form.screen", "FORM_SAVE_ON", f, "SUCCESS");	
			}
		}); 
		
		jQuery("#btnTrans").click(function() {
			
			//필수 입력항목 check
			//	alert(save());
				if(save()){
					var f = document.form1;
					jQuery("#fevent").val("FORM_SAVE_ON");
					submitXmlRequest("/portal/guar/subconPayOutPopup_form.screen", "FORM_SAVE_ON", f, "SUCCESS");	
				}
			
		});		

		jQuery("#btnAgain").click(function() {
			
			//필수 입력항목 check
			//	alert(save());
				if(save()){
					var f = document.form1;
					jQuery("#fevent").val("FORM_SAVE_ON");
					submitXmlRequest("/portal/guar/subconPayOutPopup_form.screen", "FORM_SAVE_ON", f, "SUCCESS");	
				}
			
		});	
		jQuery("#btnCancel").click(function() {
			if(confirm("해당기관에 전송한 계약정보가 삭제됩니다.\n\n취소 신청하시겠습니까?")){
				//	보증정보 삭제
				var f = document.form1;
				jQuery("#fevent").val("FORM_DEL");
				submitXmlRequest("/portal/guar/subconPayOutPopup_form.screen", "FORM_DEL", f, "SUCCESS");	
			}

		});					
		//보증 상태에 따라서 버튼 오픈 유무 체크
		funBtnCheck();
	}

	function doResult(resultObj) {
		try {
			
			if( resultObj.getRequestEvent() == "FORM_SAVE_ON" ) {
				if( resultObj.getSuccess() ) {				
					alert("저장되었습니다.");		
					
					returnValue = new Array(0,"OK",<%=params.get("subContModId")%>);
					parent.popContWarrClose(returnValue);
					
				}else {
					
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}
			if( resultObj.getRequestEvent() == "FORM_DEL" ) {
				if( resultObj.getSuccess() ) {				
					alert("정상적으로 처리 되었습니다.");
					
					returnValue = new Array(0,"OK",<%=params.get("subContModId")%>);
					parent.popContWarrClose(returnValue);
				}else {
					
					dlgErrorMsg(resultObj);
				}
				document.form1.isSubmit = false;
			}				
		}
		catch(errorObject) {
	        showErrorDlg("doResult()", errorObject);
		}
	}
	
	
	
	function calendar(thisDayObj){
		dlgCalendar(thisDayObj);
	}		

	//첨부파일   
	function doAttachFile(obj,No) {
		
		parent.doAttachFilePop(obj, No, document.form1, "GUARCONT_OUT_<%=params.get("warrGubun")%>_<%=params.get("warrSeq")%>", "cont/outside/<%=params.get("subContModId")%>/guar");

	} 

	/********************************
		보증정보 저장
	********************************/
	function save()
	{
		var	form	=	document.form1;

		/* 		여기부터 수정 할것 			*/
		var iReqDate 			= form.reqdate;				// 발급희망일
		var iLongGbn 			= form.longgbn;				// 장기계속구분
		var iContorderno 		= form.contorderno;				// 원도급 계약번호
		var iContOrgbnCd  		= form.contorgbncode;	// 기관분류
//		var iSite_ocst  		= form.site_ocst;	// 발주처 사업자번호
//		var iDealer_nm  		= form.dealer_nm;	// 발주처 기관명
		var iDepnm  			= form.depnm;					// 부서명
		var iEmpnm  			= form.empnm;					// 성명
		var iTelno  			= form.telno;					// 전화번호
		var iHpno  				= form.hpno;						// 핸드폰번호
		var iEmail  			= form.email;					// 메일주소 
		var iRateGbnCd			= form.GUARRATEGBNCODE;// 보증서발급지분
		var iPrepayRefYn		= form.PREPAYREFYN;		// 선급금공제여부
		var iExistRefYn			= form.EXIISTREFYN;		// 기성금공제여부
		var iOrderOwner			= form.orderowner;			// 발주처대표자명

		var iToDate 			= "<%=contOutWarr.get("TODAY")%>";
		var iContstartdate			= form.contstartdate;			// 원도급 계약 시작일자
		var iContclosedate			= form.contclosedate;			// 원도급 계약 종료 일자
		
		var iCont_sdate			= form.cont_sdate;			// 하도급 계약 시작일자
		var iCont_edate			= form.cont_edate;			// 하도급 계약 종료 일자
		 
		if(iReqDate.value.length < 8){
			alert("발급희망일을 정확히 입력하세요");
			document.getElementById("reqdate").focus();
			return false;
		}

		if(iReqDate.value < iToDate){
			alert("발급희망일을 오늘 날짜 이후로 입력해 주세요.");
			document.getElementById("reqdate").focus();
			return false;
		}		
		//원도급 계약 시작일자가 하도급 계약 시작일자 안에 있어야 함
		if(iCont_sdate.value < iContstartdate.value){
			alert("하도급 계약 시작일은 원도급 계약 시작일 안에 있어야 합니다.");
			document.getElementById("contstartdate").focus();
			return false;
		}		
		//원도급 계약 시작일자가 하도급 계약 시작일자 안에 있어야 함
		if(iCont_edate.value > iContclosedate.value){
			alert("하도급 계약 종료일은 원도급 계약 종료일 안에 있어야 합니다.");
			document.getElementById("contclosedate").focus();
			return false;
		}		
		
		if(iRateGbnCd.value == ""){
			alert("보증서발급지분을 선택하세요.");
			return false;
		}
/*		
		if(iPrepayRefYn.value == ""){
			alert("선급금공제여부를 선택하세요.");
			return false;
		}
		
		if(iExistRefYn.value == ""){
			alert("기성금공제여부를 선택하세요.");
			return false;
		}
*/
		if(iContorderno.value == ""){
			alert("원도급 계약번호를 입력하세요.");
			return false;
		}
		if(document.form1.contamt.value == ""){
			alert("원도급 계약 금액을 입력하세요.");
			document.form1.contamt.focus();
			return false;
		}		
		if(iLongGbn.value == ""){
			alert("장기계속구분을 선택하세요.");
			document.getElementById("longgbn").focus();
			return false;
		}
/*		
		if(iSite_ocst.value == ""){
			alert("발주처 사업자 번호를 입력하세요.");
			return false;
		}
		if(iDealer_nm.value == ""){
			alert("발주처 기관명을 입력하세요.");
			return false;
		}		
		*/		
		
		if(iContOrgbnCd.value == ""){
			alert("기관분류를 선택하세요.");
			document.getElementById("contorgbncode").focus();
			return false;
		}

		if(iOrderOwner.value == ""){
			alert("발주처 대표자 명을 입력하세요.");
			document.getElementById("orderowner").focus();
			return false;
		}
		
		if(iDepnm.value == ""){
			alert("부서명을 입력하세요.");
			document.getElementById("depnm").focus();
			return false;
		}
		
		if(iEmpnm.value == ""){
			alert("성명을 입력하세요.");
			document.getElementById("empnm").focus();
			return false;
		}
		
		if(iTelno.value == ""){
			alert("전화번호를 입력하세요.");
			document.getElementById("telno").focus();
			return false;
		}
		
		if(iHpno.value == ""){
			alert("휴대전화번호를 입력하세요.");
			document.getElementById("hpno").focus();
			return false;
		}
		
		if(iEmail.value == ""){
			alert("이메일을 입력하세요.");
			document.getElementById("email").focus();
			return false;
		}		
		
		form.guarStatus.value = "04";
			
		if(confirm("보증정보를 저장하시겠습니까?"))	 return true;
		
	}

	/****************************
	보증지분율 설정
	******************************/	
	function setGuarRate(row_index, col_name)
	{
		var	form	=	document.form1;
//		var ds_cnt	= sDataset.CountRow;
		var w_gubun = form.GUARRATEGBNCODE;
		var w_cause = document.getElementById("CAUSECODE"+ row_index);
		var c_camt	= "<%=contOutWarr.get("CONT_CAMT")%>";
		var l_camt	= <%=contOutWarr.get("LAST_CAMT")%>;	
		var gs_amt	= <%=contOutWarr.get("CONTEXISTENCEAMT")%>;
		var sun_amt	= <%=contOutWarr.get("SUM_SUN")%>;
		var df_amt	=	Number(c_camt) - Number(l_camt);
		//var df_amt	=	parseInt(c_camt - l_camt);
	
		// 보증지분구분[ 03:단독, 04:공동이행(전체-한도분할 안함), 05:공동이행(전체-한도분할 함), 06:공동이행(당사), 07:분담이행 ]
		// 변경구분 [ 01:당초, 02:연장, 03:증액 ]
		if(w_gubun.value == ""){
		 	return;
		 	
		}else if(w_gubun.value == "03"){								// 단독, 분담이행
			document.getElementById("GUARRATE"+ row_index).value = "100";								// 일성 보증지분율: 100%
			
			if(w_cause.value == "01"){
				calcul_1(c_camt, row_index);			
				calcul_2(sun_amt, row_index);			
				calcul_3(gs_amt, "Y", row_index);			
			}else if(w_cause.value == "02"){
				calcul_1(l_camt, row_index);		
				calcul_2(sun_amt, row_index);
				calcul_3(gs_amt, "X", row_index);		
			}else if(w_cause.value == "03"){
				calcul_1(df_amt, row_index);
				calcul_2(sun_amt, row_index);
				calcul_3(gs_amt, "X", row_index);		
			}	
		}
	}
	
	/****************************
		계약금 분담액 계산 입력
	******************************/
	function calcul_1(amt, row_index)
	{
		var cal_rate = document.getElementById("GUARRATE"+ row_index).value;
		var cal_amt  = parseInt(amt * cal_rate /100);
		document.getElementById("ADDCONTAMT"+ row_index).value = cal_amt;
	}
	
	/****************************
		선급금 공제액  계산 입력
	******************************/
	function calcul_2(amt, row_index)
	{
		var ref_flag = document.getElementById("PREPAYREFYN"+ row_index).value;
		
		if(ref_flag == "Y"){
			var cal_rate = document.getElementById("GUARRATE"+ row_index).value;
			var cal_amt  = parseInt(amt * cal_rate /100);
			document.getElementById("ADDPREPAYAMT"+ row_index).value = cal_amt;
		}else{
			document.getElementById("ADDPREPAYAMT"+ row_index).value = "0";
		}	
	}
	
	/****************************
		기성금 공제액  계산 입력
	******************************/
	function calcul_3(amt, mode, row_index)
	{
		var gs_flag = document.getElementById("EXIISTREFYN"+ row_index).value;

		if(mode == "X"){
			document.getElementById("ADDEXISAMT"+ row_index).value = "0";
		}else{
			if(gs_flag == "Y"){
				var cal_rate = document.getElementById("GUARRATE"+ row_index).value;
				var cal_amt  = parseInt(amt * cal_rate /100);
				document.getElementById("ADDEXISAMT"+ row_index).value = cal_amt;
			}else{
				document.getElementById("ADDEXISAMT"+ row_index).value = "0";
			}	
		}
	}
	
	/****************************
		선급금 공제분 설정
	******************************/
	function setPrepay(row_index, col_name)
	{
		var sun_amt		= "<%=contOutWarr.get("SUM_SUN")%>";
		var flag  = document.getElementById("PREPAYREFYN"+ row_index).value;	
		
		if(flag == "Y" && sun_amt == "0"){
			alert("기지급 선급금이 없으므로 반영 할 수 없습니다.");
			document.getElementById("PREPAYREFYN"+ row_index).value = "N";
			return;
		}				
		if(flag == "N"){
			document.getElementById("ADDPREPAYAMT"+ row_index).value = "0";
			document.getElementById("ADDPREPAYAMT"+ row_index).style.readOnly=true;
//			document.form1.ADDPREPAYAMT.value = "0";
//			document.form1.ADDPREPAYAMT.style.readOnly=true;
			
		}else{
			document.getElementById("ADDPREPAYAMT"+ row_index).style.readOnly=false;
			
			setGuarRate(row_index, "GUARRATEGBNCODE");	
		}
	}
	
	/****************************
		기성금 공제분 설정
	******************************/
	function setGs(row_index, col_name)
	{
		var gs_amt		= "<%=contOutWarr.get("CONTEXISTENCEAMT")%>";
		var gs_ref_yn	= "<%=contOutWarr.get("GS_REF_FLAG")%>";
		var flag = document.getElementById("EXIISTREFYN"+ row_index).value;	
		
		if(flag == "Y" && gs_amt == "0"){
			alert("기지급 기성금이 없으므로 반영 할 수 없습니다.");
			document.getElementById("EXIISTREFYN"+ row_index).value = "N";
			return;
		}else if(gs_ref_yn == "Y"){
			alert("이미 발급된 보증정보가 존재하므로\n\n현재 보증정보에서는 기성정보를 반영할 수 없습니다.");
			document.getElementById("EXIISTREFYN"+ row_index).value = "N";
			return;
		}
		
		if(flag == "N"){
			document.getElementById("ADDEXISAMT"+ row_index).value = "0";
			document.getElementById("ADDEXISAMT"+ row_index).style.readOnly=true;			
		}else{
			document.getElementById("ADDEXISAMT"+ row_index).style.readOnly=false;
			
			setGuarRate(row_index, "GUARRATEGBNCODE");	
		}
	}
	
	function funBtnCheck(){
		if((sGuarStatus == "") || (sGuarStatus == "02") || (sGuarStatus == "04"))
		{
			document.getElementById("btnSave").style.display	=	"";
		}else{
			document.getElementById("btnCancel").style.display	=	"";			
		}	
	}
</SCRIPT>
<STYLE>
BODY {
	padding : 0 0 0 0;
}
</STYLE>
<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="<%= params.get("fevent") %>">

<INPUT type="hidden" name="subContModId" id="subContModId" value="<%=params.get("subContModId") %>">	<!-- 보증증권 ID -->
<INPUT type="hidden" name="warrGubun" id="warrGubun" value="<%=params.get("warrGubun") %>">			<!-- 보증증권 구분 -->
<INPUT type="hidden" name="viewDiv" id="viewDiv" value="<%=params.get("viewDiv") %>">			<!-- 화면구분 -->
<INPUT type="hidden" name="guarStatus" id="guarStatus" value="<%=contOutWarr.get("GUAR_STATUS") %>">			<!--보증 상태 -->
<INPUT type="hidden" name="SUB_CONT_ID" id="SUB_CONT_ID" value="<%=params.get("SUB_CONT_ID") %>">			<!--계약서 ID -->
<INPUT type="hidden" name="MOD_NO" id="MOD_NO" value="<%=params.get("MOD_NO") %>">			<!--계약 변경차수 -->

<INPUT type="hidden" name="prepayId" id="prepayId" value="<%=params.get("prepayId") %>">			<!-- 보증일련번호 -->
<INPUT type="hidden" name="guarOnOffYn" id="guarOnOffYn" value="Y">			<!-- 발행방법 -->
<INPUT type="hidden" name="EXIST_FLAG" id="EXIST_FLAG" value="<%=contOutWarr.get("EXIST_FLAG") %>">			<!-- 저장 유무 -->
<INPUT type="hidden" name="GUARRATEGBNCODE" id="GUARRATEGBNCODE" value="03">		<!-- 단독이행 -->


	<!-- 제목 및 버튼 -->
<table  id="t1" width="100%" border="0" cellspacing="0" cellpadding="0" class="ftit_table">
	<colgroup>
		<col width="200" />
		<col width="*" />
	</colgroup>
	<tr>
	   <td align="right">
			<span class="btnSearch center" style="display:none" id="btnSave"><a>저장</a></span>
			<span class="btnSearch center" style="display:none" id="btnDel"><a href="javascript:void();del('정말로 보증정보를 삭제 하시겠습니까?');">삭제</a></span>
			<span class="btnSearch center" style="display:none" id="btnTrans"><a>전송</a></span>
			<span class="btnSearch center" style="display:none" id="btnAgain"><a>재전송</a></span>
			<span class="btnSearch center" style="display:none" id="btnCancel"><a>취소</a></span>
	   </td>
   	</tr>
</table>
   	
<!-- 보증사 -->  
<TABLE cellspacing="1" cellpadding="0" class="search_table" style="margin-top:10px;">
	<colgroup>
		<col width="120" />
		<col width="*" />
		<col width="120" />
		<col width="*" />
	</colgroup>
	<TR height="25">
		<TH class="search_table_title required" style="text-align: left;">보증기관명</TH>
		<TD class="search_table_data" style="text-align: left;">&nbsp;<%= InputText.get("warrGoffice", contOutWarr.get("WARR_GOFFICE"), 30, 40, "string, left, readOnly", "string") %>
			<INPUT type="hidden" name="guarOrganCode" id="guarOrganCode" value="3">
		</TD>
		<TH class="search_table_title" style="text-align: left;">발급희망일</TH>
		<TD class="search_table_data" style="text-align: left;">&nbsp;<%= InputText.get("reqdate", Formatter.formatDate(contOutWarr.get("REQDATE"), "-"), 29, 10, "Center, date, PerSize, readonly", "date", "") %>
			<A href="JavaScript:calendar('reqdate');"><IMG src="/img/buyer/btn/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A>
		</TD>		
	</TR>
</TABLE>

<table width="100%" style="margin-top:3px;">
	<tr>
		<TD height="5" style="text-align: left;">※ 원도급정보</font> </TD>
	</tr>
</table>
<TABLE cellspacing="1" cellpadding="0" class="search_table" style="margin-top:3px;">
	<colgroup>
		<col width="120" />
		<col width="*" />
		<col width="120" />
		<col width="*" />
	</colgroup>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">장기계속구분</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= HTMLMaker.getSelectTag(longgbnComboList, "DETAILCD", "DETAILNM", "longgbn", "width:50%;height=18;", "<option value=''>::장기계속구분선택::</option>", contOutWarr.get("longgbn")) %></TD>
		<TH class="search_table_title" style="text-align: left;">계약번호</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("contorderno", contOutWarr.get("contorderno"), 70, 30, "string, left, PerSize", "string") %></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">계약금액</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("contamt", contOutWarr.get("contamt"), 70, 30, "class=input byteChk ,number, right, PerSize", "number") %></TD>
		<TH class="search_table_title" style="text-align: left;">계약체결일자</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("contdate", Formatter.formatDate(contOutWarr.get("contdate"), "-"), 29, 10, "Center, date, PerSize, readonly", "date", "") %>
			<A href="JavaScript:calendar('contdate');"><IMG src="/img/buyer/btn/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">계약시작일자</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("contstartdate", Formatter.formatDate(contOutWarr.get("contstartdate"), "-"), 29, 10, "Center, date, PerSize, readonly", "date", "") %>
			<A href="JavaScript:calendar('contstartdate');"><IMG src="/img/buyer/btn/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A></TD>
		<TH class="search_table_title" style="text-align: left;">계약종료일자</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("contclosedate", Formatter.formatDate(contOutWarr.get("contclosedate"), "-"), 29, 10, "Center, date, PerSize, readonly", "date", "") %>
			<A href="JavaScript:calendar('contclosedate');"><IMG src="/img/buyer/btn/bt_calender.gif" alt="달력" border="0" align="absmiddle"></A></TD>
	</TR>
</TABLE>

<table width="100%" style="margin-top:3px;">
	<tr>
		<TD height="5" style="text-align: left;">※ 발주처 정보</font> </TD>
	</tr>
</table>
<TABLE cellspacing="1" cellpadding="0" class="search_table" style="margin-top:3px;">
	<colgroup>
		<col width="120" />
		<col width="*" />
		<col width="120" />
		<col width="*" />
	</colgroup>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">사업자번호</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("DEALER_BSNO", contOutWarr.get("DEALER_BSNO"), 40, 30, "string, left, tabIndex=-1, readOnly", "string") %></TD>
		<TH class="search_table_title" style="text-align: left;">기관분류</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= HTMLMaker.getSelectTag(contorgbncodeComboList, "DETAILCD", "DETAILNM", "contorgbncode", "width:50%;height=18;", "<option value=''>::기관분류선택::</option>", contOutWarr.get("contorgbncode")) %></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">기관명</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("dealer_nm", contOutWarr.get("DEALER_NM"), 40, 30, "string, left, tabIndex=-1, readOnly", "string") %></TD>
		<TH class="search_table_title" style="text-align: left;">대표자명</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("orderowner", contOutWarr.get("orderowner"), 40, 30, "string, left, tabIndex=-1", "string") %></TD>
	</TR>
</TABLE>

<table width="100%" style="margin-top:3px;">
	<tr>
		<TD height="5" style="text-align: left;">※ 보증신청정보</font> </TD>
	</tr>
</table>
<TABLE cellspacing="1" cellpadding="0" class="search_table" style="margin-top:3px;display:">
	<colgroup>
		<col width="120" />
		<col width="100" />
		<col width="80" />
		<col width="120" />
		<col width="*" />
		<col width="*" />
	</colgroup>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: center;" rowspan="2">보증신청계약번호</TH>
		<TH class="search_table_title" style="text-align: center;" rowspan="2">변경구분</TH>
		<TH class="search_table_title" style="text-align: center;" rowspan="2">지분율(%)<br>(계약/보증)</TH>
		<TH class="search_table_title" style="text-align: center;" rowspan="2">계약분담금액</TH>
		<TH class="search_table_title" style="text-align: center;" colspan="2">공제분반영여부</TH>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: center;">선급금</TH>
		<TH class="search_table_title" style="text-align: center;">기성금</TH>
	</TR>
<%
	if (params.get("CAUSECODE").equals("04")){
%>
	<TR height="25">
		<TD class="search_table_data" style="text-align: center;" rowspan="2"><%= InputText.get("GRTREQNO", contOutWarr.get("GRTREQNO"), 90, 30, "string, left, PerSize, readOnly", "string") %></TD>
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("CAUSENAME1", "연장", 90, 30, "string, center, PerSize, readOnly", "string") %>
			<INPUT type="hidden" name="warrSeq1" id="warrSeq1" value="<%=params.get("warrSeq") %>">				<!-- 보증증권 일련번호 -->
			<INPUT type="hidden" name="CAUSECODE1" id="CAUSECODE1" value="02">
			<INPUT type="hidden" name="CAUSECOUNT" id="CAUSECOUNT" value="2">
		</TD>
		<TD class="search_table_data" style="text-align: center;">
			<%= InputText.get("CONTRATE1", contOutWarr.get("CONTRATE"), 60, 30, "string, center, PerSize, readOnly", "string") %><br/>
			<%= InputText.get("GUARRATE1", contOutWarr.get("GUARRATE"), 60, 30, "string, center, PerSize, readOnly", "string") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">
			<%= InputText.get("ADDCONTAMT1", contOutWarr.get("ADDCONTAMT"), 90, 30, "number, right, PerSize", "number") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">&nbsp;
			<SELECT class='input_select' id='PREPAYREFYN1' name='PREPAYREFYN1' style='width:50%;height=18;' onchange="setPrepay(1);">
				<OPTION value='Y' <%=contOutWarr.get("PREPAYREFYN").equals("Y") ? "selected=selected":""%>>반영</OPTION>
				<OPTION value='N' <%=contOutWarr.get("PREPAYREFYN").equals("N") ? "selected=selected":""%>>미반영</OPTION>
			</SELECT><br>
			<%= InputText.get("ADDPREPAYAMT1", contOutWarr.get("ADDPREPAYAMT"), 60, 30, "number, right, PerSize, readOnly", "number") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">&nbsp;
			<SELECT class='input_select' id='EXIISTREFYN1' name='EXIISTREFYN1' style='width:50%;height=18;' onchange="setGs(1);">
				<OPTION value='Y' <%=contOutWarr.get("EXIISTREFYN").equals("Y") ? "selected=selected":""%>>반영</OPTION>
				<OPTION value='N' <%=contOutWarr.get("EXIISTREFYN").equals("N") ? "selected=selected":""%>>미반영</OPTION>
			</SELECT><br>
			<%= InputText.get("ADDEXISAMT1", contOutWarr.get("ADDEXISAMT"), 60, 30, "number, right, PerSize, readOnly", "number") %>		
		</TD>
	</TR>
	<TR height="25">
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("CAUSENAME1", "증액", 90, 30, "string, center, PerSize, readOnly", "string") %>
			<INPUT type="hidden" name="warrSeq2" id="warrSeq2" value="<%=Integer.parseInt(params.get("warrSeq"))+1 %>">				<!-- 보증증권 일련번호 -->
			<INPUT type="hidden" name="CAUSECODE2" id="CAUSECODE2" value="03">
		</TD>
		<TD class="search_table_data" style="text-align: center;">
			<%= InputText.get("CONTRATE2", contOutWarr.get("CONTRATE"), 60, 30, "string, center, PerSize, readOnly", "string") %><br/>
			<%= InputText.get("GUARRATE2", contOutWarr.get("GUARRATE"), 60, 30, "string, center, PerSize, readOnly", "string") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">
			<%= InputText.get("ADDCONTAMT2", contOutWarr.get("ADDCONTAMT"), 90, 30, "number, right, PerSize", "number") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">&nbsp;
			<SELECT class='input_select' id='PREPAYREFYN2' name='PREPAYREFYN2' style='width:50%;height=18;' onchange="setPrepay(2);">
				<OPTION value='Y' <%=contOutWarr.get("PREPAYREFYN").equals("Y") ? "selected=selected":""%>>반영</OPTION>
				<OPTION value='N' <%=contOutWarr.get("PREPAYREFYN").equals("N") ? "selected=selected":""%>>미반영</OPTION>
			</SELECT><br>
			<%= InputText.get("ADDPREPAYAMT2", contOutWarr.get("ADDPREPAYAMT"), 60, 30, "number, right, PerSize, readOnly", "number") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">&nbsp;
			<SELECT class='input_select' id='EXIISTREFYN2' name='EXIISTREFYN2' style='width:50%;height=18;' onchange="setGs(2);">
				<OPTION value='Y' <%=contOutWarr.get("EXIISTREFYN").equals("Y") ? "selected=selected":""%>>반영</OPTION>
				<OPTION value='N' <%=contOutWarr.get("EXIISTREFYN").equals("N") ? "selected=selected":""%>>미반영</OPTION>
			</SELECT><br>
			<%= InputText.get("ADDEXISAMT2", contOutWarr.get("ADDEXISAMT"), 60, 30, "number, right, PerSize, readOnly", "number") %>		
		</TD>
	</TR>
<%
	}else{
%>
	<TR height="25">
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("GRTREQNO", contOutWarr.get("GRTREQNO"), 90, 30, "string, left, PerSize, readOnly", "string") %></TD>
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("CAUSENAME1", contOutWarr.get("CAUSENAME"), 90, 30, "string, center, PerSize, readOnly", "string") %>
			<INPUT type="hidden" name="warrSeq1" id="warrSeq1" value="<%=params.get("warrSeq") %>">				<!-- 보증증권 일련번호 -->
			<INPUT type="hidden" name="CAUSECODE1" id="CAUSECODE1" value="<%=params.get("CAUSECODE") %>">
			<INPUT type="hidden" name="CAUSECOUNT" id="CAUSECOUNT" value="1">
		</TD>
		<TD class="search_table_data" style="text-align: center;">
			<%= InputText.get("CONTRATE1", contOutWarr.get("CONTRATE"), 60, 30, "string, center, PerSize, readOnly", "string") %><br/>
			<%= InputText.get("GUARRATE1", contOutWarr.get("GUARRATE"), 60, 30, "string, center, PerSize, readOnly", "string") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">
			<%= InputText.get("ADDCONTAMT1", contOutWarr.get("ADDCONTAMT"), 90, 30, "number, right, PerSize", "number") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">&nbsp;
			<SELECT class='input_select' id='PREPAYREFYN1' name='PREPAYREFYN1' style='width:50%;height=18;' onchange="setPrepay(1);">
				<OPTION value='Y' <%=contOutWarr.get("PREPAYREFYN").equals("Y") ? "selected=selected":""%>>반영</OPTION>
				<OPTION value='N' <%=contOutWarr.get("PREPAYREFYN").equals("N") ? "selected=selected":""%>>미반영</OPTION>
			</SELECT><br>
			<%= InputText.get("ADDPREPAYAMT1", contOutWarr.get("ADDPREPAYAMT"), 60, 30, "number, right, PerSize, readOnly", "number") %>
		</TD>
		<TD class="search_table_data" style="text-align: center;">&nbsp;
			<SELECT class='input_select' id='EXIISTREFYN1' name='EXIISTREFYN1' style='width:50%;height=18;' onchange="setGs(1);">
				<OPTION value='Y' <%=contOutWarr.get("EXIISTREFYN").equals("Y") ? "selected=selected":""%>>반영</OPTION>
				<OPTION value='N' <%=contOutWarr.get("EXIISTREFYN").equals("N") ? "selected=selected":""%>>미반영</OPTION>
			</SELECT><br>
			<%= InputText.get("ADDEXISAMT1", contOutWarr.get("ADDEXISAMT"), 60, 30, "number, right, PerSize, readOnly", "number") %>		
		</TD>
	</TR>
<%
	}
%>
</TABLE>

<table width="100%" style="margin-top:3px;">
	<tr>
		<TD height="5" style="text-align: left;">※ 하도급 계약정보</font> </TD>
	</tr>
</table>
<TABLE cellspacing="1" cellpadding="0" class="search_table" style="margin-top:3px;">
	<colgroup>
		<col width="120" />
		<col width="*" />
		<col width="120" />
		<col width="*" />
	</colgroup>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">현장명</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("deptName", contOutWarr.get("SITE_NAME"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
		<TH class="search_table_title" style="text-align: left;">계약명</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("deptName", contOutWarr.get("CONT_NAME"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">하도급 계약번호</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("CONT_GNO", contOutWarr.get("CONT_GNO"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
		<TH class="search_table_title" style="text-align: left;">업체명</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("memberName", contOutWarr.get("CUST_NAME"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">사업자번호</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("SITE_GNO", contOutWarr.get("SITE_GNO"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
		<TH class="search_table_title" style="text-align: left;">계약금액</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("CONT_CAMT", contOutWarr.get("CONT_CAMT"), 40, 30, "class=input_blank ,number, right, readOnly=white", "number") %></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">계약시작일자</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("cont_sdate", contOutWarr.get("cont_sdate"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
		<TH class="search_table_title" style="text-align: left;">계약종료일자</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("cont_edate", contOutWarr.get("cont_edate"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">기성지급주기</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("gs_day", contOutWarr.get("gs_day"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
		<TH class="search_table_title" style="text-align: left;">당초지급보증서번호</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("last_wgno", contOutWarr.get("last_wgno"), 40, 30, "class=input_blank, readOnly=white, string, left, tabIndex=-1", "string") %></TD>
	</TR>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">기성검사일(당초)</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("contcheckdate", contOutWarr.get("contcheckdate"), 40, 30, "class=input_blank, readOnly=white, date, left, tabIndex=-1", "date") %></TD>
		<TH class="search_table_title" style="text-align: left;">기성금액(당초)</TH>
		<TD class="search_table_data" style="text-align: left;margin-left:10px;">&nbsp;<%= InputText.get("contexistenceamt", contOutWarr.get("contexistenceamt"), 40, 30, "class=input_blank ,number, right, readOnly=white", "number") %></TD>
	</TR>
</TABLE>

<table width="100%" style="margin-top:3px;">
	<tr>
		<TD height="5" style="text-align: left;">※ 건설담당자</font> </TD>
	</tr>
</table>
<TABLE cellspacing="1" cellpadding="0" class="search_table" style="margin-top:3px;display:">
	<colgroup>
		<col width="120" />
		<col width="120" />
		<col width="120" />
		<col width="120" />
		<col width="*" />
	</colgroup>
	<TR height="25"> 
		<TH class="search_table_title" style="text-align: left;">부서명</TH>
		<TH class="search_table_title" style="text-align: left;">성명</TH>
		<TH class="search_table_title" style="text-align: left;">전화번호</TH>
		<TH class="search_table_title" style="text-align: left;">휴대전화</TH>
		<TH class="search_table_title" style="text-align: left;">이메일</TH>
	</TR>
	<TR height="25">
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("depnm", contOutWarr.get("depnm"), 90, 20, "string, left, PerSize", "string") %></TD>
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("empnm", contOutWarr.get("empnm"), 90, 20, "string, left, PerSize", "string") %></TD>
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("telno", contOutWarr.get("telno"), 90, 20, "string, left, PerSize", "string") %></TD>
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("hpno", contOutWarr.get("hpno"), 90, 20, "string, left, PerSize", "string") %></TD>
		<TD class="search_table_data" style="text-align: center;"><%= InputText.get("email", contOutWarr.get("email"), 90, 40, "string, left, PerSize", "string") %></TD>

	</TR>
</TABLE>

<TABLE cellspacing="1" cellpadding="0" class="search_table" style="margin-top:10px;display:">
	<colgroup>
		<col width="120" />
		<col width="*" />
	</colgroup>
	<TR height="25">
		<TH class="search_table_title" style="text-align: left;">구비서류</TH>
		<TD class="search_table_data" style="text-align: left;">&nbsp;<TEXTAREA name="p_AttachFileGuar1" id="p_AttachFileGuar1" style="width:85%;height:80px" rows="1" class="input" readOnly><%=attFile.get("fileRow") %></TEXTAREA>
			<IMG id='search_spot_button' onClick="doAttachFile(document.form1.subContModId,1);" src='/img/buyer/button/bt_change.gif' border='0'  align="top" align='absmiddle' alt='[Attach File]' style='cursor:pointer;'>
		</TD>
	</TR>				
</TABLE>
</FORM>
<%if(contOutWarr.get("EXIST_FLAG").equals("I")){ %>
<script type="text/javascript">
<!--
	//처음 저장일때만 처리
	setGuarRate(1, "GUARRATEGBNCODE");
	<%if (params.get("CAUSECODE").equals("04")){%>
	setGuarRate(2, "GUARRATEGBNCODE");		//연장증액이 한번에 올경우 한번에 처리 하기 위해서 한번더 호출
	<%} %>
//-->
</script>
<%} %>
<br/>