web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

(Outstanding) Amount of purchase lines and Cash Flow

(0) ShareShare
ReportReport
Posted on by 220

Hey everyone!

We have observed a very strange behaviour with the amount and the outstanding amount of purchase lines. Sadly, this behaviour renders the cash flow planning module useless.

Every time, we reopen a purchase order, NAV resets the outstanding amount to 0 (Code Unit 415, function Reopen()). This wouldn't be a problem on its own, but our version of NAV won't recalculate the amount when we release the order again. Now this has consequences for the cash flow forecast since it only selects the purchase lines with an outstanding amount > 0.

We are using Dynamics NAV 2013 R2 7.1.36310.0.

Is this a bug or do I muss a hidden feature here? Thanks in advance!

Cheers,
Patrik

*This post is locked for comments

I have the same question (0)
  • mmv Profile Picture
    11,471 on at

    Hi,

    Resetting the "Outstanding Amount" is the standard functionality and it recalculates it once it's released.  It works in Standard Nav.

    Best Regards,

    MMV

  • Patrik Nordsiek Profile Picture
    220 on at

    Hey MMV,

    I tried it again with my NAV installation and it won't recalculate it. Although my installation is modified, I can not find any trace, that this was changed by our partners. Do you have an idea, where (CodeUnit, Table etc) NAV recalculates the value?

    Cheers,

    Patrik

  • mmv Profile Picture
    11,471 on at

    Hi,

    It goes through CodeUnit -> Release Purchase Document ->  (Function) -> PurchLine.UpdateVATOnLines(1,Rec,PurchLine,TempVATAmountLine1);

    From the above function, it calls ->           InitOutstanding;

    So, you may either check  either InitOutstanding (In the Purchase Line table) or PurchLine.UpdateVATOnLines(1,Rec,PurchLine,TempVATAmountLine1);

    Best Regards,

    MMV

  • Patrik Nordsiek Profile Picture
    220 on at

    Hey MMV!

    Thanks again. I can trace the code and I think, my problem lies in line 18 of the function PurchLine.UpdateVATOnLines(). It checks the following:

    IF VATAmountLine.Modified THEN BEGIN

    But if I don't modify the line or the amount line, initOutstanding will not be called, if I see that correctly.

    Another thing I noticed is, that the amount itself is 0, so the outstanding-calculation is right and wrong at the same time ;).

    Cheers,
    Patrik

  • mmv Profile Picture
    11,471 on at

    Hi,

    Which Amount is 0 (zero)?  From InitOutstanding, it will InitOutstandingAmount which will update the "Outstanding Amount".

    Best Regards,

    MMV

  • Patrik Nordsiek Profile Picture
    220 on at

    Hi,

    the line amount changes to zero. Field No 29.

    Cheers,

    Patrik

  • mmv Profile Picture
    11,471 on at

    Hi,

    Oh!! so the O/S amount is calculated to 0.  It seems to be a customization.  Please check.

    Best Regards,

    MMV

  • Patrik Nordsiek Profile Picture
    220 on at

    Hi there,

    let me thank you for all the help first :).

    I checked the CodeUnits. At first glance, the standard sets the amount to zero in CodeUnit 415 in function ReOpen(), line 14. (ZeroAmountInLines).

    Releasing the document will trigger CodeUnit 415's OnRun() function, which updates VATOnLines, but there seems to be no appearance of a calcuation of the amount. Our partner only customizes with a comment to signal the modification. There is none. Here is the code of my CU415:

    IF Status = Status::Released THEN
      EXIT;
    
    TESTFIELD("Buy-from Vendor No.");
    
    // S/ihd700.000.000
    ...
    // E/ihd700.000.000
    
    PurchLine.SETRANGE("Document Type","Document Type");
    PurchLine.SETRANGE("Document No.","No.");
    PurchLine.SETFILTER(Type,'>0');
    PurchLine.SETFILTER(Quantity,'<>0');
    IF NOT PurchLine.FIND('-') THEN
      ERROR(Text001,"Document Type","No.");
    InvtSetup.GET;
    IF InvtSetup."Location Mandatory" THEN BEGIN
      PurchLine.SETRANGE(Type,PurchLine.Type::Item);
      IF PurchLine.FIND('-') THEN
        REPEAT
          IF NOT PurchLine.IsServiceItem THEN
            PurchLine.TESTFIELD("Location Code");
        UNTIL PurchLine.NEXT = 0;
      PurchLine.SETFILTER(Type,'>0');
    END;
    PurchLine.SETRANGE("Drop Shipment",FALSE);
    NotOnlyDropShipment := PurchLine.FIND('-');
    PurchLine.RESET;
    
    // S/ihd700.000.000
    ...
    // E/ihd700.000.000
    
    PurchSetup.GET;
    IF PurchSetup."Calc. Inv. Discount" THEN BEGIN
      PostingDate := "Posting Date";
      PrintPostedDocuments := "Print Posted Documents";
      CODEUNIT.RUN(CODEUNIT::"Purch.-Calc.Discount",PurchLine);
      GET("Document Type","No.");
      "Print Posted Documents" := PrintPostedDocuments;
      IF PostingDate <> "Posting Date" THEN
        VALIDATE("Posting Date",PostingDate);
    END;
    
    IF TestPrepayment(Rec) AND ("Document Type" = "Document Type"::Order) THEN BEGIN
      Status := Status::"Pending Prepayment";
      MODIFY(TRUE);
      EXIT;
    END
      ;
    Status := Status::Released;
    
    PurchLine.SetPurchHeader(Rec);
    PurchLine.CalcVATAmountLines(0,Rec,PurchLine,TempVATAmountLine0);
    PurchLine.CalcVATAmountLines(1,Rec,PurchLine,TempVATAmountLine1);
    PurchLine.UpdateVATOnLines(0,Rec,PurchLine,TempVATAmountLine0);
    PurchLine.UpdateVATOnLines(1,Rec,PurchLine,TempVATAmountLine1);
    
    // S/ihd000.700.000
    ...
    // E/ihd000.700.000
    MODIFY(TRUE);
    
    IF NotOnlyDropShipment THEN
      IF "Document Type" IN ["Document Type"::Order,"Document Type"::"Return Order"] THEN
        WhsePurchRelease.Release(Rec);
    
    // S/uBas7.15
    ...
    // E/uBas7.15
    // S/ihd700.000.000
    ...
    // E/ihd700.000.000


    Cheers,
    Evan

  • mmv Profile Picture
    11,471 on at

    Hi,

    Did you check whether there is any customization in the Purchase Line table? (basically the coding)

    Best Regards,

    MMV

  • Patrik Nordsiek Profile Picture
    220 on at

    Hi,

    there is a lot of customization, but nothing on the amount field and as far as I can tell, there is no customization, which influences the amount handling. Additionally, our partner has told us, that they could recreate the problem with standard NAV =/.

    Cheers,

    Patrik

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans