CustLedgEntry.SETRANGE("Customer No.", "Sales Invoice Header"."Sell-to Customer No."); CustLedgEntry.SETRANGE("Document No.", "Sales Invoice Header"."No."); IF CustLedgEntry.FIND('+') THEN BEGIN LastEntryNo := CustLedgEntry."Entry No."; CustLedgEntry.RESET; CustLedgEntry.SETRANGE("Customer No.", "Sales Invoice Header"."Sell-to Customer No."); CustLedgEntry.SETFILTER("Document No.", '<> %1', "Sales Invoice Header"."No."); CustLedgEntry.SETFILTER("Entry No.", '< %1', LastEntryNo); IF CustLedgEntry.FIND('+') THEN PrevEntryNo := CustLedgEntry."Entry No."; END; CustLedgEntry.RESET; CustLedgEntry.SETRANGE("Customer No.", "Sales Invoice Header"."Sell-to Customer No."); IF CustLedgEntry.GET(LastEntryNo) THEN REPEAT CustLedgEntry.CALCFIELDS(Amount); NewBalanceAmount := NewBalanceAmount + CustLedgEntry.Amount; UNTIL CustLedgEntry.NEXT(-1) = 0; IF CustLedgEntry.GET(PrevEntryNo) THEN REPEAT CustLedgEntry.CALCFIELDS(Amount); OldBalanceAmount := OldBalanceAmount + CustLedgEntry.Amount; UNTIL CustLedgEntry.NEXT(-1) = 0;
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Entry Type=FILTER(Initial Entry|Unrealized Loss|Unrealized Gain|Realized Loss|Realized Gain|Payment Discount|'Payment Discount (VAT Excl.)'|'Payment Discount (VAT Adjustment)'|Payment Tolerance|Payment Discount Tolerance|'Payment Tolerance (VAT Excl.)'|'Payment Tolerance (VAT Adjustment)'|'Payment Discount Tolerance (VAT Excl.)'|'Payment Discount Tolerance (VAT Adjustment)'),
Customer No.=FIELD(Customer No.),
Posting Date=FIELD(Date Filter)
But the result I get is the same on all Customer Ledger Entries, and is probably equal to the SUM of Amount. What I want is a FlowField that displays the SUM of Amount up to the Date of the current Ledger Entry or, more correctly, up to the current Cust. Ledger Entry... :x
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
It took me a while but it works, and now I understand FlowFields and FlowFilters better!
Merry Christmas