* Copyright (C) 2004-2006 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_once(DOL_DOCUMENT_ROOT."/lib/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(); $statut=isset($_GET["statut"])?$_GET["statut"]:''; llxHeader(); $link=''; if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; print_fiche_titre($langs->trans("AccountsArea"),$link); print '
'; // On charge tableau des comptes financiers (ouverts par defaut) $accounts = array(); $sql = "SELECT rowid, courant, rappro"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; if ($statut != 'all') { $sql .= " WHERE clos = 0"; } $sql .= " ORDER BY label"; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; while ($i < $num) { $objp = $db->fetch_object($resql); $accounts[$objp->rowid] = $objp->courant; $i++; } $db->free($resql); } /* * Comptes courants */ print ''; print ''; print ''; print ''; 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 ''; print ''; print ''; print ''; print ''; print ''; print ''; $total += $solde; } } // Total print ''; print ''; /* * Comptes placements */ print ''; print ''; print ''; print ''; print ''; 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 ''; print ''; print ''; print ''; print ''; print ''; print ''; $total += $solde; } } // Total print ''; print ''; /* * Comptes caisse/liquide */ print ''; print ''; print ''; 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 ''; print ''; print ''; print ''; print ''; print ''; print ''; $total += $solde; } } // Total print ''; print "
'.$langs->trans("CurrentAccounts").''.$langs->trans("Bank").''.$langs->trans("AccountIdShort").''.$langs->trans("Conciliable").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
'.$acc->getNomUrl(1).''.$acc->bank.''.$acc->number.''.yn($acc->rappro).''.$acc->getLibStatut(2).''; print ''.price($solde).''; print '
 '.$langs->trans("Total").''.price($total).'
 
'.$langs->trans("SavingAccounts").''.$langs->trans("Bank").''.$langs->trans("Numero").''.$langs->trans("Conciliable").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
'.$acc->getNomUrl(1).''.$acc->bank.''.$acc->number.''.yn($acc->rappro).''.$acc->getLibStatut(2).''; print ''.price($solde).''; print '
 '.$langs->trans("Total").''.price($total).'
 
'.$langs->trans("CashAccounts").'   '.$langs->trans("Status").''.$langs->trans("BankBalance").'
'.$acc->getNomUrl(1).''.$acc->bank.'  '.$acc->getLibStatut(2).''; print ''.price($solde).''; print '
 '.$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$'); ?>