Exemple #1
0
        public IActionResult Detail(int id)
        {
            var paymentRecord = _payComputationService.GetById(id);

            if (paymentRecord == null)
            {
                return(NotFound());
            }
            var model = new PaymentRecordDetailViewModel()
            {
                Id                  = paymentRecord.Id,
                EmployeeId          = paymentRecord.EmployeeId,
                FullName            = paymentRecord.FullName,
                NiNo                = paymentRecord.NiNo,
                PayDate             = paymentRecord.PayDate,
                PayMonth            = paymentRecord.PayMonth,
                TaxYearId           = paymentRecord.TaxYearId,
                Year                = _payComputationService.GetTaxYearById(paymentRecord.TaxYearId).YearOfTax,
                ContractualHours    = paymentRecord.ContractualHours,
                OvertimeHours       = paymentRecord.OvertimeHours,
                ContractualEarnings = paymentRecord.ContractualEarnings,
                OvertimeRate        = _payComputationService.OvertimeRate(paymentRecord.HourlyRate),
                Tax                 = paymentRecord.Tax,
                NIC                 = paymentRecord.NIC,
                UnionFee            = paymentRecord.UnionFee,
                SLC                 = paymentRecord.SLC,
                TotalEarnings       = paymentRecord.TotalEarnings,
                TotalDeduction      = paymentRecord.TotalDeduction,
                Employee            = paymentRecord.Employee,
                TaxYear             = paymentRecord.TaxYear,
                NetPayment          = paymentRecord.NetPayment,
            };

            return(View(model));
        }
Exemple #2
0
        public IActionResult Detail(int id)                         //We need to create a detail view model, go to models folder and add a class named "PaymentRecordDetailViewModel"
        {
            var paymentRecord = _payComputationService.GetById(id); //In order to display the payment records we need to retrieve the payment record by ID

            if (paymentRecord == null)
            {
                return(NotFound());
            }

            var model = new PaymentRecordDetailviewModel                                        //Next we need our model
            {
                Id                  = paymentRecord.Id,
                EmployeeId          = paymentRecord.EmployeeId,
                FullName            = paymentRecord.FullName,
                NiNo                = paymentRecord.NiNo,
                PayDate             = paymentRecord.PayDate,
                PayMonth            = paymentRecord.PayMonth,
                TaxYearId           = paymentRecord.TaxYearId,
                Year                = _payComputationService.GetTaxYearById(paymentRecord.TaxYearId).YearOfTax,
                TaxCode             = paymentRecord.TaxCode,
                HourlyRate          = paymentRecord.HourlyRate,
                HoursWorked         = paymentRecord.HoursWorked,
                ContractualHours    = paymentRecord.ContractualHours,
                OvertimeHours       = paymentRecord.OvertimeHours,
                OvertimeRate        = _payComputationService.OvertimeRate(paymentRecord.HourlyRate),
                ContractualEarnings = paymentRecord.ContractualEarnings,
                OvertimeEarnings    = paymentRecord.OvertimeEarnings,
                Tax                 = paymentRecord.Tax,
                NIC                 = paymentRecord.NIC,
                UnionFee            = paymentRecord.UnionFee,
                SLC                 = paymentRecord.SLC,
                TotalEarnings       = paymentRecord.TotalEarnings,
                TotalDeduction      = paymentRecord.TotalDeduction,
                Employee            = paymentRecord.Employee,       //This employee is equal to paymentRecord.Employee
                TaxYear             = paymentRecord.TaxYear,
                NetPayment          = paymentRecord.NetPayment,
            };

            return(View(model));
        }