diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index a69b0128ffc..1c0bb2bbfc2 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -22,6 +22,8 @@
*/
require("./pre.inc.php");
+require_once("../../facture.class.php");
+
$mesg = '';
@@ -47,16 +49,29 @@ if ($_GET["id"])
{
print_fiche_titre('Fiche produit : '.$product->ref, $mesg);
- print '
';
+ print '';
print '| '.$langs->trans("Ref").' | '.$product->ref.' | ';
print ''.$langs->trans("Statistics").' |
';
print '| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '';
- print "Propositions commerciales : ".$product->count_propale($socid);
- print " Proposé à ".$product->count_propale_client($socid)." clients";
- print " Factures : ".$product->count_facture($socid);
+ // Propals
+ if ($conf->propal->enabled) {
+ $langs->load("propal");
+ print ''.$langs->trans("Proposals").' : '.$product->count_propale($socid);
+ print " (Proposé à ".$product->count_propale_client($socid)." clients) ";
+ }
+ // Commande
+ if ($conf->commande->enabled) {
+ $langs->load("orders");
+ print ''.$langs->trans("Orders").' : '.$product->count_facture($socid)." ";
+ }
+ // Factures
+ if ($conf->facture->enabled) {
+ $langs->load("bills");
+ print ''.$langs->trans("Bills").' : '.$product->count_facture($socid);
+ }
print ' |
';
- print '| Prix de vente | '.price($product->price).' |
';
+ print '| '.$langs->trans("CurrentPrice").' | '.price($product->price).' |
';
print "
";
if ($page == -1)
@@ -75,9 +90,10 @@ if ($_GET["id"])
$sortfield="f.datef";
}
+ print "
";
print_barre_liste("Factures",$page,"facture.php","&id=$product->id",$sortfield,$sortorder);
- $sql = "SELECT distinct(f.rowid), s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid";
+ $sql = "SELECT distinct(f.rowid), s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.fk_statut as statut,f.rowid as facid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as d WHERE f.fk_soc = s.idp";
$sql .= " AND d.fk_facture = f.rowid AND d.fk_product =".$product->id;
if ($socid)
@@ -92,13 +108,13 @@ if ($_GET["id"])
$num = $db->num_rows();
$i = 0;
- print "";
+ print "";
print '';
- print_liste_field_titre($langs->trans("Ref"),"facture.php","s.nom","","&socidp=$socidp");
- print_liste_field_titre($langs->trans("Company"),"facture.php","s.nom","","&socidp=$socidp");
- print_liste_field_titre($langs->trans("Date"),"facture.php","f.datef","","&socidp=$socidp",'align="right"');
- print_liste_field_titre($langs->trans("Amount"),"facture.php","f.amount","","&socidp=$socidp",'align="right"');
+ print_liste_field_titre($langs->trans("Ref"),"facture.php","s.idp","","&id=".$_GET["id"],'',$sortfield);
+ print_liste_field_titre($langs->trans("Company"),"facture.php","s.nom","","&id=".$_GET["id"],'',$sortfield);
+ print_liste_field_titre($langs->trans("Date"),"facture.php","f.datef","","&id=".$_GET["id"],'align="right"',$sortfield);
+ print_liste_field_titre($langs->trans("Amount"),"facture.php","f.amount","","&id=".$_GET["id"],'align="right"',$sortfield);
print '| | ';
print "
\n";
@@ -120,35 +136,32 @@ if ($_GET["id"])
{
print ''.$objp->facnumber.'';
}
- print "\n";
- print ''.$objp->nom.' | ';
+ print "\n";
+ print ''.$objp->nom.' | ';
if ($objp->df > 0 )
{
- print "";
+ print " | ";
print strftime("%d %B %Y",$objp->df)." | ";
}
else
{
- print "!!! | \n";
+ print "!!! | \n";
}
- print "".price($objp->amount)." | \n";
+ print "".price($objp->amount)." | \n";
- if (! $objp->paye)
- {
- print 'impayée | ';
- }
- else
- {
- print ' | ';
- }
+ $fac=new Facture($db);
+ print ''.$fac->LibStatut($objp->paye,$objp->statut).' | ';
print "\n";
$i++;
}
}
}
+ else {
+ dolibarr_print_error($db);
+ }
print "
";
$db->free();
}
diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php
index 82e1bc82e3d..9cb36956fef 100644
--- a/htdocs/product/stats/fiche.php
+++ b/htdocs/product/stats/fiche.php
@@ -144,9 +144,22 @@ if ($_GET["id"])
print ''.$langs->trans("Statistics").' | ';
print "| ".$langs->trans("Label")." | $product->libelle | ";
print '';
- print 'Propositions commerciales : '.$product->count_propale($socid);
- print " Proposé à ".$product->count_propale_client($socid)." clients";
- print ' '.$langs->trans("Bills").' : '.$product->count_facture($socid);
+ // Propals
+ if ($conf->propal->enabled) {
+ $langs->load("propal");
+ print ''.$langs->trans("Proposals").' : '.$product->count_propale($socid);
+ print " (Proposé à ".$product->count_propale_client($socid)." clients) ";
+ }
+ // Commande
+ if ($conf->commande->enabled) {
+ $langs->load("orders");
+ print ''.$langs->trans("Orders").' : '.$product->count_facture($socid)." ";
+ }
+ // Factures
+ if ($conf->facture->enabled) {
+ $langs->load("bills");
+ print ''.$langs->trans("Bills").' : '.$product->count_facture($socid);
+ }
print ' |
';
print '| '.$langs->trans("CurrentPrice").' | '.price($product->price).' |
';
print "
";
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index 51a84966d0a..8d485cb1a81 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -47,16 +47,29 @@ if ($_GET["id"])
{
print_fiche_titre('Fiche produit : '.$product->ref, $mesg);
- print '';
+ print '';
print '| '.$langs->trans("Ref").' | '.$product->ref.' | ';
print ''.$langs->trans("Statistics").' |
';
print '| '.$langs->trans("Label").' | '.$product->libelle.' | ';
print '';
- print "Propositions commerciales : ".$product->count_propale($socid);
- print " Proposé à ".$product->count_propale_client($socid)." clients";
- print " Factures : ".$product->count_facture($socid);
+ // Propals
+ if ($conf->propal->enabled) {
+ $langs->load("propal");
+ print ''.$langs->trans("Proposals").' : '.$product->count_propale($socid);
+ print " (Proposé à ".$product->count_propale_client($socid)." clients) ";
+ }
+ // Commande
+ if ($conf->commande->enabled) {
+ $langs->load("orders");
+ print ''.$langs->trans("Orders").' : '.$product->count_facture($socid)." ";
+ }
+ // Factures
+ if ($conf->facture->enabled) {
+ $langs->load("bills");
+ print ''.$langs->trans("Bills").' : '.$product->count_facture($socid);
+ }
print ' |
';
- print '| Prix de vente | '.price($product->price).' |
';
+ print '| '.$langs->trans("CurrentPrice").' | '.price($product->price).' |
';
print "
";
if ($page == -1)
@@ -75,6 +88,7 @@ if ($_GET["id"])
$sortfield="p.datep";
}
+ print "
";
print_barre_liste("Propositions commerciales",$page,"propal.php","&id=$product->id",$sortfield,$sortorder);
$sql = "SELECT distinct(p.rowid), s.nom,s.idp, p.ref,".$db->pdate("p.datep")." as df,p.rowid as facid";
@@ -97,9 +111,9 @@ if ($_GET["id"])
$i = 0;
print "";
print '';
- print_liste_field_titre($langs->trans("Ref"),"propal.php","p.rowid","","&id=$product->id&socidp=$socidp");
- print_liste_field_titre($langs->trans("Company"),"propal.php","s.nom","","&id=$product->id&socidp=$socidp");
- print_liste_field_titre($langs->trans("Date")"Date","propal.php","f.datef","","&id=$product->id&socidp=$socidp",'align="right"');
+ print_liste_field_titre($langs->trans("Ref"),"propal.php","p.rowid","","&id=".$_GET["id"],'',$sortfield);
+ print_liste_field_titre($langs->trans("Company"),"propal.php","s.nom","","&id=".$_GET["id"],'',$sortfield);
+ print_liste_field_titre($langs->trans("Date"),"propal.php","f.datef","","&id=".$_GET["id"],'align="right"',$sortfield);
print "
\n";
if ($num > 0)
@@ -110,14 +124,14 @@ if ($_GET["id"])
$objp = $db->fetch_object( $i);
$var=!$var;
- print "";
+ print "
";
print '| ';
print img_file();
print ' ';
print $objp->ref;
print " | \n";
- print ''.$objp->nom.' | ';
- print "";
+ print ' | '.$objp->nom.' | ';
+ print "";
print strftime("%d %B %Y",$objp->df)." | ";
print "
\n";
$i++;
@@ -126,7 +140,7 @@ if ($_GET["id"])
}
else
{
- print $db->error();
+ dolibarr_print_error($db);
}
print "
";
$db->free();