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

199 lines
7.9 KiB
C#

using Ease.Core.Model;
using System;
using System.Collections.Generic;
using System.Data;
namespace HRM.BO
{
public class MonthEnd:BasicBaseObject
{
private DateTime _month;
private DateTime _dPaymentDate;
private List<SalaryMonthly> _salaryMonthlys;
private List<PFTransaction> _pfTransactions;
private List<LoanSchedule> _loanShedules;
//private List<IncomeTax> _incometaxes;
private List<ESBDefinition> _oESBDefinitions = null;
private List<ESBProvision> _oESBProvisions = null;
List<SalaryProcess> _oSProcess = null;
public MonthEnd()
{
}
private bool Validation()
{
return false;
}
//public void DoMonthEnd(DateTime month, List<SalaryMonthly> salaries,DateTime dPaymentDate)
//{
// _dPaymentDate = dPaymentDate;
// _salaryMonthlys = salaries;
// _loanShedules = new List<LoanSchedule>();
// _month = month;
// _oSProcess = SalaryProcess.Get(month);
// Process();
// SalaryProcess sprocess = new SalaryProcess();
// SalaryProcess.Service.MonthEnd(month,_pfTransactions,_loanShedules,_oESBProvisions);
//}
//private void Process()
//{
// _oESBDefinitions = new List<ESBDefinition>();
// _oESBProvisions = new List<ESBProvision>();
// List<PFException> oPfExceptions = PFException.Get();
// List<Employee> oEmployees = Employee.GetAllEmps();
// ESBProvision oESBProvision = null;
// ESBDefinition oESBDefinition = null;
// DataSet oDS=null;
// bool doProvision = ConfigurationManager.GetBoolValue("gratuity", "doprovision", EnumConfigurationType.Logic);
// if (doProvision)
// {
// oDS = new DataSet();
// //oDS = ESBProvision.GetCumulativeProv(_month);
// _oESBDefinitions = ESBDefinition.Get();
// }
// _pfTransactions = new List<PFTransaction>();
// foreach(SalaryProcess oSP in _oSProcess)
// {
// oSP.PaymentDate = _dPaymentDate;
// oSP.MonthEndDate = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate;
// oSP.Update(oSP);
// }
// foreach (SalaryMonthly item in _salaryMonthlys)
// {
// Employee oEmp = oEmployees.FirstOrDefault(x => x.int == item.EmployeeID);
// if (oEmp != null && oEmp.PFMemberType == EnumPFMembershipType.Live)
// {
// //_pfTransactions = new List<PFTransaction>();
// #region PF transaction
// #region EPF
// PFTransaction epf = new PFTransaction();
// epf.EmployeeID = item.EmployeeID;
// epf.MonthDate = _month;
// epf.TranAmount = item.GetDeductAmount(EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution);
// epf.TranType = EnumPFTranType.PFAmount;
// epf.SetAuditTrail();
// _pfTransactions.Add(epf);
// #endregion
// #region CPF
// PFException oEmpPFException = oPfExceptions.FirstOrDefault(x => x.EmployeeID == item.Employee.ID);
// PFTransaction cpf = new PFTransaction();
// cpf.EmployeeID = item.EmployeeID;
// cpf.MonthDate = _month;
// if (oEmpPFException != null) // && oEmpPFException.StartDate <= item.SalaryMonth) // Dont open this
// {
// cpf.TranAmount = oEmpPFException.CPFPercent == 0 ? oEmpPFException.CPFAmount : PayrollPayrollGlobalFunctions.Round(item.ThisMonthBasic * (oEmpPFException.CPFPercent / 100));
// }
// else
// {
// cpf.TranAmount = item.GetDeductAmount(EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution);
// }
// cpf.TranType = EnumPFTranType.CPFAmount;
// cpf.SetAuditTrail();
// _pfTransactions.Add(cpf);
// #endregion
// #endregion PF transaction
// }
// #region Loan Installment payment update
// List<SalaryMonthlyDetail> loans = item.Details.FindAll(delegate(SalaryMonthlyDetail detail)
// {
// return detail.ItemCode == EnumSalaryItemCode.Loan_Monthly_Installment;
// });
// if (loans != null)
// {
// foreach (SalaryMonthlyDetail loan in loans)
// {
// LoanSchedule laonshedule = new LoanSchedule();
// laonshedule.PaymentDate = _month;
// laonshedule.setId(loan.SupportID);
// _loanShedules.Add(laonshedule);
// }
// }
// #endregion Loan Installment payment update
// #region Gratuity Provision
// if (doProvision)
// {
// oESBDefinition = ESBDefinition.Get(_oESBDefinitions, item.Employee);
// if (oESBDefinition == null) throw new ServiceException("gratuity rule not found for the employee " + item.Employee.EmployeeNo); // add employee NO and Name
// oESBProvision = new ESBProvision();
// oESBDefinition.CalculateProvisionAmount(item.Employee, item.Details, oESBProvision, oDS);
// oESBProvision.EmployeeID = item.EmployeeID;
// oESBProvision.SalaryMonthlyID = item.ID;
// oESBProvision.ProcessMonthDate = item.SalaryMonth;
// oESBProvision.UserID = Payroll.BO.User.CurrentUser.UserAccessTypes[0].PayrollTypeObj.ID;
// _oESBProvisions.Add(oESBProvision);
// }
// #endregion
// }
// #region PF Exception
// foreach (PFException oEmpPFException in oPfExceptions)
// {
// Employee oEmp = oEmployees.FirstOrDefault(x => x.int == oEmpPFException.EmployeeID);
// if (oEmp == null)
// continue;
// if (_salaryMonthlys.Any(x => x.EmployeeID == oEmpPFException.EmployeeID))
// {
// if (oEmp.PFMemberType == EnumPFMembershipType.Live)
// continue;
// }
// //if (oEmpPFException.StartDate > _month)
// // continue;
// #region EPF
// PFTransaction epf = new PFTransaction();
// epf.EmployeeID = oEmpPFException.EmployeeID;
// epf.MonthDate = _month;
// epf.TranAmount = oEmpPFException.EPFPercent == 0 ? oEmpPFException.EPFAmount : PayrollPayrollGlobalFunctions.Round(oEmp.BasicSalary * (oEmpPFException.EPFPercent / 100));
// epf.TranType = EnumPFTranType.PFAmount;
// epf.SetAuditTrail();
// _pfTransactions.Add(epf);
// #endregion
// #region CPF
// PFTransaction cpf = new PFTransaction();
// cpf.EmployeeID = oEmpPFException.EmployeeID;
// cpf.MonthDate = _month;
// cpf.TranAmount = oEmpPFException.CPFPercent == 0 ? oEmpPFException.CPFAmount : PayrollPayrollGlobalFunctions.Round(oEmp.BasicSalary * (oEmpPFException.CPFPercent / 100));
// cpf.TranType = EnumPFTranType.CPFAmount;
// cpf.SetAuditTrail();
// _pfTransactions.Add(cpf);
// #endregion
// }
// #endregion
//}
}
}