code cleaning

This commit is contained in:
Rodolphe Quiedeville 2003-03-18 18:36:42 +00:00
parent bcc0fd244a
commit 3815c2157b

View File

@ -1,6 +1,5 @@
<?PHP <?PHP
/******************************************************************************** /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,30 +18,30 @@
* $Id$ * $Id$
* $Source$ * $Source$
* *
*******************************************************************************/ */
require("./pre.inc.php3"); require("./pre.inc.php3");
llxHeader(); llxHeader();
$db = new Db(); $db = new Db();
$bc[0]="bgcolor=\"#90c090\""; if ($action == 'class')
$bc[1]="bgcolor=\"#b0e0b0\""; {
if ($action == 'class') {
$author = $GLOBALS["REMOTE_USER"]; $author = $GLOBALS["REMOTE_USER"];
$sql = "INSERT INTO llx_bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)"; $sql = "INSERT INTO llx_bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)";
$result = $db->query($sql); $result = $db->query($sql);
} }
if ($action == 'update') { if ($action == 'update')
{
$author = $GLOBALS["REMOTE_USER"]; $author = $GLOBALS["REMOTE_USER"];
$sql = "update llx_bank set label='$label' where rowid = $rowid;"; $sql = "update llx_bank set label='$label' where rowid = $rowid;";
$result = $db->query($sql); $result = $db->query($sql);
} }
if ($action == 'type') { if ($action == 'type')
{
$author = $GLOBALS["REMOTE_USER"]; $author = $GLOBALS["REMOTE_USER"];
$sql = "update llx_bank set fk_type='$value' where rowid = $rowid;"; $sql = "update llx_bank set fk_type='$value' where rowid = $rowid;";
$result = $db->query($sql); $result = $db->query($sql);
@ -51,12 +50,14 @@ if ($action == 'type') {
$sql = "SELECT rowid, label FROM llx_bank_categ;"; $sql = "SELECT rowid, label FROM llx_bank_categ;";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
{
$var=True; $var=True;
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $i = 0;
$options = "<option value=\"0\" SELECTED></option>"; $options = "<option value=\"0\" SELECTED></option>";
while ($i < $num) { while ($i < $num)
{
$obj = $db->fetch_object($i); $obj = $db->fetch_object($i);
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++; $options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $i++;
} }
@ -78,11 +79,13 @@ $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rap
$sql .= " FROM llx_bank as b WHERE rowid=$rowid"; $sql .= " FROM llx_bank as b WHERE rowid=$rowid";
$sql .= " ORDER BY dateo ASC"; $sql .= " ORDER BY dateo ASC";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
{
$var=True; $var=True;
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $total = 0; $i = 0; $total = 0;
while ($i < $num) { while ($i < $num)
{
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$total = $total + $objp->amount; $total = $total + $objp->amount;
@ -94,9 +97,12 @@ if ($result) {
print "<td>".strftime("%d %b %Y",$objp->do)."</TD>\n"; print "<td>".strftime("%d %b %Y",$objp->do)."</TD>\n";
print "<td>$objp->label</td>"; print "<td>$objp->label</td>";
if ($objp->amount < 0) { if ($objp->amount < 0)
{
print "<td align=\"right\">".price($objp->amount * -1)."</TD><td>&nbsp;</td>\n"; print "<td align=\"right\">".price($objp->amount * -1)."</TD><td>&nbsp;</td>\n";
} else { }
else
{
print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</TD>\n"; print "<td>&nbsp;</td><td align=\"right\">".price($objp->amount)."</TD>\n";
} }
@ -163,11 +169,13 @@ $sql = "SELECT c.label, c.rowid";
$sql .= " FROM llx_bank_class as a, llx_bank_categ as c WHERE a.lineid=$rowid AND a.fk_categ = c.rowid "; $sql .= " FROM llx_bank_class as a, llx_bank_categ as c WHERE a.lineid=$rowid AND a.fk_categ = c.rowid ";
$sql .= " ORDER BY c.label"; $sql .= " ORDER BY c.label";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result)
{
$var=True; $var=True;
$num = $db->num_rows(); $num = $db->num_rows();
$i = 0; $total = 0; $i = 0; $total = 0;
while ($i < $num) { while ($i < $num)
{
$objp = $db->fetch_object( $i); $objp = $db->fetch_object( $i);
$var=!$var; $var=!$var;
@ -184,8 +192,6 @@ if ($result) {
print "</table>"; print "</table>";
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");