[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (c) 2004 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: index.php,v 1.13 2005/07/16 14:56:25 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/facture/stats/index.php,v $ 21 * 22 */ 23 24 /** 25 \file htdocs/compta/facture/stats/index.php 26 \ingroup facture 27 \brief Page des stats factures 28 \version $Revision: 1.13 $ 29 */ 30 31 require ("./pre.inc.php"); 32 33 $WIDTH=500; 34 $HEIGHT=250; 35 36 37 /* 38 * Sécurité accés client 39 */ 40 if ($user->societe_id > 0) 41 { 42 $action = ''; 43 $socidp = $user->societe_id; 44 } 45 46 llxHeader(); 47 48 print_fiche_titre($langs->trans("BillsStatistics"), $mesg); 49 50 $stats = new FactureStats($db, $socidp); 51 $year = strftime("%Y", time()); 52 $data = $stats->getNbByMonthWithPrevYear($year); 53 54 if (! is_dir($conf->facture->dir_images)) { mkdir($conf->facture->dir_images); } 55 56 $filename = $conf->facture->dir_images."/nbfacture2year-".$year.".png"; 57 $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=nbfacture2year-'.$year.'.png'; 58 59 $px = new BarGraph(); 60 $mesg = $px->isGraphKo(); 61 if (! $mesg) { 62 $px->SetData($data); 63 $px->SetMaxValue($px->GetMaxValue()); 64 $px->SetLegend(array($year - 1, $year)); 65 $px->SetWidth($WIDTH); 66 $px->SetHeight($HEIGHT); 67 $px->draw($filename); 68 } 69 70 $sql = "SELECT count(*), date_format(datef,'%Y') as dm, sum(total) FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0 "; 71 if ($socidp) 72 { 73 $sql .= " AND fk_soc = $socidp"; 74 } 75 $sql .= " GROUP BY dm DESC "; 76 if ($db->query($sql)) 77 { 78 $num = $db->num_rows(); 79 80 print '<table class="border" width="100%">'; 81 print '<tr><td align="center">'.$langs->trans("Year").'</td><td width="10%" align="center">'.$langs->trans("NumberOfBills").'</td><td align="center">'.$langs->trans("AmountTotal").'</td>'; 82 print '<td align="center" valign="top" rowspan="'.($num + 1).'">'; 83 if ($mesg) { print $mesg; } 84 else { print '<img src="'.$fileurl.'" alt="Nombre de factures par mois">'; } 85 print '</td></tr>'; 86 $i = 0; 87 while ($i < $num) 88 { 89 $row = $db->fetch_row($i); 90 $nbproduct = $row[0]; 91 $year = $row[1]; 92 print "<tr>"; 93 print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td><td align="center">'.$nbproduct.'</td><td align="center">'.price($row[2]).'</td></tr>'; 94 $i++; 95 } 96 97 print '</table>'; 98 $db->free(); 99 } 100 else 101 { 102 dolibarr_print_error($db); 103 } 104 105 106 $db->close(); 107 108 llxFooter('$Date: 2005/07/16 14:56:25 $ - $Revision: 1.13 $'); 109 ?>
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 |
![]() |