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

<html>

    <head>
        <title>Account Details</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="${pageContext.request.contextPath}/js/Calendar.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/TableCSSCode.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/img/favicon.ico?pacs=<%=((new java.util.Date()).getTime())%>" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/styles.css?pacs=<%=((new java.util.Date()).getTime())%>"/>
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/ButtonAndText.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <link rel="stylesheet" type="text/css" href="/PacsApplication/css/info.css?pacs=<%=((new java.util.Date()).getTime())%>" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/jquery-ui-1.10.4.custom/development-bundle/jquery-1.10.2.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/chromejs/chrome.js?pacs=<%=((new java.util.Date()).getTime())%>"></script>
        <script type="text/javascript" src="/PacsApplication/js/iFrame_killer.js"></script>
    </head>
    <body onload="noBack()">
        <script type="text/javascript">


            function noBack()
            {
                window.history.forward();
            }
            function ShowParent()
            {
            document.forms[0].action = "${pageContext.request.contextPath}/Shg_JSP/AccountDetails.jsp";
            document.forms[0].submit();
            }
            function numbersonly(txt,e){

                    var unicode=e.charCode? e.charCode : e.keyCode
                if(unicode==46)
                {if (txt.value.indexOf('.') === -1) {
                        return true;
                    } else {
                        return false;
                    }
                } else if(unicode!=8){
                    //if the key isn't the backspace key (which we should allow)
                            if (unicode<48||unicode>57) //if not a number
                                    return false ;//disable key press
                    }
            }

            function showbankname(i)
            {
                if(document.getElementById("source"+i).value == "External")
                    document.getElementById("bankname"+i).disabled=false;
                else
                    document.getElementById("bankname"+i).disabled=true;


            }
            function showbanknameDeposit(i)
            {
                if(document.getElementById("source1"+i).value == "External")
                    document.getElementById("bankname1"+i).disabled=false;
                else
                    document.getElementById("bankname1"+i).disabled=true;

            }
            function showbanknameDepositAmend(i)
            {
                if(document.getElementById("source1Amend"+i).value == "External")
                    document.getElementById("bankname1Amend"+i).disabled=false;
                else
                    document.getElementById("bankname1Amend"+i).disabled=true;

            }
            function showbanknameAmend(i)
            {
                if(document.getElementById("sourceAmend"+i).value == "External")
                    document.getElementById("banknameAmend"+i).disabled=false;
                else
                    document.getElementById("banknameAmend"+i).disabled=true;
            }
            function submitloanform(AccountDetailsform)
            {
                if (checkCreateDivLoan(AccountDetailsform))
                {
                    document.forms[0].handle_id.value = "CreateLoan";

                    document.forms[0].action = '/PacsApplication/AccountDetailsServlet';
                    AccountDetailsform.submit();
                }
            }
            function submitdepositform(AccountDetailsform)
            {
                if (checkCreateDivDeposit(AccountDetailsform))
                {
                    document.forms[0].handle_id.value = "CreateDeposit";
                    document.forms[0].action = '/PacsApplication/AccountDetailsServlet';

                    AccountDetailsform.submit();
                }
            }
            function checkCreateDivLoan(AccountDetailsform)
            {
                var counter = document.forms[0].rowCounter.value;

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

                    try{

                        if(document.getElementById("source"+i).value == "")
                        { alert("Source should be filled.");
                            return false;
                        }
                        if(document.getElementById("accountnumber"+i).value == "")
                        { alert("Account Number should be filled.");
                            return false;
                        }

                        if (document.getElementById("accountopendate"+i).value == "")
                        {
                            alert("Account Open Date should be filled.");
                            return false;
                        }
                        if (document.getElementById("lastdisbursementdate"+i).value == "")
                        {
                            alert("Last Disbursement Date should be filled.");
                            return false;
                        }
                        if (document.getElementById("loanamount"+i).value == "")
                        {
                            alert("Loan Amount should be filled.");
                            return false;
                        }
                        if (document.getElementById("principaloutstanding"+i).value == "")
                        {
                            alert("Principal Outstanding should be filled.");
                            return false;
                        }
                        if (document.getElementById("principalpaid"+i).value == "")
                        {
                            alert("Principal Paid should be filled.");
                            return false;

                        }
                        if (document.getElementById("interestoutstanding"+i).value == "")
                        {
                            alert("Interest Outstanding should be filled.");
                            return false;
                        }
                        if (document.getElementById("interestpaid"+i).value == "")
                        {
                            alert("Interest Paid should be filled.");
                            return false;

                        }
                        if((document.getElementById("accountopendate"+i).value)
                            >(document.getElementById("lastdisbursementdate"+i).value))
                        {
                            alert("Account Open Date should be before Last Disbursement Date.");
                            return false;
                        }
                    }
                    catch(e)
                    {

                    }
                }
                document.forms[0].submit();
                return true;
            }

            function checkCreateDivDeposit(AccountDetailsform)
            {
                var counter = document.forms[0].rowCounter.value;


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

                    try{
                        if(document.getElementById("source1"+i).value == "")
                        { alert("Source should be filled.");
                            return false;
                        }

                        if(document.getElementById("accountnumber1"+i).value == "")
                        { alert("Account Number should be filled.");
                            return false;
                        }

                        if (document.getElementById("accountopendate1"+i).value == "")
                        {
                            alert("Account Open Date should be filled.");
                            return false;
                        }
                        if (document.getElementById("outstandingbalance"+i).value == "")
                        {
                            alert("Outstanding Balance should be filled.");
                            return false;
                        }
                        if (document.getElementById("interestaccrued"+i).value == "")
                        {
                            alert("Interest Accrued should be filled.");
                            return false;
                        }
                        if (document.getElementById("lasttransactiondate"+i).value == "")
                        {
                            alert("Last Transaction Date should be filled.");
                            return false;
                        }
                        if((document.getElementById("accountopendate1"+i).value)
                            >(document.getElementById("lasttransactiondate"+i).value))
                        {
                            alert("Account Open Date should be before Last Transaction Date.");
                            return false;
                        }
                    }
                    catch(e)
                    {

                    }
                }
                document.forms[0].submit();
                return true;
            }

            function updateloanform(AccountDetailsform)
            {
                alert("inn");
                if (checkUpdateDivLoanAmend(AccountDetailsform))
                {
                    alert("in3");
                    document.forms[0].handle_id.value = "UpdateLoan";

                    document.forms[0].action = '/PacsApplication/AccountDetailsServlet';
                    AccountDetailsform.submit();
                }
            }
            function updatedepositform(AccountDetailsform)
            {
                if (checkUpdateDivDepositAmend(AccountDetailsform))
                {
                    document.forms[0].handle_id.value = "UpdateDeposit";

                    document.forms[0].action = '/PacsApplication/AccountDetailsServlet';
                    AccountDetailsform.submit();
                }
            }

            function checkUpdateDivLoanAmend(AccountDetailsform)
            {
                alert("in2");
                var counter = document.forms[0].rowCounter.value;

                for (var i = 1; i <= counter; i++) {
                    alert("in3");
                    try{
                        if(document.getElementById("sourceAmend"+i).value == "")
                        {
                            alert("Source should be filled.");
                            return false;
                        }
                        if(document.getElementById("accountnumberAmend"+i).value == "")
                        {
                            alert(" Account Number should be filled.");
                            return false;
                        }
                        if (document.getElementById("accountopendateAmend"+i).value == "")
                        {
                            alert("Account Open Date should be filled.");
                            return false;
                        }
                        if (document.getElementById("lastdisbursementdateAmend"+i).value == "")
                        {
                            alert("Last Disbursement Date should be filled.");
                            return false;
                        }
                        if (document.getElementById("loanamountAmend"+i).value == "")
                        {
                            alert("Loan Amount should be filled.");
                            return false;
                        }
                        if (document.getElementById("principaloutstandingAmend"+i).value == "")
                        {
                            alert("Principal Outstanding should be filled.");
                            return false;
                        }
                        if (document.getElementById("principalpaidAmend"+i).value == "")
                        {
                            alert("Principal Paid should be filled.");
                            return false;

                        }
                        if (document.getElementById("interestoutstandingAmend"+i).value == "")
                        {
                            alert("Interest Outstanding should be filled.");
                            return false;
                        }
                        if (document.getElementById("interestpaidAmend"+i).value == "")
                        {
                            alert("Interest Paid should be filled.");
                            return false;

                        }
                        if((document.getElementById("accountopendateAmend"+i).value)
                            >(document.getElementById("lastdisbursementdateAmend"+i).value))
                        {
                            alert("Account Open Date should be before Last Disbursement Date.");
                            return false;
                        }
                    }
                    catch(e)
                    {

                    }
                }
                document.forms[0].submit();
                return true;
            }
            function checkUpdateDivDepositAmend(AccountDetailsform)
            {
                var counter = document.forms[0].rowCounter.value;



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

                    try{
                        if(document.getElementById("source1Amend"+i).value == "")
                        { alert("Source should be filled.");
                            return false;
                        }
                        if(document.getElementById("accountnumber1Amend"+i).value == "")
                        { alert(" Account Number should be filled.");
                            return false;
                        }

                        if (document.getElementById("accountopendate1Amend"+i).value == "")
                        {
                            alert("Account Open Date should be filled.");
                            return false;
                        }
                        if (document.getElementById("outstandingbalanceAmend"+i).value == "")
                        {
                            alert("Outstanding Balance should be filled.");
                            return false;
                        }
                        if (document.getElementById("interestaccruedAmend"+i).value == "")
                        {
                            alert("Interest Accrued should be filled.");
                            return false;
                        }
                        if (document.getElementById("lasttransactiondateAmend"+i).value == "")
                        {
                            alert("Last Transaction Date should be filled.");
                            return false;
                        }
                        if((document.getElementById("accountopendate1Amend"+i).value)
                            >(document.getElementById("lasttransactiondateAmend"+i).value))
                        {
                            alert("Account Open Date should be before Last Transaction Date.");
                            return false;
                        }
                    }
                    catch(e){

                    }
                }
                document.forms[0].submit();
                return true;
            }


            function checkop()
            {
                if (document.getElementById("checkOption").value == "create")
                {
                    document.getElementById('create').style.display = 'block';
                    document.getElementById('amend').style.display = 'none';
                    document.getElementById('view').style.display = 'none';
                    //document.getElementById('amend2').style.display = 'none';
                    document.getElementById('amendsearch').style.display = 'none';
                    document.getElementById('viewsearch').style.display = 'none';
                    document.getElementById('transDiv').style.display = 'none';
                    document.getElementById('transSearch').style.display = 'none';
                    document.getElementById('memberDetails').style.display='none';

                }
                if (document.getElementById("checkOption").value == "amend")
                {
                    document.getElementById('create').style.display = 'none';
                    document.getElementById('view').style.display = 'none';
                    document.getElementById('amend').style.display = 'block';
                    document.getElementById('amendsearch').style.display = 'block';
                    document.getElementById('viewsearch').style.display = 'none';
                    //  /document.getElementById('amend2').style.display = 'none';
                    document.getElementById('transDiv').style.display = 'none';
                    document.getElementById('transSearch').style.display = 'none';
                    document.getElementById('memberDetails').style.display='none';

                }if (document.getElementById("checkOption").value == "view")
                {
                    document.getElementById('create').style.display = 'none';
                    document.getElementById('amend').style.display = 'none';
                    document.getElementById('view').style.display = 'block';
                    document.getElementById('viewsearch').style.display = 'block';
                    document.getElementById('amendsearch').style.display = 'none';
                    //  /document.getElementById('amend2').style.display = 'none';
                    document.getElementById('transDiv').style.display = 'none';
                    document.getElementById('transSearch').style.display = 'none';
                    document.getElementById('memberDetails').style.display='none';

                }
                if (document.getElementById("checkOption").value == "transaction")
                {
                    document.getElementById('create').style.display = 'none';
                    document.getElementById('amend').style.display = 'none';
                    document.getElementById('view').style.display = 'none';
                    document.getElementById('viewsearch').style.display = 'none';
                    document.getElementById('amendsearch').style.display = 'none';

                    //document.getElementById('amend2').style.display = 'none';
                    document.getElementById('transDiv').style.display = 'block';
                    document.getElementById('transSearch').style.display = 'block';
                    document.getElementById('memberDetails').style.display='none';
                }
                if (document.getElementById("checkOption").value == "memberDetails")
                {
                    document.getElementById('create').style.display = 'none';
                    document.getElementById('amend').style.display = 'none';
                    document.getElementById('view').style.display = 'none';
                    document.getElementById('viewsearch').style.display = 'none';
                    document.getElementById('amendsearch').style.display = 'none';

                    //document.getElementById('amend2').style.display = 'none';
                    document.getElementById('transDiv').style.display = 'none';
                    document.getElementById('transSearch').style.display = 'none';
                    document.getElementById('memberDetails').style.display='block';
                }
            } 
            function checkop2()
            {
                if (document.getElementById("checkOption2").value == "loan")
                {
                    document.getElementById('create').style.display = 'block';
                    document.getElementById('loan').style.display = 'block';
                    document.getElementById('deposit').style.display = 'none';

                }
                if (document.getElementById("checkOption2").value == "deposit")
                {
                    document.getElementById('create').style.display = 'block';
                    document.getElementById('loan').style.display = 'none';
                    document.getElementById('deposit').style.display = 'block';

                }

                document.getElementById("checkOption2").disabled=true;
                document.getElementById("checkOption").disabled=true;

            }
            /*  function checkop3()
            {
                /*alert("hi");
                if (document.getElementById("checkOption3").value == "loan1")
                {
                    document.getElementById('amend').style.display = 'block';
                    document.getElementById('amend2').style.display = 'block';
                    document.getElementById('amendsearch').style.display = 'none';

                    document.getElementById('loan_Amend').style.display = 'block';
                    document.getElementById('deposit_Amend').style.display = 'none';

                }
                if (document.getElementById("checkOption3").value == "deposit1")
                {
                    document.getElementById('amend').style.display = 'block';
                    document.getElementById('amend2').style.display = 'block';
                    document.getElementById('amendsearch').style.display = 'none';

                    document.getElementById('loan_Amend').style.display = 'none';
                    document.getElementById('deposit_Amend').style.display = 'block';
                }
                document.getElementById("checkOption3").disabled=true;
                document.getElementById("checkOption").disabled=true;
            }*/

            function searchShg(width, height, shgSearch) {

                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 + '';
                if (document.getElementById("checkOption3").value == "loan1")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsLoan"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsLoan', attr);
                    popWin.focus();

                }else if (document.getElementById("checkOption4").value == "loan2")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsLoan"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsLoan', attr);
                    popWin.focus();

                }
                else if (document.getElementById("checkOption3").value == "deposit1")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsDeposit"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsDeposit', attr);
                    popWin.focus();

                } else if (document.getElementById("checkOption4").value == "deposit2")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsDeposit"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsDeposit', attr);
                    popWin.focus();

                }
                else
                {
                    alert("Please select the account type");
                }


            }function searchShg1(width, height, shgSearch) {

                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 + '';
                if (document.getElementById("checkOption3").value == "loan1")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsLoan"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsLoan', attr);
                    popWin.focus();

                }else if (document.getElementById("checkOption4").value == "loan2")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsLoan2"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsLoan', attr);
                    popWin.focus();

                }
                else if (document.getElementById("checkOption3").value == "deposit1")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsDeposit"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsDeposit', attr);
                    popWin.focus();

                } else if (document.getElementById("checkOption4").value == "deposit2")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsDeposit2"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsDeposit', attr);
                    popWin.focus();

                }
                else
                {
                    alert("Please select the account type.");
                }

            }

            function searchShg2(width, height, shgSearch) {

                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 + '';
                if (document.getElementById("checkOption3").value == "loan1")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsLoan"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsLoan', attr);
                    popWin.focus();

                }else if (document.getElementById("checkOption5").value == "loan3")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsLoan3"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsLoan', attr);
                    popWin.focus();

                }
                else if (document.getElementById("checkOption3").value == "deposit1")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsDeposit"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsDeposit', attr);
                    popWin.focus();

                } else if (document.getElementById("checkOption5").value == "deposit3")
                {
                    var screenName = "AccountDetails.jsp";
                    var lovKey = "AccountDetailsDeposit3"
                    popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgSearch=' + shgSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailsDeposit', attr);
                    popWin.focus();

                }
                else
                {
                    alert("Please select the account type.");
                }
            }

            function searchShgcode(width, height, shgcodeSearch) {

                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 = "AccountDetails.jsp";
                var lovKey = "AccountDetailscode"
                popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?shgcodeSearch=' + shgcodeSearch + '&screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailscode', attr);
                popWin.focus();

            }

            function searchShg3(width, height) {

                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 = "AccountDetails.jsp";
                var lovKey = "Shg_code"
                popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?screenName=' + screenName + '&lovKey=' + lovKey, 'AccountDetailscode', attr);
                popWin.focus();
                //alert("Okk");
            }

            function searchShgMembers(width, height,shg_id) {
                if(document.getElementById("shg_code").value=="")
                {
                    alert("Kindly Select SHG first !!!");
                    return;
                }
                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 = "AccountDetails.jsp";
                var lovKey = "searchShgMembers";
                popWin = open('/PacsApplication/CommonSearchInformationShgLOV.jsp?screenName=' + screenName + '&lovKey=' + lovKey + '&searchShg=' +shg_id, 'AccountDetailscode', attr);
                popWin.focus();
                }
                //alert("Okk");
            }

            function checkMember()
            {
                if(document.getElementById("member_id").value=="")
                    {
                        alert("SHG ID and Member's Name can't be empty.");
                        document.getElementById("txnType").value="";
                        return false;
                    }
                return true;
            }

            function getDetails() {


                if (document.getElementById("shgSearch").value == "")
                {
                    alert("Shg Code should be filled.");
                    return false;
                }
                //checkop3();
                if (document.getElementById("checkOption3").value == "loan1")
                {
                    document.forms[0].handle_id.value = "SearchLoan";
                }
                else if (document.getElementById("checkOption3").value == "deposit1")
                {
                    document.forms[0].handle_id.value = "SearchDeposit";
                }
                else if (document.getElementById("checkOption5").value == "loan3")
                {
                    document.forms[0].handle_id.value = "SearchLoan2";
                }
                else if (document.getElementById("checkOption5").value == "deposit3")
                {
                    document.forms[0].handle_id.value = "SearchDeposit2";
                }
                
                document.forms[0].action = '/PacsApplication/AccountDetailsServlet';
                document.forms[0].submit();

            }

            function getDetails2() {


                if (document.getElementById("shgSearch2").value == "")
                {
                    alert("Shg Code should be filled.");
                    return false;
                }
                //checkop3();
                else if (document.getElementById("checkOption5").value == "loan3")
                {
                    document.forms[0].handle_id.value = "SearchLoan2";
                }
                else if (document.getElementById("checkOption5").value == "deposit3")
                {
                    document.forms[0].handle_id.value = "SearchDeposit2";
                }

                document.forms[0].action = '/PacsApplication/AccountDetailsServlet';
                document.forms[0].submit();

            }

            function getDetails3() {

                if (document.getElementById("shg_code").value == "")
                {
                    alert("Shg ID should be filled.");
                    return false;
                }
                //checkop3();

               /* else if (document.getElementById("member_name").value == "")
                {
                    alert("!! Member Name field should be filled !!");
                    return false;
                }*/
                else if (document.getElementById("txnType1").value == "")
                {
                    alert("Transaction Type should be filled.");
                    return false;
                }
                else if (document.getElementById("txnType1").value == "deposit")
                {
                    document.forms[0].handle_id.value = "SearchDepositMember";
                }
                else if (document.getElementById("txnType1").value == "loan")
                {
                    document.forms[0].handle_id.value = "SearchLoanMember";
                }

                document.forms[0].action = '/PacsApplication/AccountDetailsServlet';
                document.forms[0].submit();

            }

            function getDetails1() {
                if (document.getElementById("shgSearch1").value == "")
                {
                    alert("Shg Code should be filled.");
                    return false;
                }
                //checkop3();
                if (document.getElementById("checkOption4").value == "loan2")
                {
                    document.forms[0].handle_id.value = "viewLoan";
                }
                else if (document.getElementById("checkOption4").value == "deposit2")
                {
                    document.forms[0].handle_id.value = "viewDeposit";
                }

                document.forms[0].action = '/PacsApplication/AccountDetailsServlet';
                document.forms[0].submit();

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

        <%

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

        <%
             Object oAccountDetailsBeanObj = request.getAttribute("AccountDetailsBeanObj");
             AccountDetailsBean oAccountDetailsBean = new AccountDetailsBean();
             if (oAccountDetailsBeanObj != null) {
                 oAccountDetailsBean = (AccountDetailsBean) request.getAttribute("AccountDetailsBeanObj");

             }
        %>
        <%
             Object alAccountDetailsBeanObj = request.getAttribute("alAccountDetailsBean");
             ArrayList<AccountDetailsBean> alAccountDetailsBean = new ArrayList<AccountDetailsBean>();
             if (alAccountDetailsBeanObj != null) {
                 alAccountDetailsBean = (ArrayList<AccountDetailsBean>) request.getAttribute("alAccountDetailsBean");

             }
        %>
        <%
             String displayFlag = "";
             Object display = request.getAttribute("displayFlag");
             if (display != null) {
                 displayFlag = display.toString();
             }
             String checkoption3 = "";
             Object check3 = request.getAttribute("checkoption3");
             if (check3 != null) {
                 checkoption3 = check3.toString();
             }
             String checkoption4 = "";
             Object check4 = request.getAttribute("checkoption4");
             if (check4 != null) {
                 checkoption4 = check4.toString();
             }
             String checkoption5 = "";
             Object check5 = request.getAttribute("checkoption5");
             if (check5 != null) {
                 checkoption5 = check5.toString();
             }
             String checkoption = "";
             Object check = request.getAttribute("checkoption");
             if (check != null) {
                 checkoption = check.toString();
             }
        %>
        <jsp:include page="MenuHead_SHG.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">Account Details: </legend>
            <form name="AccountDetailsform" method="post" action="AccountDetailsServlet">

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

                <br>
                <br>
                <center id="operationSel"><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Operation Selection: </lable>
                    <select id="checkOption" onchange="checkop()" name="checkOption" >
                        <option value=""  selected style="display:none;" > --select-- </option>
                        <option value="create" >Enter Account Details</option>
                        <option value="amend" >Amend/Update Account Details</option>
                        <option value="view" >View Account Details</option>
                        <option value="transaction" >View Transaction Details</option>
                        <option value="memberDetails"<%if(displayFlag=="Y"){%><%if(checkoption.equalsIgnoreCase("memberDetails")){%>selected<%}}%>>View Member Details</option>

                    </select>
                </center>

                <%--   Create Seaction  --%>

                <div id="create" style="display:none;">
                    <center> <table>
                            <tr><td><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection: </lable>
                        </td><td><select  style="width: 159px"  id="checkOption2" onchange="checkop2()" name="checkOption2" >
                            <option value=""  selected style="display:none;" > --select-- </option>
                            <option value="loan" >Loan Account [External]</option>
                            <option value="deposit" >Deposit Account [External]</option>
                        </select></td></tr>
                    <br><br>
                    <tr><td>
                            SHG Code:</td><td><input type="text" id="shgcode" name="shgcode" readonly style="text-align:right;" ></td>
                        <td> <input type="button" name="Search Code" value="Search" onclick="javascript:searchShgcode(500, 220, document.AccountDetailsform.shgcode.value)" > </td></tr>
                    <tr></tr>
                    <tr>
                        <td>Name Of SHG: </td>
                        <td> <input type="text" id="shgname" name="shgname" readonly /></td>
                    </tr>
                    <tr></tr>
                    <tr></tr>
                </table>
            </center>
        </div>

        <div id="loan" style="display:none;">
            <br><br>
            <center>
                <table id="loan_details"  border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px; width: 100%;" >
                    <thead  class="CSSTableGenerator" >
                        <tr>
                            <td></td>
                            <td>Source</td>
                            <td>Bank Name</td>
                            <td>Account Number</td>
                            <td style="width: 80px">Account Open Date</td>
                            <td>Last Disbursement Date</td>
                            <td>Loan Amount</td>
                            <td>Principal Outstanding</td>
                            <td>Principal Paid</td>
                            <td>Interest Outstanding</td>
                            <td>Interest Paid</td>

                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td><input type="checkbox" name="chckbox<%=count%>" id="chckbox<%=count%>" onclick="return checkboxTrue(<%=count%>)"/></td>
                            <td><select  id="source<%=count%>" name="source<%=count%>" onchange="showbankname(<%=count%>)"><option value="External"  >External</option></select></td>
                            <td><input size="8" type="text" name="bankname<%=count%>" id="bankname<%=count%>" ></td>
                            <td><input size="13" type="text" id="accountnumber<%=count%>" name="accountnumber<%=count%>" onKeyPress="return numbersonly(this, event)"></td>
                            <td><input size="6" style="text-align:center;" type="text" name="accountopendate<%=count%>" id="accountopendate<%=count%>" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendate<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="15" height="16" /></a></td>
                            <td><input size="17" style="text-align:center;" type="text" name="lastdisbursementdate<%=count%>" id="lastdisbursementdate<%=count%>" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].lastdisbursementdate<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="18" height="18" /></a></td>
                            <td><input size="10" type="text" id="loanamount<%=count%>" name="loanamount<%=count%>"  onKeyPress="return numbersonly( this,event)"></td>
                            <td><input size="18" type="text" id="principaloutstanding<%=count%>" name="principaloutstanding<%=count%>"  onKeyPress="return numbersonly(this,event)"></td>
                            <td><input size="10" type="text" id="principalpaid<%=count%>" name="principalpaid<%=count%>"  onKeyPress="return numbersonly( this,event)"></td>
                            <td><input size="17" type="text" id="interestoutstanding<%=count%>" name="interestoutstanding<%=count%>"  onKeyPress="return numbersonly(this,event)"></td>
                            <td><input size="10" type="text" id="interestpaid<%=count%>" name="interestpaid<%=count%>"  onKeyPress="return numbersonly(this, event)"></td>

                        </tr>
                    </tbody>
                </table>
            </center>
            <br/><br/>
            <lable style=" font-family: Berlin Sans FB; font-weight:  normal;"><font color="red" >*</font>All fields are mandatory.</lable>
            <center>
                <input type="button" id="addRowLoan" value="Add Row"/>
                <input type="button" id="deleteRowLoan" value="Delete Row"/>
                <input type="button" value="Submit" onclick="javascript:submitloanform(AccountDetailsform)"/>
                <input type="button" value="Reset" name="reset" onclick="ShowParent();" />
            </center>

        </div>
        <div id="deposit" style="display:none;">

            <center>
                <table id="deposit_details"  border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px; width: 100%;" >
                    <thead  class="CSSTableGenerator" >
                        <tr>
                            <td></td>
                            <td>Source</td>
                            <td>Bank Name</td>
                            <td>Account Number</td>
                            <td>Account Open Date</td>
                            <td>Outstanding Balance</td>
                            <td>Interest Accrued</td>
                            <td>Last Transaction Date</td>

                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td><input  type="checkbox" name="chckbox1<%=count%>" id="chckbox1<%=count%>" onclick="return checkboxTrueDeposit(<%=count%>)"/></td>
                            <td><select id="source1<%=count%>" name="source1<%=count%>" onchange="showbanknameDeposit(<%=count%>)"><option value="External"  >External</option></select></td>
                            <td><input size="15" type="text" name="bankname1<%=count%>" id="bankname1<%=count%>" ></td>
                            <td><input type="text" id="accountnumber1<%=count%>" name="accountnumber1<%=count%>" onKeyPress="return numbersonly(this, event)"></td>
                            <td><input style="text-align:center;" size="14" type="text" name="accountopendate1<%=count%>" id="accountopendate1<%=count%>" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendate1<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="15" height="15" /></a></td>
                            <td><input type="text" id="outstandingbalance<%=count%>" name="outstandingbalance<%=count%>"  onKeyPress="return numbersonly( this,event)"></td>
                            <td><input type="text" id="interestaccrued<%=count%>" name="interestaccrued<%=count%>"  onKeyPress="return numbersonly(this, event)"></td>
                            <td><input style="text-align:center;" size="16" type="text" name="lasttransactiondate<%=count%>" id="lasttransactiondate<%=count%>" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].lasttransactiondate<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="15" height="15" /></a></td>

                        </tr>
                    </tbody>
                </table>
            </center>
            <br/><br/>
            <lable style=" font-family: Berlin Sans FB; font-weight:  normal;">All fields are mandatory</lable>
            <center>
                <input type="button" id="addRowDeposit" value="Add Row"/>
                <input type="button" id="deleteRowDeposit" value="Delete Row"/>
                <input type="button" value="Submit" onclick="javascript:submitdepositform(AccountDetailsform)"/>
                <input type="button" value="Reset" name="reset" onclick="ShowParent();" />

            </center>
        </div>

       <%--   Amend Seaction  --%>

        <div id="amend" style="display: none;">
            <br><br><center><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection: </lable>
                <select id="checkOption3"  name="checkOption3" >
                    <option value="" selected  style="width: 159px"  style="display:none;" > --select-- </option>
                    <option value="loan1" >Loan Account [External]</option>
                    <option value="deposit1" >Deposit Account [External]</option>
                </select>
            </center></div>
        <div id="amendsearch" style="display: none;">
            <center>
                <br><br>  <lable style=" font-family: Berlin Sans FB; font-weight:  normal;" >Enter SHG Code: </lable>
                <input type="text" name="shgSearch" readonly id="shgSearch" style="text-align:right;" />
                <input type="button"  value="Search" onclick="javascript:searchShg(220, 180, document.AccountDetailsform.shgSearch.value)" />
                <input type="button"  value="Submit" onclick="javascript:getDetails()" />
                <input type="hidden" name="shgName" id="shgName" />

            </center>
            <br><br>
        </div>

        <%--if (checkoption.equalsIgnoreCase("amend")) {
        --%>

        <%if (checkoption3.equalsIgnoreCase("loan1")) {
        %>

       <%--<script>      document.getElementById("checkOption").disabled=true;</script>--%>
       <script>      document.getElementById("operationSel").style.visibility='hidden';</script>
        <center><table>
                <tr><td><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection:</lable>
            </td><td><select id="checkOption3"  style="width: 159px" disabled  name="checkOption3" >
                <option value="" selected  style="display:none;" > --select-- </option>
                <option value="loan1" <%if (checkoption3.equalsIgnoreCase("loan1")) {%> selected <%}%>>Loan Account</option>
                <option value="deposit1" <%if (checkoption3.equalsIgnoreCase("deposit1")) {%> selected <%}%>>Deposit Account</option>
            </select></td></tr>

        <br><br>
        <tr><td>
                SHG Code:</td><td><input type="text" id="shgcodeAmend" name="shgcodeAmend" value="<%=blankNull(oAccountDetailsBean.getShgcode())%>" readonly style="text-align:right;" > </td>
        </tr>
        <tr>
            <td>Name Of SHG: </td>
            <td> <input type="text" id="shgnameAmend" name="shgnameAmend" value="<%=blankNull(oAccountDetailsBean.getShgname())%>" readonly /></td>
        </tr>
        <tr></tr>
        <tr></tr>
    </table>
</center>

<div id="loan_Amend" >
    <br><br>
    <center>
        <table id="loan_details_Amend"  border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px; width: 100%;" >
            <thead  class="CSSTableGenerator" >
                <tr>
                    <td></td>
                    <td>Source</td>
                    <td>Bank Name</td>
                    <td>Account Number</td>
                    <td style="width: 80px">Account Open Date</td>
                    <td>Last Disbursement Date</td>
                    <td>Loan Amount</td>
                    <td>Principal Outstanding</td>
                    <td>Principal Paid</td>
                    <td>Interest Outstanding</td>
                    <td>Interest Paid</td>

                </tr>
            </thead>
            <tbody>
                <%
                    oAccountDetailsBean = new AccountDetailsBean();
                    count = 0;

                    for (int i = 0; i < alAccountDetailsBean.size(); i++) {
                        oAccountDetailsBean = alAccountDetailsBean.get(i);

                        count++;

                %>
                <tr>
                    <td><input type="checkbox" name="chckboxAmend<%=count%>" id="chckboxAmend<%=count%>" onclick="return checkboxTrueAmend(<%=count%>)"  value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>" /></td>
                    <td><select  id="sourceAmend<%=count%>" name="sourceAmend<%=count%>" onchange="showbanknameAmend(<%=count%>)" value="<%=blankNull(oAccountDetailsBean.getSource())%>"><option value="External" <%if (oAccountDetailsBean.getSource().equalsIgnoreCase("External")) {%> selected <%}%> >External</option></select></td>
                    <td><input size="6" type="text" name="banknameAmend<%=count%>" id="banknameAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getBankname())%>" <%if (oAccountDetailsBean.getSource().equalsIgnoreCase("Internal")) {%> disabled <%}%>></td>
                    <td><input size="8" type="text" id="accountnumberAmend<%=count%>" name="accountnumberAmend<%=count%>"  onKeyPress="return numbersonly(this, event)" value="<%=blankNull(oAccountDetailsBean.getAccountnumber())%>"</td>
                    <td><input size="6" type="text" style="text-align:center;" name="accountopendateAmend<%=count%>" id="accountopendateAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountopendate())%>" readonly><a href="#" onclick="return getCalendar(document.forms[0].accountopendateAmend<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="16" height="18" /></a></td>
                    <td><input size="8" type="text" style="text-align:center;" name="lastdisbursementdateAmend<%=count%>" id="lastdisbursementdateAmend<%=count%>" readonly  value="<%=blankNull(oAccountDetailsBean.getLastdisbursementdate())%>"  /><a href="#" onclick="return getCalendar(document.forms[0].lastdisbursementdateAmend<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="18" height="18" /></a></td>
                    <td><input size="7" type="text" id="loanamountAmend<%=count%>" name="loanamountAmend<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getLoanamount())%>" onKeyPress="return numbersonly( this,event)"></td>
                    <td><input size="12" type="text" id="principaloutstandingAmend<%=count%>" name="principaloutstandingAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getPrincipaloutstanding())%>" onKeyPress="return numbersonly(this,event)"></td>
                    <td><input size="7" type="text" id="principalpaidAmend<%=count%>" name="principalpaidAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getPrincipalpaid())%>" onKeyPress="return numbersonly( this,event)"></td>
                    <td><input size="12" type="text" id="interestoutstandingAmend<%=count%>" name="interestoutstandingAmend<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getInterestoutstanding())%>" onKeyPress="return numbersonly(this,event)"></td>
                    <td><input size="7" type="text" id="interestpaidAmend<%=count%>" name="interestpaidAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getInterestpaid())%>" onKeyPress="return numbersonly(this, event)"></td>
                    <td style="display:none;"><input type="hidden" name="acc_idAmend<%=count%>" id="acc_idAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>"/></td>
                    <td style="display:none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>

                </tr>
                <%}%>
            </tbody>
        </table>
    </center>
    <br/><br/>
    <lable style=" font-family: Berlin Sans FB; font-weight:  normal;">All fields are mandatory</lable>
    <center>
        <input type="button" id="addRowLoanAmend" value="Add Row"/>
        <input type="button" id="deleteRowLoanAmend" value="Delete Row"/>
        <input type="button" value="Submit" onclick="javascript:updateloanform(AccountDetailsform)"/>
        <input type="button" value="Reset" name="reset" onclick="ShowParent();" />

    </center>

</div>
<%}%>       <%if (checkoption3.equalsIgnoreCase("deposit1")) {
%>
<%--<script> document.getElementById("checkOption").disabled=true;</script>--%>
<script>      document.getElementById("operationSel").style.visibility='hidden';</script>
<div id="deposit_Amend" >
    <center><table>
            <tr><td><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection:</lable>
        </td>   <td><select id="checkOption3" disabled  style="width: 150px" name="checkOption3" >
            <option value="" selected   style="display:none;" > --select-- </option>
            <option value="loan1" <%if (checkoption3.equalsIgnoreCase("loan1")) {%> selected <%}%>>Loan Account</option>
            <option value="deposit1" <%if (checkoption3.equalsIgnoreCase("deposit1")) {%> selected <%}%>>Deposit Account</option>
        </select></td></tr>

    <br><br>
    <tr><td>
            SHG Code:</td><td><input type="text" id="shgcodeAmend" name="shgcodeAmend" value="<%=blankNull(oAccountDetailsBean.getShgcode())%>" readonly style="text-align:right;" ></td>
    </tr>
    <tr>
        <td>Name Of SHG: </td>
        <td> <input type="text" id="shgnameAmend" name="shgnameAmend" value="<%=blankNull(oAccountDetailsBean.getShgname())%>" readonly /></td>
    </tr>
    <tr></tr>
    <tr></tr>
</table>
</center>
<center>
    <table id="deposit_details_Amend"  border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px; width: 100%;" >
        <thead  class="CSSTableGenerator" >
            <tr>
                <td></td>
                <td>Source</td>
                <td>Bank Name</td>
                <td>Account Number</td>
                <td>Account Open Date</td>
                <td>Outstanding Balance</td>
                <td>Interest Accrued</td>
                <td>Last Transaction Date</td>
            </tr>
        </thead>
        <tbody>
            <%
                oAccountDetailsBean = new AccountDetailsBean();
                count = 0;

                for (int i = 0; i < alAccountDetailsBean.size(); i++) {
                    oAccountDetailsBean = alAccountDetailsBean.get(i);

                    count++;

            %>
            <tr>
                <td><input type="checkbox" name="chckboxAmend<%=count%>" id="chckboxAmend<%=count%>" onclick="return checkboxTrueAmend(<%=count%>)"  value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>" /></td>
                <td><select id="source1Amend<%=count%>" name="source1Amend<%=count%>" onchange="showbanknameDepositAmend(<%=count%>)" value="<%=blankNull(oAccountDetailsBean.getSource1())%>"><option value="External" <%if (oAccountDetailsBean.getSource1().equalsIgnoreCase("External")) {%> selected <%}%>  >External</option></select></td>
                <td><input size="15" type="text" name="bankname1Amend<%=count%>" id="bankname1Amend<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getBankname1())%>" <%if (oAccountDetailsBean.getSource1().equalsIgnoreCase("Internal")) {%> disabled <%}%>></td>
                <td><input type="text" id="accountnumber1Amend<%=count%>" name="accountnumber1Amend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountnumber1())%>" onKeyPress="return numbersonly(this, event)"></td>
                <td><input size="10" style="text-align:center;" type="text" name="accountopendate1Amend<%=count%>" id="accountopendate1Amend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountopendate1())%>" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendate1Amend<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="20" height="15" /></a></td>
                <td><input  type="text" id="outstandingbalanceAmend<%=count%>" name="outstandingbalanceAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getOutstandingbalance())%>" onKeyPress="return numbersonly( this,event)"></td>
                <td><input  type="text" id="interestaccruedAmend<%=count%>" name="interestaccruedAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getInterestaccrued())%>" onKeyPress="return numbersonly(this, event)"></td>
                <td><input size="10" style="text-align:center;" type="text" name="lasttransactiondateAmend<%=count%>" id="lasttransactiondateAmend<%=count%>" readonly  value="<%=blankNull(oAccountDetailsBean.getLasttransactiondate())%>" /><a href="#" onclick="return getCalendar(document.forms[0].lasttransactiondateAmend<%=count%>);"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="20" height="15" /></a></td>
                <td style="display:none;"><input type="hidden" name="acc_idAmend<%=count%>" id="acc_idAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>"/></td>
                <td style="display:none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>

            </tr>
            <%}%>
        </tbody>
    </table>
</center>
<br/><br/>
<lable style=" font-family: Berlin Sans FB; font-weight:  normal;">All fields are mandatory</lable>
<center>
    <input type="button" id="addRowDepositAmend" value="Add Row"/>
    <input type="button" id="deleteRowDepositAmend" value="Delete Row"/>
    <input type="button" value="Submit" onclick="javascript:updatedepositform(AccountDetailsform)"/>
    <input type="button" value="Reset" name="reset" onclick="ShowParent();" />

</center>

</div>
<%}%>

<%--   View Seaction  --%>

<div id="view" style="display: none;">
    <br><br><center><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection:</lable>
        <select id="checkOption4"  name="checkOption4" >
            <option value="" selected  style="width: 159px"  style="display:none;" > --select-- </option>
            <option value="loan2" >Loan Account</option>
            <option value="deposit2" >Deposit Account</option>
        </select>
    </center></div>
<div id="viewsearch" style="display: none;">
    <center>
        <br><br>  <lable style=" font-family: Berlin Sans FB; font-weight:  normal;" >Enter SHG Code: </lable>
        <input type="text" name="shgSearch1" readonly id="shgSearch1" style="text-align:right;" />
        <input type="button"  value="Search" onclick="javascript:searchShg1(220, 180, document.AccountDetailsform.shgSearch1.value)" />
        <input type="button"  value="Submit" onclick="javascript:getDetails1()" />
        <input type="hidden" name="viewshg" id="viewshg" />

    </center>
    <br><br>
</div>

<%--if (checkoption.equalsIgnoreCase("amend")) {
--%>

<%if (checkoption4.equalsIgnoreCase("loan2")) {
%>

<%--<script>      document.getElementById("checkOption").disabled=true;</script>--%>
<script>      document.getElementById("operationSel").style.visibility='hidden';</script>

<center><table>
        <tr><td><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection:</lable>
    </td><td><select id="checkoption4"  style="width: 159px" disabled  name="checkoption4" >
        <option value="" selected  style="display:none;" > --select-- </option>
        <option value="loan2" <%if (checkoption4.equalsIgnoreCase("loan2")) {%> selected <%}%>>Loan Account</option>
        <option value="deposit2" <%if (checkoption4.equalsIgnoreCase("deposit2")) {%> selected <%}%>>Deposit Account</option>
    </select></td></tr>

<br><br>
<tr><td>
        SHG Code:</td><td><input type="text" id="shgcodeAmend1" name="shgcodeAmend1" value="<%=blankNull(oAccountDetailsBean.getShgcode())%>" readonly style="text-align:right;" ></td>
</tr>
<tr>
    <td>Name Of SHG: </td>
    <td> <input type="text" id="shgnameAmend1" name="shgnameAmend1" value="<%=blankNull(oAccountDetailsBean.getShgname())%>" readonly /></td>
</tr>
<tr></tr>
<tr></tr>
</table>
</center>

<div id="loan_view" >
    <br><br>
    <center>
        <div style="overflow:scroll; width: 900px;">
        <table id="loan_details_view"  border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px; width: 100%;" >
            <thead  class="CSSTableGenerator" >
                <tr>

                    <td>Source</td>
                    <td>Bank Name</td>
                    <td>Account Number</td>
                    <td style="width: 80px">Account Open Date</td>
                    <td>Last Disbursement Date</td>
                    <td>Loan Amount</td>
                    <td>Principal Outstanding</td>
                    <td>Principal Paid</td>
                    <td>Interest Outstanding</td>
                    <td>Interest Paid</td>

                </tr>
            </thead>
            <tbody>
                <%
                    oAccountDetailsBean = new AccountDetailsBean();
                    count = 0;

                    for (int i = 0; i < alAccountDetailsBean.size(); i++) {
                        oAccountDetailsBean = alAccountDetailsBean.get(i);

                        count++;
                %>
                <tr>
                    <td><select  id="sourceAmend<%=count%>" disabled name="sourceAmend<%=count%>" onchange="showbanknameAmend(<%=count%>)" value="<%=blankNull(oAccountDetailsBean.getSource())%>"><option value=""  selected="selected">[Select]</option><option value="Internal"<%if (oAccountDetailsBean.getSource().equalsIgnoreCase("Internal")) {%> selected <%}%>>Internal</option><option value="External" <%if (oAccountDetailsBean.getSource().equalsIgnoreCase("External")) {%> selected <%}%> >External</option></select></td>
                    <td><input size="8" readonly type="text" name="banknameAmend<%=count%>" id="banknameAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getBankname())%>" <%if (oAccountDetailsBean.getSource().equalsIgnoreCase("Internal")) {%> disabled <%}%>></td>
                    <td><input size="15" readonly type="text" id="accountnumberAmend<%=count%>" name="accountnumberAmend<%=count%>"  onKeyPress="return numbersonly(this, event)" value="<%=blankNull(oAccountDetailsBean.getAccountnumber())%>"</td>
                    <td><input size="10" readonly style="text-align:center;" type="text" name="accountopendateAmend<%=count%>" id="accountopendateAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountopendate())%>" readonly><a href="#" onclick="return getCalendar(document.forms[0].accountopendateAmend<%=count%>);"></a></td>
                    <td><input size="20" readonly style="text-align:center;" type="text" name="lastdisbursementdateAmend<%=count%>" id="lastdisbursementdateAmend<%=count%>" readonly  value="<%=blankNull(oAccountDetailsBean.getLastdisbursementdate())%>"  /><a href="#" onclick="return getCalendar(document.forms[0].lastdisbursementdateAmend<%=count%>);"></a></td>
                    <td><input size="11" readonly type="text" id="loanamountAmend<%=count%>" name="loanamountAmend<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getLoanamount())%>" onKeyPress="return numbersonly( this,event)"></td>
                    <td><input size="19" readonly type="text" id="principaloutstandingAmend<%=count%>" name="principaloutstandingAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getPrincipaloutstanding())%>" onKeyPress="return numbersonly(this,event)"></td>
                    <td><input size="11" readonly type="text" id="principalpaidAmend<%=count%>" name="principalpaidAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getPrincipalpaid())%>" onKeyPress="return numbersonly( this,event)"></td>
                    <td><input size="18" readonly type="text" id="interestoutstandingAmend<%=count%>" name="interestoutstandingAmend<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getInterestoutstanding())%>" onKeyPress="return numbersonly(this,event)"></td>
                    <td><input size="10" readonly type="text" id="interestpaidAmend<%=count%>" name="interestpaidAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getInterestpaid())%>" onKeyPress="return numbersonly(this, event)"></td>
                    <td style=" display: none;"><input type="hidden" name="acc_idAmend<%=count%>" id="acc_idAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>"/></td>
                    <td style=" display: none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>

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

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

</div>
<%}%>       <%if (checkoption4.equalsIgnoreCase("deposit2")) {
%>
<%--<script> document.getElementById("checkOption").disabled=true;</script>--%>
<script>      document.getElementById("operationSel").style.visibility='hidden';</script>
<div id="deposit_view" >
    <center><table>
            <tr><td><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection: </lable>
        </td>   <td><select id="checkoption4" disabled  style="width: 150px" name="checkoption4" >
            <option value="" selected   style="display:none;" > --select-- </option>
            <option value="loan2" <%if (checkoption4.equalsIgnoreCase("loan2")) {%> selected <%}%>>Loan Account</option>
            <option value="deposit2" <%if (checkoption4.equalsIgnoreCase("deposit2")) {%> selected <%}%>>Deposit Account</option>
        </select></td></tr>
    <br><br>
    <tr><td>
            SHG Code:</td><td><input type="text" id="shgcodeAmend" name="shgcodeAmend" value="<%=blankNull(oAccountDetailsBean.getShgcode())%>" readonly style="text-align:right;" > </td>
    </tr>
    <tr>
        <td>Name Of SHG: </td>
        <td> <input type="text" id="shgnameAmend" name="shgnameAmend" value="<%=blankNull(oAccountDetailsBean.getShgname())%>" readonly /></td>
    </tr>
    <tr></tr>
    <tr></tr>
</table>
</center>
<center>
    <div style="overflow:scroll; width: 900px;">
        <table id="deposit_details_view"  border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px; width: 100%;" >
            <thead  class="CSSTableGenerator" >
                <tr>

                    <td>Source</td>
                    <td>Bank Name</td>
                    <td>Account Number</td>
                    <td>Account Open Date</td>
                    <td>Outstanding Balance</td>
                    <td>Interest Accrued</td>
                    <td>Last Transaction Date</td>
                </tr>
            </thead>
            <tbody>
                <%
                    oAccountDetailsBean = new AccountDetailsBean();
                    count = 0;

                    for (int i = 0; i < alAccountDetailsBean.size(); i++) {
                        oAccountDetailsBean = alAccountDetailsBean.get(i);

                        count++;
                %>
                <tr>
                    <td><select id="source1Amend<%=count%>" disabled name="source1Amend<%=count%>" onchange="showbanknameDepositAmend(<%=count%>)" value="<%=blankNull(oAccountDetailsBean.getSource1())%>"><option value="" selected="selected">[Select]</option><option value="Internal"<%if (oAccountDetailsBean.getSource1().equalsIgnoreCase("Internal")) {%> selected <%}%>>Internal</option><option value="External" <%if (oAccountDetailsBean.getSource1().equalsIgnoreCase("External")) {%> selected <%}%>  >External</option></select></td>
                    <td><input size="15" readonly type="text" name="bankname1Amend<%=count%>" id="bankname1Amend<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getBankname1())%>" <%if (oAccountDetailsBean.getSource1().equalsIgnoreCase("Internal")) {%> disabled <%}%>></td>
                    <td><input type="text" readonly id="accountnumber1Amend<%=count%>" name="accountnumber1Amend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountnumber1())%>" onKeyPress="return numbersonly(this, event)"></td>
                    <td><input size="16" readonly style="text-align:center;" type="text" name="accountopendate1Amend<%=count%>" id="accountopendate1Amend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountopendate1())%>" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendate1Amend<%=count%>);"></a></td>
                    <td><input  type="text" readonly id="outstandingbalanceAmend<%=count%>" name="outstandingbalanceAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getOutstandingbalance())%>" onKeyPress="return numbersonly( this,event)"></td>
                    <td><input  type="text" readonly id="interestaccruedAmend<%=count%>" name="interestaccruedAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getInterestaccrued())%>" onKeyPress="return numbersonly(this, event)"></td>
                    <td><input size="20" readonly type="text" name="lasttransactiondateAmend<%=count%>" id="lasttransactiondateAmend<%=count%>" readonly  value="<%=blankNull(oAccountDetailsBean.getLasttransactiondate())%>" /><a href="#" onclick="return getCalendar(document.forms[0].lasttransactiondateAmend<%=count%>);"></a></td>
                    <td style=" display: none;"><input type="hidden" name="acc_idAmend<%=count%>" id="acc_idAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>"/></td>
                    <td style=" display: none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>

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

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

</div>
<%}%>

<%--   Transaction Seaction  --%>

<div id="transDiv" style="display: none;" >
    <br><br><center><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection: </lable>
        <select id="checkOption5"  name="checkOption5" >
            <option value="" selected  style="width: 159px"  style="display:none;" >--select--</option>
            <option value="loan3" >Loan Account</option>
            <option value="deposit3" >Deposit Account</option>
        </select>
    </center></div>
<div id="transSearch" style="display: none;">
    <center>
        <br><br>  <lable style=" font-family: Berlin Sans FB; font-weight:  normal;" >Enter SHG Code: </lable>
        <input type="text" name="shgSearch2" readonly id="shgSearch2" style="text-align:right;" />
       <%-- <br><lable style=" font-family: Berlin Sans FB; font-weight:  normal;" >SHG Name: </lable>
        <input type="text" name="shgName" readonly id="shgName"/>--%>
        <input type="button"  value="Search" onclick="javascript:searchShg2(220, 180, document.AccountDetailsform.shgSearch.value)" />
        <input type="button"  value="Submit" onclick="javascript:getDetails2()" />
        <input type="hidden" name="viewshg2" id="viewshg2" />

    </center>
    <br><br>
</div>

<%--if (checkoption.equalsIgnoreCase("amend")) {
--%>

<%if (checkoption5.equalsIgnoreCase("loan3")) {
%>

<%--<script>document.getElementById("checkOption").disabled=true;</script>--%>
<script>      document.getElementById("operationSel").style.visibility='hidden';</script>

<center><table>
        <tr><td><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection</lable>
    </td><td><select id="checkoption5"  style="width: 159px" disabled  name="checkoption5" >
        <option value="" selected  style="display:none;" >--select--</option>
        <option value="loan2" <%if (checkoption5.equalsIgnoreCase("loan3")) {%> selected <%}%>>Loan Account</option>
        <option value="deposit2" <%if (checkoption5.equalsIgnoreCase("deposit3")) {%> selected <%}%>>Deposit Account</option>
    </select></td></tr>

<br><br>
<tr><td>
        SHG Code:</td><td><input type="text" id="shgcodeAmend1" name="shgcodeAmend1" value="<%=blankNull(oAccountDetailsBean.getShgcode())%>" readonly style="text-align:right;" > </td>
</tr>
<tr>
        <td>Name Of SHG: </td>
        <td> <input type="text" id="shgnameAmend2" name="shgnameAmend2" value="<%=blankNull(oAccountDetailsBean.getShgname())%>" readonly /></td>
    </tr>
    <tr></tr>
    <tr></tr>
</table>
</center>
<center>
    <div style="overflow:scroll; width: 900px;">

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

                    <td>Transaction Reference No.</td>
                    <td>Account Number</td>
                    <td>Transaction Amount</td>
                    <td>Transaction Type</td>
                    <td>Transaction Date</td>
                    <td>Member Name</td>
                </tr>
            </thead>
            <tbody>
                <%
                    oAccountDetailsBean = new AccountDetailsBean();
                    count = 0;

                    for (int i = 0; i < alAccountDetailsBean.size(); i++) {
                        oAccountDetailsBean = alAccountDetailsBean.get(i);

                        count++;

                %>
                <tr>

                    <td><input size="24" readonly type="text" name="txnRefNo<%=count%>" id="txnRefNo<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getTxn_ref_no())%>"></td>
                    <td><input size="20" type="text" readonly id="accountnumber1<%=count%>" name="accountnumber1<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountnumber())%>"></td>
                    <td><input size="20" readonly type="text" name="txnAmount<%=count%>" id="txnAmount<%=count%>" value="<%=blankNull(oAccountDetailsBean.getTxn_amt())%>" /></td>
                    <td><input size="20" readonly type="text" name="txn_type<%=count%>" id="txn_type<%=count%>" value="<%=blankNull(oAccountDetailsBean.getTxn_type())%>" /></td>
                    <td><input size="20" style="text-align:center;" readonly type="text" name="txnDate<%=count%>" id="txnDate<%=count%>" value="<%=blankNull(oAccountDetailsBean.getLasttransactiondate())%>" /></td>
                    <td><input size="20" readonly type="text" name="memberName<%=count%>" id="memberName<%=count%>" value="<%=blankNull(oAccountDetailsBean.getMember_name())%>" /></td>
                    <td style=" display: none;"><input type="hidden" name="acc_idAmend<%=count%>" id="acc_idAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>"/></td>
                    <td style=" display: none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>

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

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

<%}%>       <%if (checkoption5.equalsIgnoreCase("deposit3")) {
%>
<%--<script> document.getElementById("checkOption").disabled=true;</script>--%>
<script>      document.getElementById("operationSel").style.visibility='hidden';</script>
<div id="deposit_view" >
    <center><table>
            <tr><td><lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Account Selection: </lable>
        </td>   <td><select id="checkoption5" disabled  style="width: 150px" name="checkoption4" >
            <option value="" selected   style="display:none;" >--select--</option>
            <option value="loan3" <%if (checkoption5.equalsIgnoreCase("loan3")) {%> selected <%}%>>Loan Account</option>
            <option value="deposit3" <%if (checkoption5.equalsIgnoreCase("deposit3")) {%> selected <%}%>>Deposit Account</option>
        </select></td></tr>

    <br><br>
    <tr><td>
            SHG Code:</td><td><input type="text" id="shgcodeAmend" name="shgcodeAmend" value="<%=blankNull(oAccountDetailsBean.getShgcode())%>" readonly style="text-align:right;" ></td>
    </tr>
    <tr>
        <td>Name Of SHG: </td>
        <td> <input type="text" id="shgnameAmend2" name="shgnameAmend2" value="<%=blankNull(oAccountDetailsBean.getShgname())%>" readonly /></td>
    </tr>
    <tr></tr>
    <tr></tr>
</table>
</center>
<center>
    <div style="overflow:scroll; width: 900px;">

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

                    <td>Transaction Reference No.</td>
                    <td>Account Number</td>
                    <td>Transaction Amount</td>
                    <td>Transaction Type</td>
                    <td>Transaction Date</td>
                    <td>Member Name</td>
                </tr>
            </thead>
            <tbody>
                <%
                    oAccountDetailsBean = new AccountDetailsBean();
                    count = 0;

                    for (int i = 0; i < alAccountDetailsBean.size(); i++) {
                        oAccountDetailsBean = alAccountDetailsBean.get(i);

                        count++;

                %>
                <tr>

                    <td><input size="24" readonly type="text" name="txnRefNo<%=count%>" id="txnRefNo<%=count%>"  value="<%=blankNull(oAccountDetailsBean.getTxn_ref_no())%>"></td>
                    <td><input size="20" type="text" readonly id="accountnumber1<%=count%>" name="accountnumber1<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAccountnumber())%>"></td>
                    <td><input size="20" readonly type="text" name="txnAmount<%=count%>" id="txnAmount<%=count%>" value="<%=blankNull(oAccountDetailsBean.getTxn_amt())%>" /></td>
                    <td><input size="20" readonly type="text" name="txn_type<%=count%>" id="txn_type<%=count%>" value="<%=blankNull(oAccountDetailsBean.getTxn_type())%>" /></td>
                    <td><input size="20" readonly type="text" style="text-align:center;" name="txnDate<%=count%>" id="txnDate<%=count%>" value="<%=blankNull(oAccountDetailsBean.getLasttransactiondate())%>" /></td>
                    <td><input size="20" readonly type="text" name="memberName<%=count%>" id="memberName<%=count%>" value="<%=blankNull(oAccountDetailsBean.getMember_name())%>" /></td>
                    <td style=" display: none;"><input type="hidden" name="acc_idAmend<%=count%>" id="acc_idAmend<%=count%>" value="<%=blankNull(oAccountDetailsBean.getAcc_id())%>"/></td>
                    <td style=" display: none;"><input type="hidden" name="rowStatus<%=count%>" id="rowStatus<%=count%>" value="A"/></td>

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

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

</center>
</div>

<%}%>

<%--    Member Details Section  --%>

<br>
<br>

<div id="memberDetails" name="memberDetails" style="display: none">

    <%
        String shg_name="";
        String mem_name="";
        String t_type="";
        if(displayFlag=="Y")
        {
            shg_name=request.getAttribute("s_code").toString();
            mem_name=request.getAttribute("mem_name").toString();
            t_type=request.getAttribute("tType").toString();

        }

    %>
    <center>
    <table id="memberDetailsTbl" name="memberDetailsTbl">
        <tr>
            <td>
            SHG Name:
            </td>
            <td>
                <input type="text" id="shg_code" name="shg_code" <%if(displayFlag=="Y"){%> value="<%=shg_name%>" disabled<%}%> readonly />
            </td>
            <td>
                <input type="button" id="shg_code_btn" name="shg_code_btn" value="Search" onclick="javascript:searchShg3(220, 180)" />
            </td>
        </tr>
        <tr>
            <td>
                Member Name:
            </td>
            <td>
                <input type="text" id="member_name" name="member_name" <%if(displayFlag=="Y"){%> value="<%=mem_name%>" disabled<%}%> readonly/>
            </td>
            <td>
                <input type="button" id="member_name_srch" name="member_name_srch" value="Search" onclick="javascript:searchShgMembers(220, 180,document.getElementById('viewshg3').value)" />
            </td>
        </tr>
        <tr><td>
                Select Type:
            </td>
            <td>
                <select id="txnType1"  name="txnType1">
                    <option value="" selected disabled>--Select--</option>
                    <option value="deposit"  <%if(displayFlag=="Y"){%><%if(t_type.equalsIgnoreCase("deposit")){%>selected<%}}%> >Deposit</option>
                    <option value="loan" <%if(displayFlag=="Y"){%><%if(t_type.equalsIgnoreCase("loan")){%>selected<%}}%> >Loan</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" id="submitMember" name="submitMember" value="Submit" onclick="javascript:getDetails3()" />
            </td>
            <td>
                <input type="button" id="resetMember" name="resetMember" value="Reset" onclick="ShowParent();" />
            </td>

        </tr>
        <input type="hidden" name="viewshg3" id="viewshg3" />
        <input type="hidden" name="member_id" id="member_id" />
    </table>
</center>

    <%
                                    if(displayFlag=="Y")
                                    {
                            %>
    <%--<script>
        checkop(); 
        document.getElementById("checkOption").disabled=true;</script>--%>
    <script>
         checkop();
        document.getElementById("operationSel").style.visibility='hidden';</script>
    <center>
    <table id="member_contri_deposit" border="2" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px;">
        <thead  class="CSSTableGenerator" >
                <tr>
                    <td>Member ID</td>
                    <td>Member Name</td>
                    <td>Deposit</td>
                    <td>Withdrawl</td>
                    <td>Net Contribution</td>
                </tr>
        </thead>
        <tbody>
             <%
                    oAccountDetailsBean = new AccountDetailsBean();
                    count = 0;

                    for (int i = 0; i < alAccountDetailsBean.size(); i++) {
                        oAccountDetailsBean = alAccountDetailsBean.get(i);

                        count++;


                        Float dep=Float.parseFloat(oAccountDetailsBean.getDeposit()== null ? "0" : oAccountDetailsBean.getDeposit());
                        Float wtdrw=Float.parseFloat((oAccountDetailsBean.getWithdrawl()== null ? "0" : oAccountDetailsBean.getWithdrawl()));
                        float f=dep-wtdrw;

                       // float f=(dep/tot)*100;
                        

                %>
        <tr>
            <td><input type="text" id="memberId" name="memberId" value="<%=blankNull(oAccountDetailsBean.getMember_code())%>" readonly style="text-align:right;" /></td>
            <td><input type="text" id="memberName" name="memberName" value="<%=blankNull(oAccountDetailsBean.getMember_name())%>" readonly /></td>
            <td><input type="text" id="memberDeposit" name="memberDeposit" value="<%=dep%>" readonly style="text-align:right;" /></td>
            <td><input type="text" id="memberWithdrawl" name="memberWithdrawl" value="<%=wtdrw%>" readonly style="text-align:right;" /></td>
            <td><input type="text" id="memberContriDep" name="memberContriDep" value="<%=f%>" readonly style="text-align:right;" /></td>
        </tr>
        <%}%>
        </tbody>
    </table>


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

                    <td>Disbursed Amount</td>
                    <td>% of Total Disbursed Amount</td>
                    <td>Principal Outstanding</td>
                    <td>Principal Paid</td>
                    <td>Interest Outstanding</td>
                    <td>Interest Paid</td>
                </tr>
        </thead>
        <tbody>
        <tr>
            <td><input type="text" id="disbursedAmt" name="disbursedAmt" readonly style="text-align:right;" /></td>
            <td><input type="text" id="perce_disbursedAmt" name="perce_disbursedAmt" readonly style="text-align:right;" /></td>
            <td><input type="text" id="prinOut" name="prinOut" readonly style="text-align:right;" /></td>
            <td><input type="text" id="prinPaid" name="prinPaid" readonly style="text-align:right;" /></td>
            <td><input type="text" id="intOut" name="intOut" readonly style="text-align:right;" /></td>
            <td><input type="text" id="intPaid" name="intPaid" readonly style="text-align:right;" /></td> 
        </tr>
        </tbody>
    </table>
    </center>
     <%}%>
</div>

<input type="hidden" name="rowCounterDelete" id="rowCounterDelete" value="<%=count%>">
<input type="hidden" name="deletedRows" id="deletedRows" value=""/>
<input type="hidden" name="rowCounter" id="rowCounter" value="<%=count%>">
<input type="hidden" name="chkboxCounter" id="chkboxCounter" value="0">

<input name="handle_id" id="handle_id" type="hidden" value="" />

</form>
<script>
    
    $("#addRowDeposit").click(function () {
        var counter = $("#rowCounter").val();
        var counterdelete = $("#rowCounterDelete").val();
        counterdelete++;
        counter++;
        $("#rowCounter").val(counter);
        $("#rowCounterDelete").val(counterdelete);
        $('#deposit_details tr:last').after(' <tr><td align="center"><input type="checkbox" name="chckbox1' + counter + '" id="chckbox1' + counter + '" onclick="return checkboxTrueDeposit('+counter+')"/></td>\n\
             <td><select  id="source1' + counter + '" name="source1' + counter + '" onchange="showbanknameDeposit(' + counter + ')"><<option value="External"  >External</option></select></td>\n\
            <td><input size="15" type="text" name="bankname1' + counter + '" id="bankname1' + counter + '" ></td>\n\
            <td><input  type="text" id="accountnumber1' + counter + '" name="accountnumber1' + counter + '" onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="14" type="text" name="accountopendate1' + counter + '" id="accountopendate1' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendate1' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="15" height="15" /></a></td>\n\
            <td><input  type="text" id="outstandingbalance' + counter + '" name="outstandingbalance' + counter + '"  onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input  type="text" id="interestaccrued' + counter + '" name="interestaccrued' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
            <td><input size="16" type="text" name="lasttransactiondate' + counter + '" id="lasttransactiondate' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].lasttransactiondate' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="15" height="15" /></a></td>\n\
            \n\n\n</tr>');
    });
    $("#addRowLoan").click(function () {
        var counter = $("#rowCounter").val();
        var counterdelete = $("#rowCounterDelete").val();
        counterdelete++;
        counter++;
        $("#rowCounter").val(counter);
        $("#rowCounterDelete").val(counterdelete);
        $('#loan_details tr:last').after(' <tr><td align="center"><input type="checkbox" name="chckbox' + counter + '" id="chckbox' + counter + '" onclick="return checkboxTrue('+counter+')"/></td>\n\
            <td><select   id="source' + counter + '" name="source' + counter + '" onchange="showbankname(' + counter + ')"><<option value="External"  >External</option></select></td>\n\
            <td><input size="8" type="text" name="bankname' + counter + '" id="bankname' + counter + '" ></td>\n\
            <td><input size="13" type="text" id="accountnumber' + counter + '" name="accountnumber' + counter + '" onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="6" type="text" name="accountopendate' + counter + '" id="accountopendate' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendate' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="15" height="16" /></a></td>\n\
             <td><input size="17" type="text" name="lastdisbursementdate' + counter + '" id="lastdisbursementdate' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].lastdisbursementdate' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="18" height="18" /></a></td>\n\
             <td><input size="10" type="text" id="loanamount' + counter + '" name="loanamount' + counter + '"  onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="18" type="text" id="principaloutstanding' + counter + '" name="principaloutstanding' + counter + '"  onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="10" type="text" id="principalpaid' + counter + '" name="principalpaid' + counter + '"  onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="17" type="text" id="interestoutstanding' + counter + '" name="interestoutstanding' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
            <td><input size="10" type="text" id="interestpaid' + counter + '" name="interestpaid' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
          \n\n\n</tr>');
    });

    $("#addRowDepositAmend").click(function () {
        var counter = $("#rowCounter").val();
        var counterdelete = $("#rowCounterDelete").val();
        counterdelete++;
        counter++;
        $("#rowCounter").val(counter);
        $("#rowCounterDelete").val(counterdelete);

        $('#deposit_details_Amend tr:last').after(' <tr><td align="center"><input type="checkbox" name="chckbox1Amend' + counter + '" id="chckbox1Amend' + counter + '" onclick="return checkboxTrueDepositAmend('+counter+')"/></td>\n\
            <td><select id="source1Amend' + counter + '" name="source1Amend' + counter + '" onchange="showbanknameDepositAmend(' + counter + ')"><option value="External"  >External</option></select></td>\n\
            <td><input size="15" type="text" name="bankname1Amend' + counter + '" id="bankname1Amend' + counter + '" ></td>\n\
            <td><input  type="text" id="accountnumber1Amend' + counter + '" name="accountnumber1Amend' + counter + '" onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="10" type="text" name="accountopendate1Amend' + counter + '" id="accountopendate1Amend' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendate1Amend' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="18" height="18" /></a></td>\n\
            <td><input type="text" id="outstandingbalanceAmend' + counter + '" name="outstandingbalanceAmend' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
            <td><input  type="text" id="interestaccruedAmend' + counter + '" name="interestaccruedAmend' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
            <td><input size="10" type="text" name="lasttransactiondateAmend' + counter + '" id="lasttransactiondateAmend' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].lasttransactiondateAmend' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="18" height="18" /></a></td>\n\
            <td  style="display:none;"><input type="hidden" name="rowStatus' + counter + '" id="rowStatus' + counter + '" value="N"/></td>\n\\n\
                  \n\n\n</tr>');
    });
    $("#addRowLoanAmend").click(function () {
        var counter = $("#rowCounter").val();
        var counterdelete = $("#rowCounterDelete").val();
        counterdelete++;
        counter++;
        $("#rowCounter").val(counter);
        $("#rowCounterDelete").val(counterdelete);
        $('#loan_details_Amend tr:last').after(' <tr><td align="center"><input type="checkbox" name="chckbox' + counter + '" id="chckbox' + counter + '" onclick="return checkboxTrueAmend('+counter+')"/></td>\n\
            <td><select id="sourceAmend' + counter + '" name="sourceAmend' + counter + '" onchange="showbanknameAmend(' + counter + ')"><option value="External"  >External</option></select></td>\n\
            <td><input size="6" type="text" name="banknameAmend' + counter + '" id="banknameAmend' + counter + '" ></td>\n\
            <td><input size="8" type="text" id="accountnumberAmend' + counter + '" name="accountnumberAmend' + counter + '" onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="6" type="text" name="accountopendateAmend' + counter + '" id="accountopendateAmend' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].accountopendateAmend' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="18" height="18" /></a></td>\n\
             <td><input size="8" type="text" name="lastdisbursementdateAmend' + counter + '" id="lastdisbursementdateAmend' + counter + '" readonly  /><a href="#" onclick="return getCalendar(document.forms[0].lastdisbursementdateAmend' + counter + ');"><img src="/PacsApplication/img/calendar.jpg" name="imgr" id="imgr" border="0" width="18" height="18" /></a></td>\n\
             <td><input size="7" type="text" id="loanamountAmend' + counter + '" name="loanamountAmend' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
            <td><input size="12" type="text" id="principaloutstandingAmend' + counter + '" name="principaloutstandingAmend' + counter + '"  onKeyPress="return numbersonly(this, event)"></td>\n\
            <td><input size="7" type="text" id="principalpaidAmend' + counter + '" name="principalpaidAmend' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
            <td><input size="12" type="text" id="interestoutstandingAmend' + counter + '" name="interestoutstandingAmend' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
            <td><input size="7" type="text" id="interestpaidAmend' + counter + '" name="interestpaidAmend' + counter + '"  onKeyPress="return numbersonly( this,event)"></td>\n\
          <td  style="display:none;"><input type="hidden" name="rowStatus' + counter + '" id="rowStatus' + counter + '" value="N"/></td>\n\\n\
                  \n\n\n</tr>');
    });

    $( "#deleteRowLoan" ).click(function() {
        var counter = $("#rowCounterDelete").val();
        var chkboxCounter=$("#chkboxCounter").val();

        counterDelete=counter-chkboxCounter;

        if (counterDelete==0)
        {

            alert("All rows cannot be deleted");
        }

        else{

            $('input:checkbox:checked').closest('tr').remove();
            $("#rowCounterDelete").val(counterDelete);
            chkboxCounter=0;
            $("#chkboxCounter").val(chkboxCounter);


        }



    });
    $( "#deleteRowDeposit" ).click(function() {
        var counter = $("#rowCounterDelete").val();
        var chkboxCounter=$("#chkboxCounter").val();
        //alert(chkboxCounter);
        counterDelete=counter-chkboxCounter;

        if (counterDelete==0)
        {

            alert("All rows cannot be deleted");
        }

        else{

            $('input:checkbox:checked').closest('tr').remove();
            $("#rowCounterDelete").val(counterDelete);
            chkboxCounter=0;
            $("#chkboxCounter").val(chkboxCounter);


        }



    });


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


        var counter =$("#rowCounterDelete").val();
        var chkboxCounter=$("#chkboxCounter").val();
        var counterDelete=counter-chkboxCounter;

        if (counterDelete==0){

            alert("All rows cannot be deleted");
        }
        else{

            var selchbox = [];        // array that will store the value of selected checkboxes

            selchbox= getSelectedChbox(AccountDetailsform);
            $("#deletedRows").val(selchbox);

            $('input:checkbox:checked').closest('tr').remove();

            $("#rowCounterDelete").val(counterDelete);
            chkboxCounter=0;
            $("#chkboxCounter").val(chkboxCounter);


        }


    });

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


        var counter =$("#rowCounterDelete").val();
        var chkboxCounter=$("#chkboxCounter").val();
        var counterDelete=counter-chkboxCounter;

        if (counterDelete==0){

            alert("All rows cannot be deleted");
        }
        else{

            var selchbox = [];        // array that will store the value of selected checkboxes

            selchbox= getSelectedChbox(AccountDetailsform);
            $("#deletedRows").val(selchbox);

            $('input:checkbox:checked').closest('tr').remove();

            $("#rowCounterDelete").val(counterDelete);
            chkboxCounter=0;
            $("#chkboxCounter").val(chkboxCounter);


        }


    });
    function getSelectedChbox(AccountDetailsform) {

        var selchbox = [];        // array that will store the value of selected checkboxes

        // gets all the input tags in frm, and their number
        var inpfields = AccountDetailsform.getElementsByTagName('input');
        var nr_inpfields = inpfields.length;

        // traverse the inpfields elements, and adds the value of selected (checked) checkbox in selchbox
        for(var i=0; i<nr_inpfields; i++) {
            if(inpfields[i].type == 'checkbox' && inpfields[i].checked == true){
                if  (inpfields[i].value!=null || inpfields[i].value!="" ){

                    selchbox.push(inpfields[i].value);

                }

            }

        }

        return selchbox;
    }

    function checkboxTrueAmend(i){

        if(document.getElementById("chckboxAmend"+i).checked==true){

            var counter = $("#chkboxCounter").val();
            counter++;
            $("#chkboxCounter").val(counter);
        }

        else{

            var counter = $("#chkboxCounter").val();
            counter--;
            $("#chkboxCounter").val(counter);
        }

    }
    function checkboxTrueDepositAmend(i){

        if(document.getElementById("chckbox1Amend"+i).checked==true){

            var counter = $("#chkboxCounter").val();
            counter++;
            $("#chkboxCounter").val(counter);
        }

        else{

            var counter = $("#chkboxCounter").val();
            counter--;
            $("#chkboxCounter").val(counter);
        }

    }
    function checkboxTrue(i){

        if(document.getElementById("chckbox"+i).checked==true){

            var counter = $("#chkboxCounter").val();
            counter++;
            $("#chkboxCounter").val(counter);
        }

        else{

            var counter = $("#chkboxCounter").val();
            counter--;
            $("#chkboxCounter").val(counter);
        }

    }
    function checkboxTrueDeposit(i){

        if(document.getElementById("chckbox1"+i).checked==true){

            var counter = $("#chkboxCounter").val();
            counter++;
            $("#chkboxCounter").val(counter);
        }

        else{

            var counter = $("#chkboxCounter").val();
            counter--;
            $("#chkboxCounter").val(counter);
        }

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