<%@ page language="C#" autoeventwireup="true" inherits="Pages_MaterialManagement_Procurement_StockIssue, App_Web_vwjowgv1" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage_new.master" uiculture="auto" 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/DatePicker/DatePickerControl.ascx" TagName="DataPickerControl"
    TagPrefix="HIMS" %>
<%@ Register Src="~/UserControls/MaterialManagement/Procurement/BatchUpdation.ascx"
    TagPrefix="BUC" TagName="BatchUserControl" %>
<%@ Register Src="~/UserControls/Common/CommonSearch/CommonSearch.ascx" TagName="CommonSearchUserControl"
TagPrefix="Common" %> 
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl"
    TagPrefix="ScreenGroup" %>
<%@ Register Src="~/UserControls/Common/CommonSearch/AlphabetSearchCommonControl.ascx" TagName="AlphabetSearchCommonControl"
TagPrefix="ACS" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    
    <asp:UpdatePanel ID="StockIssueUpdatePanel" runat="server">
        <ContentTemplate>
             <Common:CommonSearchUserControl ID="CommonSearchControl" runat ="server" Visible="false" />
             <ACS:AlphabetSearchCommonControl ID="AlphabetCommonSearch" runat="server" Visible="false" />
             
               <div id="divContentPage" class="divcontentpagemargin">
                <!-- ContentPlaceHolder Box Starts -->
                 <div style="width: 100%;padding:2px;margin:2px">
                    <table width="100%" border="0" style="vertical-align: top; margin-top: -1px" cellpadding="0"
                        cellspacing="0">

                        <tr>
                       <td class="dashBoardLeftCont" valign="top">
                                <div class="himssuHeader3WireBox">
                                   <%-- <div class="himsBoxHeader">
                                        <div class="leftdiv">
                                        </div>
                                        <div class="himsBoxTitle">
                                            <div class="headerText">
                                            <asp:Label runat="server" ID="ScreenGroupNameLabel"></asp:Label>    
                                            </div>
                                        </div>
                                    </div>--%>
                                    <table width="0px" 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>
                            </td>
                            <td style="vertical-align: top;" width="100%"> 
                                 <!-- Sub Container Box Start -->
            <div class="himssuHeader5WireBox whitebox">
                <div class="himsBoxHeader note note1 box box-danger">
                    <div class="leftdiv">
                    </div>
                    <div class="himsBoxTitle">
                        <div class="headerText" id="codeHeader">
                            Stock Issue</div>
                    </div>
                </div>
                <div class="himsBoxContent">
                    <div class="contentHolder">
                        <div class="outerBox pTop5">
                            <div class="controlLabelWidth">
                                <asp:Label ID="IssueNoLabel" runat="server" Text="Issue No" 
                                    meta:resourcekey="IssueNoLabelResource1"></asp:Label>
                            </div>
                            <div class="fLeft">
                                <acc:AutoCompleteControl ID="IssueNoTextBox" runat="server" MinimumPrefixLength="2"
                                    Width="150px" ContextKey="Procurement.StockIssueNumber" 
                                    AutoPostBack="true" DisplayLoadingStatus="true"
                                    FirstRowSelected="false" MaxLength="20" ValidateOnTextChanged="false" />
                                <asp:ImageButton ID="IssueNoSearchImageButton" ToolTip="Issue No. Search" SkinID="FindImage"
                                    OnClick="IssueNoSearchImageButton_Click" runat="server" 
                                    meta:resourcekey="IssueNoSearchImageButtonResource1" />
                            </div>
                        </div>
                        <div class="outerBox pTop5">
                            <div class="controlLabelWidth">
                                <asp:Label ID="IssueDateLabel" runat="server" Text="Issued Date" 
                                    meta:resourcekey="IssueDateLabelResource1"></asp:Label>
                            </div>
                            <div class="fLeft pRight5">
                                <asp:TextBox SkinID="DisabledTextbox" ReadOnly="True" ID="IssuedDateLabel" 
                                    runat="server" meta:resourcekey="IssuedDateLabelResource1"></asp:TextBox>
                            </div>
                        </div>
                        <div class="outerBox pTop5">
                            <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" Width="150px" runat="server"
                                    MaxLength="100" onmouseleave="showHideTooltip()" 
                                    onmouseenter="showHideTooltip()" meta:resourcekey="IssuedByTextBoxResource1"></asp:TextBox>
                            </div>
                        </div>
                        <div class="cBoth">
                        </div>
                        <div class="outerBox pTop5">
                            <div class="controlLabelWidth">
                                <asp:Label ID="RequestNoLabel" runat="server" Text="Req. No" 
                                    meta:resourcekey="RequestNoLabelResource1"></asp:Label>
                            </div>
                            <div class="fLeft">
                                <acc:AutoCompleteControl ID="RequestNoTextBox" runat="server" MinimumPrefixLength="2"
                                    Width="150px" ContextKey="sProcurement.StockIssueRequestNumber" AutoPostBack="true"
                                    DisplayLoadingStatus="true" FirstRowSelected="false" MaxLength="20" 
                                    ValidateOnTextChanged="false" />
                                <asp:ImageButton ID="RequestNoSearchImageButton" ToolTip="Request No. Search" SkinID="FindImage"
                                    OnClick="RequestNoSearchImageButton_Click" runat="server" 
                                    meta:resourcekey="RequestNoSearchImageButtonResource1" />
                            </div>
                        </div>
                        <div class="outerBox pTop5">
                            <div class="controlLabelWidth">
                                <asp:Label ID="RequestDateLabel" runat="server" Text="Req. Date" 
                                    meta:resourcekey="RequestDateLabelResource1"></asp:Label>
                            </div>
                            <div class="fLeft pRight5">
                                <asp:TextBox SkinID="DisabledTextbox" ReadOnly="True" ID="RequestedDateDisplayLabel"
                                    runat="server" meta:resourcekey="RequestedDateDisplayLabelResource1"></asp:TextBox>
                            </div>
                        </div>
                        
                        <div class="outerBox pTop5" runat="server" visible="false">
                            <div class="controlLabelWidth">
                                <asp:Label ID="FromLocationLabel" SkinID="mandatoryLabel" runat="server" 
                                    Text="From Location" meta:resourcekey="FromLocationLabelResource1"></asp:Label>
                            </div>
                            <div class="fLeft">
                                <asp:DropDownList ID="FromLocationDropDownList" runat="server" Width="154px" AutoPostBack="True"
                                    SkinID="CustomWidthDropDownList"  
                                    onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" 
                                    meta:resourcekey="FromLocationDropDownListResource1">
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="outerBox pTop5">
                            <div class="controlLabelWidth">
                                <asp:Label ID="ToLocationLabel" Visible = "false" SkinID="mandatoryLabel" runat="server" 
                                    Text="To Dept" meta:resourcekey="ToLocationLabelResource1"></asp:Label>
                            </div>
                            <div class="fLeft pRight5">
                                <asp:DropDownList ID="ToDepartmentDropDownList" Visible = "false" runat="server" Width="104px" onmouseleave="showHideTooltip()" AutoPostBack = "true"
                                    SkinID="CustomWidthDropDownList" onmouseenter="showHideTooltip()"    OnSelectedIndexChanged="ToDepartmentDownList_SelectedIndexChanged" 
                                   >
                                </asp:DropDownList>
                            </div>
                        </div>
                         <div id="Div1" class="outerBox pTop5" runat="server" visible="false">
                            <div class="controlLabelWidth">
                                <asp:Label ID="Label1"   runat="server" 
                                    Text="First Aid" ></asp:Label>
                            </div>
                            <div class="fLeft pRight5">
                                <asp:DropDownList ID="FirstAidDropDownList" runat="server" Width="104px" onmouseleave="showHideTooltip()"
                                    SkinID="CustomWidthDropDownList" onmouseenter="showHideTooltip()" Enabled="false"
                                    >
                                </asp:DropDownList>
                            </div>
                        </div>
                        <div class="cBoth">
                        </div>
                    </div>
                </div>
                <!-- Sub Container Box Ends -->
                <div class="spacer">
                    <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/spacer.gif" 
                        meta:resourcekey="Image2Resource1" /></div>
                <!-- Sub Container Box Start -->
                <div class="himssuHeader1WireBox">
                    <div class="himsBoxHeader note note1 box box-danger">
                        <div class="leftdiv">
                        </div>
                        <div class="himsBoxTitle">
                            <div class="headerText">
                                Stock Issue Details</div>
                        </div>
                    </div>
                    <div class="himsBoxContent">
                        <div class="contentHolder">
                            <div class="outerBox pTop5">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="ItemCodeLabel" SkinID="mandatoryLabel" runat="server" 
                                        Text="Item Code" meta:resourcekey="ItemCodeLabelResource1"></asp:Label>
                                </div>
                                <div class="fLeft">
                                    <acc:AutoCompleteControl ID="StockItemCodeTextBox" runat="server" MinimumPrefixLength="2"
                                      IsCacheEnabled="false"  Width="100px" ContextKey="Common.ItemTitleAll" 
                                        AutoPostBack="true" DisplayLoadingStatus="true"
                                        FirstRowSelected="false" MaxLength="20" ValidateOnTextChanged="false" />
                                    <asp:ImageButton ID="ItemCodeSearchButton" ToolTip="Item Code Search" SkinID="FindImage"
                                        OnClick="ItemCodeSearchButton_Click" runat="server" 
                                        meta:resourcekey="ItemCodeSearchButtonResource1" />
                                </div>
                            </div>
                            <div class="outerBox pTop5">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="NameLabel" runat="server" Text="Item Name" 
                                        meta:resourcekey="NameLabelResource1"></asp:Label>
                                </div>
                                <div class="fLeft pRight5">
                                    <acc:AutoCompleteControl ID="StockItemNameTextBox" runat="server" MinimumPrefixLength="2"
                                      IsCacheEnabled="false"  Width="150px" 
                                        ContextKey="InventoryPlanning.ItemTitleAll" AutoPostBack="true"
                                        DisplayLoadingStatus="true" FirstRowSelected="false" MaxLength="300" 
                                        ValidateOnTextChanged="false" />
                                    <asp:ImageButton ID="ItemNameSearchButton" ToolTip="Item Name Search" SkinID="FindImage"
                                        OnClick="ItemNameSearchButton_Click" runat="server" 
                                        meta:resourcekey="ItemNameSearchButtonResource1" />
                                </div>
                            </div>
                            <div class="outerBox pTop5">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="RequestedQtyLabel" runat="server" Text="Requested Qty" 
                                        meta:resourcekey="RequestedQtyLabelResource1"></asp:Label>
                                </div>
                                <div class="fLeft pRight5">
                                    <asp:TextBox ID="RequestedQtyTextBox" runat="server" MaxLength="13" onblur="javascript:return fnValidateDecimal(this,10,2)"
                                        onKeypress="javascript:return MaskDecimal(event,10,2)" onmouseleave="showHideTooltip()"
                                        onmouseenter="showHideTooltip()" Style="text-align: right;" 
                                        meta:resourcekey="RequestedQtyTextBoxResource1"></asp:TextBox>
                                </div>
                            </div>
                            <div class="cBoth">
                            </div>
                            <div class="outerBox pTop5">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="IssueQtyLabel" SkinID="mandatoryLabel" runat="server" 
                                        Text="Issue Qty" meta:resourcekey="IssueQtyLabelResource1"></asp:Label>
                                </div>
                                <div class="fLeft">
                                    <asp:TextBox ID="IssueQtyTextBox" runat="server" MaxLength="13" onblur="javascript:return fnValidateDecimal(this,10,2)"
                                        onKeypress="javascript:return MaskDecimal(event,10,2)" onmouseleave="showHideTooltip()"
                                        onmouseenter="showHideTooltip()" Style="text-align: right;" 
                                        meta:resourcekey="IssueQtyTextBoxResource1"></asp:TextBox>
                                  <%--  <asp:LinkButton ID="IssueQtyAddImageButton" ToolTip="Add Batch"
                                        OnClick="IssueQtyAddImageButton_Click" runat="server" 
                                        CssClass="CursorHand" meta:resourcekey="IssueQtyAddImageButtonResource1">
                                    <i class="fa fa-plus"></i>
                                        </asp:LinkButton>--%>
                                    <asp:ImageButton ID="IssueQtyAddImageButton" ToolTip="Add Batch" ImageUrl="~/Images/icons/icon_visit.png"
                                        OnClick="IssueQtyAddImageButton_Click" runat="server" 
                                        CssClass="CursorHand pTop5" meta:resourcekey="IssueQtyAddImageButtonResource1" Visible="false" />
                                </div>
                            </div>
                            <div class="outerBox pTop5">
                                <div class="controlLabelWidth">
                                    <asp:Label ID="RemarksLabel" runat="server" Text="Remarks" 
                                        meta:resourcekey="RemarksLabelResource1"></asp:Label>
                                </div>
                                <div class="fLeft pRight5">
                                    <asp:TextBox ID="RemarksTextBox" runat="server" Style="border-color: #7F9DB9; border-width: 1px;
                                        border-style: Solid; font-size: 11px; height: 40px; width: 390px" TextMode="MultiLine"
                                        MaxLength="300" onKeypress="javascript:return fnMaxLength(this, 300)" onblur="javascript:return CheckLength(this, 300)"
                                        onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" 
                                        meta:resourcekey="RemarksTextBoxResource1"></asp:TextBox>
                                </div>
                            </div>
                            <div class="cBoth">
                            </div>
                            <div class=" alignCenter pTop5">
                                <asp:Button ID="AddToListButton" runat="server" Width="60px" SkinID="CustomWidthButton"
                                    class="buttonLBlue" Text="Add" OnClick="AddToListButton_Click" 
                                    meta:resourcekey="AddToListButtonResource1" />
                                     <asp:Button ID="ClearDetailButton" runat="server" Width="60px" class="buttonLBlue" Text="Clear" 
                                    OnClick="ClearDetail_Click" meta:resourcekey="ClearButtonResource1" />
                            </div>


                            <div class="cBoth">
                            </div>
                                <div id="StockIssueDetailDiv" class="himssuHeader6WireBox box-body box-solid gridviewfont" runat="server">
                         
                        <div class="himsBoxHeader" id="PatientRelationDiv" runat="server">
                            <div class="leftdiv">
                            </div>
                            <div class="himsBoxTitle">
                                <div class="headerText">
                                    <div class="fLeft">
                                        <asp:Label ID="GridViewLabel" Text="" runat="server" Font-Bold="True" 
                                            meta:resourcekey="GridViewLabelResource1" />
                                    </div>
                                </div>
                                <div align="right" class="fRight" style="margin-top: -0px;">
                                    <uc1:GridViewPager ID="StockIssueDetailGridView_GridViewPager" runat="server" OnFirstRecordClick="StockIssueDetailGridView_GridViewPager_FirstRecordClick"
                                        OnLastRecordClick="StockIssueDetailGridView_GridViewPager_LastRecordClick" OnNextRecordClick="StockIssueDetailGridView_GridViewPager_NextRecordClick"
                                        OnPrevRecordClick="StockIssueDetailGridView_GridViewPager_PrevRecordClick" OnTextBoxValueChange="StockIssueDetailGridView_GridViewPager_TextBoxValueChange"
                                        ParentGridView="StockIssueDetailGridView" />
                                </div>
                            </div>
                        </div>
                        <div class="himsBoxContent"> 
                           
                           <%-- <div id="DivData" class="Container" style="vertical-align: top; height: 100px; width: 99.6%;">--%>
                                <asp:GridView ID="StockIssueDetailGridView" runat="server" Width="100%" AutoGenerateColumns="False"
                                    OnRowDataBound="StockIssueDetailGridView_RowDataBound" OnPageIndexChanging="StockIssueDetailGridView_PageIndexChanging"
                                    AllowPaging="True" PageSize="5" OnDataBinding="StockIssueDetailGridView_DataBinding"
                                    ShowHeader="True" DataKeyNames="Id,StockItemId"
                                    EmptyDataText="No Records Found" 
                                    meta:resourcekey="StockIssueDetailGridViewResource1" CssClass="table table-striped table-bordered">
                                    <Columns>
                                        <asp:TemplateField HeaderText="Item Code" HeaderStyle-HorizontalAlign="Left"
                                            meta:resourcekey="TemplateFieldResource1">
                                            <ItemTemplate>
                                                <asp:LinkButton ID="StockItemCodeLinkButton" runat="server" OnClick="StockItemCodeLinkButton_Click"
                                                    ToolTip='<%# Bind("StockItemCode") %>' Text='<%# Bind("StockItemCode") %>' Enabled='<%# Eval("IsBatchWiseTracking") %>'
                                                    Width="70px" CausesValidation="False" 
                                                    CommandArgument='<%# Eval("StockItemId") %>'></asp:LinkButton>
                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Left" Width="20%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Item Name" HeaderStyle-HorizontalAlign="Left"
                                            meta:resourcekey="TemplateFieldResource2">
                                            <ItemTemplate>
                                                <asp:Label CssClass="boxEllips" ToolTip='<%# Bind("StockItemName") %>' ID="NameLabel"
                                                    runat="server" Text='<%# Bind("StockItemName") %>' Width="200px"></asp:Label>
                                            </ItemTemplate>
                                            <ItemStyle Width="20%" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="UOM" HeaderText="UOM" HeaderStyle-HorizontalAlign="Left"
                                            meta:resourcekey="BoundFieldResource1" >
                                            <ItemStyle Width="20%" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="RequestedQuantity" HeaderText="Requested Qty" HeaderStyle-HorizontalAlign="Right"
                                            DataFormatString="{0:F}" meta:resourcekey="BoundFieldResource2" >
                                            <ItemStyle HorizontalAlign="Right" Width="15%" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="Issue Qty" HeaderStyle-HorizontalAlign="Right"
                                            meta:resourcekey="TemplateFieldResource3">
                                            <ItemTemplate>
                                                <asp:TextBox ID="IssueQuantityTextBoxGrid" Enabled='<%# GetIssueQuantityTextBoxGridBehavior(Eval("IsBatchWiseTracking"), Eval("Id"),Eval("IsFreezed")) %>'
                                                    runat="server" 
                                                    Text='<%# String.Format("{0:F}", Eval("IssuedQuantity")) %>' Width="200px"
                                                    MaxLength="13" onblur="javascript:return fnValidateDecimal(this,10,2)" onKeypress="javascript:return MaskDecimal(event,10,2)"
                                                    onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()" Style="text-align: right;"
                                                    AutoPostBack="True" OnTextChanged="IssueQuantityTextBoxGrid_TextChanged"  ></asp:TextBox>
                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Right" Width="15%" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center"
                                            meta:resourcekey="TemplateFieldResource4">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="DeleteImageButton" runat="server" CommandName="Delete" CommandArgument='<%# Eval("StockItemId") %>'
                                                    OnClick="DeleteImageButton_Click" SkinID="DeleteImage" ToolTip="Delete" 
                                                    Enabled='<%# GetDeleteImageGridBehavior(Eval("Id")) %>' 
                                                    meta:resourcekey="DeleteImageButtonResource1" />
                                            </ItemTemplate>
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerSettings Visible="False" />
                                </asp:GridView>
                          <%--  </div>--%>
                        </div>
                    </div>

                        </div>
                    </div>
                    <!--Grid starts-->
                
                    <!--Grid Ends-->
                    <BUC:BatchUserControl ID="BatchUpdationCtrl" runat="server" />
                </div>
            </div>
                            </td>
                        </tr>
                    </table>
                    <%--HEDP History Ends Here--%>
                </div>
            </div>
            <div class="spacer">
                <img src="../../../Images/spacer.gif" />
            </div>         
       
        </ContentTemplate>
    </asp:UpdatePanel>
        <%--<script data-main="../../../JavaScript/rjs/encrypt/stock-issue-encrypt" src="../../../JavaScript/rjs/require.js"></script>--%>  
    <script data-main='<%=ResolveUrl("~/JavaScript/rjs//stock-issue")%>' src='<%=ResolveUrl("~/JavaScript/rjs/require.js")%>'></script>    
</asp:Content>
