//using Ease.Core.Model; //using System; //using System.Collections.Generic; //using System.Data; //namespace HRM.BO //{ // public delegate void ProcessStatus1(string processStatus); // //public delegate void ProgressStatus1(EnumProcessStatus status); // public delegate void ErrorMessage1(String error); // public class BonusCalculator // { // //public event ProcessStatus1 ProcessStatus; // //public event ProgressStatus1 ProgressStatus; // public BonusCalculator() // { // } // //public List ErrorList // //{ // // get // // { // // return _processStatuses; // // } // //} // //private void UpdateprocessStatus(string statusString) // //{ // // if (ProcessStatus != null) ProcessStatus(statusString); // //} // //private void UpdateProgressStatus(EnumProcessStatus status) // //{ // // if (ProgressStatus != null) ProgressStatus(status); // //} // public void BCalculate(List oEmployees,int BonusID,DateTime payDate) // { // } // public double ConvertToDailyRate(double nBasic, DateTime dMonthDate) // { // double amount = 0; // amount = nBasic / Convert.ToDouble(DateTime.DaysInMonth(dMonthDate.Year, dMonthDate.Month)); // return amount; // } // public double GeneralAmount(Employee oEmp, BonusParameter oBParameter, DateTime SalaryMonthDate) // { // double nTotalBonus = 0.0; // nTotalBonus = oBParameter.FlatAmount + (oEmp.GrossSalary * oBParameter.NoOfGross) + (oEmp.BasicSalary * oBParameter.NoOfBasic) + (oEmp.GrossSalary * oBParameter.PercentOfGross / 100) + (oEmp.BasicSalary * oBParameter.NoOfEarnedBasic); // // nTotalBonus = nTotalBonus + ConvertToDailyRate(oEmp.BasicSalary, SalaryMonthDate) * oBParameter.NoOfDays + ConvertToDailyRate(oEmp.GrossSalary, SalaryMonthDate) * oBParameter.GrossOfDays; // return nTotalBonus; // } // public double GeneralAmount(Employee oEmp,BonusParameter oBParameter, double basicSalary, double GrossSalary ) // { // double nTotalBonus = 0.0; // nTotalBonus = oBParameter.FlatAmount +(GrossSalary *oBParameter.NoOfGross) + (basicSalary * oBParameter.NoOfBasic) + (GrossSalary * oBParameter.PercentOfGross / 100) + (basicSalary * oBParameter.NoOfEarnedBasic); // // nTotalBonus = nTotalBonus + ConvertToDailyRate(oEmp.BasicSalary, SalaryMonthDate) * oBParameter.NoOfDays + ConvertToDailyRate(oEmp.GrossSalary, SalaryMonthDate) * oBParameter.GrossOfDays; // return nTotalBonus; // } // /// // /// // /// /// // /// // /// // /// // /// // //public double CaculatedSalaryComponentAmount(BonusParameter parameter,Employee oEmp) // //{ // // List _SalaryComponents = SalaryComponent.Benefits(); // // double nAmount = 0; // // int nProjectedMonth=0; // // if (SalaryMonthly.IsSalaryProcessed(oEmp.ID, SystemInformation.CurrentSysInfo.NextPayProcessDate)) // // { // // nProjectedMonth = Ease.Core.Utility.Global.DateFunctions.DateDiff("m", SystemInformation.CurrentSysInfo.NextPayProcessDate, // // Ease.Core.Utility.Global.DateFunctions.LastDateOfYear(SystemInformation.CurrentSysInfo.NextPayProcessDate)); // // } // // else // // { // // nProjectedMonth = Ease.Core.Utility.Global.DateFunctions.DateDiff("m", SystemInformation.CurrentSysInfo.NextPayProcessDate, // // Ease.Core.Utility.Global.DateFunctions.LastDateOfYear(SystemInformation.CurrentSysInfo.NextPayProcessDate)) + 1; // // } // // //SalaryMonthly.IsSalaryProcessed(); // // double nTotalAmount = 0; // // foreach (BonusParameter.BonusParamSalaryItem oSComponent in parameter.BonusParamSalaryItems) // // { // // SalaryMonthly osalary = new SalaryMonthly(); // // nAmount = osalary.GetAmountOnRange(oEmp, new DateTime(SystemInformation.CurrentSysInfo.NextPayProcessDate.Year, 1, 1), SystemInformation.CurrentSysInfo.NextPayProcessDate, // // EnumSalaryGroup.Gross, (EnumSalaryItemCode)oSComponent.SalaryGroupCode, oSComponent.AllowDeductID, parameter.ID.Integer); // // if (nProjectedMonth > 1) // // nAmount = nAmount + (nProjectedMonth * oEmp.BasicSalary); // // if(oSComponent.Percent>0) // // nAmount = (nAmount * oSComponent.Percent) / 100; // // nTotalAmount = nTotalAmount + nAmount; // // } // // return nTotalAmount; // //} // public double CalculateOverTheYearAmount(BonusParameter oBonusParameter, Employee oEmp,DateTime dPayDate,double TotalBonusAmount) // { // double BonusOvertheAmount = 0.0; // DateTime JoiningDate = oEmp.JoiningDate; // DateTime CompareDate=DateTime.Now; // DateTime FirstDateofYear= Ease.Core.Utility.Global.DateFunctions.FirstDateOfYear(dPayDate); // DateTime LastDateofYear = Ease.Core.Utility.Global.DateFunctions.LastDateOfYear(dPayDate); // if(oEmp.JoiningDate<=FirstDateofYear) // { // CompareDate = FirstDateofYear; // } // if(CompareDate<=FirstDateofYear) // { // BonusOvertheAmount = TotalBonusAmount; // } // else if(JoiningDate>FirstDateofYear) // { // int nDays = (LastDateofYear - JoiningDate).Days + 1; // BonusOvertheAmount = (TotalBonusAmount * nDays) / 365; // } // return BonusOvertheAmount; // } // public double CalculateOverTheYearAmountForWartsila(BonusParameter oBonusParameter, Employee oEmp, DateTime cutOffDate, double TotalBonusAmount) // { // double BonusOvertheAmount = 0.0; // TimeSpan ts = cutOffDate.Subtract(oEmp.JoiningDate); // int tdays = ts.Days + 1; // if (tdays >= 180 && tdays <= 364) // { // BonusOvertheAmount = (TotalBonusAmount * tdays) / 365; // } // else if (tdays >= 365) // { // BonusOvertheAmount = TotalBonusAmount; // } // //if (oEmp.JoiningDate > FirstDateofYear) // //{ // // int nDays = (LastDateofYear - JoiningDate).Days + 1; // // BonusOvertheAmount = (TotalBonusAmount * nDays) / 365; // //} // return BonusOvertheAmount; // } // public double CaculatedProratedCutOffAmount(BonusParameter oBonusParameter, Employee oEmp, double TotalBonusAmount, DateTime dCuttOffDate) // { // double BonusProAmount = 0.0; // DateTime JoiningDate = oEmp.JoiningDate; // DateTime CompareDate = DateTime.Now; // //DateTime FirstDateofYear = Ease.Core.Utility.Global.DateFunctions.FirstDateOfYear(dCuttOffDate); // //DateTime LastDateofYear = Ease.Core.Utility.Global.DateFunctions.LastDateOfYear(dCuttOffDate); // //if (JoiningDate <= FirstDateofYear) // //{ // // CompareDate = FirstDateofYear; // //} // //else if (JoiningDate > FirstDateofYear) // //{ // // CompareDate = JoiningDate; // //} // //BonusProAmount = TotalBonusAmount * ((dCuttOffDate - CompareDate).Days + 1) / ((dCuttOffDate - FirstDateofYear).Days + 1); // TimeSpan dd = dCuttOffDate.AddDays(1)-JoiningDate ; // if (dd.Days >= 365) // { // BonusProAmount = TotalBonusAmount; // } // else // { // BonusProAmount = TotalBonusAmount / 365 * dd.Days; // } // return BonusProAmount; // } // public double CaculatedProratedAmount(BonusParameter oBonusParameter, Employee oEmp, double TotalBonusAmount, DateTime dCuttOffDate) // { // double BonusProAmount = 0.0; // DateTime JoiningDate = oEmp.JoiningDate; // DateTime CompareDate = DateTime.Now; // DateTime FirstDateofYear = Ease.Core.Utility.Global.DateFunctions.FirstDateOfYear(dCuttOffDate); // DateTime LastDateofYear = Ease.Core.Utility.Global.DateFunctions.LastDateOfYear(dCuttOffDate); // if (oEmp.JoiningDate <= FirstDateofYear) // { // CompareDate = FirstDateofYear; // } // if (CompareDate <= FirstDateofYear) // { // BonusProAmount = TotalBonusAmount; // } // else if (JoiningDate > FirstDateofYear) // { // int nDays = (LastDateofYear - JoiningDate).Days + 1; // BonusProAmount = (TotalBonusAmount * nDays) / 365; // } // return BonusProAmount; // } // public double CaculatedServiceLengthAmount(BonusParameter oBonusParameter,Employee oEmp,double TotalBonusAmount,DateTime dCuttOffDate) // { // DateTime toDate = DateTime.Now; // DateTime joiningDate = oEmp.JoiningDate; // double BonusSLengthAmount = 0.0; // int ServiceLength = 0; // int Counter = 0; // // if paramter applicable cutt of date, other wise deduct from last date of year. // Counter = (dCuttOffDate - joiningDate).Days + 1; // if (oBonusParameter.BonusServiceLengths != null) // { // for (int i = oBonusParameter.BonusServiceLengths.Count; i >=1 ; i--) // { //// ServiceLength = oBonusParameter.BonusServiceLengths[i-1].LengthOfService; // if (oBonusParameter.BonusServiceLengths[i-1].LengthOfService < Counter) // { // ServiceLength = oBonusParameter.BonusServiceLengths[i - 1].EntitlePercent; // break; // } // } // BonusSLengthAmount = (TotalBonusAmount * ServiceLength)/100; // } // return BonusSLengthAmount; // } // //public double CalculationSlabOnBasic(BonusParameter oBonusParameter, Employee oEmp, double basicSalary) // //{ // // double BonusDearnessAmount=0.0; // // if (oBonusParameter.BonusSlabs != null) // // { // // for (int i = oBonusParameter.BonusSlabs.Count; i >= 1; i--) // // { // // if (oBonusParameter.BonusSlabs[i - 1].SlabAmount < basicSalary) // // { // // if(oBonusParameter.BonusSlabs[i - 1].AmountType==EnumSlabAmountType.ActualBasic) // // { // // BonusDearnessAmount = basicSalary; // // break; // // } // // else if (oBonusParameter.BonusSlabs[i - 1].AmountType == EnumSlabAmountType.FlatAmount) // // { // // BonusDearnessAmount = oBonusParameter.BonusSlabs[i - 1].Amount; // // break; // // } // // } // // } // // } // // return BonusDearnessAmount; // //} // ////public double CalculationCasualBonusAmount(BonusParameter oBonusParameter, Employee oEmp, double basicSalary) // ////{ // //// double BonusCasualAmount = 0.0; // //// List oEmpLStatuses = EmpLeaveStatus.EmpCurrentYearStatus(oEmp); // //// double nCLeave = 0; // //// //foreach(EmpLeaveStatus oEmpLStatus in oEmpLStatuses) // //// //{ // //// // if(oEmpLStatus.LeaveId==5) // //// // { // //// // nCLeave = oEmpLStatus.LeaveAvailed; // //// // } // //// //} // //// if (oBonusParameter.BonusSlabs != null) // //// { // //// for (int i = oBonusParameter.BonusSlabs.Count; i >= 1; i--) // //// { // //// if (oBonusParameter.BonusSlabs[i - 1].SlabAmount < nCLeave) // //// { // //// if (oBonusParameter.BonusSlabs[i - 1].AmountType == EnumSlabAmountType.Percentage) // //// { // //// BonusCasualAmount = basicSalary * (oBonusParameter.BonusSlabs[i - 1].Amount / 100);//oBonusParameter.BonusSlabs[i - 1].Amount; // //// break; // //// } // //// } // //// } // //// } // //// return BonusCasualAmount; // ////} // ////public double CaculatedBonusAdjustAmount(BonusParameter.BonusParamAdjustItem oBonusPAdjustAmount) // ////{ // //// double BonusAdjustAmount = 0.0; // //// if (oBonusParameter.BonusParamAdjustItems != null) // //// { // //// foreach (BonusParameter.BonusParamAdjustItem oBAdjustAmount in oBonusParameter.BonusParamAdjustItems) // //// { // //// BonusAdjustAmount += oBAdjustAmount.Amount; // //// } // //// } // //// return BonusAdjustAmount; // ////} // public double CalcluateBonus(BonusParameter param, Employee oemployee, // double basicSalary, double GrossSalary, DateTime dCuttOfDate) // { // double BonusGeneralAmount=0; // double TotalAmount=0; // double BonusAdjustAmount=0; // double BonusSalaryItemAmount=0; // double BonusDearnessAmount=0; // double BonusCasualAmount=0; // #region calculate adjust Item // //if (oBonusParm.BonusParamSalaryItems != null && oBonusParm.BonusParamSalaryItems.Count > 0) // // BonusSalaryItemAmount = this.CaculatedSalaryComponentAmount(oBonusParm, oEmp); // //foreach (BonusParameter.BonusParamAdjustItem oBPAdjustItem in oBonusParm.BonusParamAdjustItems) // //{ // // BonusProcess.BonusProcessDetail.BonusProcessAdjustItem oBPAItem = new BonusProcess.BonusProcessDetail.BonusProcessAdjustItem(); // // BonusAdjustAmount += oBPAdjustItem.Amount; // // oBPAItem.AdjustAmount = oBPAdjustItem.Amount; // // oBPAItem.BonusAdjustID = oBPAdjustItem.BonusAdjustItemID; // // oBPDetail.BonusProcessAdjustItems.Add(oBPAItem); // //} // #endregion calculate adjust Item // BonusGeneralAmount = this.GeneralAmount(oemployee, param, basicSalary, GrossSalary); // //##### // bool bjoiningproporate = true; //ConfigurationManager.GetBoolValue("bonus", "joiningprorate", EnumConfigurationType.Logic); // #region calculate Slab Amount // //if (oBonusParm.BonusSlabs.Count > 0) // //{ // // if (oBonusParm.BonusSlabs[1].SlabType == EnumSlabType.BasicSalary) // // { // // BonusDearnessAmount = this.CalculationSlabOnBasic(oBonusParm, oEmp, nBasicSalary); // // } // // else if (oBonusParm.BonusSlabs[1].SlabType == EnumSlabType.CasualLeave) // // { // // BonusCasualAmount = this.CalculationCasualBonusAmount(oBonusParm, oEmp,nBasicSalary); // // } // //} // #endregion calculate Slab Amount // TotalAmount = BonusGeneralAmount + BonusAdjustAmount + BonusSalaryItemAmount + BonusDearnessAmount + BonusCasualAmount; // if (param.BonusServiceLengths != null && param.BonusServiceLengths.Count > 0) // TotalAmount = this.CaculatedServiceLengthAmount(param, oemployee, TotalAmount, dCuttOfDate); // else if (param.IsProrated && param.EligibleCuttoffDate) // TotalAmount = this.CaculatedProratedCutOffAmount(param, oemployee, TotalAmount, dCuttOfDate); // else if (param.IsProrated) // TotalAmount = this.CaculatedProratedAmount(param, oemployee, TotalAmount, dCuttOfDate); // return TotalAmount; // } // public double CalculateRemainingBonusAmount(BonusParameter param, Employee oemployee, // double basicSalary, double GrossSalary, DateTime dCuttOfDate, BonusProcess.BonusProcessDetail odetail) // { // if (odetail != null) // { // if (param.NoOfBasic > 0) // { // param.NoOfBasic = param.NoOfBasic - odetail.ChangeSalaryItemAmount; // here changetaxamount contain count // } // if (param.NoOfGross > 0) // { // param.NoOfGross = param.NoOfGross - odetail.ChangeSalaryItemAmount; // here changetaxamount contain count // } // } // if((param.NoOfBasic + param.NoOfGross + param.FlatAmount) <=0) return 0; // double namount = 0; // namount= CalcluateBonus(param, oemployee, // basicSalary, GrossSalary, dCuttOfDate); // if (odetail != null) // { // if (param.NoOfBasic > 0) // { // param.NoOfBasic = param.NoOfBasic + odetail.ChangeSalaryItemAmount; // here changetaxamount contain count // } // if (param.NoOfGross > 0) // { // param.NoOfGross = param.NoOfGross + odetail.ChangeSalaryItemAmount; // here changetaxamount contain count // } // } // return namount; // } // public double CalcluateFestivalBonus(BonusParameter param, Employee oemployee, // double basicSalary, double GrossSalary, DateTime dCuttOfDate) // { // double TotalAmount = 0; // double basic = basicSalary; // //DateDifferenceInYearsMonthDays dd = DateDifferenceInYearsMonthDays.CompareDates(dCuttOfDate, oemployee.JoiningDate); // ////int year = dCuttOfDate.Year - oemployee.JoiningDate.Year; // //if (dd.Years >=1) // //{ // // TotalAmount = basic; // //} // //else // //{ // // TotalAmount = basic/365*dd.Days; // //} // return TotalAmount; // } // //public BonusProcess CalCulate(List oEmployees, Bonus oBonus, DateTime dBasicMonth, // // DateTime dPayDate, DateTime dCuttOfDate, double CurrProcess, bool IsDisburseWithSalary, bool IsTaxProcess) // //{ // // bool CheckOvertheYearCal = ConfigurationManager.GetBoolValue("bonus", "overtheyearcalculation", EnumConfigurationType.Logic); // // BonusProcess oProssBonus = new BonusProcess(); // // oProssBonus.BonusProcessDetails = new List(); // // double nBasicSalary = 0; // // double nGrossSalary = 0; // // //Added by ashek to reduce database hits // // ListoSetupManagerTranTypes=SetupDetail.GetTypes(EnumParameterSetup.Bonus); // // List oSetupDetails = SetupDetail.GetParameters(EnumParameterSetup.Bonus); // // List ogsAll = EmployeeGradeSalary.GetBasicOnDate(GlobalFunctions.LastDateOfMonth(dBasicMonth)); // // UpdateprocessStatus("Calculating Bonus"); // // UpdateProgressStatus(EnumProcessStatus.Start); // // int nCount = 0; // // List parameters = BonusParameter.Get(EnumStatus.Regardless); // // int nTotal=oEmployees.Count; // // foreach (Employee oEmp in oEmployees) // // { // // nCount++; // // UpdateprocessStatus("Calculating Bonus " + nCount.ToString() + "/" + nTotal.ToString()); // // UpdateProgressStatus(EnumProcessStatus.PerformStep); // // double TotalAmount = 0; // // List oParams = BonusParameter.ApplicableParameters3(parameters, oEmp, oBonus.ID, oSetupManagerTranTypes, oSetupDetails); // // if (oParams == null || oParams.Count <= 0) // // throw new ServiceException("Parameter not found for the employee " + oEmp.Name + " (" + oEmp.EmployeeNo + ")"); // // foreach (BonusParameter oBonusParm in oParams) // // { // // #region prepare bonusProcess // // oProssBonus.BonusID = oBonusParm.BonusID; // // oProssBonus.UsedProcess = CurrProcess; // // oProssBonus.BasicOnMonth = GlobalFunctions.LastDateOfMonth(dBasicMonth); // // oProssBonus.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate; // // oProssBonus.DisburseDate = dPayDate; // // oProssBonus.IsDisburseWithSalary = IsDisburseWithSalary; // // oProssBonus.IsTaxProcess = IsTaxProcess; // // //Old Change by ashek to reduce database hits // // //EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(oEmp.ID, GlobalFunctions.LastDateOfMonth(dBasicMonth)); // // EmployeeGradeSalary ogs = ogsAll.Find(delegate(EmployeeGradeSalary eg) { return eg.EmployeeID == oEmp.ID; }); // // if (ogs == null) // // { // // nBasicSalary = oEmp.BasicSalary; // // nGrossSalary = oEmp.GrossSalary; // // } // // else // // { // // nBasicSalary = ogs.BasicSalary; // // nGrossSalary = ogs.GrossSalary; // // } // // #endregion prepare bonusProcess // // BonusProcess.BonusProcessDetail oBPDetail = new BonusProcess.BonusProcessDetail(); // // oBPDetail.BonusID = oBonusParm.BonusID; // // oBPDetail.EmployeeID = oEmp.ID; // // oBPDetail.BasicSalary = nBasicSalary; // // oBPDetail.BonusMonth = Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate; // // //if (oBonus.Code == "001") // // //{ // // // TotalAmount = this.CalcluateFestivalBonus(oBonusParm, oEmp, nBasicSalary, nGrossSalary, dCuttOfDate); // // //} // // //else // // //{ // // TotalAmount = this.CalcluateBonus(oBonusParm, oEmp, nBasicSalary, nGrossSalary, dCuttOfDate); // // //} // // if (oBonusParm.IsOverYearCalculation) // // { // // double noOfItem = oBonusParm.NoOfBasic + oBonusParm.NoOfGross; // // double preAmount = BonusProcess.GetBonusAmountWithinYear(dCuttOfDate, oEmp.ID, oBonusParm.BonusID.Integer); // // if (preAmount > 0) // // { // // int nNoOfPaid = BonusProcess.GetForNoOfPaidForEmp(dCuttOfDate, oBonusParm.BonusID.Integer, oEmp.ID.Integer); // // oBPDetail.BonusAmount = (TotalAmount - preAmount) * CurrProcess / (oBonusParm.NoOfDisbusement - nNoOfPaid); // // } // // else // // { // // oBPDetail.BonusAmount = TotalAmount / oBonusParm.NoOfDisbusement * CurrProcess; // // } // // } // // else if (oBonusParm.IsPercent() == true) // // oBPDetail.BonusAmount = (TotalAmount / 100) * CurrProcess; // // else // // { // // double noOfItem = oBonusParm.NoOfBasic + oBonusParm.NoOfGross; // // oBPDetail.BonusAmount = TotalAmount / noOfItem * CurrProcess; // // } // // oBPDetail.BonusAmount = GlobalFunctions.Round(oBPDetail.BonusAmount); // // oBPDetail.ChangeBonusAmount = GlobalFunctions.Round(oBPDetail.BonusAmount); // // oBPDetail.IsProjectedBonus = oBonusParm.IsFestival; // // //oBPDetail.CalculatedAdjustAmount = BonusAdjustAmount; // // //oBPDetail.CalculatedSalaryItemAmount = BonusSalaryItemAmount; // // //oBPDetail.ChangeAdjustAmount = BonusAdjustAmount; // // //oBPDetail.ChangeSalaryItemAmount = BonusSalaryItemAmount; // // if(oBPDetail.BonusAmount>0) // // oProssBonus.BonusProcessDetails.Add(oBPDetail); // // } // // } // // UpdateProgressStatus(EnumProcessStatus.End); // // return oProssBonus; // //} // //public void CalculateTax(BonusProcess oProcessedItems, List oEmployees, Bonus oBonus) // //{ // // if(SystemInformation.CurrentSysInfo.TaxParamID==null)throw new ServiceException("Current year Tax paramter setup not found."); // // TaxParameter oparamter = TaxParameter.Get(SystemInformation.CurrentSysInfo.TaxParamID); // // List oParams = ADParameter.Get(EnumStatus.Regardless, EnumAllowOrDeduct.Allowance); // // List oTaxes= IncomeTax.Get( EnumIncomeTaxDataFrom.ProcessTempData); // // double nTaxAmount = 0; // // UpdateprocessStatus("Calculating Tax......"); // // UpdateProgressStatus(EnumProcessStatus.Start); // // int nCount = 0; // // EnumIncomeTaxDataFrom datafrom = IncomeTax.GetEnumForSalaryIT(); // // if (datafrom == EnumIncomeTaxDataFrom.SalaryITTempData) // // { // // throw new ServiceException("Current month salary is processed and not yet finalized. Tax calculation " // // + " is not allowed middle of this process. You have to Undo or finalize the salary to calculate tax."); // // } // // TaxCalculator oCalculator = new TaxCalculator(); // // oCalculator.TaxParameter = oparamter; // // foreach (BonusProcess.BonusProcessDetail item in oProcessedItems.BonusProcessDetails) // // { // // nCount++; // // UpdateProgressStatus(EnumProcessStatus.PerformStep); // // oCalculator.Employee = oEmployees.GetItem(item.EmployeeID); // // if (item.ChangeBonusAmount > 0) // // { // // List oTaxRowItems = new List(); // // oTaxRowItems.Add(TaxRawItem.Create(oBonus.Name, item.ChangeBonusAmount, enumIncomeTaxItemType.Bonus, item.BonusID.Integer)); // // nTaxAmount = 0; // // item.IncomeTaxcoll = oCalculator.CalculateBonus(oTaxRowItems, ref nTaxAmount, oParams,oTaxes); // // item.TaxAmount = nTaxAmount; // // item.ChangeTaxAmount = nTaxAmount; // // } // // } // // UpdateProgressStatus(EnumProcessStatus.End); // //} // //public void UndoTax(BonusProcess oProcessedItems, List oEmployees, Bonus oBonus) // //{ // // if (SystemInformation.CurrentSysInfo.TaxParamID == null) throw new ServiceException("Current year Tax paramter setup not found."); // // TaxParameter oparamter = TaxParameter.Get(SystemInformation.CurrentSysInfo.TaxParamID); // // Employee oemp = null; // // TaxCalculator oCalculator = new TaxCalculator(); // // oCalculator.TaxParameter = oparamter; // // EnumIncomeTaxDataFrom datafrom = IncomeTax.GetEnumForSalaryIT(); // // if (datafrom == EnumIncomeTaxDataFrom.SalaryITTempData) // // { // // throw new ServiceException("Current month salary is processed and not yet finalized. Tax calculation " // // + " is not allowed middle of this process. You have to Undo or finalize the salary to calculate tax."); // // } // // List taxes = IncomeTax.Get(EnumIncomeTaxDataFrom.ProcessTempData ); // // foreach (BonusProcess.BonusProcessDetail item in oProcessedItems.BonusProcessDetails) // // { // // oemp = oEmployees.GetItem(item.EmployeeID); // // if (oemp == null) // // { // // oemp = Employee.Get(item.EmployeeID); // // } // // if(oemp==null) throw new ServiceException("Employee not found while undo tax process; employee No:" + item.Employee.EmployeeNo); // // oCalculator.Employee = oemp; // // oCalculator.CurrentYearTax = IncomeTax.Get(taxes,item.EmployeeID); // // List oTaxRowItems = new List(); // // oTaxRowItems.Add(TaxRawItem.Create(oBonus.Name, item.ChangeBonusAmount, enumIncomeTaxItemType.Bonus, item.BonusID.Integer)); // // item.IncomeTaxcoll = oCalculator.UndoBonus(oTaxRowItems, item.ChangeTaxAmount); // // } // //} // } //}