<%-- 
    Document   : myIntimation_STB
    Created on : Aug 17, 2021, 2:23:35 PM
    Author     : 1242938
--%>
<%@page import="LoginDb.DbHandler"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.util.ArrayList"%>
<%@page import="DataEntryBean.MyIntimationBean"%>
<html>
    <head>
        
        <title>My Intimation</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 myintimationfunctionsubmit(myintimationform)
            {

                if (document.getElementById("checkOption").value == ""){

                    alert("You must select option for the Intimation.");
                    myintimationform.checkOption.focus();
                    return false;
                }
                if (document.getElementById("fromDate").value == ""){

                    alert("You must select From Date.");
                    myintimationform.fromDate.focus();
                    return false;
                }
                if (document.getElementById("toDate").value == ""){

                    alert("You must select To Date.");
                    myintimationform.toDate.focus();
                    return false;
                }
                
                var startDate = $('#fromDate').val();
                var endDate = $('#toDate').val();
                var adata = startDate.split('/');
                var dd = parseInt(adata[0],10);
                var mm = parseInt(adata[1],10);
                var yyyy = parseInt(adata[2],10);
                var from_date = new Date(yyyy,mm-1,dd);
                
                adata = endDate.split('/');
                var dd = parseInt(adata[0],10);
                var mm = parseInt(adata[1],10);
                var yyyy = parseInt(adata[2],10);
                var to_date = new Date(yyyy,mm-1,dd);

                if(Date.parse(from_date) > Date.parse(to_date)){
                    alert("From Date cannot be greater than To Date");
                    return false;
                }

                document.forms[0].action = '/PacsApplication/MyIntimationServlet_STB';
                document.forms[0].submit();
            }
            function ShowParent()
            {
                document.forms[0].action = "MyIntimation_STB.jsp";
                document.forms[0].submit();
            }

            function checkop(){

                if (document.getElementById("checkOption").value == ""){

                    document.getElementById("transactiontype").disabled=true;

                }

                else if (document.getElementById("checkOption").value == "TXN"){

                    document.getElementById("transactiontype").disabled=false;

                }

                else if (document.getElementById("checkOption").value == "ACC"){

                    document.getElementById("transactiontype").disabled=true;

                }
                else if (document.getElementById("checkOption").value == "KCC"){

                    document.getElementById("transactiontype").disabled=true;

                }
                else if (document.getElementById("checkOption").value == "LACC"){

                    document.getElementById("transactiontype").disabled=true;

                }

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

        <%
                    String displayFlag = "";
                    Object display = request.getAttribute("displayFlag");
                    if (display != null) {
                        displayFlag = display.toString();
                    }
        %>

        <%
                    String ModuleName = new String();

                    ModuleName = (String) session.getAttribute("moduleName");
        %>

        <% if (ModuleName.equalsIgnoreCase("KCC")) {%>
        <jsp:include page="MenuHead.jsp" flush="true" />
        <%} else if (ModuleName.equalsIgnoreCase("Deposit")) {%>
        <jsp:include page="/Deposit/MenuHead_Deposit.jsp" flush="true" />
        <%} else if (ModuleName.equalsIgnoreCase("Loan")) {%>
        <jsp:include page="/Loan/MenuHead_Loan.jsp" flush="true" />
        <%}else if (ModuleName.equalsIgnoreCase("SpecialBothKcc") || ModuleName.equalsIgnoreCase("SpecialKcc")) {%>
        <jsp:include page="/MenuHead.jsp" flush="true" />
        <%}else if (ModuleName.equalsIgnoreCase("SpecialBothDep")) {%>
        <jsp:include page="/Deposit/MenuHead_Deposit.jsp" flush="true" />
        <%}else if (ModuleName.equalsIgnoreCase("SpecialBoth")) {%>
        <jsp:include page="/Deposit/MenuHead_Deposit.jsp" flush="true" />
        <%}else if (ModuleName.equalsIgnoreCase("Special")) {%>
        <jsp:include page="/Deposit/MenuHead_Deposit.jsp" flush="true" />
        <%}%>
        <br>
        <%!
            String blankNull(String s) {
                return (s == null) ? "" : s;
            }
        %>

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

        <%
                    Object alMyIntimationBeanObj = request.getAttribute("alMyIntimationBean");
                    ArrayList<MyIntimationBean> alMyIntimationBean = new ArrayList<MyIntimationBean>();
                    if (alMyIntimationBeanObj != null) {
                        alMyIntimationBean = (ArrayList<MyIntimationBean>) request.getAttribute("alMyIntimationBean");
                    }
        %>
        <%
                    Object oMyIntimationBeanSearchObj = request.getAttribute("oMyIntimationBeanSearchObj");
                    MyIntimationBean oMyIntimationBean = new MyIntimationBean();
                    MyIntimationBean oMyIntimationBeanSearch = new MyIntimationBean();
                    if (oMyIntimationBeanSearchObj != null) {
                        oMyIntimationBean = (MyIntimationBean) request.getAttribute("oMyIntimationBeanSearchObj");

                    }
        %>
        <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">My Intimation</legend>
            <form id="myintimationform" name="myintimationform" method="post" action="EnquiryServlet">


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

                <center>
                    <lable style=" font-family: Berlin Sans FB; font-weight:  normal;">Intimation For<font color="red" >*</font>:</lable>
                    <select id="checkOption" onchange="checkop()" name="checkOption">
                        <option value="">--Select--</option>
                        <option value="TP">Transaction Posting</option>
                        
                    </select>
                </center>
                <br><br>
                <div id="filterDiv" >
                    <center>
                        <table>
                            <tr>
                                <td style="text-align: right">From Date<font color="red" >*</font>:</td>
                                <td><input value="<%=blankNull(oMyIntimationBean.getFromDate())%>" type="text" id="fromDate" style="text-align:center;" name="fromDate" readonly />&nbsp;<a href="#" onclick="return getCalendar(document.forms[0].fromDate);"><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></a></td>
                                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                <td style="text-align: right">To Date<font color="red" >*</font>:</td>
                                <td><input value="<%=blankNull(oMyIntimationBean.getToDate())%>" type="text" id="toDate" style="text-align:center;" name="toDate" readonly />&nbsp;<a href="#" onclick="return getCalendar(document.forms[0].toDate);"><img src="${pageContext.request.contextPath}/img/calendar.jpg" name="imgr" border="0" width="25" height="20" /></a></td>
                            </tr>
                            <tr>
                                <td><br></td>
                            </tr>
                            <tr>
                                <td style="text-align: right">Transaction Reference Number:</td>
                                <td><input type="text" name="refno" id="refno" value="<%=blankNull(oMyIntimationBean.getRefno())%>" style="text-align:right;" onkeypress='return event.charCode >= 48 && event.charCode <= 57'/></td>
                                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                <td style="text-align: right">Transaction Type: </td>
                                <td><select id="transactiontype" name="transactiontype" >
                                        <option value="" disabled selected style="display:none;" <%if (blankNull(oMyIntimationBean.getTransactiontype()).equals("")) {%> selected <%}%>>--Select--</option>
                                        <option value="DR" <%if (blankNull(oMyIntimationBean.getTransactiontype()).equals("DR")) {%> selected <%}%>>Debit</option>
                                        <option value="CR" <%if (blankNull(oMyIntimationBean.getTransactiontype()).equals("CR")) {%> selected <%}%>>Credit</option>
                                    </select>
                                </td>
                            </tr>                            
                            
                        </table>
                        <br><br>

                        <input type="button" value="View Intimation" onclick="javascript:myintimationfunctionsubmit(myintimationform)">
                        <input type="button" value="Reset" name="reset" onclick="ShowParent();" />
                    </center>
                </div><br><br>



                <%if (displayFlag.equalsIgnoreCase("Y")) {%>
                <center>
                    <div id="displayDiv" >

                        <% if (oMyIntimationBean.getCheckOption().equalsIgnoreCase("TP")) {%>
                        <div style="width:930px;overflow: scroll;">
                            <table border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px;">
                                <thead class="CSSTableGenerator">
                                    <tr>
                                        <td>Pacs ID</td>
                                        <td>Pacs Name</td>
                                        <td>CBS Account</td>
                                        <td>Reference No.</td>
                                        <td>Account No.</td>
                                        <td>Account No2</td>
                                        <td>Account Balance</td>
                                        <td>Amount</td>
                                        <td>Transaction Date</td>
                                        <td>Authorizer ID</td>
                                        <td>Authorizer's Remarks</td>
                                        <td>Transaction Status</td>

                                    </tr>
                                </thead>
                                <tbody style="background-color: white; font-size: 15px">
                                    <%
                                         oMyIntimationBean = null;

                                         for (int i = 0; i < alMyIntimationBean.size(); i++) {
                                             oMyIntimationBean = alMyIntimationBean.get(i);
                                    %>

                                    <tr>
                                        <td><input style="border: none" size="20" type="text" readonly name="pacsID<%=i%>" id="pacsID<%=i%>" value="<%=blankNull(oMyIntimationBean.getPacsID())%>" /></td>
                                        <td><input style="border: none" size="20" type="text" readonly name="pacsName<%=i%>" id="pacsName<%=i%>" value="<%=blankNull(oMyIntimationBean.getPacsName())%>" /></td>
                                        <td><input style="border: none" size="20" type="text" readonly name="CBSAcc<%=i%>" id="CBSAcc<%=i%>" value="<%=blankNull(oMyIntimationBean.getCBSAcc())%>" /></td>                                        
                                        <td><input style="border: none" size="20" type="text" readonly name="refno<%=i%>" id="refno<%=i%>" value="<%=blankNull(oMyIntimationBean.getRefnoSearch())%>" /></td>
                                        <td><input style="border: none" size="20" type="text" readonly name="account_no<%=i%>" id="account_no<%=i%>" value="<%=blankNull(oMyIntimationBean.getAccount_no())%>" /></td>
                                        <td><input style="border: none" size="20" type="text" readonly name="account_no2<%=i%>" id="account_no2<%=i%>" value="<%=blankNull(oMyIntimationBean.getAccount_no2())%>" /></td>
                                        <td><input style="border: none" size="20" type="text" readonly name="account_bal<%=i%>" id="account_bal<%=i%>" value="<%=blankNull(oMyIntimationBean.getAccount_bal())%>" /></td>
                                        <td><input style="border: none" size="10" type="text" readonly name="amount<%=i%>" id="amount<%=i%>" value="<%=blankNull(oMyIntimationBean.getAmount())%>" /></td>
                                        <td><input style="text-align:center;" style="border: none" size="10" type="text" readonly name="tran_date<%=i%>" id="tran_date<%=i%>" value="<%=blankNull(oMyIntimationBean.getTran_date())%>" /></td>
                                        <td><input style="border: none" size="10" type="text" readonly name="auth_id<%=i%>" id="auth_id<%=i%>" value="<%=blankNull(oMyIntimationBean.getAuth_id())%>" /></td>
                                        <td><input style="border: none" size="30" type="text" readonly name="remarks<%=i%>" id="remarks<%=i%>" value="<%=blankNull(oMyIntimationBean.getRemarks())%>" /></td>
                                        <td><input style="border: none" size="30" type="text" readonly name="status<%=i%>" id="status<%=i%>" value="<%=blankNull(oMyIntimationBean.getStatus())%>" /></td>

                                    </tr>
                                    <%}%>
                                </tbody>

                            </table>
                        </div>
                        <%} else if (oMyIntimationBean.getCheckOption().equalsIgnoreCase("TTP")) {%>
                        <div style="overflow:scroll; width:930px;">
                            <table border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px;">
                                <thead class="CSSTableGenerator">
                                    <tr>
                                        <td>Reference No.</td>
                                        <td>Account No.</td>
                                        <td>Amount</td>
                                        <td>Charges</td>
                                        <td>Transaction Date</td>
                                        <td>Transaction Type</td>
                                        <td>Authorizer ID</td>
                                        <td>Authorizer's Remarks</td>
                                        <td>Transaction Status</td>

                                    </tr>
                                </thead>
                                <tbody style="background-color: white; font-size: 15px">
                                    <%
                                         oMyIntimationBean = null;

                                         for (int i = 0; i < alMyIntimationBean.size(); i++) {
                                             oMyIntimationBean = alMyIntimationBean.get(i);
                                    %>

                                    <tr>
                                        <td><input style="border: none" size="20" type="text" readonly name="refno<%=i%>" id="refno<%=i%>" value="<%=blankNull(oMyIntimationBean.getRefnoSearch())%>" /></td>
                                        <td><input style="border: none" size="20" type="text" readonly name="account_no<%=i%>" id="account_no<%=i%>" value="<%=blankNull(oMyIntimationBean.getAccount_no())%>" /></td>
                                        <td><input style="border: none" size="10" type="text" readonly name="amount<%=i%>" id="amount<%=i%>" value="<%=blankNull(oMyIntimationBean.getAmount())%>" /></td>
                                        <td><input style="border: none" size="10" type="text" readonly name="chargeToDeduct<%=i%>" id="chargeToDeduct<%=i%>" value="<%=blankNull(oMyIntimationBean.getChargeToDeduct())%>" /></td>
                                        <td><input style="text-align:center;" style="border: none" size="10" type="text" readonly name="tran_date<%=i%>" id="tran_date<%=i%>" value="<%=blankNull(oMyIntimationBean.getTran_date())%>" /></td>
                                        <td><input style="border: none" size="15" type="text" readonly name="transactiontype<%=i%>" id="transactiontype<%=i%>" value="<%=blankNull(oMyIntimationBean.getTransactiontypeSearch())%>" /></td>
                                        <td><input style="border: none" size="10" type="text" readonly name="auth_id<%=i%>" id="auth_id<%=i%>" value="<%=blankNull(oMyIntimationBean.getAuth_id())%>" /></td>
                                        <td><input style="border: none" size="30" type="text" readonly name="remarks<%=i%>" id="remarks<%=i%>" value="<%=blankNull(oMyIntimationBean.getRemarks())%>" /></td>
                                        <td><input style="border: none" size="30" type="text" readonly name="status<%=i%>" id="status<%=i%>" value="<%=blankNull(oMyIntimationBean.getStatus())%>" /></td>

                                    </tr>
                                    <%}%>
                                </tbody>

                            </table>
                        </div>
                        <%} else if (oMyIntimationBean.getCheckOption().equalsIgnoreCase("ACC")
                                 || oMyIntimationBean.getCheckOption().equalsIgnoreCase("LACC") || oMyIntimationBean.getCheckOption().equalsIgnoreCase("KCC")) {%>
                        <div style="width:930px;overflow: scroll;">
                            <table border="2" width="auto" cellspacing="1" cellpadding="1" style="text-align: center ;overflow-y: scroll; font-size: 15px;">
                                <thead class="CSSTableGenerator">
                                    <tr>
                                        <td>Reference No.</td>
                                        <td>Open A/C No.</td>
                                        <td>Transaction Date</td>
                                        <td>Transaction Type</td>
                                        <td>Authorizer ID</td>
                                        <td>Authorizer's Remarks</td>
                                        <td>Transaction Status</td>



                                    </tr>
                                </thead>
                                <tbody style="background-color: white; font-size: 15px">
                                    <%
                                         oMyIntimationBean = null;

                                         for (int i = 0; i < alMyIntimationBean.size(); i++) {
                                             oMyIntimationBean = alMyIntimationBean.get(i);
                                    %>

                                    <tr>
                                        <td><input style="border: none" size="20" type="text" readonly name="refno<%=i%>" id="refno<%=i%>" value="<%=blankNull(oMyIntimationBean.getRefnoSearch())%>" /></td>
                                        <td><input style="border: none" size="20" type="text" readonly name="account_no<%=i%>" id="account_no<%=i%>" value="<%=blankNull(oMyIntimationBean.getAccount_no())%>" /></td>
                                        <td><input style="text-align:center;" style="border: none" size="16" type="text" readonly name="tran_date<%=i%>" id="tran_date<%=i%>" value="<%=blankNull(oMyIntimationBean.getTran_date())%>" /></td>
                                        <td><input style="border: none" size="25" type="text" readonly name="transactiontype<%=i%>" id="transactiontype<%=i%>" value="<%=blankNull(oMyIntimationBean.getTransactiontypeSearch())%>" /></td>
                                        <td><input style="border: none" size="10" type="text" readonly name="auth_id<%=i%>" id="auth_id<%=i%>" value="<%=blankNull(oMyIntimationBean.getAuth_id())%>" /></td>
                                        <td><input style="border: none" size="30" type="text" readonly name="remarks<%=i%>" id="remarks<%=i%>" value="<%=blankNull(oMyIntimationBean.getRemarks())%>" /></td>
                                        <td><input style="border: none" size="25" type="text" readonly name="status<%=i%>" id="status<%=i%>" value="<%=blankNull(oMyIntimationBean.getStatus())%>" /></td>
                                    </tr>
                                    <%}%>
                                </tbody>

                            </table>
                        </div>

                        <%}%>

                        <br><br>

                    </div>
                </center>
                <%}%>

            </form>
        </fieldset>
    </body>
</html>
