<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_listePrelievo.ascx.cs"
    Inherits="GMW_Term.WebUserControls.mod_listePrelievo" %>
<%@ Register Src="mod_periodoAnalisi.ascx" TagName="mod_periodoAnalisi" TagPrefix="uc1" %>
<div id="contenuto" style="text-align: center;">
    <div class="filtro_1" style="white-space: nowrap;">
        <uc1:mod_periodoAnalisi ID="mod_periodoAnalisi1" runat="server" Visible="false" />
    </div>
    <div style="clear: both;" height="0px">
    </div>
    <div id="Button" style="white-space: nowrap;">
        <asp:Button ID="btnLoginPage" runat="server" OnClick="btnLoginPage_Click" CssClass="btnLogout" />
        <asp:Button ID="btnButtonsHome" runat="server" OnClick="btnButtonsHome_Click" CssClass="btnHome" />
    </div>
    <asp:Panel runat="server" ID="pnlMaster" Visible="true">
        <div id="smallGrid">
            <asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
                OnSelectedIndexChanged="grView_SelectedIndexChanged" OnDataBound="grView_DataBound"
                Width="100%" DataKeyNames="CodLista" DataSourceID="ods" OnRowUpdating="grView_RowUpdating"
                Font-Size="Small">
                <RowStyle CssClass="ctrRowStyle" />
                <AlternatingRowStyle CssClass="ctrAltRowStyle" />
                <EditRowStyle CssClass="ctrEditRowStyle" />
                <SelectedRowStyle CssClass="ctrSelRowStyle" />
                <FooterStyle CssClass="ctrFooter" />
                <PagerStyle CssClass="ctrHeaderPagerMini" ForeColor="White" HorizontalAlign="Center" />
                <HeaderStyle CssClass="ctrHeaderPager" ForeColor="White" Font-Bold="True" />
                <EmptyDataRowStyle CssClass="ctrRowStyle" />
                <EmptyDataTemplate>
                    <asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
                </EmptyDataTemplate>
                <Columns>
                    <asp:TemplateField HeaderText="CodLista/Data" SortExpression="CodLista">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkDest" runat="server" CommandName="Update" CommandArgument="ShowDetail"
                                CausesValidation="False" OnClick="lnk_Click">
                                <div>
                                    <div style="float: left; white-space: nowrap; font-size: small;">
                                        <asp:Label ID="lblCodLista" runat="server" Text='<%# Eval("CodLista").ToString() %>' />
                                    </div>
                                </div>
                                <br />
                                <div style="float: left; white-space: nowrap; font-size: xx-small">
                                    <asp:Label ID="lblDataCreaz" runat="server" Text='<%# Eval("DataCreaz","{0:dd/MM HH:mm}") %>' />
                                </div>
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Part/qta" SortExpression="Particolare">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkPart" runat="server" CommandName="Update" CommandArgument="ShowDetail"
                                CausesValidation="False" OnClick="lnk_Click">
                                <div>
                                    <div style="padding-right: 1px; white-space: nowrap;">
                                        <div style="float: left;">
                                            <b>
                                                <asp:Label ID="lblCodParticolare" runat="server" Text='<%# Eval("Particolare") %>' />
                                            </b>
                                        </div>
                                    </div>
                                </div>
                                <br />
                                <div style="float: left;">
                                    <asp:Label ID="lblPrelevati" runat="server" Text='<%# Eval("Prelevato","{0:0}") %>' />
                                    <asp:Label ID="lblTotale" runat="server" Text='<%# Eval("QtaTot","/ {0:0}") %>' />
                                </div>
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="StatoLista" SortExpression="CodStatoLista" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:ImageButton runat="server" ID="imgCodStatoLista" ImageUrl='<%# pathImgStato(Eval("CodStatoLista")) %>'
                                CausesValidation="False" CommandArgument='<%# cmdArgStato(Eval("CodStatoLista")) %>'
                                ToolTip='<%# cmdArgStato(Eval("CodStatoLista")) %>' OnClick="imgAzioneLista_Click"
                                CommandName="Update" Enabled='<%# enabledStato(Eval("CodStatoLista"), Eval("codLista")) %>' />
                            <%--<cc1:ConfirmButtonExtender ID="cbeCambia" runat="server" ConfirmText='<%# traduci(cmdArgStato(Eval("CodStatoLista")))%>'
                                TargetControlID="imgCodStatoLista" />--%>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:Label ID="lblWarning" runat="server" Visible="false" CssClass="erroreMid" />
            <asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="Original_{0}"
                SelectMethod="getByFilt" TypeName="GMW_data.DS_magazzinoTableAdapters.ElencoListePrelievoTableAdapter"
                OnInserting="recuperaFooter" FilterExpression="((CodStatoLista = 1) OR ((CodStatoLista = 2) AND (CodSoggetto = '{0}'))) "
                OnInserted="ods_Updated" OnUpdated="ods_Updated" DeleteMethod="DeleteQuery" OnDeleted="ods_Updated">
                <FilterParameters>
                    <asp:SessionParameter DefaultValue="O" Name="CodSoggetto" SessionField="CodSoggetto" />
                </FilterParameters>
                <DeleteParameters>
                    <asp:Parameter Name="Original_CodLista" Type="String" />
                </DeleteParameters>
                <SelectParameters>
                    <asp:SessionParameter Name="DataFrom" SessionField="_inizio" Type="DateTime" />
                    <asp:SessionParameter Name="DataTo" SessionField="_fine" Type="DateTime" />
                    <asp:Parameter Name="classifArticolo" DefaultValue="*" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </div>
    </asp:Panel>
    <asp:Panel runat="server" ID="pnlDetail" Visible="false">
        <div style="background-color: #ACACAC;">
            <asp:Button ID="btnCloseDet" runat="server" OnClick="btnCloseDet_Click" CssClass="btnHome"
                Visible="false" />
            <asp:Button ID="btnPrendiInCarico" runat="server" OnClick="btnPrendiInCarico_Click"
                CommandArgument="" CssClass="btnPrendiInCarico" Visible='<%# enabledPrendiInCarico() %>' />
            <%--<cc1:ConfirmButtonExtender ID="cbeCambiaStato" runat="server" ConfirmText='<%# traduci(cmdArgStato(Eval("CodStatoLista")))%>'
                TargetControlID="btnPrendiInCarico" />--%>
            <asp:Button runat="server" ID="btnShowPeriodo" OnClick="btnShowPeriodo_Click" CssClass="btnShowPeriodo" />
            <asp:Button ID="btnBarcode" runat="server" OnClick="btnBarcode_Click" CssClass="btnBarcodeLarge" />
        </div>
        <div id="smallGridDetail">
            <asp:GridView ID="grViewDetail" runat="server" AllowPaging="True" AllowSorting="True"
                Width="100%" AutoGenerateColumns="False" OnDataBound="grView_DataBound" DataKeyNames="CodLista,UDC"
                DataSourceID="odsDetail" OnRowUpdating="grViewDetail_RowUpdating" Font-Size="Small">
                <RowStyle CssClass="ctrRowStyle" />
                <AlternatingRowStyle CssClass="ctrAltRowStyle" />
                <EditRowStyle CssClass="ctrEditRowStyle" />
                <SelectedRowStyle CssClass="ctrSelRowStyle" />
                <FooterStyle CssClass="ctrFooter" />
                <PagerStyle CssClass="ctrHeaderPager" ForeColor="White" HorizontalAlign="Center" />
                <HeaderStyle CssClass="ctrHeaderPager" ForeColor="White" Font-Bold="True" />
                <EmptyDataRowStyle CssClass="ctrRowStyle" />
                <Columns>
                    <asp:TemplateField HeaderText="UDC" SortExpression="UDC">
                        <ItemTemplate>
                            <div style="float: left; white-space: nowrap; font-size: 8pt;">
                                <asp:Label ID="lblUDC" runat="server" Text='<%# Eval("UDC","<b>{0}</b>") %>' />
                            </div>
                            <br />
                            <div style="float: left; white-space: nowrap;">
                                <asp:Label ID="lblQta" runat="server" Text='<%# Eval("Qta", "{0:#} pz") %>' />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="CodCella" SortExpression="CodCella">
                        <ItemTemplate>
                            <div style="float: left; white-space: nowrap;">
                                <asp:Label ID="lblCodCella" runat="server" Text='<%# Eval("CodCella","<b>{0}</b>") %>' />
                            </div>
                            <br />
                            <div style="float: left; white-space: nowrap;">
                                <asp:Label ID="lblCodMag" runat="server" Text='<%# Eval("CodMag","({0})") %>' />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CheckBoxField DataField="Prelevato" HeaderText="Prel" SortExpression="Prelevato"
                        ReadOnly="true" />
                    <asp:TemplateField ShowHeader="False">
                        <HeaderTemplate>
                            <asp:Button ID="btnNew" runat="server" OnClick="btnNew_Click" Text='<%# traduci("New") %>'
                                Visible="false" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:ImageButton ID="imgPrelevato" runat="server" CausesValidation="False" CommandName="Update"
                                CommandArgument="ConfermaPrelevato" ToolTip='<%# traduci("EffettuaPrelievo") %>'
                                Visible='<%# prelevaEnabled(Eval("Prelevato"), Eval("UDC")) %>' ImageUrl="~/images/ArrowUpGreen_m.jpg"
                                OnClick="imgPrelevato_Click" />
                            <asp:ImageButton ID="imgAnnullaPrelevato" runat="server" CausesValidation="False"
                                CommandName="Update" CommandArgument="AnnullaPrelevato" ToolTip='<%# traduci("AnnullaPrelievo") %>'
                                Visible='<%# annullaEnabled(Eval("Prelevato")) %>' ImageUrl="~/images/ArrowDownRed_xl.jpg"
                                OnClick="imgAnnullato_Click" />
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:ObjectDataSource ID="odsDetail" runat="server" OldValuesParameterFormatString="Original_{0}"
                SelectMethod="getByCodLista" TypeName="GMW_data.DS_magazzinoTableAdapters.v_righeListePrelievoPosizioneTableAdapter"
                UpdateMethod="updateUDC">
                <UpdateParameters>
                    <asp:Parameter Name="Original_CodLista" Type="String" />
                    <asp:Parameter Name="Original_UDC" Type="String" />
                    <asp:Parameter Name="UDC" Type="String" />
                </UpdateParameters>
                <SelectParameters>
                    <asp:SessionParameter DefaultValue="*" Name="CodLista" SessionField="CodLista_sel"
                        Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </div>
    </asp:Panel>
</div>
