[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: remav.php,v 1.2 2005/09/13 13:37:53 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/distributeurs/remav.php,v $ 20 * 21 */ 22 require ("./pre.inc.php"); 23 24 if ($user->distributeur_id) 25 { 26 $_GET["id"] = $user->distributeur_id; 27 } 28 29 llxHeader(); 30 31 32 $page = $_GET["page"]; 33 $sortorder = $_GET["sortorder"]; 34 $sortfield = $_GET["sortfield"]; 35 if ($sortorder == "") $sortorder="DESC"; 36 if ($sortfield == "") $sortfield="p.datepo"; 37 38 /* 39 * 40 * 41 */ 42 43 if ($_GET["id"]) 44 { 45 $h = 0; 46 $distri = new DistributeurTelephonie($db); 47 $distri->fetch($_GET["id"]); 48 49 $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id; 50 $head[$h][1] = $distri->nom; 51 $h++; 52 53 $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id; 54 $head[$h][1] = "Contrat"; 55 $h++; 56 57 $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/commissions.php?id='.$distri->id; 58 $head[$h][1] = "Rémunérations"; 59 $h++; 60 61 $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remav.php?id='.$distri->id; 62 $head[$h][1] = "Rém. avance"; 63 $hselected = $h; 64 $h++; 65 66 $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remconso.php?id='.$distri->id; 67 $head[$h][1] = "Rém. conso"; 68 $h++; 69 70 $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id; 71 $head[$h][1] = "Prises d'ordre"; 72 $h++; 73 74 $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id; 75 $head[$h][1] = "Statistiques"; 76 $h++; 77 78 dolibarr_fiche_head($head, $hselected, "Distributeur"); 79 80 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 81 print '<tr><td width="70%" valign="top">'; 82 83 if ($page == -1) { $page = 0 ; } 84 85 $offset = $conf->liste_limit * $page ; 86 $pageprev = $page - 1; 87 $pagenext = $page + 1; 88 89 /* 90 * Mode Liste 91 * 92 */ 93 94 if ($_GET["month"] > 0) 95 { 96 $datetime = mktime(12,12,12,substr($_GET["month"], -2), 1 , substr($_GET["month"],0,4)); 97 } 98 else 99 { 100 $datetime = time(); 101 } 102 103 $month = substr("00".strftime("%m", $datetime), -2); 104 $year = strftime("%Y", $datetime); 105 $mois = strftime("%B %Y", $datetime); 106 107 $sql = "SELECT s.idp, s.nom, a.fk_contrat, sum(a.montant) as montant"; 108 109 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance as a"; 110 $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; 111 $sql .= " , ".MAIN_DB_PREFIX."societe as s"; 112 113 $sql .= " WHERE a.fk_distributeur =".$distri->id; 114 $sql .= " AND a.fk_contrat = c.rowid"; 115 $sql .= " AND c.fk_soc = s.idp"; 116 $sql .= " AND a.date ='".$year.$month."'"; 117 $sql .= " GROUP BY s.idp"; 118 $sql .= " ORDER BY s.nom ASC"; 119 120 $resql = $db->query($sql); 121 if ($resql) 122 { 123 $num = $db->num_rows($resql); 124 $i = 0; 125 126 print_barre_liste("Rémunération sur avance pour $mois", $page, "po.php", "", $sortfield, $sortorder, '', $num); 127 128 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 129 print '<tr class="liste_titre"><td>Client</td>'; 130 print '<td align="right">Montant</td>'; 131 print "</tr>\n"; 132 133 $var=True; 134 135 while ($i < min($num,$conf->liste_limit)) 136 { 137 $obj = $db->fetch_object($resql); 138 $var=!$var; 139 140 print "<tr $bc[$var]>"; 141 print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->idp.'">'; 142 print img_file(); 143 print '</a> '; 144 print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->idp.'">'.$obj->nom."</a></td>\n"; 145 print '<td align="right">'.sprintf("%01.2f",$obj->montant)."</td>\n"; 146 print "</tr>\n"; 147 $i++; 148 } 149 print "</table>"; 150 $db->free(); 151 } 152 else 153 { 154 print $db->error() . ' ' . $sql; 155 } 156 157 158 print '</td><td width="30%" valign="top">'; 159 160 161 $sql = "SELECT distinct(a.date)"; 162 163 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission_avance as a"; 164 $sql .= " ORDER BY a.date DESC"; 165 166 $resql = $db->query($sql); 167 if ($resql) 168 { 169 $num = $db->num_rows($resql); 170 $i = 0; 171 print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">'; 172 print '<tr class="liste_titre"><td>Mois</td>'; 173 print "</tr>\n"; 174 175 $var=True; 176 177 while ( $obj = $db->fetch_object($resql)) 178 { 179 $var=!$var; 180 181 print "<tr $bc[$var]><td>"; 182 print '<a href="'.DOL_URL_ROOT.'/telephonie/distributeurs/remav.php?id='.$_GET["id"]; 183 print '&month='.$obj->date.'">'.$obj->date."</a></td>\n"; 184 print "</tr>\n"; 185 } 186 print "</table>"; 187 $db->free(); 188 } 189 else 190 { 191 print $db->error() . ' ' . $sql; 192 } 193 194 195 print '</td></tr></table>'; 196 } 197 198 $db->close(); 199 200 llxFooter("<em>Dernière modification $Date: 2005/09/13 13:37:53 $ révision $Revision: 1.2 $</em>"); 201 ?>
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 |
![]() |