using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35; using Ease.CoreV35.Model; using Ease.CoreV35.Caching; using System.Data.Linq.Mapping; using System.Data; namespace Payroll.BO { #region BonusParameter [Serializable] public class BonusParameter : BasicBaseObject,ISetupManager { #region Cache Store private static Cache _cache = new Cache(typeof(BonusParameter)); #endregion #region Constructor public BonusParameter() { _confirmeRequired = false; _isFestival = false; _EligibleCuttoffDate = false; _isProrated = false; _isOverYearCalculation = false; _flatAmount = 0; _noOfBasic = 0; _noOfDays = 0; _payrollTypeID = null; _noOfEarnedBasic = 0; _noOfDisbusement = 0; _bonusID = null; _BonusParamAdjustItems = null; _BonusParamSalaryItems = null; _BonusServiceLengths = null; _taxProjectInMonth = 1; _percentOfGross = 0; } #endregion #region Internal Class [Serializable] public class BonusServiceLength : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(BonusServiceLength)); #endregion #region Constructor public BonusServiceLength() { _bonusParameterID = null; _lengthOfService = 0; _entitlePercent = 0; } #endregion #region Properties #region BonusParameterID : ID private ID _bonusParameterID; public ID BonusParameterID { get { return _bonusParameterID; } set { base.OnPropertyChange("BonusParameterID", _bonusParameterID, value); _bonusParameterID = value; } } #endregion #region LengthOfService : Int private int _lengthOfService; public int LengthOfService { get { return _lengthOfService; } set { base.OnPropertyChange("LengthOfService", _lengthOfService, value); _lengthOfService = value; } } #endregion #region EntitlePercent : Int private int _entitlePercent; public int EntitlePercent { get { return _entitlePercent; } set { base.OnPropertyChange("EntitlePercent", _entitlePercent, value); _entitlePercent = value; } } #endregion #endregion } #endregion #region Internal Class [Serializable] public class BonusParamSalaryItem : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(BonusParamSalaryItem)); #endregion #region Constructor public BonusParamSalaryItem() { _allowDeductID = 0; _noOfSalary = 0; _percent = 0; _salaryGroupCode = 0; _bonusParameterID = null; } #endregion #region Properties #region AllowDeductID : ID private int _allowDeductID; public int AllowDeductID { get { return _allowDeductID; } set { base.OnPropertyChange("AllowDeductID", _allowDeductID, value); _allowDeductID = value; } } #endregion #region NoOfSalary : Int private int _noOfSalary; public int NoOfSalary { get { return _noOfSalary; } set { base.OnPropertyChange("NoOfSalary", _noOfSalary, value); _noOfSalary = value; } } #endregion #region Percent : Int private int _percent; public int Percent { get { return _percent; } set { base.OnPropertyChange("Percent", _percent, value); _percent = value; } } #endregion #region SalaryGroupCode : Int private int _salaryGroupCode; public int SalaryGroupCode { get { return _salaryGroupCode; } set { base.OnPropertyChange("SalaryGroupCode", _salaryGroupCode, value); _salaryGroupCode = value; } } #endregion #region BonusParameterID : ID private ID _bonusParameterID; public ID BonusParameterID { get { return _bonusParameterID; } set { base.OnPropertyChange("BonusParameterID", _bonusParameterID, value); _bonusParameterID = value; } } #endregion #endregion } #endregion #region Internal Class [Serializable] public class BonusParamAdjustItem : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(BonusParamAdjustItem)); #endregion #region Constructor public BonusParamAdjustItem() { _amount = 0.0; _bonusAdjustItemID = 0; _bonusParameterID = null; } #endregion #region Properties #region Amount : double private double _amount; public double Amount { get { return _amount; } set { base.OnPropertyChange("Amount", _amount, value); _amount = value; } } #endregion #region BonusAdjustItemID : int private int _bonusAdjustItemID; public int BonusAdjustItemID { get { return _bonusAdjustItemID; } set { base.OnPropertyChange("BonusAdjustItemID", _bonusAdjustItemID, value); _bonusAdjustItemID = value; } } #endregion #region BonusParameterID : ID private ID _bonusParameterID; public ID BonusParameterID { get { return _bonusParameterID; } set { base.OnPropertyChange("BonusParameterID", _bonusParameterID, value); _bonusParameterID = value; } } #endregion #endregion } #endregion #region Internal Class [Serializable] public class BonusSlab : AuditTrailBase { #region Cache Store private static Cache _cache = new Cache(typeof(BonusSlab)); #endregion #region Constructor public BonusSlab() { _bonusParameterID = null; _slabType = EnumSlabType.BasicSalary; _SlabAmount = 0.0; _Amount = 0.0; _AmountType = EnumSlabAmountType.FlatAmount; } #endregion #region Properties #region BonusParameterID : ID private ID _bonusParameterID; public ID BonusParameterID { get { return _bonusParameterID; } set { base.OnPropertyChange("BonusParameterID", _bonusParameterID, value); _bonusParameterID = value; } } #endregion #region SlabType : EnumSlabType private EnumSlabType _slabType; public EnumSlabType SlabType { get { return _slabType; } set { base.OnPropertyChange("SlabType",(short) _slabType,(short) value); _slabType = value; } } #endregion #region SlabAmount : Double private double _SlabAmount; public double SlabAmount { get { return _SlabAmount; } set { base.OnPropertyChange("SlabAmount", _SlabAmount, value); _SlabAmount = value; } } #endregion #region Amount : Double private double _Amount; public double Amount { get { return _Amount; } set { base.OnPropertyChange("Amount", _Amount, value); _Amount = value; } } #endregion #region AmountType : EnumSlabAmountType private EnumSlabAmountType _AmountType; public EnumSlabAmountType AmountType { get { return _AmountType; } set { base.OnPropertyChange("AmountType",(short) _AmountType, (short)value); _AmountType = value; } } #endregion #endregion } #endregion #region Properties #region confirmeRequired : bool private bool _confirmeRequired; public bool ConfirmeRequired { get { return _confirmeRequired; } set { base.OnPropertyChange("confirmeRequired", _confirmeRequired, value); _confirmeRequired = value; } } #endregion #region IsFestival : bool private bool _isFestival; public bool IsFestival { get { return _isFestival; } set { base.OnPropertyChange("IsFestival", _isFestival, value); _isFestival = value; } } #endregion #region flatAmount : double private double _flatAmount; public double FlatAmount { get { return _flatAmount; } set { base.OnPropertyChange("flatAmount", _flatAmount, value); _flatAmount = value; } } #endregion #region PerformanceBonusPercent : Double private double _performanceBonusPercent; public double PerformanceBonusPercent { get { return _performanceBonusPercent; } set { base.OnPropertyChange("PerformanceBonusPercent", _performanceBonusPercent, value); _performanceBonusPercent = value; } } #endregion #region Q1:Double private double _q1; public double Q1 { get { return _q1; } set { base.OnPropertyChange("Q1", _q1, value); _q1 = value; } } #endregion #region Q2:Double private double _q2; public double Q2 { get { return _q2; } set { base.OnPropertyChange("Q2", _q2, value); _q2 = value; } } #endregion #region Q3:double private double _q3; public double Q3 { get { return _q3; } set { base.OnPropertyChange("Q3", _q3, value); _q3 = value; } } #endregion #region Q4:Double private double _q4; public double Q4 { get { return _q4; } set { base.OnPropertyChange("Q4", _q4, value); _q4 = value; } } #endregion #region noOfBasic : int private double _noOfBasic; public double NoOfBasic { get { return _noOfBasic; } set { base.OnPropertyChange("noOfBasic", _noOfBasic, value); _noOfBasic = value; } } #endregion #region noOfDays : int private int _noOfDays; public int NoOfDays { get { return _noOfDays; } set { base.OnPropertyChange("noOfDays", _noOfDays, value); _noOfDays = value; } } #endregion #region TaxProjectInMonth : int private int _taxProjectInMonth; public int TaxProjectInMonth { get { return _taxProjectInMonth; } set { _taxProjectInMonth = value; } } #endregion #region PayrollTypeID : ID private ID _payrollTypeID; public ID PayrollTypeID { get { return _payrollTypeID; } set { base.OnPropertyChange("PayrollTypeID", _payrollTypeID, value); _payrollTypeID = value; } } #endregion #region BonusID : ID private ID _bonusID; public ID BonusID { get { return _bonusID; } set { base.OnPropertyChange("BonusID", _bonusID, value); _bonusID = value; } } #endregion #region noOfEarnedBasic : int private int _noOfEarnedBasic; public int NoOfEarnedBasic { get { return _noOfEarnedBasic; } set { base.OnPropertyChange("noOfEarnedBasic", _noOfEarnedBasic, value); _noOfEarnedBasic = value; } } #endregion #region NoOfDisbusement : int private int _noOfDisbusement; public int NoOfDisbusement { get { return _noOfDisbusement; } set { base.OnPropertyChange("NoOfDisbusement", _noOfDisbusement, value); _noOfDisbusement = value; } } #endregion #region noOfGross : int private double _noOfGross; public double NoOfGross { get { return _noOfGross; } set { base.OnPropertyChange("NoOfGross", _noOfGross, value); _noOfGross = value; } } #endregion #region PercentOfGross : int private double _percentOfGross; public double PercentOfGross { get { return _percentOfGross; } set { base.OnPropertyChange("PercentOfGross", _percentOfGross, value); _percentOfGross = value; } } #endregion #region GrossOfDays : int private int _grossOfDays; public int GrossOfDays { get { return _grossOfDays; } set { base.OnPropertyChange("GrossOfDays", _grossOfDays, value); _grossOfDays = value; } } #endregion #region EligibleCuttoffDate : bool private bool _EligibleCuttoffDate; public bool EligibleCuttoffDate { get { return _EligibleCuttoffDate; } set { base.OnPropertyChange("EligibleCuttoffDate", _EligibleCuttoffDate, value); _EligibleCuttoffDate = value; } } #endregion #region IsProrated : bool private bool _isProrated; public bool IsProrated { get { return _isProrated; } set { base.OnPropertyChange("IsProrated", _isProrated, value); _isProrated = value; } } #endregion #region IsOverYearCalculation : bool private bool _isOverYearCalculation; public bool IsOverYearCalculation { get { return _isOverYearCalculation; } set { base.OnPropertyChange("IsOverYearCalculation", _isOverYearCalculation, value); _isOverYearCalculation = value; } } #endregion #region BonusServiceLength : BonusServiceLength private ObjectsTemplate _BonusServiceLengths = null; public ObjectsTemplate 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 ObjectsTemplate _BonusSlabs = null; public ObjectsTemplate 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 ObjectsTemplate _BonusParamSalaryItems = null; public ObjectsTemplate 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 ObjectsTemplate _BonusParamAdjustItems = null; public ObjectsTemplate 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(typeof(IBonusParameterService)); } } #endregion #endregion #region Functions public static BonusParameter Get(ID 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(ID nBonsuID) { BonusParameter oBonusParameter = null; #region Cache Header oBonusParameter = (BonusParameter)_cache["Get", nBonsuID]; if (oBonusParameter != null) return oBonusParameter; #endregion oBonusParameter = BonusParameter.Service.GetByBonusID(nBonsuID, SystemInformation.CurrentSysInfo.PayrollTypeID); #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 ObjectsTemplate Get(EnumStatus status) { #region Cache Header ObjectsTemplate bonusParameters = _cache["Get", status] as ObjectsTemplate; if (bonusParameters != null) return bonusParameters; #endregion try { bonusParameters = Service.Get(status, SystemInformation.CurrentSysInfo.PayrollTypeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } #region Cache Footer _cache.Add(bonusParameters, "Get", status); #endregion return bonusParameters; } public static ObjectsTemplate GetBy(ID nBonusID) { ObjectsTemplate bonusParameters=new ObjectsTemplate(); try { bonusParameters = Service.Get(nBonusID, SystemInformation.CurrentSysInfo.PayrollTypeID); } catch (ServiceException e) { throw new Exception(e.Message, e); } return bonusParameters; } public static ObjectsTemplate GetSerLengthByBonus(ID bonusParamID) { #region Cache Header ObjectsTemplate bonusParameterServiceLengths = _cache["GetSerLengthByBonus", bonusParamID] as ObjectsTemplate; 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 ObjectsTemplate GetSlabByBonus(ID bonusParamID) { #region Cache Header ObjectsTemplate bonusParameterSlabs = _cache["GetSlabByBonus", bonusParamID] as ObjectsTemplate; 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 ObjectsTemplate GetSalaryItemByBonus(ID bonusParamID) { #region Cache Header ObjectsTemplate bonusParamSalaryItems = _cache["GetSalaryItemByBonus", bonusParamID] as ObjectsTemplate; 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 ObjectsTemplate GetAdjustItemByBonus(ID bonusParamID) { #region Cache Header ObjectsTemplate bonusParamAdjustItems = _cache["GetAdjustItemByBonus", bonusParamID] as ObjectsTemplate; 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 ID Save() { base.SetAuditTrailProperties(); return BonusParameter.Service.Save(this); } public void Delete() { BonusParameter.Service.Delete(ID); } #endregion #region ISetupManager Members private ObjectsTemplate _setupDetails; public ObjectsTemplate SetupDetails { get { return _setupDetails; } set { _setupDetails = value; } } public static BonusParameter ApplicableParameters(ObjectsTemplate parameters, Employee employee, ID bonusID) { List 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 ObjectsTemplate ApplicableParameters(Employee employee, ID nBonusID, List setupTypes, ObjectsTemplate setupDetails, List bonusParameters) { EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus); ObjectsTemplate oParams = new ObjectsTemplate(); 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 ObjectsTemplate ApplicableParameters2(Employee employee, ID nBonusID, List setupTypes, ObjectsTemplate details) { EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus); ObjectsTemplate oParams = new ObjectsTemplate(); 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 ObjectsTemplate ApplicableParameters3(Employee employee, ID nBonusID, List setupTypes, ObjectsTemplate details, ObjectsTemplate oParamsAll) { EmployeeSetupParameter empParameter = new EmployeeSetupParameter(EnumParameterSetup.Bonus); ObjectsTemplate oParams = new ObjectsTemplate(); empParameter.Employee = employee; empParameter.ParameterIDs = SetupManager.ApplicableParameters2(employee, EnumParameterSetup.Bonus, setupTypes, details); for (int i = 0; i < empParameter.ParameterIDs.Count; i++) { BonusParameter param =oParamsAll.Find(x=>x.ID==ID.FromInteger(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 GetApplicableParametersByGrade(Employee employee, ID graId, ObjectsTemplate parameters) { List applicableParams = parameters.FindAll(delegate(BonusParameter param) { return IsApplicable(param, graId, employee); }); return applicableParams; } private static bool IsApplicable(BonusParameter param, ID 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(ObjectsTemplate parameters, Employee employee) { List 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 ApplicableParameters(ObjectsTemplate employees) { ObjectsTemplate details = SetupDetail.GetParameters(EnumParameterSetup.Bonus); List types = SetupDetail.GetTypes(EnumParameterSetup.Bonus); List empParametes = new List(); 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(ID 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 ObjectsTemplate GetSetupDetail(ID parmID) { if (this.ID != null && this.ID.IsUnassigned == false) { return BonusParameter.Service.GetSetupDetail(this.ID); } return null; } public static DataTable GetByBonusIDAndTranType(string bonusIDs, EnmSetupManagerTranType tranType) { return BonusParameter.Service.GetByBonusIDAndTranType(bonusIDs, tranType); } } #endregion #region IBonusParameter Service public interface IBonusParameterService { BonusParameter Get(ID nBonusParamID); BonusParameter GetByBonusID(ID nBonusID, ID PayrollTypeID); ObjectsTemplate Get(EnumStatus status, ID PayrollTypeID); ObjectsTemplate Get(ID nBonusID, ID PayrollTypeID); ObjectsTemplate GetSerLengthByBonus(ID bonusParamID); ObjectsTemplate GetSlabByBonus(ID bonusParamID); ObjectsTemplate GetSalaryItemByBonus(ID bonusParamID); ObjectsTemplate GetAdjustItemByBonus(ID bonusParamID); ID Save(BonusParameter item); void Delete(ID id); ObjectsTemplate GetSetupDetail(ID parmID); DataTable GetByBonusIDAndTranType(string bonusIDs, EnmSetupManagerTranType tranType); } #endregion }