<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="com.udapsoft.waf.system.HandlerStorage" %>
<%@ page import="kr.co.hsnc.common.config.WAFConfig"%>
<%@ page import="kr.co.hsnc.common.sql.*" %>
<%@ page import="kr.co.hsnc.common.util.*"%>
<%@ page import="com.udapsoft.waf.common.ui.*" %>
<jsp:useBean id="ctx" class="com.udapsoft.waf.system.context.SessionContext" scope="session" />
<%
    ctx.init(request, response);
    HandlerStorage storage = ctx.getHandlerStorage();

    ValueObject signInfo = storage.getValueObject("SignInfo");
    ValueObject params = storage.getParams();
    String gwURL = WAFConfig.get("gw.url.address");
%>

<%  if( storage.getSuccess() ) { 

	System.out.println("ORGID===="+signInfo.get("ORGID"));
	System.out.println("ORGKEY===="+signInfo.get("ORGKEY"));
	System.out.println("COMID===="+signInfo.get("COMID"));
	System.out.println("EMPNO===="+signInfo.get("EMPNO"));
	System.out.println("FORMID===="+signInfo.get("FORMID"));
	System.out.println("BODY===="+signInfo.get("BODY"));
%>

<FORM name="form1" method="post">
<INPUT type="hidden" name="ORGID"  value="<%= signInfo.get("ORGID")  %>"><br>
<INPUT type="hidden" name="ORGKEY" value="<%= signInfo.get("ORGKEY") %>"><br>
<INPUT type="hidden" name="COMID"  value="<%= signInfo.get("COMID")  %>"><br>
<INPUT type="hidden" name="EMPNO"  value="<%= signInfo.get("EMPNO")%>"><br>
<INPUT type="hidden" name="FORMID" value="<%= signInfo.get("FORMID")  %>"><br>
<TEXTAREA name="BODY" cols="100" rows="10" style="display:none"></TEXTAREA>
<DIV id="body_div" style="display:none">
<%= signInfo.get("BODY") %>
</DIV>
</FORM>
<SCRIPT language="JavaScript">
	
	
	function doSend() {
	    var f = document.form1;
	    
	    /*
	    try {
	    	opener.doSearch();
	    }
	    catch(errorObject) {
	    	alert("결재상신 페이지를 Reload 할 수 없습니다.");
	    }
	    */

		f.BODY.value = document.all.body_div.innerHTML;
		f.action = "<%=gwURL%>?ORGID=ERP&ORGKEY="+f.ORGKEY.value+"&COMID=TEC&EMPNO="+f.EMPNO.value+"&FORMID="+f.FORMID.value+"&APP_DOCID=";
		
		//ORGID=ERP&ORGKEY=SIGN_INTERFACE_ID&COMID=TEC&EMPNO=사번&FORMID=expensecall2&APP_DOCID=
		f.submit();
	}
	doSend();
</SCRIPT>

<%  }
    else { %>

<SCRIPT language="JavaScript">
	/* function dlgAlert( msg, varWidth, varHeight ){
		var dlgWidth = 350;
		var dlgHeight  = 180;
	
		if( varWidth != null )
			dlgWidth = varWidth;
	
		if( varHeight != null )
			dlgHeight = varHeight;
	
		window.showModalDialog('/lib/dlgAlert.screen', msg,'dialogWidth:' + dlgWidth + 'px;dialogHeight:' + dlgHeight + 'px; center:yes; help:no; status:no; scroll:no; resizable:no');
	} */
	alert("<%= storage.getMessage() %>");
	self.close();
</SCRIPT>

<%  } %>