public ActionResult ShowReport(DAL.Models.DAL_M_VendorDD vendordetails) { LogWriter logw = new LogWriter("ValuesController entry"); string uploadPath = System.Configuration.ConfigurationManager.AppSettings["Uploadpath"]; // here is the path where vendorreport file will be saved //string uploadFileName = Path.Combine(Server.MapPath("~/" + uploadPath + "/ "), vendordetails.VendorReportFileName); string uploadFileName = System.Web.HttpContext.Current.Server.MapPath("~/" + uploadPath + "/" + vendordetails.VendorReportFileName); ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.SizeToReportContent = true; viewer.SizeToReportContent = true; viewer.AsyncRendering = true; viewer.LocalReport.ReportPath = "VendorAuthorizationForm.rdlc"; DataTable vdt = createVendorDataTable(vendordetails); ReportDataSource rds = new ReportDataSource("VendorDataSet", vdt); // location ds DataTable ldt = createLocationDataTable(vendordetails); ReportDataSource lds = new ReportDataSource("VendorDataLocDataSet", ldt); viewer.LocalReport.DataSources.Clear(); viewer.LocalReport.DataSources.Add(rds); viewer.LocalReport.DataSources.Add(lds); string retFileName = PDFExport(viewer.LocalReport, uploadFileName, vendordetails.VendorReportFileName); return(Json(retFileName)); }
public DataTable createLocationDataTable(DAL.Models.DAL_M_VendorDD vendordetails) { if (vendordetails.LocationAddressDescList.Count <= 0) { return(null); } DataTable dt = new DataTable(); dt.Clear(); dt.Columns.Add("LocationAddress"); int cnt = 1; foreach (string locadd in vendordetails.LocationAddressDescList) { if (locadd != null && locadd != string.Empty) { DataRow dr = dt.NewRow(); dr["LocationAddress"] = cnt.ToString() + ". " + locadd; cnt++; dt.Rows.Add(dr); } } return(dt); }
public DataTable createVendorDataTable(DAL.Models.DAL_M_VendorDD vendordetails) { DataTable dt = new DataTable(); dt.Clear(); dt.Columns.Add("VendorNumber"); dt.Columns.Add("VendorName"); dt.Columns.Add("ssn"); dt.Columns.Add("DDNotifiEmail"); dt.Columns.Add("AccountType"); dt.Columns.Add("BankAccountNumber"); dt.Columns.Add("BankRoutingNo"); dt.Columns.Add("FinancialIns"); dt.Columns.Add("Signeremail"); dt.Columns.Add("Signername"); dt.Columns.Add("Signerphone"); dt.Columns.Add("Signertitle"); dt.Columns.Add("VendorAttachmentFileName"); dt.Columns.Add("SubmittedDate"); dt.Columns.Add("TotalAttachment"); dt.Columns.Add("ConfirmationNumber"); DataRow dr = dt.NewRow(); dr["VendorNumber"] = vendordetails.Vendorname; dr["VendorName"] = vendordetails.Payeename; dr["ssn"] = getMaskedSSN(vendordetails.Ssn); dr["DDNotifiEmail"] = vendordetails.DDNotifyEmail; if (vendordetails.AccountType == 2) // 1 changes 2 { dr["AccountType"] = "Checking"; } else if (vendordetails.AccountType == 1) { dr["AccountType"] = "Saving"; } else { dr["AccountType"] = "Error"; } dr["BankAccountNumber"] = vendordetails.BankAccountNumber; dr["BankRoutingNo"] = vendordetails.BankRoutingNo; dr["FinancialIns"] = vendordetails.FinancialIns; dr["Signeremail"] = vendordetails.Signeremail; dr["Signername"] = vendordetails.Signername; dr["Signerphone"] = vendordetails.Signerphone; dr["Signertitle"] = vendordetails.Signertitle; dr["VendorAttachmentFileName"] = vendordetails.VendorAttachmentFileName; dr["TotalAttachment"] = "Total: 1"; dr["SubmittedDate"] = "SubmittedDate: " + vendordetails.SubmitDateTime.ToString("g", System.Globalization.CultureInfo.CreateSpecificCulture("en-us")); dr["ConfirmationNumber"] = vendordetails.Confirmation; dt.Rows.Add(dr); return(dt); }