<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="True" CodeBehind="PAY_PAYROLLS.aspx.cs"
    Inherits="HRMS.PAY_PAYROLLS" Title="Cloud HR - Payroll" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:Panel ID="main_pnl" runat="server">
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading" style="padding-bottom:30px">
                           <span class="label label-primary">Payroll</span>
                     <div class="pull-right">
                        <asp:Button ID="btnSave" class="btn btn-info" runat="server" Text="Save"  onclick="btnSave_Click" ValidationGroup="save" ></asp:Button>
                        <a href="#" id="aCancel" runat="server" class="btn btn-info">Back</a>

                     </div>
                     </header>
                        <div class="panel-body">
                            <div class="span6">
                                <div id="divMessage" runat="server" visible="false" class="alert alert-info alert-dismissable">
                                    <i class="icon-check-sign"></i>
                                    <asp:Label ID="lblMessage" class="msg" runat="server" Text="" ></asp:Label>
                                </div>
                                <div class="span6">
                                    <div id="diverrorMessage" runat="server" visible="false" class="alert alert-danger alert-dismissable">
                                         <i class="icon-check-sign"></i>
                                        <asp:Label ID="lblerrorMessage" class="msg" runat="server" Text="" ></asp:Label>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                    <label class="control-label col-md-3">Business Group</label>
                                      <div class="col-md-3">
                                          <asp:DropDownList ID="ddl_BUSINESS_GROUP_ID" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddl_BUSINESS_GROUP_ID_OnSelectedIndexChanged" CssClass="form-control select2"></asp:DropDownList>
                                          <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_ddl_BUSINESS_GROUP_ID" ControlToValidate="ddl_BUSINESS_GROUP_ID" ErrorMessage="Business Group is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                                       </div>   
                                    <label class="control-label col-md-2">Organization</label>
                                      <div class="col-md-3">
                                           <asp:DropDownList ID="ddl_ORGANIZATION_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                           <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_ddl_ORGANIZATION_ID" ControlToValidate="ddl_ORGANIZATION_ID" ErrorMessage="Organization is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                                      </div>   
                            </div>
                            <div class="row">
                                    <label class="control-label col-md-3">Name</label>
                                      <div class="col-md-3">
                                      <asp:HiddenField ID="hid_noy" runat="server"></asp:HiddenField>
                                      <asp:HiddenField id="hid_cost" runat="server" />
                                          <asp:HiddenField ID="hid_PAYROLL_ID" runat="server"></asp:HiddenField>
                                          <asp:TextBox ID="txt_PAYROLL_NAME" runat="server"  CssClass="form-control"></asp:TextBox>
                                          <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_txt_PAYROLL_NAME" ControlToValidate="txt_PAYROLL_NAME" ErrorMessage="Name is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                                       </div>   
                                    <label class="control-label col-md-2">Period Type</label>
                                      <div class="col-md-2">
                                         <asp:DropDownList ID="ddl_PERIOD_TYPE" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                      </div>   
                            </div>

                            <div class="row">
                                    <label class="control-label col-md-3">First Period End Date</label>
                                       <div class="col-md-2">
                                         <asp:TextBox ID="txt_FIRST_PERIOD_END_DATE" runat="server" CssClass="form-control datetime"></asp:TextBox>
                                       </div>   

                                    <label class="control-label col-md-3">Number Of Years</label>
                                      <div class="col-md-2">
                                        <asp:TextBox ID="txt_NUMBER_OF_YEARS" runat="server" CssClass="form-control"></asp:TextBox>
                                      </div>   
                            </div>

                            <br />
                            <div class="row">
                                <div class="col-md-9 col-md-offset-2">
                                 <h5>Date Offset</h5>
                                 <hr style="margin-bottom:10px !important;margin-top:0px !important;"/>
                                  <div class="row">
                                       <label class="control-label col-md-2">Check</label>
                                         <div class="col-md-2">
                                           <asp:TextBox ID="txt_PAY_DATE_OFFSET" runat="server" CssClass="form-control"></asp:TextBox>
                                         </div>
                                          <label class="control-label col-md-2">Scheduled Run</label>
                                          <div class="col-md-2">
                                             <asp:TextBox ID="txt_DIRECT_DEPOSIT_DATE_OFFSET" runat="server" CssClass="form-control"></asp:TextBox>
                                          </div>

                                  </div> 
                                  
                                  <div class="row">
                                          <label class="control-label col-md-2">Cut off</label>
                                          <div class="col-md-2">
                                               <asp:TextBox ID="txt_CUT_OFF_DATE_OFFSET" runat="server"  CssClass="form-control"></asp:TextBox>
                                          </div>
                                  </div>

                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-9 col-md-offset-2">
                                 <h5>Default</h5>
                                 <hr style="margin-bottom:10px !important;margin-top:0px !important;"/>
                                  <div class="row">
                                       <label class="control-label col-md-3">Payment Method</label>
                                         <div class="col-md-6">
                                               <asp:DropDownList ID="ddl_DEFAULT_PAYMENT_METHOD_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                         </div>
                                  </div> 
                                  
                                  <div class="row">
                                          <label class="control-label col-md-3">Consolidation Set</label>
                                          <div class="col-md-6">
                                             <asp:DropDownList ID="ddl_CONSOLIDATION_SET_ID" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                             <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_ddl_CONSOLIDATION_SET_ID" ControlToValidate="ddl_CONSOLIDATION_SET_ID" ErrorMessage="Consolidation Set is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
                                          </div>
                                  </div>
                                  <hr style="margin-bottom:10px !important;"/>
                                  <div class="row">
                                     <label class="control-label col-md-3">Negative Payment Allowed</label>
                                         <div class="col-md-6">
                                           <asp:CheckBox ID="chk_NEGATIVE_PAY_ALLOWED_FLAG" runat="server" CssClass="checkbox"></asp:CheckBox>
                                         </div>
                                  </div>

                                  <div class="row">
                                   <label class="control-label col-md-3">Date From</label>
                                   <div class="col-md-3">
                                      <asp:TextBox ID="txt_EFFECTIVE_START_DATE" runat="server" CssClass="form-control datetime"></asp:TextBox>
                                      <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_txt_EFFECTIVE_START_DATE" ControlToValidate="txt_EFFECTIVE_START_DATE" ErrorMessage="Date From is required." setfocusonerror="true" ValidationGroup="save"></asp:RequiredFieldValidator>
                                   </div>

                                   <label class="control-label col-md-2">Date To</label>
                                   <div class="col-md-3">
                                    <asp:TextBox ID="txt_EFFECTIVE_END_DATE" runat="server"  CssClass="form-control datetime"></asp:TextBox>

                                   </div>
                                  </div>
                                </div>
                            </div>
                      
                         <br />
                        
                        
                       
                       <%--Costing Values Repeater--%>
                          <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:Repeater ID="rpt_cost" runat="server" OnItemDataBound="rpt_cost_OnItemDataBound">
                                          <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="320" 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>
                                  <hr />
                                             <%-- <div class="form-group">
                                              <div class="col-lg-1"></div>
                                                <asp:Label ID="Label1" runat="server" class="col-lg-3 col-sm-3 control-label" Text="Balancing Account"></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList ID="ddl_bal_account" runat="server" CssClass="form-control"></asp:DropDownList>

                                                </div>
                                            </div>--%>
                                  <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal" >Select & Close</button>
                                  </div>
                                </div>
                               </div>
                            </div>


                            <%--Balancing Values Repeater--%>
                          <div class="modal fade" id="BalVal" 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">Balancing Values :</h4>
                                  </div>
                                  <div class="modal-body">
                                        <asp:Repeater ID="rpt_bal" runat="server" OnItemDataBound="rpt_bal_OnItemDataBound">
                                          <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("PROMPTT") %>'></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList Width="320" ID="ddl_br_value" runat="server" CssClass="form-control select2"></asp:DropDownList>
                                                     <asp:HiddenField ID="hid_b_field_name" runat="server" Value='<%# Eval("col_namee") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_b_vs_name" runat="server" Value='<%# Eval("SEG_VALUE_SETT") %>' ></asp:HiddenField>
                                                     <asp:HiddenField ID="hid_b_value" runat="server" Value='<%# Eval("VALUEE") %>' ></asp:HiddenField>

                                                </div>
                                            </div>
                                            
                                           </ItemTemplate>
                                       </asp:Repeater>
                                        
         
                                  </div>
                                  <hr />
                                              <%--<div class="form-group">
                                              <div class="col-lg-1"></div>
                                                <asp:Label ID="Label1" runat="server" class="col-lg-3 col-sm-3 control-label" Text="Balancing Account"></asp:Label>
                                                <div class="col-lg-6">
                                                     <asp:DropDownList ID="ddl_bal_account" runat="server" CssClass="form-control"></asp:DropDownList>

                                                </div>
                                            </div>--%>
                                  <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal" >Select & Close</button>
                                  </div>
                                </div>
                               </div>
                            </div>

                          
                           <div class="row">
                           <div class="col-md-3 pull-right">
                            <a href="#" data-target="#CostVal" data-toggle="modal" id="A1"   runat="server" class="btn btn-block btn-info">Costing Values</a>
                           </div>
                           <div class="col-md-3 pull-right">
                            <a href="#" data-target="#BalVal" data-toggle="modal" id="A3"   runat="server" class="btn btn-block btn-info">Balancing Values</a>
                           </div>
                          </div>





                          <div class="form-group">
                            <asp:Repeater ID="add_info" runat="server">
                             <HeaderTemplate> <header class="panel-heading">Additional Information</header><br /></HeaderTemplate>
                              <ItemTemplate>
                                <div class="form-group">
                                  <div class="col-lg-1"></div>
                                    <asp:Label ID="r_lbl" runat="server" class="col-lg-2 col-sm-2 control-label" Text='<%# Eval("PROMPT") %>'></asp:Label>
                                    <div class="col-lg-4">
                                        <asp:TextBox ID="txt_r_value" runat="server"  placeholder='<%# Eval("PROMPT") %>' Text='<%# Eval("value") %>' CssClass="form-control"></asp:TextBox>
                                         <asp:HiddenField ID="hid_field_name" runat="server" Value='<%# Eval("col_name") %>' ></asp:HiddenField>
                                    </div>
                                </div>
                               </ItemTemplate>
                           </asp:Repeater>
                         </div>



                         <div class="row" >
                              <div class="col-lg-12">
                                     <div class="panel">
                                      <div class="panel-heading">Period Dates</div>
                                             <div class="actions pull-right">
                                                 <div class="btn-group">
                                                   <a href="#" id="aNewDtl" runat="server" class="btn btn-info">Add Period Dates</a>
                                                 </div>
                                              </div>
                               <div id="dtl_div" runat="server" class="panel-body">
                                     <asp:GridView ID="grd_dtl" runat="server"  AutoGenerateColumns="False"   
                                        cellpadding="0" border="0" class="display" onrowcommand="grd_dtl_RowCommand" >
                                        <Columns>
                                             <asp:BoundField HeaderText="Id" DataField="TIME_PERIOD_ID" />
                                             <asp:BoundField HeaderText="Period" DataField="PERIOD_NAME" />
                                             <asp:BoundField HeaderText="Start Date" DataField="START_DATE" />
                                             <asp:BoundField HeaderText="End Date" DataField="END_DATE" />
                                             <asp:BoundField HeaderText="Status" DataField="Status_Desc" />
                                             <asp:TemplateField ItemStyle-Width="6%" HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                                                 <ItemTemplate>
                                                   <asp:LinkButton ID="lnkEdit" runat="server" CommandName="gEdit"><i class="fa fa-pencil" style="font-size:20px !important"></i></asp:LinkButton>
                                                    &nbsp<asp:LinkButton ID="lnkDelete" runat="server" CommandName="gDelete" 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>
                                           <%-- Mandatory--%>
                                           <RowStyle CssClass="rowStyle"/>
                                           <%-- Mandatory--%>
                                           <HeaderStyle CssClass="headerStyle" />
                                           <%-- optional--%>
                                           <FooterStyle  CssClass="footerStyle"  />
                                       </asp:GridView>
                                       
                                       <script src="/ThemeScrips/Datatables/media/js/jquery.js" type="text/javascript"></script>
                                       <script src="/ThemeScrips/Datatables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
                                       <script src="/ThemeScrips/Datatables/media/js/jquery.dataTables.js" type="text/javascript"></script>
                                       <script src="/ThemeScrips/Datatables/media/js/GridviewFix.js" type="text/javascript"></script>
                                       <script type="text/javascript">
                                           //without passing class names.
                                           $("#ContentPlaceHolder1_grd_dtl").GridviewFix().dataTable();
                                           //Passing class names
                                        </script>
                                        
                                        <br />
                                     </div>
                                   </div>
                               </div>
                     </div>
                    </div>
                </section>
            </div>
        </div>
    </asp:Panel>

    <script src="../../ThemeScrips/jquery.min.js"></script>
    <link href="../../ThemeScrips/select2.min.css" rel="stylesheet" />
    <script src="../../ThemeScrips/select2.min.js"></script>
    <script>
        $('.select2').select2();
    </script>
</asp:Content>
