From 4d679d3669658826244387b9ac2f0cee95a33eb2 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 11 Oct 2022 16:01:53 +0200 Subject: [PATCH] AutismusKoelnBonn, AutimusLeben, PerspektivenEV, AKGG und Varo --- ReportImp/AKGG/CustomReportCreator.cs | 2 +- .../AutismusKoelnBonn.csproj | 1 + ReportImp/AutismusKoelnBonn/BasisRechnung.cs | 2 +- ReportImp/AutismusKoelnBonn/RechnungFaktor.cs | 2 +- .../InvoiceCustomerReport.Designer.cs | 2 + .../ServiceInvoiceReport.Designer.cs | 14 +- .../AutismusLeben/ServiceInvoiceReport.cs | 22 ++- .../PerspektivenEV/Export/DatevExporter.cs | 128 ++++++++++++++++++ .../Invoicing/CollectiveInvoiceCreation.cs | 28 ++-- .../PerspektivenEV/PerspektivenEV.csproj | 1 + .../Invoicing/CustomInvoiceCreation.cs | 10 +- 11 files changed, 187 insertions(+), 25 deletions(-) diff --git a/ReportImp/AKGG/CustomReportCreator.cs b/ReportImp/AKGG/CustomReportCreator.cs index c380fdfc8..d9f6a3d45 100644 --- a/ReportImp/AKGG/CustomReportCreator.cs +++ b/ReportImp/AKGG/CustomReportCreator.cs @@ -10,7 +10,7 @@ namespace Akgg { public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay) { - List lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay); + List lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid); if (lROs.Count > 0) { diff --git a/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj b/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj index 85b399488..aa3512c9f 100644 --- a/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj +++ b/ReportImp/AutismusKoelnBonn/AutismusKoelnBonn.csproj @@ -121,6 +121,7 @@ InvoiceCustomerReport.cs Designer + Quittierungsbeleg.cs Designer diff --git a/ReportImp/AutismusKoelnBonn/BasisRechnung.cs b/ReportImp/AutismusKoelnBonn/BasisRechnung.cs index 554d27f84..2d4a175de 100644 --- a/ReportImp/AutismusKoelnBonn/BasisRechnung.cs +++ b/ReportImp/AutismusKoelnBonn/BasisRechnung.cs @@ -61,7 +61,7 @@ namespace AutismusKoelnBonn string team = "MoveAut Team Köln"; Customer c; - if (pRO.ServiceInvoicePeriods[0].Customer.Oid.HasValue) + if (pRO.ServiceInvoicePeriods.Count > 0 && pRO.ServiceInvoicePeriods[0].Customer.Oid.HasValue) { c = DAOFactory.GenericDAO.LoadByID(pRO.ServiceInvoicePeriods[0].Customer.Oid ?? 0); team = c.Team2CustomerList[0].Team.Name; diff --git a/ReportImp/AutismusKoelnBonn/RechnungFaktor.cs b/ReportImp/AutismusKoelnBonn/RechnungFaktor.cs index 5e48c5c82..24aaec9c1 100644 --- a/ReportImp/AutismusKoelnBonn/RechnungFaktor.cs +++ b/ReportImp/AutismusKoelnBonn/RechnungFaktor.cs @@ -61,7 +61,7 @@ namespace AutismusKoelnBonn lblAdresse.Text = sb.ToString(); string team = "MoveAut Team Köln"; Customer c; - if (pRO.ServiceInvoicePeriods[0].Customer.Oid.HasValue) + if (pRO.ServiceInvoicePeriods.Count > 0 && pRO.ServiceInvoicePeriods[0].Customer.Oid.HasValue) { c = DAOFactory.GenericDAO.LoadByID(pRO.ServiceInvoicePeriods[0].Customer.Oid ?? 0); team = c.Team2CustomerList[0].Team.Name; diff --git a/ReportImp/AutismusLeben/InvoiceCustomerReport.Designer.cs b/ReportImp/AutismusLeben/InvoiceCustomerReport.Designer.cs index dac9315a7..099c62710 100644 --- a/ReportImp/AutismusLeben/InvoiceCustomerReport.Designer.cs +++ b/ReportImp/AutismusLeben/InvoiceCustomerReport.Designer.cs @@ -713,11 +713,13 @@ namespace AutismusLeben // // lblSchlusssatz // + this.lblSchlusssatz.Font = new System.Drawing.Font("Arial", 10F); this.lblSchlusssatz.LocationFloat = new DevExpress.Utils.PointFloat(0.0003814697F, 55.76045F); this.lblSchlusssatz.Multiline = true; this.lblSchlusssatz.Name = "lblSchlusssatz"; this.lblSchlusssatz.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.lblSchlusssatz.SizeF = new System.Drawing.SizeF(700.9995F, 67.27083F); + this.lblSchlusssatz.StylePriority.UseFont = false; // // xrTable4 // diff --git a/ReportImp/AutismusLeben/ServiceInvoiceReport.Designer.cs b/ReportImp/AutismusLeben/ServiceInvoiceReport.Designer.cs index d2b169558..8cfd82588 100644 --- a/ReportImp/AutismusLeben/ServiceInvoiceReport.Designer.cs +++ b/ReportImp/AutismusLeben/ServiceInvoiceReport.Designer.cs @@ -515,7 +515,7 @@ namespace AutismusLeben // xrLabel20 // this.xrLabel20.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "DebitorNumber")}); + new DevExpress.XtraReports.UI.XRBinding("Text", null, "InvoiceBase.SupportConceptCostBearerRelDc.SupportConcept.Customer.DebitorNumber")}); this.xrLabel20.Font = new System.Drawing.Font("Arial", 9F); this.xrLabel20.LocationFloat = new DevExpress.Utils.PointFloat(534.75F, 34.00005F); this.xrLabel20.Name = "xrLabel20"; @@ -581,6 +581,8 @@ namespace AutismusLeben // this.xrLabel21.BackColor = System.Drawing.Color.Transparent; this.xrLabel21.CanShrink = true; + this.xrLabel21.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { + new DevExpress.XtraReports.UI.XRBinding("Text", null, "InvoiceBase.CustomerReferenceNumber", "Aktenzeichen LVR: {0}")}); this.xrLabel21.Font = new System.Drawing.Font("Arial", 10F); this.xrLabel21.LocationFloat = new DevExpress.Utils.PointFloat(0F, 338.9285F); this.xrLabel21.Multiline = true; @@ -589,7 +591,6 @@ namespace AutismusLeben this.xrLabel21.SizeF = new System.Drawing.SizeF(683.0002F, 20F); this.xrLabel21.StylePriority.UseBackColor = false; this.xrLabel21.StylePriority.UseFont = false; - this.xrLabel21.Text = "Aktenzeichen LVR: [CustomerReferenceNumber]"; this.xrLabel21.WordWrap = false; // // xrLabel4 @@ -604,7 +605,8 @@ namespace AutismusLeben this.xrLabel4.SizeF = new System.Drawing.SizeF(683.0002F, 20F); this.xrLabel4.StylePriority.UseBackColor = false; this.xrLabel4.StylePriority.UseFont = false; - this.xrLabel4.Text = "[CustomerLastName], [CustomerFirstName]; [CustomerBirthdate!dd.MM.yyyy]"; + this.xrLabel4.Text = "[InvoiceBase.CustomerLastName], [InvoiceBase.CustomerFirstName]; [CustomerBirthda" + + "te!dd.MM.yyyy]"; this.xrLabel4.WordWrap = false; // // xrLabel3 @@ -855,8 +857,6 @@ namespace AutismusLeben this.xrTableCell43.BorderColor = System.Drawing.Color.Black; this.xrTableCell43.Borders = ((DevExpress.XtraPrinting.BorderSide)(((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right) | DevExpress.XtraPrinting.BorderSide.Bottom))); - this.xrTableCell43.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] { - new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.ServiceDescription", "{0:0.00}")}); this.xrTableCell43.Font = new System.Drawing.Font("Arial", 9F); this.xrTableCell43.Name = "xrTableCell43"; this.xrTableCell43.Padding = new DevExpress.XtraPrinting.PaddingInfo(5, 2, 2, 2, 100F); @@ -865,7 +865,7 @@ namespace AutismusLeben this.xrTableCell43.StylePriority.UseFont = false; this.xrTableCell43.StylePriority.UsePadding = false; this.xrTableCell43.StylePriority.UseTextAlignment = false; - this.xrTableCell43.Text = "xrTableCell43"; + this.xrTableCell43.Text = "Betreuungsleistungen"; this.xrTableCell43.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft; this.xrTableCell43.Weight = 1.5008078450454461D; // @@ -917,11 +917,13 @@ namespace AutismusLeben // // lblSchlusssatz // + this.lblSchlusssatz.Font = new System.Drawing.Font("Arial", 10F); this.lblSchlusssatz.LocationFloat = new DevExpress.Utils.PointFloat(0F, 49.86458F); this.lblSchlusssatz.Multiline = true; this.lblSchlusssatz.Name = "lblSchlusssatz"; this.lblSchlusssatz.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F); this.lblSchlusssatz.SizeF = new System.Drawing.SizeF(682.9998F, 67.27084F); + this.lblSchlusssatz.StylePriority.UseFont = false; // // xrTable2 // diff --git a/ReportImp/AutismusLeben/ServiceInvoiceReport.cs b/ReportImp/AutismusLeben/ServiceInvoiceReport.cs index 8e14c924e..d91584ff1 100644 --- a/ReportImp/AutismusLeben/ServiceInvoiceReport.cs +++ b/ReportImp/AutismusLeben/ServiceInvoiceReport.cs @@ -25,7 +25,27 @@ namespace AutismusLeben //{ // lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end); //} - lblSchlusssatz.Text = string.Format("Zahlbar bis {0:dd.MM.yyyy} ohne Abzug.\nUmsatzsteuerfrei gemäß §4 Nr. 18 UStG.", pRO.InvoiceDateTime.Value.AddDays(14)); + foreach (var sip in pRO.ServiceInvoicePeriods) + { + if (sip.ServiceInvoiceItems != null) + { + foreach (var ii in sip.ServiceInvoiceItems) + { + if (!String.IsNullOrEmpty(ii.RateFactor)) + { + var rfStr = ii.RateFactor.Replace("%", "").Replace(",00", "").Trim(); + int rfInt = 0; + Int32.TryParse(rfStr, out rfInt); + + decimal rateFactor = (100m + rfInt) / 100m; + + ii.Hours = ii.Hours * rateFactor; + } + } + } + } + + lblSchlusssatz.Text = string.Format("Zahlbar bis {0:dd.MM.yyyy} ohne Abzug.\nUmsatzsteuerfrei gemäß §4 Nr. 18 UStG.", pRO.InvoiceDateTime.Value.AddDays(14)); this.bindingSource1.DataSource = pRO; } diff --git a/ReportImp/PerspektivenEV/Export/DatevExporter.cs b/ReportImp/PerspektivenEV/Export/DatevExporter.cs index 1ecae049a..53d575549 100644 --- a/ReportImp/PerspektivenEV/Export/DatevExporter.cs +++ b/ReportImp/PerspektivenEV/Export/DatevExporter.cs @@ -35,6 +35,16 @@ namespace PerspektivenEV.Export if (!String.IsNullOrWhiteSpace(s)) sb.Append(s); + + var sAllg = GetMonatlicheAllgRechnungenString(date); + if (!String.IsNullOrWhiteSpace(sAllg)) + { + if (sb.Length > 0) + sb.AppendLine(); + + sb.Append(sAllg); + } + var sLWV = GetMonatlicheRechnungLWVString(date); if (!String.IsNullOrWhiteSpace(sLWV)) { @@ -130,6 +140,92 @@ namespace PerspektivenEV.Export return sb.ToString(); } + public static String GetMonatlicheAllgRechnungenString(DateTime date) + { + var sql = GetMonatlicheAllgRechnungenSql(date); + + /* + 0 sip.Claim, + 1 c.DebitorNumber, + 2 ib.InvoiceDate, + 3 ib.invoicenumber, + 4 ib.Oid AS InvoiceOID, + 5 c.CostCenter, + 6 c2s.Oid, + 7 ib.InvoiceId, + 8 ib.RecipientOrganisation, + 9 ii.ItemDescription, + 10 ii.UnitDescription, + 11 ii.SupportConceptAproOID + 12 ii.Notice, + 13 ii.AmountPerUnit, + 14 ii.UnitCount, + 15 ii.AmountTotal + */ + + //Kontonummer; Umsatz; Gegenkonto; Belegdatum; Kost 1; Belegfeld 1; Buchungstext; Festschreibung + var dt = ExecuteQuery(sql, date); + + StringBuilder sb = new StringBuilder(); + foreach (DataRow row in dt.Rows) + { + String orgaName = ""; + String itemDescription = ""; + String unitDescription = ""; + String isApproved = ""; + + if (row[8] != null) + orgaName = row[8].ToString(); + + if (row[9] != null) + itemDescription = row[9].ToString(); + + if (row[10] != null) + unitDescription = row[10].ToString(); + + if (row[12] != null) + isApproved = row[12].ToString(); + + if (sb.Length > 0) + sb.AppendLine(); + + DateTime lastDate = new DateTime(date.Year, date.Month, 1); + lastDate = lastDate.AddMonths(1).AddDays(-1); + + //sb.Append(String.Format("{0}", row[1])); //Debitornr. als Kontonummer + sb.Append("999998;"); + sb.Append(String.Format("{0:0.00}", row[15])); //Umsatz - der Rechnungsposition + sb.Append(";"); + //var gegenkto = GetErloeskonto(itemDescription, unitDescription, orgaName, isApproved); + //sb.Append(gegenkto); //Gegenkonto - Auffang/Fehlerkonto 999999 + sb.Append("999999;"); + sb.Append(String.Format("{0:ddMM}", lastDate)); + sb.Append(";"); + //var kostenstelle = GetKostenstelle(itemDescription, unitDescription, orgaName); + //sb.Append(kostenstelle); //Kostenstelle - Auffang/Fehlerkostenstelle 999 + sb.Append("999;"); + sb.Append(String.Format("{0}", row[3])); + sb.Append(";"); + String buchungstext = String.Format("Allgemeine Rechnung - {0}", orgaName); + if (row[6].ToString().Length > 0) + { + int index = 0; + index = row[6].ToString().IndexOf("\r\n"); + if (index == 0) + index = row[6].ToString().IndexOf("BEZAHLT"); + else if (index > 0) + buchungstext = row[6].ToString().Remove(index); + else + buchungstext = row[6].ToString(); + + } + sb.Append(buchungstext); + sb.Append(";"); + } + + return sb.ToString(); + } + public static String GetMonatlicheRechnungLWVString(DateTime date) { /* @@ -350,6 +446,38 @@ namespace PerspektivenEV.Export return sql; } + private static String GetMonatlicheAllgRechnungenSql(DateTime date) + { + String sql = @" + select + 'SUMME' AS 'sip.Claim', + 'nix' AS 'c.DebitorNumber', + ib.InvoiceDate, + ib.invoicenumber, + ib.Oid AS InvoiceOID, + 'nix' AS 'c.CostCenter', + ib.Notice AS 'c2s.Oid', + ib.InvoiceId, + ib.RecipientOrganisation, + ii.ItemDescription, + ii.UnitDescription, + ii.SupportConceptApprovalPeriodOid, + ii.Notice, + ii.AmountPerUnit, + ii.UnitCount, + ii.AmountTotal + from + invoicebase ib + inner join invoiceitem ii on ii.InvoiceBaseOid = ib.Oid + WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' and ib.IsActive = 1 + AND ib.SupportConceptOid IS NULL + ORDER BY invoiceoid, ii.ItemDescription + "; + + return sql; + } + + private static String GetMonatlicheRechnungPositionenLWVSql(DateTime date) { diff --git a/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreation.cs b/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreation.cs index c50c60107..dddb8e5f7 100644 --- a/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreation.cs +++ b/ReportImp/PerspektivenEV/Invoicing/CollectiveInvoiceCreation.cs @@ -84,21 +84,23 @@ namespace PerspektivenEV.Invoicing { if (ap.ServiceCategory.Name.Contains("Tagesstätte")) ap.ServiceCategory.Name = "Tagesstätte"; - - String key = ap.ServiceCategory.Name; - if (!cat2Daten.ContainsKey(key)) + else { - cat2Daten.Add(key, new List()); - } + String key = ap.ServiceCategory.Name; + if (!cat2Daten.ContainsKey(key)) + { + cat2Daten.Add(key, new List()); + } - var daten = new Abrechnungsdaten(); - daten.CategoryName = key; - daten.AbrechnungsStartDate = invoicePeriod.StartDate; - daten.AbrechnungsEndDate = invoicePeriod.EndDate; - daten.CompactSupportConcept = item.Key; - daten.CostBearer2SupportConcept = c2s; - daten.SupportConceptApprovalPeriod = ap; - cat2Daten[key].Add(daten); + var daten = new Abrechnungsdaten(); + daten.CategoryName = key; + daten.AbrechnungsStartDate = invoicePeriod.StartDate; + daten.AbrechnungsEndDate = invoicePeriod.EndDate; + daten.CompactSupportConcept = item.Key; + daten.CostBearer2SupportConcept = c2s; + daten.SupportConceptApprovalPeriod = ap; + cat2Daten[key].Add(daten); + } } } } diff --git a/ReportImp/PerspektivenEV/PerspektivenEV.csproj b/ReportImp/PerspektivenEV/PerspektivenEV.csproj index c8348ae5b..9cbf706f3 100644 --- a/ReportImp/PerspektivenEV/PerspektivenEV.csproj +++ b/ReportImp/PerspektivenEV/PerspektivenEV.csproj @@ -133,6 +133,7 @@ InvoiceCustomerReport.cs Designer + Quittierungsbeleg.cs Designer diff --git a/ReportImp/VaroSozialagentur/Invoicing/CustomInvoiceCreation.cs b/ReportImp/VaroSozialagentur/Invoicing/CustomInvoiceCreation.cs index 5327c31a6..60f728be0 100644 --- a/ReportImp/VaroSozialagentur/Invoicing/CustomInvoiceCreation.cs +++ b/ReportImp/VaroSozialagentur/Invoicing/CustomInvoiceCreation.cs @@ -227,13 +227,19 @@ namespace VaroSozialagentur.Invoicing public override InvoiceItem CreateInvoiceItem(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, Calculations calc) { var invoiceItem = base.CreateInvoiceItem(iServiceRecord, scap, calc); - if (iServiceRecord != null) + if (iServiceRecord.CostBearer.Name.Contains("Hannover")) + { + invoiceItem.UnitCount = 120 * invoiceItem.UnitCount / 100; + invoiceItem.GrossAmountTotal = 120 * invoiceItem.GrossAmountTotal / 100; + } + + if (iServiceRecord != null) { var cat = iServiceRecord.ServiceDescription.CategoryName; var desc = iServiceRecord.ServiceDescription.Name; - if (cat == "Fachleistungsstunde") + if (cat.Contains("Fachleistungsstunde")) { invoiceItem.ItemDescription = desc; invoiceItem.UnitDescription = "Fachleistungsstunde (FLS)";