Automatic Expiration Calculation

If we want to use the automatic Expiration Date calculation, then on Item Tracking Code Card, don’t tick the Man. Expir. Date Entry Reqd. If you tick this, then NAV will force you to fill the Expiration Date manually on Item Tracking Lines.

Then, on Item card, on Expiration Calculation, fill it with date formula, like 1Y stands for 1 year.

Next, the question is what is the date used to calculate the Expiration Date?

For Purchase Order, the date used is the Document Date. Why Document Date? Don’t know.

Fortunately, if using Warehouse Receipt and Inventory Put-away, there is no Document Date, and the Document Date on the Purchase Order is defaulted to be the same as Posting Date. So when it is posted with Posting Date of 30 April 2018, then the Document Date will also be the same.

So, if we are using Warehouse Receipt or Inventory Put-away, this will not become a problem. But, if we use Purchase Order, then the problem may rise, if after change the Posting Date, the user override the Document Date.

The source code is here:

LOCAL SetupSplitJnlLine(VAR ItemJnlLine2 : Record "Item Journal Line";TrackingSpecExists : Boolean) : Boolean
...
 IF FORMAT(Item."Expiration Calculation") <> '' THEN
 CalcExpirationDate := CALCDATE(Item."Expiration Calculation",ItemJnlLine2."Document Date");
...
LOCAL PostItemJnlLine(PurchHeader : Record "Purchase Header";PurchLine : Record "Purchase Line";QtyToBeReceived : Decimal;QtyToBeReceivedBase : Decimal;QtyToBeInvoiced : Decimal;QtyToBeInvoicedBase : Decimal;ItemLedgShptEntryNo : Integer;ItemChargeNo 
...
WITH ItemJnlLine DO BEGIN
 INIT;
 CopyFromPurchHeader(PurchHeader);
...
[External] CopyFromPurchHeader(PurchHeader : Record "Purchase Header")
"Posting Date" := PurchHeader."Posting Date";
"Document Date" := PurchHeader."Document Date";
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s