Purchase TTM

I want to pull the Purchase(LCY) amount from the Vendor Ledger Entry table, by posting date (month-year), and total the amount for the year, by vendor ID

Answers

  • aredmond@thompsonpump.com[email protected] Member Posts: 16
    TTMTotal := Purchase(LCY) + TTMTotal
    TTMTotal is by vendor ID, not total for all vendors
    I have over 2600 Vendors
  • DuikmeesterDuikmeester Hoorn, The NetherlandsMember Posts: 304
    edited 2019-02-28
    Something along the lines of:
    Vendor.SETRANGE("Date Filter",theFromDate,theToDate);
    Vendor.SETFILTER("Purchases (LCY)",'>0');
    
    IF Vendor.FINDSET THEN
      REPEAT
        TTMTotal += Vendor."Purchases (LCY)";
      UNTIL Vendor.NEXT = 0;
    

    Or to get the total directly:
    VendorLedgerEntry.SETRANGE("Posting Date",theFromDate,theToDate);
    VendorLedgerEntry.CALCSUMS("Purchase (LCY)");
    TTMTotal := VendorLedgerEntry."Purchase (LCY)" * -1;
    
  • aredmond@thompsonpump.com[email protected] Member Posts: 16
    Thank you; This will work
Sign In or Register to comment.