* Copyright (C) 2004-2008 Laurent Destailleur * * 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. */ /** \file htdocs/compta/bank/budget.php \ingroup banque \brief Page de budget \version $Id$ */ require("./pre.inc.php"); $langs->load("categories"); if (!$user->rights->banque->lire) accessforbidden(); /* * Affichage page * */ $companystatic=new Societe($db); llxHeader(); // List movements bu category for bank transactions print_fiche_titre($langs->trans("BankTransactionByCategories")); print ''; print ""; print ''; print ''; print ''; print ''; print "\n"; $sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid "; $sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as c, ".MAIN_DB_PREFIX."bank_class as l, ".MAIN_DB_PREFIX."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($result); $i = 0; $total = 0; $var=true; while ($i < $num) { $objp = $db->fetch_object($result); $var=!$var; print ""; print ""; print ''; print '"; print '"; print ""; $i++; $total = $total + abs($objp->somme); } $db->free($result); print ''; print ''; } else { dolibarr_print_error($db); } print "
'.$langs->trans("Rubrique").''.$langs->trans("Nb").''.$langs->trans("Total").''.$langs->trans("Average").'
rowid\">$objp->label'.$objp->nombre.''.price(abs($objp->somme))."'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."
'.$langs->trans("Total").''.price($total).' 
"; $db->close(); llxFooter('$Date$ - $Revision$'); ?>