/[dolibarr]/dolibarr/scripts/banque/graph-solde.php
ViewVC logotype

Diff of /dolibarr/scripts/banque/graph-solde.php

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

revision 1.1 by rodolphe, Sun Jul 31 17:24:43 2005 UTC revision 1.2 by rodolphe, Sun Jul 31 18:33:29 2005 UTC
# Line 38  $datetime = time(); Line 38  $datetime = time();
38  $month = strftime("%m", $datetime);  $month = strftime("%m", $datetime);
39  $year = strftime("%Y", $datetime);  $year = strftime("%Y", $datetime);
40    
 $account = 1;  
   
41  if ($month == 1)  if ($month == 1)
42  {  {
43    $monthprev = "12";    $monthprev = "12";
# Line 60  else Line 58  else
58    $monthnext = substr("00".($month + 1), -2) ;    $monthnext = substr("00".($month + 1), -2) ;
59  }  }
60    
61    $sql = "SELECT distinct(fk_account)";
 $sql = "SELECT sum(amount)";  
62  $sql .= " FROM ".MAIN_DB_PREFIX."bank";  $sql .= " FROM ".MAIN_DB_PREFIX."bank";
63  $sql .= " WHERE fk_account = ".$account;  $sql .= " WHERE date_format(datev,'%Y%m') = '".$year.$month."'";
 $sql .= " AND datev < '".$year."-".$month."-01';";  
64    
65  $resql = $db->query($sql);  $resql = $db->query($sql);
66    
67    $amounts = array();
68    
69  if ($resql)  if ($resql)
70  {  {
71    $row = $db->fetch_row($resql);    $num = $db->num_rows($resql);
72    $solde = $row[0];    $i = 0;
73    
74      while ($i < $num)
75        {
76          $row = $db->fetch_row($resql);
77          array_push($accounts, $row[0]);
78          $i++;
79        }
80    
81  }  }
82  else    
83    $account = 1;
84    
85    foreach ($accounts as $account)
86  {  {
87    print $sql ;  
88  }  
89    
90    
91      $sql = "SELECT sum(amount)";
92      $sql .= " FROM ".MAIN_DB_PREFIX."bank";
93      $sql .= " WHERE fk_account = ".$account;
94      $sql .= " AND datev < '".$year."-".$month."-01';";
95      
96      $resql = $db->query($sql);
97      if ($resql)
98      {
99        $row = $db->fetch_row($resql);
100        $solde = $row[0];
101      }
102      else
103        {
104          print $sql ;
105        }
106    
107    
108  $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";  $sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
# Line 154  $graph->img->SetImgFormat("png"); Line 181  $graph->img->SetImgFormat("png");
181  $file= DOL_DATA_ROOT."/graph/banque/solde.$account.png";  $file= DOL_DATA_ROOT."/graph/banque/solde.$account.png";
182    
183  $graph->Stroke($file);  $graph->Stroke($file);
184    }
185    
186  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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