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

<%@ Register TagPrefix="uc1" TagName="Header" Src="Modules/Header.ascx" %>
<%@ Register TagPrefix="uc1" TagName="SupplierMenu" Src="Modules/SupplierMenu.ascx" %>
<%@	Register TagPrefix="ftb" Namespace="FreeTextBoxControls" Assembly="FreeTextBox"	%>
<%@ Register TagPrefix="uc1" TagName="Helper" Src="Modules/Helper.ascx" %>
<%@ Register TagPrefix="uc1" TagName="Footer" Src="Modules/Footer.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<!--#include file="inc/head.inc"-->
		<title>商家中心 <%=config.SiteTitle%></title>
        <script type="text/javascript" src="inc/commond.js"></script>
		<script src="inc/ui.datepicker.cn.js" type="text/javascript"></script>
		<link type="text/css" rel="stylesheet" href="style/ui.datepicker.css" />
		<script type="text/javascript">
            $(document).ready(function() {
                $("#txtStartTime").datepicker().click(function(){$(this).blur()});
                $("#txtEndTime").datepicker().click(function(){$(this).blur()});
                
                
                $("#btnReset").click(function(){
                    var len = document.Form1.elements.length;
                    for(i = 0 ; i < len ; i++){
                      if(document.Form1.elements[i].type == 'text'){
                        document.Form1.elements[i].value = '';
                      }else if(document.Form1.elements[i].type == 'select-one'){
                        document.Form1.elements[i].options[0].selected=true;
                      }
                    }
                    return false;
                  })
               
                  //查询时，判断查询条件格式是否正确
                  $("#btnSearch").click(function(){
                    var st_time =$("#txtStartTime").val();
                    var et_time =$("#txtEndTime").val();
                    var lt_time ="<%=GetLastDate() %>";
                    if(et_time!='' && st_time>et_time){
                      alert("时间区间的开始时间大于结束时间");
                      return false;
                    }
                    if(st_time!=''&&st_time<lt_time){
                        alert('时间区间的开始时间不小于'+lt_time);
                        return false;
                    }
                  });
                
   	            //给跳转按钮绑定onclick事件
	            $("#go").bind("click",function(){
		            var pageNum = $("#gopage").val();
		            var totalpage =  parseInt($("#totalpage").text());
		            if(pageNum.replace(new RegExp("(^[\\s]*)|([\\s]*$)", "g"), "") != "" ){
                        if(pageNum != "0"& !isNaN(parseInt(pageNum,10))){
                            if(pageNum > totalpage){
                                alert("输入的数字大于总页数");
                                $("#gopage").attr("value","");
                                return false;
                            }
                        }
                        else{  
                            alert("输入错误！");
                            $("#gopage").attr("value","");
                            return false;
                        }
                    }
                    else{
                        alert("请输入要跳转到的页面");
                        $("#gopage").attr("value","");
                        return false;
                    }
	            });
            });        
        </script>
	</head>
	<body>

			<uc1:Header id="Header1" runat="server"></uc1:Header>
			 <!--位置导航开始-->
			 <div class="path"><a href="<%=webSite %>supplier/default.<%=config.html%>">商家桌面</a> > 统计报表 > 商品统计</div>
			<!--位置导航结束-->
			<div class="xp-w clear">
				<div class="content-left">
					<!--会员中心导航开始-->
					<uc1:SupplierMenu id="SupplierMenu1" runat="server"></uc1:SupplierMenu>
					<!--会员中心导航结束-->
				</div>
				<div class="content-middle">	
					<div class="rframe">
					    <div class="tm">商品统计</div>
					    <div class="mm clear">
					        <form id="Form1" method="post" runat="server" >
                                <table>
                                    <tr>
	                                <td  class="right">商品ID：</td>
	                                <td>
                                    <asp:TextBox ID=txtPdtID runat=server></asp:TextBox>（多个ID半角逗号分隔）
                                    </td>
	                                <td class="right">时间区间：</td>
	                                <td>
                                    <asp:TextBox ID=txtStartTime runat=server></asp:TextBox>-<asp:TextBox ID=txtEndTime runat=server></asp:TextBox>（最近3个月以内）
                                    </td>
                                    </tr>
                                </table>
                                
                                <hr class="itemhr" />
                                <div style="float:right ;padding:5px 0px">
                                <input type=hidden  id=hidePage value=""/>
                                <input type=hidden  id=curTime name=curTime value=""/>

                                <asp:Button  id="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click" ></asp:Button>&nbsp;&nbsp;
                                <asp:Button  id="btnReset" runat="server" Text="重置" ></asp:Button>&nbsp;&nbsp;
                                </div>
                                <div style="clear:right"></div>
                            <br>
                            说明：<br>
                            <span class="red">1、以下数据只供参考，不做结算使用。</span><br>
                            2、发出数量，指的是发出商品数量。<br>
                            3、发出总额，指的是发出商品总金额。<br>
                            <hr class="itemhr" />
                            
    					    <div class="pro_hlist">
							    <asp:DataList id="dlPdtStatistics" CellPadding="4" RepeatColumns="1" 
                                    RepeatDirection="Horizontal" Width="100%" runat="server" 
                                    ForeColor="#333333" GridLines="Both" BorderWidth="1" BorderColor="#c8dcf4">
								    <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                                    <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <ItemStyle CssClass="datagrid-item"></ItemStyle>
			                        <HeaderStyle CssClass="datagrid-header"></HeaderStyle>
								    <HeaderTemplate>								
                                        <ItemTemplate>													
									        <table cellpadding="3" cellspacing="0" width="100%">
										        <tr align="center">
                                                  <th>序号</th>
                                                  <th>商品ID</th>
                                                  <th>商品名称</th>
                                                  <th>店内分类</th>
                                                  <th>市场价</th>
                                                  <th>会员价</th>
                                                  <th>发出数量</th>
                                                  <th>发出总金额</th>
                                                  <th>详情</th>
                                                </tr>			    
									        </table>
								        </ItemTemplate>								
								    </HeaderTemplate>
								    <ItemTemplate>													
									    <table cellpadding="3" cellspacing="0" width="100%">
										    <tr align="center">
                                                <td width="10%">
                                                    <%#Container.ItemIndex+1%>
											    </td>
                                                <td width="10%">
                                                    <%# DataBinder.Eval(Container.DataItem, "ProductID", "{0:f0}") %>
											    </td>
                                                <td width="10%">
                                                    <%#DataBinder.Eval(Container.DataItem, "ProductName", "{0:f2}")  %>
											    </td>
                                                <td width="10%">
                                                    <%# DataBinder.Eval(Container.DataItem, "CName", "{0:f2}") %>
											    </td>										
                                                <td width="10%">
                                                    <%#DataBinder.Eval(Container.DataItem, "MarketPrice", "{0:f2}") %>
											    </td>
                                                <td width="10%">
                                                    <%#DataBinder.Eval(Container.DataItem, "MemberPrice", "{0:f2}") %>
											    </td>
                                                <td width="10%">
                                                    <%#DataBinder.Eval(Container.DataItem, "Quantity") %>
											    </td>
	                                            <td width="10%">
                                                    <%#DataBinder.Eval(Container.DataItem, "Subprice", "{0:f2}") %>
											    </td>
                                                <td width="10%">
                                                    <%# GetProductStatisticsDetailLink(DataBinder.Eval(Container.DataItem, "ProductID", "{0:f0}"), GetLastDate(), txtStartTime.Text.Trim(), txtEndTime.Text.Trim())%>
											    </td>

										    </tr>
									    </table>
								    </ItemTemplate>
							    </asp:DataList>
							    <asp:panel id="plPage" visible="true" runat="server">
				                <!-- 翻页开始-->
				                <div class="page clear">
					                <div class="fpage1">
                                        <asp:Label ID="lblPagerInfo" runat="server"></asp:Label>

                                <asp:textbox id="gopage"  runat="server" class="gopage" size="1" />
                                <asp:button id="go" runat="server" text="Go" class="go" onclick="go_Click" />
                                    </div>
                                    <div class="fpage2">
                                        <span class="prepage"></span>
                                        <asp:Label ID="lbPage" runat="server"></asp:Label>
                                        <span class="nextpage"></span>
                                    </div>                                
				                </div>
				                <!-- 翻页结束-->
				                </asp:panel>
				                <asp:panel id="plNoProduct" visible="false" runat="server">
					                <div style="margin:20px;">
						                <h3>抱歉，没有找到符合的商品！</h3>
					                </div>
				                </asp:panel>
						    </div>
		                </form>
					    </div>
					</div>
			    </div>
			</div>
		<uc1:Helper id="Helper" runat="server"></uc1:Helper>
		<uc1:Footer id="Footer" runat="server"></uc1:Footer>

	</body>
</html>