diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index fb992a6f0f9..101ea1f8b19 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -464,7 +464,8 @@ $resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
- $i=0; $total=0; $var=false;
+ $total=$totalwithpmp;
+ $i=0; $var=false;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
@@ -474,8 +475,8 @@ if ($resql)
print '
'.$entrepotstatic->getNomUrl(1).' | ';
print ''.$obj->reel.($obj->reel<0?' '.img_warning():'').' | ';
// PMP
- print ''.price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp),'MU').' | '; // Ditto : Show PMP from movement or from product
- print ''.price(price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp)*$obj->reel,'MT')).' | '; // Ditto : Show PMP from movement or from product
+ print ''.(price2num($obj->pmp)?price2num($obj->pmp,'MU'):'').' | '; // Ditto : Show PMP from movement or from product
+ print ''.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').' | '; // Ditto : Show PMP from movement or from product
// Sell price
print '';
if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price(price2num($product->price,'MU'));
@@ -485,9 +486,10 @@ if ($resql)
if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price(price2num($product->price*$obj->reel,'MT')).' | '; // Ditto : Show PMP from movement or from product
else print $langs->trans("Variable");
print ''; ;
- $total = $total + $obj->reel;
- $totalvalue = $totalvalue + price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp)*$obj->reel,'MT'); // Ditto : Show PMP from movement or from product
- $totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MT'); // Ditto : Show PMP from movement or from product
+ $total += $obj->reel;
+ if (price2num($obj->pmp)) $totalwithpmp += $obj->reel;
+ $totalvalue = $totalvalue + price2num($obj->pmp*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product
+ $totalvaluesell = $totalvaluesell + price2num($product->price*$obj->reel,'MU'); // Ditto : Show PMP from movement or from product
$i++;
$var=!$var;
}
@@ -496,17 +498,17 @@ else dol_print_error($db);
print '| '.$langs->trans("Total").': | ';
print ''.$total.' | ';
print '';
-print ($total?price($totalvalue/$total):' ');
+print ($totalwithpmp?price($totalvalue/$totalwithpmp):' ');
print ' | ';
print '';
-print price($totalvalue);
+print price(price2num($totalvalue,'MT'));
print ' | ';
print '';
if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print ($total?price($totalvaluesell/$total):' ');
else print $langs->trans("Variable");
print ' | ';
print '';
-if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price($totalvaluesell);
+if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print price(price2num($totalvaluesell,'MT'));
else print $langs->trans("Variable");
print ' | ';
print "
";
diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php
index ddf8d9860d9..4888ad0cd26 100644
--- a/htdocs/product/stock/valo.php
+++ b/htdocs/product/stock/valo.php
@@ -110,7 +110,8 @@ if ($result)
print ''.$objp->lieu.' | ';
// PMP value
print '';
- print price(price2num($objp->estimatedvalue,'MT'));
+ if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'));
+ else print '';
print ' | ';
// Selling value
print '';
|