HshCologne/Export/FibuExporter.cs
SupportOID=165133
This commit is contained in:
@@ -91,25 +91,38 @@ namespace HshCologne.Export
|
||||
{
|
||||
|
||||
String sql = @"
|
||||
select
|
||||
SELECT * FROM
|
||||
(SELECT
|
||||
SUM(sip.Claim),
|
||||
org.DebitorNumber,
|
||||
ib.InvoiceDate,
|
||||
ib.invoicenumber,
|
||||
SUBSTRING_INDEX(org.Name2, ';', 1) AS JA,
|
||||
SUBSTRING_INDEX(org.Name2, ';', -1) AS BTxt,
|
||||
ib.Oid
|
||||
SUBSTRING_INDEX(org.Name2, ';', 1) AS JA,
|
||||
SUBSTRING_INDEX(org.Name2, ';', -1) AS BTxt,
|
||||
ib.Oid
|
||||
FROM
|
||||
invoicebase ib
|
||||
inner join serviceinvoice si on si.invoicebaseoid = ib.oid
|
||||
inner join serviceinvoiceperiod sip on sip.serviceinvoiceoid = si.oid
|
||||
inner join costbearer cb on ib.recipientcostbeareroid = cb.oid
|
||||
inner join organisation org on org.costbeareroid = cb.oid
|
||||
WHERE ib.InvoiceDate >= ':Monat_Start' AND ib.InvoiceDate < ':Monat_End' and ib.IsActive = 1 AND ib.`IsExported` = 0
|
||||
GROUP BY ib.Oid
|
||||
order by ib.invoicenumber
|
||||
";
|
||||
|
||||
invoicebase ib
|
||||
inner join serviceinvoice si on si.invoicebaseoid = ib.oid
|
||||
inner join serviceinvoiceperiod sip on sip.serviceinvoiceoid = si.oid
|
||||
inner join costbearer cb on ib.recipientcostbeareroid = cb.oid
|
||||
inner join organisation org on org.costbeareroid = cb.oid
|
||||
WHERE ib.InvoiceDate >= ':Monat_Start' AND ib.InvoiceDate < ':Monat_End' and ib.IsActive = 1 AND ib.`IsExported` = 0
|
||||
GROUP BY ib.Oid
|
||||
UNION
|
||||
SELECT
|
||||
sum(ii.AmountTotal),
|
||||
org.DebitorNumber,
|
||||
ib.InvoiceDate,
|
||||
ib.invoicenumber,
|
||||
SUBSTRING_INDEX(org.Name2, ';', 1) AS JA,
|
||||
SUBSTRING_INDEX(org.Name2, ';', -1) AS BTxt,
|
||||
ib.Oid
|
||||
FROM invoicebase ib
|
||||
INNER JOIN organisation org ON org.costbeareroid = ib.RecipientOrganisationOid
|
||||
INNER JOIN invoiceitem ii ON ii.invoicebaseoid = ib.Oid
|
||||
WHERE ib.InvoiceDate >= ':Monat_Start' AND ib.InvoiceDate < ':Monat_End' AND ib.IsActive = 1 AND ib.`IsExported` = 0 and ib.Type = 2) qry
|
||||
ORDER BY qry.invoicenumber
|
||||
";
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user