/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); this.table1BindingSource = new System.Windows.Forms.BindingSource(this.components); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.b_today = new System.Windows.Forms.Button(); this.b_prev = new System.Windows.Forms.Button(); this.b_next = new System.Windows.Forms.Button(); this.b_Refresh = new System.Windows.Forms.Button(); this.dtp_to = new System.Windows.Forms.DateTimePicker(); this.dtp_from = new System.Windows.Forms.DateTimePicker(); this.t_To = new System.Windows.Forms.Label(); this.t_From = new System.Windows.Forms.Label(); this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer(); ((System.ComponentModel.ISupportInitialize)(this.table1BindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 // this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; // // splitContainer1.Panel1 // this.splitContainer1.Panel1.Controls.Add(this.b_today); this.splitContainer1.Panel1.Controls.Add(this.b_prev); this.splitContainer1.Panel1.Controls.Add(this.b_next); this.splitContainer1.Panel1.Controls.Add(this.b_Refresh); this.splitContainer1.Panel1.Controls.Add(this.dtp_to); this.splitContainer1.Panel1.Controls.Add(this.dtp_from); this.splitContainer1.Panel1.Controls.Add(this.t_To); this.splitContainer1.Panel1.Controls.Add(this.t_From); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.reportViewer1); this.splitContainer1.Size = new System.Drawing.Size(783, 567); this.splitContainer1.SplitterDistance = 93; this.splitContainer1.TabIndex = 0; // // b_today // this.b_today.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.b_today.Location = new System.Drawing.Point(191, 66); this.b_today.Name = "b_today"; this.b_today.Size = new System.Drawing.Size(87, 23); this.b_today.TabIndex = 7; this.b_today.Text = "Today"; this.b_today.UseVisualStyleBackColor = true; this.b_today.Click += new System.EventHandler(this.b_today_Click); // // b_prev // this.b_prev.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.b_prev.ForeColor = System.Drawing.SystemColors.ButtonShadow; this.b_prev.Image = global::TimeSheetControl.Properties.Resources.backward_241; this.b_prev.Location = new System.Drawing.Point(147, 66); this.b_prev.Name = "b_prev"; this.b_prev.Size = new System.Drawing.Size(40, 23); this.b_prev.TabIndex = 6; this.b_prev.UseVisualStyleBackColor = true; this.b_prev.Click += new System.EventHandler(this.b_prev_Click); // // b_next // this.b_next.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.b_next.ForeColor = System.Drawing.SystemColors.ButtonShadow; this.b_next.Image = global::TimeSheetControl.Properties.Resources.forward_241; this.b_next.Location = new System.Drawing.Point(284, 66); this.b_next.Name = "b_next"; this.b_next.Size = new System.Drawing.Size(39, 23); this.b_next.TabIndex = 5; this.b_next.UseVisualStyleBackColor = true; this.b_next.Click += new System.EventHandler(this.b_next_Click); // // b_Refresh // this.b_Refresh.Location = new System.Drawing.Point(385, 36); this.b_Refresh.Name = "b_Refresh"; this.b_Refresh.Size = new System.Drawing.Size(91, 23); this.b_Refresh.TabIndex = 4; this.b_Refresh.Text = "Refresh"; this.b_Refresh.UseVisualStyleBackColor = true; this.b_Refresh.Click += new System.EventHandler(this.b_Refresh_Click); // // dtp_to // this.dtp_to.Location = new System.Drawing.Point(137, 40); this.dtp_to.Name = "dtp_to"; this.dtp_to.Size = new System.Drawing.Size(200, 20); this.dtp_to.TabIndex = 3; // // dtp_from // this.dtp_from.Location = new System.Drawing.Point(137, 12); this.dtp_from.Name = "dtp_from"; this.dtp_from.Size = new System.Drawing.Size(200, 20); this.dtp_from.TabIndex = 2; // // t_To // this.t_To.AutoSize = true; this.t_To.Location = new System.Drawing.Point(108, 46); this.t_To.Name = "t_To"; this.t_To.Size = new System.Drawing.Size(23, 13); this.t_To.TabIndex = 1; this.t_To.Text = "To:"; // // t_From // this.t_From.AutoSize = true; this.t_From.Location = new System.Drawing.Point(98, 18); this.t_From.Name = "t_From"; this.t_From.Size = new System.Drawing.Size(33, 13); this.t_From.TabIndex = 0; this.t_From.Text = "From:"; // // reportViewer1 // this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = this.table1BindingSource; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer1.LocalReport.ReportEmbeddedResource = "TimeSheetControl.DTO.Report1.rdlc"; this.reportViewer1.Location = new System.Drawing.Point(0, 0); this.reportViewer1.Name = "reportViewer1"; this.reportViewer1.Size = new System.Drawing.Size(783, 470); this.reportViewer1.TabIndex = 0; // // F_Report // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(783, 567); this.Controls.Add(this.splitContainer1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.Name = "F_Report"; this.Text = "Report timesheet"; this.Load += new System.EventHandler(this.F_Report_Load); ((System.ComponentModel.ISupportInitialize)(this.table1BindingSource)).EndInit(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); }
public void MostSellableItemsReport() { DateCriteriaForm rf = new DateCriteriaForm(); rf.onSuccessfulDateSelect += new EventHandler(child_onDateSelect); rf.ShowDialog(); using (var db = new posdbEntities()) { var query = (from c in db.salesorderdetails join d in db.salesorders on c.OrderID equals d.OrderID join p in db.products on c.ProductID equals p.ProductID join cat in db.categories on p.CategoryID equals cat.CategoryID where d.SaleDate >= AppConfig.ReportCriteria_FromDate && d.SaleDate <= AppConfig.ReportCriteria_ToDate select new { OrderID = c.OrderID, CategoryID = p.CategoryID, CategoryName = cat.CategoryName, ProductName = p.ProductName, SaleQuantity = c.Quantity, SaleAmount = c.SalePrice }).ToList(); var query2 = (from a in query group a by new { a.CategoryName, a.ProductName } into g select new { CategoryName = g.Key.CategoryName, ProductName = g.Key.ProductName, TotalQuantitySold = g.Sum(p => p.SaleQuantity), SaleAmount = g.Sum(p => p.SaleAmount) } ).ToList(); var resultList = query2.OrderByDescending(i => i.SaleAmount).Take(5); DataSet ds = new DataSet("MostSellableItemsDataSet"); DataTable dt = new DataTable("MostSellableItemsTable"); dt.Columns.Add("CategoryName"); dt.Columns.Add("ProductName"); dt.Columns.Add("TotalQuantitySold"); dt.Columns.Add("SaleAmount"); ds.Tables.Add(dt); Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource("MostSellableItemsDataSet", resultList); reportViewer1.LocalReport.ReportPath = @"../../Reports/Sales_Reports/MostSellableItemsReport.rdlc"; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); reportViewer1.LocalReport.Refresh(); reportViewer1.LocalReport.EnableExternalImages = true; string imagePath = @"file:///" + AppConfig.imagefile; ReportParameter parameter = new ReportParameter("ImagePathParameter", imagePath); reportViewer1.LocalReport.SetParameters(parameter); reportViewer1.RefreshReport(); } }
private void frmViewSumInfoAndChart_Load(object sender, EventArgs e) { Device dv = Device.Instance; List <Device> dev = new List <Device>(); dev.Add(dv); Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dev); reportViewer1.LocalReport.DataSources.Add(dataset); dataset.Value = dev; //Print_Preview(Content.Print_Graph_and_Summary); //this.reportViewer1.RefreshReport(); string imagepath = @"file:///" + "C:\\Desert.jpg"; //string imagepath = "Desert.jpg"; reportViewer1.LocalReport.ReportEmbeddedResource = "Pexo16.Report2.rdlc"; //ReportParameterCollection para = new ReportParameterCollection(); //para.Add(new ReportParameter("AddImage", imagepath)); //para.Values.Add(FileName + "\\~temp._t_"); //para.Values.Add("C:\\Users\\Public\\Pictures\\Sample Pictures\\Desert.jpg"); //para.Values.Add(imagepath); reportViewer1.LocalReport.EnableExternalImages = true; ReportParameter[] param = new ReportParameter[1]; param[0] = new ReportParameter("AddImage", imagepath); reportViewer1.LocalReport.SetParameters(param[0]); reportViewer1.RefreshReport(); }
private void btnImpr1_Click(object sender, EventArgs e) { //try //{ var convertisseur = ConvertisseurNombreEnLettre .Parametrage .AppliquerUneUnite(Unite.Creer("dirham", "dirhams", "centime", "Centimes")) .ModifierLaVirgule("et ").AppliquerLaRegleDesTiretsDe1990(true) .ValiderLeParametrage(); var data = db.print_Fac(numfac, Cmbste.Text); var reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = data; ReportParameter[] parameters = new ReportParameter[3]; parameters[0] = new ReportParameter("Montant", convertisseur.Convertir(Montant)); parameters[1] = new ReportParameter("TVA", Tva.ToString()); parameters[2] = new ReportParameter("TTC", Montant.ToString()); this.reportViewer1.LocalReport.SetParameters(parameters); reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.Refresh(); this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); //this.reportViewer1.LocalReport.ReportEmbeddedResource = "GESTIONCOMMECIALE.Report1.rdlc"; this.reportViewer1.RefreshReport(); //} //catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Report_Load(object sender, EventArgs e) { List <CMCGPCheckedResult> list = mCheckedGeoPoint.GetResults(); reportViewer1.LocalReport.DataSources.Clear(); //clear report reportViewer1.LocalReport.ReportEmbeddedResource = "Maps.Report1.rdlc"; // bind reportviewer with .rdlc //здесь мутим передачу строк Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("SurfacesDS", list); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset); dataset.Value = list; //string temp = ImageToBase64(Image.FromFile(@"D:\temp\123.jpg"), System.Drawing.Imaging.ImageFormat.Jpeg); string PointOffset = "X = " + mCheckedGeoPoint.Offset.Lat + " м ,Y = " + mCheckedGeoPoint.Offset.Lng + " м"; reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("ReportParameter1", mCheckedGeoPoint.ImageIn64)); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("HeightOfPoint", mCheckedGeoPoint.Height.ToString() + " м")); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("AzimutDalnost", mCheckedGeoPoint.Angle.ToString())); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("PointOffset", PointOffset)); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("DistanceFromKTA", mCheckedGeoPoint.Distance.ToString() + " м")); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("RunwayBeginHeight", mCheckedGeoPoint.HeightAboveRunwayBegin.ToString() + " м")); reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("DotName", mCheckedGeoPoint.Text)); this.reportViewer1.RefreshReport(); }
private void PrintActiont(object obj) { var message = new MyMessageBox("Print Pre Shcedule", "Tentukan Tanggal", MessageBoxButton.YesNo); var picker = new DatePicker() { Margin = new Thickness(10, 3, 0, 0), Width = 200 }; picker.SelectedDate = DateTime.Now; message.customPanel.Children.Add(picker); message.ShowDialog(); if (message.MessageResult == MessageBoxResult.Yes) { var reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource() { Name = "DataSet1", Value = Source.Where(O => O.IsSelected).OrderBy(O => O.PTIId).ToList() }; Helpers.PrintPreviewWithFormAction("PRE SCHEDULE FLIGHT", reportDataSource, "MainApp.Reports.Layouts.PreScheduleManifest.rdlc", new ReportParameter[] { new ReportParameter("Tanggal", picker.SelectedDate.Value.ToShortDateString()) } ); } }
public void Imprimir(String nombre, String path, Microsoft.Reporting.WinForms.ReportParameter[] Parameters) { try { Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource(); rds.Name = nombre; rds.Value = DTReporte; this.reportViewer.Reset(); this.reportViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; this.reportViewer.LocalReport.EnableExternalImages = true; this.reportViewer.LocalReport.DataSources.Clear(); this.reportViewer.LocalReport.DataSources.Add(rds); this.reportViewer.LocalReport.ReportPath = Application.StartupPath + path; if (Parameters != null) { this.reportViewer.LocalReport.SetParameters(Parameters); } this.reportViewer.LocalReport.SubreportProcessing += LocalReport_SubreportProcessing; this.reportViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout); this.reportViewer.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth; this.reportViewer.RefreshReport(); this.reportViewer.LocalReport.Refresh(); } catch (Exception) { throw; } }
public InterventionsView() { InitializeComponent(); this.CustomizeInterventionsView(); orderService = new OrderService(); userService = new UserService(); atmService = new AtmService(); ///Init Blank report /// /// this.rVReports.LocalReport.DataSources.Clear(); rVReports.Reset(); rVReports.LocalReport.ReportPath = "Reports/BlankReport.rdlc"; var allAtmsDataSource = new AtmService(); var allAtms = allAtmsDataSource.GetAllAtmsList(); Microsoft.Reporting.WinForms.ReportDataSource rprtDTSource = new Microsoft.Reporting.WinForms.ReportDataSource(); rprtDTSource.Name = "DataSet1"; rprtDTSource.Value = this.AtmModelBindingSource; this.rVReports.LocalReport.DataSources.Add(rprtDTSource); this.AtmModelBindingSource.DataSource = allAtms; this.rVReports.RefreshReport(); }
private void ReportViewer2_Load(object sender, EventArgs e) { if (!_isReportViewerLoaded2) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); DSreport dataset = new DSreport(); dataset.BeginInit(); reportDataSource1.Name = "DataSet1"; //Name of the report dataset in our .RDLC file reportDataSource1.Value = dataset.ticket_rep; this.reportFacture.LocalReport.DataSources.Add(reportDataSource1); this.reportFacture.LocalReport.ReportPath = "../../Layouts/repFacture.rdlc"; dataset.EndInit(); //fill data into WpfApplication4DataSet DSreportTableAdapters.ticket_repTableAdapter facture = new DSreportTableAdapters.ticket_repTableAdapter(); facture.ClearBeforeFill = true; facture.Fill(dataset.ticket_rep, id); reportFacture.RefreshReport(); _isReportViewerLoaded2 = true; } }
private void ReportViewer1_Load(object sender, EventArgs e) { if (!_isReportViewer1Loaded) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); DataSet1 dataset = new DataSet1(); dataset.BeginInit(); reportDataSource1.Name = "DataSet1"; //Name of the report dataset in our .RDLC file reportDataSource1.Value = dataset.DataTable2; this._reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this._reportViewer1.LocalReport.ReportEmbeddedResource = "PorjectDepartmentIT.Report2.rdlc"; dataset.EndInit(); //fill data into adventureWorksDataSet DataSet1TableAdapters.DataTable2TableAdapter DataTable2 = new DataSet1TableAdapters.DataTable2TableAdapter(); DataTable2.ClearBeforeFill = true; DataTable2.Fill(dataset.DataTable2); _reportViewer1.RefreshReport(); _isReportViewer1Loaded = true; } }
private void viewButton_Click(object sender, EventArgs e) { // mealListView.Items.Clear(); MealManager aMealManager = new MealManager(); int memberId = (int)nameComboBox.SelectedValue; DateTime input = Convert.ToDateTime(searchTimePicker.Text); string date = input.Month.ToString(); List <MemberWithMeal> meals = aMealManager.GetMeals(memberId, date); //reportViewer1.ProcessingMode = ProcessingMode.Local; ////Providing DataSource for the Report //ReportDataSource rds = new ReportDataSource("GetMealReport", meals); //reportViewer1.LocalReport.DataSources.Clear(); //reportViewer1.LocalReport.DataSources.Add(rds); //this.reportViewer1.RefreshReport(); reportViewer1.LocalReport.DataSources.Clear(); //clear report reportViewer1.LocalReport.ReportEmbeddedResource = "MessManagementSystem.Report.MealReport.rdlc"; // bind reportviewer with .rdlc Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("GetMealReport", meals); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset); dataset.Value = meals; // reportViewer1.RefreshReport(); }
private void ReportViewer2_Load(object sender, EventArgs e) // Отчет Order с фильтром { if (!_isReportViewer2Loaded) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); DataSetOrder dataset = new DataSetOrder(); dataset.BeginInit(); reportDataSource1.Name = "DataSet1"; // Name of the report dataset in our .RDLC file reportDataSource1.Value = dataset.Order; // Название таблицы в .xsd файле (DataSet) this._reportViewer2.LocalReport.DataSources.Add(reportDataSource1); this._reportViewer2.LocalReport.ReportEmbeddedResource = "PorjectDepartmentIT.Report3.rdlc"; dataset.EndInit(); //fill data into adventureWorksDataSet DataSetOrderTableAdapters.OrderTableAdapter Order = new DataSetOrderTableAdapters.OrderTableAdapter(); Order.ClearBeforeFill = true; Order.Fill(dataset.Order, "Готов", "Не готов"); _reportViewer2.RefreshReport(); _isReportViewer2Loaded = true; } }
public void loadReport() { /* * // file ini disimpan di bin/debug * m_cryRpt.Load(Application.StartupPath + @".\REPORT\agent.rpt"); * // cara pemanggilan menggunakan data table yang sudah di proses dan di masukan ke object dt * m_cryRpt.Database.Tables[0].SetDataSource((DataTable)my_dt); * // data yang di panggil di ke data source otomatis tergambar ke dataset yang di buat dan berextensi xsd * crystalReportAGENT.ReportSource = m_cryRpt; * crystalReportAGENT.Refresh();*/ //List<Student> list = StudentRepository.GetStudents(); // m_cryRpt.Database.Tables[0].SetDataSource((DataTable)my_dt); reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.ReportEmbeddedResource = "LOGISTICMANAGAMENTSYSTEM.MASTER.REPORT.masterAgent.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("dsAGENT_v_agent", my_dt); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset); dataset.Value = my_dt; System.Drawing.Printing.PageSettings pg = new PageSettings(); // Set margins // Set paper size pg.Margins.Top = 100; pg.Margins.Bottom = 100; pg.Margins.Left = 100; pg.Margins.Right = 100; pg.Landscape = false; System.Drawing.Printing.PaperSize size = new PaperSize(); size.RawKind = (int)PaperKind.A4; pg.PaperSize = size; reportViewer1.LocalReport.Refresh(); reportViewer1.RefreshReport(); // refresh report }
private void frmXuatKetQua_Load(object sender, EventArgs e) { rpt.SetDisplayMode(DisplayMode.PrintLayout); rpt.ZoomMode = ZoomMode.PageWidth; rpt.ZoomPercent = 100; components = new Container(); Microsoft.Reporting.WinForms.ReportDataSource datasource = new Microsoft.Reporting.WinForms.ReportDataSource(); this.rpt.LocalReport.ReportPath = Application.StartupPath + "\\REPORT\\" + strReport; REPORT.IN ng = new REPORT.IN(); BindingSource source = new BindingSource(this.components); ((ISupportInitialize)ng).BeginInit(); ((ISupportInitialize)source).BeginInit(); source.DataSource = ng; datasource.Name = "DataSet1"; datasource.Value = source; rpt.LocalReport.DataSources.Add(datasource); SetReportParameter(ng, source); ((ISupportInitialize)source).EndInit(); ((ISupportInitialize)ng).EndInit(); if (bprint) { Print(); } else if (bExport) { Export(); } else { this.rpt.RefreshReport(); } }
public ReportViewProvider( String DataSource, String InitialCatalog, String UserID, String Password) { builder = new SqlConnectionStringBuilder(); builder.DataSource = DataSource; builder.InitialCatalog = InitialCatalog; builder.UserID = UserID; builder.Password = Password; this.TransactionBindingSource = new System.Windows.Forms.BindingSource(); this.TransactionCustomerBindingSource = new System.Windows.Forms.BindingSource(); this.TransactionLinesBindingSource = new System.Windows.Forms.BindingSource(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource3 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "Transaction"; reportDataSource1.Value = this.TransactionBindingSource; reportDataSource2.Name = "TransactionCustomer"; reportDataSource2.Value = this.TransactionCustomerBindingSource; reportDataSource3.Name = "TransactionLines"; reportDataSource3.Value = this.TransactionLinesBindingSource; this.LocalReport = new LocalReport(); LocalReport.DataSources.Add(reportDataSource1); LocalReport.DataSources.Add(reportDataSource2); LocalReport.DataSources.Add(reportDataSource3); LocalReport.ReportEmbeddedResource = "LSDelevaryNote.DelivaryReport.rdlc"; }
public void OnNavigatedTo(NavigationContext navigationContext) { int hash = int.Parse(navigationContext.Parameters["DataToDisplay"].ToString()); dataToDisplay = (object)AppParameters.Request(hash); reportPath = navigationContext.Parameters["ReportPath"].ToString(); parameters = (ReportParameter[])navigationContext.Parameters["Parameters"]; reportDataSourceName = navigationContext.Parameters["ReportDataSourceName"].ToString(); if (!_isReportViewerLoaded) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource.Name = reportDataSourceName; reportDataSource.Value = DataToDisplay; this.ReportViewerControl.LocalReport.DataSources.Add(reportDataSource); this.ReportViewerControl.LocalReport.ReportPath = ReportPath; if (parameters != null) { this.ReportViewerControl.LocalReport.SetParameters(parameters); } ReportViewerControl.RefreshReport(); _isReportViewerLoaded = true; } menu = new RTIReportWindow(); menu.PrintButton.Command = printCommand; ribbonService.AddRibbonItem(menu, true); }
private void frmRPInPMS_Load(object sender, EventArgs e) { //// TODO: This line of code loads data into the 'dataSet1.CHITIETPHIEUMUON' table. You can move, or remove it, as needed. //this.cHITIETPHIEUMUONTableAdapter.Fill(this.dataSet1.CHITIETPHIEUMUON); this.reportViewer1.RefreshReport(); reportViewer1.LocalReport.ReportEmbeddedResource = "PTIT2012.BAOCAO.rptInPMS.rdlc"; reportViewer1.LocalReport.DataSources.Clear(); string cmd = @"SELECT SACH.MASACH, DAUSACH.TENDAUSACH, CHITIETPHIEUMUON.NGAYTRA FROM CHITIETPHIEUMUON INNER JOIN SACH ON CHITIETPHIEUMUON.MASACH = SACH.MASACH INNER JOIN DAUSACH ON SACH.MADAUSACH = DAUSACH.MADAUSACH WHERE CHITIETPHIEUMUON.SOPM = '" + SoPhieu + "' "; Microsoft.Reporting.WinForms.ReportDataSource newDataSource = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", DataProvider.GetData(cmd)); string cmd1 = @"SELECT (THUTHU.HO+' '+ THUTHU.TEN) AS TenTT, (DOCGIA.HO+' ' + DOCGIA.TEN) AS TenDG, CONVERT(NVARCHAR, PHIEUMUONSACH.NGAYMUON,103) AS NGAYMUON FROM PHIEUMUONSACH INNER JOIN THUTHU ON PHIEUMUONSACH.MATHUTHU = THUTHU.MATHUTHU INNER JOIN DOCGIA ON PHIEUMUONSACH.MADG = DOCGIA.MADG WHERE SOPM='" + SoPhieu + "'"; ReportParameter[] param = new ReportParameter[4]; param[0] = new ReportParameter("SoPM", SoPhieu); param[1] = new ReportParameter("ThuThu", DataProvider.GetData(cmd1).Rows[0][0].ToString()); param[2] = new ReportParameter("NgayMuon", DataProvider.GetData(cmd1).Rows[0][2].ToString()); param[3] = new ReportParameter("DocGia", DataProvider.GetData(cmd1).Rows[0]["TenDG"].ToString()); reportViewer1.LocalReport.SetParameters(param); reportViewer1.LocalReport.DataSources.Add(newDataSource); reportViewer1.LocalReport.DisplayName = "Báo Cáo"; reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout); reportViewer1.ZoomPercent = 100; this.reportViewer1.RefreshReport(); }
private void ReportViewer_Load(object sender, EventArgs e) { if (!_isReportViewerLoaded) { //InvoiceDetail this._reportViewer.LocalReport.ReportEmbeddedResource = "OA.Invoice.rdlc"; //ReportParameter[] rp = new ReportParameter[1]; ReportParameter rp = new ReportParameter("LoginName", LoginAttribute.UserName); _reportViewer.LocalReport.SetParameters(rp); foreach (DataTable dt in ParameterPassing.ReportTable) { Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource(); rds.Name = dt.TableName; rds.Value = dt; this._reportViewer.LocalReport.DataSources.Add(rds); } _reportViewer.RefreshReport(); _isReportViewerLoaded = true; } }
private void ReInitializeReportViewer() { //if (prevValue == newValue) // return; reportViewer1.Clear(); reportViewer1.Dispose(); this.Controls.Remove(this.reportViewer1); GC.Collect(); // // reportViewer1 // this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer(); this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; reportDataSource1.Name = "Taxi_Model_stp_DriverDailyJobSheetResult"; reportDataSource1.Value = this.stp_DriverDailyJobSheetResultBindingSource; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer1.LocalReport.ReportEmbeddedResource = "Taxi_AppMain.ReportDesigns.Template1_rptDriverDailyJobSheet.rdlc"; this.reportViewer1.Location = new System.Drawing.Point(0, 141); this.reportViewer1.Name = "reportViewer1"; this.reportViewer1.Size = new System.Drawing.Size(1103, 472); this.reportViewer1.TabIndex = 110; this.Controls.Add(this.reportViewer1); reportViewer1.BringToFront(); // prevValue = newValue; }
public void salesReportMonthly() { DateCriteriaForm rf = new DateCriteriaForm(); rf.onSuccessfulDateSelect += new EventHandler(child_onDateSelect); rf.ShowDialog(); using (var db = new posdbEntities()) { var query = (from c in db.salesorders where c.SaleDate >= AppConfig.ReportCriteria_FromDate && c.SaleDate <= AppConfig.ReportCriteria_ToDate group c by c.date_month_string into g select new { SaleDate = g.Key, SaleAmount = g.Sum(p => p.SaleAmount) }).ToList(); Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource("SalesDataSet", query.ToList()); reportViewer1.LocalReport.ReportPath = @"../../Reports/Sales_Reports/SalesReportMonthly.rdlc"; reportViewer1.LocalReport.DataSources.Clear(); reportViewer1.LocalReport.DataSources.Add(rds); reportViewer1.LocalReport.Refresh(); reportViewer1.LocalReport.EnableExternalImages = true; string imagePath = @"file:///" + AppConfig.imagefile; ReportParameter parameter = new ReportParameter("ImagePathParameter", imagePath); reportViewer1.LocalReport.SetParameters(parameter); reportViewer1.RefreshReport(); } }
public void loadReport() { /* // file ini disimpan di bin/debug m_cryRpt.Load(Application.StartupPath + @".\REPORT\RESI.rpt"); // cara pemanggilan menggunakan data table yang sudah di proses dan di masukan ke object dt m_cryRpt.Database.Tables[0].SetDataSource((DataTable)my_dt); // data yang di panggil di ke data source otomatis tergambar ke dataset yang di buat dan berextensi xsd crystalReportViewerRESI.ReportSource = m_cryRpt; crystalReportViewerRESI.Refresh(); */ reportViewerCETAKRESI.LocalReport.DataSources.Clear(); reportViewerCETAKRESI.LocalReport.ReportEmbeddedResource = "LOGISTICMANAGAMENTSYSTEM.REPORTS.EXPRESS.cetakRESI.rdlc"; Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("dsRESI_V_TRANSAKSIEXPRESS", my_dt); // set the datasource reportViewerCETAKRESI.LocalReport.DataSources.Add(dataset); dataset.Value = my_dt; System.Drawing.Printing.PageSettings pg = new PageSettings(); // Set margins // Set paper size pg.Margins.Top = 100; pg.Margins.Bottom = 100; pg.Margins.Left = 100; pg.Margins.Right = 100; pg.Landscape = false; System.Drawing.Printing.PaperSize size = new PaperSize(); size.RawKind = (int)PaperKind.A4; pg.PaperSize = size; // reportViewerCETAKRESI.SetPageSettings(pg); ?? reportViewerCETAKRESI.LocalReport.Refresh(); reportViewerCETAKRESI.RefreshReport(); // refresh report }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); this.reportViewer2 = new Microsoft.Reporting.WinForms.ReportViewer(); this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer(); this.SuspendLayout(); // // reportViewer2 // this.reportViewer2.Dock = System.Windows.Forms.DockStyle.Fill; reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = alumnosCursos.GetAllAsDTO(); this.reportViewer2.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer2.LocalReport.ReportPath = "promediosNotas.rdlc"; this.reportViewer2.Location = new System.Drawing.Point(5, 5); this.reportViewer2.Name = "ReportViewer"; this.reportViewer2.ServerReport.BearerToken = null; this.reportViewer2.Size = new System.Drawing.Size(650, 454); this.reportViewer2.TabIndex = 0; this.reportViewer2.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth; this.reportViewer2.RefreshReport(); // // Promedios // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(660, 464); this.Controls.Add(this.reportViewer2); this.Name = "Promedios"; this.Padding = new System.Windows.Forms.Padding(5); this.Text = "Promedios"; this.ResumeLayout(false); }
private void ReportViewer_Generar() { try { _reporte.Reset(); _reporte.Visible = false; _reporte.LocalReport.ReportPath = "Reportes/rTrasladoEstatal.rdlc"; _reporte.LocalReport.DataSources.Clear(); Microsoft.Reporting.WinForms.ReportDataSource rsd1 = new Microsoft.Reporting.WinForms.ReportDataSource(); rsd1.Name = "DS_DETALLE"; rsd1.Value = ds_detalle; Microsoft.Reporting.WinForms.ReportDataSource rsd2 = new Microsoft.Reporting.WinForms.ReportDataSource(); rsd2.Name = "DS_ENCABEZADO"; rsd2.Value = ds_encabezado; _reporte.LocalReport.DataSources.Add(rsd1); _reporte.LocalReport.DataSources.Add(rsd2); _reporte.RefreshReport(); _reporte.Visible = true; ReportViewerVisible = Visibility.Visible; } catch (Exception ex) { ReportViewerVisible = Visibility.Visible; StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar el reporte.", ex); } }
public AccountStatementFullWindow() { InitializeComponent(); BillingDataDataContext db = new BillingDataDataContext(); rs = new Microsoft.Reporting.WinForms.ReportDataSource(); rs.Name = "AccountStatementDatasetFull"; AccountStatementViewer.LocalReport.ReportPath = "AccountStatementFullReport.rdlc"; }
private void _ReportViewer_Load(object sender, EventArgs e) { if (!_isReportViewerLoaded) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); Gargai grg = new Gargai(); grg.BeginInit(); reportDataSource1.Name = "CustomerReciept"; reportDataSource1.Value = grg.Customer; this._reportViewer.LocalReport.DataSources.Add(reportDataSource1); this._reportViewer.LocalReport.ReportEmbeddedResource = "AMD.AMDReport.rdlc"; grg.EndInit(); GargaiTableAdapters.CustomerTableAdapter customer = new GargaiTableAdapters.CustomerTableAdapter(); customer.ClearBeforeFill = true; customer.FillByCustomerID(grg.Customer, txtCustomerID.Text); ReportParameterCollection reportParameter = new ReportParameterCollection(); reportParameter.Add(new ReportParameter("CustomerName", txtCustomerFullName.Text)); if (PaymentType.SelectedIndex == 0) { reportParameter.Add(new ReportParameter("PaymentType", "Cash")); } else if (PaymentType.SelectedIndex == 1) { reportParameter.Add(new ReportParameter("PaymentType", "Transfer")); } else if (PaymentType.SelectedIndex == 2) { reportParameter.Add(new ReportParameter("PaymentType", "Cash & Transfer")); } this._reportViewer.LocalReport.SetParameters(reportParameter); this._reportViewer.ShowBackButton = false; this._reportViewer.ShowPageNavigationControls = false; this._reportViewer.ShowParameterPrompts = false; this._reportViewer.ShowFindControls = false; this._reportViewer.ShowZoomControl = false; this._reportViewer.ShowFindControls = false; this._reportViewer.ShowContextMenu = false; this._reportViewer.ShowCredentialPrompts = false; this._reportViewer.ShowDocumentMapButton = false; this._reportViewer.ShowParameterPrompts = false; var setUp = this._reportViewer.GetPageSettings(); setUp.Margins = new Margins(0, 0, 0, 0); this._reportViewer.SetPageSettings(setUp); //PageSettings pageSettings = new PageSettings(); //pageSettings.Margins = new Margins(0,0,0,0); _reportViewer.RefreshReport(); _isReportViewerLoaded = true; } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); this.ETC_OutVehicleBindingSource = new System.Windows.Forms.BindingSource(this.components); this.EtcCenter_testingDataSet = new RDLC.EtcCenter_testingDataSet(); this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer(); this.ETC_OutVehicleTableAdapter = new RDLC.EtcCenter_testingDataSetTableAdapters.ETC_OutVehicleTableAdapter(); ((System.ComponentModel.ISupportInitialize)(this.ETC_OutVehicleBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.EtcCenter_testingDataSet)).BeginInit(); this.SuspendLayout(); // // ETC_OutVehicleBindingSource // this.ETC_OutVehicleBindingSource.DataMember = "ETC_OutVehicle"; this.ETC_OutVehicleBindingSource.DataSource = this.EtcCenter_testingDataSet; // // EtcCenter_testingDataSet // this.EtcCenter_testingDataSet.DataSetName = "EtcCenter_testingDataSet"; this.EtcCenter_testingDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // reportViewer1 // this.reportViewer1.AutoSize = true; this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; reportDataSource1.Name = "EtcCenter_testingDataSet_ETC_OutVehicle"; reportDataSource1.Value = this.ETC_OutVehicleBindingSource; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer1.LocalReport.ReportEmbeddedResource = "RDLC.报表页眉页脚和传参.rdlc"; this.reportViewer1.Location = new System.Drawing.Point(0, 0); this.reportViewer1.Name = "reportViewer1"; this.reportViewer1.Size = new System.Drawing.Size(643, 440); this.reportViewer1.TabIndex = 0; this.reportViewer1.Load += new System.EventHandler(this.reportViewer1_Load); // // ETC_OutVehicleTableAdapter // this.ETC_OutVehicleTableAdapter.ClearBeforeFill = true; // // Form2 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(643, 440); this.Controls.Add(this.reportViewer1); this.Name = "Form2"; this.Text = "Form2"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.Form2_Load); ((System.ComponentModel.ISupportInitialize)(this.ETC_OutVehicleBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.EtcCenter_testingDataSet)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
private void ReportViewer_Load(object sender, EventArgs e) { if (!_isReportViewerLoaded) { _reportViewer.Reset(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource("", tab); _reportViewer.LocalReport.DataSources.Add(reportDataSource1); _reportViewer.LocalReport.ReportEmbeddedResource = "Report1.rdlc"; _reportViewer.RefreshReport(); } }
public PrintWindow(List <RuntimeData> data, DateTime toDate, DateTime fromDate, bool option = true) { InitializeComponent(); this.option = option; if (option) { InvoiceGrid1.Visibility = System.Windows.Visibility.Visible; InvoiceGrid2.Visibility = System.Windows.Visibility.Visible; MisGrid1.Visibility = System.Windows.Visibility.Collapsed; MisGrid2.Visibility = System.Windows.Visibility.Collapsed; } else { InvoiceGrid1.Visibility = System.Windows.Visibility.Collapsed; InvoiceGrid2.Visibility = System.Windows.Visibility.Collapsed; MisGrid1.Visibility = System.Windows.Visibility.Visible; MisGrid2.Visibility = System.Windows.Visibility.Visible; } ToDate.SelectedDate = toDate.Date; FromDate.SelectedDate = fromDate.Date; TaxBox.Text = Configs.Default.ServiceTax; ClientListSource = (CollectionViewSource)FindResource("ClientList"); DataGridSource = (CollectionViewSource)FindResource("DataGridDataSource"); SubClientListSource = (CollectionViewSource)FindResource("SubClientList"); dataGridSource = data; if (option) { List <string> clientCodeList = data.Select(x => x.CustCode.Trim()).ToList(); ClientListSource.Source = DataSources.ClientCopy.Where(x => clientCodeList.Contains(x.CLCODE.Trim())).ToList(); } else { ClientListSource.Source = DataSources.ClientCopy; } rs = new Microsoft.Reporting.WinForms.ReportDataSource(); rs.Name = "DataSet1"; SubClientList = new Dictionary <string, List <string> >(); if (data != null) { List <string> clients = data.Select(x => x.CustCode).Distinct().ToList(); clients.ForEach(x => { List <string> subClients = data.Where(y => y.CustCode == x).Select(z => z.SubClient).Distinct().ToList(); SubClientList.Add(x, subClients); }); } Client selectedClient = ClientList.SelectedItem as Client; if (selectedClient != null) { SubClientListSource.Source = SubClientList.ContainsKey(selectedClient.CLCODE) ? SubClientList[selectedClient.CLCODE] : new List <string>(); } rs.Value = dataGridSource; }
private void loadReporteHabitacion() { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource.Name = "habitacion"; reportDataSource.Value = new Bd.ReportHelper().getHabitaciones().habitacion_cliente; reportViewerHabitaciones.LocalReport.DataSources.Clear(); reportViewerHabitaciones.LocalReport.DataSources.Add(reportDataSource); reportViewerHabitaciones.LocalReport.ReportEmbeddedResource = "Becarios.Habitaciones_Disponibles.rdlc"; reportViewerHabitaciones.ProcessingMode = ProcessingMode.Local; reportViewerHabitaciones.RefreshReport(); }
public Report(int id) { InitializeComponent(); this.id = id; ReportViewerDemo.Reset(); DataTable dt = GetData(); Microsoft.Reporting.WinForms.ReportDataSource ds = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dt); ReportViewerDemo.LocalReport.DataSources.Add(ds); ReportViewerDemo.LocalReport.ReportEmbeddedResource = "DoctorCashWpf.Printer.Report1.rdlc"; ReportViewerDemo.RefreshReport(); }
private void loadReporte(int id = 0) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "gasto"; reportDataSource1.Value = new Bd.ReportHelper().getGastos(id).total_gasto; reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(reportDataSource1); reportViewer.LocalReport.ReportEmbeddedResource = "Becarios.GastosCliente.rdlc"; reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.RefreshReport(); }
public AccountStatementReportingWindow() { InitializeComponent(); BillingDataDataContext db = new BillingDataDataContext(); ClientListSource = (CollectionViewSource)FindResource("ClientList"); List <Client> clientList = DataSources.ClientCopy; ClientListSource.Source = clientList.OrderBy(x => x.NameAndCode).ToList(); rs = new Microsoft.Reporting.WinForms.ReportDataSource(); rs.Name = "InvoiceDataSet1"; AccountStatementViewer.LocalReport.ReportPath = "AccountStatementReport.rdlc"; }
private void loadReporte(int clv_orden = 0) { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "gastoTicket"; reportDataSource1.Value = new Bd.ReportHelper().getTicket(clv_orden).total_gasto; reportViewer.LocalReport.DataSources.Clear(); reportViewer.LocalReport.DataSources.Add(reportDataSource1); reportViewer.LocalReport.ReportEmbeddedResource = "Becarios.Ticket.rdlc"; reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.RefreshReport(); }
public FormReportViewer(ReportData reportData) { reportData_ = reportData; InitializeComponent(); this.reportViewer1.LocalReport.DataSources.Clear(); Microsoft.Reporting.WinForms.ReportDataSource rprtDTSource = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", reportData_.Table); this.reportViewer1.LocalReport.DataSources.Add(rprtDTSource); this.reportViewer1.RefreshReport(); }
public frmReporte(string nombreReporte, string tablaDataSet) { InitializeComponent(); this.components = new System.ComponentModel.Container(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); this.p_quirogBindingSource = new System.Windows.Forms.BindingSource(this.components); this.tablas = new SISPE_MIGRACION.reportes.tablas(); this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer(); this.reportViewer1.Load += new System.EventHandler(this.reportViewer1_Load); ((System.ComponentModel.ISupportInitialize)(this.p_quirogBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.tablas)).BeginInit(); this.SuspendLayout(); // // p_quirogBindingSource // this.p_quirogBindingSource.DataMember = tablaDataSet; this.p_quirogBindingSource.DataSource = this.tablas; // // tablas // this.tablas.DataSetName = "tablas"; this.tablas.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // reportViewer1 // this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = this.p_quirogBindingSource; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer1.LocalReport.ReportEmbeddedResource = string.Format("SISPE_MIGRACION.reportes.{0}.rdlc", nombreReporte); this.reportViewer1.Location = new System.Drawing.Point(0, 0); this.reportViewer1.Name = "reportViewer1"; this.reportViewer1.Size = new System.Drawing.Size(768, 499); this.reportViewer1.TabIndex = 0; // // frmReporte // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(768, 499); this.Controls.Add(this.reportViewer1); this.Name = "frmReporte"; this.Text = "Form1"; this.Load += new System.EventHandler(this.frmReporte_Load); ((System.ComponentModel.ISupportInitialize)(this.p_quirogBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.tablas)).EndInit(); this.ResumeLayout(false); WindowState = FormWindowState.Maximized; }
private void PrepareReport() { this.mform_components = new System.ComponentModel.Container(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); this.ProductBindingSource = new System.Windows.Forms.BindingSource(this.mform_components); ((System.ComponentModel.ISupportInitialize)(this.ProductBindingSource)).BeginInit(); reportDataSource1.Name = "DataSet2"; reportDataSource1.Value = this.ProductBindingSource; this.viewerInstance.LocalReport.DataSources.Add(reportDataSource1); this.viewerInstance.LocalReport.ReportEmbeddedResource = "MadeInHouse.ReportViewer.Report1.rdlc"; this.viewerInstance.Location = new System.Drawing.Point(0,0); ((System.ComponentModel.ISupportInitialize)(this.ProductBindingSource)).EndInit(); }
public FinalPrint(BillReport obj) : this() { objReport = obj; reportViewer1.LocalReport.DataSources.Clear(); //clear report reportViewer1.LocalReport.ReportEmbeddedResource = "BookStore.Report1.rdlc"; // bind reportviewer with .rdlc List<BillReport> lstBillReport = new List<BillReport>(); lstBillReport.Add(objReport); Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", lstBillReport); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset); // dataset.Value = list; Microsoft.Reporting.WinForms.ReportDataSource dataset1 = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet2", objReport.productList); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset1); // dataset1.Value = list; reportViewer1.LocalReport.Refresh(); reportViewer1.RefreshReport(); this.reportViewer1.RefreshReport(); }
private void frmReport_Load(object sender, EventArgs e) { try { ReportParameter[] parameters = new ReportParameter[1]; parameters[0] = new ReportParameter("ReportParameter1", dia); this.reportViewer1.LocalReport.SetParameters(parameters); this.reportViewer1.RefreshReport(); reportViewer1.LocalReport.DataSources.Clear(); //clear report reportViewer1.LocalReport.ReportEmbeddedResource = "Centro_Estetica.Report1.rdlc"; // bind reportviewer with .rdlc Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DSInfHono", list); // set the datasource reportViewer1.LocalReport.DataSources.Add(dataset); dataset.Value = list; reportViewer1.LocalReport.Refresh(); reportViewer1.RefreshReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Ver_Reporte_Form_Load(object sender, EventArgs e) { if (reportCD) { this.verReporteRPVW.Reset(); ReportDataSource proyectoDataSet = new Microsoft.Reporting.WinForms.ReportDataSource(); ReportDataSource clasesDiametricasDataSet = new Microsoft.Reporting.WinForms.ReportDataSource(); clasesDiametricasDataSet.Name = "CLASESDIAMETRICASDataSet"; clasesDiametricasDataSet.Value = this.diametricClassesBS; proyectoDataSet.Name = "PROYECTODataSet"; proyectoDataSet.Value = this.proyectoBS; this.verReporteRPVW.LocalReport.DataSources.Add(clasesDiametricasDataSet); this.verReporteRPVW.LocalReport.DataSources.Add(proyectoDataSet); this.verReporteRPVW.LocalReport.ReportEmbeddedResource = "SIFCA.Reportes.DiametricClassesReport.rdlc"; this.verReporteRPVW.RefreshReport(); } else { this.verReporteRPVW.Reset(); ReportDataSource resultadosDataSet = new Microsoft.Reporting.WinForms.ReportDataSource(); ReportDataSource proyectoDataSet = new Microsoft.Reporting.WinForms.ReportDataSource(); ReportDataSource totalesDataSet = new Microsoft.Reporting.WinForms.ReportDataSource(); resultadosDataSet.Name = "RESULTADODATASET"; resultadosDataSet.Value = this.resultadosBS; proyectoDataSet.Name = "PROYECTODATASET"; proyectoDataSet.Value = this.proyectoBS; totalesDataSet.Name = "TOTALESDATASET"; totalesDataSet.Value = this.totalEstratificadoBS; this.verReporteRPVW.LocalReport.DataSources.Add(resultadosDataSet); this.verReporteRPVW.LocalReport.DataSources.Add(proyectoDataSet); if (!estratificado) this.verReporteRPVW.LocalReport.ReportEmbeddedResource = "SIFCA.Reportes.ResultsReport.rdlc"; else { this.verReporteRPVW.LocalReport.DataSources.Add(totalesDataSet); this.verReporteRPVW.LocalReport.ReportEmbeddedResource = "SIFCA.Reportes.StratumReport.rdlc"; } //this.verReporteRPVW.LocalReport.ReportPath = Path.GetDirectoryName(Application.ExecutablePath)+"\\Reportes\\ResultsReport.rdlc"; this.verReporteRPVW.RefreshReport(); } }
/// <summary> /// This method will refresh the report source based on /// the report settings /// </summary> private void RefreshReportSource() { Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource(); switch (m_type) { case ReportType.MessageReport: msViewer.LocalReport.ReportPath = ""; msViewer.LocalReport.DisplayName = Properties.Resources.MessageReport_Title; msViewer.LocalReport.ReportEmbeddedResource = GetReportName(System.Threading.Thread.CurrentThread.CurrentCulture.Name); MessageRecordBindingSource.DataSource = m_msgs; reportDataSource1.Name = "Workshare_Trace_Scanner_Reports_MessageRecord"; reportDataSource1.Value = this.MessageRecordBindingSource; this.msViewer.LocalReport.DataSources.Add(reportDataSource1); break; case ReportType.FullMessageReport: msViewer.LocalReport.ReportPath = ""; msViewer.LocalReport.DisplayName = Properties.Resources.MessageReport_Title; msViewer.LocalReport.ReportEmbeddedResource = GetReportName(System.Threading.Thread.CurrentThread.CurrentCulture.Name); ReportParameter p1 = new ReportParameter("Title", Properties.Resources.RISK_TITLE); ReportParameter p2 = new ReportParameter("SubTitle", Properties.Resources.RISK_SUBTITLE); ReportParameter p3 = new ReportParameter("DocTitle", Properties.Resources.RISK_DOCTITLE); ReportParameter p4 = new ReportParameter("GenBy", Properties.Resources.RISK_GENBY); ReportParameter p5 = new ReportParameter("GenOn", Properties.Resources.RISK_GENON); ReportParameter p6 = new ReportParameter("SumPolicy", Properties.Resources.RISK_SUMPOL); ReportParameter p7 = new ReportParameter("SumRisk", Properties.Resources.RISK_SUM); ReportParameter p8 = new ReportParameter("HighText", Properties.Resources.TEXT_HIGH); ReportParameter p9 = new ReportParameter("MediumText", Properties.Resources.TEXT_MEDIUM); ReportParameter p10 = new ReportParameter("LowText", Properties.Resources.TEXT_LOW); ReportParameter p11 = new ReportParameter("InstanceText", Properties.Resources.RISK_INSTANCE); ReportParameter p12 = new ReportParameter("InstancesText", Properties.Resources.RISK_INSTANCES); ReportParameter p13 = new ReportParameter("EmailRecipients", Properties.Resources.RISK_EMAIL); ReportParameter p14 = new ReportParameter("SubTitlePolicy", Properties.Resources.RISK_SUBTITLEPOL); ReportParameter p15 = new ReportParameter("Risk", Properties.Resources.RISK); ReportParameter p16 = new ReportParameter("Doc", Properties.Resources.RISK_DOC); ReportParameter p17 = new ReportParameter("Policy", Properties.Resources.RISK_POLICY); ReportParameter p18 = new ReportParameter("InstancesOfText", Properties.Resources.RISK_INSTANCES_OF); ReportParameter p19 = new ReportParameter("Triggers", Properties.Resources.TRIGGERS); ReportParameter p20 = new ReportParameter("ReportTitle", Properties.Resources.RISK_REPORTTITLE); msViewer.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20 }); MessageRecordBindingSource.DataSource = m_msgs; reportDataSource1.Name = "Workshare_Reports_Viewer_MessageRecord"; reportDataSource1.Value = this.MessageRecordBindingSource; reportDataSource2.Name = "Full_Workshare_Reports_Viewer_MessageRecord"; reportDataSource2.Value = this.MessageRecordBindingSource; this.msViewer.LocalReport.DataSources.Add(reportDataSource1); this.msViewer.LocalReport.DataSources.Add(reportDataSource2); break; case ReportType.FullFileReport: msViewer.LocalReport.ReportPath = ""; msViewer.LocalReport.DisplayName = Properties.Resources.MessageReport_Title; msViewer.LocalReport.ReportEmbeddedResource = GetReportName(System.Threading.Thread.CurrentThread.CurrentCulture.Name); MessageRecordBindingSource.DataSource = m_msgs; reportDataSource1.Name = "Workshare_Trace_Scanner_Reports_MessageRecord"; reportDataSource1.Value = this.MessageRecordBindingSource; this.msViewer.LocalReport.DataSources.Add(reportDataSource1); break; case ReportType.SummaryReport: msViewer.LocalReport.ReportPath = ""; msViewer.LocalReport.DisplayName = Properties.Resources.SummaryReport_Title; msViewer.LocalReport.ReportEmbeddedResource = GetReportName(System.Threading.Thread.CurrentThread.CurrentCulture.Name); MessageRecordBindingSource.DataSource = m_summary; reportDataSource1.Name = "Workshare_Trace_Scanner_Reports_SummaryRecord"; reportDataSource1.Value = this.MessageRecordBindingSource; this.msViewer.LocalReport.DataSources.Add(reportDataSource1); break; case ReportType.ScanReport: msViewer.LocalReport.ReportPath = ""; msViewer.LocalReport.DisplayName = Properties.Resources.ScanReport_Title; msViewer.LocalReport.ReportEmbeddedResource = GetReportName(System.Threading.Thread.CurrentThread.CurrentCulture.Name); MessageRecordBindingSource.DataSource = m_scans; ViolationRecordBindingSource.DataSource = m_vios; reportDataSource1.Name = "Workshare_Trace_Scanner_Reports_ScanRecord"; reportDataSource1.Value = this.MessageRecordBindingSource; reportDataSource2.Name = "Workshare_Trace_Scanner_Reports_ViolationRecord"; reportDataSource2.Value = this.ViolationRecordBindingSource; this.msViewer.LocalReport.DataSources.Add(reportDataSource1); this.msViewer.LocalReport.DataSources.Add(reportDataSource2); break; } this.Text = msViewer.LocalReport.DisplayName; msViewer.RefreshReport(); }
private void frmRptViewer_Load(object sender, EventArgs e) { Waiting.Show("Preparing to generate report"); try { this.Cursor = Cursors.WaitCursor; if (string.IsNullOrEmpty(this.strRptPath) || (this.dicDSNameWithSQL.Count == 0 && this.dicDSNameWithData.Count == 0)) { CommFunc.MsgInfo("The report path and report data should assign value!"); this.Close(); } else { this.rptViewer.Reset(); this.rptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; this.rptViewer.LocalReport.ReportPath = this.strRptPath; this.rptViewer.LocalReport.DataSources.Clear(); if (this.dicDSNameWithSQL.Count > 0) { foreach (KeyValuePair<string, string> itemDs in this.dicDSNameWithSQL) { Microsoft.Reporting.WinForms.ReportDataSource rptDS = new Microsoft.Reporting.WinForms.ReportDataSource(); rptDS.Name = itemDs.Key; rptDS.Value = GlobalParam.Inst.DBI.GetDataTable(itemDs.Value); this.rptViewer.LocalReport.DataSources.Add(rptDS); } } if (this.dicDSNameWithData.Count > 0) { foreach (KeyValuePair<string, DataTable> itemDs in this.dicDSNameWithData) { Microsoft.Reporting.WinForms.ReportDataSource rptDS = new Microsoft.Reporting.WinForms.ReportDataSource(); rptDS.Name = itemDs.Key; rptDS.Value = itemDs.Value; this.rptViewer.LocalReport.DataSources.Add(rptDS); } } if (this.dicParam.Count > 0) { ReportParameter[] param = new ReportParameter[this.dicParam.Count]; int i = 0; foreach (KeyValuePair<string, string> item in this.dicParam) { param[i] = new Microsoft.Reporting.WinForms.ReportParameter(item.Key, item.Value); i += 1; } this.rptViewer.LocalReport.SetParameters(param); } this.rptViewer.RefreshReport(); } } catch (Exception ex) { Waiting.Close(); CommFunc.MsgErr(ex); this.Close(); } finally { this.Cursor = Cursors.Default; } }
private LocalReport LoadReport(string reportName) { Report.Daten.Firma tempFirma = new Report.Daten.Firma() { Name = Firma.Name, Strasse = Firma.Strasse, PLZ = Firma.PLZ, Ort = Firma.Ort, Beschreibung = Firma.Beschreibung }; Report.Daten.Objekt tempObjekt = new Report.Daten.Objekt() { Stundenverrechnungssatz = Objekt.Stundenverrechnungssatz, Name = Objekt.Name, Beschreibung = Objekt.Beschreibung, GesamtPreisJahr = Objekt.GesamtPreisJahr, AverageHoursDaily = Objekt.Stunden }; var tempList = Objekt.Leistungen.ToList(); tempList.Sort(new Comparer.LeistungObservableObjectComparer()); List<Report.Daten.Leistung> tempLeistungen = new List<Report.Daten.Leistung>(); foreach (var item in tempList) { tempLeistungen.Add(new Report.Daten.Leistung() { Etage = item.Etage.Name, Bezeichnung = item.Bezeichnung.Name, Art = item.Art.Name, Methode = item.Methode.Name, Maenge = item.Maenge.Name, Anzahl = item.Anzahl, RichtLeistung = item.RichtLeistungMitFaktor, Haeufigkeit = item.Haeufigkeit != null ? item.Haeufigkeit.ReportName : "", HaeufigkeitFaktor = item.Haeufigkeit != null ? item.Haeufigkeit.Faktor : 0m, AnzahlMonatlich = item.AnzahlMonatlich, ZeitTaeglich = item.ZeitTaeglich, ZeitMonatlich = item.ZeitMonatlich, Preis = item.Preis }); } LocalReport report = new LocalReport(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "Firma"; //Name of the report dataset in our .RDLC file reportDataSource1.Value = new Report.Daten.Firma[1] { tempFirma }; report.DataSources.Add(reportDataSource1); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource2.Name = "Objekt"; //Name of the report dataset in our .RDLC file reportDataSource2.Value = new Report.Daten.Objekt[1] { tempObjekt }; report.DataSources.Add(reportDataSource2); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource3 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource3.Name = "Leistung"; //Name of the report dataset in our .RDLC file reportDataSource3.Value = tempLeistungen; report.DataSources.Add(reportDataSource3); report.ReportEmbeddedResource = reportName; //"CleanEstimate.Report.EtageHaeufigkeit.rdlc"; return report; }
private LocalReport LoadPrintObjectOverview(string reportName) { Report.Daten.Firma tempFirma = new Report.Daten.Firma() { Name = Firma.Name, Strasse = Firma.Strasse, PLZ = Firma.PLZ, Ort = Firma.Ort, Beschreibung = Firma.Beschreibung }; IEnumerable<Report.Daten.Objekt> tempObjekts = Firma.Objekte.OrderBy(x => x.Name).ThenBy(x => x.Beschreibung).ThenBy(x => x.GesamtPreisJahr).Select(x => new Report.Daten.Objekt() { Stundenverrechnungssatz = x.Stundenverrechnungssatz, Name = x.Name, Beschreibung = x.Beschreibung, GesamtPreisJahr = x.GesamtPreisJahr, AverageHoursDaily = x.Stunden }); LocalReport report = new LocalReport(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "Firma"; //Name of the report dataset in our .RDLC file reportDataSource1.Value = new Report.Daten.Firma[1] { tempFirma }; report.DataSources.Add(reportDataSource1); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource2.Name = "Objekt"; //Name of the report dataset in our .RDLC file reportDataSource2.Value = tempObjekts.ToArray(); report.DataSources.Add(reportDataSource2); report.ReportEmbeddedResource = reportName; return report; }
public static System.Xml.Linq.XDocument ShowReport(ReportViewer reportviewer, Modeling.Report report_model, ViewingOptions viewingoptions, System.Action<Viziblr.Reporting.RDL2005.Report> mod_report) { var report = CreateReport(report_model); if (mod_report != null) { mod_report(report); } var new_dom = report.ReportToXMLDOM(); if (viewingoptions.SaveRDLFile) { string temp_rdl = viewingoptions.OutputRDLFilename; new_dom.Save(temp_rdl); } reportviewer.LocalReport.DataSources.Clear(); var rep_ds = new Microsoft.Reporting.WinForms.ReportDataSource(report_model.DatasetName, report_model.DataTable); reportviewer.LocalReport.DataSources.Add(rep_ds); reportviewer.ProcessingMode = ProcessingMode.Local; var mem_stream = SaveXMLToMemoryStream(new_dom); //reportviewer.LocalReport.ReportPath = temp_rdl; reportviewer.LocalReport.LoadReportDefinition(mem_stream); reportviewer.RefreshReport(); return new_dom; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); Microsoft.Reporting.WinForms.ReportDataSource reportDataSource2 = new Microsoft.Reporting.WinForms.ReportDataSource(); this.QRPrikazVyskladneniBindingSource = new System.Windows.Forms.BindingSource(this.components); this.DataSet1 = new PhotoInfo.Forms.DataSet1(); this.BarCodeBindingSource = new System.Windows.Forms.BindingSource(this.components); this.DataSet2 = new PhotoInfo.Forms.DataSet2(); this.reportViewer1 = new Microsoft.Reporting.WinForms.ReportViewer(); this.QRPrikazVyskladneniTableAdapter = new PhotoInfo.Forms.DataSet1TableAdapters.QRPrikazVyskladneniTableAdapter(); ((System.ComponentModel.ISupportInitialize)(this.QRPrikazVyskladneniBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DataSet1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.BarCodeBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DataSet2)).BeginInit(); this.SuspendLayout(); // // QRPrikazVyskladneniBindingSource // this.QRPrikazVyskladneniBindingSource.DataMember = "QRPrikazVyskladneni"; this.QRPrikazVyskladneniBindingSource.DataSource = this.DataSet1; // // DataSet1 // this.DataSet1.DataSetName = "DataSet1"; this.DataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // BarCodeBindingSource // this.BarCodeBindingSource.DataMember = "BarCode"; this.BarCodeBindingSource.DataSource = this.DataSet2; // // DataSet2 // this.DataSet2.DataSetName = "DataSet2"; this.DataSet2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // reportViewer1 // this.reportViewer1.Dock = System.Windows.Forms.DockStyle.Fill; reportDataSource1.Name = "DataSet1"; reportDataSource1.Value = this.QRPrikazVyskladneniBindingSource; reportDataSource2.Name = "d2"; reportDataSource2.Value = this.BarCodeBindingSource; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer1.LocalReport.DataSources.Add(reportDataSource2); this.reportViewer1.LocalReport.ReportEmbeddedResource = "PhotoInfo.Forms.Report1.rdlc"; this.reportViewer1.Location = new System.Drawing.Point(0, 0); this.reportViewer1.Name = "reportViewer1"; this.reportViewer1.Size = new System.Drawing.Size(707, 635); this.reportViewer1.TabIndex = 0; // // QRPrikazVyskladneniTableAdapter // this.QRPrikazVyskladneniTableAdapter.ClearBeforeFill = true; // // ReportPrikazKVyskladneni // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(707, 635); this.Controls.Add(this.reportViewer1); this.Name = "ReportPrikazKVyskladneni"; this.Text = "ReportPrikazKVyskladneni"; this.Load += new System.EventHandler(this.ReportPrikazKVyskladneni_Load); ((System.ComponentModel.ISupportInitialize)(this.QRPrikazVyskladneniBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DataSet1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.BarCodeBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DataSet2)).EndInit(); this.ResumeLayout(false); }
private void runBtn_Click(object sender, EventArgs e) { string selectedReport = this.reportCmbo.SelectedItem.ToString().ToLower(); ReportDataSource rptDS = new Microsoft.Reporting.WinForms.ReportDataSource(); List<ReportParameter> rptParams = new List<ReportParameter>(); DateTime? startDate = null; DateTime? endDate = null; this.reportViewer1.Reset(); this.reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; switch(selectedReport) { case "employee directory" : this.EMPLOYEETableAdapter.Connection.ConnectionString = ConfigurationManager.ConnectionStrings["MCLabor"].ToString(); this.EMPLOYEETableAdapter.Fill(this.DSEmployee.EMPLOYEE); rptDS.Name = "DSEmployee_EMPLOYEE"; rptDS.Value = this.EMPLOYEEBindingSource; this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(rptDS); this.reportViewer1.LocalReport.ReportEmbeddedResource = "MCLaborAdmin.RPTEmployeeDirectory.rdlc"; break; case "pay rate list" : this.DTPayRateListTableAdapter.Connection.ConnectionString = ConfigurationManager.ConnectionStrings["MCLabor"].ToString(); this.DTPayRateListTableAdapter.Fill(this.DSPayRateList.DTPayRateList); rptDS.Name = "DSPayRateList_DTPayRateList"; rptDS.Value = this.DTPayRateListBindingSource; this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(rptDS); this.reportViewer1.LocalReport.ReportEmbeddedResource = "MCLaborAdmin.RPTPayRateList.rdlc"; break; case "work site labor summary" : this.DTWorkSiteLaborSummaryTableAdapter.Connection.ConnectionString = ConfigurationManager.ConnectionStrings["MCLabor"].ToString(); this.DTWorkSiteLaborSummaryTableAdapter.Fill(this.DSWorkSiteLaborSummary.DTWorkSiteLaborSummary); rptDS.Name = "DSWorkSiteLaborSummary_DTWorkSiteLaborSummary"; rptDS.Value = this.DTWorkSiteLaborSummaryBindingSource; this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(rptDS); this.reportViewer1.LocalReport.ReportEmbeddedResource = "MCLaborAdmin.RPTWorkSiteLaborSummary.rdlc"; if ((this.workSiteCmbo.SelectedItem != null) && (this.workSiteCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmWorkSiteName", ((WorkSite)this.workSiteCmbo.SelectedItem).WorkSiteName)); } else { for (int i = 1; i < this.workSiteCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmWorkSiteName", ((WorkSite)this.workSiteCmbo.Items[i]).WorkSiteName)); } } if ((this.jobCmbo.SelectedItem != null) && (this.jobCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmJobName", ((Job)this.jobCmbo.SelectedItem).JobName)); } else { for (int i = 1; i < this.jobCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmJobName", ((Job)this.jobCmbo.Items[i]).JobName)); } } this.reportViewer1.LocalReport.SetParameters(rptParams); break; case "employee labor detail" : if (!validateDateParams()) { break; } startDate = this.startDatePicker.Value; endDate = this.endDatePicker.Value; this.EMP_LABOR_DETAILTableAdapter.Connection.ConnectionString = ConfigurationManager.ConnectionStrings["MCLabor"].ToString(); this.EMP_LABOR_DETAILTableAdapter.Fill(this.DSEmpLaborDetail.EMP_LABOR_DETAIL, startDate, endDate); rptDS.Name = "DSEmpLaborDetail_EMP_LABOR_DETAIL"; rptDS.Value = this.EMP_LABOR_DETAILBindingSource; this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(rptDS); this.reportViewer1.LocalReport.ReportEmbeddedResource = "MCLaborAdmin.RPTEmployeeLaborDetail.rdlc"; rptParams.Add(new ReportParameter("ParmStartDate", startDate.Value.ToString())); rptParams.Add(new ReportParameter("ParmEndDate", endDate.Value.ToString())); if ((this.employeeCmbo.SelectedItem != null) && (this.employeeCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmEmpId", ((Employee)this.employeeCmbo.SelectedItem).EmployeeId.ToString())); } else { for (int i = 1; i < this.employeeCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmEmpId", ((Employee)this.employeeCmbo.Items[i]).EmployeeId.ToString())); } } if ((this.workSiteCmbo.SelectedItem != null) && (this.workSiteCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmWorkSiteName", ((WorkSite)this.workSiteCmbo.SelectedItem).WorkSiteName)); } else { for (int i = 1; i < this.workSiteCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmWorkSiteName", ((WorkSite)this.workSiteCmbo.Items[i]).WorkSiteName)); } } if ((this.jobCmbo.SelectedItem != null) && (this.jobCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmJobName", ((Job)this.jobCmbo.SelectedItem).JobName)); } else { for (int i = 1; i < this.jobCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmJobName", ((Job)this.jobCmbo.Items[i]).JobName)); } } this.reportViewer1.LocalReport.SetParameters(rptParams); break; case "employee labor summary" : if (!validateDateParams()) { break; } startDate = this.startDatePicker.Value; endDate = this.endDatePicker.Value; this.EMP_LABOR_SUMMARYTableAdapter.Connection.ConnectionString = ConfigurationManager.ConnectionStrings["MCLabor"].ToString(); this.EMP_LABOR_SUMMARYTableAdapter.Fill(this.DSEmpLaborSummary.EMP_LABOR_SUMMARY, startDate, endDate); rptDS.Name = "DSEmpLaborSummary_EMP_LABOR_SUMMARY"; rptDS.Value = this.EMP_LABOR_SUMMARYBindingSource; this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(rptDS); this.reportViewer1.LocalReport.ReportEmbeddedResource = "MCLaborAdmin.RPTEmployeeLaborSummary.rdlc"; rptParams.Add(new ReportParameter("ParmStartDate", startDate.Value.ToString())); rptParams.Add(new ReportParameter("ParmEndDate", endDate.Value.ToString())); if ((this.employeeCmbo.SelectedItem != null) && (this.employeeCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmEmpId", ((Employee)this.employeeCmbo.SelectedItem).EmployeeId.ToString())); } else { for (int i = 1; i < this.employeeCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmEmpId", ((Employee)this.employeeCmbo.Items[i]).EmployeeId.ToString())); } } if ((this.workSiteCmbo.SelectedItem != null) && (this.workSiteCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmWorkSiteName", ((WorkSite)this.workSiteCmbo.SelectedItem).WorkSiteName)); } else { for (int i = 1; i < this.workSiteCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmWorkSiteName", ((WorkSite)this.workSiteCmbo.Items[i]).WorkSiteName)); } } if ((this.jobCmbo.SelectedItem != null) && (this.jobCmbo.SelectedIndex != 0)) { rptParams.Add(new ReportParameter("ParmJobName", ((Job)this.jobCmbo.SelectedItem).JobName)); } else { for (int i = 1; i < this.jobCmbo.Items.Count; i++) { rptParams.Add(new ReportParameter("ParmJobName", ((Job)this.jobCmbo.Items[i]).JobName)); } } this.reportViewer1.LocalReport.SetParameters(rptParams); break; } this.reportViewer1.RefreshReport(); }
private void Form1_Load(object sender, EventArgs e) { this.reportDataset = new Report(); this.reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource(); this.reportViewer1.ProcessingMode = ProcessingMode.Local; switch (ReportType) { case "EC": ReportTableAdapters.ECTableAdapter ECTableAdapter = new ReportTableAdapters.ECTableAdapter(); ECTableAdapter.Fill(reportDataset.EC, this.ObjectID); this.reportDataSource.Name = "EC"; this.reportDataSource.Value = this.reportDataset.EC; this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.EC.rdlc"; break; case "MEDICINEBILL": ReportTableAdapters.MEDICINEBILLTableAdapter MEDICINEBILLTableAdapter = new ReportTableAdapters.MEDICINEBILLTableAdapter(); MEDICINEBILLTableAdapter.Fill(reportDataset.MEDICINEBILL, this.ObjectID); this.reportDataSource.Name = "MEDICINEBILL"; this.reportDataSource.Value = this.reportDataset.MEDICINEBILL; this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.MEDICINEBILL.rdlc"; break; case "SERVICEBILL": ReportTableAdapters.SERVICEBILLTableAdapter SERVICEBILLTableAdapter = new ReportTableAdapters.SERVICEBILLTableAdapter(); SERVICEBILLTableAdapter.Fill(reportDataset.SERVICEBILL, this.ObjectID); this.reportDataSource.Name = "SERVICEBILL"; this.reportDataSource.Value = this.reportDataset.SERVICEBILL; this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.SERVICEBILL.rdlc"; break; case "MATERIALBILL": ReportTableAdapters.MATERIALBILLTableAdapter METERIALBILLTableAdapter = new ReportTableAdapters.MATERIALBILLTableAdapter(); METERIALBILLTableAdapter.Fill(reportDataset.MATERIALBILL, this.ObjectID); this.reportDataSource.Name = "MATERIALBILL"; this.reportDataSource.Value = this.reportDataset.MATERIALBILL; this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.MATERIALBILL.rdlc"; break; case "REVENUEBYDAY": ReportTableAdapters.REVENUEBYDAYTableAdapter REVENUEBYDAYTableAdapter = new ReportTableAdapters.REVENUEBYDAYTableAdapter(); REVENUEBYDAYTableAdapter.Fill(reportDataset.REVENUEBYDAY, this.DATEFROM, this.DATETO); this.reportDataSource.Name = "REVENUEBYDAY"; this.reportDataSource.Value = this.reportDataset.REVENUEBYDAY; //this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { //new ReportParameter("DateForm", this.DATEFROM.ToShortDateString()), //new ReportParameter("DateTo", this.DATETO.ToShortDateString()) }); this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.REVENUEBYDAY.rdlc"; break; case "REVENUEBYMONTH": ReportTableAdapters.REVENUEBYMONTHTableAdapter REVENUEBYMONTHTableAdapter = new ReportTableAdapters.REVENUEBYMONTHTableAdapter(); REVENUEBYMONTHTableAdapter.Fill(reportDataset.REVENUEBYMONTH, this.DATEFROM, this.DATETO); this.reportDataSource.Name = "REVENUEBYMONTH"; this.reportDataSource.Value = this.reportDataset.REVENUEBYMONTH; this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.REVENUEBYMONTH.rdlc"; break; case "REVENUEBYYEAR": ReportTableAdapters.REVENUEBYYEARTableAdapter REVENUEBYYEARTableAdapter = new ReportTableAdapters.REVENUEBYYEARTableAdapter(); REVENUEBYYEARTableAdapter.Fill(reportDataset.REVENUEBYYEAR, this.DATEFROM, this.DATETO); this.reportDataSource.Name = "REVENUEBYYEAR"; this.reportDataSource.Value = this.reportDataset.REVENUEBYYEAR; this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.REVENUEBYYEAR.rdlc"; break; } this.reportViewer1.LocalReport.DataSources.Add(this.reportDataSource); this.reportViewer1.RefreshReport(); //this.reportDataset = new Report(); //this.reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource(); //this.reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; //ReportTableAdapters.REVENUEBYYEARTableAdapter REVENUEBYYEARTableAdapter = new ReportTableAdapters.REVENUEBYYEARTableAdapter(); //REVENUEBYYEARTableAdapter.Fill(reportDataset.REVENUEBYYEAR, this.DATEFROM, this.DATETO); //this.reportDataSource.Name = "REVENUEBYYEAR"; //this.reportDataSource.Value = this.reportDataset.REVENUEBYYEAR; //this.reportViewer1.LocalReport.ReportEmbeddedResource = "Hospital.Report.REVENUEBYYEAR.rdlc"; //this.reportViewer1.LocalReport.DataSources.Add(this.reportDataSource); //this.reportViewer1.RefreshReport(); }