From: Joe Hunt Date: Sat, 9 Dec 2017 08:49:00 +0000 (+0100) Subject: Inventory Valuation Report showing 0 (zero) on Unit Cost and decimal precision fix. X-Git-Tag: v2.4.4~47 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=495ac5fbc5f98dde51645d1691e13dc37654f771;hp=d8c20899e75cfa22aec62b1ad1c46a74c0bb5edc;p=fa-stable.git Inventory Valuation Report showing 0 (zero) on Unit Cost and decimal precision fix. --- diff --git a/includes/current_user.inc b/includes/current_user.inc index 52fafa53..23887cb6 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -353,7 +353,7 @@ function price_decimal_format($number, &$dec) if ($pos !== false) { $len = strlen(substr($str, $pos + 1)); - if ($len > $dec) + if ($len > $dec && $len < ini_get('precision')-3) $dec = $len; } return number_format2($number, $dec); diff --git a/reporting/rep301.php b/reporting/rep301.php index ac669492..4ef14f1c 100644 --- a/reporting/rep301.php +++ b/reporting/rep301.php @@ -62,7 +62,7 @@ function getAverageCost($stock_id, $location, $to_date) LEFT JOIN ".TB_PREF."debtor_trans cust_trans ON cust_trans.trans_no=move.trans_no AND cust_trans.type=move.type LEFT JOIN ".TB_PREF."debtors_master debtor ON cust_trans.debtor_no=debtor.debtor_no WHERE stock_id=".db_escape($stock_id)." - AND move.tran_date < '$to_date' AND standard_cost > 0.001 AND qty <> 0 AND move.type <> ".ST_LOCTRANSFER; + AND move.tran_date <= '$to_date' AND standard_cost > 0.001 AND qty <> 0 AND move.type <> ".ST_LOCTRANSFER; if ($location != 'all') $sql .= " AND move.loc_code = ".db_escape($location); diff --git a/reporting/rep308.php b/reporting/rep308.php index 21877177..a8bcccbe 100644 --- a/reporting/rep308.php +++ b/reporting/rep308.php @@ -111,7 +111,7 @@ function avg_unit_cost($stock_id, $location=null, $to_date) LEFT JOIN ".TB_PREF."debtor_trans cust_trans ON cust_trans.trans_no=move.trans_no AND cust_trans.type=move.type LEFT JOIN ".TB_PREF."debtors_master debtor ON cust_trans.debtor_no=debtor.debtor_no WHERE stock_id=".db_escape($stock_id)." - AND move.tran_date < '$to_date' AND standard_cost > 0.001 AND qty <> 0 AND move.type <> ".ST_LOCTRANSFER; + AND move.tran_date <= '$to_date' AND standard_cost > 0.001 AND qty <> 0 AND move.type <> ".ST_LOCTRANSFER; if ($location != '') $sql .= " AND move.loc_code = ".db_escape($location);