static void Main(string[] args) { var connectionString = TestTaskConfiguration.Instance.ConnectionString; var context = new DataContext(connectionString); var repository = new EmployeeRepository(context); var service = new EmployeeService(repository); var node = new EmployeeReportModel(); node.EmployeeDetails = service.All().OrderBy(x => x.FirstName).Select(x => new EmployeeReportDetailsModel { Name = x.FirstName, Wage = x.Wage }).ToList(); dataList.Add(node); ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.LocalReport.ReportPath = AppDomain.CurrentDomain.BaseDirectory + @"\..\..\EmployeeReportTemplate.rdlc"; reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(ReportViewer_OnSubreportProcessing); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("DSEmployee", dataList)); Byte[] result = reportViewer.LocalReport.Render("PDF"); using (FileStream fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\Test.pdf", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write)) { fs.Write(result, 0, result.Length); fs.Flush(); fs.Close(); } //Console.ReadKey(); }
/*ActionResult*/ public void GetReport(string name) { ReportViewer reportViewer = new ReportViewer(); try { var reportUri = System.Configuration.ConfigurationManager.AppSettings["reportServerUri"]; var reportUser = System.Configuration.ConfigurationManager.AppSettings["reportUserName"]; var reportUserPass = System.Configuration.ConfigurationManager.AppSettings["reportUserPass"]; var reportUserDomain = System.Configuration.ConfigurationManager.AppSettings["reportUserDomain"]; reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.SizeToReportContent = true; reportViewer.Width = System.Web.UI.WebControls.Unit.Percentage(100); reportViewer.Height = System.Web.UI.WebControls.Unit.Percentage(100); reportViewer.ServerReport.ReportServerCredentials = new Security.ReportServerCredentials(reportUser, reportUserPass, reportUserDomain); reportViewer.CssClass = "reportViewer"; reportViewer.ShowToolBar = true; reportViewer.ShowParameterPrompts = true; reportViewer.ShowExportControls = true; reportViewer.AsyncRendering = true; reportViewer.ServerReport.ReportPath = String.Format("/{0}", name); reportViewer.ServerReport.ReportServerUrl = new Uri(reportUri); } catch (ReportViewerException rvex) { throw new Exception(String.Format("reviewer error {0}", rvex.Message)); } ViewBag.ReportViewer = reportViewer; }
protected void ExportarXLS() { ReportViewer rvExporter = new ReportViewer(); rvExporter.ProcessingMode = ProcessingMode.Local; rvExporter.LocalReport.ReportPath = Server.MapPath(@"~\Reports\ListadeCompras.rdlc"); rvExporter.LocalReport.DataSources.Add(new ReportDataSource("Lista", GetDados())); rvExporter.LocalReport.Refresh(); Resultado resultado = new Resultado(); Ped_ItemFacade oPedFacade = new Ped_ItemFacade(); int CategoriaID = Convert.ToInt32(Request.QueryString["categoriaid"]); int CC_ID = Convert.ToInt32(Request.QueryString["CC"]); resultado = new Ped_ItemFacade().AtualizaProcessoCompra(CategoriaID, CC_ID); ////Exportar para PDF string mimeType; string encoding; string fileNameExtension; Warning[] warnings; string[] streamids; byte[] exportBytes = rvExporter.LocalReport.Render("Excel", null, out mimeType, out encoding, out fileNameExtension, out streamids, out warnings); Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.{1}", DateTime.Now.ToString("yyyy-MM-dd") + "Planilha Processo de Compra Numero " + resultado.Id.ToString().PadLeft(6,'0') , fileNameExtension)); Response.BinaryWrite(exportBytes); Response.Flush(); Response.End(); rvExporter.Dispose(); }
public static Task GeneratePDF(List<Contact> datasource, string filePath) { return Task.Run(() => { string binPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "bin"); var assembly = Assembly.Load(System.IO.File.ReadAllBytes(binPath + "\\NowManagementStudio.dll")); using (Stream stream = assembly.GetManifestResourceStream(Report)) { var viewer = new ReportViewer(); viewer.LocalReport.EnableExternalImages = true; viewer.LocalReport.LoadReportDefinition(stream); Warning[] warnings; string[] streamids; string mimeType; string encoding; string filenameExtension; viewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", datasource)); viewer.LocalReport.Refresh(); byte[] bytes = viewer.LocalReport.Render( "PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); using (FileStream fs = new FileStream(filePath, FileMode.Create)) { fs.Write(bytes, 0, bytes.Length); } } }); }
private static string ExportReport(ReportViewer reportViewer1, List<string> agency, List<string> contractNumber, int i) { Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes; bytes = reportViewer1.ServerReport.Render("Excel", null, out mimeType, out encoding, out extension, out streamids, out warnings); //write to temp file DateTime todaysDate = DateTime.Today; string month = todaysDate.Month.ToString(); string day = todaysDate.Day.ToString(); string year = todaysDate.Year.ToString(); string runDate = month + "_" + day + "_" + year; string reportName = agency[i]+"_"+contractNumber[i]+"_"+runDate+".xls"; // //N:\\PERFORMANCE\\AGENCY REPORTS\\Agency submissions\\2016 Reports Received\\Test_QPR2015_AA\\ string fileName = Path.Combine("G:\\Wendy\\DIRMonthly\\", reportName); using (FileStream fs = new FileStream(fileName, FileMode.Create)) { fs.Write(bytes, 0, bytes.Length); } return fileName; }
private void ShowReport(IObjectContainer container) { // #example: Run a report with db4o var dataToShow = from Person p in container where p.FirstName.Contains("o") select p; var reportViewer = new ReportViewer { ProcessingMode = ProcessingMode.Local }; // Put the data into the datasource which you are using // in your report. Here it's named 'MainData' reportViewer.LocalReport.DataSources.Add( new ReportDataSource("MainData", dataToShow)); reportViewer.Dock = DockStyle.Fill; // The report can be an embedded resource reportViewer.LocalReport.ReportEmbeddedResource = "Db4oDoc.Code.Reporting.ExampleReport.rdlc"; // or can be a file // reportViewer.LocalReport.ReportPath = "path/to/your/report"; // After that you can use the report viewer in your app this.Controls.Add(reportViewer); reportViewer.RefreshReport(); // #end example }
public static string generateInvoicePDF(int invoiceID) { Microsoft.Reporting.WebForms.ReportViewer reportViewer = new ReportViewer(); string reportPath = null; string appPath = ConfigurationManager.AppSettings["appPath"].ToString(); invoiceReport = CRM.Repository.InvoiceManager.GetInvoiceForReport(invoiceID); if (invoiceReport != null) { reportViewer.Reset(); reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.EnableExternalImages = true; ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = invoiceReport; reportViewer.LocalReport.DataSources.Add(reportDataSource); reportViewer.LocalReport.ReportPath = HttpContext.Current.Server.MapPath("~/Content/Invoice.rdlc"); reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(invoiceReportSubReport); reportPath = string.Format("{0}/Temp/Invoice_{1}.pdf", appPath, invoiceID); Core.ReportHelper.savePDFFromLocalReport(reportViewer.LocalReport, reportPath); } return reportPath; }
private void anteprimaStampaBilancioLoad(object sender, EventArgs e) { // Set Processing Mode _reportViewer = new ReportViewer {ProcessingMode = ProcessingMode.Local}; // Set RDL file _reportViewer.LocalReport.ReportEmbeddedResource = "Gipasoft.Stabili.UI.StatoPatrimoniale.Reports.DettaglioPartitario.rdlc"; // Supply a DataTable corresponding to each report dataset _reportViewer.LocalReport.DataSources.Add(new ReportDataSource("MovimentoContabileBilancioDTO", _partitario)); // Add the reportviewer to the form Controls.Add(_reportViewer); _reportViewer.Dock = DockStyle.Fill; _reportViewer.LocalReport.EnableExternalImages = true; var parameterCondominio1 = new ReportParameter("condominio1", _reportParameters.DescrizioneCondominio[0]); var parameterCondominio2 = new ReportParameter("condominio2", _reportParameters.DescrizioneCondominio[1]); var parameterCondominio3 = new ReportParameter("condominio3", _reportParameters.DescrizioneCondominio[2]); var parameterCondominio4 = new ReportParameter("condominio4", _reportParameters.DescrizioneCondominio[3]); var parameterCodiceCondominio = new ReportParameter("codiceCondominio", _reportParameters.CodiceCondominio); var parameterEsercizio = new ReportParameter("esercizio", _reportParameters.DescrizioneEsercizio); var parameterAzienda = new ReportParameter("azienda", _reportParameters.DescrizioneAzienda); var parameterGriglia = new ReportParameter("griglia", _reportParameters.VisualizzaGriglia.ToString()); var parameterNote = new ReportParameter("note", _reportParameters.Note); var parameterIntestazioneStudio = new ReportParameter("intestazioneStudio", _reportParameters.IntestazioneStudio); var parameterViaStudio = new ReportParameter("viaStudio", _reportParameters.ViaStudio); var parameterCapStudio = new ReportParameter("capStudio", _reportParameters.CapStudio); var parameterLocalitaStudio = new ReportParameter("localitaStudio", _reportParameters.LocalitaStudio); var parameterLogo = new ReportParameter("logo", _documentService.SaveInLocalCache(new Gipasoft.Business.Interface.DocumentInfo() { Body = _aziendaService.GetLogo().LogoAzienda, FileName = "logo.jpg" })); string dataSituazione = "Fine esercizio"; if (_reportParameters.DataSituazione != null) dataSituazione = _reportParameters.DataSituazione.Value.ToShortDateString(); var parameterDataSituazione = new ReportParameter("dataSituazione", dataSituazione); _reportViewer.LocalReport.SetParameters( new [] { parameterCondominio1, parameterCondominio2, parameterCondominio3, parameterCondominio4, parameterCodiceCondominio, parameterEsercizio, parameterAzienda, parameterGriglia, parameterNote, parameterIntestazioneStudio, parameterViaStudio, parameterCapStudio, parameterLocalitaStudio, parameterLogo, parameterDataSituazione }); _reportViewer.RefreshReport(); }
private void btnSalvar_Click(object sender, EventArgs e) { //local ReportViewer report = new ReportViewer(); report.ProcessingMode = ProcessingMode.Local; report.LocalReport.ReportEmbeddedResource = "MariosPet.Report1.rdlc"; //criar listas List<ReportParameter> lista = new List<ReportParameter>(); lista.Add(new ReportParameter("NomeVeterinario", txtNomeVeterinario.Text)); lista.Add(new ReportParameter("Prescricao", txtPrescricao.Text)); report.LocalReport.SetParameters(lista); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extrension; byte[] bytePdf = report.LocalReport.Render("PDF", null, out mimeType, out encoding ,out extrension, out streamids, out warnings); //criar pdf FileStream file = null; string nomeArquivo = Path.GetTempPath() + "Receiturario" + DateTime.Now.ToString("dd_MM_yyyy-HH_mm_ss") + ".pdf"; //abrir pdf file = new FileStream(nomeArquivo, FileMode.Create); file.Write(bytePdf, 0, bytePdf.Length); file.Close(); Process.Start(nomeArquivo); }
public FileResult Print() { var bandId = Convert.ToInt32(Session["BandId"]); var rv = new ReportViewer { ProcessingMode = ProcessingMode.Local }; var ds = new GetAllSongsTableAdapter(); var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ReportConnectionString"].ConnectionString); ds.Connection = connection; string reportPath = "~/Reports/Songs.rdlc"; rv.LocalReport.ReportPath = Server.MapPath(reportPath); rv.ProcessingMode = ProcessingMode.Local; ReportDataSource rds = new ReportDataSource("Songs", (object)ds.GetData(bandId)); rv.LocalReport.DataSources.Add(rds); rv.LocalReport.Refresh(); string mimeType = string.Empty; string encoding = string.Empty; string filenameExtension = string.Empty; string[] streamids; Warning[] warnings; var streamBytes = rv.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); var bandName = _bandRepository.Get(bandId).Name; var filename = bandName + ".pdf"; return File(streamBytes, mimeType, filename); }
public static ReportViewer CreateReport() { var reportViewer = new ReportViewer(); AddReport(reportViewer); return reportViewer; }
public Sample() { //snippet //MySqlDataReader reader = cmd.ExecuteReader(); // add to collection List<MyReportClass> myReportClassCollection = new List<MyReportClass>(); //while (reader.Read()) //{ // populate entity var myReportClass = new MyReportClass(); // set properties, skipping DBNull checking for quickness myReportClass.ID = 1;//(int)reader["ID"]; myReportClass.Name = "Test";//(string) reader["Name"]; myReportClassCollection.Add(myReportClass); //} ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = Path.Combine(Environment.CurrentDirectory, "Report\\crBalanceReport.rdlc"); viewer.LocalReport.DataSources.Add(new ReportDataSource("myDataSource", myReportClassCollection)); //viewer.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamIds, out warnings); }
private void printReceipt(object sender, EventArgs e) { ReportDataSource source = new ReportDataSource(); ReportViewer reportViewer = new ReportViewer(); source.Name = "DataSet1"; source.Value = null; ReportParameter p1 = new ReportParameter("test1", "ASV"); // reportViewer.Reset(); // reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.ReportPath = "../../Reports/ReportReceipts.rdlc"; ReportParameter rp = new ReportParameter(); rp.Name = "id"; rp.Values.Add(objectReceipt.Id); ReportParameter rp1 = new ReportParameter("contractid", objectReceipt.Contractid, true); ReportParameter rp2 = new ReportParameter("dateestablish", this.objectReceipt.Dateestablish, true); ReportParameter rp3 = new ReportParameter("billid", this.objectReceipt.Billid, true); ReportParameter rp4 = new ReportParameter("customername", this.objectReceipt.Customername, true); ReportParameter rp5 = new ReportParameter("total", this.objectReceipt.Total.ToString(), true); ReportParameter rp6 = new ReportParameter("reason", this.objectReceipt.Reason, true); ReportParameter rp7 = new ReportParameter("note", this.objectReceipt.Contents, true); ReportParameter[] parameter = new ReportParameter[] { rp, rp2, rp1, rp3, rp4, rp5, rp6, rp7 }; // reportViewer.LocalReport.SetParameters(p); // reportViewer.LocalReport.DataSources.Add(source); ReportReceipts form = new ReportReceipts(parameter); form.Show(); }
public WordUpReportContainer () { InitializeComponent (); ReportViewer = new ReportViewer (); windowsFormsHost.Child = ReportViewer; }
private byte[] GetLocalReport(ReportDataSource rs, string reportName, Dictionary<string, string> parameters) { var rview = new ReportViewer(); rview.LocalReport.ReportPath = string.Format("{0}{1}.rdlc", HostingEnvironment.MapPath("~/Reports/"), reportName); rview.ProcessingMode = ProcessingMode.Local; rview.LocalReport.DataSources.Clear(); rview.LocalReport.DataSources.Add(rs); var paramList = new List<ReportParameter>(); if (parameters.Count > 0) { foreach (KeyValuePair<string, string> kvp in parameters) { paramList.Add(new ReportParameter(kvp.Key, kvp.Value)); } } rview.LocalReport.SetParameters(paramList); string mimeType, encoding, extension; string[] streamids; Warning[] warnings; string format = "Excel"; byte[] bytes = rview.LocalReport.Render(format, null, out mimeType, out encoding, out extension, out streamids, out warnings); return bytes; }
/// <summary> /// GenerateStatement /// </summary> /// <param name="Report">string</param> /// <param name="DataSources">ReportDataSource[]</param> /// <param name="Parameters">ReportParameters[]</param> /// <returns></returns> /// <remarks></remarks> public static string GenerateStatement(string Report, string ReportName, ReportDataSource[] DataSources, ReportParameter[] Parameters) { ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.Reset(); viewer.LocalReport.ReportPath = @"Reports\" + Report; viewer.LocalReport.DataSources.Clear(); foreach (ReportDataSource ds in DataSources) { viewer.LocalReport.DataSources.Add(ds); } viewer.LocalReport.SetParameters(Parameters); viewer.LocalReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string filenameExtension; byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); string filename = Path.Combine(Path.GetTempPath(), ReportName + ".pdf"); using (FileStream fs = new FileStream(filename, FileMode.Create)) { fs.Write(bytes, 0, bytes.Length); } return filename; }
//[Authorize] public ActionResult Index() { ServerReport report = new ServerReport(); //astea tb sa le facem cumva global dada var reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.ServerReport.ReportServerCredentials = new CustomCredentials(); reportViewer.ServerReport.ReportPath = "/Test/PieChart"; reportViewer.ServerReport.ReportServerUrl = new Uri(AppConstants.ServerURL); reportViewer.SizeToReportContent = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); ViewBag.reportView = reportViewer; AccuracyViewModel accuracy = new AccuracyViewModel { ClientNames = db.Accuracy_Setup.ToList().Select(a=>a.CUSTOMER).ToList() }; return View(accuracy); }
public ReportingCalibration(ReportViewer p_R) { reportViewer1 = p_R; reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); p_R.RenderingComplete += p_R_RenderingComplete; seted = false; }
public void ExcelWriter(string FilePath, ReportViewer Viewer) { byte[] byteListData = Viewer.LocalReport.Render("EXCEL"); using (FileStream fs = File.Create(FilePath)) { fs.Write(byteListData, 0, byteListData.Length); } }
public void ShowReport(ReportViewer rptViewer) { var report = GenerateRdl(); DumpRdl(report); rptViewer.LocalReport.DisplayName = string.IsNullOrEmpty(BuildReport.PageHeaderText) ? "Report" : BuildReport.PageHeaderText; rptViewer.LocalReport.LoadReportDefinition(report); rptViewer.LocalReport.Refresh(); }
public FileResult ApplyDetailEvaporate(int Y, int equipment_id) { string DBConnectionCode = CommSetup.CommWebSetup.DB0_CodeString; ReportCenter logicCenter = new ReportCenter(DBConnectionCode); db0 = ReportCenter.getDB0; Apply_User getUserData = null; if (this.UserId != null) { getUserData = db0.Apply_User.Where(x => x.USERID == this.UserId).FirstOrDefault(); } var getApplyData = db0.Apply.Where(x => x.userid == this.UserId && x.y == Y).FirstOrDefault(); var Evaporate = db0.Apply_Detail_Evaporate.Where(x => x.y == Y && x.equipment_id == equipment_id).FirstOrDefault(); ReportData rpt = new ReportData() { ReportName = "Apply.rdlc" }; List<ReportParameter> rparam = new List<ReportParameter>(); rparam.Add(new ReportParameter("report_name", "冰水主機蒸發器冰水出、回水溫差報表")); rparam.Add(new ReportParameter("applyName", getUserData.USERNAME)); rparam.Add(new ReportParameter("applyYear", Y.ToString())); rparam.Add(new ReportParameter("doc_name", getApplyData.doc_name)); rparam.Add(new ReportParameter("doc_rank", getApplyData.doc_rank)); rparam.Add(new ReportParameter("doc_tel", getApplyData.doc_tel)); rparam.Add(new ReportParameter("mng_name", getApplyData.mng_name)); rparam.Add(new ReportParameter("mng_rank", getApplyData.mng_rank)); rparam.Add(new ReportParameter("mng_tel", getApplyData.mng_tel)); db0.Dispose(); //rpt.Data = logicCenter.rpt_apply_detailEva(Y, getUserData.USERID); ReportViewer rptvw = new ReportViewer(); rptvw.ProcessingMode = ProcessingMode.Local; ReportDataSource rds = new ReportDataSource("MasterData", rpt.Data); rptvw.LocalReport.DataSources.Clear(); rptvw.LocalReport.ReportPath = @"_Code\RPTFile\" + rpt.ReportName; rptvw.LocalReport.DataSources.Add(rds); foreach (var pa in rparam) { rptvw.LocalReport.SetParameters(pa); } rptvw.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); rptvw.LocalReport.Refresh(); Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; byte[] bytes = rptvw.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); Stream outputStream = new MemoryStream(bytes); string setFileName = "申報表-蒸發器" + DateTime.Now.Ticks + ".pdf"; return File(outputStream, "application/pdf", setFileName); }
private void anteprimaStampaLoad(object sender, EventArgs e) { _reportViewer = new ReportViewer {ProcessingMode = ProcessingMode.Local}; // Set RDL file _reportViewer.LocalReport.ReportEmbeddedResource = "Gipasoft.Stabili.UI.Millesimi.Reports.RiepilogoMillesimi.rdlc"; // Supply a DataTable corresponding to each report dataset _reportViewer.LocalReport.DataSources.Add(new ReportDataSource("MillesimoDTO", _riepilogoMillesimi)); // Add the reportviewer to the form Controls.Add(_reportViewer); _reportViewer.Dock = DockStyle.Fill; _reportViewer.LocalReport.EnableExternalImages = true; var parameterCondominio1 = new ReportParameter("condominio1", _reportParameters.DescrizioneCondominio[0]); var parameterCondominio2 = new ReportParameter("condominio2", _reportParameters.DescrizioneCondominio[1]); var parameterCondominio3 = new ReportParameter("condominio3", _reportParameters.DescrizioneCondominio[2]); var parameterCondominio4 = new ReportParameter("condominio4", _reportParameters.DescrizioneCondominio[3]); var parameterDescrizioneCondominio = new ReportParameter("descrizioneCondominio", _reportParameters.DescrizioneSingolaCondominio); var parameterCodiceCondominio = new ReportParameter("codiceCondominio", _reportParameters.CodiceCondominio); var parameterEsercizio = new ReportParameter("esercizio", _reportParameters.DescrizioneEsercizio); var parameterAzienda = new ReportParameter("azienda", _reportParameters.DescrizioneAzienda); var parameterGriglia = new ReportParameter("griglia", _reportParameters.VisualizzaGriglia.ToString()); var parameterNote = new ReportParameter("note", _reportParameters.Note); var parameterIntestazioneStudio = new ReportParameter("intestazioneStudio", _reportParameters.IntestazioneStudio); var parameterViaStudio = new ReportParameter("viaStudio", _reportParameters.ViaStudio); var parameterCapStudio = new ReportParameter("capStudio", _reportParameters.CapStudio); var parameterLocalitaStudio = new ReportParameter("localitaStudio", _reportParameters.LocalitaStudio); var parameterSaltoPagina = new ReportParameter("saltoPagina", _reportParameters.SaltoPagina.ToString()); var parameterLogo = new ReportParameter("logo", _documentService.SaveInLocalCache(new Business.Interface.DocumentInfo { Body = _aziendaService.GetLogo().LogoAzienda, FileName = "logo.jpg" })); _reportViewer.LocalReport.SetParameters( new[] { parameterCondominio1, parameterCondominio2, parameterCondominio3, parameterCondominio4, parameterDescrizioneCondominio, parameterCodiceCondominio, parameterEsercizio, parameterAzienda, parameterGriglia, parameterNote, parameterIntestazioneStudio, parameterViaStudio, parameterCapStudio, parameterLocalitaStudio, parameterLogo, parameterSaltoPagina }); _reportViewer.RefreshReport(); }
public void OnDrillthrough(ReportViewer reportViewer, DrillthroughEventArgs e) { var report = (LocalReport)e.Report; var parameters = report.GetParameters(); var countryId = int.Parse(parameters["CountryId"].Values.First()); var cities = LocalData.GetCitiesByCountryId(countryId); report.DataSources.Add(new ReportDataSource("Cities", cities)); report.Refresh(); }
private void btnPrint_Click(object sender, EventArgs e) { var reportViewer = new ReportViewer(); reportViewer.HeaderWidthPercent = 100; reportViewer.ContentWidthPercent = 100; reportViewer.RowsPerPage = 30; reportViewer.HeaderContent = string.Format("<center><h2>Daily Collection Report for the Date of {0:dd/MM/yyyy} of {1}</h2></center>", this.dtValue.Text, ApplicationElements.loggedInEmployee.LoginId); reportViewer.GenerateFromGridView(this.dgvServiceReport, false); reportViewer.Show(this); }
protected override void RescueMode() { MedVitalSignGraph vitalSignGraph = null; MedDrugGraph drugGraph = null; MedGridGraph gridGraph = null; List <MedVitalSignGraph> vitalSignGraphs = ReportViewer.GetControls <MedVitalSignGraph>(); List <MedDrugGraph> drugGraphs = ReportViewer.GetControls <MedDrugGraph>(); List <MedGridGraph> gridGraphs = ReportViewer.GetControls <MedGridGraph>(); if (vitalSignGraphs.Count > 0) { vitalSignGraph = vitalSignGraphs[0]; if (!ExtendApplicationContext.Current.IsRescueMode) { ExtendApplicationContext.Current.OldMinScaleCount = vitalSignGraph.MinScaleCount; } } if (drugGraphs.Count > 0) { drugGraph = drugGraphs[0]; } if (gridGraphs.Count > 0) { gridGraph = gridGraphs[0]; } base.RescueMode(); if (ExtendApplicationContext.Current.IsRescueMode) { switch (vitalSignGraph.ScaleType) { case ScaleType.HalfHour: vitalSignGraph.MinScaleCount = 30; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 30; gridGraph.MinScaleCount = 30; break; case ScaleType.Hour: vitalSignGraph.MinScaleCount = 60; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 60; gridGraph.MinScaleCount = 60; break; case ScaleType.OneMin: vitalSignGraph.MinScaleCount = 1; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 1; gridGraph.MinScaleCount = 1; break; case ScaleType.Quarter: vitalSignGraph.MinScaleCount = 15; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 15; gridGraph.MinScaleCount = 15; break; case ScaleType.TenMin: vitalSignGraph.MinScaleCount = 10; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 10; gridGraph.MinScaleCount = 10; break; case ScaleType.TriQuarter: vitalSignGraph.MinScaleCount = 45; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 45; gridGraph.MinScaleCount = 45; break; case ScaleType.TwiHour: vitalSignGraph.MinScaleCount = 120; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 120; gridGraph.MinScaleCount = 120; break; case ScaleType.TwoMin: vitalSignGraph.MinScaleCount = 2; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 2; gridGraph.MinScaleCount = 2; break; case ScaleType.FiveMin: vitalSignGraph.MinScaleCount = 5; vitalSignGraph.OnlyShowFileMinute = false; drugGraph.MinScaleCount = 5; gridGraph.MinScaleCount = 5; break; } } else { vitalSignGraph.MinScaleCount = ExtendApplicationContext.Current.OldMinScaleCount; vitalSignGraph.OnlyShowFileMinute = true; drugGraph.MinScaleCount = ExtendApplicationContext.Current.OldMinScaleCount; gridGraph.MinScaleCount = ExtendApplicationContext.Current.OldMinScaleCount; } this.RefreshData(); }
/// <summary> /// ReportViewer渲染完成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ReportView_RenderingComplete(object sender, Microsoft.Reporting.WinForms.RenderingCompleteEventArgs e) { if (e.Exception != null) { var exp = e.Exception; while (exp.InnerException != null) { exp = exp.InnerException; } Message = string.Format("无法打印:{0}", exp.Message); return; } ReportViewer rv = sender as ReportViewer; //rv.SetPageSettings(Config.GetPageSettings()); #region 如果能直接打印了 if (!PrintData.PrintTemplate.IsAppend || CanPrint != null && CanPrint.Value) { if (e.Exception == null && rv.LocalReport.DataSources.Count > 0) { try { Export(rv.LocalReport); printDocument1.DefaultPageSettings = Config.GetPageSettings(); printDocument1.PrinterSettings = Config.GetPrintSettings(); printDocument1.Print(); StreamDispose(); } catch (Exception exp) { Message = string.Format("无法打印:{0}", exp.Message); //XMessageBox.Warning(string.Format("无法打印:{0}", exp.Message)); } } return; } #endregion #region 往页后面追加行 if (PrintData.PrintTemplate.IsAppend) { var totalPages = rv.GetTotalPages(); if (LastPageCount == null) { LastPageCount = totalPages; } var dt = rv.LocalReport.DataSources[0].Value as DataTable; if (LastPageCount == totalPages) { dt.Rows.Add(dt.NewRow()); } else { dt.Rows.RemoveAt(dt.Rows.Count - 1); CanPrint = true; } rv.RefreshReport(); return; } #endregion }
public void RenderReport() { string mimeType, encoding, extension; string[] streamids; Warning[] warnings; ReportViewer rview = new ReportViewer(); ReportParameter startDateParameter = new ReportParameter(); ReportParameter endDateParameter = new ReportParameter(); ReportParameter mealTypeParameter = new ReportParameter(); ReportParameter scheduleTypeParameter = new ReportParameter(); ReportParameter reportIDParameter = new ReportParameter(); ReportParameter communityAreaParameter = new ReportParameter(); ReportParameter siteNameParameter = new ReportParameter(); ReportParameter labelTextParameter = new ReportParameter(); ReportParameter bunCountParameter = new ReportParameter(); ReportParameter loafCountParameter = new ReportParameter(); ReportParameter sliceCountParameter = new ReportParameter(); ReportParameter bagCountParameter = new ReportParameter(); const string deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>"; rview.ServerReport.ReportServerUrl = new Uri("http://gcfd-websrvr/reportserver"); rview.ServerReport.ReportPath = "http://gcfd-websrvr/gcfdinternalresources/Reports/" + Name + ".rdl"; rview.ServerReport.Refresh(); if (!string.IsNullOrEmpty(startDate)) { startDateParameter.Name = "MealStartDate"; startDateParameter.Values.Add(StartDate); rview.ServerReport.SetParameters(new ReportParameter[] { startDateParameter }); } if (!string.IsNullOrEmpty(endDate)) { endDateParameter.Name = "MealEndDate"; endDateParameter.Values.Add(EndDate); rview.ServerReport.SetParameters(new ReportParameter[] { endDateParameter }); } if (!string.IsNullOrEmpty(mealType)) { mealTypeParameter.Name = "MealType"; mealTypeParameter.Values.Add(MealType); rview.ServerReport.SetParameters(new ReportParameter[] { mealTypeParameter }); } if (!string.IsNullOrEmpty(reportID)) { reportIDParameter.Name = "ReportID"; reportIDParameter.Values.Add(ReportID); rview.ServerReport.SetParameters(new ReportParameter[] { reportIDParameter }); } if (!string.IsNullOrEmpty(communityArea)) { communityAreaParameter.Name = "CommunityArea"; communityAreaParameter.Values.Add(CommunityArea); rview.ServerReport.SetParameters(new ReportParameter[] { communityAreaParameter }); } if (!string.IsNullOrEmpty(siteName)) { siteNameParameter.Name = "SiteName"; siteNameParameter.Values.Add(SiteName); rview.ServerReport.SetParameters(new ReportParameter[] { siteNameParameter }); } if (!string.IsNullOrEmpty(labelText)) { labelTextParameter.Name = "ReportText"; labelTextParameter.Values.Add(LabelText); rview.ServerReport.SetParameters(new ReportParameter[] { labelTextParameter }); } if (!string.IsNullOrEmpty(sliceCount)) { sliceCountParameter.Name = "SliceCount"; sliceCountParameter.Values.Add(SliceCount); rview.ServerReport.SetParameters(new ReportParameter[] { sliceCountParameter }); } if (!string.IsNullOrEmpty(bunCount)) { bunCountParameter.Name = "BunCount"; bunCountParameter.Values.Add(BunCount); rview.ServerReport.SetParameters(new ReportParameter[] { bunCountParameter }); } if (!string.IsNullOrEmpty(loafCount)) { loafCountParameter.Name = "LoafCount"; loafCountParameter.Values.Add(LoafCount); rview.ServerReport.SetParameters(new ReportParameter[] { loafCountParameter }); } if (!string.IsNullOrEmpty(bagCount)) { bagCountParameter.Name = "BagCount"; bagCountParameter.Values.Add(BagCount); rview.ServerReport.SetParameters(new ReportParameter[] { bagCountParameter }); } rview.Width = Unit.Percentage(100); Response.Clear(); byte[] bytes = rview.ServerReport.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); Response.ContentType = "application/pdf"; Response.AddHeader("Content-disposition", "filename=" + name + ".pdf"); Response.OutputStream.Write(bytes, 0, bytes.Length); Response.OutputStream.Flush(); Response.OutputStream.Close(); Response.Flush(); Response.Close(); }
public void TongLuongChiTraTrongDuAn(string tenduan, ReportViewer reportViewer) { tk.TongLuongChiTraTrongDuAn(tenduan, reportViewer); }
public void LuongChiTraTrongDuAnTheoThang(string nam, string thang, ReportViewer reportViewer) { tk.LuongChiTraTrongDuAnTheoThang(nam, thang, reportViewer); }
public ActionResult Index(DeficiencyFilesPINWiseModel param) { ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; var deficiencypinwiseModel = new System.Data.DataTable(); List <DeficiencyFilesPINWiseModel.YearDate> yeardate = new List <DeficiencyFilesPINWiseModel.YearDate>(); DateTime yearToday = DateTime.Now; for (int i = 2006; i <= yearToday.Year; i++) { yeardate.Add(new DeficiencyFilesPINWiseModel.YearDate { Id = i, Value = i.ToString() }); } param.YearOptions = yeardate; if (!param.IncludeParameter) { if (param.PIN == "0") { if (param.ExcludeAdmission) { deficiencypinwiseModel = _clPatientStatisticsDB.DeficiencyPINWiseAll(param.StartDate, param.EndDate, param.ExcludeAdmission); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PatientStatistics\DeficiencyPINWise.rdl"; reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", param.StartDate)); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", param.EndDate)); } else { deficiencypinwiseModel = _clPatientStatisticsDB.DeficiencyPINWiseAll(param.StartDate, param.EndDate, param.ExcludeAdmission); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PatientStatistics\DeficiencyPINWise.rdl"; reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", param.StartDate)); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", param.EndDate)); } } else { if (param.ExcludeAdmission) { deficiencypinwiseModel = _clPatientStatisticsDB.DeficiencyPINWise(param.StartDate, param.EndDate, param.PIN, param.ExcludeAdmission); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PatientStatistics\DeficiencyPINWise.rdl"; reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", param.StartDate)); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", param.EndDate)); } else { deficiencypinwiseModel = _clPatientStatisticsDB.DeficiencyPINWise(param.StartDate, param.EndDate, param.PIN, param.ExcludeAdmission); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PatientStatistics\DeficiencyPINWise.rdl"; reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", param.StartDate)); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", param.EndDate)); } } } else { if ((param.Speciality != "0") && (param.Doctor == "0")) { deficiencypinwiseModel = _clPatientStatisticsDB.DeficiencyPINWiseComparisonAll(param.ExcludeAdmission, param.MonthFromDate, param.YearFromDate, param.MonthToDate, param.YearToDate, param.Standard, param.Speciality, param.Doctor); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PatientStatistics\DeficiencyPINWiseComparison.rdl"; reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", param.StartDate)); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", param.EndDate)); } else if ((param.Speciality != "0") && (param.Doctor != "0")) { deficiencypinwiseModel = _clPatientStatisticsDB.DeficiencyPINWiseComparison(param.ExcludeAdmission, param.MonthFromDate, param.YearFromDate, param.MonthToDate, param.YearToDate, param.Doctor, param.Standard); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PatientStatistics\DeficiencyPINWiseComparison.rdl"; reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", param.StartDate)); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", param.EndDate)); } else { deficiencypinwiseModel = _clPatientStatisticsDB.DeficiencyPINWiseComparisonSpeciality(param.ExcludeAdmission, param.MonthFromDate, param.YearFromDate, param.MonthToDate, param.YearToDate, param.Standard); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Areas\ManagementReports\Reports\PatientStatistics\DeficiencyPINWiseComparison.rdl"; reportViewer.LocalReport.SetParameters(new ReportParameter("StartDate", param.StartDate)); reportViewer.LocalReport.SetParameters(new ReportParameter("EndDate", param.EndDate)); } } reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dsDeficiencyPINWise", deficiencypinwiseModel)); reportViewer.LocalReport.DisplayName = base.SaveFilestreamtoPDF(reportViewer); ViewBag.ReportViewer = reportViewer; return(View(param)); }
public void TongSLNhanVien(string tenduan, ReportViewer reportViewer) { tk.TongSLNhanVien(tenduan, reportViewer); }
private void InvoiceGen(string invoice_id) { try{ Dao.ReportDao repDAO = new Dao.ReportDao(); DataTable buyer = repDAO.getDatatable("select * from contact where id = " + repDAO.getBuyerID(invoice_id)); DataTable seller = repDAO.getDatatable("select * from contact where id = " + repDAO.getSellerID(invoice_id)); DataTable reference = repDAO.getDatatable("select * from reference where invoice_id = '" + invoice_id + "'"); DataTable dt = repDAO.getReportData(invoice_id); DataTable item = repDAO.getDatatable_Item_Raw(); String date = util.ReportUtils.getThaiDate(dt.Rows[0]["issue_date"].ToString()); string reftext1 = ""; string reftext2 = ""; string reftext3 = ""; if (reference.Rows.Count > 0) // yes is reprint , !repDAO.isReprint(invoice_id) { //Initial Report Parameter util.ReportUtils utils = new util.ReportUtils(); if (dt.Rows[0]["invoice_name"].ToString() == "ใบเพิ่มหนี้") { reftext1 = "สาเหตุการออกใบเพิ่มหนี้"; reftext2 = "เลขที่ใบกำกับภาษีอ้างถึง"; reftext3 = "วันที่ของใบกำกับภาษีอ้างถึง"; } else if (dt.Rows[0]["invoice_name"].ToString() == "ใบลดหนี้") { reftext1 = "สาเหตุการออกใบลดหนี้"; reftext2 = "เลขที่ใบกำกับภาษีอ้างถึง"; reftext3 = "วันที่ของใบกำกับภาษีอ้างถึง"; } else { reftext1 = "สาเหตุในการยกเลิกใบกำกับภาษีเดิม"; reftext2 = "เลขที่ใบกำกับภาษีเดิม"; reftext3 = "วันที่ของใบกำกับภาษีเดิม"; } //Assign Report Parameter ReportParameter docNo = new ReportParameter("docNo", invoice_id.ToString()); ReportParameter reportDate = new ReportParameter("date", date); ReportParameter sell_name = new ReportParameter("sell_name", seller.Rows[0]["name"].ToString()); ReportParameter sell_taxno = new ReportParameter("sell_taxno", seller.Rows[0]["tax_id"].ToString()); ReportParameter sell_comno = new ReportParameter("sell_comno", utils.getBranch(seller.Rows[0]["branch_id"].ToString()));// ReportParameter sell_email = new ReportParameter("sell_email", seller.Rows[0]["email"].ToString()); ReportParameter sell_tellno = new ReportParameter("sell_tellno", util.ReportUtils.getFullThaiMobilePhone(seller.Rows[0]["phone_no"].ToString(), seller.Rows[0]["phone_ext"].ToString())); ReportParameter sell_add1 = new ReportParameter("sell_add1", seller.Rows[0]["address1"].ToString()); ReportParameter sell_zipcode = new ReportParameter("sell_zipcode", seller.Rows[0]["zipcode"].ToString()); ReportParameter sell_district = new ReportParameter("sell_district", seller.Rows[0]["district_name"].ToString()); ReportParameter sell_subdistrict = new ReportParameter("sell_subdistrict", seller.Rows[0]["subdistrict_name"].ToString()); ReportParameter sell_province = new ReportParameter("sell_province", seller.Rows[0]["province_name"].ToString()); ReportParameter sell_house_no = new ReportParameter("sell_house_no", seller.Rows[0]["house_no"].ToString()); ReportParameter buy_name = new ReportParameter("buy_name", buyer.Rows[0]["name"].ToString()); ReportParameter buy_taxno = new ReportParameter("buy_taxno", buyer.Rows[0]["tax_id"].ToString()); ReportParameter buy_comno = new ReportParameter("buy_comno", utils.getBranch(buyer.Rows[0]["branch_id"].ToString())); ReportParameter buy_email = new ReportParameter("buy_email", buyer.Rows[0]["email"].ToString()); ReportParameter buy_tellno = new ReportParameter("buy_tellno", util.ReportUtils.getFullThaiMobilePhone(buyer.Rows[0]["phone_no"].ToString(), buyer.Rows[0]["phone_ext"].ToString())); ReportParameter buy_refer = new ReportParameter("buy_refer", buyer.Rows[0]["contact_person"].ToString()); ReportParameter buy_add1 = new ReportParameter("buy_add1", buyer.Rows[0]["address1"].ToString()); ReportParameter buy_zipcode = new ReportParameter("buy_zipcode", buyer.Rows[0]["zipcode"].ToString()); ReportParameter buy_district = new ReportParameter("buy_district", seller.Rows[0]["district_name"].ToString()); ReportParameter buy_subdistrict = new ReportParameter("buy_subdistrict", seller.Rows[0]["subdistrict_name"].ToString()); ReportParameter buy_province = new ReportParameter("buy_province", seller.Rows[0]["province_name"].ToString()); ReportParameter buy_house_no = new ReportParameter("buy_house_no", seller.Rows[0]["house_no"].ToString()); ReportParameter testflag = new ReportParameter("testflag", "Y"); ReportParameter referText1 = new ReportParameter("referText1", reftext1); ReportParameter referText2 = new ReportParameter("referText2", reftext2); ReportParameter referText3 = new ReportParameter("referText3", reftext3); ReportParameter grand_totalthai = new ReportParameter("grand_totalthai", "( " + util.ReportUtils.getFullThaiBathController(dt.Rows[0]["grand_total"].ToString()) + " )"); /*FOR REPRINT*/ var Ref = util.ReportUtils.getReference(reference); ReportParameter ref_docno = new ReportParameter("ref_docno", Ref[0]); ReportParameter ref_docdate = new ReportParameter("ref_docdate", Ref[1]); ReportDataSource dataSource = new ReportDataSource(); dataSource.Name = "Tax"; dataSource.Value = dt; Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; ReportViewer reportViewer = new ReportViewer(); reportViewer.LocalReport.DataSources.Add(dataSource); reportViewer.LocalReport.ReportPath = absolutepath + "Report\\tax_multipage_return.rdlc"; reportViewer.LocalReport.ReportEmbeddedResource = "eTaxInvoicePdfGenerator.Report.tax_multipage_return.rdlc"; reportViewer.LocalReport.SetParameters(new ReportParameter[] { docNo, reportDate, sell_name, sell_taxno, sell_comno, sell_email, sell_tellno, buy_name, buy_taxno, buy_comno, buy_email, buy_tellno, buy_refer , testflag, grand_totalthai, ref_docno, ref_docdate , sell_add1, sell_zipcode, buy_add1, buy_zipcode , referText1, referText2, referText3, sell_district, sell_subdistrict, sell_province, buy_district, buy_subdistrict, buy_province, sell_house_no, buy_house_no }); invoicePdf = reportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); util.getInvoice_Xml invXml = new util.getInvoice_Xml(buyer, seller, reference, item, invoice_id, absolutepath); invoiceXmlstring = invXml.get_Xml(); invoiceXmlbyte = Encoding.ASCII.GetBytes(invoiceXmlstring); //System.IO.File.WriteAllBytes("test.pdf", invoicePdf); //Response.Buffer = true; //Response.Clear(); //Response.ContentType = mimeType; //Response.AddHeader("content-disposition", "attachment; filename=" + fileName + "." + extension); //Response.BinaryWrite(bytes); // create the file //Response.Flush(); // send it to the client to download /*string[] netpath = path.Split('\\'); * string newpath = netpath[0] + "\\" + netpath[1] + "\\" + netpath[2] + "\\" + netpath[3] + "\\" + "Export.xml"; * System.IO.File.WriteAllText(newpath, XML);*/ //_reportViewer.RefreshReport(); //_isReportViewerLoaded = true; } else { //Initial Report Parameter util.ReportUtils utils = new util.ReportUtils(); //Assign Report Parameter ReportParameter docNo = new ReportParameter("docNo", invoice_id.ToString()); ReportParameter reportDate = new ReportParameter("date", date); ReportParameter sell_name = new ReportParameter("sell_name", seller.Rows[0]["name"].ToString()); ReportParameter sell_taxno = new ReportParameter("sell_taxno", seller.Rows[0]["tax_id"].ToString()); ReportParameter sell_comno = new ReportParameter("sell_comno", utils.getBranch(seller.Rows[0]["branch_id"].ToString()));// ReportParameter sell_email = new ReportParameter("sell_email", seller.Rows[0]["email"].ToString()); ReportParameter sell_tellno = new ReportParameter("sell_tellno", util.ReportUtils.getFullThaiMobilePhone(seller.Rows[0]["phone_no"].ToString(), seller.Rows[0]["phone_ext"].ToString())); ReportParameter sell_add1 = new ReportParameter("sell_add1", seller.Rows[0]["address1"].ToString()); ReportParameter sell_zipcode = new ReportParameter("sell_zipcode", seller.Rows[0]["zipcode"].ToString()); ReportParameter sell_district = new ReportParameter("sell_district", seller.Rows[0]["district_name"].ToString()); ReportParameter sell_subdistrict = new ReportParameter("sell_subdistrict", seller.Rows[0]["subdistrict_name"].ToString()); ReportParameter sell_province = new ReportParameter("sell_province", seller.Rows[0]["province_name"].ToString()); ReportParameter sell_house_no = new ReportParameter("sell_house_no", seller.Rows[0]["house_no"].ToString()); ReportParameter buy_name = new ReportParameter("buy_name", buyer.Rows[0]["name"].ToString()); ReportParameter buy_taxno = new ReportParameter("buy_taxno", buyer.Rows[0]["tax_id"].ToString()); ReportParameter buy_comno = new ReportParameter("buy_comno", utils.getBranch(buyer.Rows[0]["branch_id"].ToString())); ReportParameter buy_email = new ReportParameter("buy_email", buyer.Rows[0]["email"].ToString()); ReportParameter buy_tellno = new ReportParameter("buy_tellno", util.ReportUtils.getFullThaiMobilePhone(buyer.Rows[0]["phone_no"].ToString(), buyer.Rows[0]["phone_ext"].ToString())); ReportParameter buy_refer = new ReportParameter("buy_refer", buyer.Rows[0]["contact_person"].ToString()); ReportParameter buy_house_no = new ReportParameter("buy_house_no", buyer.Rows[0]["house_no"].ToString()); ReportParameter buy_add1 = new ReportParameter("buy_add1", buyer.Rows[0]["address1"].ToString()); ReportParameter buy_zipcode = new ReportParameter("buy_zipcode", buyer.Rows[0]["zipcode"].ToString()); ReportParameter buy_district = new ReportParameter("buy_district", buyer.Rows[0]["district_name"].ToString()); ReportParameter buy_subdistrict = new ReportParameter("buy_subdistrict", buyer.Rows[0]["subdistrict_name"].ToString()); ReportParameter buy_province = new ReportParameter("buy_province", buyer.Rows[0]["province_name"].ToString()); ReportParameter testflag = new ReportParameter("testflag", "Y"); ReportParameter grand_totalthai = new ReportParameter("grand_totalthai", "( " + util.ReportUtils.getFullThaiBathController(dt.Rows[0]["grand_total"].ToString()) + " )"); ReportDataSource dataSource = new ReportDataSource(); dataSource.Name = "Tax"; dataSource.Value = dt; Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; ReportViewer reportViewer = new ReportViewer(); reportViewer.LocalReport.DataSources.Add(dataSource); reportViewer.LocalReport.ReportPath = absolutepath + "Report\\tax_multipage.rdlc"; reportViewer.LocalReport.ReportEmbeddedResource = "eTaxInvoicePdfGenerator.Report.tax_multipage.rdlc"; reportViewer.LocalReport.SetParameters(new ReportParameter[] { docNo, reportDate, sell_name, sell_taxno, sell_comno, sell_email, sell_tellno, buy_name, buy_taxno, buy_comno, buy_email, buy_tellno, buy_refer , testflag, grand_totalthai, sell_add1, sell_zipcode, buy_add1, buy_zipcode, sell_district, sell_subdistrict, sell_province, buy_district, buy_subdistrict, buy_province, buy_house_no, sell_house_no }); reportViewer.LocalReport.DisplayName = "Hello"; invoicePdf = reportViewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); //System.IO.File.WriteAllBytes("test.pdf", invoicePdf); util.getInvoice_Xml invXml = new util.getInvoice_Xml(buyer, seller, reference, item, invoice_id, absolutepath); invoiceXmlstring = invXml.get_Xml(); invoiceXmlbyte = Encoding.ASCII.GetBytes(invoiceXmlstring); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); System.Windows.MessageBox.Show(ex.InnerException.Message); System.Windows.MessageBox.Show(ex.InnerException.StackTrace); } }
public TestData() { //Prepare LocalReport parameters ReportParameterList = new List <ReportParameter>(); ReportParameterList.Add(new ReportParameter("ReportParameter1")); ReportParameterList.Add(new ReportParameter("ReportParameter2", "Value2")); ReportParameterList.Add(new ReportParameter("ReportParameter3", new string[] { "Array1", "Array2", "Array3" })); ReportParameterList.Add(new ReportParameter("ReportParameter4", "Value4", true)); ReportParameterList.Add(new ReportParameter("ReportParameter5", new string[] { "Array1", "Array2", "Array3" }, true)); //Prepare LocalReport datasource List <object> dataList = new List <object>(); for (int i = 0; i <= 10; i++) { var data = new { Column1 = "ValueA" + i.ToString(), Column2 = "ValueB" + i.ToString(), Column3 = "ValueC" + i.ToString() }; dataList.Add(data); } //ReportViewer properties ReportViewerTests = new ReportViewer(); ReportViewerTests.ProcessingMode = ProcessingMode.Local; ReportViewerTests.SizeToReportContent = true; ReportViewerTests.Width = Unit.Percentage(100); ReportViewerTests.Height = Unit.Percentage(100); //LocalReport properties ReportViewerTests.LocalReport.ReportPath = LocalReportPath; ReportViewerTests.LocalReport.DataSources.Add(new ReportDataSource("ReportViewerForMvcTestsReport", dataList)); ReportViewerTests.LocalReport.DataSources.Add(new ReportDataSource("ReportViewerForMvcTestsReport1", dataList)); ReportViewerTests.LocalReport.DataSources.Add(new ReportDataSource("ReportViewerForMvcTestsReport2", dataList)); ReportViewerTests.LocalReport.SetParameters(ReportParameterList); ReportViewerTests.LocalReport.SubreportProcessing += LocalReport_SubreportProcessing; //ServerReport properties //ReportViewerTests.ServerReport.ReportPath = ServerReportPath; //ReportViewerTests.ServerReport.ReportServerUrl = new Uri(ReportServerUrl); //ReportViewerTests.ServerReport.SetParameters(GetParametersServer()); //Set anonymous DataSource AnonymousDataSourceList = new[] { new { Name = "ReportViewerForMvcTestsReport", Value = dataList }, new { Name = "ReportViewerForMvcTestsReport1", Value = dataList }, new { Name = "ReportViewerForMvcTestsReport2", Value = dataList }, }; AnonymousDataSource = new { Name = "ReportViewerForMvcTestsReport2", Value = dataList }; }
public ReportViewer TaskReportRDLC(SearchTaskReport searchParams, Email emailInput, string reportType) { string reportDueDate = "All Dates"; string reportAssignDate = "All Dates"; SearchFormat searchoutput = new SearchFormat(); if (searchParams.DueFromDate != null) { if (searchParams.DueToDate != null) { reportDueDate = searchParams.DueFromDate.Value.ToShortDateString() + " - " + searchParams.DueToDate.Value.ToShortDateString(); } else { reportDueDate = "since " + searchParams.DueFromDate.Value.ToShortDateString(); } } if (searchParams.DueToDate != null) { if (searchParams.DueFromDate == null) { reportDueDate = "through " + searchParams.DueToDate.Value.ToShortDateString(); } } if (searchParams.AssignFromDate != null) { if (searchParams.AssignToDate != null) { reportAssignDate = searchParams.AssignFromDate.Value.ToShortDateString() + " - " + searchParams.AssignToDate.Value.ToShortDateString(); } else { reportAssignDate = "since " + searchParams.AssignFromDate.Value.ToShortDateString(); } } if (searchParams.AssignToDate != null) { if (searchParams.AssignFromDate == null) { reportAssignDate = "through " + searchParams.AssignToDate.Value.ToShortDateString(); } } ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; try { if (AppSession.ReportScheduleID > 0 && searchParams.ReportTitle != null) { searchParams.ReportTitle = String.Concat(searchParams.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID); } else { searchParams.ReportTitle = reportType == "Summary" ? "Task Report - Summary" : "Task Report - Detail"; } string rdlcfilename = reportType == "Summary" ? "rptTaskReportSummary.rdlc" : "rptTaskReportDetail.rdlc"; string dsName = "dsTaskReport"; DataView dvTaskReport = new DataView(TaskReportData(searchParams).Tables[0]); reportViewer.LocalReport.DisplayName = searchParams.ReportTitle; reportViewer.LocalReport.ReportPath = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\Corporate\Reports\" + rdlcfilename; reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dvTaskReport)); ReportParameter p1 = new ReportParameter("ReportTitle", searchParams.ReportTitle); ReportParameter p2 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Copyright.ToString()); ReportParameter p3 = new ReportParameter("ProgramName", AppSession.SelectedProgramName); ReportParameter p4 = new ReportParameter("SiteName", searchParams.SelectedSiteNames); ReportParameter p5 = new ReportParameter("ReportDateTitle", DateTime.Now.ToString()); ReportParameter p6 = new ReportParameter("Status", searchParams.SelectedTaskStatusNames); ReportParameter p7 = new ReportParameter("AssignedToNames", searchParams.SelectedAssignedToNames); ReportParameter p8 = new ReportParameter("AssignedByNames", searchParams.SelectedAssignedByNames); ReportParameter p9 = new ReportParameter("EmailCcedToName", searchParams.SelectedEmailCcedNames); ReportParameter p10 = new ReportParameter("DueDate", reportDueDate); ReportParameter p11 = new ReportParameter("AssignDate", reportAssignDate); ReportParameterCollection reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 }; if (reportType != "Summary") { ReportParameter p12 = new ReportParameter("OrgType3Header", AppSession.OrgRanking3Name.ToString()); ReportParameter p13 = new ReportParameter("OrgType2Header", AppSession.OrgRanking2Name.ToString()); ReportParameter p14 = new ReportParameter("OrgType1Header", AppSession.OrgRanking1Name.ToString()); reportParameterCollection.Add(p12); reportParameterCollection.Add(p13); reportParameterCollection.Add(p14); } reportViewer.LocalReport.SetParameters(reportParameterCollection); if (emailInput.To != null) { CommonService emailService = new CommonService(); int actionTypeId = (int)ActionTypeEnum.TaskReport; if (emailService.SendReportEmail(emailInput, actionTypeId, emailService.SetRdlcEmail(reportViewer))) { HttpContext.Current.Session["EmailSuccess"] = "true"; } else { HttpContext.Current.Session["EmailSuccess"] = "false"; } } } catch (Exception ex) { if (ex.Message.ToString() != "No Data") { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message + ";" + ex.InnerException.Message, PageName = "TaskReport", MethodName = "TaskReportRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } throw ex; } return(reportViewer); }
public ActionResult RptSpeseAvvicendamento(decimal meseAnnoDa, decimal meseAnnoA) { List <RptSpeseAvvicendamentoNewModel> lrpt = new List <RptSpeseAvvicendamentoNewModel>(); try { using (ModelDBISE db = new ModelDBISE()) { var annoMeseElabDa = db.MESEANNOELABORAZIONE.Find(meseAnnoDa); decimal annoMeseDa = Convert.ToDecimal(annoMeseElabDa.ANNO.ToString() + annoMeseElabDa.MESE.ToString().PadLeft(2, Convert.ToChar("0"))); decimal annoDa = annoMeseElabDa.ANNO; decimal meseDa = annoMeseElabDa.MESE; var annoMeseElabA = db.MESEANNOELABORAZIONE.Find(meseAnnoA); decimal annoMeseA = Convert.ToDecimal(annoMeseElabA.ANNO.ToString() + annoMeseElabA.MESE.ToString().PadLeft(2, Convert.ToChar("0"))); decimal annoA = annoMeseElabA.ANNO; decimal meseA = annoMeseElabA.MESE; using (dtSpeseAvvicendamentoNew dtsa = new dtSpeseAvvicendamentoNew()) { lrpt = dtsa.GetSpeseAvvicendamento(meseDa, annoDa, meseA, annoA, db); } string strMeseAnnoDa = ""; string strMeseAnnoA = ""; string strTotaleImporto = lrpt.Sum(a => a.Importo).ToString("#,##0.##"); string strDataOdierna = DateTime.Now.ToShortDateString(); using (dtElaborazioni dte = new dtElaborazioni()) { strMeseAnnoDa = CalcoloMeseAnnoElaborazione.NomeMese((EnumDescrizioneMesi)meseDa) + " " + annoDa.ToString(); strMeseAnnoA = CalcoloMeseAnnoElaborazione.NomeMese((EnumDescrizioneMesi)meseA) + " " + annoA.ToString(); } ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); reportViewer.Visible = true; reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"/Areas/Statistiche/RPT/RptSpeseAvvicendamentoNew.rdlc"; reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.Refresh(); ReportParameter[] parameterValues = new ReportParameter[] { new ReportParameter("paramMeseAnnoDa", strMeseAnnoDa), new ReportParameter("paramMeseAnnoA", strMeseAnnoA), new ReportParameter("paramTotaleImporto", strTotaleImporto), new ReportParameter("paramDataOdierna", strDataOdierna) }; reportViewer.LocalReport.SetParameters(parameterValues); ReportDataSource _rsource = new ReportDataSource("dsSpeseAvvicendamento", lrpt); reportViewer.LocalReport.DataSources.Add(_rsource); reportViewer.LocalReport.Refresh(); ViewBag.ReportViewer = reportViewer; } } catch (Exception ex) { return(PartialView("ErrorPartial", new MsgErr() { msg = ex.Message })); } return(PartialView()); }
public void EscolherReportParaExibir(ReportViewer reportViwer, string relatorio, BindingSource bindingSource) { this.FillDataSource(reportViwer, bindingSource, "Relatorio-Categorias"); }
public SubReportDemoViewModel(MainWindow window) { _mainWindow = window; _reportViewer = window.reportViewer; Initialize(); }
public void SLNhanVienTuADenB(string tenduan, string fromday, string today, ReportViewer reportViewer) { tk.SLNhanVienTuADenB(tenduan, fromday, today, reportViewer); }
public ActionResult ProjectCertificateRpt() { var reportViewer = new ReportViewer() { ProcessingMode = ProcessingMode.Local, SizeToReportContent = true, Width = Unit.Percentage(100), Height = Unit.Percentage(100), }; var projectId = Convert.ToInt32(Request["Id"]); ProjectsApplicationViewDataTable PD = new ProjectsApplicationViewDataTable(); ProjectsApplicationViewTableAdapter PA = new ProjectsApplicationViewTableAdapter(); PA.ProjectApplicationFillByProjectId(PD, projectId); foreach (DataRow row in PD.Rows) { GetInterventionTypeInput input = new GetInterventionTypeInput(); input.Id = int.Parse(row["interventionTypeId"].ToString()); GetInterventionTypeOutput output = _InterventionTypeAppService.GetInterventionTypeById(input); row["InterVType"] = output.InterventionName; getNeighborhoodIntput NInput = new getNeighborhoodIntput(); NInput.Id = Convert.ToInt32(row["neighborhoodID"].ToString()); getNeighborhoodOutput NOutput = _neighborhoodAppService.getNeighborhoodById(NInput); row["Neighborhood"] = NOutput.EName; var DonorId = row["donorId"].ToString(); if (!string.IsNullOrWhiteSpace(DonorId)) { GetDonorsInput DInput = new GetDonorsInput(); DInput.Id = Convert.ToInt32(row["donorId"].ToString()); var DOutput = _donorsAppService.GetDonorById(DInput); row["Donor"] = DOutput.DonorName; } else { row["Donor"] = "no Donor"; } var isBuildingHasRoof = Convert.ToByte(row["isBuildingHasRoof"].ToString()); if (isBuildingHasRoof == 1) { row["BuildingRoof"] = "Yes"; } else { row["BuildingRoof"] = "No"; } GetBuildingUsesInput UInput = new GetBuildingUsesInput(); UInput.id = Convert.ToInt32(row["buildingUsesID"].ToString()); var UOutput = _buildingUsesAppService.getBuildingUsesById(UInput); row["BuildingUses"] = UOutput.UsedFor; } var rows = PD.Rows; var ProjectID = Convert.ToInt32(rows[0]["Id"]); // var AllUploadedProjectFiles = _uploadProjectFilesAppService.GetAllUploadedProjectFiles(); // var ProjectUploadedFiles = from UF in AllUploadedProjectFiles where UF.ProjectId == ProjectID orderby UF.Id descending select UF; UploadProjectFilesViewDataTable UPD = new UploadProjectFilesViewDataTable(); UploadProjectFilesViewTableAdapter UPA = new UploadProjectFilesViewTableAdapter(); UPA.FillByProjectUploadFilesProjectId(UPD, ProjectID); reportViewer.LocalReport.ReportPath = @"Reporting\ProjectCertificate.rdlc"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ProjectApplicationDataSet", (object)PD)); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ProjectFilesDataSet", (object)UPD)); reportViewer.LocalReport.Refresh(); ViewBag.ReportViewer = reportViewer; return(View("ProjectCertificateView")); }
public void TongSoCongViecTuADenB(string tenduan, string fromday, string today, ReportViewer reportViewer) { tk.TongSoCongViecTuADenB(tenduan, fromday, today, reportViewer); }
public ActionResult print(string pTipoReporte, Int16 pIdPuesto) { #region Datos dummy //List<Persona> datos = new List<Persona>(){ // new Persona() { nombre = "Sacarias", apellido_materno = "Piedras del Rio"}, // new Persona() { nombre = "Alan", apellido_materno = "Brito" }, // new Persona() { nombre = "Marcos", apellido_materno = "Pinto" } //}; #endregion Datos dummy string DirectorioReportesRelativo = "~/Views/GenerarReporte/"; string urlArchivo = string.Format("{0}.{1}", "informe", "rdlc"); string FullPathReport = string.Format("{0}{1}", this.HttpContext.Server.MapPath(DirectorioReportesRelativo), urlArchivo); ReportViewer Reporte = new ReportViewer(); Reporte.Reset(); Reporte.LocalReport.ReportPath = FullPathReport; ReportParameter[] parametros = new ReportParameter[1]; parametros[0] = new ReportParameter("tipoReporte", pTipoReporte); Reporte.LocalReport.SetParameters(parametros); var objPersona = from cnt in _db.Contrato join emp in _db.Empleado on cnt.idEmpleado equals emp.idEmpleado join cnd in _db.Candidato on emp.idCandidato equals cnd.idCandidato join cvt in _db.Convocatoria on cnt.idConvocatoria equals cvt.idConvocatoria join pst in _db.Puesto on cvt.idPuesto equals pst.idPuesto join per in _db.Persona on cnd.idPersona equals per.idPersona join tct in _db.TipoContrato on cnt.idTipoContrato equals tct.idTipoContrato where cnd.idEstadoCandidato == 5 select new { Contrato = cnt, Empleado = emp, Puesto = pst, Persona = per }; if (pIdPuesto > 0) { objPersona = objPersona.Where(x => x.Puesto.idPuesto == pIdPuesto); } List <Reporte> objLstEmpleados = new List <Reporte>(); foreach (var itm in objPersona) { if (objLstEmpleados.Where(w => w.idEmpleado == itm.Empleado.idEmpleado).ToList().Count == 0) { objLstEmpleados.Add(new Reporte { idEmpleado = itm.Contrato.idContrato, documentoIdentidad = itm.Empleado.Candidato.Persona.documentoIdentidad, nombreCompleto = itm.Contrato.Empleado.Candidato.nombreCompleto, descripcionPuesto = itm.Contrato.Convocatoria.Puesto.descripcionPuesto, nroContrato = itm.Contrato.nroContrato, fechaIngresoStr = itm.Contrato.fechaInicioContratoStr, descripcionContrato = itm.Contrato.TipoContrato.descripcionContrato }); } } ReportDataSource DataSource = new ReportDataSource("dstInforme", objLstEmpleados); Reporte.LocalReport.DataSources.Add(DataSource); Reporte.LocalReport.Refresh(); Reporte.ExportContentDisposition = ContentDisposition.AlwaysInline; Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] file = Reporte.LocalReport.Render("PDF"); return(File(new MemoryStream(file).ToArray(), System.Net.Mime.MediaTypeNames.Application.Octet, /*Esto para forzar la descarga del archivo*/ string.Format("{0}{1}", "reporte_empleados.", "PDF"))); }
public void TongSoCongViec(string tenduan, ReportViewer reportViewer) { tk.TongSoCongViec(tenduan, reportViewer); }
/// <summary> /// Método para exportar a excel /// </summary> /// <returns></returns> private void Consultar() { try { DateTime fechaIni = DtpFechaInicial.SelectedDate.HasValue ? DtpFechaInicial.SelectedDate.Value : new DateTime(); DateTime fechaFin = DtpFechaFinal.SelectedDate.HasValue ? DtpFechaFinal.SelectedDate.Value : fechaIni; var organizacionInfo = (OrganizacionInfo)cmbOrganizacion.SelectedItem; int organizacionId = organizacionInfo.OrganizacionID; List <ReporteOperacionSanidadInfo> resultadoInfo = ObtenerReporteOperacionSanidad(organizacionId, fechaIni, fechaFin); if (resultadoInfo == null || !resultadoInfo.Any()) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ReporteOperacionSanidad_MsgSinInformacion, MessageBoxButton.OK, MessageImage.Warning); LimpiarCampos(); return; } var organizacionPl = new OrganizacionPL(); var organizacion = organizacionPl.ObtenerPorIdConIva(organizacionId); DtpFechaInicial.IsEnabled = false; DtpFechaFinal.IsEnabled = false; var nombreOrganizacion = organizacion != null ? organizacion.Division : String.Empty; var encabezado = new ReporteEncabezadoInfo { Titulo = Properties.Resources.ReporteOperadoresSanidad_TituloReporte, FechaInicio = fechaIni, FechaFin = fechaFin, Organizacion = Properties.Resources.ReportesSukarneAgroindustrial_Titulo + " (" + nombreOrganizacion + ")" }; foreach (var dato in resultadoInfo) { dato.Titulo = encabezado.Titulo; dato.FechaInicio = encabezado.FechaInicio; dato.FechaFin = encabezado.FechaFin; dato.Organizacion = encabezado.Organizacion; } var documento = new ReportDocument(); var reporte = String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "\\Reporte\\RptReporteOperacionSanidad.rpt"); documento.Load(reporte); documento.DataSourceConnections.Clear(); documento.SetDataSource(resultadoInfo); documento.Refresh(); var forma = new ReportViewer(documento, encabezado.Titulo); forma.MostrarReporte(); forma.Show(); } catch (ExcepcionServicio ex) { Logger.Error(ex); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ReporteIndicadoresSanidad_FalloCargarReporte, MessageBoxButton.OK, MessageImage.Error); } catch (Exception ex) { Logger.Error(ex); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ReporteIndicadoresSanidad_FalloCargarReporte, MessageBoxButton.OK, MessageImage.Error); } }
public void LuongChiTraTrongDuAnTheoNam(string nam, ReportViewer reportViewer) { tk.LuongChiTraTrongDuAnTheoNam(nam, reportViewer); }
private void cmdView_Execute(object obj) { try { if (fromInvoiceDate > toInvoiceDate) { UIHelper.ShowErrorMessage("From Date cannot not be greater than To Date"); return; } if ((toInvoiceDate - fromInvoiceDate).Days > 31) { UIHelper.ShowErrorMessage("Days Difference should not be greater than 31"); return; } if (fromInvoiceNo > toInvoiceNo) { UIHelper.ShowErrorMessage("From Invoice No. cannot not be greater than To Invoice No."); return; } if (fromInvoiceDate > toInvoiceDate) { UIHelper.ShowErrorMessage("From Date cannot not be greater than To Date"); return; } if (fromInvoiceNo != 0 && fromInvoiceNo != toInvoiceNo) { using (System.Windows.Forms.FolderBrowserDialog browse = new System.Windows.Forms.FolderBrowserDialog()) { browse.ShowDialog(); folderPath = browse.SelectedPath; } if (string.IsNullOrEmpty(folderPath)) { UIHelper.ShowErrorMessage("Select Path to save reports"); return; } } using (DataServiceClient pxy = new DataServiceClient()) { ObservableCollection <CompanyMaster> objComp = new ObservableCollection <CompanyMaster> { pxy.GetCompanyDetails() }; ObservableCollection <InvoiceReport> lstInvRept = pxy.FinalInvoiceReport(fromInvoiceNo, toInvoiceNo, fromInvoiceDate, toInvoiceDate); if (lstInvRept.Count <= 0) { UIHelper.ShowMessage("Data not found"); return; } for (int i = 0; i < lstInvRept.Count; i++) { Viewer = new WindowsFormsHost(); using (ReportViewer reportViewer = new ReportViewer()) { reportViewer.LocalReport.DataSources.Clear(); ObservableCollection <InvoiceReport> objTemp = new ObservableCollection <InvoiceReport> { lstInvRept[i] }; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dataSetCompany", objComp)); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dataSetInvoiceReport", objTemp)); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dataSetInvoice", lstInvRept[i].lstDetails)); if (lstInvRept[i].lstDetails.Sum(p => p.IGST) > 0) { reportViewer.LocalReport.ReportPath = System.Windows.Forms.Application.StartupPath + "//Views//Reports//I0003_IGST.rdlc"; } else { reportViewer.LocalReport.ReportPath = System.Windows.Forms.Application.StartupPath + "//Views//Reports//I0003_CSGST.rdlc"; } reportViewer.RefreshReport(); Viewer.Child = reportViewer; if (fromInvoiceNo != 0 && fromInvoiceNo != toInvoiceNo) { byte[] Bytes = reportViewer.LocalReport.Render(format: "PDF", deviceInfo: ""); using (FileStream stream = new FileStream(folderPath + "//" + lstInvRept[i].InvoiceNo + ".pdf", FileMode.Create)) { stream.Write(Bytes, 0, Bytes.Length); } } } } } } catch (FaultException ex) { UIHelper.ShowErrorMessage(ex.Message); } catch (Exception ex) { UIHelper.ShowErrorMessage(ex.Message); } }
private void PrintPickingList(string soNo, List <PickingDtl> lstPicking) { ShippingOrder soHDR = null; try { base.BeginProcessing("Begin Load Report...", "Please Waiting for Loading Report"); DataSet ds; using (ShippingOrderBLL shipOrdBll = new ShippingOrderBLL()) { ds = shipOrdBll.PrintPickingListReport(soNo, lstPicking, string.Empty); soHDR = shipOrdBll.GetShippingOrder(soNo); } ReportViewer viewer = new ReportViewer(); viewer.AutoCloseAfterPrint = true; RPT_PICKING_LIST rpt = new RPT_PICKING_LIST(); //RPT_PICKING_LIST_REPORT rpt = new RPT_PICKING_LIST_REPORT(); rpt.DataSource = ds; rpt.Parameters["paramUserPrint"].Value = this.USER_ID; rpt.CreateDocument(); if (soHDR.PARTY_ID == "PST008") { RPT_PICKING_LIST rpt2 = new RPT_PICKING_LIST(); rpt2.DataSource = ds; rpt2.CreateDocument(); for (int i = 0; i < rpt2.Pages.Count; i++) { rpt2.Pages[i].AssignWatermark(CreateTextWatermark("COPY")); } // rpt.Pages.AddRange(rpt2.Pages); int minPageCount = Math.Min(rpt.Pages.Count, rpt2.Pages.Count); for (int i = 0; i < minPageCount; i++) { rpt.Pages.Insert(i * 2 + 1, rpt2.Pages[i]); } if (rpt2.Pages.Count != minPageCount) { for (int i = minPageCount; i < rpt2.Pages.Count; i++) { rpt.Pages.Add(rpt2.Pages[i]); } } } viewer.SetReport(rpt); base.FinishedProcessing(); viewer.ShowDialog(); } catch (Exception ex) { base.FinishedProcessing(); XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } finally { base.FinishedProcessing(); } }
private void PrintDocuments(int pedidoIdPrint, int rePrint) { string sqlUpdate; var reportViewerForm = new ReportViewer(); DataSet dsResult = null; bool printCocina = false; bool printBar = false; bool printCocinaOk = false; bool printBarOk = false; if (cbCocina.Checked) { dsResult = DataUtil.FillDataSet(DataBaseQuerys.ReporteCocina(pedidoIdPrint, rePrint), "pedido_detalle"); if (dsResult.Tables[0].Rows.Count > 0) { if (AppConstant.GeneralInfo.Impresora.Cocina != string.Empty) { if (AppConstant.GeneralInfo.PrintText.Cocina) { PrintByText.printDocument(AppConstant.GeneralInfo.Impresora.Cocina, dsResult, "C"); } else { reportViewerForm.dsReport = dsResult; reportViewerForm.reporteName = AppConstant.Reportes.Cocina; reportViewerForm.tableNameReport = "pedido_detalle"; reportViewerForm.printerName = string.Empty; reportViewerForm.printerName = AppConstant.GeneralInfo.Impresora.Cocina; reportViewerForm.ShowDialog(); } printCocina = true; } else { MessageBox.Show(@"La impresora de la cocina no esta configurada.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); } sqlUpdate = "UPDATE pedido_detalle SET Impreso = 1 WHERE Codigo_Producto IN (SELECT Producto_id FROM Producto WHERE Producto_categoria_id <> 3) AND pedido_id = " + pedidoIdPrint + ""; DataUtil.UpdateThrow(sqlUpdate); } else { if (rePrint == 1) { MessageBox.Show(@"No existen nuevos productos o productos modificados.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } if (cbBar.Checked) { if (printCocina) { var diagResult = MessageBox.Show(@"Imprimio Correctamente el ticket de Cocina?", @"Impresion", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (diagResult == DialogResult.Yes) { printCocinaOk = true; } } else { printCocinaOk = true; } if (printCocinaOk) { dsResult = DataUtil.FillDataSet(DataBaseQuerys.ReporteBar(pedidoIdPrint, rePrint), "pedido_detalle"); if (dsResult.Tables[0].Rows.Count > 0) { if (AppConstant.GeneralInfo.Impresora.Bar != string.Empty) { if (AppConstant.GeneralInfo.PrintText.Bar) { PrintByText.printDocument(AppConstant.GeneralInfo.Impresora.Bar, dsResult, "B"); } else { reportViewerForm.dsReport = dsResult; reportViewerForm.reporteName = AppConstant.Reportes.Bar; reportViewerForm.tableNameReport = "pedido_detalle"; reportViewerForm.printerName = string.Empty; reportViewerForm.printerName = AppConstant.GeneralInfo.Impresora.Bar; reportViewerForm.ShowDialog(); } printBar = true; } else { MessageBox.Show(@"La impresora del Bar no esta configurada.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Warning); } sqlUpdate = "UPDATE pedido_detalle SET Impreso = 1 WHERE Codigo_Producto IN (SELECT Producto_id FROM Producto WHERE Producto_categoria_id = 3) AND pedido_id = " + pedidoIdPrint + ""; DataUtil.UpdateThrow(sqlUpdate); } else { if (rePrint == 1) { MessageBox.Show(@"No existen nuevos productos o productos modificados.", @"Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
public ActionResult ApplicationRpt() { List <SelectListItem> orderBy = new List <SelectListItem>(); orderBy.Add(new SelectListItem() { Text = "Full Name", Value = "fullName" }); orderBy.Add(new SelectListItem() { Text = "Reject Date", Value = "RejectDate" }); orderBy.Add(new SelectListItem() { Text = "Approved Date", Value = "ApprovedDate" }); List <SelectListItem> ApplicationStatus = new List <SelectListItem>(); ApplicationStatus.Add(new SelectListItem() { Text = "Rejected", Value = "Rejected" }); ApplicationStatus.Add(new SelectListItem() { Text = "Approved", Value = "Approved" }); var reportingViewModel = new ReportingViewModel() { OrderBy = orderBy, ApplicationStatus = ApplicationStatus }; var reportViewer = new ReportViewer() { ProcessingMode = ProcessingMode.Local, SizeToReportContent = true, Width = Unit.Percentage(100), Height = Unit.Percentage(100), }; ApplicationViewDataTable AD = new ApplicationViewDataTable(); ApplicationAdp AP = new ApplicationAdp("Select * From ApplicationView"); AP.cmdTimeout = 0; String Wheresql = ""; String OrderBy = Request["OrderBy"]; if (!string.IsNullOrWhiteSpace(Request["FullName"])) { Wheresql = CheckWhere(Wheresql) + " fullName Like N'%" + Request["FullName"] + "%'"; } if (!string.IsNullOrWhiteSpace(Request["previousRestorationSource"])) { Wheresql = CheckWhere(Wheresql) + " previousRestorationSource Like N'%" + Request["previousRestorationSource"] + "%'"; } if (!string.IsNullOrWhiteSpace(Request["ApprovedDateFrom"]) && !string.IsNullOrWhiteSpace(Request["ApprovedDateTo"])) { Wheresql = CheckWhere(Wheresql) + " format(ApprovedDate,'dd/mm/yyyy') between " + Request["ApprovedDateFrom"] + " and " + Request["ApprovedDateTo"]; } if (!string.IsNullOrWhiteSpace(Request["RejectDateFrom"]) && !string.IsNullOrWhiteSpace(Request["RejectDateTo"])) { Wheresql = CheckWhere(Wheresql) + " RejectDate between " + Request["RejectDateFrom"] + " and " + Request["RejectDateTo"]; } if (!string.IsNullOrWhiteSpace(Request["otherOwnershipType"])) { Wheresql = CheckWhere(Wheresql) + " otherOwnershipType Like N'%" + Request["otherOwnershipType"] + "%'"; } if (!string.IsNullOrWhiteSpace(Request["InterestedRepairingEntityName"])) { Wheresql = CheckWhere(Wheresql) + " interestedRepairingEntityName Like N'%" + Request["InterestedRepairingEntityName"] + "%'"; } if (!string.IsNullOrWhiteSpace(Request["ApplicationStatus"])) { Wheresql = CheckWhere(Wheresql) + " ApplicationStatus= " + Request["ApplicationStatus"]; } if (Wheresql.Length == 0) { ApplicationAdp AP2 = new ApplicationAdp("Select * From ApplicationView " + OrderBy); AP2.cmdTimeout = 0; AP2.Adapter.Fill(AD); } else { AP.QueryStr(Wheresql, OrderBy); AP.Adapter.Fill(AD); } foreach (DataRow row in AD.Rows) { var AppStatus = row["ApplicationStatus"].ToString(); if (!string.IsNullOrWhiteSpace(AppStatus)) { var applicationStatus = Convert.ToInt32(row["ApplicationStatus"].ToString()); if (applicationStatus == 0) { row["AppStatus"] = "Rejected"; } else { row["AppStatus"] = "Approved"; } } else { row["AppStatus"] = "Not Processed"; } } reportViewer.LocalReport.ReportPath = @"Reporting\ApplicationsReport.rdlc"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ApplicationDataSet", (object)AD)); reportViewer.LocalReport.Refresh(); ViewBag.ReportViewer = reportViewer; return(View("ApplicationRptView", reportingViewModel)); }
public byte[] SOUpload(string soNumber) { Microsoft.Reporting.WebForms.ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = Server.MapPath(@"~\Resources\LSISalesOrder.rdlc"); //viewer.LocalReport.ReportPath = "SalesOrder.rdlc"; List <SO_Header_Model> soheadermodel = SO_Header.RetrieveData(connection, soNumber, false); string strSONumber = soNumber; string strOrderDate = soheadermodel[0].Order_Date.ToShortDateString(); string strDueDate = soheadermodel[0].Due_Date.ToShortDateString(); string strCustomerPOnum = soheadermodel[0].Customer_PO; string strSalesman = soheadermodel[0].Salesman; string strCreditTerm = soheadermodel[0].credit_term; string strOtherCharges = soheadermodel[0].Other_Charges.ToString(); decimal grossamount = soheadermodel[0].Gross_Amount; decimal finaldiscount = soheadermodel[0].Final_Discount; decimal netamount = grossamount - soheadermodel[0].Freight_Charges - soheadermodel[0].Other_Charges; decimal taxamount = grossamount * Convert.ToDecimal(1 - (1 / 1.12)); decimal strGrossAmount = grossamount; decimal strFinalDiscount = finaldiscount; decimal strCharges = soheadermodel[0].Freight_Charges + soheadermodel[0].Other_Charges; decimal strNetAmount = netamount; string strRemarks = soheadermodel[0].Remarks; List <Customer_Details_Model> customerDetails = Customer_Details.RetrieveData(connection, soheadermodel[0].idCustomer, ""); string strCustomerCode = customerDetails[0].Customer_Code; string strAddress1 = customerDetails[0].Address1; string strAddress2 = customerDetails[0].Address2; string strAddress3 = customerDetails[0].Address3; string strAddress4 = customerDetails[0].Address4; string strCompanyName = customerDetails[0].Company_Name; decimal strOutputVat = taxamount; decimal strTaxableSales = Convert.ToDecimal(netamount) / Convert.ToDecimal(1.12); string strShipAddress1 = customerDetails[0].AddressShipping1; string strShipAddress2 = customerDetails[0].AddressShipping2; string strShipAddress3 = customerDetails[0].AddressShipping3; string strShipAddress4 = customerDetails[0].AddressShipping4; var lDataAdd = SO_Detail.RetrieveDataForSOCreation(connection, soheadermodel[0].idSOHeader); if (strAddress1 == " ") { strAddress1 = " "; } if (strAddress2 == " ") { strAddress2 = " "; } if (strAddress3 == " ") { strAddress3 = " "; } if (strAddress4 == " ") { strAddress4 = " "; } if (strShipAddress1 == " ") { strShipAddress1 = " "; } if (strShipAddress2 == " ") { strShipAddress2 = " "; } if (strShipAddress3 == " ") { strShipAddress3 = " "; } ReportParameter p1 = new ReportParameter("Order_Date", strOrderDate); ReportParameter p2 = new ReportParameter("Due_Date", strDueDate); ReportParameter p3 = new ReportParameter("Customer_PO", strCustomerPOnum); ReportParameter p4 = new ReportParameter("Salesman", strSalesman); ReportParameter p5 = new ReportParameter("credit_term", strCreditTerm); ReportParameter p6 = new ReportParameter("SO_Number", strSONumber); ReportParameter p7 = new ReportParameter("Gross_Amount", strGrossAmount.ToString("n", CultureInfo.GetCultureInfo("en-US"))); ReportParameter p8 = new ReportParameter("Final_Discount", strFinalDiscount.ToString("n", CultureInfo.GetCultureInfo("en-US"))); ReportParameter p9 = new ReportParameter("Charges", strCharges.ToString("n", CultureInfo.GetCultureInfo("en-US"))); ReportParameter p10 = new ReportParameter("Net_Amount", strNetAmount.ToString("n", CultureInfo.GetCultureInfo("en-US"))); ReportParameter p11 = new ReportParameter("Customer_Code", strCustomerCode); ReportParameter p12 = new ReportParameter("Address1", strAddress1); ReportParameter p13 = new ReportParameter("Address2", strAddress2); ReportParameter p14 = new ReportParameter("Address3", strAddress3); ReportParameter p15 = new ReportParameter("Address4", strAddress4); ReportParameter p16 = new ReportParameter("Remarks", strRemarks); ReportParameter p17 = new ReportParameter("Company_Name", strCompanyName); ReportParameter p18 = new ReportParameter("Output_Vat", strOutputVat.ToString("n", CultureInfo.GetCultureInfo("en-US"))); ReportParameter p19 = new ReportParameter("Taxable_Sales", strTaxableSales.ToString("n", CultureInfo.GetCultureInfo("en-US"))); ReportParameter p20 = new ReportParameter("AddressShipping1", strShipAddress1); ReportParameter p21 = new ReportParameter("AddressShipping2", strShipAddress2); ReportParameter p22 = new ReportParameter("AddressShipping3", strShipAddress3); viewer.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22 }); ReportDataSource repDataSource1 = new ReportDataSource("DataSet1", lDataAdd); viewer.LocalReport.DataSources.Clear(); viewer.LocalReport.DataSources.Add(repDataSource1); byte[] bytes = viewer.LocalReport.Render("PDF"); DeleteFile(soheadermodel[0].idSOHeader); // insert data string strQuery = "INSERT INTO a_SO_Attachment" + "(idSOHeader, FileName, content_type, data)" + " values (@idSOHeader, @FileName, @content_type, @data)"; SqlCommand cmd = new SqlCommand(strQuery); cmd.Parameters.Add("@idSOHeader", SqlDbType.VarChar).Value = soheadermodel[0].idSOHeader; cmd.Parameters.Add("@FileName", SqlDbType.VarChar).Value = strSONumber; cmd.Parameters.Add("@content_type", SqlDbType.VarChar).Value = "text/html"; cmd.Parameters.Add("@data", SqlDbType.Binary).Value = bytes; InsertUpdateData(cmd); return(bytes); }
private void AttendanceReportForm_Load(object sender, EventArgs e) { ReportViewer.RefreshReport(); }
public ActionResult projectRpt() { var donors = _donorsAppService.getAllDonors(); List <SelectListItem> orderBy = new List <SelectListItem>(); orderBy.Add(new SelectListItem() { Text = "Project Name", Value = "projectArabicName" }); orderBy.Add(new SelectListItem() { Text = "year", Value = "year" }); orderBy.Add(new SelectListItem() { Text = "Number of Families", Value = "numberOfFamilies" }); var ReportingViewModel = new ReportingViewModel { Donors = donors, OrderBy = orderBy }; var reportViewer = new ReportViewer() { ProcessingMode = ProcessingMode.Local, SizeToReportContent = true, Width = Unit.Percentage(100), Height = Unit.Percentage(100), }; ViewProjectDataTable PD = new ViewProjectDataTable(); ProjectAdp PA = new ProjectAdp("select * from ViewProject"); PA.cmdTimeout = 0; String Wheresql = ""; String OrderBy = Request["OrderBy"]; if (!string.IsNullOrWhiteSpace(Request["Donors"])) { Wheresql = CheckWhere(Wheresql) + " donorId=" + Request["Donors"]; } if (Convert.ToInt32(Request["CheckedYear"]) == 0) { if (!string.IsNullOrWhiteSpace(Request["year"])) { Wheresql = CheckWhere(Wheresql) + " year=" + Request["year"]; } } if (Convert.ToInt32(Request["CheckedYear"]) == 1) { if (!string.IsNullOrWhiteSpace(Request["YearFrom"]) && !string.IsNullOrWhiteSpace(Request["YearTo"])) { Wheresql = CheckWhere(Wheresql) + " year between " + Request["YearFrom"] + " and " + Request["YearTo"]; } } if (!string.IsNullOrWhiteSpace(Request["Budget"])) { Wheresql = CheckWhere(Wheresql) + " budget=" + Request["Budget"]; } if (!string.IsNullOrWhiteSpace(Request["Contractor"])) { Wheresql = CheckWhere(Wheresql) + " contractor Like N'%" + Request["Contractor"] + "%'"; } if (!string.IsNullOrWhiteSpace(Request["locationFromMap"])) { Wheresql = CheckWhere(Wheresql) + " locationFromMap=" + Request["locationFromMap"]; } if (!string.IsNullOrWhiteSpace(Request["projectPeriod"])) { Wheresql = CheckWhere(Wheresql) + " projectPeriod=" + Request["projectPeriod"]; } if (!string.IsNullOrWhiteSpace(Request["Name"])) { Wheresql = CheckWhere(Wheresql) + " projectArabicName Like N'%" + Request["Name"] + "%' or projectEnglishName like N'%" + Request["Name"] + "%'"; } if (Wheresql.Length == 0) { ProjectAdp PA2 = new ProjectAdp("select * from ViewProject order by " + OrderBy); PA2.cmdTimeout = 0; PA2.Adapter.Fill(PD); } else { PA.QueryStr(Wheresql, OrderBy); PA.Adapter.Fill(PD); } //if (!string.IsNullOrWhiteSpace(Request["Donors"]) && !string.IsNullOrWhiteSpace(Request["year"])) //{ // var donorId = Convert.ToInt32(Request["Donors"]); // var year = Convert.ToInt32(Request["year"]); // // PA.Fill(PD); // PA.FillByDonorAndYear(PD, year, donorId); //} //else if (string.IsNullOrWhiteSpace(Request["Donors"]) && !string.IsNullOrWhiteSpace(Request["year"])) //{ // var year = Convert.ToInt32(Request["year"]); // PA.FillByYear(PD,year); //} //else if (!string.IsNullOrWhiteSpace(Request["Donors"]) && string.IsNullOrWhiteSpace(Request["year"])) //{ // var donorId = Convert.ToInt32(Request["Donors"]); // PA.FillByDonor(PD, donorId); //} //else //{ // PA.Fill(PD); //} reportViewer.LocalReport.ReportPath = @"Reporting\ProjectsReport.rdlc"; reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ProjectsDataSet", (object)PD)); // System.Collections.Generic.List<ReportParameter> paramList = new System.Collections.Generic.List<ReportParameter>(); // paramList.Add(new ReportParameter("User1", this.User.Identity.Name)); // reportViewer.LocalReport.SetParameters(paramList); reportViewer.LocalReport.Refresh(); ViewBag.ReportViewer = reportViewer; return(View("ProjectRptView", ReportingViewModel)); }
private void cmdGenerateExcel_Execute(object obj) { try { string folderPath = string.Empty; if (fromInvoiceDate > toInvoiceDate) { UIHelper.ShowErrorMessage("From Date cannot not be greater than To Date"); return; } ////if ((toInvoiceDate - fromInvoiceDate).Days > 31) ////{ //// UIHelper.ShowErrorMessage("Days Difference should not be greater than 31"); //// return; ////} if (fromInvoiceNo > toInvoiceNo) { UIHelper.ShowErrorMessage("From Invoice No. cannot not be greater than To Invoice No."); return; } using (System.Windows.Forms.FolderBrowserDialog browse = new System.Windows.Forms.FolderBrowserDialog()) { browse.ShowDialog(); folderPath = browse.SelectedPath; } if (string.IsNullOrEmpty(folderPath)) { UIHelper.ShowErrorMessage("Select Path to save excel file"); return; } using (InvoiceServiceClient pxy = new InvoiceServiceClient()) { ObservableCollection <IMS.InvoiceServiceRef.ProductDetails> lstInvoiceProduct = pxy.InvoiceProductPatch(fromInvoiceNo, toInvoiceNo, fromInvoiceDate, toInvoiceDate, ProductID, Global.UserID); if (lstInvoiceProduct == null || lstInvoiceProduct.Count == 0) { UIHelper.ShowMessage("Data not found"); return; } using (ReportViewer reportViewer = new ReportViewer()) { reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(new ReportDataSource("InvoiceProductDataSet", lstInvoiceProduct)); reportViewer.LocalReport.ReportPath = System.Windows.Forms.Application.StartupPath + "//Views//Reports//InvoiceProductPatch.rdlc"; reportViewer.RefreshReport(); byte[] Bytes = reportViewer.LocalReport.Render(format: "Excel", deviceInfo: ""); using (FileStream stream = new FileStream(folderPath + "//InvoiceProductPatch.xls", FileMode.Create)) { stream.Write(Bytes, 0, Bytes.Length); } } } UIHelper.ShowMessage("File generated!"); } catch (FaultException ex) { UIHelper.ShowErrorMessage(ex.Message); } catch (Exception ex) { UIHelper.ShowErrorMessage(ex.Message); } }
public void BCCVTheoTienDo(string tenduan, string tiendo, ReportViewer reportViewer) { tk.BCCVTheoTienDo(tenduan, tiendo, reportViewer); }
public byte[] ERTracerByQuestionRDLC(SearchER search, int reportType, string SortBy = "", string SortOrder = "") { byte[] fileContents = null; string reportDateTitle = ""; string rdlcName = String.Empty; string dsName = String.Empty; DataView dv = null; bool isCMSProgram = AppSession.IsCMSProgram; // This passes to reports to determine if "TJC Tracers" appears for CMS customers ReportParameterCollection reportParameterCollection = null; try { if (AppSession.ReportScheduleID > 0) { search.ReportTitle = String.Concat(search.ReportTitle, " - Report ID: ", AppSession.ReportScheduleID); } reportDateTitle = CommonService.InitializeReportDateTitle("Observation", search.StartDate, search.EndDate); search.EndDate = (search.EndDate != null && search.EndDate.ToString() != "") ? search.EndDate.Value.Date.AddHours(23).AddMinutes(29).AddSeconds(59) : search.EndDate; // Setup ReportViewer ReportViewer reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; reportViewer.LocalReport.DisplayName = search.ReportTitle; // Add Initial Common Report Parameter // Set Parameters switch (search.LevelIdentifier) { case (int)WebConstants.ERTracerByQuestionLevels.Level1_Program: default: { rdlcName = "rptReportERTracerByQuestion_ByProgram.rdlc"; dsName = "dsReport_ERTracerByQuestionByProgram"; dv = new DataView(GetLevel1DataSet(search).Tables[0]); ReportParameter p1 = new ReportParameter("ReportTitle", search.ReportTitle.ToString()); ReportParameter p2 = new ReportParameter("Programs", search.ProgramNames.ToString()); ReportParameter p3 = new ReportParameter("Tracers", search.TracerListNames.ToString()); ReportParameter p4 = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString()); ReportParameter p5 = new ReportParameter("ReportDateTitle", reportDateTitle.ToString()); ReportParameter p6 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString()); ReportParameter p7 = new ReportParameter("ReportSubTitle", "Overall Compliance by Program"); ReportParameter p8 = new ReportParameter("ReportType", search.ReportType.ToString()); ReportParameter p9 = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0"); ReportParameter p10 = new ReportParameter("Departments", search.DepartmentListNames.ToString()); ReportParameter p11 = new ReportParameter("IsCMSProgram", isCMSProgram ? "1" : "0"); reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 }; break; } case (int)WebConstants.ERTracerByQuestionLevels.Level2_Tracer: { rdlcName = "rptReportERTracerByQuestion_ByTracer.rdlc"; dsName = "dsReport_ERTracerByQuestionByTracer"; dv = new DataView(GetLevel2DataSet(search).Tables[0]); ReportParameter p1 = new ReportParameter("ReportTitle", search.ReportTitle.ToString()); ReportParameter p2 = new ReportParameter("Programs", search.ProgramNames.ToString()); ReportParameter p3 = new ReportParameter("ReportDateTitle", reportDateTitle.ToString()); ReportParameter p4 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString()); ReportParameter p5 = new ReportParameter("ReportSubTitle", "Compliance by Tracer"); ReportParameter p6 = new ReportParameter("SiteName", search.SelectedSiteHCOIDs.ToString()); ReportParameter p7 = new ReportParameter("Tracers", search.TracerListNames.ToString()); ReportParameter p8 = new ReportParameter("ReportType", search.ReportType.ToString()); ReportParameter p9 = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString()); ReportParameter p10 = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0"); ReportParameter p11 = new ReportParameter("Departments", search.DepartmentListNames.ToString()); ReportParameter p12 = new ReportParameter("IsCMSProgram", isCMSProgram ? "1" : "0"); reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12 }; break; } case (int)WebConstants.ERTracerByQuestionLevels.Level3_Question: { rdlcName = "rptReportERTracerByQuestion_ByQuestion.rdlc"; dsName = "dsReport_ERTracerByQuestionByQuestion"; dv = new DataView(GetLevel3DataSet(search).Tables[0]); ReportParameter p1 = new ReportParameter("ReportTitle", search.ReportTitle.ToString()); ReportParameter p2 = new ReportParameter("Programs", search.ProgramNames.ToString()); ReportParameter p3 = new ReportParameter("Tracers", search.TracerListNames.ToString()); ReportParameter p4 = new ReportParameter("ReportDateTitle", reportDateTitle.ToString()); ReportParameter p5 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString()); ReportParameter p6 = new ReportParameter("ReportSubTitle", "Compliance by Question"); ReportParameter p7 = new ReportParameter("SiteName", search.SelectedSiteHCOIDs.ToString()); ReportParameter p8 = new ReportParameter("ReportType", search.ReportType.ToString()); ReportParameter p9 = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0"); ReportParameter p10 = new ReportParameter("Departments", search.DepartmentListNames.ToString()); ReportParameter p11 = new ReportParameter("IsCMSProgram", isCMSProgram ? "1" : "0"); reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 }; break; } case (int)WebConstants.ERTracerByQuestionLevels.Level4_Site: { rdlcName = "rptReportERTracerByQuestion_BySite.rdlc"; dsName = "dsReport_ERTracerByQuestionBySite"; dv = new DataView(GetLevel4DataSet(search).Tables[0]); int split1 = search.TracerListNames.IndexOf(">", 0); ReportParameter p1 = new ReportParameter("ReportTitle", search.ReportTitle.ToString()); ReportParameter p2 = new ReportParameter("Programs", search.ProgramNames.ToString()); ReportParameter p3 = new ReportParameter("Tracers", search.TracerListNames.Substring(0, split1 - 1).ToString()); ReportParameter p4 = new ReportParameter("HCOID", search.SelectedSiteHCOIDs.ToString()); ReportParameter p5 = new ReportParameter("ReportDateTitle", reportDateTitle.ToString()); ReportParameter p6 = new ReportParameter("Copyright", "© " + DateTime.Now.Year.ToString() + WebConstants.Tracer_Copyright.ToString()); ReportParameter p7 = new ReportParameter("ReportSubTitle", "Compliance by Site"); ReportParameter p8 = new ReportParameter("ReportType", search.ReportType.ToString()); ReportParameter p9 = new ReportParameter("FSA", search.IncludeFsa ? "1" : "0"); ReportParameter p10 = new ReportParameter("Departments", search.DepartmentListNames.ToString()); ReportParameter p11 = new ReportParameter("IsCMSProgram", isCMSProgram ? "1" : "0"); ReportParameter p12 = new ReportParameter("QuestionText", search.TracerListNames.Substring(split1 + 1).Trim().ToString()); reportParameterCollection = new ReportParameterCollection { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12 }; break; } } if (SortBy != "") { dv.Sort = SortBy + " " + SortOrder; } // Setup Data sources for report reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.ReportPath = HttpContext.Current.Request.MapPath(HttpContext.Current.Request.ApplicationPath) + @"Areas\TracerER\Reports\" + rdlcName.ToString(); reportViewer.LocalReport.DataSources.Add(new ReportDataSource(dsName, dv)); reportViewer.LocalReport.SetParameters(reportParameterCollection); Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string format = WebConstants.REPORT_FORMAT_PDF; // PDF is default if (reportType == (int)WebConstants.ReportFormat.EXCEL) { format = WebConstants.REPORT_FORMAT_EXCEL; // If Excel option chosen } fileContents = reportViewer.LocalReport.Render(format, null, out mimeType, out encoding, out extension, out streamIds, out warnings); } catch (Exception ex) { ExceptionLog exceptionLog = new ExceptionLog { ExceptionText = "Reports: " + ex.Message, PageName = "TracerByQuestionRDLC", MethodName = "TracerByQuestionRDLC", UserID = Convert.ToInt32(AppSession.UserID), SiteId = Convert.ToInt32(AppSession.SelectedSiteId), TransSQL = "", HttpReferrer = null }; _exceptionService.LogException(exceptionLog); } return(fileContents); }
private void SetReportParameters(PaymentCollectionDTO paymentCollectionDetails, ReportViewer reportViewer, bool isRePrint) { string amount = Convert.ToString(paymentCollectionDetails.PC_Amount); ReportParameter rpReceiptNo = new ReportParameter("ReceiptNo", Convert.ToString(paymentCollectionDetails.PC_Id)); ReportParameter rpReceiptDate = new ReportParameter("ReceiptDate", String.Format("{0:dd/MM/yyyy}", Convert.ToString(paymentCollectionDetails.PC_ReceiptDate))); ReportParameter rpCustomerCode = new ReportParameter("CustomerCode", paymentCollectionDetails.CustomerCode); ReportParameter rpTradeName = new ReportParameter("TradeName", paymentCollectionDetails.CustomerTradeName); ReportParameter rpCustomerName = new ReportParameter("CustomerName", Convert.ToString(paymentCollectionDetails.CustomerName)); ReportParameter rpDistrictName = new ReportParameter("DistrictName", Convert.ToString(paymentCollectionDetails.CustomerDistrict)); ReportParameter rpAmount = new ReportParameter("Amount", amount); CurrencyConvertor currencyConvertor = new CurrencyConvertor(); string amountInWords = currencyConvertor.Convertor(string.Format("{0:0.00}", amount)); ReportParameter rpAmountInWords = new ReportParameter("AmountInWords", amountInWords); ReportParameter rpInstrumentType = new ReportParameter("InstrumentType", Convert.ToString(paymentCollectionDetails.PaymentModeName)); ReportParameter rpInstrumentNumber = new ReportParameter("InstrumentNumber", Convert.ToString(paymentCollectionDetails.PC_InstrumentNo)); ReportParameter rpInstrumentDate = new ReportParameter("InstrumentDate", Convert.ToDateTime(paymentCollectionDetails.PC_InstrumentDate).ToString("dd/MMM/yyyy")); ReportParameter rpBankDrawn = new ReportParameter("BankDrawn", Convert.ToString(ESalesUnityContainer.Container.Resolve<IMasterService>().GetBanksDetailsById(Convert.ToInt32(paymentCollectionDetails.PC_BankDrawn)).Bank_Name)); ReportParameter rpBankBranch = new ReportParameter("BranchName", Convert.ToString(paymentCollectionDetails.PC_BankBranch)); ReportParameter rpPayer = new ReportParameter("Payer", Convert.ToString(paymentCollectionDetails.PC_PayerName)); ReportParameter rpPayerMobileNumber = new ReportParameter("PayerMobileNumber", Convert.ToString(paymentCollectionDetails.PC_MobileNumber)); ReportParameter rpPrintNumber = new ReportParameter("PrintNumber", Convert.ToString(GetPrintName(isRePrint == true ? (paymentCollectionDetails.PC_ReprintCount + 1) : paymentCollectionDetails.PC_ReprintCount))); reportViewer.LocalReport.SetParameters(new ReportParameter[] {rpReceiptNo, rpReceiptDate, rpCustomerCode, rpTradeName, rpCustomerName, rpDistrictName, rpAmount, rpAmountInWords, rpInstrumentType, rpInstrumentNumber, rpInstrumentDate, rpBankDrawn, rpBankBranch, rpPayer, rpPayerMobileNumber,rpPrintNumber}); }
/// <summary> /// Creates a ReportViewer control and stores it on the ViewBag /// </summary> /// <returns></returns> public ActionResult View(int id, int categoryId) { var report = ReportHelper.GetReport(id); report.SelectedCategoryId = categoryId; var reportViewer = new ReportViewer { ProcessingMode = ProcessingMode.Remote, SizeToReportContent = true, Width = Unit.Percentage(100), Height = Unit.Percentage(100) }; IReportServerCredentials irsc = new CustomReportCredentials("RemoteUser", "Remote2User", "TOUREASTGROUP"); reportViewer.ServerReport.ReportServerCredentials = irsc; //IReportServerCredentials irsc = new CustomReportCredentials("tony.song", "nvtgf7TH", "TOUREASTGROUP"); //reportViewer.ServerReport.ReportServerCredentials = irsc; reportViewer.ServerReport.ReportPath = report.Path; reportViewer.ServerReport.ReportServerUrl = new Uri(report.SsrsServerUrl); reportViewer.AsyncRendering = false; ViewBag.ReportViewer = reportViewer; return View(report); }
private void button3_Click(object sender, EventArgs e) { ReportDataSource source = new ReportDataSource(); ReportViewer reportViewer = new ReportViewer(); source.Name = "DataSet1"; source.Value = null; // reportViewer.Reset(); // reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.ReportPath = "../../Reports/ReportSpend.rdlc"; ReportParameter rp = new ReportParameter(); rp.Name = "id"; rp.Values.Add(objBillSpend.Id); ReportParameter rp1 = new ReportParameter("dateestablish",objBillSpend.Dateestablish.ToShortDateString(), true); ReportParameter rp2 = new ReportParameter("expenseds", this.objBillSpend.Expenses, true); ReportParameter rp3 = new ReportParameter("total", this.objBillSpend.Total.ToString(), true); ReportParameter rp4 = new ReportParameter("note", this.objBillSpend.Note, true); ReportParameter rp5 = new ReportParameter("receiver", this.objBillSpend.Receiver, true); ReportParameter[] parameter = new ReportParameter[] { rp, rp2, rp1, rp3, rp4, rp5 }; // reportViewer.LocalReport.SetParameters(parameter); // reportViewer.LocalReport.DataSources.Add(source); ReportSpend form = new ReportSpend(parameter); form.Show(); }
public ReportViewer PrintPage(int loanId, DateTime startDate, DateTime endDate) { //check authentication session is null, if null return if (Session["AuthenticatedUser"] == null) return null; User userData = (User)Session["AuthenticatedUser"]; //set report viewr property dynamically ReportViewer rptViewerLoanSummaryPrint = new ReportViewer(); rptViewerLoanSummaryPrint.ProcessingMode = ProcessingMode.Local; rptViewerLoanSummaryPrint.Reset(); rptViewerLoanSummaryPrint.LocalReport.EnableExternalImages = true; rptViewerLoanSummaryPrint.LocalReport.ReportPath = Server.MapPath("~/Reports/RptTransactionHistory.rdlc"); //get report header details ReportAccess ra = new ReportAccess(); List<LoanDetailsRpt> details = ra.TopHeaderDetails(loanId, userData.UserId); foreach (var dates in details) { dates.StartRange = startDate.ToString("MM/dd/yyyy"); dates.EndRange = endDate.ToString("MM/dd/yyyy"); dates.ReportDate = DateTime.Now.ToString("MM/dd/yyyy"); } List<ReportTransactionHistory> loanSumm = ra.GetTransactionHistoryByDateRange(loanId, startDate, endDate); rptViewerLoanSummaryPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", details)); rptViewerLoanSummaryPrint.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", loanSumm)); return rptViewerLoanSummaryPrint; }
public ActionResult ReporteCotizacion(Reporte reporte) { if (!LoginController.validaUsuario(Session)) return RedirectToAction("Index", "Home"); Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; ReportViewer reportviewer = new ReportViewer(); reportviewer.ProcessingMode = ProcessingMode.Local; reportviewer.LocalReport.ReportPath = "Reportes/ReportCotizacion.rdlc"; reportviewer.LocalReport.DataSources.Add(new ReportDataSource("DSReporteCotizacion", reporteCotizacionFacturacion(reporte.FechaInicio, reporte.FechaFin, reporte.IdCliente, null, "Cotizacion", null))); reportviewer.LocalReport.Refresh(); byte[] bytes = reportviewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.BinaryWrite(bytes); return View(); }
public static void Run(ReportViewer RV, short _Copias, string _Impresora) { CantidadCopias = _Copias; Impresora = _Impresora; Export(RV.LocalReport); Print(); }