here we are going to demonstrate how to calculate amount in footer . Follow the below steps.
Controller using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Data.Entity; using System.Data; using Microsoft.Reporting.WebForms; using System.IO; using ForumMVC; using ForumMVC.Models; using System.ComponentModel; namespace ForumMVC.Controllers { public class HomeController : Controller { forumEntities1 db = new forumEntities1(); public ActionResult Index() {
return View(); }
public ActionResult PrintPDF() { LocalReport localReport = new LocalReport(); localReport.ReportPath = Server.MapPath("~/Graph.rdlc"); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; DataSet ds = new DataSet(); DataTable dt = new DataTable();
var Result = from c in db.CUSTOMER join o in db.ORDER on c.CUST_ID equals o.CUST_ID join p in db.PRODUCT on o.PRODUCT_ID equals p.PRODUCT_ID select new { Id = c.CUST_ID, Name = c.CUST_NAME, Date = o.ORD_DATE, Product = p.PRODUCT_NAME, Price = p.PRICE }; dt = ConvertToDataTable(Result.Where(m => m.Id < 5).ToList()); ds.Tables.Add(dt); reportDataSource.Value = ds.Tables[0]; localReport.DataSources.Add(reportDataSource);
ReportParameter[] parameters = new ReportParameter[3]; parameters[0] = new ReportParameter("Name", "Anupam Sing"); parameters[1] = new ReportParameter("Number", "7798930674"); parameters[2] = new ReportParameter("Date", DateTime.Now.ToString()); localReport.SetParameters(parameters); string reportType = "PDF"; string mimeType; string encoding; string fileNameExtension;
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
.