<%@ Page Language="C#" EnableEventValidation="false" MasterPageFile="~/CITAD.Master"
    AutoEventWireup="true" Codebehind="frmFundReturnCreate_List.aspx.cs" Inherits="CITAD.Modules.TaoLenhHoanChuyen.Web.frmFundReturnCreate_List"
    Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="../../Controls/MessageBox.ascx" TagName="MessageBox" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script language="javascript" type="text/javascript">
		//window.document.onkeydown=KeyDown;
		function pageUnload()
        {
           
            Sys.Net.WebRequestManager.remove_completedRequest(onComplete);
        }
		function row_ondblclick(row)	    
	    {
	        location.href="frmFundReturnCreate.aspx?strId=" + row.msg_key;
	    }
        function fcnShowR_CI_List(txtci_id)
        {
            var strFeatureMDlg = "dialogHeight:400px;center:yes;dialogWidth:610px;resizable:yes;status:no;scroll:no;";
            if (event.keyCode==115) //F4
            {
                if(!document.getElementById(txtci_id).readOnly)
                {
                    rValue = window.showModalDialog('../DanhSachNganHang/frmCIList.aspx' + '?randomNumber=' + Math.random(),"",strFeatureMDlg);
                    if(rValue!=undefined) 
                    {
                        document.getElementById(txtci_id).value = rValue;
                        __doPostBack(txtci_id,'');
                    }
                }
                event.keyCode=9;
            }
        }
//			function CheckAll(chkBox)
//			{
//				if (chkBox.checked)
//				{
//					for (var i = 0; i < chkBox.form.length; ++i) 
//					{
//						var elem = chkBox.form.elements[i];
//						if (elem.type == 'checkbox')
//						{
//							if (elem.id.indexOf('chk') != -1)
//							{
//									if(!elem.checked)
//									elem.checked = true;
//							}
//						}
//					}		
//				}
//				else
//				{
//					for (var i = 0; i < chkBox.form.length; ++i) 
//					{
//						var elem = chkBox.form.elements[i];
//						if (elem.type == 'checkbox')
//						{
//							if (elem.id.indexOf('chk') != -1)
//							{
//								if(elem.checked)
//								elem.checked = false;
//							}
//						}
//					}						
//				}				
//			}
			
    </script>

    <script language="javascript" type="text/javascript">
        window.document.onkeyup=ShortcutKeys;
        function ShortcutKeys()
        {
            if(event.ctrlKey)
            {
                if(window.event.keyCode==69)
                {
                    __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuClose');
                }
                if(window.event.keyCode==49)
                {
                    __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuAdd');
                }
                if(window.event.keyCode==50)
                {
                    __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuOpen');
                }
                if(window.event.keyCode==52)
                {
                    __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuIquiry');
                }
            }
            if(event.keyCode == 13)
            {    
                var tablet = document.getElementById('eventSRC');                
                if(tablet.contains(event.srcElement)){
                    __doPostBack('ctl00$ContentPlaceHolder1$Menu1','mnuIquiry');                    
                }                
            }    
 
        }
        function formload()
	    {
	        document.getElementById('<%=txtRelation_No.ClientID %>').focus();
	    }
        window.document.onload = formload;
    </script>

    <ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="True"
        EnableScriptLocalization="True" ID="ScriptManager1" CombineScripts="True" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div>
                <table class="citad-toolbar" cellpadding="0" cellspacing="0" width="770px">
                    <tr>
                        <td class="citad-toolbar-tdleft">
                        </td>
                        <td class="citad-toolbar-tdmain">
                            <asp:Menu ID="Menu1" runat="server" OnMenuItemClick="Menu1_MenuItemClick" Font-Names="Verdana"
                                Font-Size="11px" Orientation="Horizontal" CssClass="citad-menu" StaticSubMenuIndent="10px"
                                meta:resourcekey="Menu1Resource1" StaticHoverStyle-CssClass="citad-menu-hover"
                                StaticMenuStyle-CssClass="citad-menu" StaticSelectedStyle-CssClass="citad-menu-selected"
                                StaticMenuItemStyle-HorizontalPadding="5px" StaticMenuItemStyle-VerticalPadding="2px">
                                <Items>
                                    <asp:MenuItem Text="Tho&#225;t" NavigateUrl="~/Default.aspx" Value="mnuClose" meta:resourcekey="MenuItemResource1"
                                        ImageUrl="~/Images/Menu/home.gif" SeparatorImageUrl="~/Images/toolbar/citad-toolbar-sperator.gif"
                                        ToolTip="Ctrl + E"></asp:MenuItem>
                                    <asp:MenuItem Text="Th&#234;m mới" Value="mnuAdd" meta:resourcekey="MenuItemResource2"
                                        ImageUrl="~/Images/Menu/add.gif" SeparatorImageUrl="~/Images/toolbar/citad-toolbar-sperator.gif"
                                        ToolTip="Ctrl + 1"></asp:MenuItem>
                                    <asp:MenuItem Text="Chọn mở" Value="mnuOpen" meta:resourcekey="MenuItemResource3"
                                        ImageUrl="~/Images/Menu/open.gif" SeparatorImageUrl="~/Images/toolbar/citad-toolbar-sperator.gif"
                                        ToolTip="Ctrl + 2"></asp:MenuItem>
                                    <asp:MenuItem Text="Truy vấn" Value="mnuIquiry" meta:resourcekey="MenuItemResource4"
                                        ImageUrl="~/Images/Menu/search.gif" ToolTip="Ctrl + 4"></asp:MenuItem>
                                </Items>
                                <StaticMenuStyle CssClass="citad-menu" />
                                <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
                                <StaticSelectedStyle CssClass="citad-menu-selected" />
                                <StaticHoverStyle CssClass="citad-menu-hover" />
                            </asp:Menu>
                        </td>
                    </tr>
                </table>
            </div>
            <table border="0" width="770px" cellpadding="0" cellspacing="0">
                <tr>
                    <td colspan="3" valign="top">
                        <fieldset>
                            <legend>
                                <asp:Label ID="grbTrxType" runat="server" meta:resourcekey="grbTrxTypeResource1">Thông tin truy vấn</asp:Label></legend>
                            <table border="0" cellspacing="1px" cellpadding="0" id="eventSRC">
                                <tr>
                                    <td style="width: 120px; height: 17px; text-align: right;">
                                        <asp:Label ID="lblRelation_No" runat="server" Width="85px" meta:resourcekey="lblRelation_NoResource1"
                                            Text="Số bút toán"></asp:Label></td>
                                    <td style="width: 190px; height: 17px;">
                                        &nbsp;<asp:TextBox ID="txtRelation_No" runat="server" CssClass="citad-txt" meta:resourcekey="txtSerial_NoResource1"
                                            onpropertychange="Upper()" Width="113px"></asp:TextBox></td>
                                    <td style="width: 97px; height: 17px; text-align: right;">
                                        <asp:Label ID="lblReceivingBank" runat="server" Text="Ngân hàng nhận" Width="98px"
                                            meta:resourcekey="lblReceivingBankResource1"></asp:Label></td>
                                    <td colspan="1" style="width: 113px; height: 17px;">
                                        &nbsp;<asp:TextBox ID="txtReceivingBank" runat="server" CssClass="citad-txt" meta:resourcekey="txtReceivingBankResource1"
                                            Width="96px"></asp:TextBox></td>
                                    <td colspan="1" style="width: 106px; height: 17px;" align="right">
                                        <asp:CheckBox ID="chTRX_Date" runat="server" Text="Ngày tạo" meta:resourcekey="chTRX_DateResource1"
                                            AutoPostBack="True" OnCheckedChanged="chTRX_Date_CheckedChanged" Width="115px" /></td>
                                    <td colspan="3" style="width: 126px; height: 17px">
                                        &nbsp;<asp:TextBox ID="txtTRX_Date" runat="server" CssClass="citad-txt" meta:resourcekey="TextBox1Resource1"
                                            Width="70px"></asp:TextBox>
                                        <asp:ImageButton ID="imgCalendar" runat="server" ImageUrl="~/Images/Calendar.png"
                                            meta:resourcekey="imgCalendarResource1" /></td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="height: 1px">
                                        <fieldset>
                                            <legend>
                                                <asp:Label ID="Label1" runat="server" meta:resourcekey="Label1Resource1">Loại giao dịch</asp:Label></legend>
                                            <asp:RadioButton ID="rdbLV" runat="server" GroupName="TrxType" Text="Giá trị thấp"
                                                CssClass="citad-RadioButton" meta:resourcekey="rdbLVResource1"/>
                                            <asp:RadioButton ID="rdbHV" runat="server" GroupName="TrxType" Text="Giá trị cao"
                                                CssClass="citad-RadioButton" meta:resourcekey="rdbHVResource1" />
                                            <asp:RadioButton ID="rdbAll" runat="server" Checked="True" GroupName="TrxType" Text="Tất cả"
                                                CssClass="citad-RadioButton" meta:resourcekey="rdbAllResource1" />
                                        </fieldset>
                                    </td>
                                    <td valign="middle" style="height: 1px; text-align: right;">
                                        <asp:Label ID="lblTrxStatus" runat="server" meta:resourcekey="lblTrxStatusResource1">Tình trạng</asp:Label></td>
                                    <td colspan="2" valign="middle" style="height: 1px">
                                        &nbsp;<asp:DropDownList CssClass="Combobox" ID="cboTrx_Status" runat="server" Width="99%"
                                            meta:resourcekey="cboTrx_StatusResource1">
                                        </asp:DropDownList></td>
                                    <td style="height: 1px">
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" style="height: 1px">
                                    </td>
                                    <td style="height: 1px; text-align: right" valign="middle">
                                    </td>
                                    <td colspan="2" style="height: 1px" valign="middle">
                                    </td>
                                    <td style="height: 1px" align="right">
                                        <asp:Label ID="lblTongSo" runat="server" Text="Tổng số: " meta:resourcekey="lblTongSo"
                                            Font-Bold="True"></asp:Label>
                                        <asp:Label ID="lblCount" runat="server" Font-Bold="True"></asp:Label></td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                </tr>
            </table>
            <div>
                <asp:GridView ID="grvListTrx" CellPadding="2" 
                    CssClass="grid" runat="server" 
                    AutoGenerateColumns="false"
                    DataKeyNames="MSG_KEY" 
                    AllowPaging="True" 
                    Style="width: 770px;" 
                    OnPageIndexChanging="grvListTrx_PageIndexChanging"
                    OnRowDataBound="grvListTrx_RowDataBound" 
                    meta:resourcekey="grvListTrxResource1"
                    OnSelectedIndexChanged="grvListTrx_SelectedIndexChanged" 
                    AllowSorting="True" 
                    OnSorting="grvListTrx_Sorting">
                    <FooterStyle CssClass="grid-footer" />
                    <RowStyle CssClass="grid-row" />
                    <SelectedRowStyle CssClass="grid-selectedRow" />
                    <PagerStyle HorizontalAlign="Center" CssClass="grid-pager" />
                    <HeaderStyle CssClass="grid-header" />
                    <AlternatingRowStyle CssClass="grid-alternating" />
                    <Columns>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource1">
                            <HeaderTemplate>
                                <asp:CheckBox ID="chkCheckAll" runat="server" onclick="return CheckAll(this,'chkOne');"
                                    meta:resourcekey="chkCheckAllResource1" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <input id="chkOne" type="CheckBox" runat="server"/>
                            </ItemTemplate>
                            <ItemStyle Width="15px" HorizontalAlign="Center" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource2">
                            <HeaderTemplate>
                                <asp:Label ID="lblNo" Text="STT" runat="server" meta:resourcekey="lblNoResource1"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("No") %>
                            </ItemTemplate>
                            <ItemStyle Width="25px" HorizontalAlign="Center" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource3">
                            <HeaderTemplate>                                
                                <asp:LinkButton runat="server" ID="lblRelation_No" Text="Số hiệu bút toán" CommandName="Sort" CommandArgument="RELATION_NO" meta:resourcekey="lblRelation_NoResource1" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("RELATION_NO") %>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource4">
                            <HeaderTemplate>                                
                                <asp:LinkButton runat="server" ID="lblSerial_No" Text="Số giao dịch" CommandName="Sort" CommandArgument="FR.SERIAL_NO" meta:resourcekey="lblSerial_NoResource2" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:LinkButton ID="lbtSERIAL_NO" runat="server" CommandName="Select" Text='<%# Bind("SERIAL_NO") %>'></asp:LinkButton>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource5">
                            <HeaderTemplate>
                                <asp:Label ID="lblTrx_type" Text="Loại giao dịch" runat="server" meta:resourcekey="lblTrx_typeResource1"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("LOAIGIAODICH") %>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource5">
                            <HeaderTemplate>
                                <asp:Label ID="lblNoCo" Text="Nợ/Có" runat="server" meta:resourcekey="lblNoCoResource1"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("NOCO") %>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField
                            meta:resourcekey="TemplateFieldResource7">
                            <HeaderTemplate>                                
                                <asp:LinkButton runat="server" ID="lblTrx_Amount" Text="Số tiền" CommandName="Sort" CommandArgument="AMOUNT_ORG" meta:resourcekey="lblTrx_AmountResource1" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("AMOUNT_ORG") %>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Right" CssClass="HtmlEncode:False; DataFormatString:{0:c}; " />
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource8">
                            <HeaderTemplate>
                                <asp:Label ID="lblTrx_Status" Text="T&#236;nh trạng" runat="server" meta:resourcekey="lblTrx_StatusResource1"></asp:Label>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("TINHTRANG") %>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField meta:resourcekey="TemplateFieldResource9">
                            <HeaderTemplate>                                
                                <asp:LinkButton runat="server" ID="lblR_CI_CODE" Text="Ng&#226;n h&#224;ng nhận" CommandName="Sort" CommandArgument="R_CI_CODE" meta:resourcekey="lblR_CI_CODEResource1" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <%# Eval("R_CI_CODE") %>
                            </ItemTemplate>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <asp:Label ID="lblGrvMsg" runat="server" meta:resourcekey="lblGrvMsgResource1" Text="Không có bản ghi nào"></asp:Label>
                    </EmptyDataTemplate>
                </asp:GridView>
                <uc1:MessageBox ID="MessageBox1" runat="server" />
            </div>
            <cc1:MaskedEditValidator ID="MaskedEditValidator1" ControlExtender="MaskedEditExtender1"
                runat="server" ControlToValidate="txtTRX_Date" EmptyValueMessage="Date is required"
                InvalidValueMessage="Date is invalid" Display="Dynamic" EmptyValueBlurredText="*"
                InvalidValueBlurredMessage="*" ValidationGroup="MKE" ErrorMessage="MaskedEditValidator1"
                meta:resourcekey="MaskedEditValidator1Resource1" />
            <cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtTRX_Date"
                Mask="99/99/9999" MaskType="Date" AcceptNegative="Left" ErrorTooltipEnabled="True"
                CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" CultureDateFormat=""
                CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder=""
                CultureTimePlaceholder="" Enabled="True" />
            <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtTRX_Date"
                Format="dd/MM/yyyy" Enabled="True" PopupButtonID="imgCalendar">
            </cc1:CalendarExtender>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Menu1" EventName="MenuItemClick" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
