From 6077880b0fd84cd35f6a1dcbb330db1a328b639a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 10 Feb 2021 15:25:27 +0100 Subject: [PATCH] Close #16248 : new column in Stock to date --- htdocs/product/stock/stockatdate.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 91159984a35..86f569d91c9 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -243,7 +243,8 @@ $title = $langs->trans('StockAtDate'); $sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price,'; $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'; +$sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, '; +$sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; if ($fk_warehouse > 0) { $sql .= ', SUM(ps.reel) as stock_reel'; } @@ -401,6 +402,8 @@ print ''; print ''; print ''; +print ''; +print ''; if ($mode == 'future') { print ''; } @@ -424,6 +427,9 @@ if ($fk_warehouse > 0) { print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue", '', $param, '', $sortfield, $sortorder, 'right '); +print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right '); + if ($mode == 'future') { print_liste_field_titre('CurrentStock', $_SERVER["PHP_SELF"], $fieldtosortcurrentstock, $param, '', '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"]); @@ -516,6 +522,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''; // TODO Remove this and make a fetch to get description when creating order instead of a GETPOST print ''; + // PMP value + print ''; + if (price2num($objp->estimatedvalue, 'MT')) print price(price2num($objp->estimatedvalue, 'MT'), 1); + else print ''; + print ''; + + // Selling value + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue, 'MT'), 1); + else { + $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + } + print''; + if ($mode == 'future') { // Current stock print ''.$currentstock.''; @@ -560,7 +581,7 @@ $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // N print $hookmanager->resPrint; if (empty($date) || ! $dateIsValid) { - $colspan = 6; + $colspan = 8; if ($mode == 'future') $colspan++; print ''.$langs->trans("EnterADateCriteria").''; }