bugfix
This commit is contained in:
parent
281a48a77c
commit
8a035b5ccc
@ -26,7 +26,7 @@ require("./lib.inc.php");
|
|||||||
function propals ($db, $year, $month) {
|
function propals ($db, $year, $month) {
|
||||||
global $bc;
|
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 = "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 c.id in (1,2)";
|
||||||
$sql .= " AND date_format(p.datep, '%Y') = $year ";
|
$sql .= " AND date_format(p.datep, '%Y') = $year ";
|
||||||
$sql .= " AND round(date_format(p.datep, '%m')) = $month ";
|
$sql .= " AND round(date_format(p.datep, '%m')) = $month ";
|
||||||
@ -97,57 +97,66 @@ function factures ($db, $year, $month, $paye) {
|
|||||||
global $bc;
|
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 = "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 date_format(f.datef, '%Y') = $year ";
|
||||||
$sql .= " AND round(date_format(f.datef, '%m')) = $month ";
|
$sql .= " AND round(date_format(f.datef, '%m')) = $month ";
|
||||||
$sql .= " ORDER BY f.datef DESC ";
|
$sql .= " ORDER BY f.datef DESC ";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result) {
|
if ($result)
|
||||||
$num = $db->num_rows();
|
{
|
||||||
if ($num > 0) {
|
$num = $db->num_rows();
|
||||||
$i = 0;
|
if ($num > 0)
|
||||||
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
{
|
||||||
print "<TR bgcolor=\"orange\"><td colspan=\"3\"><b>Factures</b></td></tr>";
|
$i = 0;
|
||||||
print "<TR bgcolor=\"orange\">";
|
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
|
||||||
print "<TD>Societe</td>";
|
print "<TR bgcolor=\"orange\"><td colspan=\"3\"><b>Factures</b></td></tr>";
|
||||||
print "<TD>Num</TD>";
|
print "<TR bgcolor=\"orange\">";
|
||||||
print "<TD align=\"right\">Date</TD>";
|
print "<TD>Societe</td>";
|
||||||
print "<TD align=\"right\">Montant</TD>";
|
print "<TD>Num</TD>";
|
||||||
print "<TD align=\"right\">Payé</TD>";
|
print "<TD align=\"right\">Date</TD>";
|
||||||
print "</TR>\n";
|
print "<TD align=\"right\">Montant</TD>";
|
||||||
$var=True;
|
print "<TD align=\"right\">Payé</TD>";
|
||||||
while ($i < $num) {
|
print "</TR>\n";
|
||||||
$objp = $db->fetch_object( $i);
|
$var=True;
|
||||||
$var=!$var;
|
while ($i < $num)
|
||||||
print "<TR $bc[$var]>";
|
{
|
||||||
print "<TD><a href=\"comp.php?socidp=$objp->idp\">$objp->nom</a></TD>\n";
|
$objp = $db->fetch_object( $i);
|
||||||
print "<TD><a href=\"../facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
|
$var=!$var;
|
||||||
if ($objp->df > 0 ) {
|
print "<TR $bc[$var]>";
|
||||||
print "<TD align=\"right\">".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
print "<TD><a href=\"comp.php?socidp=$objp->idp\">$objp->nom</a></TD>\n";
|
||||||
} else {
|
print "<TD><a href=\"../facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
|
||||||
print "<TD align=\"right\"><b>!!!</b></TD>\n";
|
if ($objp->df > 0 )
|
||||||
|
{
|
||||||
|
print "<TD align=\"right\">".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<TD align=\"right\"><b>!!!</b></TD>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<TD align=\"right\">".price($objp->amount)."</TD>\n";
|
||||||
|
|
||||||
|
$payes[1] = "oui";
|
||||||
|
$payes[0] = "<b>non</b>";
|
||||||
|
|
||||||
|
print "<TD align=\"right\">".$payes[$objp->paye]."</TD>\n";
|
||||||
|
print "</TR>\n";
|
||||||
|
|
||||||
|
$total = $total + $objp->amount;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
print "<tr><td colspan=\"3\" align=\"right\"><b>Total ~ ".francs($total)." FF HT</b></td>";
|
||||||
|
print "<td align=\"right\"><b>Total : ".price($total)."</b></td><td></td></tr>";
|
||||||
|
print "</TABLE>";
|
||||||
|
$db->free();
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<TD align=\"right\">".price($objp->amount)."</TD>\n";
|
|
||||||
|
|
||||||
$payes[1] = "oui";
|
|
||||||
$payes[0] = "<b>non</b>";
|
|
||||||
|
|
||||||
|
|
||||||
print "<TD align=\"right\">".$payes[$objp->paye]."</TD>\n";
|
|
||||||
print "</TR>\n";
|
|
||||||
|
|
||||||
$total = $total + $objp->amount;
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
print "<tr><td colspan=\"3\" align=\"right\"><b>Total ~ ".francs($total)." FF HT</b></td>";
|
|
||||||
print "<td align=\"right\"><b>Total : ".price($total)."</b></td><td></td></tr>";
|
|
||||||
print "</TABLE>";
|
|
||||||
$db->free();
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
print $db->error();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ function propals ($db, $year, $month) {
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<TR $bc[$var]>";
|
print "<TR $bc[$var]>";
|
||||||
|
|
||||||
print "<TD><a href=\"comp.php3?socidp=$objp->idp\">$objp->nom</a></TD>\n";
|
print "<TD><a href=\"comp.php?socidp=$objp->idp\">$objp->nom</a></TD>\n";
|
||||||
|
|
||||||
print "<TD><a href=\"../comm/propal.php3?propalid=$objp->propalid\">$objp->ref</a></TD>\n";
|
print "<TD><a href=\"../comm/propal.php3?propalid=$objp->propalid\">$objp->ref</a></TD>\n";
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ function factures ($db, $year, $month, $paye) {
|
|||||||
$objp = $db->fetch_object( $i);
|
$objp = $db->fetch_object( $i);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<TR $bc[$var]>";
|
print "<TR $bc[$var]>";
|
||||||
print "<TD><a href=\"comp.php3?socidp=$objp->idp\">$objp->nom</a></TD>\n";
|
print "<TD><a href=\"comp.php?socidp=$objp->idp\">$objp->nom</a></TD>\n";
|
||||||
print "<TD><a href=\"facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
|
print "<TD><a href=\"facture.php3?facid=$objp->facid\">$objp->facnumber</a></TD>\n";
|
||||||
if ($objp->df > 0 ) {
|
if ($objp->df > 0 ) {
|
||||||
print "<TD align=\"right\">".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
print "<TD align=\"right\">".strftime("%d %B %Y",$objp->df)."</TD>\n";
|
||||||
@ -182,7 +182,7 @@ function pt ($db, $sql, $year) {
|
|||||||
|
|
||||||
if ($obj->sum > 0) {
|
if ($obj->sum > 0) {
|
||||||
print "<TR $bc[$var]>";
|
print "<TR $bc[$var]>";
|
||||||
print "<td><a href=\"comp.php3?details=1&year=$year&month=$obj->dm\">";
|
print "<td><a href=\"comp.php?details=1&year=$year&month=$obj->dm\">";
|
||||||
print strftime("%B",mktime(12,0,0,$obj->dm, 1, $year))."</TD>\n";
|
print strftime("%B",mktime(12,0,0,$obj->dm, 1, $year))."</TD>\n";
|
||||||
print "<TD align=\"right\">".price($obj->sum)."</TD>\n";
|
print "<TD align=\"right\">".price($obj->sum)."</TD>\n";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user