private static PayRunInvoiceDetailViewResponse CreateResponse(Payrun payrun, PayRunInvoiceDomain payRunInvoice)
        {
            var result = new PayRunInvoiceDetailViewResponse
            {
                PayRunId     = payrun.Id,
                PayRunNumber = payrun.Number,
                DateCreated  = payrun.DateCreated,
                StartDate    = payrun.StartDate,
                EndDate      = payrun.EndDate,
            };

            var(supplierReclaimsTotal, hackneyReclaimsTotal) = CalculateTotals(payRunInvoice.InvoiceItems);
            var invoiceRes = new PayRunInvoiceResponse
            {
                Id                    = payRunInvoice.Id,
                InvoiceId             = payRunInvoice.InvoiceId,
                CarePackageId         = payRunInvoice.CarePackageId,
                ServiceUserId         = payRunInvoice.ServiceUserId,
                ServiceUserName       = payRunInvoice.ServiceUserName,
                SupplierId            = payRunInvoice.SupplierId,
                SupplierName          = payRunInvoice.SupplierName,
                InvoiceNumber         = payRunInvoice.InvoiceNumber,
                PackageTypeId         = (int)payRunInvoice.PackageType,
                PackageType           = payRunInvoice.PackageType.GetDisplayName(),
                GrossTotal            = decimal.Round(payRunInvoice.GrossTotal, 2),
                NetTotal              = decimal.Round(payRunInvoice.NetTotal, 2),
                SupplierReclaimsTotal = decimal.Round(supplierReclaimsTotal, 2),
                HackneyReclaimsTotal  = decimal.Round(hackneyReclaimsTotal, 2),
                InvoiceStatus         = payRunInvoice.InvoiceStatus,
                AssignedBrokerName    = payRunInvoice.AssignedBrokerName,
                InvoiceItems          = payRunInvoice.InvoiceItems.ToResponse()
            };

            result.Invoice = invoiceRes;

            return(result);
        }
Esempio n. 2
0
 public static PayRunInvoiceResponse ToResponse(this PayRunInvoiceDomain invoice, InvoiceStatus status, decimal supplierReclaimsTotal, decimal hackneyReclaimsTotal)
 {
     return(new PayRunInvoiceResponse
     {
         Id = invoice.Id,
         InvoiceId = invoice.InvoiceId,
         CarePackageId = invoice.CarePackageId,
         ServiceUserId = invoice.ServiceUserId,
         HackneyId = invoice.HackneyId,
         ServiceUserName = invoice.ServiceUserName,
         SupplierId = invoice.SupplierId,
         SupplierName = invoice.SupplierName,
         InvoiceNumber = invoice.InvoiceNumber,
         PackageTypeId = (int)invoice.PackageType,
         PackageType = invoice.PackageType.GetDisplayName(),
         GrossTotal = decimal.Round(invoice.GrossTotal, 2),
         NetTotal = decimal.Round(invoice.NetTotal, 2),
         SupplierReclaimsTotal = decimal.Round(supplierReclaimsTotal, 2),
         HackneyReclaimsTotal = decimal.Round(hackneyReclaimsTotal, 2),
         InvoiceStatus = status,
         AssignedBrokerName = invoice.AssignedBrokerName,
         InvoiceItems = invoice.InvoiceItems.ToResponse()
     });
 }