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

<%@ Register Assembly="AjaxControlToolkit" TagPrefix="asp" Namespace="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" language="javascript">
        function AllowOnlyNumeric() {
            // Get the ASCII value of the key that the user entered
            var key = window.event.keyCode;

            // Verify if the key entered was a numeric character (0-9) or a decimal (.)
            if ((key > 47 && key < 58) || key == 46)
            // If it was, then allow the entry to continue
                return;

            else
            // If it was not, then dispose the key and continue with entry
                window.event.returnValue = null;
            alert("Number Only Allowed")
        }



        function isNumberKey(evt, obj) {

            var charCode = (evt.which) ? evt.which : event.keyCode
            var value = obj.value;
            var dotcontains = value.indexOf(".") != -1;
            if (dotcontains)
                if (charCode == 46) return false;
        if (charCode == 46) return true;
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
        return true;
    }

    </script>
    <script type="text/javascript">
        function CallConfirmBox() {
            if (confirm("Confirm Proceed Further?")) {
                //OK – Do your stuff or call any callback method here..
                alert("You pressed OK!");
            } else {
                //CANCEL – Do your stuff or call any callback method here..
                alert("You pressed Cancel!");
            }
        }
       </script>
    
    <script language="javascript" type="text/javascript">

        function validate() {
    
            if (document.getElementById("<%=txtBarcodesearch.ClientID %>").value == "") {
                alert("Enter Barcode");
                document.getElementById("<%=txtBarcodesearch.ClientID %>").focus();
                return false;
            }
            if (document.getElementById("<%=txtDesc.ClientID %>").value == "") {
                alert("Enter Description");
                document.getElementById("<%=txtDesc.ClientID %>").focus();
                return false;
            }
            if (document.getElementById("<%=txtOnHand.ClientID %>").value == "") {
                alert("Enter OnHand");
                document.getElementById("<%=txtOnHand.ClientID %>").focus();
                return false;
            }

            if (document.getElementById("<%=txtCheckqty.ClientID %>").value == "") {
                alert("Enter Check Qty (Min -0)");
                document.getElementById("<%=txtCheckqty.ClientID %>").focus();
                return false;
            }
            return true;
        }
    </script>

      <script language="javascript" type="text/javascript">

          function validateSearch() 
             {

                 if (document.getElementById("<%=txtStkchkSearch.ClientID %>").value == "") 
            {
                alert("Enter StockCheck No ");
                document.getElementById("<%=txtStkchkSearch.ClientID %>").focus();
                return false;
            }
            }
         </script> 


    <!-- Add the library, as explained on http://docs.scandit.com/stable/web/index.html -->
    <script src="https://cdn.jsdelivr.net/npm/scandit-sdk@4.x"></script>
    <%--<style>
        body
        {
            margin: 0;
            padding: 0;
            background-color: black;
            color: white;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: center;
            font-size: 3vh;
            font-family: 'Open Sans' , sans-serif;
            width: 100vw;
            height: 100vh;
        }
        #scandit-barcode-picker
        {
            width: 100%;
            height: 100%;
            max-height: 70vh;
        }
        #scandit-barcode-result
        {
            display: flex;
            justify-content: center;
            align-items: center;
            flex: 1;
            width: 100%;
        }
        button, button:active, button[disabled]:hover
        {
            --webkit-appearance: none;
            border: none;
            border-radius: none;
            outline: none;
            font-size: 0.7em;
            padding: 0.4em 0.6em;
            margin: 20px;
            text-transform: uppercase;
            font-family: 'Open Sans' , sans-serif;
            background: #2ec0cc;
            color: white;
        }
        button:hover
        {
            background: #30d0d8;
        }
        button[disabled]
        {
            opacity: 0.4;
        }
        #continue-scanning-button
        {
            margin-bottom: 10vh;
        }
    </style>--%>

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

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel3" runat="server">
        <ContentTemplate>
            <div class="row">
                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <div class="section-block">
                        <h5 class="section-title">
                            INVENTORY STOCK CHECK</h5>
                    </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 align="right">
                                        <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                            <label for="validationCustom05">
                                                Branch
                                                <asp:Label ID="lblBranchAliasName" runat="server"></asp:Label>
                                            </label>
                                            <asp:DropDownList ID="cmbBranches" onselectedindexchanged="cmbBranches_SelectedIndexChanged" CssClass="custom-select" Width="250px" runat="server"
                                                AutoPostBack="true">
                                            </asp:DropDownList>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="simple-card">
                        <ul class="nav nav-tabs" id="myTab5" role="tablist">
                            <li class="nav-item" runat="server" id="tb1"><a class="nav-link active border-left-0" id="home-tab-simple"
                                data-toggle="tab" href="#home-simple" role="tab" aria-controls="home" aria-selected="true">
                                Stock Check </a></li>
                            <li class="nav-item" runat="server" id="tb2"><a class="nav-link" id="profile-tab-simple" data-toggle="tab"
                                href="#profile-simple" role="tab" aria-controls="profile" aria-selected="false">
                                Check List</a> </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-body border-top">
                                    <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">
                                                            <label for="validationCustom04">
                                                                Barcode
                                                            </label>
                                                            <%--<div id="scandit-barcode-result">
                                                                No codes scanned yet
                                                                <br />
                                                            </div>--%>
                                                              <%--<asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Text="GetData" />--%>
                                                              <asp:TextBox ID="txtBarcodesearch" runat="server" class="form-control" AutoPostBack="True"
                                                                  OnTextChanged="txtBarcodesearch_TextChanged"></asp:TextBox>
                                                                  
                                                            <br />
                                                            <%--<img alt="" style="cursor: pointer; width: 40px; height: 40px" src="IMG/BarCodeScan.png" />--%>
                                                        </div>
                                                        <div>
                                                        </div>
                                                        <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                            <label for="validationCustom04">
                                                                Desc
                                                            </label>
                                                            <asp:TextBox ID="txtDesc" class="form-control" runat="server" AutoPostBack="true"></asp:TextBox>
                                                        </div>
                                                        <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                            <label for="validationCustom04">
                                                                On Hand
                                                            </label>
                                                            <asp:TextBox ID="txtOnHand" class="form-control" runat="server"></asp:TextBox>
                                                        </div>
                                                        <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                            <label for="validationCustom03">
                                                                Check Qty</label>
                                                            <asp:TextBox ID="txtCheckqty" runat="server" onkeypress="return isNumberKey(event,this)"
                                                                class="form-control" ></asp:TextBox>
                                                            <asp:TextBox ID="hdnfldInventoryId" runat="server" Visible="false"></asp:TextBox>
                                                            <%--<asp:HiddenField="hdnfldInventoryId" runat="server" />--%>
                                                        </div>

                                                         <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                            <label for="validationCustom03">
                                                                Stock Check No:</label>
                                                          <asp:TextBox ID="txtSTCNo"  class="form-control" runat="server"></asp:TextBox>    
                                                          <asp:Label ID="lblStockCheckNo" runat="server"></asp:Label>  
                                                        </div>
                                                         <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                            <label for="validationCustom03">ID</label>
                                                               
                                                         <asp:TextBox ID="txtSTCID"   class="form-control" runat="server"></asp:TextBox>
                                                        </div>

                                                       <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                            <label for="validationCustom03">
                                                                UOM</label>
                                                            <asp:TextBox ID="txtUOM" runat="server"  class="form-control" ></asp:TextBox>
                                                         </div>
                                                         </div>

                                                         <asp:Button ID="btnAddToCheckList" runat="server" Text="Add to Checklist" ToolTip="Add to Checklist"
                                                         CssClass="btn btn-primary" OnClick="btnAddToCheckList_Click"   OnClientClick="return validate()"/>
                                                    
                                                </div>

                                            </div>
                                        </div>

                                        
                                    </div>

                                    <div class="table-responsive">
                                        <table id="Table1" class="table table-striped table-bordered second" style="width: 60%">
                                            <tbody>
                                                <caption>
                                                    <asp:GridView ID="grdStockCheck" runat="server" AutoGenerateColumns="False" EmptyDataRowStyle-CssClass="alert-dark"
                                                        Font-Size="11px" HeaderStyle-BackColor="RoyalBlue" EmptyDataText="No Such Record Found ! "
                                                        FooterStyle-BackColor="Green" FooterStyle-ForeColor="white" Width="920px" AllowPaging="true"
                                                        PageSize="500" BackColor="White" AllowSorting="true" BorderColor="#CCCCCC" BorderStyle="None"
                                                        BorderWidth="1px" CellPadding="3" onrowdeleting="grdStockCheck_RowDeleting" OnRowCommand="grdStockCheck_RowCommand">
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Inv.Id" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Left">
                                                                
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblInventoryid" runat="server" Text='<%#Eval("InventoryId") %>'></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                             <asp:TemplateField HeaderText="STCDetailItemID" ItemStyle-Width="180px" ItemStyle-HorizontalAlign="Left"
                                                                Visible="false">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblItemID" runat="server" Text='<%#Eval("StockCheckDetailId") %>'></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Barcode">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblBarCode" runat="server" Text='<%#Eval("BarCode") %>'></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Inv.Name"  ItemStyle-HorizontalAlign="Left">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblInvName" runat="server" Text='<%#Eval("InventoryName") %>'></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="OnHand" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Right">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblonhand" runat="server" Text='<%#Eval("OldQty") %>'></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Check Qty" ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Right">
                                                                <ItemTemplate>
                                                                    <asp:TextBox ID="txtChkQty" Width="50px"  runat="server" Text='<%# Eval("CheckedQty") %>' />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Diff" ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Right">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblDiffs" runat="server" Text='<%# Eval("Diffs") %>' />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <%--<asp:TemplateField HeaderText="Status" ItemStyle-Width="180px" SortExpression="InventoryName"
                                                                ItemStyle-HorizontalAlign="Left">
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblStatus" runat="server" Text='<%#Eval("status") %>'></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Edit" ItemStyle-Width="180px" SortExpression="Description">
                                                                <ItemTemplate>
                                                                    <asp:Button ID="btnEdit" Text="Select" runat="server" CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>--%>
                                                            <%--  <asp:ButtonField Text="Select" CommandName="Select" ItemStyle-Width="150" />--%>

                                                        <%--
                                                        <asp:TemplateField ShowHeader="False">
                                                        <ItemTemplate>
                                                        <asp:ImageButton ID="Button1" runat="server" Width="30px" Height="25px" CausesValidation="False" ImageUrl="~/IMG/Delete/delete.png" CommandArgument='<%# Eval("InventoryId") %>' CommandName="Delete"
                                                        AlternateText="Delete"></asp:ImageButton>
                                                        </ItemTemplate>
                                                        </asp:TemplateField>--%>

                                                        <asp:TemplateField HeaderText="" ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Right"> 
                                                                <ItemTemplate>
                                                                    <asp:Button ID="btnDelete" runat="server" Text="Delete" CommandArgument='<%#((GridViewRow)Container).RowIndex%>' CommandName="Delete"/>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>

                                                        <%-- <asp:CommandField ShowDeleteButton="True"  ButtonType="Button"/>--%>

                                                        </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>
                                                </caption>
                                            </tbody>
                                        </table>
                                    </div>

                                <div class="row">
                              
                                <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                                    <div class="section-block" id="buttons"></div>
                                    <div class="card">
                                       
                                    
                                 
                                      
                                        <div class="card-body">
                                                     <%--Button : Void --%>
                                          <asp:Button ID="btnVoid" runat="server" Text="&nbsp;&nbsp;&nbsp;Void&nbsp;&nbsp;&nbsp;" ToolTip=" Inventory Void" CssClass="btn btn-primary"
                                          OnClientClick="if(!confirm('Are you sure you want Void this?')) return false;" OnClick="btnVoid_Click" />

                                                            
                                                           

                                                     

                                              </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="section-block" id="Div1">
                                       
                                       
                                    </div>
                                    <div class="card">
                                      
                                        <div class="card-body">

                                              <%--Button : Save --%>
                                           <asp:Button ID="btnCheckListSave" runat="server" Text="&nbsp;&nbsp;&nbsp;Save&nbsp;&nbsp;&nbsp;" ToolTip="Save" CssClass="btn btn-primary"
                                           OnClick="btnCheckListSave_Click" OnClientClick="if(!confirm('Are you sure you want Save this?')) return false;"/>
                                        
                                              </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="section-block" id="Div2">
                                       
                                       
                                    </div>
                                    <div class="card">
                                      
                                        <div class="card-body">

                                            <%--Button :Confirm --%>
                                            <asp:Button ID="btnConfirm" runat="server" Text="Confirm" ToolTip="Confirm" CssClass="btn btn-primary"
                                            OnClientClick="if(!confirm('Are you sure you want Confirm this?')) return false;" OnClick="btnConfirm_Click" />





                                             </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="section-block" id="Div3">
                                       
                                       
                                    </div>
                                    <div class="card">
                                      
                                        <div class="card-body">


                                        <%--Button :Clear --%>
                                         <asp:Button ID="btnClearSess" runat="server" Text="&nbsp;&nbsp;&nbsp;Clear&nbsp;&nbsp;" ToolTip="Clear Session Items" CssClass="btn btn-primary"
                                         OnClientClick="if(!confirm('Are you sure you want Clear this?')) return false;" OnClick="btnClearSess_Click" />



                                        

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







                                   </div>
                            </div>
                            <div class="tab-pane fade" id="profile-simple" role="tabpanel" aria-labelledby="profile-tab-simple">
                                <div class="card">
                                    <h5 class="card-header">
                                        Check List Details
                                    </h5>

                                    <div class="card-body border-top">
                                   

                                        <div class="form-row">
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom04"> 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>

                                                </div>

                                                   <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                <label for="validationCustom04">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">
                                                </div>
                                                <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                                  <asp:Button ID="btnSave" runat="server" Text="Apply" ToolTip="Add Items To Inventory Adjust"
                                                  CssClass="btn btn-primary" AutoPostBack="true" OnClick="btnSave_Click" />
                                                </div>

                                          
                                      </div>

                                       <div class="form-row">
                                        <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                        <label for="validationCustom04"> StockCheckNO </label>
                                        <asp:TextBox ID="txtStkchkSearch" class="form-control" runat="server"></asp:TextBox>
                                       </div>
                                                

                                         </div> 
                                         <div class="form-row">      
                                         <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2">
                                         <asp:Button ID="btnStockCheckSearch" runat="server" Text="Search" ToolTip="Click for StockCheck Search"
                                          CssClass="btn btn-primary" AutoPostBack="true"  OnClientClick="retrun validateSearch()"  OnClick="btnStockCheckSearch_Click" />
                                         </div>
                                                 
                                         </div>


                                    <div class="card-body">
                             
                                              <div class="row">
                                            <div class="table-responsive">
                                                            <table id="Table2" class="table table-striped table-bordered second" style="width: 100%">
                                                         

                                                                <table id="example" class="table table-striped table-bordered second" style="width: 100%">
                                                                    <tbody>
                                                                        <caption>
                                                                            <asp:GridView ID="grdChkList" runat="server" AutoGenerateColumns="False" EmptyDataRowStyle-CssClass="alert-dark"
                                                                                Font-Size="11px" HeaderStyle-BackColor="RoyalBlue" EmptyDataText="No Such Record Found ! "
                                                                                FooterStyle-BackColor="Green" FooterStyle-ForeColor="white" Width="900px" AllowPaging="true"
                                                                                PageSize="500" BackColor="White" AllowSorting="true" BorderColor="#CCCCCC" BorderStyle="None"
                                                                                BorderWidth="1px" CellPadding="3"  OnRowCommand="grdChkList_RowCommand">
                                                                                                <Columns>
                                                                <asp:TemplateField HeaderText="ID" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="left"
                                                                    Visible="false">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblSTCPID" runat="server" Text='<%#Eval("STCID") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Date" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="left">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblSTCDate" runat="server" Text='<%#Eval("Transdate") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="S.C No" ItemStyle-Width="5%" SortExpression="BarCode">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblSTCNo" runat="server" Text='<%#Eval("StockCheckNo") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Status" ItemStyle-Width="10%" SortExpression="BarCode">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblSTCStatus" runat="server" Text='<%#Eval("STCSTATUS") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Edit"  SortExpression="BarCode">
                                                                    <ItemTemplate>
                                                                        <%--<asp:Label ID="lblSTCEDIT" runat="server" Text='<%#Eval("Edit") %>'></asp:Label>--%>
                                                                        <%-- <asp:Image ID="Image1" runat="server" Width="20px" Height="20px" ImageUrl="~/IMG/edit.png"/>--%>
                                                                        <asp:ImageButton ID="imgBtnEditSTC" runat="server" ImageUrl="~/IMG/edit.png" Width="20px"
                                                                            Height="20px" CommandArgument='<%#((GridViewRow)Container).RowIndex%>' CommandName="EditSTC" />
                                                                        <%-- <asp:TextBox ID="lblSTCPID1" runat="server"  Text='<%#Eval("STCID") %>'></asp:TextBox>--%>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <%--  <asp:TemplateField HeaderText="Status" ItemStyle-Width="180px" SortExpression="InventoryName"
                                                                                        ItemStyle-HorizontalAlign="Left">
                                                                                        <ItemTemplate>
                                                                                            <asp:Label ID="lblStatus" runat="server" Text='<%#Eval("status") %>'></asp:Label>
                                                                                        </ItemTemplate>
                                                                                    </asp:TemplateField>
                                                                                    <asp:TemplateField HeaderText="Edit" ItemStyle-Width="180px" SortExpression="Description">
                                                                                        <ItemTemplate>
                                                                                            <asp:Button ID="btnEdit" Text="Select" runat="server" CommandName="Select" CommandArgument="<%# Container.DataItemIndex %>" />
                                                                                        </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>
                                                                        </caption>
                                                                    </tbody>
                                                                </table>

                                                            </table>

                                                        </div>
                                            
                                        </div>
                                    </div>
                                </div>   
                                  
                                       
                            </div>
                        </div>
                    </div>
                    <br />
                </div>
               </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <!-- Containers for the picker and the results -->
    <%--  <div id="scandit-barcode-picker">
    </div>
    <!-- Button to continue scanning after a barcode was scanned -->
    <button id="continue-scanning-button" onclick="continueScanning()">
        Continue Scanning</button>
    <script>
        // Helper function called when the "Continue Scanning" button is clicked
        function continueScanning() {
            if (picker) {
                continueButton.disabled = true;

                // Resume scanning
                picker.resumeScanning();
            }
        }

        // Configure the library and activate it with a license key
        const licenseKey = "ARe9nhdHCfLKF5owsDj9ylkNWb7AJJD2LUFzivYq2FEqaI+mFHBZCEptmigBRuBIjE8f+6Fo3ATeaK9VsloncXdkbw6aff0lhm/vkhJnuDeiRfJIQw/jBgkV+QAzilfqvmWwGRJoTZtVWEULI++lFIbgsBMMEQvNZAdgF9AdroSvMYHzZANQ1uKdblV+xES24Tm/C71PDHobG3bsd5orK9XJPjE6ni7A8kCZE7/oL4uV4HMBKX+rZavs35d4BnDBPA/Ps61SXP9SeFq7vJnLE3DVvIUa5xncED9BDlndaTzUXQfP6HOTcYwpvg5V8HhRMyva8WrdP7npXz5HD6d6fTsqbaSsNJBXzR2j8gFZ1rm5iRKqxZ8T3DdO6HRIdAe8CSeoi6rKuEckzKrop7IC3uJLJX8OhuAaWw6fTrf9c6Wv+0f2J5SKnRy462tBJGfGHmekiANeh5yfi0nNZXXFJcE26lzZYP/CAwJTalhxUG9VYvdBqqjhf/hLOcmSNZC6wGtAjQgqOh19zR9JcvLTnhTYM4XMWBRrB84lMGes5PypRjlqoHUjVeQn3o0HEASr334MWOyqsKVxBGWq9IgsqM1nXpWYbL+IbACr9pOCyHeI6QsJKGI3NJJVf5MEgx3/57lcxNJJVVpSTQDLg76IkYFuNT0r3kMTTMcbjoRmzpktOcu5lUroFQhJ63UtePxKBw32dd/bAG+yKO5x46U4/JswHF2l7gjlq5vqsQ6oCkdAlZUllV0TMGokZuZaRblG+FIR3kHoJ9c2GamPgm8Xb7pZeYfpUO1dTNK2";

        // Configure the engine location, as explained on http://docs.scandit.com/stable/web/index.html
        // const engineLocation = "build"; // the folder containing the engine
        // or, if using a CDN:
        const engineLocation = "https://cdn.jsdelivr.net/npm/scandit-sdk@4.x/build"

        ScanditSDK.configure(licenseKey, { engineLocation: engineLocation });

        const scannerContainer = document.getElementById("scandit-barcode-picker");
        const resultContainer = document.getElementById("scandit-barcode-result");
        const continueButton = document.getElementById("continue-scanning-button");
        continueButton.disabled = true;
        continueButton.hidden = true;
        let picker;

       // document.getElementById("txtBarcodesearch").value = resultContainer;
        
        // Create & start the picker
        ScanditSDK.BarcodePicker.create(scannerContainer, {
                playSoundOnScan: true,
                vibrateOnScan: true
            })
            .then(barcodePicker => {
                picker = barcodePicker;
                // Create the settings object to be applied to the scanner
                const scanSettings = new ScanditSDK.ScanSettings({
                    enabledSymbologies: ["ean8", "ean13", "upca", "upce", "code128", "code39", "code93",
                        "itf"
                    ],
                    codeDuplicateFilter: 1000
                });
                picker.applyScanSettings(scanSettings);

                // If a barcode is scanned, show it to the user and pause scanning
                // (scanning is resumed when the user clicks "Continue Scanning")
                picker.on("scan", scanResult => {
                    continueButton.hidden = false;
                    continueButton.disabled = false;
                    picker.pauseScanning();                    
                    resultContainer.innerHTML = scanResult.barcodes.reduce((string, barcode) =>
                        string +
                        `${ScanditSDK.Barcode.Symbology.toHumanizedName(barcode.symbology)}: ${barcode.data}<br>`,
                        '');
                     

                });
                picker.on("scanError", error => {
                    console.error(error.message);
                });
                picker.resumeScanning();
            })
            .catch(error => {
                alert(error);
            });
    </script>--%>
</asp:Content>
