Exemplo n.º 1
0
        private bool AddTaxInfo(Payslip payslip)
        {
            try
            {
                payslip.HourlyPay = rep.GetHourlyPay(_EmployeeId);

                //Payslip

                /* If hrly is taxable
                 *    1. make it the basic
                 *    2. remove from earnings*/
                if (this.employee.BasicComputation.Equals("H"))
                {
                    this.Basic = payslip.HourlyPay;
                }
                else if (this.employee.BasicComputation.Equals("X"))
                {
                    this.Basic += payslip.HourlyPay;
                }
                else
                {
                }

                payslip.BasicPay = this.Basic + rep.Allowances(_EmployeeId);

                payslip.TotalBenefits = this.NonCashBenefits();
                payslip.Variables     = this.rep.NonTaxableEarnings(_EmployeeId); //these are nontaxable allowances
                payslip.Earnings      = this.Earnings();


                //Payslip summary
                //Tax Details
                payslip.GrossTaxableEarnings = payslip.BasicPay + payslip.TotalBenefits;


                //must have computed grosstabale earning and allowable deductions
                //Nettaxable requires pension to have been added
                payslip.GrossTax = this.GrossTax(payslip.NetTaxableEarnings);

                payslip.PersonalRelief  = this.PersonalRelief();
                payslip.MortgageRelief  = this.MortgageRelief();
                payslip.InsuranceRelief = this.InsuranceRelief();

                //update PAYE deduction that was initially added as a place holder
                foreach (var d in payslip.AllDeductions)
                {
                    if ("PAYE".Equals(d.Description.Trim()))
                    {
                        d.Amount      = payslip.NetTax;
                        d.IsStatutory = true;
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Log.WriteToErrorLogFile(ex);
                return(false);
            }
        }