Options

FlowField sum question

siimsandsiimsand Member Posts: 28
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.

Answers

  • Options
    Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Is your check supposed to include posted invoices amount?
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • Options
    siimsandsiimsand Member Posts: 28
    Is your check supposed to include posted invoices amount?

    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.
  • Options
    geronimogeronimo Member Posts: 90
    it would be better as far as the posted purchase invoices go to have a look at the ledger entries as the documents can be removed when printed.
Sign In or Register to comment.