<%--
    Document   : MiscChargeDeduction
    Created on : Sep 20, 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>Misc Charge Deduction</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/MiscChargeDeduction.jsp";
                document.forms[0].submit();
            }
            function popup_prodCode(width, height, pcode) {
                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 = "MiscChargeDeduction.jsp";
                var  lovKey="prodLOV"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInfoLOVNew.jsp?pcode=' + pcode + '&screenName=' + screenName+'&lovKey='+lovKey, 'prodLOV', attr);
                popWin.focus();

            }

            function submitform(MiscChargeDeductionForm)
            {
                if (checkDiv(MiscChargeDeductionForm))
                {

                    document.MiscChargeDeductionForm.action = '/PacsApplication/MiscChargeDeductionServlet';
                    document.MiscChargeDeductionForm.submit();
                }
            }
            function checkDiv(MiscChargeDeductionForm)
            {
                if (MiscChargeDeductionForm.methodType.value == "")
                {
                    alert("Select Charge Deduction Type.");
                    MiscChargeDeductionForm.methodType.focus();
                    return false;
                }
                if (MiscChargeDeductionForm.prodCode.value == "")
                {
                    alert("Product Code can not be null.");
                    MiscChargeDeductionForm.prodCode.focus();
                    return false;
                }
                if (MiscChargeDeductionForm.txnAmt.value == "")
                {
                    alert("Deduction Amount can not be null.");
                    MiscChargeDeductionForm.txnAmt.focus();
                    return false;
                }
                if (MiscChargeDeductionForm.narration.value == "")
                {
                    alert("Narration can not be null.");
                    MiscChargeDeductionForm.narration.focus();
                    return false;
                }
                return true;
            }

            $(document).ready(function () {
               $('select#methodType').change(function () {
                    var shouldEnable = $(this).val();
                    switch(shouldEnable)
                    {
                        case 'NONTXNCHARGE':
                            $('#frmdt').show();
                            $('#todt').show();
                            $('#maxTr').hide();
                            break;

                        case 'MINCHARGE':
                            $('#minb').show();
                            $('#frmdt').hide();
                            $('#todt').hide();
                            $('#maxTr').hide();
                            break;

                        case 'THRESHOLD':
                            $('#minb').hide();
                            $('#frmdt').show();
                            $('#todt').show();
                            $('#maxTr').show();
                            break;

                        default:
                            $('#frmdt').hide();
                            $('#todt').hide();
                            $('#minb').hide();
                            $('#maxTr').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_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">Miscellaneous Charge Deduction</legend>
            <%if (!error_msg.equalsIgnoreCase("")) {%>
                    <center><div class="info" id="errorMessage"><center><%= error_msg%></center></div></center>
                    <% }%>
            <form name="MiscChargeDeductionForm" id="MiscChargeDeductionForm" action="" method="post">
                <div align="center">

                    <table>
                        <tbody>
                            <tr><tr><tr>
                            <tr>
                                <td><lable>Select Charge Deduction Type<font color="red" >*</font>:</lable></td>
                            <td> <select id="methodType" name="methodType" >
                                    <option value="" selected  >--Select--</option>
                                    <option value="SMSCHARGE" >SMS Charge Deduction</option>
                                    <option value="MISSCHARGE" >Missed Call Charge Deduction</option>
                                    <option value="EMAILCHARGE" >E-Mail Charge Deduction</option>
                                    <option value="NONTXNCHARGE" >Non Transaction Charge Deduction</option>
                                    <option value="MINCHARGE" >Minimum Balance Charge Deduction</option>
                                    <%--<option value="THRESHOLD" >Threshold Cash Debit Transaction Count Charge Deduction</option>--%>
                                </select></td>
                            </tr><td><td>
                            <tr id="maxTr" style="display:none">
                                <td>Maximum No of Cash Debit Transaction Allowed: </td>
                                <td><input type="text" size="20" name="maxCashTra" id="maxCashTra" onkeypress='return event.charCode >= 48 && event.charCode <= 57' /></tr>
                            <tr><tr><tr>
                            <tr>
                                <td>Product Code<font color="red" >*</font>: </td>
                                <td><input type="text" size="20" name="prodCode" id="prodCode" value="" readonly style="text-align:right;"  />
                                <input type="button" value="Search" onclick="javascript:popup_prodCode(500,300,$('#prodCode').val());" /></td>
                            </tr>
                            <tr> 
                                <td>Interest Category: </td>
                                <td><input type="text" size="20" name="intCat" id="intCat" readOnly style="text-align:right;" /></tr>
                            <tr><tr><tr>
                            <tr>
                                <td>Deduction Amount<font color="red" >*</font>: </td>
                                <td><input type="text" size="20" name="txnAmt" id="txnAmt" style="text-align:right;" onkeypress='return event.charCode >= 46 && event.charCode <= 57' /></tr>
                            <tr><tr><tr>
                            <tr id="minb" style="display:none">
                                <td>Minimum Balance To Be Maintained: </td>
                                <td><input type="text" size="20" name="minBal" id="minBal" style="text-align:right;" onkeypress='return event.charCode >= 46 && event.charCode <= 57' /></tr>
                            <tr><tr><tr>
                            <tr id="frmdt" style="display:none">
                                <td>From Date: </td>
                                <td><input type="text" size="20" name="fromdate" id="fromdate" readonly style="text-align:center;" /> <a href="#" onclick="return getCalendar(document.forms[0].fromdate);" /><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></td></tr>
                            <tr><tr><tr>
                            <tr id="todt" style="display:none">
                                <td>To Date: </td>
                                <td><input type="text" size="20" name="todate" id="todate" readonly style="text-align:center;" /> <a href="#" onclick="return getCalendar(document.forms[0].todate);" /><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></td></tr>
                            <tr><tr><tr>
                            <tr>
                                <td>Narration<font color="red" >*</font>: </td>
                                <td><input type="text" size="20" name="narration" id="narration" /></tr>
                            <tr><tr><tr>
                        </tbody>
                    </table>
                    <br>
                    <br><br><br>
                    <center>
                     <input type="button" value="Submit" id="Submit" onclick="submitform(MiscChargeDeductionForm);" />
                     <input type="button" value="Reset" id="Reset" onclick="ShowParent();"</center>
                 </div>
            </form>
        </fieldset>
    </body>
</html>
<% 	} catch (Exception e) {
               
            }
%>