CEL_Payroll/Payroll.BO/Bonus/BonusProcess.cs
2024-09-17 14:30:13 +06:00

1380 lines
43 KiB
C#

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 BonusProcess
[Serializable]
public class BonusProcess : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(BonusProcess));
#endregion
#region Constructor
public BonusProcess()
{
_bonusID = null;
_bonusMonth = DateTime.MinValue;
_basicOnMonth = DateTime.MinValue;
_disburseDate = DateTime.MinValue;
_remarks = string.Empty;
_showInWeb = false;
_IsDisburseWithSalary = false;
_IsTaxProcess = false;
_UsedProcess = 0.0;
// _bonus = null;
}
#endregion
#region Internal Class
#region BonusProcessDetail
[Serializable]
public class BonusProcessDetail : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(BonusProcessDetail));
#endregion
#region Constructor
public BonusProcessDetail()
{
_bonusProcessID = null;
_bonusID = null;
_employeeID = null;
_bonusMonth = DateTime.MinValue;
_bonusAmount = 0;
_basicSalary = 0;
_changeBonusAmount = 0;
_changeAdjustAmount = 0;
_changeSalaryItemAmount = 0;
_changeTaxAmount = 0;
_calculatedAdjustAmount = 0;
_calculatedSalaryItemAmount = 0;
_taxAmount = 0;
_employee = null;
_bonus = null;
_incomeTax = null;
_isProjectedBonus = false;
// _bonusProcess = null;
}
#endregion
#region Internal Class
public class BonusProcessAdjustItem : AuditTrailBase
{
#region Cache Store
private static Cache _cache = new Cache(typeof(BonusProcessAdjustItem));
#endregion
#region Constructor
public BonusProcessAdjustItem()
{
_adjustAmount = 0;
_bonusAdjustID = 0;
_bonusProcessDetailID = null;
//_side = EnumTranSide.Credit;
}
#endregion
#region Properties
#region AdjustAmount : double
private double _adjustAmount;
public double AdjustAmount
{
get { return _adjustAmount; }
set
{
base.OnPropertyChange<double>("AdjustAmount", _adjustAmount, value);
_adjustAmount = value;
}
}
#endregion
#region BonusAdjustID : int
private int _bonusAdjustID;
public int BonusAdjustID
{
get { return _bonusAdjustID; }
set
{
base.OnPropertyChange<int>("BonusAdjustID", _bonusAdjustID, value);
_bonusAdjustID = value;
}
}
#endregion
#region BonusProcessDetailID : ID
private ID _bonusProcessDetailID;
public ID BonusProcessDetailID
{
get { return _bonusProcessDetailID; }
set
{
base.OnPropertyChange<ID>("BonusProcessDetailID", _bonusProcessDetailID, value);
_bonusProcessDetailID = value;
}
}
#endregion
//#region Side : EnumTranSide
//private EnumTranSide _side;
//public EnumTranSide Side
//{
// get { return _side; }
// set {_side = value; }
//}
//#endregion
#endregion
}
#endregion
#region Properties
private bool _isProjectedBonus;
public bool IsProjectedBonus
{
get { return _isProjectedBonus; }
set
{
_isProjectedBonus = value;
}
}
#region BonusProcessID : ID
private ID _bonusProcessID;
public ID BonusProcessID
{
get { return _bonusProcessID; }
set
{
base.OnPropertyChange<ID>("BonusProcessID", _bonusProcessID, value);
_bonusProcessID = value;
}
}
#endregion
#region BonusID : ID
private ID _bonusID;
public ID BonusID
{
get { return _bonusID; }
set
{
base.OnPropertyChange<ID>("BonusID", _bonusID, value);
_bonusID = value;
}
}
#endregion
#region EmployeeID : ID
private ID _employeeID;
public ID EmployeeID
{
get { return _employeeID; }
set
{
base.OnPropertyChange<ID>("EmployeeID", _employeeID, value);
_employeeID = value;
}
}
#endregion
#region disburseDate : DateTime
private DateTime _bonusMonth;
public DateTime BonusMonth
{
get { return _bonusMonth; }
set
{
base.OnPropertyChange<DateTime>("BonusMonth", _bonusMonth, value);
_bonusMonth = value;
}
}
#endregion
#region bonusAmount : double
private double _bonusAmount;
public double BonusAmount
{
get { return _bonusAmount; }
set
{
base.OnPropertyChange<double>("bonusAmount", _bonusAmount, value);
_bonusAmount = value;
}
}
#endregion
#region basicSalary : double
private double _basicSalary;
public double BasicSalary
{
get { return _basicSalary; }
set
{
base.OnPropertyChange<double>("basicSalary", _basicSalary, value);
_basicSalary = value;
}
}
#endregion
private double _grossSalary;
public double GrossSalary
{
get { return _grossSalary; }
set
{
_grossSalary = value;
}
}
#region changeBonusAmount : double
private double _changeBonusAmount;
public double ChangeBonusAmount
{
get { return _changeBonusAmount; }
set
{
base.OnPropertyChange<double>("changeBonusAmount", _changeBonusAmount, value);
_changeBonusAmount = value;
}
}
#endregion
#region changeTaxAmount : double
private double _changeTaxAmount;
public double ChangeTaxAmount
{
get { return _changeTaxAmount; }
set
{
base.OnPropertyChange<double>("changeTaxAmount", _changeTaxAmount, value);
_changeTaxAmount = value;
}
}
#endregion
#region ChangeSalaryItemAmount : double
private double _changeSalaryItemAmount;
public double ChangeSalaryItemAmount
{
get { return _changeSalaryItemAmount; }
set
{
base.OnPropertyChange<double>("ChangeSalaryItemAmount", _changeSalaryItemAmount, value);
_changeSalaryItemAmount = value;
}
}
#endregion
#region ChangeSalaryItemAmount : double
private double _changeAdjustAmount;
public double ChangeAdjustAmount
{
get { return _changeAdjustAmount; }
set
{
base.OnPropertyChange<double>("ChangeAdjustAmount", _changeAdjustAmount, value);
_changeAdjustAmount = value;
}
}
#endregion
#region CalculatedAdjustAmount : double
private double _calculatedAdjustAmount;
public double CalculatedAdjustAmount
{
get { return _calculatedAdjustAmount; }
set
{
base.OnPropertyChange<double>("CalculatedAdjustAmount", _calculatedAdjustAmount, value);
_calculatedAdjustAmount = value;
}
}
#endregion
#region CalculatedSalaryItemAmount : double
private double _calculatedSalaryItemAmount;
public double CalculatedSalaryItemAmount
{
get { return _calculatedSalaryItemAmount; }
set
{
base.OnPropertyChange<double>("CalculatedSalaryItemAmount", _calculatedSalaryItemAmount, value);
_calculatedSalaryItemAmount = value;
}
}
#endregion
#region NetBonusAmount : double
public double NetBonusAmount
{
get {
bool isOtherItem = ConfigurationManager.GetBoolValue("incometax", "taxissalaryotheritem", EnumConfigurationType.Logic);
if(isOtherItem==true) return _changeBonusAmount;
else return (_changeBonusAmount - _changeTaxAmount) ; }
}
#endregion
#region taxAmount : double
private double _taxAmount;
public double TaxAmount
{
get { return _taxAmount; }
set
{
base.OnPropertyChange<double>("taxAmount", _taxAmount, value);
_taxAmount = value;
}
}
#endregion
#region BonusProcessAdjustItems : BonusProcessAdjustItems
private ObjectsTemplate<BonusProcessAdjustItem> _BonusProcessAdjustItems = null;
public ObjectsTemplate<BonusProcessAdjustItem> BonusProcessAdjustItems
{
get
{
//if (_BonusProcessAdjustItems == null)
// this._BonusProcessAdjustItems = new ObjectsTemplate<BonusProcessAdjustItem>();
return this._BonusProcessAdjustItems;
}
set
{
_BonusProcessAdjustItems = value;
}
}
#endregion
#region employee : Employee
private Employee _employee;
public Employee Employee
{
get
{
if (_employeeID.Integer > 0 && _employee == null)
{
_employee = new Employee();
_employee = Employee.Get(_employeeID);
}
return this._employee;
}
set
{
_employee = value;
}
}
#endregion
#region Bonus EmpCostCenter : BonusEmpCotCenter
private ObjectsTemplate<BonusEmpCostCenter> _bonusEmpCostCenters;
public ObjectsTemplate<BonusEmpCostCenter> BonusCostCentersInvolments
{
get
{
if (_bonusEmpCostCenters == null)
{
_bonusEmpCostCenters = new ObjectsTemplate<BonusEmpCostCenter>();
}
return _bonusEmpCostCenters;
}
set
{
_bonusEmpCostCenters = value;
}
}
#endregion
#region bonus : Bonus
private Bonus _bonus;
public Bonus Bonus
{
get
{
if (_bonusID.Integer > 0 && _bonus == null)
{
_bonus = new Bonus();
_bonus = Bonus.Get(_bonusID);
}
return this._bonus;
}
set
{
_bonus = value;
}
}
#endregion
#region BonusProcessAdjustItems : BonusProcessAdjustItems
//private ObjectsTemplate<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem> _BonusProcessAdjustItems = null;
//public ObjectsTemplate<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem> BonusProcessAdjustItems
//{
// get
// {
// return this._BonusProcessAdjustItems;
// }
// set
// {
// _BonusProcessAdjustItems = value;
// }
//}
#endregion
#region Property IncomeTax : ObjectsTemplate<IncomeTax>
private ObjectsTemplate<IncomeTax> _incomeTax = null;
public ObjectsTemplate<IncomeTax> IncomeTaxcoll
{
get
{
return _incomeTax;
}
set
{
_incomeTax = value;
}
}
#endregion Property IncomeTax : ObjectsTemplate<IncomeTax>
#endregion
}
#endregion
#endregion
#region Properties
#region BonusID : ID
private ID _bonusID;
public ID BonusID
{
get { return _bonusID; }
set
{
base.OnPropertyChange<ID>("BonusID", _bonusID, value);
_bonusID = value;
}
}
#endregion
#region bonusMonth : DateTime
private DateTime _bonusMonth;
public DateTime BonusMonth
{
get { return _bonusMonth; }
set
{
base.OnPropertyChange<DateTime>("bonusMonth", _bonusMonth, value);
_bonusMonth = value;
}
}
#endregion
#region basicOnMonth : DateTime
private DateTime _basicOnMonth;
public DateTime BasicOnMonth
{
get { return _basicOnMonth; }
set
{
base.OnPropertyChange<DateTime>("basicOnMonth", _basicOnMonth, value);
_basicOnMonth = value;
}
}
#endregion
#region disburseDate : DateTime
private DateTime _disburseDate;
public DateTime DisburseDate
{
get { return _disburseDate; }
set
{
base.OnPropertyChange<DateTime>("disburseDate", _disburseDate, value);
_disburseDate = value;
}
}
#endregion
#region FestivalDate : DateTime
private DateTime _festivalDate;
public DateTime FestivalDate
{
get { return _festivalDate; }
set
{
base.OnPropertyChange<DateTime>("FestivalDate", _festivalDate, value);
_festivalDate = value;
}
}
#endregion
#region religionID : ID
private ID _religionID;
public ID ReligionID
{
get { return _religionID; }
set
{
base.OnPropertyChange<ID>("ReligionID", _religionID, value);
_religionID = value;
}
}
#endregion
#region remarks : string
private string _remarks;
public string Remarks
{
get { return _remarks; }
set
{
base.OnPropertyChange<string>("remarks", _remarks, value);
_remarks = value;
}
}
#endregion
#region showInWeb : bool
private bool _showInWeb;
public bool ShowInWeb
{
get { return _showInWeb; }
set
{
base.OnPropertyChange<bool>("showInWeb", _showInWeb, value);
_showInWeb = value;
}
}
#endregion
#region IsDisburseWithSalary : bool
private bool _IsDisburseWithSalary;
public bool IsDisburseWithSalary
{
get { return _IsDisburseWithSalary; }
set
{
base.OnPropertyChange<bool>("IsDisburseWithSalary", _IsDisburseWithSalary, value);
_IsDisburseWithSalary = value;
}
}
#endregion
#region IsTaxProcess : bool
private bool _IsTaxProcess;
public bool IsTaxProcess
{
get { return _IsTaxProcess; }
set
{
base.OnPropertyChange<bool>("IsTaxProcess", _IsTaxProcess, value);
_IsTaxProcess = value;
}
}
#endregion
#region BonusProcessDetails : BonusProcessDetails
private ObjectsTemplate<BonusProcess.BonusProcessDetail> _BonusProcessDetails = null;
public ObjectsTemplate<BonusProcess.BonusProcessDetail> BonusProcessDetails
{
get
{
if (_BonusProcessDetails == null)
{
if (!this.ID.IsUnassigned)
{
_BonusProcessDetails = new ObjectsTemplate<BonusProcessDetail>();
_BonusProcessDetails = BonusProcess.Service.GetBonusDetails(this.ID.Integer);
if (_BonusProcessDetails.Count == 0) _BonusProcessDetails = null;
}
}
return _BonusProcessDetails;
}
set { _BonusProcessDetails = value; }
}
#endregion
#region UsedProcess : int
private double _UsedProcess;
public double UsedProcess
{
get { return _UsedProcess; }
set
{
base.OnPropertyChange<double>("UsedProcess", _UsedProcess, value);
_UsedProcess = value;
}
}
#endregion
#region Service Factory IBonusProcessService : IBonusProcessService
internal static IBonusProcessService Service
{
get { return Services.Factory.CreateService<IBonusProcessService>(typeof(IBonusProcessService)); }
}
#endregion
#endregion
#region Functions
public static double GetBonusAmount(DateTime bonusMonthFirstDate, ID employeeID, int bonusID)
{
double bonusAmount = 0;
try
{
bonusAmount = BonusProcess.Service.GetBonusAmount(bonusMonthFirstDate, employeeID, bonusID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return bonusAmount;
}
public static double GetUsedBonusWithinYear(DateTime bonusMonthFirstDate,int bonusID)
{
double usedBonus = 0;
try
{
usedBonus = BonusProcess.Service.GetUsedBonusWithinYear(bonusMonthFirstDate, bonusID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return usedBonus;
}
public static double GetBonusAmountWithinYear(DateTime bonusYearDate, ID employeeID, int bonusID)
{
double bonusAmount = 0;
try
{
bonusAmount = BonusProcess.Service.GetBonusAmountWithinYear(bonusYearDate, employeeID, bonusID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return bonusAmount;
}
public static double GetBonusPaidAmount(DateTime date1, DateTime date2, ID employeeID, int bonusID)
{
double bonusAmount = 0;
try
{
bonusAmount = BonusProcess.Service.GetBonusPaidAmount(date1, date2, employeeID, bonusID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return bonusAmount;
}
public static double GetBonusAmountWithinYear(DateTime bonusYearDate, ID employeeID, int bonusID,int nReligionID)
{
double bonusAmount = 0;
try
{
bonusAmount = BonusProcess.Service.GetBonusAmountWithinYear(bonusYearDate, employeeID, bonusID, SystemInformation.CurrentSysInfo.PayrollTypeID, nReligionID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return bonusAmount;
}
public static double GetKPIBonusAmountWithinYear(DateTime bonusYearDate, ID employeeID, int bonusID, int nReligionID)
{
double bonusAmount = 0;
try
{
bonusAmount = BonusProcess.Service.GetKPIBonusAmountWithinYear(bonusYearDate, employeeID, bonusID, SystemInformation.CurrentSysInfo.PayrollTypeID, nReligionID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return bonusAmount;
}
public static double GetPreviousKPIBonusAmount(ID employeeID, int bonusID, string bonusProcessIDs)
{
double bonusAmount = 0;
try
{
bonusAmount = BonusProcess.Service.GetPreviousKPIBonusAmount(employeeID, bonusID, bonusProcessIDs, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return bonusAmount;
}
public static double GetKPIBonusAmountWithinYearPercent(DateTime bonusYearDate, ID employeeID, int bonusID, int nReligionID)
{
double bonusAmount = 0;
try
{
bonusAmount = BonusProcess.Service.GetKPIBonusAmountWithinYearPercent(bonusYearDate, employeeID, bonusID, SystemInformation.CurrentSysInfo.PayrollTypeID, nReligionID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return bonusAmount;
}
public static BonusProcess Get(ID nID)
{
BonusProcess oBonusProcess = null;
#region Cache Header
oBonusProcess = (BonusProcess)_cache["Get", nID];
if (oBonusProcess != null)
return oBonusProcess;
#endregion
oBonusProcess = BonusProcess.Service.Get(nID, SystemInformation.CurrentSysInfo.PayrollTypeID);
#region Cache Footer
_cache.Add(oBonusProcess, "Get", nID);
#endregion
return oBonusProcess;
}
public static BonusProcess Get(ID nBonusID, DateTime bonusMonth)
{
BonusProcess oBonusProcess = null;
oBonusProcess = BonusProcess.Service.Get(nBonusID, bonusMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
return oBonusProcess;
}
public static BonusProcess Get(ID nBonusID, DateTime bonusMonth,int nQuarterID)
{
BonusProcess oBonusProcess = null;
oBonusProcess = BonusProcess.Service.Get(nBonusID, bonusMonth, SystemInformation.CurrentSysInfo.PayrollTypeID, nQuarterID);
return oBonusProcess;
}
public static ObjectsTemplate<BonusProcess> GetProcess(DateTime bonusMonth)
{
#region Cache Header
ObjectsTemplate<BonusProcess> bonusProcesss = _cache["GetProcess", bonusMonth] as ObjectsTemplate<BonusProcess>;
if (bonusProcesss != null)
return bonusProcesss;
#endregion
try
{
bonusProcesss = Service.GetProcess(bonusMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesss, "GetProcess", bonusMonth);
#endregion
return bonusProcesss;
}
public static ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth, bool bPayWithsalary)
{
#region Cache Header
ObjectsTemplate<BonusProcess.BonusProcessDetail> bonusProcesssDetails = _cache["GetBonusDetails", dMonth, bPayWithsalary] as ObjectsTemplate<BonusProcess.BonusProcessDetail>;
if (bonusProcesssDetails != null)
return bonusProcesssDetails;
#endregion
try
{
bonusProcesssDetails = Service.GetBonusDetails(dMonth, bPayWithsalary, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesssDetails, "GetBonusDetails", dMonth, bPayWithsalary);
#endregion
return bonusProcesssDetails;
}
public static ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth, bool bPayWithsalary,int nEmpID)
{
#region Cache Header
ObjectsTemplate<BonusProcess.BonusProcessDetail> bonusProcesssDetails = _cache["GetBonusDetails", dMonth, bPayWithsalary] as ObjectsTemplate<BonusProcess.BonusProcessDetail>;
if (bonusProcesssDetails != null)
return bonusProcesssDetails;
#endregion
try
{
bonusProcesssDetails = Service.GetBonusDetails(dMonth, bPayWithsalary, SystemInformation.CurrentSysInfo.PayrollTypeID, nEmpID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesssDetails, "GetBonusDetails", dMonth, bPayWithsalary);
#endregion
return bonusProcesssDetails;
}
public static ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth, int nEmpID,int nBonusID)
{
#region Cache Header
ObjectsTemplate<BonusProcess.BonusProcessDetail> bonusProcesssDetails = _cache["GetBonusDetails", dMonth] as ObjectsTemplate<BonusProcess.BonusProcessDetail>;
if (bonusProcesssDetails != null)
return bonusProcesssDetails;
#endregion
try
{
bonusProcesssDetails = Service.GetBonusDetails(dMonth, nEmpID, nBonusID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesssDetails, "GetBonusDetails", dMonth);
#endregion
return bonusProcesssDetails;
}
public static ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth)
{
#region Cache Header
ObjectsTemplate<BonusProcess.BonusProcessDetail> bonusProcesssDetails = _cache["GetBonusDetails", dMonth] as ObjectsTemplate<BonusProcess.BonusProcessDetail>;
if (bonusProcesssDetails != null)
return bonusProcesssDetails;
#endregion
try
{
bonusProcesssDetails = Service.GetBonusDetails(dMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesssDetails, "GetBonusDetails", dMonth);
#endregion
return bonusProcesssDetails;
}
public static ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(int nID)
{
#region Cache Header
ObjectsTemplate<BonusProcess.BonusProcessDetail> bonusProcesssDetails = _cache["GetBonusDetails", nID] as ObjectsTemplate<BonusProcess.BonusProcessDetail>;
if (bonusProcesssDetails != null)
return bonusProcesssDetails;
#endregion
try
{
bonusProcesssDetails = Service.GetBonusDetails(nID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesssDetails, "GetBonusDetails", nID);
#endregion
return bonusProcesssDetails;
}
public static ObjectsTemplate<BonusProcess.BonusProcessDetail> GetSumOfBonusDetails(DateTime fromMonth, DateTime toMonth)
{
#region Cache Header
ObjectsTemplate<BonusProcess.BonusProcessDetail> bonusProcesssDetails = _cache["GetSumOfBonusDetails", fromMonth, toMonth] as ObjectsTemplate<BonusProcess.BonusProcessDetail>;
if (bonusProcesssDetails != null)
return bonusProcesssDetails;
#endregion
try
{
bonusProcesssDetails = Service.GetSumOfBonusDetails(fromMonth, toMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesssDetails, "GetSumOfBonusDetails", fromMonth, toMonth);
#endregion
return bonusProcesssDetails;
}
//public static ObjectsTemplate<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem> GetBProcessAdjust(ID bonusProDetailID)
//{
// #region Cache Header
// ObjectsTemplate<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem> bonusProcessAdjustItems = _cache["GetBProcessAdjust", bonusProDetailID] as ObjectsTemplate<BonusProcess.BonusProcessDetail.BonusProcessAdjustItem>;
// if (bonusProcessAdjustItems != null)
// return bonusProcessAdjustItems;
// #endregion
// try
// {
// bonusProcessAdjustItems = Service.GetBProcessAdjust(bonusProDetailID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(bonusProcessAdjustItems, "GetBProcessAdjust", bonusProDetailID);
// #endregion
// return bonusProcessAdjustItems;
//}
public static DataSet GetBonusRegisterCarFuel(DateTime dBonusMonth, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetBonusRegisterCarFuel(dBonusMonth, sEmpID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetBonusRegister(ID BonusID,DateTime dBonusMonth, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetBonusRegister(BonusID,dBonusMonth, sEmpID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetBonusBankAdvice(ID BonusID, DateTime dBonusMonth, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetBonusBankAdvice(BonusID, dBonusMonth, sEmpID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetBonusPaySlip(ID BonusID, DateTime dBonusMonth, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetBonusPaySlip(BonusID, dBonusMonth, sEmpID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetOldBonusPaySlip(ID BonusID, DateTime dBonusMonth, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetOldBonusPaySlip(BonusID, dBonusMonth, sEmpID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static DataSet GetOldBonusRegister(ID BonusID, DateTime dBonusMonth, string sEmpID)
{
DataSet ds = null;
try
{
ds = Service.GetOldBonusRegister(BonusID, dBonusMonth, sEmpID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
throw new Exception(e.Message, e);
}
return ds;
}
public static int GetForNoOfPaidForEmp(DateTime bonusYearDate, int bonusID,int empId)
{
int PaidItem = 0;
try
{
PaidItem = BonusProcess.Service.GetForNoOfPaidForEmp(bonusYearDate, bonusID, empId, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return PaidItem;
}
public static int GetForNoOfPaid(DateTime bonusYearDate,int bonusID)
{
int PaidItem = 0;
try
{
PaidItem = BonusProcess.Service.GetForNoOfPaid(bonusYearDate, bonusID, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (Exception e)
{
if (e.InnerException == null)
{
throw new Exception(e.Message);
}
else
{
throw new Exception(e.Message, e.InnerException);
}
}
return PaidItem;
}
public static ObjectsTemplate<BonusProcess> GetProcess(ID bonusID, DateTime bonusMonth)
{
#region Cache Header
ObjectsTemplate<BonusProcess> bonusProcesss = _cache["GetProcess", bonusID, bonusMonth] as ObjectsTemplate<BonusProcess>;
if (bonusProcesss != null)
return bonusProcesss;
#endregion
try
{
bonusProcesss = Service.GetProcess(bonusID, bonusMonth, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesss, "GetProcess", bonusID, bonusMonth);
#endregion
return bonusProcesss;
}
public static ObjectsTemplate<BonusProcess> GetProcess()
{
#region Cache Header
ObjectsTemplate<BonusProcess> bonusProcesss = _cache["GetProcess"] as ObjectsTemplate<BonusProcess>;
if (bonusProcesss != null)
return bonusProcesss;
#endregion
try
{
bonusProcesss = Service.GetProcess(SystemInformation.CurrentSysInfo.PayrollTypeID);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
#region Cache Footer
_cache.Add(bonusProcesss, "GetProcess");
#endregion
return bonusProcesss;
}
public static ObjectsTemplate<BonusProcess> GetProcess(DateTime fromMonth, DateTime toDate,ID religionID, ID bonusID)
{
#region Cache Header
ObjectsTemplate<BonusProcess> bonusProcesss = new ObjectsTemplate<BonusProcess>();
if (bonusProcesss != null)
return bonusProcesss;
#endregion
try
{
bonusProcesss = Service.GetProcess(fromMonth, toDate,religionID, bonusID,Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
}
catch (ServiceException e)
{
throw new Exception(e.Message, e);
}
return bonusProcesss;
}
public ID Save()
{
this.SetAuditTrailProperties();
return BonusProcess.Service.Save(this, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
public void BulkSave()
{
this.SetAuditTrailProperties();
BonusProcess.Service.BulkSave(this);
}
public static void UndoProcess(BonusProcess oBonusProcess)
{
BonusProcess.Service.Delete(oBonusProcess, SystemInformation.CurrentSysInfo.PayrollTypeID);
}
#endregion
}
#endregion
#region IBonusProcess Service
public interface IBonusProcessService
{
double GetPreviousKPIBonusAmount(ID employeeID, int bonusID, string bonusProcessIDs, ID PayrollTypeID);
ObjectsTemplate<BonusProcess> GetProcess(ID PayrollTypeID);
double GetBonusAmount(DateTime bonusMonthFirstDate, ID employeeID, int bonusID, ID PayrollTypeID);
double GetBonusAmountWithinYear(DateTime bonusYearDate, ID employeeID, int bonusID, ID PayrollTypeId);
double GetBonusAmountWithinYear(DateTime bonusYearDate, ID employeeID, int bonusID, ID PayrollTypeId,int nReligionID);
double GetBonusPaidAmount(DateTime date1, DateTime date2, ID employeeID, int bonusID);
double GetKPIBonusAmountWithinYear(DateTime bonusYearDate, ID employeeID, int bonusID, ID PayrollTypeId, int nReligionID);
double GetKPIBonusAmountWithinYearPercent(DateTime bonusYearDate, ID employeeID, int bonusID, ID PayrollTypeId, int nReligionID);
double GetUsedBonusWithinYear(DateTime bonusYearDate,int bonusID, ID PayrollTypeID);
BonusProcess Get(ID id, ID PayrollTypeID);
int GetForNoOfPaid(DateTime bonusYear, int bonusID, ID PayrollTypeID);
BonusProcess Get(ID bonusID, DateTime bonusMonth, ID PayrollTypeID);
BonusProcess Get(ID bonusID, DateTime bonusMonth, ID PayrollTypeID, int nQuarterID);
ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth, bool bPayWithSalary, ID PayrollTypeID);
ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth, bool bPayWithSalary, ID PayrollTypeID,int nEmpID);
ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth, int nEmpID,int nBonusID);
ObjectsTemplate<BonusProcess.BonusProcessDetail> GetSumOfBonusDetails(DateTime fromMonth, DateTime toDate, ID PayrollTypeID);
DataSet GetBonusRegister(ID BonusID, DateTime dBonusMonth, string sEmpID, ID PayrollTypeID);
DataSet GetBonusRegisterCarFuel( DateTime dBonusMonth, string sEmpID);
DataSet GetBonusBankAdvice(ID BonusID, DateTime dBonusMonth, string sEmpID, ID PayrollTypeID);
DataSet GetBonusPaySlip(ID BonusID, DateTime dBonusMonth, string sEmpID, ID PayrollTypeID);
DataSet GetOldBonusPaySlip(ID BonusID, DateTime dBonusMonth, string sEmpID, ID PayrollTypeID);
DataSet GetOldBonusRegister(ID BonusID, DateTime dBonusMonth, string sEmpID, ID PayrollTypeID);
ID Save(BonusProcess item, ID PayrollTypeID);
void BulkSave(BonusProcess item);
void Delete(BonusProcess oBonusProcess, ID PayrollTypeID);
ObjectsTemplate<BonusProcess> GetProcess(ID bonusID, DateTime bonusMonth, ID PayrollTypeID);
ObjectsTemplate<BonusProcess> GetProcess(DateTime bonusMonth, ID PayrollTypeId);
int GetForNoOfPaidForEmp(DateTime bonusYearDate, int bonusID, int empId, ID PayrollTytpeID);
ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(DateTime dMonth, ID PayrollTypeID);
ObjectsTemplate<BonusProcess.BonusProcessDetail> GetBonusDetails(int nID);
ObjectsTemplate<BonusProcess> GetProcess(DateTime fromMonth, DateTime toDate, ID religionID, ID bonusID,int payrollTypeID);
}
#endregion
}