From: Joe Hunt Date: Tue, 23 Sep 2008 00:17:38 +0000 (+0000) Subject: Bug [0000059] Direct Invoice or Delivery Notes doesn't account for negative inventory... X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=44d8fedb34bbe162871ed1c327cb13e5a59bcd95;p=textcart.git Bug [0000059] Direct Invoice or Delivery Notes doesn't account for negative inventory flag --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index af677f0..95765db 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,10 @@ Legend: ! -> Note $ -> Affected files +23-Sep-2008 Joe Hunt +# Bug [0000059] Direct Invoice or Delivery Notes doesn't account for negative inventory flag +$ /sales/sales_order_entry.php + 21-Sep-2008 Janusz Dobrowolski + Added submit_on_change option for date fields $ /includes/ui/ui_input.inc diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 2113662..9891d0c 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -291,7 +291,6 @@ if (isset($_POST['ProcessOrder']) && can_process()) { function check_item_data() { - if (!check_num('qty', 0) || !check_num('Disc', 0, 100)) { display_error( _("The item could not be updated because you are attempting to set the quantity ordered to less than 0, or the discount percent to more than 100.")); set_focus('qty'); @@ -306,6 +305,20 @@ function check_item_data() set_focus('qty'); display_error(_("You attempting to make the quantity ordered a quantity less than has already been delivered. The quantity delivered cannot be modified retrospectively.")); return false; + } // Joe Hunt added 2008-09-22 ------------------------- + elseif ($_SESSION['Items']->trans_type!=30 && !sys_prefs::allow_negative_stock() && + is_inventory_item($_POST['stock_id'])) + { + $qoh = get_qoh_on_date($_POST['stock_id'], $_POST['Location'], $_POST['OrderDate']); + if (input_num('qty') > $qoh) + { + $stock = get_item($_POST['stock_id']); + display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:") . + " " . $stock['stock_id'] . " - " . $stock['description'] . " - " . + _("Quantity On Hand") . " = " . number_format2($qoh, get_qty_dec($_POST['stock_id']))); + return false; + } + return true; } return true; }