diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 725b40e2a60..88a49002c6f 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -34,6 +34,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php");
require_once(DOL_DOCUMENT_ROOT."/facture.class.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
+$langs->load("companies");
$langs->load("bills");
$langs->load("products");
@@ -108,7 +109,7 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '
| '.$langs->trans("Referers").' | ';
- print ''.$langs->trans("NbOfCustomers").' | ';
+ print ''.$langs->trans("NbOfThirdParties").' | ';
print ''.$langs->trans("NbOfReferers").' | ';
print ''.$langs->trans("TotalQuantity").' | ';
print '
';
@@ -130,7 +131,7 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
- // Commandes
+ // Commandes clients
if ($conf->commande->enabled)
{
$ret=$product->load_stats_commande($socidp);
@@ -147,6 +148,23 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
+ // Commandes fournisseurs
+ if ($conf->fournisseur->enabled)
+ {
+ $ret=$product->load_stats_commande_fournisseur($socidp);
+ if ($ret < 0) dolibarr_print_error($db);
+ $langs->load("orders");
+ print '| ';
+ print ''.img_object('','order').' '.$langs->trans("SuppliersOrders").'';
+ print ' | ';
+ print $product->stats_commande_fournisseur['suppliers'];
+ print ' | ';
+ print $product->stats_commande_fournisseur['nb'];
+ print ' | ';
+ print $product->stats_commande_fournisseur['qty'];
+ print ' | ';
+ print '
';
+ }
// Contrats
if ($conf->contrat->enabled)
{
@@ -164,7 +182,7 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
- // Factures
+ // Factures clients
if ($conf->facture->enabled)
{
$ret=$product->load_stats_facture($socidp);
@@ -181,7 +199,23 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
-
+ // Factures fournisseurs
+ if ($conf->fournisseur->enabled)
+ {
+ $ret=$product->load_stats_facture_fournisseur($socidp);
+ if ($ret < 0) dolibarr_print_error($db);
+ $langs->load("bills");
+ print '| ';
+ print ''.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'';
+ print ' | ';
+ print $product->stats_facture_fournisseur['suppliers'];
+ print ' | ';
+ print $product->stats_facture_fournisseur['nb'];
+ print ' | ';
+ print $product->stats_facture_fournisseur['qty'];
+ print ' | ';
+ print '
';
+ }
print "";
print '';
diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php
index 2598a88b39e..46477e20526 100644
--- a/htdocs/product/stats/fiche.php
+++ b/htdocs/product/stats/fiche.php
@@ -35,6 +35,7 @@ require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/dolgraph.class.php");
+$langs->load("companies");
$langs->load("products");
$langs->load("bills");
@@ -63,7 +64,7 @@ if ($_GET["id"] || $_GET["ref"])
$product = new Product($db);
if ($_GET["ref"]) $result = $product->fetch('',$_GET["ref"]);
if ($_GET["id"]) $result = $product->fetch($_GET["id"]);
-
+
llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($result)
@@ -92,7 +93,7 @@ if ($_GET["id"] || $_GET["ref"])
$WIDTH=380;
$HEIGHT=200;
-
+
$px = new DolGraph();
$mesg = $px->isGraphKo();
if (! $mesg)
@@ -162,7 +163,7 @@ if ($_GET["id"] || $_GET["ref"])
if ($previous_ref || $next_ref) print ''.$previous_ref.' | '.$next_ref.' | ';
print '';
print '';
-
+
// Libelle
print '| '.$langs->trans("Label").' | '.$product->libelle.' |
';
@@ -174,7 +175,7 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '| '.$langs->trans("Referers").' | ';
- print ''.$langs->trans("NbOfCustomers").' | ';
+ print ''.$langs->trans("NbOfThirdParties").' | ';
print ''.$langs->trans("NbOfReferers").' | ';
print ''.$langs->trans("TotalQuantity").' | ';
print '
';
@@ -196,7 +197,7 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
- // Commandes
+ // Commandes clients
if ($conf->commande->enabled)
{
$ret=$product->load_stats_commande($socid);
@@ -213,6 +214,23 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
+ // Commandes fournisseurs
+ if ($conf->fournisseur->enabled)
+ {
+ $ret=$product->load_stats_commande_fournisseur($socidp);
+ if ($ret < 0) dolibarr_print_error($db);
+ $langs->load("orders");
+ print '| ';
+ print ''.img_object('','order').' '.$langs->trans("SuppliersOrders").'';
+ print ' | ';
+ print $product->stats_commande_fournisseur['suppliers'];
+ print ' | ';
+ print $product->stats_commande_fournisseur['nb'];
+ print ' | ';
+ print $product->stats_commande_fournisseur['qty'];
+ print ' | ';
+ print '
';
+ }
// Contrats
if ($conf->contrat->enabled)
{
@@ -230,7 +248,7 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
- // Factures
+ // Factures clients
if ($conf->facture->enabled)
{
$ret=$product->load_stats_facture($socid);
@@ -247,11 +265,28 @@ if ($_GET["id"] || $_GET["ref"])
print '';
print '';
}
+ // Factures fournisseurs
+ if ($conf->fournisseur->enabled)
+ {
+ $ret=$product->load_stats_facture_fournisseur($socidp);
+ if ($ret < 0) dolibarr_print_error($db);
+ $langs->load("bills");
+ print '| ';
+ print ''.img_object('','bill').' '.$langs->trans("SuppliersInvoices").'';
+ print ' | ';
+ print $product->stats_facture_fournisseur['suppliers'];
+ print ' | ';
+ print $product->stats_facture_fournisseur['nb'];
+ print ' | ';
+ print $product->stats_facture_fournisseur['qty'];
+ print ' | ';
+ print '
';
+ }
print '';
print '';
-
-
+
+
print '';
// Ligne de graph
@@ -281,7 +316,7 @@ if ($_GET["id"] || $_GET["ref"])
print '| '.($mesg?''.$mesg.'':$langs->trans("ChartNotGenerated")).' | ';
}
print '['.$langs->trans("ReCalculate").'] | ';
-
+
// Ligne de graph
print 'Nombre de ventes sur les 12 derniers mois | ';
print 'Nombre de pièces vendues |
';
@@ -319,7 +354,7 @@ if ($_GET["id"] || $_GET["ref"])
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent en fin de page
print '';
print '
';
-
+
}
}
else