<%@ Page language="c#" Codebehind="MyAgent.aspx.cs" AutoEventWireup="false" Inherits="XpShop.WebUI.MyAgent" %>
<%@ Register TagPrefix="uc1" TagName="MemberMenu" Src="Modules/MemberMenu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="NavBar" Src="Modules/NavBar.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Link" Src="Modules/Link.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Helper" Src="Modules/Helper.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="Modules/Footer.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Bulletin" Src="Modules/Bulletin.ascx" %>
<!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/encoding.inc"-->
		<title><%=GetResourceString("MyAgent")%> －－ <%=config.SiteTitle%></title>
		<!--#include file="../../inc/head.inc"-->		
		<script type="text/javascript" src="inc/calendar.js"></script>
	</HEAD>
	<body>
            <div id="container">
                <uc1:Header id="Header1" runat="server"></uc1:Header>
                <!--位置导航开始-->
                <div class="path">
                    <a href="/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%><%if(config.html==""){%>default.aspx<%}else{%>Index.<%=config.html%><%}%>">
                        <%=GetResourceString("Home")%>
                    </a>>
                    <%=GetResourceString("MemberCenter")%>
                    >
                    <%=GetResourceString("MyAgent")%>
                </div>
                <!--位置导航结束-->
                <div id="content">
                    <div id="content_left_side">
                        <!--会员中心导航开始-->
                        <uc1:MemberMenu id="MemberMenu1" runat="server"></uc1:MemberMenu>
                        <!--会员中心导航结束-->
                    </div>
                    <div id="content_middle_side">
                        <!--内容开始-->
	                    <form id="Form1" method="post" runat="server">
                        <div class="mframe">
                            <div class="tl"> </div>
                            <div class="tr"></div>
                            <div class="tm">
                                <div class="on">
                                    <%=GetResourceString("MyAgent")%>
                                </div>
                            </div>
                            <div class="ml"></div>
                            <div class="mr"> </div>
                            <div class="mm">
                                <div style="float: left;">
                                    <%=GetResourceString("ExtLink")%>：<a href='/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%>jump.aspx?code=<%=GetAgentNoByMemberID() %>'
                                        style="color: Blue;" target="_blank"><%=GetMyAgentLink() %></a></div>
                                <div style="float: left; width: 20px;"></div>
                                <div style="float: left;">
                                    <%=GetResourceString("AgentNo")%>：<span style="color: Blue;"><%=GetAgentNoByMemberID() %></span></div>
                                <div style="float: left; width: 20px;"></div>
                                <div>
                                    <%=GetResourceString("SubMembers")%>：<span style="color: Blue;"><%=GetTotalMemberSum()%> <%=GetResourceString("Unit")%></span></div>
                                <div><span><%=GetResourceString("PreMonthOrdersCount")%>：<%=GetTotalOrdersSum("PreMonth")%><%=GetResourceString("Unit")%></span><span> <%=GetResourceString("PaymentOrdersMoneyCount")%>：<%=GetTotalMoney("PreMonth")%><%=GetResourceString("Yuan")%></span></div>
                                <div><span><%=GetResourceString("ThisMonthOrdersCount")%>：<%=GetTotalOrdersSum("ThisMonth")%><%=GetResourceString("Unit")%></span><span> <%=GetResourceString("PaymentOrdersMoneyCount")%>：<%=GetTotalMoney("ThisMonth")%><%=GetResourceString("Yuan")%></span></div>
                                <asp:DataGrid ID="dgOrderList" runat="server" AutoGenerateColumns="False" DataKeyField="OrderID"
                                    Width="100%" HorizontalAlign="Center" BorderWidth="1" BorderColor="#CCCCCC">
                                    <ItemStyle BackColor="White"></ItemStyle>
                                    <HeaderStyle BackColor="#E4E3E1"></HeaderStyle>
                                    <Columns>
                                        <asp:TemplateColumn HeaderText="订单编号">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Left" Height="20px" Width="8%"></ItemStyle>
                                            <ItemTemplate>
                                                <a href="#" onclick='printOrder(<%# DataBinder.Eval(Container.DataItem, "OrderID") %>)'>
                                                    <%# DataBinder.Eval(Container.DataItem, "OrderNo") %>
                                                </a>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:BoundColumn DataField="OrderTime" HeaderText="下订时间" DataFormatString="{0:yyyy-MM-dd}">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" Width="15%"></ItemStyle>
                                        </asp:BoundColumn>
                                        <asp:TemplateColumn HeaderText="总金额">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" Width="10%"></ItemStyle>
                                            <ItemTemplate>
                                                <%# DataBinder.Eval(Container.DataItem, "TotalPrice","{0:f}") %>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="支付金额">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" Width="13%"></ItemStyle>
                                            <ItemTemplate>
                                                <font color="Tomato">
                                                    <%# GetPay(DataBinder.Eval(Container.DataItem, "TotalPrice").ToString(),DataBinder.Eval(Container.DataItem, "AdvancePayment").ToString())%>
                                                </font>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="订单状态">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" Width="36%"></ItemStyle>
                                            <ItemTemplate>
                                                <%# GetStatus(DataBinder.Eval(Container.DataItem, "OrderID").ToString())%>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                        <asp:TemplateColumn HeaderText="操作">
                                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                                            <ItemStyle HorizontalAlign="Center" Width="20%"></ItemStyle>
                                            <ItemTemplate>
                                                <a href="#" onclick='printOrder(<%# DataBinder.Eval(Container.DataItem, "OrderID") %>)'>
                                                    <%=GetResourceString("ViewOrder")%>
                                                </a>
                                            </ItemTemplate>
                                        </asp:TemplateColumn>
                                    </Columns>
                                </asp:DataGrid>
                                

                                <script type="text/javascript">
		                        function printOrder(oid)
		                        {
			                        temp=window.open('/<%=System.Configuration.ConfigurationSettings.AppSettings["ShopFolder"]%>OrderPrint.aspx?OrderID='+oid,'shopcat','width=700,height=850,scrollbars=yes,resizable=yes');
			                        temp.focus();
		                        }
                                </script>

                            </div>
                            <div class="bl"></div>
                            <div class="br"></div>
                            <div class="bm"></div>
                        </div>
                        <!--内容结束-->
                        <div style="float: left; vertical-align:middle; height:50px;">
                            <%=GetResourceString("Time")%>：<%=GetResourceString("From")%>
                            <asp:TextBox ID="txtDateFrom" runat="server" onmouseover="window.status='Date Picker';return true;"
                                onmouseout="window.status='';return true;" onClick="javascript:show_calendar('Form1.txtDateFrom');"
                                Width="100px"></asp:TextBox>
                            <%=GetResourceString("To")%>
                            <asp:TextBox ID="txtDateTo" runat="server" onmouseover="window.status='Date Picker';return true;"
                                onmouseout="window.status='';return true;" onClick="javascript:show_calendar('Form1.txtDateTo');"
                                Width="100px"></asp:TextBox>
                            <asp:Button ID="btnSearch" runat="server" Text="查看"></asp:Button>
                            <%=GetResourceString("OrdersCount")%>：<%=GetTotalOrdersSum("")%><%=GetResourceString("Unit")%>
                            <%=GetResourceString("PaymentOrdersMoneyCount")%>：<%=GetTotalMoney("")%><%=GetResourceString("Yuan")%>
                            
                        </div>
		            </form>
                </div>
                    <div style="clear:both;"></div>
            </div>
                <uc1:Helper id="Helper1" runat="server"></uc1:Helper>
                <uc1:Footer id="Footer1" runat="server"></uc1:Footer>
        </div>
	</body>
</HTML>
