Hello,
I have this sum check in code, which is executed when the button "Release" is pressed in Purchase Orders.
IF VendorPurchaseContract.Amount <> 0.0 THEN BEGIN
PurchaseHeader.CALCFIELDS(Amount);
IF PurchaseHeader.Amount > VendorPurchaseContract.Amount THEN
PurchaseHeader.FIELDERROR(Amount,Text006);
END;
In this check I also want to include a check where
'IF VendorPurchaseContract.Amount > (Amount in PurchaseHeader + the sum of amounts in already released purchases with the same Buy-from Vendor No. + the sum of amounts in already posted purchase invoices with the same Buy-from Vendor No.) THEN
FIELDERROR(Amount,<Text>)'
The Amount fields in these tables are FlowFields, but still kind of confuse me if it would be better to filter and sum them up with repeat-until and store them into variables or use CALCFIELDS. Any ideas/code examples?
Thanks in advance.
0
Answers
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Yes, the sum of the amounts with the same Vendor No. in the Posted Purchase Invoices (in classic client) in the IF-sentence's condition.