<%--
    Document   : TDRepayMethod
    Created on : Aug 22, 2019, 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" %>
<!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>TD/RD Interest TRF Method </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;

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

            function ShowParent()
            {

                document.forms[0].action = "${pageContext.request.contextPath}/Deposit/TDRepayMethod.jsp";
                document.forms[0].submit();
            }
            function popup_DepositAccLOV(width, height, depAccount) {
                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 = "TDRepayMethod.jsp";
                var  lovKey="TDAccLOV"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInfoLOVNew.jsp?depAccount=' + depAccount + '&screenName=' + screenName+'&lovKey='+lovKey, 'TDAccLOV', attr);
                popWin.focus();

            }
            function popup_TransferAccLOV(width,height,customer,trfAccount){
                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 = "TDRepayMethod.jsp";
                var  lovKey="TransferAccLOV";
                popWin = open('${pageContext.request.contextPath}/CommonSearchInfoLOVNew.jsp?customer=' + customer + '&trfAccount=' + trfAccount + '&screenName=' + screenName+'&lovKey='+lovKey, 'TransferAccLOV', attr);
                popWin.focus();
            }

            function submitform(TDRepayMethodForm)
            {
                if (checkDiv(TDRepayMethodForm))
                {

                    document.TDRepayMethodForm.action = '/PacsApplication/TDRepayMethodServlet';
                    document.TDRepayMethodForm.submit();
                }
            }
            function checkDiv(TDRepayMethodForm)
            {
                if (TDRepayMethodForm.depAccount.value == "")
                {
                    alert("TD Account cannot be null.");
                    TDRepayMethodForm.depAccount.focus();
                    return false;
                }
                if (TDRepayMethodForm.methodType.value == "")
                {
                    alert("Interest Transfer Account cannot be null.");
                    TDRepayMethodForm.methodType.focus();
                    return false;
                }
                return true;
            }

            $(document).ready(function () {
               $('select#methodType').change(function () {
                    var shouldEnable = $(this).val();
                    switch(shouldEnable)
                    {
                        case 'F':
                            $('#trfacc').hide();
                            document.getElementById("trfAccount").disabled = true;
                            break;

                        case 'R':
                            $('#trfacc').hide();
                            document.getElementById("trfAccount").disabled = true;
                            break;

                        default:
                            $('#trfacc').show();
                            document.getElementById("trfAccount").disabled = false;
                            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_Deposit.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();

                 }
         %>

        <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">TD/RD Interest TRF Method Change</legend>
            <%if (!error_msg.equalsIgnoreCase("")) {%>
                    <center><div class="info" id="errorMessage"><center><%= error_msg%></center></div></center>
                    <% }%>
            <form name="TDRepayMethodForm" id="TDRepayMethodForm" action="" method="post">
                <div align="left">

                    <table>
                        <tbody>
                            <tr>
                                <td>Account Number<font color="red" >*</font>: </td>
                                <td><input type="text" size="20" name="depAccount" id="depAccount" value="" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57' />
                                <input type="button" value="Search" onclick="javascript:popup_DepositAccLOV(500,300,$('#depAccount').val());" /></td>
                            </tr>
                            <tr>
                                <td>Customer Number<font color="red" >*</font>: </td>
                                <td><input type="text" size="20" name="customer" id="customer" readOnly /></tr>
                            <tr><tr><tr>
                            <tr>
                                <td><lable>Select New Interest TD TRF Method<font color="red" >*</font>:</lable></td>
                            <td> <select id="methodType" name="methodType" >
                                    <option value="" selected  > --Select-- </option>
                                    <option value="T" >Transfer Mode</option>
                                    <option value="TR" >Transfer And Renew Mode</option>
                                    <option value="R" >Auto-Renew Mode</option>
                                    <option value="F" >Freeze Mode</option>
                                </select></td>
                            </tr><td><td>

                            <tr id="trfacc" >
                                <td>Interest Transfer Account: </td>
                                <td><input type="text" size="20" name="trfAccount" id="trfAccount" value="" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/>
                                <input type="button" value="Search" onclick="javascript:popup_TransferAccLOV(500,300,$('#customer').val(),$('#trfAccount').val());" /></td>
                            </tr>                            

                        </tbody>
                    </table>
                    <br>
                    <br><br><br>
                    <center>
                     <input type="button" value="Submit" id="Submit" onclick="submitform(TDRepayMethodForm);" />
                     <input type="button" value="Reset" id="Reset" onclick="ShowParent();"</center>
                 </div>
            </form>
        </fieldset>
    </body>
</html>
<% 	} catch (Exception e) {
                
            }
%>