diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index 4801dff3af0..6d487de21e3 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -68,7 +68,7 @@ $form=new Form($db);
$warehouse=new Entrepot($db);
$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,";
-$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
+$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
@@ -83,6 +83,16 @@ $result=$db->query($sql);
if ($result)
{
$totalnboflines = $db->num_rows($result);
+ // fetch totals
+ $line = $total = $totalsell = $totalStock = 0;
+ while ($line < $totalnboflines)
+ {
+ $objp = $db->fetch_object($result);
+ $total += price2num($objp->estimatedvalue,'MU');
+ $totalsell += price2num($objp->sellvalue,'MU');
+ $totalStock += $objp->stockqty;
+ $line++;
+ }
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@@ -118,6 +128,7 @@ if ($result)
print "
";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'','','align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder);
@@ -135,7 +146,7 @@ if ($result)
print '';
print '';
- print '| ';
+ print ' | ';
print ' | ';
print '';
@@ -152,7 +163,6 @@ if ($result)
if ($num)
{
$entrepot=new Entrepot($db);
- $total = $totalsell = 0;
$var=false;
while ($i < min($num,$limit))
{
@@ -164,6 +174,8 @@ if ($result)
print ' | ' . $entrepot->getNomUrl(1) . ' | ';
// Location
print ''.$objp->lieu.' | ';
+ // Stock qty
+ print ''.price2num($objp->stockqty,5).' | ';
// PMP value
print '';
if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'),1);
@@ -185,17 +197,15 @@ if ($result)
print " |
\n";
- $total += price2num($objp->estimatedvalue,'MU');
- $totalsell += price2num($objp->sellvalue,'MU');
-
$var=!$var;
$i++;
}
- if ($totalnboflines <= $limit)
+ if ($totalnboflines-$offset <= $limit)
{
print '';
print '| '.$langs->trans("Total").' | ';
+ print ''.price2num($totalStock,5).' | ';
print ''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).' | ';
print '';
if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency);
|