diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 2ae1dcd1582..49a443938ab 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -141,9 +141,9 @@ if ($id > 0 || ! empty($ref))
$sql.= " AND d.fk_commande = c.rowid";
$sql.= " AND d.fk_product =".$product->id;
if (! empty($search_month))
- $sql.= ' AND MONTH(f.datef) IN (' . $search_month . ')';
+ $sql.= ' AND MONTH(c.date_commande) IN (' . $search_month . ')';
if (! empty($search_year))
- $sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')';
+ $sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')';
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
$sql.= " ORDER BY $sortfield $sortorder ";
@@ -189,12 +189,14 @@ if ($id > 0 || ! empty($ref))
print_barre_liste($langs->trans("CustomersOrders"),$page,$_SERVER["PHP_SELF"],"&id=$product->id",$sortfield,$sortorder,'',$num,$totalrecords,'');
print '
';
$i = 0;
print '';
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index 3141b3266e9..8cbdea41495 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -150,9 +150,9 @@ if ($id > 0 || ! empty($ref)) {
$sql .= " AND d.fk_commande = c.rowid";
$sql .= " AND d.fk_product =" . $product->id;
if (! empty($search_month))
- $sql .= ' AND MONTH(f.datef) IN (' . $search_month . ')';
+ $sql .= ' AND MONTH(c.date_commande) IN (' . $search_month . ')';
if (! empty($search_year))
- $sql .= ' AND YEAR(f.datef) IN (' . $search_year . ')';
+ $sql .= ' AND YEAR(c.date_commande) IN (' . $search_year . ')';
if (! $user->rights->societe->client->voir && ! $socid)
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
if ($socid)
@@ -199,12 +199,14 @@ if ($id > 0 || ! empty($ref)) {
print_barre_liste($langs->trans("SuppliersOrders"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
print '';
$i = 0;
print '';
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index b59bc008f17..2ae8164b0f9 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -190,12 +190,14 @@ if ($id > 0 || ! empty($ref))
print_barre_liste($langs->trans("CustomersInvoices"),$page,$_SERVER["PHP_SELF"],"&id=".$product->id,$sortfield,$sortorder,'',$num,$totalrecords,'');
print '';
$i = 0;
print '';
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 0feb415cc43..2e8e84621ba 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -191,12 +191,14 @@ if ($id > 0 || ! empty($ref))
print_barre_liste($langs->trans("SuppliersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
print '';
$i = 0;
print '';
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index 50d7c952b6d..10fd8247204 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -192,12 +192,14 @@ if ($id > 0 || ! empty($ref))
print_barre_liste($langs->trans("Proposals"), $page, $_SERVER["PHP_SELF"], "&id=$product->id", $sortfield, $sortorder, '', $num, $totalrecords, '');
print '';
$i = 0;
print '