From b8c3f1f462cba0c4a61d8f6ec67ae86d4fe06293 Mon Sep 17 00:00:00 2001 From: "ashikeu@gmai.com" Date: Mon, 30 Nov 2026 10:14:40 +0600 Subject: [PATCH] salary on balancing --- HRM.BO/AllowDeduct/ADParameter.cs | 7 +- HRM.BO/AllowDeduct/ADParameterEmployee.cs | 4 + HRM.BO/HRBasic/Enums.cs | 8 + HRM.BO/Salary/SalaryMonthly.cs | 2 + HRM.BO/Salary/SalaryMonthlyDetail.cs | 4 + HRM.DA/DA/AllowDeduct/ADParameterDA.cs | 10 +- .../Service/AllowDeduct/ADParameterService.cs | 83 ++++++ HRM.DA/Service/Salary/SalaryCalculator.cs | 121 ++++++++- HRM.DA/Service/Tax/IncomeTaxService.cs | 45 ++++ HRM.DA/Service/Tax/TaxCalculator.cs | 246 +++++++++--------- .../src/app/_models/Payroll/adparameter.ts | 6 +- HRM.UI/ClientApp/src/app/_models/enums.ts | 8 + ...on-parameterization-details.component.html | 5 + ...tion-parameterization-entry.component.html | 31 +++ ...uction-parameterization-entry.component.ts | 30 ++- HRM.UI/appsettings.json | 4 +- 16 files changed, 480 insertions(+), 134 deletions(-) diff --git a/HRM.BO/AllowDeduct/ADParameter.cs b/HRM.BO/AllowDeduct/ADParameter.cs index 60b14d9..df0a06f 100644 --- a/HRM.BO/AllowDeduct/ADParameter.cs +++ b/HRM.BO/AllowDeduct/ADParameter.cs @@ -113,7 +113,7 @@ namespace HRM.BO PercentOfGross = 0; EffectMonth = PayrollGlobalFunctions.PayrollFirstDateOfMonth(DateTime.Today); ArrearToCalculationMonth = PayrollGlobalFunctions.PayrollFirstDateOfMonth(DateTime.Today); - + } #endregion @@ -194,6 +194,9 @@ namespace HRM.BO public bool IsTaxProjection { get; set; } public bool IsDependsOnAttendance { get; set; } public bool ISDEPENDSONSPECIALHOUR { get; set; } + public EnumAllowanceType AllowanceType { get; set; } + + public bool IsOnBalancing { get; set; } public bool IsDependsOnOTHour { get; set; } public bool IsWithException { get; set; } public EnumPeriodicity Periodicity { get; set; } @@ -718,7 +721,7 @@ namespace HRM.BO -//#endregion + //#endregion } diff --git a/HRM.BO/AllowDeduct/ADParameterEmployee.cs b/HRM.BO/AllowDeduct/ADParameterEmployee.cs index 6a530f7..0e4afd4 100644 --- a/HRM.BO/AllowDeduct/ADParameterEmployee.cs +++ b/HRM.BO/AllowDeduct/ADParameterEmployee.cs @@ -65,6 +65,10 @@ namespace HRM.BO public int Approvedby { get; set; } public DateTime ApprovedDate { get; set; } public EnumAuthStatus ApprovalStatus { get; set; } + + public EnumAllowanceType AllowanceType { get; set; } + + public bool IsOnBalancing { get; set; } public double GetAmount(double basicSalary, double grossSalary) { if (this.ValueType == EnumValueType.Amount) return this.MonthlyAmount; diff --git a/HRM.BO/HRBasic/Enums.cs b/HRM.BO/HRBasic/Enums.cs index 1b4f3ec..bb415d2 100644 --- a/HRM.BO/HRBasic/Enums.cs +++ b/HRM.BO/HRBasic/Enums.cs @@ -1961,6 +1961,14 @@ namespace HRM.BO Individual = 2 } + public enum EnumAllowanceType + { + None = 0, + HouseRent = 1, + Medical = 2, + Conveynce = 3 + } + public enum EnumPFTranType { diff --git a/HRM.BO/Salary/SalaryMonthly.cs b/HRM.BO/Salary/SalaryMonthly.cs index f5ac4e4..3c659d0 100644 --- a/HRM.BO/Salary/SalaryMonthly.cs +++ b/HRM.BO/Salary/SalaryMonthly.cs @@ -791,6 +791,8 @@ namespace HRM.BO #endregion + public double ActualPassegeFreeAmount { get; set; } + // #region Functions // public static SalaryMonthly Get(int nID) diff --git a/HRM.BO/Salary/SalaryMonthlyDetail.cs b/HRM.BO/Salary/SalaryMonthlyDetail.cs index d268d34..92ea208 100644 --- a/HRM.BO/Salary/SalaryMonthlyDetail.cs +++ b/HRM.BO/Salary/SalaryMonthlyDetail.cs @@ -173,7 +173,11 @@ namespace HRM.BO } #endregion + public EnumAllowanceType AllowanceType { get; set; } + public bool IsOnBalancing { get; set; } + + public double ActualPassegeFreeAmount { get; set; } #region Service Factory ISalaryMonthlyService : ISalaryMonthlyService diff --git a/HRM.DA/DA/AllowDeduct/ADParameterDA.cs b/HRM.DA/DA/AllowDeduct/ADParameterDA.cs index f34bb84..e4b353f 100644 --- a/HRM.DA/DA/AllowDeduct/ADParameterDA.cs +++ b/HRM.DA/DA/AllowDeduct/ADParameterDA.cs @@ -22,15 +22,15 @@ namespace HRM.DA { // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 tc.ExecuteNonQuery( - "INSERT INTO ADPARAMETERBASIC(ADParameterID, allowDeductID, isForConfirmOnly, flatAmount, percentOfBasic, percentOfGross, GFFlatAmount, GFPercentOfBasic, GFPercentOfGross, minAmount, maxAmount, isCurrentlyActive, TAXABLEPERCENTAGE, ISTAXABLE, ISTaxProjection, IsDependsOnAttendance, IsDependsOnOTHour,ISDEPENDSONSPECIALHOUR, IsWithException, Periodicity, ALLOWORDEDUCT, GENDER, CreatedBy, CreationDate, PAYROLLTYPEID, LASTACTIVATIONDATE,ENTITLETYPE,PercentOfEarnedBasic,IsFractionateApplicable, TaxProjection)" + - " VALUES(%n, %n, %b, %n, %n, %n, %n, %n, %n, %n, %n, %b, %n, %b, %b, %b, %b, %n, %b, %n, %n, %n, %n, %d, %n, %D, %n, %n, %n,%n)", + "INSERT INTO ADPARAMETERBASIC(ADParameterID, allowDeductID, isForConfirmOnly, flatAmount, percentOfBasic, percentOfGross, GFFlatAmount, GFPercentOfBasic, GFPercentOfGross, minAmount, maxAmount, isCurrentlyActive, TAXABLEPERCENTAGE, ISTAXABLE, ISTaxProjection, IsDependsOnAttendance, IsDependsOnOTHour,ISDEPENDSONSPECIALHOUR, IsWithException, Periodicity, ALLOWORDEDUCT, GENDER, CreatedBy, CreationDate, PAYROLLTYPEID, LASTACTIVATIONDATE,ENTITLETYPE,PercentOfEarnedBasic,IsFractionateApplicable, TaxProjection,allowanceType,isBalancing)" + + " VALUES(%n, %n, %b, %n, %n, %n, %n, %n, %n, %n, %n, %b, %n, %b, %b, %b, %b, %n, %b, %n, %n, %n, %n, %d, %n, %D, %n, %n, %n,%n,%n,%b)", item.ID, item.AllowDeductID, item.IsForConfirmOnly, item.FlatAmount, item.PercentOfBasic, item.PercentOfGross, item.GFFlatAmount, item.GFPercentOfBasic, item.GFPercentOfGross, item.MinAmount, item.MaxAmount, item.IsCurrentlyActive, item.TaxablePercentage, item.IsTaxable, item.IsTaxProjection, item.IsDependsOnAttendance, item.IsDependsOnOTHour, item.ISDEPENDSONSPECIALHOUR, item.IsWithException, item.Periodicity, item.AllowOrDeductType, item.Gender, item.CreatedBy, item.CreatedDate, item.PayrollTypeID, DateTime.Now, item.EntitleType, item.PercentOfEarnedBasic, - item.IsFractionateApplicable, 0); + item.IsFractionateApplicable, 0,item.AllowanceType,item.IsOnBalancing); } internal static void Insert(TransactionContext tc, ADParameter.ADParameterGrade item) @@ -57,13 +57,13 @@ namespace HRM.DA internal static void Update(TransactionContext tc, ADParameter item) { tc.ExecuteNonQuery( - "UPDATE ADPARAMETERBASIC SET allowDeductID=%n, IsForConfirmOnly=%b, FlatAmount=%n, PercentOfBasic=%n, PercentOfGross=%n, GFFlatAmount=%n, GFPercentOfBasic=%n, GFPercentOfGross=%n, MinAmount=%n, MaxAmount=%n, IsCurrentlyActive=%b, TaxablePercentage=%n, IsTaxable=%b, IsTaxProjection=%b, IsDependsOnAttendance=%b, IsDependsOnOTHour=%b, IsWithException=%b, Periodicity=%n, ALLOWORDEDUCT=%n, Gender=%n, ModifiedBy=%n, ModifiedDate=%d, ENTITLETYPE=%n, PercentOfEarnedBasic=%n, IsFractionateApplicable=%n" + + "UPDATE ADPARAMETERBASIC SET allowDeductID=%n, IsForConfirmOnly=%b, FlatAmount=%n, PercentOfBasic=%n, PercentOfGross=%n, GFFlatAmount=%n, GFPercentOfBasic=%n, GFPercentOfGross=%n, MinAmount=%n, MaxAmount=%n, IsCurrentlyActive=%b, TaxablePercentage=%n, IsTaxable=%b, IsTaxProjection=%b, IsDependsOnAttendance=%b, IsDependsOnOTHour=%b, IsWithException=%b, Periodicity=%n, ALLOWORDEDUCT=%n, Gender=%n, ModifiedBy=%n, ModifiedDate=%d, ENTITLETYPE=%n, PercentOfEarnedBasic=%n, IsFractionateApplicable=%n,allowanceType=%n,isBalancing=%b" + " WHERE ADParameterID=%n", item.AllowDeductID, item.IsForConfirmOnly, item.FlatAmount, item.PercentOfBasic, item.PercentOfGross, item.GFFlatAmount, item.GFPercentOfBasic, item.GFPercentOfGross, item.MinAmount, item.MaxAmount, item.IsCurrentlyActive, item.TaxablePercentage, item.IsTaxable, item.IsTaxProjection, item.IsDependsOnAttendance, item.IsDependsOnOTHour, item.IsWithException, item.Periodicity, item.AllowOrDeductType, item.Gender, item.ModifiedBy, - item.ModifiedDate, item.EntitleType, item.PercentOfEarnedBasic, item.IsFractionateApplicable, item.ID); + item.ModifiedDate, item.EntitleType, item.PercentOfEarnedBasic, item.IsFractionateApplicable, item.AllowanceType, item.IsOnBalancing, item.ID); } #endregion diff --git a/HRM.DA/Service/AllowDeduct/ADParameterService.cs b/HRM.DA/Service/AllowDeduct/ADParameterService.cs index 03f8285..ad9399f 100644 --- a/HRM.DA/Service/AllowDeduct/ADParameterService.cs +++ b/HRM.DA/Service/AllowDeduct/ADParameterService.cs @@ -51,6 +51,8 @@ namespace HRM.DA oADParameter.ModifiedBy = oReader.GetInt32("ModifiedBy", 0); oADParameter.ModifiedDate = oReader.GetDateTime("ModifiedDate"); oADParameter.EntitleType = (EnumEntitleType)oReader.GetInt32("EntitleType").Value; + oADParameter.AllowanceType = (EnumAllowanceType)oReader.GetInt32("allowanceType").Value; + oADParameter.IsOnBalancing = oReader.GetBoolean("isBalancing").Value; this.SetObjectState(oADParameter, Ease.Core.ObjectState.Saved); } @@ -938,7 +940,88 @@ namespace HRM.DA return nAmount; } + public double GetGradeDefinedAmountForMonth(Employee employee, double basicSalary, + double grossSalary, EmployeeGradeSalary oEmpGradeSalary, ADParameter param, int nFrac) + { + ADParameterEmployee adEmp = null; + double nAmount = 0.0; + switch (param.EntitleType) + { + case EnumEntitleType.Grade: + if (param.PercentOfBasic > 0) + nAmount = nAmount + param.FlatAmount * nFrac + + basicSalary * param.PercentOfBasic / 100.0; + //nAmount = basicSalary * this.PercentOfBasic / 100.0;// + this.FlatAmount; + else if (param.PercentOfGross > 0) + nAmount = nAmount + param.FlatAmount * nFrac + + grossSalary * param.PercentOfGross / 100.0; + //nAmount = grossSalary * this.PercentOfGross / 100.0;// + this.FlatAmount; + else + nAmount = param.FlatAmount * nFrac; + //bool IsGradFather = (employee.GrandFather != null && employee.GrandFather.Allowance == true); + //if (IsGradFather == true) + //{ + // nAmount = 0; + // if (this.GFPercentOfBasic > 0) + // nAmount = nAmount + this.GFFlatAmount * oEmpGradeSalary.FractionofFromTo + basicSalary * this.GFPercentOfBasic / 100.0; + // //nAmount = basicSalary * this.PercentOfBasic / 100.0;// + this.FlatAmount; + // else if (this.GFPercentOfGross > 0) + // nAmount = nAmount + this.GFFlatAmount * oEmpGradeSalary.FractionofFromTo + grossSalary * this.GFPercentOfGross / 100.0; + // //nAmount = grossSalary * this.PercentOfGross / 100.0;// + this.FlatAmount; + // else + // nAmount = this.GFFlatAmount * oEmpGradeSalary.FractionofFromTo; + //} + + if (param.NotApplicable.Exists(x => x.EmployeeID == employee.ID) == true) + { + nAmount = 0; + } + else + { + adEmp = param.Exception.Find(x => x.EmployeeID == employee.ID); + if (adEmp != null) + { + switch (adEmp.ValueType) + { + case EnumValueType.Amount: + nAmount = adEmp.MonthlyAmount * nFrac; + break; + case EnumValueType.Other: + if (param.PercentOfBasic > 0 || adEmp.MonthlyAmount > 0) + nAmount = basicSalary * adEmp.MonthlyAmount / + 100.0; //* oEmpGradeSalary.FractionofFromTo; //+ this.FlatAmount; + else if (param.PercentOfGross > 0 || adEmp.MonthlyAmount > 0) + nAmount = grossSalary * adEmp.MonthlyAmount / + 100.0; //* oEmpGradeSalary.FractionofFromTo; //+ this.FlatAmount; + break; + } + } + } + + break; + + case EnumEntitleType.Individual: + throw new Exception("You have choosed the wrong overloaded function to calculate" + + " Individual Allowance" + " Employee:(" + employee.EmployeeNo + ")" + + employee.Name + "; Item Name:" + param.AllowanceDeduction.Name); + } + + if (param.MinAmount != 0 || param.MaxAmount != 0) + { + if (nAmount < param.MinAmount) + { + nAmount = param.MinAmount; + } + + if (nAmount > param.MaxAmount) + { + nAmount = param.MaxAmount; + } + } + + return nAmount; + } public double GetGradeDefinedAmount(Employee employee, double basicSalary, double grossSalary, EmployeeGradeSalary oEmpGradeSalary, ADParameter param) { diff --git a/HRM.DA/Service/Salary/SalaryCalculator.cs b/HRM.DA/Service/Salary/SalaryCalculator.cs index 91e5fcd..ac853c9 100644 --- a/HRM.DA/Service/Salary/SalaryCalculator.cs +++ b/HRM.DA/Service/Salary/SalaryCalculator.cs @@ -128,8 +128,9 @@ namespace HRM.DA //this.PF(); this.PFNEW(); -// this.OverTimeArrearProcess(); needed later + // this.OverTimeArrearProcess(); needed later //UpdateprocessStatus("Calculating Employees Income tax...."); + this.CalculateOnBalance(); UpdateprocessStatus("Calculating Income Tax"); this.Tax(); UpdateprocessStatus("Calculating Cost-Center"); @@ -480,6 +481,7 @@ namespace HRM.DA //{ // basicDetail = this.AddDetail(salary, EnumSalaryGroup.Gross, EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, 0, "Ordinary Amount", PayrollPayrollGlobalFunctions.Round(basicSalary)); //} + salary.ActualPassegeFreeAmount += salary.ThisMonthBasic; } #endregion Calculate Normal Salary #region calculate arrear amount @@ -693,6 +695,79 @@ namespace HRM.DA } + private void CalculateOnBalance() + { + AllowanceDeduction allowDeduc = new AllowanceDeduction(); + UpdateProgressStatus(EnumProcessStatus.Start); + double grossamount = 0, rcvgross = 0, nProjectAmount = 0; + double arrgrossamount = 0, arrrcvgross = 0; + foreach (SalaryMonthly sMonthly in _salaryMonthlys) + { + grossamount = 0; rcvgross = 0; nProjectAmount = 0; + arrgrossamount = 0; arrrcvgross = 0; + foreach (EmployeeGradeSalary item in sMonthly.GradeSalaries) + { + grossamount = grossamount + item.GrossSalary; + } + foreach (EmployeeGradeSalary item in sMonthly.ArrearGradeSalaries) + { + arrgrossamount = arrgrossamount + item.GrossSalary; + } + + + foreach (SalaryMonthlyDetail item in sMonthly.Details) + { + if ((item.ItemCode == EnumSalaryItemCode.Basic_Salary && item.ItemID == -101 && item.itemGroupCode == EnumSalaryGroup.Gross) || + item.AllowanceType == EnumAllowanceType.HouseRent && item.itemGroupCode == EnumSalaryGroup.Gross || + item.AllowanceType == EnumAllowanceType.Medical && item.itemGroupCode == EnumSalaryGroup.Gross || + item.AllowanceType == EnumAllowanceType.Conveynce && item.itemGroupCode == EnumSalaryGroup.Gross + ) + { + rcvgross += item.CalculatedAmount; + + } + } + + foreach (SalaryMonthlyDetail item in sMonthly.Details) + { + if ((item.ItemCode == EnumSalaryItemCode.Basic_Salary && item.ItemID == -101 && item.itemGroupCode == EnumSalaryGroup.Arrear) || + item.AllowanceType == EnumAllowanceType.HouseRent && item.itemGroupCode == EnumSalaryGroup.Arrear || + item.AllowanceType == EnumAllowanceType.Medical && item.itemGroupCode == EnumSalaryGroup.Arrear || + item.AllowanceType == EnumAllowanceType.Conveynce && item.itemGroupCode == EnumSalaryGroup.Arrear + ) + { + arrrcvgross += item.CalculatedAmount; + } + } + + SalaryMonthlyDetail smd = sMonthly.Details.Find(x => x.ItemCode == EnumSalaryItemCode.Allowance && x.IsOnBalancing && x.itemGroupCode == EnumSalaryGroup.Gross); + if (smd != null) + { + smd.CalculatedAmount = Math.Round(grossamount - rcvgross, 0); + smd.ChangedAmount = smd.CalculatedAmount; + smd.ActualPassegeFreeAmount = sMonthly.ActualPassegeFreeAmount; + + SalaryMonthlyDetail arr = sMonthly.Details.Find(x => x.ItemCode == EnumSalaryItemCode.Allowance && x.IsOnBalancing && x.itemGroupCode == EnumSalaryGroup.Arrear); + + if (arr != null) + { + arr.CalculatedAmount = 0; + arr.ChangedAmount = 0; + } + + if (arr == null && arrrcvgross != 0) + arr = this.AddDetail(sMonthly, EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, smd.ItemID, smd.SupportID, smd.Description + " Arrear", 0); + + if (arr != null && arrrcvgross != 0) + { + arr.CalculatedAmount = Math.Round(arrgrossamount - arrrcvgross, 0); + arr.ChangedAmount = arr.CalculatedAmount; + } + + } + + } + } private void PFNEW() { UpdateProgressStatus(EnumProcessStatus.Start); @@ -855,6 +930,17 @@ namespace HRM.DA List indvAllowances = new ADParameterEmployeeService().Get( GlobalFunctions.FirstDateOfMonth(_processMonth), GlobalFunctions.LastDateOfMonth(_processMonth), this.PayrollTypeID); + + foreach (ADParameterEmployee emp in indvAllowances) + { + ADParameter adParam = _adParameters.Find(x => x.ID == emp.ADParameterID); + if (adParam != null) + { + emp.AllowanceType=adParam.AllowanceType; + emp.IsOnBalancing=adParam.IsOnBalancing; + } + + } double totalPresentDays = 0; foreach (SalaryMonthly salary in _salaryMonthlys) { @@ -864,6 +950,8 @@ namespace HRM.DA this.GradeDefinedAllowDeduct(salary, salary.ArrearGradeSalaries, EnumSalaryGroup.Arrear, indvAllowances, EnumSide.Add); // this.GradeDefinedAllowDeduct(salary, salary.ArrearPaidGradeSalaries, EnumSalaryGroup.Arrear, indvAllowances, EnumSide.Deduct); leter we can introduce this.IndividualAllowDeduct(salary, indvAllowances, totalPresentDays); + + salary.ActualPassegeFreeAmount = salary.ThisMonthGross - salary.ActualPassegeFreeAmount; } } private void IndividualAllowDeduct(SalaryMonthly salary, List indvAllowances, double toTalPresentDays) @@ -925,6 +1013,22 @@ namespace HRM.DA detail.Position = item.AllowDeduct.Sequence + 1; detail.ADParamEmployee = item; } + + if (detail != null) + { + if (parameter.AllowanceType == EnumAllowanceType.HouseRent || + parameter.AllowanceType == EnumAllowanceType.Medical || + parameter.AllowanceType == EnumAllowanceType.Conveynce) + { + + if (groupCode != EnumSalaryGroup.Arrear) + { + salary.ActualPassegeFreeAmount += item.MonthlyAmount; + } + } + } + + } #endregion Individual Allowance @@ -953,12 +1057,17 @@ namespace HRM.DA { if (salary.Category.WagesType == EnumWagesType.Monthly) { + amount = new ADParameterService().GetGradeDefinedAmount(salary.Employee, empGradeSalary.BasicSalary, empGradeSalary.GrossSalary, empGradeSalary, parameter); - // for echotex - if (parameter.AllowanceDeduction.Code == "023" && parameter.AllowanceDeduction.Name == "Night shift allowance" && amount >0) + + if ((parameter.AllowanceType == EnumAllowanceType.HouseRent && gCode == EnumSalaryGroup.Gross) || + (parameter.AllowanceType == EnumAllowanceType.Medical && gCode == EnumSalaryGroup.Gross) || + (parameter.AllowanceType == EnumAllowanceType.Conveynce && gCode == EnumSalaryGroup.Gross)) { - amount = parameter.FlatAmount; + double nAmt = new ADParameterService().GetGradeDefinedAmountForMonth(salary.Employee, salary.ThisMonthBasic, salary.ThisMonthGross, empGradeSalary, parameter, 1); + salary.ActualPassegeFreeAmount += nAmt; } + } } else continue; @@ -993,6 +1102,10 @@ namespace HRM.DA if (detail != null) detail.Position = parameter.AllowanceDeduction.Sequence + 1; + detail.AllowanceType = parameter.AllowanceType; + detail.IsOnBalancing= parameter.IsOnBalancing; + + } } } diff --git a/HRM.DA/Service/Tax/IncomeTaxService.cs b/HRM.DA/Service/Tax/IncomeTaxService.cs index 3f8ca8a..3b898b9 100644 --- a/HRM.DA/Service/Tax/IncomeTaxService.cs +++ b/HRM.DA/Service/Tax/IncomeTaxService.cs @@ -1345,6 +1345,8 @@ namespace HRM.DA taxCalculator.Salary = salaries; taxCalculator.Employee = new EmployeeService().Get(salaries.EmployeeID); taxCalculator.AllowanceDeductions = new AllowanceDeductionService().Get(EnumStatus.Regardless); + List ads = new ADParameterService().GetWithDetail(EnumStatus.Regardless, salaries.PayrollTypeID); + taxCalculator.AdParameters = ads; try { foreach (IncomeTax item in taxCalculator.CurrentYearTax) @@ -1353,6 +1355,49 @@ namespace HRM.DA item.ProjectedAmount = 0; } + double rcvGross = 0; + // find gross amount + Employee oEmp = new EmployeeService().Get(salaries.EmployeeID); + SalaryMonthlyDetail pscFreeIime = null; + foreach (var item in salaries.Details) + { + if (item.itemGroupCode == EnumSalaryGroup.Gross) + { + if (item.ItemCode == EnumSalaryItemCode.Allowance) + { + ADParameter param = ads.Find(x=>x.AllowDeductID==item.ItemID); + if (param != null) + { + if(param.IsOnBalancing) + { + pscFreeIime = item; + } + if (param.AllowanceType ==EnumAllowanceType.HouseRent || + param.AllowanceType == EnumAllowanceType.Medical || + param.AllowanceType == EnumAllowanceType.Conveynce) + { + + ADParameter adParam = new ADParameterService().GetApplicableParameter(oEmp, salaries.GradeID, + ads, item.ItemID); + + double nAmt = new ADParameterService().GetAmount(oEmp, adParam); + + rcvGross = rcvGross + nAmt; + } + } + } + } + + } + rcvGross += salaries.ThisMonthBasic; + + + if (pscFreeIime!=null) + { + pscFreeIime.ActualPassegeFreeAmount = salaries.ThisMonthGross - rcvGross; + } + + salaries.Incometaxes = taxCalculator.SalaryTax(); } catch (ServiceException sx) diff --git a/HRM.DA/Service/Tax/TaxCalculator.cs b/HRM.DA/Service/Tax/TaxCalculator.cs index 841885c..c89066e 100644 --- a/HRM.DA/Service/Tax/TaxCalculator.cs +++ b/HRM.DA/Service/Tax/TaxCalculator.cs @@ -31,12 +31,12 @@ namespace HRM.DA protected List _bATBGrandFatherTagings; protected List _allowanceDeductions; protected List _empTaxInvestments = null; - protected List _investmentTypes =null; + protected List _investmentTypes = null; protected double _projectedMonth; protected double _onceoffAmount; List _oTProcesss = null; private double _taxontaxamount; - public bool? _investmentwithoutpf= null; + public bool? _investmentwithoutpf = null; public bool? _monthlyexemption = null; public bool _isActualInvestment; #endregion Define Class Variable @@ -64,7 +64,7 @@ namespace HRM.DA _isActualInvestment = false; _salary = null; _taxSlabs = null; - TaxParameter param = taxparam; + TaxParameter param = taxparam; _mergeItems = new TaxMergeMasterService().GetbyTaxParameter(param.ID, ptype.ID); this.payrolltype = ptype; if (param != null) @@ -345,10 +345,10 @@ namespace HRM.DA List adParamEmps = null; EmployeeGradeSalary oEmpGSalary = new EmployeeGradeSalary(); List rawItems = new List(); - // _projectedMonth = _projectedMonth + 1; + // _projectedMonth = _projectedMonth + 1; _salary = new SalaryMonthly(); _salary.Details.Add(this.CreateSalaryDetail("Basic Salary", EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary, 0, _employee.BasicSalary)); - if(this._allowanceDeductions == null) + if (this._allowanceDeductions == null) { this._allowanceDeductions = new AllowanceDeductionService().Get(EnumStatus.Regardless, this.payrolltype.ID); } @@ -363,7 +363,7 @@ namespace HRM.DA if (adParam.EntitleType == EnumEntitleType.Grade) _salary.Details.Add(this.CreateSalaryDetail(adParam.AllowanceDeduction.Name, - EnumSalaryItemCode.Allowance, adParam.AllowanceDeduction.ID, adParam.ID, + EnumSalaryItemCode.Allowance, adParam.AllowanceDeduction.ID, adParam.ID, new ADParameterService().GetGradeDefinedAmount(_employee, _employee.BasicSalary, _employee.GrossSalary, new EmployeeGradeSalary(), adParam))); @@ -452,7 +452,15 @@ namespace HRM.DA #region Management Payrol if (adparameter.EntitleType == EnumEntitleType.Grade) { - item.ProjectedAmount = GlobalFunctions.Round( new ADParameterService().GetGradeDefinedAmount(_employee, _employee.BasicSalary, _employee.GrossSalary, oEmpGSalary, adparameter)) * _projectedMonth; + if ((salaryDetail.IsOnBalancing == true) + && salaryDetail.ItemCode == EnumSalaryItemCode.Allowance && + salaryDetail.itemGroupCode == EnumSalaryGroup.Gross) + { + item.ProjectedAmount = salaryDetail.ActualPassegeFreeAmount * _projectedMonth; + } + else item.ProjectedAmount = GlobalFunctions.Round(new ADParameterService().GetGradeDefinedAmount(_employee, _employee.BasicSalary, _employee.GrossSalary, oEmpGSalary, adparameter)) * _projectedMonth; + + //item.ProjectedAmount = GlobalFunctions.Round( new ADParameterService().GetGradeDefinedAmount(_employee, _employee.BasicSalary, _employee.GrossSalary, oEmpGSalary, adparameter)) * _projectedMonth; } else { @@ -600,7 +608,7 @@ namespace HRM.DA where pItem.ItemGroup == 7 select pItem; #endregion - if(this._monthlyexemption ==null) + if (this._monthlyexemption == null) this._monthlyexemption = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "incometax", "monthlyexemption"); foreach (var processItem in examtionItems) @@ -612,17 +620,17 @@ namespace HRM.DA { //if (_employee.JoiningDate.Day > 1) // _employee.JoiningDate = new DateTime(_employee.JoiningDate.Year, _employee.JoiningDate.Month, 1); - IncomeTax basicItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && - x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary && x.ItemID == (int) EnumIncomeTaxItemGroup.Basic_Salary); + IncomeTax basicItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && + x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary); - IncomeTax HRItem = _currentYearTax.FirstOrDefault(x=> x.EmployeeID == _employee.ID && + IncomeTax HRItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.House_Rent_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.House_Rent_Allowance); if (HRItem == null || HRItem.TotalAmount == 0) continue; //throw new ServiceException("House rent allowance not found in the collection while calculating HR Examtion"); //continue; // - IncomeTax HrExption = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && - x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance && - x.ItemID == (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance); + IncomeTax HrExption = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && + x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance && + x.ItemID == (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance); if (HrExption == null) HrExption = this.Add(EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, string.Empty, 0, 0, EnumIncomeTaxSide.Dec_SalaryIncome); //if (oCycles != null && oCycles.Count>0) @@ -852,12 +860,12 @@ namespace HRM.DA #region Conveyance Allowance Examtion else if (processItem.ItemCode == (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance) { - IncomeTax CnvItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID== _employee.ID && + IncomeTax CnvItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Conveyance_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Conveyance_Allowance); if (CnvItem == null || CnvItem.TotalAmount == 0) continue; - IncomeTax CvExption = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && - x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance); + IncomeTax CvExption = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && + x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance); if (CvExption == null) CvExption = this.Add(EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, string.Empty, 0, 0, EnumIncomeTaxSide.Dec_SalaryIncome); if (this._monthlyexemption == false) @@ -899,15 +907,15 @@ namespace HRM.DA #region Other Allowance Examption else if (processItem.ItemCode == (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance) { - IncomeTax MedicalItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && - x.ItemGroup == EnumIncomeTaxItemGroup.Medical_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Medical_Allowance); + IncomeTax MedicalItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && + x.ItemGroup == EnumIncomeTaxItemGroup.Medical_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Medical_Allowance); if (MedicalItem == null) continue; //throw new ServiceException("Conveyance allowance not found in the collection while calculating HR Examtion"); - IncomeTax mdExption = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax mdExption = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_Medical_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance); if (mdExption == null) mdExption = this.Add(EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, string.Empty, 0, 0, EnumIncomeTaxSide.Dec_SalaryIncome); - IncomeTax basicItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax basicItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary); //Sumon on 24 June 2014 @@ -930,11 +938,11 @@ namespace HRM.DA } else if (processItem.ItemCode == (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance) { - IncomeTax LFAItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax LFAItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.LFA_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.LFA_Allowance); if (LFAItem == null) continue;// throw new ServiceException("LFA allowance not found in the collection while calculating HR Examtion"); //continue; // - IncomeTax lfaExption = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax lfaExption = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_LFA_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance); if (lfaExption == null) lfaExption = this.Add(EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, string.Empty, 0, 0, EnumIncomeTaxSide.Dec_SalaryIncome); @@ -946,11 +954,11 @@ namespace HRM.DA } else if (processItem.ItemCode == (int)EnumIncomeTaxItemGroup.WPPF_Examption) { - IncomeTax wppfItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID ==_employee.ID && + IncomeTax wppfItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.WPPF_Allowance); if (wppfItem == null) continue;// throw new ServiceException("LFA allowance not found in the collection while calculating HR Examtion"); //continue; // - IncomeTax wppfExption = _currentYearTax.FirstOrDefault(x=>x.EmployeeID== _employee.ID + IncomeTax wppfExption = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption && x.ItemID == (int)EnumIncomeTaxItemGroup.WPPF_Examption); if (wppfExption == null) wppfExption = this.Add(EnumIncomeTaxItemGroup.WPPF_Examption, (int)EnumIncomeTaxItemGroup.WPPF_Examption, string.Empty, 0, 0, EnumIncomeTaxSide.Dec_SalaryIncome); @@ -973,7 +981,7 @@ namespace HRM.DA x.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF && x.ItemID == (int)EnumIncomeTaxItemGroup.Company_Contri_PF); if (pfItem == null) pfItem = this.Add(EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF, string.Empty, 0, 0, EnumIncomeTaxSide.Inc_AnnualIncome); - IncomeTax BasicItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax BasicItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary); if (BasicItem == null) return; @@ -1027,7 +1035,7 @@ namespace HRM.DA } if (_projectionBonusParams == null || _projectionBonusParams.Count == 0) return; - oparams = new BonusParameterService().GetApplicableParameters(_employee, (int) _employee.GradeID, _projectionBonusParams); + oparams = new BonusParameterService().GetApplicableParameters(_employee, (int)_employee.GradeID, _projectionBonusParams); if (oparams == null) return; _ApplicableBonusParams = oparams; @@ -1055,9 +1063,9 @@ namespace HRM.DA pfItem.ProjectedAmount = 0; //First Project Month - if (bonusAmount >0 && item.firstProjectMonth != null && item.firstProjectMonth > payrolltype.NextPayProcessDate) + if (bonusAmount > 0 && item.firstProjectMonth != null && item.firstProjectMonth > payrolltype.NextPayProcessDate) { - if(item.secondProjectMonth !=null) + if (item.secondProjectMonth != null) pfItem.ProjectedAmount = bonusAmount / 2; else pfItem.ProjectedAmount = bonusAmount; } @@ -1138,14 +1146,14 @@ namespace HRM.DA if (_isActualInvestment == true) // payroll type wise Actual investment date is different, so this done in temporary basis { - IncomeTax ActualInvestment = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax ActualInvestment = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Investment_Actual && x.ItemID == (int)EnumIncomeTaxItemGroup.Investment_Actual); if (ActualInvestment == null) ActualInvestment = this.Add(EnumIncomeTaxItemGroup.Investment_Actual, (int)EnumIncomeTaxItemGroup.Investment_Actual, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_Info_Item); - IncomeTax pfItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF - && x.ItemID == (int)EnumIncomeTaxItemGroup.Company_Contri_PF); + IncomeTax pfItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF + && x.ItemID == (int)EnumIncomeTaxItemGroup.Company_Contri_PF); investAmount = 0; if (pfItem != null) investAmount = investAmount + (pfItem.TotalAmount * 2); @@ -1158,8 +1166,8 @@ namespace HRM.DA ActualInvestment.TotalAmount = nactualInvt; } - IncomeTax InvestmentAllowed = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Investment_Allowed - && x.ItemID == (int)EnumIncomeTaxItemGroup.Investment_Allowed); + IncomeTax InvestmentAllowed = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Investment_Allowed + && x.ItemID == (int)EnumIncomeTaxItemGroup.Investment_Allowed); if (InvestmentAllowed == null) InvestmentAllowed = this.Add(EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_Info_Item); @@ -1189,16 +1197,16 @@ namespace HRM.DA { if (_assignedHeads == null) return; - List Items = _assignedHeads.FindAll(x=>x.EmployeeID == _employee.ID); + List Items = _assignedHeads.FindAll(x => x.EmployeeID == _employee.ID); if (Items == null || Items.Count == 0) return; DateTime fromDate = GlobalFunctions.FirstDateOfMonth(month); DateTime toDate = GlobalFunctions.LastDateOfMonth(month); bool bvalid = false; - IncomeTax basicSalaryItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax basicSalaryItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary - && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary); + && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary); if (basicSalaryItem == null) throw new ServiceException("Basic salary item not found in the collection on " + " calculating Company provided Car/HouseRent of the Employee No:" + _employee.EmployeeNo); @@ -1220,9 +1228,9 @@ namespace HRM.DA #region Calculate Car calculation if (item.HeadID == EnumIncomeTaxHead.Car) { - taxItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID - && x.ItemGroup == EnumIncomeTaxItemGroup.Cmp_Provided_car - && x.ItemID == (int)EnumIncomeTaxItemGroup.Cmp_Provided_car); + taxItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID + && x.ItemGroup == EnumIncomeTaxItemGroup.Cmp_Provided_car + && x.ItemID == (int)EnumIncomeTaxItemGroup.Cmp_Provided_car); if (taxItem == null) taxItem = this.Add(EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car, "Company provided car", 0, 0, EnumIncomeTaxSide.Inc_SalaryIncome); @@ -1241,13 +1249,13 @@ namespace HRM.DA //else tempAmount = basicSalaryItem.ProjectedAmount / _projectedMonth; if (toDate == GlobalFunctions.LastDateOfMonth(toDate)) - taxItem.ProjectedAmount = (tempAmount * (Global.DateFunctions.DateDiff("m", GlobalFunctions.LastDateOfMonth(month).AddDays(1), toDate) + 1) ); + taxItem.ProjectedAmount = (tempAmount * (Global.DateFunctions.DateDiff("m", GlobalFunctions.LastDateOfMonth(month).AddDays(1), toDate) + 1)); else - taxItem.ProjectedAmount = (tempAmount * GlobalFunctions.GetFraction(GlobalFunctions.LastDateOfMonth(month).AddDays(1), toDate)) ; + taxItem.ProjectedAmount = (tempAmount * GlobalFunctions.GetFraction(GlobalFunctions.LastDateOfMonth(month).AddDays(1), toDate)); taxItem.ProjectedAmount = GlobalFunctions.Round(taxItem.ProjectedAmount); - if(taxItem.TotalAmount <120000) + if (taxItem.TotalAmount < 120000) { taxItem.ProjectedAmount = 120000 - (taxItem.PreviousAmount + taxItem.ThisMonthAmount); } @@ -1257,9 +1265,9 @@ namespace HRM.DA #region Calculate House rent calculation if (item.HeadID == EnumIncomeTaxHead.House) { - taxItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + taxItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Cmp_Provided_House - && x.ItemID == (int)EnumIncomeTaxItemGroup.Cmp_Provided_House); + && x.ItemID == (int)EnumIncomeTaxItemGroup.Cmp_Provided_House); if (taxItem == null) taxItem = this.Add(EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House, "Company provided House", 0, 0, EnumIncomeTaxSide.Inc_SalaryIncome); @@ -1270,7 +1278,7 @@ namespace HRM.DA tempAmount = basicSalaryItem.ThisMonthAmount; else { - SalaryMonthlyDetail detail = _salary.Details.FirstOrDefault(x=>x.itemGroupCode == EnumSalaryGroup.Gross + SalaryMonthlyDetail detail = _salary.Details.FirstOrDefault(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Basic_Salary && x.ItemID == (int)EnumSalaryItemCode.Basic_Salary); if (detail == null) continue; tempAmount = detail.ChangedAmount; @@ -1284,7 +1292,7 @@ namespace HRM.DA GlobalFunctions.GetFraction(item.StartDate, (DateTime)gse.TillDate); else { - SalaryMonthlyDetail arreardetail = _salary.Details.FirstOrDefault(x=>x.itemGroupCode == EnumSalaryGroup.Arrear + SalaryMonthlyDetail arreardetail = _salary.Details.FirstOrDefault(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Basic_Salary && x.ItemID == (int)EnumSalaryItemCode.Basic_Salary); if (arreardetail != null) { @@ -1382,7 +1390,7 @@ namespace HRM.DA protected void CalculateTotalIncome() { - IncomeTax salaryIncome = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax salaryIncome = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Annual_Salary_Income && x.ItemID == (int)EnumIncomeTaxItemGroup.Annual_Salary_Income); if (salaryIncome == null) salaryIncome = this.Add(EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); @@ -1412,7 +1420,7 @@ namespace HRM.DA salaryIncome.ThisMonthAmount = GlobalFunctions.Round(salaryIncome.ThisMonthAmount); salaryIncome.ProjectedAmount = GlobalFunctions.Round(salaryIncome.ProjectedAmount); - IncomeTax annualIncome = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax annualIncome = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Annual_Income && x.ItemID == (int)EnumIncomeTaxItemGroup.Annual_Income); if (annualIncome == null) annualIncome = this.Add(EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); @@ -1457,7 +1465,7 @@ namespace HRM.DA if (item.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_Rebate || item.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_Refund || item.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate || - item.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherAddable ) + item.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherAddable) { if (item.Side == EnumIncomeTaxSide.Inc_GrossTax) TotIncome = TotIncome + item.TotalAmount; @@ -1473,9 +1481,9 @@ namespace HRM.DA /// protected void CalculateYearlyRefund() { - IncomeTax oNetTaxPayable = this.CurrentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && - x.ItemGroup == EnumIncomeTaxItemGroup.Net_Payable && x.ItemID == (int)EnumIncomeTaxItemGroup.Net_Payable); - IncomeTax oTaxDeducted = this.CurrentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax oNetTaxPayable = this.CurrentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && + x.ItemGroup == EnumIncomeTaxItemGroup.Net_Payable && x.ItemID == (int)EnumIncomeTaxItemGroup.Net_Payable); + IncomeTax oTaxDeducted = this.CurrentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted); @@ -1488,7 +1496,7 @@ namespace HRM.DA if ((oNetTaxPayable.TotalAmount - oTaxDeducted.TotalAmount) != 0) { - IncomeTax TaxRefund = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax TaxRefund = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Refund_On_Current_Year && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Refund_On_Current_Year); if (TaxRefund == null) TaxRefund = this.Add(EnumIncomeTaxItemGroup.Tax_Refund_On_Current_Year, (int)EnumIncomeTaxItemGroup.Tax_Refund_On_Current_Year, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); @@ -1506,8 +1514,8 @@ namespace HRM.DA } protected void CalculateNetPayable() { - - IncomeTax GrossTax = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + + IncomeTax GrossTax = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Gross_Tax && x.ItemID == (int)EnumIncomeTaxItemGroup.Gross_Tax); if (GrossTax == null) { @@ -1516,7 +1524,7 @@ namespace HRM.DA this.CalculateGrossTax(); - IncomeTax netPayable = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax netPayable = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Net_Payable && x.ItemID == (int)EnumIncomeTaxItemGroup.Net_Payable); if (netPayable == null) netPayable = this.Add(EnumIncomeTaxItemGroup.Net_Payable, (int)EnumIncomeTaxItemGroup.Net_Payable, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); @@ -1527,11 +1535,11 @@ namespace HRM.DA if (GrossTax.TotalAmount > 0) { - IncomeTax InvestItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax InvestItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment); if (InvestItem == null) this.CalculateInvestment(); - - + + netPayable.ProjectedAmount = netPayable.ProjectedAmount + GrossTax.TotalAmount - InvestItem.TotalAmount; @@ -1557,7 +1565,7 @@ namespace HRM.DA } incentive.TotalAmount = GlobalFunctions.Round(incentive.ProjectedAmount); netPayable.ProjectedAmount = netPayable.ProjectedAmount - incentive.TotalAmount; - } + } #endregion @@ -1575,7 +1583,7 @@ namespace HRM.DA protected void CalculateGrossTax() { - IncomeTax GrossTax = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax GrossTax = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Gross_Tax && x.ItemID == (int)EnumIncomeTaxItemGroup.Gross_Tax); if (GrossTax == null) GrossTax = this.Add(EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); @@ -1592,7 +1600,7 @@ namespace HRM.DA { double nAmount = 0; double nTaxAmount = 0; - IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted); if (TaxDeductitem != null) { @@ -1602,7 +1610,7 @@ namespace HRM.DA this.CalculateThisMonth(); - TaxDeductitem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + TaxDeductitem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted); if (TaxDeductitem != null) { @@ -1613,7 +1621,7 @@ namespace HRM.DA protected void UndoDecutedAmount(double nAmount) { - IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted); if (TaxDeductitem != null) TaxDeductitem.ThisMonthAmount = TaxDeductitem.ThisMonthAmount - nAmount; @@ -1624,12 +1632,12 @@ namespace HRM.DA if (_employee.ForeignExPat == true) return 0; - if(this._investmentwithoutpf ==null) + if (this._investmentwithoutpf == null) this._investmentwithoutpf = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "incometax", "investmentwithoutpf"); IncomeTax AnnItem = null; - AnnItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID== _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Annual_Income - && x.ItemID == (int)EnumIncomeTaxItemGroup.Annual_Income); + AnnItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Annual_Income + && x.ItemID == (int)EnumIncomeTaxItemGroup.Annual_Income); double totalIncome = IncomeAmount; //AnnItem.TotalAmount - _onceoffAmount; @@ -1655,14 +1663,14 @@ namespace HRM.DA } if (_isActualInvestment == true) { - IncomeTax ActualInvestment = _currentYearTax.FirstOrDefault(x=>x.EmployeeID== _employee.ID && + IncomeTax ActualInvestment = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Investment_Actual && x.ItemID == (int)EnumIncomeTaxItemGroup.Investment_Actual); if (ActualInvestment == null) ActualInvestment = this.Add(EnumIncomeTaxItemGroup.Investment_Actual, (int)EnumIncomeTaxItemGroup.Investment_Actual, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_Info_Item); - IncomeTax pfItem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF - && x.ItemID == (int)EnumIncomeTaxItemGroup.Company_Contri_PF); + IncomeTax pfItem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF + && x.ItemID == (int)EnumIncomeTaxItemGroup.Company_Contri_PF); investAmount = 0; if (pfItem != null) investAmount = investAmount + (pfItem.TotalAmount * 2); @@ -1703,7 +1711,7 @@ namespace HRM.DA protected void CalculateThisMonth() { - IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted); if (TaxDeductitem == null) TaxDeductitem = this.Add(EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); @@ -1711,7 +1719,7 @@ namespace HRM.DA this.CalculateGrossTax(); this.CalculateNetPayable(); double onceOffTax = 0; - double netPayable = this._currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + double netPayable = this._currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Net_Payable && x.ItemID == (int)EnumIncomeTaxItemGroup.Net_Payable).TotalAmount; double annualIncome = this.GetAnnualIncome(); //double grossTax = IncomeTax.Get(this._currentYearTax, _employee.ID, @@ -1724,11 +1732,11 @@ namespace HRM.DA // if (onceOffTax < 0) onceOffTax = 0; //} double exptionAmount = 0; - var expItem = this._currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && - x.ItemGroup == EnumIncomeTaxItemGroup.AnnualExemption && x.ItemID == + var expItem = this._currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && + x.ItemGroup == EnumIncomeTaxItemGroup.AnnualExemption && x.ItemID == (int)EnumIncomeTaxItemGroup.AnnualExemption); if (expItem != null) exptionAmount = expItem.TotalAmount; - + if (_employee.Status == EnumEmployeeStatus.Discontinued) TaxDeductitem.ThisMonthAmount = netPayable - TaxDeductitem.TotalAmount; else @@ -1796,16 +1804,16 @@ namespace HRM.DA protected double GetTaxAmount(double TaxableIncome) { - + double taxAmount = 0; if (_employee.ForeignExPat == true) { - if ((_employee.JoiningDate - payrolltype.NextPayProcessDate).TotalDays <= 183) return TaxableIncome * .3; + if ((_employee.JoiningDate - payrolltype.NextPayProcessDate).TotalDays <= 183) return TaxableIncome * .3; } List parameterSlabs = new TaxParameterService().CalculateTaxOnSlab(payrolltype, _taxParameter, _employee, TaxableIncome); taxAmount = TaxParameterSlab.GetTotalTaxAmount(parameterSlabs); return taxAmount; - + } //protected void UpdateRawItems(List rawItems, EnumSide nSide) @@ -1970,8 +1978,8 @@ namespace HRM.DA double taxamount = this.GetTaxAmount(income); if (_employee.ForeignExPat == true) return 0; - if(this._investmentwithoutpf ==null) - this._investmentwithoutpf = new SystemConfigarationService().GetconfigBooleanValue( EnumConfigurationType.Logic, "incometax", "investmentwithoutpf"); + if (this._investmentwithoutpf == null) + this._investmentwithoutpf = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "incometax", "investmentwithoutpf"); double investmentCanBeShown = ((taxamount * _taxParameter.MaxInvestPercent) / 100); if (investmentCanBeShown > _taxParameter.MaxInvAmount) investmentCanBeShown = _taxParameter.MaxInvAmount; @@ -1987,7 +1995,7 @@ namespace HRM.DA } if (_isActualInvestment == true) { - IncomeTax ActualInvestment = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax ActualInvestment = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Investment_Actual && x.ItemID == (int)EnumIncomeTaxItemGroup.Investment_Actual); investAmount = ActualInvestment.ThisMonthAmount; } @@ -2009,7 +2017,7 @@ namespace HRM.DA // (int)EnumIncomeTaxItemGroup.Cmp_Provided_car); this.CalculateTotalIncome(); - IncomeTax IncomeWithCar = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax IncomeWithCar = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Annual_Salary_Income && x.ItemID == (int)EnumIncomeTaxItemGroup.Annual_Salary_Income); double dif = 0; @@ -2044,13 +2052,13 @@ namespace HRM.DA { double nAmount = 0; double nTaxAmount = 0; - IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID && + IncomeTax TaxDeductitem = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted); if (TaxDeductitem == null) TaxDeductitem = this.Add(EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); - IncomeTax onetTax = _currentYearTax.FirstOrDefault(x=>x.EmployeeID == _employee.ID + IncomeTax onetTax = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Net_Payable && x.ItemID == (int)EnumIncomeTaxItemGroup.Net_Payable); if (onetTax != null) @@ -2095,9 +2103,9 @@ namespace HRM.DA } public class TaxCalculator : AbstractTaxCalculator { - public TaxCalculator(int taxparamid, int payrolltypeid):base(taxparamid, payrolltypeid) + public TaxCalculator(int taxparamid, int payrolltypeid) : base(taxparamid, payrolltypeid) { - + } public TaxCalculator() : base() { @@ -2116,7 +2124,7 @@ namespace HRM.DA set { if (_taxParameter == null) throw new ServiceException("Taxparameter must set before Employee"); - _taxSlabs = new TaxParameterService().GetEmployeeSlab( payrolltype, + _taxSlabs = new TaxParameterService().GetEmployeeSlab(payrolltype, _taxParameter, value); TaxParameter.SetMinimumTax(value, _taxParameter); @@ -2192,11 +2200,11 @@ namespace HRM.DA try { // if IncomeTax.get() function not return employee order-by wise data, rest of the function will not culculate properly. - List oTaxYearly = new IncomeTaxService().GetPrvYear(nTaxParamterID, this.payrolltype.ID); + List oTaxYearly = new IncomeTaxService().GetPrvYear(nTaxParamterID, this.payrolltype.ID); if (this.payrolltype.TaxParamID == nTaxParamterID) oTaxYearly = new IncomeTaxService().GetByYear(nTaxParamterID, EnumIncomeTaxDataFrom.ProcessTempData, this.payrolltype.ID); else - oTaxYearly = new IncomeTaxService().GetPrvYear(nTaxParamterID,payrolltype.ID); + oTaxYearly = new IncomeTaxService().GetPrvYear(nTaxParamterID, payrolltype.ID); int? nCurrEmployeeid = null; if (oTaxYearly.Count > 0) nCurrEmployeeid = oTaxYearly[0].EmployeeID; _taxParameter = new TaxParameterService().Get((int)nTaxParamterID); @@ -2205,10 +2213,10 @@ namespace HRM.DA while (true) { _employee = oemps.FirstOrDefault(x => x.ID == nCurrEmployeeid); - if(_employee == null) _employee = new EmployeeService().Get((int)nCurrEmployeeid); + if (_employee == null) _employee = new EmployeeService().Get((int)nCurrEmployeeid); _isActualInvestment = true; - this.CurrentYearTax = oTaxYearly.FindAll(x=>x.EmployeeID == nCurrEmployeeid); + this.CurrentYearTax = oTaxYearly.FindAll(x => x.EmployeeID == nCurrEmployeeid); // Initialize the current data. foreach (IncomeTax item in this.CurrentYearTax) oTaxYearly.Remove(item); // Remove from collection @@ -2400,7 +2408,7 @@ namespace HRM.DA if (item.EmployeeID == _employee.ID) this.CurrentYearTax.Add(item); } - if (this.payrolltype.NextPayProcessDate.Month == 7 && this.CurrentYearTax.Count ==0) // if month is july and salary not yet processed then, clear all tax data + if (this.payrolltype.NextPayProcessDate.Month == 7 && this.CurrentYearTax.Count == 0) // if month is july and salary not yet processed then, clear all tax data { bStartMonth = true; _projectedMonth = 12; @@ -2453,13 +2461,13 @@ namespace HRM.DA x.ItemGroup == EnumIncomeTaxItemGroup.Net_Payable && x.ItemID == (int)EnumIncomeTaxItemGroup.Net_Payable); if (netPayable != null) { - + double annualIncome = this.GetAnnualIncome(); - double newGross = this.GetTaxAmount(annualIncome - _onceoffAmount); + double newGross = this.GetTaxAmount(annualIncome - _onceoffAmount); ntaxAmount = newGross - CalculateOnceOfInvestmentAmt(annualIncome - _onceoffAmount); - if (newGross >0 && ntaxAmount < _taxParameter.MinTaxAmount) + if (newGross > 0 && ntaxAmount < _taxParameter.MinTaxAmount) ntaxAmount = _taxParameter.MinTaxAmount; ntaxAmount = ntaxAmount + this.GetTaxRebate(); @@ -2470,7 +2478,7 @@ namespace HRM.DA { ntaxAmount = netPayable.TotalAmount; } - else if (ntpBeforeBonus != null && ntpBeforeBonus.TotalAmount == _taxParameter.MinTaxAmount + else if (ntpBeforeBonus != null && ntpBeforeBonus.TotalAmount == _taxParameter.MinTaxAmount && ntaxAmount == _taxParameter.MinTaxAmount) // tax amount was min_tax { ntaxAmount = 0; @@ -2490,7 +2498,7 @@ namespace HRM.DA ntaxAmount = GlobalFunctions.Round(ntaxAmount); } - if(ntaxAmount> this._onceoffAmount) // if tax amount greater than bonus amount + if (ntaxAmount > this._onceoffAmount) // if tax amount greater than bonus amount { ntaxAmount = this._onceoffAmount; } @@ -2500,7 +2508,7 @@ namespace HRM.DA if (TaxDeductitem == null) TaxDeductitem = this.Add(EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted, string.Empty, 0, 0, EnumIncomeTaxSide.Tax_fixed_Item); - TaxDeductitem.PreviousAmount = TaxDeductitem.PreviousAmount + TaxDeductitem.ThisMonthAmount ; + TaxDeductitem.PreviousAmount = TaxDeductitem.PreviousAmount + TaxDeductitem.ThisMonthAmount; TaxDeductitem.ThisMonthAmount = ntaxAmount; @@ -2686,7 +2694,7 @@ namespace HRM.DA this._projectedMonth = 0; foreach (IncomeTax item in this.CurrentYearTax) { - item.PreviousAmount = item.PreviousAmount + item.ThisMonthAmount; + item.PreviousAmount = item.PreviousAmount + item.ThisMonthAmount; item.ThisMonthAmount = 0; item.ProjectedAmount = 0; } @@ -2702,7 +2710,7 @@ namespace HRM.DA && x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted && x.ItemID == (int)EnumIncomeTaxItemGroup.Tax_Deducted); IncomeTax netPayable = _currentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID && x.ItemGroup == EnumIncomeTaxItemGroup.Net_Payable && x.ItemID == (int)EnumIncomeTaxItemGroup.Net_Payable); - if(TaxDeductitem != null) + if (TaxDeductitem != null) TaxDeductitem.ThisMonthAmount = netPayable.TotalAmount - TaxDeductitem.TotalAmount; return this.CurrentYearTax; } @@ -2812,7 +2820,7 @@ namespace HRM.DA { // if IncomeTax.get() function not return employee order-by wise data, rest of the function will not culculate properly. List oTaxYearly = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessTempData, ptyp.ID); - oTaxYearly = oTaxYearly.OrderBy(x=>x.EmployeeID).ToList(); + oTaxYearly = oTaxYearly.OrderBy(x => x.EmployeeID).ToList(); int? nCurrEmployeeid = null; if (oTaxYearly.Count > 0) nCurrEmployeeid = oTaxYearly[0].EmployeeID; _taxParameter = new TaxParameterService().Get((int)ptyp.TaxParamID); @@ -2838,7 +2846,7 @@ namespace HRM.DA foreach (IncomeTax item in this.CurrentYearTax) { - item.TaxParameterID = (int)ptyp.TaxParamID; + item.TaxParameterID = (int)ptyp.TaxParamID; empTaxCertificates.Add(item); oTaxYearly.Remove(item); } @@ -3192,13 +3200,13 @@ namespace HRM.DA List empsalareis = salareis.FindAll(x => x.EmployeeID == employeeid).ToList(); if (empsalareis != null) { - foreach(var salary in empsalareis) + foreach (var salary in empsalareis) { foreach (var salaryDetail in salary.Details) { if (ItemCode == EnumSalaryItemCode.PF_Contribution || ItemCode == EnumSalaryItemCode.Inc_Tax_Deduction) { - if (salaryDetail.ItemCode == ItemCode && (salaryDetail.itemGroupCode == EnumSalaryGroup.Deductions) + if (salaryDetail.ItemCode == ItemCode && (salaryDetail.itemGroupCode == EnumSalaryGroup.Deductions) && salaryDetail.ItemID == ItemID) { aAmount = aAmount + salaryDetail.ChangedAmount; @@ -3263,7 +3271,7 @@ namespace HRM.DA } else if (mergeDetail.Type == EnumTaxMergeType.Bonus) { - Amount = Amount + BonusPayments.Where(x => x.EmployeeID == _employee.ID + Amount = Amount + BonusPayments.Where(x => x.EmployeeID == _employee.ID && x.BonusID == mergeDetail.ItemID).Sum(x => x.ChangeBonusAmount); } @@ -3291,7 +3299,7 @@ namespace HRM.DA //} return Amount; } - public List TaxReconsiliation(int payrolltypeid, List emps, + public List TaxReconsiliation(int payrolltypeid, List emps, int nTaxParamterID, EnumIncomeTaxDataFrom datafrom) { List salareis = null; @@ -3329,7 +3337,7 @@ namespace HRM.DA else { List allemp = new EmployeeService().GetAllEmps(payrolltypeid); - salareis = new SalaryMonthlyService().GetByDateRange(_taxParameter.FiscalyearDatefrom, _taxParameter.FiscalyearDateTo, payrolltypeid); + salareis = new SalaryMonthlyService().GetByDateRange(_taxParameter.FiscalyearDatefrom, _taxParameter.FiscalyearDateTo, payrolltypeid); emps = new List(); foreach (Employee item in allemp) @@ -3359,16 +3367,16 @@ namespace HRM.DA ProjectedMonths = Convert.ToDouble(0); else ProjectedMonths = GlobalFunctions.GetFraction(this.payrolltype.NextPayProcessDate.AddDays(1), (DateTime)emp.EndOfContractDate); - + } - this.CurrentYearTax =oTaxYearly.FindAll(x=>x.EmployeeID== _employee.ID); + this.CurrentYearTax = oTaxYearly.FindAll(x => x.EmployeeID == _employee.ID); #region Calculate From Salary & Bonus double basicSalary = 0; - IncomeTax HrExption = this.CurrentYearTax.FirstOrDefault(x=>x.EmployeeID== _employee.ID - && x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance + IncomeTax HrExption = this.CurrentYearTax.FirstOrDefault(x => x.EmployeeID == _employee.ID + && x.ItemGroup == EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance); if (HrExption == null) HrExption = this.Add(EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, @@ -3794,7 +3802,7 @@ namespace HRM.DA List bonuspaments = null; List empTaxCertificates = new List(); List oTaxYearly = null; - string inSQL = ""; + string inSQL = ""; List assignedHeads = new ITEmpHeadService().GetWithTaxParam(nTaxParamterID); PayrollType ptype = new PayrollTypeService().Get(payrolltypeid); List empInvestments = new EmployeeTaxInvestmentService().GetAllUsersInfo(nTaxParamterID); @@ -3825,7 +3833,7 @@ namespace HRM.DA if (ptype.TaxParamID == nTaxParamterID) oTaxYearly = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessTempData, payrolltypeid); else - oTaxYearly = new IncomeTaxService().GetPrvYear(nTaxParamterID, payrolltypeid); + oTaxYearly = new IncomeTaxService().GetPrvYear(nTaxParamterID, payrolltypeid); salareis = new SalaryMonthlyService().GetByDateRange(_taxParameter.FiscalyearDatefrom, _taxParameter.FiscalyearDateTo, payrolltypeid); bonuspaments = new BonusProcessService().GetBonusDetailsByEmps(inSQL, _taxParameter.FiscalyearDatefrom, _taxParameter.FiscalyearDateTo, payrolltypeid); @@ -3840,7 +3848,7 @@ namespace HRM.DA if (doconMiddleofYear == true) { - var disconemps = emps.Where(e => (e.EndOfContractDate <= _taxParameter.FiscalyearDateTo) && + var disconemps = emps.Where(e => (e.EndOfContractDate <= _taxParameter.FiscalyearDateTo) && (e.EndOfContractDate >= _taxParameter.FiscalyearDatefrom)).ToList(); filteremps.AddRange(disconemps); } @@ -3848,7 +3856,7 @@ namespace HRM.DA if (liveEmpInYear == true) { // Remove discontinued employees from emps using LINQ - var liveemps = emps.Where(e => !(e.EndOfContractDate <= _taxParameter.FiscalyearDateTo && e.EndOfContractDate >= _taxParameter.FiscalyearDatefrom)).ToList(); + var liveemps = emps.Where(e => !(e.EndOfContractDate <= _taxParameter.FiscalyearDateTo && e.EndOfContractDate >= _taxParameter.FiscalyearDatefrom)).ToList(); filteremps.AddRange(liveemps); } @@ -3858,7 +3866,7 @@ namespace HRM.DA List taxMerges = new TaxMergeMasterService().GetbyTaxParameter(_taxParameter.ID, payrolltypeid); var taxdeductedItem = taxMerges.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted); - if(taxdeductedItem == null) + if (taxdeductedItem == null) { TaxMergeMaster taxMerge = new TaxMergeMaster { @@ -3870,7 +3878,7 @@ namespace HRM.DA Type = EnumTaxMergeType.Deduction, Position = 0 }; - taxMerges.Add(taxMerge); + taxMerges.Add(taxMerge); TaxMergeMaster.TaxMergeDetail taxMergeDetail = new TaxMergeMaster.TaxMergeDetail { @@ -3891,7 +3899,7 @@ namespace HRM.DA { _employee = emp; //employees.FirstOrDefault(x => x.ID.Integer == nCurrEmployeeid.Integer); this.CurrentYearTax = oTaxYearly.FindAll(x => x.EmployeeID == _employee.ID); - + #region Calculate From Salary & Bonus double basicSalary = 0; diff --git a/HRM.UI/ClientApp/src/app/_models/Payroll/adparameter.ts b/HRM.UI/ClientApp/src/app/_models/Payroll/adparameter.ts index 73a986e..6f630b6 100644 --- a/HRM.UI/ClientApp/src/app/_models/Payroll/adparameter.ts +++ b/HRM.UI/ClientApp/src/app/_models/Payroll/adparameter.ts @@ -1,4 +1,4 @@ -import { EnumPeriodicity, EnumAllowOrDeduct, EnumArrearType, EnumADEmpType, EnumValueType, EnumEntitleType, EnumGender, EnumAuthStatus } from "../enums"; +import { EnumPeriodicity, EnumAllowOrDeduct, EnumArrearType, EnumADEmpType, EnumValueType, EnumEntitleType, EnumGender, EnumAuthStatus, EnumAllowanceType } from "../enums"; import { BaseObject } from '../Basic/baseObject'; import { AllowanceDeduction } from '../../_models/HRBasic/allowanceDeduction'; import { SearchEmployee } from '../../_models/Employee/searchEmployee'; @@ -42,6 +42,8 @@ export class ADParameter extends BaseObject this.gradeNames=''; this.adParameterEmployees = []; this.calculatedAmount = 0; + this.allowanceType=EnumAllowanceType.None; + this.isOnBalancing = false; } allowDeductID: number; allowDeductName: string; @@ -71,6 +73,8 @@ export class ADParameter extends BaseObject entitleType: EnumEntitleType; allowOrDeductType: EnumAllowOrDeduct; gender: EnumGender; + allowanceType: EnumAllowanceType; + isOnBalancing: boolean; // public AllowanceDeduction AllowanceDeduction { get; set; } exception: ADParameterEmployee[] =[]; diff --git a/HRM.UI/ClientApp/src/app/_models/enums.ts b/HRM.UI/ClientApp/src/app/_models/enums.ts index 3e2affe..c11837f 100644 --- a/HRM.UI/ClientApp/src/app/_models/enums.ts +++ b/HRM.UI/ClientApp/src/app/_models/enums.ts @@ -1427,6 +1427,14 @@ export enum EnumEntitleType { Individual = 2, } + export enum EnumAllowanceType + { + None = 0, + HouseRent = 1, + Medical = 2, + Conveynce = 3 + } + export enum EnumOpiAvgPayType { NONE = 0, OT = 1, diff --git a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-details/allowance-deduction-parameterization-details.component.html b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-details/allowance-deduction-parameterization-details.component.html index 2ee1720..0eb4ed4 100644 --- a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-details/allowance-deduction-parameterization-details.component.html +++ b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-details/allowance-deduction-parameterization-details.component.html @@ -29,6 +29,11 @@ {{dataItem.isTaxable ? 'Yes' : 'No'}} + + + {{dataItem.isOnBalancing ? 'Yes' : 'No'}} + + diff --git a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html index fe7a1c3..d76ae47 100644 --- a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html +++ b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html @@ -73,6 +73,28 @@ +
+ +
+ + +
+
+
diff --git a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts index 6efe49c..764a37b 100644 --- a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts +++ b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts @@ -11,7 +11,7 @@ import {UntilityHandlerService} from '../../../../utility.hanldler.service'; import {ADParameter, ADParameterGrade, ADParameterEmployee} from '../../../../_models/Payroll/adparameter'; import {AllowanceDeduction} from '../../../../_models/HRBasic/allowanceDeduction'; import {Grade} from '../../../../_models/Basic/grade'; -import {EnumArrearType, EnumADEmpType, EnumExtension, EnumPeriodicity, EnumGender, EnumEntitleType, EnumAllowOrDeduct, EnumValueType, EnumAuthStatus} from '../../../../_models/enums'; +import {EnumArrearType, EnumADEmpType, EnumExtension, EnumPeriodicity, EnumGender, EnumEntitleType, EnumAllowOrDeduct, EnumValueType, EnumAuthStatus, EnumAllowanceType} from '../../../../_models/enums'; import { AuthService } from '../../../../_services/auth/auth.service'; import { PayrollType } from '../../../../_models/Authentication/payrollType'; import { Router } from '@angular/router'; @@ -45,8 +45,16 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit, { name: 'Monthly-Employee-Wise', value: 3 }, { name: 'Once-off', value: 2 }, + ]; + _allowanceTpe = [ + { name: 'None', value: 0}, + { name: 'HouseRent', value: 1 }, + { name: 'Medical', value: 2 }, + { name: 'Conveynce', value: 3 }, + ]; _selectedPeriodicity: number =1; + _selectedAllowanceType: number =0; _gender: any = EnumExtension.getNamesAndValues(EnumGender); _selectedPreiodicity: number; _individualAmount: number=0; @@ -117,6 +125,7 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit, }, () => { this.AllowDeductselectionChange(this._allowDeducts.find(x => x.id == this._adPram.allowDeductID)); + this._selectedAllowanceType = this._adPram.allowanceType ?? EnumAllowanceType.None; if (this._adPram.periodicity == EnumPeriodicity.Monthly && this._adPram.entitleType == EnumEntitleType.Grade) { @@ -142,6 +151,7 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit, this._fromValidator = new FormBuilder().group({ allowOrDeductID: ['', Validators.required], periodicity: ['', Validators.required], + allowancetype: ['', Validators.required], isIndividual: '', flatAmount: '', percentOfBasic: '', @@ -153,6 +163,7 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit, isFractionateApplicable: '', gender: '', isTaxable: '', + isOnBalancing: '', }); } @@ -203,6 +214,23 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit, this.prediocityPopulate(2); } + } + changeallowancetype(item:any) { + if (item.value == 0) { + this._adPram.allowanceType = EnumAllowanceType.None; + } + else if (item.value == 1) { + this._adPram.allowanceType = EnumAllowanceType.HouseRent; + } + else if (item.value == 2) { + + this._adPram.allowanceType = EnumAllowanceType.Medical; + } + else if (item.value == 3) { + + this._adPram.allowanceType = EnumAllowanceType.Conveynce; + } + } IndividualChecked(e) { diff --git a/HRM.UI/appsettings.json b/HRM.UI/appsettings.json index fadd8ef..b164580 100644 --- a/HRM.UI/appsettings.json +++ b/HRM.UI/appsettings.json @@ -52,8 +52,8 @@ //"Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDB;User Id=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", //"SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=autocrop;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", // Development - "Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", - "SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development + "Default": "provider=sql;sqlSyntax=SQL;server=103.197.204.164,1718;Database=MasterProjectDBUATBRAC;User Id= DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;", + "SqlCommandConnection": "Data Source=103.197.204.164,1718;Initial Catalog=MasterProjectDBUATBRAC;Persist Security Info=True; User ID=DBuser;Password=ceLEa&e2025;TrustServerCertificate=True;" // Development }, "Calendar": { -- 2.40.0.windows.1