public void ShowData() { this.ReportViewer1.Reset(); this.ReportViewer1.LocalReport.Dispose(); this.ReportViewer1.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource reportdatsource = new Microsoft.Reporting.WebForms.ReportDataSource(); reportdatsource.Name = "DataSet1"; List <DataManager> dmlist = new List <DataManager>(); List <DataManager> dmlist2 = new List <DataManager>(); if (Session["inspectlist"] != null) { //将session转为集合 dmlist = (List <DataManager>)Session["inspectlist"]; foreach (var v in dmlist) { v.discoverTime2 = v.discoverTime.ToString(); } } reportdatsource.Value = dmlist; this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Models/InspectReport.rdlc"); this.ReportViewer1.LocalReport.DataSources.Add(reportdatsource); this.ReportViewer1.LocalReport.Refresh(); }
public override void render(string sType, Stream st) { var localReport = new Microsoft.Reporting.WebForms.LocalReport(); //rpt.ReportPath = "Rpt01.rdlc"; localReport.EnableExternalImages = true; for (int i = 0; i < this.ds.Tables.Count; i++) { var o = new Microsoft.Reporting.WebForms.ReportDataSource(this.ds.Tables[i].TableName, this.ds.Tables[i]); localReport.DataSources.Add(o); } //string sReportName = Request.QueryString["ReportName"]; System.IO.MemoryStream ms = new System.IO.MemoryStream(this.output); localReport.LoadReportDefinition(ms); // //MemoryStream ms = new MemoryStream(); //file.PostedFile.InputStream.CopyTo(ms); //var byts = ms.ToArray(); //ms.Dispose(); byte[] bytes = localReport.Render(sType); st.Write(bytes, 0, bytes.Length); }
protected void btnDeliveryOrderReport_Click(object sender, EventArgs e) { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); DeliveryOrderReportsTableAdapters.DeliveryOrderReportTableAdapter DOTA = new DeliveryOrderReportsTableAdapters.DeliveryOrderReportTableAdapter(); DOTA.ClearBeforeFill = true; try { DateTime? From = null; DateTime? To = null; From = DateTime.ParseExact(txtDateFrom.Text,"dd/MM/yyyy",null); To = DateTime.ParseExact(txtDateTo.Text,"dd/MM/yyyy",null); rds.Name = "DODataSet"; rds.Value = DOTA.GetData(0, From, To); ReportViewer1.LocalReport.ReportPath = "Reports\\DeliveryReport.rdlc"; //ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { new Microsoft.Reporting.WebForms.ReportParameter("From", txtDateFrom.ToString()) }); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); } catch (Exception ex) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { string cargoCode = Request.QueryString["cargoCode"].ToString().Trim(); string cargoName = Request.QueryString["cargoName"].ToString().Trim(); string modelName = Request.QueryString["modelName"].ToString().Trim(); string specName = Request.QueryString["specName"].ToString().Trim(); string saleStatusStr = Request.QueryString["saleStatusStr"].ToString().Trim(); int saleStatus = -1; if (!string.IsNullOrEmpty(saleStatusStr)) { if (int.TryParse(saleStatusStr, out saleStatus) == false) { saleStatus = -1; } } using (DAL.GoldEntities context = new DAL.GoldEntities()) { List <DAL.proc_WebSelectEachDeptSaleAllocation_Result> resultList = context.proc_WebSelectEachDeptSaleAllocation().ToList <DAL.proc_WebSelectEachDeptSaleAllocation_Result>(); var queryResult = (from r in resultList where r.CargoCode.Contains(cargoCode) && r.CargoName.Contains(cargoName) && r.CargoModel.Contains(modelName) && r.CargoSpec.Contains(specName) && (saleStatus >= 0 ? r.SaleStatus == saleStatus : 1 == 1) select r).ToList(); Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", queryResult); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoCode = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoCode", cargoCode); Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoName = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoName", cargoName); Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoModel = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoModel", modelName); Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoSpec = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoSpec", specName); Microsoft.Reporting.WebForms.ReportParameter ReportParameter_SaleStatus = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_SaleStatus", saleStatus >= 0 ? (saleStatus > 0?"可售":"不可售"): ""); Microsoft.Reporting.WebForms.ReportParameterCollection rpList = new Microsoft.Reporting.WebForms.ReportParameterCollection(); rpList.Add(ReportParameter_CargoCode); rpList.Add(ReportParameter_CargoName); rpList.Add(ReportParameter_CargoModel); rpList.Add(ReportParameter_CargoSpec); rpList.Add(ReportParameter_SaleStatus); ReportViewer1.LocalReport.SetParameters(rpList); ReportViewer1.DataBind(); } } } catch (Exception ex) { lblGridViewMsg.Text = Utility.LogHelper.GetExceptionMsg(ex); } }
// Testing ReportViewer 2015 protected void Page_Load(object sender, System.EventArgs e) { // Basic_SQL.SQL.GetSqlServerTypesDll(@"d:\"); byte[] ba = Portal_Reports.Umzugsmitteilung.GetUmzugsmitteilung(new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.WordOpenXml), "C38CB749-1EEC-4686-9BBA-F627B9C4E8EC", "DE"); return; RenderReport(); return; this.m_Viewer = new Microsoft.Reporting.WebForms.ReportViewer(); EnableFormat("foo"); COR_Reports.ReportFormatInfo formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.WordOpenXml); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Html); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.HtmlFragment); //formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Image); formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.ExcelOpenXml); // this.m_Viewer.LocalReport.ReportPath = System.Web.Hosting.HostingEnvironment.MapPath("~/SimpleTest.rdl"); using (System.IO.Stream reportDefinition = COR_Reports.ReportRepository.GetEmbeddedReport("SimpleTest.rdl")) { this.m_Viewer.LocalReport.LoadReportDefinition(reportDefinition); } Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = "DATA_Columns"; //This refers to the dataset name in the RDLC file string strSQL = @"SELECT TOP 100 * FROM information_schema.columns"; // strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'"); // strSQL = strSQL.Replace("@_in_sprache", "'" + in_sprache.Replace("'", "''") + "'"); rds.Value = Basic_SQL.SQL.GetDataTable(strSQL); strSQL = null; this.m_Viewer.LocalReport.DataSources.Add(rds); Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] result = this.m_Viewer.LocalReport.Render(formatInfo.FormatName, formatInfo.DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); string savePath = @"D:\"; if (!System.StringComparer.OrdinalIgnoreCase.Equals(System.Environment.UserDomainName, "COR")) { savePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); } savePath = System.IO.Path.Combine(savePath, "SimpleTest" + formatInfo.Extension); System.IO.File.WriteAllBytes(savePath, result); } // End Sub Page_Load
protected void Filldata() { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DS_sp_ReportNewPrescription"); rds.Value = GetData(); rvUserLoginInfo.LocalReport.ReportPath = "Reports/RptDoctorNurseUsers.rdlc"; rvUserLoginInfo.LocalReport.DataSources.Clear(); rvUserLoginInfo.LocalReport.DataSources.Add(rds); rvUserLoginInfo.LocalReport.Refresh(); }
public void Add(ReportDataSource pRDS) { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.DataMember = pRDS.DataMember; rds.DataSourceId = pRDS.DataSourceId; rds.Name = pRDS.Name; rds.Value = pRDS.Value; this.mm_Viewer.LocalReport.DataSources.Add(rds); }
private void MostrarReporte(string FechaInicio, string FechaFin) { List<entPersona> Lista = negRepote.Instancia.MejoresClientes(FechaInicio, FechaFin); var origen = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", Lista); ReportViewer1.LocalReport.ReportPath = "Intranet/Reporte1.rdlc"; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(origen); ReportViewer1.LocalReport.Refresh(); }
protected void Page_Load(object sender, System.EventArgs e) { if (this.Page.IsPostBack) { return; } // this.rptViewer.AsyncRendering = false; this.rptViewer.PageNavigation += myPageNavigation; Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = "DataSet1"; //This refers to the dataset name in the RDLC file string strSQL = @"SELECT * FROM T_Benutzer"; // strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'"); // strSQL = strSQL.Replace("@_in_sprache", "'" + in_sprache.Replace("'", "''") + "'"); rds.Value = Basic_SQL.SQL.GetDataTable(strSQL); strSQL = null; using (System.IO.Stream reportDefinition = COR_Reports.ReportRepository.GetEmbeddedReport("PaginationTest.rdl")) { this.rptViewer.LocalReport.LoadReportDefinition(reportDefinition); } // End Using reportDefinition this.rptViewer.LocalReport.DataSources.Add(rds); // this.rptViewer.DataBind(); this.rptViewer.CurrentPage = 3; //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //System.IO.StringWriter stringWriter = new System.IO.StringWriter(sb); //HtmlTextWriter htw = new HtmlTextWriter(stringWriter); //this.rptViewer.RenderControl(htw); //string foo = sb.ToString(); //System.Console.WriteLine(foo); // this.rptViewer.LocalReport.ListRenderingExtensions(); // this.rptViewer.LocalReport.Refresh(); int a = this.rptViewer.LocalReport.GetTotalPages(); // https://stackoverflow.com/questions/10585029/parse-an-html-string-with-js System.Console.WriteLine(a); Context.Response.Flush(); // rs.CurrentPage = 3; // int b = rs.LocalReport.GetTotalPages(); } // End Sub Page_Load
protected void btnStatus_Click(object sender, EventArgs e) { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); FilterbyStatusTableAdapters.DeliveryOrderReportByStatusTableAdapter DORSTA = new FilterbyStatusTableAdapters.DeliveryOrderReportByStatusTableAdapter(); DORSTA.ClearBeforeFill = true; try { } }
private void ClearReport() { ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; var reportDataSource1 = new Microsoft.Reporting.WebForms.ReportDataSource(); reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = new List <Staff>(); ReportViewer1.LocalReport.DataSources.Add(reportDataSource1); ReportViewer1.LocalReport.ReportPath = "Report/VisitorReport.rdlc"; ReportViewer1.LocalReport.Refresh(); }
public static void BindControl(Microsoft.Reporting.WebForms.ReportViewer rv, DataSet data, string name, string virtualRldc) { rv.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = name + "_Table"; rds.Value = data.Tables[0]; Microsoft.Reporting.WebForms.LocalReport r = rv.LocalReport; r.ReportPath = virtualRldc; r.DataSources.Add(rds); }
protected void btnBuscar_Click(object sender, EventArgs e) { try { if (DateTime.Parse(TxtFechaInicio.Text) > DateTime.Parse(TxtFechaFin.Text)) { lblEstatus1.Text = "LA FECHA INICIAL NO PUEDE SER MAYOR A LA FINAL, INTENTE NUEVAMENTE PORFAVOR"; } else { lblEstatus1.Text = ""; gvEstados.Visible = true; gvEstados.DataSourceID = "ObjectTabla"; gvEstados.DataBind(); ObjectDataSource ObjectDataSource1 = new ObjectDataSource("AtencionTemprana.dsReportesTableAdapters.SP_ConteoMunicipioHechosTablaTableAdapter", "GetData"); ObjectDataSource1.SelectParameters.Add("IdUnidad", Session["IdUnidad"].ToString()); ObjectDataSource1.SelectParameters.Add("Fecha1", TxtFechaInicio.Text); ObjectDataSource1.SelectParameters.Add("Fecha2", TxtFechaFin.Text); Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", ObjectDataSource1); DataSet ds2 = GetODS_DS(ObjectDataSource1); if (ds2.Tables.Count == 0) { gvEstados.Visible = false; ReportViewer1.Visible = false; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.Refresh(); lblEstatus1.Text = "NO SE ENCONTRARON REGISTROS PARA EL RANGO DE FECHAS ESPECÍFICADO, INTENTE NUEVAMENTE POR FAVOR"; } else { lblEstatus1.Text = ""; gvEstados.Visible = true; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.ReportPath = "RptMunicipioHechos.rdlc"; ReportViewer1.LocalReport.Refresh(); PGJ.InsertarBitacora(int.Parse(Session["IdUsuario"].ToString()), Session["IP_MAQUINA"].ToString(), HttpContext.Current.Request.Url.AbsoluteUri, 10, "Conteo de denuncias por municipio de hechos, fecha de inicio: " + TxtFechaInicio.Text + " fecha fin: " + TxtFechaFin.Text, int.Parse(Session["IdModuloBitacora"].ToString())); } } } catch (Exception ex) { lblEstatus.Text = ex.Message; lblEstatus1.Text = "INTENTELO NUEVAMENTE"; } }
public IHttpActionResult PrintPackingListExtend(int id, int template) { Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanPrint)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } //GET DATA BLL.ECommercialInvoiceMng bll = new BLL.ECommercialInvoiceMng(); DTO.ECommercialInvoiceMng.PackingListContainerPrintout dtoPrintout = bll.GetPackingListPrintoutData(id, ControllerContext.GetAuthUserId(), out notification); //CREATE PRINTOUT string printoutFileName = string.Empty; if (dtoPrintout != null && dtoPrintout.PackingListPrintouts != null && dtoPrintout.PackingListDetailPrintouts != null) { string reportName = ""; //int? companyID = fwBll.GetCompanyID(ControllerContext.GetAuthUserId()); switch (template) { case 1: reportName = "PackingListPrint_OrangePine.rdlc"; break; default: reportName = "PackingListPrint.rdlc"; break; } Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + reportName; Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoice.Name = "PackingList"; rsInvoice.Value = dtoPrintout.PackingListPrintouts; lr.DataSources.Add(rsInvoice); Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoiceDetail.Name = "PackingListDetail"; rsInvoiceDetail.Value = dtoPrintout.PackingListDetailPrintouts; lr.DataSources.Add(rsInvoiceDetail); printoutFileName = PrintoutHelper.BuildPrintoutFile(lr, "PDF"); } return(Ok(new Library.DTO.ReturnData <string>() { Data = printoutFileName, Message = notification })); }
private void ObtenerReporte(string tipo) { int estado = 1; int.TryParse(ddlEstado.SelectedItem.Value, out estado); string proveedor = txbProveedor.Text.Trim().Replace('\'', ' '); string sucursal = txbSucursal.Text.Trim().Replace('\'', ' '); string flujoon = txbFlujoOnbase.Text.Trim().Replace('\'', ' '); string placa = txbPlaca.Text.Trim().Replace('\'', ' '); DateTime fechai = DateTime.ParseExact(txbFechaDesde.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); DateTime fechaf = DateTime.ParseExact(txbFechaHasta.Text, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture); ReportViewerLiquidacion.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewerLiquidacion.LocalReport.ReportPath = "Reportes/RepFormularioGestionLiquidacion.rdlc"; DatosReportes reportes = new DatosReportes(); Microsoft.Reporting.WebForms.ReportDataSource datasource = new Microsoft.Reporting.WebForms.ReportDataSource("GestionLiquidacionDS", reportes.ObtenerDatosGrilla( estado, proveedor, sucursal, flujoon, placa, fechai, fechaf)); ReportViewerLiquidacion.LocalReport.DataSources.Clear(); ReportViewerLiquidacion.LocalReport.DataSources.Add(datasource); //Configuracion de pagina /*System.Drawing.Printing.PageSettings pagina = new System.Drawing.Printing.PageSettings(); * pagina.Landscape = true; * pagina.PaperSize = new System.Drawing.Printing.PaperSize("Carta", 1100, 850); * pagina.PaperSize.RawKind = (int)System.Drawing.Printing.PaperKind.Letter; * pagina.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0); * ReportViewerLiquidacion.SetPageSettings(pagina);*/ //Exportar reporte Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string nombre = "LBCGestionLiquidacion"; string extension = (tipo == "xls") ? "xls" : "pdf"; string deviceinfo = string.Format("<DeviceInfo><PageHeight>{0}</PageHeight><PageWidth>{1}</PageWidth><MarginBottom>{2}</MarginBottom><MarginLeft>{3}</MarginLeft><MarginRight>{3}</MarginRight><MarginTop>{2}</MarginTop></DeviceInfo>", "8.5in", "13in", "0in", "0.1in"); byte[] bytes = (tipo == "xls") ? ReportViewerLiquidacion.LocalReport.Render("Excel", deviceinfo, out mimeType, out encoding, out extension, out streamIds, out warnings) : ReportViewerLiquidacion.LocalReport.Render("PDF", deviceinfo, out mimeType, out encoding, out extension, out streamIds, out warnings); Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=" + nombre + "." + extension); Response.BinaryWrite(bytes); Response.Flush(); }
public void ShowData() { this.ReportViewer1.Reset(); this.ReportViewer1.LocalReport.Dispose(); this.ReportViewer1.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource reportdatsource = new Microsoft.Reporting.WebForms.ReportDataSource(); reportdatsource.Name = "SolveRpt"; List <DataEliminate> list = new List <DataEliminate>(); List <DataEliminate> dmlist = new List <DataEliminate>(); if (Session["solvelist"] != null) { //将session转为集合 list = (List <DataEliminate>)Session["solvelist"]; foreach (var v in list) { DataEliminate dmm = new DataEliminate(); dmm.solveTaskCode = v.solveTaskCode; dmm.solveTaskName = v.solveTaskName; dmm.lineCode = v.lineCode; dmm.poleCode = v.poleCode; dmm.startPoleCode = v.startPoleCode; dmm.endPoleCode = v.endPoleCode; dmm.bugLevelName = v.bugLevelName; dmm.bugTypeName = v.bugTypeName; if (v.isBug == 1) { dmm.BugName = "有"; } else { dmm.BugName = "无"; } dmm.finishTime2 = v.finishTime.ToString(); dmm.discoverTime2 = v.discoverTime.ToString(); dmm.bugDesc = v.bugDesc; dmlist.Add(dmm); } } reportdatsource.Value = dmlist; this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Models/SolveReport.rdlc"); this.ReportViewer1.LocalReport.DataSources.Add(reportdatsource); this.ReportViewer1.LocalReport.Refresh(); }
// Testing ReportViewer 2015 protected void Page_Load(object sender, System.EventArgs e) { // Basic_SQL.SQL.GetSqlServerTypesDll(@"d:\"); byte[] ba = Portal_Reports.Umzugsmitteilung.GetUmzugsmitteilung(new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.WordOpenXml), "C38CB749-1EEC-4686-9BBA-F627B9C4E8EC", "DE"); return; RenderReport(); return; this.m_Viewer = new Microsoft.Reporting.WebForms.ReportViewer(); EnableFormat("foo"); COR_Reports.ReportFormatInfo formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.WordOpenXml); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Html); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.HtmlFragment); //formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Image); formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.ExcelOpenXml); // this.m_Viewer.LocalReport.ReportPath = System.Web.Hosting.HostingEnvironment.MapPath("~/SimpleTest.rdl"); using (System.IO.Stream reportDefinition = COR_Reports.ReportRepository.GetEmbeddedReport("SimpleTest.rdl")) { this.m_Viewer.LocalReport.LoadReportDefinition(reportDefinition); } Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = "DATA_Columns"; //This refers to the dataset name in the RDLC file string strSQL = @"SELECT TOP 100 * FROM information_schema.columns"; // strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'"); // strSQL = strSQL.Replace("@_in_sprache", "'" + in_sprache.Replace("'", "''") + "'"); rds.Value = Basic_SQL.SQL.GetDataTable(strSQL); strSQL = null; this.m_Viewer.LocalReport.DataSources.Add(rds); Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] result = this.m_Viewer.LocalReport.Render(formatInfo.FormatName, formatInfo.DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); string savePath = @"D:\"; if (!System.StringComparer.OrdinalIgnoreCase.Equals(System.Environment.UserDomainName, "COR")) savePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); savePath = System.IO.Path.Combine(savePath, "SimpleTest" + formatInfo.Extension); System.IO.File.WriteAllBytes(savePath, result); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/reportes/reporteProveedores.rdlc"); listaProveedor = _gestorProveedor.leer_proveedor(); IEnumerable <BE.Proveedor> ie; ie = listaProveedor.AsQueryable(); Microsoft.Reporting.WebForms.ReportDataSource datasource = new Microsoft.Reporting.WebForms.ReportDataSource("proveedor", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource); } }
public static byte[] RenderReport(DataSet data, string name, string type) { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = name + "_Table"; rds.Value = data.Tables[0]; string virtualRdlc = BuildRDLC(data, name); Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = HttpContext.Current.Server.MapPath(virtualRdlc); lr.DataSources.Add(rds); return(RenderReport(lr, name, type)); }
protected void Page_Load(object sender, EventArgs e) { this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; System.Data.DataTable dt = null; Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("COR_Basic", dt); // rds.Name = "COR_Basic"; // rds.Value = dt; Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.DataSources.Add(rds); lr.ReportPath = "bla.rdlc"; byte[] mybytes = lr.Render("WORD"); }
} // End Sub Page_Load protected static void RenderReport() { Microsoft.Reporting.WebForms.ReportViewer m_Viewer = new Microsoft.Reporting.WebForms.ReportViewer(); // EnableFormat("foo"); COR_Reports.ReportFormatInfo formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.WordOpenXml); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Html); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.HtmlFragment); //formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Image); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.ExcelOpenXml); using (System.IO.Stream reportDefinition = COR_Reports.ReportRepository.GetEmbeddedReport("TestReport.rdl")) { m_Viewer.LocalReport.LoadReportDefinition(reportDefinition); } Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = "DataSet1"; //This refers to the dataset name in the RDLC file string strSQL = @"SELECT TOP 10 * FROM T_Benutzer"; // strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'"); // strSQL = strSQL.Replace("@_in_sprache", "'" + in_sprache.Replace("'", "''") + "'"); rds.Value = Basic_SQL.SQL.GetDataTable(strSQL); strSQL = null; m_Viewer.LocalReport.DataSources.Add(rds); Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] result = m_Viewer.LocalReport.Render(formatInfo.FormatName, formatInfo.DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); string savePath = @"D:\"; if (!System.StringComparer.OrdinalIgnoreCase.Equals(System.Environment.UserDomainName, "COR")) { savePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); } savePath = System.IO.Path.Combine(savePath, "SimpleTest" + formatInfo.Extension); System.IO.File.WriteAllBytes(savePath, result); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ReportViewer1.LocalReport.ReportPath = "ReporteListaResidencias.rdlc"; List <DatosContacto> datos = new ws.WSEmpresas().getAllEmpresas(); datos.Add(new DatosContacto { nombre = "nueva", domicilio = "nueva" }); Microsoft.Reporting.WebForms.ReportDataSource rds1 = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", datos); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds1); ReportViewer1.LocalReport.Refresh(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ReportViewer1.LocalReport.ReportPath = @"C:\Users\Administrator\Documents\Visual Studio 2012\Projects\WindowsReport\WindowsReport\Report1.rdlc"; this.ReportViewer1.LocalReport.DataSources.Clear(); //这里的MyDataSet1与Report所绑定的数据库命名需一致 //而后DataTable的TableName需和数据源所对应的表名一致 var source = new Microsoft.Reporting.WebForms.ReportDataSource("MyDataSet1", new StudentCourseData().GetDataTable()); this.ReportViewer1.LocalReport.DataSources.Add(source); this.ReportViewer1.LocalReport.Refresh(); } ////this.ReportViewer1.LocalReport.ReportPath = @"C:\Users\Administrator\Documents\Visual Studio 2012\Projects\WindowsReport\WindowsReport\MircrosoftReport.rdlc"; //this.ReportViewer1.LocalReport.Refresh(); }
//Rishu for RDLC #region rdlc private void ProcessRdlReport(string _DataSetName, DataSet _DataSetRdl, string _ReportPath) { try { this.reportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; //this.reportViewer1.LocalReport.ReportPath = _ReportPath; this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.ReportPath = _ReportPath; Microsoft.Reporting.WebForms.ReportDataSource _DataSource = new Microsoft.Reporting.WebForms.ReportDataSource(_DataSetName, _DataSetRdl.Tables[0]); this.reportViewer1.LocalReport.DataSources.Add(_DataSource); this.reportViewer1.LocalReport.Refresh(); } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { //int siteId = int.Parse(Request.QueryString["SiteId"]); int plantId = int.Parse(Request.QueryString["PlantId"]); //int lineId = int.Parse(Request.QueryString["LineId"]); // DateTime startDate = DateTime.Now.AddDays(-40); //DateTime endDate = DateTime.Now; string year = Request.QueryString["year"]; IndentReportService _IndentReportService = new IndentReportService(); //List<Services.Models.BreakDownMonthlySummaryDataSet> dataSource = _breakDownReportService.GetBreakdownDataGroupByType(1, plantId, 12, startDate, endDate); List <Services.Models.IndentReportDataSet> dataSource = _IndentReportService.GetIssuedIndentDetail(plantId, year); //new DateTime(dateTime.Year, dateTime.Month, 1) if (dataSource.Count > 0) { rvSiteMapping.Visible = true; pnlNoData.Visible = false; String reportFolder = System.Configuration.ConfigurationManager.AppSettings["SSRSReportsFolder"].ToString(); rvSiteMapping.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; Microsoft.Reporting.WebForms.ReportDataSource datasrc = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource); datasrc.Name = "DataSet1"; //datasrc.DataSourceId= rvSiteMapping.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource)); } else { rvSiteMapping.Visible = false; pnlNoData.Visible = true; Microsoft.Reporting.WebForms.ReportDataSource datasrc = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource); datasrc.Name = "DataSet1"; rvSiteMapping.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", dataSource)); } rvSiteMapping.LocalReport.Refresh(); } catch (Exception ex) { } } }
private void LoadData() { List <Staff> list = null; string client = User.Identity.Name; if (ddlDept.SelectedItem == null) { return; } if (ddlDevice.SelectedItem == null) { return; } string dpt = ddlDept.SelectedItem.Value.ToString(); string dev = ddlDevice.SelectedItem.Value.ToString(); if (User.IsInRole("Admin")) { list = db.Staffs .Where(_ => _.deptName == dpt) .Where(_ => _.emerPer == dev) .OrderByDescending(_ => _.ORDER_BY_DERIVED_0).ToList(); } else { list = db.Staffs .Where(_ => _.job == client) .Where(_ => _.deptName == dpt) .Where(_ => _.emerPer == dev) .OrderByDescending(_ => _.ORDER_BY_DERIVED_0).ToList(); // list = db.Staffs.OrderByDescending(_ => _.ORDER_BY_DERIVED_0).ToList(); } ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; var reportDataSource1 = new Microsoft.Reporting.WebForms.ReportDataSource(); reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = list; ReportViewer1.LocalReport.DataSources.Add(reportDataSource1); ReportViewer1.LocalReport.ReportPath = "Report/VisitorReport.rdlc"; ReportViewer1.LocalReport.Refresh(); }
/// <summary> /// Get the collection of web form report data sources. /// </summary> /// <param name="reportBindingSource">The report binding source collection.</param> /// <returns>The report data source collection</returns> public static Microsoft.Reporting.WebForms.ReportDataSource[] WebFormsReportDataSource(Nequeo.Model.DataSource.BindingSourceData[] reportBindingSource) { // Create a new generic report data source Microsoft.Reporting.WebForms.ReportDataSource[] reportDataSource = new Microsoft.Reporting.WebForms.ReportDataSource[reportBindingSource.Length]; for (int i = 0; i < reportBindingSource.Length; i++) { reportDataSource[i] = new Microsoft.Reporting.WebForms.ReportDataSource() { Name = reportBindingSource[i].DataSourceName, Value = reportBindingSource[i].DataSource } } ; // Return the report data source collection. return(reportDataSource); }
public void CallReportEstaciones(string Fecha, string protocolo) { ReporteDataSet rpdset = new ReporteDataSet(); rpdset.EnforceConstraints = false; ReporteDataSetTableAdapters.spReporteEstacionesTableAdapter spAdapterEst = new ReporteDataSetTableAdapters.spReporteEstacionesTableAdapter(); RptVwrEstacion.Reset(); RptVwrEstacion.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; RptVwrEstacion.LocalReport.ReportPath = "Reportes/ReportEstaciones.rdlc"; RptVwrEstacion.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource DataSourseRp = new Microsoft.Reporting.WebForms.ReportDataSource(); DataSourseRp.Name = "EstDataSet"; DataSourseRp.Value = rpdset.spReporteEstaciones; spAdapterEst.Fill(rpdset.spReporteEstaciones, Fecha, protocolo); RptVwrEstacion.LocalReport.DataSources.Add(DataSourseRp); RptVwrEstacion.LocalReport.Refresh(); }
protected static void RenderReport() { Microsoft.Reporting.WebForms.ReportViewer m_Viewer = new Microsoft.Reporting.WebForms.ReportViewer(); // EnableFormat("foo"); COR_Reports.ReportFormatInfo formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.WordOpenXml); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Html); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.HtmlFragment); //formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Image); // formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.ExcelOpenXml); using (System.IO.Stream reportDefinition = COR_Reports.ReportRepository.GetEmbeddedReport("TestReport.rdl")) { m_Viewer.LocalReport.LoadReportDefinition(reportDefinition); } Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = "DataSet1"; //This refers to the dataset name in the RDLC file string strSQL = @"SELECT TOP 10 * FROM T_Benutzer"; // strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'"); // strSQL = strSQL.Replace("@_in_sprache", "'" + in_sprache.Replace("'", "''") + "'"); rds.Value = Basic_SQL.SQL.GetDataTable(strSQL); strSQL = null; m_Viewer.LocalReport.DataSources.Add(rds); Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] result = m_Viewer.LocalReport.Render(formatInfo.FormatName, formatInfo.DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); string savePath = @"D:\"; if (!System.StringComparer.OrdinalIgnoreCase.Equals(System.Environment.UserDomainName, "COR")) savePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory); savePath = System.IO.Path.Combine(savePath, "SimpleTest" + formatInfo.Extension); System.IO.File.WriteAllBytes(savePath, result); }
private void LoadData() { List <AccessRecord> list = null; string client = User.Identity.Name; DateTime dtF = DateTime.Now; DateTime dtT = DateTime.Now.AddDays(1); if (!string.IsNullOrEmpty(dtFrom.Text)) { dtF = Convert.ToDateTime(dtFrom.Text); } if (!string.IsNullOrEmpty(dtTo.Text)) { dtT = Convert.ToDateTime(dtTo.Text).AddDays(1); } if (User.IsInRole("Admin")) { list = db.AccessRecords .Where(_ => _.recordTime >= dtF.Date) .Where(_ => _.recordTime <= dtT.Date).OrderByDescending(_ => _.recordTime).ToList(); } else { list = (from d in db.Devices join acc in db.AccessRecords on d.sn equals acc.sn where d.client == User.Identity.Name select acc).Where(_ => (_.recordTime >= dtF.Date && _.recordTime <= dtT.Date)).ToList(); } ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.EnableExternalImages = true; var reportDataSource1 = new Microsoft.Reporting.WebForms.ReportDataSource(); reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = list; ReportViewer1.LocalReport.DataSources.Add(reportDataSource1); ReportViewer1.LocalReport.ReportPath = "Report/AccessRecord.rdlc"; ReportViewer1.LocalReport.Refresh(); }
protected void uiLinkButtonGetReport_Click(object sender, EventArgs e) { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); GetPilotScheduleTableAdapter ta = new GetPilotScheduleTableAdapter(); rds.Name = "ScheduleDataSet"; ta.ClearBeforeFill = true; try { CultureInfo provider = CultureInfo.InvariantCulture; provider = new CultureInfo("fr-FR"); DateTime? From = null; DateTime? To = null; if (!string.IsNullOrEmpty(uiTextBoxFrom.Text)) { From = DateTime.ParseExact(uiTextBoxFrom.Text, "dd/MM/yyyy", provider); } if (!string.IsNullOrEmpty(uiTextBoxTo.Text)) { To = DateTime.ParseExact(uiTextBoxTo.Text, "dd/MM/yyyy", provider); } Pilot current = new Pilot(); current.GetPilotByUserName(Page.User.Identity.Name); if(current.RowCount > 0 ) rds.Value = ta.GetData(current.PilotID, From, To); else rds.Value = ta.GetData(0, From, To); } catch (Exception ex) { throw; } uiReportViewer.LocalReport.DataSources.Clear(); uiReportViewer.LocalReport.DataSources.Add(rds); //uiReportViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("From", uiTextBoxFrom.Text)); //uiReportViewer.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("To", uiTextBoxTo.Text)); uiReportViewer.LocalReport.Refresh(); }
protected void Page_Load(object sender, EventArgs e) { dsViewVendasTableAdapters.VendasTableAdapter tableAdapter = new dsViewVendasTableAdapters.VendasTableAdapter(); dsViewVendas.VendasDataTable dataTable = new dsViewVendas.VendasDataTable(); dataTable.Merge(tableAdapter.MeuSelect()); DataSet ds = new DataSet(); DataTable t = dataTable; Microsoft.Reporting.WebForms.ReportDataSource item = new Microsoft.Reporting.WebForms.ReportDataSource(); item.Name = "dsViewVendas_VendasTableAdapter"; item.Value = dataTable; rv.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; rv.LocalReport.ReportPath = Server.MapPath("~/Report2.rdlc"); //rv.LocalReport.DataSources.Add(item); rv.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("dsViewVendas_VendasDataTable", (DataTable)dataTable)); rv.DataBind(); GridView1.DataSource = dataTable; GridView1.DataBind(); }
public IHttpActionResult PrintCreditNote(int id, string fileTypeID) { Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanPrint)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } //GET DATA BLL.CreditNoteMng bll = new BLL.CreditNoteMng(); DTO.ECommercialInvoiceMng.InvoiceContainerPrintout dtoPrintout = bll.GetCreditNotePrintout(id, ControllerContext.GetAuthUserId(), out notification); //CREATE PRINTOUT string printoutFileName = string.Empty; if (dtoPrintout != null && dtoPrintout.Invoices != null && dtoPrintout.InvoiceDetails != null) { Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + "CreditNotePrint.rdlc"; Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoice.Name = "Invoice"; rsInvoice.Value = dtoPrintout.Invoices; lr.DataSources.Add(rsInvoice); Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoiceDetail.Name = "InvoiceDetail"; rsInvoiceDetail.Value = dtoPrintout.InvoiceDetails; lr.DataSources.Add(rsInvoiceDetail); printoutFileName = PrintoutHelper.BuildPrintoutFile(lr, fileTypeID); } return(Ok(new Library.DTO.ReturnData <string>() { Data = printoutFileName, Message = notification })); }
public void CallReport(long FechaIni, long FechaFin, bool Lmbr, bool Est, bool Estr) { ReporteDataSet rp = new ReporteDataSet(); rp.EnforceConstraints = false; ReporteDataSetTableAdapters.spReporteMedicionesTableAdapter spAdapter = new ReporteDataSetTableAdapters.spReporteMedicionesTableAdapter(); ReportViewer1.Reset(); ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = "Reportes/ReportMediciones.rdlc"; ReportViewer1.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource DataSourseRepo = new Microsoft.Reporting.WebForms.ReportDataSource(); DataSourseRepo.Name = "ReportDataSet"; DataSourseRepo.Value = rp.spReporteMediciones; spAdapter.Fill(rp.spReporteMediciones, FechaIni, FechaFin, Lmbr, Est, Estr); ReportViewer1.LocalReport.DataSources.Add(DataSourseRepo); FindControl(); ReportViewer1.LocalReport.Refresh(); }
public override byte[] export(string fileType) { var rpt = new Microsoft.Reporting.WebForms.LocalReport(); //rpt.ReportPath = "Rpt01.rdlc"; rpt.EnableExternalImages = true; for (int i = 0; i < this.ds.Tables.Count; i++) { var o = new Microsoft.Reporting.WebForms.ReportDataSource(this.ds.Tables[i].TableName, this.ds.Tables[i]); rpt.DataSources.Add(o); } //string sReportName = Request.QueryString["ReportName"]; System.IO.MemoryStream ms = new System.IO.MemoryStream(this.output); rpt.LoadReportDefinition(ms); Byte[] results = rpt.Render(fileType); return(results); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (SesionActualWindows.SesionActual().ObtenerUsuarioActual() != null) { Cultura = SesionActualWindows.SesionActual().ObtenerUsuarioActual().Cultura.ToString(); BE.Consumidor consumidor = new BE.Consumidor(); if (usuario.Perfil.Nombre == "CONSUMIDOR") { consumidor = _gestorConsumidor.leer_Consumidor_DNI(usuario.idUsuario.ToString()); } ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/reportes/reporteMovCus.rdlc"); listaMovCustomer = _gestorMovCustomer.leer_mov_Customer(consumidor.idCliente.ToString(), consumidor.idConsumidor.ToString()); IEnumerable <BE.MovCustomer> ie; ie = listaMovCustomer.AsQueryable(); Microsoft.Reporting.WebForms.ReportDataSource datasource = new Microsoft.Reporting.WebForms.ReportDataSource("movCustomer", ie); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(datasource); } } }
public IHttpActionResult PrintNewPickingList(int id) { Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), getModuleCode(), Library.DTO.ModuleAction.CanPrint)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } //GET DATA BLL.WarehousePickingListMng bll = new BLL.WarehousePickingListMng(); DTO.WarehousePickingListMng.PickingListContainerPrintout dtoPrintout = bll.GetNewPickingListPrintData(id, ControllerContext.GetAuthUserId(), out notification); //CREATE PRINTOUT Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + "PickingListPrint.rdlc"; Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoice.Name = "PickingList"; rsInvoice.Value = dtoPrintout.PickingListPrintouts; lr.DataSources.Add(rsInvoice); Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoiceDetail.Name = "PickingListDetail"; rsInvoiceDetail.Value = dtoPrintout.PickingListDetailPrintouts; lr.DataSources.Add(rsInvoiceDetail); string printoutFileName = PrintoutHelper.BuildPrintoutFile(lr, "PDF"); return(Ok(new Library.DTO.ReturnData <string>() { Data = printoutFileName, Message = notification })); }
protected void uiLinkButtonGetReport_Click(object sender, EventArgs e) { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); switch (uiRadioButtonListReports.SelectedValue) { case "0": rds.Name = "CabinCrewHoursDataSet"; break; case "1": rds.Name = "CabinCrewPerDiemDataSet"; break; case "2": rds.Name = "ALLCabinCrewHoursDataSet"; break; case "3": rds.Name = "CabinCrewScheduleDataSet"; break; default: break; } GetCrewHoursTableAdapter CTA = new GetCrewHoursTableAdapter(); GetAllCrewHoursTableAdapter ACTA = new GetAllCrewHoursTableAdapter(); GetCrewScheduleTableAdapter CSTA = new GetCrewScheduleTableAdapter(); CTA.ClearBeforeFill = true; ACTA.ClearBeforeFill = true; CSTA.ClearBeforeFill = true; try { DateTime? From = null; DateTime? To = null; From = uiRadDatePickerFrom.SelectedDate; To = uiRadDatePickerTo.SelectedDate; //if (!string.IsNullOrEmpty(uiTextBoxFrom.Text)) //{ // From = DateTime.ParseExact(uiTextBoxFrom.Text, "dd/MM/yyyy", null); //} //if (!string.IsNullOrEmpty(uiTextBoxTo.Text)) //{ // To = DateTime.ParseExact(uiTextBoxTo.Text, "dd/MM/yyyy", null); //} switch (uiRadioButtonListReports.SelectedValue) { case "0": rds.Value = CTA.GetData(Convert.ToInt32(uiDropDownListCrew.SelectedValue), From, To); ReportViewer1.LocalReport.ReportPath = "Reports\\CabinCrewHours.rdlc"; break; case "2": rds.Value = ACTA.GetData(From, To); ReportViewer1.LocalReport.ReportPath = "Reports\\ALLCabinCrewHours.rdlc"; ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("From", uiRadDatePickerFrom.SelectedDate.ToString())); break; case "3": rds.Value = CSTA.GetData(Convert.ToInt32(uiDropDownListCrew.SelectedValue), From, To); ReportViewer1.LocalReport.ReportPath = "Reports\\CabinCrewSchedule.rdlc"; break; } ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); } catch (Exception ex) { } }
protected void uiLinkButtonGetReport_Click(object sender, EventArgs e) { ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer2.LocalReport.DataSources.Clear(); ReportViewer3.LocalReport.DataSources.Clear(); ReportViewer4.LocalReport.DataSources.Clear(); ReportViewer5.LocalReport.DataSources.Clear(); ReportViewer6.LocalReport.DataSources.Clear(); ReportViewer7.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); Microsoft.Reporting.WebForms.ReportDataSource rds2 = new Microsoft.Reporting.WebForms.ReportDataSource(); GetPilotReportTableAdapter ta = new GetPilotReportTableAdapter(); GetPAXReportTableAdapter taP = new GetPAXReportTableAdapter(); GetFlyHoursReportTableAdapter taF = new GetFlyHoursReportTableAdapter(); GetPilotScheduleTableAdapter taS = new GetPilotScheduleTableAdapter(); CalculatePerDiemTableAdapter TPD = new CalculatePerDiemTableAdapter(); GetPerDiemLogTableAdapter TPDL = new GetPerDiemLogTableAdapter(); GetAirPlaneActualBurnOffTableAdapter APBO = new GetAirPlaneActualBurnOffTableAdapter(); GetSectorsActualBurnOffTableAdapter SBO = new GetSectorsActualBurnOffTableAdapter(); ta.ClearBeforeFill = true; taP.ClearBeforeFill = true; taF.ClearBeforeFill = true; taS.ClearBeforeFill = true; TPD.ClearBeforeFill = true; TPDL.ClearBeforeFill = true; APBO.ClearBeforeFill = true; SBO.ClearBeforeFill = true; try { DateTime? From = null; DateTime? To = null; From = uiRadDatePickerFrom.SelectedDate; To = uiRadDatePickerTo.SelectedDate; switch (uiRadioButtonListReports.SelectedValue) { case "0": rds.Name = "PilotDataSet"; rds.Value = ta.GetData(Convert.ToInt32(uiDropDownListPilots.SelectedValue), From, To); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("From", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerFrom.SelectedDate))); ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("To", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerTo.SelectedDate))); ReportViewer1.LocalReport.Refresh(); ReportViewer1.Visible = true; ReportViewer2.Visible = false; ReportViewer3.Visible = false; ReportViewer4.Visible = false; ReportViewer5.Visible = false; ReportViewer6.Visible = false; ReportViewer7.Visible = false; break; case "1": rds.Name = "PAXDataSet"; rds.Value = taP.GetData(From, To,Convert.ToInt32(uiDropDownListAirplane.SelectedValue)); ReportViewer3.LocalReport.DataSources.Add(rds); ReportViewer3.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("From", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerFrom.SelectedDate))); ReportViewer3.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("To", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerTo.SelectedDate))); ReportViewer3.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("Airplane", uiDropDownListAirplane.SelectedValue)); ReportViewer3.LocalReport.Refresh(); ReportViewer1.Visible = false; ReportViewer2.Visible = false; ReportViewer3.Visible = true; ReportViewer4.Visible = false; ReportViewer5.Visible = false; ReportViewer6.Visible = false; ReportViewer7.Visible = false; break; case "2": rds.Name = "FlyHoursDataSet"; rds.Value = taF.GetData(From, To); ReportViewer4.LocalReport.DataSources.Add(rds); ReportViewer4.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("From", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerFrom.SelectedDate))); ReportViewer4.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("To", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerTo.SelectedDate))); ReportViewer4.LocalReport.Refresh(); ReportViewer1.Visible = false; ReportViewer2.Visible = false; ReportViewer3.Visible = false; ReportViewer4.Visible = true; ReportViewer5.Visible = false; ReportViewer6.Visible = false; ReportViewer7.Visible = false; break; case "3": rds.Name = "ScheduleDataSet"; if(!Roles.IsUserInRole(Page.User.Identity.Name,"Pilot")) { rds.Value = taS.GetData(0,From, To); } else { Pilot p = new Pilot(); p.GetPilotByUserName(Page.User.Identity.Name); rds.Value = taS.GetData(p.PilotID, From, To); } ReportViewer5.LocalReport.DataSources.Add(rds); //ReportViewer5.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("From", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerFrom.SelectedDate))); //ReportViewer5.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("To", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerTo.SelectedDate))); ReportViewer5.LocalReport.Refresh(); ReportViewer1.Visible = false; ReportViewer2.Visible = false; ReportViewer3.Visible = false; ReportViewer4.Visible = false; ReportViewer5.Visible = true; ReportViewer6.Visible = false; ReportViewer7.Visible = false; break; case "4": rds.Name = "PerDiemDataSet"; rds2.Name = "PerdiemLogDataSet"; rds.Value = TPD.GetData(From, To, Convert.ToInt32(uiDropDownListPilots.SelectedValue)); rds2.Value = TPDL.GetData(From, To, Convert.ToInt32(uiDropDownListPilots.SelectedValue)); ReportViewer2.LocalReport.DataSources.Add(rds); ReportViewer2.LocalReport.DataSources.Add(rds2); ReportViewer2.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("RateParameter", uiTextBoxRate.Text)); ReportViewer2.LocalReport.Refresh(); ReportViewer1.Visible = false; ReportViewer2.Visible = true; ReportViewer3.Visible = false; ReportViewer4.Visible = false; ReportViewer5.Visible = false; ReportViewer6.Visible = false; ReportViewer7.Visible = false; break; case "5": rds.Name = "PerDiemDataSet"; rds2.Name = "PerdiemLogDataSet"; rds.Value = TPD.GetData(From, To, Convert.ToInt32(uiDropDownListPilots.SelectedValue)); rds2.Value = TPDL.GetData(From, To, Convert.ToInt32(uiDropDownListPilots.SelectedValue)); ReportViewer2.LocalReport.DataSources.Add(rds); ReportViewer2.LocalReport.DataSources.Add(rds2); ReportViewer2.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("RateParameter", uiTextBoxRate.Text)); ReportViewer2.LocalReport.Refresh(); ReportViewer1.Visible = false; ReportViewer2.Visible = true; ReportViewer3.Visible = false; ReportViewer4.Visible = false; ReportViewer5.Visible = false; ReportViewer6.Visible = false; ReportViewer7.Visible = false; break; case "6": rds.Name = "AirplaneActualBurnOffDataSet"; rds.Value = APBO.GetData(Convert.ToInt32(uiDropDownListAirplane.SelectedValue),From, To); ReportViewer6.LocalReport.DataSources.Add(rds); ReportViewer6.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("StartDate", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerFrom.SelectedDate))); ReportViewer6.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("EndDate", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerTo.SelectedDate))); ReportViewer6.LocalReport.Refresh(); ReportViewer1.Visible = false; ReportViewer2.Visible = false; ReportViewer3.Visible = false; ReportViewer4.Visible = false; ReportViewer5.Visible = false; ReportViewer6.Visible = true; ReportViewer7.Visible = false; break; case "7": rds.Name = "SectorActualBurnOffDataSet"; rds.Value = SBO.GetData(Convert.ToInt32(uiDropDownListFrom.SelectedValue), Convert.ToInt32(uiDropDownListTo.SelectedValue), From, To); ReportViewer7.LocalReport.DataSources.Add(rds); ReportViewer7.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("StartDate", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerFrom.SelectedDate))); ReportViewer7.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("EndDate", string.Format("{0:MM/dd/yyyy}", uiRadDatePickerTo.SelectedDate))); ReportViewer7.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("FromAirPort", uiDropDownListFrom.SelectedValue)); ReportViewer7.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("ToAirPort", uiDropDownListTo.SelectedValue)); ReportViewer7.LocalReport.Refresh(); ReportViewer1.Visible = false; ReportViewer2.Visible = false; ReportViewer3.Visible = false; ReportViewer4.Visible = false; ReportViewer5.Visible = false; ReportViewer6.Visible = false; ReportViewer7.Visible = true; break; default: break; } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { // ReportViewer1.ShowExportControls = false // ReportViewer1.ShowFindControls = false // ReportViewer1.ShowPrintButton = false // ReportViewer1.ShowPromptAreaButton = false // ReportViewer1.ShowParameterPrompts = false // ReportViewer1.ShowRefreshButton = false // ReportViewer1.ShowPageNavigationControls = false // ReportViewer1.ShowZoomControl = true // ReportViewer1.ShowToolBar = false // ReportViewer1.ShowDocumentMapButton = false // ReportViewer1.ShowBackButton = false // ReportViewer1.ToolBarItemBorderStyle = BorderStyle.None ReportViewer1.ShowToolBar = false; ReportViewer1.ShowParameterPrompts = true; ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = "GM_Gebaeudestammdaten_Wincasa.rdl"; //rdlc ? ReportViewer1.LocalReport.EnableHyperlinks = true; ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence); Microsoft.Reporting.WebForms.ReportParameterInfoCollection x = ReportViewer1.LocalReport.GetParameters(); /* parameters.Add(new ParameterValue { Name = "in_stichtag", Value = System.DateTime.Now.ToString("MM'/'dd'/'yyyy") }); parameters.Add(new ParameterValue { Name = "in_mandant", Value = "0" }); // in use parameters.Add(new ParameterValue { Name = "in_sprache", Value = "DE" }); parameters.Add(new ParameterValue { Name = "in_standort", Value = "00000000-0000-0000-0000-000000000000" }); parameters.Add(new ParameterValue { Name = "in_gebaeude", Value = "00000000-0000-0000-0000-000000000000" }); parameters.Add(new ParameterValue { Name = "def_logo", Value = "R0lGODlhswA4AOYAAPzq0tvc3fOZJ/zlyLprCvSnRfKMC6urrfr6+rOztPb29oKDhfa3ZcLDxPKSF7q7vPKJA8vLzOC7jO3t7djd5NLS0/GFAJmam+jo6OHi5PLy8vOhOP768/rWqP716qKipOHh4vz8/Hd4e/3y45SBavjGhuXm5vayXPrctOXs9Md0DP7+/vKPEJGSlPe8cPnLkd7f4M3OzoWGiP78+X+AgvDhznt9f4mKjNzSxYeIioyNkPfAesiUUvWtUeLj5eTn66F5SdjY2tbW2P/+/bW2t+LFnvnRnMXGx9zM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V/wBZv7uaAbuhgYCAA7AA==" }); parameters.Add(new ParameterValue { Name = "def_padding_left", Value = 70 }); parameters.Add(new ParameterValue { Name = "def_padding_right", Value = 0 }); parameters.Add(new ParameterValue { Name = "def_padding_top", Value = 0 }); parameters.Add(new ParameterValue { Name = "def_padding_bottom", Value = 0 }); parameters.Add(new ParameterValue { Name = "def_mime", Value = "image/gif" }); parameters.Add(new ParameterValue { Name = "def_HideLogo", Value = false }); */ foreach (Microsoft.Reporting.WebForms.ReportParameterInfo pi in x) { System.Console.WriteLine(pi.Prompt); } System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter> parms = new System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter>(); // Add Parameters of type Microsoft.Reporting.Windows.ReportParameter parms.Add(new Microsoft.Reporting.WebForms.ReportParameter("Test", "Whatever")); parms.Add(new Microsoft.Reporting.WebForms.ReportParameter("CustomerID", new string[] { "14335", "15094" })); // http://forums.asp.net/t/1656685.aspx/1 // Clears the source data (below) before a new request is sent // ReportViewer1.LocalReport.DataSources.Clear(); // ReportViewer1.ShowReportBody = true; ReportViewer1.ServerReport.SetParameters(parms); System.Data.DataTable dt = null; Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("COR_Basic", dt); // rds.Name = "COR_Basic"; // rds.Value = dt; // https://msdn.microsoft.com/en-US/library/ms251837(v=VS.90).aspx Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.DataSources.Add(rds); lr.ReportPath = "bla.rdlc"; string deviceInfo = null; /* deviceInfo = "<DeviceInfo>" + " <OutputFormat>EMF</OutputFormat>" + " <PageWidth>8.5in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0.25in</MarginTop>" + " <MarginLeft>0.25in</MarginLeft>" + " <MarginRight>0.25in</MarginRight>" + " <MarginBottom>0.25in</MarginBottom>" + "</DeviceInfo>"; */ Microsoft.Reporting.WebForms.CreateStreamCallback cb = CreateStream; Microsoft.Reporting.WebForms.Warning[] warnings; //lr.Render("WORD", deviceInfo, cb, out warnings); lr.Render("PDF", deviceInfo, cb, out warnings); }
protected void btnBuscar_Click(object sender, EventArgs e) { //if (lblError.Text == "") //{ try { if (DateTime.Parse(TxtFechaInicio.Text) > DateTime.Parse(TxtFechaFin.Text)) { lblEstatus1.Text = "LA FECHA INICIAL NO PUEDE SER MAYOR A LA FECHA FINAL, INTENTE NUEVAMENTE POR FAVOR"; } else { lblEstatus1.Text = ""; LBVerDetalles.Visible = true; ObjectDataSource ObjectDataSource1 = new ObjectDataSource("AtencionTemprana.dsReportesTableAdapters.SP_ConteoPNLTablaTableAdapter", "GetData"); ObjectDataSource1.SelectParameters.Add("fechainicio", TxtFechaInicio.Text); ObjectDataSource1.SelectParameters.Add("fechafin", TxtFechaFin.Text); ObjectDataSource1.SelectParameters.Add("IdMunicipio", IdMunicipio.Text); ObjectDataSource1.SelectParameters.Add("IdUnidad", IdUnidad.Text); Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", ObjectDataSource1); ObjectDataSource ObjectDataSource2 = new ObjectDataSource("AtencionTemprana.dsReportesTableAdapters.SP_ConteoPNLGraficaTableAdapter", "GetData"); ObjectDataSource2.SelectParameters.Add("fechainicio", TxtFechaInicio.Text); ObjectDataSource2.SelectParameters.Add("fechafin", TxtFechaFin.Text); ObjectDataSource2.SelectParameters.Add("IdMunicipio", IdMunicipio.Text); ObjectDataSource2.SelectParameters.Add("IdUnidad", IdUnidad.Text); Microsoft.Reporting.WebForms.ReportDataSource rds2 = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet2", ObjectDataSource2); DataSet ds1 = GetODS_DS(ObjectDataSource1); DataSet ds2 = GetODS_DS(ObjectDataSource2); //if (Convert.ToInt32(ds1.Tables[0].Rows[0]["Total"]) == 0 && Convert.ToInt32(ds1.Tables[0].Rows[1]["Total"]) == 0) if (Convert.ToInt32(ds1.Tables.Count) == 0 && Convert.ToInt32(ds1.Tables.Count) == 0) { //ocultar grafica y reporte Chart1.Visible = false; LBVerDetalles.Visible = false; ReportViewer1.Visible = false; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.Refresh(); lblEstatus1.Text = "NO SE ENCONTRARON REGISTROS PARA EL RANGO DE FECHAS ESPECÍFICADO, INTENTE NUEVAMENTE POR FAVOR"; } else { lblEstatus1.Text = ""; Chart1.Visible = true; LBVerDetalles.Visible = false; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.DataSources.Add(rds2); ReportViewer1.LocalReport.ReportPath = "ReportePNL.rdlc"; ReportViewer1.LocalReport.Refresh(); PGJ.InsertarBitacora(int.Parse(Session["IdUsuario"].ToString()), Session["IP_MAQUINA"].ToString(), HttpContext.Current.Request.Url.AbsoluteUri, 10, "Conteo de personas reportadas como no localizadas, fecha de inicio: " + TxtFechaInicio.Text + " fecha fin: " + TxtFechaFin.Text, int.Parse(Session["IdModuloBitacora"].ToString())); } } } catch (Exception ex) { lblEstatus.Text = ex.Message; lblEstatus1.Text = "INTENTELO NUEVAMENTE"; } }
public IHttpActionResult PrintPackingList(int id, string formatType, string reportName) { Library.DTO.Notification notification = new Library.DTO.Notification(); // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanPrint)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } BLL.ECommercialInvoiceMng bll = new BLL.ECommercialInvoiceMng(); string printoutFileName = string.Empty; if (reportName == "PackingListPrint") { if (formatType == "PDF") { DTO.ECommercialInvoiceMng.PackingListContainerPrintout dtoPrintout = bll.GetPackingListPrintoutData(id, ControllerContext.GetAuthUserId(), out notification); reportName = reportName + ".rdlc"; Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + reportName; Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoice.Name = "PackingList"; rsInvoice.Value = dtoPrintout.PackingListPrintouts; lr.DataSources.Add(rsInvoice); Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoiceDetail.Name = "PackingListDetail"; rsInvoiceDetail.Value = dtoPrintout.PackingListDetailPrintouts; lr.DataSources.Add(rsInvoiceDetail); printoutFileName = PrintoutHelper.BuildPrintoutFile(lr, "PDF"); } else { printoutFileName = bll.GetPEUackingListPrintoutData(id, reportName, out notification); } } else { if (reportName == "PackingListPrint_PerCont") { if (formatType == "PDF") { List <DTO.ECommercialInvoiceMng.PackingListContainerPrintout> listDtoPrintout = bll.GetPackingListPrintoutData_PerCont(id, ControllerContext.GetAuthUserId(), out notification); foreach (var dtoPrintout in listDtoPrintout) { //DTO.ECommercialInvoiceMng.PackingListContainerPrintout dtoPrintout = bll.GetPackingListPrintoutData(id, ControllerContext.GetAuthUserId(), out notification); reportName = reportName + ".rdlc"; Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + reportName; Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoice.Name = "PackingList"; rsInvoice.Value = dtoPrintout.PackingListPrintouts; lr.DataSources.Add(rsInvoice); Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoiceDetail.Name = "PackingListDetail"; rsInvoiceDetail.Value = dtoPrintout.PackingListDetailPrintouts; lr.DataSources.Add(rsInvoiceDetail); if (printoutFileName != string.Empty) { printoutFileName = printoutFileName + "," + PrintoutHelper.BuildPrintoutFile(lr, "PDF"); } else { printoutFileName = PrintoutHelper.BuildPrintoutFile(lr, "PDF"); } reportName = "PackingListPrint_PerCont"; } } else { printoutFileName = bll.GetEUPackingListPrintoutData_PerCont(id, reportName, out notification); } } else { printoutFileName = bll.GetOrangePiePrintout(id, out notification); } } return(Ok(new Library.DTO.ReturnData <string>() { Data = printoutFileName, Message = notification })); }
public IHttpActionResult PrintInvoice(int id, string formatFile, string reportName, int invoiceType) { BLL.ECommercialInvoiceMng bll = new BLL.ECommercialInvoiceMng(); Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanPrint)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } //CREATE PRINTOUT string printoutFileName = string.Empty; int? companyID = fwBll.GetCompanyID(ControllerContext.GetAuthUserId()); /* * get report file base on format of report * Excel format is special, we will use one function to get report base on excel * Another format we will use microsoft report tool to create report */ if (formatFile == "Excel") { //switch (companyID) //{ // case 13: // printoutFileName = bll.GetOrangePiePrintout(id, out notification); // break; // default: // break; //} printoutFileName = bll.GetInvoicePrintoutInExcel(id, reportName, invoiceType, out notification); } else { DTO.ECommercialInvoiceMng.InvoiceContainerPrintout dtoPrintout = bll.GetInvoicePrintoutData(id, ControllerContext.GetAuthUserId(), out notification); if (dtoPrintout != null && dtoPrintout.Invoices != null && dtoPrintout.InvoiceDetails != null) { reportName = reportName + ".rdlc"; //switch (companyID) //{ // case 13: // reportName = reportName + "_OrangePine.rdlc"; // break; // default: // reportName = reportName + ".rdlc"; // break; //} Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + reportName; Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoice.Name = "Invoice"; rsInvoice.Value = dtoPrintout.Invoices; lr.DataSources.Add(rsInvoice); Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource(); rsInvoiceDetail.Name = "InvoiceDetail"; rsInvoiceDetail.Value = dtoPrintout.InvoiceDetails; lr.DataSources.Add(rsInvoiceDetail); printoutFileName = PrintoutHelper.BuildPrintoutFile(lr, formatFile); } } return(Ok(new Library.DTO.ReturnData <string>() { Data = printoutFileName, Message = notification })); }
} // End Sub EnableFormat protected void Page_Load(object sender, System.EventArgs e) { if (this.Page.IsPostBack) { return; } Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = "DataSet1"; //This refers to the dataset name in the RDLC file string strSQL = @"SELECT * FROM T_Benutzer"; // strSQL = strSQL.Replace("@_in_umzugsuid", "'" + in_ump_uid.Replace("'", "''") + "'"); // strSQL = strSQL.Replace("@_in_sprache", "'" + in_sprache.Replace("'", "''") + "'"); rds.Value = Basic_SQL.SQL.GetDataTable(strSQL); strSQL = null; Microsoft.Reporting.WebForms.ReportViewer rs = new Microsoft.Reporting.WebForms.ReportViewer(); //EnableFormat(rs, "HTML4.0"); EnableFormat(rs, "IMAGE"); using (System.IO.Stream reportDefinition = COR_Reports.ReportRepository.GetEmbeddedReport("PaginationTest.rdl")) { rs.LocalReport.LoadReportDefinition(reportDefinition); } // End Using reportDefinition rs.LocalReport.DataSources.Add(rds); Microsoft.Reporting.WebForms.Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; //COR_Reports.ReportFormatInfo formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.HtmlFragment); //COR_Reports.ReportFormatInfo formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.MHTML); COR_Reports.ReportFormatInfo formatInfo = new COR_Reports.ReportFormatInfo(COR_Reports.ExportFormat.Image); string deviceInfo = "<DeviceInfo>" + " <OutputFormat>EMF</OutputFormat>" + " <PageWidth>8.5in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0.25in</MarginTop>" + " <MarginLeft>0.25in</MarginLeft>" + " <MarginRight>0.25in</MarginRight>" + " <MarginBottom>0.25in</MarginBottom>" + "</DeviceInfo>"; byte[] result = rs.LocalReport.Render(formatInfo.FormatName, formatInfo.DeviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); System.Console.WriteLine(result); //Page page = new Page(); TestRender page = new TestRender(); //System.Web.UI.ScriptManager scriptManager = new ScriptManager(); //System.Web.UI.HtmlControls.HtmlForm form = new System.Web.UI.HtmlControls.HtmlForm(); //form.Controls.Add(scriptManager); //rs.AsyncRendering = false; //form.Controls.Add(rs); //page.Controls.Add(form); //page.RenderControl //// page.DataBind(); //exception here //// RenderControlToHtml2(page); string s = RenderControlToHtml(page); System.Console.WriteLine(s); } // End Sub Page_Load
public static byte[] RenderReport(DataSet data, string name, string type) { Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource(); rds.Name = name + "_Table"; rds.Value = data.Tables[0]; string virtualRdlc = BuildRDLC(data, name); Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport(); lr.ReportPath = HttpContext.Current.Server.MapPath(virtualRdlc); lr.DataSources.Add(rds); return RenderReport(lr, name, type); }