<%@ Page Language="C#" MasterPageFile="~/MasterPages/Main.master" AutoEventWireup="true"
    CodeFile="EJSearch.aspx.cs" Inherits="Business_EJSearch" %>

<%@ Register Src="../UserControls/DatePicker.ascx" TagName="DatePicker" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script language="javascript" type="text/javascript">
        function validate() {
            var message = "";
            if (document.getElementById("<%=txtTerminal.ClientID%>").value == "" && document.getElementById("<%=txtCardNumber.ClientID%>").value == "") {
                message += "You have to at least enter the card number or the ATM number\n";
            }
            if (document.getElementById("<%=DatePicker1.TextBoxClientID%>").value == "") {
                message += "You have to at enter the transaction date\n";
            }
            /*if ( isNaN(document.getElementById("<%=txtCardNumber.ClientID%>").value) )
            {
            message += "Card number must contain numbers only\n";
            }*/
            /*if ( isNaN(document.getElementById("<%=txtTerminal.ClientID%>").value) )
            {
            message += "ATM number must contain numbers only\n";
            }*/

            if (message.length > 0) {
                message = "please notice the following requirments:\n\n" + message;
                alert(message);
                return false;
            }
            return true;
        }
        function ClearTextbox() {
            //      if (document.getElementById('<%=rdOnUs.ClientID %>').Checked=true) {
            document.getElementById('<%=txtAccountNo.ClientID %>').value = "";
            document.getElementById('<%=txtAccountNo.ClientID %>').disabled = true;
            //      }
            //      else {
            //          document.getElementById('<%=txtAccountNo.ClientID %>').value;
            //      }
        }
        function UnClearTextbox() {
            //      if (document.getElementById('<%=rdOnUs.ClientID %>').Checked=true) {
            document.getElementById('<%=txtAccountNo.ClientID %>').value = "";
            document.getElementById('<%=txtAccountNo.ClientID %>').disabled = false;
            //      }
            //      else {
            //          document.getElementById('<%=txtAccountNo.ClientID %>').value;
            //      }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table class="body_MainTB" border="0" cellpadding="0" cellspacing="0">
        <tr align="center">
            <td valign="top">
                <!------------------------------------body St  ---------------------------------------------->
                <table border="0" cellpadding="0" cellspacing="0" class="body_formTitle">
                    <tr>
                        <td>
                            EJ Transaction Search
                        </td>
                    </tr>
                </table>
                <br>
                <!------------------------------------body End1 ----------------------------------------------->
                <table border="0" cellpadding="0" cellspacing="0" class="contTB">
                    <tr>
                        <td align="center">
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="Frow">
                                <tr>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                <tr>
                                    <td class="tdNormal">
                                        ATM number
                                    </td>
                                    <td class="tdNormal">
                                        <asp:TextBox ID="txtTerminal" MaxLength="4" runat="server" class="fieldNormal" Width="250"></asp:TextBox>
                                        <br />
                                        <asp:Label ID="lbTermNotFoundlError" runat="server" Style="color: #FF0000"></asp:Label>
                                    </td>
                                    <td class="tdNormal">
                                    </td>
                                    <td class="tdNormal">
                                        Card Number
                                    </td>
                                    <td class="tdNormal">
                                        <asp:TextBox ID="txtCardNumber" MaxLength="19" runat="server" class="fieldNormal"
                                            Width="250"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tdNormal">
                                        From Date
                                    </td>
                                    <td>
                                        <uc1:DatePicker ID="DatePicker1" runat="server" width="250" />
                                    </td>
                                    <td class="tdNormal">
                                    </td>
                                    <td class="tdNormal">
                                        Trace ID
                                    </td>
                                    <td class="tdNormal">
                                        <asp:TextBox ID="txtTraceID" runat="server" class="fieldNormal" Width="250"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tdNormal">
                                        To Date
                                    </td>
                                    <td>
                                        <uc1:DatePicker ID="DatePicker2" runat="server" width="250" />
                                    </td>
                                    <td class="tdNormal">
                                    </td>
                                    <td class="tdNormal">
                                        Search Type
                                    </td>
                                    <td class="tdNormal">
                                        <asp:RadioButton ID="rdOnUs" runat="server" GroupName="aa" Text="On Us" Checked="True" />
                                        <asp:RadioButton ID="rdOther" runat="server" GroupName="aa" Text="Others" OnCheckedChanged="rdOther_CheckedChanged" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tdNormal">
                                        Match Status
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlMatch" runat="server" DataTextField="status" Width="350px"
                                            DataValueField="sid" class="fieldNormal">
                                        </asp:DropDownList>
                                    </td>
                                    <td class="tdNormal">
                                        &nbsp;
                                    </td>
                                    <td class="tdNormal">
                                        Account Number
                                    </td>
                                    <td class="tdNormal">
                                        <asp:TextBox ID="txtAccountNo" runat="server" class="fieldNormal" Width="250"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tdNormal">
                                        Transaction Type
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="ddlETT" runat="server" DataTextField="Ett_Desc" Width="350px"
                                            DataValueField="ID" class="fieldNormal">
                                        </asp:DropDownList>
                                    </td>
                                    <td class="tdNormal">
                                        &nbsp;
                                    </td>
                                    <td class="tdNormal">
                                        &nbsp;
                                    </td>
                                    <td class="tdNormal">
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td class="tdNormal" colspan="5">
                                        <asp:CustomValidator ID="cvAccountNo" runat="server" Display="Dynamic" ErrorMessage="Account Number is Mandatory"
                                            OnServerValidate="cvAccountNo_ServerValidate"></asp:CustomValidator>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtCardNumber"
                                            Enabled="false" Display="Dynamic" ErrorMessage="You must enter the Card Number"></asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="5" style="text-align: center">
                                        <asp:Button ID="Button1" runat="server" Text="Search" CssClass="Btn_L_Normal" OnClick="Button1_Click" />
                                        <asp:Button ID="btnClear" runat="server" Text="Clear" CssClass="Btn_L_Normal" OnClick="btnClear_Click"
                                            CausesValidation="False" />
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <asp:Panel ID="pnlResult" runat="server" Width="100%" Visible="false">
                                <fieldset id="addItem">
                                    <legend id="addItem">EJ Search Results</legend>
                                </fieldset>
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB1">
                                    <tr>
                                        <td class="tdNormal" colspan="5">
                                            <asp:GridView ID="GridView1" CssClass="gridMaster" Width="100%" runat="server" AutoGenerateColumns="False"
                                                AllowPaging="True" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None"
                                                OnRowCommand="GridView1_RowCommand" EmptyDataText="There are no results" OnRowCreated="GridView1_RowCreated">
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                <Columns>
                                                    <asp:BoundField DataField="card_no" HeaderText="Card No" />
                                                    <asp:BoundField DataField="tran_date" HeaderText="Date" />
                                                    <asp:BoundField DataField="tran_time" HeaderText="Time" />
                                                    <asp:BoundField DataField="settle_date" HeaderText="Settle Date" />
                                                    <asp:BoundField DataField="txn_cur" HeaderText="Currancy" />
                                                    <asp:BoundField DataField="amount" HeaderText="Amount" />
                                                    <asp:BoundField DataField="terminal_id" HeaderText="Terminal ID" />
                                                    <asp:BoundField DataField="record_date" HeaderText="Record Date" />
                                                    <asp:BoundField DataField="proc_flag" HeaderText="Proc Flag" />
                                                    <asp:BoundField DataField="seq_no" HeaderText="Seq No" />
                                                    <asp:BoundField DataField="tran_status" HeaderText="" />
                                                    <asp:BoundField DataField="status" HeaderText="" />
                                                    <asp:BoundField DataField="luno_id" HeaderText="" />
                                                    <asp:BoundField DataField="ACCOUNT" HeaderText="" />
                                                    <asp:BoundField DataField="disp_a" HeaderText="" />
                                                    <asp:BoundField DataField="disp_b" HeaderText="" />
                                                    <asp:BoundField DataField="disp_c" HeaderText="" />
                                                    <asp:BoundField DataField="disp_d" HeaderText="" />
                                                    <%--  18--%>
                                                    <asp:BoundField DataField="txn_date" HeaderText="" />
                                                    <asp:BoundField DataField="status_code" HeaderText="" />
                                                    <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="v" Text="View Transaction details"
                                                        ImageUrl="~/Images/document_view.jpg">
                                                        <ItemStyle Width="30px" />
                                                    </asp:ButtonField>
                                                    <asp:BoundField DataField="dispenser" HeaderText="" />
                                                </Columns>
                                                <PagerStyle BackColor="#284775" ForeColor="White" />
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="Black" />
                                                <EditRowStyle BackColor="#999999" />
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" HorizontalAlign="Right" />
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 20%">
                                            Go To Page:
                                            <asp:DropDownList ID="ddlPages" runat="server" class="fieldNormal" AutoPostBack="True"
                                                Width="50px" OnSelectedIndexChanged="ddlPages_SelectedIndexChanged">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                        <td class="tdNormal">
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                            <asp:Panel ID="pnlControls" runat="server" Width="80%">
                                <fieldset id="addItem">
                                    <legend id="addItem">EJ Item details</legend>
                                </fieldset>
                                <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB1">
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Card Number
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label1" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Sequence Number
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label2" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Transaction Status
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label3" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Transaction Date
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label4" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Transaction Time
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label5" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Settle Date
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label6" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Account
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label7" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Transaction Currency
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label8" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Amount
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label9" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Status
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label14" runat="server" Text="Label" Font-Bold="True"></asp:Label></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Terminal ID
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label11" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Record Date
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label12" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Processing flag
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label13" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                        </td>
                                    </tr>
                                    <% if (Validate_Manager.Validate_Data(lblDenom.Text.Trim(), 1))
                                       {
                                    %>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Cassette &quot;A&quot; (100)
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label10" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Cassette &quot;B&quot; (500)
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label15" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="tdNormal" style="width: 15%">
                                            Cassette &quot;C&quot; (50)
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label16" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                        <td class="tdNormal" style="width: 10%">
                                            &nbsp;
                                        </td>
                                        <td class="tdNormal" style="width: 15%">
                                            Cassette &quot;D&quot; (100)
                                        </td>
                                        <td class="tdNormal" style="width: 30%">
                                            <asp:Label ID="Label17" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                        </td>
                                    </tr>
                                    <%} %>
                    </tr>
                    <% if (Validate_Manager.Validate_Data(lblDenom.Text.Trim(), 2))
                       {
                    %>
                    <tr>
                        <td class="tdNormal" style="width: 15%">
                            Denomination
                        </td>
                        <td class="tdNormal" style="width: 30%">
                            <asp:Label ID="lblDenom" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                        </td>
                        <td class="tdNormal" style="width: 10%">
                        </td>
                        <td class="tdNormal" style="width: 15%">
                        </td>
                        <td class="tdNormal" style="width: 30%">
                        </td>
                    </tr>
                    <%} %>
                    <tr>
                        <td class="tdNormal" style="width: 15%">
                            EDC status
                        </td>
                        <td class="tdNormal" colspan="4">
                            <asp:GridView ID="GridView2" CssClass="gridMaster" Width="100%" runat="server" AutoGenerateColumns="False"
                                CellPadding="4" ForeColor="#333333" GridLines="None" EmptyDataText="There are no status messages">
                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <Columns>
                                    <asp:BoundField DataField="status" HeaderText="status" />
                                    <asp:BoundField DataField="stat_desc" HeaderText="Description" />
                                    <asp:BoundField DataField="TERM_TRACE" HeaderText="Trace" />
                                    <asp:BoundField DataField="TXN_PREV_TRACE" HeaderText="Prev. Trace" />
                                </Columns>
                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="Black" />
                                <EditRowStyle BackColor="#999999" />
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" HorizontalAlign="Right" />
                            </asp:GridView>
                        </td>
                    </tr>
                </table>
                <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgaddItem">
                    <tr>
                        <td>
                            <asp:Button ID="btnCancel" runat="server" Text="   Cancel   " class="Btn_M_Normal"
                                CausesValidation="False" OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
                </asp:Panel>
                <!------------------------------------body End2 ----------------------------------------------->
                <br />
            </td>
        </tr>
    </table>
    <!------------------------------------body End2 ----------------------------------------------->
    </td> </tr> </table>
</asp:Content>
