From 8c343297d186e07d4bdf40bb9f53e88e492dfef7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Jul 2006 14:37:19 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Ajout=20propri=E9t=E9=20url=20sur=20les?= =?UTF-8?q?=20comptes=20bancaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/bank/account.class.php | 22 ++++- htdocs/compta/bank/budget.php | 11 ++- htdocs/compta/bank/config.php | 58 ++++++------ htdocs/compta/bank/fiche.php | 2 +- htdocs/compta/bank/index.php | 137 +++++++++++---------------- htdocs/compta/bank/search.php | 14 +-- 6 files changed, 123 insertions(+), 121 deletions(-) diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index 1251e2723f1..bcc801b1e4b 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -632,6 +632,26 @@ class Account } } + + /** + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto Inclut le picto dans le lien + * \return string Chaine avec URL + */ + function getNomUrl($withpicto=0) + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowAccount"),'account').$lienfin.' '); + $result.=$lien.$this->label.$lienfin; + return $result; + } + } @@ -740,7 +760,7 @@ class AccountLine dolibarr_print_error($this->db); } } - + } ?> diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index e4b969ea0fd..1eac64c7b53 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -51,7 +51,10 @@ if ($_GET["bid"] == 0) print ''; print ""; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; $sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid "; @@ -71,9 +74,9 @@ if ($_GET["bid"] == 0) $var=!$var; print ""; print ""; - print ''; - print ""; - print ""; + print ''; + print '"; + print '"; print ""; $i++; $total = $total + abs($objp->somme); diff --git a/htdocs/compta/bank/config.php b/htdocs/compta/bank/config.php index 1c317f63532..bfc90c1efe3 100644 --- a/htdocs/compta/bank/config.php +++ b/htdocs/compta/bank/config.php @@ -1,6 +1,6 @@ - * 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 @@ -21,10 +21,10 @@ */ /** - \file htdocs/compta/bank/config.php - \ingroup banque - \brief Page de configuration des comptes bancaires - \version $Revision$ + \file htdocs/compta/bank/config.php + \ingroup banque + \brief Page de configuration des comptes bancaires + \version $Revision$ */ require("./pre.inc.php"); @@ -42,7 +42,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $sql = "SELECT rowid, label, number, bank, courant as type, clos, rappro"; @@ -53,27 +53,31 @@ $result = $db->query($sql); $var=false; if ($result) { - $account=new Account($db); - - $var=True; - $num = $db->num_rows($result); - $i = 0; $total = 0; - - $sep = 0; - - while ($i < $num) { - $objp = $db->fetch_object($result); - - $var=!$var; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i++; - } - $db->free($result); + $accountstatic=new Account($db); + + $var=True; + $num = $db->num_rows($result); + $i = 0; $total = 0; + + $sep = 0; + + while ($i < $num) + { + $objp = $db->fetch_object($result); + + $var=!$var; + print ''; + $accountstatic->id=$objp->rowid; + $accountstatic->label=$objp->label; + print ''; + print ''; + print ''; + print ''; + print ''; + + $i++; + } + $db->free($result); } print "
'.$langs->trans("Description").''.$langs->trans("Nb").''.$langs->trans("Total").''.$langs->trans("Average").''.$langs->trans("Description").''.$langs->trans("Nb").''.$langs->trans("Total").''.$langs->trans("Average").'
rowid\">$objp->label'.$objp->nombre.'".price(abs($objp->somme))."".price(abs($objp->somme / $objp->nombre))."'.$objp->nombre.''.price(abs($objp->somme))."'.price(abs($objp->somme / $objp->nombre))."
'.$langs->trans("Ref")."".$langs->trans("Type")."".$langs->trans("Bank").''.$langs->trans("AccountIdShort").''.$langs->trans("Conciliable").''.$langs->trans("Status").''.$langs->trans("Status").'
'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.''.$account->type_lib[$objp->type].''.$objp->bank.' '.$objp->number.' '.yn($objp->rappro).''.$account->status[$objp->clos].'
'.$accountstatic->getNomUrl(1).''.$accountstatic->type_lib[$objp->type].''.$objp->bank.' '.$objp->number.' '.yn($objp->rappro).''.$accountstatic->LibStatut($objp->clos,5).'
"; diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 2f3766d3d82..5ac67e8c71b 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -326,7 +326,7 @@ else } print ''.$langs->trans("Web").''; - print ''.$account->url.''; + print ''.$account->url.''; print "\n"; print ''; diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index b1c2bb20059..b2a77691130 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -1,6 +1,6 @@ - * 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 @@ -87,7 +87,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print "\n"; @@ -96,24 +96,27 @@ $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 ''; - - $total += $solde; - } + 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 @@ -126,10 +129,11 @@ print ''; /* * Comptes placements */ -print '
'.$langs->trans("CurrentAccounts").''.$langs->trans("Bank").''.$langs->trans("AccountIdShort").''.$langs->trans("Conciliable").''.$langs->trans("Conciliable").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
'; - print ''.img_object($langs->trans("ShowAccount"),'account').' '.$acc->label.''; - print ''.$acc->bank."$acc->number'.yn($acc->rappro).''.$acc->status[$acc->clos].''.price($solde).'
'.$acc->getNomUrl(1).''.$acc->bank.''.$acc->number.''.yn($acc->rappro).''.$acc->getLibStatut(2).''; + print ''.price($solde).''; + print '
 
'; -print ''; +print ''; +print ''; +print ''; print ''; -print ''; +print ''; print ''; print ''; print "\n"; @@ -138,24 +142,27 @@ $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 ''; - - $total += $solde; - } + 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 @@ -168,7 +175,6 @@ print ''; /* * Comptes caisse/liquide */ -print '
'.$langs->trans("SavingAccounts").''.$langs->trans("Bank").'
'.$langs->trans("SavingAccounts").''.$langs->trans("Bank").''.$langs->trans("Numero").''.$langs->trans("Conciliable").''.$langs->trans("Conciliable").''.$langs->trans("Status").''.$langs->trans("BankBalance").'
"; - print ''.img_object($langs->trans("ShowAccount"),'account').' '.$acc->label.''; - print "$acc->bank$acc->number'.yn($acc->rappro).''.$acc->status[$acc->clos].''.price($solde).'
'.$acc->getNomUrl(1).''.$acc->bank.''.$acc->number.''.yn($acc->rappro).''.$acc->getLibStatut(2).''; + print ''.price($solde).''; + print '
 
'; print ''; print ''; print ''; @@ -188,13 +194,15 @@ foreach ($accounts as $key=>$type) $var = !$var; $solde = $acc->solde(); - print "'; + print ""; + print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; $total += $solde; @@ -205,41 +213,6 @@ foreach ($accounts as $key=>$type) 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").'   
"; - print ''.img_object($langs->trans("ShowAccount"),'account').' '.$acc->label.''; - print ''.$acc->bank.'
'.$acc->getNomUrl(1).''.$acc->bank.'  '.$acc->status[$acc->clos].''.price($solde).''.$acc->getLibStatut(2).''; + print ''.price($solde).''; + print '
 '.$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).'
"; diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index d585d973d1a..6c767228bf2 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -1,6 +1,6 @@ - * 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 @@ -92,16 +92,18 @@ print ''; // Compte le nombre total d'écritures -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."bank"; -if ($account) { $sql .= " WHERE b.fk_account=$account"; } +$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."bank"; +if ($account) { $sql .= " WHERE b.fk_account=".$account; } $resql=$db->query($sql); if ($resql) { - $nbline = $db->result (0, 0); + $obj = $db->fetch_object($resql); + $nbline = $obj->nb; $db->free($resql); } -else { +else +{ dolibarr_print_error($db); } @@ -164,7 +166,7 @@ if ($result) $var=!$var; print ""; - print "".strftime("%d %b %y",$objp->do)."\n"; + print "".dolibarr_print_date($objp->do,"%d %b %y")."\n"; print "rowid&account=$objp->fk_account\">$objp->label ";