EchoTex_Payroll/HRM.BO/Leave/LeaveEncashment.cs

237 lines
8.0 KiB
C#
Raw Permalink Normal View History

2024-10-14 10:01:49 +06:00
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 LeaveEncashment
[Serializable]
public class LeaveEncashment : BasicBaseObject
{
#region Constructor
public LeaveEncashment()
{
_isFromWeb = false;
_amount = 0;
_taxAmount = 0;
_taxParamID = 0;
}
#endregion
#region Properties
private int _leaveYearID;
public int LeaveYearID
{
get { return _leaveYearID; }
set { _leaveYearID = value; }
}
private int _leaveID;
public int LeaveID
{
get { return _leaveID; }
set { _leaveID = value; }
}
private int _employeeID;
public int EmployeeID
{
get { return _employeeID; }
set { _employeeID = value; }
}
private int _taxParamID;
public int TaxParamID
{
get { return _taxParamID; }
set { _taxParamID = value; }
}
private double _encashmentDays;
public double EncashmentDays
{
get { return _encashmentDays; }
set { _encashmentDays = value; }
}
private double _essSubmittedDays;
public double ESSSubmittedDays
{
get { return _essSubmittedDays; }
set { _essSubmittedDays = value; }
}
private double _amount;
public double Amount
{
get { return _amount; }
set { _amount = value; }
}
private double _taxAmount;
public double TaxAmount
{
get { return _taxAmount; }
set { _taxAmount = value; }
}
private bool _isFromWeb;
public bool IsFromWeb
{
get { return _isFromWeb; }
set { _isFromWeb = value; }
}
private double _grossSalary;
public double GrossSalary
{
get { return _grossSalary; }
set { _grossSalary = value; }
}
private double _leaveBalance;
public double LeaveBalance
{
get { return _leaveBalance; }
set { _leaveBalance = value; }
}
private double _basicSalary;
public double BasicSalary
{
get { return _basicSalary; }
set { _basicSalary = value; }
}
#region Property IncomeTax : List<IncomeTax>
private List<IncomeTax> _incomeTax = null;
public List<IncomeTax> IncomeTaxcoll
{
get
{
return _incomeTax;
}
set
{
_incomeTax = value;
}
}
public double presentDays { get; set; }
public double holiDays { get; set; }
public double absentDays { get; set; }
public double enjoyedLeave { get; set; }
public DateTime encashMonth { get; set; }
public DateTime encashmentFromDate {get;set;}
public DateTime encashmentToDate { get; set; }
public string employeeNo { get; set; } // view purpose
public string employeeName { get; set; } // view purpose
#endregion Property IncomeTax : List<IncomeTax>
#endregion
//public static void CalculateTax(List<LeaveEncashment> oProcessedItems)
//{
// if (SystemInformation.CurrentSysInfo.TaxParamID == null) throw new ServiceException("Current year Tax paramter setup not found.");
// TaxParameter oparamter = TaxParameter.Get(SystemInformation.CurrentSysInfo.TaxParamID);
// double nTaxAmount = 0;
// List<Employee> oEmployees = Employee.GetAllEmps();
// List<IncomeTax> currentYearTax = new List<IncomeTax>();
// foreach (LeaveEncashment item in oProcessedItems)
// {
// TaxCalculator oCalculator = new TaxCalculator();
// oCalculator.TaxParameter = oparamter;
// oCalculator.Employee = oEmployees.GetItem(item.EmployeeID);
// currentYearTax = IncomeTax.Get(item.EmployeeID, EnumIncomeTaxDataFrom.ProcessTempData);
// if(!item.ID.IsUnassigned)
// {
// List<TaxRawItem> oTaxRowItems = new List<TaxRawItem>();
// IncomeTax encashItem = IncomeTax.Get(currentYearTax, item.EmployeeID, EnumIncomeTaxItemGroup.Earned_Leave, 100);
// if (encashItem != null)
// {
// oTaxRowItems.Add(TaxRawItem.Create("Earned Leave", encashItem.ThisMonthAmount, enumIncomeTaxItemType.Earned_Leave, 100));
// nTaxAmount = 0;
// if (encashItem.TotalAmount > 0)
// nTaxAmount = item.TaxAmount;
// item.IncomeTaxcoll = oCalculator.UndoEncashAmount(oTaxRowItems, nTaxAmount);
// //item.TaxAmount = 0;
// item.TaxParamID = oparamter.ID;
// }
// }
// if (item.Amount > 0)
// {
// List<TaxRawItem> oTaxRowItems = new List<TaxRawItem>();
// //IncomeTax encashItem = IncomeTax.Get(currentYearTax, item.EmployeeID, EnumIncomeTaxItemGroup.Earned_Leave, 100);
// oTaxRowItems.Add(TaxRawItem.Create("Earned Leave", item.Amount, enumIncomeTaxItemType.Earned_Leave, 100));
// nTaxAmount = 0;
// item.IncomeTaxcoll = oCalculator.CalculateEncashAmount(oTaxRowItems, ref nTaxAmount);
// item.TaxAmount = nTaxAmount;
// item.TaxParamID = oparamter.ID;
// }
// }
//}
//public static void CalculateTax(LeaveEncashment encash)
//{
// if (SystemInformation.CurrentSysInfo.TaxParamID == null) throw new ServiceException("Current year Tax paramter setup not found.");
// TaxParameter oparamter = TaxParameter.Get(SystemInformation.CurrentSysInfo.TaxParamID);
// double nTaxAmount = 0;
// List<Employee> oEmployees = Employee.GetAllEmps();
// List<IncomeTax> currentYearTax = new List<IncomeTax>();
// TaxCalculator oCalculator = new TaxCalculator();
// oCalculator.TaxParameter = oparamter;
// oCalculator.Employee = oEmployees.GetItem(encash.EmployeeID);
// currentYearTax = IncomeTax.Get(encash.EmployeeID, EnumIncomeTaxDataFrom.ProcessTempData);
// if (!encash.ID.IsUnassigned)
// {
// List<TaxRawItem> oTaxRowItems = new List<TaxRawItem>();
// IncomeTax encashItem = IncomeTax.Get(currentYearTax, encash.EmployeeID, EnumIncomeTaxItemGroup.Earned_Leave, (int)EnumIncomeTaxItemGroup.Earned_Leave);
// oTaxRowItems.Add(TaxRawItem.Create("Earned Leave", encash.Amount, enumIncomeTaxItemType.Earned_Leave, 100));
// nTaxAmount = 0;
// encash.IncomeTaxcoll = oCalculator.UndoEncashAmount(oTaxRowItems, encash.TaxAmount);
// encash.TaxAmount = 0;
// encash.TaxParamID = oparamter.ID;
// }
//}
}
#endregion
#region ILeaveEncashment Service
public interface ILeaveEncashmentService
{
int Save(LeaveEncashment leaveEncashment);
void CalculateTax(List<LeaveEncashment> oProcessedItems, DateTime nextPayProcess, int taxParamId, int payrollTypeID);
LeaveEncashment Get(int leaveYearID, int employeeID);
List<LeaveEncashment> Get(int leaveYearID);
void Save(List<LeaveEncashment> _editedLeaveEncashments);
void Delete(int id);
DataTable GetData(int nYearID);
DataTable GetSalaryData(DateTime dt);
void Delete(LeaveEncashment encash);
DataTable GetSalaryDataExpat(DateTime dt);
}
#endregion
}