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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <%--<script src="../js/validation.js" language ="javascript" type ="text/javascript" ></script>--%>
<link href ="../css/tab.css" rel ="Stylesheet" type ="text/css" />
<script language="javascript" type="text/javascript">

//    function disableButton() {

//        //
//        document.getElementById('<%= btnSave.ClientID %>').submit();
//        document.getElementById('<%= btnSave.ClientID %>').disabled = true;

//        return false;
//        }

//    function disableButton(sender) {
//        sender.disabled = "disabled";
//        _doPostBack(sender.name, '');
//    }

    function KeyPressFuncNotSpecialCharecter() {
        if ((event.keyCode >= 47 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 97 && event.keyCode <= 122)) {
            event.returnValue = true;
        }
        else {
            event.returnValue = false;
        }
    }
    function validate()
    {
        var message = "";
        var e = document.getElementById("<%=DropDownList3.ClientID %>");
        var strUser = e.options[e.selectedIndex].value;
        if (strUser == 2) {
            if (document.getElementById("<%=TextBox1.ClientID%>").value == "") {
                message += "Overage Account Feild can not be blank\n";
                document.getElementById("<%=TextBox1.ClientID%>").style.backgroundColor = "#c8d1e4";
            }
            if (document.getElementById("<%=TextBox2.ClientID%>").value == "") {
                message += "Shortage Account Feild can not be blank\n";
                document.getElementById("<%=TextBox2.ClientID%>").style.backgroundColor = "#c8d1e4";
            }
            if (document.getElementById("<%=TextBox3.ClientID%>").value == "") {
                message += "Cash Account Feild can not be blank\n";
                document.getElementById("<%=TextBox3.ClientID%>").style.backgroundColor = "#c8d1e4";
            }
        }
        else if (strUser == 1) {
            if (document.getElementById("<%=TextBox4.ClientID%>").value == "") {
                message += "Overage Account Feild can not be blank\n";
                document.getElementById("<%=TextBox4.ClientID%>").style.backgroundColor = "#c8d1e4";
            }
            if (document.getElementById("<%=TextBox5.ClientID%>").value == "") {
                message += "Shortage Account Feild can not be blank\n";
                document.getElementById("<%=TextBox5.ClientID%>").style.backgroundColor = "#c8d1e4";
            }
            if (document.getElementById("<%=TextBox6.ClientID%>").value == "") {
                message += "Cash Account Feild can not be blank\n";
                document.getElementById("<%=TextBox6.ClientID%>").style.backgroundColor = "#c8d1e4";
            }
        }

        
            
        if(message.length >0)
        {
            message = "please notice the following requirments:\n\n" + message;
            alert(message);
            return false;
        }
          return true;
      }

//      function KeyPressNotSpecialCharecter() 
//      {
////          if ((event.keyCode >= 47 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 97 && event.keyCode <= 122)) {
////              event.returnValue = true;
//          //          }

//          if (event.keyCode < 45 || event.keyCode > 57) {
//              event.returnValue = false;
//          }
//          
//      }

</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
                   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                     <ContentTemplate>
<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>
                                        ATM Information</td>
                                </tr>
                                <tr>
                                    <td>
                                   
                                      </td>
                                </tr>
                            </table>
                            <br />
                            <table border="0" cellpadding="0" cellspacing="0" class="body_formTitle">
                                <tr>
                                    <td>
                                        </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 />
                                        
                                    <asp:Panel ID="pnl_filters" runat="server" Width="100%">
                                     <asp:UpdateProgress ID="UpdateProgress1" runat="server" 
                                                        AssociatedUpdatePanelID="UpdatePanel1">
                                                        <ProgressTemplate>
                                                       
                                                            <img alt="Loading" src="../Images/ajax-loader.gif" />
                                                           
                                                        </ProgressTemplate>
                                                    </asp:UpdateProgress>
                                        <table border="0" width=100% cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <tr>
                                                    <td class="tdNormal">
                                                        Branch
                                                    </td>
                                                    <td colspan=4>
                                                        <asp:DropDownList ID="ddlChannels" runat="server" DataTextField="branch_name" 
                                                            Width="250px" DataValueField="branch_code" class="fieldNormal">
                                                        </asp:DropDownList>
                                                 </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal">
                                                        Terminal
                                                    </td>
                                                    <td colspan=4>
                                                        <asp:TextBox ID="txtATMnumber" runat="server" class="fieldNormal" Width=250 
                                                            MaxLength="4"></asp:TextBox>
                                                 </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal">
                                                        ATM Type
                                                    </td>
                                                    <td colspan=4>
                                                    <asp:DropDownList ID="ddlType" runat="server" DataTextField="type_name" 
                                                            Width=250px DataValueField="type_code" class="fieldNormal">
                                                    </asp:DropDownList>
                                                 </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" />
                                                    </td>
                                                </tr>
                                            </table>

                                    </asp:Panel>
                                            <br />
                                            <asp:Label ID="lblError" runat="server" Text="" class="fieldError"></asp:Label>
                                        
                                        
                                        <asp:Panel ID="pnl_confirmation" runat="server" Width="100%">
                                            <table border="0" width="100%" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <tr>
                                                    <td colspan="2" class="tdNormal" align="center">
                                                       <asp:Label runat="server" Text="Are you sure you want to delete this ATM ?"></asp:Label>                                                       
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal">
                                                       <asp:Button ID="btn_conf_ok" runat="server" Text="OK" CssClass="Btn_L_Normal" 
                                                            onclick="btn_conf_ok_Click"/>
                                                    </td>

                                                    <td class="tdNormal">
                                                       <asp:Button ID="btn_conf_cancel" runat="server" Text="Cancel" 
                                                            CssClass="Btn_L_Normal" onclick="btn_conf_cancel_Click"/>
                                                    </td>
                                                        
                                                </tr>
                                            </table>
                                        </asp:Panel>
                                        
                                        
                                        <asp:Panel ID="pnlResult" runat="server" Width="100%" Visible="false">
                                            <fieldset id="addItem">
                                             <legend id="addItem">ATM Search Results</legend>
                                            </fieldset>
                                            <table border="0" width=100% cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <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" EmptyDataText="There are no Results" 
                                                            DataKeyNames="atm_number" onrowcommand="GridView1_RowCommand" 
                                                            onrowcreated="GridView1_RowCreated" 
                                                            onrowdatabound="GridView1_RowDataBound">
                                                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Right" />
                                                            <Columns>
                                                                <asp:BoundField DataField="branch_code" HeaderText="Branch code" />
                                                                <asp:BoundField DataField="atm_number" HeaderText="ATM Number" />
                                                                <asp:BoundField DataField="term_id" HeaderText="Terminal ID" />
                                                                <asp:BoundField DataField="type_code" HeaderText="" />
                                                                <asp:BoundField DataField="atm_type" HeaderText="Type" />
                                                                <asp:BoundField DataField="overage_acct_number" HeaderText="overage_acct_number" />
                                                                <asp:BoundField DataField="shortage_acct_number" HeaderText="shortage_acct_number" />
                                                                <asp:BoundField DataField="cash_acct_number" HeaderText="cash_acct_number" />
                                                                <asp:BoundField DataField="overage_dep_acct_number" HeaderText="cash_acct_number" />
                                                                <asp:BoundField DataField="shortage_dep_acct_number" HeaderText="cash_acct_number" />
                                                                <asp:BoundField DataField="cash_dep_acct_number" HeaderText="cash_acct_number" />
                                                                <asp:BoundField DataField="modified_by" HeaderText="" />
                                                                <asp:BoundField DataField="modify_date" HeaderText="" />
                                                                <asp:BoundField DataField="ATM_GROUP" HeaderText="Group"/>
                                                                <asp:BoundField DataField="app_status" HeaderText="app_status"/>
                                                                <asp:BoundField DataField="status" HeaderText="Status"/>
                                                             
                                                                 <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="vm" Text="View Modification" ImageUrl="~/Images/view.jpg" />
                                                                <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="vd" Text="View Current Details" ImageUrl="~/Images/document_view.jpg" />
                                                                
                                                                <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="e" 
                                                                    Text="Edit" ImageUrl="~/Images/edit.jpg" >
                                                                </asp:ButtonField>
                                                                <asp:ButtonField ButtonType="Image" ItemStyle-Width="30px" CommandName="d" 
                                                                    Text="Delete" ImageUrl="~/Images/delete.jpg" >
                                                                </asp:ButtonField>
                                                                  <%-- <asp:BoundField DataField="atm_status" HeaderText="Status"/>--%>
                                                            </Columns>
                                                        </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>
                                            <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgForm">
                                                <tr>
                                                    <td>
                                                        <asp:Button ID="btnAdd" runat="server" Text="     Add     " 
                                                            class="Btn_M_Normal" onclick="btnAdd_Click"/>
                                                    </td> 
                                                </tr>
                                            </table>
                                        </asp:Panel>    
                                        <asp:Panel ID="pnlControls" runat="server" Width="100%" Visible="false" 
                                            style="text-align: left">
                                            <fieldset id="addItem">
                                                <legend id="addItem">ATM Details</legend>
                                            </fieldset>
                                            
                                            <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                <tr>
                                                    <td class="tdNormal" style="width:15%">
                                                        Branch 
                                                    </td>
                                                    <td class="tdNormal" colspan="2">
                                                        <asp:DropDownList ID="DropDownList1" runat="server" class="fieldNormal"
                                                        DataTextField="branch_name" DataValueField="branch_code"></asp:DropDownList>
                                                    </td>
                                                    <td class="tdNormal" style="width:15%">
                                                        <asp:Label ID="lblStatus" Text ="Status" runat ="server" Visible ="false" ></asp:Label>
                                                        </td>
                                                    <td class="tdNormal" style="width:15%">
                                                        <asp:Textbox ID ="txtStatus" runat ="server" MaxLength="20" class="fieldNormal" Visible ="false" ></asp:Textbox>
                                                    </td>
                                                </tr>
                                                <tr >
                                                    <td class="tdNormal" style="width:15%">
                                                        Terminal ID
                                                    </td>
                                                    <td class="tdNormal" colspan="2">
                                                        <asp:TextBox ID="txtTerminalID" runat="server" class="fieldNormal" 
                                                            MaxLength="16"></asp:TextBox>
                                                        </td>
                                                    <td class="tdNormal" style="width:15%;visibility :hidden "">
                                                        Active</td>
                                                    <td class="tdNormal" style="width:30%;visibility :hidden "">
                                                        <asp:CheckBox ID="chkStatus" runat="server" class="fieldNormal" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal" style="width:15%">
                                                        ATM Type
                                                    </td>
                                                    <td class="tdNormal" colspan="2">
                                                        <asp:DropDownList ID="DropDownList3" runat="server" class="fieldNormal" 
                                                            DataTextField="type_name" DataValueField="type_code">
                                                        </asp:DropDownList></td>
                                                    <td class="tdNormal" style="width:15%">
                                                        </td>
                                                    <td class="tdNormal" style="width:30%">
                                                        </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdNormal" style="width:15%">
                                                        ATM Group</td>
                                                    <td class="tdNormal" colspan="2">
                                                        <asp:DropDownList ID="ddlATMGroup" runat="server" class="fieldNormal" 
                                                            DataTextField="GROUP_NAME" DataValueField="GID">
                                                        </asp:DropDownList>
                                                    </td>
                                                    <td class="tdNormal" style="width:15%">
                                                        &nbsp;</td>
                                                    <td class="tdNormal" style="width:30%">
                                                        &nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <td colspan="5">
                                                        <fieldset id="addItem">
                                                            <legend id="addItem">Withdrowal Accounts</legend>
                                                        </fieldset>
                                                        <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                            <tr>
                                                                <td class="tdNormal" style="width:30%">
                                                                    Surplus Account 
                                                                </td>
                                                                <td class="tdNormal" style="width:5%">
                                                                    
                                                                </td>
                                                                <td class="tdNormal" style="width:30%">
                                                                    Shortage Account
                                                                </td>
                                                                <td class="tdNormal" style="width:5%">
                                                                </td>
                                                                <td class="tdNormal" style="width:30%">
                                                                    Cash Account</td>
                                                            </tr>
                                                            <tr>
                                                                <td class="tdNormal">
                                                                    <asp:TextBox ID="TextBox1" runat="server" class="fieldNormal" Width="192px" MaxLength="20"></asp:TextBox>
                                                                </td>
                                                                <td class="tdNormal">
                                                                    
                                                                </td>
                                                                <td class="tdNormal">
                                                                    <asp:TextBox ID="TextBox2" runat="server" class="fieldNormal" Width="190px" MaxLength="20"></asp:TextBox>
                                                                </td>
                                                                <td class="tdNormal">
                                                                </td>
                                                                <td class="tdNormal">
                                                                    <asp:TextBox ID="TextBox3" runat="server" class="fieldNormal" Width="176px" MaxLength="20"></asp:TextBox>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="5">
                                                        <fieldset id="addItem">
                                                            <legend id="addItem">Deposit Accounts</legend>
                                                        </fieldset>
                                                        <table border="0" cellpadding="0" cellspacing="0" class="add_ItemTB">
                                                            <tr>
                                                                <td class="tdNormal" style="width:30%">
                                                                    Surplus Account 
                                                                </td>
                                                                <td class="tdNormal" style="width:5%">
                                                                    
                                                                </td>
                                                                <td class="tdNormal" style="width:30%">
                                                                    Shortage Account
                                                                </td>
                                                                <td class="tdNormal" style="width:5%">
                                                                </td>
                                                                <td class="tdNormal" style="width:30%">
                                                                    Cash Account</td>
                                                            </tr>
                                                            <tr>
                                                                <td class="tdNormal">
                                                                    <asp:TextBox ID="TextBox4" runat="server" class="fieldNormal" Width="187px" MaxLength="20"></asp:TextBox>
                                                                </td>
                                                                <td class="tdNormal">
                                                                    
                                                                </td>
                                                                <td class="tdNormal">
                                                                    <asp:TextBox ID="TextBox5" runat="server" class="fieldNormal" Width="185px" MaxLength="20"></asp:TextBox>
                                                                </td>
                                                                <td class="tdNormal">
                                                                </td>
                                                                <td class="tdNormal">
                                                                    <asp:TextBox ID="TextBox6" runat="server" class="fieldNormal" Width="179px" MaxLength="20"></asp:TextBox>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr> 
                                                <tr>
                                                    <td class="tdNormal" style="width:15%">
                                                        Modified By
                                                    </td>
                                                    <td class="tdNormal" style="width:30%">
                                                        <asp:Label ID="lblUser" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                                        </td>
                                                    <td class="tdNormal" style="width:10%">
                                                         <asp:Label ID="lblUserID" runat="server" Text="Label" Font-Bold="True" Visible ="false" ></asp:Label>
                                                        </td>
                                                    <td class="tdNormal" style="width:15%">
                                                    Modify dDate
                                                        &nbsp;</td>
                                                    <td class="tdNormal" style="width:30%">
                                                    <asp:Label ID="lblDate" runat="server" Text="Label" Font-Bold="True"></asp:Label>
                                                        &nbsp;</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" />
                                                            <asp:Button ID="btnSave" runat="server" Text="   Save   "                                                  
                                                                class="Btn_M_Normal" onclick="btnSave_Click" OnClientClick="return validate()"  />
                                                             
                                                        </td>
                                                    </tr>
                                                </table>
                                           
                                        </asp:Panel>                                    
                                        <!------------------------------------body End2 ----------------------------------------------->
                                        <br/>
                                        <%--<asp:Panel ID="pnlGrid" runat="server" Width="100%" Visible ="false" >
                                            
                               
                                               <asp:GridView ID="GridView2" CssClass="gridMaster" Width ="100%" runat="server" AutoGenerateColumns="False"
                                                                OnRowCommand="GridView1_RowCommand" AllowSorting="True" CellPadding="4" 
                                                                ForeColor="#333333" GridLines="None" OnRowCreated="GridView2_RowCreated"
                                                                DataKeyNames="mkt_code" AllowPaging ="True">
                                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                                                <Columns>
                                                                                                                        
                                                                    <asp:BoundField DataField="chg_id" HeaderText="Change Id" />                                      
                                                                    <asp:BoundField DataField="column_name" HeaderText="Column Name"  />
                                                                    <asp:BoundField DataField="old_value" HeaderText="Old Value"  />
                                                                    <asp:BoundField DataField="new_value" HeaderText="New Value"  />
                                                                    <asp:BoundField DataField="changed_rec_id" HeaderText="RRN"  />
                                                                    <asp:BoundField DataField ="chg_type_code" HeaderText ="chg_type_code" />
                                                                    <asp:BoundField DataField="chg_type" HeaderText="Request Type"  />
                                                                        
                                                                </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" />
                                                            </asp:GridView>
                                                 <table border="0" cellpadding="0" cellspacing="0" class="action_TB_BgForm">
                                                <tr>
                                                    <td>
                                                        <asp:Button ID="btnClose" runat="server" Text="     Close     " 
                                                            class="Btn_M_Normal" onclick="btnClose_Click"/>
                                                </tr>
                                            </table>
                              
                                         </asp:Panel>--%>
                                    </td>
                                </tr>
                            </table>
                            <!------------------------------------body End2 ----------------------------------------------->
                        </td>
                    </tr>
                </table>
                </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

