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

<%@	Register TagPrefix="ftb" Namespace="FreeTextBoxControls" Assembly="FreeTextBox"	%>
<!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>Supplier</title>
		<script type="text/javascript" src="inc/jquery.easydrag.handler.beta2.js"></script>
        <script type="text/javascript" src="inc/FinanceStatistics.js"></script>
        <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" src="inc/multi_popup.js"></script>
		<link type="text/css" rel="stylesheet" href="style/multi_popup.css" />
		

        <style type="text/css">
            /*弹出窗口*/
            .popupWindow{position: absolute; z-index: 100;display: none;background-color:#FFFFFF;border:solid 1px #ccc;width: 550px;}
            .popupHead{}
            .popupTitle{}
            .popupClose{}
            .popupContent{padding:0px;width: 100%;height:auto !important; max-height:350px;overflow:auto;}
            .tips{font-size:14px;height:30px;padding-left:15px;padding-top:10px}
            .item{font-size:12px;padding-left:15px}
            .popupFooter{width:100%;text-align:center;margin:10px 0 10px 0}
            .btn{height:20px;}
             #maskLayer{background-color:#e3e3e3; position:absolute; z-index:99; left:0; top:0; display:none; width:100%; height:1000px;opacity:0.5;filter: alpha(opacity=50);-moz-opacity: 0.5;}
 	        .save{z-index:1;text-align:center;}
 	    </style>
	</HEAD>
	<body>
	    <div class="container">
		<div class="sub_container"style="position:relative;z-index:1">
		<div class="sub_container_title"><a href="<%=AdminDefault%>" target="_top">桌面</a><img src="images/admin_title.jpg" height=9px width=8px align="absmiddle" />
        财务统计
        </div>
		<div class="sub_container_content">
		<form id="Form1" runat="server">
		    <div class="frame">
		        <div class="frame_title"><asp:label id="lbTitle" Runat="server" CssClass="tableHeaderText">财务统计</asp:label></div>
                 <div class="frame_operator">
<%--                    <asp:Button ID="btnOutput" runat="server" class="inputbtn" Text="导出" 
                         onclick="btnOutput_Click"  />--%>
                    <asp:Button ID="btnOutputAll" runat="server" class="inputbtn" Text="导出筛选的账单" 
                         onclick="btnOutputAll_Click"/>
<%--                    <asp:Button ID="btnInput" runat="server" class="inputbtn" Text="导入" 
                         onclick="btnInput_Click"/>--%>
		        </div>
		        <div class="frame_content">
	                    <table>
                            <tr>
                            <td  >统计类型：</td>
                            <td>
                            <asp:RadioButtonList id="rdlStatisticsType" runat="server"  AutoPostBack=false
                                    RepeatDirection=Horizontal 
                                    onselectedindexchanged="rdlStatisticsType_SelectedIndexChanged">
                                    <asp:ListItem Selected="True" Value="0">按供应商汇总</asp:ListItem>
                                    <asp:ListItem Value="1">按期数汇总</asp:ListItem>
                                 </asp:RadioButtonList>
                            </td>
                            </tr>
                            <tr>
                              <td>结款状态：</td>
                              <td align=left>
                                    <asp:DropDownList ID="ddlStatus" runat=server>
                            	        <asp:ListItem Value="9999">全部</asp:ListItem>
                            	        <asp:ListItem Value=2>可以结款</asp:ListItem>
                                        <asp:ListItem Value=3>结款中</asp:ListItem>
                                        <asp:ListItem Value=4>结款完成</asp:ListItem>
                                    </asp:DropDownList>
                              </td>
                              <td style="display:none">结款期号：</td>
                              <td style="display:none" lign=left>
                                    <asp:DropDownList ID="ddlPeriod" runat=server>
                                    </asp:DropDownList>
                              </td>
                              <td>结款时间：</td>
	                            <td>
	                            <asp:TextBox id="txtStartTime" runat="server"  name="txtStartTime" value="" size="10" ></asp:TextBox>-<asp:TextBox id="txtEndTime" runat="server" type="text" name="txtEndTime" value="" size="10" ></asp:TextBox>&nbsp;</td>
                             </tr> 
                             <tr>
	                            <td>结款期号：</td>
	                            <td>
	                            <asp:TextBox ID="txtIssue" runat="server" ></asp:TextBox>
	                            </td>
                            
                                <asp:panel id="pnlSupName" Runat="server" style="display:none">
	                                <td>供应商名称：</td>
	                                <td>
	                                <asp:TextBox ID="txtSupName" runat="server" ></asp:TextBox>
	                                </td>
                                 </asp:panel>

                            </tr>
                        </table>
                        <div style="float:right ;padding:5px 0px">
                        <input type=hidden  id=hidePage value=""/>
                        <asp:Button  id="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click" ></asp:Button>&nbsp;&nbsp;
                        <asp:Button  id="btnReset" runat="server" Text="重置" OnClick="btnReset_Click" ></asp:Button>&nbsp;&nbsp;
                        </div>
                        <div style="clear:right"></div>
                        <hr class="itemhr" />
                        

						<div>
							<%if (string.IsNullOrEmpty(Request.QueryString["type"]) || !Request.QueryString["type"].Equals("1")){%>											    
							<asp:DataList id="dlFinanceStatistics0" CellPadding="4" RepeatColumns="1" 
                                RepeatDirection="Horizontal" Width="100%" runat="server" DataKeyField="FinanceSummaryID"
                                ForeColor="#333333">
								<AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                                <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
								<HeaderTemplate>								
                                    <ItemTemplate>													
									    <table cellpadding="3" cellspacing="0" width="100%">
										    <tr align=center>
                                                <td width="10%">
                                                    结款期间
											    </td>
                                                <td width="10%">
                                                    订单结款金额
											    </td>
                                                <td width="10%">
                                                    退款金额
											    </td>
                                                <td width="10%">
                                                    佣金
											    </td>										
                                                <td width="10%">
                                                    应付账款
											    </td>
                                                <td width="10%">
                                                    财务转账状态
											    </td>
                                                <td width="10%">
                                                    供应商
											    </td>
                                            <td width="10%">
                                                银行账号
											</td>
											<td width="10%">
											        导出数据
											    </td>
											<td width="10%">
                                                给商家结款
                                            </td>
	                                	    </tr>
	                                	</table>
								    </ItemTemplate>								
								</HeaderTemplate>											   

								<ItemTemplate>													
									<table cellpadding="3" cellspacing="0" width="100%">
										<tr align=center>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "Issue", "{0:f}")%>
											</td>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "Amount", "{0:f}")%>
											</td>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "TuiKuan", "{0:f}")%>
											</td>										
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "YongJin", "{0:f}")%>
											</td>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "ShiFu", "{0:f}")%>
											</td>
											<td width="10%">
                                                <%# DataBinder.Eval(Container.DataItem, "Status")=="" ? " ": GetStatus(int.Parse(DataBinder.Eval(Container.DataItem, "Status").ToString()))%>
											</td>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "SupplierName")%> 
											</td>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "BankNo")%> 
											</td>
											<td width="10%">
											    <asp:LinkButton id="btnExport0" runat="Server" Text="导出" CommandName="Export" CommandArgument='<%# ExportCommandArgument( DataBinder.Eval(Container.DataItem, "Issue").ToString(), DataBinder.Eval(Container.DataItem, "SupplierID").ToString(), DataBinder.Eval(Container.DataItem, "SupplierName").ToString()) %>' Visible=<%# IsShowLinkButton(int.Parse(DataBinder.Eval(Container.DataItem, "FinanceSummaryID").ToString()))%> OnClick="btnExport0_Click"  > </asp:LinkButton>  
										    </td>
                                            <td width="10%" >
                                                <input type="hidden" name="issue"  value="<%#DataBinder.Eval(Container.DataItem, "Issue").ToString()%>"/>
                                                <input type="hidden" name="sid"  value="<%#DataBinder.Eval(Container.DataItem, "SupplierID").ToString()%>"/>
                                                <a href="#" class="doConfirm" style="display:<%#DataBinder.Eval(Container.DataItem, "FinanceSummaryID").ToString()=="0" ||DataBinder.Eval(Container.DataItem, "Status").ToString()=="4" ?"none":"block" %>">确认结款</a>
                                            </td>
									    </tr>
									</table>
								</ItemTemplate>
							</asp:DataList>
							<%}else{ %>
								<asp:DataList id="dlFinanceStatistics1" CellPadding="4" RepeatColumns="1" 
                                RepeatDirection="Horizontal" Width="100%" runat="server" ForeColor="#333333">
								<AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                                <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
								<HeaderTemplate>								
                                    <ItemTemplate>													
									    <table cellpadding="3" cellspacing="0" width="100%">
										    <tr align=center>
                                                <td width="15%">
                                                    结款期号
											    </td>
                                                <td width="15%">
                                                    订单结款金额
											    </td>
                                                <td width="10%">
                                                    退款金额
											    </td>
                                                <td width="10%">
                                                    佣金
											    </td>										
                                                <td width="10%">
                                                    应付账款
											    </td>
                                                <td width="10%">
                                                    财务转账状态
											    </td>
											    <td width="10%">
											        导出数据
											    </td>
										    </tr>
									    </table>
								    </ItemTemplate>								
								</HeaderTemplate>
								<ItemTemplate>													
									<table cellpadding="3" cellspacing="0" width="100%">
										<tr align=center>
                                            <td width="15%">
                                                <%#DataBinder.Eval(Container.DataItem, "Issue", "{0:f}")%>
											</td>
                                            <td width="15%">
                                                <%#DataBinder.Eval(Container.DataItem, "Amount", "{0:f}")%>
											</td>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "TuiKuan", "{0:f}")%>
											</td>										
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "YongJin", "{0:f}")%>
											</td>
                                            <td width="10%">
                                                <%#DataBinder.Eval(Container.DataItem, "ShiFu", "{0:f}")%>
											</td>
											<td width="10%">
                                                <%# DataBinder.Eval(Container.DataItem, "Status")==null? " ": GetStatus(int.Parse(DataBinder.Eval(Container.DataItem, "Status").ToString()))%>
											</td>
											<td width="10%">
											<asp:LinkButton id="btnExport1" runat="Server" Text="导出本期" CommandName="Export" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Issue")%>' Visible=<%# IsShowLinkButton(int.Parse(DataBinder.Eval(Container.DataItem, "FinanceSummariesID").ToString()))%> OnClick="btnExport1_Click"  > </asp:LinkButton>  
										    </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>
	        </div>
            <!--弹出层开始-->
            <div id="showChangeStatus" class="popupWindow " >
                <div class="popupHead" id="ChangeStatusHeader">
                <div class="popupTitle">转账完成</div>
                <div class="popupClose" id="ChangeStatusClose"><span>×</span></div>
                <div class="clear" ></div>
                </div>
                <div class="popupContent">
                    <table style="width:99%;" class="thinBorder">
                        <tr>
                            <td style="width:35%">转账交易流水号：</td>
                            <td><input type="text" id="serialNumber"/></td>
                        </tr>
                        <tr>
                            <td>操作备注：</td>
                            <td ><textarea id="remark" rows="4"></textarea></td>
                        </tr>
                    </table>
                    <div style="padding:10px;">请转账后，执行此操作</div>
                </div>
                <div class="popupFooter">
                        <input type="button" value="确认" id="btnConfirm"/>
                        <input type="button" value="取消" id="btnCancel"/>
                </div>
            </div>
        </form>
		</div>
		</div>
		</div>

	</body>
</HTML>
