<%--
    Document   : RemoveLien
    Created on : Dec 29, 2021, 6:00:55 PM
    Author     : 1242938
--%>

<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.util.Date"%>
<%@page import="LoginDb.DbHandler"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.UUID" %>
<%@page import="DataEntryBean.LoanAccountCreationBean"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%String uuid = UUID.randomUUID().toString();%>
<% try {
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Remove Lien</title>
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css" />
        <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 src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <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>

        <style>
            .beforeAccSrch {
                display: none;
            }

            #nsc{
                position: right;
                top:510;
                right: 425;
                left: 750;
                bottom:376;
                width: auto;

            }
            #gold{
                position: right;
                top:510;
                right: 425;
                left: 750;
                bottom:376;
                width: auto;

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

            function ShowParent()
            {

                document.forms[0].action = "${pageContext.request.contextPath}/Loan/RemoveLien.jsp";
                document.forms[0].submit();
            }            
            function popup_accSearch(width, height, acc, type) {

                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 = "RemoveLien.jsp";
                var  lovKey="accSearch"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInfoLOVNew.jsp?acc=' + acc + '&screenName=' + screenName+ '&type=' + type+ '&lovKey='+lovKey, 'accSearch', attr);
                popWin.focus();                

            }
            function popup_depAccount(width, height, cifNumber) {

                if($('#cifNumber').val() == ""){
                    alert( "Please select CIF Number first !!" );
                }
                else{

                    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 = "LienMarking.jsp";
                    var lovKey = "Account"
                    popWin = open('/PacsApplication/CommonSearchInfoLOVNew.jsp?cifNumber=' + cifNumber + '&screenName=' + screenName + '&lovKey=' + lovKey, 'Account', attr);
                    popWin.focus();

                }}
            function popup_nscDetails(width, height){
                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 = "LienMarking.jsp";
                    var lovKey = "NscDetails"
                    popWin = window.open('/PacsApplication/Loan/popupnscdetails.jsp?screenName=' + screenName + '&lovKey=' + lovKey, 'NscDetails', attr);
                    popWin.focus();
            }
            function popup_goldDetails(width, height, acc)
            {
                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 refno = $('#SearchID').val();
                var screenName = "RemoveLien.jsp";
                var  lovKey=    "view_Gold"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationLoanLOV.jsp?acc=' + acc + '&screenName=' + screenName+'&lovKey='+lovKey+'&refno='+refno , 'view_Gold', attr);
                popWin.focus();
            }    
            function submitform(remLien)
            {
                if (checkDiv(remLien))
                {
                    document.remLien.action = '/PacsApplication/RemoveLienServlet';
                    document.remLien.submit();
                }
            }
            function checkDiv(remLien)
            {
                if (remLien.lienType.value == "")
                {
                    alert("Please select Lien Type.");
                    remLien.lienType.focus();
                    return false;
                }
                if (remLien.loanAccount.value == "")
                {
                    alert("Loan Account must be filled.");
                    remLien.loanAccount.focus();
                    return false;
                }

//                if (LienMarking.lienType.value == "D")
//                {
//                    if (LienMarking.cifNo.value == "")
//                    {
//                        alert("CIF Number must be fetched from Loan Accoun.");
//                        LienMarking.cifNo.focus();
//                        return false;
//                    }
//                    if (LienMarking.dep_acc_no.value == "")
//                    {
//                        alert("Deposit Account must be filled.");
//                        LienMarking.dep_acc_no.focus();
//                        return false;
//                    }
//                }

//                if (LienMarking.currentValuation.value == "")
//                {
//                    alert("Security Amount must be filled.");
//                    LienMarking.currentValuation.focus();
//                    return false;
//                }                
                if (remLien.description.value == "")
                {
                    alert("Description must be filled.");
                    remLien.description.focus();
                    return false;
                }
                if (remLien.comment.value == "")
                {
                    alert("Comments must be filled.");
                    remLien.comment.focus();
                    return false;
                }
                
                return true;
            }
            
            $(document).ready(function () {
                            $('#nscBtn').hide();
                            $('#goldBtn').hide();
                            $('#cif').hide();
                            $('#Dep').hide();
                            
                $('select#lienType').change(function () {
                    var val = $(this).val();
                    switch(val)
                    {                        
                            
                        case 'G':
                            $('#Dep').hide();
                            $('#cif').hide();
                            $('#nscBtn').hide();
                            $('#goldBtn').show();
                            break;                           

                        default:
                            $('#Dep').hide();
                            $('#cif').hide();
                            $('#nscBtn').hide();
                            $('#goldBtn').hide();
                            break;
                    }
                });
            });
            
            // 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_Loan.jsp" flush="true" />
        <br>

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

                 String error_msg = "";
                 Object error = request.getAttribute("message");
                  if (error != null) {
                     error_msg = error.toString();

                 }
         %>
         <%
                    Object LoanAccountCreationBeanObj = request.getAttribute("oLoanAccountCreationBean");
                    LoanAccountCreationBean oLoanAccountCreationBean = new LoanAccountCreationBean();

                    if (LoanAccountCreationBeanObj != null) {
                        oLoanAccountCreationBean = (LoanAccountCreationBean) request.getAttribute("oLoanAccountCreationBean");

                    }
        %>

        <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">Remove Lien</legend>
            <%if (!error_msg.equalsIgnoreCase("")) {%>
                    <center><div class="info" id="errorMessage"><center><%= error_msg%></center></div></center>
                    <% }%>
            <form name="remLien" id="remLien" action="" method="post">
                <div align="left">
                             
                    <table>
                        <tbody>
                            <tr>
                                <td><lable>Select Lien Type<font color="red" >*</font>:</lable></td>
                            <td> <select id="lienType" name="lienType" >
                                    <option value="" selected  >--Select--</option>
                                    <option value="G" >Gold Loan</option>
                                </select></td>
                            </tr><td><td>

                            <tr>
                                <td>Loan Account<font color="red" >*</font>: </td>
                                <td><input type="text" size="20" name="loanAccount" id="loanAccount" value="" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' />
                                <input type="button" value="Search" onclick="javascript:popup_accSearch(500,300,$('#loanAccount').val(),document.remLien.lienType.value);" /></td>
                            </tr>
                            <tr id="cif">
                                <td>CIF Number: </td>
                                <td><input type="text" name="cifNo" id="cifNo" Value="" readonly="true" style="text-align:right;" /></td></tr>
                            <tr id="Dep">
                                <td>Deposit Account<font color="red" >*</font>: </td>
                                <td><input type="text" size="20" readonly name="dep_acc_no" id="dep_acc_no" value="" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' />
                                <input type="button" value="Search" onclick="javascript:popup_depAccount(500,300,document.LienMarking.cifNo.value);" /></td>
                            </tr>
                            <tr></tr>
                            <tr></tr>
                            <tr>
                                <td></td>
                                <td><input  type="button" id="nscBtn" name="nscBtn" value="NSC Details" onclick="javascript:popup_nscDetails(750,180);"/></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td><input  type="button" id="goldBtn" name="goldBtn" value="Gold Details" onclick="javascript:popup_goldDetails(350,250,$('#loanAccount').val());"/></td>
                            </tr>
<!--                            <tr>
                                <td><lable>Security Amount:</lable></td>
                            <td><input type="text" id="currentValuation" name="currentValuation" style="text-align:right;" /></td>
                            </tr>
                            <tr>
                                <td><lable>Safe Lending Margin :</lable></td>
                                <td><input type="text" id="safeLendingMargin" name="safeLendingMargin" value="100" readonly="true" style="text-align:right;" /></td>
                            <td><lable>%</lable></td>
                            </tr>-->
                            <tr>
                                <td><lable>Description<font color="red" >*</font>:</lable></td>
                            <td><textarea id="description" name="description" style="width : 150px"></textarea></td>
                            </tr> 
                            <tr>
                                <td><lable>Comments<font color="red" >*</font>:</lable></td>
                                <td><input type="text" id="comment" name="comment" ></td>
                            </tr>
                            <tr>
                                <td><input type="hidden" name="expDt" id="expDt" Value="" /></td></tr>
                            <tr>
                                <td><input type="hidden" name="openDt" id="openDt" Value="" /></td></tr>
                            <tr>
                                <td><input type="hidden" name="KVPNo" id="KVPNo" Value="" /></td></tr>
                            
                        </tbody>

                    </table>
                    <br>
                  <center>
                     <input type="button" value="Submit" id="Submit" onclick="submitform(remLien);" />
                     <input type="button" value="Reset" id="Reset" onclick="ShowParent();"
                  </center>
                 </div>

                <div id="nsc" style="display:none;" align="right" >
                                <div style="overflow:scroll; width: 350px; height: 100px;">
                                <table id="order-list" border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: right ;overflow-y: scroll; font-size: 5px">
                    <thead class="CSSTableGenerator" >
                        <tr>
                            <td>REF No</td>
                            <td>Amount</td>
                            <td>Open Date</td>
                            <td>Expiry Date</td>

                        </tr>
                    </thead>
                    <tbody>
                        <%--<tr class="tRow">
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="ref<%=count%>" id="ref<%=count%>"/></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="amt<%=count%>" id="amt<%=count%>" /></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="openDt<%=count%>" id="openDt<%=count%>"/></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="expDt<%=count%>" id="expDt<%=count%>"/></td>

                        </tr>--%>
                    </tbody>
                </table>
                            </div>
                </div>
                    
                <div id="gold" style="display:none;" align="right" >
                                <div style="overflow:scroll; width: 350px; height: 100px;">
                                <table id="order-list2" border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: right ;overflow-y: scroll; font-size: 5px">
                    <thead class="CSSTableGenerator" >
                        <tr>
                            <td>Bond No</td>
                            <td>Gross Weight</td>
                            <td>Net Weight</td>

                        </tr>
                    </thead>
                    <tbody>
                        <%--<tr class="tRow">
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="ref<%=count%>" id="ref<%=count%>"/></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="amt<%=count%>" id="amt<%=count%>" /></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="openDt<%=count%>" id="openDt<%=count%>"/></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="expDt<%=count%>" id="expDt<%=count%>"/></td>

                        </tr>--%>
                    </tbody>
                </table>
                            </div>
                </div>    
                           
                <input type="hidden" name="rowCounter" id="rowCounter" value="" />
                <input type="hidden" name="mat_dt" id="mat_dt" value=""/>   
                <input type="hidden" name="SearchID" id="SearchID" value="<%=blankNull(oLoanAccountCreationBean.getId())%>" />
                    
            </form>
        </fieldset>
    </body>
</html>
<% 	} catch (Exception e) {
                
            }
%>