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 ''; print ''; print ''; print ''; - print ''; + print ''; print "
'.$langs->trans("Ref").''.$product->ref.''.$langs->trans("Statistics").'
'.$langs->trans("Label").''.$product->libelle.''; - 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 '
Prix de vente'.price($product->price).'
'.$langs->trans("CurrentPrice").''.price($product->price).'
"; 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 ''; + print "\n"; + print ''; if ($objp->df > 0 ) { - print ""; } else { - print "\n"; + print "\n"; } - print "\n"; + print "\n"; - if (! $objp->paye) - { - print ''; - } - else - { - print ''; - } + $fac=new Facture($db); + print ''; print "\n"; $i++; } } } + else { + dolibarr_print_error($db); + } print "
 
'.$objp->nom.''.$objp->nom.'"; + print ""; print strftime("%d %B %Y",$objp->df)."!!!!!!".price($objp->amount)."".price($objp->amount)."impayée '.$fac->LibStatut($objp->paye,$objp->statut).'
"; $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 ''; print ''; print ''; print ''; - print ''; + print ''; print "
'.$langs->trans("Ref").''.$product->ref.''.$langs->trans("Statistics").'
'.$langs->trans("Label").''.$product->libelle.''; - 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 '
Prix de vente'.price($product->price).'
'.$langs->trans("CurrentPrice").''.price($product->price).'
"; 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 '\n"; - print ''; - print "'; + print ""; print "\n"; $i++; @@ -126,7 +140,7 @@ if ($_GET["id"]) } else { - print $db->error(); + dolibarr_print_error($db); } print "
'; print img_file(); print ' '; print $objp->ref; print "'.$objp->nom.'"; + print ''.$objp->nom.'"; print strftime("%d %B %Y",$objp->df)."
"; $db->free();