* * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ * */ require("./pre.inc.php3"); llxHeader(); $db = new Db(); /* * * * TODO attention des sommes positives sont a consideres * * * exemple remboursement de frais de gestion par la banque * * * * */ if ($bid == 0) { /* * Liste */ print_titre("Budgets"); print ""; print ""; echo ''; print "\n"; $sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid "; $sql .= " FROM llx_bank_categ as c, llx_bank_class as l, llx_bank as d"; $sql .= " WHERE d.rowid=l.lineid AND c.rowid = l.fk_categ GROUP BY c.label, c.rowid ORDER BY c.label"; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); $i = 0; $total = 0; $var=True; while ($i < $num) { $objp = $db->fetch_object( $i); $var=!$var; print ""; print ""; print ""; print ""; print ""; print ""; print ""; $i++; $total = $total + abs($objp->somme); } $db->free(); print ''; print ''; print "\n"; } else { print $db->error(); } print "
DescriptionNbTotalMoyenne
rowid\">$objp->label$objp->nombre".price(abs($objp->somme))."".francs(abs($objp->somme))." FF".price(abs($objp->somme / $objp->nombre))."
Total'.price($total).' 
soit en francs".francs($total)." 
"; } else { /* * Vue */ $sql = "SELECT label FROM llx_bank_categ WHERE rowid=$bid"; if ( $db->query($sql) ) { if ( $db->num_rows() ) { $budget_name = $db->result(0,0); } $db->free(); } print_titre("Budget : $budget_name"); print ""; print ""; echo ''; print "\n"; $sql = "SELECT d.amount, d.label, ".$db->pdate("d.dateo")." as do, d.rowid"; $sql .= " FROM llx_bank_class as l, llx_bank as d"; $sql .= " WHERE d.rowid=l.lineid AND l.fk_categ=$bid ORDER by d.dateo DESC"; $result = $db->query($sql); if ($result) { $num = $db->num_rows(); $i = 0; $total = 0; $var=True; while ($i < $num) { $objp = $db->fetch_object( $i); $var=!$var; print ""; print "\n"; print ""; print ""; print ""; print ""; $i++; $total = $total + $objp->amount; } $db->free(); print ""; print "\n"; } else { print $db->error(); } print "
DateDescriptionMontant 
".strftime("%d %B %Y",$objp->do)."rowid\">$objp->label".price(abs($objp->amount))."".francs(abs($objp->amount))."
Total".price(abs($total))."euros
soit".francs(abs($total))."francs
"; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>