Ne graph que si il y a des donnees
This commit is contained in:
parent
539c531834
commit
612caf7d85
@ -98,7 +98,7 @@ foreach ( $products as $id => $fdir)
|
|||||||
$num[$i] = 0;
|
$num[$i] = 0;
|
||||||
$ca[$i] = 0;
|
$ca[$i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT date_format(f.datef,'%b'), sum(fd.qty), sum(fd.total_ht), date_format(f.datef,'%m')";
|
$sql = "SELECT date_format(f.datef,'%b'), sum(fd.qty), sum(fd.total_ht), date_format(f.datef,'%m')";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as fd";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as fd";
|
||||||
$sql .= " WHERE f.rowid = fd.fk_facture AND date_format(f.datef,'%Y')='".$year."'";
|
$sql .= " WHERE f.rowid = fd.fk_facture AND date_format(f.datef,'%Y')='".$year."'";
|
||||||
@ -115,8 +115,7 @@ foreach ( $products as $id => $fdir)
|
|||||||
{
|
{
|
||||||
$legends[($row[3] - 1)] = $row[0];
|
$legends[($row[3] - 1)] = $row[0];
|
||||||
$num[($row[3] - 1)] = $row[1];
|
$num[($row[3] - 1)] = $row[1];
|
||||||
$ca[($row[3] - 1)] = $row[2];
|
$ca[($row[3] - 1)] = $row[2];
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
@ -126,17 +125,19 @@ foreach ( $products as $id => $fdir)
|
|||||||
print $sql;
|
print $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph = new DolGraph();
|
if ($i > 0)
|
||||||
|
{
|
||||||
|
$graph = new DolGraph();
|
||||||
|
|
||||||
$file = $fdir ."ventes-".$year."-".$id.".png";
|
$file = $fdir ."ventes-".$year."-".$id.".png";
|
||||||
$title = "Ventes";
|
$title = "Ventes";
|
||||||
|
|
||||||
$graph->SetTitle($title);
|
$graph->SetTitle($title);
|
||||||
$graph->BarLineOneYearArtichow($file, $ca, $num, $legends);
|
$graph->BarLineOneYearArtichow($file, $ca, $num, $legends);
|
||||||
|
|
||||||
|
if ($verbose)
|
||||||
if ($verbose)
|
print "$file\n";
|
||||||
print "$file\n";
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Ventes annuelles
|
* Ventes annuelles
|
||||||
@ -174,16 +175,19 @@ foreach ( $products as $id => $fdir)
|
|||||||
print $sql;
|
print $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph = new DolGraph();
|
if ($i > 0)
|
||||||
|
{
|
||||||
|
$graph = new DolGraph();
|
||||||
|
|
||||||
$file = $fdir ."ventes-".$id.".png";
|
$file = $fdir ."ventes-".$id.".png";
|
||||||
$title = "Ventes";
|
$title = "Ventes";
|
||||||
|
|
||||||
$graph->SetTitle($title);
|
$graph->SetTitle($title);
|
||||||
$graph->BarLineAnnualArtichow($file, $ca, $num, $legends);
|
$graph->BarLineAnnualArtichow($file, $ca, $num, $legends);
|
||||||
|
|
||||||
if ($verbose)
|
if ($verbose)
|
||||||
print "$file\n";
|
print "$file\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user