diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index fb992a6f0f9a42f11fe8544269f024f4ff88b062..101ea1f8b1997f81db5f7dc3ace7bf47221a65db 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 '<td>'.$entrepotstatic->getNomUrl(1).'</td>'; print '<td align="right">'.$obj->reel.($obj->reel<0?' '.img_warning():'').'</td>'; // PMP - print '<td align="right">'.price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp),'MU').'</td>'; // Ditto : Show PMP from movement or from product - print '<td align="right">'.price(price2num(($obj->pmp > 0 ? $obj->pmp : $product->pmp)*$obj->reel,'MT')).'</td>'; // Ditto : Show PMP from movement or from product + print '<td align="right">'.(price2num($obj->pmp)?price2num($obj->pmp,'MU'):'').'</td>'; // Ditto : Show PMP from movement or from product + print '<td align="right">'.(price2num($obj->pmp)?price(price2num($obj->pmp*$obj->reel,'MT')):'').'</td>'; // Ditto : Show PMP from movement or from product // Sell price print '<td align="right">'; 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')).'</td>'; // Ditto : Show PMP from movement or from product else print $langs->trans("Variable"); print '</tr>'; ; - $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 '<tr class="liste_total"><td align="right" class="liste_total">'.$langs->trans("Total").':</td>'; print '<td class="liste_total" align="right">'.$total.'</td>'; print '<td class="liste_total" align="right">'; -print ($total?price($totalvalue/$total):' '); +print ($totalwithpmp?price($totalvalue/$totalwithpmp):' '); print '</td>'; print '<td class="liste_total" align="right">'; -print price($totalvalue); +print price(price2num($totalvalue,'MT')); print '</td>'; print '<td class="liste_total" align="right">'; if (empty($conf->global->PRODUIT_MUTLI_PRICES)) print ($total?price($totalvaluesell/$total):' '); else print $langs->trans("Variable"); print '</td>'; print '<td class="liste_total" align="right">'; -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 '</td>'; print "</tr>"; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index ddf8d9860d998232da5aacfb0cf115576b346a7c..4888ad0cd26c375690fc9e708a9987cedaf59f15 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -110,7 +110,8 @@ if ($result) print '<td>'.$objp->lieu.'</td>'; // PMP value print '<td align="right">'; - print price(price2num($objp->estimatedvalue,'MT')); + if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT')); + else print ''; print '</td>'; // Selling value print '<td align="right">';