<%--
    Document   : TDOperation
    Created on : Nov 7, 2016, 12:41:01 PM
    Author     : 986137
--%>

<%@page import="DataEntryBean.transactionOperationBean"%>
<%@page import="DataEntryBean.transactionOperationBean"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.util.Date"%>
<%@page import="LoginDb.DbHandler"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

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



<html>
    <head>
        <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())%>" />
        <title>Term Deposit Operation</title>
        <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:1px solid #333;
                display:inline-block;
                margin:5px;
                width: 180px;

            }
        </style>
        <style>
            #image-holder{
                position: absolute;
                top:200;
                right: 0;
                left: 800;
                bottom:376;
                width: auto;

            }

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


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

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

            }

            function checkDiv(transactionForm)
            {
                var tranAmt = parseFloat(Math.abs(transactionForm.trAmount.value)).toFixed(2);
                var prinAmt = parseFloat(Math.abs(transactionForm.prinAmt.value)).toFixed(2);
                var inttAmount = parseFloat(Math.abs(transactionForm.inttAmount.value)).toFixed(2);
                var res_princopalAmt = parseFloat(Math.abs(transactionForm.resTXNAmt.value)).toFixed(2);
                var resCashDrawer = parseFloat(Math.abs(transactionForm.resTXNAmt.value)).toFixed(2);
                var res_inttAmt = parseFloat(Math.abs(transactionForm.resTXNAmt_intt.value)).toFixed(2);
                var intAdjAmt = parseFloat(Math.abs(transactionForm.intAdjAmt.value)).toFixed(2);
                var net = parseFloat(Math.abs(transactionForm.netAmt.value)).toFixed(2);

                /*if(inttAmount == "" || inttAmount == null)
                    inttAmount = 0;
                net = prinAmt + inttAmount + intAdjAmt;*/
                if (transactionForm.tranType.value == "")
                {
                    alert("Transaction Type must be selected.");
                    transactionForm.tranType.focus();
                    return false;
                }
                if (transactionForm.accNo.value == "")
                {
                    alert("Account Number must be selected.");
                    transactionForm.accNo.focus();
                    return false;
                }
                if (transactionForm.trAmount.value == "" && document.getElementById("tranType").value == "D")
                {
                    alert("Please select a valid Account to get Transaction Amount.");
                    transactionForm.trAmount.focus();
                    return false;
                }
                if (transactionForm.trAmount.value == "" && document.getElementById("tranType").value == "P")
                {
                    alert("Please select a valid Account to get Transaction Amount.");
                    transactionForm.trAmount.focus();
                    return false;
                }
                if (transactionForm.prinAmt.value == "" && document.getElementById("tranType").value == "W")
                {
                    alert("Please select a valid Account to get Principal Amount.");
                    transactionForm.prinAmt.focus();
                    return false;
                }
                /*if (transactionForm.inttAmount.value == "" && document.getElementById("tranType").value == "W")
                {
                    alert("!! Please select a valid Account to get Interest Amount !!");
                    transactionForm.inttAmount.focus();
                    return false;
                }*/

                if ((transactionForm.tranType.value == "W" || transactionForm.tranType.value == "P") && transactionForm.intAdjAmt.value == "")
                {
                    alert("Please enter amount for interest adjustment");
                    transactionForm.intAdj.focus();
                    return false;
                }


                if(transactionForm.tranType.value == "W" || transactionForm.tranType.value == "P"){
                    if (transactionForm.payMode.value == "")
                    {
                        alert("Payment Method cant not be empty.");
                        transactionForm.payMode.focus();
                        return false;
                    }
                    if (transactionForm.intAdjAmt.value == "")
                    {
                        alert("Please enter amount for interest adjustment.");
                        transactionForm.intAdjAmt.focus();
                        return false;
                    }
                }

                if(transactionForm.payMode.value == "T"){
                    if (transactionForm.transferAcc.value == "")
                    {
                        alert("Transfer A/C cant not be empty.");
                        transactionForm.transferAcc.focus();
                        return false;
                    }
                }
                if(transactionForm.payMode.value == "TGL"){
                    if (transactionForm.transferGLAcc.value == "")
                    {
                        alert("Transfer A/C cant not be empty.");
                        transactionForm.transferGLAcc.focus();
                        return false;
                    }
                }

                if (transactionForm.narration.value == "")
                {
                    alert("Narration field cant not be empty.");
                    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)) && document.getElementById("tranType").value != "R")
                {
                    alert("Transaction amount could only contain numbers.");
                    transactionForm.trAmount.focus();
                    return false;
                }


                if (document.getElementById("tranType").value == "D" && transactionForm.payMode.value == "C" && Number(resCashDrawer)  != Number(tranAmt))
                {
                    //alert("Please select the cash drawer values according to the Transaction amount.");
                    alert("Before proceeding, please fill in the cash drawer values according to the transaction amount.");
                    transactionForm.trAmount.focus();
                    transactionForm.trAmount.click();
                    return false;
                }
                if (document.getElementById("tranType").value == "P" && transactionForm.payMode.value == "C" && Number(resCashDrawer) != Number(net))
                {
                    //alert("Please select the cash drawer values according to the net Net amount.");
                    alert("Before proceeding, please fill in the cash drawer values according to the transaction amount.");
                    transactionForm.netAmt.focus();
                    transactionForm.netAmt.click();
                    return false;
                }
                if (document.getElementById("tranType").value == "W" && transactionForm.payMode.value == "C" && Number(resCashDrawer) != Number(net))
                {
                    //alert("Please select the cash drawer values according to the  Net amount.");
                    alert("Before proceeding, please fill in the cash drawer values according to the transaction amount");
                    transactionForm.netAmt.focus();
                    transactionForm.netAmt.click();
                    return false;
                }
                /*if (document.getElementById("tranType").value == "W" && transactionForm.payMode.value == "C"  && Number(res_inttAmt) != Number(inttAmount))
                {
                    alert("!! Please select the cash drawer values according to the Interest amount!!");
                    transactionForm.inttAmount.focus();
                    transactionForm.inttAmount.click();
                    return false;
                }*/


                return true;
            }
            <%--function isNumberKey(evt)
            {
                //alert(event.charCode);
                var charCode = (evt.which) ? evt.which : evt.keyCode;
                if (charCode != 46 && charCode > 31 && charCode != 45
                    && (charCode < 46 || charCode > 57))
                    return false;

                $( "#btnReset" ).click();
                //calcAmt();
                return true;
            }--%>

            function calcAmt() {
                var prinAmt = parseFloat($("#prinAmt").val());//
                var inttAmount = parseFloat($("#inttAmount").val());
                var trAmount = parseFloat($("#trAmount").val());
                var tranType = $("#tranType").val();
                var intAdjAmt = parseFloat($("#intAdjAmt").val());
                var net = parseFloat(0);

                if(tranType == "W"){
                    net = prinAmt + inttAmount + intAdjAmt;
                    document.getElementById("netAmt").value = net;
                }
                else if(tranType == "P"){
                    net = trAmount + intAdjAmt;
                    document.getElementById("netAmt").value = net;
                }

            }

            function goToNet() {
                document.getElementById("accNoSearch").disabled = true;
                document.getElementById("accNo").readOnly = true;
            }

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

                goToNet();
            }
            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 + '';

                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 can not be null.");
                }
            }

             function goTDCertiDownload(){
                document.forms[0].reportPath.value = "/Reports/term_deosit_certificate";
                document.forms[0].reportName.value = "TERM DEPOSIT CERTIFICATE DOWNLOAD";
                document.forms[0].DOWNLOAD.value = "P";
                document.forms[0].action = '/PacsApplication/ExcelReportServlet';
                document.forms[0].submit();
            }

            function popup_sigPhoto(width, height, custNo) {
                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 = "TDOperation.jsp";
                var lovKey = "depositAccount";
                popWin = open('${pageContext.request.contextPath}/CommonSearchPhotoSignatureLOV.jsp?custNo=' + custNo + '&screenName=' + screenName + '&lovKey=' + lovKey, 'depositAccount', attr);
                popWin.focus();

            }

            $(document).ready(function () {
                $('select#tranType').change(function () {
                    $('#accNo').val('');
                    $('#trAmount').val('');
                    $('#transferAcc').val('');
                    $('#transferGLAcc').val('');
                    $('select#payMode').val('');
                    $('#narration').val('');
                    $('#prinAmt').val('');
                    $('#inttAmount').val('');
                    $('#netAmt').val('0');
                    $('#intAdjAmt').val('');
                    $('#btnReset').click();
                    $('#tran').hide();
                    $('#intAdj').hide();
                    $('#net').hide();
                    $('#tdCertDwnldButton').hide();
                    $('#transferaccNoSearch').hide();
                    $('.PrincipalHeaderTD').remove();
                    $('.DenoAdded').remove();
                    $('.Deno4TermDepAmount').remove();
                    $('.Deno4AccPreClos').remove();
                    document.getElementById("accNoSearch").disabled = false;
                    document.getElementById("accNo").readOnly = false;
                    document.getElementById("blah").src = "#";
                    document.getElementById("blahsig").src = "#";
                    $('#custNo').val('');
                    $('#image-holder').hide();
                    var shouldEnable = $(this).val();
                    switch(shouldEnable)
                    {
                        case 'W':
                            $('#accno').show(500);
                            $('#tranamt').hide();
                            $('#principalAmt').show(500);
                            $('#interestAmt').show(500);
                            $('#paymode').show(500);
                            $('#trannaratn').show(500);
                            $('#intAdj').show(500);
                            $('#net').show(500);
                            $('#trm').hide();
                            $('#tdCertDwnldButton').hide();
                            $('#calMatR').hide();

                            break;

                        case 'D':
                            $('#accno').show(500);
                            $('#tranamt').show(500);
                            $('#principalAmt').hide();
                            $('#interestAmt').hide();
                            $('#paymode').show();
                            $('#trannaratn').show(500);
                            $('#intAdj').hide();
                            $('#net').hide();
                            $('#trm').hide();
                            $('#tdCertDwnldButton').hide();
                            $('#calMatR').hide();

                            break;
                        case 'P':
                            $('#accno').show(500);
                            $('#tranamt').show(500);
                            $('#principalAmt').hide();
                            $('#interestAmt').hide();
                            $('#paymode').show(500);
                            $('#trannaratn').show(500);
                            $('#intAdj').show(500);
                            $('#net').show(500);
                            $('#trm').hide();
                            $('#tdCertDwnldButton').hide();
                            $('#calMatR').hide();

                            break;
                        case 'R':
                            $('#accno').show(500);
                            $('#tranamt').hide();
                            $('#principalAmt').show(500);
                            $('#interestAmt').show(500);
                            $('#paymode').hide();
                            $('#trannaratn').show(500);
                            $('#intAdj').hide();
                            $('#net').hide();
                            $('#trm').show(500);
                            $('#tdCertDwnldButton').hide();
                            $('#calMatR').show();

                            break;
                        case 'TDCert':
                            $('#accno').show(500);
                            $('#tranamt').hide();
                            $('#principalAmt').hide();
                            $('#interestAmt').hide();
                            $('#paymode').hide();
                            $('#trannaratn').hide();
                            $('#intAdj').hide();
                            $('#net').hide();
                            $('#trm').hide();
                            $('#tdCertDwnldButton').show();
                            $('#submitButtonMain').hide();
                            $('#calMatR').hide();
                            break;
                        default:
                            $('#accno').hide();
                            $('#tranamt').hide();
                            $('#principalAmt').hide();
                            $('#interestAmt').hide();
                            $('#paymode').hide();
                            $('#trannaratn').hide();
                            $('#intAdj').hide();
                            $('#net').hide();
                            $('#trm').hide();
                            $('#tdCertDwnldButton').hide();
                            $('#calMatR').hide();
                            break;
                    }
                });
            });

            $(document).ready(function () {
                $('select#payMode').change(function () {
                    $('#transferAcc').val('');
                    $('#transferGLAcc').val('');
                    var TranTypeOption  = $('select#tranType').val();
                    var PaymentModeOption = $('select#payMode').val();
                    var a = TranTypeOption + PaymentModeOption;
                    switch(a)
                    {
                        case 'WC':

                            $('#tran').hide();
                            $('#transferaccNoSearch').hide();
                            $('#tranGL').hide();
                            $('#transferGLaccNoSearch').hide();


                            break
                        case 'WT':

                            $('#tran').show();
                            $('#tranGL').hide();
                            $('#transferaccNoSearch').show();
                            $('#transferGLaccNoSearch').hide();
                            $( "#btnReset" ).click();
                            $('.DenoAdded').remove();
                            break;
                        case 'WTGL':

                            $('#tran').hide();
                            $('#tranGL').show();
                            $('#transferaccNoSearch').hide();
                            $('#transferGLaccNoSearch').show();
                            $( "#btnReset" ).click();
                            $('.DenoAdded').remove();
                            break;
                        case 'DT':

                            $('#tran').show();
                            $('#tranGL').hide();
                            $('#transferaccNoSearch').show();
                            $('#transferGLaccNoSearch').hide();
                            $( "#btnReset" ).click();
                            $('.DenoAdded').remove();
                            break;
                        case 'DTGL':

                            $('#tran').hide();
                            $('#tranGL').show();
                            $('#transferaccNoSearch').hide();
                            $('#transferGLaccNoSearch').show();
                            $( "#btnReset" ).click();
                            $('.DenoAdded').remove();
                            break;
                        case 'DC':
                            $('#tran').hide();
                            $('#transferaccNoSearch').hide();
                            $('#tranGL').hide();
                            $('#transferGLaccNoSearch').hide();

                            $( "#btnReset" ).click();
                            break;
                        case 'PC':
                            $('#tran').hide();
                            $('#transferaccNoSearch').hide();
                            $('#tranGL').hide();
                            $('#transferGLaccNoSearch').hide();
                            
                            break;
                        case 'PT':
                            $('#tran').show();
                            $('#tranGL').hide();
                            $('#transferaccNoSearch').show();
                            $('#transferGLaccNoSearch').hide();
                            $( "#btnReset" ).click();
                            $('.DenoAdded').remove();
                            break;
                        case 'PTGL':
                            $('#tran').hide();
                            $('#tranGL').show();
                            $('#transferGLaccNoSearch').show();
                            $('#transferaccNoSearch').hide();
                            $( "#btnReset" ).click();
                            $('.DenoAdded').remove();
                            break;
                        default:
                            $('#tran').hide();
                            $('#transferaccNoSearch').hide();
                            $('#tranGL').hide();
                            $('#transfeGLraccNoSearch').hide();
                            break;
                    }
                });
            });

            $(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"});
            });

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

            function popup_TransdepAccount(width, height, accNo) {
                if($('#accNo').val() == ""){
                    alert( "Please select A/C Number first." );
                }else if($('#payMode').val() == ""){
                    alert( "Please select Interest Payment Method  first !!" );
                }
                else{
                    if (window.innerWidth) {
                        LeftPosition = (window.innerWidth - width) / 2;
                        TopPosition = ((window.innerHeight - height) / 2) - 20;
                    }
                    else {
                        LeftPosition = (parseInt(window.screen.width) - width) / 2;
                        TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                    }
                    attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                        height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                        TopPosition + '';
                    var screenName = "TDOperation.jsp";
                    var  lovKey="SavingsAccSearchTransfer"
                    popWin = open('/PacsApplication/CommonSearchInformationDepositLOV.jsp?accNo=' + accNo + '&screenName=' + screenName + '&lovKey='+lovKey, 'SavingsAccSearchTransfer', attr);
                    popWin.focus();

                }
            }

            function popup_TransGLAccount(width, height, accNo) {
                if($('#accNo').val() == ""){
                    alert( "Please select A/C Number first." );
                }else if($('#payMode').val() == ""){
                    alert( "Please select Interest Payment Method  first !!" );
                }
                else{
                    if (window.innerWidth) {
                        LeftPosition = (window.innerWidth - width) / 2;
                        TopPosition = ((window.innerHeight - height) / 2) - 20;
                    }
                    else {
                        LeftPosition = (parseInt(window.screen.width) - width) / 2;
                        TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                    }
                    attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                        height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                        TopPosition + '';
                    var screenName = "TDOperation.jsp";
                    var  lovKey="GLAccSearchTransfer"
                    popWin = open('/PacsApplication/CommonSearchInfoLOVNew.jsp?accNo=' + accNo + '&screenName=' + screenName + '&lovKey='+lovKey, 'GLAccSearchTransfer', attr);
                    popWin.focus();

                }
            }
            $(function() {
                /*$("#prinAmt").keypress(function() {
                    if($('#accNo').val() == ""){
                        alert("Please select a proper a/c number.");
                    }else if($('#payMode').val() == null){
                        alert("Please select a payment mode first");
                    }else if($('#status').val() == "C"){
                        alert("Cash Drawer isn't opened yet!");
                    }
                    else{
                        if ($('#payMode').val() == "C"){

                            $("#myform").show(500);
                            if($('select#tranType').val() == 'W'){
                                if($('div#myform table').find('thead.PrincipalHeaderTD').length == 0){
                                    $( ".CSSTableGenerator" ).before( '<thead class="PrincipalHeaderTD"><tr><td colspan="4"><b>Denominations for Principal</b></td></tr></thead>' );
                                }

                            }
                        }

                    }
                });*/

                $("#netAmt").click(function() {
                    if($('#accNo').val() == ""){
                        alert("Please select a proper a/c number.");
                    } else if($('#intAdjAmt').val() == ""){
                        alert("Please enter interest adjustment amount");
                    } else if($('#netAmt').val() == ""){
                        alert("Please enter correct interest adjustment amount to get the net amount");
                    } else if($('#payMode').val() == null){
                        alert("Please select a payment mode first");
                    }
                    else if($('#status').val() == "C"){
                        alert("Cash Drawer isn't opened yet!");
                    }
                    else{
                        if ($('#payMode').val() == "C"){

                            $("#myform").show(500);
                            if($('select#tranType').val() == 'W'){
                                if($('div#myform table').find('thead.PrincipalHeaderTD').length == 0){
                                    $( "div#myform table thead.CSSTableGenerator" ).before( '<thead class="PrincipalHeaderTD"><tr><td colspan="4"><b>Denominations for Net Amount</b></td></tr></thead>' );
                                }
                            } else if($('select#tranType').val() == 'P'){
                                if($('div#myform table').find('thead.PrincipalHeaderTD').length == 0){
                                    $( "div#myform table thead.CSSTableGenerator" ).before( '<thead class="PrincipalHeaderTD"><tr><td colspan="4"><b>Denominations for Net Amount</b></td></tr></thead>' );
                                }
                            }
                        }
                    }

                });
            });

            /*$(function() {
                $("#inttAmount").keypress(function() {
                    if($('#accNo').val() == ""){
                        alert("Please select a proper a/c number.");
                    }else if($('#payMode').val() == null){
                        alert("Please select a payment mode first");
                    }else if($('#status').val() == "C"){
                        alert("Cash Drawer isn't opened yet!");
                    }
                    else
                        if ($('#payMode').val() == "C"){

                            $("#myformTwo").show(500);
                        }
                });
                $("#inttAmount").click(function() {
                    if($('#accNo').val() == ""){
                        alert("Please select a proper a/c number.");
                    }else if($('#payMode').val() == null){
                        alert("Please select a payment mode first");
                    }else if($('#status').val() == "C"){
                        alert("Cash Drawer isn't opened yet!");
                    }
                    else
                        if ($('#payMode').val() == "C"){

                            $("#myformTwo").show(500);
                        }
                });
            });*/

            $(function() {
                /*$("#trAmount").keypress(function() {
                    if($('#accNo').val() == "" ){
                        alert("Please select a proper a/c number.");
                    } else if($('#payMode').val() == null){
                        alert("Please select a payment mode first");
                    } else if($('#status').val() == "C"){
                        alert("Cash Drawer isn't opened yet!");
                    }
                    else{
                        if ($('#payMode').val() == "C"){

                            $("#myform").show(500);
                        }
                    }
                });*/

                $("#trAmount").click(function() {
                    if($('#accNo').val() == ""){
                        alert("Please select a proper a/c number.");
                    } else if ($('#payMode').val() == null){
                        alert("Please select a payment mode first");
                    } else if ($('#status').val() == "C"){
                        alert("Cash Drawer isn't opened yet!");
                    }
                    else{
                        if ($('#payMode').val() == "C"){

                            $("#myform").show(500);
                            if($('select#tranType').val() == 'D'){
                                if($('div#myform table').find('thead.Deno4TermDepAmount').length == 0){
                                    $( ".CSSTableGenerator" ).before( '<thead class="Deno4TermDepAmount"><tr><td colspan="4"><b>Denominations for Term Deposit Transaction Amount </b></td></tr></thead>' );
                                }

                            }else if($('select#tranType').val() == 'P'){
                                if($('div#myform table').find('thead.Deno4AccPreClos').length == 0){
                                    $( ".CSSTableGenerator" ).before( '<thead class="Deno4AccPreClos"><tr><td colspan="4"><b>Denominations for Account Pre-Closure Transaction Amount </b></td></tr></thead>' );
                                }
                            }


                        }
                    }

                });
            });

            $(function() {
                $("#closePopupTwo").click(function() {
                    $("#myformTwo").hide(500);
                });
            });

            function popup_FDMaturity(width, height, prinAmt, trmYr, trmMon, trmDay,accNo) {
                //var firstChar = inttCatDetails.substring(0, 4);
                if($('#accNo').val()=="")
                    {
                        alert("Please select account deatils first!");
                    }else if($('#prinAmt').val()=="" ){

                    alert("Please enter term Value to calculate maturity Amount!");
                }else if($('#trmYr').val()==""){
                    alert("Please enter all termYears to calculate maturity Amount!");
                }else if($('#trmMon').val()==""){
                    alert("Please enter all termMonth to calculate maturity Amount!");
                }else if($('#trmDay').val()==""){
                    alert("Please enter all termDays to calculate maturity Amount!");
                }
                else{
                    if (window.innerWidth) {
                        LeftPosition = (window.innerWidth - width) / 2;
                        TopPosition = ((window.innerHeight - height) / 2) - 20;
                    }
                    else {
                        LeftPosition = (parseInt(window.screen.width) - width) / 2;
                        TopPosition = ((parseInt(window.screen.height) - height) / 2) - 20;
                    }
                    //var firstChar = inttCatDetails.substr(0, 4);
                    attr = 'resizable=yes,scrollbars=yes,width=' + width + ',height=' +
                        height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
                        TopPosition + '';
                    var screenName = "TDOperation.jsp";
                    var  lovKey="CalcFDMaturity"
                    popWin = open('/PacsApplication/CommonSearchInfoLOVNew.jsp?termValue=' + prinAmt + '&termYears=' + trmYr + '&termMonth=' + trmMon + '&termDays=' + trmDay +'&accNo=' + accNo  + '&screenName=' + screenName +'&lovKey='+lovKey, 'CalcFDMaturity', attr);
                    popWin.focus();
                }
            }
            // added for copy paste prevention
            $(document).ready(function(){
                $('#trmYr').bind("cut copy paste",function(e) {
                e.preventDefault();
                });
            });
            $(document).ready(function(){
                $('#trmMon').bind("cut copy paste",function(e) {
                e.preventDefault();
                });
            });
            $(document).ready(function(){
                $('#trmDay').bind("cut copy paste",function(e) {
                e.preventDefault();
                });
            });

            $(document).ready(function () {
                $('#intAdjAmt').val('0');
            });
            
        // 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 odeno50P = "";
             String odeno1P = "";
             String status = "C";
             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;
            }
        %>



        <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">Term Deposit 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 class="dialog" id="myformTwo">

                    <table border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px">
                        <thead><tr><td colspan="4"><b>Denominations for Interest</b></td></tr></thead>
                        <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_intt" id="twothouAvail_intt" class="available" value="<%=odeno2000%>"></td>
                                <td><input type="text" name="twothouIN_intt" id="twothouIN_intt" class="inDeno"></td>
                                <td><input type="text" name="twothouOUT_intt" id="twothouOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>500 Note</label></td>
                                <td><input type="text" readonly name="fivehundredAvail_intt" id="fivehundredAvail_intt" class="available" value="<%=odeno500%>"></td>
                                <td><input type="text" name="fivehundredIN_intt" id="fivehundredIN_intt" class="inDeno"></td>
                                <td><input type="text" name="fivehundredOUT_intt" id="fivehundredOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>200 Note</label></td>
                                <td><input type="text" readonly name="twohundredAvail_intt" id="twohundredAvail_intt" class="available" value="<%=odeno200%>"></td>
                                <td><input type="text" name="twohundredIN_intt" id="twohundredIN_intt" class="inDeno"></td>
                                <td><input type="text" name="twohundredOUT_intt" id="twohundredOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>100 Note</label></td>
                                <td><input type="text" readonly name="hundredAvail_intt" id="hundredAvail_intt" class="available" value="<%=odeno100%>"></td>
                                <td><input type="text" name="hundredIN_intt" id="hundredIN_intt" class="inDeno"></td>
                                <td><input type="text" name="hundredOUT_intt" id="hundredOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>50 Note</label></td>
                                <td><input type="text" readonly name="fiftyAvail_intt" id="fiftyAvail_intt" class="available" value="<%=odeno50%>"></td>
                                <td><input type="text" name="fiftyIN_intt" id="fiftyIN_intt" class="inDeno"></td>
                                <td><input type="text" name="fiftyOUT_intt" id="fiftyOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>20 Note</label></td>
                                <td><input type="text" readonly name="twentyAvail_intt" id="twentyAvail_intt" class="available" value="<%=odeno20%>"></td>
                                <td><input type="text" name="twentyIN_intt" id="twentyIN_intt" class="inDeno"></td>
                                <td><input type="text" name="twentyOUT_intt" id="twentyOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>10 Note</label></td>
                                <td><input type="text" readonly name="tenAvail_intt" id="tenAvail_intt" class="available" value="<%=odeno10%>"></td>
                                <td><input type="text" name="tenIN_intt" id="tenIN_intt" class="inDeno"></td>
                                <td><input type="text" name="tenOUT_intt" id="tenOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>5 Note</label></td>
                                <td><input type="text" readonly name="fiveAvail_intt" id="fiveAvail_intt" class="available" value="<%=odeno5%>"></td>
                                <td><input type="text" name="fiveIN_intt" id="fiveIN_intt" class="inDeno"></td>
                                <td><input type="text" name="fiveOUT_intt" id="fiveOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>2 Note</label></td>
                                <td><input type="text" readonly name="twoAvail_intt" id="twoAvail_intt" class="available" value="<%=odeno2%>"></td>
                                <td><input type="text" name="twoIN_intt" id="twoIN_intt" class="inDeno"></td>
                                <td><input type="text" name="twoOUT_intt" id="twoOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>1 Note</label></td>
                                <td><input type="text" readonly name="oneAvail_intt" id="oneAvail_intt" class="available" value="<%=odeno1%>"></td>
                                <td><input type="text" name="oneIN_intt" id="oneIN_intt" class="inDeno"></td>
                                <td><input type="text" name="oneOUT_intt" id="oneOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>50 Paisa</label></td>
                                <td><input type="text" readonly name="fiftyPaisaAvail_intt" id="fiftyPaisaAvail_intt" class="available" value="<%=odeno50P%>"></td>
                                <td><input type="text" name="fiftyPaisaIN_intt" id="fiftyPaisaIN_intt" class="inDeno"></td>
                                <td><input type="text" name="fiftyPaisaOUT_intt" id="fiftyPaisaOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td align="left"><label>1 Paisa</label></td>
                                <td><input type="text" readonly name="onePaisaAvail_intt" id="onePaisaAvail_intt" class="available" value="<%=odeno1P%>"></td>
                                <td><input type="text" name="onePaisaIN_intt" id="onePaisaIN_intt" class="inDeno"></td>
                                <td><input type="text" name="onePaisaOUT_intt" id="onePaisaOUT_intt" class="outDeno"></td>
                            </tr>
                            <tr>
                                <td colspan="2" align="left"><label>Total IN/OUT</label></td>

                                <td><input type="text" readonly name="totalIN_intt" id="totalIN_intt" ></td>
                                <td><input type="text" readonly name="totalOUT_intt" id="totalOUT_intt" ></td>
                            </tr>
                            <tr>
                                <td><label>Cash Drawer Present Balance</label></td>
                                <td><input type="text" readonly name="cashDRWBal_intt" id="cashDRWBal_intt" ></td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td><label>Resulted Txn Amount</label></td>
                                <td><input type="text" readonly name="resTXNAmt_intt" id="resTXNAmt_intt"></td>
                                <td></td>
                                <td></td>
                            </tr>
                        </tbody>
                    </table>
                    <br>
                    <div align="center">
                        <input type="button" value="Ok" id="btnOKTwo"><input type="button" value="Reset" id="btnResetTwo"><input type="button" value="Close" id="closePopupTwo">
                    </div>

                </div>

                <div id="create" align="left" >
                    <table class="numbersOnly">
                        <tbody>

                            <tr>
                                <td>Select Transaction Type<font color="red" >*</font>:</td>
                                <td><select id="tranType" name="tranType">
                                        <option value="">--Select--</option>
                                        <option value="W">Closure on Maturity</option>
                                        <option value="D">Deposit to TD Account</option>
                                        <option value="P">Account Pre-Closure</option>
                                        <option value="R">TD Re-Invest</option>
                                        <option value="TDCert">Download TD Certificate</option>
                                    </select>
                                </td>
                            </tr>
                            <tr id="accno"  style="display: none">
                                <td>Account Number<font color="red" >*</font>:</td>
                                <td><input type="text" name="accNo" id="accNo" value="" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/><input type="button" name="accNoSearch" id="accNoSearch" value="Search" onclick="javascript:popup_depAccount(920, 480, document.transactionForm.accNo.value,document.transactionForm.tranType.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>
                            <tr id="tranamt"  style="display: none">
                                <td>Transaction Amount:</td>
                                <td id="transactionAmtTD"><input type="text" name="trAmount" id="trAmount" size="15" readonly="true" style="text-align:right;" /></td>
                            </tr>

                            <tr id="principalAmt"  style="display: none">
                                <td>Principal Amount:</td>
                                <td id="prinTD"><input type="text" name="prinAmt" id="prinAmt" readonly="true" style="text-align:right;"/> </td>
                            </tr>
                            <tr id="interestAmt"  style="display: none">
                                <td>Interest Amount:</td>
                                <td id="inttTD"><input type="text" readonly   name="inttAmount" id="inttAmount" style="text-align:right;"/> </td>
                            </tr>

                            <tr id="intAdj" name="intAdj" style="display: none">
                                <td>Interest Adjustment:</td>
                                <td><input type="text" name="intAdjAmt" id="intAdjAmt" value="" maxlength="15" onkeypress='return event.charCode >= 45 && event.charCode <= 57 && event.charCode != 46' onkeyup="javascript:calcAmt();" style="text-align:right;"/></td>
                            </tr>

                            <tr id="trm" name="trm" style="display: none">
                                <td>Term Length</td>
                                <td><input type="text" name="trmYr" id="trmYr" value="" size="5" onkeypress='return event.charCode >= 48 && event.charCode <= 57' style="text-align:right;"/>Years<input type="text" name="trmMon" id="trmMon" value="" size="5" onkeypress='return event.charCode >= 48 && event.charCode <= 57' style="text-align:right;" />Months<input type="text" name="trmDay" id="trmDay" value="" size="5" onkeypress='return event.charCode >= 48 && event.charCode <= 57' style="text-align:right;" />Days</td>
                            </tr>

                            <tr id="net" name="net" style="display: none">
                                <td>Net Amount:</td>
                                <td id="addImg"><input type="text" name="netAmt" id="netAmt" value="" size="15" readonly style="text-align:right;"/></td>
                            </tr>


                            <tr id="paymode" name="paymode" style="display: none">
                                <td>Payment Mode<font color="red" >*</font>:</td>
                                <td><select id="payMode" name="payMode">
                                        <option value="" disabled selected style="display: none">--select---</option>
                                        <option value="C">Cash/Cheque</option>
                                        <option value="T">Transfer</option>
                                        <option value="TGL">Transfer GL</option>
                                    </select> </td>
                            </tr>
                            <tr id="tran" name="tran" style="display: none">
                                <td>Transfer A/C Number: </td><td><input type="text" readonly name="transferAcc" id="transferAcc" style="text-align:right;" /><input type="button" name="transferaccNoSearch" id="transferaccNoSearch" value="Search" onclick="javascript:popup_TransdepAccount(520, 280, document.transactionForm.accNo.value)"/></td>
                            </tr>
                            
                            <tr id="tranGL" name="tranGL" style="display: none">
                                <td>Transfer GL A/C Number: </td><td><input type="text" readonly name="transferGLAcc" id="transferGLAcc" style="text-align:right;" /><input type="button" name="transferGLaccNoSearch" id="transferGLaccNoSearch" value="Search" onclick="javascript:popup_TransGLAccount(520, 280, document.transactionForm.accNo.value)"/></td>
                            </tr>

                            <tr id="trannaratn" name="trannaratn" style="display: none">
                                <td>Transaction Narration<font color="red" >*</font>:</td>
                                <td><textarea size="12" name="narration" id="narration"></textarea> </td>
                            </tr>
                            <tr id="calMatR" name="calMat" style="display: none">
                                <td>Maturity Amount:</td>
                                <td><input type="text" id="matAmt" name="matAmt" readonly style="text-align:right;"> &nbsp &nbsp  &nbsp &nbsp <input type="button" id="getMatAmt" name="getMatAmt" Value="Calculate Maturity" onclick="javascript:popup_FDMaturity(220, 220, document.transactionForm.prinAmt.value,document.transactionForm.trmYr.value, document.transactionForm.trmMon.value, document.transactionForm.trmDay.value,document.transactionForm.accNo.value);"/></td>
                            </tr>

                        </tbody>
                    </table>


                    <br>
                    <div id="image-holder" style="display:none;" ><img id="blah" src="#" alt="Invalid image" width="140" height="150" border="1px" />&nbsp;<img id="blahsig" src="#" alt="Invalid image" width="180" height="80" border="1px"/><b id="noSig" style="display: none">No Signature found</b></div>
                    <center>
                        <input type="button" id="submitButtonMain" name="submitButtonMain" value="Submit" onclick="javascript:submitform(transactionForm)">
                        <input type="button" name="tdCertDwnldButton" id="tdCertDwnldButton" value="Download Certificate" onclick="javascript:goTDCertiDownload();" style="display:none;"/>

                        <input type="button" value="Reset" name="reset" onclick="ShowParent();" />
                    </center>

                    <input type="hidden" value="TDOperation" name="screenName" />
                    <input type="hidden" name="status" id="status" value="<%=status%>" />
                    <input type="hidden" value="" name="custNo" id="custNo"/>
                    <input type="hidden" value="" name="nomineeCif" id="nomineeCif"/>

                    <input type="hidden" name="reportPath" value=""/>
                    <input type="hidden" name="reportName" value=""/>
                    <input type="hidden" name="DOWNLOAD" value=""/>
                </div>
            </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,#totalIN_intt,#totalOUT_intt').css({"background-color": "#ffff93"});
            $('#cashDRWBal,#resTXNAmt,#resTXNAmt_intt,#cashDRWBal_intt').css({"background-color": "#b2d0b2"});

            $('#myformTwo').find(':input.inDeno[type="text"],#totalIN_intt,#totalOUT_intt,#resTXNAmt_intt').val('0');
            $('#myformTwo').find(':input.outDeno[type="text"]').val('0');

        });

        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
        $('#cashDRWBal_intt').val(tenth);

        $( "#btnReset,#btnResetTwo" ).click(function() {
            $('.dialog').find(':input.inDeno[type="text"],:input.outDeno[type="text"]').val('0');
            $("#totalIN,#totalIN_intt").val('0');
            $("#totalOUT,#totalOUT_intt").val('0');
            $('#twothouAvail,#twothouAvail_intt').val(first);
            $('#fivehundredAvail,#fivehundredAvail_intt').val(second);
            $('#hundredAvail,#hundredAvail_intt').val(third);
            $('#fiftyAvail,#fiftyAvail_intt').val(fourth);
            $('#twentyAvail,#twentyAvail_intt').val(fifth);
            $('#tenAvail,#tenAvail_intt').val(sixth);
            $('#fiveAvail,#fiveAvail_intt').val(seventh);
            $('#twoAvail,#twoAvail_intt').val(eighth);
            $('#oneAvail,#oneAvail_intt').val(ninth);
            $('#fiftyPaisaAvail,#fiftyPaisaAvail_intt').val(eleventh);
            $('#onePaisaAvail,#onePaisaAvail_intt').val(twelveth);
            $("#cashDRWBal,#cashDRWBal_intt").val(tenth);
            $('#twohundredAvail,#twohundredAvail_intt').val(thirtinth);
            $('#resTXNAmt,#resTXNAmt_intt').val('0');

        });
        $( "#btnReset" ).click(function() {
            if ($('#prinTD').find('img').length > 0){
                $('.DenoAdded').remove();
            }
            if ($('#transactionAmtTD').find('img').length > 0){
                $('.DenoAdded').remove();
            }
        });
        $( "#btnResetTwo" ).click(function() {
            if ($('#inttTD').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 == 37 || event.keyCode == 39 || event.keyCode == 46) {

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

        //calculating IN & OUT Total,and Resultant final Amount
        $('.dialog').on("keyup", ".inDeno,.outDeno", function() {
            //working as principal portion
            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())));

            //added for interest portion
            $("#totalIN_intt").val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val())) + parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
        });

        //for Rs 2000 starts
        $('.dialog').on("keyup", "#twothouOUT,#twothouOUT_intt", function() {

            if(parseInt($("#twothouAvail").val())<= 0 )
            {
                alert("Insufficiernt Rs.2000 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#twothouAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.2000 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#twothouAvail,#twothouAvail_intt').val(parseInt(check(first)) + ((parseInt(check($('#twothouIN').val())) + parseInt(check($('#twothouIN_intt').val()))) - (parseInt(check($('#twothouOUT').val())) + parseInt(check($('#twothouOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#twothouOUT,#twothouOUT_intt", function() {
            if(parseInt(first)< parseInt(check($('#twothouOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if (parseInt(first)< parseInt(check($('#twothouOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#twothouIN,#twothouIN_intt", function() {

            //working as principal denominations & for term deposit normal denominations
            $('#twothouAvail,#twothouAvail_intt').val(parseInt(check(first)) + ((parseInt(check($('#twothouIN').val())) + parseInt(check($('#twothouIN_intt').val()))) - (parseInt(check($('#twothouOUT').val())) + parseInt(check($('#twothouOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
        });

        //for Rs 500 starts
        $('.dialog').on("keyup", "#fivehundredOUT,#fivehundredOUT_intt", function() {
            if(parseInt($("#fivehundredAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.500 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#fivehundredAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.500 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#fivehundredAvail,#fivehundredAvail_intt').val(parseInt(check(second)) + ((parseInt(check($('#fivehundredIN').val())) + parseInt(check($('#fivehundredIN_intt').val()))) - (parseInt(check($('#fivehundredOUT').val())) + parseInt(check($('#fivehundredOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#fivehundredOUT,#fivehundredOUT_intt", function() {
            if(parseInt(second)< parseInt(check($('#fivehundredOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(second)< parseInt(check($('#fivehundredOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#fivehundredIN,#fivehundredIN_intt", function() {

            $('#fivehundredAvail,#fivehundredAvail_intt').val(parseInt(check(second)) + ((parseInt(check($('#fivehundredIN').val())) + parseInt(check($('#fivehundredIN_intt').val()))) - (parseInt(check($('#fivehundredOUT').val())) + parseInt(check($('#fivehundredOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });

        //for Rs 200 starts
        $('.dialog').on("keyup", "#twohundredOUT,#twohundredOUT_intt", function() {
            if(parseInt($("#twohundredAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.200 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#twohundredAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.200 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#twohundredAvail,#twohundredAvail_intt').val(parseInt(check(thirtinth)) + ((parseInt(check($('#twohundredIN').val())) + parseInt(check($('#twohundredIN_intt').val()))) - (parseInt(check($('#twohundredOUT').val())) + parseInt(check($('#twohundredOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#twohundredOUT,#twohundredOUT_intt", function() {
            if(parseInt(thirtinth)< parseInt(check($('#twohundredOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(thirtinth)< parseInt(check($('#twohundredOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#twohundredIN,#twohundredIN_intt", function() {

            $('#twohundredAvail,#twohundredAvail_intt').val(parseInt(check(thirtinth)) + ((parseInt(check($('#twohundredIN').val())) + parseInt(check($('#twohundredIN_intt').val()))) - (parseInt(check($('#twohundredOUT').val())) + parseInt(check($('#twohundredOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });

        //for Rs 100 starts
        $('.dialog').on("keyup", "#hundredOUT,#hundredOUT_intt", function() {
            if(parseInt($("#hundredAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.100 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#hundredAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.100 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#hundredAvail,#hundredAvail_intt').val(parseInt(check(third)) + ((parseInt(check($('#hundredIN').val())) + parseInt(check($('#hundredIN_intt').val()))) - (parseInt(check($('#hundredOUT').val())) + parseInt(check($('#hundredOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#hundredOUT,#hundredOUT_intt", function() {
            if(parseInt(third)< parseInt(check($('#hundredOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(third)< parseInt(check($('#hundredOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#hundredIN,#hundredIN_intt", function() {

            $('#hundredAvail,#hundredAvail_intt').val(parseInt(check(third)) + ((parseInt(check($('#hundredIN').val())) + parseInt(check($('#hundredIN_intt').val()))) - (parseInt(check($('#hundredOUT').val())) + parseInt(check($('#hundredOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });


        //for Rs 50 starts
        $('.dialog').on("keyup", "#fiftyOUT,#fiftyOUT_intt", function() {
            if(parseInt($("#fiftyAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.50 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#fiftyAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.50 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#fiftyAvail,#fiftyAvail_intt').val(parseInt(check(fourth)) + ((parseInt(check($('#fiftyIN').val())) + parseInt(check($('#fiftyIN_intt').val()))) - (parseInt(check($('#fiftyOUT').val())) + parseInt(check($('#fiftyOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#fiftyOUT,#fiftyOUT_intt", function() {
            if(parseInt(fourth)< parseInt(check($('#fiftyOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(fourth)< parseInt(check($('#fiftyOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#fiftyIN,#fiftyIN_intt", function() {

            $('#fiftyAvail,#fiftyAvail_intt').val(parseInt(check(fourth)) + ((parseInt(check($('#fiftyIN').val())) + parseInt(check($('#fiftyIN_intt').val()))) - (parseInt(check($('#fiftyOUT').val())) + parseInt(check($('#fiftyOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });

        //for Rs 20 starts
        $('.dialog').on("keyup", "#twentyOUT,#twentyOUT_intt", function() {
            if(parseInt($("#twentyAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.20 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#twentyAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.20 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#twentyAvail,#twentyAvail_intt').val(parseInt(check(fifth)) + ((parseInt(check($('#twentyIN').val())) + parseInt(check($('#twentyIN_intt').val()))) - (parseInt(check($('#twentyOUT').val())) + parseInt(check($('#twentyOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#twentyOUT,#twentyOUT_intt", function() {
            if(parseInt(fifth)< parseInt(check($('#twentyOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(fifth)< parseInt(check($('#twentyOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#twentyIN,#twentyIN_intt", function() {

            $('#twentyAvail,#twentyAvail_intt').val(parseInt(check(fifth)) + ((parseInt(check($('#twentyIN').val())) + parseInt(check($('#twentyIN_intt').val()))) - (parseInt(check($('#twentyOUT').val())) + parseInt(check($('#twentyOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });

        //for Rs 10 starts
        $('.dialog').on("keyup", "#tenOUT,#tenOUT_intt", function() {
            if(parseInt($("#tenAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.10 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#tenAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.10 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#tenAvail,#tenAvail_intt').val(parseInt(check(sixth)) + ((parseInt(check($('#tenIN').val())) + parseInt(check($('#tenIN_intt').val()))) - (parseInt(check($('#tenOUT').val())) + parseInt(check($('#tenOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#tenOUT,#tenOUT_intt", function() {
            if(parseInt(sixth)< parseInt(check($('#tenOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(sixth)< parseInt(check($('#tenOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#tenIN,#tenIN_intt", function() {

            $('#tenAvail,#tenAvail_intt').val(parseInt(check(sixth)) + ((parseInt(check($('#tenIN').val())) + parseInt(check($('#tenIN_intt').val()))) - (parseInt(check($('#tenOUT').val())) + parseInt(check($('#tenOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });


        //for Rs 5 starts
        $('.dialog').on("keyup", "#fiveOUT,#fiveOUT_intt", function() {
            if(parseInt($("#fiveAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.5 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#fiveAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.5 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#fiveAvail,#fiveAvail_intt').val(parseInt(check(seventh)) + ((parseInt(check($('#fiveIN').val())) + parseInt(check($('#fiveIN_intt').val()))) - (parseInt(check($('#fiveOUT').val())) + parseInt(check($('#fiveOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#fiveOUT,#fiveOUT_intt", function() {
            if(parseInt(seventh)< parseInt(check($('#fiveOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(seventh)< parseInt(check($('#fiveOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#fiveIN,#fiveIN_intt", function() {

            $('#fiveAvail,#fiveAvail_intt').val(parseInt(check(seventh)) + ((parseInt(check($('#fiveIN').val())) + parseInt(check($('#fiveIN_intt').val()))) - (parseInt(check($('#fiveOUT').val())) + parseInt(check($('#fiveOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });


        //for Rs 2 starts
        $('.dialog').on("keyup", "#twoOUT,#twoOUT_intt", function() {
            if(parseInt($("#twoAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.2 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#twoAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.2 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#twoAvail,#twoAvail_intt').val(parseInt(check(eighth)) + ((parseInt(check($('#twoIN').val())) + parseInt(check($('#twoIN_intt').val()))) - (parseInt(check($('#twoOUT').val())) + parseInt(check($('#twoOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#twoOUT,#twoOUT_intt", function() {
            if(parseInt(eighth)< parseInt(check($('#twoOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(eighth)< parseInt(check($('#twoOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#twoIN,#twoIN_intt", function() {

            $('#twoAvail,#twoAvail_intt').val(parseInt(check(eighth)) + ((parseInt(check($('#twoIN').val())) + parseInt(check($('#twoIN_intt').val()))) - (parseInt(check($('#twoOUT').val())) + parseInt(check($('#twoOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });


        //for Rs 1 starts
        $('.dialog').on("keyup", "#oneOUT,#oneOUT_intt", function() {
            if(parseInt($("#oneAvail").val())<= 0)
            {
                alert("Insufficiernt Rs.1 Notes");
                $('#btnReset').click();
            }else if(parseInt($("#oneAvail_intt").val())<= 0){
                alert("Insufficiernt Rs.1 Notes");
                $('#btnResetTwo').click();
            }
            else{
                $('#oneAvail,#oneAvail_intt').val(parseInt(check(ninth)) + ((parseInt(check($('#oneIN').val())) + parseInt(check($('#oneIN_intt').val()))) - (parseInt(check($('#oneOUT').val())) + parseInt(check($('#oneOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#oneOUT", function() {
            if(parseInt(ninth)< parseInt(check($('#oneOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(ninth)< parseInt(check($('#oneOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#oneIN,#oneIN_intt", function() {

            $('#oneAvail,#oneAvail_intt').val(parseInt(check(ninth)) + ((parseInt(check($('#oneIN').val())) + parseInt(check($('#oneIN_intt').val()))) - (parseInt(check($('#oneOUT').val())) + parseInt(check($('#oneOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });

        //for 50 Paisa starts
        $('.dialog').on("keyup", "#fiftyPaisaOUT,#fiftyPaisaOUT_intt", function() {
            if(parseInt($("#fiftyPaisaAvail").val())<= 0)
            {
                alert("Insufficiernt 50 paisa");
                $('#btnReset').click();
            }else if(parseInt($("#fiftyPaisaAvail_intt").val())<= 0){
                alert("Insufficiernt 50 paisa");
                $('#btnResetTwo').click();
            }
            else{
                $('#fiftyPaisaAvail,#fiftyPaisaAvail_intt').val(parseInt(check(eleventh)) + ((parseInt(check($('#fiftyPaisaIN').val())) + parseInt(check($('#fiftyPaisaIN_intt').val()))) - (parseInt(check($('#fiftyPaisaOUT').val())) + parseInt(check($('#fiftyPaisaOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#fiftyPaisaOUT", function() {
            if(parseInt(eleventh)< parseInt(check($('#fiftyPaisaOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(eleventh)< parseInt(check($('#fiftyPaisaOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#fiftyPaisaIN,#fiftyPaisaIN_intt", function() {

            $('#fiftyPaisaAvail,#fiftyPaisaAvail_intt').val(parseInt(check(eleventh)) + ((parseInt(check($('#fiftyPaisaIN').val())) + parseInt(check($('#fiftyPaisaIN_intt').val()))) - (parseInt(check($('#fiftyPaisaOUT').val())) + parseInt(check($('#fiftyPaisaOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });

        //for 1 paisa starts
        $('.dialog').on("keyup", "#onePaisaOUT,#onePaisaOUT_intt", function() {
            if(parseInt($("#onePaisaAvail").val())<= 0)
            {
                alert("Insufficiernt 1 Paisa");
                $('#btnReset').click();
            }else if(parseInt($("#onePaisaAvail_intt").val())<= 0){
                alert("Insufficiernt 1 Paisa");
                $('#btnResetTwo').click();
            }
            else{
                $('#onePaisaAvail,#onePaisaAvail_intt').val(parseInt(check(twelveth)) + ((parseInt(check($('#onePaisaIN').val())) + parseInt(check($('#onePaisaIN_intt').val()))) - (parseInt(check($('#onePaisaOUT').val())) + parseInt(check($('#onePaisaOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

                $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
                $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
                $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
                $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));
            }
        });
        $('.dialog').on("change", "#onePaisaOUT", function() {
            if(parseInt(twelveth)< parseInt(check($('#onePaisaOUT').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnReset').click();
            }else if(parseInt(twelveth)< parseInt(check($('#onePaisaOUT_intt').val()))){
                alert("Insufficient Denomination !!!");
                $('#btnResetTwo').click();
            }
        });
        $('.dialog').on("keyup", "#onePaisaIN,#onePaisaIN_intt", function() {

            $('#onePaisaAvail,#onePaisaAvail_intt').val(parseInt(check(twelveth)) + ((parseInt(check($('#onePaisaIN').val())) + parseInt(check($('#onePaisaIN_intt').val()))) - (parseInt(check($('#onePaisaOUT').val())) + parseInt(check($('#onePaisaOUT_intt').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(parseFloat(check($('#totalIN').val())) - parseFloat(check($('#totalOUT').val())));

            //working as interest denominations
            $("#totalOUT_intt").val(parseInt(check($('#twothouOUT_intt').val())) * 2000 + parseInt(check($('#fivehundredOUT_intt').val())) * 500 + parseInt(check($('#twohundredOUT_intt').val())) * 200 + parseInt(check($('#hundredOUT_intt').val())) * 100 + parseInt(check($('#fiftyOUT_intt').val())) * 50 + parseInt(check($('#twentyOUT_intt').val())) * 20 + parseInt(check($('#tenOUT_intt').val())) * 10 + parseInt(check($('#fiveOUT_intt').val())) * 5 + parseInt(check($('#twoOUT_intt').val())) * 2 + parseInt(check($('#oneOUT_intt').val()))+ parseFloat(check($('#fiftyPaisaOUT_intt').val()) * 0.50) + parseFloat(check($('#onePaisaOUT_intt').val()) * 0.01));
            $('#totalIN_intt').val(parseInt(check($('#twothouIN_intt').val())) * 2000 + parseInt(check($('#fivehundredIN_intt').val())) * 500 + parseInt(check($('#twohundredIN_intt').val())) * 200 + parseInt(check($('#hundredIN_intt').val())) * 100 + parseInt(check($('#fiftyIN_intt').val())) * 50 + parseInt(check($('#twentyIN_intt').val())) * 20 + parseInt(check($('#tenIN_intt').val())) * 10 + parseInt(check($('#fiveIN_intt').val())) * 5 + parseInt(check($('#twoIN_intt').val())) * 2 + parseInt(check($('#oneIN_intt').val()))+ parseFloat(check($('#fiftyPaisaIN_intt').val()) * 0.50) + parseFloat(check($('#onePaisaIN_intt').val()) * 0.01));
            $("#cashDRWBal_intt").val(parseInt(check($('#twothouAvail_intt').val()) * 2000) + parseInt(check($('#fivehundredAvail_intt').val()) * 500) + parseInt(check($('#twohundredAvail_intt').val()) * 200) + parseInt(check($('#hundredAvail_intt').val()) * 100)+ parseInt(check($('#fiftyAvail_intt').val()) * 50)+ parseInt(check($('#twentyAvail_intt').val()) * 20)+ parseInt(check($('#tenAvail_intt').val()) * 10)+ parseInt(check($('#fiveAvail_intt').val()) * 5)+ parseInt(check($('#twoAvail_intt').val()) * 2)+ parseInt(check($('#oneAvail_intt').val()) * 1)+ parseFloat(check($('#fiftyPaisaAvail_intt').val()) * 0.50) + parseFloat(check($('#onePaisaAvail_intt').val()) * 0.01));
            $('#resTXNAmt_intt').val(parseFloat(check($('#totalIN_intt').val())) - parseFloat(check($('#totalOUT_intt').val())));

        });


        //Reset transaction amout when OK button clicks
        $('#btnOK').click(function(){
            var amount = $('#resTXNAmt').val();
            var amount_twoFixed = Number(Math.abs($('#resTXNAmt').val())).toFixed(2);
            var amount_intt = $('#resTXNAmt_intt').val();
            var principal_amount = Number(Math.abs($('#prinAmt').val())).toFixed(2);
            var netAmt = Number(Math.abs($('#netAmt').val())).toFixed(2);
            var tranAmt = Number(Math.abs($('#trAmount').val())).toFixed(2);
            var flag = 0;
            if($('#tranType').val() == "W")
            {
                if(Number(amount) >= 0){
                    alert("Total Denomination IN cannot be greater than Total Denomination OUT!!! ");
                    flag = 1;
                }
            }
            else if($('#tranType').val() == "D")
            {
                if(Number(amount) <= 0){
                    alert("Total OUT cannot be greater than total IN!!! ");
                    flag = 1;
                }
            }
            else if($('#tranType').val() == "P")
            {
                if(Number(amount) >= 0){
                    alert("Total IN cannot be greater than total OUT!!! ");
                    flag = 1;
                }
            }
            if(parseInt(flag) == 0){
                if($('#tranType').val() == "W"){
                    if(Number(netAmt) == Number(amount_twoFixed)){
                        $("#myform").hide(400);
                        if ($('#addImg').find('img').length == 0)
                        {
                            $('#addImg').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>');

                        }

                    }else{
                        alert("Resultant Txn Amount must be same as Net Amount");
                    }
                }else if($('#tranType').val() == "D"){
                    if(Number(tranAmt) == Number(amount_twoFixed)){
                        $("#myform").hide(400);
                        if ($('#transactionAmtTD').find('img').length == 0)
                        {
                            $('#transactionAmtTD').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>');

                        }

                    }else{
                        alert("Resultant Txn Amount must be same as Transaction Amount");
                    }

                }else if($('#tranType').val() == "P"){
                    if(Number(netAmt) == Number(amount_twoFixed)){
                        $("#myform").hide(400);
                        if ($('#addImg').find('img').length == 0)
                        {
                            $('#addImg').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>');

                        }

                    }else{
                        alert("Resultant Txn Amount must be same as Net Amount");
                    }
                }

            }
        });

        $('#btnOKTwo').click(function(){
            var amount_intt = $('#resTXNAmt_intt').val();
            var amount_twoFixed = Number(Math.abs($('#resTXNAmt_intt').val())).toFixed(2);
            var interest_amt = Number(Math.abs($('#inttAmount').val())).toFixed(2);
            var flag = 0;
            if($('#tranType').val() == "W")
            {
                if(Number(amount_intt) >= 0){
                    alert("Total Denomination IN cannot be greater than Total Denomination OUT!!! ");
                    flag = 1;
                }
            }

            if(parseInt(flag) == 0){
                if($('#tranType').val() == "W"){
                    if(Number(interest_amt) == Number(amount_twoFixed)){
                        $("#myformTwo").hide(400);
                        if ($('#inttTD').find('img').length == 0)
                        {
                            $('#inttTD').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>');

                        }

                    }else{
                        alert("Resultant Txn Amount must be same as Principal Amount");
                    }
                }else {

                }

            }
        });

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