2004-10-19 22:35:36 +02:00
|
|
|
<?php
|
2005-08-02 16:52:04 +02:00
|
|
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2011-07-20 21:03:31 +02:00
|
|
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copytight (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
2002-05-11 20:52:36 +02:00
|
|
|
*
|
|
|
|
|
* 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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-05-11 20:52:36 +02:00
|
|
|
* (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
|
2011-08-01 00:21:57 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2002-05-11 20:52:36 +02:00
|
|
|
*/
|
2004-11-26 01:16:52 +01:00
|
|
|
|
2005-02-14 21:26:23 +01:00
|
|
|
/**
|
2009-01-02 17:43:58 +01:00
|
|
|
* \file htdocs/compta/bank/index.php
|
|
|
|
|
* \ingroup banque
|
2011-12-30 00:33:34 +01:00
|
|
|
* \brief Home page of bank module
|
2009-01-02 17:43:58 +01:00
|
|
|
*/
|
2004-11-26 01:16:52 +01:00
|
|
|
|
2013-04-15 13:11:29 +02:00
|
|
|
require('../../main.inc.php');
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
2013-06-05 16:24:32 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|
|
|
|
|
|
|
|
|
$langs->load("banks");
|
|
|
|
|
$langs->load("categories");
|
2005-02-14 21:26:23 +01:00
|
|
|
|
2009-05-05 14:43:51 +02:00
|
|
|
// Security check
|
|
|
|
|
if ($user->societe_id) $socid=$user->societe_id;
|
|
|
|
|
$result=restrictedArea($user,'banque');
|
2003-11-05 10:59:16 +01:00
|
|
|
|
2012-10-13 10:39:16 +02:00
|
|
|
$statut=GETPOST('statut');
|
2005-08-13 19:55:18 +02:00
|
|
|
|
|
|
|
|
|
2008-09-04 21:47:46 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
2011-12-30 00:33:34 +01:00
|
|
|
$help_url='EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas';
|
|
|
|
|
llxHeader('',$langs->trans('AccountsArea'),$help_url);
|
2002-05-11 20:52:36 +02:00
|
|
|
|
2005-08-13 19:55:18 +02:00
|
|
|
$link='';
|
|
|
|
|
if ($statut == '') $link='<a href="'.$_SERVER["PHP_SELF"].'?statut=all">'.$langs->trans("IncludeClosedAccount").'</a>';
|
|
|
|
|
if ($statut == 'all') $link='<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("OnlyOpenedAccount").'</a>';
|
|
|
|
|
print_fiche_titre($langs->trans("AccountsArea"),$link);
|
2004-06-09 19:50:28 +02:00
|
|
|
print '<br>';
|
2002-05-11 20:52:36 +02:00
|
|
|
|
2005-05-07 23:56:12 +02:00
|
|
|
|
2005-08-13 19:55:18 +02:00
|
|
|
// On charge tableau des comptes financiers (ouverts par defaut)
|
2005-05-07 23:56:12 +02:00
|
|
|
$accounts = array();
|
|
|
|
|
|
2005-09-17 02:14:36 +02:00
|
|
|
$sql = "SELECT rowid, courant, rappro";
|
2009-05-05 14:43:51 +02:00
|
|
|
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
2013-07-19 09:19:20 +02:00
|
|
|
$sql.= " WHERE entity IN (".getEntity('bank_account', 1).")";
|
2009-05-05 14:43:51 +02:00
|
|
|
if ($statut != 'all') $sql.= " AND clos = 0";
|
|
|
|
|
$sql.= $db->order('label', 'ASC');
|
2002-05-11 20:52:36 +02:00
|
|
|
|
2005-08-02 16:52:04 +02:00
|
|
|
$resql = $db->query($sql);
|
|
|
|
|
if ($resql)
|
2003-08-26 12:10:42 +02:00
|
|
|
{
|
2009-01-02 17:43:58 +01:00
|
|
|
$num = $db->num_rows($resql);
|
|
|
|
|
$i = 0;
|
|
|
|
|
while ($i < $num)
|
|
|
|
|
{
|
|
|
|
|
$objp = $db->fetch_object($resql);
|
|
|
|
|
$accounts[$objp->rowid] = $objp->courant;
|
|
|
|
|
$i++;
|
|
|
|
|
}
|
|
|
|
|
$db->free($resql);
|
2002-05-11 20:52:36 +02:00
|
|
|
}
|
|
|
|
|
|
2005-05-07 23:56:12 +02:00
|
|
|
|
2004-02-15 19:42:02 +01:00
|
|
|
/*
|
2009-01-02 17:43:58 +01:00
|
|
|
* Comptes courants (courant = 1)
|
2004-02-15 19:42:02 +01:00
|
|
|
*/
|
2011-07-20 21:03:31 +02:00
|
|
|
print '<table class="liste" width="100%">';
|
2005-08-07 01:19:54 +02:00
|
|
|
print '<tr class="liste_titre"><td width="30%">'.$langs->trans("CurrentAccounts").'</td>';
|
2005-08-13 19:55:18 +02:00
|
|
|
print '<td width="20%">'.$langs->trans("Bank").'</td>';
|
2005-09-17 02:14:36 +02:00
|
|
|
print '<td align="left">'.$langs->trans("AccountIdShort").'</td>';
|
2007-11-04 22:35:24 +01:00
|
|
|
print '<td align="center">'.$langs->trans("TransactionsToConciliate").'</td>';
|
2005-09-17 02:14:36 +02:00
|
|
|
print '<td align="center" width="70">'.$langs->trans("Status").'</td>';
|
|
|
|
|
print '<td align="right" width="100">'.$langs->trans("BankBalance").'</td>';
|
2003-10-21 16:09:11 +02:00
|
|
|
print "</tr>\n";
|
2005-05-07 23:56:12 +02:00
|
|
|
|
2011-12-30 00:33:34 +01:00
|
|
|
$total = 0; $found = 0;
|
2005-05-07 23:56:12 +02:00
|
|
|
$var=true;
|
|
|
|
|
foreach ($accounts as $key=>$type)
|
2003-06-20 16:30:08 +02:00
|
|
|
{
|
2006-07-01 16:37:19 +02:00
|
|
|
if ($type == 1)
|
|
|
|
|
{
|
2011-12-30 00:33:34 +01:00
|
|
|
$found++;
|
|
|
|
|
|
2006-07-01 16:37:19 +02:00
|
|
|
$acc = new Account($db);
|
|
|
|
|
$acc->fetch($key);
|
|
|
|
|
|
|
|
|
|
$var = !$var;
|
2008-07-31 18:07:40 +02:00
|
|
|
$solde = $acc->solde(1);
|
2006-07-01 16:37:19 +02:00
|
|
|
|
|
|
|
|
print '<tr '.$bc[$var].'>';
|
|
|
|
|
print '<td width="30%">'.$acc->getNomUrl(1).'</td>';
|
|
|
|
|
print '<td>'.$acc->bank.'</td>';
|
|
|
|
|
print '<td>'.$acc->number.'</td>';
|
2007-11-04 22:35:24 +01:00
|
|
|
print '<td align="center">';
|
2009-01-02 17:43:58 +01:00
|
|
|
if ($acc->rappro)
|
2007-11-04 22:35:24 +01:00
|
|
|
{
|
|
|
|
|
$result=$acc->load_board($user,$acc->id);
|
|
|
|
|
print $acc->nbtodo;
|
|
|
|
|
if ($acc->nbtodolate) print ' ('.$acc->nbtodolate.img_warning($langs->trans("Late")).')';
|
|
|
|
|
}
|
|
|
|
|
else print $langs->trans("FeatureDisabled");
|
|
|
|
|
print '</td>';
|
2006-07-01 16:37:19 +02:00
|
|
|
print '<td align="center">'.$acc->getLibStatut(2).'</td>';
|
|
|
|
|
print '<td align="right">';
|
|
|
|
|
print '<a href="account.php?account='.$acc->id.'">'.price($solde).'</a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
$total += $solde;
|
|
|
|
|
}
|
2002-05-12 15:53:50 +02:00
|
|
|
}
|
2011-12-30 00:33:34 +01:00
|
|
|
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
2005-05-07 23:56:12 +02:00
|
|
|
// Total
|
2009-11-07 15:01:34 +01:00
|
|
|
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td><td align="right" class="liste_total">'.price($total).'</td></tr>';
|
2004-02-15 19:42:02 +01:00
|
|
|
|
|
|
|
|
|
2011-12-30 00:33:34 +01:00
|
|
|
//print '<tr><td colspan="5"> </td></tr>';
|
2004-02-15 19:42:02 +01:00
|
|
|
|
2004-11-16 21:42:37 +01:00
|
|
|
|
2002-06-18 20:21:12 +02:00
|
|
|
/*
|
2009-01-02 17:43:58 +01:00
|
|
|
* Comptes caisse/liquide (courant = 2)
|
2002-06-18 20:21:12 +02:00
|
|
|
*/
|
2009-01-02 17:43:58 +01:00
|
|
|
print '<tr class="liste_titre"><td width="30%">'.$langs->trans("CashAccounts").'</td><td width="20%"> </td>';
|
|
|
|
|
print '<td align="left"> </td>';
|
|
|
|
|
print '<td align="left" width="100"> </td>';
|
2005-09-17 02:14:36 +02:00
|
|
|
print '<td align="center" width="70">'.$langs->trans("Status").'</td>';
|
|
|
|
|
print '<td align="right" width="100">'.$langs->trans("BankBalance").'</td>';
|
2005-05-07 23:56:12 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2011-12-30 00:33:34 +01:00
|
|
|
$total = 0; $found = 0;
|
2005-05-07 23:56:12 +02:00
|
|
|
$var=true;
|
|
|
|
|
foreach ($accounts as $key=>$type)
|
|
|
|
|
{
|
2009-01-02 17:43:58 +01:00
|
|
|
if ($type == 2)
|
2006-07-01 16:37:19 +02:00
|
|
|
{
|
2011-12-30 00:33:34 +01:00
|
|
|
$found++;
|
|
|
|
|
|
|
|
|
|
$acc = new Account($db);
|
2006-07-01 16:37:19 +02:00
|
|
|
$acc->fetch($key);
|
|
|
|
|
|
|
|
|
|
$var = !$var;
|
2008-07-31 18:07:40 +02:00
|
|
|
$solde = $acc->solde(1);
|
2006-07-01 16:37:19 +02:00
|
|
|
|
|
|
|
|
print "<tr ".$bc[$var].">";
|
|
|
|
|
print '<td width="30%">'.$acc->getNomUrl(1).'</td>';
|
|
|
|
|
print '<td>'.$acc->bank.'</td>';
|
2009-01-02 17:43:58 +01:00
|
|
|
print '<td> </td>';
|
|
|
|
|
print '<td> </td>';
|
2006-07-01 16:37:19 +02:00
|
|
|
print '<td align="center">'.$acc->getLibStatut(2).'</td>';
|
|
|
|
|
print '<td align="right">';
|
|
|
|
|
print '<a href="account.php?account='.$acc->id.'">'.price($solde).'</a>';
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '</tr>';
|
|
|
|
|
|
|
|
|
|
$total += $solde;
|
|
|
|
|
}
|
2005-05-07 23:56:12 +02:00
|
|
|
}
|
2011-12-30 00:33:34 +01:00
|
|
|
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
2005-05-07 23:56:12 +02:00
|
|
|
// Total
|
2009-11-07 15:01:34 +01:00
|
|
|
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td><td align="right" class="liste_total">'.price($total).'</td></tr>';
|
2005-05-07 23:56:12 +02:00
|
|
|
|
|
|
|
|
|
2009-01-02 17:43:58 +01:00
|
|
|
|
2011-12-30 00:33:34 +01:00
|
|
|
//print '<tr><td colspan="5"> </td></tr>';
|
2005-05-07 23:56:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-01-02 17:43:58 +01:00
|
|
|
* Comptes placements (courant = 0)
|
2005-05-07 23:56:12 +02:00
|
|
|
*/
|
2009-01-02 17:43:58 +01:00
|
|
|
print '<tr class="liste_titre">';
|
|
|
|
|
print '<td width="30%">'.$langs->trans("SavingAccounts").'</td>';
|
|
|
|
|
print '<td width="20%">'.$langs->trans("Bank").'</td>';
|
|
|
|
|
print '<td align="left">'.$langs->trans("Numero").'</td>';
|
|
|
|
|
print '<td align="center" width="100">'.$langs->trans("TransactionsToConciliate").'</td>';
|
2005-09-17 02:14:36 +02:00
|
|
|
print '<td align="center" width="70">'.$langs->trans("Status").'</td>';
|
|
|
|
|
print '<td align="right" width="100">'.$langs->trans("BankBalance").'</td>';
|
2005-05-07 23:56:12 +02:00
|
|
|
print "</tr>\n";
|
|
|
|
|
|
2011-12-30 00:33:34 +01:00
|
|
|
$total = 0; $found = 0;
|
2005-05-07 23:56:12 +02:00
|
|
|
$var=true;
|
|
|
|
|
foreach ($accounts as $key=>$type)
|
|
|
|
|
{
|
2009-01-02 17:43:58 +01:00
|
|
|
if ($type == 0)
|
|
|
|
|
{
|
2011-12-30 00:33:34 +01:00
|
|
|
$found++;
|
|
|
|
|
|
|
|
|
|
$acc = new Account($db);
|
2009-01-02 17:43:58 +01:00
|
|
|
$acc->fetch($key);
|
2005-05-07 23:56:12 +02:00
|
|
|
|
2009-01-02 17:43:58 +01:00
|
|
|
$var = !$var;
|
|
|
|
|
$solde = $acc->solde(1);
|
2005-05-07 23:56:12 +02:00
|
|
|
|
2009-01-02 17:43:58 +01:00
|
|
|
print "<tr ".$bc[$var].">";
|
2006-07-01 16:37:19 +02:00
|
|
|
print '<td width="30%">'.$acc->getNomUrl(1).'</td>';
|
2009-01-02 17:43:58 +01:00
|
|
|
print '<td>'.$acc->bank.'</td>';
|
|
|
|
|
print '<td>'.$acc->number.'</td>';
|
|
|
|
|
print '<td align="center">';
|
|
|
|
|
if ($acc->rappro)
|
|
|
|
|
{
|
|
|
|
|
$result=$acc->load_board($user,$acc->id);
|
|
|
|
|
print $acc->nbtodo;
|
|
|
|
|
if ($acc->nbtodolate) print ' ('.$acc->nbtodolate.img_warning($langs->trans("Late")).')';
|
|
|
|
|
}
|
|
|
|
|
else print $langs->trans("FeatureDisabled");
|
|
|
|
|
print '</td>';
|
|
|
|
|
print '<td align="center">'.$acc->getLibStatut(2).'</td>';
|
2006-07-01 16:37:19 +02:00
|
|
|
print '<td align="right">';
|
|
|
|
|
print '<a href="account.php?account='.$acc->id.'">'.price($solde).'</a>';
|
|
|
|
|
print '</td>';
|
2009-01-02 17:43:58 +01:00
|
|
|
print '</tr>';
|
2005-05-07 23:56:12 +02:00
|
|
|
|
2009-01-02 17:43:58 +01:00
|
|
|
$total += $solde;
|
|
|
|
|
}
|
2005-05-07 23:56:12 +02:00
|
|
|
}
|
2011-12-30 00:33:34 +01:00
|
|
|
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
2005-05-07 23:56:12 +02:00
|
|
|
// Total
|
2009-11-07 15:01:34 +01:00
|
|
|
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td><td align="right" class="liste_total">'.price($total).'</td></tr>';
|
2005-05-07 23:56:12 +02:00
|
|
|
|
2002-05-12 15:00:08 +02:00
|
|
|
print "</table>";
|
2002-05-11 20:52:36 +02:00
|
|
|
|
2004-01-24 22:40:00 +01:00
|
|
|
|
2004-06-11 02:54:19 +02:00
|
|
|
/*
|
|
|
|
|
* Boutons d'actions
|
|
|
|
|
*/
|
2013-04-15 18:00:20 +02:00
|
|
|
|
|
|
|
|
print '<div class="tabsAction">'."\n";
|
2013-12-01 23:16:18 +01:00
|
|
|
if ($user->rights->banque->configurer)
|
2013-04-15 18:00:20 +02:00
|
|
|
{
|
2007-05-26 20:16:58 +02:00
|
|
|
print '<a class="butAction" href="fiche.php?action=create">'.$langs->trans("NewFinancialAccount").'</a>';
|
2004-06-11 02:54:19 +02:00
|
|
|
}
|
2013-04-15 18:00:20 +02:00
|
|
|
print '</div>';
|
2004-06-11 02:54:19 +02:00
|
|
|
|
|
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2011-12-30 00:33:34 +01:00
|
|
|
|
|
|
|
|
$db->close();
|
2002-05-11 20:52:36 +02:00
|
|
|
?>
|