| [ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2005 Christophe 3 * Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 * $Id: box_comptes.php,v 1.3 2005/11/15 15:41:54 ccomb Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_comptes.php,v $ 21 */ 22 23 /** 24 \file htdocs/includes/boxes/box_comptes.php 25 \ingroup banque 26 \brief Module de génération de l'affichage de la box comptes 27 */ 28 29 include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php"); 30 include_once (DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); 31 32 33 class box_comptes extends ModeleBoxes { 34 35 var $boxcode="currentaccounts"; 36 var $boximg="object_bill"; 37 var $boxlabel; 38 var $depends = array("banque"); // Box active si module banque actif 39 40 var $info_box_head = array(); 41 var $info_box_contents = array(); 42 43 /** 44 * \brief Constructeur de la classe 45 */ 46 function box_comptes() 47 { 48 global $langs; 49 $langs->load("boxes"); 50 51 $this->boxlabel=$langs->trans('BoxCurrentAccounts'); 52 } 53 54 /** 55 * \brief Charge les données en mémoire pour affichage ultérieur 56 * \param $max Nombre maximum d'enregistrements à charger 57 */ 58 function loadBox($max=5) 59 { 60 global $user, $langs, $db; 61 $langs->load("boxes"); 62 63 $this->info_box_head = array('text' => $langs->trans("BoxTitleCurrentAccounts")); 64 65 if ($user->rights->banque->lire) 66 { 67 $sql = "SELECT rowid, label, bank, number"; 68 $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; 69 $sql .= " WHERE clos = 0 AND courant = 1"; 70 $sql .= " ORDER BY label"; 71 $sql .= $db->plimit($max, 0); 72 73 $result = $db->query($sql); 74 75 if ($result) 76 { 77 $num = $db->num_rows($result); 78 79 $i = 0; 80 $solde_total = 0; 81 82 while ($i < $num) 83 { 84 $objp = $db->fetch_object($result); 85 $acc = new Account($db); 86 $acc->fetch($objp->rowid); 87 $solde_total += $acc->solde(); 88 89 $this->info_box_contents[$i][0] = array('align' => 'left', 90 'logo' => $this->boximg, 91 'text' => stripslashes($objp->label), 92 'url' => DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid); 93 94 $this->info_box_contents[$i][1] = array('align' => 'left', 95 'text' => stripslashes($objp->bank) 96 ); 97 98 $this->info_box_contents[$i][2] = array('align' => 'left', 99 'text' => stripslashes($objp->number) 100 ); 101 102 $this->info_box_contents[$i][3] = array('align' => 'right', 103 'text' => price( $acc->solde() ) 104 ); 105 106 $i++; 107 } 108 109 // Total 110 $this->info_box_contents[$i][-1] = array('class' => 'liste_total'); 111 112 $this->info_box_contents[$i][0] = array('align' => 'right', 113 'colspan' => '4', 114 'class' => 'liste_total', 115 'text' => $langs->trans('Total') 116 ); 117 118 $this->info_box_contents[$i][1] = array('align' => 'right', 119 'class' => 'liste_total', 120 'text' => price($solde_total) 121 ); 122 123 } 124 else { 125 dolibarr_print_error($db); 126 } 127 } 128 else { 129 $this->info_box_contents[0][0] = array('align' => 'left', 130 'text' => $langs->trans("ReadPermissionNotAllowed")); 131 } 132 133 } 134 135 function showBox() 136 { 137 parent::showBox($this->info_box_head, $this->info_box_contents); 138 } 139 140 } 141 142 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
|