<%@ page language="C#" autoeventwireup="true" inherits="Pages_MaterialManagement_Procurement_StockWacUpdate, App_Web_tvvzwpls" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" uiculture="auto" title="Update WAC Cost" meta:resourcekey="PageResource1" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/AutoComplete/AutoCompleteControl.ascx" TagName="AutoCompleteControl" TagPrefix="acc" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/Common/CommonSearch/AlphabetSearchCommonControl.ascx" TagName="AlphabetSearchCommonControl" TagPrefix="ACS" %>

<%@ Register Src="~/UserControls/Common/CommonSearch/CommonSearch.ascx" TagName="CommonSearchUserControl" TagPrefix="Common" %>
<%@ Register Src="~/UserControls/Common/Stock/StockDetailBoxControl.ascx" TagName="StockControl" TagPrefix="Stock" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="Date" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <style type="text/css">
        .loadingbg {
            background-image: url("/Images/loading_bg.png");
            position: fixed;
            top: 50%;
            left: 50%;
            background-repeat: no-repeat;
            height: 107px;
            text-align: center;
            vertical-align: middle;
            width: 100px;
            z-index: 99;
            background-position: center;
        }

        .loadingtext {
            color: #FFF;
        }
    </style>
    <asp:UpdateProgress ID="MainUpdateProgress" runat="Server" AssociatedUpdatePanelID="HREmployeeMasterSearchUpdatePanel" DisplayAfter="0">
        <ProgressTemplate>
            <div class="loadingbg">
                <img src='<%=ResolveUrl("~/Images/ajax-loader.gif")%>' width="32" height="32" vspace="22" style="margin: 0px;" alt="loading" />
                <div class="loadingtext">
                    Loading...
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="HREmployeeMasterSearchUpdatePanel" runat="server">
        <ContentTemplate>
            <div id="divContentPage" class="divcontentpagemargin">
                <div class="dashBoardLeftCont" valign="top">
                    <div class="himssuHeader3WireBox">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <div class="himsBoxContent">
                                        <div class="leftUlMenu">
                                            <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="160"
                                                Visible="true" runat="server" />
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>

                <Common:CommonSearchUserControl ID="CommonSearchControl" runat="server" Visible="false" />

                <ACS:AlphabetSearchCommonControl ID="AlphabetCommonSearch" runat="server" Visible="false" />
                <div class="whiteboxpaddingleft row">
                    <Stock:StockControl ID="StockUserControl" runat="server" Visible="true" />
                    <div class="card card-box">
                        <div class="himssuHeader2WireBox">
                            <div class="himsBoxHeader">
                                <asp:Panel ID="Panel1" runat="server" meta:resourcekey="Panel1Resource1">
                                    <div class="leftdiv">
                                    </div>
                                    <div class="himsBoxTitle card-head">
                                        <%--<asp:Image ID="Image2" runat="server" class="fLeft" meta:resourcekey="Image2Resource1" />--%>
                                        <div class="himsBoxTitle">
                                            <div class="headerText">
                                                <header>
                                                    <i class="fas fa-list-ul"></i>
                                                    <asp:Label ID="Label1" runat="server" Text="Update WAC Cost"></asp:Label>
                                                </header>
                                            </div>
                                        </div>
                                    </div>
                                </asp:Panel>
                            </div>
                            <div class="himsBoxContent card-body">
                                <asp:Panel ID="DetailPanel" runat="server" meta:resourcekey="DetailPanelResource1">
                                    <div class="contentHolder">
                                        <%--change for 26757 mantis--%>
                                        <cc1:TabContainer ID="UpdateWACCastTabContainer" runat="server" CssClass="ajax__myTab nav nav-tabs tabs-style-iconbox"
                                            meta:resourcekey="UpdateWACCastTabContainerResource1" ActiveTabIndex="0">
                                            <cc1:TabPanel ID="UpdateWACCastDetails" runat="server" HeaderText="Update WAC Cost">
                                                <HeaderTemplate>

                                                    <ul class="nav nav-tabs tabs-style-iconboxinner ajaxnavtabs">
                                                        <li class="fancyTab"><a><i class="fas fa-calendar"></i>&nbsp;Update WAC Cost</a></li>
                                                    </ul>
                                                </HeaderTemplate>
                                                <ContentTemplate>
                                                    <asp:Panel ID="SearchCriteriaPanel" runat="server" meta:resourcekey="SearchCriteriaPanelResource1">
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="lblcode" Text="Item Code" runat="server" SkinID="MandatoryLabel" meta:resourcekey="Label1Resource1"></asp:Label>
                                                            </div>
                                                            <%--  <div class="fLeft">--%>
                                                            <%-- <asp:TextBox ID="txtcode" SkinID="CustomWidthTextBox" runat="server"
                                                                    meta:resourcekey="SearchCodeTextBoxResource1" MaxLength="100"></asp:TextBox>--%>
                                                            <%--mantis Start - 0033706--%>
                                                            <%-- <asp:ImageButton ID="ItemCodeSearchButton" ToolTip="Item Code Search" SkinID="FindImage"
                                                                   OnClick="ItemCodeSearchButton_Click" runat="server" meta:resourcekey="ItemCodeSearchButtonResource" />
                                                                <%--mantis End - 0033706--%>
                                                            <%-- </div>--%>
                                                            <%--mantis Start - 0033706--%>
                                                            <div class="fLeft display-flex">
                                                                <acc:AutoCompleteControl ID="txtcode" runat="server" MinimumPrefixLength="2"
                                                                    IsCacheEnabled="false" ContextKey="Common.ItemTitleAll" AutoPostBack="true"
                                                                    DisplayLoadingStatus="true" FirstRowSelected="false" ValidateOnTextChanged="false" />
                                                                <asp:ImageButton ID="ItemCodeSearchButton" ToolTip="Item Code Search" SkinID="FindImage"
                                                                    OnClick="ItemCodeSearchButton_Click" runat="server" meta:resourcekey="ItemCodeSearchButtonResource1" />
                                                            </div>
                                                            <%--mantis End - 0033706--%>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="lblsublocation" Text="Store Location:" SkinID="MandatoryLabel" runat="server" meta:resourcekey="Label1Resource1"></asp:Label>
                                                            </div>
                                                            <div class="fLeft">
                                                                <asp:DropDownList ID="ddlSublocation" runat="server" CssClass="form-control"></asp:DropDownList>
                                                            </div>
                                                        </div>

                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="lblWeightedAverageCost1" SkinID="MandatoryLabel" Text="Weighted Average New Cost" runat="server" meta:resourcekey="Label1Resource1"></asp:Label>
                                                            </div>
                                                            <div class="fLeft">
                                                                <asp:TextBox ID="txtWeightedAverageNewCost" SkinID="CustomWidthTextBox" runat="server"
                                                                    meta:resourcekey="SearchCodeTextBoxResource1" MaxLength="100"></asp:TextBox>
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3" runat="server" visible="false">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="lblWeightedAverageCost" SkinID="MandatoryLabel" Text="Weighted Average Old Cost" runat="server" meta:resourcekey="Label1Resource1"></asp:Label>
                                                            </div>
                                                            <div class="fLeft">
                                                                <asp:TextBox ID="txtWeightedAverageoldCost" SkinID="CustomWidthTextBox" runat="server"
                                                                    meta:resourcekey="SearchCodeTextBoxResource1" MaxLength="100"></asp:TextBox>
                                                            </div>
                                                        </div>

                                                        <div class="cBoth">
                                                        </div>
                                                        <div class=" alignCenter pTop5">
                                                            <asp:Button ID="UpdateButton" Text="&#xf093; Update WAC" runat="server" SkinID="0"
                                                                OnClick="UpdateButton_Click" meta:resourcekey="SearchButtonResource1" CssClass="btn btn-update fas" />
                                                        </div>
                                                    </asp:Panel>
                                                </ContentTemplate>
                                            </cc1:TabPanel>
                                            <cc1:TabPanel ID="UpdateWACCastLog" runat="server" HeaderText="Update WAC Cost Log">
                                                <HeaderTemplate>

                                                    <ul class="nav nav-tabs tabs-style-iconboxinner ajaxnavtabs">
                                                        <li class="fancyTab"><a><i class="fas fa-calendar"></i>&nbsp;Update WAC Cost Log</a></li>
                                                    </ul>
                                                </HeaderTemplate>
                                                <ContentTemplate>
                                                    <asp:Panel ID="LogCriteriaPanel" runat="server" meta:resourcekey="SearchCriteriaPanelResource1">
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="FromDateLabel" runat="server" Text="From Date" SkinID="MandatoryLabel"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <Date:DatePickerControl DisplayDatePicker="true" ID="FromDatePickerControl" Width="154Px"
                                                                    runat="server" Visible="true" />
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="ToDateLabel" runat="server" Text="To Date" SkinID="MandatoryLabel"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <Date:DatePickerControl DisplayDatePicker="true" ID="ToDatePickerControl" Width="154Px"
                                                                    runat="server" Visible="true" />
                                                            </div>
                                                        </div>
                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="ItemCodeLabel" Text="Item Code" runat="server"></asp:Label>
                                                            </div>
                                                            <div class="fLeft  pRight5">
                                                                <asp:TextBox ID="ItemCodeText" SkinID="CustomWidthTextBox" runat="server"
                                                                    meta:resourcekey="SearchCodeTextBoxResource1" Text="*" MaxLength="100">
                                                                </asp:TextBox>
                                                            </div>
                                                        </div>
                                                        <div class="alignCenter pTop5 col-md-12 center">
                                                            <asp:Button ID="SearchButton" Text="&#xf002; Search" runat="Server" OnClick="SearchButton_Click"
                                                                SkinID="0" class="btn-search btn fas" />
                                                            <asp:Button ID="ResetButton" runat="server" Text="&#xf0e2; Reset" OnClick="ResetButton_Click"
                                                                SkinID="0" class="btn-reset btn fas" />
                                                            <asp:HiddenField ID="MaxRowHiddenField" runat="server" />
                                                        </div>

                                                        <div class="himsBoxContent col-md-12 pTop10">
                                                            <div class="table-responsive">
                                                                <asp:GridView ID="UpdateWacLogGridview"
                                                                    runat="server" AutoGenerateColumns="False" EmptyDataText="No Records Found !!"
                                                                    AllowPaging="False" ViewStateMode="Enabled" DataKeyNames=""
                                                                    CssClass="table table-striped table-bordered table-hover">
                                                                    <Columns>
                                                                        <asp:BoundField DataField="Code" HeaderText="Item Code" />
                                                                        <asp:BoundField DataField="OperationRemark" HeaderText="Activity Remark" />
                                                                        <asp:BoundField DataField="Title" HeaderText="Store Location" />
                                                                        <asp:BoundField DataField="UserName" HeaderText="User Name" />
                                                                        <asp:BoundField DataField="CreatedDateTime" HeaderText="Activity Time" />
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </div>
                                                        </div>
                                                    </asp:Panel>
                                                </ContentTemplate>
                                            </cc1:TabPanel>
                                            <%-- Added By Dhananjay for Mantis Start - 0034531 --%>

                                            <cc1:TabPanel ID="BulkWacUpdatedGridviewTabPanel" runat="server" HeaderText="Bulk Update WAC Cost" >
                                                <HeaderTemplate>

                                                    <ul class="nav nav-tabs tabs-style-iconboxinner ajaxnavtabs">
                                                        <li class="fancyTab"><a><i class="fas fa-calendar"></i>&nbsp;Bulk Update WAC Cost</a></li>
                                                    </ul>
                                                </HeaderTemplate>
                                                <ContentTemplate>
                                                    <asp:Panel ID="Panel2" runat="server" meta:resourcekey="SearchCriteriaPanelResource1">

                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="SearchMainGroupLabel" runat="server" Text="Main Group"
                                                                    meta:resourcekey="Label11Resource1"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <asp:DropDownList ID="SearchMainGroupDropDownList"
                                                                    runat="server" onmouseleave="showHideTooltip()" AutoPostBack="true" OnSelectedIndexChanged="Fill_Search_Item_Sub_Category" SkinID="CustomWidthDropDownList" CssClass="form-control" onmouseenter="showHideTooltip()"
                                                                    meta:resourcekey="MainGroupDropDownListResource1">
                                                                </asp:DropDownList>
                                                            </div>
                                                        </div>

                                                        <div class="outerBox pTop5 col-md-3">
                                                            <div class="controlLabelWidth">
                                                                <asp:Label ID="SearchSubGroupLabel" runat="server" Text="Sub Group"
                                                                    meta:resourcekey="Label11Resource1"></asp:Label>
                                                            </div>
                                                            <div class="fLeft pRight5">
                                                                <asp:DropDownList ID="SearchSubGroupDropDownList"
                                                                    runat="server" onmouseleave="showHideTooltip()" AutoPostBack="false" SkinID="CustomWidthDropDownList" CssClass="form-control" onmouseenter="showHideTooltip()"
                                                                    meta:resourcekey="MainGroupDropDownListResource1">
                                                                </asp:DropDownList>
                                                            </div>
                                                        </div>

                                                        <div class="alignCenter pTop5 col-md-12 center">
                                                            <asp:Button ID="BulkSearchButton" Text="&#xf002; Search" runat="Server" OnClick="BulkSearchButton_Click"
                                                                SkinID="0" class="btn-search btn fas" />
                                                            <asp:Button ID="BulkSaveButton" runat="server" Text="&#xf0c7; Save" CssClass="fas btn btn-save " OnClick="SaveButton_Click"
                                                                SkinID="0" Font-Bold="true" CommandName="Save" />
                                                               <asp:Button ID="BulkResetButton" runat="server" Text="&#xf0e2; Reset" OnClick="BulkResetButton_Click"
                                                                SkinID="0" class="btn-reset btn fas" />
                                                        </div>

                                                        <div id="GridViewPagerDiv" runat="server">
                                                            <div class="leftdiv">
                                                            </div>
                                                            <div class="himsBoxTitle">
                                                                <div class="headerText fLeft">
                                                                    <asp:Label ID="GridViewLabel" Text="" runat="server" />
                                                                </div>
                                                            </div>

                                                            <div class="fRight display-flex">
                                                                <asp:TextBox ID="ApplyAllTextBox" runat="server" ClientIDMode="Static" MaxLength="10"
                                                                    SkinID="CustomWidthTextBox" Width="100px"></asp:TextBox>
                                                                &nbsp;&nbsp;&nbsp;  
                                                                <asp:Button ID="ApplyAllButton" runat="server"
                                                                Text="&#xf058; Apply All" SkinID="0" CssClass="btn btn-apply fas mr-1" OnClick="ApplyAllButton_Click" />
                                                            </div>
                                                        </div>
                                                        <div class="himsBoxContent col-md-12 pTop10">
                                                            <div class="table-responsive">
                                                                <asp:GridView ID="BulkWacUpdatedGridview"
                                                                    runat="server" AutoGenerateColumns="False" EmptyDataText="No Records Found !!"
                                                                    AllowPaging="False" ViewStateMode="Enabled" DataKeyNames="Code,ItemName,WeightedAverageCost"
                                                                    CssClass="table table-striped table-bordered table-hover">
                                                                    <Columns>
                                                                        <asp:BoundField DataField="Code" HeaderText="Item Code" />
                                                                        <asp:BoundField DataField="ItemName" HeaderText="Item Name" />
                                                                        <asp:TemplateField HeaderText="Weighted Average Cost">
                                                                            <ItemTemplate>
                                                                                <asp:TextBox ID="WeightedAverageCostTextBox" runat="server" maxlength="10" Text='<%# Eval("WeightedAverageCost") %>' onkeypress="javascript:return isNumberKeys(this)"></asp:TextBox>
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </div>
                                                        </div>
                                                    </asp:Panel>
                                                </ContentTemplate>
                                            </cc1:TabPanel>

                                            <%-- Added By Dhananjay for Mantis End - 0034531 --%>
                                        </cc1:TabContainer>
                                    </div>

                                </asp:Panel>
                            </div>
                        </div>
                        <%--   <div class="spacer">
                            <asp:Image ID="Image5" runat="server" ImageUrl="~/Images/spacer.gif" meta:resourcekey="Image5Resource1" visible="false"/>
                        </div>--%>
                    </div>
                </div>
            </div>
        </ContentTemplate>


    </asp:UpdatePanel>
    <%--<script data-main='<%= ResolveUrl("~/JavaScript/rjs/stock-status-built-encrypt") %>' src='<%= ResolveUrl("~/JavaScript/rjs/require.js") %>'></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/stock-wac-update")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <style type="text/css">
        .align {
            text-align: right;
        }
    </style>
  <script type="text/javascript">
      function isNumberKey(evt, element) {
          var charCode = (evt.which) ? evt.which : evt.keyCode;

          // Allow backspace, delete, left arrow, right arrow, and tab
          if (charCode == 8 || charCode == 46 || charCode == 37 || charCode == 39 || charCode == 9) {
              return true;
          }

          // Allow only one decimal point
          if (charCode == 46) {
              if (element.value.indexOf('.') !== -1) {
                  return false;
              }
          }

          // Allow digits
          if (charCode >= 48 && charCode <= 57) {
              return true;
          }

          return false;
      }

    </script>
</asp:Content>
