1196 lines
36 KiB
C#
1196 lines
36 KiB
C#
using Ease.Core.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
|
|
namespace HRM.BO
|
|
{
|
|
#region BonusParameter
|
|
|
|
public class BonusParameter : BasicBaseObject
|
|
{
|
|
#region Constructor
|
|
|
|
public BonusParameter()
|
|
{
|
|
_confirmeRequired = false;
|
|
_isFestival = false;
|
|
_EligibleCuttoffDate = false;
|
|
_isProrated = false;
|
|
_isOverYearCalculation = false;
|
|
_flatAmount = 0;
|
|
_noOfBasic = 0;
|
|
_noOfDays = 0;
|
|
_payrollTypeID = 0;
|
|
_noOfEarnedBasic = 0;
|
|
_noOfDisbusement = 0;
|
|
_bonusID = 0;
|
|
BonusParamAdjustItems = new List<BonusParamAdjustItem>();
|
|
BonusParamSalaryItems = new List<BonusParamSalaryItem>();
|
|
BonusServiceLengths = new List<BonusServiceLength>();
|
|
BonusParamGrads = new List<BonusParamGrade>();
|
|
_taxProjectInMonth = 1;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Internal Class
|
|
|
|
public class BonusServiceLength : AuditTrailBase
|
|
{
|
|
#region Constructor
|
|
|
|
public BonusServiceLength()
|
|
{
|
|
_bonusParameterID = 0;
|
|
_lengthOfService = 0;
|
|
_entitlePercent = 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region BonusParameterID : ID
|
|
|
|
private int _bonusParameterID;
|
|
|
|
public int BonusParameterID
|
|
{
|
|
get { return _bonusParameterID; }
|
|
set { _bonusParameterID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region LengthOfService : Int
|
|
|
|
private int _lengthOfService;
|
|
|
|
public int LengthOfService
|
|
{
|
|
get { return _lengthOfService; }
|
|
set { _lengthOfService = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EntitlePercent : Int
|
|
|
|
private int _entitlePercent;
|
|
|
|
public int EntitlePercent
|
|
{
|
|
get { return _entitlePercent; }
|
|
set { _entitlePercent = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Internal Class
|
|
|
|
public class BonusParamSalaryItem : AuditTrailBase
|
|
{
|
|
#region Constructor
|
|
|
|
public BonusParamSalaryItem()
|
|
{
|
|
_allowDeductID = 0;
|
|
_noOfSalary = 0;
|
|
_percent = 0;
|
|
_salaryGroupCode = 0;
|
|
_bonusParameterID = 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region AllowDeductID : ID
|
|
|
|
private int _allowDeductID;
|
|
|
|
public int AllowDeductID
|
|
{
|
|
get { return _allowDeductID; }
|
|
set { _allowDeductID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region NoOfSalary : Int
|
|
|
|
private int _noOfSalary;
|
|
|
|
public int NoOfSalary
|
|
{
|
|
get { return _noOfSalary; }
|
|
set { _noOfSalary = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Percent : Int
|
|
|
|
private int _percent;
|
|
|
|
public int Percent
|
|
{
|
|
get { return _percent; }
|
|
set { _percent = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SalaryGroupCode : Int
|
|
|
|
private int _salaryGroupCode;
|
|
|
|
public int SalaryGroupCode
|
|
{
|
|
get { return _salaryGroupCode; }
|
|
set { _salaryGroupCode = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region BonusParameterID : ID
|
|
|
|
private int _bonusParameterID;
|
|
|
|
public int BonusParameterID
|
|
{
|
|
get { return _bonusParameterID; }
|
|
set { _bonusParameterID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Internal Class
|
|
|
|
public class BonusParamAdjustItem : AuditTrailBase
|
|
{
|
|
#region Constructor
|
|
|
|
public BonusParamAdjustItem()
|
|
{
|
|
_amount = 0.0;
|
|
_bonusAdjustItemID = 0;
|
|
_bonusParameterID = 0;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region Amount : double
|
|
|
|
private double _amount;
|
|
|
|
public double Amount
|
|
{
|
|
get { return _amount; }
|
|
set { _amount = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region BonusAdjustItemID : int
|
|
|
|
private int _bonusAdjustItemID;
|
|
|
|
public int BonusAdjustItemID
|
|
{
|
|
get { return _bonusAdjustItemID; }
|
|
set { _bonusAdjustItemID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region BonusParameterID : ID
|
|
|
|
private int _bonusParameterID;
|
|
|
|
public int BonusParameterID
|
|
{
|
|
get { return _bonusParameterID; }
|
|
set { _bonusParameterID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Internal Class
|
|
|
|
public class BonusSlab : AuditTrailBase
|
|
{
|
|
#region Constructor
|
|
|
|
public BonusSlab()
|
|
{
|
|
_bonusParameterID = 0;
|
|
_slabType = EnumSlabType.BasicSalary;
|
|
_SlabAmount = 0.0;
|
|
_Amount = 0.0;
|
|
_AmountType = EnumSlabAmountType.FlatAmount;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region BonusParameterID : ID
|
|
|
|
private int _bonusParameterID;
|
|
|
|
public int BonusParameterID
|
|
{
|
|
get { return _bonusParameterID; }
|
|
set { _bonusParameterID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SlabType : EnumSlabType
|
|
|
|
private EnumSlabType _slabType;
|
|
|
|
public EnumSlabType SlabType
|
|
{
|
|
get { return _slabType; }
|
|
set { _slabType = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region SlabAmount : Double
|
|
|
|
private double _SlabAmount;
|
|
|
|
public double SlabAmount
|
|
{
|
|
get { return _SlabAmount; }
|
|
set { _SlabAmount = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Amount : Double
|
|
|
|
private double _Amount;
|
|
|
|
public double Amount
|
|
{
|
|
get { return _Amount; }
|
|
set { _Amount = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region AmountType : EnumSlabAmountType
|
|
|
|
private EnumSlabAmountType _AmountType;
|
|
|
|
public EnumSlabAmountType AmountType
|
|
{
|
|
get { return _AmountType; }
|
|
set { _AmountType = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Internal Class
|
|
public class BonusParamGrade : AuditTrailBase
|
|
{
|
|
public int BonusParamID { get; set; }
|
|
public int GradeID { get; set; }
|
|
}
|
|
#endregion
|
|
|
|
#region Properties
|
|
|
|
#region confirmeRequired : bool
|
|
|
|
private bool _confirmeRequired;
|
|
|
|
public bool ConfirmeRequired
|
|
{
|
|
get { return _confirmeRequired; }
|
|
set { _confirmeRequired = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsFestival : bool
|
|
|
|
private bool _isFestival;
|
|
|
|
public bool IsFestival
|
|
{
|
|
get { return _isFestival; }
|
|
set { _isFestival = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region flatAmount : double
|
|
|
|
private double _flatAmount;
|
|
|
|
public double FlatAmount
|
|
{
|
|
get { return _flatAmount; }
|
|
set { _flatAmount = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region noOfBasic : int
|
|
|
|
private double _noOfBasic;
|
|
|
|
public double NoOfBasic
|
|
{
|
|
get { return _noOfBasic; }
|
|
set { _noOfBasic = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region noOfDays : int
|
|
|
|
private int _noOfDays;
|
|
|
|
public int NoOfDays
|
|
{
|
|
get { return _noOfDays; }
|
|
set { _noOfDays = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region TaxProjectInMonth : int
|
|
|
|
private int _taxProjectInMonth;
|
|
|
|
public int TaxProjectInMonth
|
|
{
|
|
get { return _taxProjectInMonth; }
|
|
set { _taxProjectInMonth = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region PayrollTypeID : ID
|
|
|
|
private int _payrollTypeID;
|
|
|
|
public int PayrollTypeID
|
|
{
|
|
get { return _payrollTypeID; }
|
|
set { _payrollTypeID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region BonusID : ID
|
|
|
|
private int _bonusID;
|
|
|
|
public int BonusID
|
|
{
|
|
get { return _bonusID; }
|
|
set { _bonusID = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region noOfEarnedBasic : int
|
|
|
|
private int _noOfEarnedBasic;
|
|
|
|
public int NoOfEarnedBasic
|
|
{
|
|
get { return _noOfEarnedBasic; }
|
|
set { _noOfEarnedBasic = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region NoOfDisbusement : int
|
|
|
|
private int _noOfDisbusement;
|
|
|
|
public int NoOfDisbusement
|
|
{
|
|
get { return _noOfDisbusement; }
|
|
set { _noOfDisbusement = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region noOfGross : int
|
|
|
|
private double _noOfGross;
|
|
|
|
public double NoOfGross
|
|
{
|
|
get { return _noOfGross; }
|
|
set { _noOfGross = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region PercentOfGross : int
|
|
|
|
private int _percentOfGross;
|
|
|
|
public int PercentOfGross
|
|
{
|
|
get { return _percentOfGross; }
|
|
set { _percentOfGross = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GrossOfDays : int
|
|
|
|
private int _grossOfDays;
|
|
|
|
public int GrossOfDays
|
|
{
|
|
get { return _grossOfDays; }
|
|
set { _grossOfDays = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region EligibleCuttoffDate : bool
|
|
|
|
private bool _EligibleCuttoffDate;
|
|
|
|
public bool EligibleCuttoffDate
|
|
{
|
|
get { return _EligibleCuttoffDate; }
|
|
set { _EligibleCuttoffDate = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsProrated : bool
|
|
|
|
private bool _isProrated;
|
|
|
|
public bool IsProrated
|
|
{
|
|
get { return _isProrated; }
|
|
set { _isProrated = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsOverYearCalculation : bool
|
|
|
|
private bool _isOverYearCalculation;
|
|
|
|
public bool IsOverYearCalculation
|
|
{
|
|
get { return _isOverYearCalculation; }
|
|
set { _isOverYearCalculation = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IsProjectInTaxCalculation : bool
|
|
|
|
private bool _isProjectInTaxCalculation;
|
|
|
|
public bool IsProjectInTaxCalculation
|
|
{
|
|
get { return _isProjectInTaxCalculation; }
|
|
set { _isProjectInTaxCalculation = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
public string BonusName { get; set; }
|
|
public string ForConfirmed { get; set; }
|
|
|
|
private string _ApplicableGrades;
|
|
|
|
public string ApplicableGrades
|
|
{
|
|
get { return _ApplicableGrades; }
|
|
set { _ApplicableGrades = value; }
|
|
}
|
|
|
|
public DateTime? firstProjectMonth { get; set; }
|
|
public DateTime? secondProjectMonth { get; set; }
|
|
|
|
public List<BonusParameter.BonusServiceLength> BonusServiceLengths { get; set; }
|
|
public List<BonusParameter.BonusSlab> BonusSlabs { get; set; }
|
|
public List<BonusParameter.BonusParamSalaryItem> BonusParamSalaryItems { get; set; }
|
|
public List<BonusParameter.BonusParamAdjustItem> BonusParamAdjustItems { get; set; }
|
|
public List<BonusParameter.BonusParamGrade> BonusParamGrads { get; set; }
|
|
|
|
//#region BonusServiceLength : BonusServiceLength
|
|
|
|
//private List<BonusParameter.BonusServiceLength> _BonusServiceLengths = null;
|
|
//public List<BonusParameter.BonusServiceLength> BonusServiceLengths
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_BonusServiceLengths == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
// {
|
|
// _BonusServiceLengths = BonusParameter.GetSerLengthByBonus(this.ID);
|
|
// }
|
|
// return this._BonusServiceLengths;
|
|
// }
|
|
// set
|
|
// {
|
|
// _BonusServiceLengths = value;
|
|
// }
|
|
//}
|
|
//#endregion
|
|
|
|
//#region BonusSlabs : BonusSlabs
|
|
|
|
//private List<BonusParameter.BonusSlab> _BonusSlabs = null;
|
|
//public List<BonusParameter.BonusSlab> BonusSlabs
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_BonusSlabs == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
// {
|
|
// _BonusSlabs = BonusParameter.GetSlabByBonus(this.ID);
|
|
// }
|
|
// return this._BonusSlabs;
|
|
// }
|
|
// set
|
|
// {
|
|
// _BonusSlabs = value;
|
|
// }
|
|
//}
|
|
//#endregion
|
|
|
|
//#region BonusParamSalaryItem : BonusParamSalaryItem
|
|
|
|
//private List<BonusParameter.BonusParamSalaryItem> _BonusParamSalaryItems = null;
|
|
//public List<BonusParameter.BonusParamSalaryItem> BonusParamSalaryItems
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_BonusParamSalaryItems == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
// {
|
|
// _BonusParamSalaryItems = BonusParameter.GetSalaryItemByBonus(this.ID);
|
|
// }
|
|
// return this._BonusParamSalaryItems;
|
|
// }
|
|
// set
|
|
// {
|
|
// _BonusParamSalaryItems = value;
|
|
// }
|
|
//}
|
|
//#endregion
|
|
|
|
//#region BonusParamAdjustItem : BonusParamAdjustItem
|
|
|
|
//private List<BonusParameter.BonusParamAdjustItem> _BonusParamAdjustItems = null;
|
|
//public List<BonusParameter.BonusParamAdjustItem> BonusParamAdjustItems
|
|
//{
|
|
// get
|
|
// {
|
|
// if (_BonusParamAdjustItems == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
|
|
// {
|
|
// _BonusParamAdjustItems = BonusParameter.GetAdjustItemByBonus(this.ID);
|
|
// }
|
|
// return this._BonusParamAdjustItems;
|
|
// }
|
|
// set
|
|
// {
|
|
// _BonusParamAdjustItems = value;
|
|
// }
|
|
//}
|
|
//#endregion
|
|
|
|
//#region Service Factory IBonusService : IBonusService
|
|
|
|
//internal static IBonusParameterService Service
|
|
//{
|
|
// get { return Services.Factory.CreateService<IBonusParameterService>(typeof(IBonusParameterService)); }
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
//#region Functions
|
|
|
|
//public string GetApplicableGradeCodes(List<Grade> oAllGrades)
|
|
//{
|
|
// string strGradeCodes = string.Empty;
|
|
|
|
// if (this.int != null && this.ID.IsUnassigned == false && oAllGrades != null)
|
|
// {
|
|
// this.SetupDetails = BonusParameter.Service.GetSetupDetail(this.ID);
|
|
// List<int> applicableGradeIDs = new List<int>();
|
|
// this.SetupDetails.ForEach(x => applicableGradeIDs.Add(x.TranID.Integer));
|
|
// strGradeCodes = oAllGrades.Where(x => applicableGradeIDs.Contains(x.ID.Integer))
|
|
// .Aggregate(new StringBuilder(), (sb, g) => sb.AppendFormat("{0}, ", g.Code), sb => sb.ToString().Trim(',', ' '));
|
|
// }
|
|
|
|
// return strGradeCodes;
|
|
//}
|
|
|
|
//public static BonusParameter Get(int nBonsuParamID)
|
|
//{
|
|
// BonusParameter oBonusParameter = null;
|
|
// #region Cache Header
|
|
// oBonusParameter = (BonusParameter)_cache["Get", nBonsuParamID];
|
|
// if (oBonusParameter != null)
|
|
// return oBonusParameter;
|
|
// #endregion
|
|
// oBonusParameter = BonusParameter.Service.Get(nBonsuParamID);
|
|
// #region Cache Footer
|
|
// _cache.Add(oBonusParameter, "Get", nBonsuParamID);
|
|
// #endregion
|
|
// return oBonusParameter;
|
|
//}
|
|
|
|
//public static BonusParameter GetByBonusID(int nBonsuID)
|
|
//{
|
|
// BonusParameter oBonusParameter = null;
|
|
// #region Cache Header
|
|
// oBonusParameter = (BonusParameter)_cache["Get", nBonsuID];
|
|
// if (oBonusParameter != null)
|
|
// return oBonusParameter;
|
|
// #endregion
|
|
// oBonusParameter = BonusParameter.Service.GetByBonusID(nBonsuID);
|
|
// #region Cache Footer
|
|
// _cache.Add(oBonusParameter, "Get", nBonsuID);
|
|
// #endregion
|
|
// return oBonusParameter;
|
|
//}
|
|
|
|
public bool IsPercent()
|
|
{
|
|
if (_noOfBasic > 0 || _noOfGross > 0)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
return true;
|
|
}
|
|
|
|
//public string CurrentProcessText()
|
|
//{
|
|
// string scaption="Basic";
|
|
// if (_flatAmount > 0)
|
|
// {
|
|
// scaption = "% Flat Amount";
|
|
// }
|
|
// else if (_noOfBasic > 0)
|
|
// {
|
|
// scaption = "Basic";
|
|
// }
|
|
// else if (_noOfGross > 0)
|
|
// {
|
|
// scaption = "Gross";
|
|
// }
|
|
// else if(this.BonusServiceLengths!=null && this.BonusServiceLengths.Count>0)
|
|
// {
|
|
// scaption = "%";
|
|
// }
|
|
// else if(this.BonusParamSalaryItems!=null && this.BonusParamSalaryItems.Count>0)
|
|
// {
|
|
// scaption = "%";
|
|
// }
|
|
// else if(this.BonusSlabs!=null && this.BonusSlabs.Count>0)
|
|
// {
|
|
// scaption = "%";
|
|
// }
|
|
|
|
// return scaption;
|
|
//}
|
|
|
|
//public double CurrentProcessItem(double nUsedProcess, double nUsedDisburs)
|
|
//{
|
|
// double nAmount = (double)this.NoOfBasic;
|
|
// if (this.NoOfDisbusement - nUsedDisburs == 0) return 1;
|
|
// if (_flatAmount > 0)
|
|
// {
|
|
// nAmount = 100;
|
|
// if ((nAmount - nUsedProcess) == 0 && (this.NoOfDisbusement - nUsedDisburs) == 0)
|
|
// return 0;
|
|
// else
|
|
// nAmount = (nAmount - nUsedProcess) / (this.NoOfDisbusement - nUsedDisburs);
|
|
// }
|
|
// else if (_noOfBasic > 0)
|
|
// {
|
|
// if ((nAmount - nUsedProcess) == 0 && (this.NoOfDisbusement - nUsedDisburs) == 0)
|
|
// return 0;
|
|
// else
|
|
// nAmount = (nAmount - nUsedProcess) / (this.NoOfDisbusement - nUsedDisburs);
|
|
|
|
// }
|
|
// else if (_noOfGross > 0)
|
|
// {
|
|
// if ((nAmount - nUsedProcess) == 0 || (this.NoOfDisbusement - nUsedDisburs) == 0)
|
|
// return 0;
|
|
// else
|
|
// nAmount = (nAmount - nUsedProcess) / (this.NoOfDisbusement - nUsedDisburs);
|
|
// }
|
|
// else if (this.BonusParamSalaryItems != null && this.BonusParamSalaryItems.Count > 0)
|
|
// {
|
|
// nAmount = 100;
|
|
// if ((nAmount - nUsedProcess) == 0 || (this.NoOfDisbusement - nUsedDisburs) == 0)
|
|
// return 0;
|
|
// else
|
|
// nAmount = (nAmount - nUsedProcess) / (this.NoOfDisbusement - nUsedDisburs);
|
|
|
|
// }
|
|
// else if (this.BonusServiceLengths != null && this.BonusServiceLengths.Count > 0)
|
|
// {
|
|
// nAmount = 100;
|
|
// if ((nAmount - nUsedProcess) == 0 || (this.NoOfDisbusement - nUsedDisburs) == 0)
|
|
// return 0;
|
|
// else
|
|
// nAmount = (nAmount - nUsedProcess) / (this.NoOfDisbusement - nUsedDisburs);
|
|
// }
|
|
// else if (this.BonusSlabs != null && this.BonusSlabs.Count > 0)
|
|
// {
|
|
// nAmount = 100;
|
|
// if ((nAmount - nUsedProcess) == 0 || (this.NoOfDisbusement - nUsedDisburs) == 0)
|
|
// return 0;
|
|
// else
|
|
// nAmount = (nAmount - nUsedProcess) / (this.NoOfDisbusement - nUsedDisburs);
|
|
// }
|
|
// return nAmount;
|
|
//}
|
|
|
|
////public double CurrentProcessItem(DateTime dBonusYear)
|
|
////{
|
|
//// double nAmount =(double) this.NoOfBasic;
|
|
//// if (_flatAmount > 0)
|
|
//// {
|
|
//// nAmount = 100;
|
|
//// nAmount = nAmount/ this.NoOfDisbusement;
|
|
//// }
|
|
//// else if (_noOfBasic > 0)
|
|
//// {
|
|
//// nAmount = nAmount / this.NoOfDisbusement;
|
|
|
|
//// }
|
|
//// else if (_noOfGross > 0)
|
|
//// {
|
|
//// nAmount = nAmount / this.NoOfDisbusement;
|
|
//// }
|
|
//// else if(this.BonusParamSalaryItems!=null && this.BonusParamSalaryItems.Count>0)
|
|
//// {
|
|
//// nAmount = 100;
|
|
//// nAmount = nAmount / this.NoOfDisbusement;
|
|
//// }
|
|
//// else if(this.BonusServiceLengths!=null && this.BonusServiceLengths.Count>0)
|
|
//// {
|
|
//// nAmount = 100;
|
|
//// nAmount = nAmount / this.NoOfDisbusement;
|
|
//// }
|
|
//// else if (this.BonusSlabs != null && this.BonusSlabs.Count > 0)
|
|
//// {
|
|
//// nAmount = 100;
|
|
//// nAmount = nAmount / this.NoOfDisbusement;
|
|
//// }
|
|
//// return nAmount;
|
|
////}
|
|
|
|
//public static List<BonusParameter> Get(EnumStatus status)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// List<BonusParameter> bonusParameters = _cache["Get", status] as List<BonusParameter>;
|
|
// if (bonusParameters != null)
|
|
// return bonusParameters;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// bonusParameters = Service.Get(status);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(bonusParameters, "Get", status);
|
|
|
|
// #endregion
|
|
|
|
// return bonusParameters;
|
|
//}
|
|
|
|
|
|
//public static List<BonusParameter.BonusServiceLength> GetSerLengthByBonus(int bonusParamID)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// List<BonusParameter.BonusServiceLength> bonusParameterServiceLengths = _cache["GetSerLengthByBonus", bonusParamID] as List<BonusParameter.BonusServiceLength>;
|
|
// if (bonusParameterServiceLengths != null)
|
|
// return bonusParameterServiceLengths;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// bonusParameterServiceLengths = Service.GetSerLengthByBonus(bonusParamID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(bonusParameterServiceLengths, "GetSerLengthByBonus", bonusParamID);
|
|
|
|
// #endregion
|
|
|
|
// return bonusParameterServiceLengths;
|
|
//}
|
|
|
|
//public static List<BonusParameter.BonusSlab> GetSlabByBonus(int bonusParamID)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// List<BonusParameter.BonusSlab> bonusParameterSlabs = _cache["GetSlabByBonus", bonusParamID] as List<BonusParameter.BonusSlab>;
|
|
// if (bonusParameterSlabs != null)
|
|
// return bonusParameterSlabs;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// bonusParameterSlabs = Service.GetSlabByBonus(bonusParamID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(bonusParameterSlabs, "GetSlabByBonus", bonusParamID);
|
|
|
|
// #endregion
|
|
|
|
// return bonusParameterSlabs;
|
|
//}
|
|
|
|
//public static List<BonusParameter.BonusParamSalaryItem> GetSalaryItemByBonus(int bonusParamID)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// List<BonusParameter.BonusParamSalaryItem> bonusParamSalaryItems = _cache["GetSalaryItemByBonus", bonusParamID] as List<BonusParameter.BonusParamSalaryItem>;
|
|
// if (bonusParamSalaryItems != null)
|
|
// return bonusParamSalaryItems;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// bonusParamSalaryItems = Service.GetSalaryItemByBonus(bonusParamID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(bonusParamSalaryItems, "GetSalaryItemByBonus", bonusParamID);
|
|
|
|
// #endregion
|
|
|
|
// return bonusParamSalaryItems;
|
|
//}
|
|
|
|
//public static List<BonusParameter.BonusParamAdjustItem> GetAdjustItemByBonus(int bonusParamID)
|
|
//{
|
|
// #region Cache Header
|
|
|
|
// List<BonusParameter.BonusParamAdjustItem> bonusParamAdjustItems = _cache["GetAdjustItemByBonus", bonusParamID] as List<BonusParameter.BonusParamAdjustItem>;
|
|
// if (bonusParamAdjustItems != null)
|
|
// return bonusParamAdjustItems;
|
|
|
|
// #endregion
|
|
|
|
// try
|
|
// {
|
|
// bonusParamAdjustItems = Service.GetAdjustItemByBonus(bonusParamID);
|
|
// }
|
|
// catch (ServiceException e)
|
|
// {
|
|
// throw new Exception(e.Message, e);
|
|
// }
|
|
|
|
// #region Cache Footer
|
|
|
|
// _cache.Add(bonusParamAdjustItems, "GetAdjustItemByBonus", bonusParamID);
|
|
|
|
// #endregion
|
|
|
|
// return bonusParamAdjustItems;
|
|
//}
|
|
|
|
//public int Save()
|
|
//{
|
|
// base.SetAuditTrailProperties();
|
|
// return BonusParameter.Service.Save(this);
|
|
//}
|
|
//public void Delete()
|
|
//{
|
|
// BonusParameter.Service.Delete(ID);
|
|
//}
|
|
//#endregion
|
|
|
|
//#region ISetupManager Members
|
|
//private List<SetupDetail> _setupDetails;
|
|
//public List<SetupDetail> SetupDetails
|
|
//{
|
|
// get
|
|
// {
|
|
// return _setupDetails;
|
|
// }
|
|
// set
|
|
// {
|
|
// _setupDetails = value;
|
|
// }
|
|
//}
|
|
|
|
//public static BonusParameter ApplicableParameters(List<BonusParameter> parameters, Employee employee, int bonusID)
|
|
//{
|
|
// List<int> paramerIDs = SetupManager.ApplicableParameters(employee, EnumParameterSetup.Bonus);
|
|
// foreach (int i in paramerIDs)
|
|
// {
|
|
// foreach (BonusParameter param in parameters)
|
|
// {
|
|
// if (param.ID.Integer == i && param.BonusID.Integer == bonusID.Integer)
|
|
// return param;
|
|
// }
|
|
// }
|
|
// return null;
|
|
//}
|
|
|
|
|
|
//public static List<BonusParameter> ApplicableParameters(Employee employee, int nBonusID, List<EnmSetupManagerTranType> setupTypes, List<SetupDetail> setupDetails, List<BonusParameter> bonusParameters)
|
|
//{
|
|
// EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus);
|
|
// List<BonusParameter> oParams = new List<BonusParameter>();
|
|
|
|
// empParameter.Employee = employee;
|
|
// empParameter.ParameterIDs = SetupManager.ApplicableParameters(employee, EnumParameterSetup.Bonus,setupTypes,setupDetails);
|
|
|
|
// for (int i = 0; i < empParameter.ParameterIDs.Count; i++)
|
|
// {
|
|
// BonusParameter param = bonusParameters.Find(delegate(BonusParameter bp) { return bp.ID.Integer == empParameter.ParameterIDs[i]; }); //BonusParameter.Get(ID.FromInteger(empParameter.ParameterIDs[i]));
|
|
// if(param!=null)
|
|
// {
|
|
// if (param.BonusID == nBonusID)
|
|
// {
|
|
// oParams.Add(param);
|
|
// }
|
|
// }
|
|
// }
|
|
// return oParams;
|
|
//}
|
|
//public static List<BonusParameter> ApplicableParameters2(Employee employee, int nBonusID, List<EnmSetupManagerTranType> setupTypes, List<SetupDetail> details)
|
|
//{
|
|
// EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus);
|
|
// List<BonusParameter> oParams = new List<BonusParameter>();
|
|
|
|
// empParameter.Employee = employee;
|
|
// empParameter.ParameterIDs = SetupManager.ApplicableParameters2(employee, EnumParameterSetup.Bonus, setupTypes, details);
|
|
|
|
// for (int i = 0; i < empParameter.ParameterIDs.Count; i++)
|
|
// {
|
|
// BonusParameter param = BonusParameter.Get(ID.FromInteger(empParameter.ParameterIDs[i]));
|
|
// if (param != null)
|
|
// {
|
|
// if (param.BonusID == nBonusID)
|
|
// {
|
|
// oParams.Add(param);
|
|
// }
|
|
// }
|
|
// }
|
|
// return oParams;
|
|
//}
|
|
//public static List<BonusParameter> ApplicableParameters3(List<BonusParameter> parameters, Employee employee, int nBonusID, List<EnmSetupManagerTranType> setupTypes, List<SetupDetail> details)
|
|
//{
|
|
// EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus);
|
|
// List<BonusParameter> oParams = new List<BonusParameter>();
|
|
|
|
// empParameter.Employee = employee;
|
|
// empParameter.ParameterIDs = SetupManager.ApplicableParameters2(employee, EnumParameterSetup.Bonus, setupTypes, details);
|
|
|
|
// for (int i = 0; i < empParameter.ParameterIDs.Count; i++)
|
|
// {
|
|
// BonusParameter param = parameters.FirstOrDefault(x => x.ID.Integer == empParameter.ParameterIDs[i]); // BonusParameter.Get(ID.FromInteger(empParameter.ParameterIDs[i]));
|
|
// if (param != null)
|
|
// {
|
|
// if (param.BonusID == nBonusID)
|
|
// {
|
|
// oParams.Add(param);
|
|
// }
|
|
// }
|
|
// }
|
|
// return oParams;
|
|
//}
|
|
|
|
//public static List<BonusParameter> GetApplicableParametersByGrade(Employee employee,
|
|
// int graId, List<BonusParameter> parameters)
|
|
//{
|
|
// List<BonusParameter> applicableParams = parameters.FindAll(delegate(BonusParameter param) { return IsApplicable(param, graId, employee); });
|
|
|
|
// return applicableParams;
|
|
//}
|
|
|
|
//private static bool IsApplicable(BonusParameter param, int graid, Employee employee)
|
|
//{
|
|
// bool isApplicable = false;
|
|
|
|
// foreach (SetupDetail adgrade in param.SetupDetails)
|
|
// {
|
|
|
|
// if (adgrade.TranID.Integer == graid.Integer)
|
|
// {
|
|
// isApplicable = true;
|
|
// }
|
|
// }
|
|
// if (!isApplicable) return false;
|
|
|
|
// return true;
|
|
//}
|
|
|
|
//public static BonusParameter ApplicableParameters(List<BonusParameter> parameters, Employee employee)
|
|
//{
|
|
// List<int> paramerIDs = SetupManager.ApplicableParameters(employee, EnumParameterSetup.Bonus);
|
|
// foreach (int i in paramerIDs)
|
|
// {
|
|
// foreach (BonusParameter param in parameters)
|
|
// {
|
|
// if (param.ID.Integer == i)
|
|
// return param;
|
|
// }
|
|
// }
|
|
// return null;
|
|
//}
|
|
//public EmployeeSetupParameter ApplicableParameters(Employee employee)
|
|
//{
|
|
// EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus);
|
|
// empParameter.Employee = employee;
|
|
// empParameter.ParameterIDs = SetupManager.ApplicableParameters(employee, EnumParameterSetup.Bonus);
|
|
// return empParameter;
|
|
//}
|
|
|
|
//public List<EmployeeSetupParameter> ApplicableParameters(List<Employee> employees)
|
|
//{
|
|
// List<SetupDetail> details = SetupDetail.GetParameters(EnumParameterSetup.Bonus);
|
|
// List<EnmSetupManagerTranType> types = SetupDetail.GetTypes(EnumParameterSetup.Bonus);
|
|
// List<EmployeeSetupParameter> empParametes = new List<EmployeeSetupParameter>();
|
|
// foreach (Employee emp in employees)
|
|
// {
|
|
// EmployeeSetupParameter empparameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus);
|
|
// empparameter.Employee = emp;
|
|
// empparameter.ParameterIDs = SetupManager.ApplicableParameters(emp, EnumParameterSetup.Bonus,
|
|
// types, details);
|
|
// empParametes.Add(empparameter);
|
|
// }
|
|
// return empParametes;
|
|
//}
|
|
//public void FillMe(int id)
|
|
//{
|
|
// BonusParameter bp = BonusParameter.Get(id);
|
|
|
|
// this.BonusID = bp.BonusID;
|
|
// this.NoOfBasic = bp.NoOfBasic;
|
|
// this.NoOfDays = bp.NoOfDays;
|
|
// this.NoOfEarnedBasic = bp.NoOfEarnedBasic;
|
|
// this.FlatAmount = bp.FlatAmount;
|
|
// this.ConfirmeRequired = bp.ConfirmeRequired;
|
|
// this.PayrollTypeID = bp.PayrollTypeID;
|
|
// this.CreatedBy = bp.CreatedBy;
|
|
// this.CreatedDate = bp.CreatedDate;
|
|
// this.ModifiedBy = bp.ModifiedBy;
|
|
// this.ModifiedDate = bp.ModifiedDate;
|
|
// this.SetID(bp.ID);
|
|
// this.SetState(ObjectState.Saved);
|
|
//}
|
|
//#endregion
|
|
|
|
public double GeneralAmount(double basicSalary, double GrossSalary)
|
|
{
|
|
double nTotalBonus = 0.0;
|
|
nTotalBonus = this.FlatAmount + (GrossSalary * this.NoOfGross) + (basicSalary * this.NoOfBasic) +
|
|
(GrossSalary * this.PercentOfGross / 100) + (basicSalary * this.NoOfEarnedBasic);
|
|
// nTotalBonus = nTotalBonus + ConvertToDailyRate(oEmp.BasicSalary, SalaryMonthDate) * oBParameter.NoOfDays + ConvertToDailyRate(oEmp.GrossSalary, SalaryMonthDate) * oBParameter.GrossOfDays;
|
|
return nTotalBonus;
|
|
}
|
|
|
|
//public List<SetupDetail> GetSetupDetail(int parmID)
|
|
//{
|
|
// if (this.int != null && this.ID.IsUnassigned == false)
|
|
// {
|
|
// return BonusParameter.Service.GetSetupDetail(this.ID);
|
|
// }
|
|
// return null;
|
|
//}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region IBonusParameter Service
|
|
|
|
public interface IBonusParameterService
|
|
{
|
|
BonusParameter Get(int nBonusParamID);
|
|
|
|
BonusParameter GetByBonusID(int nBonusID);
|
|
List<BonusParameter> Get(EnumStatus status);
|
|
List<BonusParameter> Get(EnumStatus status, int payrollTypeId);
|
|
List<BonusParameter.BonusServiceLength> GetSerLengthByBonus(int bonusParamID);
|
|
List<BonusParameter.BonusSlab> GetSlabByBonus(int bonusParamID);
|
|
List<BonusParameter.BonusParamSalaryItem> GetSalaryItemByBonus(int bonusParamID);
|
|
List<BonusParameter.BonusParamAdjustItem> GetAdjustItemByBonus(int bonusParamID);
|
|
List<BonusParameter.BonusParamGrade> GetUsedGrades(int bonusID);
|
|
int Save(BonusParameter item);
|
|
void Delete(int id);
|
|
|
|
//List<SetupDetail> GetSetupDetail(int parmID);
|
|
}
|
|
|
|
#endregion
|
|
} |