From 8acc47220df2d36be6a792ec6e80d7edf8a0c70b Mon Sep 17 00:00:00 2001 From: Pichi1966 <57623859+josett225@users.noreply.github.com> Date: Tue, 7 Nov 2023 18:07:46 +0100 Subject: [PATCH] Update stockatdate.php (#26481) As commented in #23782 this update is to clean and clarify the code for future evolution of stocktodate. In fact the calculated value in the SQL request is the current stock value and not the estimated stock value at date value. Therefore I changed in SQL request the estimatedvalue to currentvalue and reused as a variable for a better understanding and for future use (other PR) as it will be interesting to get a comparison between stockatdate value to currentstock value. Also some others changes are required to improve the page speed. --- htdocs/product/stock/stockatdate.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 868b3bb3adf..ddee7143569 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -276,10 +276,10 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,'; $sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,'; $sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, '; if (!empty($search_fk_warehouse)) { - $sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; + $sql .= " SUM(p.pmp * ps.reel) as currentvalue, SUM(p.price * ps.reel) as sellvalue"; $sql .= ', SUM(ps.reel) as stock_reel'; } else { - $sql .= " SUM(p.pmp * p.stock) as estimatedvalue, SUM(p.price * p.stock) as sellvalue"; + $sql .= " SUM(p.pmp * p.stock) as currentvalue, SUM(p.price * p.stock) as sellvalue"; } // Add fields from hooks $parameters = array(); @@ -611,12 +611,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // PMP value print '