Billing: Handle negative credit amount in following credits
Some checks failed
Test / Run tests (push) Has been cancelled
Some checks failed
Test / Run tests (push) Has been cancelled
This commit is contained in:
@ -46,14 +46,14 @@ namespace Elwig.Helpers.Billing {
|
||||
m.mgnr,
|
||||
v.avnr,
|
||||
ROUND(p.amount / POW(10, s.precision - 2)) AS net_amount,
|
||||
ROUND(lp.amount / POW(10, s.precision - 2)) AS prev_amount,
|
||||
IIF(lc.amount >= 0, ROUND(lp.amount / POW(10, s.precision - 2)), 0) AS prev_net_amount,
|
||||
IIF(m.buchführend, s.vat_normal, s.vat_flatrate) AS vat,
|
||||
ROUND(IIF({Data.ConsiderTotalPenalty}, COALESCE(b.total_penalty, 0), 0) / POW(10, s.precision - 2)) +
|
||||
ROUND(IIF({Data.ConsiderContractPenalties}, COALESCE(u.total_penalty, 0), 0) / POW(10, 4 - 2)) +
|
||||
ROUND(IIF({Data.ConsiderAutoBusinessShares}, -COALESCE(a.total_amount, 0), 0) / POW(10, s.precision - 2)) +
|
||||
IIF({Data.ConsiderCustomModifiers}, COALESCE(x.amount, 0), 0)
|
||||
AS modifiers,
|
||||
lc.modifiers AS prev_modifiers
|
||||
IIF(lc.amount >= 0, lc.modifiers, 0) AS prev_modifiers
|
||||
FROM season s
|
||||
JOIN payment_variant v ON v.year = s.year
|
||||
LEFT JOIN payment_variant l ON l.year = s.year
|
||||
|
Reference in New Issue
Block a user