* Copyright (C) 2004-2005 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. * * $Id$ * $Source$ * */ /** \file htdocs/compta/bank/index.php \ingroup banque \brief Page accueil banque \version $Revision$ */ require("./pre.inc.php"); require("./bank.lib.php"); require("../../tva.class.php"); require("../../chargesociales.class.php"); $langs->load("banks"); $user->getrights('compta'); $user->getrights('banque'); if (!$user->rights->banque->lire) accessforbidden(); llxHeader(); print_titre($langs->trans("AccountsArea")); print '
'; // On charge tableau des comptes financiers $accounts = array(); $sql = "SELECT rowid, courant"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " ORDER BY label"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; while ($i < $num) { $objp = $db->fetch_object($result); $accounts[$objp->rowid] = $objp->courant; $i++; } $db->free($result); } /* * Comptes courants */ print ''; print ''; print ''; print "\n"; $total = 0; $var=true; foreach ($accounts as $key=>$type) { if ($type == 1) { $acc = new Account($db); $acc->fetch($key); $var = !$var; $solde = $acc->solde(); print ""; print ''; $total += $solde; } } // Total print ''; print ''; /* * Comptes placements */ print '
'.$langs->trans("CurrentAccounts").''.$langs->trans("Bank").''.$langs->trans("Numero").''.$langs->trans("BankBalance").''.$langs->trans("Closed").'
"; print ''.$acc->label.''; print "$acc->bank$acc->number'.price($solde).''.$yn[$acc->clos].'
'.$langs->trans("Total").''.price($total).' 
 
'; print ''; print ''; print "\n"; $total = 0; $var=true; foreach ($accounts as $key=>$type) { if ($type == 0) { $acc = new Account($db); $acc->fetch($key); $var = !$var; $solde = $acc->solde(); print ""; print ''; $total += $solde; } } // Total print ''; print ''; /* * Comptes caisse/liquide */ print '
'.$langs->trans("SavingAccounts").''.$langs->trans("Bank").''.$langs->trans("Numero").''.$langs->trans("BankBalance").''.$langs->trans("Closed").'
"; print ''.$acc->label.''; print "$acc->bank$acc->number'.price($solde).''.$yn[$acc->clos].'
'.$langs->trans("Total").''.price($total).' 
 
'; print ''; print ''; print "\n"; $total = 0; $var=true; foreach ($accounts as $key=>$type) { if ($type == 2) { $acc = new Account($db); $acc->fetch($key); $var = !$var; $solde = $acc->solde(); print ""; print ''; $total += $solde; } } // Total print ''; /* * Dettes */ print ''; print ''; // TVA if ($conf->compta->tva) { $var=true; $var = !$var; $tva = new Tva($db); $tva_solde = $tva->solde(); $total = $total + $tva_solde; print "".''; } // Charges sociales $var = !$var; $chs = new ChargeSociales($db); $chs_a_payer = $chs->solde(); $total = $total - $chs_a_payer; print "".''; // Total print ''; print "
'.$langs->trans("CashAccounts").'  '.$langs->trans("BankBalance").''.$langs->trans("Closed").'
"; print ''.$acc->label.''; print "$acc->bank '.price($solde).''.$yn[$acc->clos].'
'.$langs->trans("Total").''.price($total).' 
 
'.$langs->trans("Debts").'
'.$langs->trans("VAT").''.price($tva_solde).' 
'.$langs->trans("SocialContributions").''.price($chs_a_payer).' 
'.$langs->trans("Total").''.price($total).' 
"; /* * Boutons d'actions */ print "
\n"; if ($user->rights->banque->configurer) { print ''.$langs->trans("NewFinancialAccount").''; print ''.$langs->trans("Categories").''; } print "
"; $db->close(); llxFooter('$Date$ - $Revision$'); ?>