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

    <style type="text/css">
        @media only screen and (max-width: 600px)
         {
          div 
           {
           text-align:left;        
           }
         }
      </style>
    <style type="text/css">

        /* Create two equal columns that floats next to each other */
        .columnLeft {
          float: left;
          width: 50%;
          padding-left: 15px;
          height: auto; /* Should be removed. Only for demonstration */

        }

        .columnRight {
          float: left;
          width: 50%;
          padding-right:17px;
          height: auto; /* Should be removed. Only for demonstration */
          text-align:right;
          margin-right:-10px;
        }
        /* Clear floats after the columns */
        .row:after {
          content: "";
          display: table;
          clear: both;
        }

        .hrefCss
        {
            text-decoration: underline;
        }
          </style>
    <style type="text/css">
        .modalCss
        {
            display: none; /* Hidden by default */
            position: fixed; /* Stay in place */
            z-index: 1; /* Sit on top */
            padding-top: 80px; /* Location of the box */
            left: 0;
            top: 0;
            width: 100%; /* Full width */
            height: 100%; /* Full height */
            overflow: auto; /* Enable scroll if needed */
            background-color: rgb(0,0,0); /* Fallback color */
            background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
        }
               
        
        .modal-dialogCss
        {
        }
        
        /* Modal Content */
        .modal-contentCss
        {
            background-color: #fefefe;
            margin: auto;
            /*padding: 20px;*/
           /* border: 1px solid #888;*/
            width: 400px;
            height:820px;
            border-radius: 3px; 
        }
        
        
        /* Create two equal columns that floats next to each other */
        .column
        {
            float: left;
            width: 40%;
            padding: 2px;
            margin-left:7px;
            height: auto; /* Should be removed. Only for demonstration */
        }
        
        /* Clear floats after the columns */
        .row:after
        {
            content: "";
            display: table;
            clear: both;
        }
        
         .ButtonSearch 
            {
                background: #ffc108;
                margin: 0;
                font-family: Circular Std Book;
                font-size: 14px;
                line-height: inherit;
                border-width: thin;
                border-color: #212529;
                border-radius: 2px;
                color: #212529;
                
            }
        
    </style>

    <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;
            _smoz-opacity: 1;
        }
        
        .LoadingDivCss
        {
            margin: 0;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-right: -50%;
            transform: translate(-50%, -50%);
        }
        
        .LoadingImgCss
        {
            height: 100px;
            width: 100px;
        }
    </style>
    <script type="text/javascript">
        function showProgress() {
            var updateProgress = $get("<%= UpdateProgress.ClientID %>");
            updateProgress.style.display = "block";
        }

    </script>
     
    <script type="text/javascript">
     
        //Search Condiment
            
        function ShowPackageModelList()
        {
            var modal = document.getElementById("ModalPackageList");
            modal.style.display = "block";
        }

        function CloseModal()
        {
            var modal = document.getElementById("ModalPackageList");
            modal.style.display = "none";
        }

        //Search PackageItem List nid added on 08-Mar-2023
                 
        function ShowModelPackageItemList() {
            var modal = document.getElementById("ModelPackageItemList");
            modal.style.display = "block";
        }

        function CloseModelPackageItemList() {
            var modal = document.getElementById("ModelPackageItemList");
            modal.style.display = "none";
        }
        
        function CloseModal2() {
            var modal = document.getElementById("ModelPackageItemList");
            modal.style.display = "none";
        }
               
    </script>
    
<script type="text/javascript">

    function validateSearch() {

        if (document.getElementById("<%=txtPISearchVal.ClientID %>").value == "")
        {
            alert("Enter the Search Value");
            document.getElementById("<%=txtPISearchVal.ClientID %>").focus();
            return false;
        }

    }

    function validateSearch5() {

        if (document.getElementById("<%=txtSearchVal.ClientID %>").value == "")
    {
        alert("Enter the Search Value");
            document.getElementById("<%=txtSearchVal.ClientID %>").focus();
            return false;
        }

    }

</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
       <ContentTemplate>


                   <%--<table style="width:100%">
                   <tr>
                   <td>
         
                   </td>
                   <td align="right" style="padding-bottom:2px;">
         
                   <label for="validationCustom05">Branch  </label> 
                    <asp:DropDownList ID="cmbBranches" CssClass="custom-select"  
                    Width="200px" runat="server" AutoPostBack="true" Height="35px" 
                    onselectedindexchanged="cmbBranches_SelectedIndexChanged">
                   </asp:DropDownList>
                       s
                   </td>
                   </tr>
       
                  </table>--%>


          <div class="d-flex justify-content-end align-items-center mb-3">
                <!-- Label -->
                <label for="cmbBranches" class="form-label mb-0 me-2">Branch</label>
                <!-- Optional alias label -->
                <asp:Label ID="lblBranchAliasName" runat="server" CssClass="text-muted me-2" />
                <!-- Dropdown with auto width -->
                <asp:DropDownList ID="cmbBranches" runat="server"
                CssClass="form-select "
                AutoPostBack="true"
                Style="width: 250px;"
                OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged" />
              </div>


 



                <div class="row">
                    <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="simple-card">
                    <ul class="nav nav-tabs" id="myTab5" role="tablist">
                    <li class="nav-item">
                   
                    </li>
                    </ul>
                    <div class="tab-content" id="myTabContent5">
                    <div class="tab-pane fade show active" id="home-simple" role="tabpanel" aria-labelledby="home-tab-simple">
                    

             <div class="card">
                   <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size:14PX"> PACKAGE MASTER &nbsp;&nbsp;
                   <button type="button"  onclick="ShowPackageModelList()" class="btn btn-warning"> 
                   Search
                   </button>
                    
                    </h5>
                       <div class="card-body">
                       <div class="custom-controls-stacked">
                       <div class="form-row">
                       <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                       <label for="validationCustom03">
                       Pck InvID</label>
                       <asp:TextBox ID="txtPInvID" runat="server" onkeypress="return isNumberKey(event,this)"
                       placeholder="" class="form-control" ReadOnly="True"></asp:TextBox>
                       </div>
                       <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                       <label for="validationCustom03">
                       Package Barcode</label>
                       <asp:TextBox ID="txtPBarcode" runat="server" onkeypress="return isNumberKey(event,this)"
                       placeholder="" class="form-control" ReadOnly="True"></asp:TextBox>
                       </div>
                       <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                       <label for="validationCustom03">
                       Inventory Name</label>
                       <asp:TextBox ID="txtPInventoryName" runat="server" onkeypress="return isNumberKey(event,this)"
                        placeholder="" class="form-control" ReadOnly="True"></asp:TextBox>
                       </div>
                       <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                       <label for="validationCustom03">
                       Description
                       </label>
                       <asp:TextBox ID="txtPDescription" runat="server" onkeypress="return isNumberKey(event,this)"
                       placeholder="" class="form-control" ReadOnly="True"></asp:TextBox>
                       </div>

                      <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                       <br />
                       <label for="validationCustom03">
                       Current Package Amount :
                       </label>
                       <asp:Label ID="lblCurrentPackageAmount" runat="server"></asp:Label>
                       </div>
                       <div class="card">
                        <!--Packaged Items GridView under Main Item-->
                        <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">
                        <asp:Label ID="Label2" runat="server">PACKAGE ITEMS</asp:Label>&nbsp;&nbsp;
                        <button type="button"  onclick="ShowModelPackageItemList()" class="btn btn-warning">
                         Search
                        </button>
                        </h5>
                        <div class="card-body">
                        <div class="table-responsive">
                        <table id="Table2" class="table table-striped table-bordered second" style="width: 100%">
                        <tbody>
                        <caption>
                        <asp:Panel ID="Panel3" runat="server" BackColor="white" Height="200px" ScrollBars="Auto"
                        Width="1400px">
                         <asp:GridView ID="GrdPackagedItems" runat="server" AutoGenerateColumns="False" DataKeyNames="PackageID"
                         EmptyDataRowStyle-CssClass="alert-dark" Font-Size="11px" HeaderStyle-BackColor="White"
                         EmptyDataText="No Record Found ! " FooterStyle-BackColor="Green" FooterStyle-ForeColor="white"
                         Width="750px" AllowPaging="true" PageSize="20" BackColor="White" AllowSorting="false"
                         BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                         CellPadding="3" OnSelectedIndexChanged="GrdPackagedItems_OnSelectedIndexChanged" onrowdeleting="GrdPackagedItems_RowDeleting">
                         <Columns>
                         <asp:TemplateField HeaderText="PID" SortExpression="" HeaderStyle-CssClass="text-left"
                         ItemStyle-CssClass="text-left">
                         <ItemTemplate>
                         <asp:Label ID="lblPID" runat="server" Text='<%#Eval("PackageID") %>' Width></asp:Label>
                         </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="InvID" SortExpression="" HeaderStyle-CssClass="text-left"
                         ItemStyle-CssClass="text-left">
                         <ItemTemplate>
                         <asp:Label ID="lblPackageInventoryID" runat="server" Text='<%#Eval("PackageInventoryID") %>'></asp:Label>
                         </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Barcode" SortExpression="" HeaderStyle-CssClass="text-left"
                         ItemStyle-CssClass="text-left">
                         <ItemTemplate>
                         <asp:Label ID="lblBarcode" runat="server" Text='<%#Eval("Barcode") %>'></asp:Label>
                         </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="InvName" SortExpression="" HeaderStyle-CssClass="text-left"
                         ItemStyle-CssClass="text-left">
                         <ItemTemplate>
                         <asp:Label ID="lblInventoryName" runat="server" Text='<%#Eval("InventoryName") %>'></asp:Label>
                         </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Qty" SortExpression="" HeaderStyle-CssClass="text-left"
                         ItemStyle-CssClass="text-left">
                         <ItemTemplate>
                         <asp:Label ID="lblQuantity" runat="server" Text='<%#Eval("Quantity") %>'></asp:Label>
                         </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="Price" SortExpression="" HeaderStyle-CssClass="text-left"
                         ItemStyle-CssClass="text-left">
                         <ItemTemplate>
                         <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price") %>'></asp:Label>
                         </ItemTemplate>
                         </asp:TemplateField>
                         <asp:TemplateField HeaderText="" SortExpression="" HeaderStyle-CssClass="text-left"
                         ItemStyle-CssClass="text-left">
                         <ItemTemplate>
                         <asp:LinkButton ID="lnkDelete" runat="server" Font-Underline="true" ForeColor="Blue"
                         CommandName="Delete" CommandArgument="<%# Container.DataItemIndex %>" OnClientClick=" return ConfirmationMsg('Are you sure you want to delete this Item from the Package?')"
                         CausesValidation="false">Delete</asp:LinkButton>
                         </ItemTemplate>
                         </asp:TemplateField>
                         </Columns>
                        </asp:GridView>
                        </asp:Panel>
                        </caption>
                        </tbody>
                        </table>
                        </div>
                        </div>
                        </div>
                        </div>
                        </div>
                        </div> 
                   </div>
             <%--Nid added for Add new Items for the Package on 10-Mar-2023--%>
             <%--This Div block Hideded because we skipped step on saving data on Temp Table.
                 Added directly to table instead. Karthik modified On 02-02-24 --%>
              <div class="card" style="display:none">
              <h5 class="card-header" style="background-color: #4c4c4c; color: White;">
              <span style="font-size:14px;color:#F8F9FA"> Add New Item</span>&nbsp;&nbsp;
              
              </h5>
              <div class="card-body">
              <div class="table-responsive">
              <table id="Table6" class="table table-striped table-bordered second" style="width:100%">
              <tbody>
              <caption>
              <h6><asp:Label ID="lblAdjustPendingText" runat="server"></asp:Label> </h6>
              <asp:Panel ID="Panel4" runat="server" BackColor="white" Height="150px" ScrollBars="Auto"
              Width="1400px">
              <asp:GridView ID="GrdInvPIList"
              runat="server" showfooter="false"  BorderColor="Transparent" Font-Size="11px"
              DataKeyNames="ItemInvID" AutoGenerateColumns="false" EmptyDataText=" No Package Item Selected ! "
              Width= "600px"  onrowdeleting="GrdInvPIList_RowDeleting" >
              <AlternatingRowStyle CssClass="dataTableAlt" />
              <RowStyle CssClass="dataTable" />
              <Columns>
              <asp:TemplateField HeaderText="SNo" HeaderStyle-HorizontalAlign="Left"  ItemStyle-HorizontalAlign="left" ItemStyle-Width="10%">
              <ItemTemplate> 
              <%--<%#Container.DataItemIndex+1 %>--%>
              <asp:Label ID="lblSNo" runat="server" Text='<%#Eval("SNo")%>'></asp:Label>
              </ItemTemplate>
              </asp:TemplateField>
              <%--<asp:BoundField DataField="InventoryID" HeaderText="InvID"  HeaderStyle-HorizontalAlign="Left"  HtmlEncode="False" ItemStyle-HorizontalAlign="left" ItemStyle-Width="31%"  />--%>
              <asp:TemplateField HeaderText="PackageInvID" HeaderStyle-HorizontalAlign="Left"  ItemStyle-HorizontalAlign="left" ItemStyle-Width="25%" >
              <ItemTemplate> <asp:Label ID="lblPackageInvID" runat="server" Text='<%#Eval("PackageInvID")%>'></asp:Label></ItemTemplate>
              </asp:TemplateField>
              <%--<asp:BoundField DataField="Barcode" HeaderText="Barcode"  HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" HtmlEncode="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="29%" />--%>
              <asp:TemplateField HeaderText="ItemInvID" HeaderStyle-HorizontalAlign="Left" HeaderStyle-CssClass="text-left" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="25%" >
              <ItemTemplate> <asp:Label ID="lblItemInvID" runat="server" Text='<%#Eval("ItemInvID")%>'></asp:Label></ItemTemplate>
              </asp:TemplateField>
              <%--<asp:BoundField DataField="Qty" HeaderText="Qty" HtmlEncode="False" ItemStyle-HorizontalAlign="Right" HeaderStyle-CssClass="text-right" ItemStyle-Width="42%" />--%>
              <asp:TemplateField HeaderText="Qty" ItemStyle-HorizontalAlign="Right" HeaderStyle-CssClass="text-right" ItemStyle-Width="15%" >
              <ItemTemplate> <asp:Label ID="lblQty" runat="server" Text='<%#Eval("Qty")%>'></asp:Label></ItemTemplate>
              </asp:TemplateField>
             <%-- <asp:TemplateField HeaderText="Qty"  HeaderStyle-HorizontalAlign="Center"  ItemStyle-HorizontalAlign="Center" >
              <ItemTemplate>
              <asp:Label ID="lblInvQty" runat="server"  Text='<%#Eval("Qty") %>' ></asp:Label>
              </ItemTemplate>
              </asp:TemplateField>   --%>
              <%--<asp:BoundField DataField="AdjCost" HeaderText="AdjCost" HtmlEncode="False" ItemStyle-HorizontalAlign="Right" HeaderStyle-CssClass="text-right" ItemStyle-Width="42%" />--%>
              <asp:TemplateField HeaderText="Price" ItemStyle-HorizontalAlign="Right" HeaderStyle-CssClass="text-right" ItemStyle-Width="15%" >
              <ItemTemplate> <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price")%>'></asp:Label></ItemTemplate>
              </asp:TemplateField>
              <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Right" HeaderStyle-CssClass="text-right" ItemStyle-Width="2%" >
              <ItemTemplate> <asp:Label ID="lblAction" runat="server" Text='<%#Eval("Action")%>'></asp:Label></ItemTemplate>
              </asp:TemplateField>
              <asp:CommandField ShowDeleteButton="True" DeleteText="Delete"  ControlStyle-ForeColor="Red"   />
              </Columns>
              </asp:GridView>
              </asp:Panel> 
              </caption>
              </tbody>
              </table>
              </div>
              </div>
           
              </div>
              <asp:Button ID="btnAddPackageItem" runat="server" Text="Add New Package Items" class="btn btn-primary" Visible="false"
               OnClick="btnAddPackageItem_Click" OnClientClick="return confirm('Do you want to Add new items into Package?');return false;" />      
          <br /><br />
          <%--Nid added for setting package pricing on 16-Mar-2023--%>
          <div class="card">
              <h5 class="card-header" style="background-color: #4c4c4c; color: White;">
              <span style="font-size:14px;color:#F8F9FA">PACKAGE PRICE </span>&nbsp;&nbsp;
              </h5>
              <div class="card-body">
              <div class="custom-controls-stacked">
              <div class="form-row">
              <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
              <label for="validationCustom03">
              Package Price</label>
              <asp:TextBox ID="txtFinalPackagePrice"  runat="server" onkeypress="return isNumberKey(event,this)"
              placeholder="0.00" class="form-control" ReadOnly="False"></asp:TextBox>
              </div>
              </div>
              </div>
              <div align="left">
              <asp:Button ID="btnSetPackagePrice" runat="server" Text="Set Package Price"  CssClass="btn btn-primary" AutoPostBack="true" onclick="btnSetPackagePrice_Click" OnClientClick="return confirm('Do you want to set this as your Package Price?');return false;" />                 
              </div>
              </div> 
              </div>

              </div>
              </div>
              <br />
             </div>
             </div>
            </div>
             <div class="modalCss" id="ModalPackageList">
                
               
                <div class="modal-body" >
                <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                <div class="card" style="width:90%; height:800px; margin-left:120px">
                <h6 class="card-header" style="background-color: #4c4c4c; color: White;">PRODUCT INVENTORY LIST
                <button type="button" class="close"  style="color:White; opacity:1;" onclick="CloseModal()" data-dismiss="modal">
                 &times;</button>
                 </h6>
                 <div class="card-body">
                 <div class="row">
                 <div class="column">
                 <label for="validationCustom03">
                 Search Type
                 </label>
                 <asp:DropDownList ID="cmbSearch" CssClass="form-select w-25"  OnSelectedIndexChanged="cmbSearch_SelectedIndexChanged" 
                 runat="server" AutoPostBack="true">
                 <asp:ListItem Value="0" Text="Select"></asp:ListItem>
                 <asp:ListItem Value="1" Text="Inventory Id"></asp:ListItem>
                 <asp:ListItem Value="2" Text="Barcode"></asp:ListItem>
                 <asp:ListItem Value="3" Text="Inventory Name"></asp:ListItem>
                 <asp:ListItem Value="4" Text="Description"></asp:ListItem>
                 <asp:ListItem Value="5" Text="Category Type"></asp:ListItem>
                 </asp:DropDownList>   
                 </div>

               <div class="column">
               <label for="validationCustom03">
               Enter Description
               </label>
               <asp:TextBox ID="txtSearchVal" class="form-control w-25"  Width="420px" autocomplete="off"   runat="server" OnTextChanged="txtSearchVal_TextChanged"></asp:TextBox>
               </div>
               </div>
               <div class="row">
               <div class="column">
               <asp:CheckBox ID="chkActiveonly" runat="server" Checked="true" />
               <span>Active Only</span>
               </div>
               </div>
               <div class="row">
               <div class="column">
               <asp:Button ID="btnSearch" runat="server" Text="Apply" CssClass="btn btn-primary" OnClientClick="validateSearch5()"  OnClick="btnSearch_Click"/>
               <asp:Button ID="btnPackageSearchClear" runat="server" Text="Clear" CssClass="btn btn-warning" OnClick="btnPackageSearchClear_Click"  />
               
               </div>
               </div>
               <div class="row">
               <div class="table-responsive" style="height: 500px;padding: 0px 20px 0px 20px;">
               <label for="validationCustom03">
               Search Result:
               </label>
               <table id="Table3" class="table table-striped table-bordered second">
               <tbody>
               <caption>
               <asp:GridView ID="grdInventory" runat="server"  EmptyDataRowStyle-CssClass="alert-dark"
               Font-Size="11px" HeaderStyle-BackColor="RoyalBlue" EmptyDataText="No Record Found ! "
               DataKeyNames="InventoryID" FooterStyle-BackColor="Green" FooterStyle-ForeColor="white"
               Width="1100px" AllowPaging="true" PageSize="5000"
               BackColor="White" AllowSorting="false" BorderColor="#CCCCCC" s
               BorderStyle="None" BorderWidth="1px" CellPadding="3"  OnSelectedIndexChanged="OnSelectedIndexChanged">
               <Columns>
              <asp:TemplateField>
               <ItemTemplate>
               <asp:LinkButton ID="imgbtn1" runat="server" Font-Underline="true" ForeColor="Blue" 
               CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" CausesValidation="false">Edit</asp:LinkButton>
               </ItemTemplate>
               </asp:TemplateField>
               <asp:TemplateField HeaderText="InvenID" SortExpression="InventoryId" ItemStyle-HorizontalAlign="Center">
               <ItemTemplate>
               <asp:Label ID="lblInventoryID" runat="server" Text='<%#Eval("InventoryID") %>'></asp:Label>
               </ItemTemplate>
               </asp:TemplateField>
               <asp:TemplateField HeaderText="Barcode" ItemStyle-Width="80px" SortExpression="BarCode">
               <ItemTemplate>
               <asp:Label ID="lblBarCode" runat="server" Text='<%#Eval("BarCode") %>'></asp:Label>
               </ItemTemplate>
               </asp:TemplateField>
               <asp:TemplateField HeaderText="Inv.Name" ItemStyle-Width="180px" SortExpression="InventoryName"
                ItemStyle-HorizontalAlign="Left">
                <ItemTemplate>
                <asp:Label ID="lblInventoryName" runat="server" Text='<%#Eval("InventoryName") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Description" ItemStyle-Width="180px" SortExpression="Description">
                <ItemTemplate>
                <asp:Label ID="lblDescription" runat="server" Text='<%#Eval("Description") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="CategoryName" ItemStyle-Width="180px" SortExpression="CategoryName">
                <ItemTemplate>
                <asp:Label ID="lblCategoryName" runat="server" Text='<%#Eval("CategoryName") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Price" SortExpression="Price" HeaderStyle-HorizontalAlign="Right"
                ItemStyle-HorizontalAlign="Right">
                <ItemTemplate>
                <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price" ,"{0:F2}") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Price2" SortExpression="Price2" HeaderStyle-HorizontalAlign="Right"
                ItemStyle-HorizontalAlign="Right">
                <ItemTemplate>
                <asp:Label ID="lblPrice2" runat="server" Text='<%#Eval("Price2" ,"{0:F2}") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Price3" SortExpression="Price3" HeaderStyle-HorizontalAlign="Right"
                ItemStyle-HorizontalAlign="Right">
                <ItemTemplate>
                <asp:Label ID="lblPrice3" runat="server" Text='<%#Eval("Price3" ,"{0:F2}") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Price4" SortExpression="Price4" HeaderStyle-HorizontalAlign="Right"
                ItemStyle-HorizontalAlign="Right">
                <ItemTemplate>
                <asp:Label ID="lblPrice4" runat="server" Text='<%#Eval("Price4" ,"{0:F2}") %>'></asp:Label>
                </ItemTemplate>
                </asp:TemplateField>
                <asp:ButtonField Text="Select" CommandName="Select" ItemStyle-Width="150" Visible="false" />
                </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:GridView ID="GridView1" runat="server" AllowPaging="true" Visible="false">
                </asp:GridView>
                </caption>
                </tbody>
                </table>
                </div>
                </div>
                </div>
                </div>
                </div>
                </div>
                </div>
             
                
             </div> 
             <%--nid added for package item search on 06-Mar-2023--%>  
             <div class="modalCss" id="ModelPackageItemList">
             <div class="modal-dialogCss">
             <div class="modal-contentCss" style="width: 90%">
                       
             
             <div class="modal-body" style="padding:0px;">


                  <div class="card">
                        <h6 class="card-header" style="background-color: #4c4c4c; color: White;">
                               SEARCH INVENTORY ITEMS 
                        <button type="button" class="close"  style="color:White; opacity:1;" onclick="CloseModelPackageItemList()" data-dismiss="modal">&times;</button>
                        </h6>
                        <div class="card-body">
                            <div class="row">
                                <div class="column">
                                 <label for="validationCustom03">
                                 Search Type
                                 </label>

                                              <asp:DropDownList ID="cmbPISearch" CssClass="form-select w-25"  
                                                runat="server" AutoPostBack="true" onselectedindexchanged="cmbPISearch_SelectedIndexChanged"  >
                                                 <asp:ListItem Value="0" Text="Select"></asp:ListItem>

                                                    
                                                    <asp:ListItem Value="1" Text="Inventory ID"></asp:ListItem>
                                                    <asp:ListItem Value="2" Text="Barcode"></asp:ListItem>
                                                    <asp:ListItem  Value="3" Text="Inventory Name"></asp:ListItem>
                                                    <asp:ListItem  Value="4" Text="Category Type"></asp:ListItem>
                                                    <asp:ListItem  Value="5" Text="Group1"></asp:ListItem>
                                                    <asp:ListItem  Value="6" Text="Group2"></asp:ListItem>
                                                    <asp:ListItem  Value="7" Text="Group3"></asp:ListItem>
                                                    <asp:ListItem  Value="8" Text="Group4"></asp:ListItem>
                                                    <asp:ListItem  Value="9" Text="Group5"></asp:ListItem>
                                                    <asp:ListItem  Value="10" Text="Description"></asp:ListItem>
                                                                                              
                                                </asp:DropDownList>

                                 </div>

                                 <div class="column">
                                  <label for="validationCustom03">
                                  Enter Description
                                  </label>
                                  <asp:TextBox ID="txtPISearchVal" OnTextChanged="txtPISearchVal_TextChanged"  autocomplete="off"  class="form-control w-25" runat="server"  ></asp:TextBox>
                                                
                                </div>


                                </div>
                                <div class="row">
                                <div class="column">
                                 <asp:CheckBox ID="chkPIActiveonly" runat="server" Checked="true" />
                                    <span>Active Only</span>
                                    </div>

                                </div>

                               
                               <div class="row">
                                <div class="column">
                                <asp:Button ID="btnPISearch" runat="server" Text="Apply" CssClass="btn btn-primary" OnClientClick="validateSearch()"  OnClick="btnPISearch_Click"/>
                                <asp:Button ID="btnSearchClear" runat="server" Text="Clear" CssClass="btn btn-warning" OnClick="btnSearchClear_Click"  />
                                </div>
                                </div>
                                </div>


                            </div>

                   <div>
                   <div class="table-responsive" style="height: 550px;padding: 0px 20px 0px 10px;">
                   <label for="validationCustom03">
                   Search Result:
                   </label>
                   <table id="Table5" class="table table-striped table-bordered second">
                   <tbody>
                   <caption>
                   <asp:Panel ID="Panel1" runat="server" BackColor="white" Height="400px" ScrollBars="Auto"
                     Width="1680px">              
                     <asp:GridView ID="grdPIInventoryView" runat="server" AutoGenerateColumns="False"  EmptyDataRowStyle-CssClass="alert-dark"
                    Font-Size="11px" HeaderStyle-BackColor="RoyalBlue" EmptyDataText="No Record Found ! " 
                    DataKeyNames="InventoryID" FooterStyle-BackColor="Green" FooterStyle-ForeColor="white" 
                    Width="1600px" Height="80px"  AllowPaging="true" PageSize="5000"
                    BackColor="White" AllowSorting="false" OnSorting="OnSorting"
                    BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                    OnSelectedIndexChanged="grdPIInventoryView_SelectedIndexChanged" onpageindexchanging="grdPIInventoryView_PageIndexChanging" >
                   
                    <Columns>

                        <%--<asp:TemplateField HeaderText="SNo">
                        <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                        </ItemTemplate>
                        </asp:TemplateField>--%>

                       <%--<asp:TemplateField>
                            <ItemTemplate>
                            <asp:LinkButton ID="imgbtn1" runat="server" Font-Underline="true" ForeColor="Blue"
                            CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" CausesValidation="false">Select</asp:LinkButton>
                            </ItemTemplate>
                          </asp:TemplateField>--%>
                        <asp:TemplateField HeaderText="InvenID" SortExpression="InventoryId" ItemStyle-HorizontalAlign="Center">
                          <ItemTemplate >
                          <asp:Label ID="lblInventoryID"   runat="server" Text='<%#Eval("InventoryID") %>'></asp:Label>
                          </ItemTemplate>
                        </asp:TemplateField>
            
                        <asp:TemplateField HeaderText="Barcode" ItemStyle-Width="80px" SortExpression="BarCode">
                            <ItemTemplate>
                            <asp:Label ID="lblBarCode" runat="server" Text='<%#Eval("BarCode") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>     
      
                        <asp:TemplateField HeaderText="Inv.Name" ItemStyle-Width="180px" SortExpression="InventoryName" ItemStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                            <asp:Label ID="lblInventoryName" runat="server"  Text='<%#Eval("InventoryName") %>' ></asp:Label>
                             </ItemTemplate>
                        </asp:TemplateField>     
                        <asp:TemplateField HeaderText="Description" ItemStyle-Width="280px" SortExpression="Description">
                            <ItemTemplate>
                            <asp:Label ID="lblDescription" runat="server"  Text='<%#Eval("Description") %>' Width="200PX" ></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>     
                        <asp:TemplateField HeaderText="CategoryName" ItemStyle-Width="180px" SortExpression="CategoryName">
                            <ItemTemplate>
                            <asp:Label ID="lblCategoryName" runat="server"  Text='<%#Eval("CategoryName") %>' ></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>     
                        <asp:TemplateField HeaderText="Price"  SortExpression="Price" HeaderStyle-HorizontalAlign="Right"  ItemStyle-HorizontalAlign="Right">
                        <ItemTemplate>
                            <asp:Label ID="lblPrice" runat="server"   Text='<%#Eval("Price" ,"{0:F2}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>     
                        <asp:TemplateField HeaderText="Price2"  SortExpression="Price2" HeaderStyle-HorizontalAlign="Right"  ItemStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                            <asp:Label ID="lblPrice2" runat="server"   Text='<%#Eval("Price2" ,"{0:F2}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField> 
                       
                        <asp:TemplateField HeaderText="Price3"  SortExpression="Price3" HeaderStyle-HorizontalAlign="Right"  ItemStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                            <asp:Label ID="lblPrice3" runat="server"   Text='<%#Eval("Price3" ,"{0:F2}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>    
                    
                        <asp:TemplateField HeaderText="Price4"  SortExpression="Price4" HeaderStyle-HorizontalAlign="Right"  ItemStyle-HorizontalAlign="Right">
                            <ItemTemplate>
                            <asp:Label ID="lblPrice4" runat="server"   Text='<%#Eval("Price4" ,"{0:F2}") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>   

                       <asp:TemplateField HeaderText="Qty">
                           <ItemTemplate>
                           <asp:TextBox ID="txtQty" runat="server" CssClass="textbox"  MaxLength="8" placeholder="0"
                            Width="80px"  ></asp:TextBox>
                           </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 style="margin-left:1450px;">
                 <asp:Button ID="btnSave" runat="server" Text="Confirm Selection"  ToolTip="Add Items To Inventory Package Item List"  CssClass="btn btn-primary" AutoPostBack="true" onclick="btnSave_Click" />                 
                 </div>
                  
                 </div>
                 </div>
                  

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

     </ContentTemplate>
     <Triggers>
     <asp:PostBackTrigger ControlID="btnSave" />
     </Triggers>
     </asp:UpdatePanel>

     <asp:UpdateProgress ID="UpdateProgress" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
        <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" src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
 <script type="text/javascript" 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>
