public ActionResult Index() { PurchaseSalesReportModel model = new PurchaseSalesReportModel(); model.CurrencyList = PurchaseSalesReportRepository.GetCurrency(); return(View(model)); }
public List <PurchaseSalesReportModel> GetPurchaseList(int?CurrencyID, DateTime?FromDate, DateTime?ToDate) { var Data = entity.Air_GetPurchaseSalesReport(CurrencyID, FromDate, ToDate); List <PurchaseSalesReportModel> SalesPurchaselist = new List <PurchaseSalesReportModel>(); double AdminPurchaseTotal, AdminSalesTotal, BranchpurchaseTotal, BranchSalesTotal, DisPurchaseTotal, DisSalesTotal, AgentPurchaseTotal, AgentSalesTotal; AdminPurchaseTotal = AdminSalesTotal = BranchpurchaseTotal = BranchSalesTotal = DisPurchaseTotal = DisSalesTotal = AgentPurchaseTotal = AgentSalesTotal = 0; foreach (var item in Data) { PurchaseSalesReportModel singleone = new PurchaseSalesReportModel() { BranchName = item.BranchName, DistributorName = item.DistributorName, AgentName = item.AgentName, Ariline = item.Airline, ServiceProvider = item.ServiceProviderName, Sector = item.Sector, AdminPurchase = item.AdminPurchaseAmount, AdminSales = item.AdminSalesAmount, BranchPurchase = item.BranchPurchaseAmount, BranchSales = item.BranchSalesAmount, DistributorPurchase = item.DisPurchaseAmount, DistributorSales = item.DisSalesAmount, AgentPurchase = item.AgentPurchaseAmount, AgentSales = item.AgentSalesAmount }; SalesPurchaselist.Add(singleone); AdminPurchaseTotal += item.AdminPurchaseAmount; AdminSalesTotal += item.AdminSalesAmount ?? 0; BranchpurchaseTotal += item.BranchPurchaseAmount ?? 0; BranchSalesTotal += item.BranchSalesAmount ?? 0; DisPurchaseTotal += item.DisPurchaseAmount ?? 0; DisSalesTotal += item.DisSalesAmount ?? 0; AgentPurchaseTotal += item.AgentPurchaseAmount ?? 0; AgentSalesTotal += item.AgentSalesAmount ?? 0; } PurchaseSalesReportModel last = new PurchaseSalesReportModel(); last.AdminPurchase = AdminPurchaseTotal; last.AdminSales = AdminSalesTotal; last.BranchPurchase = BranchpurchaseTotal; last.BranchSales = BranchSalesTotal; last.DistributorPurchase = DisPurchaseTotal; last.DistributorSales = DisSalesTotal; last.AgentPurchase = AgentPurchaseTotal; last.AgentSales = AgentSalesTotal; SalesPurchaselist.Add(last); return(SalesPurchaselist); }
public ActionResult Index(ExportModel Expmodel, PurchaseSalesReportModel model, FormCollection frm) { model.PurchaseList = PurchaseSalesReportRepository.GetPurchaseList(model.CurrencyID, model.FromDate, model.ToDate); BookedTicketReportController crtBKT = new BookedTicketReportController(); crtBKT.GetExportTypeClicked(Expmodel, frm); if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null)) { try { if (Expmodel.ExportTypeExcel != null) { Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel; } else if (Expmodel.ExportTypeWord != null) { Expmodel.ExportTypeWord = Expmodel.ExportTypeWord; } else if (Expmodel.ExportTypePdf != null) { Expmodel.ExportTypePdf = Expmodel.ExportTypePdf; } int count = 1; var exportData = model.PurchaseList.Select(m => new { SN = count++, Branch_Name = m.BranchName, Distributor_Name = m.DistributorName, Agent_Name = m.AgentName, Service_Provider = m.ServiceProvider, Airline = m.Ariline, Sector = m.Sector, Admin_Purchase = m.AdminPurchase, Admin_Sales = m.AdminSales, Branch_Purchase = m.BranchPurchase, Branch_Sales = m.BranchSales, Distributor_Purchase = m.DistributorPurchase, Distributor_Sales = m.DistributorSales, Agent_Purchase = m.AgentPurchase, Agent_Sales = m.AgentSales }); App_Class.AppCollection.Export(Expmodel, exportData, "Purchase Sales Report"); } catch { } } model.CurrencyList = PurchaseSalesReportRepository.GetCurrency(); return(View(model)); }