<%@ Page Language="c#" CodeBehind="Bill.aspx.cs" AutoEventWireup="True" Inherits="SWTraining.Finance.Bill"
    Title="财务管理-消费单管理" %>

<%@ Register Src="../UserCol/Progress.ascx" TagName="Progress" TagPrefix="uc2" %>
<%@ Import Namespace="SWTraining" %>
<!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 runat="server">
    <link id="linkStyle" runat="server" href="../Themes/Blue/css.css" rel="stylesheet"
        type="text/css" />
    <script src="../Jscript/CreateSubMenu.js" type="text/javascript"></script>
</head>
<body>
    <script type="text/javascript">
        var IsPrint = false;</script>
    <div class="printWeb">
        <iframe id="PrintWeb" width="0" height="0"></iframe>
    </div>
    <form id="Form1" runat="server">
    <div class="tool_Search">
        校区：<asp:DropDownList ID="ddlSchool" DataTextField="SchoolName" DataValueField="SchoolID"
            runat="server">
        </asp:DropDownList>
        &nbsp;消费单号：<asp:TextBox ID="tbxBillID" runat="server"></asp:TextBox>
        <label class="lab_buttom">
<asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="查询" />
</label>
    </div>
    <div class="both">
    </div>
    <div class="divpanel">
        <asp:GridView ID="GridView1" runat="server" CssClass="gridview" AutoGenerateColumns="False"
            DataKeyNames="BillID" OnRowDataBound="GridView1_RowDataBound" OnSelectedIndexChanging="GridView1_SelectedIndexChanging"
            OnRowCommand="GridView1_RowCommand">
            <SelectedRowStyle CssClass="selected" />
            <Columns>
                <asp:TemplateField InsertVisible="False" HeaderText="单号" SortExpression="BillID">
                    <ItemTemplate>
                        <asp:ImageButton ID="ibnSelect" CommandName="Select" ImageUrl='<%# accTheme("node_close.gif") %>'
                            runat="server" />
                        <asp:LinkButton ID="lbnSelect" runat="server" Text='<%# Eval("BillID") %>' CommandName="Select" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="StudentID" HeaderText="学号" />
                <asp:BoundField DataField="StudentName" HeaderText="姓名" />
                <asp:TemplateField HeaderText="日期">
                    <ItemTemplate>
                        <asp:Label ID="labDateAndTime" runat="server" Text='<%#Eval("DateAndTime")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="类型">
                    <ItemTemplate>
                        <asp:Label ID="labBillTypeID" runat="server" Text='<%#(int)Eval("BillTypeID") == 1 ? "售出" : "退货"%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="应交金额">
                    <ItemTemplate>
                        <asp:Label ID="labPay" runat="server" Text='<%# Eval("Pay","{0:c2}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="优惠">
                    <ItemTemplate>
                        <asp:Label ID="labFavourable" runat="server" Text='<%# Eval("Favourable","{0:c2}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="实收金额">
                    <ItemTemplate>
                        <asp:Label ID="labPayed" runat="server" Text='<%# Eval("Payed","{0:c2}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="备注">
                    <ItemTemplate>
                        <asp:Literal runat="server" ID="litRemark" Text='<%# Eval("Remark") %>' Mode="Encode"></asp:Literal>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="PostSchoolName" HeaderText="交费点" ReadOnly="true" />
                <asp:TemplateField HeaderText="录入员">
                    <ItemTemplate>
                        <%#Eval("TrueName")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="已打">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbnPrint" runat="server" CommandName="Print" CommandArgument='<%#Eval("BillID") %>'
                            Text='<%# (int)Eval("PrintCount") > 0 ? "已" : "未" %>' Font-Size="9pt"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="打印">
                    <ItemTemplate>
                        <asp:HyperLink ID="hlkPrint" runat="server" NavigateUrl='<%#string.Format("javascript:Print({0});void(0);",Eval("BillID")) %>'
                            ImageUrl='<%# accTheme("print.gif")%>' CssClass="noborder"></asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="管理">
                    <ItemTemplate>
                        <asp:HyperLink ID="hlkShow" runat="server" Text="管理" NavigateUrl='<%# string.Format("StudentFrame.aspx?action={3}&StudentID={0}&BillID={1}&pageIndex=2&GetUrl={2}",Eval("StudentID"),Eval("BillID"),swq.Web.PathAndQuery(),(int)Eval("BillTypeID") == 1 ? "selledit" : "outedit") %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    <div class="divpanel">
        <asp:Literal ID="litPagerButton" runat="server"></asp:Literal>
    </div>
    <div class="backpanel">
        <label class="lab_buttom">
<input causesvalidation="false" type="button" runat="server" onclick="back()" value="返回" />
</label>
    </div>
    <div id="divItems" style="visibility: hidden">
        <div style="width: 50%">
            <asp:GridView ID="gvItems" runat="server" AutoGenerateColumns="false" CssClass="smallgridview">
                <Columns>
                    <asp:BoundField DataField="ProductID" HeaderText="编号" ReadOnly="True" />
                    <asp:BoundField DataField="ProductName" HeaderText="项目" ReadOnly="True" />
                    <asp:TemplateField HeaderText="单价">
                        <ItemTemplate>
                            <asp:Label ID="labUnitPrice" runat="server" Text='<%# Bind("UnitPrice","{0:c2}") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="数量">
                        <ItemTemplate>
                            <asp:Label ID="labAmount" runat="server" Text='<%# Bind("Amount") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="单位">
                        <ItemTemplate>
                            <asp:Label ID="labUnitName" runat="server" Text='<%# Eval("UnitName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="优惠">
                        <ItemTemplate>
                            <asp:Label ID="labFavorable" runat="server" Text='<%# Eval("Favorable","{0:c2}") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="合计">
                        <ItemTemplate>
                            <asp:Label ID="labTotalPrice" runat="server" Text='<%# Bind("TotalPrice","{0:c2}") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="仓库">
                        <ItemTemplate>
                            <asp:Label ID="labStoreroomName" runat="server" Text='<%# Bind("StoreroomName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
    </div>
    </form>
</body>
</html>
