EchoTex_Payroll/HRM.BO/Tax/TaxParameter.cs
2024-10-14 10:01:49 +06:00

568 lines
15 KiB
C#

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
{
#region TaxParameter
public class TaxParameter : AuditTrailBase
{
#region Constructor
public TaxParameter()
{
_fiscalYear = string.Empty;
_assessmentYear = string.Empty;
_maxInvestPercent = 0;
_maxHRPercent = 0;
_maxHRAmount = 0;
_maxMedicalAmount = 0;
_maxConvAmount = 0;
_maxMedicalPercent = 0;
_maxCPFPercent = 0;
_maxInvExempPercent = 0;
_maxInvAmount = 0;
_minTaxAmount = 0;
_pfIntProjection = 0;
_maxAge = 0;
//_isMonthlyExamtion = false;
TaxParameterSlabs = null;
_InvestmentActiveMonth = DateTime.MinValue;
//#### _payrollTypeID = SystemInformation.CurrentSysInfo.PayrollTypeID;
}
#endregion
#region Properties
#region fiscalYear : string
private string _fiscalYear;
public string FiscalYear
{
get { return _fiscalYear; }
set
{
_fiscalYear = value;
}
}
public DateTime FiscalyearDatefrom
{
get
{
return new DateTime(Convert.ToInt32(_fiscalYear.Substring(0, 4)), 7, 1);
}
}
public DateTime FiscalyearDateTo
{
get
{
return new DateTime(Convert.ToInt32(_fiscalYear.Substring(5, 4)), 6, 30);
}
}
#endregion
#region assessmentYear : string
private string _assessmentYear;
public string AssessmentYear
{
get { return _assessmentYear; }
set
{
_assessmentYear = value;
}
}
#endregion
#region maxInvestPercent : double
private double _maxInvestPercent;
public double MaxInvestPercent
{
get { return _maxInvestPercent; }
set
{
_maxInvestPercent = value;
}
}
#endregion
#region maxHRPercent : double
private double _maxHRPercent;
public double MaxHRPercent
{
get { return _maxHRPercent; }
set
{
_maxHRPercent = value;
}
}
#endregion
#region maxHRAmount : double
private double _maxHRAmount;
public double MaxHRAmount
{
get { return _maxHRAmount; }
set
{
_maxHRAmount = value;
}
}
#endregion
#region maxMedicalPercent : double
private double _maxMedicalPercent;
public double MaxMedicalPercent
{
get { return _maxMedicalPercent; }
set
{
_maxMedicalPercent = value;
}
}
#endregion
#region MaxMedicalAmount : double
private double _maxMedicalAmount;
public double MaxMedicalAmount
{
get { return _maxMedicalAmount; }
set
{
_maxMedicalAmount = value;
}
}
#endregion
#region PayrollTypeID : ID
private int _payrollTypeID;
public int PayrollTypeID
{
get { return _payrollTypeID; }
set { _payrollTypeID = value; }
}
#endregion
#region maxConvAmount : double
private double _maxConvAmount;
public double MaxConvAmount
{
get { return _maxConvAmount; }
set
{
_maxConvAmount = value;
}
}
#endregion
#region maxCPFPercent : double
private double _maxCPFPercent;
public double MaxCPFPercent
{
get { return _maxCPFPercent; }
set
{
_maxCPFPercent = value;
}
}
#endregion
#region maxInvExempPercent : double
private double _maxInvExempPercent;
public double MaxInvExempPercent
{
get { return _maxInvExempPercent; }
set
{
_maxInvExempPercent = value;
}
}
#endregion
#region maxInvAmount : double
private double _maxInvAmount;
public double MaxInvAmount
{
get { return _maxInvAmount; }
set
{
_maxInvAmount = value;
}
}
#endregion
#region minTaxAmount : double
private double _minTaxAmount;
public double MinTaxAmount
{
get { return _minTaxAmount; }
set
{
_minTaxAmount = value;
}
}
#endregion
#region pfIntProjection : double
private double _pfIntProjection;
public double PfIntProjection
{
get { return _pfIntProjection; }
set
{
_pfIntProjection = value;
}
}
#endregion
#region maxAge : double
private double _maxAge;
public double MaxAge
{
get { return _maxAge; }
set
{
_maxAge = value;
}
}
#endregion
#region InvestmentActiveMonth : DateTime
private DateTime? _InvestmentActiveMonth;
public DateTime? InvestmentActiveMonth
{
get { return _InvestmentActiveMonth; }
set
{
_InvestmentActiveMonth = value;
}
}
#endregion
//#region isMonthlyExamtion : bool
//private bool _isMonthlyExamtion;
//public bool IsMonthlyExamtion
//{
// get { return _isMonthlyExamtion; }
// set
// {
// base.OnPropertyChange<bool>("isMonthlyExamtion", _isMonthlyExamtion, value);
// _isMonthlyExamtion = value;
// }
//}
//#endregion
public List<TaxParameterSlab> TaxParameterSlabs { get; set; }
//#region TaxParameterSlab : TaxParameterSlab
//private List<TaxParameterSlab> _TaxParameterSlabs = null;
//public List<TaxParameterSlab> TaxParameterSlabs
//{
// get
// {
// if (_TaxParameterSlabs == null && !this.ID.IsUnassigned && this.ID.Integer > 0)
// {
// _TaxParameterSlabs = TaxParameter.GetSlabsByParamID(this.ID);
// }
// return this._TaxParameterSlabs;
// }
// set
// {
// _TaxParameterSlabs= value;
// }
//}
//#endregion
//#region Service Factory ITaxParameterService : ITaxParameterService
//internal static ITaxParameterService Service
//{
// get { return Services.Factory.CreateService<ITaxParameterService>(typeof(ITaxParameterService)); }
//}
//#endregion
#endregion
public static void SetMinimumTax(Employee employee, TaxParameter param)
{
if(employee.TaxCircle == EnumTaxCircle.Municipal)
{
param.MinTaxAmount = 4000;
}
else if (employee.TaxCircle == EnumTaxCircle.Union)
{
param.MinTaxAmount = 3000;
}
}
//#region Functions
//public static TaxParameter Get(int nID)
//{
// TaxParameter oTaxParameter = null;
// #region Cache Header
// oTaxParameter = (TaxParameter)_cache["Get", nID];
// if (oTaxParameter != null)
// return oTaxParameter;
// #endregion
// oTaxParameter = TaxParameter.Service.Get(nID);
// #region Cache Footer
// _cache.Add(oTaxParameter, "Get", nID);
// #endregion
// return oTaxParameter;
//}
//public static TaxParameter Get(string assessmentYear)
//{
// TaxParameter oTaxParameter = null;
// oTaxParameter = TaxParameter.Service.Get(assessmentYear);
// return oTaxParameter;
//}
//public double GetSlabTotal()
//{
// double amount = 0;
// foreach (TaxParameterSlab item in _TaxParameterSlabs)
// {
// amount = amount + item.IncomeAmount;
// }
// return amount;
//}
//public static List<TaxParameter> Get()
//{
// #region Cache Header
// List<TaxParameter> taxParameters = _cache["Get"] as List<TaxParameter>;
// if (taxParameters != null)
// return taxParameters;
// #endregion
// try
// {
// taxParameters = Service.Get();
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(taxParameters, "Get");
// #endregion
// return taxParameters;
//}
//public static List<TaxParameter> Get(bool IsCurrentFY)
//{
// #region Cache Header
// List<TaxParameter> taxParameters = _cache["Get",IsCurrentFY] as List<TaxParameter>;
// if (taxParameters != null)
// return taxParameters;
// #endregion
// try
// {
// taxParameters = Service.Get(IsCurrentFY,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(taxParameters, "Get",IsCurrentFY);
// #endregion
// return taxParameters;
//}
//public static List<TaxParameterSlab> GetTaxSlabs(int nTaxParamID, EnumTaxSlabType TaxType)
//{
// #region Cache Header
// List<TaxParameterSlab> taxParamSlabs = _cache["GetTaxSlabs", nTaxParamID, TaxType] as List<TaxParameterSlab>;
// if (taxParamSlabs != null)
// return taxParamSlabs;
// #endregion
// try
// {
// taxParamSlabs = Service.GetTaxSlabs(nTaxParamID,TaxType);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(taxParamSlabs, "GetTaxSlabs", nTaxParamID, TaxType);
// #endregion
// return taxParamSlabs;
//}
//public static DataSet GetTSByParamAndType(int nTaxParamID, EnumTaxSlabType TaxType)
//{
// DataSet taxParamSlabs = null;
// try
// {
// taxParamSlabs = Service.GetTSByParamAndType(nTaxParamID, TaxType);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// return taxParamSlabs;
//}
//public static List<TaxParameterSlab> GetEmployeeSlab(TaxParameter parameter, Employee employee)
//{
// foreach (TaxParameterSlab item in parameter.TaxParameterSlabs)
// {
// item.SlabTaxAmount = 0;
// item.SlabTaxableAmount = 0;
// }
// List<TaxParameterSlab> employeeSlab = null;
// EnumTaxSlabType SlabType = EnumTaxSlabType.Male;
// if (employee.PersonType == EnumPersonType.Disable)
// SlabType = EnumTaxSlabType.Disable;
// else if (employee.PersonType == EnumPersonType.Freedom_Fighter)
// SlabType = EnumTaxSlabType.Freedom_Fighter;
// else
// {
// if (employee.Gender == EnumGender.Female)
// SlabType = EnumTaxSlabType.Female;
// else
// {
// int NoOfMonth = Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("m",
// employee.BirthDate, SystemInformation.CurrentSysInfo.TaxYearEndDate);
// int NoOfYear = NoOfMonth / 12;
// if (NoOfYear >= parameter.MaxAge) SlabType = EnumTaxSlabType.Age;
// }
// }
// employeeSlab = new List<TaxParameterSlab>();
// foreach (TaxParameterSlab item in parameter.TaxParameterSlabs)
// {
// if(item.ParamType == SlabType)
// employeeSlab.Add(item);
// }
// return employeeSlab;
//}
//public static List<TaxParameterSlab> GetSlabsByParamID(int nTaxParamID)
//{
// #region Cache Header
// List<TaxParameterSlab> taxParamSlabs = _cache["GetSlabsByParamID", nTaxParamID] as List<TaxParameterSlab>;
// if (taxParamSlabs != null)
// return taxParamSlabs;
// #endregion
// try
// {
// taxParamSlabs = Service.GetSlabsByParamID(nTaxParamID);
// }
// catch (ServiceException e)
// {
// throw new Exception(e.Message, e);
// }
// #region Cache Footer
// _cache.Add(taxParamSlabs, "GetSlabsByParamID", nTaxParamID);
// #endregion
// return taxParamSlabs;
//}
//public int Save()
//{
// this.SetAuditTrailProperties();
// return TaxParameter.Service.Save(this,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
//}
//public void Delete()
//{
// TaxParameter.Service.Delete(ID,SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
//}
//#endregion
}
#endregion
#region ITaxParameter Service
public interface ITaxParameterService
{
TaxParameter Get(int id);
TaxParameter Get(string assessmentYear);
TaxParameter GetByFiscalYear(string fiscalYear);
List<TaxParameter> GetbyPayrolltype(int payrolltypeid);
List<TaxParameter> Get(bool IsForCurrentYear, int payrollTypeID);
List<TaxParameterSlab> GetTaxSlabs(int taxParameterID, EnumTaxSlabType TaxType);
DataSet GetTSByParamAndType(int taxParameterID, EnumTaxSlabType TaxType);
List<TaxParameterSlab> GetSlabsByParamID(int taxParameterID);
int Save(TaxParameter item, int payrollTypeID);
void Delete(int id,int payrollTypeID);
void SetCurrentYearTax(int taxParamid, int payrolltypeid);
}
#endregion
}