<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="mod_elencoListePrelievo.ascx.cs" Inherits="GMW.WebUserControls.mod_elencoListePrelievo" %>
<%@ Register Src="mod_viewRigheListaPrelievo.ascx" TagName="mod_viewRigheListaPrelievo" TagPrefix="uc1" %>
<%@ Register Src="mod_selPeriodo.ascx" TagName="mod_selPeriodo" TagPrefix="uc2" %>
<%@ Register Src="mod_filtro.ascx" TagName="mod_filtro" TagPrefix="uc3" %>
<%@ Register Src="mod_nuovaListaPrelievo.ascx" TagName="mod_nuovaListaPrelievo" TagPrefix="uc4" %>
<% if (false)
  { %>
<webopt:BundleReference ID="BundleReference1" runat="server" Path="~/Content/css" />
<webopt:BundleReference ID="BundleReference2" runat="server" Path="~/Content/themes/base/css" />
<% } %>

<div class="container-fluid" style="background-color: #cdcdcd; padding-top: 2px; padding-bottom: 2px;">
  <div class="container">
    <div class="row">
      <div class="col-sm-9">
        <uc2:mod_selPeriodo ID="mod_selPeriodo1" runat="server" />
      </div>
      <div class="col-sm-3 text-right">
        <asp:Button runat="server" ID="btnForceReload" OnClick="btnForceReload_Click" CssClass="btn btn-default btn-sm btn-block" />
      </div>
    </div>
    <div class="row">
      <div class="col-sm-4">
        <uc3:mod_filtro ID="mod_filtroStato" runat="server" Oneh_selValore="eh_selectedStato" filterChekText="filtraStatoListe" />
        <asp:ObjectDataSource ID="odsFiltroStati" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData"
          TypeName="GMW_data.DS_UtilityTableAdapters.v_selStatiListeTableAdapter"></asp:ObjectDataSource>
      </div>
      <div class="col-sm-4 text-center">
        <uc3:mod_filtro ID="mod_filtroTipo" runat="server" Oneh_selValore="eh_selectedTipo" filterChekText="filtraTipoListe"
          isChecked="false" />
        <asp:ObjectDataSource ID="odsTipoLista" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData"
          TypeName="GMW_data.DS_UtilityTableAdapters.v_selTipoListaTableAdapter"></asp:ObjectDataSource>
      </div>
      <div class="col-sm-4 text-right">
        <uc3:mod_filtro ID="mod_filtroTipoPart" runat="server" Oneh_selValore="eh_selectedTipoPart" filterChekText="filtraTipoPart" />
        <asp:ObjectDataSource ID="odsTipoPart" runat="server" OldValuesParameterFormatString="Original_{0}" SelectMethod="GetData"
          TypeName="GMW_data.DS_UtilityTableAdapters.v_selTipoPartTableAdapter"></asp:ObjectDataSource>
      </div>
    </div>
  </div>
</div>
<div class="container-fluid table-success" style="padding-top: 2px; padding-bottom: 2px;">
  <div class="container">
    <div class="row">
      <div class="col-sm-9 text-left">
        <asp:Button runat="server" CssClass="btn btn-success btn-sm" ID="btnNewLista" OnClick="btnNewLista_Click" CausesValidation="false" />
        <asp:Button runat="server" CssClass="btn btn-success btn-sm" ID="btnSetDestTipo" OnClick="btnSetDestTipo_Click" CausesValidation="false" />
        <asp:Button runat="server" CssClass="btn btn-success btn-sm" ID="btnSetModeScaricaListeSel" OnClick="btnSetModeScaricaListeSel_Click" CausesValidation="false" />
      </div>
      <div class="col-sm-3 text-right">
        <asp:Panel runat="server" ID="pnlRowNum" CssClass="divDx">
          <div style="float: right;">
            <asp:Label runat="server" ID="lblNumRighe"><%: traduci("righePerPag") %></asp:Label>
            <asp:TextBox ID="txtNumRighe" runat="server" AutoPostBack="True" OnTextChanged="txtNumRighe_TextChanged" Width="3em" />
          </div>
          <div style="float: right;">
            <asp:UpdateProgress ID="updtRicerca" runat="server" DisplayAfter="10" DynamicLayout="true">
              <ProgressTemplate>
                <div id="progress_back">
                </div>
                <div id="progress_top">
                  <asp:Image ID="ProgressBar" ImageUrl="~/images/fbloader.gif" runat="server" />
                </div>
              </ProgressTemplate>
            </asp:UpdateProgress>
          </div>
        </asp:Panel>
      </div>
    </div>
    <div class="row">
      <div class="col-sm-12 text-left">
        <uc4:mod_nuovaListaPrelievo ID="mod_nuovaListaPrelievo1" runat="server" />
        <asp:Panel runat="server" ID="pnlSetDestTipo">
          <asp:DropDownList ID="ddlTipoLista" runat="server" DataSourceID="odsTipoLista" DataTextField="label" DataValueField="value"
            AutoPostBack="True" CssClass="btn btn-default btn-sm">
          </asp:DropDownList>
          <asp:Label ID="lblDestinatario" runat="server" Font-Size="7pt" />
          <asp:DropDownList runat="server" ID="ddlDestin" DataTextField="label" DataValueField="value" CssClass="btn btn-default btn-sm" DataSourceID="odsDestinatario" AutoPostBack="True" />
          <asp:ObjectDataSource ID="odsDestinatario" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getByConditio"
            TypeName="GMW_data.DS_UtilityTableAdapters.v_selDestinatariListePrelievoTableAdapter">
            <SelectParameters>
              <asp:ControlParameter ControlID="ddlTipoLista" Name="conditio" PropertyName="SelectedValue" DefaultValue="*" Type="String" />
            </SelectParameters>
          </asp:ObjectDataSource>
          <asp:Button runat="server" ID="btnUpdateDestTipo" OnClick="btnUpdateDestTipo_Click" CssClass="btn btn-primary btn-sm" />
        </asp:Panel>
        <asp:Panel runat="server" ID="pnlScaricaMultiLDP">
          <asp:Button runat="server" ID="btnScaricaSelLDP" OnClick="btnScaricaSelLDP_Click" CssClass="btn btn-primary btn-sm" />
        </asp:Panel>
      </div>
    </div>
  </div>
</div>
<div class="container" style="padding-top: 2px; padding-bottom: 2px;">
  <div class="row">
    <div class="col-sm-8" style="font-size: 8pt;">
      <asp:Label runat="server" ID="lblErroriLDP" Visible="false" CssClass="erroreBig" />
      <asp:GridView ID="grView" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" OnSelectedIndexChanged="grView_SelectedIndexChanged"
        OnDataBound="grView_DataBound" DataKeyNames="CodLista" DataSourceID="ods" OnRowUpdating="grView_RowUpdating" OnPageIndexChanged="grView_PageIndexChanged"
        OnSorted="grView_Sorted" OnRowEditing="grView_RowEditing" OnRowUpdated="grView_RowUpdated">
        <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" />
        <EmptyDataTemplate>
          <asp:Label runat="server" ID="lblNoRecord" Text='<%# traduci("noRecord") %>' />
        </EmptyDataTemplate>
        <Columns>
          <asp:TemplateField ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
              <asp:CheckBox ID="chkSelect" runat="server" Visible='<%# modDestAndTipo(Eval("CodStatoLista")) %>' />
            </ItemTemplate>
            <HeaderTemplate>
              <asp:CheckBox ID="btnSelAll" runat="server" Checked="false" ToolTip='<%# traduci("btnSelAll") %>' OnCheckedChanged="btnSelAll_Click"
                CssClass="ctrHeaderPager" AutoPostBack="true" />
            </HeaderTemplate>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField ShowHeader="False" ItemStyle-HorizontalAlign="Center">
            <HeaderTemplate>
              <asp:LinkButton ID="lbtReset" runat="server" OnClick="btnReset_Click" CssClass="btn btn-default btn-sm" Visible="true"><i class="fa fa-refresh"></i> <%: traduci("Reset") %></asp:LinkButton>
            </HeaderTemplate>
            <ItemTemplate>
              <asp:ImageButton ID="imgSelect" runat="server" CausesValidation="False" CommandName="Select" ToolTip='<%# traduci("Select") %>'
                ImageUrl="~/images/view_m.png" />
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Destinatario" SortExpression="DestinatarioDescrizione">
            <ItemTemplate>
              <div style="padding: 2px;">
                <div style="float: left;">
                  <asp:Image runat="server" ID="imgCodTipoLista" ImageUrl='<%# pathImgTipo(Eval("CodTipoLista")) %>' ToolTip='<%# tooltipTipo(Eval("CodTipoLista")) %>' />
                </div>
                <div style="float: left;">
                  <asp:Label ID="lblDestinatario" runat="server" Text='<%# Eval("Destinatario","[{0}]") %>' />
                  <asp:Label ID="lblDestinatarioDescrizione" runat="server" Text='<%# Eval("DestinatarioDescrizione"," - {0}") %>' />
                </div>
              </div>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="CodLista" SortExpression="CodLista">
            <ItemTemplate>
              <div>
                <asp:Label ID="lblCodLista" runat="server" Text='<%# Eval("CodLista") %>' />
                <div style="font-size: smaller;">
                  <asp:Label ID="lblDataCreaz" runat="server" Text='<%# Eval("DataCreaz","{0:dd/MM/yyyy HH:mm}") %>' />
                </div>
              </div>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Particolare" SortExpression="Particolare">
            <ItemTemplate>
              <div>
                <asp:Label ID="lblParticolare" runat="server" Text='<%# Eval("Particolare") %>' />
              </div>
              <div style="float: right; font-weight: bold;">
                <asp:Label ID="lblPrelevati" runat="server" Text='<%# Eval("Prelevato","{0:0}") %>' />
                <asp:Label ID="lblTotale" runat="server" Text='<%# Eval("QtaTot","/ {0:0}") %>' />
              </div>
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderText="Stato" SortExpression="CodStatoLista" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
              <asp:Image runat="server" ID="imgCodStatoLista" ImageUrl='<%# pathImgStato(Eval("CodStatoLista")) %>' ToolTip='<%# tooltipStato(Eval("CodStatoLista")) %>' />
            </ItemTemplate>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
            <HeaderTemplate>
              <asp:Label runat="server" ID="lblAttiva" Text="[ A ]" ToolTip='<%# traduci("AttivaListaPrelievo") %>' />
            </HeaderTemplate>
            <ItemTemplate>
              <asp:ImageButton ID="imgAttivaListaPrelievo" runat="server" CausesValidation="False" CommandName="Update" CommandArgument="attivaListaPrelievo" ToolTip='<%# traduci("AttivaListaPrelievo") %>' Visible='<%# attivaEnabled(Eval("CodStatoLista")) %>' ImageUrl="~/images/apply_s.png" OnClick="img_Click" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaAttivaLista") %>' />
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
            <HeaderTemplate>
              <asp:Label runat="server" ID="lblInizia" Text="[ I ]" ToolTip='<%# traduci("IniziaListaPrelievo") %>' />
            </HeaderTemplate>
            <ItemTemplate>
              <asp:ImageButton ID="imgIniziaListaPrelievo" runat="server" CausesValidation="False" CommandName="Update" CommandArgument="iniziaListaPrelievo"
                ToolTip='<%# traduci("IniziaListaPrelievo") %>' Visible='<%# iniziaEnabled(Eval("CodStatoLista")) %>' ImageUrl="~/images/apply_s.png"
                Enabled="true" OnClick="img_Click" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaIniziaLista") %>' />
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
            <HeaderTemplate>
              <asp:Label runat="server" ID="lblCompleta" Text="[ C ]" ToolTip='<%# traduci("CompletaListaPrelievo") %>' />
            </HeaderTemplate>
            <ItemTemplate>
              <asp:ImageButton ID="imgCompletaListaPrelievo" runat="server" CausesValidation="False" CommandName="Update" CommandArgument="completaListaPrelievo"
                ToolTip='<%# traduciCodSogg(Eval("CodSoggetto"), traduci("InCaricoA")) %>' Visible='<%# completaEnabled(Eval("CodStatoLista")) %>'
                ImageUrl="~/images/apply_s.png" Enabled="true" OnClick="img_Click" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaCompletaLista") %>' />
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
            <HeaderTemplate>
              <asp:Label runat="server" ID="lblScarica" Text="[ S ]" ToolTip='<%# traduci("ScaricaListaPrelievo") %>' />
            </HeaderTemplate>
            <ItemTemplate>
              <asp:ImageButton ID="imgScaricaListaPrelievo" runat="server" CausesValidation="False" CommandName="Update" CommandArgument="scaricaListaPrelievo"
                Visible='<%# ScaricaEnabled(Eval("CodStatoLista"), Eval("CodTipoLista")) %>' ToolTip='<%# traduciCodSogg(Eval("CodSoggetto"), traduci("ScaricaListaPrelievoCompletataDa")) %>'
                ImageUrl="~/images/apply_s.png" OnClick="img_Click" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaScaricaLista") %>' />
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
              <asp:ImageButton ID="imgDelete" runat="server" CausesValidation="False" CommandName="Delete" CommandArgument='<%# Eval("CodStatoLista") %>'
                ToolTip='<%# traduci("Delete") %>' Visible='<%# delEnabled(Eval("CodStatoLista")) %>' ImageUrl="~/images/elimina_m.png" OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaDel") %>' />
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
          <asp:TemplateField>
            <ItemTemplate>
              <asp:HyperLink runat="server" ID="lnkShow" ImageUrl="~/images/print_s.png" NavigateUrl='<%# formattaUrlReport(Eval("CodLista")) %>'
                Target="_blank" ToolTip="Stampa" />
            </ItemTemplate>
          </asp:TemplateField>
          <asp:TemplateField HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
            <HeaderTemplate>
              <asp:Label runat="server" ID="lblReset" Text="X" ToolTip='<%# traduci("ResetListaPrelievo") %>' />
            </HeaderTemplate>
            <ItemTemplate>
              <asp:ImageButton ID="imgResetListaPrelievo" runat="server" CausesValidation="False" CommandName="Update" CommandArgument="resetListaPrelievo"
                ToolTip='<%# tooltipReset(Eval("CodTipoLista")) %>' Visible='<%# ResetVisible(Eval("CodLista"), Eval("CodStatoLista")) %>'
                ImageUrl='<%# imgReset(Eval("CodTipoLista")) %>' OnClick="img_Click" Enabled='<%# ResetEnabled(Eval("CodLista"), Eval("CodStatoLista"), Eval("CodTipoLista")) %>' OnClientClick='<%# SteamWare.jsUtils.getCBE("confermaResetLista") %>' />
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
          </asp:TemplateField>
        </Columns>
      </asp:GridView>
      <asp:Label ID="lblNumRec" runat="server" CssClass="didascalia" />&nbsp;&nbsp;
            <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="CodLista LIKE '%{0}%' OR Particolare LIKE '%{0}%' OR DescParticolare LIKE '%{0}%'"
        OnInserted="ods_Updated" OnUpdated="ods_Updated" DeleteMethod="DeleteQuery" OnDeleted="ods_Updated">
        <FilterParameters>
          <asp:SessionParameter DefaultValue="*" Name="ricerca" SessionField="valoreCercato" />
        </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:ControlParameter ControlID="mod_filtroTipoPart" Name="classifArticolo" PropertyName="valore" Type="String" />
        </SelectParameters>
      </asp:ObjectDataSource>
    </div>
    <div class="col-sm-4">
      <div class="row">
        <div class="col-sm-6">
          <%: traduci("SlotLPAS") %>: &nbsp;
                <asp:DropDownList runat="server" ID="ddlSlotLPAS">
                  <asp:ListItem Text="1" Selected="True"></asp:ListItem>
                  <asp:ListItem Text="2"></asp:ListItem>
                  <asp:ListItem Text="3"></asp:ListItem>
                  <asp:ListItem Text="4"></asp:ListItem>
                </asp:DropDownList>
        </div>
        <div class="col-sm-6">
          <asp:LinkButton runat="server" ID="lbtShowOnlyUdcNC" CssClass="btn btn-danger btn-block" OnClick="lbtShowOnlyUdcNC_Click" Visible="false">Mostra SOLO NC</asp:LinkButton>
          <asp:LinkButton runat="server" ID="lbtShowAllUdc" CssClass="btn btn-success btn-block" OnClick="lbtShowAllUdc_Click" Visible="false">Mostra TUTTI</asp:LinkButton>
        </div>
      </div>
      <div>
        <asp:LinkButton ID="lbtForzaDL" runat="server" CssClass="btn btn-primary btn-block" Visible="false" OnClick="lbtForzaDL_Click"><i class="fa fa-check"></i> <%: traduci("ForzaDL") %></asp:LinkButton>
        <uc1:mod_viewRigheListaPrelievo ID="mod_viewRigheListaPrelievo1" runat="server" />
      </div>
    </div>
  </div>
</div>

