<%--
    Document   : accountCreation
    Created on : Mar 8, 2016, 1:20:58 PM
    Author     : Tcs Helpdesk10
--%>

<%@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"%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>Loan Account Creation</title>

        <script src="${pageContext.request.contextPath}/js/Calendar.js"></script>
        <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico" type="image/x-icon" />
        <script src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js"></script>
        <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 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>
            #nsc{
                position: absolute;
                top:510;
                right: 425;
                left: 750;
                bottom:376;
                width: auto;

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

            }
        </style>
    </head>
    <body  onload="noBack()">

        <%
                    int count = 0;
        %>
        
        <script type="text/javascript">
            function noBack()
            {
                window.history.forward();
            }
            function submitform(accCreatForm)
            {
                if (checkDiv(accCreatForm))
                {

                    document.forms[0].action = '/PacsApplication/LoanAccountCreationServlet';
                    document.forms[0].submit();
                }
            }
            function checkDiv(accCreatForm)
            {
                //alert(document.getElementById('sysdt').value + " 11:30:25");
                //alert(new Date(document.getElementById('sysdt').value + " 11:30:25"));
                if (accCreatForm.productCode.value == "")
                {
                    alert("Product Code must be filled.");
                    accCreatForm.productCodeDetails.focus();
                    return false;
                }
                if (accCreatForm.inttCategory.value == "")
                {
                    alert("Interest Category must be filled.");
                    accCreatForm.inttCategory.focus();
                    return false;
                }
                if (accCreatForm.segmentCode.value == "")
                {
                    alert("Segment Code must be filled.");
                    accCreatForm.segmentCode.focus();
                    return false;
                }
                if (accCreatForm.cifNumber.value == "")
                {
                    alert("CIF Number must be filled.");
                    accCreatForm.cifNumber.focus();
                    return false;
                }                
                if (accCreatForm.activityCode.value == "")
                {
                    alert("Activity Code must be filled.");
                    accCreatForm.activityCode.focus();
                    return false;
                }
                if (accCreatForm.customerType.value == "")
                {
                    alert("Customer Type must be filled.");
                    accCreatForm.customerType.focus();
                    return false;
                }
                if (accCreatForm.loanappAmt.value == "")
                {
                    alert("Loan Application Amount must be filled.");
                    accCreatForm.loanappAmt.focus();
                    return false;
                }
                if (accCreatForm.loanTerm.value == "")
                {
                    alert("Loan Terms(Months) fields must be filled.");
                    accCreatForm.loanTerm.focus();
                    return false;
                }
                if (accCreatForm.schemeCode.value == "")
                {
                    alert("Scheme Code must be filled.");
                    accCreatForm.schemeCode.focus();
                    return false;
                }
                if (accCreatForm.purposeCode.value == "")
                {
                    alert("Purpose Code must be filled.");
                    accCreatForm.purposeCode.focus();
                    return false;
                }               
                
                if (accCreatForm.securityFlag.value == "Yes")
                {
                    if(accCreatForm.collateralType.value == "")
                    {
                        alert("Collateral Type  must be filled.");
                        accCreatForm.collateralType.focus();
                        return false;
                    }
                    if(accCreatForm.description.value == "")
                    {
                        alert("Description must be filled.");
                        accCreatForm.description.focus();
                        return false;
                    }
                    if(accCreatForm.currentValuation.value == "")
                    {
                        alert("Current Valuation must be filled.");
                        accCreatForm.currentValuation.focus();
                        return false;
                    }
                    if(accCreatForm.safeLendingMargin.value == "")
                    {
                        alert("Safe Lending Margin must be filled.");
                        accCreatForm.safeLendingMargin.focus();
                        return false;
                    }
                    if(accCreatForm.intRate.value == "")
                    {
                        alert("Interest Rate must be filled.");
                        accCreatForm.intRate.focus();
                        return false;
                    }
                    if(accCreatForm.penIntRate.value == "")
                    {
                        alert("Penal Interest Rate must be filled.");
                        accCreatForm.penIntRate.focus();
                        return false;
                    }
                    if(accCreatForm.productCodeDetails.value.substring(0,4) == "7003" || accCreatForm.productCodeDetails.value.substring(0,4) == "7000")
                    {
                        if(accCreatForm.dep_acc_no.value==""){
                            alert("Please enter deposit A/C for Loan against Deposit.");
                            document.getElementById("collateralType").value = "D";
                            $('#collateralType').change();
                            document.getElementById("currentValuation").value = "";
                            accCreatForm.dep_acc_no.focus();
                            return false;
                        }
                        //var matdt = document.getElementById('mat_dt').value;
                        //var sysdt = Date.parse(document.getElementById('sysdt').value);
                        //var sysdt=new Date(document.getElementById('sysdt').value);
                        //sysdt.setMonth(sysdt.getMonth() + document.getElementById('loanTerm').value)
                        $('#collateralType').prop('disabled', false);
                    }

                    if(accCreatForm.productCodeDetails.value.substring(0,4) == "7001" || accCreatForm.productCodeDetails.value.substring(0,4) == "7010")
                    {
                        /*if( accCreatForm.expDt.value==""){
                            alert("Please enter expiry date");
                            document.getElementById("collateralType").value = "K";
                            $('#collateralType').change();
                            document.getElementById("currentValuation").value = "";
                            accCreatForm.expDtRow.focus();
                            return false;
                        }*/
                        $('#collateralType').prop('disabled', false);
                    }
                    
                }
                if (accCreatForm.guarantorFlag.value == "Yes")
                {
                    if(accCreatForm.gurantorName.value == "")
                    {
                        alert("Gurantor Name  must be filled.");
                        accCreatForm.gurantorName.focus();
                        return false;
                    }
                    if(accCreatForm.guarantorDOB.value == "")
                    {
                        alert("Gurantor DOB  must be filled.");
                        accCreatForm.guarantorDOB.focus();
                        return false;
                    }

                    if(accCreatForm.guarantorJob.value == "")
                    {
                        alert("Gurantor Job  must be filled.");
                        accCreatForm.guarantorJob.focus();
                        return false;
                    }
                    if(accCreatForm.guarantorAddress.value == "")
                    {
                        alert("Gurantor Address  must be filled.");
                        accCreatForm.guarantorAddress.focus();
                        return false;
                    }
                    if(accCreatForm.gurantorName.value == "")
                    {
                        alert("Gurantor Name  must be filled.");
                        accCreatForm.gurantorName.focus();
                        return false;
                    }
                    if(accCreatForm.gurantorIncome.value == "")
                    {
                        alert("Gurantor Income  must be filled.");
                        accCreatForm.gurantorIncome.focus();
                        return false;
                    }
                    if(accCreatForm.guarRelation.value == "")
                    {
                        alert("Relationship with Gurantor must be filled.");
                        accCreatForm.guarRelation.focus();
                        return false;
                    }
                    if(accCreatForm.guarIdType.value == "")
                    {
                        alert("Gurantor ID Type  must be filled.");
                        accCreatForm.guarIdType.focus();
                        return false;
                    }
                    if(accCreatForm.guarIdNo.value == "")
                    {
                        alert("Gurantor ID Number  must be filled.");
                        accCreatForm.guarIdNo.focus();
                        return false;
                    }
                }

                return true;
            }
            $(document).ready(function () {
                $('select#collateralType').change(function () {
                    var val = $(this).val();
                    switch(val)
                    {
                        case 'L':

                            document.getElementById("currentValuation").readOnly = false;
                            $('#lic_no').hide();
                            $('#kno').hide();
                            $('#dep_acc_noTR').hide();
                            $('#accNoSearch').hide();
                            $('#expDtRow').hide();
                            $('#showGoldLn').hide();
                            
                            break;
                            
                        case 'G':

                            document.getElementById("currentValuation").readOnly = false;
                            $('#lic_no').show();
                            $('#kno').show();
                            $('#dep_acc_noTR').hide();
                            $('#accNoSearch').hide();
                            $('#expDtRow').hide();
                            $('#showGoldLn').show();
                           
                            break;    
                            
                        case 'K':

                            document.getElementById("currentValuation").readOnly = true;
                            $('#lic_no').show();
                            $('#kno').show();
                            $('#dep_acc_noTR').hide();
                            $('#accNoSearch').hide();
                            $('#expDtRow').show();
                            $('#showGoldLn').hide();
                            
                            break;
                            
                        case 'D':

                            document.getElementById("currentValuation").readOnly = true;
                            $('#lic_no').hide();
                            $('#kno').hide();
                            $('#dep_acc_noTR').show();
                            $('#accNoSearch').show();
                            $('#expDtRow').hide();
                            $('#showGoldLn').hide();
                            
                            break;

                        default:
                           
                            document.getElementById("currentValuation").readOnly = false;
                            $('#lic_no').hide();
                            $('#kno').hide();
                            $('#expDtRow').hide();
                            $('#showGoldLn').hide();
                            
                            break;
                    }
                });
            });

            function sendInfo() {

                document.forms[0].handle_id.value = document.accCreatForm.productCode.value;
                document.forms[0].action = "DynamicInttCategory.jsp";
                document.forms[0].submit();
            }

            function ShowParent()
            {
                document.forms[0].action = "${pageContext.request.contextPath}/Loan/LoanAccountCreation.jsp";
                document.forms[0].submit();
            }

            function popup_CIF(width, height, 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 = "LoanAccountCreation.jsp";
                var  lovKey="CifDetails"
                popWin = open('/PacsApplication/CommonSearchInformationLoanLOV.jsp?cifNumber=' + cifNumber + '&screenName=' + screenName+'&lovKey='+lovKey, 'CifDetails', attr);
                popWin.focus();

            }
            function popup_CustName(width, height, customerName) {
                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 = "LoanAccountCreation.jsp";
                var  lovKey="CustNameDetails"
                popWin = open('/PacsApplication/CommonSearchInformationLoanLOV.jsp?customerName=' + customerName + '&screenName=' + screenName+'&lovKey='+lovKey, 'CustNameDetails', attr);
                popWin.focus();

            }
            function popup_productCode(width, height, productCodeDetails) {
                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 = "LoanAccountCreation.jsp";
                var  lovKey="productCodeSearch"
                popWin = open('/PacsApplication/CommonSearchInformationLoanLOV.jsp?productCodeDetails=' + productCodeDetails + '&screenName=' + screenName+'&lovKey='+lovKey, 'productCodeSearch', 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 = "LoanAccountCreation.jsp";
                    var lovKey = "NscDetails"
                    popWin = window.open('/PacsApplication/Loan/popupnscdetails.jsp?screenName=' + screenName + '&lovKey=' + lovKey, 'NscDetails', attr);
                    popWin.focus();
            }
            function popup_goldLoanDetails(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 = "LoanAccountCreation.jsp";
                    var lovKey = "GoldDetailsKey"
                    popWin = window.open('/PacsApplication/Loan/popupGoldLoanDetails.jsp?screenName=' + screenName + '&lovKey=' + lovKey, 'GoldDetailsKey', 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 = "LoanAccountCreation.jsp";
                    var lovKey = "Account"
                    popWin = open('/PacsApplication/CommonSearchInformationLoanLOV.jsp?cifNumber=' + cifNumber + '&screenName=' + screenName + '&lovKey=' + lovKey, 'Account', attr);
                    popWin.focus();

                }}
            function CheckOption(gurantor,security){

               
                if (gurantor == "Yes")
                {
                    document.getElementById('guarantorDiv').style.display = 'block';
                
                }

                if (gurantor == "No")
                {
                    document.getElementById('guarantorDiv').style.display = 'none';

                }

                if (security == "Yes")
                {
                    document.getElementById('securityDiv').style.display = 'block';
                 
                }

                if (security == "No")
                {
                    document.getElementById('securityDiv').style.display = 'none';

                }

            }

            function calculateEligAmt(){


                var currentValuation = document.getElementById("currentValuation").value;
                var safeLendingMargin = document.getElementById("safeLendingMargin").value;

                document.getElementById("eligAmt").value = currentValuation * (safeLendingMargin/100);

            }

            $('table').on('keydown','#cifNumber', function(event) {
                if (event.shiftKey == true) {
                    event.preventDefault();
                }

                if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105) || event.keyCode == 8  || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46) {

                } else {
                    event.preventDefault();
                }
            });
            
            // to restrict back button
            history.pushState(null, null, location.href);
            window.addEventListener('popstate', function(event) {
                history.pushState(null, null, location.href);
            });

        </script>


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

        <jsp:include page="MenuHead_Loan.jsp" flush="true" />
        <br>

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

        <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">Loan Account Creation</legend>

            <form name="accCreatForm" method="post" action="">

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

                <div id="create" align="left">

                    <table id="information">
                        <tr><td></td></tr>
                        <tr><td><h3>Account Information :</h3></td></tr>
                        <tr>
                            <td><lable>Product Code<font color="red" >*</font>:</lable></td>
                        <td><input type="text"  id="productCodeDetails" name="productCodeDetails" readonly ></td>
                        <td><input type="button" name="productCodeSearch" id="productCodeSearch" value="Search" onclick="javascript:popup_productCode(480, 180, document.accCreatForm.productCodeDetails.value);"/></td>

                        </tr>
                        <tr>
                            <td><lable>Intt Category<font color="red" >*</font>:</lable></td>
                        <td><input type="text" id="inttCatDetails" name="inttCatDetails" readonly="true"></td>
                        </tr>

                        <tr>
                            <td><lable>Segment Code<font color="red" >*</font>:</lable></td>
                        <td>
                            <select id="segmentCode" name="segmentCode">
                                <option value="" disabled selected style="display:none;">--Select--</option>
                                <option value="0706">0706:INDIVIDUAL</option>
                                <option value="0306">0306:STAFF</option>
                                <option value="5003">5003:SENIOR CITIZEN</option>
                                <option value="5010">5010:SHG</option>
                                <option value="5000">5000:BANKS</option>
                                <option value="5009">5009:INSTITUTIONS</option>
                                <option value="5050">5050:OTHERS</option>
                                <option value="5007">5007:SOCIETY</option>
                                <option value="5011">5011:GOV/SEMI GOV</option>
                                <option value="5012">5012:PACS</option>
                                <option value="5013">5013:UCB</option>
                                <option value="5014">5014:SCB</option>
                                <option value="5015">5015:CCB</option>
                            </select>
                        </td>
                        </tr>
                        <tr>
                            <td><lable>CIF Number<font color="red" >*</font>:</lable></td>
                        <td><input type="text" id="cifNumber" name="cifNumber" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' ></td>
                        <td><input type="button" name="cifNumberSearch" id="cifNumberSearch" value="Search" onclick="javascript:popup_CIF(600, 180, document.accCreatForm.cifNumber.value);"/></td>
                        </tr>
                        <tr>
                            <td><lable>Customer Name:</lable></td>
                        <td><input type="text" id="customerName" name="customerName"></td>
                        <td><input type="button" name="customerNameSearch" id="customerNameSearch" value="Search" onclick="javascript:popup_CustName(220, 180, document.accCreatForm.customerName.value);"/></td>
                        </tr>
                        <tr>
                            <td><lable>Loan Application Amount<font color="red" >*</font>:</lable></td>
                <td><input type="text" id="loanappAmt" name="loanappAmt" maxlength="17" style="text-align:right;" onkeypress='return event.charCode >= 46 && event.charCode <= 57' ></td>
                        </tr>
                        <tr>
                            <td><lable>Loan Terms(Months)<font color="red" >*</font>:</lable></td>
                        <td><input type="text" id="loanTerm" name="loanTerm" maxlength="4" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' ></td>
                        </tr>
                        <tr>
                            <td><lable>Scheme Code<font color="red" >*</font>:</lable></td>
                        <td>
                            <select id="schemeCode" name="schemeCode">
                                <option value="" disabled selected style="display:none;"> --Select-- </option>
                                <option value="1">Urban Development Scheme</option>
                                <option value="2">Women Welfare Scheme</option>
                                <option value="3">Kishan Subidha Yojona</option>
                                <option value="4">Others</option>

                            </select>
                        </td>
                        </tr>
                        <tr>
                            <td><lable>Purpose Code<font color="red" >*</font>:</lable></td>
                        <td>
                            <select id="purposeCode" name="purposeCode">
                                <option value="" disabled selected style="display:none;"> --Select-- </option>
                                <option value="1">Seasonal Crop</option>
                                <option value="2">Regular Crop</option>
                                <option value="3">Other</option>

                            </select>
                        </td>
                        </tr>
                    </table>

                    <div id="securityDiv" style="display:none;" align="left">
                        <table>
                            <tr><td><hr></td></tr>
                            <tr><td><h3>Collateral Information :</h3></td></tr>
                            <tr>
                                <td><lable>Collateral Type<font color="red" >*</font>:</lable></td>
                            <td>
                                <select id="collateralType" name="collateralType">
                                    <option value="" selected style="display:none;">--Select--</option>
                                    <option value="L">Land</option>
                                    <option value="G">Gold</option>
                                    <option value="D">Loan against Deposit</option>
                                    <option value="K">Loan against NSC/KVP/LIC</option>
                                    <option value="O">Others</option>
                                </select>
                            </td>
                            </tr>
                            <tr id="dep_acc_noTR" name="dep_acc_noTR" style="display: none">
                                <td>Deposit Account Number:</td>
                                <td><input type="text" id="dep_acc_no" name="dep_acc_no"  readonly></td>
                                <td><input type="button" name="accNoSearch" id="accNoSearch" value="Search" onclick="javascript:popup_depAccount(750, 180, document.accCreatForm.cifNumber.value);"/></td>
                                
                            </tr>
                            
                            <tr id="expDtRow" name="expDtRow" style="display: none">
                                <td></td>
                                <td><input  type="button" id="nscBtn" name="nscBtn" value="NSC Details" onclick="javascript:popup_nscDetails(750,180);"/></td>
                            </tr>
                            
                            <tr id="showGoldLn" name="showGoldLn" style="display: none">
                                <td></td>
                                <td><input  type="button" id="nscBtn" name="nscBtn" value="Gold Details" onclick="javascript:popup_goldLoanDetails(750,180);"/></td>
                            </tr>

                            <tr></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>Current Valuation (in Rs.)<font color="red" >*</font>:</lable></td>
                            <td><input type="text" id="currentValuation" name="currentValuation" onchange="calculateEligAmt()" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' /></td>
                            </tr>
                            <tr>
                                <td><lable>Safe Lending Margin<font color="red" >*</font>:</lable></td>
                            <td><input type="text" maxlength="17" id="safeLendingMargin" name="safeLendingMargin"  onchange="calculateEligAmt()" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/></td>
                            <td><lable>%</lable></td>
                            </tr>

                            <tr>
                                <td><lable>Eligible Amount :</lable></td>
                            <td><input type="text" id="eligAmt" name="eligAmt" readonly style="text-align:right;" /></td>
                            </tr>

                        </table>
                    </div>

                    <table>

                        <tr><td><hr></td></tr>
                        <tr><td><h3>Additional Information:</h3></td></tr>

                        <tr>
                            <td><lable>Activity Code<font color="red" >*</font>:</lable></td>
                        <td>
                            <select id="activityCode" name="activityCode">
                                <option value="" disabled selected style="display:none;">--Select--</option>
                                <option value="1">Direct Agriculture</option>
                                <option value="2">Indirect Agriculture</option>
                                <option value="3">Agricultural Service Units</option>
                                <option value="4">Farm Irrigation</option>
                                <option value="5">Fruits & Vegetables</option>
                            </select>
                        </td>
                        </tr>
                        <tr>
                        <td><lable>Customer Type<font color="red" >*</font>:</lable></td>
                        <td><input type="text" readonly id="customerType" name="customerType"></td>
                        </tr>

                        <tr><td><hr></td></tr>
                        <tr><td><h3>Interest Information:</h3></td></tr>
                        <tr>
                        <td><lable>Interest Rate<font color="red" >*</font>:</lable></td>
                        <td><input type="text" maxlength="17" id="intRate" name="intRate" value="" style="text-align:right;" onkeypress='return event.charCode >= 46 && event.charCode <= 57'></td>
                        </tr>
                        <tr>
                        <td><lable>Penal Interest Rate<font color="red" >*</font>:</lable></td>
                        <td><input type="text" maxlength="17" id="penIntRate" name="penIntRate" value="" style="text-align:right;" onkeypress='return event.charCode >= 46 && event.charCode <= 57'></td>
                        </tr>
                    </table>



                    <div id="guarantorDiv" style="display:none;" align="left">
                        <table>

                            <tr><td><hr></td></tr>
                            <tr><td><h3>Guarantor Information:</h3></td></tr>

                            <tr>
                                <td><lable>Guarantor Name:</lable></td>
                            <td><input type="text" name="gurantorName" id="gurantorName"></td>
                            </tr>
                            <tr>
                                <td><lable>Guarantor Address:</lable></td>
                            <td><textarea name="guarantorAddress" id="guarantorAddress"></textarea></td>
                            </tr>
                            <tr>
                                <td><lable>Guarantor Date of Birth:</lable></td>
                            <td><input type="text" id="guarantorDOB" name="guarantorDOB" readonly="true" style="text-align:center;" > <a href="#" onclick="return getCalendar(document.forms[0].guarantorDOB);"><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></a></td>
                            </tr>
                            <tr>
                                <td><lable>Guarantor Job:</lable></td>
                            <td><select name="guarantorJob" id="guarantorJob">
                                    <option value=""> --Select-- </option>
                                    <option value="S">Service</option>
                                    <option value="B">Business</option>
                                    <option value="O">Others</option>
                                </select>
                            </td>
                            </tr>
                            <tr>
                                <td><lable>Guarantor Annual Income:</lable></td>
                            <td><input type="text" name="gurantorIncome" id="gurantorIncome" style="text-align:right;" onkeypress='return event.charCode >= 46 && event.charCode <= 57' ></td>
                            </tr>
                            <tr>
                                <td><lable>Relationship with Guarantor:</lable></td>
                            <td>
                                <select name="guarRelation" id="guarRelation">
                                    <option value=""> --Select-- </option>
                                    <option value="P">Parent</option>
                                    <option value="S">Spouse</option>
                                    <option value="O">Others</option>
                                </select>
                            </td>
                            </tr>
                            <tr>
                                <td><lable>Guarantor ID Type:</lable></td>
                            <td><select name="guarIdType" id="guarIdType">
                                    <option value=""> --Select-- </option>
                                    <option value="V">Voter ID</option>
                                    <option value="A">AADHAR CARD</option>
                                    <option value="R">RATION CARD</option>
                                </select>
                            </td>
                            </tr>
                            <tr>
                                <td><lable> ID Number:</lable></td>
                            <td><input type="text" name="guarIdNo" id="guarIdNo" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' ></td>
                            </tr>
                        </table>
                    </div>
                    <br>
                    <br>
                    <center>
                        <input type="button" value="Submit" onclick="javascript:submitform(accCreatForm)">
                        <input type="button" value="Reset" name="reset" onclick="ShowParent();" />
                    </center>
                    <tr><td><br></td></tr>
                    <tr><td><br></td></tr>
                    <label style=" font-family: Berlin Sans FB; font-weight:normal; ">All fields are mandatory</label>
                </div>

                <div id="nsc" style="display:none;" >
                    <div style="overflow:scroll; width: 350px; height: 100px;">
                                <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>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;" >
                    <div style="overflow:scroll; width: 350px; height: 100px;">
                        <table id="order-list2" border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px">
                    <thead class="CSSTableGenerator" >
                        <tr>
                            <td>Bond No</td>
                            <td>Gross Weight</td>
                            <td>Net Weight</td> 

                        </tr>
                    </thead>
                    <tbody>
                        <tr class="tRowGold">
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="bond<%=count%>" id="bond<%=count%>"/></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="grossW<%=count%>" id="grossW<%=count%>" /></td>
                            <td><input  type="text" style="width: 100%;padding: 5px;margin: 0px;border: 1px solid #CCC;" name="netW<%=count%>" id="netW<%=count%>"/></td>
                            
                        </tr>
                    </tbody>
                        </table>
                    </div>
                </div>
                            
                <input type="hidden" name="handle_id" value="" />
                <input type="hidden" name="productCode" value="" />
                <input type="hidden" name="inttCategory" value="" />
                <input type="hidden" name="rowCounter" id="rowCounter" value="" />
                <input type="hidden" name="guarantorFlag" id="guarantorFlag" value=""  />
                <input type="hidden" name="securityFlag" id="securityFlag" value=""  />
                <input type="hidden" name="mat_dt" id="mat_dt" value=""/>
                
            </form>
        </fieldset>
    </body>
</html>
