1680 lines
99 KiB
C#
1680 lines
99 KiB
C#
|
using System;
|
|||
|
|
|||
|
namespace HRM.BO
|
|||
|
{
|
|||
|
//public delegate void ProcessStatus(string processStatus);
|
|||
|
//public delegate void ProgressStatus(EnumProcessStatus status);
|
|||
|
//public delegate void ErrorMessage(String error);
|
|||
|
|
|||
|
//public enum EnumProcessStatus
|
|||
|
//{
|
|||
|
// Start = 1,
|
|||
|
// PerformStep = 2,
|
|||
|
// End = 3
|
|||
|
//}
|
|||
|
//public class SalaryCalculator : SalaryException
|
|||
|
//{
|
|||
|
// #region Define Class Veriable
|
|||
|
// private List<Employee> _employees;
|
|||
|
// private List<AllowanceDeduction> _allowdeducitons;
|
|||
|
// private List<ProcessItem> _processItems;
|
|||
|
// private List<SalaryMonthly> _salaryMonthlys;
|
|||
|
// private List<SalaryProcessStatus> _processStatuses;
|
|||
|
// private List<SalaryMonthly> _PrvMonthsalary;
|
|||
|
// private List<ADParameter> _adParameters;
|
|||
|
// public DateTime _processMonth;
|
|||
|
// private List<AttnMonthlyBenefit> _attnHours;
|
|||
|
// public event ProcessStatus ProcessStatus;
|
|||
|
// public event ProgressStatus ProgressStatus;
|
|||
|
// public List<Grade> _greades;
|
|||
|
// public List<AttnMonthlyBenefit> _attnBenifits;
|
|||
|
// // public List<EmployeeWorkPlanSetup> _empWorkPlans;
|
|||
|
// public List<DailyAttnProcess> _attnProcess;
|
|||
|
// List<BonusProcess.BonusProcessDetail> _bonusdetails;
|
|||
|
// #endregion Define Class Veriable
|
|||
|
|
|||
|
// public List<SalaryMonthly> SalaryMonthlies
|
|||
|
// {
|
|||
|
// get
|
|||
|
// {
|
|||
|
// return _salaryMonthlys;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// public SalaryCalculator()
|
|||
|
// {
|
|||
|
// _processItems = ProcessItem.Get();
|
|||
|
// }
|
|||
|
// public List<SalaryProcessStatus> ErrorList
|
|||
|
// {
|
|||
|
// get
|
|||
|
// {
|
|||
|
// return _processStatuses;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// public List<ADParameter> Adparameter
|
|||
|
// {
|
|||
|
// get
|
|||
|
// {
|
|||
|
// return _adParameters;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// private void UpdateprocessStatus(string statusString)
|
|||
|
// {
|
|||
|
// if (ProcessStatus != null) ProcessStatus(statusString);
|
|||
|
// }
|
|||
|
// private void UpdateProgressStatus(EnumProcessStatus status)
|
|||
|
// {
|
|||
|
// if (ProgressStatus != null) ProgressStatus(status);
|
|||
|
// }
|
|||
|
|
|||
|
// public List<Employee> Employees
|
|||
|
// {
|
|||
|
// get
|
|||
|
// {
|
|||
|
// return _employees;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// public void Process(List<Employee> employees, DateTime processMonth)
|
|||
|
// {
|
|||
|
// //SalaryException oSException = new SalaryException();
|
|||
|
// _employees = employees;
|
|||
|
// _processMonth = processMonth;
|
|||
|
// UpdateprocessStatus("Collecting Employee basic information....");
|
|||
|
// this.Initialize();
|
|||
|
// this.AddEmployeeToProcess();
|
|||
|
// if (_processStatuses.Count > 0) return;
|
|||
|
// UpdateprocessStatus("Calculating basic Salary....");
|
|||
|
// this.BasicSalary();
|
|||
|
// UpdateprocessStatus("Calculating benifits and deduction....");
|
|||
|
// this.AllowanceDeduction();
|
|||
|
// UpdateprocessStatus("Calculating OverTime....");
|
|||
|
// this.OverTimeProcess();
|
|||
|
// UpdateprocessStatus("Calculating Bonus....");
|
|||
|
// this.CalculateBonus();
|
|||
|
// UpdateprocessStatus("Calculating Salary deduct item(unauthorized leave)....");
|
|||
|
// this.UnAuthorizeLeave();
|
|||
|
// UpdateprocessStatus("Calculating PF & CPF....");
|
|||
|
// this.PF();
|
|||
|
// this.OverTimeArrearProcess();
|
|||
|
// //UpdateprocessStatus("Calculating Employees Income tax....");
|
|||
|
// UpdateprocessStatus("Calculating Income Tax");
|
|||
|
// this.Tax();
|
|||
|
// UpdateprocessStatus("Calculating Cost-Center");
|
|||
|
// this.PrepareCostcenterData();
|
|||
|
// UpdateprocessStatus("Calculating Loan Installment");
|
|||
|
// this.LoanProcess();
|
|||
|
// UpdateprocessStatus("Calculating Net Income");
|
|||
|
// this.NetIncome();
|
|||
|
// //UpdateprocessStatus("Calculating Attendance Days");
|
|||
|
// //this.AttendanceDayProcess();
|
|||
|
// UpdateprocessStatus("Calculating Leave Days");
|
|||
|
// // this.LeaveDayProcess();
|
|||
|
// UpdateprocessStatus("Calculating Salary Exception");
|
|||
|
// this.SalaryExceptionCalculation(this);
|
|||
|
// UpdateprocessStatus("");
|
|||
|
// //this.LeavePrepare(oSException.GetEmpLeaveStatus());
|
|||
|
// }
|
|||
|
|
|||
|
// public void ProcessLTA(List<Employee> employees, DateTime processMonth)
|
|||
|
// {
|
|||
|
// //SalaryException oSException = new SalaryException();
|
|||
|
// _employees = employees;
|
|||
|
// _processMonth = processMonth;
|
|||
|
// UpdateprocessStatus("Collecting Employee basic information....");
|
|||
|
// this.Initialize();
|
|||
|
// this.AddEmployeeToProcess();
|
|||
|
// if (_processStatuses.Count > 0) return;
|
|||
|
// UpdateprocessStatus("Calculating basic Salary....");
|
|||
|
// this.BasicSalary();
|
|||
|
// UpdateprocessStatus("Calculating benifits and deduction....");
|
|||
|
// this.AllowanceDeduction();
|
|||
|
// UpdateprocessStatus("Calculating OverTime....");
|
|||
|
// this.OverTimeProcess();
|
|||
|
// UpdateprocessStatus("Calculating PF & CPF....");
|
|||
|
// this.PF();
|
|||
|
// this.OverTimeArrearProcess();
|
|||
|
|
|||
|
// }
|
|||
|
// private void Initialize()
|
|||
|
// {
|
|||
|
// _processStatuses = new List<SalaryProcessStatus>();
|
|||
|
// _salaryMonthlys = new List<SalaryMonthly>();
|
|||
|
// _PrvMonthsalary = SalaryMonthly.Get(PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(_processMonth.AddMonths(-1)));
|
|||
|
// }
|
|||
|
// private bool ProcessStartValidation()
|
|||
|
// {
|
|||
|
// return false;
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
// private void AddEmployeeToProcess()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
// List<EmployeeCostCenter> empCostCenters = EmployeeCostCenter.Get();
|
|||
|
// List<Category> categories = Category.Get();
|
|||
|
// List<BATBGrandFatherTaging> gradFathers = BATBGrandFatherTaging.Get();
|
|||
|
// _greades = Grade.Get(EnumStatus.Regardless);
|
|||
|
// _attnBenifits = AttnMonthlyBenefit.Get(_processMonth);
|
|||
|
// foreach (Employee employee in _employees)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// this.UpdateprocessStatus(" Collecting information for the employee " + employee.Name + " ( " + employee.EmployeeNo + ")");
|
|||
|
|
|||
|
// SalaryMonthly salary = new SalaryMonthly();
|
|||
|
// salary.EmployeeID = employee.ID;
|
|||
|
// salary.CategoryID = employee.CategoryID;
|
|||
|
// if (employee.CategoryID == null)
|
|||
|
// {
|
|||
|
// AddProcessStatus(employee, "Category not yet assingned");
|
|||
|
// }
|
|||
|
// else salary.Category = categories.Find(delegate (Category detail) { return (detail.ID.Integer == employee.CategoryID.Integer); });
|
|||
|
|
|||
|
// salary.Gender = employee.Gender;
|
|||
|
// salary.SalaryMonth = _processMonth;
|
|||
|
|
|||
|
// if (employee.GradeID == null) AddProcessStatus(employee, "grade not yet assingned");
|
|||
|
// else salary.GradeID = employee.GradeID;
|
|||
|
|
|||
|
// if (employee.DepartmentID == null) AddProcessStatus(employee, "Department not yet assingned");
|
|||
|
// else salary.DepartmentID = employee.DepartmentID;
|
|||
|
|
|||
|
// if (employee.DesignationID == null)
|
|||
|
// AddProcessStatus(employee, "Designation not yet assingned");
|
|||
|
// else salary.DesignationID = employee.DesignationID;
|
|||
|
|
|||
|
// if (employee.LocationID == null) AddProcessStatus(employee, "Loacation not yet assingned");
|
|||
|
// else salary.LocationID = employee.LocationID;
|
|||
|
|
|||
|
// salary.DesignationID = employee.DesignationID;
|
|||
|
// salary.DesignationText = employee.DescriptionText;
|
|||
|
// if (employee.PaymentMode == EnumPaymentMode.BankTransfer)
|
|||
|
// {
|
|||
|
// if (employee.BranchID == null || employee.BranchID.IsUnassigned) AddProcessStatus(employee, "Employee payment mode is diclared"
|
|||
|
// + " to bank transfer, but no bank/account information found");
|
|||
|
// else
|
|||
|
// {
|
|||
|
// salary.BranchID = employee.BranchID;
|
|||
|
// salary.AccountNo = employee.AccountNo;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// salary.ThisMonthBasic = employee.BasicSalary;
|
|||
|
// salary.ThisMonthGross = employee.GrossSalary;
|
|||
|
// salary.PayrollTypeID = employee.PayrollTypeID;
|
|||
|
// salary.ReligionID = employee.ReligionID;
|
|||
|
// salary.Employee = employee;
|
|||
|
// salary.IsConfirmed = employee.IsConfirmed;
|
|||
|
|
|||
|
// if (employee.EndOfContractDate != null)
|
|||
|
// if (employee.EndOfContractDate >= PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(_processMonth) &&
|
|||
|
// employee.EndOfContractDate <= PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(_processMonth))
|
|||
|
// {
|
|||
|
// if (employee.Status == EnumEmployeeStatus.Live && employee.MonthStatusUpdate == EnumEmployeeStatus.Live)
|
|||
|
// AddProcessStatus(employee, "Employee end_of_contact_date defined but not yet discontinued from discontinue module." + " ");
|
|||
|
// }
|
|||
|
|
|||
|
// bool bfixedAmount = ConfigurationManager.GetBoolValue("costcenter", "manadatoryinsalary", EnumConfigurationType.Logic);
|
|||
|
// if (bfixedAmount == true)
|
|||
|
// {
|
|||
|
// List<EmployeeCostCenter> empinvolments = EmployeeCostCenter.Get(empCostCenters, salary.EmployeeID);
|
|||
|
// if (empinvolments == null || empinvolments.Count == 0) AddProcessStatus(employee, "Cost-Center not yet assingned");
|
|||
|
// }
|
|||
|
|
|||
|
// salary.Employee.GrandFather = gradFathers.Find(delegate (BATBGrandFatherTaging detail) { return (detail.EmployeeID == employee.ID.Integer); });
|
|||
|
// _salaryMonthlys.Add(salary);
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
// private void AddProcessStatus(Employee employee, string remarks)
|
|||
|
// {
|
|||
|
// SalaryProcessStatus status = new SalaryProcessStatus();
|
|||
|
// status.EmployeeNo = employee.EmployeeNo;
|
|||
|
// status.Name = employee.Name;
|
|||
|
// status.Remarks = remarks;
|
|||
|
// _processStatuses.Add(status);
|
|||
|
// }
|
|||
|
// private void NetIncome()
|
|||
|
// {
|
|||
|
// string sPosItems = "Positive Items:";
|
|||
|
// string sNegItems = "Negative Items:";
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// double netAmount = 0;
|
|||
|
// sPosItems = "Positive Items:";
|
|||
|
// sNegItems = "Negative Items:";
|
|||
|
|
|||
|
// foreach (SalaryMonthlyDetail detail in salary.Details)
|
|||
|
// {
|
|||
|
// string sName = detail.Description;
|
|||
|
// if (sName.Length > 4) sName = sName.Substring(0, 4);
|
|||
|
|
|||
|
// if (detail.itemGroupCode == EnumSalaryGroup.Gross || detail.itemGroupCode == EnumSalaryGroup.Arrear)
|
|||
|
// {
|
|||
|
// netAmount = netAmount + detail.ChangedAmount;
|
|||
|
// sPosItems = sPosItems + sName + ":" + detail.ChangedAmount.ToString() + ", ";
|
|||
|
// }
|
|||
|
// else if (detail.itemGroupCode == EnumSalaryGroup.Deductions || detail.itemGroupCode == EnumSalaryGroup.UnauthLeave)
|
|||
|
// {
|
|||
|
// netAmount = netAmount - detail.ChangedAmount;
|
|||
|
// sNegItems = sNegItems + sName + ":" + detail.ChangedAmount.ToString() + ", ";
|
|||
|
// }
|
|||
|
// }
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.OtherItem, EnumSalaryItemCode.Net_Payable, (int)EnumSalaryItemCode.Net_Payable, 0, "Net Amount", PayrollPayrollGlobalFunctions.Round(netAmount));
|
|||
|
// if (netAmount <= 0)
|
|||
|
// {
|
|||
|
// sPosItems = sPosItems.Substring(0, sPosItems.Length - 2);
|
|||
|
// sNegItems = sNegItems.Substring(0, sNegItems.Length - 2);
|
|||
|
// this.AddProcessStatus(salary.Employee, "Net amount can't be Zero or less than zero. Components:" + sPosItems + " " + sNegItems);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// public SalaryMonthlyDetail AddDetail(SalaryMonthly salarymonthly, EnumSalaryGroup group, EnumSalaryItemCode itemcode, int itemId
|
|||
|
// , int supportId, string description, double nAmount)
|
|||
|
// {
|
|||
|
|
|||
|
// SalaryMonthlyDetail detail = new SalaryMonthlyDetail();
|
|||
|
// ProcessItem pitem = _processItems.Find(delegate (ProcessItem item)
|
|||
|
// { return item.ItemCode == (int)itemcode; });
|
|||
|
// if (pitem == null)
|
|||
|
// {
|
|||
|
// this.AddProcessStatus(salarymonthly.Employee, "Salary process item code not found in the process"
|
|||
|
// + " collection; Item Code:" + itemcode.ToString());
|
|||
|
// return null;
|
|||
|
// }
|
|||
|
|
|||
|
// detail = new SalaryMonthlyDetail();
|
|||
|
// detail.ItemID = itemId;
|
|||
|
// detail.itemGroupCode = group;
|
|||
|
// detail.ItemCode = itemcode;
|
|||
|
// detail.SupportID = (supportId);
|
|||
|
// detail.Position = GetMaxPostion(salarymonthly, group);
|
|||
|
// detail.Description = description.Length > 0 ? description : pitem.UserDescription;
|
|||
|
// detail.CalculatedAmount = nAmount;
|
|||
|
// detail.ChangedAmount = detail.CalculatedAmount;
|
|||
|
|
|||
|
// salarymonthly.Details.Add(detail);
|
|||
|
|
|||
|
// return detail;
|
|||
|
// }
|
|||
|
// public int GetMaxPostion(SalaryMonthly osalary, EnumSalaryGroup group)
|
|||
|
// {
|
|||
|
// int maxPos = 0;
|
|||
|
// foreach (SalaryMonthlyDetail item in osalary.Details)
|
|||
|
// {
|
|||
|
// //if(item.itemGroupCode == group)
|
|||
|
// //{
|
|||
|
// if (item.Position > maxPos)
|
|||
|
// {
|
|||
|
// maxPos = item.Position;
|
|||
|
// //}
|
|||
|
// }
|
|||
|
// }
|
|||
|
// maxPos = maxPos + 1;
|
|||
|
// return maxPos;
|
|||
|
// }
|
|||
|
|
|||
|
// private void CalculateWagesBasicSalary(SalaryMonthly salary)
|
|||
|
// {
|
|||
|
// if (_attnHours == null)
|
|||
|
// {
|
|||
|
// _attnHours = AttnMonthlyBenefit.Get(salary.SalaryMonth);
|
|||
|
// }
|
|||
|
// if (salary.Category.WagesType == EnumWagesType.Hourly)
|
|||
|
// {
|
|||
|
// double amount = 0;
|
|||
|
// double Hours = 208;
|
|||
|
// AttnMonthlyBenefit basicsHours = _attnHours.Find(delegate (AttnMonthlyBenefit detail) { return (detail.ItemType == enumPayrollComponentType.Ordinary_Hour && detail.EmployeeID == salary.EmployeeID.Integer && detail.ItemID == (int)enumPayrollComponentType.Ordinary_Hour); });
|
|||
|
// if (basicsHours != null)
|
|||
|
// Hours = Hours - basicsHours.Total;
|
|||
|
|
|||
|
// AttnMonthlyBenefit ExtraHour = _attnHours.Find(delegate (AttnMonthlyBenefit detail) { return (detail.ItemType == enumPayrollComponentType.Ordinary_Hour_Extra && detail.EmployeeID == salary.EmployeeID.Integer && detail.ItemID == (int)enumPayrollComponentType.Ordinary_Hour_Extra); });
|
|||
|
// if (ExtraHour != null && ExtraHour.Total > 0)
|
|||
|
// Hours = Hours + ExtraHour.Total;
|
|||
|
|
|||
|
// amount = Hours * PayrollPayrollGlobalFunctions.ConvertToHourlyRate(salary.ThisMonthBasic);
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.Gross, EnumSalaryItemCode.Basic_Salary,
|
|||
|
// (int)EnumSalaryItemCode.Basic_Salary, 0, "Ordinary Amount", PayrollPayrollGlobalFunctions.Round(amount));
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Basic_Salary,
|
|||
|
// (int)EnumSalaryItemCode.Basic_Salary, 0, "Ordinary Hours", Hours);
|
|||
|
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// private void BasicSalary()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// //GetCurrentMonthSalaryItems function return current month's employee grade, salary and effect date.
|
|||
|
// //effect date must sorted, otherwise error will be generated from next function.
|
|||
|
|
|||
|
// #region Calculate Normal Salary
|
|||
|
// List<EmployeeGradeSalary> gradeSalaryItems = EmployeeGradeSalary.Service.GetCurrMonthSalaryItems(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
// double basicSalary = 0;
|
|||
|
// SalaryMonthlyDetail basicDetail = null;
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
|
|||
|
// salary.GradeSalaries = EmployeeGradeSalary.Get(gradeSalaryItems, salary.EmployeeID);
|
|||
|
// if (salary.GradeSalaries.Count == 0) continue;
|
|||
|
// EmployeeGradeSalary.PrepareDataForCurrentSalary(salary.Employee, salary.GradeSalaries);
|
|||
|
// basicSalary = 0;
|
|||
|
// if (salary.Category.WagesType != EnumWagesType.Monthly)
|
|||
|
// {
|
|||
|
// this.CalculateWagesBasicSalary(salary);
|
|||
|
// continue;
|
|||
|
// }
|
|||
|
|
|||
|
// if (salary.GradeSalaries.Count > 0)
|
|||
|
// {
|
|||
|
// salary.ThisMonthBasic = salary.GradeSalaries[salary.GradeSalaries.Count - 1].BasicSalary;
|
|||
|
// salary.ThisMonthBasic = PayrollPayrollGlobalFunctions.Round(salary.ThisMonthBasic);
|
|||
|
// salary.ThisMonthGross = salary.GradeSalaries[salary.GradeSalaries.Count - 1].GrossSalary;
|
|||
|
// salary.ThisMonthGross = PayrollPayrollGlobalFunctions.Round(salary.ThisMonthGross);
|
|||
|
// }
|
|||
|
// foreach (EmployeeGradeSalary item in salary.GradeSalaries)
|
|||
|
// {
|
|||
|
// item.BasicSalary = item.BasicSalary * item.FractionofFromTo;
|
|||
|
// item.BasicSalary = PayrollPayrollGlobalFunctions.Round(item.BasicSalary);
|
|||
|
// item.GrossSalary = item.GrossSalary * item.FractionofFromTo;
|
|||
|
// item.GrossSalary = PayrollPayrollGlobalFunctions.Round(item.GrossSalary);
|
|||
|
// basicSalary = basicSalary + item.BasicSalary;
|
|||
|
// }
|
|||
|
// if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1)
|
|||
|
// {
|
|||
|
// basicDetail = this.AddDetail(salary, EnumSalaryGroup.Gross, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, 0, "Basic", PayrollPayrollGlobalFunctions.Round(basicSalary));
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// basicDetail = this.AddDetail(salary, EnumSalaryGroup.Gross, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, 0, "Ordinary Amount", PayrollPayrollGlobalFunctions.Round(basicSalary));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// #endregion Calculate Normal Salary
|
|||
|
// #region calculate arrear amount
|
|||
|
// double arrearAmount = 0;
|
|||
|
// List<EmployeeGradeSalary> arrearItems = EmployeeGradeSalary.Service.GetArrearItems(SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
// bool continuation = true;
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// continuation = false;
|
|||
|
// arrearAmount = 0;
|
|||
|
// salary.ArrearGradeSalaries = EmployeeGradeSalary.Get(arrearItems, salary.EmployeeID);
|
|||
|
|
|||
|
// foreach (EmployeeGradeSalary arrearItem in salary.ArrearGradeSalaries)
|
|||
|
// {
|
|||
|
// if (salary.Category.WagesType == EnumWagesType.Hourly)
|
|||
|
// {
|
|||
|
// EmployeeGradeSalary PrvSalary = null;
|
|||
|
// PrvSalary = EmployeeGradeSalary.Service.Get(salary.EmployeeID, arrearItem.EffectDate, EnumArrearType.NotPresent);
|
|||
|
// // if (PrvSalary == null) this.AddProcessStatus(salary.Employee, "Previous salary not found for the employee");
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// double nTotalORDHrs = 0;
|
|||
|
// if (arrearItem.EffectDate.Day < 20 && continuation == false)
|
|||
|
// {
|
|||
|
|
|||
|
// nTotalORDHrs = SalaryMonthly.Service.GetSumOnRange(salary.EmployeeID, PayrollPayrollGlobalFunctions.AttendanceSalaryMonth(arrearItem.EffectDate.AddMonths(1)), (DateTime)arrearItem.TillDate,
|
|||
|
// EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
// nTotalORDHrs = nTotalORDHrs + ((PayrollPayrollGlobalFunctions.AttendanceMonthEnd(arrearItem.EffectDate) - arrearItem.EffectDate).Days + 1) * 8 -
|
|||
|
// PayrollPayrollGlobalFunctions.GetDayofWeek(arrearItem.EffectDate, PayrollPayrollGlobalFunctions.AttendanceMonthEnd(arrearItem.EffectDate), 6) * 8;
|
|||
|
|
|||
|
// }
|
|||
|
// else
|
|||
|
// nTotalORDHrs = SalaryMonthly.Service.GetSumOnRange(salary.EmployeeID, PayrollPayrollGlobalFunctions.AttendanceSalaryMonth(arrearItem.EffectDate), (DateTime)arrearItem.TillDate,
|
|||
|
// EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
|
|||
|
// continuation = true;
|
|||
|
// if (PrvSalary != null && salary.GradeID == PrvSalary.GradeID)
|
|||
|
// {
|
|||
|
// Grade ograde = _greades.FirstOrDefault(x => x.ID.Integer == salary.GradeID.Integer);
|
|||
|
// double incrementAmount = ograde.Increment * salary.GradeSalaries[0].Increment;// arrearItem.BasicSalary - PrvSalary.BasicSalary;
|
|||
|
// salary.WIPIncrement = incrementAmount;
|
|||
|
// arrearAmount = arrearAmount + PayrollPayrollGlobalFunctions.ConvertToHourlyRate(incrementAmount) * nTotalORDHrs;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// double nIncrAmount = 0;
|
|||
|
// Grade oCurrgrade = _greades.FirstOrDefault(x => x.ID.Integer == salary.GradeID.Integer);
|
|||
|
// nIncrAmount = oCurrgrade.Increment * salary.GradeSalaries[0].Increment;
|
|||
|
// salary.WIPIncrement = nIncrAmount;
|
|||
|
// Grade Prvograde = null;
|
|||
|
|
|||
|
// if (PrvSalary == null)
|
|||
|
// {
|
|||
|
// salary.WIPIncrement = nIncrAmount + oCurrgrade.MinBasic;
|
|||
|
// arrearAmount = arrearAmount + PayrollPayrollGlobalFunctions.ConvertToHourlyRate((nIncrAmount + oCurrgrade.MinBasic)) * nTotalORDHrs;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// Prvograde = _greades.FirstOrDefault(x => x.ID.Integer == PrvSalary.GradeID.Integer);
|
|||
|
// salary.WIPIncrement = nIncrAmount + oCurrgrade.MinBasic - Prvograde.MinBasic;
|
|||
|
// arrearAmount = arrearAmount + PayrollPayrollGlobalFunctions.ConvertToHourlyRate((nIncrAmount + oCurrgrade.MinBasic - Prvograde.MinBasic)) * nTotalORDHrs;
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// arrearItem.BasicSalary = arrearItem.BasicSalary * PayrollPayrollGlobalFunctions.GetFraction(arrearItem.EffectDate, (DateTime)arrearItem.TillDate);
|
|||
|
// arrearItem.BasicSalary = PayrollPayrollGlobalFunctions.Round(arrearItem.BasicSalary);
|
|||
|
// arrearItem.GrossSalary = arrearItem.GrossSalary * PayrollPayrollGlobalFunctions.GetFraction(arrearItem.EffectDate, (DateTime)arrearItem.TillDate);
|
|||
|
// arrearItem.GrossSalary = PayrollPayrollGlobalFunctions.Round(arrearItem.GrossSalary);
|
|||
|
// arrearItem.FractionofFromTo = PayrollPayrollGlobalFunctions.GetFraction(arrearItem.EffectDate, (DateTime)arrearItem.TillDate);
|
|||
|
// arrearAmount = (arrearAmount + arrearItem.BasicSalary) - salary.GetAmountOnRange(salary.Employee, arrearItem.EffectDate, (DateTime)arrearItem.TillDate, EnumSalaryGroup.Gross,
|
|||
|
// EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, arrearItem, null);
|
|||
|
|
|||
|
// }
|
|||
|
// arrearAmount = PayrollPayrollGlobalFunctions.Round(arrearAmount);
|
|||
|
// }
|
|||
|
|
|||
|
// if (salary.ArrearGradeSalaries.Count > 0)
|
|||
|
// {
|
|||
|
// if (salary.Category.WagesType == EnumWagesType.Monthly)
|
|||
|
// {
|
|||
|
// DateTime arrearPaidFrom = salary.ArrearGradeSalaries[0].EffectDate;
|
|||
|
// salary.ArrearPaidGradeSalaries = EmployeeGradeSalary.Service.GetArrearPaidItems(salary.EmployeeID, arrearPaidFrom, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
// if (salary.ArrearPaidGradeSalaries.Count > 0)
|
|||
|
// {
|
|||
|
// if (salary.ArrearPaidGradeSalaries[0].EffectDate < arrearPaidFrom)
|
|||
|
// salary.ArrearPaidGradeSalaries[0].EffectDate = arrearPaidFrom;
|
|||
|
// }
|
|||
|
// foreach (EmployeeGradeSalary paidarrearItem in salary.ArrearPaidGradeSalaries)
|
|||
|
// {
|
|||
|
// paidarrearItem.BasicSalary = paidarrearItem.BasicSalary * PayrollPayrollGlobalFunctions.GetFraction(paidarrearItem.EffectDate, (DateTime)paidarrearItem.TillDate);
|
|||
|
// paidarrearItem.BasicSalary = PayrollPayrollGlobalFunctions.Round(paidarrearItem.BasicSalary);
|
|||
|
// paidarrearItem.GrossSalary = paidarrearItem.GrossSalary * PayrollPayrollGlobalFunctions.GetFraction(paidarrearItem.EffectDate, (DateTime)paidarrearItem.TillDate);
|
|||
|
// paidarrearItem.GrossSalary = PayrollPayrollGlobalFunctions.Round(paidarrearItem.GrossSalary);
|
|||
|
// paidarrearItem.FractionofFromTo = PayrollPayrollGlobalFunctions.GetFraction(paidarrearItem.EffectDate, (DateTime)paidarrearItem.TillDate);
|
|||
|
// arrearAmount = arrearAmount - (paidarrearItem.BasicSalary - salary.GetAmountOnRange(salary.Employee, paidarrearItem.EffectDate, (DateTime)paidarrearItem.TillDate, EnumSalaryGroup.Gross,
|
|||
|
// EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary));
|
|||
|
// arrearAmount = PayrollPayrollGlobalFunctions.Round(arrearAmount);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// if (arrearAmount != 0)
|
|||
|
// {
|
|||
|
// SalaryMonthlyDetail detail = null;
|
|||
|
// if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1)
|
|||
|
// {
|
|||
|
// detail = this.AddDetail(salary, EnumSalaryGroup.Arrear, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, 0, "Basic", PayrollPayrollGlobalFunctions.Round(arrearAmount));
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// detail = this.AddDetail(salary, EnumSalaryGroup.Arrear, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, 0, "Ordinary Amount", PayrollPayrollGlobalFunctions.Round(arrearAmount));
|
|||
|
// }
|
|||
|
|
|||
|
// if (detail != null && basicDetail != null)
|
|||
|
// {
|
|||
|
// detail.Position = basicDetail.Position;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion calculate arrear amount
|
|||
|
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
// private void PF()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// bool earnedBasic = ConfigurationManager.GetBoolValue("pf", "earnedbasic", EnumConfigurationType.Logic);
|
|||
|
// double pfPercent = (SystemInformation.CurrentSysInfo.pFContriCompany / 100);
|
|||
|
// List<PFException> oPfExceptions = PFException.Get();
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// SalaryMonthlyDetail pfDetail = null;
|
|||
|
|
|||
|
// if (salary.Employee.PFMemberType != EnumPFMembershipType.Live) continue;
|
|||
|
// SalaryMonthly prvSalary = _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID.Integer == salary.EmployeeID.Integer);
|
|||
|
// double arrearPF = 0;
|
|||
|
// if (prvSalary != null)
|
|||
|
// {
|
|||
|
// SalaryMonthlyDetail prvPF = prvSalary.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.PF_Contribution && detail.itemGroupCode == EnumSalaryGroup.Deductions); });
|
|||
|
|
|||
|
|
|||
|
// if (salary.Employee.ConfirDate != DateTime.MinValue && salary.Employee.ConfirDate < PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(_processMonth) && prvSalary != null && prvPF == null) // if pf continue with previous month salary
|
|||
|
// {
|
|||
|
// DateTime tepConfirm = salary.Employee.ConfirDate;
|
|||
|
// while (PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(tepConfirm) <= SystemInformation.CurrentSysInfo.LastPayProcessDate)
|
|||
|
// {
|
|||
|
// EmployeeGradeSalary gradeSal = EmployeeGradeSalary.GetBasicOnDateBAT(salary.EmployeeID, tepConfirm);
|
|||
|
// if (gradeSal == null)
|
|||
|
// {
|
|||
|
// AddProcessStatus(salary.Employee, " Employee previous salary not found during PF arrear calculation");
|
|||
|
// break;
|
|||
|
// }
|
|||
|
|
|||
|
// double fractionate = 0;
|
|||
|
// if (tepConfirm == PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(tepConfirm))
|
|||
|
// fractionate = 1;
|
|||
|
// if (tepConfirm == PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(tepConfirm))
|
|||
|
// fractionate = 30 / 29;
|
|||
|
// else fractionate = PayrollPayrollGlobalFunctions.GetFractinalOfMonth(tepConfirm);
|
|||
|
|
|||
|
// arrearPF = arrearPF + ((gradeSal.BasicSalary * fractionate) * pfPercent);
|
|||
|
|
|||
|
// tepConfirm = PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(tepConfirm.AddMonths(1));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// SalaryMonthlyDetail basic = salary.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary && detail.itemGroupCode == EnumSalaryGroup.Gross); });
|
|||
|
// if (basic != null)
|
|||
|
// {
|
|||
|
// pfDetail = this.AddDetail(salary, EnumSalaryGroup.Deductions,
|
|||
|
// EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution, 0, "PF", PayrollPayrollGlobalFunctions.Round(basic.CalculatedAmount * pfPercent));
|
|||
|
// }
|
|||
|
|
|||
|
// basic = salary.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary && detail.itemGroupCode == EnumSalaryGroup.Arrear); });
|
|||
|
// if (basic != null)
|
|||
|
// {
|
|||
|
// pfDetail.CalculatedAmount = pfDetail.CalculatedAmount + PayrollPayrollGlobalFunctions.Round(basic.CalculatedAmount * pfPercent);
|
|||
|
// }
|
|||
|
|
|||
|
// basic = salary.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary && detail.itemGroupCode == EnumSalaryGroup.UnauthLeave); });
|
|||
|
// if (basic != null)
|
|||
|
// {
|
|||
|
// pfDetail.CalculatedAmount = pfDetail.CalculatedAmount - PayrollPayrollGlobalFunctions.Round(basic.CalculatedAmount * pfPercent);
|
|||
|
// }
|
|||
|
|
|||
|
// if (pfDetail != null)
|
|||
|
// {
|
|||
|
|
|||
|
// if (PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(salary.Employee.ConfirDate) == _processMonth)
|
|||
|
// pfDetail.CalculatedAmount = PayrollPayrollGlobalFunctions.Round(pfDetail.CalculatedAmount * ((double)(31 - salary.Employee.ConfirDate.Day) / (double)30));
|
|||
|
|
|||
|
// pfDetail.CalculatedAmount = pfDetail.CalculatedAmount + PayrollPayrollGlobalFunctions.Round(arrearPF);
|
|||
|
// pfDetail.ChangedAmount = pfDetail.CalculatedAmount;
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// //if (earnedBasic == false)
|
|||
|
// //{
|
|||
|
// // pfDetail = this.AddDetail(salary, EnumSalaryGroup.Deductions ,
|
|||
|
// // EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution, 0, "PF", PayrollPayrollGlobalFunctions.Round(salary.ThisMonthBasic * pfPercent));
|
|||
|
|
|||
|
|
|||
|
// //}
|
|||
|
// //else
|
|||
|
// //{
|
|||
|
// // SalaryMonthlyDetail basic = salary.Details.Find(delegate(SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary && detail.itemGroupCode == EnumSalaryGroup.Gross); });
|
|||
|
// // if (basic != null)
|
|||
|
// // {
|
|||
|
// // pfDetail= this.AddDetail(salary, EnumSalaryGroup.Deductions,
|
|||
|
// // EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution, 0, "PF", PayrollPayrollGlobalFunctions.Round(basic.CalculatedAmount * pfPercent));
|
|||
|
// // }
|
|||
|
|
|||
|
// // basic = salary.Details.Find(delegate(SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary && detail.itemGroupCode == EnumSalaryGroup.Arrear); });
|
|||
|
// // if (basic != null)
|
|||
|
// // {
|
|||
|
// // pfDetail.CalculatedAmount = pfDetail.CalculatedAmount + PayrollPayrollGlobalFunctions.Round(basic.CalculatedAmount * pfPercent);
|
|||
|
// // }
|
|||
|
|
|||
|
// // basic = salary.GetDetail(EnumSalaryGroup.UnauthLeave, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary);
|
|||
|
// // if (basic != null)
|
|||
|
// // {
|
|||
|
// // pfDetail.CalculatedAmount = pfDetail.CalculatedAmount - PayrollPayrollGlobalFunctions.Round(basic.CalculatedAmount * pfPercent);
|
|||
|
// // //this.AddDetail(salary, EnumSalaryGroup.Deductions,
|
|||
|
// // // EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution, 0, "PF", -PayrollPayrollGlobalFunctions.Round(basic.CalculatedAmount * pfPercent));
|
|||
|
// // }
|
|||
|
// // if(pfDetail!=null) pfDetail.ChangedAmount = pfDetail.CalculatedAmount;
|
|||
|
|
|||
|
// //}
|
|||
|
|
|||
|
// //#region Exception PF
|
|||
|
|
|||
|
// //PFException oEmpPFException = oPfExceptions.FirstOrDefault(x => x.EmployeeID == salary.Employee.ID);
|
|||
|
// //if (oEmpPFException != null) // && oEmpPFException.StartDate <= salary.SalaryMonth)
|
|||
|
// //{
|
|||
|
// // if (pfDetail != null)
|
|||
|
// // {
|
|||
|
// // pfDetail.CalculatedAmount = oEmpPFException.EPFPercent == 0 ? oEmpPFException.EPFAmount : PayrollPayrollGlobalFunctions.Round(salary.ThisMonthBasic * (oEmpPFException.EPFPercent/ 100)) ;
|
|||
|
// // pfDetail.ChangedAmount = pfDetail.CalculatedAmount;
|
|||
|
// // }
|
|||
|
// //}
|
|||
|
|
|||
|
|
|||
|
// //#endregion
|
|||
|
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// private void DesignationAttachment()
|
|||
|
// {
|
|||
|
// EmpChangeDesignation ochanges = new EmpChangeDesignation();
|
|||
|
// ochanges.DesignationAttachment(_PrvMonthsalary, _salaryMonthlys);
|
|||
|
// return;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// #region Designation change in fraction month
|
|||
|
|
|||
|
// List<EmpLifeCycle> empLifecycles = EmpLifeCycle.GetByCreateDate(SystemInformation.CurrentSysInfo.LastPayProcessDate, SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// var emplifecycles = empLifecycles.Where(x => x.DesignationID != null)
|
|||
|
// .GroupBy(x => x.EmployeeID.Integer)
|
|||
|
// .Select(x => new { EmployeeID = x.Key }).ToList();
|
|||
|
|
|||
|
|
|||
|
// foreach (var lEntry in emplifecycles)
|
|||
|
// {
|
|||
|
// List<EmpChangeDesignation> empdngs = new List<EmpChangeDesignation>();
|
|||
|
// List<EmpLifeCycle> empCount = empLifecycles.Where(x => x.EmployeeID.Integer == (int)lEntry.EmployeeID && x.DesignationID != null).ToObjectsTemplate();
|
|||
|
// SalaryMonthly omonthyly = _salaryMonthlys.FirstOrDefault(x => x.EmployeeID.Integer == lEntry.EmployeeID);
|
|||
|
// if (omonthyly == null) continue;
|
|||
|
// empdngs = new List<EmpChangeDesignation>();
|
|||
|
// int count = 0;
|
|||
|
// foreach (EmpLifeCycle item in empCount)
|
|||
|
// {
|
|||
|
// if (item.DesignationID == null) continue;
|
|||
|
// bool Isnew = !_PrvMonthsalary.Exists(x => x.EmployeeID.Integer == item.EmployeeID.Integer);
|
|||
|
|
|||
|
// count = count + 1;
|
|||
|
// //if(empCount.Count > count)
|
|||
|
// // if (empCount.GetRange(count, empCount.Count - count).Any(x => x.EffectDate == item.EffectDate) == true) continue;
|
|||
|
|
|||
|
// if (item.EffectDate < PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
// {
|
|||
|
// if (item.EffectDate == GlobalExtensions.PayrollFirstDateOfMonth(item.EffectDate))
|
|||
|
// {
|
|||
|
// EmpChangeDesignation ecd = new EmpChangeDesignation();
|
|||
|
// ecd.EmployeeID = (lEntry.EmployeeID);
|
|||
|
// ecd.DesignationID = (Isnew == true) ? omonthyly.DesignationID : _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).DesignationID;
|
|||
|
// ecd.EffectDateFrom = item.EffectDate;
|
|||
|
// ecd.EffectedDateTo = SystemInformation.CurrentSysInfo.LastPayProcessDate;
|
|||
|
// ecd.GradeID = (Isnew == true) ? omonthyly.GradeID : _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).GradeID; ;
|
|||
|
// ecd.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd.EffectDateFrom, ecd.EffectedDateTo);
|
|||
|
// ecd.IsArrear = true;
|
|||
|
// ecd.NewJoiner = Isnew;
|
|||
|
// empdngs.Add(ecd);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
|
|||
|
// if (Isnew == false)
|
|||
|
// {
|
|||
|
// EmpChangeDesignation ecd1 = new EmpChangeDesignation();
|
|||
|
// ecd1.EmployeeID = (lEntry.EmployeeID);
|
|||
|
// ecd1.DesignationID = (Isnew == true) ? omonthyly.DesignationID : _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).DesignationID;
|
|||
|
// ecd1.EffectDateFrom = GlobalExtensions.PayrollFirstDateOfMonth(item.EffectDate);
|
|||
|
// ecd1.EffectedDateTo = item.EffectDate.AddDays(-1);
|
|||
|
// ecd1.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd1.EffectDateFrom, ecd1.EffectedDateTo);
|
|||
|
// ecd1.IsArrear = true;
|
|||
|
// ecd1.NewJoiner = Isnew;
|
|||
|
// ecd1.GradeID = (Isnew == true) ? omonthyly.GradeID : _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).GradeID;
|
|||
|
// empdngs.Add(ecd1);
|
|||
|
// }
|
|||
|
|
|||
|
// EmpChangeDesignation ecd2 = new EmpChangeDesignation();
|
|||
|
// ecd2.EmployeeID = (lEntry.EmployeeID);
|
|||
|
// ecd2.DesignationID = item.DesignationID;
|
|||
|
// ecd2.EffectDateFrom = item.EffectDate;
|
|||
|
// ecd2.EffectedDateTo = SystemInformation.CurrentSysInfo.LastPayProcessDate;
|
|||
|
// ecd2.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd2.EffectDateFrom, ecd2.EffectedDateTo);
|
|||
|
// ecd2.IsArrear = true;
|
|||
|
// ecd2.NewJoiner = Isnew;
|
|||
|
// ecd2.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|||
|
// empdngs.Add(ecd2);
|
|||
|
// }
|
|||
|
|
|||
|
// if (count == empCount.Count)
|
|||
|
// {
|
|||
|
// EmpChangeDesignation ecd3 = new EmpChangeDesignation();
|
|||
|
// ecd3.EmployeeID = (lEntry.EmployeeID);
|
|||
|
// ecd3.DesignationID = item.DesignationID;
|
|||
|
// ecd3.EffectDateFrom = PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
// ecd3.EffectedDateTo = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
// ecd3.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd3.EffectDateFrom, ecd3.EffectedDateTo);
|
|||
|
// ecd3.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|||
|
|
|||
|
// empdngs.Add(ecd3);
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
// else if (item.EffectDate > PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate))
|
|||
|
// {
|
|||
|
|
|||
|
// if (Isnew == false)
|
|||
|
// {
|
|||
|
// EmpChangeDesignation ecd4 = new EmpChangeDesignation();
|
|||
|
// ecd4.EmployeeID = (lEntry.EmployeeID);
|
|||
|
// ecd4.DesignationID = (Isnew == true) ? omonthyly.DesignationID : _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).DesignationID;
|
|||
|
// ecd4.EffectDateFrom = GlobalExtensions.PayrollFirstDateOfMonth(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
// ecd4.EffectedDateTo = item.EffectDate.AddDays(-1);
|
|||
|
// ecd4.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd4.EffectDateFrom, ecd4.EffectedDateTo);
|
|||
|
// ecd4.GradeID = (item.GradeID == null) ? omonthyly.GradeID : _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID.Integer == item.EmployeeID.Integer).GradeID; ; ;
|
|||
|
// empdngs.Add(ecd4);
|
|||
|
// }
|
|||
|
|
|||
|
// EmpChangeDesignation ecd5 = new EmpChangeDesignation();
|
|||
|
// ecd5.EmployeeID = (lEntry.EmployeeID);
|
|||
|
// ecd5.DesignationID = item.DesignationID;
|
|||
|
// ecd5.EffectDateFrom = item.EffectDate;
|
|||
|
// ecd5.EffectedDateTo = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
// ecd5.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd5.EffectDateFrom, ecd5.EffectedDateTo);
|
|||
|
// ecd5.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|||
|
|
|||
|
|
|||
|
// empdngs.Add(ecd5);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// if (count == empCount.Count)
|
|||
|
// {
|
|||
|
// EmpChangeDesignation ecd4 = new EmpChangeDesignation();
|
|||
|
// ecd4.EmployeeID = (lEntry.EmployeeID);
|
|||
|
// ecd4.DesignationID = item.DesignationID;
|
|||
|
// ecd4.EffectDateFrom = item.EffectDate;
|
|||
|
// ecd4.GradeID = (item.GradeID == null) ? omonthyly.GradeID : item.GradeID;
|
|||
|
// ecd4.EffectedDateTo = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
// ecd4.Franctionate = Payroll.BO.PayrollPayrollGlobalFunctions.GetFraction(ecd4.EffectDateFrom, ecd4.EffectedDateTo);
|
|||
|
// empdngs.Add(ecd4);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// SalaryMonthly osalary = _salaryMonthlys.FirstOrDefault(x => x.EmployeeID.Integer == lEntry.EmployeeID);
|
|||
|
// if (osalary != null) osalary.DesignationChanges = empdngs;
|
|||
|
// }
|
|||
|
// #endregion
|
|||
|
// }
|
|||
|
|
|||
|
// private void AllowanceDeduction()
|
|||
|
// {
|
|||
|
// DateTime fromDate = PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(_processMonth);
|
|||
|
// fromDate = fromDate.AddMonths(-1);
|
|||
|
// fromDate = new DateTime(fromDate.Year, fromDate.Month, 26);
|
|||
|
// DateTime toDate = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(_processMonth);
|
|||
|
// toDate = new DateTime(toDate.Year, toDate.Month, 25);
|
|||
|
// //DataSet absentDSet = DailyAttnProcess.Service.GetTotalAbsentDays(fromDate, toDate);
|
|||
|
// DataSet presentDSet = DailyAttnProcess.Service.GetTotalPresentDays(fromDate, toDate);
|
|||
|
// List<DailyAttnProcess> _dailyAttnProcess = DailyAttnProcess.Get(fromDate, toDate);
|
|||
|
// List<DailyAttnProcess> _dailyAttnProcessEmp = new List<DailyAttnProcess>();
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
// _adParameters = ADParameter.Service.GetWithDetail(EnumStatus.Active, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
// if (_adParameters == null || _adParameters.Count == 0)
|
|||
|
// {
|
|||
|
// return;
|
|||
|
// }
|
|||
|
|
|||
|
// _allowdeducitons = Payroll.BO.AllowanceDeduction.Get(EnumStatus.Regardless);
|
|||
|
// List<ADParameterEmployee> indvAllowances = ADParameterEmployee.Service.Get(
|
|||
|
// PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(_processMonth),
|
|||
|
// PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(_processMonth), SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
// //this.DesignationAttachment();
|
|||
|
// DataRow dtrow = null;
|
|||
|
// double totalPresentDays = 0;
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// dtrow = null;
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// ADParameter.ApplicableParameters(salary.Employee, salary, _adParameters);
|
|||
|
// this.GradeDefinedAllowDeduct(salary, salary.GradeSalaries, EnumSalaryGroup.Gross, indvAllowances, EnumSide.Add);
|
|||
|
// this.GradeDefinedAllowDeduct(salary, salary.ArrearGradeSalaries, EnumSalaryGroup.Arrear, indvAllowances, EnumSide.Add);
|
|||
|
// this.GradeDefinedAllowDeduct(salary, salary.ArrearPaidGradeSalaries, EnumSalaryGroup.Arrear, indvAllowances, EnumSide.Deduct);
|
|||
|
// if (presentDSet != null && presentDSet.Tables[0].Rows.Count > 0)
|
|||
|
// dtrow = presentDSet.Tables[0].AsEnumerable().Where(x => Convert.ToInt32(x["EmployeeID"]) == salary.EmployeeID.Integer).FirstOrDefault();
|
|||
|
// totalPresentDays = dtrow == null ? 0 : Convert.ToDouble(dtrow["Total"]);
|
|||
|
// _dailyAttnProcessEmp = _dailyAttnProcess.Where(o => o.EmployeeID == salary.EmployeeID).ToObjectsTemplate();
|
|||
|
// if (_dailyAttnProcessEmp.Count == 0)
|
|||
|
// totalPresentDays = 0;
|
|||
|
// if (_dailyAttnProcessEmp.Where(o => o.AttenType == EnumAttendanceType.Present).Count() >= 26)
|
|||
|
// totalPresentDays = 26;
|
|||
|
// this.IndividualAllowDeduct(salary, indvAllowances, totalPresentDays);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// private void IndividualAllowDeduct(SalaryMonthly salary, List<ADParameterEmployee> indvAllowances, double toTalPresentDays)
|
|||
|
// {
|
|||
|
// double amount = 0;
|
|||
|
// EnumSalaryGroup groupCode = EnumSalaryGroup.Gross;
|
|||
|
// int sbaAllowanceParamID = ConfigurationManager.GetIntValue("salary", "sbaallow", EnumConfigurationType.Logic);
|
|||
|
// int sbaDeductionParamID = ConfigurationManager.GetIntValue("salary", "sbadeduct", EnumConfigurationType.Logic);
|
|||
|
// #region Individual Allowance
|
|||
|
// List<ADParameterEmployee> items = indvAllowances.FindAll(delegate (ADParameterEmployee item)
|
|||
|
// {
|
|||
|
// return item.EmployeeID.Integer == salary.Employee.ID.Integer && item.ADEmpType == EnumADEmpType.AppliedToIndividual;
|
|||
|
// });
|
|||
|
// foreach (ADParameterEmployee item in items)
|
|||
|
// {
|
|||
|
// amount = 0;
|
|||
|
// ADParameter parameter = _adParameters.GetItem(item.ADParameterID);
|
|||
|
|
|||
|
// amount = parameter.GetIndividualAmount(salary.Employee, _processMonth, item,
|
|||
|
// salary.Employee.GrossSalary, salary.GetGrossAmount(EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary));
|
|||
|
|
|||
|
// if (item.ADParameterID.Integer == sbaAllowanceParamID || item.ADParameterID.Integer == sbaDeductionParamID)
|
|||
|
// amount = (amount / 26.0) * (toTalPresentDays);
|
|||
|
// EnumSalaryItemCode itemCode = EnumSalaryItemCode.Allowance;
|
|||
|
// groupCode = EnumSalaryGroup.Gross;
|
|||
|
// if (parameter.AllowOrDeductType == EnumAllowOrDeduct.Deduction)
|
|||
|
// {
|
|||
|
// itemCode = EnumSalaryItemCode.Deduction;
|
|||
|
// groupCode = EnumSalaryGroup.Deductions;
|
|||
|
// }
|
|||
|
// if (item.Arreartype == EnumArrearType.ToCalculate) groupCode = EnumSalaryGroup.Arrear;
|
|||
|
|
|||
|
// if (groupCode == EnumSalaryGroup.Arrear)
|
|||
|
// {
|
|||
|
// amount = amount - salary.GetUnAuthorizeAmount(amount, salary.Employee,
|
|||
|
// item.FormDate, (DateTime)item.TillDate, itemCode, parameter.AllowDeductID.Integer);
|
|||
|
// EnumSalaryGroup arrgCode = (parameter.AllowanceDeduction.AllowOrDeductType == EnumAllowOrDeduct.Allowance) ? EnumSalaryGroup.Gross : EnumSalaryGroup.Deductions;
|
|||
|
// amount = amount - salary.GetAmountOnRange(salary.Employee, item.FormDate, (DateTime)item.TillDate, arrgCode, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer);
|
|||
|
// if (amount == 0) continue;
|
|||
|
// }
|
|||
|
|
|||
|
// SalaryMonthlyDetail detail = salary.GetDetail(groupCode, itemCode, parameter.AllowDeductID.Integer);
|
|||
|
// if (detail == null)
|
|||
|
// {
|
|||
|
// detail = this.AddDetail(salary, groupCode, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, parameter.AllowanceDeduction.Name, PayrollPayrollGlobalFunctions.Round(amount));
|
|||
|
|
|||
|
// if (_attnBenifits != null & _attnBenifits.Count > 0)
|
|||
|
// {
|
|||
|
// AttnMonthlyBenefit attnItem = _attnBenifits.Find(delegate (AttnMonthlyBenefit attn)
|
|||
|
// {
|
|||
|
// return attn.EmployeeID == item.EmployeeID.Integer
|
|||
|
// && attn.ItemType == enumPayrollComponentType.Allowance && attn.ItemID == item.AllowDeductID.Integer;
|
|||
|
// });
|
|||
|
// if (attnItem != null && attnItem.Total != 0)
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.Miscellaneous, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, parameter.AllowanceDeduction.Name, attnItem.Total);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// detail.CalculatedAmount = detail.CalculatedAmount + amount;
|
|||
|
// detail.CalculatedAmount = PayrollPayrollGlobalFunctions.Round(detail.CalculatedAmount);
|
|||
|
// detail.ChangedAmount = detail.CalculatedAmount;
|
|||
|
// detail.SupportID = parameter.ID;
|
|||
|
// }
|
|||
|
// if (detail != null)
|
|||
|
// detail.Position = item.AllowDeduct.Sequence + 1;
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion Individual Allowance
|
|||
|
// }
|
|||
|
|
|||
|
// private void GradeDefinedAllowDeduct(SalaryMonthly salary, List<EmployeeGradeSalary> gradeSalaries,
|
|||
|
// EnumSalaryGroup gCode, List<ADParameterEmployee> indvAllowances, EnumSide side)
|
|||
|
// {
|
|||
|
// double amount = 0;
|
|||
|
// EnumSalaryGroup GroupCode = gCode;
|
|||
|
// foreach (EmployeeGradeSalary empGradeSalary in gradeSalaries)
|
|||
|
// {
|
|||
|
// amount = 0;
|
|||
|
// if (gCode == EnumSalaryGroup.Arrear) amount = 0;
|
|||
|
// foreach (ADParameter parameter in empGradeSalary.ADParameters)
|
|||
|
// {
|
|||
|
// GroupCode = gCode;
|
|||
|
// parameter.AllowanceDeduction = _allowdeducitons.GetItem(parameter.AllowDeductID);
|
|||
|
// if (parameter.AllowanceDeduction.AllowOrDeductType == EnumAllowOrDeduct.Deduction && GroupCode == EnumSalaryGroup.Gross)
|
|||
|
// GroupCode = EnumSalaryGroup.Deductions;
|
|||
|
|
|||
|
// EnumSalaryItemCode itemCode = (parameter.AllowOrDeductType == EnumAllowOrDeduct.Allowance) ? EnumSalaryItemCode.Allowance : EnumSalaryItemCode.Deduction;
|
|||
|
|
|||
|
// amount = 0;
|
|||
|
// if (parameter.EntitleType == EnumEntitleType.Grade)
|
|||
|
// {
|
|||
|
|
|||
|
// if (salary.Category.WagesType == EnumWagesType.Monthly)
|
|||
|
// {
|
|||
|
// if (GroupCode == EnumSalaryGroup.Gross)
|
|||
|
// {
|
|||
|
// parameter.DesignationChanges = salary.DesignationChanges.Where(x => x.IsArrear == false).ToObjectsTemplate();
|
|||
|
// amount = parameter.GetGradeDefinedAmount(salary.Employee, empGradeSalary.BasicSalary, empGradeSalary.GrossSalary, empGradeSalary);
|
|||
|
// if (parameter.ADParameterDesignations.Count > 0 && salary.DesignationChanges.Any(x => x.IsArrear == true) && salary.ArrearGradeSalaries.Count == 0) // Only Designation Arrear no grade Arrear
|
|||
|
// {
|
|||
|
|
|||
|
// // double arrAmount = parameter.GetGradeDefinedAmount(salary.Employee, empGradeSalary.BasicSalary, empGradeSalary.GrossSalary, empGradeSalary);
|
|||
|
// parameter.DesignationChanges = salary.DesignationChanges.Where(x => x.IsArrear == true).ToObjectsTemplate(); ;
|
|||
|
// double arrAmount = parameter.GetGradeDefinedAmount(salary.Employee, empGradeSalary.BasicSalary, empGradeSalary.GrossSalary, empGradeSalary);
|
|||
|
// EnumSalaryGroup arrgCode = (parameter.AllowanceDeduction.AllowOrDeductType == EnumAllowOrDeduct.Allowance) ? EnumSalaryGroup.Gross : EnumSalaryGroup.Deductions;
|
|||
|
// arrAmount = arrAmount - salary.GetAmountOnRange(salary.Employee, salary.DesignationChanges[0].EffectDateFrom, salary.DesignationChanges[salary.DesignationChanges.Count - 1].EffectedDateTo, arrgCode, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, empGradeSalary, parameter);
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.Arrear, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, parameter.AllowanceDeduction.Name, PayrollPayrollGlobalFunctions.Round(arrAmount));
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// // Designation wise allowance setup change in Previous month
|
|||
|
// // Employee who don't have any Designation change in life-cycle but he is going to get new designation wise benifits from middle of the month
|
|||
|
// ADParameter.ADParameterDesignation otest = parameter.ADParameterDesignations.FirstOrDefault(x => x.DesignationID.Integer == salary.DesignationID.Integer);
|
|||
|
|
|||
|
// if (parameter.ADParameterDesignations.Any(x => x.IsDesignationArrear == true && x.DesignationID.Integer == salary.DesignationID.Integer)
|
|||
|
// && salary.ArrearGradeSalaries.Count == 0 && parameter.DesignationChanges.Count == 0)
|
|||
|
// {
|
|||
|
|
|||
|
// ADParameter.ADParameterDesignation odg = parameter.ADParameterDesignations.FirstOrDefault(x => x.DesignationID.Integer == salary.DesignationID.Integer);
|
|||
|
// double arrAmount = odg.FlatAmount * PayrollPayrollGlobalFunctions.GetFraction(odg.EffectMonth, PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(_processMonth.AddMonths(-1)));
|
|||
|
// EnumSalaryGroup arrgCode = (parameter.AllowanceDeduction.AllowOrDeductType == EnumAllowOrDeduct.Allowance) ? EnumSalaryGroup.Gross : EnumSalaryGroup.Deductions;
|
|||
|
// arrAmount = arrAmount - salary.GetAmountOnRange(salary.Employee, odg.EffectMonth, PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(_processMonth.AddMonths(-1)), arrgCode, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, empGradeSalary, parameter);
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.Arrear, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, parameter.AllowanceDeduction.Name, PayrollPayrollGlobalFunctions.Round(arrAmount));
|
|||
|
// }
|
|||
|
// // Designation wise allowance setup change in current month
|
|||
|
// // Employee who don't have any Designation change in life-cycle but he is going to get new designation wise benifits from middle of the month
|
|||
|
|
|||
|
// if (otest != null && parameter.DesignationChanges.Count == 0 && otest.EffectMonth > PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(_processMonth) && salary.ArrearGradeSalaries.Count == 0)
|
|||
|
// {
|
|||
|
// amount = amount * PayrollPayrollGlobalFunctions.GetFractinalOfMonth(otest.EffectMonth);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// parameter.DesignationChanges = salary.DesignationChanges.Where(x => x.IsArrear == true).ToObjectsTemplate(); ;
|
|||
|
// amount = parameter.GetGradeDefinedAmount(salary.Employee, empGradeSalary.BasicSalary, empGradeSalary.GrossSalary, empGradeSalary);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
|
|||
|
// if (gCode == EnumSalaryGroup.Arrear) // needed to handle BATB Non-Management arrear
|
|||
|
// {
|
|||
|
// double monthDef = 0;
|
|||
|
// foreach (EmployeeGradeSalary monthCount in gradeSalaries)
|
|||
|
// {
|
|||
|
// monthDef = monthDef + Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("m", monthCount.EffectDate, (DateTime)monthCount.TillDate) + 1;
|
|||
|
// }
|
|||
|
// SalaryMonthlyDetail dt = salary.GetDetail(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary);
|
|||
|
// if (dt != null)
|
|||
|
// {
|
|||
|
// if (salary.Employee.GrandFather != null)
|
|||
|
// amount = salary.WIPIncrement * parameter.GFPercentOfBasic / 100 * monthDef;
|
|||
|
// else amount = salary.WIPIncrement * parameter.PercentOfBasic / 100 * monthDef;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else amount = parameter.GetGradeDefinedAmount(salary.Employee, empGradeSalary.BasicSalary, empGradeSalary.GrossSalary, empGradeSalary);
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
// else continue;
|
|||
|
|
|||
|
// if (GroupCode == EnumSalaryGroup.Arrear && salary.Category.WagesType == EnumWagesType.Monthly)
|
|||
|
// {
|
|||
|
// amount = amount - salary.GetUnAuthorizeAmount(amount, salary.Employee,
|
|||
|
// empGradeSalary.EffectDate, (DateTime)empGradeSalary.TillDate, itemCode, parameter.AllowDeductID.Integer);
|
|||
|
// EnumSalaryGroup arrgCode = (parameter.AllowanceDeduction.AllowOrDeductType == EnumAllowOrDeduct.Allowance) ? EnumSalaryGroup.Gross : EnumSalaryGroup.Deductions;
|
|||
|
// amount = amount - salary.GetAmountOnRange(salary.Employee, empGradeSalary.EffectDate, (DateTime)empGradeSalary.TillDate, arrgCode, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, empGradeSalary, parameter);
|
|||
|
// if (amount == 0) continue;
|
|||
|
// }
|
|||
|
|
|||
|
// if (GroupCode == EnumSalaryGroup.Arrear && side == EnumSide.Deduct) amount = -amount;
|
|||
|
|
|||
|
// SalaryMonthlyDetail detail = salary.GetDetail(GroupCode, itemCode, parameter.AllowDeductID.Integer);
|
|||
|
// if (detail == null)
|
|||
|
// {
|
|||
|
// detail = this.AddDetail(salary, GroupCode, itemCode, parameter.AllowDeductID.Integer, parameter.ID.Integer, parameter.AllowanceDeduction.Name, PayrollPayrollGlobalFunctions.Round(amount));
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// detail.CalculatedAmount = detail.CalculatedAmount + amount;
|
|||
|
// detail.CalculatedAmount = PayrollPayrollGlobalFunctions.Round(detail.CalculatedAmount);
|
|||
|
// detail.ChangedAmount = detail.CalculatedAmount;
|
|||
|
// detail.SupportID = parameter.ID;
|
|||
|
// }
|
|||
|
// if (detail != null)
|
|||
|
// detail.Position = parameter.AllowanceDeduction.Sequence + 1;
|
|||
|
|
|||
|
// parameter.DesignationChanges = new List<EmpChangeDesignation>();
|
|||
|
// }
|
|||
|
// if (gCode == EnumSalaryGroup.Arrear) break; // needed to handle BATB Non-Management arrear
|
|||
|
// }
|
|||
|
// }
|
|||
|
// private void OverTimeProcess()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// TermParameter ob = new TermParameter();
|
|||
|
|
|||
|
// List<OTProcess> otProcess = OTProcess.Get(SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
|||
|
// if (otProcess == null || otProcess.Count == 0) return;
|
|||
|
|
|||
|
// foreach (SalaryMonthly sMonthly in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
|
|||
|
// List<OTProcess> empOTProcess = otProcess.FindAll(delegate (OTProcess process) { return process.EmployeeID.Integer == sMonthly.EmployeeID.Integer; });
|
|||
|
// if (empOTProcess != null)
|
|||
|
// {
|
|||
|
// foreach (OTProcess process in empOTProcess)
|
|||
|
// {
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Over_Time_Hours, process.TermID.Integer, process.TermParameterID.Integer, process.TermObj.Name + " hour", process.TotalHour);
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Gross, EnumSalaryItemCode.Over_Time_Amount, process.TermID.Integer, process.TermParameterID.Integer, process.TermObj.Name, PayrollPayrollGlobalFunctions.Round(process.Amount));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// private void AttendanceDayProcess()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// // TermParameter ob = new TermParameter();
|
|||
|
// DateTime PayrollFirstDateOfMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate.PayrollFirstDateOfMonth().Date;
|
|||
|
// DateTime PayrollLastDateOfMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate.PayrollLastDateOfMonth().Date;
|
|||
|
// int TotalDaysInMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate.TotalDaysInMonth();
|
|||
|
// List<DailyAttnProcess> attnProcess = DailyAttnProcess.Get().Where(x => x.AttnDate >= PayrollFirstDateOfMonth && x.AttnDate <= PayrollLastDateOfMonth).ToList();
|
|||
|
|
|||
|
// if (attnProcess == null || attnProcess.Count == 0)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// foreach (SalaryMonthly sMonthly in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// DateTime joiningDate = DateTime.MinValue;
|
|||
|
// Employee oEmployee = _employees.FirstOrDefault(x => x.ID.Integer == sMonthly.EmployeeID.Integer);
|
|||
|
|
|||
|
// if (oEmployee != null)
|
|||
|
// joiningDate = oEmployee.JoiningDate;
|
|||
|
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// if (joiningDate < PayrollFirstDateOfMonth)
|
|||
|
// {
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Total_Days, (int)EnumSalaryItemCode.Total_Days, 0, "Working Days", TotalDaysInMonth);
|
|||
|
// }
|
|||
|
// else if (joiningDate > PayrollLastDateOfMonth)
|
|||
|
// {
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Total_Days, (int)EnumSalaryItemCode.Total_Days, 0, "Working Days", 0);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Total_Days, (int)EnumSalaryItemCode.Total_Days, 0, "Working Days", (PayrollLastDateOfMonth.Subtract(joiningDate).TotalDays + 1));
|
|||
|
// }
|
|||
|
// List<DailyAttnProcess> empAttnProcess = attnProcess.Where(x => x.EmployeeID.Integer == sMonthly.EmployeeID.Integer).ToList();
|
|||
|
// if (empAttnProcess != null && empAttnProcess.Count > 0)
|
|||
|
// {
|
|||
|
// if (empAttnProcess.Any(x => x.AttenType == EnumAttendanceType.Present))
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Tot_Attend_Days, (int)EnumSalaryItemCode.Tot_Attend_Days, 0, "Present Days", empAttnProcess.Where(x => x.AttenType == EnumAttendanceType.Present).Count());
|
|||
|
|
|||
|
// if (empAttnProcess.Any(x => x.AttenType == EnumAttendanceType.WeeklyHoliday || x.AttenType == EnumAttendanceType.Holiday))
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Total_HoliDays, (int)EnumSalaryItemCode.Total_HoliDays, 0, "Holidays", empAttnProcess.Where(x => x.AttenType == EnumAttendanceType.WeeklyHoliday || x.AttenType == EnumAttendanceType.Holiday).Count());
|
|||
|
|
|||
|
// //if (empAttnProcess.Any(x => x.AttenType == EnumAttendanceType.Absent))
|
|||
|
// // this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Tot_UnauthLeave_Days, 1, 0, "Absent Days", empAttnProcess.Where(x => x.AttenType == EnumAttendanceType.Absent).Count());
|
|||
|
|
|||
|
// if (empAttnProcess.Any(x => x.AttenType == EnumAttendanceType.Delay))
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Delay_Days, (int)EnumSalaryItemCode.Delay_Days, 0, "Delay Days", empAttnProcess.Where(x => x.AttenType == EnumAttendanceType.Delay).Count());
|
|||
|
|
|||
|
// }
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// private void LeaveDayProcess()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// // TermParameter ob = new TermParameter();
|
|||
|
// DateTime PayrollFirstDateOfMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate.PayrollFirstDateOfMonth();
|
|||
|
// DateTime PayrollLastDateOfMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate.PayrollLastDateOfMonth();
|
|||
|
// //int TotalDaysInMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate.TotalDaysInMonth();
|
|||
|
// List<LeaveEntry> leaveEntries = LeaveEntry.Get(PayrollFirstDateOfMonth, PayrollLastDateOfMonth, EnumLeaveStatus.Approved);
|
|||
|
// List<Leave> leaves = Leave.Get();
|
|||
|
|
|||
|
// if (leaveEntries == null || leaveEntries.Count == 0)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// foreach (SalaryMonthly sMonthly in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
|
|||
|
// var empLeaveGroup = leaveEntries.Where(x => x.EmpID == sMonthly.EmployeeID.Integer)
|
|||
|
// .GroupBy(x => x.LeaveID)
|
|||
|
// .Select(x => new { LeaveID = x.Key, Days = x.Sum(y => y.ApprovedTotalDays) }).ToList();
|
|||
|
|
|||
|
// foreach (var lEntry in empLeaveGroup)
|
|||
|
// {
|
|||
|
// Leave lv = leaves.FirstOrDefault(x => x.ID.Integer == lEntry.LeaveID.Integer);
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, lEntry.LeaveID.Integer, 0, lv != null ? lv.Code : "Unknown Leave", lEntry.Days);
|
|||
|
// }
|
|||
|
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
// private void OverTimeArrearProcess()
|
|||
|
// {
|
|||
|
// OvertimeProcess process = null;
|
|||
|
// List<OTProcess> otProcesses = null;
|
|||
|
// List<OTProcess> empOTProcesses = null;
|
|||
|
// List<Term> oTerms = Term.Get(EnumStatus.Active);
|
|||
|
// double arrAMount = 0;
|
|||
|
// List<TermParameter> termparameters = TermParameter.Get();
|
|||
|
|
|||
|
// foreach (SalaryMonthly sMonthly in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// arrAMount = 0;
|
|||
|
// if (sMonthly.WIPIncrement > 0)
|
|||
|
// {
|
|||
|
// foreach (Term oterm in oTerms)
|
|||
|
// {
|
|||
|
// arrAMount = 0;
|
|||
|
// foreach (EmployeeGradeSalary gradeSalary in sMonthly.ArrearGradeSalaries)
|
|||
|
// {
|
|||
|
// double amount = SalaryMonthly.Service.GetSumOnRangeOnRound(sMonthly.EmployeeID, PayrollPayrollGlobalFunctions.AttendanceSalaryMonth(gradeSalary.EffectDate), (DateTime)gradeSalary.TillDate,
|
|||
|
// EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Over_Time_Hours, oterm.ID.Integer, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
// //if (oterm.ID.Integer == 5)
|
|||
|
// //{
|
|||
|
// // amount = amount + SalaryMonthly.Service.GetSumOnRangeOnRound(sMonthly.EmployeeID, PayrollPayrollGlobalFunctions.AttendanceSalaryMonth(gradeSalary.EffectDate), (DateTime)gradeSalary.TillDate,
|
|||
|
// // EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
|
|||
|
// //}
|
|||
|
|
|||
|
|
|||
|
// if (amount > 0)
|
|||
|
// {
|
|||
|
// TermParameter tp = TermParameter.GetParameter(termparameters, sMonthly.Employee, oterm.ID);
|
|||
|
// if (tp != null)
|
|||
|
// {
|
|||
|
// amount = tp.Calculate(amount, sMonthly.WIPIncrement, _processMonth);
|
|||
|
// // amount = amount * ( / 208) * (200 / 100);
|
|||
|
// arrAMount = arrAMount + amount;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// if (arrAMount > 0)
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Arrear, EnumSalaryItemCode.Over_Time_Amount, oterm.ID.Integer, 0, oterm.Name, PayrollPayrollGlobalFunctions.Round(arrAMount));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
// return;
|
|||
|
// Hashtable monthList = new Hashtable();
|
|||
|
// Hashtable employeeList = new Hashtable();
|
|||
|
|
|||
|
// foreach (SalaryMonthly sMonthly in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// foreach (EmployeeGradeSalary gradeSalary in sMonthly.ArrearGradeSalaries)
|
|||
|
// {
|
|||
|
// DateTime startdate = gradeSalary.EffectDate;
|
|||
|
// while (startdate <= gradeSalary.TillDate)
|
|||
|
// {
|
|||
|
// if (monthList[PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(startdate)] == null)
|
|||
|
// {
|
|||
|
// monthList.Add(PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(startdate), PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(startdate));
|
|||
|
// }
|
|||
|
// if (employeeList[gradeSalary.EmployeeID.Integer] == null)
|
|||
|
// {
|
|||
|
// employeeList.Add(gradeSalary.EmployeeID.Integer, gradeSalary.EmployeeID.Integer);
|
|||
|
// }
|
|||
|
// startdate = PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(startdate).AddDays(1));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// otProcesses = OTProcess.GetbyOtMonth(employeeList, monthList);
|
|||
|
|
|||
|
// if (otProcesses != null && otProcesses.Count > 0)
|
|||
|
// {
|
|||
|
// process = new OvertimeProcess();
|
|||
|
// foreach (SalaryMonthly salaryMonthly in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// foreach (EmployeeGradeSalary gradeSalary in salaryMonthly.ArrearGradeSalaries)
|
|||
|
// {
|
|||
|
// empOTProcesses = otProcesses.FindAll(delegate (OTProcess prs)
|
|||
|
// {
|
|||
|
// return prs.EmployeeID == gradeSalary.EmployeeID;
|
|||
|
// });
|
|||
|
|
|||
|
// foreach (OTProcess empOTProcess in empOTProcesses)
|
|||
|
// {
|
|||
|
// if (empOTProcess.EmpOverTime == null) continue;
|
|||
|
// OTProcess prs = process.ProcessArrear(empOTProcess, salaryMonthly.ThisMonthBasic); //
|
|||
|
// SalaryMonthlyDetail basic = salaryMonthly.Details.Find(delegate (SalaryMonthlyDetail detail)
|
|||
|
// {
|
|||
|
// return (detail.ItemCode == EnumSalaryItemCode.Over_Time_Amount
|
|||
|
// && detail.itemGroupCode == EnumSalaryGroup.Gross && detail.ItemID == empOTProcess.TermID.Integer);
|
|||
|
// });
|
|||
|
// if (basic == null)
|
|||
|
// this.AddDetail(salaryMonthly, EnumSalaryGroup.Gross, EnumSalaryItemCode.Over_Time_Amount,
|
|||
|
// empOTProcess.TermID.Integer, empOTProcess.TermParameterID.Integer, empOTProcess.TermObj.Name, 0);
|
|||
|
|
|||
|
// SalaryMonthlyDetail arrearItem = salaryMonthly.Details.Find(delegate (SalaryMonthlyDetail detail)
|
|||
|
// {
|
|||
|
// return (detail.ItemCode == EnumSalaryItemCode.Over_Time_Amount
|
|||
|
// && detail.itemGroupCode == EnumSalaryGroup.Arrear && detail.ItemID == empOTProcess.TermID.Integer);
|
|||
|
// });
|
|||
|
// if (arrearItem == null)
|
|||
|
// this.AddDetail(salaryMonthly, EnumSalaryGroup.Arrear, EnumSalaryItemCode.Over_Time_Amount,
|
|||
|
// empOTProcess.TermID.Integer, empOTProcess.TermParameterID.Integer, empOTProcess.TermObj.Name, PayrollPayrollGlobalFunctions.Round(prs.Amount));
|
|||
|
// else
|
|||
|
// {
|
|||
|
// arrearItem.CalculatedAmount = arrearItem.CalculatedAmount + PayrollPayrollGlobalFunctions.Round(prs.Amount);
|
|||
|
// arrearItem.ChangedAmount = arrearItem.ChangedAmount + PayrollPayrollGlobalFunctions.Round(prs.Amount);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// private void CalculateBonus()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// DateTime dSalaryMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
// _bonusdetails = BonusProcess.GetBonusDetails(dSalaryMonth, true);
|
|||
|
// if (_bonusdetails == null || _bonusdetails.Count == 0) return;
|
|||
|
// List<Bonus> bonuses = Bonus.Get(EnumStatus.Regardless);
|
|||
|
|
|||
|
// foreach (BonusProcess.BonusProcessDetail bonusdt in _bonusdetails)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// SalaryMonthly sMonthly = _salaryMonthlys.Find(delegate (SalaryMonthly monthly) { return monthly.EmployeeID.Integer == bonusdt.EmployeeID.Integer; });
|
|||
|
// if (sMonthly != null)
|
|||
|
// {
|
|||
|
// Bonus ob = bonuses.GetItem(bonusdt.BonusID);
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Gross, EnumSalaryItemCode.Bonus, bonusdt.BonusID.Integer, bonusdt.BonusProcessID.Integer, ob.Name, PayrollPayrollGlobalFunctions.Round(bonusdt.NetBonusAmount));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
// private void LoanProcess()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// // DateTime dSalaryMonth = SystemInformation.CurrentSysInfo.NextPayProcessDate;
|
|||
|
// // List<LoanIssue> loanIssues = LoanIssue.Service.Get(dSalaryMonth);
|
|||
|
// // if (loanIssues == null || loanIssues.Count == 0)
|
|||
|
// // {
|
|||
|
// // UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
// // return;
|
|||
|
// // }
|
|||
|
|
|||
|
// // double nClosing = 0.0;
|
|||
|
// //// bool withInerest = ConfigurationManager.GetBoolValue("loan", "combineinterestinsalary", EnumConfigurationType.Logic);
|
|||
|
|
|||
|
// // //List<LoanSchedule> oLoanScheduls = new List<LoanSchedule>();
|
|||
|
// // //oLoanScheduls = LoanSchedule.Get();
|
|||
|
|
|||
|
// // List<LoanSchedule> oschedules = LoanSchedule.Service.GetUnpaidSechedule(_processMonth);
|
|||
|
|
|||
|
// // foreach (LoanSchedule issue in oschedules)
|
|||
|
// // {
|
|||
|
// // UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// // SalaryMonthly sMonthly = _salaryMonthlys.Find(delegate(SalaryMonthly monthly) { return monthly.EmployeeID.Integer == issue.EmployeeID.Integer; });
|
|||
|
// // if (sMonthly != null)
|
|||
|
// // {
|
|||
|
// // sMonthly.CalculateTotal();
|
|||
|
// //// List<LoanSchedule> oschedules = issue.Schedules; issue.MonthlySchedules(dSalaryMonth);
|
|||
|
// // //if (oschedules == null) continue;
|
|||
|
// // //foreach (LoanSchedule schedule in oschedules)
|
|||
|
// // //{
|
|||
|
// //// nClosing = schedule.ClosingBalance;
|
|||
|
// // this.AddDetail(sMonthly, EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Installment, issue.LoanIssueID.Integer, schedule.ID.Integer, issue.LoanObj.Name, PayrollPayrollGlobalFunctions.Round(schedule.InstallmentPrincipal));
|
|||
|
// // this.AddDetail(sMonthly, EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Interest, issue.LoanID.Integer, schedule.ID.Integer, issue.LoanObj.Name + " interest", PayrollPayrollGlobalFunctions.Round(schedule.InstallmentInterest));
|
|||
|
// // //}
|
|||
|
// // this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Loan_Remain_Balance, issue.LoanID.Integer, issue.ID.Integer, issue.LoanObj.Name + " balance", PayrollPayrollGlobalFunctions.Round(nClosing));
|
|||
|
// // }
|
|||
|
// // }
|
|||
|
|
|||
|
// DataSet oDataSet = LoanSchedule.Service.GetScheduleForSalary(_processMonth, SystemInformation.CurrentSysInfo.PayrollTypeID.Integer);
|
|||
|
// if (oDataSet == null || oDataSet.Tables[0] == null || oDataSet.Tables[0].Rows.Count == 0)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// foreach (DataRow oRow in oDataSet.Tables[0].Rows)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// SalaryMonthly sMonthly = _salaryMonthlys.Find(delegate (SalaryMonthly monthly) { return monthly.EmployeeID.Integer.ToString() == oRow["EMPLOYEEID"].ToString(); });
|
|||
|
// if (sMonthly != null)
|
|||
|
// {
|
|||
|
// sMonthly.CalculateTotal();
|
|||
|
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Installment, Convert.ToInt32(oRow["LOANID"].ToString()), Convert.ToInt32(oRow["LOANSCHEDULEID"].ToString()), oRow["DESCRIPTION"].ToString() + " Principle", PayrollPayrollGlobalFunctions.Round(Convert.ToDouble(oRow["InstallmentPrincipal"].ToString())));
|
|||
|
// this.AddDetail(sMonthly, EnumSalaryGroup.Deductions, EnumSalaryItemCode.Loan_Monthly_Interest, Convert.ToInt32(oRow["LOANID"].ToString()), Convert.ToInt32(oRow["LOANSCHEDULEID"].ToString()), oRow["DESCRIPTION"].ToString() + " Interest", PayrollPayrollGlobalFunctions.Round(Convert.ToDouble(oRow["InstallmentInterest"].ToString())));
|
|||
|
// // this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Loan_Remain_Balance, Convert.ToInt32(oRow["LOANID"].ToString()), Convert.ToInt32(oRow["LOANSCHEDULEID"].ToString()), oRow["DESCRIPTION"].ToString(), PayrollPayrollGlobalFunctions.Round(Convert.ToDouble(oRow["REMAININGAMOUNT"].ToString())));
|
|||
|
// // this.AddDetail(sMonthly, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Loan_Remain_Interest, Convert.ToInt32(oRow["LOANID"].ToString()), Convert.ToInt32(oRow["LOANSCHEDULEID"].ToString()), oRow["DESCRIPTION"].ToString(), PayrollPayrollGlobalFunctions.Round(Convert.ToDouble(oRow["REMAINININTEREST"].ToString())));
|
|||
|
|
|||
|
// }
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
// private void Tax()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// TaxCalculator taxCalculator = new TaxCalculator();
|
|||
|
// taxCalculator.AdParameters = _adParameters;
|
|||
|
// bool bfixedAmount = ConfigurationManager.GetBoolValue("incometax", "fixedamount", EnumConfigurationType.Logic);
|
|||
|
|
|||
|
// bool isOtherItem = ConfigurationManager.GetBoolValue("incometax", "taxissalaryotheritem", EnumConfigurationType.Logic);
|
|||
|
// EnumSalaryGroup ngroupCode = EnumSalaryGroup.Deductions;
|
|||
|
// if (isOtherItem == true) ngroupCode = EnumSalaryGroup.OtherItem;
|
|||
|
// taxCalculator.TaxParameter = TaxParameter.Get(SystemInformation.CurrentSysInfo.TaxParamID);
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// salary.Incometaxes = new List<IncomeTax>();
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
|
|||
|
// if (bfixedAmount == false)
|
|||
|
// {
|
|||
|
// if (salary.Employee.IsShownInTaxSheet == true) // Consaltant Tax
|
|||
|
// {
|
|||
|
// double contax = salary.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross).Sum(x => x.ChangedAmount);
|
|||
|
// contax = contax + salary.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear).Sum(x => x.ChangedAmount);
|
|||
|
// this.AddDetail(salary, ngroupCode, EnumSalaryItemCode.Inc_Tax_Deduction,
|
|||
|
// (int)EnumSalaryItemCode.Inc_Tax_Deduction, 0,
|
|||
|
// string.Empty, PayrollPayrollGlobalFunctions.Round(contax * .1));
|
|||
|
// continue;
|
|||
|
// }
|
|||
|
|
|||
|
// taxCalculator.Salary = salary;
|
|||
|
// taxCalculator.Employee = salary.Employee;
|
|||
|
// taxCalculator.AllowanceDeductions = _allowdeducitons;
|
|||
|
// taxCalculator.CurrentYearTax = null;
|
|||
|
// taxCalculator.PaidBonues = _bonusdetails;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// salary.Incometaxes = taxCalculator.SalaryTax();
|
|||
|
// }
|
|||
|
// catch (ServiceException sx)
|
|||
|
// {
|
|||
|
// this.AddProcessStatus(salary.Employee, sx.Message);
|
|||
|
// continue;
|
|||
|
// }
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// this.AddProcessStatus(salary.Employee, ex.Message);
|
|||
|
// continue;
|
|||
|
// }
|
|||
|
// #region Include tax in salary
|
|||
|
// IncomeTax taxItem = IncomeTax.Get(salary.Incometaxes, salary.EmployeeID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
|||
|
// (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
|||
|
|
|||
|
// if (taxItem != null)
|
|||
|
// {
|
|||
|
// if (taxItem.ThisMonthAmount < 0)
|
|||
|
// {
|
|||
|
// this.AddDetail(salary, ngroupCode, EnumSalaryItemCode.Inc_Tax_Deduction,
|
|||
|
// (int)EnumSalaryItemCode.Inc_Tax_Deduction, 0,
|
|||
|
// string.Empty, PayrollPayrollGlobalFunctions.Round(0));
|
|||
|
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// if (salary.Employee.ForeignExPat == false)
|
|||
|
// {
|
|||
|
// SalaryMonthly oprvsalry = _PrvMonthsalary.Find(delegate (SalaryMonthly param) { return param.EmployeeID.Integer == salary.EmployeeID.Integer; });
|
|||
|
// if (oprvsalry != null)
|
|||
|
// {
|
|||
|
// SalaryMonthlyDetail odtl = oprvsalry.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Inc_Tax_Deduction && detail.itemGroupCode == EnumSalaryGroup.Deductions); });
|
|||
|
// if (odtl != null)
|
|||
|
// {
|
|||
|
// if (Math.Abs(taxItem.ThisMonthAmount - odtl.ChangedAmount) <= 50)
|
|||
|
// taxItem.ThisMonthAmount = odtl.ChangedAmount;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// this.AddDetail(salary, ngroupCode, EnumSalaryItemCode.Inc_Tax_Deduction,
|
|||
|
// (int)EnumSalaryItemCode.Inc_Tax_Deduction, 0,
|
|||
|
// string.Empty, PayrollPayrollGlobalFunctions.Round(taxItem.ThisMonthAmount));
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// taxItem.ThisMonthAmount = salary.Employee.TaxAmount;
|
|||
|
// this.AddDetail(salary, ngroupCode, EnumSalaryItemCode.Inc_Tax_Deduction,
|
|||
|
// (int)EnumSalaryItemCode.Inc_Tax_Deduction, 0,
|
|||
|
// string.Empty, PayrollPayrollGlobalFunctions.Round(salary.Employee.TaxAmount));
|
|||
|
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// #endregion Include tax in salary
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// if (salary.Employee.TaxAmount > 0)
|
|||
|
// {
|
|||
|
// this.AddDetail(salary, ngroupCode, EnumSalaryItemCode.Inc_Tax_Deduction,
|
|||
|
// (int)EnumSalaryItemCode.Inc_Tax_Deduction, 0,
|
|||
|
// string.Empty, PayrollPayrollGlobalFunctions.Round(salary.Employee.TaxAmount));
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
// private void UnAuthorizeLeave()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// List<UnAuthorizeLeaveParam> UnLeaves = UnAuthorizeLeaveParam.Get();
|
|||
|
// List<EmployeeUnAuthorizeLeave> empUnLeaves = EmployeeUnAuthorizeLeave.Get(EnumLeaveEntryType.Normal, _processMonth);
|
|||
|
|
|||
|
// //DataSet DocAndZleave = DailyAttnProcess.Service.GetZandDocLeaveDays(GlobalExtensions.PayrollFirstDateOfMonth(_processMonth), _processMonth);
|
|||
|
|
|||
|
// //if (DocAndZleave != null && DocAndZleave.Tables[0] != null && DocAndZleave.Tables[0].Rows.Count > 0)
|
|||
|
// //{
|
|||
|
// // foreach (DataRow oRow in DocAndZleave.Tables[0].Rows)
|
|||
|
// // {
|
|||
|
// // EmployeeUnAuthorizeLeave uleave = new EmployeeUnAuthorizeLeave();
|
|||
|
// // uleave.LeaveDays = Convert.ToInt32(oRow["TOTAL"].ToString());
|
|||
|
// // uleave.EmployeeID = ( Convert.ToInt32(oRow["EMPLOYEEID"].ToString()));
|
|||
|
// // uleave.UnAuthorizeleaveID = ( Convert.ToInt32(oRow["REFERENCEID"].ToString()));
|
|||
|
// // uleave.ParamID = (Convert.ToInt32(oRow["REFERENCEID"].ToString()));
|
|||
|
|
|||
|
// // empUnLeaves.Add(uleave);
|
|||
|
// // }
|
|||
|
// //}
|
|||
|
// DateTime fromDate = _processMonth;
|
|||
|
// fromDate = fromDate.AddMonths(-1);
|
|||
|
// fromDate = new DateTime(fromDate.Year, fromDate.Month, 26);
|
|||
|
// DateTime toDate = _processMonth;
|
|||
|
// toDate = new DateTime(toDate.Year, toDate.Month, 25);
|
|||
|
// DataSet absentDSet = DailyAttnProcess.Service.GetTotalAbsentDays(fromDate, toDate);
|
|||
|
// List<UnAuthorizeLeaveParam> unAuthorizeLeaveParams = UnAuthorizeLeaveParam.Get();
|
|||
|
// UnAuthorizeLeaveParam unAuthorizeLeaveParamGross = unAuthorizeLeaveParams.Where(o => o.UnAuthorizeLeave.Code.Trim() == "001").FirstOrDefault();
|
|||
|
// UnAuthorizeLeaveParam unAuthorizeLeaveParamBasic = unAuthorizeLeaveParams.Where(o => o.UnAuthorizeLeave.Code.Trim() == "002").FirstOrDefault();
|
|||
|
// double totalDaysOfMonth = Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", fromDate, toDate) + 1; // toDate.Subtract(fromDate).TotalDays;
|
|||
|
|
|||
|
// if (absentDSet != null && absentDSet.Tables[0].Rows.Count > 0)
|
|||
|
// {
|
|||
|
// foreach (DataRow dor in absentDSet.Tables[0].Rows)
|
|||
|
// {
|
|||
|
// EmployeeUnAuthorizeLeave uleave = new EmployeeUnAuthorizeLeave();
|
|||
|
// uleave.LeaveDays = Convert.ToInt32(dor["TOTAL"].ToString());
|
|||
|
// uleave.EmployeeID = (Convert.ToInt32(dor["EMPLOYEEID"].ToString()));
|
|||
|
// uleave.LeaveMonth = _processMonth;
|
|||
|
// uleave.MonthDate = _processMonth;
|
|||
|
// uleave.UnAuthorizeleaveID = unAuthorizeLeaveParamGross.UnAhuthorizeLeaveID;
|
|||
|
// uleave.ParamID = unAuthorizeLeaveParamGross.ID;
|
|||
|
// empUnLeaves.Add(uleave);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// if (empUnLeaves == null || empUnLeaves.Count == 0)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
// return;
|
|||
|
// }
|
|||
|
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
|
|||
|
// #region Unauthorize leave monthly calculation
|
|||
|
// List<EmployeeUnAuthorizeLeave> empLeaves = empUnLeaves.FindAll(delegate (EmployeeUnAuthorizeLeave empLeave) { return empLeave.EmployeeID.Integer == salary.EmployeeID.Integer; });
|
|||
|
// SalaryMonthlyDetail salaryDetail = null;
|
|||
|
// double nAmount = 0;
|
|||
|
|
|||
|
// foreach (EmployeeUnAuthorizeLeave leave in empLeaves)
|
|||
|
// {
|
|||
|
// leave.Param = UnLeaves.Find(delegate (UnAuthorizeLeaveParam param) { return param.int == leave.ParamID; });
|
|||
|
// if (leave.Param == null)
|
|||
|
// {
|
|||
|
// ProcessStatus("Unauthorize leave parameter not found");
|
|||
|
// continue;
|
|||
|
// }
|
|||
|
// foreach (UnAuthorizeLeaveParamDetail detail in leave.Param.Details)
|
|||
|
// {
|
|||
|
// salaryDetail = salary.Details.Find(delegate (SalaryMonthlyDetail dtl)
|
|||
|
// {
|
|||
|
// return IsExists(dtl, detail);
|
|||
|
// });
|
|||
|
// if (salaryDetail == null) continue;
|
|||
|
// if (leave.LeaveMonth == _processMonth)
|
|||
|
// {
|
|||
|
// if (salaryDetail != null)
|
|||
|
// {
|
|||
|
// nAmount = salaryDetail.CalculatedAmount;
|
|||
|
// if (salary.Employee.JoiningDate > PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(_processMonth))
|
|||
|
// {
|
|||
|
// double ndays;
|
|||
|
// ndays = Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", salary.Employee.JoiningDate, _processMonth) + 1;
|
|||
|
// nAmount = nAmount / ndays;
|
|||
|
// nAmount = nAmount * _processMonth.Day;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// nAmount = salary.GetAmountOnRange(salary.Employee, PayrollPayrollGlobalFunctions.PayrollFirstDateOfMonth(leave.LeaveMonth),
|
|||
|
// PayrollPayrollGlobalFunctions.PayrollLastDateOfMonth(leave.LeaveMonth), EnumSalaryGroup.Gross,
|
|||
|
// EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary);
|
|||
|
// }
|
|||
|
|
|||
|
// //nAmount = PayrollPayrollGlobalFunctions.ConevrtToDlyRateofMonth(nAmount, _processMonth) * leave.LeaveDays;
|
|||
|
// //not 26 it will be Number of days from 26 to 25
|
|||
|
// nAmount = (nAmount / totalDaysOfMonth) * leave.LeaveDays;
|
|||
|
// nAmount = nAmount * (detail.ValueInPercent / 100);
|
|||
|
// //nAmount = PayrollPayrollGlobalFunctions.Round(nAmount);
|
|||
|
// nAmount = Math.Round(nAmount, 2);
|
|||
|
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.UnauthLeave,
|
|||
|
// detail.Type == EnumSalaryComponent.Basic ? EnumSalaryItemCode.Basic_Salary : EnumSalaryItemCode.Allowance,
|
|||
|
// detail.Type == EnumSalaryComponent.Basic ? (int)EnumSalaryItemCode.Basic_Salary : detail.AllowanceID.Integer,
|
|||
|
// salaryDetail.SupportID.Integer, salaryDetail.Description, Math.Round(nAmount, 2));
|
|||
|
|
|||
|
// }
|
|||
|
// this.AddDetail(salary, EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Tot_UnauthLeave_Days, leave.Param.UnAhuthorizeLeaveID.Integer, 0, "UnAuthorized Leave Days", leave.LeaveDays);
|
|||
|
// }
|
|||
|
// #endregion
|
|||
|
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
// private bool IsExists(SalaryMonthlyDetail dtl, UnAuthorizeLeaveParamDetail detail)
|
|||
|
// {
|
|||
|
// switch (detail.Type)
|
|||
|
// {
|
|||
|
// case EnumSalaryComponent.Basic:
|
|||
|
// return dtl.ItemCode == EnumSalaryItemCode.Basic_Salary && dtl.itemGroupCode == EnumSalaryGroup.Gross;
|
|||
|
// case EnumSalaryComponent.Allowance:
|
|||
|
// return (dtl.ItemCode == EnumSalaryItemCode.Allowance && dtl.itemGroupCode == EnumSalaryGroup.Gross
|
|||
|
// && dtl.ItemID == detail.AllowanceID.Integer);
|
|||
|
// default: return false;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// private void PrepareCostcenterData()
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.Start);
|
|||
|
|
|||
|
// List<EmployeeCostCenter> empCostCenters = EmployeeCostCenter.Get();
|
|||
|
// foreach (SalaryMonthly salary in _salaryMonthlys)
|
|||
|
// {
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.PerformStep);
|
|||
|
// List<EmployeeCostCenter> empinvolments = EmployeeCostCenter.Get(empCostCenters, salary.EmployeeID);
|
|||
|
// if (empCostCenters == null) continue;
|
|||
|
|
|||
|
// salary.CostCentersInvolments = new List<SalaryEmpCostCenter>();
|
|||
|
// if (empinvolments != null)
|
|||
|
// {
|
|||
|
// foreach (EmployeeCostCenter item in empinvolments)
|
|||
|
// {
|
|||
|
// SalaryEmpCostCenter Semp = new SalaryEmpCostCenter();
|
|||
|
// Semp.CostCenterID = item.CostCenterID;
|
|||
|
// Semp.Percentage = item.Percentage;
|
|||
|
// Semp.EmployeeID = salary.EmployeeID;
|
|||
|
// salary.CostCentersInvolments.Add(Semp);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// UpdateProgressStatus(EnumProcessStatus.End);
|
|||
|
|
|||
|
// }
|
|||
|
//}
|
|||
|
//public class SalaryProcessStatus
|
|||
|
//{
|
|||
|
// public SalaryProcessStatus()
|
|||
|
// {
|
|||
|
// _employeeNo = "";
|
|||
|
// _name = "";
|
|||
|
// _remarks = "";
|
|||
|
// }
|
|||
|
// public SalaryProcessStatus(string empCode, string name, string remarks)
|
|||
|
// {
|
|||
|
// _employeeNo = empCode;
|
|||
|
// _name = name;
|
|||
|
// _remarks = remarks;
|
|||
|
// }
|
|||
|
// #region EmployeeNo : Employee No
|
|||
|
|
|||
|
// private string _employeeNo;
|
|||
|
// public string EmployeeNo
|
|||
|
// {
|
|||
|
// get { return _employeeNo; }
|
|||
|
// set
|
|||
|
// {
|
|||
|
// _employeeNo = value;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// #region Employee Name : Employee Name
|
|||
|
|
|||
|
// private string _name;
|
|||
|
// public string Name
|
|||
|
// {
|
|||
|
// get { return _name; }
|
|||
|
// set
|
|||
|
// {
|
|||
|
// _name = value;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
// #region remaks : remarks
|
|||
|
|
|||
|
// private string _remarks;
|
|||
|
// public string Remarks
|
|||
|
// {
|
|||
|
// get { return _remarks; }
|
|||
|
// set
|
|||
|
// {
|
|||
|
// _remarks = value;
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// #endregion
|
|||
|
|
|||
|
//}
|
|||
|
}
|