Stop ship when not enough inventory

cwiginton
Member Posts: 16
Trying to stop shipping if not enough inventory.
Using Nav3.7, have the following code in codeunit 22 just after InsertItemLedgEntry and the system still let's me ship when no inventory. Can anyone tell me what I did wrong?
WITH ItemJnlLine DO BEGIN
IF ItemLedgEntry.Open THEN BEGIN
IF (((ItemLedgEntry."Entry Type" IN
[ItemLedgEntry."Entry Type"::"Negative Adjmt.",
ItemLedgEntry."Entry Type"::Consumption,
ItemLedgEntry."Entry Type"::Sale]) AND
("Source Type" = "Source Type"::Item)) OR
(ItemLedgEntry."Entry Type" = ItemLedgEntry."Entry Type"::Transfer)) AND
(ItemLedgEntry.Quantity < 0)
THEN
ERROR(Text005,ItemLedgEntry."Item No.");
Help is greatly appreciated!
Catherine :-k
Using Nav3.7, have the following code in codeunit 22 just after InsertItemLedgEntry and the system still let's me ship when no inventory. Can anyone tell me what I did wrong?
WITH ItemJnlLine DO BEGIN
IF ItemLedgEntry.Open THEN BEGIN
IF (((ItemLedgEntry."Entry Type" IN
[ItemLedgEntry."Entry Type"::"Negative Adjmt.",
ItemLedgEntry."Entry Type"::Consumption,
ItemLedgEntry."Entry Type"::Sale]) AND
("Source Type" = "Source Type"::Item)) OR
(ItemLedgEntry."Entry Type" = ItemLedgEntry."Entry Type"::Transfer)) AND
(ItemLedgEntry.Quantity < 0)
THEN
ERROR(Text005,ItemLedgEntry."Item No.");
Help is greatly appreciated!
Catherine :-k
0
Comments
-
source type is not item for entry type sales.
i suggest to add new code and don't modify the existing if statement0 -
Ah! Thank you and I'll take your advise!
=D>0 -
WOW do you get paid per line of code
Try this:
http://wiki.dynamicsbook.com/index.php? ... ory_in_NAVAdd a field to the Location Table Block Negative Inventory::Boolean IN CU22 look for ILE.Modify and ILE.Insert, and add code IF "remaining Quantity" < 0 then Error(..... if OldItemLedgEntry."Remaining Qty." < 0 then error(......
David Singleton0 -
Or, goto sales and receiveable setup
and check the box
Stock Out Warning
then if you try to put an item on a sales order without stock on hand, a pop up a warning box will appear.
If you edit the form, to hide the yes button it can't be entered on an order.
Not quite what you were looking for, but it also doesn't require any programming.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions