Merge pull request #103 from exciler/subscriptioncycle-zahlzyklus

Enable "Zahlzyklus" in "Abolauf"
This commit is contained in:
OpenXE-ERP 2023-12-10 10:22:24 +01:00 committed by GitHub
commit 33aa53b7c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -31,14 +31,14 @@ class SubscriptionModule implements SubscriptionModuleInterface
aa.id,
@start := GREATEST(aa.startdatum, aa.abgerechnetbis) as start,
@end := IF(aa.enddatum = '0000-00-00' OR aa.enddatum > :calcdate, :calcdate, aa.enddatum) as end,
@cycles := CASE
@cycles := GREATEST(aa.zahlzyklus, CASE
WHEN aa.preisart = 'monat' THEN
TIMESTAMPDIFF(MONTH, @start, @end)
WHEN aa.preisart = 'jahr' THEN
TIMESTAMPDIFF(YEAR, @start, @end)
WHEN aa.preisart = '30tage' THEN
FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30)
END+1 as cycles,
END+1) as cycles,
CASE
WHEN aa.preisart = 'monat' THEN
DATE_ADD(@start, INTERVAL @cycles MONTH)

View File

@ -94,7 +94,7 @@ class Rechnungslauf {
DATE_ADD(@start, INTERVAL (FLOOR(TIMESTAMPDIFF(DAY, @start, IF(aa.enddatum = '0000-00-00' OR aa.enddatum > '$scalcdate', '$scalcdate', aa.enddatum)) / 30)+1)*30 DAY )
END, '%d.%m.%Y') SEPARATOR '<br>') as end,
SUM((100-aa.rabatt)/100 * aa.preis * aa.menge *
(CASE
(GREATEST(aa.zahlzyklus, CASE
WHEN aa.preisart = 'monat' THEN
TIMESTAMPDIFF(MONTH, @start, @end)
WHEN aa.preisart = 'jahr' THEN
@ -102,7 +102,7 @@ class Rechnungslauf {
WHEN aa.preisart = '30tage' THEN
FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30)
END
)
))
) as amount,
adr.id
FROM abrechnungsartikel aa