Hotfix til fakturering af købsordre i NAV 5.0

DKK 100,00
Fejlmeddelelse, når du fakturerer en købsordre i Microsoft Dynamics NAV 5.0: "Den mængde, der skal faktureres, stemmer ikke overens med den mængde, der er angivet i varesporing." Læs mere her og nederst kan guldmedlemmer downloade hotfix.
 
Error message when you invoice a purchase order in Microsoft Dynamics NAV 5.0: "The quantity to invoice does not match the quantity defined in item tracking"
 
SYMPTOMS
 
Consider the following scenario in Microsoft Dynamics NAV 5.0. You create a purchase order. In a purchase order line, you use the item tracking for an item and you assign a job number in the purchase order line. Then, you post a receipt for the purchase order. Next, you invoice the purchase order. In this scenario, you receive the following error message:
The quantity to invoice does not match the quantity defined in item tracking.
Additionally, the values in the following fields are unexpectedly negative:
• The Quantity (Base) field 
• The Quantity to Invoice field 
• The Quantity Handled (Base) field
RESOLUTION

Hotfix information
A supported hotfix is now available from Microsoft. However, it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Dynamics NAV 5.0 service pack or the next Microsoft Dynamics NAV version that contains this hotfix.

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

 

Til toppen af siden

Installation og download

 

Installation information
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Note Before you install this hotfix, verify that all Microsoft Navision client users are logged off the system. This includes Microsoft Navision Application Services (NAS) client users. You should be the only client user who is logged on when you implement this hotfix.

To implement this hotfix, you must have a developer license.

We recommend that the user account in the Windows Logins window or in the Database Logins window be assigned the "SUPER" role ID. If the user account cannot be assigned the "SUPER" role ID, you must verify that the user account has the following permissions:
• The Modify permission for the object that you will be changing.
• The Execute permission for the System Object ID 5210 object and for the System Object ID 9015 object.

Note You do not have to have rights to the data stores unless you have to perform data repair.

Code changes
 
Note Always test code fixes in a controlled environment before you apply the fixes to your production computers.
To apply this hotfix, change the code in the PostItemJnlLine function in the Purch.-Post codeunit (90) as follows.
 
Existing code

...
  ItemJnlPostLine.RunWithCheck(ItemJnlLine,TempJnlLineDim);

  IF ("Job No." <> '') THEN BEGIN
          ItemJnlLine2."Entry Type" := ItemJnlLine2."Entry Type"::"Negative Adjmt.";
          Job.GET("Job No.");
          ItemJnlLine2."Source No." := Job."Bill-to Customer No.";
          ItemJnlLine2."Source Type" := ItemJnlLine2."Source Type"::Customer;
          ItemJnlLine2."Discount Amount" := 0;
          IF (QtyToBeReceived <> 0) THEN BEGIN
            // item tracking for consumption
            ReservationEntry2.RESET;
            IF ReservationEntry3.FIND('-') THEN BEGIN
              IF ReservationEntry2.FIND('+') THEN
                NextReservationEntryNo := ReservationEntry2."Entry No." + 1
              ELSE
                NextReservationEntryNo := 1;
              REPEAT
                ReservationEntry2 := ReservationEntry3;
                ReservationEntry2."Entry No." := NextReservationEntryNo;
                IF ReservationEntry2.Positive THEN
                  ReservationEntry2.Positive := FALSE
                ELSE
                  ReservationEntry2.Positive := TRUE;
                ReservationEntry2."Quantity (Base)" := ReservationEntry2."Quantity (Base)" * -1;
                ReservationEntry2."Shipment Date" := ReservationEntry2."Expected Receipt Date";
                ReservationEntry2."Expected Receipt Date" := 0D;
                ReservationEntry2.Quantity := ReservationEntry2.Quantity * -1;
                ReservationEntry2."Qty. to Handle (Base)" := ReservationEntry2."Qty. to Handle Base)" * -1;
                ReservationEntry2."Qty. to Invoice (Base)" := ReservationEntry2."Qty. to Invoice (Base)" * -1;
                ReservationEntry2.INSERT;
                NextReservationEntryNo := NextReservationEntryNo + 1;
              UNTIL ReservationEntry3.NEXT = 0;
              IF (QtyToBeReceivedBase <> 0) THEN
                IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN
                  ReservePurchLine.TransferPurchLineToItemJnlLine(PurchLine,ItemJnlLine2,QtyToBeReceivedBase,CheckApplToItemEntry)
                ELSE
                  ReservePurchLine.TransferPurchLineToItemJnlLine(PurchLine,ItemJnlLine2,-QtyToBeReceivedBase,CheckApplToItemEntry);
            END;
            JobPostLine.GetStartItemLedgEntryNo;
            ItemJnlPostLine.RunWithCheck(ItemJnlLine2,TempJnlLineDim);
            JobPostLine.InsertPurchLine(PurchHeader,PurchInvHeader,PurchCrMemoHeader,PurchRcptHeader,PurchLine,SrcCode,TempJnlLineDim);
          END;
          IF (QtyToBeInvoiced <> 0) AND (QtyToBeReceived = 0) THEN BEGIN
            JobPostLine.GetNextItemLedgEntryNo(ItemJnlLine2);
            ItemJnlPostLine.RunWithCheck(ItemJnlLine2,TempJnlLineDim);
          END;
        END;

          IF ItemJnlPostLine.CollectTrackingSpecification(TempHandlingSpecification) THEN BEGIN
          IF ItemJnlLine.Subcontracting THEN
            TempHandlingSpecification.DELETEALL;
          IF TempHandlingSpecification.FIND('-') THEN
            REPEAT
              TempTrackingSpecification := TempHandlingSpecification;
              TempTrackingSpecification."Source Type" := DATABASE::"Purchase Line";
              TempTrackingSpecification."Source Subtype" := "Document Type";
              TempTrackingSpecification."Source ID" := "Document No.";
              TempTrackingSpecification."Source Batch Name" := '';
              TempTrackingSpecification."Source Prod. Order Line" := 0;
              TempTrackingSpecification."Source Ref. No." := "Line No.";
              IF TempTrackingSpecification.INSERT THEN;
              IF QtyToBeInvoiced <> 0 THEN BEGIN
                TempTrackingSpecificationInv := TempTrackingSpecification;
                IF TempTrackingSpecificationInv.INSERT THEN;
              END;
            UNTIL TempHandlingSpecification.NEXT = 0;
        END;

  IF PostWhseJnlLine THEN BEGIN
...

Replacement code
...
  ItemJnlPostLine.RunWithCheck(ItemJnlLine,TempJnlLineDim);

          IF ItemJnlPostLine.CollectTrackingSpecification(TempHandlingSpecification) THEN BEGIN
          IF ItemJnlLine.Subcontracting THEN
            TempHandlingSpecification.DELETEALL;
          IF TempHandlingSpecification.FIND('-') THEN
            REPEAT
              TempTrackingSpecification := TempHandlingSpecification;
              TempTrackingSpecification."Source Type" := DATABASE::"Purchase Line";
              TempTrackingSpecification."Source Subtype" := "Document Type";
              TempTrackingSpecification."Source ID" := "Document No.";
              TempTrackingSpecification."Source Batch Name" := '';
              TempTrackingSpecification."Source Prod. Order Line" := 0;
              TempTrackingSpecification."Source Ref. No." := "Line No.";
              IF TempTrackingSpecification.INSERT THEN;
              IF QtyToBeInvoiced <> 0 THEN BEGIN
                TempTrackingSpecificationInv := TempTrackingSpecification;
                IF TempTrackingSpecificationInv.INSERT THEN;
              END;
            UNTIL TempHandlingSpecification.NEXT = 0;
        END;

IF ("Job No." <> '') THEN BEGIN
          ItemJnlLine2."Entry Type" := ItemJnlLine2."Entry Type"::"Negative Adjmt.";
          Job.GET("Job No.");
          ItemJnlLine2."Source No." := Job."Bill-to Customer No.";
          ItemJnlLine2."Source Type" := ItemJnlLine2."Source Type"::Customer;
          ItemJnlLine2."Discount Amount" := 0;
          IF (QtyToBeReceived <> 0) THEN BEGIN
            // item tracking for consumption
            ReservationEntry2.RESET;
            IF ReservationEntry3.FIND('-') THEN BEGIN
              IF ReservationEntry2.FIND('+') THEN
                NextReservationEntryNo := ReservationEntry2."Entry No." + 1
              ELSE
                NextReservationEntryNo := 1;
              REPEAT
                ReservationEntry2 := ReservationEntry3;
                ReservationEntry2."Entry No." := NextReservationEntryNo;
                IF ReservationEntry2.Positive THEN
                  ReservationEntry2.Positive := FALSE
                ELSE
                  ReservationEntry2.Positive := TRUE;
                ReservationEntry2."Quantity (Base)" := ReservationEntry2."Quantity (Base)" * -1;
                ReservationEntry2."Shipment Date" := ReservationEntry2."Expected Receipt Date";
                ReservationEntry2."Expected Receipt Date" := 0D;
                ReservationEntry2.Quantity := ReservationEntry2.Quantity * -1;
                ReservationEntry2."Qty. to Handle (Base)" := ReservationEntry2."Qty. to Handle (Base)" * -1;
                ReservationEntry2."Qty. to Invoice (Base)" := ReservationEntry2."Qty. to Invoice (Base)" * -1;
                ReservationEntry2.INSERT;
                NextReservationEntryNo := NextReservationEntryNo + 1;
              UNTIL ReservationEntry3.NEXT = 0;
              IF (QtyToBeReceivedBase <> 0) THEN
                IF "Document Type" IN ["Document Type"::"Return Order","Document Type"::"Credit Memo"] THEN
                  ReservePurchLine.TransferPurchLineToItemJnlLine(PurchLine,ItemJnlLine2,QtyToBeReceivedBase,CheckApplToItemEntry)
                ELSE
                  ReservePurchLine.TransferPurchLineToItemJnlLine(PurchLine,ItemJnlLine2,-QtyToBeReceivedBase,CheckApplToItemEntry);
            END;
            JobPostLine.GetStartItemLedgEntryNo;
            ItemJnlPostLine.RunWithCheck(ItemJnlLine2,TempJnlLineDim);
            JobPostLine.InsertPurchLine(PurchHeader,PurchInvHeader,PurchCrMemoHeader,PurchRcptHeader,PurchLine,SrcCode,TempJnlLineDim);
          END;
          IF (QtyToBeInvoiced <> 0) AND (QtyToBeReceived = 0) THEN BEGIN
            JobPostLine.GetNextItemLedgEntryNo(ItemJnlLine2);
            ItemJnlPostLine.RunWithCheck(ItemJnlLine2,TempJnlLineDim);
          END;
        END;
...

Prerequisites
You must have Microsoft Dynamics NAV 5.0 installed to apply this hotfix.

Removal information
You cannot remove this hotfix.
STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
APPLIES TO

 

 
• Microsoft Dynamics NAV 5.0
 
Nøgleord: