<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostSellBill.aspx.cs" Inherits="MTCUN.Register.PostSellBill"
    Title="增加消费单-客服" %>

<%@ Register Src="../UserCol/SimpleCode.ascx" TagName="SimpleCode" TagPrefix="uc1" %>
<%@ Register Src="../UserCol/Ann.ascx" TagName="Ann" TagPrefix="uc2" %>
<%@ Register Src="../UserCol/ReportServer.ascx" TagName="ReportServer" TagPrefix="uc3" %>
<!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">
    <title></title>
    <link id="linkStyle" runat="server" href="../Themes/Blue/css.css" rel="stylesheet"
        type="text/css" />
    <script type="text/javascript">
        function StudentBox() {
            window.showModelessDialog('../Tools/StudentBox.aspx', window, 'dialogWidth=750px;dialogHeight=500px');
        }
    </script>
    <script type="text/javascript"> 
<!--

    function Focus() {
        if (!document.getElementById("tbxBarcode").disabled) {
            document.getElementById("tbxBarcode").focus();
        }
    }

    //--> 
    </script>
    <script type="text/javascript">
        function NoDataTips() {
            var _billItems = document.getElementById("BillItems");
            if (_billItems.innerText.trim() == "") {
                _billItems.innerHTML = "<span style='color:red'>*请增加收费项目。</span>";
            }
        }
    </script>
</head>
<body onload="Focus();NoDataTips()">
    <form id="form1" runat="server">
        <div class="divpanel">
            <uc2:Ann ID="Ann1" runat="server" />
            <table class="table" cellspacing="0">
                <tr>
                    <th colspan="3">收费明细单
                    </th>
                </tr>
                <tr>
                    <td style="width: 100px">学号：
                    </td>
                    <td style="width: 100px">
                        <asp:Label ID="labStudentID" runat="server"></asp:Label>
                    </td>
                    <td rowspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>姓名：
                    </td>
                    <td>
                        <asp:Label ID="labStudentName" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>已选项目：
                    </td>
                    <td colspan="2">

                        <div class="striking_head">
                            条形码：<asp:TextBox ID="tbxBarcode" runat="server" Width="90px"></asp:TextBox>
                            <asp:DropDownList ID="ddlProductType" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlProductType_SelectedIndexChanged">
                                <asp:ListItem Value="0$0">请选择</asp:ListItem>
                                <asp:ListItem Value="1$0">课程</asp:ListItem>
                                <asp:ListItem Value="2$0">收费项</asp:ListItem>
                                <asp:ListItem Value="8$0">商品</asp:ListItem>
                            </asp:DropDownList>
                            <asp:DropDownList ID="ddlProduct" runat="server" DataTextField="ProductName" DataValueField="ProductID"
                                AutoPostBack="True" OnSelectedIndexChanged="ddlProduct_SelectedIndexChanged">
                            </asp:DropDownList>
                            <uc1:SimpleCode ID="SimpleCode1" runat="server" UsersControlID="ddlProduct" CodeType="Course"
                                Visible="False" />
                            数量：<asp:TextBox ID="tbxAmount" runat="server" Width="51px" AutoPostBack="True" OnTextChanged="tbxAmount_TextChanged"></asp:TextBox>
                            <asp:Label ID="labUnitName" runat="server"></asp:Label>
                            单价：<asp:TextBox ID="tbxUnitPrice" runat="server" Width="65px"></asp:TextBox>
                            <span id="panSto" runat="server">仓库：<asp:DropDownList ID="ddlStoreroom" runat="server"
                                DataTextField="StoreroomName" DataValueField="StoreroomID">
                            </asp:DropDownList>
                            </span>
                            <label class="lab_button striking_btnc">
                                <asp:Button ID="btnAddItem" runat="server" Text="增加" OnClick="btnAddItem_Click" />
                            </label>
                        </div>

                        <div class="striking_content">
                            <div style="width: 70%" id="BillItems">

                                <asp:GridView ID="GridView1" runat="server" CssClass="smallgridview" AutoGenerateColumns="False"
                                    DataKeyNames="BillItemID" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing"
                                    OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting">
                                    <Columns>
                                        <asp:BoundField DataField="ProductID" ReadOnly="True" HeaderText="编号" />
                                        <asp:TemplateField HeaderText="收费项目">
                                            <ItemTemplate>
                                                <asp:Label ID="labProductName" runat="server" Text='<%# Eval("ProductName") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="单价">
                                            <ItemTemplate>
                                                <asp:Label ID="labUnitPrice" runat="server" Text='<%# Eval("UnitPrice","{0:c2}") %>'></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="tbxUnitPrice" runat="server" Text='<%# Eval("UnitPrice","{0:f2}") %>'
                                                    Width="60"></asp:TextBox>
                                            </EditItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="数量">
                                            <ItemTemplate>
                                                <asp:Label ID="labAmount" runat="server" Text='<%# Eval("Amount") %>'></asp:Label>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="tbxAmount" runat="server" Text='<%# Eval("Amount") %>' Width="60"></asp:TextBox>
                                            </EditItemTemplate>
                                        </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>
                                            <EditItemTemplate>
                                                <asp:TextBox ID="tbxFavorable" runat="server" Text='<%# Eval("Favorable","{0:f2}") %>'
                                                    Width="60"></asp:TextBox>
                                            </EditItemTemplate>
                                        </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>
                                        <asp:TemplateField HeaderText="编辑">
                                            <ItemTemplate>
                                                <div class="lab_button_sub" id="divEdit" runat="server">
                                                    <asp:LinkButton ID="lbnEdit" runat="server" Text="编辑" CommandName="Edit"></asp:LinkButton>
                                                </div>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <div class="lab_button_sub">
                                                    <asp:LinkButton ID="lbnUpdate" runat="server" Text="更新" CommandName="Update"></asp:LinkButton>
                                                </div>
                                                <div class="lab_button_sub">
                                                    <asp:LinkButton ID="lbnCancel" runat="server" Text="取消" CommandName="Cancel"></asp:LinkButton>
                                                </div>
                                            </EditItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="删除">
                                            <ItemTemplate>
                                                <div class="lab_button_sub" id="divDelete" runat="server">
                                                    <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete"></asp:LinkButton>
                                                </div>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </div>


                        </div>
                    </td>
                </tr>

                <tr>
                    <td>单号：
                    </td>
                    <td colspan="2" class="required">
                        <asp:TextBox ID="tbxBillID" runat="server" Width="184px" Enabled="False"></asp:TextBox>
                        <asp:CheckBox
                            ID="cbxAutoID" runat="server" AutoPostBack="True" Checked="True" OnCheckedChanged="cbxAutoID_CheckedChanged"
                            Text="自动" />
                    </td>
                </tr>
                <tr>
                    <td>日期：
                    </td>
                    <td colspan="2" class="required">
                        <asp:TextBox ID="tbxDateAndTime" runat="server" Width="152px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>总价：
                    </td>
                    <td colspan="2" class="required">
                        <asp:TextBox ID="tbxTotalPay" runat="server" Enabled="False"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>优惠：
                    </td>
                    <td colspan="2">
                        <asp:TextBox ID="tbxFavourable" runat="server" OnTextChanged="tbxFavourable_TextChanged"
                            AutoPostBack="True">0</asp:TextBox>
                        折扣：<asp:DropDownList ID="ddlDiscount" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlDiscount_SelectedIndexChanged">
                            <asp:ListItem Value="10" Text=""></asp:ListItem>
                            <asp:ListItem>9</asp:ListItem>
                            <asp:ListItem>8</asp:ListItem>
                            <asp:ListItem>7</asp:ListItem>
                            <asp:ListItem>6</asp:ListItem>
                            <asp:ListItem>5</asp:ListItem>
                            <asp:ListItem>4</asp:ListItem>
                            <asp:ListItem>3</asp:ListItem>
                            <asp:ListItem>2</asp:ListItem>
                            <asp:ListItem>1</asp:ListItem>
                            <asp:ListItem>0</asp:ListItem>
                        </asp:DropDownList>
                        .<asp:DropDownList ID="ddlDiscountDecimal" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlDiscount_SelectedIndexChanged">
                            <asp:ListItem Value="0"> </asp:ListItem>
                            <asp:ListItem Text="">1</asp:ListItem>
                            <asp:ListItem>2</asp:ListItem>
                            <asp:ListItem>3</asp:ListItem>
                            <asp:ListItem>4</asp:ListItem>
                            <asp:ListItem>5</asp:ListItem>
                            <asp:ListItem>6</asp:ListItem>
                            <asp:ListItem>7</asp:ListItem>
                            <asp:ListItem>8</asp:ListItem>
                            <asp:ListItem>9</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>金额：
                    </td>
                    <td colspan="2" class="required">
                        <asp:TextBox ID="tbxPayed" runat="server" ReadOnly="True" Enabled="False"></asp:TextBox>
                        <span runat="server" id="spanAcc" visible="false"><span style="color: Red">*</span>
                            帐户金额不足：需充入<asp:Label ID="labMissing" runat="server" ForeColor="Red" Text=""></asp:Label>元，
                        您想即充即扣？<div class="control_bg"><label class="lab_button"><asp:CheckBox ID="cbxInstant" runat="server" Text="是" /></label>
                            &nbsp;支付方式：<asp:DropDownList ID="ddlPayMethod" runat="server" DataTextField="PayMethodName" DataValueField="PayMethodName">
                            </asp:DropDownList></div>
                        </span>
                        <asp:Label ID="labArrearsTip" runat="server" ForeColor="Red"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>备注：
                    </td>
                    <td colspan="2">
                        <asp:TextBox ID="tbxRemark" runat="server" Width="387px" Height="53px" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>短信通知：
                    </td>
                    <td colspan="2">
                        <asp:CheckBox ID="cbxSMS" runat="server" Checked="True" />
                    </td>
                </tr>
                <tr>
                    <td>办理点：
                    </td>
                    <td colspan="2" class="required">
                        <asp:DropDownList ID="ddlPostSchool" runat="server" DataTextField="SchoolName" DataValueField="SchoolID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>录入员：
                    </td>
                    <td colspan="2" class="required">
                        <asp:DropDownList ID="ddlUser" runat="server" DataTextField="TrueName" DataValueField="UserID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;
                    </td>
                    <td colspan="2">
                        <label class="lab_button">
                            <asp:Button ID="btnPost" runat="server" Text="确定结账" OnClick="btnPost_Click" />
                        </label>
                        <label class="lab_button" id="__mt_labBack" runat="server">
                            <input causesvalidation="false" id="__mt_back" type="button" runat="server" onclick="back(this)" value="返回" />
                        </label>
                        <%--<div class="lab_button" style="margin-left:20px">--%>
                            <asp:HyperLink ID="hlkPayment" runat="server" Target="_blank">账户充值</asp:HyperLink>
                        <%--</div>--%>
                    </td>
                </tr>
            </table>
        </div>
        <div class="divremark">
            <b>注意事项：</b><br />
            1、“即充即扣”，即不用人工去充值，直接在这里收费，系统自动在充值面板增加一条记录。使用“即充即扣”时按需充入金额收费。欠费学员不能使用此功能。<br />
            2、优惠请使用负数。
        </div>
        <uc3:ReportServer ID="ReportServer1" runat="server" />
    </form>
</body>
</html>
