<%@ Page Title="Condiment Report" Language="C#" MasterPageFile="~/SunMaster.Master"
    AutoEventWireup="true" CodeBehind="CondimentReport.aspx.cs" Inherits="SUNWEB.CondimentReport" %>

<%@ Register Assembly="AjaxControlToolkit" TagPrefix="asp" Namespace="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        @media only screen and (max-width: 600px)
        {
            table, th, td
            {
                font-size: 10px;
                font-weight: bold;
            }
        
            .Labels
            {
                font-size: 10px;
            }
            .alnright
            {
                text-align: right;
            }
        
        }
    </style>
    <style type="text/css">
        .overlay
        {
            position: fixed;
            top: 0px;
            left: 0px;
            z-index: 0;
            height: 100%;
            width: 100%;
            top: 0;
            background-color: White;
            filter: alpha(opacity=60);
            opacity: 0.9;
            -moz-opacity: 1;
        }
        
        .LoadingDivCss
        {
            margin: 0;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-right: -50%;
            transform: translate(-50%, -50%);
        }
        
        .LoadingImgCss
        {
            height: 100px;
            width: 100px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div align="left">
        <asp:Button ID="btnExcel" runat="server" Text="Excel" ToolTip="To Export the Report Click Here" BackColor="Green" BorderColor="Green"
            CssClass="btn btn-success btn-xs" OnClick="btnExcel_Click" />
    </div>
    <asp:UpdatePanel ID="Upanel" runat="server">
        <ContentTemplate>
            <%--  <table style="margin-left: 1%; width: 98%;">
        <tr>
            <td style="font-size: large; width: 50%; font-family: 'Open Sans', sans-serif; font-weight: bolder;">
              CONDIMENT REPORT
               
            </td>
        </tr>
    </table>--%>
            <div class="section-block">
                <h6 class="section-title">
                    SEARCH CONDIMENT REPORT
                </h6>
            </div>
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="form-row">
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <caption>
                                        <label for="validationCustom03">
                                            From 
                                        </label>
                                        <asp:TextBox ID="txtFromDt" class="form-control" runat="server" Font-Size="Small"></asp:TextBox>
                                        <asp:CalendarExtender ID="calFirstDueDate" Format="yyyy-MM-dd" runat="server" TargetControlID="txtFromDt"
                                            PopupPosition="BottomLeft" FirstDayOfWeek="Sunday"></asp:CalendarExtender>
                                    </caption>
                                </div>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <label for="validationCustom03">
                                        To
                                    </label>
                                    <asp:TextBox ID="txtToDt" runat="server" class="form-control"></asp:TextBox>
                                    <asp:CalendarExtender ID="CalendarExtender1" Format="yyyy-MM-dd" runat="server" TargetControlID="txtToDt"
                                        PopupPosition="BottomLeft" FirstDayOfWeek="Sunday"></asp:CalendarExtender>
                                </div>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <label for="validationCustom03">
                                        Branch 
                                        <asp:Label ID="lblBranchAliasName" ForeColor="Blue" runat="server"></asp:Label></label>
                                    <asp:DropDownList ID="cmbBranches" CssClass="custom-select" runat="server" AutoPostBack="true"
                                        OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </div>
                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                    <asp:Button ID="btnGenerate" runat="server" Text="Apply" Class="btn btn-primary"
                                        OnClick="btnGenerate_Click" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <br />
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="card">
                      
                            <h4 class="card-header" id="idGenReport" runat="server">
                                <asp:Label ID="lblMsgTotalSelection" runat="server" CssClass="Labels"> </asp:Label></h4>
                            <%--<asp:Button ID="btnPdf" runat="server" Text="PDF" 
            ToolTip="To Export  the Report Click Here"  CssClass="btn btn-secondary" 
            onclick="btnPdf_Click"/>--%>
                            <%--<asp:Button ID="Button1" runat="server" Text="Excel"    
                 ToolTip="To Export the Report Click Here"  CssClass="btn btn-success active" 
                 onclick="btnExcel_Click"/>--%>
                       
                        <div class="card-body">
                            <div class="table-responsive">
                                <div align="center">
                                    <table id="example4" class="table table-striped table-bordered" style="width: 85%">
                                        <tbody>
                                            <caption>
                                                <div align="center">
                                                    <asp:GridView ID="grdCondiment" runat="server" ShowFooter="true" BorderColor="Transparent"
                                                        DataKeyNames="Condimentname" AutoGenerateColumns="false" OnRowDataBound="gv_RowDataBound"
                                                        Font-Size="13px" Width="80%" AllowPaging="True" PageSize="20000" EmptyDataText="No Data Found !">
                                                        <HeaderStyle CssClass="dataTable" />
                                                        <HeaderStyle BackColor="White" ForeColor="Black" />
                                                        <FooterStyle BackColor="White" ForeColor="Black" />
                                                        <%--<AlternatingRowStyle CssClass="dataTableAlt" />--%>
                                                        <RowStyle CssClass="dataTable" />
                                                        <Columns>
                                                            <asp:TemplateField HeaderStyle-Width="10px">
                                                                <ItemTemplate>
                                                                    <a href="javascript:switchViews('div<%# Eval("Condimentname") %>', 'one');">
                                                                        <img id="imgdiv<%# Eval("Condimentname") %>" alt="Click to show/hide Details" width="25"
                                                                            height="20px" border="0" src="IMG/plus.gif" />
                                                                    </a>
                                                                </ItemTemplate>
                                                                <AlternatingItemTemplate>
                                                                    <a href="javascript:switchViews('div<%# Eval("Condimentname") %>', 'alt');">
                                                                        <img id="imgdiv<%# Eval("Condimentname") %>" alt="Click to show/hide Details" width="25"
                                                                            height="20px" border="0" src="IMG/plus.gif" />
                                                                    </a>
                                                                </AlternatingItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:BoundField DataField="CondimentName" HeaderText="CondimentName" HeaderStyle-HorizontalAlign="Left"
                                                                HtmlEncode="False" ItemStyle-HorizontalAlign="left" ItemStyle-Width="70%" FooterStyle-Font-Bold="true"
                                                                FooterStyle-HorizontalAlign="left" />
                                                            <asp:BoundField DataField="Qty" HeaderText="QUANTITY" HeaderStyle-HorizontalAlign="Right"
                                                                HeaderStyle-CssClass="text-right" HtmlEncode="False" ItemStyle-HorizontalAlign="Right"
                                                                ItemStyle-Width="30%" FooterStyle-Font-Bold="true" FooterStyle-HorizontalAlign="Right" />
                                                            <asp:TemplateField>
                                                                <ItemTemplate>
                                                                    <tr>
                                                                        <td colspan="100%">
                                                                            <div id="div<%# Eval("CondimentName") %>" style="display: none; position: relative;
                                                                                left: 15px;">
                                                                                <asp:GridView ID="GrdDetails" runat="server" Width="95%" AutoGenerateColumns="false"
                                                                                    DataKeyNames="ItemName" EmptyDataText="No Details for this Group">
                                                                                    <HeaderStyle CssClass="dataTable" />
                                                                                    <%--<AlternatingRowStyle CssClass="dataTableAlt" />--%>
                                                                                    <RowStyle CssClass="dataTable" />
                                                                                    <Columns>
                                                                                        <asp:BoundField DataField="ItemName" HeaderText="ItemName" ItemStyle-HorizontalAlign="left"
                                                                                            ItemStyle-Width="70%" />
                                                                                        <asp:BoundField DataField="Qty" HeaderText="QUANTITY" HeaderStyle-HorizontalAlign="Right"
                                                                                            HeaderStyle-CssClass="text-right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="28%" />
                                                                                    </Columns>
                                                                                </asp:GridView>
                                                                            </div>
                                                                        </td>
                                                                    </tr>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <%-- <asp:TemplateField HeaderText="Condiment">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblCondiment" runat="server" Text='<%#Eval("Condimentname") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Name">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblItemName" runat="server" Text='<%#Eval("Name") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Description">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblDesc" runat="server" Text='<%#Eval("InventoryDesc") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="QTY">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lblQTY" runat="server" Text='<%#Eval("Qty") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>--%>
                                                        </Columns>
                                                        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                                                        <RowStyle ForeColor="#000066" />
                                                        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                                                        <SortedAscendingCellStyle BackColor="#F1F1F1" />
                                                        <SortedAscendingHeaderStyle BackColor="#007DBB" />
                                                        <SortedDescendingCellStyle BackColor="#CAC9C9" />
                                                        <SortedDescendingHeaderStyle BackColor="#00547E" />
                                                    </asp:GridView>
                                                </div>
                                            </caption>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="Upanel">
        <ProgressTemplate>
            <div class="overlay">
                <%--  <div style="z-index: 1000; margin-left: 450px; margin-top: 0; opacity: 1; -moz-opacity: 1;">--%>
                <div class="LoadingDivCss">
                    <img alt="" src="IMG/Spinner.gif" class="LoadingImgCss" />
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>


    <script type="text/javascript">
        function switchViews(obj, row) {
            var div = document.getElementById(obj);
            var img = document.getElementById('img' + obj);

            if (div.style.display == "none") {
                div.style.display = "inline";
                img.src = "IMG/minus.gif";
            } else {
                div.style.display = "none";
                img.src = "IMG/plus.gif";
            }
        }
    </script>


  <script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
 <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css?v=1.1" rel="stylesheet" />
  <!-- Bootstrap 5 -->
 <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
 <!-- Optional Bootstrap Icons -->
 <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet" />

</asp:Content>
