Topic: Negative Stock

The following concerning negative inventory was noted:
1. In System and General Ledger Setup, allow negative inventory was not checked to allow negative inventory.
2. Today, qty on hand was 500 units of inventory item, on 25 July there were 1000 units on hand
3. When we backdate a sale to 25 July of 600 units, the sale is processed
4. But as of today's date 100 units of negative stock will appear, despite the fact that we did not allow negative inventory in system and GL set up.
5. No warning was displayed to disallow (or at least alert) the negative balance.

Re: Negative Stock

You. Should not elaborate between allow and disallow negative stock. It will cause troubles.

Joe

Re: Negative Stock

By not ticking the box called "allow negative inventory" in system and general ledger set up I thought that negative inventory would not be allowed, so as not cause "troubles."
But, in the example I gave in previous post, negative inventory was allowed.  Like I've said before, I can't code. Logically speaking, there needs to be a routine in the code that checks today's stock quantity before allowing me to process a back dated delivery or direct invoice that exceeds today's qty and results in negative stock.  As it is now, one thinks that by not ticking allow negative inventory the troubles are avoided, but they are not.

Re: Negative Stock

Mark, I am sorry that I didn't see the problem at first.

Of course, we should not allow the delivery. We should not test the stock availability by the document delivery date, but we should test for Todays date.

I will try to fix this asap.

/Joe

Re: Negative Stock

This item has now been fixed and the HG repository has been updated.

You can download /sales/sales_order_entry.php here:

/joe

Re: Negative Stock

thanks Joe.
Appreciated!
Will this fix go to the next release and I can download then?
Mark

Re: Negative Stock

Yes it will go to the next minor release.

Joe

Re: Negative Stock

Hi Joe

I tested the fix for negative stock.
It works correctly now, except for the error message....which does not show the correct qty on hand

Here is my test data:

1. 25.8.14 purchased 1000 units
2. 25.8.14 sold 500 units leaving a balance of 500 units
3. 20.9.14 sold 100 units leaving a balance of 400 units
4. 26.8.14 back dated a sale of 500 units

As expected, I could not process the sale of 500 units, but the error message below is incorrect.

The delivery cannot be processed because there is an insufficient quantity for item: testneg - testneg - Quantity On Hand = 500

The qty on hand is 400, not 500. 

It looks like the routine for checking stock levels used by the error message needs to be updated from historical levels on 25.8.14 to actual stock levels at 26.8.14 (current date). 

Mark

Re: Negative Stock

Hello Mark.
Janusz, our chief developer, is about to fix a better solution. He will rewrite something this weekend, so please stay put until he is ready.

Joe

Re: Negative Stock

Hello Mark,

Janusz has now fixed this. Not only testing on item lines, but also finally in multi user Environment. HG repository updated and fixes is included in next minor release.

/Joe

11 (edited by apmuthu 09/24/2014 11:05:07 am)

Re: Negative Stock

Fixes needed for negative stock to work and other cosmetic changes:

File: includes/db/sql_functions.inc
Fix: missing end of file closing php tag "?>"

File:  inventory/transfers.php
Fix: Change line 79 from:
global $Refs;
to
global $Refs, $SysPrefs;

File: sales/includes/ui/sales_order_ui.inc
Fix: Remove Line 138:
    global $SysPrefs;'
as it is no longer needed.

****** All these issues and others have been addressed in the subsequent commit. *******