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

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<%@ Register Src="~/UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="DPC" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/Common/Stock/StockDetailBoxControl.ascx" TagName="StockControl" TagPrefix="Stock" %>
<%@ Register Src="~/UserControls/DatePicker/DatePickerControl.ascx" TagName="DatePickerControl" TagPrefix="Date" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">

    <asp:UpdatePanel ID="OTQueueListingUpdatePanel" runat="server">
        <ContentTemplate>

            <input type="hidden" id="hdnSessionid" runat="server" />
            <table border="0" style="vertical-align: top; margin-top: -1px; border-collapse: collapse;">
                <tr>
                    <td class="dashBoardLeftCont">
                        <div class="himssuHeader3WireBox">
                            <table>
                                <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>
                    </td>
                </tr>
            </table>

            <div class="whiteboxpaddingleft row">
                <Stock:StockControl ID="StockUserControl" runat="server" Visible="true" />
                <div class="card card-box col-md-12 p-0">
                    <div class="himsBoxContent card-body">
                        <div class="col-md-6">
                            <div class="outerBox pTop5 col-md-6">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="SearchForDepartmentLabel" runat="server" Text="Department" SkinId="mandatoryLabel"></asp:Label>
                                </div>
                                <div class="fLeft pRight5">
                                    <asp:DropDownList runat="server" AutoPostBack="true" ID="DepartmentDropDownList" SkinID="CustomWidthDropDownList"
                                        CssClass="form-control"  onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="cBoth"></div>
                            <div class="outerBox col-md-12">
                                <div class="outerBox pTop5">
                                    <div class="controlLabelWidth">
                                        <asp:Label ID="lblCode" runat="server" Text="Code" meta:resourcekey="codelike"></asp:Label>
                                    </div>
                                    <div class="fLeft pRight5">
                                        <asp:TextBox ID="txtcodelike" runat="server"></asp:TextBox>
                                        <div class="cBoth"></div>
                                        <b>
                                            <asp:Label ID="Label1" runat="server" ForeColor="#a94442" Text="For Search Multiple Record (Eg.2,5,20)"></asp:Label></b>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="col-md-6">
                            <div class="outerBox pTop5 col-md-6">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="MainGroupLabel2" SkinID="mandatoryLabel" runat="server" Text="Main Group"></asp:Label>
                                </div>
                                <asp:DropDownList ID="ItemMainGroupDropDownList" runat="server" CssClass="form-control"
                                    onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" OnSelectedIndexChanged="ItemMainGroupDropDownList_SelectedIndexChanged" AutoPostBack="true" />
                            </div>
                            <div class="outerBox pTop5 col-md-6">
                                <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="ItemSubGroupDropDownList"
                                        runat="server" onmouseleave="showHideTooltip()" AutoPostBack="false" SkinID="CustomWidthDropDownList" CssClass="form-control" onmouseenter="showHideTooltip()"
                                        meta:resourcekey="MainGroupDropDownListResource1">
                                    </asp:DropDownList>
                                </div>
                            </div>

                            <div class="cBoth"></div>
                            <div class="outerBox pTop5 col-md-12">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="lblitemNameLike" runat="server" Text="SubGroup Name" meta:resourcekey="ItemName1"></asp:Label>
                                </div>
                                <div class="fLeft pRight5">
                                    <asp:TextBox ID="txtitemlike" runat="server"></asp:TextBox>
                                    <div class="cBoth"></div>
                                    <b>
                                        <asp:Label ID="Label2" runat="server" ForeColor="#a94442" Text="For Search Multiple Record (Eg.FAN,BOOK,SHIRT)"></asp:Label></b>
                                </div>
                            </div>

                        </div>

                        <%-- <div class="col-md-12 pTop15" id="CodeNoteDiv" runat="server">
                            <div class="alert alert-info">
                                <i class="material-icons">info</i> |&nbsp;
                                <asp:Label ID="RamarkLabel" runat="server" Text="Add Student Code and SubGroup Name with , Comma sepration without any Space (Eg. 2. 5. 10)" Font-Bold="true"></asp:Label>
                            </div>
                        </div>--%>

                        <div class="outerBox pTop15 col-md-12">
                            <div class="searchBoxBtn alignCenter col-md-6">
                                <asp:Button ID="SearchEmployeeButton" Text="&#xf002; Search Employee" runat="server" OnClick="SearchEmployeeButton_Click"
                                     SkinID="0" CssClass="fas btn btn-search" />
                            </div>
                            <div class="searchBoxBtn alignCenter col-md-6">
                                <asp:Button ID="SearchItemButton" Text="&#xf002; Search Item" runat="server"
                                    OnClick="SearchItemButton_Click" SkinID="0" CssClass="fas btn btn-search" />
                            </div>
                        </div>

                        <div class="cBoth"></div>
                        <div id="IssuedDataDiv" class="col-md-6" runat="server" style="float: left" visible="false">
                            <div class="outerBox pTop5 col-md-6">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="IssuedByLabel" runat="server" Text="Issued By"
                                        meta:resourcekey="IssuedByLabelResource1"></asp:Label>
                                </div>
                                <div class="fLeft pRight5">
                                    <asp:TextBox ID="IssuedByTextBox" SkinID="CustomWidthTextBox" runat="server"
                                        MaxLength="100" onmouseleave="showHideTooltip()"
                                        onmouseenter="showHideTooltip()" meta:resourcekey="IssuedByTextBoxResource1"></asp:TextBox>
                                </div>
                            </div>
                        </div>

                        <div id="SaveDataDiv" class="col-md-6" runat="server" style="float: right" visible="false">
                            <div class="outerBox pTop5 col-md-6">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="IssuedLabel" runat="server" Text="Issued Date" SkinID="mandatorylabel"></asp:Label>
                                </div>
                                <div class="fLeft pRight5">
                                    <Date:DatePickerControl DisplayDatePicker="true" ID="IssuedDateLabel"
                                        runat="server" Visible="true" />
                                </div>
                            </div>
                           
                        </div>
                        <div class="cBoth"></div>
                        <div class="fRight col-md-6" id="AddDatadiv" runat="server" visible="false">
                            <div class="Outerbox col-md-6">
                                <div class="controlLabelWidth">
                                    <asp:Button ID="AddButtton" CssClass="btn btn-add fas" SkinID="0" runat="server" Text="&#xf067; Add" OnClick="AddButtton_Click" />
                                </div>
                            </div>
                        </div>
                        <div id="Gridview" class="col-md-12">

                            <div class="col-md-6" id="EmployeeListDiv" visible="true">
                                <asp:GridView ID="EmployeeListGridview" runat="server" AutoGenerateColumns="False" EmptyDataText="No records found"
                                    SkinID="" ShowHeader="True" PagerSettings-Visible="false" DataKeyNames="EmployeeId,DepartmentId"
                                    CssClass="table table-striped table-bordered table-hover">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Select" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="4%"
                                            ItemStyle-Wrap="true">
                                            <HeaderTemplate>
                                                <label class="rt-chkbox rt-chkbox-outline">
                                                    <asp:CheckBox ID="EmployeeListHeaderSelectCheckBox" runat="server" Enabled="true" AutoPostBack="true"
                                                        Visible="true" OnCheckedChanged="EmployeeListHeaderSelectCheckBox_CheckedChanged"/>
                                                    <span></span>
                                                </label>
                                            </HeaderTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <label class="rt-chkbox rt-chkbox-outline">
                                                    <asp:CheckBox ID="EmployeeListSelectCheckBox" runat="server" />
                                                    <span></span>
                                                </label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="Code" HeaderText="Code" HeaderStyle-HorizontalAlign="Left"
                                            ItemStyle-Width="5%" />
                                        <asp:BoundField DataField="DepartmentName" HeaderText="Department" HeaderStyle-HorizontalAlign="Left"
                                            ItemStyle-Width="5%" />
                                        
                                        <asp:BoundField DataField="ShortName" HeaderText="Name" HeaderStyle-HorizontalAlign="Left"
                                            ItemStyle-Width="30%" />
                                    </Columns>
                                </asp:GridView>
                            </div>

                            <div class="col-md-6" id="ItemListDiv" visible="true">
                                <asp:GridView ID="ItemListGridView" runat="server" AutoGenerateColumns="False" EmptyDataText="No records found"
                                    OnRowDataBound="ItemListGridView_RowDataBound" OnPageIndexChanging="ItemListGridView_PageIndexChanging"
                                    SkinID="" ShowHeader="True" PagerSettings-Visible="false" OnRowCommand="ItemListGridView_RowCommand"
                                    DataKeyNames="ItemSubGroupId,StockItemName" CssClass="table table-striped table-bordered table-hover">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Select" HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="1%"
                                            ItemStyle-Wrap="true">
                                            <HeaderTemplate>
                                                <label class="rt-chkbox rt-chkbox-outline">
                                                    <asp:CheckBox ID="ItemListHeaderSelectCheckBox" runat="server" Enabled="true" AutoPostBack="true"
                                                        Visible="true" OnCheckedChanged="ItemListHeaderSelectCheckBox_CheckedChanged" />
                                                    <span></span>
                                                </label>
                                            </HeaderTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                                            <ItemTemplate>
                                                <label class="rt-chkbox rt-chkbox-outline">
                                                    <asp:CheckBox ID="ItemListSelectCheckBox" runat="server" />
                                                    <span></span>
                                                </label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField ItemStyle-Width="10%">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="ImageButtonAdd" runat="server" CommandArgument='<%# Eval("ItemSubGroupId") %>' />
                                                <asp:ImageButton ID="ImageButtonDelete" runat="server" CommandArgument='<%#  Eval("ItemSubGroupId")  %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Item Id" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" Visible="false">
                                            <ItemTemplate>
                                                <asp:Label ID="IdLabel" runat="server" Text='<%#Eval("ItemSubGroupId") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="SubGroup" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="15%">
                                            <ItemTemplate>
                                                <asp:Label ID="GroupLabel" runat="server" Text='<%#Eval("StockItemName") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Item Name" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="22%">
                                            <ItemTemplate>
                                                <asp:DropDownList ID="Size_DropDownList" runat="server" Width="100%" CssClass="form-control"></asp:DropDownList>
                                                <asp:HiddenField ID="HiddenFieldType" runat="server" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Quantity" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="8%">
                                            <ItemTemplate>
                                                <asp:TextBox ID="ItemQuantityTextBox" runat="server" SkinID="CustomWidthTextBox" onkeypress="OnlyNumericEntry()"  MaxLength="100"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </div>
                            <div class="fRight col-md-6" id="TempListDiv" visible="true">
                                <asp:GridView ID="TempItemlistGridview" runat="server" AutoGenerateColumns="False" SkinID="" ShowHeader="True"
                                 PagerSettings-Visible="false" CssClass="table table-striped table-bordered table-hover" OnRowDataBound="TempItemlistGridview_RowDataBound" 
                                  OnRowCommand="TempItemlistGridview_RowCommand"  DataKeyNames="ItemSubGroupId" >
                                    <Columns>
                                        <asp:TemplateField HeaderText="SubGroup" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="15%" >
                                            <ItemTemplate>
                                                <asp:Label ID="GroupLabel" runat="server" Text='<%#Bind("StockItemName") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Item Name" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="15%">
                                            <ItemTemplate>
                                                 <asp:Label ID="NameLabel" runat="server" Text='<%#Bind("ItemName") %>'></asp:Label>
                                                <asp:HiddenField ID="ItemIDHiddenField" runat="server" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Quantity" ItemStyle-Wrap="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="8%">
                                            <ItemTemplate>
                                                 <asp:Label ID="QuantityLabel" runat="server" Text='<%#Bind("Quantity") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField ItemStyle-Width="5%">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="ImageButtonDelete" runat="server"   />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <%--<script data-main="../../../JavaScript/rjs/stock-inward-bulk" src="../../../JavaScript/rjs/require.js"></script>--%>
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs/stock-inward-bulk")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>
    <script type="text/javascript">
        $("[id*=ChekHeder]").live("click", function () {
            var chkHeader = $(this);
            var grid = $(this).closest("table");
            $('#ctl00_CP_MedicineGridView tr').each(function () {
                if (chkHeader.is(":checked")) {
                    $(this).find('input[type=checkbox]').prop('checked', true);
                }
                else {
                    $(this).find('input[type=checkbox]').prop('checked', false);
                }
            });
        });
    </script>
    <script type="text/javascript">
        function sum() {
            $('#ctl00_CP_MedicineGridView tr').each(function () {
                var qty = $(this).find('.qtytxtbox').val();
                var price = $(this).find('.prctxtbox').val();

                if ((qty != '') && (price != '')) {
                    var valueTotal = (qty * price);

                    $(this).find('.ValueBox').val(valueTotal);

                }
            });
        }
       <%-- function ValidateApply() {
            var chcnt = 0
            $('#ctl00_CP_MedicineGridView tr').each(function () {
                if ($(this).find('input[type=checkbox]').is(':checked')) {
                    chcnt = chcnt + 1;
                }
            });
            if (chcnt == 0) {
                alert('please select atleast one checkbox');
            }
            else {
                var value = document.getElementById('<%=ApplyAllTextBox.ClientID%>').value;
                var mydropdown = document.getElementById('<%=ApplyAllDropDownList.ClientID%>').value;
                if ((mydropdown != '--Select--') && (value != '')) {


                    if (document.getElementById('<%=ApplyAllDropDownList.ClientID%>').value == "Quantity") {
                        $('#ctl00_CP_MedicineGridView tr').each(function () {
                            if ($(this).find('input[type=checkbox]').is(':checked')) {
                                $(this).find('.qtytxtbox').val($('#ctl00_CP_ApplyAllTextBox').val());
                            }
                        });
                    }
                    else if (document.getElementById('<%=ApplyAllDropDownList.ClientID%>').value == "Price") {
                        $('#ctl00_CP_MedicineGridView tr').each(function () {
                            if ($(this).find('input[type=checkbox]').is(':checked')) {
                                $(this).find('.prctxtbox').val($('#ctl00_CP_ApplyAllTextBox').val());
                            }
                        });
                    }

                    $('#ctl00_CP_MedicineGridView tr').each(function () {
                        var qty = $(this).find('.qtytxtbox').val();
                        var price = $(this).find('.prctxtbox').val();

                        if ((qty != '') && (price != '')) {
                            var valueTotal = (qty * price);

                            $(this).find('.ValueBox').val(valueTotal);

                        }
                    });

                }
                else {
                    if ((mydropdown = "--Select--") && (value = " ")) {
                        alert("Please Enter Value and Select Apply All DropDown.");
                    }
                    else {
                        if (mydropdown != "--Select--") {
                            alert("Please Select Apply All Dropdown.");
                        }
                        if (value != " ") {
                            alert("Please Enter Apply All Value.");
                        }
                    }
                }
            }
        }--%>
        function FormatIt(obj) {
            if (obj.value.length == 2) // Day
                obj.value = obj.value + "/";
            if (obj.value.length == 5) // month
                obj.value = obj.value + "/";
        }
        function OnlyNumericEntry() {
            if ((event.keyCode < 48 || event.keyCode > 57 || event.keyCode == 13 || event.keyCode == 176)) {
                event.returnValue = false;
            }
            else {
                var Quantity = document.getElementById("ItemQuantityTextBox").value;
            }
        }
    </script>
</asp:Content>
