diff --git a/htdocs/telephonie/client/factures.php b/htdocs/telephonie/client/factures.php index 18caf491d88..2ce1f57145f 100644 --- a/htdocs/telephonie/client/factures.php +++ b/htdocs/telephonie/client/factures.php @@ -99,14 +99,15 @@ if ($_GET["id"]) $pageprev = $page - 1; $pagenext = $page + 1; - $sql = "SELECT f.rowid, f.date, f.ligne, f.fourn_montant, f.cout_vente, f.cout_vente_remise, f.gain, f.fk_facture"; + $sql = "SELECT f.rowid, f.date, sum(f.cout_vente) as cout_vente, f.fk_facture"; $sql .= " ,s.nom, s.idp"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as f"; $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " WHERE s.idp = l.fk_soc_facture AND l.rowid = f.fk_ligne"; - $sql .= " AND s.idp = ".$soc->id; + $sql .= " AND s.idp = ".$soc->id; + $sql .= " GROUP BY f.fk_facture"; $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); $resql = $db->query($sql); @@ -116,10 +117,9 @@ if ($_GET["id"]) $i = 0; print '
| Ligne | '; + print '||||||||
| Date | Montant HT | '; - print 'Coût fournisseur HT'; - print ' | Gain | Marge | Facture | '; + print 'Facture | '; print "||
| '.dolibarr_print_phone($obj->ligne)." | \n"; print ''.$obj->date." | \n"; - print ''.sprintf("%01.4f",$obj->cout_vente_remise)." | \n"; - print ''.sprintf("%01.4f",$obj->fourn_montant)." | \n"; - - print ''; - if ($obj->gain < 0 && $obj->cout_vente_remise) - { - print ''; - print sprintf("%01.2f",$obj->gain); - print ""; - } - else - { - print sprintf("%01.2f",$obj->gain); - } - print " | \n"; + print ''.sprintf("%01.4f",$obj->cout_vente)." | \n"; - print ''; - - print sprintf("%01.2f %%",($obj->gain / $obj->cout_vente_remise * 100)); - - print " | \n"; - - - print ''.$obj->fk_facture." | \n"; + print ''.$obj->fk_facture." | \n"; print "