diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index ece788ae34c..a46ee30669d 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -111,9 +111,10 @@ $sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
$result = $db->query($sql);
while ($objp = $db->fetch_object($result))
{
- $status=1;
+ $status=2;
if (! $objp->tosell && ! $objp->tobuy) $status=0; // To sell OR to buy
- $prodser[$objp->fk_product_type][$status]+=$objp->total;
+ if ((! $objp->tosell && $objp->tobuy) || ($objp->tosell && ! $objp->tobuy)) $status=1;
+ $prodser[$objp->fk_product_type][$status]=$objp->total;
}
print '
';
@@ -124,40 +125,105 @@ if (! empty($conf->product->enabled))
$statProducts.= '| '.$langs->trans("ProductsNotOnSell").' | '.round($prodser[0][0]).' | ';
$statProducts.= "";
$statProducts.= "";
- $statProducts.= '| '.$langs->trans("ProductsOnSell").' | '.round($prodser[0][1]).' | ';
+ $statProducts.= ''.$langs->trans("ProductsOnSell").' | '.round($prodser[0][1]).' | ';
$statProducts.= "
";
+ $statProducts.= "";
+ $statProducts.= '| '.$langs->trans("ProductsOnSellAndOnBuy").' | '.round($prodser[0][2]).' | ';
+ $statProducts.= "
";
+
}
if (! empty($conf->service->enabled))
{
- $statServices = "";
+ $statServices = "
";
$statServices.= '| '.$langs->trans("ServicesNotOnSell").' | '.round($prodser[1][0]).' | ';
$statServices.= "
";
- $statServices.= "";
- $statServices.= '| '.$langs->trans("ServicesOnSell").' | '.round($prodser[1][1]).' | ';
+ $statServices.= "
";
+ $statServices.= '| '.$langs->trans("ServicesOnSell").' | '.round($prodser[1][1]).' | ';
$statServices.= "
";
+ $statServices.= "";
+ $statServices.= '| '.$langs->trans("ServicesOnSellAndOnBuy").' | '.round($prodser[1][2]).' | ';
+ $statServices.= "
";
+
}
$total=0;
if ($type == '0')
{
print $statProducts;
- $total=round($prodser[0][0])+round($prodser[0][1]);
+ $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
}
else if ($type == '1')
{
print $statServices;
- $total=round($prodser[1][0])+round($prodser[1][1]);
+ $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2]);
}
else
{
print $statProducts.$statServices;
- $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[0][0])+round($prodser[0][1]);
+ $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]);
}
print '| '.$langs->trans("Total").' | ';
print $total;
print ' |
';
print '
';
-
+if (! empty($conf->categorie->enabled))
+{
+ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+ print '