void AddRepres() { try { RepView rv = new RepView(_contract.CustomerId); rv.AddCompleted += OnAddRepresCompleted; rv.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; rv.ShowDialog(); } catch (Exception ex) { Helper.LogShowError(ex); } }
// Daten aus der Datenbank holen und zeigen private Int32 fetchData(string asSql, string asSqlHeader, string asSqlFadr, string asSqlZahlungen, string asSqlSumme, string asSqlContent, string asSqlContent2, string asReportName, string asDatVon, string asDatBis, string asSqlRgNr) { int liRows = 0; int liOk = 0; SqlConnection connect; DataTable tableRep = new DataTable(); // Grid DataTable tableHeader = new DataTable(); // Grid DataTable tableFadr = new DataTable(); // Grid DataTable tableZahlungen = new DataTable(); DataTable tableSumme = new DataTable(); DataTable tableContent = new DataTable(); DataTable tableContentShow = new DataTable(); connect = new SqlConnection(gsConnect); string lsSqlContentShow = ""; // Darstellung der Abrechnungsdaten if (asSql.Length > 0) { try { // Db open connect.Open(); // Report SqlCommand command = new SqlCommand(asSql, connect); // Create a SqlDataReader SqlDataReader queryCommandReader = command.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableRep.Load(queryCommandReader); liRows = tableRep.Rows.Count; // Header für Report SqlCommand command2 = new SqlCommand(asSqlHeader, connect); // Create a SqlDataReader SqlDataReader queryCommandReader2 = command2.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableHeader.Load(queryCommandReader2); // Firmenadresse für Report SqlCommand command3 = new SqlCommand(asSqlFadr, connect); // Create a SqlDataReader SqlDataReader queryCommandReader3 = command3.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableFadr.Load(queryCommandReader3); if (asSqlZahlungen.Length > 0) { // DataSet für Zahlungen SqlCommand command4 = new SqlCommand(asSqlZahlungen, connect); // Create a SqlDataReader SqlDataReader queryCommandReader4 = command4.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableZahlungen.Load(queryCommandReader4); } if (asSqlSumme.Length > 0) { // DataSet für Zahlungen SqlCommand command5 = new SqlCommand(asSqlSumme, connect); // Create a SqlDataReader SqlDataReader queryCommandReader5 = command5.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableSumme.Load(queryCommandReader5); } if (asSqlContent.Length > 0) { // DataSet für Inhalt Abrechnungen aus x_abr_content SqlCommand command6 = new SqlCommand(asSqlContent, connect); // Create a SqlDataReader SqlDataReader queryCommandReader6 = command6.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableContent.Load(queryCommandReader6); } liRows = 1; if (liRows > 0) { if (asReportName == "rechnungen") { this.Title = "Report Rechnungen"; // Report befüllen RepView.Reset(); ReportDataSource rds = new ReportDataSource("DataSet1", tableRep); ReportDataSource rdsHd = new ReportDataSource("DataSetHeader", tableHeader); ReportDataSource rdsFa = new ReportDataSource("DataSetFadr", tableFadr); RepView.LocalReport.DataSources.Add(rds); RepView.LocalReport.DataSources.Add(rdsHd); RepView.LocalReport.DataSources.Add(rdsFa); RepView.LocalReport.ReportEmbeddedResource = "Ruddat_NK.ReportRechnungen.rdlc"; // RepView. RepView.RefreshReport(); } if (asReportName == "zahlungen") { this.Title = "Report Zahlungen"; // Report befüllen RepView.Reset(); ReportDataSource rds = new ReportDataSource("DataSet1", tableRep); ReportDataSource rdsHd = new ReportDataSource("DataSetHeader", tableHeader); ReportDataSource rdsFa = new ReportDataSource("DataSetFadr", tableFadr); RepView.LocalReport.DataSources.Add(rds); RepView.LocalReport.DataSources.Add(rdsHd); RepView.LocalReport.DataSources.Add(rdsFa); RepView.LocalReport.ReportEmbeddedResource = "Ruddat_NK.ReportZahlungen.rdlc"; RepView.RefreshReport(); } if (asReportName == "kosten") // Nebenkostenabrecnung { // Die Tabelle x_abr_content muss befüllt werden liOk = Timeline.fill_content(asSql, asSqlContent, asSqlContent2, asDatVon, asDatBis, gsConnect, "", 0); // Dann die Tabelle laden // Hauptcontent für Abrechnung holen lsSqlContentShow = getSql("", 3, 0); if (asSqlContent.Length > 0) { // DataSet für Inhalt Abrechnungen aus x_abr_content SqlCommand command7 = new SqlCommand(lsSqlContentShow, connect); // Create a SqlDataReader SqlDataReader queryCommandReader7 = command7.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableContentShow.Load(queryCommandReader7); this.Title = "Report Kosten"; // Report befüllen RepView.Reset(); ReportDataSource rds = new ReportDataSource("DataSet1", tableRep); ReportDataSource rdsHd = new ReportDataSource("DataSet2", tableHeader); ReportDataSource rdsFa = new ReportDataSource("DataSet3", tableFadr); ReportDataSource rdsZlg = new ReportDataSource("DataSet4", tableZahlungen); // Im Report Dataset Zahlungen verwenden ReportDataSource rdsSum = new ReportDataSource("DataSet5", tableSumme); // Im Report Dataset Zahlungen verwenden ReportDataSource rdsCon = new ReportDataSource("DataSet6", tableContentShow); // Content RepView.LocalReport.DataSources.Add(rds); RepView.LocalReport.DataSources.Add(rdsHd); RepView.LocalReport.DataSources.Add(rdsFa); RepView.LocalReport.DataSources.Add(rdsZlg); RepView.LocalReport.DataSources.Add(rdsSum); RepView.LocalReport.DataSources.Add(rdsCon); RepView.LocalReport.ReportEmbeddedResource = "Ruddat_NK.ReportAbrechnung.rdlc"; RepView.RefreshReport(); } } if (asReportName == "kostendetail") // Nebenkostenabrecnung detailliert { // Die Tabelle x_abr_content muss befüllt werden liOk = Timeline.fill_content(asSql, asSqlContent, asSqlContent2, asDatVon, asDatBis, gsConnect, "", 0); // Dann die Tabelle laden // Hauptcontent für Abrechnung holen lsSqlContentShow = getSql("", 3, 0); if (asSqlContent.Length > 0) { // DataSet für Inhalt Abrechnungen aus x_abr_content SqlCommand command7 = new SqlCommand(lsSqlContentShow, connect); // Create a SqlDataReader SqlDataReader queryCommandReader7 = command7.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableContentShow.Load(queryCommandReader7); this.Title = "Report Kosten"; // Report befüllen RepView.Reset(); ReportDataSource rds = new ReportDataSource("DataSet1", tableRep); ReportDataSource rdsHd = new ReportDataSource("DataSet2", tableHeader); ReportDataSource rdsFa = new ReportDataSource("DataSet3", tableFadr); ReportDataSource rdsZlg = new ReportDataSource("DataSet4", tableZahlungen); // Im Report Dataset Zahlungen verwenden ReportDataSource rdsSum = new ReportDataSource("DataSet5", tableSumme); // Im Report Dataset Zahlungen verwenden ReportDataSource rdsCon = new ReportDataSource("DataSet6", tableContentShow); // Content RepView.LocalReport.DataSources.Add(rds); RepView.LocalReport.DataSources.Add(rdsHd); RepView.LocalReport.DataSources.Add(rdsFa); RepView.LocalReport.DataSources.Add(rdsZlg); RepView.LocalReport.DataSources.Add(rdsSum); RepView.LocalReport.DataSources.Add(rdsCon); RepView.LocalReport.ReportEmbeddedResource = "Ruddat_NK.ReportAbrechnungdetailliert.rdlc"; RepView.RefreshReport(); } } if (asReportName == "anschreiben") // Anschreiben { // Die Tabelle x_abr_content muss befüllt werden liOk = Timeline.fill_content(asSql, asSqlContent, asSqlContent2, asDatVon, asDatBis, gsConnect, asSqlRgNr, 1); // Dann die Tabelle laden // Hauptcontent für Abrechnung holen lsSqlContentShow = getSql("", 3, 0); if (asSqlContent.Length > 0) { // DataSet für Inhalt Abrechnungen aus x_abr_content SqlCommand command7 = new SqlCommand(lsSqlContentShow, connect); // Create a SqlDataReader SqlDataReader queryCommandReader7 = command7.ExecuteReader(); // Create a DataTable object to hold all the data returned by the query. tableContentShow.Load(queryCommandReader7); this.Title = "Report Kosten"; // Report befüllen RepView.Reset(); ReportDataSource rds = new ReportDataSource("DataSet1", tableRep); ReportDataSource rdsHd = new ReportDataSource("DataSet2", tableHeader); ReportDataSource rdsFa = new ReportDataSource("DataSet3", tableFadr); ReportDataSource rdsZlg = new ReportDataSource("DataSet4", tableZahlungen); // Im Report Dataset Zahlungen verwenden ReportDataSource rdsSum = new ReportDataSource("DataSet5", tableSumme); // Im Report Dataset Zahlungen verwenden ReportDataSource rdsCon = new ReportDataSource("DataSet6", tableContentShow); // Content RepView.LocalReport.DataSources.Add(rds); RepView.LocalReport.DataSources.Add(rdsHd); RepView.LocalReport.DataSources.Add(rdsFa); RepView.LocalReport.DataSources.Add(rdsZlg); RepView.LocalReport.DataSources.Add(rdsSum); RepView.LocalReport.DataSources.Add(rdsCon); RepView.LocalReport.ReportEmbeddedResource = "Ruddat_NK.ReportAnschreiben.rdlc"; RepView.RefreshReport(); } } } else { MessageBox.Show("Es wurde kein Objekt angewählt oder es sind keine Daten vorhanden", "Keine Daten"); } } catch { // Die Anwendung anhalten MessageBox.Show("Verarbeitungsfehler Error WndRep.F01\n" + "Achtung"); } } else { MessageBox.Show("Es wurde kein Objekt angewählt", "Eingabe fehlt"); } return(liRows); }