X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fcustomer_delivery.php;h=c634a94e75109bf06a1fee1d597c014e29cb1db0;hb=716ddd8b68b285b432e47626939165d9f6c48f90;hp=9cbd252710e176255427609d416ac0eb8118edc7;hpb=5e63c6ace55729bbb5ee3b060035a25a4426eb0a;p=fa-stable.git diff --git a/sales/customer_delivery.php b/sales/customer_delivery.php index 9cbd2527..c634a94e 100644 --- a/sales/customer_delivery.php +++ b/sales/customer_delivery.php @@ -19,7 +19,6 @@ $path_to_root = ".."; include_once($path_to_root . "/sales/includes/cart_class.inc"); include_once($path_to_root . "/includes/session.inc"); include_once($path_to_root . "/includes/data_checks.inc"); -include_once($path_to_root . "/includes/manufacturing.inc"); include_once($path_to_root . "/sales/includes/sales_db.inc"); include_once($path_to_root . "/sales/includes/sales_ui.inc"); include_once($path_to_root . "/reporting/includes/reporting.inc"); @@ -174,7 +173,7 @@ function check_data() } if ($_SESSION['Items']->trans_no==0) { - if (!$Refs->is_valid($_POST['ref'])) { + if (!$Refs->is_valid($_POST['ref'], ST_CUSTDELIVERY)) { display_error(_("You must enter a reference.")); set_focus('ref'); return false; @@ -203,7 +202,7 @@ function check_data() if (!$SysPrefs->allow_negative_stock() && ($low_stock = $_SESSION['Items']->check_qoh())) { - display_error(_("This document cannot be processed because there is insufficient quantity for: ").implode(',', $low_stock)); + display_error(_("This document cannot be processed because there is insufficient quantity for items marked.")); return false; } @@ -249,13 +248,14 @@ function check_quantities() // Update cart delivery quantities/descriptions foreach ($_SESSION['Items']->line_items as $line=>$itm) { if (isset($_POST['Line'.$line])) { - if($_SESSION['Items']->trans_no) { - $min = $itm->qty_done; - $max = $itm->quantity; - } else { - $min = 0; - $max = $itm->quantity - $itm->qty_done; - } + if($_SESSION['Items']->trans_no) { + $min = $itm->qty_done; + $max = $itm->quantity; + } else { + $min = 0; + // Fixing floating point problem in PHP. + $max = round2($itm->quantity - $itm->qty_done, get_unit_dec($itm->stock_id)); + } if (check_num('Line'.$line, $min, $max)) { $_SESSION['Items']->line_items[$line]->qty_dispatched = @@ -319,10 +319,10 @@ if (isset($_POST['Update']) || isset($_POST['_Location_update']) || isset($_POST start_form(); hidden('cart_id'); -start_table(TABLESTYLE2, "width=80%", 5); +start_table(TABLESTYLE2, "width='80%'", 5); echo "