/[dolibarr]/dolibarr/htdocs/telephonie/distributeurs/distributeur.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/distributeurs/distributeur.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by rodolphe, Thu Aug 11 15:18:54 2005 UTC revision 1.8 by rodolphe, Fri Aug 12 19:36:51 2005 UTC
# Line 72  if ($_GET["id"]) Line 72  if ($_GET["id"])
72        
73    if ($resql)    if ($resql)
74      {      {
75        $num = $db->num_rows();        $num = $db->num_rows($resql);
76        $i = 0;        $i = 0;
77        $total = 0;        $total = 0;
78                
79        while ($i < $num)        while ($i < $num)
80          {          {
81            $row = $db->fetch_row($i);                $row = $db->fetch_row($resql);
82                        
83            $var=!$var;            $var=!$var;
84                        
# Line 88  if ($_GET["id"]) Line 88  if ($_GET["id"])
88                        
89            $i++;            $i++;
90          }          }
91        $db->free();        $db->free($resql);
92      }      }
93    else    else
94      {      {
# Line 96  if ($_GET["id"]) Line 96  if ($_GET["id"])
96      }      }
97    print '</table><br />';    print '</table><br />';
98    
99    
100      print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
101      print '<tr class="liste_titre"><td colspan="2">Total commission</td></tr>';
102    
103      $sql = "SELECT sum(c.montant)";
104      $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c";  
105      $sql .= " WHERE c.fk_distributeur = ".$_GET["id"];
106        
107      $resql = $db->query($sql);
108      
109      if ($resql)
110        {
111          $num = $db->num_rows($resql);
112          $i = 0;
113          $total = 0;
114          $var = 0;
115          while ($i < $num)
116            {
117              $row = $db->fetch_row($resql);          
118              $var=!$var;    
119              print "<tr $bc[$var]>";        
120              print '<td>Total</td>';
121              print '<td align="right">'.price($row[0]).' HT</td>';
122              
123              $i++;
124            }
125          $db->free($resql);
126        }
127      else
128        {
129          print $db->error() . ' ' . $sql;
130        }
131      print '</table><br />';
132    
133    print '</td><td valign="top" width="30%">';    print '</td><td valign="top" width="30%">';
134        
# Line 106  if ($_GET["id"]) Line 139  if ($_GET["id"])
139    print '<tr class="liste_titre">';    print '<tr class="liste_titre">';
140    print '<td>Date</td><td align="right">Commissions</td></tr>';    print '<td>Date</td><td align="right">Commissions</td></tr>';
141    
   
142    $sql = "SELECT c.date, c.montant";    $sql = "SELECT c.date, c.montant";
143    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c";    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commission as c";  
     
144    $sql .= " WHERE c.fk_distributeur = ".$_GET["id"];    $sql .= " WHERE c.fk_distributeur = ".$_GET["id"];
   
145    $sql .= " ORDER BY c.date DESC";    $sql .= " ORDER BY c.date DESC";
146            
147    $resql = $db->query($sql);    $resql = $db->query($sql);
148        
149    if ($resql)    if ($resql)
150      {      {
151        $num = $db->num_rows();        $num = $db->num_rows($resql);
152        $i = 0;        $i = 0;
153        $total = 0;        $total = 0;
154                
155        while ($i < $num)        while ($i < $num)
156          {          {
157            $row = $db->fetch_row($i);                $row = $db->fetch_row($resql);        
             
           $var=!$var;  
             
           print "<tr $bc[$var]>";  
158                        
159              $var=!$var;    
160              print "<tr $bc[$var]>";        
161            print '<td>'.substr($row[0], -2).'/'.substr($row[0],0,4).'</td>';            print '<td>'.substr($row[0], -2).'/'.substr($row[0],0,4).'</td>';
162            print '<td align="right">'.price($row[1]).' HT</td>';            print '<td align="right">'.price($row[1]).' HT</td>';
163                        
164            $i++;            $i++;
165          }          }
166        $db->free();        $db->free($resql);
167      }      }
168    else    else
169      {      {
# Line 144  if ($_GET["id"]) Line 172  if ($_GET["id"])
172    print '</table><br />';    print '</table><br />';
173    
174    print '</td><td valign="top" width="30%">';    print '</td><td valign="top" width="30%">';
   
175    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
176    
177    print '<tr class="liste_titre">';    print '<tr class="liste_titre">';
178    print '<td>Date</td><td align="right">'."Prise d'ordre</td></tr>";    print '<td>Date</td><td align="right">'."Prise d'ordre mensuelle</td></tr>";
   
179    
180    $sql = "SELECT ".$db->pdate("p.datepo") . " as datepo, sum(p.montant)";    $sql = "SELECT ".$db->pdate("p.datepo") . " as datepo, sum(p.montant)";
181    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p";    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p";
# Line 160  if ($_GET["id"]) Line 186  if ($_GET["id"])
186        
187    if ($resql)    if ($resql)
188      {      {
189        $num = $db->num_rows();        $num = $db->num_rows($resql);
190        $i = 0;        $i = 0;
191        $total = 0;        $total = 0;
192                
193        while ($i < $num)        while ($i < $num)
194          {          {
195            $row = $db->fetch_row($i);                $row = $db->fetch_row($resql);        
196                        
197            $var=!$var;            $var=!$var;
198                        
# Line 177  if ($_GET["id"]) Line 203  if ($_GET["id"])
203                        
204            $i++;            $i++;
205          }          }
206        $db->free();        $db->free($resql);
207      }      }
208    else    else
209      {      {
# Line 188  if ($_GET["id"]) Line 214  if ($_GET["id"])
214    print '</td></tr>';    print '</td></tr>';
215    print '</table></div>';    print '</table></div>';
216    
   
217    /* ************************************************************************** */    /* ************************************************************************** */
218    /*                                                                            */    /*                                                                            */
219    /* Barre d'action                                                             */    /* Barre d'action                                                             */
# Line 202  if ($_GET["id"]) Line 227  if ($_GET["id"])
227      }      }
228        
229    print "</div><br>";    print "</div><br>";
   
   
   
230    
231    $db->close();    $db->close();
232  }  }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26