<%@ Page Title="ReorderReport Page" Language="C#" MasterPageFile="~/SunMaster.Master" AutoEventWireup="true" CodeBehind="ReorderReport.aspx.cs" Inherits="SUNWEB.ReorderReport" %>
<%@ Register Assembly="AjaxControlToolkit" TagPrefix="asp" Namespace="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

     <script type="text/javascript">
       
         function CheckOne(obj) {
             var grid = obj.parentNode.parentNode.parentNode;
             var inputs = grid.getElementsByTagName("input");
             for (var i = 0; i < inputs.length; i++) {
                 if (inputs[i].type == "checkbox") {
                     if (obj.checked && inputs[i] != obj && inputs[i].checked) {
                         inputs[i].checked = false;
                     }
                 }
             }
         }
      </script>

</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 runat="server" ID="updatepanel1" UpdateMode="Conditional">
  <ContentTemplate>
  <div class="section-block">
     <h6 class="section-title"> REORDER 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 DATE
                                    </label>
                                    <asp:TextBox ID="txtStartDt"  class="form-control" runat="server"  ></asp:TextBox>
                                    <asp:CalendarExtender ID="calFirstDueDate"  Format="yyyy-MM-dd" runat="server"  TargetControlID="txtStartDt"  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 DATE
                                    </label>

                                    <asp:TextBox ID="txtEndDt" class="form-control" runat="server" ></asp:TextBox>
                                <asp:CalendarExtender ID="CalendarExtender1" Format="yyyy-MM-dd" runat="server"  TargetControlID="txtEndDt"  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">
                                    <asp:Label ID="lblBranchAliasName"  ForeColor="Gray" runat="server" Text="Branch Name"></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">
                                <caption>
                                    <label for="validationCustom03">
                                        Select By:
                                    </label>
                                    <asp:DropDownList ID="cmbSelectby" runat="server" CssClass="custom-select" OnSelectedIndexChanged="cmbSelectby_SelectedIndexChanged"
                                        AutoPostBack="true">
                                        <asp:ListItem Text="All Inventory" Value="AInventory"></asp:ListItem>
                                        <asp:ListItem Text="Category" Value="Category"></asp:ListItem>
                                        <asp:ListItem Text="Single Inventory" Value="SInventory"></asp:ListItem>
                                     </asp:DropDownList>
                                </caption>
                            </div>
                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                <label for="validationCustom03" style="font-color: white">
                                    Number
                                </label>
                                <asp:TextBox ID="txtID" class="form-control" runat="server" ReadOnly="false" OnTextChanged="txtID_OnTextChange"></asp:TextBox>
                            </div>
                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                <label for="validationCustom03">
                                    Name</label>
                                <asp:TextBox ID="txtName" class="form-control" runat="server" ReadOnly="false" OnTextChanged="txtName_OnTextChange"></asp:TextBox>
                            </div>

                            <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                <asp:Button ID="btnApplySearch" runat="server" Text="Update" CssClass="btn btn-primary"
                                    OnClick="btnApplySearch_Click" />
                            </div>

                            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                                <div class="card">
                                    <h5 class="card-header" id="idSearch" runat="server" style="background-color: #4c4c4c; color: White;">
                                        <asp:Label ID="lblSearchResult" runat="server" CssClass="Labels"> </asp:Label>
                                        <%--This Code for Image validation   Msg --%>
                                    </h5>
                                    <%-- <div class="card-header">
                                        <div>
                                            <asp:Label ID="lblSearchResult" runat="server" CssClass="Labels"> </asp:Label>
                                        </div>
                                    </div>--%>
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table id="example" class="table table-striped table-bordered second" style="width: 100%">
                                                <tbody>
                                                    <caption>
                                                        <asp:Panel ID="Panel8" runat="server" BackColor="white" Height="180px" ScrollBars="Auto"
                                                            Width="1500px">
                                                            <asp:GridView ID="grv" runat="server" AutoGenerateColumns="False" EmptyDataRowStyle-CssClass="alert-dark"
                                                                Font-Size="11px" HeaderStyle-BackColor="RoyalBlue" EmptyDataText="No Record! "
                                                                DataKeyNames="row1" FooterStyle-BackColor="Green" FooterStyle-ForeColor="white"
                                                                Width="920px" AllowPaging="true" PageSize="150" BackColor="White" AllowSorting="true"
                                                                BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
                                                                <Columns>
                                                                    <asp:TemplateField>
                                                                        <ItemTemplate>
                                                                            <asp:CheckBox ID="chkSelect" runat="server" onclick="CheckOne(this)" OnCheckedChanged="CheckBox_Changed"
                                                                                AutoPostBack="true" />
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Number" ItemStyle-HorizontalAlign="Left" Visible="true">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="lblrow1" runat="server" Text='<%#Eval("row1") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="Name" ItemStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="lblrow2" runat="server" Text='<%#Eval("row2") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                    <asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Left">
                                                                        <ItemTemplate>
                                                                            <asp:Label ID="lblrow3" runat="server" Text='<%#Eval("row3") %>'></asp:Label>
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>
                                                                </Columns>
                                                                <PagerStyle CssClass="gridview"></PagerStyle>
                                                                <FooterStyle BackColor="#006699" ForeColor="White"></FooterStyle>
                                                                <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black"></HeaderStyle>
                                                                <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>
                                                        </asp:Panel>
                                                    </caption>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>                        
  
                    </div>
                                
                </div>
                                 
                
                
                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                    <asp:Button ID="btnGetReports" runat="server" Text="Generate Report"  
                    CssClass="btn btn-primary" onclick="btnGetReports_Click" OnClientClick="return validate()" />
                </div>


                                                        
            </div>
        </div>
    </div>


<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="H1" runat="server" style="background-color: #4c4c4c; color: White;">
        <asp:Label ID="Label1" 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"/>--%>  
        </h4>
 


<div class="card-body">
<div class="table-responsive">
<div align="center" >
<table id="example4" class="table table-striped table-bordered" style="width:100%">
<tbody>
<caption>

<div align="center">

 <asp:GridView ID="GridView1" DataKeyNames="Barcode" 
runat="server" showfooter="true"  BorderColor="Transparent" 
AutoGenerateColumns="False" Font-Size="13px"
OnRowDataBound="GridView1_RowDataBound" Width="100%" EmptyDataText="No Record Found !" 
OnPageIndexChanging="GridView1_PageIndexChanging" AllowPaging="True" PageSize="20" >

    <HeaderStyle CssClass="dataTable" />
    <HeaderStyle BackColor = "White" ForeColor="Black" />
    <footerstyle backcolor= "White" ForeColor="Black" />
    <%--<AlternatingRowStyle CssClass="dataTableAlt" />--%> 
    <RowStyle CssClass="dataTable" />

    <Columns>
 <%--       <asp:TemplateField>
            <ItemTemplate>
            <a href="javascript:switchViews('div<%# Eval("Barcode") %>', 'one');">
            <img id="imgdiv<%# Eval("Barcode") %>" alt="Click to show/hide Details" border="0" src="IMG/plus.gif" />
            </a>
            </ItemTemplate>
            <AlternatingItemTemplate>
            <a href="javascript:switchViews('div<%# Eval("Barcode") %>', 'alt');">
            <img id="imgdiv<%# Eval("Barcode") %>" alt="Click to show/hide Details" border="0" src="IMG/plus.gif" />
            </a>
            </AlternatingItemTemplate>
        </asp:TemplateField>--%>

        <asp:BoundField DataField="InventoryID" HeaderText="InventoryID"  HeaderStyle-HorizontalAlign="Left"  HtmlEncode="False" ItemStyle-HorizontalAlign="left" ItemStyle-Width="12%"  />
        <asp:BoundField DataField="Barcode" HeaderText="Barcode"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="12%" />
        <asp:BoundField DataField="Name" HeaderText="InvName"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="16%" />
        <asp:BoundField DataField="Description" HeaderText="Description"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="12%" />
        <asp:BoundField DataField="CategoryID" HeaderText="CategoryID"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="12%" />
        <asp:BoundField DataField="CategoryName" HeaderText="CategoryName"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="12%" />
        <asp:BoundField DataField="Reorderlevel" HeaderText="ReorderLevel"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="12%" />
        <asp:BoundField DataField="Onhand" HeaderText="StockLevel"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="12%" />
 
    </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>


<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>





   
   <div>
       <h4>&nbsp;<asp:Label ID="lblGreeting" runat="server"></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"/>--%>   
   </div>
     </ContentTemplate>
     </asp:UpdatePanel>

 <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>
