<%--
    Document   : ADHOC transaction
    Created on : Aug 3, 2015, 2:23:35 PM
    Author     : Administrator
--%>
<%@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 import="java.lang.*"%>
<%@page import="java.util.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="java.util.UUID" %>
<%String uuid = UUID.randomUUID().toString();%>
<% try {
%>


<html>
    <head>
        <title>Cash Transaction</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>
        <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.getElementById("screenName").value="DepositTransactionOperation.jsp"
                    document.transactionForm.action = '/PacsApplication/transactionOperationServlet';
                    document.transactionForm.submit();
                }
            }

            function checkCash()
            {
                $("#btnReset" ).click();
               // $("#memberCifRow").hide();
                document.getElementById("trAmount").value = '';
            }

            function checkDiv(transactionForm)
            {
                if (transactionForm.tranType.value == "Not")
                {
                    alert("Transaction type must be selected.");
                    transactionForm.tranType.focus();
                    return false;
                }
                if (transactionForm.accNo.value == "")
                {
                    alert("Please enter Account Number.");
                    transactionForm.accNo.focus();
                    return false;
                }
                if (transactionForm.trAmount.value == "")
                {
                    alert("Please enter Transaction Amount.");
                    transactionForm.trAmount.focus();
                    return false;
                }
                if (transactionForm.narration.value == "")
                {
                    alert("Please enter Transaction Narration.");
                    transactionForm.narration.focus();
                    return false;
                }
                re = /^\d+$/; //this checks whether field contains digits
                if (!re.test(transactionForm.accNo.value))
                {
                    alert("Account No. could only contain numbers.");
                    transactionForm.accNo.focus();
                    return false;
                }

                re = /^(?=.*\d)\d*(?:\.\d*)?$/; //this checks whether field contains digits
                if (!re.test(transactionForm.trAmount.value))
                {
                    alert(".Transaction amount could only contain numbers.");
                    transactionForm.trAmount.focus();
                    return false;
                }
                var amount = $('#resTXNAmt').val();
                if(transactionForm.tranType.value == "1"){
                    if(amount <=0){
                        alert("Amount can not be lesser than or equal to zero when Transaction Credit is performed!!!");
                        return false;
                    }
                }
                if(transactionForm.tranType.value == "2"){
                    if(amount >=0){
                        alert("Amount can not be greater than or equal to zero when Transaction Debit is performed!!!");
                        return false;
                    }
                }

                if(transactionForm.product_id.value=="")
                    {
                        alert("Please search Account Number first before proceeding.");
                        return false;
                    }

                if((transactionForm.product_id.value=="1102")&&(transactionForm.member_count.value!="0")){
                    //alert("IN");

                    var txn_amount  =0;
                    var mem_count=parseInt(document.getElementById("member_count").value);

                    for(var i=1; i<=mem_count;i++)
                    {

                       var amt=0;

                        if(document.getElementById("txnAmount"+i).value=="")
                        {
                            amt=0;
                        }
                        else
                        {
                            amt=parseInt(document.getElementById("txnAmount"+i).value);
                            //alert(amt);
                        }

                        txn_amount=txn_amount+amt;
                    }

                    //alert("txn_amount="+txn_amount);

                    if(document.getElementById("tranType").value=="1"){
                        var tot_txn=parseInt(document.getElementById("totalIN").value) -parseInt(document.getElementById("totalOUT").value);
                        //alert("tot_txn="+tot_txn);
                    }
                    else
                    {
                        var tot_txn=parseInt(document.getElementById("totalOUT").value)-parseInt(document.getElementById("totalIN").value);
                        //alert("tot_txn="+tot_txn);
                    }

                    if(txn_amount!=tot_txn)
                        {
                            alert("Total Transactions made by member and Total Cash In/Out should be equal!!!");
                            return false;
                        }
                }
                return true;
            }

            function popup_depAccount(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 + '';

                //document.getElementById("memberCifRow").style.display='none';
                var screenName = "DepositTransactionOperation.jsp";
                var lovKey = "depositAccount"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInformationDepositLOV.jsp?accNo=' + accNo + '&screenName=' + screenName + '&lovKey=' + lovKey, 'depositAccount', attr);
                popWin.focus();

            }

            function popup_viewSpec(width, height, accNo) {

                if (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 + '';

                //document.getElementById("memberCifRow").style.display='none';
                var screenName = "DepositTransactionOperation.jsp";
                var lovKey = "viewSpeci"
                popWin = open('${pageContext.request.contextPath}/CommonSearchInfoLOVNew.jsp?accNo=' + accNo + '&screenName=' + screenName + '&lovKey=' + lovKey, 'viewSpeci', attr);
                popWin.focus();
                } else {
                    alert("Account No cannot be null.");
                }                
            }

            function checkProdId()
            {
                //alert("INININ");
                //alert(product_id);

                //document.getElementById("memberCifRow").style.display='table-row';
                //document.getElementById("memberSection").style.display='';
                if(($(product_id).val()=='1102')&&($(member_count).val()>0))
                {
                    document.getElementById("screenName").value="ShgTransaction";
                    document.transactionForm.action = '/PacsApplication/transactionOperationServlet';
                    document.transactionForm.submit();
                }
                //alert("INININ");
            }

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

            function resetChange()
            {
                //alert("In");
                //document.getElementById("memberCifRow").style.display='none';
                document.getElementById("product_id").value=null;
                document.getElementById("cust_no").value=null;
                document.getElementById("member_count").value=null;

            }

            $(function() {
                $("#trAmount").keypress(function() {
                    //alert($(member_count).val());
                    if($('#tranType').val() === "Not"){
                        alert("Please select Transaction Type first !!!");
                        event.preventDefault();
                    }else if ($('#accNo').val() === ""){
                        alert("Please enter A/C No. !");
                    }else if($(product_id).val()!='1102'){
                        //alert("Nope");
                        //$("#memberCifRow").hide();
                        $("#myform").show(500);
                    }else if(($(product_id).val()=="1102")&&($(member_count).val()>0)){
                        checkProdId();
                        $("#myform").show(500);
                    }
                    else if ($('#status').val() === "C"){
                        alert("Cash Drawer isn't opened yet !");
                    }
                    else{
                        $("#myform").show(500);
                    }
                });

            });
            $(function() {
                $("#trAmount").click(function() {
                    if($('#tranType').val() === "Not"){
                        alert("Please select Transaction Type first !!!");
                        event.preventDefault();
                    }else if ($('#accNo').val() === ""){
                        alert("Please enter A/C No. !");
                    }else if($(product_id).val()!='1102'){
                        //alert("Nope");
                        //$("#memberCifRow").hide();
                        $("#myform").show(500);
                    }
                    else if(($(product_id).val()=='1102')){
                        //alert("IN");
                        //$("#memberCifRow").style.display="block";
                        //checkProdId();
                        $("#myform").show(500);
                    }
                    else if ($('#status').val() === "C"){
                        alert("Cash Drawer isn't opened yet !");
                    }
                    else{
                        $("#myform").show(500);
                    }
                });
            });

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

            function numbersonly(e){

                var unicode=e.charCode? e.charCode : e.keyCode;
                //alert(unicode);
                if(unicode==46)
                {   //
                    document.forms[0].decimalcounter.value ++;}

                if((document.forms[0].decimalcounter.value>1)&&(unicode==46))
                    {                      
                        return false;
                    }

                if ((unicode!=8)&&(unicode!=46)){ //if the key isn't the backspace key (which we should allow)
                    //alert("IN2");
                    if (unicode<48||unicode>57) //if not a number
                        return false ;//disable key press
                }

                //alert("IN");
            }

            $(document).ready(function(){
                $('#txnAmount1').bind("cut copy paste",function(e) {
                e.preventDefault();
                });
            });
            $(document).ready(function(){
                $('#txnAmount2').bind("cut copy paste",function(e) {
                e.preventDefault();
                });
            });
            $(document).ready(function(){
                $('#txnAmount3').bind("cut copy paste",function(e) {
                e.preventDefault();
                });
            });

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

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

        <%
             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_Deposit.jsp" flush="true" />
        <br>
        <%!
            String blankNull(String s) {
                return (s == null) ? "" : s;
            }
        %>
        <%

                String s_id=null;
                String amt=null;
                String v_narration=null;
                String t_Type="";
                String mem_id=null;
                String p_id=null;
                String c_no=null;
                String mem_c=null;
                if(displayFlag=="Y"){
                s_id=blankNull(request.getAttribute("accNo").toString());
                //String amt=blankNull(request.getAttribute("trAmount").toString());
                v_narration=blankNull(request.getAttribute("narration").toString());
                t_Type=blankNull(request.getAttribute("tranTp").toString());
                //mem_id=blankNull(request.getAttribute("member_id").toString());
                status=blankNull(request.getAttribute("status").toString());
                p_id=blankNull(request.getAttribute("product_id").toString());
                c_no=blankNull(request.getAttribute("cust_no").toString());
                mem_c=blankNull(request.getAttribute("member_count").toString());
                }
        %>



        <fieldset style="border-color: black; background-image: url('/PacsApplication/img/download.jpg'); border-width: 3px">
            <legend style="padding: 8px; border-radius: 20px; background-color: #006600; color: white">Cash Transaction</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">

                            <tr>
                                <td>Select Transaction Type<font color="red" >*</font>:</td>
                                <td><select id="tranType" name="tranType" onchange="checkCash();">
                                        <option value="Not" selected>--Select--</option>
                                        <option value="2" <%if(t_Type.equalsIgnoreCase("2")){%>selected<%}%> >Debit</option>
                                        <option value="1" <%if(t_Type.equalsIgnoreCase("1")){%>selected<%}%> >Credit</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>Account Number<font color="red" >*</font>:</td>
                                <td><input type="text" name="accNo" id="accNo" value="<%=blankNull(s_id)%>" onchange="resetChange()" 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_depAccount(1250, 300, document.transactionForm.accNo.value);"/></td>
                               <td></td><td></td><td></td><td></td><td></td><td></td> <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
                               <td><input type="button" name="viewSpeci" id="viewSpeci" value="View Specimen Copy And ID Proof" onclick="javascript:popup_viewSpec(1250, 300, document.transactionForm.accNo.value);"/></td>
                            </tr>
                            <%if(displayFlag==""){%>
                            <tr><td></td>
                                <td>
                                    <input type="button" id="shg_dtl_btn" name=="shg_dtl_btn" value="Show Members" onclick="checkProdId()" style="display: none" />
                                </td>
                            </tr>
                            <%}%>
                            <%
                                    if(displayFlag=="Y")
                                    {
                            %>
                            <tr id="memberCifRow">
                               <%-- <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_depAccountMember(1250, 300,document.transactionForm.cust_no.value);"</td>
                               --%>

                                <table id="deposit_details_view" border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px;" >
                                        <thead  class="CSSTableGenerator" id="memberSection">
                                        <tr>

                                            <td>Member ID</td>
                                            <td>Member Name</td>
                                            <td>Amount</td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <%
                                            transactionOperationBean oTransactionBean=new transactionOperationBean();
                                            Object alTransactionBeanObj = request.getAttribute("alTransactionBean");
                                            ArrayList<transactionOperationBean> alTransactionBean = new ArrayList<transactionOperationBean>();
                                            if (alTransactionBeanObj != null) {
                                                alTransactionBean = (ArrayList<transactionOperationBean>) request.getAttribute("alTransactionBean");

                                            }
                                            int count = 0;

                                            for (int i = 0; i < alTransactionBean.size(); i++) {
                                                oTransactionBean = alTransactionBean.get(i);

                                                count++;

                                        %>
                                        <tr>

                                            <td><input size="20" readonly type="text" name="member_id<%=count%>" id="member_id<%=count%>"  value="<%=blankNull(oTransactionBean.getMember_id())%>" /></td>
                                            <td><input size="20" type="text" readonly id="member_name<%=count%>" name="member_name<%=count%>" value="<%=blankNull(oTransactionBean.getMember_name())%>"/></td>
                                            <td><input size="20" type="text" name="txnAmount<%=count%>" id="txnAmount<%=count%>" onkeypress='return event.charCode >= 48 && event.charCode <= 57' /></td>
                                            <td style=" display: none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>

                                        </tr>
                                        <%}%>
                                    </tbody>
                                </table>
                            <br>
                            </tr>
                            <%}%>

                            <tr>
                                <td><label>Transaction Amount<font color="red" >*</font>:</label></td>
                                <td id="trAmountTD"><input type="text" name="trAmount" id="trAmount" size="15" value="<%=blankNull(amt)%>" style="text-align:right;" onkeypress='return event.charCode >= 46 && event.charCode <= 57'/></td>
                            </tr>
                            <br>
                            <br>
                            <tr>
                                <td><label>Transaction Narration<font color="red" >*</font>:</label></td>
                                <td><textarea name="narration" id="narration" value="<%=blankNull(v_narration)%>"></textarea> </td>
                            </tr>

                    </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" id="screenName" name="screenName" />
                <input type="hidden" name="status" id="status" value="<%=status%>" />
                <input type="hidden" name="product_id" id="product_id" value="<%=blankNull(p_id)%>" />
               <%-- <input type="hidden" name="memberId" id="memberId" /> --%>
                <input type="hidden" name="cust_no" id="cust_no" value="<%=blankNull(c_no)%>" />
                <input type="hidden" name="member_count" id="member_count" value="<%=blankNull(mem_c)%>" />
                <input name="decimalcounter" id="decimalcounter" type="hidden" value="" />
            </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("Insufficiernt 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() == "1")//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() == "2")//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>');

                }
                //alert($(member_count).val());
                //alert($(product_id).val());


            }
        });
        $('#closePopup').click(function(){
            $( "#btnReset" ).click();
            $('#trAmount').val('0');
            $("#myform").hide(400);
        });

    </script>
    <script>
        //make all inputs whole numbers only
        /*$('table.numbersOnly').on('keydown','#accNo', 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();
            }
        });*/



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

