For many years clients have been asking for the functionality of preventing Negative entry. This has been provided by Microsoft in NAV 2013 R2. (This provision has been given by Microsoft in Inventory Setup).
If the Prevent Negative Inventory setup is marked at Inventory Setup then, Inventory has been checked for all Items.
If the Prevent Negative Inventory setup is not marked at Inventory Setup then, In Item Master there is field called Prevent Negative Inventory needs to be checked. In this scenario, The Inventory will get checked for those Items which are marked with Prevent Negative Inventory
In Standard Navision, I have observed that this Functionality only worked for Sales. But when I tried to post with Item journal and entry type is “Negative Adjt.”. The entry gets posted with negative Inventory. To prevent user from posting negative Inventory, I have done a small change in the function written in Item Ledger Entry Table Called “VerifyOnInventory”
Old Code
IF NOT Open THEN
EXIT;
IF Quantity >= 0 THEN
EXIT;
CASE "Entry Type" OF
"Entry Type"::"Negative Adjmt.","Entry Type"::Consumption,"Entry Type"::"Assembly Consumption":
IF "Source Type" = "Source Type"::Item THEN
ERROR(IsNotOnInventoryErr,"Item No.");
"Entry Type"::Transfer:
ERROR(IsNotOnInventoryErr,"Item No.");
ELSE BEGIN
Item.GET("Item No.");
IF Item.PreventNegativeInventory THEN
ERROR(IsNotOnInventoryErr,"Item No.");
END;
END;
New Code
IF NOT Open THEN
EXIT;
IF Quantity >= 0 THEN
EXIT;
CASE "Entry Type" OF
"Entry Type"::"Negative Adjmt.","Entry Type"::Consumption,"Entry Type"::"Assembly Consumption":
//AK Start
//IF "Source Type" = "Source Type"::Item THEN
// ERROR(IsNotOnInventoryErr,"Item No.");
IF ("Source Type" = "Source Type"::Item) OR ("Source Type" = "Source Type"::" ") THEN
ERROR(IsNotOnInventoryErr,"Item No.");
//AK End
"Entry Type"::Transfer:
ERROR(IsNotOnInventoryErr,"Item No.");
ELSE BEGIN
Item.GET("Item No.");
IF Item.PreventNegativeInventory THEN
ERROR(IsNotOnInventoryErr,"Item No.");
END;
END;
Written by:Mr. Abhijit Kadulkar - More than 16 years of experience in Information Technology across multiple technology solutions.Presently working as Delivery Manager- Microsoft Dynamics NAV at Direction Software Solutions, Mumbai, India
No comments:
Post a Comment