<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AgentPayAdd.aspx.cs" Inherits="XpShop.Manage.AgentPayAdd" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
	    <!--#include file="inc/head.inc"-->
		<title>AgencyFinanceAdd</title>		
        <link type="text/css" rel="stylesheet" href="style/ui.datepicker.css" />
		<script src="inc/ui.datepicker.cn.js" type="text/javascript"></script>
        <script type="text/javascript">
        	$(document).ready(function(){
				$("#txtDateFrom").datepicker();
				$("#txtDateTo").datepicker();
                //全选
                $('input[@name=chkAll]').click(function(){
                    $('input[@name=chkItem]').attr('checked',$(this).attr('checked'));
                });
                $('input[@name=chkItem]').click(function(){
                    var itemcount=$('input[@name=chkItem]').size();
                    var checkcount=$('input[@name=chkItem][checked]').size();
                    if(itemcount==checkcount){
                        $('input[@name=chkAll]').attr('checked',true);
                    }
                    else{
                        $('input[@name=chkAll]').attr('checked',false);
                    }
                });
                $('#btnSave').click(function(){
                    if($('input[@name=chkItem][checked]').size()<1){
                        alert('请选择要结算的推广员');
                        return false;
                    }
                });
			});
        </script>
	</head>
	<body>
	    <div class="container">
		<div class="sub_container">
		<div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img src="images/admin_title.jpg" height=9px width=8px align="absmiddle" /><asp:label id="lblTitleInfo" Runat="server" CssClass="tableHeaderText">结算提成</asp:label></div>
		<div class="sub_container_content">
		<form id="Form1" method="post" runat="server">
		    <div class="frame">
		        <div class="frame_title"><asp:Label id="lblAction" runat="server" CssClass="tableHeaderText">结算提成</asp:Label></div>
		        <div class="frame_content">
                    <% if (this.Request.QueryString["Action"] == "Add")
                       {%>
			        <table class="tableBorder" cellspacing="0" cellpadding="0" width="98%" align="center" border="0">
				        <tr>
                            <td align="Left">
                                <span>
                                    时间：从
                                    <asp:textbox id="txtDateFrom" name="txtDateFrom" runat="server" style="height:18px;line-height:18px;background-image:url(images/calendar.gif);background-repeat:no-repeat;padding-left:20px;"></asp:textbox>
									至
									<asp:textbox id="txtDateTo" name="txtDateTo" runat="server" style="height:18px;line-height:18px;background-image:url(images/calendar.gif);background-repeat:no-repeat;padding-left:20px;"></asp:textbox>
									<asp:Button ID="btnSearch" OnClick="btnSearch_Click" runat="server" Text="查看" CssClass="inputbtn"></asp:Button>
                                    <br />
                                    <% =info%>
                                </span>
                            </td>
				        </tr>
				        <tr>
					        <td height="23" class="forumRowHighlight">
						        <asp:datagrid id="dgAgentFinance" runat="server" AllowPaging="true" PagerStyle-Mode="NumericPages" PageSize="2"
						            AutoGenerateColumns="False" DataKeyField="AgentName" Width="100%" HorizontalAlign="Center" OnPageIndexChanged="dgAgentFinance_PageIndexChanged"
						            HeaderStyle-CssClass="summary-title" Visible="true">
						            <HeaderStyle Font-Bold="True"></HeaderStyle>
						            <Columns>
						            
                                         <asp:TemplateColumn HeaderText="选择">
                                            <HeaderTemplate>全选<input type="checkbox" name="chkAll" /></HeaderTemplate>
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left" Width="120px"></ItemStyle>
								            <ItemTemplate>
									            <input type="checkbox" name="chkItem" value="<%# DataBinder.Eval(Container.DataItem, "AgentID")%>" />
								            </ItemTemplate>
							            </asp:TemplateColumn>						            
                                         <asp:TemplateColumn HeaderText="代理员账号">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left" Width="120px"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "AgentName")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="会员帐号">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left" Width="120px"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "Name")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="该期结算提成">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left"></ItemStyle>
								            <ItemTemplate>
								                <%# DataBinder.Eval(Container.DataItem, "finance")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="所属级别">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left"></ItemStyle>
								            <ItemTemplate>
								                <%# DataBinder.Eval(Container.DataItem, "levelname")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
						            </Columns>
						            <PagerStyle Mode="NumericPages"></PagerStyle>
					            </asp:datagrid>
					        </td>
				        </tr>
				        <tr>
                            <td align="center">
                                <br />
                                <asp:Button ID="btnSave" OnClick="btnSave_Click" runat="server" Text="确认结算" Visible="false" CssClass="inputbtn"></asp:Button>
                            </td>
                        </tr>
			        </table>
			        <%} else if(this.Request.QueryString["Action"] == "View") {%>
			        <table class="tableBorder" cellspacing="0" cellpadding="0" width="98%" align="center" border="0">
				        <tr>
                            <td align="Left">
                                <span>
                                    选择期号：
                                    <asp:DropDownList ID="ddlIssue" runat="server"></asp:DropDownList>
                                    推广员名称：
                                    <asp:TextBox ID="txtAgentName" runat="server"></asp:TextBox>
									<asp:Button ID="Button1" OnClick="btnView_Click" runat="server" Text="查询" CssClass="inputbtn"></asp:Button>
                                    <br />
                                    <% =info%>
                                </span>
                            </td>
				        </tr>
				        <tr>
					        <td height="23" class="forumRowHighlight">
						        <asp:datagrid id="dgAgentPay" runat="server" AllowPaging="True" PagerStyle-Mode="NumericPages" PageSize="20" OnPageIndexChanged="dgAgentPay_PageIndexChanged"
						            AutoGenerateColumns="False" DataKeyField="AgentPayID" Width="100%" HorizontalAlign="Center" 
						            HeaderStyle-CssClass="summary-title" Visible="true">
						            <HeaderStyle Font-Bold="True"></HeaderStyle>
						            <Columns>
                                         <asp:TemplateColumn HeaderText="期数">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left" Width="120px"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "Issue")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="推广员名称">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left" Width="120px"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "AgentName")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="会员名称">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left" Width="120px"></ItemStyle>
								            <ItemTemplate>
									            <%# DataBinder.Eval(Container.DataItem, "Name")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="结算金额">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left"></ItemStyle>
								            <ItemTemplate>
								                <%# DataBinder.Eval(Container.DataItem, "finance")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
							            <asp:TemplateColumn HeaderText="结算时间">
								            <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
								            <ItemStyle HorizontalAlign="Left"></ItemStyle>
								            <ItemTemplate>
								                <%# DataBinder.Eval(Container.DataItem, "PayTime")%>
								            </ItemTemplate>
							            </asp:TemplateColumn>
						            </Columns>
						            <PagerStyle Mode="NumericPages"></PagerStyle>
					            </asp:datagrid>
					        </td>
				        </tr>
			        </table>
			        <%} %>
		        </div>
	        </div>
		</form>
		</div>
		</div>
		</div>
	</body>
</html>
