<@U5L945PD5> I did this a while back, and it did v...
# suitescript
a
@eminero I did this a while back, and it did verify back to the Aging buckets on the customer record. But I cannot remember if the test data included CMs (its been a while since i did this last). Case When {daysoverdue} <31 then {fxamountremaining} else 0 end Case When {daysoverdue} > 30 and {daysoverdue} < 61 then {fxamountremaining} else 0 end Case When {daysoverdue} > 60 and {daysoverdue} < 91 then {fxamountremaining} else 0 end Case When {daysoverdue} > 90 then {fxamountremaining} else 0 end
e
Hey @Anthony (NimbusLabs) thanks! I have something similar with amount and remainingamount, I see you are using the foreign currency there, I will try to play with that.
m
For credit memos, the amount remaining will be a credit, but it's not as simple as checking transaction type either. - for journals, it could be either. Best way I've found is checking if original amount is credit/debit (
* CASE WHEN {amount} > 0 THEN 1 ELSE -1 END
)
e
Thanks @michoel I agree is not as simple. This is a very complex calculation using formulas.
a
CM don't have a "Due Date", so natively always appear in the CURRENT bucket. I guess, the logic could be something like CASE WHEN {account.type} = 'Income' AND {type} != 'Invoice' THEN {amount} WHEN {type} = 'Invoice' AND {daysoverdue} <31 THEN {fxamountremaining} END But not sure that posting journals to the AR and AP is wise - they don't have a status value, so annoyingly stubborn when trying to view only OPEN transactions. Yeah {fxamount}, because then its in the customer currency, not converted to Base currency. ta
e
Thanks @michoel and @Anthony Emberson both provided me good points to get a better understanding on the formulas/calculations. Sharing below how I get the 1-30 age period 🙂 the others are the same just the period changes.
CASE WHEN ({recordtype} <> 'invoice' AND {recordtype} <> 'customerpayment' AND {recordtype} <> 'creditmemo' AND TRUNC({today})-{trandate} BETWEEN 1 AND 30) THEN {amount} WHEN ({recordtype} = 'creditmemo' AND {duedate} IS NULL AND TRUNC({today})-{trandate} BETWEEN 1 AND 30) THEN -({amountremaining}) WHEN ({recordtype} = 'invoice' AND {duedate} IS NOT NULL AND TRUNC({today})-{duedate} BETWEEN 1 AND 30) THEN {amountremaining} WHEN ({recordtype} = 'invoice' AND {duedate} IS NULL AND TRUNC({today})-{trandate}BETWEEN 1 AND 30) THEN {amountremaining} WHEN ({recordtype} = 'customerpayment' AND {duedate} IS NULL AND TRUNC({today})-{trandate} BETWEEN 1 AND 30) THEN -({amountremaining}) END
a
@eminero nice, pleased to help in some small way 🙂