<%--
    Document   : DepositKYCDocumentUpload
    Created on : Sep 29, 2016, 12:05:56 PM
    Author     : 986137
--%>

<%@page import="DataEntryBean.DepositKYCCreationHdrBean"%>
<%@page import="DataEntryBean.DepositKYCCreationDetailBean"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="LoginDb.DbHandler"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="java.sql.Connection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="java.util.UUID" %>
<%String uuid = UUID.randomUUID().toString();%>
<% try {
%>







<html>
    <head>
        <title>KYC Document Upload</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/styles.css?pacs=<%=((new java.util.Date()).getTime())%>"/>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/info.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>
    </head>
    <body  onload="noBack()">

        <script type="text/javascript">
            function noBack()
            {
                window.history.forward();
            }

            function popup_CIF(width, height, cifNumber, cifName) {


                if (window.innerWidth) {
                    LeftPosition = (window.innerWidth - width) / 2;
                    TopPosition = ((window.innerHeight - height) / 2) - 20;
                }
                else {
                    LeftPosition = (parseInt(window.screen.width) - width) / 2;
                    TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                }
                attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                    height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                    TopPosition + '';
                var screenName = "DepositKYCDocumentUpload.jsp";
                var  lovKey="PickUPCustomer";
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationDepositLOV.jsp?cifName=' + cifName + '&cifNumber=' + cifNumber + '&screenName=' + screenName+'&lovKey='+lovKey, 'PickUPCustomer', attr);
                popWin.focus();
            }

            function popup_CIFNAME(width, height, cifName, cifNumber) {


                if (window.innerWidth) {
                    LeftPosition = (window.innerWidth - width) / 2;
                    TopPosition = ((window.innerHeight - height) / 2) - 20;
                }
                else {
                    LeftPosition = (parseInt(window.screen.width) - width) / 2;
                    TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                }
                attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                    height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                    TopPosition + '';
                var screenName = "DepositKYCDocumentUpload.jsp";
                var  lovKey="PickUPCustomer";
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationDepositLOV.jsp?cifName=' + cifName + '&cifNumber=' + cifNumber + '&screenName=' + screenName+'&lovKey='+lovKey, 'PickUPCustomer', attr);
                popWin.focus();
            }

            function submitform(kycDocumentUploadForm)
            {
                if (kycDocumentUploadForm.cifNumber.value == "" && kycDocumentUploadForm.cifName.value == "")
                {
                    alert("!! All the Search Fields are Empty !!");
                    return false;
                }
                document.forms[0].handle_id.value = "SearchCIF";
                document.forms[0].action = '/PacsApplication/DepositKYCDocumentUploadServlet';
                document.forms[0].submit();

            }
            function SearchAsset(width, height,i)
            {
                if (window.innerWidth) {
                    LeftPosition = (window.innerWidth - width) / 2;
                    TopPosition = ((window.innerHeight - height) / 2) - 20;
                }
                else {
                    LeftPosition = (parseInt(window.screen.width) - width) / 2;
                    TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                }
                attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                    height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                    TopPosition + '';
                var screenName = "DepositKYCDocumentUpload.jsp";
                    var  lovKey=    "IDTypeScoreSearch"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationDepositLOV.jsp?screenName=' + screenName+'&lovKey='+lovKey+'&textIndex='+i , 'IDTypeScoreSearch', attr);
                popWin.focus();
                }



            function ShowParent()
            {
                document.forms[0].action = "${pageContext.request.contextPath}/Deposit/DepositKYCDocumentUpload.jsp";
                document.forms[0].submit();
            }
            
            // to restrict back button
            history.pushState(null, null, location.href);
            window.addEventListener('popstate', function(event) {
                history.pushState(null, null, location.href);
            });
            
        </script>
        <jsp:include page="MenuHead_Deposit.jsp" flush="true" />
        <br>

        <%int count = 1;
                    String error_msg = "";
                    Object error = request.getAttribute("message");
                    if (error != null) {
                        error_msg = error.toString();
                    }
        %>

        <%
                    String displayFlag = "";
                    Object display = request.getAttribute("displayFlag");
                    if (display != null) {
                        displayFlag = display.toString();
                    }
        %>

        <%
                    Object oDepositKYCCreationHdrBeanObj = request.getAttribute("oDepositKYCCreationBeanObj");
                    DepositKYCCreationHdrBean oDepositKYCCreationHdrBean = new DepositKYCCreationHdrBean();
                    if (oDepositKYCCreationHdrBeanObj != null) {
                        oDepositKYCCreationHdrBean = (DepositKYCCreationHdrBean) request.getAttribute("oDepositKYCCreationBeanObj");
                    }
        %>

        <%
                    Object alDepositKYCCreationDetailBeanObj = request.getAttribute("alDepositKYCCreationDetailBean");
                    ArrayList<DepositKYCCreationDetailBean> alDepositKYCCreationDetailBean = new ArrayList<DepositKYCCreationDetailBean>();
                    DepositKYCCreationDetailBean oDepositKYCCreationDetailBean = new DepositKYCCreationDetailBean();
                    if (alDepositKYCCreationDetailBeanObj != null) {
                        alDepositKYCCreationDetailBean = (ArrayList<DepositKYCCreationDetailBean>) request.getAttribute("alDepositKYCCreationDetailBean");

                    }
        %>





        <fieldset style="border-color: black; background-image: url('/PacsApplication/img/download.jpg'); border-width: 3px">
            <legend style="padding: 8px; border-radius: 20px; background-color: #006600; color: white">KYC DOCUMENT UPLOAD</legend>
            <form name="kycDocumentUploadForm" id="kycDocumentUploadForm" action="" method="post">


                <%if (!error_msg.equalsIgnoreCase("")) {%>
                <center><div class="info" id="errorMessage"><center><%= error_msg%></center></div></center>
                <% }%>
                <br>
                <br>

                <center>
                    <table>
                        <tr><td>Enter CIF Number</td><td><input type="text" name="cifNumber" id="cifNumber" value="<%=blankNull(oDepositKYCCreationHdrBean.getCif())%>"/><input type="button" value="Search" id="Search" onclick="javascript:popup_CIF(850, 200, document.kycDocumentUploadForm.cifNumber.value, document.kycDocumentUploadForm.cifName.value);"/></td></tr>
                        <tr><td> <br></td></tr>
                        <tr><td>Enter CIF Name</td><td><input type="text" name="cifName" id="cifName" value="<%=blankNull(oDepositKYCCreationHdrBean.getCifName())%>"/><input type="button" value="Search" id="Search" onclick="javascript:popup_CIFNAME(850, 200, document.kycDocumentUploadForm.cifName.value, document.kycDocumentUploadForm.cifNumber.value);"/></td></tr>
                        <tr><td> <br></td></tr>
                    </table>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="button" value="Submit" id="Submit" onclick="javascript:submitform(kycDocumentUploadForm)"/>
                    <input type="button" value="Reset" id="Reset" onclick="ShowParent();" />
                </center>



                <br>

                <%!
                    String blankNull(String s) {
                        return (s == null) ? "" : s;
                    }
                %>
                <%

                            if (displayFlag.equalsIgnoreCase("Y")) {

                %>
                <div id="show" align="left" >

                    <center>
                        <table id="order-list" border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px">
                            <thead class="CSSTableGenerator" >
                                <tr>

                                    <td>ID Type</td>
                                    <td>ID Number</td>
                                    <td>Upload Document</td>

                                </tr>
                            </thead>
                            <tbody>

                                <%
                                                        oDepositKYCCreationDetailBean = new DepositKYCCreationDetailBean();
                                                        count = 0;

                                                        for (int i = 0; i < alDepositKYCCreationDetailBean.size(); i++) {
                                                            oDepositKYCCreationDetailBean = alDepositKYCCreationDetailBean.get(i);

                                                            count++;

                                %>

                                <tr>


                                    <td style="background-color: #f2f2f2; text-align: left; padding-left: 10px; padding-right: 10px;"><%=blankNull(oDepositKYCCreationDetailBean.getIdType())%></td>
                                    <td style="background-color: #f2f2f2; text-align: left; padding-left: 10px; padding-right: 10px;"><%=blankNull(oDepositKYCCreationDetailBean.getIdNumber())%></td>
                                    <td><input type="file" name="file<%=count%>" size="60"/></td>
                                    <input type="hidden"  name="document_mst_id<%=count%>" id="document_mst_id<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getDocument_mst_id())%>"/>
                                    <input type="hidden" name="KYCCreation_dtl_id<%=count%>" id="KYCCreation_dtl_id<%=count%>" value="<%=blankNull(oDepositKYCCreationDetailBean.getKYCCreation_dtl_id())%>" />
                                </tr>

                                <%}%>
                            </tbody>
                        </table>

                      

                    </center>


                </div>
                <br>
                <br>

                <center>
                    <table>
                        <tr>

                           <td><input type="button" name="UploadFile" id="UploadFile" value="Upload"  onclick="" /></td>
                            <td><input type="button" value="Reset" onclick="ShowParent();" /></td>
                        </tr>
                    </table>
                </center>
                <label style=" font-family: Berlin Sans FB; font-weight:normal; ">All Fields are mandatory</label>
                <% }%>

                <input type="hidden" name="handle_id" value="" >
                <input type="hidden" name="rowCounter" id="rowCounter" value="<%=count%>">

            </form>
        </fieldset>
    </body>
</html>
<% 	} catch (Exception e) {
               
            }
%>
