[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-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: prev.php,v 1.15 2005/08/16 07:38:25 rodolphe Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/stats/prev.php,v $ 21 * 22 */ 23 require ("./pre.inc.php"); 24 25 /* 26 * Sécurité accés client 27 */ 28 if ($user->societe_id > 0) 29 { 30 $socidp = $user->societe_id; 31 } 32 33 34 function pt ($db, $sql, $title) { 35 global $bc; 36 global $langs,$conf; 37 38 print '<table class="border" width="100%">'; 39 print '<tr class="liste_titre">'; 40 print "<td>$title</td>"; 41 print "<td align=\"right\">Montant</td>"; 42 print "</tr>\n"; 43 44 $result = $db->query($sql); 45 if ($result) 46 { 47 $num = $db->num_rows(); 48 $i = 0; $total = 0 ; 49 50 $var=True; 51 while ($i < $num) 52 { 53 $obj = $db->fetch_object($result); 54 $var=!$var; 55 print '<tr '.$bc[$var].'>'; 56 print '<td>'.$obj->dm.'</td>'; 57 print '<td align="right">'.price($obj->amount).'</td>'; 58 59 print "</tr>\n"; 60 $total = $total + $obj->amount; 61 $i++; 62 } 63 print "<tr class=\"total\"><td colspan=\"2\" align=\"right\"><b>".$langs->trans("TotalHT").": ".price($total)."</b> ".$langs->trans("Currency".$conf->monnaie)."</td></tr>"; 64 65 $db->free(); 66 } 67 else 68 { 69 dolibarr_print_error($db); 70 71 } 72 print "</table>"; 73 74 } 75 /* 76 * 77 */ 78 79 llxHeader(); 80 81 82 if ($sortfield == "") 83 { 84 $sortfield="lower(p.label)"; 85 } 86 if ($sortorder == "") 87 { 88 $sortorder="ASC"; 89 } 90 91 $in = "(1,2,4)"; 92 93 print_titre ("CA Prévisionnel basé sur les propositions <b>ouvertes</b> et <b>signées</b>"); 94 95 print '<table width="100%">'; 96 97 print '<tr><td valign="top">'; 98 99 $sql = "SELECT sum(f.price) as amount, date_format(f.datep,'%Y-%m') as dm"; 100 $sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in $in"; 101 if ($socidp) 102 { 103 $sql .= " AND f.fk_soc = $socidp"; 104 } 105 $sql .= " GROUP BY dm DESC"; 106 107 pt($db, $sql, $langs->trans("Month")); 108 109 print '</td><td valign="top">'; 110 111 $sql = "SELECT sum(f.price) as amount, year(f.datep) as dm"; 112 $sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in $in"; 113 if ($socidp) 114 { 115 $sql .= " AND f.fk_soc = $socidp"; 116 } 117 $sql .= " GROUP BY dm DESC"; 118 119 pt($db, $sql, "Année"); 120 121 print "<br>"; 122 123 $sql = "SELECT sum(f.price) as amount, month(f.datep) as dm"; 124 $sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in $in"; 125 if ($socidp) 126 { 127 $sql .= " AND f.fk_soc = $socidp"; 128 } 129 $sql .= " GROUP BY dm"; 130 131 pt($db, $sql, "Mois cumulés"); 132 133 print "</td></tr></table>"; 134 135 $db->close(); 136 137 138 llxFooter("<em>Dernière modification $Date: 2005/08/16 07:38:25 $ révision $Revision: 1.15 $</em>"); 139 ?>
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 |
![]() |