// GET: Report public ActionResult PickupsByHour() { WebReport webReport = new WebReport(); webReport.Width = 1024; // set width webReport.Height = 800; // set height webReport.ReportFile = this.Server.MapPath("~/App_Data/PickupsByHour.frx"); // load the report from the file ViewBag.WebReport = webReport; // send object to the View return View("ReportViewer"); }
public static WebReport GerarRelatorioMetas(string caminho, DataTable dados) { WebReport relatorio = new WebReport(); DataSet connection = new DataSet(); connection.DataSetName = "Connection"; dados.TableName = "MinhaQuery"; connection.Tables.Add(dados); relatorio.Report.RegisterData(connection); relatorio.ReportFile = caminho; return relatorio; }
// GET: ZipSummary public ActionResult ZipSummary() { WebReport webReport = new WebReport(); webReport.Width = 1024; // set width webReport.Height = 800; // set height webReport.ReportFile = this.Server.MapPath("~/App_Data/ZipDonationSummary.frx"); // load the report from the file ViewBag.WebReport = webReport; // send object to the View return View("AnalyticsViewer"); }
private static void SetupReport(WebReport report) { report.Width = 800; // Unit.Percentage(100); report.Height = 900; // Unit.Percentage(100); report.PdfFitWindow = true; //report.ToolbarIconsStyle = ToolbarIconsStyle.Black; //report.PrintInBrowser = true; //report.PrintInPdf = true; //report.ShowExports = true; //report.ShowPrint = true; //report.SinglePage = true; }
public static WebReport GerarRelatorioOS(int id, string caminho, DataTable dados) { WebReport relatorio = new WebReport(); DataSet connection = new DataSet(); connection.DataSetName = "Connection"; dados.TableName = "MinhaConsulta"; connection.Tables.Add(dados); relatorio.Report.RegisterData(connection); relatorio.Report.SetParameterValue("parametro", id); relatorio.ReportFile = caminho; return relatorio; }
/// <summary> /// 显示要打印的FR /// </summary> /// <param name="reportCode"></param> /// <param name="paramValues">参数数组</param> /// <returns></returns> public ActionResult ShowReport(string reportCode, string paramValues) { WMS_ReportModel entity = m_BLL.GetListByWhere(ref setNoPagerAscById, "ReportCode == \"" + reportCode + "\"").First(); List <WMS_ReportParamModel> listParams = m_ParamBLL.GetListByWhere(ref setNoPagerAscById, "ReportId == " + entity.Id.ToString()) .OrderBy(p => p.Id).ToList(); List <WMS_ReportParamModel> listParamValues = Newtonsoft.Json.JsonConvert.DeserializeObject <List <WMS_ReportParamModel> >(paramValues); foreach (var item in listParamValues) { item.ParamName = item.ParamName.Replace("arg_", "@"); if (listParams.Exists(a => a.ParamName == item.ParamName)) { listParams.First(a => a.ParamName == item.ParamName).DefaultValue = item.DefaultValue; } } ViewBag.Entity = entity; ViewBag.ListParam = listParams; WebReport webReport = new WebReport(); webReport.Width = Unit.Percentage(100); webReport.Height = 600; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.PrintInBrowser = true; webReport.PrintInPdf = true; webReport.ShowExports = true; webReport.ShowPrint = true; webReport.SinglePage = true; DataSet ds = m_BLL.GetDataSource(entity, listParams); //ds = new ReportProvider().GetDataSource(entity, list, orderType, orderNum); string path = Server.MapPath("~/ReportFiles/" + entity.FileName); //if (!FileManager.FileExists(path)) //{ // string template = Server.MapPath("~/Theme/content/report/temp/Report.frx"); // System.IO.File.Copy(template, path, true); //} webReport.Report.Load(path); if (ds != null && ds.Tables != null && ds.Tables.Count > 0) { webReport.Report.RegisterData(ds); for (int i = 0; i < ds.Tables.Count; i++) { webReport.Report.GetDataSource(ds.Tables[i].TableName).Enabled = true; } } webReport.ID = reportCode; ViewBag.WebReport = webReport; return(View("ShowBill")); }
public IActionResult ShowReport() { WebReport WebReport = new WebReport(); WebReport.Width = "1000"; WebReport.Height = "1000"; WebReport.Report.Load("App_Data/Master-Detail.frx"); //Загружаем отчет в объект WebReport System.Data.DataSet dataSet = new System.Data.DataSet(); //Создаем источник данных dataSet.ReadXml("App_Data/nwind.xml"); //Открываем базу данных xml WebReport.Report.RegisterData(dataSet, "NorthWind"); //Регистрируем источник данных в отчете ViewBag.WebReport = WebReport; //передаем отчет во View return(View()); }
public IActionResult Report() { var webReport = new WebReport(); var mssqlDataConnection = new MsSqlDataConnection(); mssqlDataConnection.ConnectionString = _configuration.GetConnectionString("NorthWindConnection"); webReport.Report.Dictionary.Connections.Add(mssqlDataConnection); webReport.Report.Load(Path.Combine(_hostEnvironment.ContentRootPath, "reports", "northwind-categories.frx")); var categories = GetTable <Category>(_northwindContext.Categories, "Categories"); webReport.Report.RegisterData(categories, "Categories"); return(View(webReport)); }
private static void LoadReportByReportFile(WebReport report, string reportFile, IEpsConfiguration config) { var path = GetReportPath(config); var fullName = Path.Combine(path, reportFile); //ODAC if (!FastReport.Utils.RegisteredObjects.IsTypeRegistered(typeof(OracleDataConnection))) { FastReport.Utils.RegisteredObjects.AddConnection(typeof(OracleDataConnection)); } report.Report.Load(fullName); }
public IActionResult Index() { string filepath = TempData["FilePath"] as string; currentReportPath = filepath; RegisteredObjects.AddConnection(typeof(MsSqlDataConnection)); WebReport webReport = new WebReport(); webReport.Report.Load(filepath); ViewBag.WebReport = webReport; ViewBag.ReportName = currentReportPath; return(View()); }
// GET: Report public FileResult GetReport() { ListingUsers listingUsers = new ListingUsers(); var cont = new WindsorContainer(); cont.Install(new CastleWidsorConfiguration()); IMasterGetDataTable masterConnection = cont.Resolve <IMasterGetDataTable>(); ISqlMaster sqlMaster = cont.Resolve <ISqlMaster>(); List <Users> users = masterConnection.GetDataTable(sqlMaster.GetAllColumn()); //string reportName = "MvcAspFastReport.frx"; //string reportPath = $"FastReport/{reportName}"; Stream stream = new MemoryStream(); WebReport webReport = new WebReport(); webReport.Report.Load(this.Server.MapPath("~/FastReport/MvcAspFastReport.frx")); //webReport.ReportFile = this.Server.MapPath("~/FastReport/MvcAspFastReport.frx"); TableObject table = webReport.Report.FindObject("Table1") as TableObject; table.ColumnCount = 4; table.RowCount = users.Count; if (table != null) { for (int row = 0; row < users.Count; row++)// row строка { table[0, row].Text = users[row].id.ToString(); table[1, row].Text = users[row].surname; table[2, row].Text = users[row].name; table[3, row].Text = users[row].patronymicName; table[0, row].Border.Lines = BorderLines.All; table[1, row].Border.Lines = BorderLines.All; table[2, row].Border.Lines = BorderLines.All; table[3, row].Border.Lines = BorderLines.All; } webReport.Report.Prepare(); // сохраняем в нужном формате в поток webReport.Report.Export(new PDFExport(), stream); stream.Position = 0; } return(File(stream, "application/zip", "Report.pdf")); }
public IActionResult BasicReport(string ReportName) { var report = _businessLayer.GetAllReportInfos().Where(x => x.ReportName == ReportName).FirstOrDefault(); string filepath = @"Reports\" + report.ReportPath; RegisteredObjects.AddConnection(typeof(MsSqlDataConnection)); WebReport webReport = new WebReport(); webReport.Report.Load(filepath); ViewBag.ReportTitle = report.ReportName; ViewBag.WebReport = webReport; ViewBag.ReportName = filepath; return(View(report)); }
public override void OnControlLoad(object sender, EventArgs e) { Collection <KeyValuePair <string, object> > list = new Collection <KeyValuePair <string, object> >(); list.Add(new KeyValuePair <string, object>("@transaction_master_id", this.Page.Request["TranId"])); using (WebReport report = new WebReport()) { report.AddParameterToCollection(list); report.AddParameterToCollection(list); report.AutoInitialize = true; report.Path = "~/Modules/Sales/Reports/Source/Sales.CustomerDeliveryNote.xml"; this.Controls.Add(report); } }
public override void OnControlLoad(object sender, EventArgs e) { Collection <KeyValuePair <string, object> > list = new Collection <KeyValuePair <string, object> >(); list.Add(new KeyValuePair <string, object>("@office_id", AppUsers.GetCurrent().View.OfficeId.ToInt())); using (WebReport report = new WebReport()) { report.AutoInitialize = true; report.NoHeader = true; report.AddParameterToCollection(list); report.Path = "~/Modules/Sales/Reports/Source/SalesByOffice.xml"; this.Controls.Add(report); } }
public ActionResult Fr() { WebReport webReport = new WebReport(); string filename = @"F:\fxfile\test.frx"; webReport.Report.Load(filename); webReport.Report.SetParameterValue("Test", "MY"); ViewBag.WebReport = webReport; return(View()); }
public IActionResult ReporteHTML(string NombreReporte, IList <RepParametro> parametros) { FastReport.Utils.Config.WebMode = true; var rep = new WebReport(); var savePath = System.IO.Path.Combine(Startup.entorno.WebRootPath, "Reportes"); var path = $"{savePath}\\{NombreReporte}.frx";//guarda el frm del reporte creado de fast repor rep.Report.Load(path); var str = Resources.JsonStringProvider.GetJson(CultureInfo.CurrentCulture.Name); //idioma rep.Report.Dictionary.Connections[0].ConnectionString = StringProvider.StringGE; rep.Report.Dictionary.Connections[1].ConnectionString = StringProvider.StringEmpresas;// primera conexion rep.Report.Dictionary.Connections[2].ConnectionString = str; foreach (var item in parametros) { rep.Report.SetParameterValue(item.Nombre, item.Valor);// envia por parametro el idempresa a fast report } rep.Report.Prepare(); FastReport.Export.Html.HTMLExport html = new FastReport.Export.Html.HTMLExport(); html.ShowProgress = false; html.SinglePage = true; html.Navigator = false; // Top navigation bar html.EmbedPictures = true; // Embeds images into a document MemoryStream strm = new MemoryStream(); rep.Report.Export(html, strm); rep.Report.Dispose(); html.Dispose(); strm.Position = 0; var res = Encoding.UTF8.GetString(strm.ToArray()); //File(strm.ToArray(), "text/html", $"{NombreReporte}.html"); return(Ok(res)); //using (HTMLExport html = new HTMLExport()) //{ // MemoryStream strm = new MemoryStream(); // rep.Report.Export(html, strm); // return File(strm, "text/html", $"{NombreReporte}.html"); //} }
/// <summary> /// The "Design Report" action. /// </summary> public void DesignReport() { // Get a reference to the parent designer's associated control WebReport webreport = (WebReport)_parent.Component; Report report = new Report(); bool fileBased = false; if (!String.IsNullOrEmpty(webreport.ReportFile)) { string fileName = webreport.ReportFile; fileName = MapPath(webreport.Site, fileName); report.Load(fileName); fileBased = true; } else if (!String.IsNullOrEmpty(webreport.ReportResourceString)) { report.ReportResourceString = webreport.ReportResourceString; } try { RegisterData(webreport, report, webreport.Site); } catch (Exception ex) { using (ExceptionForm form = new ExceptionForm(ex)) { form.ShowDialog(); } return; } using (DesignerForm designerForm = new DesignerForm()) { designerForm.Designer.Report = report; designerForm.Designer.AskSave = fileBased; designerForm.ShowInTaskbar = true; designerForm.ShowDialog(); if (designerForm.Designer.Modified && !fileBased) { string oldValue = webreport.ReportResourceString; webreport.ReportResourceString = report.SaveToStringBase64(); PropertyDescriptorCollection props = TypeDescriptor.GetProperties(webreport); PropertyDescriptor prop = props.Find("ReportResourceString", false); _parent.RaiseComponentChanged(prop, oldValue, webreport.ReportResourceString); } } }
public static string GetPreviewHtml(HttpContext context, string connectionString, string dbType, string query, string id) { string html = ""; try { WebReport webReport = GetPreview(context, connectionString, dbType, query, id); html = webReport.GetHtml().ToHtmlString(); } catch (Exception ex) { Log.Error(ex); } return(html); }
public ActionResult Prepared() { WebReport webReport = new WebReport(); webReport.Width = Unit.Percentage(100); webReport.Height = Unit.Percentage(100); string file = this.Server.MapPath("~/App_Data/Prepared.fpx"); webReport.Report.LoadPrepared(file); webReport.ShowRefreshButton = false; webReport.ReportDone = true; ViewBag.WebReport = webReport; return(View()); }
/// <summary> /// The "Select Data Source" action. /// </summary> public void SelectDataSource() { using (AspSelectDataSourceForm form = new AspSelectDataSourceForm()) { WebReport webreport = (WebReport)_parent.Component; string oldValue = webreport.ReportDataSources; IReferenceService service = GetService(typeof(IReferenceService)) as IReferenceService; form.Init(webreport, service); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { PropertyDescriptorCollection props = TypeDescriptor.GetProperties(webreport); PropertyDescriptor prop = props.Find("ReportDataSources", false); _parent.RaiseComponentChanged(prop, oldValue, webreport.ReportDataSources); } } }
////Print //public ActionResult Report(string ID) //{ // //ReportViewerMVC方式 // var list = SalesOrderDAL.GetReportReturnList("ECO210413003"); // ReportViewer rpv = new ReportViewer();//建立ReportViewer物建 // rpv.ProcessingMode = ProcessingMode.Local; //設定處理模式 // rpv.SizeToReportContent = true; // //rpv.ZoomMode = FullPage;//rpv.AsyncRendering = false//rpvZoomMode = FullPage // //設定RDLC實體位置 // rpv.LocalReport.ReportPath = $"{Request.MapPath(Request.ApplicationPath)}Areas\\Sales\\RDLCReports\\So.rdlc"; // //設定報表資料來源 // rpv.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSource1", list)); // return View(rpv); //} public ActionResult Print(string ID) { WebReport webReport = new WebReport(); //string report_path = AppDomain.CurrentDomain.BaseDirectory; //webReport.ReportFile = this.Server.MapPath("~/App_Data/so.frx"); //从文件中加载报表 string report_path = $"{Request.MapPath(Request.ApplicationPath)}Reports\\so.frx"; var list = SalesOrderDAL.GetReportReturnList(ID); webReport.Report.RegisterData(list, "SoData"); //注冊數據 webReport.Report.Load(report_path); //調用報表模板 webReport.Width = 1024; webReport.Height = 800; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; ViewBag.WebReport = webReport; return(View()); }
public IActionResult ReporteTiposPrecios() { var rep = new WebReport(); var savePath = System.IO.Path.Combine(Startup.entorno.WebRootPath, "Reportes"); var path = $"{savePath}\\Precios.frx"; var strIdioma = Resources.JsonStringProvider.GetJson(CultureInfo.CurrentCulture.Name); rep.Report.Load(path); rep.Report.Dictionary.Connections[0].ConnectionString = StringProvider.StringEmpresas; rep.Report.Dictionary.Connections[1].ConnectionString = strIdioma; rep.ShowToolbar = false; rep.Report.Prepare(); ViewBag.WebReport = rep; return(View()); }
public ActionResult Report() { WebReport webReport = new WebReport { Width = 780, Height = 800 }; var citizens = TempData["citizens"] as List <Citizen>; string report_path = GetReportPath();; System.Data.DataSet CitizenDataSet = citizens.ToDataSet(); webReport.Report.RegisterData(CitizenDataSet, "CitizenDataSet"); webReport.Report.Load(report_path + "InheritedReport.frx"); ViewBag.WebReport = webReport; return(View()); }
public override void OnControlLoad(object sender, EventArgs e) { Collection <KeyValuePair <string, object> > list = new Collection <KeyValuePair <string, object> >(); list.Add(new KeyValuePair <string, object>("@TranCode", this.Page.Request["TranCode"])); using (WebReport report = new WebReport()) { report.AddParameterToCollection(list); report.AddParameterToCollection(list); report.AutoInitialize = true; report.Path = "~/Modules/Inventory/Reports/Source/Inventory.Advice.xml"; this.Controls.Add(report); } }
protected void Page_Init(object sender, EventArgs e) { string validationId = this.Page.Request.QueryString["ValidationId"]; if (string.IsNullOrWhiteSpace(validationId)) { this.DisplayError(Warnings.AccessIsDenied); return; } this.quotation = Data.Public.ApproveQuotation.GetQuotation(validationId); if (this.quotation == null || this.quotation.TranId <= 0) { this.DisplayError(Warnings.AccessIsDenied); return; } if (this.quotation.Accepted) { this.DisplayError(string.Format(Labels.SalesQuotationAlreadyAccepted, this.quotation.AcceptedOn)); return; } string catalog = this.quotation.Catalog; Collection <KeyValuePair <string, object> > list = new Collection <KeyValuePair <string, object> >(); list.Add(new KeyValuePair <string, object>("@non_gl_stock_master_id", this.quotation.TranId)); using (WebReport report = new WebReport()) { report.Catalog = catalog; report.NoHeader = true; report.AddParameterToCollection(list); report.AddParameterToCollection(list); report.AutoInitialize = true; report.Path = "~/Modules/Sales/Reports/Source/Sales.Quotation.xml"; this.Placeholder1.Controls.Add(report); } this.AcceptButton.Text = Titles.Accept; this.AcceptButton.Visible = true; this.AcceptButton.Enabled = this.IsValid(); }
public IActionResult Design() { WebReport WebReport = new WebReport(); WebReport.Width = "1000"; WebReport.Height = "1000"; WebReport.Report.Load("App_Data/Master-Detail.frx"); //Загружаем отчет в объект WebReport System.Data.DataSet dataSet = new System.Data.DataSet(); //Создаем источник данных dataSet.ReadXml("App_Data/nwind.xml"); //Открываем базу данных xml WebReport.Report.RegisterData(dataSet, "NorthWind"); //Регистрируем источник данных в отчете WebReport.Mode = WebReportMode.Designer; //Устанавливаем режим объекта веб отчет - отображение дизайнера WebReport.DesignerLocale = "en"; WebReport.DesignerPath = @"WebReportDesigner/index.html"; //Задаем URL онлайн дизайнера WebReport.DesignerSaveCallBack = @"SampleData/SaveDesignedReport"; //Задаем URL представления для метода сохранения отчета ViewBag.WebReport = WebReport; //передаем отчет во View return(View()); }
public override void OnControlLoad(object sender, EventArgs e) { Collection <KeyValuePair <string, object> > list = new Collection <KeyValuePair <string, object> >(); list.Add(new KeyValuePair <string, object>("@transaction_master_id", this.Page.Request["TranId"])); using (WebReport report = new WebReport()) { report.AddParameterToCollection(list); report.AddParameterToCollection(list); report.RunningTotalText = Titles.RunningTotal; report.Path = "~/Modules/Finance/Reports/Source/Transactions.StockTransaction.xml"; report.AutoInitialize = true; this.Controls.Add(report); } }
protected override void OnParametersSet() { base.OnParametersSet(); Report = Report.FromFile( Path.Combine( directory, string.IsNullOrEmpty(ReportName) ? DEFAULT_REPORT : ReportName)); // Registers the application dataset Report.RegisterData(DataSet, "NorthWind"); UserWebReport = new WebReport { Report = Report }; }
public IActionResult Generate([FromBody] ReportDto query) { string mime = "application/pdf"; //MIME-header with default value string webRootPath = _hostingEnvironment.WebRootPath; //Define the path to the wwwroot folder string reportPath = (webRootPath + "/Report.frx"); //Define the path to the report using (MemoryStream stream = new MemoryStream()) //Create the stream for the report { try { using (DataSet dataSet = new DataSet()) { RegisteredObjects.AddConnection(typeof(MsSqlDataConnection)); WebReport webReport = new WebReport(); MsSqlDataConnection sqlConnection = new MsSqlDataConnection(); sqlConnection.ConnectionString = Configuration.GetConnectionString("DefaultConnection"); sqlConnection.CreateAllTables(); webReport.Report.Dictionary.Connections.Add(sqlConnection); webReport.Report.Load(reportPath); webReport.Report.SetParameterValue("AmostraId", query.AmostraId); for (int i = 0; i < query.Ensaios.Length; i++) { webReport.Report.SetParameterValue($"EnsaioSelecionados{i+1}", query.Ensaios[i]); } webReport.Report.Prepare(); PDFSimpleExport pdfExport = new PDFSimpleExport(); pdfExport.Export(webReport.Report, stream); } //Get the name of resulting report file with needed extension var file = String.Concat($"Laudo-{DateTime.Now}", ".", "pdf"); return(File(stream.ToArray(), mime, file)); // attachment } catch (Exception ex) { throw new AppError(ex.Message); return(new NoContentResult()); } finally { stream.Dispose(); } } }
private void Rapor(int id, string path, string xpath, string baslik) { WebReport rapor = new WebReport(); string str = "SELECT B.OlusturmaTarihi, kr.Adi,br.Adi,B.Konu,B.CevapTarihi,B.CevapMesaji, B.BasvuruYolu, B.Mesaj, B.Tur, B.EPosta, B.Gsm, B.TcId, B.Ip, B.GrupId, B.Durum, B.Ad, B.Soyad,gr.Adi " + " FROM bildirimler B" + " left join kurumlar kr on kr.id=B.KurumId" + " left join birimler br on br.id=B.BirimId" + " left join gruplar gr on gr.id=B.GrupId " + "where B.Id=" + id + ""; var con = new MySqlConnection(WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); var cmd = new MySqlCommand(str, con); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable Tamami = new DataTable(); da.Fill(Tamami); rapor.RegisterData(Tamami, "rapor"); string pdfadi = "Bildirim_" + id; rapor.Report.Load(Server.MapPath(path)); rapor.Report.RegisterData(Tamami, "Tamami"); // rapor.Load("D:/Projeler/idari/cs/KarmedWeb/MerkeziGorusOneri/HastaneOneriWeb/Rapor/rapor.frx"); if (rapor.Report.Prepare()) { var pdfExport = new PDFExport { ShowProgress = false, Subject = "Subject", Title = "Rapor", Compressed = true, AllowPrint = true, EmbeddingFonts = true }; rapor.Report.Export(pdfExport, Server.MapPath(xpath + pdfadi)); pdfExport.Dispose(); string url = @"loadPencere('Rapor/Raporx/Downloader.aspx?dosya={0}','Rapor',1000,500);"; //wr.Report.Print(); X.ResourceManager.AddScript(string.Format(url, pdfadi)); //rapor.Show(); } }
/// <summary> /// 报表设计 /// </summary> /// <returns></returns> public ActionResult Designer(long id = 1) { WMS_ReportModel entity = m_BLL.GetById(id); List <WMS_ReportParamModel> listParam = m_ParamBLL.GetListByWhere(ref setNoPagerAscById, "ReportId == " + id.ToString()) .OrderBy(p => p.Id).ToList(); DataSet ds = m_BLL.GetDataSource(entity, listParam); WebReport webReport = new WebReport(); webReport.Width = Unit.Percentage(100); webReport.Height = 600; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.PrintInBrowser = true; webReport.PrintInPdf = true; webReport.ShowExports = true; webReport.ShowPrint = true; webReport.SinglePage = true; string path = Server.MapPath("~/ReportFiles/" + entity.FileName); //if (!FileManager.FileExists(path)) //{ // string template = Server.MapPath("~/ReportFiles/Temp/Report.frx"); // System.IO.File.Copy(template, path, true); //} webReport.Report.Load(path); if (ds != null && ds.Tables != null && ds.Tables.Count > 0) { webReport.Report.RegisterData(ds); for (int i = 0; i < ds.Tables.Count; i++) { webReport.Report.GetDataSource(ds.Tables[i].TableName).Enabled = true; } } webReport.DesignerPath = "~/WebReportDesigner/index.html"; webReport.DesignReport = true; webReport.DesignScriptCode = true; webReport.DesignerSavePath = "~/ReportFiles/Temp/"; webReport.DesignerSaveCallBack = "~/Report/ReportManager/SaveDesignedReport"; webReport.ID = id.ToString(); ViewBag.WebReport = webReport; return(View()); }
public IActionResult PrintTags() { WebReport webReport = new WebReport(); webReport.Width = "100%"; DataSet d = InitData(); webReport.Report.Load(System.IO.Path.Combine(_env.WebRootPath + "/reports", "tags.frx")); webReport.Report.RegisterData(d, "ItemsDataSet"); webReport.Report.GetDataSource("Items").Enabled = true; (webReport.Report.FindObject("Data1") as DataBand).DataSource = webReport.Report.GetDataSource("Items"); webReport.Report.Prepare(); ViewBag.WebReport = webReport; return(View()); }
public IActionResult ReporteImg(string NombreReporte, IList <RepParametro> parametros) { FastReport.Utils.Config.WebMode = true; var rep = new WebReport(); var savePath = System.IO.Path.Combine(Startup.entorno.WebRootPath, "Reportes"); var path = $"{savePath}\\{NombreReporte}.frx";//guarda el frm del reporte creado de fast repor rep.Report.Load(path); var str = Resources.JsonStringProvider.GetJson(CultureInfo.CurrentCulture.Name); //idioma rep.Report.Dictionary.Connections[0].ConnectionString = StringProvider.StringGE; rep.Report.Dictionary.Connections[1].ConnectionString = StringProvider.StringEmpresas;// primera conexion rep.Report.Dictionary.Connections[2].ConnectionString = str; foreach (var item in parametros) { rep.Report.SetParameterValue(item.Nombre, item.Valor);// envia por parametro el idempresa a fast report } if (rep.Report.Prepare()) { FastReport.Export.Image.ImageExport imgExport = new FastReport.Export.Image.ImageExport(); //imgExport.ShowProgress = false; imgExport.ImageFormat = FastReport.Export.Image.ImageExportFormat.Jpeg; imgExport.SeparateFiles = false; imgExport.Resolution = 300; MemoryStream strm = new MemoryStream(); rep.Report.Export(imgExport, strm); rep.Report.Dispose(); imgExport.Dispose(); strm.Position = 0; return(File(strm, "image/jpeg", $"{NombreReporte}.pdf")); } else { return(null); } }
public static byte[] ExportToHTML(string dt, string reportName, string KIDro) { //RegisteredObjects.AddConnection(typeof(MsSqlDataConnection)); WebReport webR = new WebReport(); /* * MsSqlDataConnection _con = new MsSqlDataConnection(); * _con.ConnectionString = spDAL.connStr; * _con.CreateAllTables(); * webR.Report.Dictionary.Connections.Add(_con); */ string _path = System.IO.Directory.GetCurrentDirectory(); _path = _path + System.IO.Path.DirectorySeparatorChar + "FastReports" + System.IO.Path.DirectorySeparatorChar + reportName + ".frx"; //_path = _path + "\\FastReports\\"+ reportName +".frx"; int m = Int32.Parse(dt.Substring(0, 2)); int y = Int32.Parse(dt.Substring(3, 4)); webR.Report.Load(_path); webR.Report.SetParameterValue("yyyy", y.ToString()); webR.Report.SetParameterValue("mm", m.ToString()); webR.Report.SetParameterValue("idro", KIDro); //webR.dt //webR.ReportName = reportName; webR.Report.Prepare(); webR.ShowExcel2007Export = true; using (MemoryStream ms = new MemoryStream()) { /* * HTMLExport HTMLExport = new HTMLExport(); * //webR.Report.Export(ExportBasee) * HTMLExport.Export(webR.Report, ms); * ms.Flush(); * HTMLExport.Dispose(); */ return(ms.ToArray()); } }
public static WebReport GerarRelatorioListagemOS(string caminho, DataTable dados, IEnumerable<FbParameter> parametros) { WebReport relatorio = new WebReport(); DataSet connection = new DataSet(); connection.DataSetName = "Connection"; dados.TableName = "Query"; connection.Tables.Add(dados); relatorio.Report.RegisterData(connection); foreach (var par in parametros) { if (par != null) { relatorio.Report.SetParameterValue(par.ParameterName.Substring(1, par.ParameterName.Length - 1), par.Value); } } relatorio.ReportFile = caminho; return relatorio; }
private void GerarRelatorioOS(int id, OrdemServicoBUS umOrdemServicoBUS, string query, string pathRelatorio, FbParameter[] parametros) { parametros[0].Value = id; DataTable dtRelatorio = umOrdemServicoBUS.GerarRelatorio(query, parametros); WebReport relatorio = new WebReport(); relatorio = Relatorio.GerarRelatorioOS(id, this.Server.MapPath(pathRelatorio), dtRelatorio); relatorio.Width = 800; relatorio.Height = 1200; ViewBag.Title = "Relatório Ordem de Serviço"; ViewBag.Id = id; ViewBag.Relatorio = relatorio; }
public ActionResult Show() { string ReportNum = WebUtil.GetQueryStringValue<string>("ReportNum", string.Empty); string orderNum = WebUtil.GetQueryStringValue<string>("OrderNum",string.Empty); ReportProvider provider = new ReportProvider(); if (ReportNum.IsEmpty()) { return Redirect("/Report/Manager/List"); } ReportsEntity entity = provider.GetReport(ReportNum); if (entity.IsNull()) { return Redirect("/Report/Manager/List"); } List<ReportParamsEntity> list = provider.GetParams(ReportNum); list = list.IsNull() ? new List<ReportParamsEntity>() : list; string SearchValues = WebUtil.GetQueryStringValue<string>("SearchValues"); SearchValues = SearchValues.UnEscapge(); List<ReportParamsEntity> listParams = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ReportParamsEntity>>(SearchValues); if (!listParams.IsNullOrEmpty()) { foreach (ReportParamsEntity item in listParams) { item.ParamName = item.ParamName.Replace("arg_", "@"); if (list.Exists(a => a.ParamName == item.ParamName)) { list.First(a => a.ParamName == item.ParamName).DefaultValue = item.DefaultValue; } } } ViewBag.Entity = entity; ViewBag.ListParam = list; WebReport webReport = new WebReport(); webReport.Width = Unit.Percentage(100); webReport.Height = 600; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.PrintInBrowser = true; webReport.PrintInPdf = true; webReport.ShowExports = true; webReport.ShowPrint = true; webReport.SinglePage = true; DataSet ds = null; int orderType = 0; if (ReportNum == ResourceManager.GetSettingEntity("InOrder_Template").Value) { orderType = (int)EOrder.InOrder; } else if (ReportNum == ResourceManager.GetSettingEntity("OutOrder_Template").Value) { orderType = (int)EOrder.OutOrder; } ds = new ReportProvider().GetDataSource(entity, list, orderType, orderNum); string path = Server.MapPath("~" + entity.FileName); if (!FileManager.FileExists(path)) { string template = Server.MapPath("~/Theme/content/report/temp/Report.frx"); System.IO.File.Copy(template, path, true); } webReport.Report.Load(path); if (ds != null && ds.Tables != null && ds.Tables.Count > 0) { webReport.Report.RegisterData(ds); for (int i = 0; i < ds.Tables.Count; i++) { webReport.Report.GetDataSource(ds.Tables[i].TableName).Enabled = true; } } webReport.ID = ReportNum; ViewBag.WebReport = webReport; return View(); }
public ActionResult Invoice_tk(int BillingID,int TimeTypeValue) { //int OrderID; int TimeTypeValue; //OrderID = 10; TimeTypeValue = 0;//临时测试用 DataSet dataSet = null; SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 768; // set width webReport.Height = 1366; // set height //读取文件到 MemoryStream FileStream stream = new FileStream(this.Server.MapPath(@"\Report\invoice_tk.frx"), FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 stream.Close(); Report_DataRegister_tk(webReport.Report, BillingID, TimeTypeValue); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport_tk = webReport; // send object to the View return View(); }
// public ActionResult Billing_EAS(string sDate) { SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 8350; // set width19772 webReport.Height = 1366; // set height //读取文件到 MemoryStream FileStream stream = new FileStream(this.Server.MapPath(@"\Report\report_eas.frx"), FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 stream.Close(); Report_DataRegister_Billing_EAS(webReport.Report, sDate); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport = webReport; // send object to the View return View(); }
public ActionResult CreditNotePage_Youhuidan(int BillingID) { //int OrderID; int CreditID; //OrderID = 10; CreditID = 1;//临时测试用 SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 768; // set width webReport.Height = 1366; // set height //读取文件到 MemoryStream FileStream stream = new FileStream(this.Server.MapPath(@"\Report\invoice_credit_youhuidan.frx"), FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 stream.Close(); Report_DataRegister_credit_youhuidan(webReport.Report, BillingID); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport_credit_youhuidan = webReport; // send object to the View return View(); }
//int OrderID, int CreditID public ActionResult Amount_BillType(string startdate, string enddate) { //int OrderID; int CreditID; //OrderID = 10; CreditID = 1;//临时测试用 startdate = startdate + " 00:00:00"; enddate = enddate + " 23:59:59"; SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 768; // set width webReport.Height = 1366; // set height //读取文件到 MemoryStream FileStream stream = new FileStream(this.Server.MapPath(@"\Report\Amout_BillingType.frx"), FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 stream.Close(); Report_DataRegister_Amount_BillType(webReport.Report, startdate, enddate); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport_Amount_BillType = webReport; // send object to the View return View(); }
//int OrderID, int CreditID public ActionResult Tug_ByDay(string startdate, string enddate) { SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 2969; // set width webReport.Height = 4201; // set height //读取文件到 MemoryStream FileStream stream = new FileStream(this.Server.MapPath(@"\Report\report_tugsum_byday.frx"), FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 stream.Close(); Report_DataRegister_Tug_ByDay(webReport.Report, startdate, enddate); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport = webReport; // send object to the View return View(); }
//int OrderID, int CreditID public ActionResult TugNum_ByCustomer(string sDate) { string[] sArray = sDate.Split('-'); int year = Convert.ToInt16(sArray[0]); int month = Convert.ToInt16(sArray[1]); SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 2969; // set width webReport.Height = 4201; // set height //读取文件到 MemoryStream FileStream stream = new FileStream(this.Server.MapPath(@"\Report\report_tugsum_bycustomer.frx"), FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 stream.Close(); Report_DataRegister_TugNum_ByCustomer(webReport.Report, year, month); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport = webReport; // send object to the View return View(); }
public ActionResult OrderList() { DataSet dataSet = null; SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 600; // set width webReport.Height = 800; // set height //webReport.Report.RegisterData(dataSet, "AppData"); // data binding // webReport.ReportFile = this.Server.MapPath("~/Report/orderlist.frx"); // load the report from the file //webReport.ReportFile = this.Server.MapPath("~/Report/test.frx"); //Report_DataRegister(webReport.Report); //读取文件到 MemoryStream FileStream stream = new FileStream(@"D:\WDoc\SRC\SHIPWAY\419\419\TugManagementSystem\Report\orderlist.frx", FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 Report_DataRegister(webReport.Report); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport = webReport; // send object to the View return View(); }
public ActionResult Designer() { string ReportNum = WebUtil.GetQueryStringValue<string>("SnNum", string.Empty); ReportProvider provider = new ReportProvider(); if (ReportNum.IsEmpty()) { return Redirect("/Report/Manager/List"); } ReportsEntity entity = provider.GetReport(ReportNum); if (entity.IsNull()) { return Redirect("/Report/Manager/List"); } List<ReportParamsEntity> list = provider.GetParams(ReportNum); WebReport webReport = new WebReport(); webReport.Width = Unit.Percentage(100); webReport.Height = 600; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black; webReport.PrintInBrowser = true; webReport.PrintInPdf = true; webReport.ShowExports = true; webReport.ShowPrint = true; webReport.SinglePage = true; DataSet ds = null; int orderType = 0; if (ReportNum == ResourceManager.GetSettingEntity("InOrder_Template").Value) { orderType = (int)EOrder.InOrder; } else if (ReportNum == ResourceManager.GetSettingEntity("OutOrder_Template").Value) { orderType = (int)EOrder.OutOrder; } ds = new ReportProvider().GetDataSource(entity, list, orderType, ""); string path = Server.MapPath("~" + entity.FileName); if (!FileManager.FileExists(path)) { string template = Server.MapPath("~/Theme/content/report/temp/Report.frx"); System.IO.File.Copy(template, path, true); } webReport.Report.Load(path); if (ds != null && ds.Tables != null && ds.Tables.Count > 0) { webReport.Report.RegisterData(ds); for (int i = 0; i < ds.Tables.Count; i++) { webReport.Report.GetDataSource(ds.Tables[i].TableName).Enabled = true; } } webReport.DesignerPath = "~/WebReportDesigner/index.html"; webReport.DesignReport = true; webReport.DesignScriptCode = true; webReport.DesignerSavePath = "~/Theme/content/report/temp/"; webReport.DesignerSaveCallBack = "~/Report/Manager/SaveDesignedReport"; webReport.ID = ReportNum; ViewBag.WebReport = webReport; return View(); }
public ActionResult Invoice_Special(int BillingID) { //int BillingID = 38; SetReport(); WebReport webReport = new WebReport(); // create object webReport.Width = 768; // set width webReport.Height = 1366; // set height //读取文件到 MemoryStream FileStream stream = new FileStream(this.Server.MapPath(@"\Report\invoice_special.frx"), FileMode.Open); //MemoryStream stream = new System.IO.MemoryStream(entTemplate.TemplateFileBin); webReport.Report.Load(stream); //从内存加载模板到report中 stream.Close(); Report_DataRegister_special(webReport.Report, BillingID); var reportPage = (FastReport.ReportPage)(webReport.Report.Pages[0]); webReport.Prepare(); ViewBag.WebReport_special = webReport; // send object to the View return View(); }