[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2003,2005 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: cumul.php,v 1.22 2005/07/10 17:46:04 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/stats/cumul.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/compta/stats/cumul.php 26 \brief Page reporting compta chiffre affaire cumulé 27 \version $Revision: 1.22 $ 28 */ 29 30 require ("./pre.inc.php"); 31 32 33 llxHeader(); 34 35 /* 36 * Sécurité accés client 37 */ 38 if ($user->societe_id > 0) 39 { 40 $socidp = $user->societe_id; 41 } 42 43 $mode='recettes'; 44 if ($conf->compta->mode == 'CREANCES-DETTES') { $mode='creances'; } 45 46 print_titre("Chiffre d'affaire cumulé (".$langs->trans("Currency".$conf->monnaie)." HT)"); 47 48 print '<table width="100%"><tr><td valign="top">'; 49 50 $sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm"; 51 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; 52 $sql .= " WHERE f.fk_statut = 1"; 53 if ($conf->compta->mode != 'CREANCES-DETTES') 54 { 55 $sql .= " AND f.paye = 1"; 56 } 57 if ($socidp) 58 { 59 $sql .= " AND f.fk_soc = $socidp"; 60 } 61 $sql .= " GROUP BY dm"; 62 63 pt($db, $sql,"Suivi cumul par mois"); 64 65 print '</td><td valign="top">'; 66 67 $sql = "SELECT sum(f.total) as amount, year(f.datef) as dm"; 68 $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; 69 $sql .= " WHERE f.fk_statut = 1"; 70 if ($conf->compta->mode != 'CREANCES-DETTES') { 71 $sql .= " AND f.paye = 1"; 72 } 73 if ($socidp) 74 { 75 $sql .= " AND f.fk_soc = $socidp"; 76 } 77 $sql .= " GROUP BY dm"; 78 79 80 pt($db, $sql,"Suivi cumul par année"); 81 82 print "</td></tr></table>"; 83 84 $db->close(); 85 86 llxFooter('$Date: 2005/07/10 17:46:04 $ - $Revision: 1.22 $'); 87 88 89 90 /* 91 * Fonctions 92 * 93 */ 94 95 function pt ($db, $sql, $date) 96 { 97 global $langs; 98 99 $bc[0]="class=\"pair\""; 100 $bc[1]="class=\"impair\""; 101 102 $resql = $db->query($sql); 103 if ($resql) 104 { 105 $num = $db->num_rows($resql); 106 $i = 0; $total = 0 ; 107 print '<table class="noborder" width="100%">'; 108 print "<tr class=\"liste_titre\">"; 109 print "<td width=\"60%\">$date</td>"; 110 print "<td align=\"right\">".$langs->trans("Amount")."</td>"; 111 print "<td align=\"right\">".$langs->trans("Total")."</td>\n"; 112 print "</tr>\n"; 113 $var=True; 114 while ($i < $num) 115 { 116 $obj = $db->fetch_object($resql); 117 $var=!$var; 118 $total = $total + $obj->amount; 119 print "<tr $bc[$var]>"; 120 print "<td>$obj->dm</td>\n"; 121 print "<td align=\"right\">".price($obj->amount)."</td><td align=\"right\">".price($total)."</td>\n"; 122 print "</tr>\n"; 123 124 $i++; 125 } 126 print "<tr class=\"liste_total\"><td align=\"right\">".$langs->trans("Total")."</td><td align=\"right\"> </b></td><td align=\"right\"><b>".price($total)."</b></td></tr>\n"; 127 128 print "</table>\n"; 129 $db->free($resql); 130 } 131 } 132 133 134 llxFooter('$Date: 2005/07/10 17:46:04 $ - $Revision: 1.22 $'); 135 ?>
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 |
![]() |