public ActionResult SalesReport() { try { var lResult = this.LiReportFacade.bll_SalesReport(DateTime.Now, DateTime.Now).ToListMSales(); Pdfs.PdfReports.GeneratePdfSales(lResult); ViewData["TotalSales"] = Convert.ToInt32(lResult.Sum(x => x.LValuetotal)); return(View(lResult)); }catch (Exception e) { var lList = new List <MReportSales>(); var lModel = new MReportSales { LMessage = e.Message }; lList.Add(lModel); return(View(lList)); } }
public static List <MReportSales> ToListMSales(this List <BoReportSales> pListBoSales) { var lListReport = new List <MReportSales>(); pListBoSales.ForEach(x => { var lReport = new MReportSales() { LCode = x.LCode, LCreationDate = x.LCreationDate, LId = x.LId, LProduct = new MProduct() { LCdProduct = x.LProduct.LCdProduct, LNameProduct = x.LProduct.LNameProduct, LIdProduct = x.LProduct.LIdProduct, LValueSupplier = x.LProduct.LValueSupplier }, LValuetotal = x.LValuetotal, LQty = x.LQty }; lListReport.Add(lReport); }); return(lListReport.OrderBy(o => o.LProduct.LNameProduct).ToList()); }