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

<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">Investment Profit

                    <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="form-group">
            <div class="col-lg-1"></div>
            <label for="inputPassword1" class="col-lg-2 col-sm-2 control-label">Investment</label>
            <div class="col-lg-4">
            <asp:HiddenField ID="hid_INV_PROF_ID" runat="server"></asp:HiddenField>
            <asp:DropDownList ID="ddl_INV_ID" runat="server" CssClass="form-control"></asp:DropDownList><asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_ddl_INV_ID" ControlToValidate="ddl_INV_ID" ErrorMessage="Investment is required. " ValidationGroup="save" setfocusonerror="true"></asp:RequiredFieldValidator>
            </div>
            </div>

            <div class="form-group">
            <div class="col-lg-1"></div>
            <label for="inputPassword1" class="col-lg-2 col-sm-2 control-label">Amount</label>
            <div class="col-lg-4">
            <asp:TextBox ID="txt_AMOUNT" onkeyup = "javascript:this.value=Comma(this.value);" style="text-align:right" runat="server" placeholder="Amount" CssClass="form-control"></asp:TextBox>
            <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_txt_AMOUNT" ControlToValidate="txt_AMOUNT" ErrorMessage="Amount is required." setfocusonerror="true" ValidationGroup="save"></asp:RequiredFieldValidator>
            </div>
            </div>

            <div class="form-group">
            <div class="col-lg-1"></div>
            <label for="inputPassword1" class="col-lg-2 col-sm-2 control-label">Date From</label>
            <div class="col-lg-4">
              <asp:TextBox ID="txt_DATE_FROM" runat="server" placeholder="Date From" CssClass="form-control datetime"></asp:TextBox>
              <asp:RequiredFieldValidator runat="server" ID="RequiredFieldValidator_txt_DATE_FROM" ControlToValidate="txt_DATE_FROM" ErrorMessage="Date From is required." setfocusonerror="true" ValidationGroup="save"></asp:RequiredFieldValidator>
            </div>
            </div>

            <div class="form-group">
            <div class="col-lg-1"></div>
            <label for="inputPassword1" class="col-lg-2 col-sm-2 control-label">Date To</label>
            <div class="col-lg-4">
            <asp:TextBox ID="txt_DATE_TO" runat="server" placeholder="Date To" CssClass="form-control datetime"></asp:TextBox>
            </div>
            </div>


            <div class="row">
             <div class="pull-right">
                  <asp:Button ID="btn_calculate_profit" class="btn btn-info" runat="server" Text="Calculate Members Profit"  onclick="btncal_Click" ValidationGroup="save" ></asp:Button>
                  <asp:Button ID="btn_save_dtl" class="btn btn-info" runat="server" Text="Save Members Profit"  onclick="btn_save_dtl_Click" ></asp:Button>
              </div>
            </div>

            <div class="row">
            <asp:GridView ID="grd_members" runat="server" AutoGenerateColumns="False" CssClass="table table-advance"
                    onrowdatabound="grd_members_RowDataBound">
             <Columns>
                
                <asp:BoundField HeaderText="Employee" DataField="Employee" />
                <asp:BoundField HeaderText="Percentage" DataField="Amt_per" />
                <asp:BoundField HeaderText="Amount"  />


                   <asp:BoundField HeaderText="ID" DataField="INV_PROF_DTL_ID" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" />
                 <asp:BoundField HeaderText="EmployeeID" DataField="EMPLOYEE_ID"  ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden"/>
                 <asp:BoundField DataField="assignment_id" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" />
            </Columns>
            </asp:GridView>
            </div>

</div>
</section>
            </div>
        </div>
    </asp:Panel>

      <script>
        function Comma(Num) { //function to add commas to textboxes
            Num += '';
            Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
            Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
            x = Num.split('.');
            x1 = x[0];
            x2 = x.length > 1 ? '.' + x[1] : '';
            var rgx = /(\d+)(\d{3})/;
            while (rgx.test(x1))
                x1 = x1.replace(rgx, '$1' + ',' + '$2');
            return x1 + x2;
        }
    </script>
</asp:Content>
