<%--
  - Author(s)  : Kim Myung Ho
  - Date       : 2014.11.20
  - Description: 하도급 대금지급 보증 책인 소멸 / 확인 목록
--%>
  
<%@page import="java.sql.Clob"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<%@ page import="com.udapsoft.waf.common.util.*" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ include file="/jsp/work/taglib.jsp" %>
<%@ page import="kr.co.udapsoft.ebid.buyer.common.file.FileManager"%>
<%@page import="java.net.URLEncoder"%>
<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();

    ValueObject ContInfo = storage.getValueObject("ContInfo");
    String RTN_REASON = "";
    boolean rtn = false;
    if(ContInfo.get("RTN_REASON").length() > 0){
    	RTN_REASON = ContInfo.get("RTN_REASON");
    	rtn = true;
    }

    /*계약서식 정보 START*/
    ValueObject templateInfo = storage.getValueObject("template");
    /*계약서식 정보 END*/
    
    /*보증 상세 정보*/
    ValueObject WarrContInfo = storage.getValueObject("WarrContInfo");
    
%>
<LINK href="/css/cont/cont_style.css" rel="stylesheet" type="text/css">
<script language="javascript" src="/js/cont/cont_util.js"></script>
<script language="javascript" src="/js/cont/lib.validate.js"></script>
<SCRIPT language="JavaScript">
/*예약함수*/
var sheet1;
var sheet1Row;
var sheet1PageNo = 1;
var pageLastRowIndex = 1;
var validationResult = false;
var filterShow = false;

	function _onReady(){
		/**
		 *	Application Initialize
		 */
		$("#btnSave").click(function() {
			if(!chkContHtml()){
				return;
			}
			if (confirm("저장 하시겠습니까?")){
				var f = document.form1;
				jQuery("#fevent").val("FORM_SAVE");
				submitXmlRequest("/cont/outside/PayGuarDetail_form.screen", "FORM_SAVE", f);
			}
		});
		
		//변경계약 삭제
		$("#btnDel").click(function() {			
			if (confirm("서식을  삭제 하시겠습니까?")){
				var f = document.form1;
				jQuery("#fevent").val("FORM_DEL");
				submitXmlRequest("/cont/outside/PayGuarDetail_form.screen", "FORM_DEL", f);
			}
		});	
		
		$("#btnSignCall").click(function() {
			if (confirm("업체에 서명 요청 하시겠습니까?")){
				var f = document.form1;
				jQuery("#fevent").val("SIGN_CALL");
				submitXmlRequest("/cont/outside/PayGuarDetail_form.screen", "SIGN_CALL", f);
			}
		});
		
		$("#btnSignOk").click(function() {
			if (confirm("서명  하시겠습니까?")){
				var f = document.form1;
				jQuery("#fevent").val("SIGN_OK");
				submitXmlRequest("/cont/outside/PayGuarDetail_form.screen", "SIGN_OK", f);		
			}
		});			

	}

	function ck(){
		if($("#ELEC_CON_YN1").attr("checked") == "checked"){
			return false;	
		}
		if($("#ELEC_CON_YN2").attr("checked") == "checked"){
			return false;
		}
		return true;
	}
	
	function sheet1_OnSearchEnd(code, message) {
	    if(code == 0) {
	    	setGridSize();
	    	for(var i=1;i <= sheet1.RowCount();i++){
	    		if(sheet1.GetCellValue(i,"INFO_YN") == "N"){
	    			sheet1.SetCellFontColor(i,10,"#FF0000");
	    		}else{
	    			sheet1.SetCellFontColor(i,10,"#0100FF");
	    		}
	    	}
	    	
	    	
		} else {
			//조회 에러 수행
			alert(message);
		}
	}
	
	
	
	/**
	 *	IBSheet size setting
	 */
	function setGridSize() {
		sheet1.FitColWidth();
	}
	
	
	//자동로그인 기능
	function f_gologin(login_id,login_pw){
		var f = document.form1;
		if('<%= user.get("ACCT_TYPE_CODE")%>' != "ADMIN"){
			dlgAlert("User who logged in as administrator only can do automatic log-in.");
			return;
		}
	
		f.login_id.value = login_id;
		f.login_pw.value = login_pw;
	
		if( !submitXmlRequest("/sign_on_check", "", document.form1) ) {
			alert("Log-in is being processed.");
		};
	
	}

	function goListProc(){
		 var f = document.form1;
		f.fevent.value ="";
	    f.action = "/cont/outside/PayGuarList.screen";
	    f.target = "_self";
	    f.submit();
	}

	function doResult(resultObj) {
		try {
			if( resultObj.getRequestEvent() == "FORM_SAVE") {
				if( resultObj.getSuccess() ) {
					alert("서식저장에 성공하였습니다.");
 					goListProc();
				}
				else {
					dlgErrorMsg(resultObj);
				}
			}
			
			//서식 삭제
			if( resultObj.getRequestEvent() == "FORM_DEL") {
				if( resultObj.getSuccess() ) {
					alert("정상적으로 삭제 처리 되었습니다.")
					goListProc();
				} else {
					dlgErrorMsg(resultObj);
				}
			}			
			if( resultObj.getRequestEvent() == "SIGN_CALL") {
				if( resultObj.getSuccess() ) {
					alert("서명 요청이 정상적으로 처리 되었습니다.")
					window.location.reload();
				} else {
					dlgErrorMsg(resultObj);
				}
			}
			
			if( resultObj.getRequestEvent() == "SIGN_OK") {
				if( resultObj.getSuccess() ) {
					alert("서명 정상적으로 처리 되었습니다.")
					window.location.reload();
				} else {
					dlgErrorMsg(resultObj);
				}
			}
			document.form1.isSubmit = false;
		}
		catch(errorObject) {
			showErrorDlg("doResult()", errorObject);
		}
	}
	

	/*담당자 호출*/	
	function SearchUser(NAME,CODE){
		var win_id = "_searchUserPopup";
		var link = "/lib/dlgSearchUserPop.screen";
		    link += "?pop_win_id="+win_id;
		    link += "&deptNameYn=outside";
			link += "&NAME=" + NAME;
			link += "&CODE=" + CODE;
			
		fLayerPop(win_id, link, 700,400, '', '', 'NO');
	}
	/*담당자 호출 Return Value 처리*/	
	function SearchUserClose(result){
		if(result.length > 0){
			$("#O_USER_NAME").val(result[1]);
			$("#O_DIVISION").val(result[3]);
			$("#O_POSITION").val(result[5]);
			$("#O_TEL_NUM").val(result[6]);
			$("#O_HP").val(result[7]);
			$("#O_EMAIL").val(result[8]);
		}
		fLayerPopClose('_searchUserPopup');
	}	

	/*서식 pdf script start*/
	function chkContHtml(){
		var f = document.form1;
		if(validate(f)){
			splitHtml(f, 'cont_html', false, 1);
			splitHtml(f, 'cont_html_rm', true, 1);
			
			return true;
		}
		return false;
	}
	/*서식 pdf script end*/	

	//첨부파일   
	function doAttachFile(obj) {
		 if(obj==''){
			alert("저장을 한 후 파일을 첨부할 수 있습니다.");
		}
		else if(obj != ''){ 
			viewFileListNew('SUB_CONT_MOD_ID', obj.value, document.getElementById("p_AttachFile1"), "Y", "cont/outside/<%=ContInfo.get("SUB_CONT_MOD_ID")%>");
		} 
	}
	/**
	 * 첨부파일 예약 함수
	 */
	function fileDown(file_id){
			var url="/common/file/FileDownloadServlet";
	 		url += "?file_id=" + file_id;
	 		
	 		window.open(url, "_fileDown", "toolbar=no, width=400, height=100, top=500, left=400, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=new")
	}	
</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="<%= params.get("fevent") %>">
<INPUT type="hidden" name="acct_id" value="<%= params.get("acct_id") %>">
<!-- 검색 조건 시작-->
<INPUT type="hidden" name="p_dept_cd" value="<%= params.get("p_dept_cd") %>">
<INPUT type="hidden" name="p_dept_nm" value="<%= params.get("p_dept_nm") %>">
<INPUT type="hidden" name="p_dealer_nm" value="<%= params.get("p_dealer_nm") %>">
<INPUT type="hidden" name="p_cont_status" value="<%= params.get("p_cont_status") %>">
<INPUT type="hidden" name="ContFromDt" value="<%= params.get("ContFromDt") %>">
<INPUT type="hidden" name="ContToDt" value="<%= params.get("ContToDt") %>">
<INPUT type="hidden" name="p_build_nm" value="<%= params.get("p_build_nm") %>">
<!-- 검색 조건 끝-->
<INPUT type="hidden" name="CONT_STATUS" value="<%=ContInfo.get("CONT_STATUS")%>">
<INPUT type="hidden" name="SUB_CONT_MOD_ID" value="<%=ContInfo.get("SUB_CONT_MOD_ID")%>">
<INPUT type="hidden" name="O_CORP_ID" value="<%=ContInfo.get("O_CORP_ID")%>">
<INPUT type="hidden" name="C_CORP_ID" value="<%=ContInfo.get("C_CORP_ID")%>">

<INPUT type='hidden' name="WARR_SEQ" value="<%= params.get("WARR_SEQ") %>">
<INPUT type='hidden' name="PAGE_SEQ" value="<%= templateInfo.get("PAGE_SEQ") %>">
<INPUT type='hidden' name="CONT_HASH" value="<%= templateInfo.get("CONT_HASH") %>">

<!-- 서식PDF정보  START-->
<INPUT type="hidden" name="TEMPLATE_CD" value="<%=params.get("TEMPLATE_CD") %>">
<INPUT type="hidden" name="CON_DOC_NO" value="<%=ContInfo.get("CON_DOC_NO") %>">
<INPUT type="hidden" name="MOD_NO" value="<%=ContInfo.get("MOD_NO") %>">
<INPUT type="hidden" name="PDF_FILE_CNT" value="1">
<!-- 서식PDF정보  END-->

	<!-- 제목 및 버튼 -->
<table width="100%">
	<colgroup>
		<col width="500" />
		<col width="*" />
	</colgroup>
	<tr>
	   	<th>
		   <div align="left" id="title">
		    <ul>
		     <li>외주_하도급 대금 지급 소멸/수령확인</li>
		    </ul>
		   </div>
	   </th>
	   <td align="right">
		<%
		if((templateInfo.get("STATUS_CD").equals("10")) || (templateInfo.get("STATUS_CD").isEmpty())){	//변경계약일경우 변경내역 팝업 
		%>
			<span class="btnSearch center" id="btnSave"><a href="javascript:void(0);">저장</a></span>
		<%
		}
		if(templateInfo.get("STATUS_CD").equals("10")){
		%>
			<span class="btnSearch center" id="btnSignCall"><a href="javascript:void(0);">업체 서명요청</a></span>
			<span class="btnSearch center" id="btnDel"><a href="javascript:void(0);">서식삭제</a></span>
		<%
		}
		if(templateInfo.get("STATUS_CD").equals("30")){
		%>
			<span class="btnSearch center" id="btnSignOk"><a href="javascript:void(0);">서명</a></span>
		<%
		}
		%>
			<span class="btnSearch center" id="btnList"><a href="javascript:goListProc();">목록</a></span>
	   </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="120px" />
		<col width="24%"/>
		<col width="120px" />
		<col width="24%"/>
		<col width="120px" />
		<col/>
	</colgroup>
  <TR height="25"> 
    <TH>현장명</TH>
	<TD><%=ContInfo.get("DEPT_NAME")%></TD>
	<TH>발주의뢰번호</TH>
	<TD><%=ContInfo.get("DEMANDED_NO")%></TD>
	<TH>발주의뢰자</TH>
	<TD><%= ContInfo.get("EMP_NM")%></TD> 	
  </TR>
  <TR height="25"> 
	<TH>발주의뢰일</TH>
	<TD><%= ContInfo.get("DEMANDED_DATE")%></TD> 
	<TH>발주의뢰부서</TH>
	<TD><%= ContInfo.get("REQ_DEPT_NM")%></TD>
	<TH>공종</TH>
	<TD><%= ContInfo.get("OUT_ITEM_NM")%></TD>	
  </TR> 	
  <TR height="25"> 
	<TH>계약명</TH>
	<TD colspan="3"><%= ContInfo.get("BUILD_NAME")%></TD>
	<TH>통화구분</TH>
	<TD><%=ContInfo.get("CON_CUR_CD")%><INPUT TYPE="hidden" name="sosuNum" ID="sosuNum" value="<%= ContInfo.get("SOSUNUM")%>"></TD> 			
  </TR>	
  <TR height="25"> 
	<TH>전자계약 여부</TH>
	<TD colspan="3"> 
		<%=ContInfo.get("ELEC_CON_YN").equals("Y") ? "온라인" : "오프라인" %>
	</TD>
	<TH>계약번호</TH>
	<TD><%=ContInfo.get("CON_DOC_NO")%></TD> 			
  </TR>
</TABLE>

<div class="application-info  magT10">
	<div class="application-sub-title">
		<span class="title">당사정보(원사업자) </span>
	</div>
	<div class="application-location">
	<%if (!templateInfo.get("O_SIGN_DATE").equals("")){%> 
		서명일시 : <%= templateInfo.get("O_SIGN_DATE") %> 
	<%}%>		
	</div>
</div>
<TABLE class="form-table">
	<colgroup>
		<col width="120px" />
		<col width="24%"/>
		<col width="120px" />
		<col width="24%"/>
		<col width="120px" />
		<col/>
	</colgroup>
  <TR height="25"> 
	<TH>업체명</TH>
	<TD colspan="3"><%= ContInfo.get("O_MEMBER_NAME")%></TD>   
	<TH>대표자명</TH>
	<TD><%= ContInfo.get("O_BOSS_NAME")%></TD> 	
  </TR>
  <TR height="25"> 
	<TH>주소</TH>
	<TD colspan="3"><%= ContInfo.get("O_ADDRESS")%></TD> 
	<TH>승인자</TH>
	<TD><%= ContInfo.get("CON_CONFIRM_NAME")%></TD>    
  </TR>
  <TR height="25"> 
	<TH>담당부서</TH>
	<TD><%= ContInfo.get("O_DIVISION")%></TD>    
	<TH>담당자명</TH>
	<TD><%= ContInfo.get("O_USER_NAME")%></TD>         
	<TH>직급</TH>
	<TD><%= ContInfo.get("O_POSITION")%></TD>
  </TR>
  <TR height="25"> 
	<TH>담당자 연락처</TH>
	<TD><%= ContInfo.get("O_TEL_NUM")%></TD>
 	<TH>담당자 HP</TH>
	<TD><%= ContInfo.get("O_HP")%></TD>
	<TH>담당자 EMAIL</TH>
	<TD><%= ContInfo.get("O_EMAIL")%></TD> 	
  </TR>  
  <!-- 계약정보 : 종료 -->
</table>
   
<div class="application-info  magT10">
	<div class="application-sub-title">
		<span class="title">계약업체정보(수급 사업자) </span>
	</div>
	<div class="application-location">
	<%if (!templateInfo.get("C_SIGN_DATE").equals("")){%> 
		서명일시 : <%= templateInfo.get("C_SIGN_DATE") %> 
	<%}%>
	</div>
</div>
<TABLE class="form-table">
	<colgroup>
		<col width="120px" />
		<col width="24%"/>
		<col width="120px" />
		<col width="24%"/>
		<col width="120px" />
		<col/>
	</colgroup>
  <TR height="25"> 
	<TH>업체명</TH>
	<TD colspan="3"><%= ContInfo.get("C_MEMBER_NAME")%></TD>    
	<TH>대표자명</TH>
	<TD><%= ContInfo.get("C_BOSS_NAME")%></TD> 	
  </TR>
  <TR height="25"> 
	<TH>주소</TH>
	<TD colspan="5"><%= ContInfo.get("C_ADDRESS")%></TD>  
  </TR>
  <TR height="25"> 
	<TH>담당부서</TH>
	<TD><%= ContInfo.get("C_DIVISION")%></TD>        
	<TH>담당자명</TH>
	<TD><%= ContInfo.get("C_USER_NAME")%></TD>          
	<TH>직급</TH>
	<TD><%= ContInfo.get("C_POSITION")%></TD>
  </TR>
  <TR height="25"> 
	<TH>담당자 연락처</TH>
	<TD><%= ContInfo.get("C_TEL_NUM")%></TD>
 	<TH class="required">담당자 HP</TH>
	<TD><%= ContInfo.get("C_HP")%></TD>
	<TH>담당자 EMAIL</TH>
	<TD><%= ContInfo.get("C_EMAIL")%></TD> 	
  </TR>  
  <!-- 계약정보 : 종료 -->
</table>

<div class="application-info  magT10">
	<div class="application-sub-title">
		<span class="title">서식 정보</span>
	</div>
	<div style="text-align:center;">
    	<font color="ffffff">......</font>
    	※<span style="background-color:yellow;text-align:center">노랑색</span>은 필수입력사항, <span style="text-align:center;background-color:#CCFF99;">연두색</span>은 계약서에 인쇄되지 않는 항목입니다.
	</div>
</div>

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid black;margin:5px 0px 5px 0px;">
	<tr>
		<td align="center" bgcolor="#efefef">
			<table width="770px" border="0" cellspacing="0" cellpadding="0">
				<tr>
				  <td align="center">
				  		<input type="hidden" name="template_seq" value="<%=templateInfo.get("SEQ")%>">
				  		<input type="hidden" name="template_name" value="<%=templateInfo.get("TEMPLATE_NAME")%>">
				  		<input type="hidden" name="template_style" value="<%=templateInfo.get("TEMPLATE_STYLE")%>">
				  		<input type="hidden" name="option_yn" value="<%=templateInfo.get("OPTION_YN")%>">
						<span class="tab_on" id="tab_<%=templateInfo.get("SEQ")%>" onClick="tabView(<%=templateInfo.get("SEQ")%>)">
							<input type="hidden" name="check_yn_<%=templateInfo.get("SEQ")%>" value="A">
							<%=templateInfo.get("TEMPLATE_NAME")%>
						</span>
				  </td>
				</tr>
			</table>
			<div id="__html" style="width:770px;border:1px solid black;padding:10px 10px 10px 10px;background-color:#FFFFFF;text-align:left;" >
				<%
	  				String template_html = ClobUtils.getClob((Clob)templateInfo.getObject("TEMPLATE_HTML")); 
	  				String divHidden = templateInfo.get("SEQ").equals("0")?"":"none";
		  		%>
		  		<div style="display:<%=divHidden%>; padding-top: 10px;overflow:hidden;overflow-y:auto;<%=templateInfo.get("TEMPLATE_STYLE") %>" id="__html_<%=templateInfo.get("SEQ")%>">
				<%= template_html%>
				</div>
			</div>
			<br />
		</td>
	</tr>
</table>			
<%
if (!templateInfo.get("FILE_PATH").isEmpty()){
%>
<div class="application-info magT15">
	<div class="application-sub-title">
		<span class="title">서식 서류</span>
	</div>
</div>
<TABLE class="form-table">
	<colgroup>
		<col width="120px" />
		<col/>
	</colgroup>
  <TR height="25">
  	<TH>자동생성</TH>
	<TD>
		<table width="100%">
    		<colgroup>
	    		<col width="100%" />
    		</colgroup>		
			<TR height="25">
				<TD>
					<div id="auto_attach_file_view" class="attach_file_view">
						<ul>
						<li><a href="/common/file/FileDownloadServlet?mode=fpDown&filePath=/cont/<%=templateInfo.get("FILE_PATH")%>&fileName=<%=URLEncoder.encode(templateInfo.get("TEMPLATE_NAME"), "UTF-8") +"."+ templateInfo.get("FILE_EXT")%>&fileRealName=<%=templateInfo.get("UNIQUE_FILE_NAME")%>"><%=templateInfo.get("TEMPLATE_NAME")%> (<%=templateInfo.get("FILE_SIZE").trim() %>)</a></li>
						</ul>
					</div>
				</TD>
			</TR>
		</TABLE>
	</TD>	
  </TR>
 </TABLE>
<%
}
%>

</form>


<script>
<%
if((templateInfo.get("STATUS_CD").equals("20")) || (templateInfo.get("STATUS_CD").equals("30")) || (templateInfo.get("STATUS_CD").equals("50"))){
%>
	window.onload = function() {  
		convertHtml();
	};	
	function convertHtml(){
		if(!document.getElementById("__html"))return;
		var elements = document.getElementById("__html").getElementsByTagName("input");
		for(var i = 0; i < elements.length; i++){
			var element = elements[i];
			setDisabled(element);
		}
		var elements = document.getElementById("__html").getElementsByTagName("textarea");
		for(var i = 0; i < elements.length; i++){
			var element = elements[i];
			element.className = "input_readonly";
			element.readOnly = true;
		}
		var elements = document.getElementById("__html").getElementsByTagName("img");
		for(var i = 0; i < elements.length; i++){
			var element = elements[i];
			element.style.display="none";
		}
		/*협력사에서 안보이는 부분숨기는 처리*/
		var elements = getElementsByClass("cl_no_view");
		for(var i = 0; i < elements.length; i++){
			var element = elements[i];
			element.style.display="none";
		}
	}
<%
}else{ //작성중일경우
	if(!(templateInfo.get("STATUS_CD").equals("10"))){
%>
		//계약일자
		<%
			String con_date_year = ""; 
			String con_date_month = "";
			String con_date_day = "";
			if(!ContInfo.get("CON_DATE").equals("")){
				con_date_year = ContInfo.get("CON_DATE").replaceAll("-","").substring(0,4);
				con_date_month = ContInfo.get("CON_DATE").replaceAll("-","").substring(4,6);
				con_date_day = ContInfo.get("CON_DATE").replaceAll("-","").substring(6,8);
			}
		%>
		replaceInput("<%=con_date_year%>","con_date_year",__html);
		replaceInput("<%=con_date_month%>","con_date_month",__html);
		replaceInput("<%=con_date_day%>","con_date_day",__html);
		
		//공사기간
		<%
			String start_work_date_year = ""; 
			String start_work_date_month = "";
			String start_work_date_day = "";
			if(!ContInfo.get("START_WORK_DATE").equals("")){
				start_work_date_year = ContInfo.get("START_WORK_DATE").replaceAll("-","").substring(0,4);
				start_work_date_month = ContInfo.get("START_WORK_DATE").replaceAll("-","").substring(4,6);
				start_work_date_day = ContInfo.get("START_WORK_DATE").replaceAll("-","").substring(6,8);
			}
			
			String end_work_date_year = ""; 
			String end_work_date_month = "";
			String end_work_date_day = "";
			if(!ContInfo.get("END_WORK_DATE").equals("")){
				end_work_date_year = ContInfo.get("END_WORK_DATE").replaceAll("-","").substring(0,4);
				end_work_date_month = ContInfo.get("END_WORK_DATE").replaceAll("-","").substring(4,6);
				end_work_date_day = ContInfo.get("END_WORK_DATE").replaceAll("-","").substring(6,8);
			}
			
		%>
		replaceInput("<%=start_work_date_year%>","start_work_date_year",__html);
		replaceInput("<%=start_work_date_month%>","start_work_date_month",__html);
		replaceInput("<%=start_work_date_day%>","start_work_date_day",__html);
		replaceInput("<%=end_work_date_year%>","end_work_date_year",__html);
		replaceInput("<%=end_work_date_month%>","end_work_date_month",__html);
		replaceInput("<%=end_work_date_day%>","end_work_date_day",__html);
		
		//나머지 계약정보
		replaceInput("<%=ContInfo.get("CON_DOC_NO")%>","con_doc_no",__html);// 계약번호
		replaceInput("<%=ContInfo.get("DEPT_NAME")%>","dept_name",__html);//현장명
		replaceInput("<%=ContInfo.get("DEALER_NM")%>","dealer_nm",__html);//발주처
		replaceInput("<%=ContInfo.get("BUILD_NAME")%>","build_name",__html);//계약명
		replaceInput("<%=ContInfo.get("DEPT_NAME")%> 중 <%=ContInfo.get("BUILD_NAME")%>","dept_build_name",__html);//현장 계약명
		replaceInput("<%=ContInfo.get("UND_CON_NAME")%>","und_con_name",__html);//원도급공사명
		replaceInput("<%=ContInfo.get("SUB_UND_CON_NAME")%>","sub_und_con_name",__html);//하도급공사명
		replaceInput("<%=ContInfo.get("WORK_PLACE")%>","work_place",__html);//공사장소
		replaceInput("<%=ContInfo.get("PAY_WAY_CASH")%>","pay_way_cash",__html);//지급방법 현금
		replaceInput("<%=ContInfo.get("PAY_WAY_BILL")%>","pay_way_bill",__html);// 지금방법 어음
		replaceInput("<%=ContInfo.get("CON_AMT")%>","con_amt",__html);// 계약금액
		replaceInput("<%=ContInfo.get("CON_SUPPLY_AMT")%>","con_supply_amt",__html);// 공급가액
		replaceInput("<%=ContInfo.get("CON_SUPPLY_TAMT")%>","con_supply_tamt",__html);// 공급가액 과세
		replaceInput("<%=ContInfo.get("CON_SUPPLY_NAMT")%>","con_supply_namt",__html);// 공급가액 비과세
		replaceInput("<%=ContInfo.get("CON_SURTAX_AMT")%>","con_surtax_amt",__html);// 계약부과세
		
		//보증정보
		replaceInput("<%=WarrContInfo.get("WARR_WAMT")%>","warr_wamt",__html);
		replaceInput("<%=WarrContInfo.get("WARR_WGNO")%>","warr_wgno",__html);
		replaceInput("<%=WarrContInfo.get("CONTEXISTENCEAMT")%>","contexistenceamt",__html);
		
		
		// 본사정보
		replaceInput("<%=ContInfo.get("O_MEMBER_NAME")%>", "o_member_name", __html);
		replaceInput("<%=ContInfo.get("O_ADDRESS")%>", "o_address", __html);
		replaceInput("<%=ContInfo.get("O_BOSS_NAME")%>", "o_boss_name", __html);
		replaceInput("<%=ContInfo.get("O_DIVISION")%>", "o_division", __html);
		replaceInput("<%=ContInfo.get("O_USER_NAME")%>", "o_user_name", __html);
		replaceInput("<%=ContInfo.get("O_POSITION")%>", "o_position", __html);
		replaceInput("<%=ContInfo.get("O_TEL_NUM")%>", "o_tel_num", __html);
		replaceInput("<%=ContInfo.get("O_HP")%>", "o_hp", __html);
		replaceInput("<%=ContInfo.get("O_EMAIL")%>", "o_email", __html);
		// 업체정보
		replaceInput("<%=ContInfo.get("C_MEMBER_NAME")%>", "c_member_name", __html);
		replaceInput("<%=ContInfo.get("C_ADDRESS")%>", "c_address", __html);
		replaceInput("<%=ContInfo.get("C_BOSS_NAME")%>", "c_boss_name", __html);
		replaceInput("<%=ContInfo.get("C_DIVISION")%>", "c_division", __html);
		replaceInput("<%=ContInfo.get("C_USER_NAME")%>", "c_user_name", __html);
		replaceInput("<%=ContInfo.get("C_POSITION")%>", "c_position", __html);
		replaceInput("<%=ContInfo.get("C_TEL_NUM")%>", "c_tel_num", __html);
		replaceInput("<%=ContInfo.get("C_HP")%>", "c_hp", __html);
		replaceInput("<%=ContInfo.get("C_EMAIL")%>", "c_email", __html);
<%
	}
%>		
		//한글로 변환할 금액, 금액 콤마처리
		var f = document.forms["form1"];
		if(f['kMoney']){
			var keyList = f['kMoney'].value.split(",");
			for(var keySeq = 0 ; keySeq < keyList.length ; keySeq ++){
				var key = keyList[keySeq];
				fSetKoreanMoney(f[key].value, 'spn_'+key);
				replaceInput(fnMakeComma2(f[key].value),key,__html)
			}
		}
		
		if(f['comma']){
			var keyList = f['comma'].value.split(",");
			for(var keySeq = 0 ; keySeq < keyList.length ; keySeq ++){
				var key = keyList[keySeq];
				replaceInput(fnMakeComma2(f[key].value),key,__html)
			}
		}
<%
}
%>
</script>
