diff --git a/htdocs/lib/databases/pgsql.lib.php b/htdocs/lib/databases/pgsql.lib.php
index e6ba0d6a4d4..b700e96b215 100644
--- a/htdocs/lib/databases/pgsql.lib.php
+++ b/htdocs/lib/databases/pgsql.lib.php
@@ -662,7 +662,7 @@ class DoliDb
*/
function ifsql($test,$resok,$resko)
{
- return 'IF('.$test.','.$resok.','.$resko.')';
+ return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)';
}
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 594f178941b..2377f8daa9e 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -98,18 +98,6 @@ if ($_GET["id"] || $_GET["ref"])
print '
| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '
';
- // Prix
- print '| '.$langs->trans("SellingPrice").' | ';
- if ($product->price_base_type == 'TTC')
- {
- print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
- }
- else
- {
- print price($product->price).' '.$langs->trans($product->price_base_type);
- }
- print ' |
';
-
// Statut
print '| '.$langs->trans("Status").' | ';
print $product->getLibStatut(2);
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index f7a539778a1..561754dac3c 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -93,18 +93,6 @@ if ($_GET["id"] || $_GET["ref"])
// Libelle
print ' |
| '.$langs->trans("Label").' | '.$product->libelle.' |
';
- // Prix
- print '| '.$langs->trans("SellingPrice").' | ';
- if ($product->price_base_type == 'TTC')
- {
- print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
- }
- else
- {
- print price($product->price).' '.$langs->trans($product->price_base_type);
- }
- print ' |
';
-
// Statut
print '| '.$langs->trans("Status").' | ';
print $product->getLibStatut(2);
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index d4701c0b155..e2ea1510be1 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -53,7 +53,7 @@ $offset = $conf->liste_limit * $_GET["page"] ;
$pageprev = $_GET["page"] - 1;
$pagenext = $_GET["page"] + 1;
if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="c.datec";
+if (! $sortfield) $sortfield="c.date_contrat";
/*
@@ -98,18 +98,6 @@ if ($_GET["id"] || $_GET["ref"])
print ' |
| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '
';
- // Prix
- print '| '.$langs->trans("SellingPrice").' | ';
- if ($product->price_base_type == 'TTC')
- {
- print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
- }
- else
- {
- print price($product->price).' '.$langs->trans($product->price_base_type);
- }
- print ' |
';
-
// Statut
print '| '.$langs->trans("Status").' | ';
print $product->getLibStatut(2);
@@ -121,11 +109,12 @@ if ($_GET["id"] || $_GET["ref"])
print '';
+ $now=dol_now();
$sql = "SELECT";
$sql.= ' sum('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
- $sql.= ' sum('.$db->ifsql("cd.statut=4 AND cd.date_fin_validite > ".$db->idate(mktime()),1,0).') as nb_running,';
- $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite <= ".$db->idate(mktime()).")",1,0).') as nb_late,';
+ $sql.= ' sum('.$db->ifsql("cd.statut=4 AND cd.date_fin_validite > '".$db->idate($now)."'",1,0).") as nb_running,";
+ $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite <= '".$db->idate($now)."')",1,0).') as nb_late,';
$sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,';
$sql.= " c.rowid as rowid, c.date_contrat, c.statut as statut,";
$sql.= " s.nom, s.rowid as socid, s.code_client";
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index 41b2bd5c56c..5b6b939b014 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -101,18 +101,6 @@ if ($_GET["id"] || $_GET["ref"])
print ' |
| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '
';
- // Prix
- print '| '.$langs->trans("SellingPrice").' | ';
- if ($product->price_base_type == 'TTC')
- {
- print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
- }
- else
- {
- print price($product->price).' '.$langs->trans($product->price_base_type);
- }
- print ' |
';
-
// Statut
print '| '.$langs->trans("Status").' | ';
print $product->getLibStatut(2);
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index 03fee24bbfe..1e72fdb05e2 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -95,18 +95,6 @@ if ($_GET["id"] || $_GET["ref"])
print ' |
| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '
';
- // Prix
- print '| '.$langs->trans("SellingPrice").' | ';
- if ($product->price_base_type == 'TTC')
- {
- print price($product->price_ttc).' '.$langs->trans($product->price_base_type);
- }
- else
- {
- print price($product->price).' '.$langs->trans($product->price_base_type);
- }
- print ' |
';
-
// Statut
print '| '.$langs->trans("Status").' | ';
print $product->getLibStatut(2);
|