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

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Zero Purchase Prices

(0) ShareShare
ReportReport
Posted on by 132

We want to specify some Purchase Prices so that for some of the Vendors POs are entered with Direct Unit Cost of zero.

However there is a piece of code in Codeunit 7010 "Purch. Price Calc. Mgt." that deliberately ignores Purchase Price records with zero Direct Unit Cost.

What is the logic behind it?

If we modify the Codeunit so that the records with zero Direct Unit Cost are included - will there be any negative consequences?

*This post is locked for comments

I have the same question (0)
  • Hannes Holst Profile Picture
    5,767 on at
    RE: Zero Purchase Prices

    Which piece of Code do you mean?

  • BorisK Profile Picture
    132 on at
    RE: Zero Purchase Prices

    LOCAL FindPurchPrice(VAR ToPurchPrice : Record "Purchase Price";VendorNo : Code[20];ItemNo : Code[20];VariantCode : Code[10];UOM : Code[10];CurrencyCode : Code[10];StartingDate : Date;ShowAll : Boolean)

    WITH FromPurchPrice DO BEGIN

     SETRANGE("Item No.",ItemNo);

     SETRANGE("Purchase Type", "Purchase Type"::Vendor);

     SETRANGE("Purchase Code",VendorNo);

     SETFILTER("Ending Date",'%1|>=%2',0D,StartingDate);

     SETFILTER("Variant Code",'%1|%2',VariantCode,'');

     IF NOT ShowAll THEN BEGIN

       SETRANGE("Starting Date",0D,StartingDate);

       SETFILTER("Currency Code",'%1|%2',CurrencyCode,'');

       SETFILTER("Unit of Measure Code",'%1|%2',UOM,'');

     END;

     ToPurchPrice.RESET;

     ToPurchPrice.DELETEALL;

     IF FIND('-') THEN

       REPEAT

         IF "Direct Unit Cost" <> 0 THEN BEGIN                //this code

           ToPurchPrice := FromPurchPrice;

           ToPurchPrice.INSERT;

         END;

       UNTIL NEXT = 0;

     SETRANGE("Purchase Type", "Purchase Type"::"Vendor Price Group");

     SETRANGE("Purchase Code", Vend."Vendor Price Group Code");

     IF FromPurchPrice.FIND('-') THEN BEGIN

       REPEAT

         IF FromPurchPrice."Direct Unit Cost" <> 0 THEN BEGIN      //this code

           ToPurchPrice := FromPurchPrice;

           ToPurchPrice.INSERT;

         END;

       UNTIL FromPurchPrice.NEXT = 0;

     END;

    END;

  • Verified answer
    BorisK Profile Picture
    132 on at
    RE: Zero Purchase Prices

    Just found myself that if the line

    IF "Direct Unit Cost" <> 0 THEN BEGIN               

    is removed then it will not work anyway - further down the line in CalcBestDirectUnitCost() the code assumes that if the "Direct Unit Cost" = 0 in the resulting BestPurchPrice then no suitable Purchase Prices exist, and Unit Cost from Item Card (or SKU) is applied.

    So I guess this is the answer.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans