code cleaning
This commit is contained in:
Rodolphe Quiedeville 2003-06-24 20:53:25 +00:00
parent 043dba868c
commit 72c56ce676

View File

@ -39,13 +39,16 @@ $db = new Db();
if ($action == 'setstatut') if ($action == 'setstatut')
{ {
/* /*
* Cloture de la propale * Classée la facture comme facturée
*/ */
$propal = new Propal($db); $propal = new Propal($db);
$propal->id = $propalid; $propal->id = $propalid;
$propal->cloture($user->id, $statut, $note); $propal->cloture($user->id, $statut, $note);
} elseif ( $action == 'delete' ) { }
if ( $action == 'delete' )
{
$sql = "DELETE FROM llx_propal WHERE rowid = $propalid;"; $sql = "DELETE FROM llx_propal WHERE rowid = $propalid;";
if ( $db->query($sql) ) { if ( $db->query($sql) ) {
@ -63,6 +66,7 @@ if ($action == 'setstatut')
$propalid = 0; $propalid = 0;
$brouillon = 1; $brouillon = 1;
} }
/* /*
* *
* Mode fiche * Mode fiche
@ -100,9 +104,9 @@ if ($propalid)
$color1 = "#e0e0e0"; $color1 = "#e0e0e0";
print "<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"100%\">"; print '<table border="1" cellspacing="0" cellpadding="2" width="100%">';
print '<tr><td>'.translate("Company").'</td><td colspan="2"><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>'; print '<tr><td>Société</td><td colspan="2"><a href="fiche.php3?socid='.$obj->idp.'">'.$obj->nom.'</a></td>';
print "<td valign=\"top\" width=\"50%\" rowspan=\"8\">Note :<br>". nl2br($obj->note)."</td></tr>"; print "<td valign=\"top\" width=\"50%\" rowspan=\"8\">Note :<br>". nl2br($obj->note)."</td></tr>";
// //
@ -146,9 +150,9 @@ if ($propalid)
* *
*/ */
print "<tr><td>PDF</a></td>"; print "<tr><td>PDF</a></td>";
$file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf"; $file = PROPALE_OUTPUTDIR. "/$obj->ref/$obj->ref.pdf";
if (file_exists($file)) { if (file_exists($file)) {
print '<td colspan="2"><a href="'.$conf->propal->outputurl.'/'.$obj->ref.'/'.$obj->ref.'.pdf">'.$obj->ref.'.pdf</a></td></tr>'; print '<td colspan="2"><a href="'.PROPALE_OUTPUT_URL.'/'.$obj->ref.'/'.$obj->ref.'.pdf">'.$obj->ref.'.pdf</a></td></tr>';
} }
print '</tr>'; print '</tr>';
/* /*
@ -161,7 +165,8 @@ if ($propalid)
print "</table>"; print "</table>";
if ($action == 'statut') { if ($action == 'statut')
{
print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">"; print "<form action=\"$PHP_SELF?propalid=$propalid\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">"; print "<input type=\"hidden\" name=\"action\" value=\"setstatut\">";
print "<select name=\"statut\">"; print "<select name=\"statut\">";
@ -183,31 +188,54 @@ if ($propalid)
/* /*
* Factures associees * Factures associees
*/ */
$sql = "SELECT f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.rowid as facid, f.author, f.paye"; $sql = "SELECT f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.rowid as facid, f.fk_user_author, f.paye";
$sql .= " FROM llx_facture as f, llx_fa_pr as fp WHERE fp.fk_facture = f.rowid AND fp.fk_propal = $propalid"; $sql .= " FROM llx_facture as f, llx_fa_pr as fp WHERE fp.fk_facture = f.rowid AND fp.fk_propal = $propalid";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
{
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $total = 0; $i = 0; $total = 0;
print "<br><b>Facture(s) associée(s)</b><TABLE border=\"1\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">"; print "<br>";
if ($num > 1)
{
print_titre("Factures associées");
}
else
{
print_titre("Facture associée");
}
print '<table border="1" width="100%" cellspacing="0" cellpadding="3">';
print "<tr>"; print "<tr>";
print "<td>Num</td>"; print "<td>Num</td>";
print "<td>Date</td>"; print "<td>Date</td>";
print "<td>Auteur</td>"; print "<td>Auteur</td>";
print "<td align=\"right\">Prix</TD>"; print '<td align="right">Prix</td>';
print "</TR>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) { while ($i < $num)
{
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$var=!$var; $var=!$var;
print "<TR bgcolor=\"#e0e0e0\">"; print "<TR bgcolor=\"#e0e0e0\">";
print "<TD><a href=\"../compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a>"; print "<TD><a href=\"../compta/facture.php3?facid=$objp->facid\">$objp->facnumber</a>";
if ($objp->paye) { print " (<b>pay&eacute;e</b>)"; } if ($objp->paye)
{
print " (<b>pay&eacute;e</b>)";
}
print "</TD>\n"; print "</TD>\n";
print "<TD>".strftime("%d %B %Y",$objp->df)."</TD>\n"; print "<TD>".strftime("%d %B %Y",$objp->df)."</td>\n";
print "<TD>$objp->author</TD>\n"; if ($objp->fk_user_author <> $user->id)
{
$fuser = new User($db, $objp->fk_user_author);
$fuser->fetch();
print "<td>".$fuser->fullname."</td>\n";
}
else
{
print "<td>".$user->fullname."</td>\n";
}
print '<TD align="right">'.price($objp->amount).'</TD>'; print '<TD align="right">'.price($objp->amount).'</TD>';
print "</tr>"; print "</tr>";
$total = $total + $objp->amount; $total = $total + $objp->amount;
@ -226,7 +254,7 @@ if ($propalid)
if ($obj->statut == 2) if ($obj->statut == 2)
{ {
print '<td bgcolor="#e0e0e0" align="center" width=\"25%\">'; print '<td bgcolor="#e0e0e0" align="center" width="25%">';
print "<a href=\"facture.php3?propalid=$propalid&action=create\">Emettre une facture</td>"; print "<a href=\"facture.php3?propalid=$propalid&action=create\">Emettre une facture</td>";
} }
else else