<%--
    Document   : LoanTransactionOperation
    Created on : Sep 23, 2016, 3:56:20 PM
    Author     : 986137
--%>

<%@page import="DataEntryBean.transactionOperationBean"%>
<%@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"%>
<% try {
%>
<html>
    <head>
        <title>Loan Disbursement Operation</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>
        <%--<link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico" type="image/x-icon" /> --%>
        <style>
            .button{
                border:1px solid #333;
                background:#6479fd;
            }
            .button:hover{
                background:#a4a9fd;
            }
            .dialog{
                border:5px solid #666;
                padding:10px;
                background:#FFFFFF;
                position:absolute;
                left: 300px;
                z-index:1;
                display:none;
            }
            .dialog label{
                display:inline-block;
                color:#151414;
            }
            div .dialog input[type=text]{
                border:none;
                display:inline-block;
                margin:5px;
                width: 180px;
                -moz-user-select:-moz-none;
                -moz-user-select:none;
                -o-user-select:none;
                -khtml-user-select:none;
                -webkit-user-select:none;
                -ms-user-select:none;
                user-select:none;
            }

        </style>

    </head>

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

            function submitform(transactionForm)
            {
                if (checkDiv(transactionForm))
                {

                    document.transactionForm.action = '/PacsApplication/LoanTransactionOperationServlet';
                    document.transactionForm.submit();
                }
            }

            function checkDiv(transactionForm)
            {
                var tAmt = document.getElementById("trAmount").value;

                if (tAmt.indexOf('.') != -1) {
                    alert("Please do not enter any decimal value in Transaction Amount!");
                    document.getElementById("trAmount").focus();
                    return false;
                }
                if (transactionForm.accNo.value == "")
                {
                    alert("Please enter Account Number.");
                    transactionForm.accNo.focus();
                    return false;
                }
                if(transactionForm.tranType.value == "Not")
                {
                    alert("Payment Mode must be selected.");
                    transactionForm.tranType.focus();
                    return false;
                }
                if(transactionForm.tranType.value == "T")
                {
                    if (transactionForm.transferAcc.value == "")
                    {
                        alert("Transfer A/C cannot not be empty.");
                        transactionForm.transferAcc.focus();
                        return false;
                    }
                }
                if (transactionForm.trAmount.value == "")
                {
                    alert("Transaction Amount must be filled.");
                    transactionForm.trAmount.focus();
                    return false;
                }                
                if (transactionForm.chargeToDeduct.value == "")
                {
                    alert("Charges to be deducted must be filled.");
                    transactionForm.chargeToDeduct.focus();
                    return false;
                }
                if (transactionForm.narration.value == "")
                {
                    alert("Narration must be filled.");
                    transactionForm.narration.focus();
                    return false;
                }
                                
              if((document.getElementById("product_code").value=="7002") && (document.getElementById("tranType").value=="C")&&(document.getElementById("member_count").value!="0"))
                    {
                        //alert
                        if(document.getElementById("memberId").value=="")
                            {
                                alert("Member Name can not be empty.");
                                transactionForm.memberName.focus();
                                return false;
                            }
                    }
                return true;
            }

            function showTr()
            {
                //alert(document.getElementById("product_code").value);

                if((document.getElementById("product_code").value=="7002")&&(document.getElementById("member_count").value!="0"))
                    {
                        //alert("IN 2");
                        document.getElementById("memberCifRow").style.display='table-row';
                    }
                else
                    {
                      document.getElementById("memberCifRow").style.display='none';
                    }
            }
            $(function() {
                $("#trAmount").keypress(function() {

                    if($('#tranType').val() === null){
                        alert("Please select Transaction Type first.");
                        event.preventDefault();
                    }else if ($('#accNo').val() === ""){
                        alert("Please enter A/C No. !");
                        event.preventDefault();
                    }
                    else if ($('#status').val() === "C" && $('#tranType').val() ==="C"){
                        alert("Cash Drawer isn't opened yet.");
                        event.preventDefault();
                    }
                    else{
                        if($('#tranType').val() === "C"){
                            $("#myform").show(500);
                            event.preventDefault();
	                    alert("Please fill in the cash drawer entries for transaction amount.");
                        }
                    }
                });
            });

            $(function() {
                $("#trAmount").click(function() {

                    if($('#tranType').val() === null){
                        alert("Please select Transaction Type first.");
                        event.preventDefault();
                    }else if ($('#accNo').val() === ""){
                        alert("Please enter A/C No. !");
                        event.preventDefault();
                    }
                    else if ($('#status').val() === "C" && $('#tranType').val() ==="C"){
                        alert("Cash Drawer isn't opened yet !");
                    }
                    else{
                        if($('#tranType').val() === "C"){
                            $("#myform").show(500);
                        }
                    }
                });
            });

            $(document).ready(function () {
                $('select#tranType').change(function () {
                    $('#trAmount').val('');
                    $('#transferAcc').val('');
                    $( "#btnReset" ).click();
                    var val = $(this).val();

                    if($('#product_code').val() == ""){
                        alert("Please search Account Number first before proceeding.");
                        event.preventDefault();
                        $('#tranType').val("Not");
                    }
                    else{
                    switch(val)
                    {
                        case 'C':
                            $('#tran').hide();
                            $('#transferaccNoSearch').hide();
                            showTr();
                            break;
                        case 'T':

                            $('#tran').show();
                            $('#transferaccNoSearch').show();
                            $('#memberCifRow').hide();
                            $('#btnReset').click();
                            break;
                        default:

                            $('#tran').hide();
                            $('#transferaccNoSearch').hide();
                            $('#memberCifRow').hide();
                            break;
                    }
                }});
            });

            function popup_loanAcc(width, height, accNo) {
                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 = "LoanTransactionOperation.jsp";
                var  lovKey="LoanAcctSearchfor_Transaction"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationLoanLOV.jsp?accNo=' + accNo + '&screenName=' + screenName+'&lovKey='+lovKey, 'LoanAcctSearchfor_Transaction', attr);
                popWin.focus();

            }

            function popup_TransdepAccount(width, height, accNo) {
                if($('#accNo').val() == ""){
                    alert( "Please select A/C No. first !!" );
                }else if($('#tranType').val() == ""){
                    alert( "Please select Payment Method  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 = "LoanTransactionOperation.jsp";
                    var  lovKey="SavingsAccSearchTransfer"
                    popWin = open('/PacsApplication/CommonSearchInformationLoanLOV.jsp?accNo=' + accNo + '&screenName=' + screenName+'&lovKey='+lovKey, 'SavingsAccSearchTransfer', attr);
                    popWin.focus();

                }
            }

            function isNumber(evt){
                evt = (evt)? evt : window.event;
                var charCode = (evt.which) ? evt.which:evt.keyCode;
                if(charCode > 31 && (charCode<48 || charCode>57)){
                    return false;
                }
                return true;
            }

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

            function popup_loanAccountMember(width, height, accNo) {
                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 = "LoanTransactionOperation.jsp";
                var lovKey = "loanShgMember"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationLoanLOV.jsp?accNo=' + accNo + '&screenName=' + screenName + '&lovKey=' + lovKey, 'depositShgMember', attr);
                popWin.focus();
            }

            function resetMember()
            {
                document.getElementById("product_code").value=null;
                document.getElementById("tranType").value="Not";
                document.getElementById("memberCifRow").style.display='none';
                document.getElementById("transferaccNoSearch").style.display='none';
                document.getElementById("tran").style.display='none';
                document.getElementById("cust_no").value=null;
                document.getElementById("memberId").value=null;
                document.getElementById("memberName").value=null;
            }
            
        // 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();
             }
        %>

        <%
             String displayFlag = "";
             Object display = request.getAttribute("displayFlag");
             if (display != null) {
                 displayFlag = display.toString();
             }
        %>
        <%          String odeno2000 = "";
             String odeno500 = "";
             String odeno200 = "";
             String odeno100 = "";
             String odeno50 = "";
             String odeno20 = "";
             String odeno10 = "";
             String odeno5 = "";
             String odeno2 = "";
             String odeno1 = "";
             String status = "C";
             String odeno50P = "";
             String odeno1P = "";
             String pacsid = (String) session.getAttribute("pacsId");
             String makerId = session.getAttribute("user").toString();
             Connection connection = null;
             ResultSet rs = null;
             Statement statement = null;
             connection = DbHandler.getDBConnection();
             try {
                 statement = connection.createStatement();
                 rs = statement.executeQuery("select nvl(d.deno_2000,0),nvl(d.deno_500,0),nvl(d.deno_100,0),nvl(d.deno_50,0),nvl(d.deno_20,0),nvl(d.deno_10,0),nvl(d.deno_5,0),nvl(d.deno_2,0),nvl(d.deno_1,0),nvl(d.DENO_50P,0),nvl(d.DENO_1P,0),d.status,nvl(d.deno_200,0) from cash_drawer d where d.entry_date = (select system_date from system_date) and  d.teller_id ='" + makerId + "' and d.pacs_id ='" + pacsid + "' ");

                 while (rs.next()) {
                     odeno2000 = rs.getString(1);
                     odeno500 = rs.getString(2);
                     odeno100 = rs.getString(3);
                     odeno50 = rs.getString(4);
                     odeno20 = rs.getString(5);
                     odeno10 = rs.getString(6);
                     odeno5 = rs.getString(7);
                     odeno2 = rs.getString(8);
                     odeno1 = rs.getString(9);
                     odeno50P = rs.getString(10);
                     odeno1P = rs.getString(11);
                     status = rs.getString(12);
                     odeno200 = rs.getString(13);
                 } 
                // statement.close();         
                // connection.close();
             } catch (Exception e) {
                System.out.println("Error occurred during processing.");
            } finally {
                try {
                    if(statement !=null)
                        statement.close();
                    if (connection != null)
                    connection.close();

            } catch (Exception e) {               
               System.out.println("Error Occurred during connection close.");
            }

            }
        %>

        <jsp:include page="MenuHead_Loan.jsp" flush="true" />
        <br>
        <%!
            String blankNull(String s) {
                return (s == null) ? "" : s;
            }
        %>

        <%
             Object otransactionOperationBeanObj = request.getAttribute("otransactionOperationBeanObj");
             transactionOperationBean otransactionOperationBean = new transactionOperationBean();
             if (otransactionOperationBeanObj != null) {
                 otransactionOperationBean = (transactionOperationBean) request.getAttribute("otransactionOperationBeanObj");
                 session.setAttribute("otransactionOperationBeanObj", otransactionOperationBeanObj);
             }
        %>

        <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 Disbursement Operation</legend>
            <form name="transactionForm" method="post" action="">


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

                    <table border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px">
                        <thead class="CSSTableGenerator">
                            <tr>
                                <td>Denominations</td>
                                <td>Available</td>
                                <td>IN</td>
                                <td>OUT</td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td align="left"><label>2000 Note</label></td>
                                <td><input type="text" readonly name="twothouAvail" id="twothouAvail" class="available" value="<%=odeno2000%>"></td>
                                <td><input type="text" name="twothouIN" id="twothouIN" class="inDeno"></td>
                                <td><input type="text" name="twothouOUT" id="twothouOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>500 Note</label></td>
                                <td><input type="text" readonly name="fivehundredAvail" id="fivehundredAvail" class="available" value="<%=odeno500%>"></td>
                                <td><input type="text" name="fivehundredIN" id="fivehundredIN" class="inDeno"></td>
                                <td><input type="text" name="fivehundredOUT" id="fivehundredOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>200 Note</label></td>
                                <td><input type="text" readonly name="twohundredAvail" id="twohundredAvail" class="available" value="<%=odeno200%>"></td>
                                <td><input type="text" name="twohundredIN" id="twohundredIN" class="inDeno"></td>
                                <td><input type="text" name="twohundredOUT" id="twohundredOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>100 Note</label></td>
                                <td><input type="text" readonly name="hundredAvail" id="hundredAvail" class="available" value="<%=odeno100%>"></td>
                                <td><input type="text" name="hundredIN" id="hundredIN" class="inDeno"></td>
                                <td><input type="text" name="hundredOUT" id="hundredOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>50 Note</label></td>
                                <td><input type="text" readonly name="fiftyAvail" id="fiftyAvail" class="available" value="<%=odeno50%>"></td>
                                <td><input type="text" name="fiftyIN" id="fiftyIN" class="inDeno"></td>
                                <td><input type="text" name="fiftyOUT" id="fiftyOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>20 Note</label></td>
                                <td><input type="text" readonly name="twentyAvail" id="twentyAvail" class="available" value="<%=odeno20%>"></td>
                                <td><input type="text" name="twentyIN" id="twentyIN" class="inDeno"></td>
                                <td><input type="text" name="twentyOUT" id="twentyOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>10 Note</label></td>
                                <td><input type="text" readonly name="tenAvail" id="tenAvail" class="available" value="<%=odeno10%>"></td>
                                <td><input type="text" name="tenIN" id="tenIN" class="inDeno"></td>
                                <td><input type="text" name="tenOUT" id="tenOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>5 Note</label></td>
                                <td><input type="text" readonly name="fiveAvail" id="fiveAvail" class="available" value="<%=odeno5%>"></td>
                                <td><input type="text" name="fiveIN" id="fiveIN" class="inDeno"></td>
                                <td><input type="text" name="fiveOUT" id="fiveOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>2 Note</label></td>
                                <td><input type="text" readonly name="twoAvail" id="twoAvail" class="available" value="<%=odeno2%>"></td>
                                <td><input type="text" name="twoIN" id="twoIN" class="inDeno"></td>
                                <td><input type="text" name="twoOUT" id="twoOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>1 Note</label></td>
                                <td><input type="text" readonly name="oneAvail" id="oneAvail" class="available" value="<%=odeno1%>"></td>
                                <td><input type="text" name="oneIN" id="oneIN" class="inDeno"></td>
                                <td><input type="text" name="oneOUT" id="oneOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>50 Paisa</label></td>
                                <td><input type="text" readonly name="fiftyPaisaAvail" id="fiftyPaisaAvail" class="available" value="<%=odeno50P%>"></td>
                                <td><input type="text" name="fiftyPaisaIN" id="fiftyPaisaIN" class="inDeno"></td>
                                <td><input type="text" name="fiftyPaisaOUT" id="fiftyPaisaOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>1 Paisa</label></td>
                                <td><input type="text" readonly name="onePaisaAvail" id="onePaisaAvail" class="available" value="<%=odeno1P%>"></td>
                                <td><input type="text" name="onePaisaIN" id="onePaisaIN" class="inDeno"></td>
                                <td><input type="text" name="onePaisaOUT" id="onePaisaOUT" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td colspan="2" align="left"><label>Total IN/OUT</label></td>

                                <td><input type="text" readonly name="totalIN" id="totalIN" ></td>
                                <td><input type="text" readonly name="totalOUT" id="totalOUT" ></td>
                            </tr>
                            <tr>
                                <td><label>Cash Drawer Present Balance</label></td>
                                <td><input type="text" readonly name="cashDRWBal" id="cashDRWBal" ></td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td><label>Resulted Txn Amount</label></td>
                                <td><input type="text" readonly name="resTXNAmt" id="resTXNAmt"></td>
                                <td></td>
                                <td></td>
                            </tr>
                        </tbody>
                    </table>
                    <br>
                    <div align="center">
                        <input type="button" value="Ok" id="btnOK"><input type="button" value="Reset" id="btnReset"><input type="button" value="Close" id="closePopup">
                    </div>
                </div>

                <div id="transaction" style="display:block;">
                    <table class="numbersOnly">
                        <tbody>
                            <%-- <tr>
                                 <td>Select Transaction Type:</td>
                                 <td><select id="tranType" name="tranType">
                                         <option value="" disabled selected style="display:none;">--Select--</option>
                                         <option value="2">Debit</option>
                                         <option value="1">Credit</option>
                                     </select>
                                 </td>
                             </tr> --%>
                            <tr>
                                <td style="text-align:right;">Account Number<font color="red" >*</font>:</td>
                                <td><input type="text" name="accNo" id="accNo" onchange="resetMember()" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57'  /></td>
                                <td><input type="button" name="accNoSearch" id="accNoSearch" value="Search" onclick="javascript:popup_loanAcc(520, 180, document.transactionForm.accNo.value);"/></td>
                            </tr>
                            <tr>
                                <td style="text-align:right;">Payment Mode<font color="red" >*</font>:</td>
                                <td><select id="tranType" name="tranType">
                                        <option value="Not" disabled selected style="display: none">-- Select --</option>
                                        <option value="C">Cash/Cheque</option>
                                        <option value="T">Transfer</option>
                                    </select>
                                </td>
                            </tr>
                            <tr id="memberCifRow" style="display: none">
                                <td>Member's Name</td>
                                <td><input type="text" name ="memberName" id="memberName" readonly/></td>
                                <td><input type="button" name="memberCifNo" id="memberCifNo" value="Search" onclick="javascript:popup_loanAccountMember(1250, 300,document.transactionForm.cust_no.value);"</td>
                            </tr>

                            <tr><td style="text-align:right;">Transaction Amount<font color="red" >*</font>:</td>
                                <td><input type="text" name="trAmount" id="trAmount" size="15" value="" style="text-align:right;"/></td>
                            </tr>
                            <tr class="trAmountTD">
                                <%--<td>Transaction Amount:</td>
                                <td><input type="text" name="trAmount" id="trAmount" size="15" value=""/></td>--%>
                                <tr id="tran" name="tran" style="display: none">
                                    <td>Transfer A/C Number: </td>
                                    <td><input type="text" readonly name="transferAcc" id="transferAcc" style="text-align:right;"/></td>
                                    <td><input type="button" name="transferaccNoSearch" id="transferaccNoSearch" value="Search" onclick="javascript:popup_TransdepAccount(220, 180, document.transactionForm.accNo.value);"/></td>
                            </tr>                            
                            <tr>
                                <td>Charges to be deducted<font color="red" >*</font>:</td>
                                <td><input type="text" name="chargeToDeduct" id="chargeToDeduct" size="15" value="" style="text-align:right;"/></td>
                            </tr>
                            <tr>
                                <td>Transaction Narration<font color="red" >*</font>:</td>
                                <td><textarea name="narration" id="narration"></textarea> </td>
                            </tr>
                        </tbody>
                    </table><br><br>
                    <center>
                        <input type="button" value="Submit" onclick="javascript:submitform(transactionForm)">
                        <input type="button" value="Reset" onclick="javascript:ShowParent()" />

                    </center>
                </div>
                <input type="hidden" value="LoanTransactionOperation" name="screenName" />
                <input type="hidden" value="<%=status%>" name="status" id="status" />
                <input type="hidden" name="product_code" id="product_code" />
                <input type="hidden" name="memberId" id="memberId" />
                <input type="hidden" name="cust_no" id="cust_no" />
                <input type="hidden" name="member_count" id="member_count" />
            </form>
        </fieldset>
    </body>

    <script>

        function check(v){
            if(isNaN(v) || v == '' || v.trim().length == 0){ return parseInt(0);}
            else { return v;}
        }

        var first = $('#twothouAvail').val();
        var second = $('#fivehundredAvail').val();
        var third = $('#hundredAvail').val();
        var fourth = $('#fiftyAvail').val();
        var fifth = $('#twentyAvail').val();
        var sixth = $('#tenAvail').val();
        var seventh = $('#fiveAvail').val();
        var eighth = $('#twoAvail').val();
        var ninth = $('#oneAvail').val();
        var eleventh = $('#fiftyPaisaAvail').val();
        var twelveth = $('#onePaisaAvail').val();
        var thirtinth = $('#twohundredAvail').val();

        $(document).ready(function() {
            $('#myform').find(':input.inDeno[type="text"],#totalIN,#totalOUT,#resTXNAmt').val('0');
            $('#myform').find(':input.outDeno[type="text"]').val('0');
            $('.inDeno,.outDeno').css({"background-color": "#FFFFC1"});
            $('#totalIN,#totalOUT').css({"background-color": "#ffff93"});
            $('#cashDRWBal,#resTXNAmt').css({"background-color": "#b2d0b2"});
        });

        var AvailsumOnLoad = 0;
        var DenoINsumOnLoad = 0;

        AvailsumOnLoad = parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1)+ parseFloat(parseInt(check($('#fiftyPaisaAvail').val())) * 0.50) + parseFloat(parseInt(check($('#onePaisaAvail').val())) * 0.01)  ;
        $("#cashDRWBal").val(AvailsumOnLoad);
        var tenth = $('#cashDRWBal').val();//calculating present cash drawer value for first time

        $( "#btnReset" ).click(function() {
            $('#myform').find(':input.inDeno[type="text"],:input.outDeno[type="text"]').val('0');
            $("#totalIN").val('0');
            $("#totalOUT").val('0');
            $('#twothouAvail').val(first);
            $('#fivehundredAvail').val(second);
            $('#hundredAvail').val(third);
            $('#fiftyAvail').val(fourth);
            $('#twentyAvail').val(fifth);
            $('#tenAvail').val(sixth);
            $('#fiveAvail').val(seventh);

            $('#twoAvail').val(eighth);
            $('#oneAvail').val(ninth);
            $('#fiftyPaisaAvail').val(eleventh);
            $('#onePaisaAvail').val(twelveth);
            $("#cashDRWBal").val(tenth);
            $('#resTXNAmt').val('0');
            $('#twohundredAvail').val(thirtinth);
            if ($('.trAmountTD').find('img').length > 0){
                $('.DenoAdded').remove();
            }
        });

        //make all inputs whole numbers only
        $('.dialog').on('keydown',':input[type="text"]', 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 == 9 || event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46) {

            } else {
                event.preventDefault();
            }
        });

        //calculating IN & OUT Total,and Resultant final Amount
        $('#myform').on("keyup", ".inDeno,.outDeno", function() {
            var DenoINsumOnChange = 0;
            var DenoOUTsumOnChange = 0;
            DenoINsumOnChange = parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01);
            $("#totalIN").val(DenoINsumOnChange);
            DenoOUTsumOnChange = parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val()) * 0.01);
            $("#totalOUT").val(DenoOUTsumOnChange);
            $('#resTXNAmt').val(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));
        });

        //for Rs 2000 starts
        $('#myform').on("keyup", "#twothouOUT", function() {
            if(parseInt($("#twothouAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.2000 Notes");
                $('#btnReset').click();
            }
            else{
                $('#twothouAvail').val(parseInt(check(first)) + (parseInt(check($('#twothouIN').val())) - parseInt(check($('#twothouOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#twothouOUT", function() {
            if(parseInt(first)< parseInt(check($('#twothouOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#twothouIN", function() {

                $('#twothouAvail').val(parseInt(check(first)) + (parseInt(check($('#twothouIN').val())) - parseInt(check($('#twothouOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });

        //for Rs 500 starts
        $('#myform').on("keyup", "#fivehundredOUT", function() {
            if(parseInt($("#fivehundredAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.500 Notes");
                $('#btnReset').click();
            }
            else{
                $('#fivehundredAvail').val(parseInt(check(second)) + (parseInt(check($('#fivehundredIN').val())) - parseInt(check($('#fivehundredOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#fivehundredOUT", function() {
            if(parseInt(second)< parseInt(check($('#fivehundredOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#fivehundredIN", function() {

                $('#fivehundredAvail').val(parseInt(check(second)) + (parseInt(check($('#fivehundredIN').val())) - parseInt(check($('#fivehundredOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });

        //for Rs 200 starts
        $('#myform').on("keyup", "#twohundredOUT", function() {
            if(parseInt($("#twohundredAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.200 Notes");
                $('#btnReset').click();
            }
            else{
                $('#twohundredAvail').val(parseInt(check(thirtinth)) + (parseInt(check($('#twohundredIN').val())) - parseInt(check($('#twohundredOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#twohundredOUT", function() {
            if(parseInt(thirtinth)< parseInt(check($('#twohundredOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#twohundredIN", function() {

                $('#twohundredAvail').val(parseInt(check(thirtinth)) + (parseInt(check($('#twohundredIN').val())) - parseInt(check($('#twohundredOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });

        //for Rs 100 starts
        $('#myform').on("keyup", "#hundredOUT", function() {
            if(parseInt($("#hundredAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.100 Notes");
                $('#btnReset').click();
            }
            else{
                $('#hundredAvail').val(parseInt(check(third)) + (parseInt(check($('#hundredIN').val())) - parseInt(check($('#hundredOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#hundredOUT", function() {
            if(parseInt(third)< parseInt(check($('#hundredOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#hundredIN", function() {

                $('#hundredAvail').val(parseInt(check(third)) + (parseInt(check($('#hundredIN').val())) - parseInt(check($('#hundredOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });


        //for Rs 50 starts
        $('#myform').on("keyup", "#fiftyOUT", function() {
            if(parseInt($("#fiftyAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.50 Notes");
                $('#btnReset').click();
            }
            else{
                $('#fiftyAvail').val(parseInt(check(fourth)) + (parseInt(check($('#fiftyIN').val())) - parseInt(check($('#fiftyOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#fiftyOUT", function() {
            if(parseInt(fourth)< parseInt(check($('#fiftyOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#fiftyIN", function() {

                $('#fiftyAvail').val(parseInt(check(fourth)) + (parseInt(check($('#fiftyIN').val())) - parseInt(check($('#fiftyOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });

        //for Rs 20 starts
        $('#myform').on("keyup", "#twentyOUT", function() {
            if(parseInt($("#twentyAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.20 Notes");
                $('#btnReset').click();
            }
            else{
                $('#twentyAvail').val(parseInt(check(fifth)) + (parseInt(check($('#twentyIN').val())) - parseInt(check($('#twentyOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#twentyOUT", function() {
            if(parseInt(fifth)< parseInt(check($('#twentyOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#twentyIN", function() {

                $('#twentyAvail').val(parseInt(check(fifth)) + (parseInt(check($('#twentyIN').val())) - parseInt(check($('#twentyOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });

        //for Rs 10 starts
        $('#myform').on("keyup", "#tenOUT", function() {
            if(parseInt($("#tenAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.10 Notes");
                $('#btnReset').click();
            }
            else{
                $('#tenAvail').val(parseInt(check(sixth)) + (parseInt(check($('#tenIN').val())) - parseInt(check($('#tenOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#tenOUT", function() {
            if(parseInt(sixth)< parseInt(check($('#tenOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#tenIN", function() {

                $('#tenAvail').val(parseInt(check(sixth)) + (parseInt(check($('#tenIN').val())) - parseInt(check($('#tenOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });


        //for Rs 5 starts
        $('#myform').on("keyup", "#fiveOUT", function() {
            if(parseInt($("#fiveAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.5 Notes");
                $('#btnReset').click();
            }
            else{
                $('#fiveAvail').val(parseInt(check(seventh)) + (parseInt(check($('#fiveIN').val())) - parseInt(check($('#fiveOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#fiveOUT", function() {
            if(parseInt(seventh)< parseInt(check($('#fiveOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#fiveIN", function() {

                $('#fiveAvail').val(parseInt(check(seventh)) + (parseInt(check($('#fiveIN').val())) - parseInt(check($('#fiveOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });


        //for Rs 2 starts
        $('#myform').on("keyup", "#twoOUT", function() {
            if(parseInt($("#twoAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.2 Notes");
                $('#btnReset').click();
            }
            else{
                $('#twoAvail').val(parseInt(check(eighth)) + (parseInt(check($('#twoIN').val())) - parseInt(check($('#twoOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#twoOUT", function() {
            if(parseInt(eighth)< parseInt(check($('#twoOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#twoIN", function() {

                $('#twoAvail').val(parseInt(check(eighth)) + (parseInt(check($('#twoIN').val())) - parseInt(check($('#twoOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });


        //for Rs 1 starts
        $('#myform').on("keyup", "#oneOUT", function() {
            if(parseInt($("#oneAvail").val())<= 0)
            {
                alert("Insufficient Rs.1 Notes");
                $('#btnReset').click();
            }
            else{
                $('#oneAvail').val(parseInt(check(ninth)) + (parseInt(check($('#oneIN').val())) - parseInt(check($('#oneOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#oneOUT", function() {
            if(parseInt(ninth)< parseInt(check($('#oneOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#oneIN", function() {

                $('#oneAvail').val(parseInt(check(ninth)) + (parseInt(check($('#oneIN').val())) - parseInt(check($('#oneOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });

        //for 50 Paisa starts
        $('#myform').on("keyup", "#fiftyPaisaOUT", function() {
            if(parseInt($("#fiftyPaisaAvail").val())<= 0)
            {
                alert("Insufficiernt 50 Paisa");
                $('#btnReset').click();
            }
            else{
                $('#fiftyPaisaAvail').val(parseInt(check(eleventh)) + (parseInt(check($('#fiftyPaisaIN').val())) - parseInt(check($('#fiftyPaisaOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#fiftyPaisaOUT", function() {
            if(parseInt(eleventh)< parseInt(check($('#fiftyPaisaOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#fiftyPaisaIN", function() {

                $('#fiftyPaisaAvail').val(parseInt(check(eleventh)) + (parseInt(check($('#fiftyPaisaIN').val())) - parseInt(check($('#oneOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });

        //for 1 Paisa starts
        $('#myform').on("keyup", "#onePaisaOUT", function() {
            if(parseInt($("#onePaisaAvail").val())<= 0)
            {
                alert("Insufficiernt 1 Paisa");
                $('#btnReset').click();
            }
            else{
                $('#onePaisaAvail').val(parseInt(check(twelveth)) + (parseInt(check($('#onePaisaIN').val())) - parseInt(check($('#onePaisaOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));
            }
        });
        $('#myform').on("change", "#onePaisaOUT", function() {
            if(parseInt(twelveth)< parseInt(check($('#onePaisaOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }
        });
        $('#myform').on("keyup", "#onePaisaIN", function() {

                $('#onePaisaAvail').val(parseInt(check(twelveth)) + (parseInt(check($('#onePaisaIN').val())) - parseInt(check($('#onePaisaOUT').val()))));
                $("#totalOUT").val(parseInt(check($('#twothouOUT').val())) * 2000 + parseInt(check($('#fivehundredOUT').val())) * 500 + parseInt(check($('#twohundredOUT').val())) * 200 + parseInt(check($('#hundredOUT').val())) * 100 + parseInt(check($('#fiftyOUT').val())) * 50 + parseInt(check($('#twentyOUT').val())) * 20 + parseInt(check($('#tenOUT').val())) * 10 + parseInt(check($('#fiveOUT').val())) * 5 + parseInt(check($('#twoOUT').val())) * 2 + parseInt(check($('#oneOUT').val())) + parseFloat(check($('#fiftyPaisaOUT').val()) * 0.50) + parseFloat(check($('#onePaisaOUT').val())* 0.01));
                $('#totalIN').val(parseInt(check($('#twothouIN').val())) * 2000 + parseInt(check($('#fivehundredIN').val())) * 500 + parseInt(check($('#twohundredIN').val())) * 200 + parseInt(check($('#hundredIN').val())) * 100 + parseInt(check($('#fiftyIN').val())) * 50 + parseInt(check($('#twentyIN').val())) * 20 + parseInt(check($('#tenIN').val())) * 10 + parseInt(check($('#fiveIN').val())) * 5 + parseInt(check($('#twoIN').val())) * 2 + parseInt(check($('#oneIN').val())) + parseFloat(check($('#fiftyPaisaIN').val()) * 0.50) + parseFloat(check($('#onePaisaIN').val()) * 0.01));
                $("#cashDRWBal").val(parseInt(check($('#twothouAvail').val()) * 2000) + parseInt(check($('#fivehundredAvail').val()) * 500) + parseInt(check($('#twohundredAvail').val()) * 200) + parseInt(check($('#hundredAvail').val()) * 100)+ parseInt(check($('#fiftyAvail').val()) * 50)+ parseInt(check($('#twentyAvail').val()) * 20)+ parseInt(check($('#tenAvail').val()) * 10)+ parseInt(check($('#fiveAvail').val()) * 5)+ parseInt(check($('#twoAvail').val()) * 2)+ parseInt(check($('#oneAvail').val()) * 1) + parseFloat(check($('#fiftyPaisaAvail').val()) * 0.50) + parseFloat(check($('#onePaisaAvail').val()) * 0.01));
                $('#resTXNAmt').val(Number(check($('#totalIN').val())) - Number(check($('#totalOUT').val())));

        });


        //Reset transaction amout when OK button clicks
        $('#btnOK').click(function(){
            var amount = $('#resTXNAmt').val();
            var flag = 0;
            if($('#tranType').val() == "T")//crdeit
            {
                if(Number(amount) <= 0){
                    alert("Amount can not be lesser than or equal to zero when Transaction Credit is performed! ");
                    flag = 1;
                }
            }
            else if($('#tranType').val() == "C")//debit
            {
                if(Number(amount) >= 0){
                    alert("Amount can not be greater than or equal to zero when Transaction Debit is performed! ");
                    flag = 1;
                }
            }
            if(parseInt(flag) == 0){
                $('#trAmount').val(Number(Math.abs(amount)));
                $("#myform").hide(400);
                if ($('.trAmountTD').find('img').length == 0)
                {

                    $('.trAmountTD').append('<span class="DenoAdded" style="padding-right:3px; padding-top: 3px; padding-left: 5px; display:inline-block;"><img class="manImg" src="${pageContext.request.contextPath}/img/check.png" width="15" height="20"/>Denomination added</span>');

                }
            }
        });
        $('#closePopup').click(function(){
            $( "#btnReset" ).click();
            $('#trAmount').val('0');
            $("#myform").hide(400);
        });
    </script>
    <script>
        //make all inputs whole numbers only
        $('table.numbersOnly').on('keydown','#transferAcc', 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();
            }
        });
         $('table.numbersOnly').on('keydown','#chargeToDeduct,#trAmount', 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 || event.keyCode == 190 || event.keyCode == 110) {

            } else {
                event.preventDefault();
            }
            if($(this).val().indexOf('.') !== -1 && (event.keyCode == 190 || event.keyCode == 110))
                    { event.preventDefault();}
        });


    </script>
</html>
<% 	} catch (Exception e) {
                
            }
%>