From 22cecf450b82a45ee299111d093b1da662806a2d Mon Sep 17 00:00:00 2001 From: Joe Date: Sun, 17 Jul 2022 11:56:25 +0200 Subject: [PATCH] Invoice not converting from DN due to float bug (dec in units). --- sales/customer_delivery.php | 5 ++++- sales/customer_invoice.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sales/customer_delivery.php b/sales/customer_delivery.php index 1e29859e..603ba1d7 100644 --- a/sales/customer_delivery.php +++ b/sales/customer_delivery.php @@ -252,8 +252,11 @@ function check_quantities() $min = $itm->qty_done; $max = $itm->quantity; } else { + global $path_to_root; $min = 0; - $max = $itm->quantity - $itm->qty_done; + // Fixing floating point problem in PHP. + include_once($path_to_root . "/inventory/includes/db/items_units_db.inc"); + $max = round2($itm->quantity - $itm->qty_done, get_unit_dec($itm->stock_id)); } if (check_num('Line'.$line, $min, $max)) { diff --git a/sales/customer_invoice.php b/sales/customer_invoice.php index 3bf5a6bb..f6791c17 100644 --- a/sales/customer_invoice.php +++ b/sales/customer_invoice.php @@ -203,9 +203,12 @@ function check_quantities() $min = $itm->qty_done; $max = $itm->quantity; } else { + global $path_to_root; $min = 0; - $max = $itm->quantity - $itm->qty_done; + include_once($path_to_root . "/inventory/includes/db/items_units_db.inc"); + $max = round2($itm->quantity - $itm->qty_done, get_unit_dec($itm->stock_id)); } + dump($max); if (check_num('Line'.$line_no, $min, $max)) { $_SESSION['Items']->line_items[$line_no]->qty_dispatched = input_num('Line'.$line_no); -- 2.30.2