diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index c033eb789f4..b93c71118fe 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -50,11 +50,11 @@ $stcomm=isset($_GET["stcomm"])?$_GET["stcomm"]:$_POST["stcomm"]; $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $page=isset($_GET["page"])?$_GET["page"]:$_POST["page"]; -if ($page == -1) { $page = 0 ; } +if ($page == -1) { $page = 0; } if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; -$offset = $conf->liste_limit * $page ; +$offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/companybankaccount.class.php b/htdocs/companybankaccount.class.php index d809c3bebe4..1a48cd8e85a 100644 --- a/htdocs/companybankaccount.class.php +++ b/htdocs/companybankaccount.class.php @@ -185,7 +185,7 @@ class CompanyBankAccount */ function verif() { - require_once DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php'; + require_once DOL_DOCUMENT_ROOT . '/lib/bank.lib.php'; if (strlen(trim($this->code_banque)) == 0) diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index 062894ab6c0..41ae5cb575f 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -271,7 +271,7 @@ class Account if (! $this->min_desired) $this->min_desired=0; // Chargement librairie pour acces fonction controle RIB - require_once DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/lib/bank.lib.php'; if (! verif_rib($this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix)) { $this->error="Le contrôle de la clé indique que les informations de votre compte bancaire sont incorrectes."; @@ -388,7 +388,7 @@ class Account global $langs; // Chargement librairie pour acces fonction controle RIB - require_once(DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php'); + require_once(DOL_DOCUMENT_ROOT.'/lib/bank.lib.php'); dolibarr_syslog("Account.class::update $this->code_banque,$this->code_guichet,$this->number,$this->cle_rib,$this->iban_prefix"); diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 1f2ed1352ee..0001b34c67c 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -30,6 +30,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); if (!$user->rights->banque->lire) accessforbidden(); @@ -67,6 +68,7 @@ if ($_POST["action"] == 'add' && $account && ! isset($_POST["cancel"])) if ($insertid) { Header("Location: account.php?account=" . $account); + exit; } else { @@ -85,259 +87,266 @@ llxHeader(); if ($account > 0) { - if ($vline) - { - $viewline = $vline; - } - else - { - $viewline = 20; - } - $acct = new Account($db); - $acct->fetch($account); - - // Chargement des categories dans $options - $nbcategories=0; - $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ;"; - $result = $db->query($sql); - if ($result) - { - $var=True; - $num = $db->num_rows($result); - $i = 0; - $options = ""; - while ($i < $num) - { - $obj = $db->fetch_object($result); - $options .= "\n"; - $nbcategories++; - $i++; - } - $db->free($result); - } - - /* - * - * - */ - $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."bank as b"; - $sql .= " WHERE b.fk_account=".$acct->id; - $sql_rech=""; - if ($_POST["req_desc"]) - { - $sql_rech .= " AND b.label like '%".strtolower($_POST["req_desc"])."%'"; - $mode_search = 1; - } - else - { - $mode_search = 0; - } - if ($_POST["req_debit"]) $sql_rech.=" AND amount = -".$_POST["req_debit"]; - if ($_POST["req_credit"]) $sql_rech.=" AND amount = ".$_POST["req_credit"]; - - $sql .= $sql_rech; - $result=$db->query($sql); - if ($result) - { - $obj = $db->fetch_object($result); - $nbline = $obj->nb; - $total_lines = $nbline; - - if ($nbline > $viewline ) + if ($vline) { - $limit = $nbline - $viewline ; + $viewline = $vline; } - else + else { - $limit = $viewline; + $viewline = 20; } + $acct = new Account($db); + $acct->fetch($account); + + // Chargement des categories dans $options + $nbcategories=0; + $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ;"; + $result = $db->query($sql); + if ($result) + { + $var=True; + $num = $db->num_rows($result); + $i = 0; + $options = ""; + while ($i < $num) + { + $obj = $db->fetch_object($result); + $options .= "\n"; + $nbcategories++; + $i++; + } + $db->free($result); + } + + /* + * + * + */ + $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."bank as b"; + $sql .= " WHERE b.fk_account=".$acct->id; + $sql_rech=""; + if ($_POST["req_desc"]) + { + $sql_rech .= " AND b.label like '%".strtolower($_POST["req_desc"])."%'"; + $mode_search = 1; + } + else + { + $mode_search = 0; + } + if ($_POST["req_debit"]) $sql_rech.=" AND amount = -".$_POST["req_debit"]; + if ($_POST["req_credit"]) $sql_rech.=" AND amount = ".$_POST["req_credit"]; + + $sql .= $sql_rech; + $result=$db->query($sql); + if ($result) + { + $obj = $db->fetch_object($result); + $nbline = $obj->nb; + $total_lines = $nbline; + + if ($nbline > $viewline ) + { + $limit = $nbline - $viewline ; + } + else + { + $limit = $viewline; + } + + $db->free($result); + } + else { + dolibarr_print_error($db); + } + + if ($page > 0 && $mode_search == 0) + { + $limitsql = $nbline - ($page * $viewline); + if ($limitsql < $viewline) + { + $limitsql = $viewline; + } + $nbline = $limitsql; + } + else + { + $page = 0; + $limitsql = $nbline; + } + + /** + * Formulaire de recherche + * + */ + $mesg=''; + + $nbpage=floor($total_lines/$viewline)+($total_lines % $viewline > 0?1:0); // Nombre de page total + if ($limitsql > $viewline) + { + $mesg.=''.img_previous().''; + } + $mesg.= ' Page '.($nbpage-$page).'/'.$nbpage.' '; + if ($total_lines > $limitsql ) + { + $mesg.= ''.img_next().''; + } + + + $titre=$langs->trans("FinancialAccount")." : ".$acct->label; + print_fiche_titre($titre,$mesg); + + // Onglets + $head=bank_prepare_head($acct); + dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0); - $db->free($result); - } - else { - dolibarr_print_error($db); - } + print ''; - if ($page > 0 && $mode_search == 0) - { - $limitsql = $nbline - ($page * $viewline); - if ($limitsql < $viewline) + /* + * Affiche tableau des transactions bancaires + * + */ + + // Formulaire de saisie d'une opération hors factures + if ($user->rights->banque->modifier && $_GET["action"]=='addline') { - $limitsql = $viewline; + $html=new Form($db); + + print ''; + print ''; + print ''; + print ''; + + print "\n"; + + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ""; + + print "\n"; } - $nbline = $limitsql; - } - else - { - $page = 0; - $limitsql = $nbline; - } - /** - * Formulaire de recherche - * - */ - $mesg=''; - - $nbpage=floor($total_lines/$viewline)+($total_lines % $viewline > 0?1:0); // Nombre de page total - if ($limitsql > $viewline) - { - $mesg.=''.img_previous().''; - } - $mesg.= ' Page '.($nbpage-$page).'/'.$nbpage.' '; - if ($total_lines > $limitsql ) - { - $mesg.= ''.img_next().''; - } + // Ligne de titre tableau des acritures + print ''; + print ''; + print ''; + print ''; + print ''; - - print_fiche_titre("Journal de trésorerie du compte : " .$acct->label,$mesg); + print ''; + print ''; + print ''; - print '
'; - print '
 
'.$langs->trans("AddBankRecordLong").'
YYYY MMDD'.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").' '; + print '
'; + print ''; + print ''; + $html->select_types_paiements('','operation','1,2',1); + print ''; + print ''; + if ($nbcategories) + { + print '
'.$langs->trans("Category").': '; + } + print '
'; + print '
'; + print ''; + print '
 
'.$langs->trans("Date").''.$langs->trans("Value").''.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("BankBalance").''; + if ($acct->type != 2 && $acct->rappro) print $langs->trans("AccountStatementShort"); + else print ' '; + print '
'; - - /* - * Affiche tableau des transactions bancaires - * - */ + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + print "\n"; - // Formulaire de saisie d'une opération hors factures - if ($user->rights->banque->modifier && $_GET["action"]=='rappro') - { - $html=new Form($db); - - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; + /* Another solution + * create temporary table solde type=heap select amount from llx_bank limit 100 ; + * select sum(amount) from solde ; + */ - print ''; - print ''; - print ''; + $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; + $sql.= " WHERE fk_account=".$acct->id; + if ($req_debit) $sql .= " AND b.amount = -".$req_debit; + if ($req_credit) $sql .= " AND b.amount = ".$req_credit; + $sql.= $sql_rech; + if ($vue) + { + if ($vue == 'credit') + { + $sql .= " AND b.amount >= 0 "; + } + else + { + $sql .= " AND b.amount < 0 "; + } + } + $sql.= " ORDER BY b.datev ASC"; + $sql.= $db->plimit($limitsql, 0); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ""; - - print "\n"; - } - - // Ligne de titre tableau des acritures - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - print "\n"; - - /* Another solution - * create temporary table solde type=heap select amount from llx_bank limit 100 ; - * select sum(amount) from solde ; - */ - - $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql.= " WHERE fk_account=".$acct->id; - if ($req_debit) $sql .= " AND b.amount = -".$req_debit; - if ($req_credit) $sql .= " AND b.amount = ".$req_credit; - $sql.= $sql_rech; - if ($vue) - { - if ($vue == 'credit') - { - $sql .= " AND b.amount >= 0 "; - } - else - { - $sql .= " AND b.amount < 0 "; - } - } - $sql.= " ORDER BY b.datev ASC"; - $sql.= $db->plimit($limitsql, 0); - - $result = $db->query($sql); - if ($result) - { - $total = _print_lines($db, $result, $sql, $acct); - if ($page == 0) - { - print ''; - print ''; - print ''; - print ''; - } - $db->free($result); - } - - - print "
  
'.$langs->trans("AddBankRecordLong").'
YYYY MMDD'.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").' '; - print '
'; - print ''; - print ''; - $html->select_types_paiements('','operation','1,2',1); - print ''; - print ''; - if ($nbcategories) - { - print '
'.$langs->trans("Category").': '; - } - print '
'; - print '
'; - print ''; - print '
 
'.$langs->trans("Date").''.$langs->trans("Value").''.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("BankBalance").''; - if ($acct->type != 2 && $acct->rappro) print $langs->trans("AccountStatementShort"); - else print ' '; - print '
Graph 
'.$langs->trans("Balance").''.price($total).' 
"; + $result = $db->query($sql); + if ($result) + { + $total = _print_lines($db, $result, $sql, $acct); + if ($page == 0) + { + print ''.$langs->trans("CurrentBalance").''; + print ''.price($total).''; + print ' '; + print ''; + } + $db->free($result); + } - /* - * Boutons actions - */ - if ($_GET["action"] != 'rappro') - { - print '
'; - - if ($user->rights->banque->modifier && $acct->type != 2 && $acct->rappro) // Si non compte cash et rapprochable - { - print ''.$langs->trans("Conciliate").''; - } - - if ($user->rights->banque->modifier) - { - print ''.$langs->trans("AddBankRecord").''; - } - - print '
'; - } + print ""; + + print "\n\n"; + + /* + * Boutons actions + */ + if ($_GET["action"] != 'addline') + { + print '
'; + + if ($user->rights->banque->modifier && $acct->type != 2 && $acct->rappro) // Si non compte cash et rapprochable + { + print ''.$langs->trans("Conciliate").''; + } + + if ($user->rights->banque->modifier) + { + print ''.$langs->trans("AddBankRecord").''; + } + + print '
'; + } + + print '
'; - print '
'; - } else { - print $langs->trans("ErrorBankAccountNotFound"); + print $langs->trans("ErrorBankAccountNotFound"); } $db->close(); diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 1639ce077c8..8ce81fc2b66 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -22,13 +22,14 @@ */ /** - \file htdocs/compta/bank/annuel.php - \ingroup banque - \brief Page reporting mensuel Entrées/Sorties d'un compte bancaire - \version $Revision$ + \file htdocs/compta/bank/annuel.php + \ingroup banque + \brief Page reporting mensuel Entrées/Sorties d'un compte bancaire + \version $Revision$ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); if (!$user->rights->banque->lire) accessforbidden(); @@ -44,6 +45,13 @@ else $year_end=$year_start+2; } +// Sécurité accés client +if ($user->societe_id > 0) +{ + $socidp = $user->societe_id; +} + + llxHeader(); @@ -51,17 +59,6 @@ llxHeader(); $acct = new Account($db); $acct->fetch($_GET["account"]); -/* - * Sécurité accés client - */ -if ($user->societe_id > 0) -{ - $socidp = $user->societe_id; -} -$title=$langs->trans("IOMonthlyReporting").", ".$langs->trans("FinancialAccount")." : id."\">".$acct->label.""; -$lien=($year_start?"".img_previous()." ".img_next()."":""); -print_fiche_titre($title,$lien); -print '
'; # Ce rapport de trésorerie est basé sur llx_bank (car doit inclure les transactions sans facture) # plutot que sur llx_paiement + llx_paiementfourn @@ -75,16 +72,18 @@ $sql .= " GROUP BY dm"; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $encaiss[$row[1]] = $row[0]; - $i++; - } -} else { - dolibarr_print_error($db); + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_row($resql); + $encaiss[$row[1]] = $row[0]; + $i++; + } +} +else +{ + dolibarr_print_error($db); } $sql = "SELECT sum(f.amount), date_format(f.dateo,'%Y-%m') as dm"; @@ -95,17 +94,28 @@ $sql .= " GROUP BY dm"; $resql=$db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - $decaiss[$row[1]] = -$row[0]; - $i++; - } -} else { - dolibarr_print_error($db); + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $row = $db->fetch_row($resql); + $decaiss[$row[1]] = -$row[0]; + $i++; + } } +else +{ + dolibarr_print_error($db); +} + + +$title=$langs->trans("FinancialAccount")." : ".$acct->label; +$lien=($year_start?"".img_previous()." ".img_next()."":""); +print_fiche_titre($title,$lien); + +// Onglets +$head=bank_prepare_head($acct); +dolibarr_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0); // Affiche tableau @@ -169,7 +179,6 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) $nbcol+=2; } print "\n"; -print ' '; // Solde actuel $balance=0; @@ -191,6 +200,7 @@ print "\n"; print ""; +print "\n\n"; $db->close(); diff --git a/htdocs/compta/bank/bank.lib.php b/htdocs/compta/bank/bank.lib.php deleted file mode 100644 index 6b853ebd849..00000000000 --- a/htdocs/compta/bank/bank.lib.php +++ /dev/null @@ -1,86 +0,0 @@ - - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004 Laurent Destailleur - * - * $Id$ - * $Source$ - * - * 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. - * or see http://www.gnu.org/ - */ - -/*! \file htdocs/compta/bank/bank.lib.php - \ingroup banque - \brief librairie contenant les fonctions bancaires. - \author Laurent Destailleur - \version $Revision$ - - Ensemble des fonctions en rapport avec les modules bancaires -*/ - - - -/*! - \brief Verifie le RIB d'un compte bancaire grace à sa clé - \param code_banque code banque - \param code_guichet code guichet - \param num_compte numero de compte - \param cle cle - \param iban Ne sert pas pour le calcul de cle mais sert pour determiner le pays - \return int true si les infos sont bonnes, false si la clé ne correspond pas -*/ - -function verif_rib($code_banque , $code_guichet , $num_compte , $cle, $iban) -{ - if (eregi("^FR",$iban)) - { // Cas de la France - - $coef = array(62, 34, 3) ; - - // Concatenation des differents codes. - $rib = strtolower(trim($code_banque).trim($code_guichet).trim($num_compte).trim($cle)); - - // On remplace les eventuelles lettres par des chiffres. - - //Ne marche pas - //$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678"); - - $rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678923456789"); - - // Separation du rib en 3 groupes de 7 + 1 groupe de 2. - // Multiplication de chaque groupe par les coef du tableau - for ($i=0, $s=0; $i<3; $i++) - { - $code = substr($rib, 7 * $i, 7) ; - $s += (0 + $code) * $coef[$i] ; - } - - // Soustraction du modulo 97 de $s à 97 pour obtenir la clé RIB - $cle_rib = 97 - ($s % 97) ; - - if ($cle_rib == $cle) - { - return true; - } - - return false; - } - - return true; -} - - -?> diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 42ad1553593..4751a1fcf6e 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -29,6 +29,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); $langs->load("banks"); @@ -103,21 +104,11 @@ $form = new Form($db); /* * Affichage onglets */ - $h=0; + $titre=$langs->trans("FinancialAccount")." : ".$account->label; + print_fiche_titre($titre,$mesg); - $head[$h][0] = 'fiche.php?id='.$account->id; - $head[$h][1] = $langs->trans("AccountCard"); - $head[$h][2] = 'bankname'; - $h++; - - if ($account->type == 0 || $account->type == 1) - { - $head[$h][0] = 'bankid_fr.php?id='.$account->id; - $head[$h][1] = $langs->trans("RIB"); - $head[$h][2] = 'bankid'; - $h++; - } - + // Onglets + $head=bank_prepare_head($account); dolibarr_fiche_head($head, 'bankid', $langs->trans("FinancialAccount")); /* @@ -186,7 +177,7 @@ $form = new Form($db); print ''; - print ''; + print "\n\n"; /* diff --git a/htdocs/compta/bank/bplc.php b/htdocs/compta/bank/bplc.php index f409d7b2f20..e26643234c9 100644 --- a/htdocs/compta/bank/bplc.php +++ b/htdocs/compta/bank/bplc.php @@ -21,7 +21,7 @@ */ require("./pre.inc.php"); -require("./bank.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); $user->getrights('compta'); diff --git a/htdocs/compta/bank/config.php b/htdocs/compta/bank/config.php index bfc90c1efe3..5811f4e3ae9 100644 --- a/htdocs/compta/bank/config.php +++ b/htdocs/compta/bank/config.php @@ -28,11 +28,12 @@ */ require("./pre.inc.php"); -require("./bank.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); if (!$user->rights->banque->configurer) accessforbidden(); + llxHeader(); print_titre($langs->trans("AccountSetup")); diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 94d3002fa3e..674543bfc43 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -29,6 +29,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); $langs->load("banks"); @@ -215,8 +216,11 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("Web").''; print ''; + // Comment print ''.$langs->trans("Comment").''; - print ''; + print ''; + print ''; + print ''; // Solde print ''.$langs->trans("InitialBankBalance").'...'; @@ -254,21 +258,11 @@ else /* * Affichage onglets */ - $h=0; - - $head[$h][0] = 'fiche.php?id='.$account->id; - $head[$h][1] = $langs->trans("AccountCard"); - $head[$h][2] = 'bankname'; - $h++; + $titre=$langs->trans("FinancialAccount")." : ".$account->label; + print_fiche_titre($titre,$mesg); - if ($account->type == 0 || $account->type == 1) - { - $head[$h][0] = 'bankid_fr.php?id='.$account->id; - $head[$h][1] = $langs->trans("RIB"); - $head[$h][2] = 'bankid'; - $h++; - } - + // Onglets + $head=bank_prepare_head($account); dolibarr_fiche_head($head, 'bankname', $langs->trans("FinancialAccount")); /* @@ -433,13 +427,16 @@ else print ''.$langs->trans("BalanceMinimalDesired").''; print ''; + // Web print ''.$langs->trans("Web").''; print ''; print ''; + // Comment print ''.$langs->trans("Comment").''; - print ''; - + print ''; + print ''; + print ''; print ''; print '   '; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 042fa3c422d..eb419cd0dd5 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -26,18 +26,19 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); if (!$user->rights->banque->lire) accessforbidden(); +$account = $_GET["account"]; + + llxHeader(); -$account = $_GET["id"]; - if ($account > 0) { - $datetime = time(); $month = strftime("%m", $datetime); $year = strftime("%Y", $datetime); @@ -45,23 +46,28 @@ if ($account > 0) $acct = new Account($db); $acct->fetch($account); - print_fiche_titre("Journal de trésorerie du compte: " .$acct->getNomUrl(0),$mesg); - - print ''; + + $titre=$langs->trans("FinancialAccount")." : ".$acct->label; + print_fiche_titre($titre,$mesg); + + // Onglets + $head=bank_prepare_head($acct); + dolibarr_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0); + + print '
'; print '
'; $file = "solde.$account.$year.png"; - /* Bug - if (! file_exists($conf->$file)) - { - print "Pour générer ou regénérer les graphiques, lancer le script ./scripts/banque/graph-solde.php en ligne de commande.
"; - print '
'; - } - else - { - print ''; - } - */ + if (! file_exists($conf->banque->dir_images."/".$file)) + { + print "Pour générer ou regénérer les graphiques, lancer le script ./scripts/banque/graph-solde.php en ligne de commande.
"; + print '
'; + } + else + { + print ''; + } + print ''; print '
'; @@ -76,6 +82,9 @@ if ($account > 0) print ''; - print '
'; + print ''; + + print "\n\n"; + } ?> diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index b2a77691130..4b837b3778e 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -27,10 +27,8 @@ \version $Revision$ */ - require("./pre.inc.php"); - -require("./bank.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); require("../../tva.class.php"); require("../../chargesociales.class.php"); diff --git a/htdocs/compta/bank/pre.inc.php b/htdocs/compta/bank/pre.inc.php index d3e8dd7a5be..d3c00fe4f10 100644 --- a/htdocs/compta/bank/pre.inc.php +++ b/htdocs/compta/bank/pre.inc.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2005 Laurent Destailleur + * 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 @@ -19,13 +19,12 @@ * * $Id$ * $Source$ - * */ /** - \file htdocs/compta/bank/pre.inc.php - \ingroup compta - \brief Fichier gestionnaire du menu compta banque + \file htdocs/compta/bank/pre.inc.php + \ingroup compta + \brief Fichier gestionnaire du menu compta banque */ require_once("../../main.inc.php"); @@ -57,9 +56,10 @@ function llxHeader($head = "") while ($i < $numr) { $objp = $db->fetch_object($resql); - $menu->add(DOL_URL_ROOT."/compta/bank/account.php?account=" . $objp->rowid, $objp->label); - if ($objp->courant != 2) $menu->add_submenu(DOL_URL_ROOT."/compta/bank/releve.php?account=" . $objp->rowid ,$langs->trans("AccountStatements")); - $menu->add_submenu(DOL_URL_ROOT."/compta/bank/annuel.php?account=" . $objp->rowid ,$langs->trans("IOMonthlyReporting")); + $menu->add(DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, $objp->label); + $menu->add_submenu(DOL_URL_ROOT."/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting")); + $menu->add_submenu(DOL_URL_ROOT."/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph")); + if ($objp->courant != 2) $menu->add_submenu(DOL_URL_ROOT."/compta/bank/releve.php?account=".$objp->rowid ,$langs->trans("AccountStatements")); $i++; } } diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 0c55f640195..444e70be8f7 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -28,6 +28,7 @@ */ require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); $langs->load("companies"); @@ -49,6 +50,18 @@ if ($_GET["action"] == 'dvprev') } +$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; +$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; +$page=isset($_GET["page"])?$_GET["page"]:$_POST["page"]; +if ($page == -1) { $page = 0; } +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="s.nom"; + +$offset = $conf->liste_limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + + llxHeader(); @@ -58,294 +71,295 @@ $acct->fetch($_GET["account"]); if (! isset($_GET["num"])) { - /* - * Vue liste tous relevés confondus - * - */ - if ($page == -1) { $page = 0 ; } + /* + * Vue liste tous relevés confondus + */ + $sql = "SELECT distinct(b.num_releve) as numr"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; + $sql.= " WHERE fk_account = ".$_GET["account"]; + $sql.= " ORDER BY numr DESC"; + $sql.= $db->plimit($conf->liste_limit+1,$offset); - $limit = $conf->liste_limit; - $offset = $limit * $page ; - $pageprev = $page - 1; - $pagenext = $page + 1; - - $sql = "SELECT distinct(b.num_releve) as numr"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql .= " WHERE fk_account = ".$_GET["account"]; - $sql .= " ORDER BY numr DESC"; -// $sql .= $db->plimit($limit,$offset); // retrait de la limite tant qu'il n'y a pas de pagination - - $result = $db->query($sql); - if ($result) - { - $var=True; - $numrows = $db->num_rows($result); - $i = 0; - - print_barre_liste($langs->trans("AccountStatements").", ".$langs->trans("BankAccount")." : id."\">".$acct->label."", $page, "releve.php","&account=".$_GET["account"],$sortfield,$sortorder,'',$numrows); - print '
'; - - print ''; - print ""; - print ''; - - //while ($i < min($numrows,$limit)) // retrait de la limite tant qu'il n'y a pas de pagination - while ($i < min($numrows,$limit)) + $result = $db->query($sql); + if ($result) { - $objp = $db->fetch_object($result); - $var=!$var; - if (! isset($objp->numr)) - { - // - } - else - { - print "\n"; - } - $i++; + $var=True; + $numrows = $db->num_rows($result); + $i = 0; + + $titre=$langs->trans("FinancialAccount")." : ".$acct->label; + print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], "&account=".$_GET["account"], $sortfield, $sortorder,'',$numrows); + + // Onglets + $head=bank_prepare_head($acct); + dolibarr_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0); + + print '
'.$langs->trans("AccountStatement").'
numr&account=".$_GET["account"]."\">$objp->numr
'; + print ""; + print ''; + + //while ($i < min($numrows,$conf->liste_limit)) // retrait de la limite tant qu'il n'y a pas de pagination + while ($i < min($numrows,$conf->liste_limit)) + { + $objp = $db->fetch_object($result); + $var=!$var; + if (! isset($objp->numr)) + { + // + } + else + { + print "\n"; + } + $i++; + } + print "
'.$langs->trans("AccountStatement").'
numr&account=".$_GET["account"]."\">$objp->numr
\n"; + + print "\n\n"; + } + else + { + dolibarr_print_error($db); } - print "\n"; - } - - } else { - /** - * Affiche liste ecritures d'un releve - */ - if ($_GET["rel"] == 'prev') - { - // Recherche valeur pour num = numéro relevé précédent - $sql = "SELECT distinct(num_releve) as num"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank"; - $sql.= " WHERE num_releve < ".$_GET["num"]." AND fk_account = ".$_GET["account"]; - $sql.= " ORDER BY num_releve DESC"; - $result = $db->query($sql); - if ($result) - { - $var=True; - $numrows = $db->num_rows($result); - $i = 0; - if ($numrows > 0) - { - $obj = $db->fetch_object($result); - $num = $obj->num; - } - } - } - elseif ($_GET["rel"] == 'next') - { - // Recherche valeur pour num = numéro relevé précédent - $sql = "SELECT distinct(num_releve) as num"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank"; - $sql.= " WHERE num_releve > ".$_GET["num"]." AND fk_account = ".$_GET["account"]; - $sql.= " ORDER BY num_releve ASC"; - $result = $db->query($sql); - if ($result) - { - $var=True; - $numrows = $db->num_rows($result); - $i = 0; - if ($numrows > 0) - { - $obj = $db->fetch_object($result); - $num = $obj->num; - } - } - } - else { - // On veut le relevé num - $num=$_GET["num"]; - } - $ve=$_GET["ve"]; - - $mesprevnext ="id\">".img_previous()."  "; - $mesprevnext.= $langs->trans("AccountStatement")." $num"; - $mesprevnext.="   id\">".img_next().""; - print_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$acct->label.'',$mesprevnext); - print '
'; - - print "
"; - print ""; + /** + * Affiche liste ecritures d'un releve + */ + if ($_GET["rel"] == 'prev') + { + // Recherche valeur pour num = numéro relevé précédent + $sql = "SELECT distinct(num_releve) as num"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank"; + $sql.= " WHERE num_releve < ".$_GET["num"]." AND fk_account = ".$_GET["account"]; + $sql.= " ORDER BY num_releve DESC"; + $result = $db->query($sql); + if ($result) + { + $var=True; + $numrows = $db->num_rows($result); + $i = 0; + if ($numrows > 0) + { + $obj = $db->fetch_object($result); + $num = $obj->num; + } + } + } + elseif ($_GET["rel"] == 'next') + { + // Recherche valeur pour num = numéro relevé précédent + $sql = "SELECT distinct(num_releve) as num"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank"; + $sql.= " WHERE num_releve > ".$_GET["num"]." AND fk_account = ".$_GET["account"]; + $sql.= " ORDER BY num_releve ASC"; + $result = $db->query($sql); + if ($result) + { + $var=True; + $numrows = $db->num_rows($result); + $i = 0; + if ($numrows > 0) + { + $obj = $db->fetch_object($result); + $num = $obj->num; + } + } + } + else { + // On veut le relevé num + $num=$_GET["num"]; + } + $ve=$_GET["ve"]; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - // Calcul du solde de départ du relevé - $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank"; - $sql.= " WHERE num_releve < ".$num." AND fk_account = ".$acct->id; - $resql=$db->query($sql); - if ($resql) - { - $obj=$db->fetch_object($resql); - $total = $obj->amount; - $db->free($resql); - } - - // Recherche les écritures pour le relevé - $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql .= " WHERE num_releve='".$num."'"; - if (!isset($num)) - { - $sql .= " or num_releve is null"; - } - $sql .= " AND fk_account = ".$acct->id; - $sql .= " ORDER BY datev ASC"; - $result = $db->query($sql); + $mesprevnext ="id\">".img_previous()."  "; + $mesprevnext.= $langs->trans("AccountStatement")." $num"; + $mesprevnext.="   id\">".img_next().""; + print_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$acct->getNomUrl(0),$mesprevnext); + print '
'; - if ($result) - { - $var=True; - $numrows = $db->num_rows($result); - $i = 0; - - // Ligne Solde début releve - print ""; - print "\n"; - - while ($i < $numrows) - { - $objp = $db->fetch_object($result); - $total = $total + $objp->amount; - - $var=!$var; - print ""; - - // Date operation - print ''; - - // Date de valeur - print '\n"; - - // Num chq - print ''; - - // Libelle - print '"; + + if ($objp->amount < 0) + { + $totald = $totald + abs($objp->amount); + print '\n"; + } + else + { + $totalc = $totalc + abs($objp->amount); + print "\n"; + } + + print "\n"; + + if ($user->rights->banque->modifier) + { + print ""; + } + else + { + print ""; + } + print ""; + $i++; + } + $db->free($result); + } + + // Ligne Total + print ""; + + // Ligne Solde + print "\n"; + print "
'.$langs->trans("DateOperationShort").''.$langs->trans("DateValueShort").''.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").' 
id."\"> ".$langs->trans("InitialBankBalance")." :".price($total)." 
'.dolibarr_print_date($objp->do,"%d/%m/%Y").''; - print ''; - print img_previous().' '; - print dolibarr_print_date($objp->dv,"%d/%m/%Y") .' '; - print ''; - print img_next().''; - print "'.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').''; + print ""; + print ""; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + // Calcul du solde de départ du relev + $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank"; + $sql.= " WHERE num_releve < ".$num." AND fk_account = ".$acct->id; + $resql=$db->query($sql); + if ($resql) + { + $obj=$db->fetch_object($resql); + $total = $obj->amount; + $db->free($resql); + } + + // Recherche les écritures pour le relev + $sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; + $sql .= " WHERE num_releve='".$num."'"; + if (!isset($num)) + { + $sql .= " or num_releve is null"; + } + $sql .= " AND fk_account = ".$acct->id; + $sql .= " ORDER BY datev ASC"; + $result = $db->query($sql); + + if ($result) + { + $var=True; + $numrows = $db->num_rows($result); + $i = 0; + + // Ligne Solde début releve + print ""; + print "\n"; + + while ($i < $numrows) + { + $objp = $db->fetch_object($result); + $total = $total + $objp->amount; + + $var=!$var; + print ""; + + // Date operation + print ''; + + // Date de valeur + print '\n"; + + // Num chq + print ''; + + // Libelle + print '"; - - if ($objp->amount < 0) - { - $totald = $totald + abs($objp->amount); - print '\n"; - } - else - { - $totalc = $totalc + abs($objp->amount); - print "\n"; - } - - print "\n"; - - if ($user->rights->banque->modifier) - { - print ""; - } - else - { - print ""; - } - print ""; - $i++; - } - $db->free($result); - } + print ''; - // Ligne Total - print ""; + /* + * Ajout les liens (societe, company...) + */ + $newline=1; + $links = $acct->get_url($objp->rowid); + foreach($links as $key=>$val) + { + if (! $newline) print ' - '; + else print '
'; + if ($links[$key]['type']=='payment') + { + print ''; + print img_object($langs->trans('ShowPayment'),'payment').' '; + print $langs->trans("Payment"); + print ''; + $newline=0; + } + elseif ($links[$key]['type']=='payment_supplier') { + print ''; + print img_object($langs->trans('ShowPayment'),'payment').' '; + print $langs->trans("Payment"); + print ''; + $newline=0; + } + elseif ($links[$key]['type']=='company') { + print ''; + print img_object($langs->trans('ShowCustomer'),'company').' '; + print dolibarr_trunc($links[$key]['label'],24); + print ''; + $newline=0; + } + else { + print ''; + print $links[$key]['label']; + print ''; + $newline=0; + } + } - // Ligne Solde - print "\n"; - print "
'.$langs->trans("DateOperationShort").''.$langs->trans("DateValueShort").''.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").' 
id."\"> ".$langs->trans("InitialBankBalance")." :".price($total)." 
'.dolibarr_print_date($objp->do,"%d/%m/%Y").''; + print ''; + print img_previous().' '; + print dolibarr_print_date($objp->dv,"%d/%m/%Y") .' '; + print ''; + print img_next().''; + print "'.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').''; $reg=array(); eregi('\((.+)\)',$objp->label,$reg); // Si texte entouré de parenthèe on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]); else print $objp->label; - print ''; - - /* - * Ajout les liens (societe, company...) - */ - $newline=1; - $links = $acct->get_url($objp->rowid); - foreach($links as $key=>$val) - { - if (! $newline) print ' - '; - else print '
'; - if ($links[$key]['type']=='payment') - { - print ''; - print img_object($langs->trans('ShowPayment'),'payment').' '; - print $langs->trans("Payment"); - print ''; - $newline=0; - } - elseif ($links[$key]['type']=='payment_supplier') { - print ''; - print img_object($langs->trans('ShowPayment'),'payment').' '; - print $langs->trans("Payment"); - print ''; - $newline=0; - } - elseif ($links[$key]['type']=='company') { - print ''; - print img_object($langs->trans('ShowCustomer'),'company').' '; - print dolibarr_trunc($links[$key]['label'],24); - print ''; - $newline=0; - } - else { - print ''; - print $links[$key]['label']; - print ''; - $newline=0; - } - } - - // Catégories - if ($ve) - { - $sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ as ct, ".MAIN_DB_PREFIX."bank_class as cl"; - $sql.= " WHERE ct.rowid=cl.fk_categ AND cl.lineid=".$objp->rowid; - $resc = $db->query($sql); - if ($resc) - { - $numc = $db->num_rows($resc); - $ii = 0; - if ($numc && ! $newline) print '
'; - while ($ii < $numc) - { - $objc = $db->fetch_object($resc); - print "
$objc->label"; - $ii++; - } - } - else - { - dolibarr_print_error($db); - } - } - - print "
'.price($objp->amount * -1)."  ".price($objp->amount)."".price($total)."rowid&account=".$acct->id."\">"; - print img_edit(); - print " 
".$langs->trans("Total")." :".price($totald)."".price($totalc)."  
 ".$langs->trans("EndBankBalance")." :".price($total)." 
\n"; + // Catégories + if ($ve) + { + $sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ as ct, ".MAIN_DB_PREFIX."bank_class as cl"; + $sql.= " WHERE ct.rowid=cl.fk_categ AND cl.lineid=".$objp->rowid; + $resc = $db->query($sql); + if ($resc) + { + $numc = $db->num_rows($resc); + $ii = 0; + if ($numc && ! $newline) print '
'; + while ($ii < $numc) + { + $objc = $db->fetch_object($resc); + print "
$objc->label"; + $ii++; + } + } + else + { + dolibarr_print_error($db); + } + } + + print "
'.price($objp->amount * -1)."  ".price($objp->amount)."".price($total)."rowid&account=".$acct->id."\">"; + print img_edit(); + print " 
".$langs->trans("Total")." :".price($totald)."".price($totalc)."  
 ".$langs->trans("EndBankBalance")." :".price($total)." 
\n"; } + $db->close(); llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index 6eeb6d3bcc4..0d215d06415 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -28,7 +28,7 @@ */ require("./pre.inc.php"); -require("./bank.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); $user->getrights('banque'); diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php index 7530e9fc1f6..768923104dd 100644 --- a/htdocs/compta/bank/virement.php +++ b/htdocs/compta/bank/virement.php @@ -28,7 +28,7 @@ */ require("./pre.inc.php"); -require("./bank.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); $user->getrights('banque'); diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 5f2bba4f589..84d3d5f588e 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -85,4 +85,5 @@ ConciliatedBy=Conciliated by DateConciliating=Conciliate date BankLineConciliated=Transaction conciliated CustomerInvoicePayment=Customer payment -SupplierInvoicePayment=Supplier payment \ No newline at end of file +SupplierInvoicePayment=Supplier payment +FinancialAccountJournal=Financial account journal \ No newline at end of file diff --git a/htdocs/langs/fr_FR/banks.lang b/htdocs/langs/fr_FR/banks.lang index 139d61c1b4d..ae097b2707e 100644 --- a/htdocs/langs/fr_FR/banks.lang +++ b/htdocs/langs/fr_FR/banks.lang @@ -85,4 +85,5 @@ ConciliatedBy=Rapproch DateConciliating=Date rapprochement BankLineConciliated=Ecriture rapprochée CustomerInvoicePayment=Règlement client -SupplierInvoicePayment=Règlement fournisseur \ No newline at end of file +SupplierInvoicePayment=Règlement fournisseur +FinancialAccountJournal=Journal de trésorerie du compte \ No newline at end of file diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index 261e1d09f25..0521a4ce26e 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -234,10 +234,11 @@ function dolibarr_syslog($message, $level=LOG_INFO) \param links Tableau de titre d'onglets \param active 0=onglet non actif, 1=onglet actif \param title Titre tabelau ("" par defaut) + \param notab 0=Add tab header, 1=no tab header */ -function dolibarr_fiche_head($links, $active='0', $title='') +function dolibarr_fiche_head($links, $active='0', $title='', $notab=0) { - print '
'."\n"; + print "\n".'
'."\n"; // Affichage titre if ($title) @@ -275,7 +276,7 @@ function dolibarr_fiche_head($links, $active='0', $title='') print "
\n"; - print '
'."\n\n"; + if (! $notab) print '
'."\n\n"; } /** @@ -1580,7 +1581,7 @@ function dol_delete_dir($dir) \param titre titre de la page \param page numéro de la page \param file lien - \param options options cellule td ('' par defaut) + \param options parametres complementaires lien ('' par defaut) \param sortfield champ de tri ('' par defaut) \param sortorder ordre de tri ('' par defaut) \param center chaine du centre ('' par defaut) @@ -1603,7 +1604,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($page > 0 || $num > $conf->liste_limit) { - print '
'.$titre.' - page '.($page+1); + print '
'.$titre.' - page '.($page+1); print '
'; } else diff --git a/htdocs/theme/eldy/eldy.css.php b/htdocs/theme/eldy/eldy.css.php index a912ce2a79b..586083a3593 100644 --- a/htdocs/theme/eldy/eldy.css.php +++ b/htdocs/theme/eldy/eldy.css.php @@ -31,7 +31,7 @@ require("../../conf/conf.php"); header('Content-type: text/css'); // Important: Avoid page request by browser and dynamic build at // each Dolibarr page access. -header('Cache-Control: max-age=3600, must-revalidate'); +header('Cache-Control: max-age=3600, public, must-revalidate'); ?> diff --git a/scripts/banque/graph-solde.php b/scripts/banque/graph-solde.php index 179ca49dcb1..f8cadb11f28 100644 --- a/scripts/banque/graph-solde.php +++ b/scripts/banque/graph-solde.php @@ -21,17 +21,17 @@ */ /** - \file scripts/banque/graph-solde.php - \ingroup banque - \brief Script de génération des images des soldes des comptes + \file scripts/banque/graph-solde.php + \ingroup banque + \brief Script de génération des images des soldes des comptes */ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer graph-solde.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; - exit; + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer graph-solde.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; } @@ -43,9 +43,9 @@ require_once($path."../../htdocs/master.inc.php"); // Vérifie que chemin vers JPGRAHP est connu et defini $jpgraph if (! $conf->global->JPGRAPH_DIR && ! defined('JPGRAPH_PATH')) { - print 'Erreur: Définissez la constante JPGRAPH_PATH sur la valeur du répertoire contenant JPGraph'; - exit; -} + print 'Erreur: Définissez la constante JPGRAPH_PATH sur la valeur du répertoire contenant JPGraph'; + exit; +} if (! $conf->global->JPGRAPH_DIR) $conf->global->JPGRAPH_DIR=JPGRAPH_PATH; $jpgraphdir=$conf->global->JPGRAPH_DIR; if (! eregi('[\\\/]$',$jpgraphdir)) $jpgraphdir.='/'; @@ -56,7 +56,7 @@ if (! file_exists($jpgraphdir."jpgraph.php")) print 'Vérifier la variable JPGRAPH_PATH'; if ($conf->global->JPGRAPH_DIR) print ' ('.$conf->global->JPGRAPH_DIR.')'."\n"; elseif (defined('JPGRAPH_PATH')) print ' ('.JPGRAPH_PATH.')'."\n"; - exit; + exit; } include_once($jpgraphdir."jpgraph.php"); @@ -71,18 +71,18 @@ $error = 0; // Initialise opt, tableau des parametres if (function_exists("getopt")) { - // getopt existe sur ce PHP - $opt = getopt("m:y:"); + // getopt existe sur ce PHP + $opt = getopt("m:y:"); } else { - // getopt n'existe sur ce PHP - $opt=array('m'=>$argv[1]); -} + // getopt n'existe sur ce PHP + $opt=array('m'=>$argv[1]); +} if (!$conf->banque->dir_images) { - $conf->banque->dir_images = DOL_DATA_ROOT."/graph/banque/"; + $conf->banque->dir_images = DOL_DATA_ROOT."/graph/banque/"; } // Crée répertoire accueil @@ -93,33 +93,33 @@ $datetime = time(); if ($opt['m'] > 0) { - $month = $opt['m']; + $month = $opt['m']; } else { - $month = strftime("%m", $datetime); + $month = strftime("%m", $datetime); } $year = strftime("%Y", $datetime); if ($month == 1) { - $monthprev = "12"; - $yearprev = $year - 1; + $monthprev = "12"; + $yearprev = $year - 1; } else { - $monthprev = substr("00".($month - 1), -2) ; - $yearprev = $year ; + $monthprev = substr("00".($month - 1), -2) ; + $yearprev = $year ; } if ($month == 12) { - $monthnext = "01"; - $yearnext = $year + 1; + $monthnext = "01"; + $yearnext = $year + 1; } else { - $monthnext = substr("00".($month + 1), -2) ; + $monthnext = substr("00".($month + 1), -2) ; } $sql = "SELECT distinct(fk_account)"; @@ -132,442 +132,442 @@ $accounts = array(); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $num = $db->num_rows($resql); + $i = 0; - while ($i < $num) - { - $row = $db->fetch_row($resql); - array_push($accounts, $row[0]); - $i++; - } + while ($i < $num) + { + $row = $db->fetch_row($resql); + array_push($accounts, $row[0]); + $i++; + } } - -$account = 1; + +$account = 1; foreach ($accounts as $account) { - $labels = array(); - $datas = array(); - $amounts = array(); - - $sql = "SELECT sum(amount)"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; - $sql .= " AND datev < '".$year."-".$month."-01';"; - - $resql = $db->query($sql); - if ($resql) - { - $row = $db->fetch_row($resql); - $solde = $row[0]; - } - else - { - print $sql ; - } + $labels = array(); + $datas = array(); + $amounts = array(); + $sql = "SELECT sum(amount)"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; + $sql .= " AND datev < '".$year."-".$month."-01';"; - $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; - $sql .= " AND date_format(datev,'%Y%m') = '".$year.$month."'"; - $sql .= " GROUP BY date_format(datev,'%Y%m%d');"; - - $resql = $db->query($sql); - - $amounts = array(); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) + $resql = $db->query($sql); + if ($resql) { - $row = $db->fetch_row($resql); - $amounts[$row[0]] = $row[1]; - $i++; - } - } - else - { - print $sql ; - } - - $subtotal = 0; - - $day = mktime(1,1,1,$month,1,$year); - - $xmonth = substr("00".strftime("%m",$day), -2); - $i = 0; - while ($xmonth == $month) - { - //print strftime ("%e %d %m %y",$day)."\n"; - - $subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)]; - - if ($day > time()) - { - $datas[$i] = 0; + $row = $db->fetch_row($resql); + $solde = $row[0]; } - else + else { - $datas[$i] = $solde + $subtotal; + print $sql ; } - $labels[$i] = strftime("%d",$day); - - $day += 86400; - $xmonth = substr("00".strftime("%m",$day), -2); - $i++; - } - - $width = 750; - $height = 350; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(2); - $graph->SetFrame(1); - $graph->img->SetMargin(60,20,20,35); - - $b2plot = new BarPlot($datas); - - $b2plot->SetColor("blue"); - //$b2plot->SetWeight(2); - - $graph->title->Set("Solde $month $year"); - - $graph->xaxis->SetTickLabels($labels); - //$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); - - $graph->Add($b2plot); - $graph->img->SetImgFormat("png"); - - $file= $conf->banque->dir_images."/solde.$account.$year.$month.png"; - - $graph->Stroke($file); + + $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; + $sql .= " AND date_format(datev,'%Y%m') = '".$year.$month."'"; + $sql .= " GROUP BY date_format(datev,'%Y%m%d');"; + + $resql = $db->query($sql); + + $amounts = array(); + + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $row = $db->fetch_row($resql); + $amounts[$row[0]] = $row[1]; + $i++; + } + } + else + { + print $sql ; + } + + $subtotal = 0; + + $day = mktime(1,1,1,$month,1,$year); + + $xmonth = substr("00".strftime("%m",$day), -2); + $i = 0; + while ($xmonth == $month) + { + //print strftime ("%e %d %m %y",$day)."\n"; + + $subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)]; + + if ($day > time()) + { + $datas[$i] = 0; + } + else + { + $datas[$i] = $solde + $subtotal; + } + + $labels[$i] = strftime("%d",$day); + + $day += 86400; + $xmonth = substr("00".strftime("%m",$day), -2); + $i++; + } + + $width = 750; + $height = 350; + + $graph = new Graph($width, $height,"auto"); + $graph->SetScale("textlin"); + + $graph->yaxis->scale->SetGrace(2); + $graph->SetFrame(1); + $graph->img->SetMargin(60,20,20,35); + + $b2plot = new BarPlot($datas); + + $b2plot->SetColor("blue"); + //$b2plot->SetWeight(2); + + $graph->title->Set("Solde $month $year"); + + $graph->xaxis->SetTickLabels($labels); + //$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); + + $graph->Add($b2plot); + $graph->img->SetImgFormat("png"); + + $file= $conf->banque->dir_images."/solde.$account.$year.$month.png"; + + $graph->Stroke($file); } /* - * Graph annuels - * - */ +* Graph annuels +* +*/ foreach ($accounts as $account) { - $labels = array(); - $datas = array(); - $amounts = array(); - - $sql = "SELECT sum(amount)"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; - $sql .= " AND datev < '".$year."-01-01';"; - - $resql = $db->query($sql); - if ($resql) - { - $row = $db->fetch_row($resql); - $solde = $row[0]; - } - else - { - print $sql ; - } + $labels = array(); + $datas = array(); + $amounts = array(); - $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; - $sql .= " AND date_format(datev,'%Y') = '".$year."'"; - $sql .= " GROUP BY date_format(datev,'%Y%m%d');"; + $sql = "SELECT sum(amount)"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; + $sql .= " AND datev < '".$year."-01-01';"; - $resql = $db->query($sql); - - $amounts = array(); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) + $resql = $db->query($sql); + if ($resql) { - $row = $db->fetch_row($resql); - $amounts[$row[0]] = $row[1]; - $i++; - } - } - else - { - dolibarr_syslog("graph-solde.php Error"); - } - - $subtotal = 0; - - $day = mktime(1,1,1,1,1,$year); - - $xyear = strftime("%Y",$day); - $i = 0; - while ($xyear == $year) - { - //print strftime ("%e %d %m %y",$day)."\n"; - - $subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)]; - - if ($day > time()) - { - $datas[$i] = 'x'; // Valeur spéciale permettant de ne pas tracer le graph + $row = $db->fetch_row($resql); + $solde = $row[0]; } - else + else { - $datas[$i] = $solde + $subtotal; + print $sql ; } - if (strftime("%d",$day) == 1) + $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; + $sql .= " AND date_format(datev,'%Y') = '".$year."'"; + $sql .= " GROUP BY date_format(datev,'%Y%m%d');"; + + $resql = $db->query($sql); + + $amounts = array(); + + if ($resql) { - $labels[$i] = strftime("%d",$day); + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $row = $db->fetch_row($resql); + $amounts[$row[0]] = $row[1]; + $i++; + } } - else + else { - + dolibarr_syslog("graph-solde.php Error"); } - - $day += 86400; - $xyear = strftime("%Y",$day); - $i++; - } - - $width = 750; - $height = 350; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(2); - $graph->SetFrame(1); - $graph->img->SetMargin(60,20,20,35); - - $b2plot = new LinePlot($datas); - - $b2plot->SetColor("blue"); - //$b2plot->SetWeight(2); - - $graph->title->Set("Solde $year"); - - $graph->xaxis->SetTickLabels($labels); - $graph->xaxis->Hide(); - //$graph->xaxis->HideTicks(); + $subtotal = 0; + + $day = mktime(1,1,1,1,1,$year); + + $xyear = strftime("%Y",$day); + $i = 0; + while ($xyear == $year) + { + //print strftime ("%e %d %m %y",$day)."\n"; + + $subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)]; + + if ($day > time()) + { + $datas[$i] = 'x'; // Valeur spéciale permettant de ne pas tracer le graph + } + else + { + $datas[$i] = $solde + $subtotal; + } + + if (strftime("%d",$day) == 1) + { + $labels[$i] = strftime("%d",$day); + } + else + { + + } + + $day += 86400; + $xyear = strftime("%Y",$day); + $i++; + } + + $width = 750; + $height = 350; + + $graph = new Graph($width, $height,"auto"); + $graph->SetScale("textlin"); + + $graph->yaxis->scale->SetGrace(2); + $graph->SetFrame(1); + $graph->img->SetMargin(60,20,20,35); + + $b2plot = new LinePlot($datas); + + $b2plot->SetColor("blue"); + //$b2plot->SetWeight(2); + + $graph->title->Set("Solde $year"); + + $graph->xaxis->SetTickLabels($labels); + + $graph->xaxis->Hide(); + //$graph->xaxis->HideTicks(); - //$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); - - $graph->Add($b2plot); - $graph->img->SetImgFormat("png"); - - $file= $conf->banque->dir_images."/solde.$account.$year.png"; - - $graph->Stroke($file); + //$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time())); + + $graph->Add($b2plot); + $graph->img->SetImgFormat("png"); + + $file= $conf->banque->dir_images."/solde.$account.$year.png"; + + $graph->Stroke($file); } /* - * Graph annuels - * - */ +* Graph annuels +* +*/ foreach ($accounts as $account) { - $labels = array(); - $datas = array(); - $amounts = array(); - - $sql = "SELECT min(".$db->pdate("datev")."),max(".$db->pdate("datev").")"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; + $labels = array(); + $datas = array(); + $amounts = array(); - $resql = $db->query($sql); + $sql = "SELECT min(".$db->pdate("datev")."),max(".$db->pdate("datev").")"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; - if ($resql) - { - $num = $db->num_rows($resql); - $row = $db->fetch_row($resql); - $min = $row[0]; - $max = $row[1]; - } - else - { - dolibarr_syslog("graph-solde.php Error"); - } + $resql = $db->query($sql); - - $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; - $sql .= " GROUP BY date_format(datev,'%Y%m%d');"; - - $resql = $db->query($sql); - - $amounts = array(); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) + if ($resql) { - $row = $db->fetch_row($resql); - $amounts[$row[0]] = $row[1]; - $i++; - } - } - else - { - dolibarr_syslog("graph-solde.php Error"); - } - - $subtotal = 0; - - $day = $min; - - $i = 0; - while ($day <= $max) - { - //print strftime ("%e %d %m %y",$day)."\n"; - - $subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)]; + $num = $db->num_rows($resql); + $row = $db->fetch_row($resql); + $min = $row[0]; + $max = $row[1]; + } + else + { + dolibarr_syslog("graph-solde.php Error"); + } - $datas[$i] = $solde + $subtotal; - $labels[$i] = strftime("%d",$day); + $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; + $sql .= " GROUP BY date_format(datev,'%Y%m%d');"; - $day += 86400; - $i++; - } + $resql = $db->query($sql); - if (sizeof($amounts) > 3) - { - $width = 750; - $height = 350; + $amounts = array(); - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(2); - $graph->SetFrame(1); - $graph->img->SetMargin(60,20,20,35); - - $b2plot = new LinePlot($datas); - - $b2plot->SetColor("blue"); - - $graph->title->Set("Solde"); - - $graph->xaxis->SetTickLabels($labels); - - $graph->xaxis->Hide(); - - $graph->Add($b2plot); - $graph->img->SetImgFormat("png"); - - $file= $conf->banque->dir_images."/solde.$account.png"; - - $graph->Stroke($file); - } + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + + while ($i < $num) + { + $row = $db->fetch_row($resql); + $amounts[$row[0]] = $row[1]; + $i++; + } + } + else + { + dolibarr_syslog("graph-solde.php Error"); + } + + $subtotal = 0; + + $day = $min; + + $i = 0; + while ($day <= $max) + { + //print strftime ("%e %d %m %y",$day)."\n"; + + $subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)]; + + $datas[$i] = $solde + $subtotal; + + $labels[$i] = strftime("%d",$day); + + $day += 86400; + $i++; + } + + if (sizeof($amounts) > 3) + { + $width = 750; + $height = 350; + + $graph = new Graph($width, $height,"auto"); + $graph->SetScale("textlin"); + + $graph->yaxis->scale->SetGrace(2); + $graph->SetFrame(1); + $graph->img->SetMargin(60,20,20,35); + + $b2plot = new LinePlot($datas); + + $b2plot->SetColor("blue"); + + $graph->title->Set("Solde"); + + $graph->xaxis->SetTickLabels($labels); + + $graph->xaxis->Hide(); + + $graph->Add($b2plot); + $graph->img->SetImgFormat("png"); + + $file= $conf->banque->dir_images."/solde.$account.png"; + + $graph->Stroke($file); + } } foreach ($accounts as $account) { - $labels = array(); - $datas = array(); - $amounts = array(); - $credits = array(); - $debits = array(); + $labels = array(); + $datas = array(); + $amounts = array(); + $credits = array(); + $debits = array(); - $sql = "SELECT date_format(datev,'%m'), sum(amount)"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; - $sql .= " AND date_format(datev,'%Y') = '".$year."'"; - $sql .= " AND amount > 0"; - $sql .= " GROUP BY date_format(datev,'%m');"; + $sql = "SELECT date_format(datev,'%m'), sum(amount)"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; + $sql .= " AND date_format(datev,'%Y') = '".$year."'"; + $sql .= " AND amount > 0"; + $sql .= " GROUP BY date_format(datev,'%m');"; - $resql = $db->query($sql); - - $amounts = array(); - - if ($resql) - { - $num = $db->num_rows($resql); - $i = 0; - - while ($i < $num) + $resql = $db->query($sql); + + $amounts = array(); + + if ($resql) { - $row = $db->fetch_row($resql); - $credits[$row[0]] = $row[1]; - $i++; - } - } - else - { - print $sql ; - } + $num = $db->num_rows($resql); + $i = 0; - $sql = "SELECT date_format(datev,'%m'), sum(amount)"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account = ".$account; - $sql .= " AND date_format(datev,'%Y') = '".$year."'"; - $sql .= " AND amount < 0"; - $sql .= " GROUP BY date_format(datev,'%m');"; - - $resql = $db->query($sql); - if ($resql) - { - while ($row = $db->fetch_row($resql)) + while ($i < $num) + { + $row = $db->fetch_row($resql); + $credits[$row[0]] = $row[1]; + $i++; + } + } + else { - $debits[$row[0]] = abs($row[1]); - } - } - else - { - print $sql ; - } + print $sql ; + } - for ($i = 0 ; $i < 12 ; $i++) - { - $data_credit[$i] = $credits[substr("0".($i+1),-2)]; - $data_debit[$i] = $debits[substr("0".($i+1),-2)]; - $labels[$i] = $i+1; - } + $sql = "SELECT date_format(datev,'%m'), sum(amount)"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank"; + $sql .= " WHERE fk_account = ".$account; + $sql .= " AND date_format(datev,'%Y') = '".$year."'"; + $sql .= " AND amount < 0"; + $sql .= " GROUP BY date_format(datev,'%m');"; - $width = 750; - $height = 350; - - $graph = new Graph($width, $height,"auto"); - $graph->SetScale("textlin"); - - $graph->yaxis->scale->SetGrace(2); - //$graph->SetFrame(1); - $graph->img->SetMargin(60,20,20,35); - - $bsplot = new BarPlot($data_debit); - $bsplot->SetColor("red"); - - $beplot = new BarPlot($data_credit); - $beplot->SetColor("green"); + $resql = $db->query($sql); + if ($resql) + { + while ($row = $db->fetch_row($resql)) + { + $debits[$row[0]] = abs($row[1]); + } + } + else + { + print $sql ; + } - $bg = new GroupBarPlot(array($beplot, $bsplot)); + for ($i = 0 ; $i < 12 ; $i++) + { + $data_credit[$i] = $credits[substr("0".($i+1),-2)]; + $data_debit[$i] = $debits[substr("0".($i+1),-2)]; + $labels[$i] = $i+1; + } - $graph->title->Set("Mouvements $year"); - - $graph->xaxis->SetTickLabels($labels); - - $graph->Add($bg); - $graph->img->SetImgFormat("png"); - - $file= DOL_DATA_ROOT."/graph/banque/mouvement.$account.$year.png"; - - $graph->Stroke($file); + $width = 750; + $height = 350; + + $graph = new Graph($width, $height,"auto"); + $graph->SetScale("textlin"); + + $graph->yaxis->scale->SetGrace(2); + //$graph->SetFrame(1); + $graph->img->SetMargin(60,20,20,35); + + $bsplot = new BarPlot($data_debit); + $bsplot->SetColor("red"); + + $beplot = new BarPlot($data_credit); + $beplot->SetColor("green"); + + $bg = new GroupBarPlot(array($beplot, $bsplot)); + + $graph->title->Set("Mouvements $year"); + + $graph->xaxis->SetTickLabels($labels); + + $graph->Add($bg); + $graph->img->SetImgFormat("png"); + + $file= $conf->banque->dir_images."/mouvement.$account.$year.png"; + + $graph->Stroke($file); } ?>