diff --git a/htdocs/compta/index.php3 b/htdocs/compta/index.php3 index ec4b09bd316..98c47da676d 100644 --- a/htdocs/compta/index.php3 +++ b/htdocs/compta/index.php3 @@ -49,7 +49,7 @@ print "

Brouillons

"; $sep = 0; $sept = 0; -$sql = "SELECT s.nom, s.idp, f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid "; +$sql = "SELECT s.nom,s.idp,f.facnumber,f.amount,".$db->pdate("f.datef")." as df,f.paye,f.rowid as facid"; $sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.fk_statut = 0"; if ($socidp) { @@ -68,16 +68,18 @@ $sql .= " ORDER BY f.fk_statut, f.paye, f.datef DESC "; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); + + $i = 0; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + if ($num > 0) { - $i = 0; - print "
[Tous]NuméroSocieteDateMontantPayéMoyenne
"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; $var=True; while ($i < $num) { $objp = $db->fetch_object( $i); @@ -160,6 +162,7 @@ print "

Valid $sep = 0; $sept = 0; +$subtotal=0; $sql = "SELECT s.nom, s.idp, f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.paye, f.rowid as facid "; $sql .= " FROM societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.fk_statut > 0"; @@ -180,26 +183,28 @@ $sql .= " ORDER BY f.paye, f.datef DESC "; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); + + $l=0; + $k=0; + print "

[Tous]NuméroSocieteDateMontantPayéMoyenne
"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + $var=True; if ($num > 0) { - $i = 0; - print "
[Tous]NuméroSocieteDateMontantPayéMoyenne
"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); + while ($l < $num) { + $objp = $db->fetch_object( $l); $var=!$var; if ($objp->paye && !$sep) { - print ""; print ""; - print ""; + print ""; print ""; print ""; @@ -208,7 +213,7 @@ if ($result) { print ""; print ""; print "\n"; - $sep = 1 ; $j = 0; + $sep = 1 ; $k = 0; $subtotal = 0; } @@ -239,23 +244,23 @@ if ($result) { $total = $total + $objp->amount; $subtotal = $subtotal + $objp->amount; print "\n"; - print "\n"; + print "\n"; print "\n"; - $i++; - $j++; + $l++; + $k++; } } - if ($i == 0) { $i=1; } if ($j == 0) { $j=1; } - print ""; print ""; - print ""; + print ""; - print ""; print ""; - print ""; + print ""; print "
[Tous]NuméroSocieteDateMontantPayéMoyenne
$i factures"; + print "
$l factures"; print "Total : ".francs($total)." FFSous Total : ".price($total)."euros HTMoyenne : ".price($total / ($i+1))."
Moyenne : ".price($total / ($l+1))."
[Tous]DateMontantPayéMoyenne
".$yn[$objp->paye]."".price($subtotal / ($j + 1))."".price($subtotal / ($k + 1))."
$j factures"; + if ($l == 0) { $l=1; } if ($k == 0) { $k=1; } + print "
$k factures"; print "Total : ".francs($subtotal)." FFSous Total : ".price($subtotal)."euros HTMoyenne : ".price($subtotal/ $j)."
Moyenne : ".price($subtotal/ $k)."
$i factures"; + print "
".($l+$i)." factures"; print "Total : ".francs($total)." FFTotal : ".price($total)."euros HTMoyenne : ".price($total/ $i)."
Moyenne : ".price($total/ ($l+$i))."
"; $db->free();