public ActionResult PurchaseInvoices() { var invoices = _purchasingService.GetPurchaseInvoices(); var model = new Models.ViewModels.Purchases.PurchaseInvoices(); foreach (var invoice in invoices) { var invoiceModel = new Models.ViewModels.Purchases.PurchaseInvoiceListLine() { Id = invoice.Id, No = invoice.No, Date = invoice.Date, Vendor = invoice.Vendor.Party.Name, TotalAmount = invoice.PurchaseInvoiceLines.Sum(a => a.Amount), //IsPaid = invoice.IsPaid(), TotalTax = _taxService.GetPurchaseTaxes(invoice.VendorId.Value, invoice.PurchaseInvoiceLines.AsEnumerable()).Sum(t => t.Value) }; model.PurchaseInvoiceListLines.Add(invoiceModel); } return(View(model)); }
public ActionResult PurchaseInvoices() { var invoices = _purchasingService.GetPurchaseInvoices(); var model = new Models.ViewModels.Purchases.PurchaseInvoices(); foreach(var invoice in invoices) { var invoiceModel = new Models.ViewModels.Purchases.PurchaseInvoiceListLine() { Id = invoice.Id, No = invoice.No, Date = invoice.Date, Vendor = invoice.Vendor.Name, TotalAmount = invoice.PurchaseInvoiceLines.Sum(a => a.Amount), IsPaid = invoice.IsPaid(), TotalTax = _taxService.GetPurchaseTaxes(invoice.VendorId.Value, invoice.PurchaseInvoiceLines.AsEnumerable()).Sum(t => t.Value) }; model.PurchaseInvoiceListLines.Add(invoiceModel); } return View(model); }