This article applies to Microsoft Dynamics NAV for all countries and all language locales.
Symptoms
When partial output is made to expected cost in period 1 and period 3 and output is invoiced in period 4 in Microsoft Dynamics NAV 2009, the ending balance of period 1 does not correspond to opening balance of period 2 in the Inventory Valuation - WIP report (5802). The report does not interpret revaluation of expected costs of outputs consistently. It has the expected cost of output in period 2 while the output is finally invoiced in period 1. Additionally, the consumptions are reversed and then the component item is also revalued. Other combinations of indirect costs and variances cause incorrect numbers in the report. This problem occurs in the following products:
-
Microsoft Dynamics NAV 2009 R2
-
Microsoft Dynamics NAV 2009 Service Pack 1
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 2009 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.
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. However, 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 resolve this problem, change the code in the Inventory Valuation WIP report (5802). To do this, follow these steps:-
Add the following global variable:
EntryFound@1000000014 : Boolean;
-
Add the following lines for the OnAfterGetRecord trigger in DataItem: Production Order as follows:
// Add the following lines.
OnAfterGetRecord=BEGIN IF SkipProductionOrder("Production Order") THEN CurrReport.SKIP; EntryFound := ValueEntryExist("Production Order",StartDate,EndDate); END; // End of lines. -
Add lines under SectionType=GroupFooter;
OnPostSection=BEGIN
CurrReport.SHOWOUTPUT((CurrReport.TOTALSCAUSEDBY = FIELDNO("Production Order"."No."))); // Add the following lines IF (ValueOfWIP = 0) AND (ValueOfMatConsump = 0) AND (ValueOfCap = 0) AND (ValueOfOutput = 0) AND (ValueOfCostPstdToGL = 0) THEN CurrReport.SHOWOUTPUT(FALSE); // End of lines. -
Remove all existing code and replace with the following code for the OnAfterGetRecord trigger in DataItem: Value Entry:
OnAfterGetRecord=BEGIN
IF ISSERVICETIER THEN BEGIN CountRecord := CountRecord + 1; LastOutput := 0; AtLastDate := 0; LastWIP := 0; IF (CountRecord = LengthRecord) AND IsNotWIP THEN BEGIN ValueEntryOnPostDataItem("Value Entry"); AtLastDate := NcValueOfWIP + NcValueOfMatConsump + NcValueOfCap + NcValueOfOutput; LastOutput := NcValueOfOutput; LastWIP := NcValueOfWIP; ValueOfCostPstdToGL := NcValueOfCostPstdToGL; NcValueOfWIP := 0; NcValueOfOutput := 0; NcValueOfMatConsump := 0; NcValueOfCap := 0; NcValueOfInvOutput1 := 0; NcValueOfExpOutPut1 := 0; NcValueOfExpOutPut2 := 0; NcValueOfRevalCostAct := 0; NcValueOfRevalCostPstd := 0; NcValueOfCostPstdToGL := 0; END; END; IF NOT ISSERVICETIER THEN IF IsNotWIP THEN CurrReport.SKIP; IF NOT IsNotWIP THEN BEGIN ValueOfWIP := 0; ValueOfMatConsump := 0; ValueOfCap := 0; ValueOfOutput := 0; ValueOfInvOutput1 := 0; ValueOfExpOutput1 := 0; ValueOfExpOutput2 := 0; IF EntryFound THEN ValueOfCostPstdToGL := "Cost Posted to G/L"; IF "Posting Date" < StartDate THEN BEGIN IF "Item Ledger Entry Type" = "Item Ledger Entry Type"::" " THEN ValueOfWIP := "Cost Amount (Actual)" ELSE ValueOfWIP := -"Cost Amount (Actual)"; IF "Item Ledger Entry Type" = "Item Ledger Entry Type"::Output THEN BEGIN ValueOfExpOutput1 := -"Cost Amount (Expected)"; ValueOfInvOutput1 := -"Cost Amount (Actual)"; ValueOfWIP := ValueOfExpOutput1 + ValueOfInvOutput1; END; IF ("Entry Type" = "Entry Type"::Revaluation) AND ("Cost Amount (Actual)" <> 0) THEN ValueOfWIP := 0; END ELSE CASE "Item Ledger Entry Type" OF "Item Ledger Entry Type"::Consumption: IF IsProductionCost("Value Entry") THEN ValueOfMatConsump := -"Cost Amount (Actual)"; "Item Ledger Entry Type"::" ": ValueOfCap := "Cost Amount (Actual)"; "Item Ledger Entry Type"::Output: BEGIN ValueOfExpOutput2 := -"Cost Amount (Expected)"; ValueOfOutput := -("Cost Amount (Actual)" + "Cost Amount (Expected)"); IF "Entry Type" = "Entry Type"::Revaluation THEN ValueOfRevalCostAct += -"Cost Amount (Actual)"; END; END; IF NOT ("Item Ledger Entry Type" = "Item Ledger Entry Type"::" ") THEN BEGIN "Cost Amount (Actual)" := -"Cost Amount (Actual)"; IF IsProductionCost("Value Entry") THEN BEGIN ValueOfCostPstdToGL := -("Cost Posted to G/L" + "Expected Cost Posted to G/L"); IF "Entry Type" = "Entry Type"::Revaluation THEN ValueOfRevalCostPstd += ValueOfCostPstdToGL; END ELSE ValueOfCostPstdToGL := 0; END ELSE ValueOfCostPstdToGL := "Cost Posted to G/L" + "Expected Cost Posted to G/L"; IF ISSERVICETIER THEN BEGIN NcValueOfWIP := NcValueOfWIP + ValueOfWIP; NcValueOfOutput := NcValueOfOutput + ValueOfOutput; NcValueOfMatConsump := NcValueOfMatConsump + ValueOfMatConsump; NcValueOfCap := NcValueOfCap + ValueOfCap; NcValueOfInvOutput1 := NcValueOfInvOutput1 + ValueOfInvOutput1; NcValueOfExpOutPut1 := NcValueOfExpOutPut1 + ValueOfExpOutput1; NcValueOfExpOutPut2 := NcValueOfExpOutPut2 + ValueOfExpOutput2; NcValueOfRevalCostAct := ValueOfRevalCostAct; NcValueOfRevalCostPstd := ValueOfRevalCostPstd; NcValueOfCostPstdToGL := NcValueOfCostPstdToGL + ValueOfCostPstdToGL; ValueOfCostPstdToGL :=0; IF CountRecord = LengthRecord THEN BEGIN ValueEntryOnPostDataItem("Value Entry"); ValueOfCostPstdToGL := NcValueOfCostPstdToGL; AtLastDate := NcValueOfWIP + NcValueOfMatConsump + NcValueOfCap + NcValueOfOutput; LastOutput := NcValueOfOutput; LastWIP := NcValueOfWIP; NcValueOfWIP := 0; NcValueOfOutput := 0; NcValueOfMatConsump := 0; NcValueOfCap := 0; NcValueOfInvOutput1 := 0; NcValueOfExpOutPut1 := 0; NcValueOfExpOutPut2 := 0; NcValueOfRevalCostAct := 0; NcValueOfRevalCostPstd := 0; NcValueOfCostPstdToGL := 0; END; END; END; END; -
Remove all existing code and replace with the following code in the ValueEntryOnPostDataItem function:
PROCEDURE ValueEntryOnPostDataItem(ValueEntry : Record 5802);
BEGIN WITH ValueEntry DO BEGIN IF ISSERVICETIER THEN BEGIN IF (NcValueOfExpOutput2 + NcValueOfExpOutput1) = 0 THEN BEGIN // if prod. order is invoiced NcValueOfOutput := NcValueOfOutput - NcValueOfRevalCostAct; // take out revalued differnce NcValueOfCostPstdToGL := NcValueOfCostPstdToGL - NcValueOfRevalCostPstd; // take out Cost posted to G/L END; IF EntryFound THEN IF NcValueOfWIP + NcValueOfMatConsump + NcValueOfCap <> -NcValueOfOutput THEN NcValueOfWIP := NcValueOfWIP - NcValueOfInvOutput1; END ELSE BEGIN IF (ValueOfExpOutput2 + ValueOfExpOutput1) = 0 THEN BEGIN // if prod. order is invoiced ValueOfOutput := ValueOfOutput - ValueOfRevalCostAct; // take out revalued differnce ValueOfCostPstdToGL := ValueOfCostPstdToGL - ValueOfRevalCostPstd; // take out Cost posted to G/ END; IF EntryFound THEN IF ValueOfWIP + ValueOfMatConsump + ValueOfCap <> -ValueOfOutput THEN ValueOfWIP := ValueOfWIP - ValueOfInvOutput1; END; END; END; -
Add the SkipProductionOrder function as follows:
PROCEDURE SkipProductionOrder@10(ProductionOrder@1001 : Record 5405) : Boolean;
BEGIN IF ProductionOrder.Status <> ProductionOrder.Status::Finished THEN EXIT(FALSE); EXIT(NOT ValueEntryExist(ProductionOrder,StartDate,31129999D)); END; -
Add the ValueEntryExist function as follows:
PROCEDURE ValueEntryExist@11(ProductionOrder@1001 : Record 5405;StartDate@1002 : Date;EndDate@1003 : Date) : Boolean;
BEGIN WITH ValueEntry DO BEGIN SETCURRENTKEY("Prod. Order No."); SETRANGE("Prod. Order No.",ProductionOrder."No."); SETRANGE("Posting Date",StartDate,EndDate); EXIT(NOT ISEMPTY); END; END; -
Change the code for RDLDATA as follows:
Existing code...
<ReportItems> ... <Textbox Name="Value_Entry___Cost_Posted_to_G_L_"> <CanGrow>true</CanGrow> <Style> <FontSize>7pt</FontSize> <Format>=First(Fields!Value_Entry___Cost_Posted_to_G_L_Format.Value)</Format> <PaddingBottom>2pt</PaddingBottom> <PaddingLeft>0.075cm</PaddingLeft> <PaddingRight>2pt</PaddingRight> <PaddingTop>2pt</PaddingTop> <TextAlign>Right</TextAlign> <VerticalAlign>Middle</VerticalAlign> </Style> Delete the following line. <Value>=Sum(Fields!Value_Entry___Cost_Posted_to_G_L_.Value)</Value> <ZIndex>6</ZIndex> </Textbox> </ReportItems> ... <TableCell> <ReportItems> <Textbox Name="ProdOrderFilterValue"> <Style> <Color>#ff0000</Color> <PaddingBottom>2pt</PaddingBottom> <PaddingLeft>2pt</PaddingLeft> <PaddingRight>2pt</PaddingRight> <PaddingTop>2pt</PaddingTop> <TextAlign>Center</TextAlign> <VerticalAlign>Middle</VerticalAlign> </Style> <Value>=Fields!ProdOrderFilter.Value</Value> <Visibility> <Hidden>true</Hidden> </Visibility> </Textbox> </ReportItems> </TableCell> </TableCells> </TableRow> </TableRows> </Footer> <Grouping Name="Table1_Group"> <GroupExpressions> <GroupExpression>=Fields!Production_Order__Production_Order___No__.Value</GroupExpression> <GroupExpression>=Fields!Production_Order__Production_Order__Status.Value</GroupExpression> </GroupExpressions> ...Replacement code
...
<ReportItems> ... <Textbox Name="Value_Entry___Cost_Posted_to_G_L_"> <CanGrow>true</CanGrow> <Style> <FontSize>7pt</FontSize> <Format>=First(Fields!Value_Entry___Cost_Posted_to_G_L_Format.Value)</Format> <PaddingBottom>2pt</PaddingBottom> <PaddingLeft>0.075cm</PaddingLeft> <PaddingRight>2pt</PaddingRight> <PaddingTop>2pt</PaddingTop> <TextAlign>Right</TextAlign> <VerticalAlign>Middle</VerticalAlign> </Style> // Add the following line. <Value>=Last(Fields!Value_Entry___Cost_Posted_to_G_L_.Value)</Value> <ZIndex>6</ZIndex> </Textbox> </ReportItems> ... <TableCell> <ReportItems> <Textbox Name="ProdOrderFilterValue"> <Style> <Color>#ff0000</Color> <PaddingBottom>2pt</PaddingBottom> <PaddingLeft>2pt</PaddingLeft> <PaddingRight>2pt</PaddingRight> <PaddingTop>2pt</PaddingTop> <TextAlign>Center</TextAlign> <VerticalAlign>Middle</VerticalAlign> </Style> <Value>=Fields!ProdOrderFilter.Value</Value> <Visibility> <Hidden>true</Hidden> </Visibility> </Textbox> </ReportItems> </TableCell> </TableCells> //Add the following lines. <Visibility> <Hidden>=IIF((Last(Fields!LastWIP.Value) = 0) AND (Sum(Fields!ValueOfMatConsump.Value) = 0) AND (Sum(Fields!ValueOfCap.Value) = 0) AND (Last(Fields!LastOutput.Value) = 0) AND (Last(Fields!Value_Entry___Cost_Posted_to_G_L_.Value) = 0),TRUE,FALSE)</Hidden> </Visibility> //End of lines. </TableRow> </TableRows> </Footer> <Grouping Name="Table1_Group"> <GroupExpressions> <GroupExpression>=Fields!Production_Order__Production_Order___No__.Value</GroupExpression> <GroupExpression>=Fields!Production_Order__Production_Order__Status.Value</GroupExpression> </GroupExpressions> ...
Prerequisites
You must have one of the following products installed to apply this hotfix:
-
Microsoft Dynamics NAV 2009 R2
-
Microsoft Dynamics NAV 2009 Service Pack 1
Replacement information
This hotfix replaces the following hotfixes:
2711751 The amount in the "Cost Posted to G/L" field is incorrect for a finished production order in the Inventory Valuation-WIP report in a certain scenario in the RoleTailored Client in Microsoft Dynamics NAV 2009
2689150 The values in the Output field and in the "As of" field are incorrect in the Inventory Valuation – WIP report after you revalue multiple output entries for a production order in the Roletailored client (RTC) in Microsoft Dynamics NAV 2009
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.
More Information
The design of the report is changed. It now only prints finished production orders that demonstrate a value of the selected period. Older finished production orders that only demonstrate zero values are excluded.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.