<%@ Page Language="C#" MasterPageFile="~/AdminMaster.master" AutoEventWireup="true" CodeFile="PurchasedOrders.aspx.cs" Inherits="PurchasedOrders" Title="Untitled Page" %>

<%@ Register src="UC_AdminOperatoChecker.ascx" tagname="UC_AdminOperatoChecker" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .style4
        {
            height: 20px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width:100%;">
        <tr>
            <td style="text-align: left" colspan="3">
                <asp:Label ID="Lbl_Title" runat="server" CssClass="LabelHeaader" 
                    Text="تحویل اقلام خریداری شده به انبار"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                &nbsp;</td>
            <td style="text-align: right">
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_DeliveryPlace" runat="server" CssClass="Label1" 
                    Text="محل تحویل:"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:DropDownList ID="Drp_WareHouseName" runat="server" 
                    DataSourceID="LinqDt_Drp_WarHName" DataTextField="WarHouseDescription" 
                    DataValueField="WarwHouseID" ValidationGroup="11">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDt_Drp_WarHName" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="WarHouseDescription" 
                    TableName="tblWareHouseNames">
                </asp:LinqDataSource>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="Drp_WareHouseName" 
                    ErrorMessage="انتخاب نام انبار الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_OrderID2" runat="server" CssClass="Label1" 
                    Text="انتخاب شماره سفارش:"></asp:Label>
            </td>
            <td style="text-align: right" colspan="2">
                <asp:GridView ID="Grd_ShomarehSefaresh" runat="server" AllowPaging="True" 
                    AutoGenerateColumns="False" CellPadding="4" CssClass="mGrid" 
                    DataKeyNames="OrderID" DataSourceID="LinqDt_Drp_OrderDetailID" 
                    ForeColor="#333333" GridLines="None" 
                    onselectedindexchanged="Grd_ShomarehSefaresh_SelectedIndexChanged" PageSize="5">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:CommandField HeaderText="انتخاب" ShowSelectButton="True" />
                        <asp:BoundField DataField="OrderID" HeaderText="کد سفارش" ReadOnly="True" 
                            SortExpression="OrderID" />
                        <asp:BoundField DataField="OrderDetailView" HeaderText="جزئیات سفارش" 
                            ReadOnly="True" SortExpression="OrderDetailView" />
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <asp:LinqDataSource ID="LinqDt_Drp_OrderDetailID" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="OrderID desc" 
                    Select="new (OrderID, OrderDetailView)" TableName="xtblOrdersCmbs">
                </asp:LinqDataSource>
            </td>
        </tr>
        <tr>
            <td style="text-align: left" class="style4">
                <asp:Label ID="Lbl_OrderID3" runat="server" CssClass="Label1" 
                    Text="شماره سفارش:"></asp:Label>
            </td>
            <td style="text-align: right" class="style4">
                <asp:TextBox ID="Txt_Code_Sefaresh" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft" Enabled="False" ValidationGroup="11">0</asp:TextBox>
                <asp:Button ID="Btn_CloseOrder" runat="server" onclick="Btn_CloseOrder_Click" 
                    Text="بستن سفارش" ValidationGroup="17" />
            </td>
            <td class="style4">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="Txt_Code_Sefaresh" 
                    ErrorMessage="ورود کد سفارش الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_OrderID0" runat="server" CssClass="Label1" 
                    Text="جزئیات خریداری نشده:"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:DropDownList ID="Drp_OrderDetails" runat="server" 
                    DataSourceID="LinqDt_Drp_OrderDetails" DataTextField="OrderDetailDescription" 
                    DataValueField="OrderDetailID" ValidationGroup="11">
                </asp:DropDownList>
                <asp:LinqDataSource ID="LinqDt_Drp_OrderDetails" runat="server" 
                    ContextTypeName="LSC_WareHouseDataContext" OrderBy="OrderDetailID desc" 
                    Select="new (OrderDetailID, OrderDetailDescription)" 
                    TableName="xtblOrderDetailsDrps" 
                    Where="PurchasedBit == @PurchasedBit &amp;&amp; OrderID == @OrderID">
                    <WhereParameters>
                        <asp:Parameter DefaultValue="false" Name="PurchasedBit" Type="Boolean" />
                        <asp:ControlParameter ControlID="Txt_Code_Sefaresh" Name="OrderID" 
                            PropertyName="Text" Type="Decimal" />
                    </WhereParameters>
                </asp:LinqDataSource>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="Drp_OrderDetails" 
                    ErrorMessage="انتخاب جزئیات سفارش الزامی می باشد" ValidationGroup="11">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                <asp:Label ID="Lbl_OrderID1" runat="server" CssClass="Label1" 
                    Text="هزینه خرید واحد:"></asp:Label>
            </td>
            <td style="text-align: right">
                <asp:TextBox ID="Txt_UnitPrice" runat="server" 
                    CssClass="TextNormalAlignLeftDLeft"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ControlToValidate="Txt_UnitPrice" 
                    ErrorMessage="وارد کردن قیمت واحد کالا الزامی است">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                &nbsp;</td>
            <td>
                <asp:Button ID="Btn_Insert" runat="server" CssClass="ButtonAdd" 
                    onclick="Btn_Insert_Click" Text="درج لیست" ValidationGroup="11" />
                <asp:Button ID="Btn_Save" runat="server" CssClass="ButtonSave" 
                    onclick="Btn_Save_Click" Text="ثبت نهایی" />
            </td>
            <td>
                <asp:Label ID="Lbl_Error" runat="server" CssClass="LabelError"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="text-align: right" colspan="3">
                <uc1:UC_AdminOperatoChecker ID="UC_AdminOperatoChecker1" runat="server" />
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" Width="700px" 
                    ValidationGroup="11" />
            </td>
        </tr>
        <tr>
            <td style="text-align: center" colspan="3">
                <asp:GridView ID="Grd_OrderDetailsM" runat="server" CssClass="mGrid" 
                    AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
                    DataKeyNames="OrderDetailID" PageSize="20" 
                    onselectedindexchanged="Grd_OrderDetailsM_SelectedIndexChanged">
                    <Columns>
                        <asp:CommandField HeaderText="حذف از لیست" SelectText="حذف" 
                            ShowSelectButton="True">
                            <ItemStyle Width="120px" />
                        </asp:CommandField>
                        <asp:TemplateField HeaderText="کد جزئیات سفارش">
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("OrderDetailID") %>'></asp:Label>
                            </ItemTemplate>
                            <ItemStyle Width="120px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="شرح و جزئیات سفارش">
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Eval("OrderDescription") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="قیمت واحد ">
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# Eval("UnitPrice") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="قیمت کل">
                            <ItemTemplate>
                                <asp:Label ID="Label4" runat="server" Text='<%# Eval("TotalPrice") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle ForeColor="#E4E4E4" />
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td style="text-align: left">
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</asp:Content>

