diff --git a/ReportImp/SBBMainzReports/Export/FibuExporter.cs b/ReportImp/SBBMainzReports/Export/FibuExporter.cs index 00dafc87f..b8d5096f7 100644 --- a/ReportImp/SBBMainzReports/Export/FibuExporter.cs +++ b/ReportImp/SBBMainzReports/Export/FibuExporter.cs @@ -60,7 +60,9 @@ namespace SBBMainzReports.Export sb.Append(String.Format("{0:dd.MM.yyyy}", lastDate)); sb.Append(";"); string konto = row[0].ToString(); - string costcenter = row[6].ToString(); + string costcenter = row[6].ToString().Trim(); + string leistung = row[9].ToString(); + leistung = GetLeistungsart(costcenter, leistung); if (row[9] != null && row[9].ToString().Contains("Handgeld")) { konto = "1361"; @@ -80,7 +82,7 @@ namespace SBBMainzReports.Export sb.Append(";"); sb.Append(String.Format("{0:0.00}", row[2])); // Rechnungsbetrag sb.Append(";"); - sb.Append(String.Format("{0}", row[9])); // Leistung(sart) + sb.Append(String.Format("{0}", leistung)); // Leistung(sart) sb.Append(";"); sb.Append(String.Format("{0}", row[7])); // Kostenträger Name sb.Append(";"); @@ -89,6 +91,23 @@ namespace SBBMainzReports.Export return sb.ToString(); } + private static string GetLeistungsart(string costcenter, string leistung) + { + if (costcenter == "210") + { + return leistung = "Eingliederungshilfe nach SGB IX"; + } + if (costcenter == "220") + { + return leistung = "Qualifizierte Assistenz"; + } + if (costcenter == "300") + { + return leistung; // SPFH + } + return leistung; + } + private static List CreateInvoiceFiles(DataTable dt) { try @@ -142,7 +161,7 @@ namespace SBBMainzReports.Export ib.invoicenumber, ib.InvoiceDate, c.DebitorNumber, - c.CostCenter, + c2s.KostenstelleHilfeplan, org.Name, CONCAT(p.`FirstName`, ' ',p.`LastName`) as 'Verwendung', ii.ItemDescription, @@ -180,7 +199,26 @@ namespace SBBMainzReports.Export WHERE ib.IsActive = 1 and ib.IsExported = 0 AND (((ib.InvoiceTypeText != 'Storno' OR ib.InvoiceTypeText IS NULL) AND ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End') OR (ib.InvoiceTypeText = 'Storno' AND ib.`InvoiceDate` >= ':Monat_Start' AND ib.`InvoiceDate` < ':Monat_End')) - order by ib.invoicenumber + UNION + select + '8000' as 'Gegenkonto', + Round(ii.AmountTotal, 2) AS 'Betrag', + (select SUM(Round(ii2.AmountTotal, 2)) from invoiceitem ii2 where ii2.invoicebaseoid = ib.Oid) as 'Gesamtbetrag', + ib.invoicenumber, + ib.InvoiceDate, + '10000' as 'DebitorNumber', + '210' as 'Kostenstelle', + ib.RecipientOrganisation as 'Name', + 'Manuelle Rechnung' as 'Verwendung', + ii.ItemDescription, + ib.Oid + from invoicebase ib + inner join invoiceitem ii on ii.invoicebaseoid = ib.Oid + WHERE ib.IsActive = 1 and ib.IsExported = 0 + and ib.Type = 2 + and ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' + + order by invoicenumber "; return sql;