public ActionResult _SubscriptionDueReportList(DateTime?tillDate, int pageNo = 1, int pageSize = 10, string Location = "") { try { MainViewModel.SubscriberDueViewModel subscriptionViewModel = new MainViewModel.SubscriberDueViewModel(); var suscriberList = reportService.getSuscriberList(tillDate, pageNo, pageSize, Location); var totalsubscriberList = reportService.getSingleTotalSuscriberList(tillDate, Location); ViewBag.DebitSum = totalsubscriberList.SumDebit; ViewBag.CreditSum = totalsubscriberList.SumCredit; ViewBag.AdvanceSum = totalsubscriberList.SumAdvance; ViewBag.DueBalance = totalsubscriberList.SumDueBalance; subscriptionViewModel.suscriberPagedList = new StaticPagedList <MainViewModel.SubscriberDueViewModel>(suscriberList, pageNo, pageSize, (suscriberList.Count == 0) ? 0 : suscriberList.FirstOrDefault().TotalCount); //foreach (var item in customerList) //{ // customerViewModel.customerViewModelList.Add(item); //} return(PartialView(subscriptionViewModel)); } catch (Exception ex) { throw ex; } }
public FileContentResult SubscriptionDueExportToExcel(DateTime?tillDate, int pageNo = 1, int pageSize = 0, string Location = "") { MainViewModel.SubscriberDueViewModel subscriptionViewModel = new MainViewModel.SubscriberDueViewModel(); var suscriberList = reportService.getSuscriberList(tillDate, pageNo, pageSize, Location); var totalsubscriberList = reportService.getSingleTotalSuscriberList(tillDate, Location); var subscriptionDueExcelList = suscriberList.Select(x => new ExcelViewModel.SubscriberDueExcelViewModel() { custNo = x.CustNo, Subsno = x.Subsno, CustomerName = x.CustomerName, CustomerType = x.CustomerType, LocationName = x.LocationName, LedgerName = x.LedgerName, Debit = x.Debit, Credit = x.Credit, Advance = x.Advance, DueBalance = x.DueBalance, Status = x.Status }).ToList(); //var totalsubscriptionDueExcelList = totalsubscriberList.Select(x => new ExcelViewModel.SubscriberDueExcelViewModel() //{ // SumCredit=x.SumCredit, // SumDebit=x.SumDebit, // SumAdvance=x.SumAdvance, // SumDueBalance=x.SumDueBalance //}).(); // var DebitSum = totalsubscriberList.SumDebit; // var CreditSum = totalsubscriberList.SumCredit; //var AdvanceSum = totalsubscriberList.SumAdvance; // var DueBalance = totalsubscriberList.SumDueBalance; decimal[] totals = { totalsubscriberList.SumDebit, totalsubscriberList.SumCredit, totalsubscriberList.SumAdvance, totalsubscriberList.SumDueBalance }; string[] columns = { "Customer No.", "Subscription No.", "Customer Name", "Customer Type", "Location Name", "Ledger Name", "Debit", "Credit", "Advance", "DueBalance", "Status" }; string[] parameterSearch = { "Location.: " + Location, "Effective Date: " + tillDate }; byte[] fileContent = ExcelExportHelper.ExportExcel(subscriptionDueExcelList, parameterSearch, totals, "Subscription Due Report", columns); return(File(fileContent, ExcelExportHelper.ExcelContentType, "Subscription Due Report.xlsx")); }