Bugfix
This commit is contained in:
parent
0d3445b83c
commit
d7c6937675
@ -31,8 +31,7 @@ include_once (JPGRAPH_DIR."jpgraph_canvas.php");
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$labels = array();
|
|
||||||
$datas = array();
|
|
||||||
|
|
||||||
$datetime = time();
|
$datetime = time();
|
||||||
$month = strftime("%m", $datetime);
|
$month = strftime("%m", $datetime);
|
||||||
@ -64,7 +63,7 @@ $sql .= " WHERE date_format(datev,'%Y%m') = '".$year.$month."'";
|
|||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
$amounts = array();
|
$accounts = array();
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -85,7 +84,9 @@ $account = 1;
|
|||||||
foreach ($accounts as $account)
|
foreach ($accounts as $account)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$labels = array();
|
||||||
|
$datas = array();
|
||||||
|
$amounts = array();
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT sum(amount)";
|
$sql = "SELECT sum(amount)";
|
||||||
@ -105,82 +106,82 @@ foreach ($accounts as $account)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
$sql = "SELECT date_format(datev,'%Y%m%d'), sum(amount)";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
|
||||||
$sql .= " WHERE fk_account = ".$account;
|
$sql .= " WHERE fk_account = ".$account;
|
||||||
$sql .= " AND date_format(datev,'%Y%m') = '".$year.$month."'";
|
$sql .= " AND date_format(datev,'%Y%m') = '".$year.$month."'";
|
||||||
$sql .= " GROUP BY date_format(datev,'%Y%m%d');";
|
$sql .= " GROUP BY date_format(datev,'%Y%m%d');";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
$amounts = array();
|
$amounts = array();
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
{
|
||||||
$row = $db->fetch_row($resql);
|
$num = $db->num_rows($resql);
|
||||||
$amounts[$row[0]] = $row[1];
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
$amounts[$row[0]] = $row[1];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $sql ;
|
||||||
|
}
|
||||||
|
|
||||||
|
$subtotal = 0;
|
||||||
|
|
||||||
|
|
||||||
|
$day = mktime(1,1,1,$month,1,$year);
|
||||||
|
|
||||||
|
$xmonth = substr("00".strftime("%m",$day), -2);
|
||||||
|
$i = 0;
|
||||||
|
while ($xmonth == $month)
|
||||||
|
{
|
||||||
|
//print strftime ("%e %d %m %y",$day)."\n";
|
||||||
|
|
||||||
|
$subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)];
|
||||||
|
|
||||||
|
$datas[$i] = $solde + $subtotal;
|
||||||
|
$labels[$i] = strftime("%d",$day);
|
||||||
|
|
||||||
|
$day += 86400;
|
||||||
|
$xmonth = substr("00".strftime("%m",$day), -2);
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $sql ;
|
|
||||||
}
|
|
||||||
|
|
||||||
$subtotal = 0;
|
$width = 750;
|
||||||
|
$height = 350;
|
||||||
|
|
||||||
|
$graph = new Graph($width, $height,"auto");
|
||||||
|
$graph->SetScale("textlin");
|
||||||
|
|
||||||
$day = mktime(1,1,1,$month,1,$year);
|
$graph->yaxis->scale->SetGrace(2);
|
||||||
|
$graph->SetFrame(1);
|
||||||
|
$graph->img->SetMargin(40,20,20,35);
|
||||||
|
|
||||||
$xmonth = substr("00".strftime("%m",$day), -2);
|
$b2plot = new BarPlot($datas);
|
||||||
$i = 0;
|
|
||||||
while ($xmonth == $month)
|
|
||||||
{
|
|
||||||
//print strftime ("%e %d %m %y",$day)."\n";
|
|
||||||
|
|
||||||
$subtotal = $subtotal + $amounts[strftime("%Y%m%d",$day)];
|
$b2plot->SetColor("blue");
|
||||||
|
//$b2plot->SetWeight(2);
|
||||||
|
|
||||||
$datas[$i] = $solde + $subtotal;
|
$graph->title->Set("Solde");
|
||||||
$labels[$i] = strftime("%d",$day);
|
|
||||||
|
|
||||||
$day += 86400;
|
$graph->xaxis->SetTickLabels($labels);
|
||||||
$xmonth = substr("00".strftime("%m",$day), -2);
|
//$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time()));
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$graph->Add($b2plot);
|
||||||
|
$graph->img->SetImgFormat("png");
|
||||||
|
|
||||||
$width = 750;
|
$file= DOL_DATA_ROOT."/graph/banque/solde.$account.png";
|
||||||
$height = 350;
|
|
||||||
|
|
||||||
$graph = new Graph($width, $height,"auto");
|
$graph->Stroke($file);
|
||||||
$graph->SetScale("textlin");
|
|
||||||
|
|
||||||
$graph->yaxis->scale->SetGrace(2);
|
|
||||||
$graph->SetFrame(1);
|
|
||||||
$graph->img->SetMargin(40,20,20,35);
|
|
||||||
|
|
||||||
$b2plot = new BarPlot($datas);
|
|
||||||
|
|
||||||
$b2plot->SetColor("blue");
|
|
||||||
//$b2plot->SetWeight(2);
|
|
||||||
|
|
||||||
$graph->title->Set("Solde");
|
|
||||||
|
|
||||||
$graph->xaxis->SetTickLabels($labels);
|
|
||||||
//$graph->xaxis->title->Set(strftime("%d/%m/%y %H:%M:%S", time()));
|
|
||||||
|
|
||||||
$graph->Add($b2plot);
|
|
||||||
$graph->img->SetImgFormat("png");
|
|
||||||
|
|
||||||
$file= DOL_DATA_ROOT."/graph/banque/solde.$account.png";
|
|
||||||
|
|
||||||
$graph->Stroke($file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user