diff --git a/ReportImp/BellaDonna/Export/SimbaExporter.cs b/ReportImp/BellaDonna/Export/SimbaExporter.cs index 1c7a514b0..1ba740e85 100644 --- a/ReportImp/BellaDonna/Export/SimbaExporter.cs +++ b/ReportImp/BellaDonna/Export/SimbaExporter.cs @@ -337,6 +337,7 @@ namespace BellaDonna.Export private static String GetMonatlicheRechnungenSql(DateTime date) { + //normale Einzelrechnungen u AllgRechnungen String sql = @" select 'BCH', @@ -361,7 +362,23 @@ namespace BellaDonna.Export inner join serviceinvoice si on si.invoicebaseoid = ib.oid inner join serviceinvoiceperiod sip on sip.serviceinvoiceoid = si.oid WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' and ib.IsActive = 1 - order by ib.invoicenumber + UNION + SELECT DISTINCT + 'BCH', + (select sum(ii.AmountTotal) from invoiceitem ii where ii.invoicebaseoid = ib.oid), + '8030' as 'Gegenkonto', + ib.invoicenumber, + ib.InvoiceDate, + org.DebitorNumber, + '32', + ib.RecipientOrganisation, + '', + '', + ib.Oid + from invoicebase ib + inner join organisation org on org.costbeareroid = ib.RecipientOrganisationOid + WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' and ib.IsActive = 1 + and ib.Type = 2 "; return sql;