<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Distributions.aspx.cs" Inherits="HRMS.Distributions" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="main-panel">
        <div class="row">
            <div class="col-md-12">
                <section class="panel">
                    <header class="panel-heading">
                        Distributions
                          <div class="pull-right">
                            
                            <asp:button text="Back" CssClass="btn btn-info" ID="btn_cancel" runat="server" onclick="btn_cancel_Click"/>
                        </div>
                    </header>

                    <div class="panel-body">
                        <div class="span6">
                                <div id="divmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" ID="lbl_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                            <div class="span6">
                                <div id="diverrmessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <asp:label text="" id="lbl_err_msg" CssClass="msg" runat="server"></asp:label>
                                </div>
                            </div>

                        <div class="row">
                            <label class="col-md-2 control-label">Line Number</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_line_no" CssClass="form-control" runat="server" Enabled="false"></asp:TextBox>
                            </div>

                              <label class="col-md-2 control-label">Line Total</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_line_total" CssClass="form-control" runat="server" Enabled="false"></asp:TextBox>
                            </div>
                        </div>


                          <div class="row">
                            <label class="col-md-2 control-label">Line Description</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_line_desc" CssClass="form-control" runat="server" Enabled="false"></asp:TextBox>
                            </div>

                              <label class="col-md-2 control-label">Distribution Total</label>
                            <div class="col-md-3">
                                <asp:TextBox ID="txt_dist_total" CssClass="form-control" runat="server" Enabled="false"></asp:TextBox>
                            </div>
                        </div>

                        <hr />

                                   <div style="width: 102%; height:250px; overflow: scroll">
                                      <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                        CssClass="table table-striped table-bordered table-hover" CellPadding="0" 
                             onrowcommand="GridView2_RowCommand" onrowdatabound="GridView2_RowDataBound">
                                <Columns>
                                <asp:TemplateField HeaderStyle-Width="10px">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hid_dist" runat="server" Value='<%# Bind("DISTRIBUTION_LINE_NUMBER") %>' />
                                        <asp:HiddenField ID="hid_type" runat="server" Value='<%# Bind("type") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>    

                                <asp:TemplateField HeaderText="Type" ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_type" Visible="false" runat="server" CssClass="form-control" Text='<%# Bind("type") %>'></asp:TextBox>
                                        <asp:DropDownList ID="ddl_type" Enabled='<%# bool.Parse(Request.QueryString["Enb"]+""=="Y"?"True":"False") %>' runat="server" CssClass="form-control"></asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                  <asp:TemplateField HeaderText="Amount"  ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_amount" Enabled='<%# bool.Parse(Request.QueryString["Enb"]+""=="Y"?"True":"False") %>' runat="server" CssClass="form-control" Text='<%# Bind("AMOUNT") %>'></asp:TextBox>
                                        <%--<asp:RequiredFieldValidator runat="server" ID="Reqamt" ControlToValidate="txt_amount" ErrorMessage="Amount is required." setfocusonerror="true" ValidationGroup = '<%# "add_" + Container.DataItemIndex %>'></asp:RequiredFieldValidator>--%>
                                        <%--<asp:RegularExpressionValidator ID="Regex2" runat="server" ValidationExpression="((\d+)((\.\d{1,2})?))$" ErrorMessage="Please enter valid number with 2 decimal places." setfocusonerror="true"  ControlToValidate="txt_amount" ValidationGroup='<%# "add_"+Container.DataItemIndex %>' />--%>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="GL Date" ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_gl_date" Enabled='<%# bool.Parse(Request.QueryString["Enb"]+""=="Y"?"True":"False") %>' runat="server" CssClass="form-control datetime" Text='<%# Bind("GL_DATE") %>'></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Account" ControlStyle-Width="250px" ItemStyle-Width="300px">
                                    <ItemTemplate>
                                            <div class="input-group">
                                                 <asp:HiddenField ID="hid_acc" Value='<%#Bind("CC_ID") %>' runat="server" />
                                        <asp:TextBox ID="txt_account" runat="server" CssClass="form-control" Text='<%# Bind("Account") %>'></asp:TextBox>
                                           <span class="input-group-btn">
                                                                    <asp:HiddenField ID="hf_row" Value='<%# Container.DataItemIndex %>' runat="server" />
                                                                    <button id="btn_cc" disabled='<%# Request.QueryString["Enb"].ToString() == "Y" ? "True":"False" %>' type="button" onclick="PopupBulkQuestion('<%# row_id.ClientID  %>','<%# ((GridViewRow)Container).FindControl("hf_row").ClientID %>')"class="btn btn-white">
                                                                        <i class="fa fa-plus"></i>
                                                                    </button>
                                                                     <button id="btn_lov" type="button" runat="server" class="btn btn-white" onserverclick="btn_lov_ServerClick"><i class="fa fa-search"></i></button>
                                                                </span>
                                         </div>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                     <asp:TemplateField HeaderText="Asset Book"  ControlStyle-Width="150px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_asset_book" runat="server" CssClass="form-control"></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                       <asp:TemplateField HeaderText="Description"  ControlStyle-Width="250px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_desc" runat="server" CssClass="form-control" Text='<%# Bind("DESCRIPTION") %>'></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                

                                     <asp:TemplateField HeaderText="Track as Asset"  ControlStyle-Width="100px" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chk_track_asser" runat="server" CssClass="checkbox" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                
                                
                                    <asp:TemplateField HeaderText="Action" ItemStyle-Width="6%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lnkadd"  runat="server" CommandName="gadd" ValidationGroup = '<%# "add_" + Container.DataItemIndex %>'><i class="fa fa-plus" style="font-size:20px !important;"></i></asp:LinkButton>&nbsp;
                                            <asp:LinkButton ID="linkedit"  runat="server" CommandName="gEdit" Visible="false"><i class="fa fa-pencil" style="font-size:20px !important;"></i></asp:LinkButton>
                                            <asp:linkbutton ID="linkdlt" CausesValidation="false" CommandName="gDelete" runat="server" Visible="false" OnClientClick="return confirm('Are you sure to delete?')"><i class="fa fa-trash" style="font-size:20px !important"></i></asp:linkbutton>
                                        </ItemTemplate> 
                                            <ItemStyle Width="6%"></ItemStyle>
                                    </asp:TemplateField>

                                 
                                </Columns>
                                    <%--<FooterStyle CssClass="footerStyle" />
                                    <HeaderStyle CssClass="headerStyle" />
                                    <RowStyle CssClass="rowStyle" />--%>
                            </asp:GridView>

                                    </div>




                                  
             <div class="modal fade" id="CostVal" role="dialog">
                               <div class="modal-dialog modal-dialog-center" >
                                <div class="modal-content">
                                  <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                                    <h4 class="modal-title">Costing Values :</h4>
                                     
                                  </div>
                                  <div class="modal-body">
                                       <asp:HiddenField ID="row_id" runat="server" />
                                        <asp:Repeater ID="rpt_cost" runat="server" OnItemDataBound="rpt_cost_ItemDataBound">
                                          <ItemTemplate>
                                            <div class="form-group">
                                              <div class="col-lg-1"></div>
                                                <asp:Label ID="r_lbl" runat="server" class="col-lg-3 col-sm-3 control-label" Text='<%# Eval("PROMPT") %>'></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList Width="320px" ID="ddl_r_value" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                                     <asp:HiddenField ID="hid_field_name" runat="server" Value='<%# Eval("col_name") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_vs_name" runat="server" Value='<%# Eval("SEG_VALUE_SET") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_value" runat="server" Value='<%# Eval("VALUE") %>' ></asp:HiddenField>

                                                </div>
                                            </div>
                                            
                                           </ItemTemplate>  
                                       </asp:Repeater>
                                  </div>
                                 
                                  <div class="modal-footer">
                                  <asp:Button ID="btn_rpt_load" runat="server" CssClass="btn btn-default" Text="Save & Close" OnClick="btn_rpt_load_Click"></asp:Button>
                                  </div>
                                </div>
                               </div>
                            </div>
                           

                         <script type="text/javascript">

                             function PopupBulkQuestion(clientid, clid2) {

                                 $('#' + '' + clientid).val($('#' + '' + clid2).val());
                                 $('#CostVal').modal();
                             }


    </script>

                    </div>
                </section>
            </div>
        </div>
    </div>
</asp:Content>
