<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_MU_carts.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_MU_carts" %>

<div class="card text-center mb-2" style="width: 100%;">
    <h5 class="card-header bg-success">CARTS</h5>
    <div class="card-body py-1">
        <div class="row">
            <div class="col-12 px-0">
                <asp:GridView runat="server" ID="grView" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CartID" DataSourceID="ods" CssClass="table table-striped table-sm table-borderless" BorderWidth="0px" OnSelectedIndexChanged="grView_SelectedIndexChanged">
                    <HeaderStyle CssClass="default" />
                    <PagerStyle CssClass="active GridPager" />
                    <PagerSettings Mode="NumericFirstLast" />
                    <SelectedRowStyle CssClass="table-info" />
                    <EmptyDataTemplate>
                        <%: traduci("NoRecord") %>
                    </EmptyDataTemplate>
                    <Columns>
                        <asp:TemplateField HeaderText="Cod" SortExpression="CartDtmx">
                            <ItemTemplate>
                                <asp:Image runat="server" Height='<%# qrSize %>' Visible='<%# hfShowQr.Value.ToLower()=="true" %>' ImageUrl='<%# getImgUrl(Eval("CartDtmx")) %>' />
                                <b>
                                    <asp:Label ID="lblCartIndex" runat="server" Text='<%# Eval("CartIndex","C{0}") %>' CssClass='<%# getCssByRatio(getRatio(Eval("TotItemCart"),getInt(Eval("TotItem")) - getInt(Eval("TotItemBin")))) %>' /></b>
                                <asp:Label ID="lblCartDtmx" runat="server" Visible='<%# hfShowQr.Value.ToLower()=="true" %>' Text='<%# Eval("CartDtmx") %>' CssClass="small" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="D/T" SortExpression="TotItem">
                            <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# $"{Eval("TotItemCart")}/{getInt(Eval("TotItem")) - getInt(Eval("TotItemBin"))}" %>' CssClass='<%# getCssByRatio(getRatio(Eval("TotItemCart"),getInt(Eval("TotItem")) - getInt(Eval("TotItemBin")))) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="%" SortExpression="TotItemLoad">
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# getRatio(Eval("TotItemCart"),getInt(Eval("TotItem"))- getInt(Eval("TotItemBin"))).ToString("P1") %>' CssClass='<%# getCssByRatio(getRatio(Eval("TotItemCart"),getInt(Eval("TotItem")) - getInt(Eval("TotItemBin")))) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField ShowHeader="False">
                            <HeaderTemplate>
                                <div class="text-center">
                                    <asp:LinkButton ID="lbtPrintAll" runat="server" OnClick="lbtPrintAll_Click" CssClass="btn btn-sm btn-primary" ToolTip='<%# traduci("PrintAll") %>' Visible='<%# hfShowPrint.Value.ToLower()=="true" %>'><i class="fa fa-print"></i> <i class="fa fa-plus"></i></asp:LinkButton>
                                </div>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <div class="text-center">
                                    <asp:LinkButton ID="lbtSelect" runat="server" CausesValidation="False" CommandName="Select" CssClass="btn btn-sm btn-info" Visible='<%# hfShowPrint.Value.ToLower()=="true" %>'><i class="fa fa-print" aria-hidden="true"></i></asp:LinkButton>
                                </div>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <asp:ObjectDataSource runat="server" ID="ods" OldValuesParameterFormatString="original_{0}" SelectMethod="getCartByBatch" TypeName="AppData.DataLayer">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="hfBatchID" DefaultValue="0" Name="BatchID" PropertyName="Value" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:HiddenField ID="hfBatchID" runat="server" />
                <asp:HiddenField ID="hfShowQr" runat="server" Value="false" />
                <asp:HiddenField ID="hfQrSize" runat="server" Value="32" />
                <asp:HiddenField ID="hfShowPrint" runat="server" Value="false" />
                <asp:HiddenField ID="hfPrintQueue" runat="server" Value="queueND" />
                <asp:HiddenField ID="hfMachineSel" runat="server" Value="#" />
            </div>
        </div>
    </div>
</div>