using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.Core; using Ease.Core.Model; using System.Data; namespace HRM.BO { public enum enumIncomeTaxItemType { None = 0, Basic_Salary = 1, Allowance = 2, Deduction = 3, OT = 4, Bonus = 5, Earned_Leave = 6, PF = 7, OPI = 8, AdjustItem = 9, FinalSettlement = 10, Compensation = 11, NoticePay= 12, LFA = 13, } #region IncomeTax public class IncomeTax : AuditTrailBase { #region Constructor public IncomeTax() { EmployeeID = 0; ItemID = 0; PreviousAmount = 0; ThisMonthAmount = 0; ProjectedAmount = 0; TotalAmount = 0; TaxParameterID = 0; Position = 0; Description = string.Empty; ItemGroup = EnumIncomeTaxItemGroup.Other_Allowance; Side = EnumIncomeTaxSide.Tax_Info_Item; DataTo = EnumIncomeTaxDataFrom.ProcessTempData; } #endregion #region Properties public int EmployeeID { get; set; } public int ItemID { get; set; } public double PreviousAmount { get; set; } public double ThisMonthAmount { get; set; } public double ProjectedAmount { get; set; } // public double TotalAmount { get; set; } #region totalAmount : double private double _totalAmount; public double TotalAmount { get { if (this.DataTo != EnumIncomeTaxDataFrom.ProcessedData) _totalAmount = this.ThisMonthAmount + this.PreviousAmount + this.ProjectedAmount; return _totalAmount; } set { _totalAmount = value; } } #endregion public EnumIncomeTaxDataFrom DataTo { get; set; } public int TaxParameterID { get; set; } public int Position { get; set; } public string Description { get; set; } public bool IsChanged { get; set; } public EnumIncomeTaxItemGroup ItemGroup { get; set; } public EnumIncomeTaxSide Side { get; set; } //#region Service Factory IIncomeTaxService : IIncomeTaxService //internal static IIncomeTaxService Service //{ // get { return Services.Factory.CreateService(typeof(IIncomeTaxService)); } //} //#endregion #endregion public string getEmpID(List items) { string str = ""; items.ForEach(x => { if (x != null) str = str + x.EmployeeID + ","; }); if (str.Length > 0) str = str.Substring(0, str.Length - 1); return str; } } #endregion #region IIncomeTax Service public interface IIncomeTaxService { List GetPrvYear(int taxparameterId, EnumIncomeTaxItemGroup groupCode, int itemID); List GetPrvYear(int taxparameterId, int payrollTypeID); List Get(int employeeid, EnumIncomeTaxDataFrom dataFrom); List Get(EnumIncomeTaxDataFrom dataFrom, int payrollTypeID); List Get(EnumIncomeTaxDataFrom dataFrom, string empids, int payrollTypeID, int? taxParamID); List Get(EnumIncomeTaxDataFrom dataFrom, int nEmpID, int nTaxParamID); IncomeTax Get(EnumIncomeTaxDataFrom dataFrom, int nEmpID, EnumIncomeTaxItemGroup groupCode, int itemID); List Get(EnumIncomeTaxDataFrom dataFrom, string sEmpIds, EnumIncomeTaxItemGroup groupCode, int itemID); List GetByYear(int taxparameterId, EnumIncomeTaxDataFrom dataFrom, int payrollTypeID); DataSet GetByEmpID(EnumIncomeTaxDataFrom dataFrom, int employeeid); DataSet GetEmpIDforOthTax(EnumIncomeTaxDataFrom dataFrom, int nEMpID); void UpdateOT(List otProcess); int Save(IncomeTax item, EnumIncomeTaxDataFrom saveto); EnumIncomeTaxDataFrom GetEnumForSalaryIT(int nEmpID); void DoYearEndReProcess(int taxParameterID, int payrollTypeID); void DoTaxYearEnd( int payrollTypeID); void Save(List _IncomeTaxs, EnumIncomeTaxDataFrom saveto); void Delete(int nEmpId, EnumIncomeTaxDataFrom deletefrom, EnumIncomeTaxItemGroup ItemGroup, int ItemID); void DeleteYearlyData(int TaxParamID, EnumIncomeTaxDataFrom deletefrom, int nEmpID, EnumIncomeTaxItemGroup ItemGroup, int ItemID); void DoTaxTempReProcess(List IncomeTaxes, int taxParameterID, EnumIncomeTaxDataFrom saveTo, int payrollTypeID); DataSet GetTaxRefreshedData(DateTime fromDate, DateTime toDate); bool hasTaxDataInSalaryTemp(int employeeID); List calculateTaxFromSalary(SalaryMonthly salaries); EnumIncomeTaxDataFrom currentYeardataSource(int employeeID); } #endregion public class TaxRawItem { public TaxRawItem() { _description = ""; _amount = 0; _taxItemType = enumIncomeTaxItemType.Basic_Salary; _itemID = 0; } private string _description; private double _amount; private enumIncomeTaxItemType _taxItemType; private int _itemID; private bool _ChangePrgAmount; public bool ChangePrgAmount { get { return _ChangePrgAmount; } set { _ChangePrgAmount = value; } } public string Description { get { return _description; } set { _description = value; } } public double Amount { get { return _amount; } set { _amount = value; } } public enumIncomeTaxItemType ItemType { get { return _taxItemType; } set { _taxItemType = value; } } public int ItemId { get { return _itemID; } set { _itemID = value; } } public int _supportID; public int SupportID { get { return _supportID; } set { _supportID = value; } } public static TaxRawItem Create(string description, double amount, enumIncomeTaxItemType type, int itemId) { TaxRawItem oitem = new TaxRawItem(); oitem.Description = description; oitem.Amount = amount; oitem.ItemType = type; oitem.ItemId = itemId; return oitem; } } }