mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Merge pull request #103 from exciler/subscriptioncycle-zahlzyklus
Enable "Zahlzyklus" in "Abolauf"
This commit is contained in:
commit
33aa53b7c5
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user