[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2004-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: budget.php,v 1.21 2005/07/10 17:46:03 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/bank/budget.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/compta/bank/budget.php 26 \ingroup banque 27 \brief Page de budget 28 \version $Revision: 1.21 $ 29 */ 30 31 require ("./pre.inc.php"); 32 33 if (!$user->rights->banque->lire) 34 accessforbidden(); 35 36 llxHeader(); 37 38 /* 39 * 40 * 41 */ 42 43 if ($_GET["bid"] == 0) 44 { 45 /* 46 * Liste mouvements par catégories d'écritures financières 47 */ 48 print_titre("Ecritures bancaires par catégories"); 49 print '<br>'; 50 51 print '<table class="noborder" width="100%">'; 52 print "<tr class=\"liste_titre\">"; 53 print '<td>'.$langs->trans("Description").'</td><td align="center">'.$langs->trans("Nb").'</td><td align="right">'.$langs->trans("Total").'</td><td align="right">'.$langs->trans("Average").'</td>'; 54 print "</tr>\n"; 55 56 $sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid "; 57 $sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as c, ".MAIN_DB_PREFIX."bank_class as l, ".MAIN_DB_PREFIX."bank as d"; 58 $sql .= " WHERE d.rowid=l.lineid AND c.rowid = l.fk_categ GROUP BY c.label, c.rowid ORDER BY c.label"; 59 60 $result = $db->query($sql); 61 if ($result) 62 { 63 $num = $db->num_rows($result); 64 $i = 0; $total = 0; 65 66 $var=true; 67 while ($i < $num) 68 { 69 $objp = $db->fetch_object($result); 70 $var=!$var; 71 print "<tr ".$bc[$var].">"; 72 print "<td><a href=\"budget.php?bid=$objp->rowid\">$objp->label</a></td>"; 73 print '<td align="center">'.$objp->nombre.'</td>'; 74 print "<td align=\"right\">".price(abs($objp->somme))."</td>"; 75 print "<td align=\"right\">".price(abs($objp->somme / $objp->nombre))."</td>"; 76 print "</tr>"; 77 $i++; 78 $total = $total + abs($objp->somme); 79 } 80 $db->free($result); 81 82 print '<tr class="liste_total"><td colspan="2" align="right">'.$langs->trans("Total").'</td>'; 83 print '<td align="right"><b>'.price($total).'</b></td><td colspan="2"> </td></tr>'; 84 } 85 else 86 { 87 dolibarr_print_error($db); 88 } 89 print "</table>"; 90 91 } 92 else 93 { 94 /* 95 * Rapport mouvements pour une catégorie donnée 96 */ 97 $sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ WHERE rowid=".$_GET["bid"]; 98 if ( $db->query($sql) ) 99 { 100 if ( $db->num_rows() ) 101 { 102 $budget_name = $db->result(0,0); 103 } 104 $db->free(); 105 } 106 107 print_titre("Ecriture bancaire pour la catégorie: $budget_name"); 108 print '<br>'; 109 110 print '<table class="noborder" width="100%">'; 111 print "<tr class=\"liste_titre\">"; 112 print '<td align="center">'.$langs->trans("Date").'</td>'; 113 print '<td align="left">'.$langs->trans("Bank").'</td>'; 114 print '<td width="60%">'.$langs->trans("Description").'</td><td align="right">'.$langs->trans("Amount").'</td><td> </td>'; 115 print "</tr>\n"; 116 117 $sql = "SELECT b.amount, b.label, ".$db->pdate("b.dateo")." as do, b.rowid, ba.label as labelcompte, ba.rowid as bankid"; 118 $sql.= " FROM ".MAIN_DB_PREFIX."bank_class as l, ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba"; 119 $sql.= " WHERE b.rowid=l.lineid AND l.fk_categ=".$_GET["bid"]; 120 $sql.= " AND b.fk_account = ba.rowid"; 121 $sql.= " ORDER BY b.dateo DESC"; 122 123 $result = $db->query($sql); 124 if ($result) 125 { 126 $num = $db->num_rows($result); 127 $i = 0; $total = 0; 128 129 $var=True; 130 while ($i < $num) 131 { 132 $objp = $db->fetch_object($result); 133 $var=!$var; 134 print "<tr $bc[$var]>"; 135 print "<td align=\"center\">".dolibarr_print_date($objp->do)."</td>\n"; 136 137 print "<td><a href=\"account.php?account=$objp->bankid\">$objp->labelcompte</a></td>"; 138 print "<td><a href=\"ligne.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowPayment"),"payment").' '.$objp->label.'</a></td>'; 139 print "<td align=\"right\">".price(0 - $objp->amount)."</td><td> </td>"; 140 print "</tr>"; 141 $i++; 142 $total = $total + (0 - $objp->amount); 143 } 144 $db->free(); 145 print '<tr class="liste_total"><td colspan="3" align="right">'.$langs->trans("Total")."</td><td align=\"right\"><b>".price(abs($total))."</b></td><td>".$langs->trans("Currency".$conf->monnaie)."</td></tr>"; 146 } 147 else 148 { 149 dolibarr_print_error($db); 150 } 151 print "</table>"; 152 153 } 154 155 $db->close(); 156 157 llxFooter('$Date: 2005/07/10 17:46:03 $ - $Revision: 1.21 $'); 158 159 ?>
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 |
![]() |