diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index 9c3fb7d861f..3f0a02a81e0 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -26,7 +26,7 @@ require("./lib.inc.php"); function propals ($db, $year, $month) { global $bc; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price - p.remise as price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; - $sql .= " FROM societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; + $sql .= " FROM llx_societe as s, llx_propal as p, c_propalst as c WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; $sql .= " AND c.id in (1,2)"; $sql .= " AND date_format(p.datep, '%Y') = $year "; $sql .= " AND round(date_format(p.datep, '%m')) = $month "; @@ -97,57 +97,66 @@ function factures ($db, $year, $month, $paye) { global $bc; $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.paye = $paye"; + $sql .= " FROM llx_societe as s,llx_facture as f WHERE f.fk_soc = s.idp AND f.paye = $paye"; $sql .= " AND date_format(f.datef, '%Y') = $year "; $sql .= " AND round(date_format(f.datef, '%m')) = $month "; $sql .= " ORDER BY f.datef DESC "; $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - if ($num > 0) { - $i = 0; - print "

"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - if ($objp->df > 0 ) { - print "\n"; - } else { - print "\n"; + if ($result) + { + $num = $db->num_rows(); + if ($num > 0) + { + $i = 0; + print "

Factures
SocieteNumDateMontantPayé
idp\">$objp->nomfacid\">$objp->facnumber".strftime("%d %B %Y",$objp->df)."!!!
"; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print "\n"; + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + if ($objp->df > 0 ) + { + print "\n"; + } + else + { + print "\n"; + } + + print "\n"; + + $payes[1] = "oui"; + $payes[0] = "non"; + + print "\n"; + print "\n"; + + $total = $total + $objp->amount; + + $i++; + } + print ""; + print ""; + print "
Factures
SocieteNumDateMontantPayé
idp\">$objp->nomfacid\">$objp->facnumber".strftime("%d %B %Y",$objp->df)."!!!".price($objp->amount)."".$payes[$objp->paye]."
Total ~ ".francs($total)." FF HTTotal : ".price($total)."
"; + $db->free(); } - - print "".price($objp->amount)."\n"; - - $payes[1] = "oui"; - $payes[0] = "non"; - - - print "".$payes[$objp->paye]."\n"; - print "\n"; - - $total = $total + $objp->amount; - - $i++; - } - print "Total ~ ".francs($total)." FF HT"; - print "Total : ".price($total).""; - print ""; - $db->free(); } - } + else + { + print $db->error(); + } } diff --git a/htdocs/compta/stats/exercices.php b/htdocs/compta/stats/exercices.php index 9239b75eeee..34c4b93a1af 100644 --- a/htdocs/compta/stats/exercices.php +++ b/htdocs/compta/stats/exercices.php @@ -67,7 +67,7 @@ function propals ($db, $year, $month) { $var=!$var; print ""; - print "idp\">$objp->nom\n"; + print "idp\">$objp->nom\n"; print "propalid\">$objp->ref\n"; @@ -121,7 +121,7 @@ function factures ($db, $year, $month, $paye) { $objp = $db->fetch_object( $i); $var=!$var; print ""; - print "idp\">$objp->nom\n"; + print "idp\">$objp->nom\n"; print "facid\">$objp->facnumber\n"; if ($objp->df > 0 ) { print "".strftime("%d %B %Y",$objp->df)."\n"; @@ -182,7 +182,7 @@ function pt ($db, $sql, $year) { if ($obj->sum > 0) { print ""; - print "dm\">"; + print "dm\">"; print strftime("%B",mktime(12,0,0,$obj->dm, 1, $year))."\n"; print "".price($obj->sum)."\n";