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

<%@ Register Assembly="AjaxControlToolkit" TagPrefix="asp" Namespace="AjaxControlToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript" language="javascript">
        var imageURL = ''
        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;
        }

        function Categoryvalidate() {
            if (document.getElementById("<%=txtCategoryName.ClientID %>").value == "") {
                alert("Enter the CategoryName");
                document.getElementById("<%=txtCategoryName.ClientID %>").focus();
                return false;
            }

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

        //function validate(el) {
        //    var maxfilesize = 200000,  // 200 Kb
        //        filesize = el.files[0].size,

        //    if (filesize > maxfilesize) {
        //        document.getElementById('dvMsg').style.display = "block";
        //        return false;
        //    } else{
        //        document.getElementById('dvMsg').style.display = "none";
        //        return true;
        //    }
        //}

        // Modified belwo Line : 19-08-21  
        // $("body").on("click", "#uploadBTN", function () {




        function loadImage() {
            var clientname = $('#<%=lblclientname.ClientID %>').html();              // Pass the cm_id from Pms Record 
            var branchname = $('#<%=lblstorename.ClientID %>').html();               // Pass the BranchAlias Name 
            //var filename = $("#<%= txtCategoryName.ClientID %>").val();
            //var filename = $("#<%= txtCategoryDescription.ClientID %>").val();
            var filename = $('#<%=hidCategoryNo.ClientID%>').val();

            //var dataUrl = "https://suntoyo-aws-s3.s3.ap-southeast-1.amazonaws.com/" + clientname + "/" + branchname + "/category/jpg/" + filename.toLowerCase().replaceAll(' ', '') + ".jpg";
            //var imgCategory = document.createElement("img");
            //imgCategory.id = "imgCategory";
            //imgCategory.src = dataUrl + "?nocache=" + Math.random();
            //imgCategory.onerror = "this.style.display='none'"
            //imgCategory.style = "width:100px; height:85px; margin-bottom: 20px;";
            //document.getElementById("divImage").appendChild(imgCategory);

            filename = filename.toLowerCase().replaceAll(' ', '')
            $.ajax({
                url: 'https://www.suntoyo.online/api/FileService/GetObject?fileName=' + filename + '.jpg&clientName=' + clientname + '&storeName=' + branchname + '/category',
                type: 'GET',
                mimeType: "multipart/form-data",
                async: true,
                success: function (data) {
                    console.log(data);
                    if (data != "") {
                        var dataUrl = "https://suntoyo-aws-s3.s3.ap-southeast-1.amazonaws.com/" + clientname + "/" + branchname + "/category/jpg/" + filename.toLowerCase().replaceAll(' ', '') + ".jpg";
                        var imgCategory = document.createElement("img");
                        imgCategory.id = "imgCategory";
                        imgCategory.src = dataUrl + "?nocache=" + Math.random();                        
                        imgCategory.style = "width:100px; height:85px; margin-bottom: 10px;";
                        document.getElementById("divImage").appendChild(imgCategory);
                    }
                },
                beforeSend: function (request) {                  
                    request.setRequestHeader("fileName", filename.toLowerCase().replaceAll(' ', ''));
                    request.setRequestHeader("clientName", clientname);
                    request.setRequestHeader("storeName", branchname);
                },
                cache: false,
                contentType: false,
                processData: false
            });



        }

        function uploadClick() {
            
            if ($('#fileUploadnew').val() == "") {
                alert("No file selected!");
                return false;
            }
            //else if ($('#<%=txtCategoryName.ClientID%>').val() == "") {
            //else if ($('#<%=txtCategoryDescription.ClientID%>').val() == "") {
            else if ($('#<%=hidCategoryNo.ClientID%>').val() == "") {              
                alert("Add Category First and Upload Image!");
                return false;
            }

            // This Validation For Image size should not Exceed 200 Kb 
            if (fileUploadnew.files[0].size > 200000) {
                document.getElementById('dvMsg').style.display = "block";
                return false;
            }

            console.log(fileUploadnew.files[0].size);
            var fd = new FormData();
            fd.append("", fileUploadnew.files[0]);

            var clientname = $('#<%=lblclientname.ClientID %>').html();              // Pass the cm_id from Pms Record 
            var branchname = $('#<%=lblstorename.ClientID %>').html();               // Pass the BranchAlias Name 
            //var filename = $("#<%= txtCategoryName.ClientID %>").val();                   //  Pass the Barcode 
            //var filename = $("#<%= txtCategoryDescription.ClientID %>").val();                   //  Pass the Description 
            var filename = $('#<%=hidCategoryNo.ClientID%>').val(); 

            //console.log(clientname);
            //console.log(branchname);
            console.log(filename);

            let imgCategory = document.getElementById('imgCategory')
            if (imgCategory !== null) {
                imgCategory.remove();
            }

            $.ajax({
                xhr: function () {
                    var xhr = new window.XMLHttpRequest();
                    xhr.upload.addEventListener("progress", function (evt) {
                        if (evt.lengthComputable) {
                            var percentComplete = ((evt.loaded / evt.total) * 100);
                            $(".progress-bar").width(percentComplete + '%');
                            $(".progress-bar").html(percentComplete + '%');
                        }
                    }, false);
                    return xhr;
                },
                url: 'https://www.suntoyo.online/api/FileService/Upload',
                type: 'POST',
                mimeType: "multipart/form-data",
                data: fd,
                crossDomain: true,
                async: true,
                success: function (data) {
                    var dataUrl = "https://suntoyo-aws-s3.s3.ap-southeast-1.amazonaws.com/" + clientname + "/" + branchname + "/category/jpg/" + filename.toLowerCase().replaceAll(' ', '') + ".jpg";
                    var imgCategory = document.createElement("img");
                    imgCategory.id = "imgCategory";
                    imgCategory.src = dataUrl + "?nocache=" + Math.random();
                    imgCategory.style = "width:100px; height:85px; margin-bottom: 10px;";
                    imgCategory.alt = "no image";
                    document.getElementById("divImage").appendChild(imgCategory);

                    $('#<%=lbldbpath.ClientID%>').html(data);
                    $("#hdnPath").val(data);
                },
                beforeSend: function (request) {
                    request.setRequestHeader("clientName", clientname);
                    request.setRequestHeader("fileName", filename.replaceAll(' ', ''));
                    request.setRequestHeader("branchName", branchname + "/category");
                    $(".progress-bar").width('0%');
                    $('#uploadStatus').html('<img src="images/loading.gif"/>');
                },
                cache: false,
                contentType: false,
                processData: false
            });
        }

        function DeleteS3Image() {
            var clientname = $('#<%=lblclientname.ClientID %>').html();              // Pass the cm_id from Pms Record 
            var branchname = $('#<%=lblstorename.ClientID %>').html();               // Pass the BranchAlias Name 
            //var filename = $("#<%= txtCategoryName.ClientID %>").val();                   //  Pass the Barcode 
            //var filename = $("#<%= txtCategoryDescription.ClientID %>").val();                   //  Pass the Barcode 
            var filename = $('#<%=hidCategoryNo.ClientID%>').val();

            branchname = branchname + "/category";
            $.ajax({
                xhr: function () {
                    var xhr = new window.XMLHttpRequest();
                    xhr.upload.addEventListener("progress", function (evt) {
                        if (evt.lengthComputable) {
                            var percentComplete = ((evt.loaded / evt.total) * 100);
                            $(".progress-bar").width(percentComplete + '%');
                            $(".progress-bar").html(percentComplete + '%');
                        }
                    }, false);
                    return xhr;
                },

                url: 'https://www.suntoyo.online/api/FileService/Delete?fileName=' + filename.toLowerCase().trim().replaceAll(' ', '') + '.jpg&clientName=' + clientname + '&storeName=' + branchname,
                type: 'POST',
                mimeType: "multipart/form-data",
                //data: fd,
                crossDomain: true,
                success: function (data) {
                    $('#<%=lbldbpath.ClientID%>').html(data);
                    $("#hdnPath").val(data);
                    var imgCategory = document.getElementById("imgCategory");
                    imgCategory.remove();
                },
                beforeSend: function (request) {
                    // request.setRequestHeader("clientName", clientname);
                    // request.setRequestHeader("fileName", filename.replaceAll(' ', ''));
                    // request.setRequestHeader("branchName", branchname + "/category");                 
                },
                cache: false,
                processData: false
            });


        }

        function S3_CallUpdateLogic(_branch, _barcode, _data) {
            var ret;
            $.ajax({
                type: "POST",
                url: "InventoryMaster.aspx/SaveImagetoS3",
                async: false,
                data: "{'branchalias':'" + _branch + "','Barcode':'" + _barcode + "','data':'" + _data + "'}",
                contentType: 'application/json; charset=utf-8',
                dataType: 'json',
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    //alert("Request: " + XMLHttpRequest.toString() + "\n\nStatus: " + textStatus + "\n\nError: " + errorThrown)
                    alert(_barcode);
                },
                success: function (result) {
                    var data = JSON.parse(result.d);
                    if (data) {
                        ret = data.toString();
                    } else {
                        ret = 0;
                    }
                }

            });
        }

    </script>

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

    <script type="text/javascript">

        //Search Condiment
        function CloseModalCategoryList() {
            var modal = document.getElementById("ModaCategoryList");
            modal.style.display = "none";
        }

        function ShowModalCategoryList() {
            var modal = document.getElementById("ModaCategoryList");
            modal.style.display = "block";
        }

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

        function ShowModalCategoryItems() {
            var modal = document.getElementById("ModaCategoryItems");
            modal.style.display = "block";
        }

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

    </script>

    <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>
    <style>
          table, th, td 
          {
            font-size: 13px;
            font-weight: bold;
            width:10%;
           
          }

         .Labels 
         {
           font-size: 10px;
         }

        .alnright 
         {
          text-align: right;
         }

    </style>

   

</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>
                        <%--<asp:Button ID="btnExcel" runat="server" Text="Export" ToolTip="To Export the Report Click Here"  CssClass="btn btn-success btn-xs" BackColor="green" BorderColor="green"  onclick="btnExcel_Click"/>--%>
                        <%--<h5 class="section-title">CATEGORY</h5>--%>

                        <%--Nid added for Navison Import on 10-Oct-2023--%>
                        <div align="left">
                            <asp:Button ID="btnNavImport" runat="server" Text="Navision Import"
                                ToolTip="Click here for Import Inventory details from Navision Server" CssClass="btn btn-success btn-xs"
                                OnClick="btnNavImport_Click"
                                OnClientClick="return confirm('Confirmation: Do you want to Import latest Inventory Information\n from Navision Server? ') ; ShowlblLoading()  " />
                        </div>
                        <%--                       <div align="left">
                            <asp:Label ID ="lblLoading" runat ="server" Text ="Navision Import In Progress..." style="display:none"   > </asp:Label>
                        </div>--%>

                    </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>
                    </td>
                </tr>
            </table>

            <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">
                                <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">CATEGORY</a>
                            </li>
                            <%-- <li class="nav-item">
                                        <a class="nav-link" id="Stock-tab-simple" data-toggle="tab" href="#Stock-simple" role="tab" aria-controls="Stock" aria-selected="false">TAX </a>
                                    </li>--%>

                            <%--<li class="nav-item">
                                        <a class="nav-link" id="contact-tab-simple" data-toggle="tab" href="#contact-simple" role="tab" aria-controls="contact" aria-selected="false">PRINTER</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>
                                    <div class="card">
                                        <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14PX">BASIC &nbsp;&nbsp;
                                             <asp:Button ID="btnAddNew" OnClick="btnAddNew_Click" runat="server" class="btn btn-success"  Text="Add New" />

                                            <button type="button" onclick="ShowModalCategoryItems()" class="btn btn-warning">
                                                Search
                                            </button>

                                            <span >
                                                <asp:Button ID="btnDelete" runat="server" CssClass="btn btn-danger mb-1 float-end" Text="Delete" OnClick="btnDelete_Click"
                                                    OnClientClick="return confirm('Warning: Deleting an existing product barcode\n will affect transaction records if the\n product have been sold before. ');" />
                                            </span>
                                        </h5>

                                        <div class="card-body">
                                            <%--<div class="form-group">
                                                <label for="inputEmail">CategoryNo</label>
                                                <asp:TextBox ID="txtCategoryNos" onkeypress="return isNumberKey(event,this)"  AutoPostBack="true"  OnTextChanged="txtCategoryNos_TextChanged" runat="server" 
                                                placeholder="Search By   Category No" class="form-control"></asp:TextBox>
                                            </div>--%>
                                            <asp:HiddenField ID="hidCategoryNo" runat="server" />
                                            <div class="form-group">
                                                <label for="inputText4" class="col-form-label">Category Name</label>
                                                <asp:TextBox ID="txtCategoryName" runat="server" class="form-control"> </asp:TextBox>
                                            </div>

                                            <div class="form-group">
                                                <label for="inputPassword">Description</label>
                                                <asp:TextBox ID="txtCategoryDescription" runat="server"
                                                    class="form-control"></asp:TextBox>
                                            </div>

                                            <div class="custom-controls-stacked" style="margin-left: -20px;">
                                                <div style="display: none">
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkActiveStatus" runat="server" /><span> Active</span>
                                                    </label>
                                                </div>

                                                <label class="custom-control custom-checkbox">
                                                    <asp:CheckBox ID="chkP" runat="server" AutoPostBack="true" />
                                                    <span>Printer Setting </span>
                                                </label>

                                                <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">
                                                            <asp:FileUpload ID="Fileploadid" class="form-control" runat="server" onchange="return validateFileSize();" Visible="false" />
                                                            <input type="file" id="fileUploadnew" accept=".jpg" onchange='validate(this)' />
                                                            <button id="uploadBTN" type="button" value="Upload" onclick="uploadClick()">Upload</button>
                                                            <br />
                                                            * Only jpg and png Allowed upload
                                                     
                                                            <div class="progress" style="margin: 10px; margin-left: -3px">
                                                                <div class="progress-bar"></div>
                                                            </div>

                                                            <br />
                                                            <asp:Label ID="lblImageError" runat="server" ForeColor="Gray"></asp:Label>
                                                            <div id="dvMsg" style="background-color: Red; color: White; width: 280px; padding: 2px; display: none;">
                                                                Image size Not Exceeds More than 200 KB
                                                            </div>
                                                        </div>
                                                        <%--<div  style="background: url(Request.Form[hdnurl].va); margin-left: 0px; width:100px; height:85px; background-size: cover; background-position: center; background-repeat: no-repeat;">--%>
                                                        <div id="divImage">
                                                            <%-- <img src="url"                                                                
                                                                alt="" 
                                                                id="imgCategory" 
                                                                style=" width:100px; height:85px;margin-bottom:20px">--%>
                                                        </div>
                                                    </div>
                                                    <div class="form-row">
                                                        <button type="button" class="btn btn-danger" onclick="DeleteS3Image()">Delete</button>
                                                    </div>
                                                </div>
                                            </div>

                                            <div class="custom-controls-stacked">
                                                <label class="custom-control custom-checkbox">
                                                    <asp:CheckBox ID="chkT" runat="server" Visible="false" AutoPostBack="true" />
                                                    <span></span>
                                                </label>
                                            </div>
                                        </div>

                                        <%--  <div class="card">--%>

                                        <div class="card">
                                            <h6 class="card-header">TAX</h6>
                                            <div class="card-body">
                                                <div class="custom-controls-stacked">
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkInvandCate" runat="server" Visible="false" />
                                                        <span style="display: none">1: Inventory Flag ; 0:Category Flag</span>
                                                    </label>
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkAlways" runat="server" Visible="false" />
                                                        <span style="display: none">Always : 0</span>
                                                    </label>

                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkTaxRate6" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblATax6" runat="server"></asp:Label>
                                                        </span>
                                                    </label>
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkTaxRate5" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblATax5" runat="server"></asp:Label></span>
                                                    </label>
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkTax4" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblATax4" runat="server"></asp:Label></span>
                                                    </label>
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkTax3" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblATax3" runat="server"></asp:Label></span>
                                                    </label>
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkScvc" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblATax2" runat="server"></asp:Label></span>
                                                    </label>
                                                    <label class="custom-control custom-checkbox">
                                                        <asp:CheckBox ID="chkGstt" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblATax1" runat="server"></asp:Label></span>
                                                    </label>
                                                    <div>
                                                        <asp:Button ID="btnSaveTax" runat="server" class="btn btn-primary" Text="ADDTAX" OnClick="btnSaveTax_Click" Visible="false" />
                                                    </div>

                                                    <asp:HiddenField ID="hidenCategoryTax" runat="server" />
                                                    <asp:Label ID="lblmsgCat_Tax" runat="server" Text="Label" Visible="false"></asp:Label>
                                                </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-header">
                                                                <h6 class="mb-0">COPY TO ALL CATEGORY</h6>
                                                            </div>
                                                            <div class="card-body">
                                                                <div class="table-responsive">
                                                                    <table cellpadding="4">
                                                                        <tr>
                                                                            <td>
                                                                                <div style="display: flex; align-items: center; gap: 5px;">
                                                                                <asp:DropDownList ID="cmbCopytoallTax" AutoPostBack="true" OnSelectedIndexChanged="cmbCopytoallTax_SelectedIndexChanged"  CssClass="custom-select" runat="server" Width="150px" Height="40px">
                                                                                    <asp:ListItem Text="Select" Value="0"></asp:ListItem>
                                                                                    <asp:ListItem Text="AllCategory" Value="1"></asp:ListItem>
                                                                                    <asp:ListItem Text="Custom" Value="2"></asp:ListItem>
                                                                                </asp:DropDownList>
                                                                             
                                                                                <asp:Button ID="btnCopy2Tax" class="btn btn-primary pt-2" runat="server" Text="Apply" OnClick="btnCopy2Tax_Click" />
                                                                                </div>
                                                                            </td>
                                                                            <td></td>
                                                                        </tr>
                                                                    </table>

                                                                    <div class="row">
                                                                        <div class="column">
                                                                            <label for="validationCustom03">
                                                                                <asp:Label ID="lblTaxMessage" runat="server"></asp:Label>
                                                                            </label>
                                                                        </div>
                                                                    </div>


                                                                    <table id="Table1" class="table table-striped table-bordered second" style="width: 100%">
                                                                        <tbody>
                                                                            <caption>
                                                                                <asp:Panel ID="Panel9" runat="server" BackColor="white" Height="200px"
                                                                                    ScrollBars="Auto" Width="320px">
                                                                                    <asp:GridView ID="grdCopyTax" Width="300px" Font-Size="Small" Height="320px" runat="server" AutoGenerateColumns="False"
                                                                                        BackColor="White" DataKeyNames="CategoryID" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                                                                                        CellPadding="3">
                                                                                        <Columns>
                                                                                            <%-- <asp:TemplateField HeaderText="SNo">
                                                                                            <ItemTemplate>
                                                                                            <%#Container.DataItemIndex + 1%>
                                                                                            </ItemTemplate>
                                                                                            </asp:TemplateField>--%>
                                                                                            <asp:TemplateField>
                                                                                                <HeaderTemplate>
                                                                                                    <asp:CheckBox ID="chkAllSelect" runat="server" onclick="CheckAll(this);" />
                                                                                                </HeaderTemplate>
                                                                                                <ItemTemplate>
                                                                                                    <asp:CheckBox ID="chkSelect" runat="server" />
                                                                                                </ItemTemplate>
                                                                                            </asp:TemplateField>
                                                                                            <asp:TemplateField HeaderText="CategoryNo" Visible="false">
                                                                                                <ItemTemplate>
                                                                                                    <asp:Label ID="lblCategoryNo1" runat="server" Text='<%#Eval("CategoryID") %>'></asp:Label>
                                                                                                </ItemTemplate>
                                                                                            </asp:TemplateField>

                                                                                            <asp:TemplateField HeaderText="CategoryName" ItemStyle-Width="80px">
                                                                                                <ItemTemplate>
                                                                                                    <asp:Label ID="lblCategoryName" runat="server" Text='<%#Eval("CategoryName") %>'></asp:Label>
                                                                                                </ItemTemplate>
                                                                                            </asp:TemplateField>
                                                                                        </Columns>
                                                                                        <FooterStyle BackColor="White" ForeColor="#000066" />
                                                                                        <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="White" />
                                                                                        <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>

                                        <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14PX">PRINTER</h5>

                                        <div class="card-body">
                                            <table>
                                                <tbody>
                                                    <tr>
                                                        <td style="width: 0.5%"></td>
                                                        <td style="width: 2%"></td>
                                                    </tr>
                                                </tbody>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkPrinterInven" runat="server" Visible="false" />
                                                        <span style="display: none">1: Inventory Flag ; 0:Category Flag</span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP19" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter19" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP18" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter18" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP17" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter17" runat="server"></asp:Label>

                                                        </span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP16" runat="server" />
                                                        <span>

                                                            <asp:Label ID="lblLPrinter16" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP15" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter15" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP14" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter14" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP13" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter13" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP12" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter12" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP11" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter11" runat="server"></asp:Label>
                                                        </span>
                                                    </td>

                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP10" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter10" runat="server"></asp:Label>

                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">

                                                        <asp:CheckBox ID="chkRP9" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter9" runat="server"></asp:Label></span>
                                                    </td>

                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP8" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter8" runat="server"></asp:Label></span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP7" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter7" runat="server"></asp:Label></span>
                                                    </td>

                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP6" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter6" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP5" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter5" runat="server"></asp:Label>
                                                        </span>
                                                    </td>

                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP4" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter4" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP3" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter3" runat="server"></asp:Label>
                                                        </span>
                                                    </td>

                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:CheckBox ID="chkRP2" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter2" runat="server"></asp:Label>
                                                        </span>
                                                    </td>
                                                    <td style="padding: 5px;">
                                                        <asp:CheckBox ID="chkRP1" runat="server" />
                                                        <span>
                                                            <asp:Label ID="lblLPrinter1" runat="server"></asp:Label>
                                                        </span>
                                                    </td>


                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Button ID="btnSavePrinter" OnClick="btnSavePrinter_Click" runat="server" class="btn btn-primary" Text="ADD PRINTER" Visible="false" />
                                                    </td>
                                                    <td>
                                                        <asp:HiddenField ID="HideCatPrinter" runat="server" />
                                                        <asp:Label ID="lblmsgCate_Printer" runat="server" Text="Label" Visible="false"></asp:Label>
                                                    </td>
                                                </tr>
                                            </table>

                                            <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-header">
                                                            <h6 class="mb-0">COPY TO ALL CATEGORY- PRINTER </h6>
                                                        </div>
                                                        <div class="card-body">
                                                            <div class="row">
                                                                <div class="column">
                                                                    <asp:DropDownList ID="cmbCopytoPrinter" AutoPostBack="true" OnSelectedIndexChanged="cmbCopytoPrinter_SelectedIndexChanged" CssClass="custom-select" runat="server" Width="150px" Height="40px">
                                                                    <asp:ListItem Text="Select" Value="0"></asp:ListItem>
                                                                    <asp:ListItem Text="AllCategory" Value="1"></asp:ListItem>
                                                                    <asp:ListItem Text="Custom" Value="2"></asp:ListItem>
                                                                    </asp:DropDownList>
                                                                    <asp:Button ID="btnCopy2Printer" class="btn btn-primary" runat="server" Text="Apply" OnClick="btnCopy2Printer_Click" />
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="column">
                                                                    <label for="validationCustom03">
                                                                        <asp:Label ID="lblMessage" runat="server"></asp:Label>
                                                                    </label>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <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="Panel10" runat="server" BackColor="white" Height="200px"
                                                                                ScrollBars="Auto" Width="320px">
                                                                                <asp:GridView ID="grdPrinter" Width="300px" Font-Size="Small" Height="320px" runat="server" AutoGenerateColumns="False"
                                                                                    BackColor="White" DataKeyNames="CategoryID" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                                                                                    CellPadding="3">
                                                                                    <Columns>
                                                                                        <%--<asp:TemplateField HeaderText="SNo">
                                                                                            <ItemTemplate>
                                                                                            <%#Container.DataItemIndex + 1%>
                                                                                            </ItemTemplate>
                                                                                            </asp:TemplateField>--%>
                                                                                        <asp:TemplateField>
                                                                                            <HeaderTemplate>
                                                                                                <asp:CheckBox ID="chkAllSelect" runat="server" onclick="CheckAll(this);" />
                                                                                            </HeaderTemplate>
                                                                                            <ItemTemplate>
                                                                                                <asp:CheckBox ID="chkSelect" runat="server" />
                                                                                            </ItemTemplate>
                                                                                        </asp:TemplateField>
                                                                                        <asp:TemplateField HeaderText="CategoryNo" Visible="false">
                                                                                            <ItemTemplate>
                                                                                                <asp:Label ID="lblCategoryNo1" runat="server" Text='<%#Eval("CategoryID") %>'></asp:Label>
                                                                                            </ItemTemplate>
                                                                                        </asp:TemplateField>

                                                                                        <asp:TemplateField HeaderText="CategoryName" ItemStyle-Width="80px">
                                                                                            <ItemTemplate>
                                                                                                <asp:Label ID="lblCategoryName" runat="server" Text='<%#Eval("CategoryName") %>'></asp:Label>
                                                                                            </ItemTemplate>
                                                                                        </asp:TemplateField>
                                                                                    </Columns>
                                                                                    <FooterStyle BackColor="White" ForeColor="#000066" />
                                                                                    <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="White" />
                                                                                    <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>
                                </div>
                            </div>
                            <%--<div class="tab-pane fade" id="Stock-simple" role="tabpanel" aria-labelledby="Stock-tab-simple">                                                              
                                </div>--%>
                            <div align="left">
                                <asp:Button ID="btnSaveCategory" ToolTip="Click to Save Category" OnClick="btnSaveCategory_Click" OnClientClick="return Categoryvalidate()" runat="server" class="btn btn-primary" Text="Save" />
                                <asp:Button ID="btnUpdate" ToolTip=" Click to Update Category" OnClick="btnUpdate_Click" OnClientClick="return Categoryvalidate()" runat="server" class="btn btn-primary" Text="Update" />
                            </div>
                        </div>
                        <br />
                    </div>
                </div>
            </div>

            <div class="modalCss" id="ModaCategoryList">
                <div class="modal-dialogCss">
                    <div class="modal-contentCss" style="width:90%">
                    <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:60%; margin-left: 145px">--%>
                                

                        <div class="card">
                             <h5 class="card-header" style="background-color: #4c4c4c; color: White;">CATEGORY LIST
                             <button type="button" class="close" style="color: White; opacity: 1;" onclick="CloseModal()" data-dismiss="modal">
                                 &times;</button>
                                    </h5>
                                    <div class="card-body">


                                        <div class="table-responsive" style="height: 500px; padding: 0px 20px 0px 20px;">
                                            <table id="example" class="table table-striped table-bordered second" >

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

    <%-- Newly created ...--%>
     <div class="modalCss" id="ModaCategoryItems">
     <div class="modal-dialogCss" style="width:90%;margin-left:125px">
         <%--<div class="modal-contentCss" style="width:90%;">--%>
             <%--  <div class="modal-header">--%>
             
             <div class="modal-body" style="padding: 9px;">

                 <div class="card">
                     <h6 class="card-header" style="background-color: #4c4c4c; color: White;">SEARCH INVENTORY CATEGORIES 
                         <button type="button" class="close" style="color: White; opacity: 1;" onclick="CloseModal5()" data-dismiss="modal">
                          &times;</button></h6>
                     <div class="card-body">

                         
                     <div class="row">
                     <div class="column">
                          <caption>
                          <label for="validationCustom03">
                           
                          </label>
                          
                         
                          </caption>
                     </div>
                     </div>

                   
                    <div class="row">
                        <div class="column">
                          
                        </div>
                    </div>
                   <caption>


                       <table>
                        <tr>
                            <td>
                             Category Name
                            </td>
                        </tr>   
                        <tr>
                            <td>
                            <asp:TextBox ID="txtCateSearch" runat="server" class="form-control" placeholder="Enter Category Name" Width="250px"> </asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                             <asp:Button ID="btnCateSearch" runat="server" class="btn btn-primary"
                              OnClick="btnCateSearch_Click" Text="Apply" />
                            </td>
                        </tr>


                    </table>
                            



                    
                      <table id="Table3" class="table table-striped table-bordered second">
                      <tbody>
                      <caption>
                          
                        
                        <asp:Panel ID="Panel8" runat="server" BackColor="white" Height="550px"
                            ScrollBars="Auto" Width="1640px">
                               <asp:GridView ID="grdCategory" runat="server" AutoGenerateColumns="False"
                                BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                                CellPadding="0" DataKeyNames="CategoryID" Font-Size="13px" Height="300px"
                                OnSelectedIndexChanged="grdCategory_SelectedIndexChanged" Width="520px">
                                <Columns>
                               <%-- <asp:TemplateField HeaderText="SNo">
                               <ItemTemplate>
                               <%#Container.DataItemIndex + 1%>
                               </ItemTemplate>
                               </asp:TemplateField>
                                    --%>
                              <asp:ButtonField CommandName="Select" ControlStyle-Width="35px"  ItemStyle-Width="20px" ItemStyle-ForeColor="Green" Text="Edit" />
                              <asp:TemplateField HeaderText="CategoryNo" Visible="false">
                              <ItemTemplate>
                              <asp:Label ID="lblCategoryNo1" runat="server" Text='<%#Eval("CategoryID") %>'></asp:Label>
                              </ItemTemplate>
                              </asp:TemplateField>
                              <asp:TemplateField HeaderText="CategoryName" ItemStyle-Width="200px">
                              <ItemTemplate>
                              <asp:Label ID="lblCategoryName" runat="server"
                               Text='<%#Eval("CategoryName") %>'></asp:Label>
                               </ItemTemplate>
                               </asp:TemplateField>
                               
                               </Columns>
                               <FooterStyle BackColor="White" ForeColor="#000066" />
                                <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="White" />
                                <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>
                         <br />
                        </asp:Panel>
                         
                       </caption>
                      
                      </tbody>
                          </table>
                     </div>
                     
                </div>
                
             <%-- </div>--%>
             <%--</div>--%>
        </div>
        
         </div>

      </div>







            <div id="s3bucketParameters" runat="server">
                <table style="display: none">
                    <tr>
                        <td>
                            <asp:Label ID="lblclientname" runat="server"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblstorename" runat="server"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lblCategoryName" runat="server"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="lbldbpath" runat="server"></asp:Label>
                            <asp:HiddenField ID="hdnPath" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="hdnurl" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="hdnfileid" runat="server" ClientIDMode="Static" />
                            <asp:HiddenField ID="IsExistImagePath" runat="server" ClientIDMode="Static" />
                        </td>
                    </tr>
                </table>
            </div>
        </ContentTemplate>
        <%--      <Triggers>
            <asp:PostBackTrigger ControlID="btnNavImport" />

        </Triggers>--%>
    </asp:UpdatePanel>


    <asp:UpdateProgress ID="UpdateProgress1" 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 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>
