<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostInBatch.aspx.cs" Inherits="SWTraining.Commodity.PostInBatch"
    Title="仓库管理-入库表单" %>

<!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 Focus() {
            if (!document.getElementById("tbxBarcode").disabled) {
                document.getElementById("tbxBarcode").focus();
            }
        }

//--> 
    </script>
</head>
<body onload="Focus();">
    <form id="form1" runat="server">
    <div class="divpanel">
        <table class="table" cellspacing="0">
            <tr>
                <th colspan="2">
                    入库单
                </th>
            </tr>
            <tr>
                <td rowspan="2">
                    &nbsp; 已选商品：
                </td>
                <td>
                    条形码：<asp:TextBox ID="tbxBarcode" runat="server" Width="90px"></asp:TextBox>
                    <asp:DropDownList ID="ddlCommodityType" runat="server" DataTextField="CommodityTypeName"
                        DataValueField="CommodityTypeID" AutoPostBack="True" OnSelectedIndexChanged="ddlCommodityType_SelectedIndexChanged">
                    </asp:DropDownList>
                    <asp:DropDownList ID="ddlCommodity" runat="server" DataTextField="CommodityName"
                        DataValueField="CommodityID" AutoPostBack="True" OnSelectedIndexChanged="ddlCommodity_SelectedIndexChanged">
                    </asp:DropDownList>
                    进价：<asp:TextBox ID="tbxPurchasePrice" runat="server" Width="54px"></asp:TextBox>
                    数量：<asp:TextBox ID="tbxAmount" runat="server" Width="40px"></asp:TextBox>
                    <asp:Label ID="labUnitName" runat="server"></asp:Label>
                    仓库：<asp:DropDownList ID="ddlStoreroom" runat="server" DataTextField="StoreroomName"
                        DataValueField="StoreroomID">
                    </asp:DropDownList>
                    <label class="lab_buttom">
                        <asp:Button ID="btnAddItem" runat="server" Text="增加" OnClick="btnAddItem_Click" />
                    </label>
                    <label class="lab_buttom">
                        <asp:Button ID="btnAddNewCommodity" runat="server" OnClick="btnAddNewCommodity_Click"
                            Text="增加新品" />
                    </label>
                </td>
            </tr>
            <tr>
                <td style="height: 20px">
                    <div style="width: 60%">
                        <asp:GridView ID="GridView1" runat="server" CssClass="smallgridview" AutoGenerateColumns="False"
                            DataKeyNames="BatchItemID" OnRowCancelingEdit="GridView1_RowCancelingEdit" OnRowEditing="GridView1_RowEditing"
                            OnRowUpdating="GridView1_RowUpdating" OnRowDeleting="GridView1_RowDeleting">
                            <Columns>
                                <asp:BoundField DataField="CommodityID" ReadOnly="True" HeaderText="商品编号" />
                                <asp:TemplateField HeaderText="商品名称">
                                    <ItemTemplate>
                                        <asp:Label ID="labCommodityName" runat="server" Text='<%# Eval("CommodityName") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="进价">
                                    <ItemTemplate>
                                        <asp:Label ID="labPurchasePrice" runat="server" Text='<%# Eval("PurchasePrice","{0:c2}") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="tbxPurchasePrice" runat="server" Text='<%# Eval("PurchasePrice") %>'
                                            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="labTotalPrice" runat="server" Text='<%# Eval("TotalPrice","{0:c2}") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="仓库">
                                    <ItemTemplate>
                                        <asp:Label ID="labStoreroomName" runat="server" Text='<%# Eval("StoreroomName") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:CommandField HeaderText="编辑" EditText="编辑" CancelText="取消" UpdateText="更新" ShowEditButton="true" />
                                <asp:TemplateField HeaderText="删除">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbnDelete" runat="server" Text="删除" CommandName="Delete"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    单号：
                </td>
                <td>
                    <asp:TextBox ID="tbxBatchID" runat="server" Width="184px" Enabled="False"></asp:TextBox>
                    <asp:Label ID="Label3" runat="server" ForeColor="red" Text="*" ToolTip="必填项"></asp:Label><asp:CheckBox
                        ID="cbxAutoID" runat="server" AutoPostBack="True" Checked="True" OnCheckedChanged="cbxAutoID_CheckedChanged"
                        Text="自动" />
                </td>
            </tr>
            <tr>
                <td>
                    日期：
                </td>
                <td>
                    <asp:TextBox ID="tbxDateAndTime" runat="server" Width="152px"></asp:TextBox>
                    <span style="color: Red">*</span>
                </td>
            </tr>
            <tr>
                <td>
                    供货商：
                </td>
                <td>
                    <asp:DropDownList ID="ddlProvider" runat="server" DataTextField="ProviderName" DataValueField="ProviderID">
                    </asp:DropDownList>
                    <span style="color: Red">*</span>
                </td>
            </tr>
            <tr>
                <td>
                    总数量：
                </td>
                <td>
                    <asp:TextBox ID="tbxTotalAmount" runat="server" ReadOnly="True"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    总价值：
                </td>
                <td>
                    <asp:TextBox ID="tbxTotalPurchasePrice" runat="server" ReadOnly="True"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    备注：
                </td>
                <td>
                    <asp:TextBox ID="tbxRemark" runat="server" Width="387px" Height="53px" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    录入员：
                </td>
                <td>
                    <asp:DropDownList ID="ddlUser" runat="server" DataTextField="TrueName" DataValueField="UserID">
                    </asp:DropDownList>
                    <span style="color: Red">*</span>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <label class="lab_buttom">
                        <asp:Button ID="btnPost" runat="server" Text="确定入库" OnClick="btnPost_Click" />
                    </label>
                    <label class="lab_buttom">
                        <input causesvalidation="false" type="button" runat="server" onclick="back()" value="返回" />
                    </label>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
