1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| <?include("inc/conf.inc");?>
<?
$ww = 28;
$tvar = array('NB','nb','NJ','nj','PB','pb','PJ','pj');
?>
<table width=* border=1 cellspacing=0 cellpadding=5>
<tr align=center valign=center>
<td><strong>Semaine <?=$ww;?></td>
<?
$sql = "SELECT * FROM regions ORDER BY regions_nom;";
$result = mysql_query($sql);
$cptreg = 0;
while ($rs = mysql_fetch_array($result)) {
$cptreg++;
$regions_nom = $rs['regions_nom'];
$treg[$cptreg] = $rs['regions_id'];
$tzone[$cptreg] = 0;
?>
<td><strong><?=$regions_nom;?></strong></td>
<?
}
?>
<td><strong>Total</strong></td>
</tr>
<? for ($n=1;$n<=4;$n++) { ?>
<tr align=center>
<td><strong><?=$tvar[($n-1)*2];?></strong></td>
<?
$result = mysql_query($sql);
$m = 0;
$totalvar = 0;
while ($rs = mysql_fetch_array($result)) {
$m++;
$tmp = "prev_".$tvar[($n*2)-1]."_ton";
$o = $treg[$m];
$sql2 = "SELECT SUM($tmp) AS nbre FROM prev, operateurs WHERE prev.operateurs_id = operateurs.operateurs_id AND regions_id = $o AND prev_ss = $ww;";
$result2 = mysql_query($sql2);
$rs2 = mysql_fetch_array($result2);
$nbre = $rs2['nbre']*1;
$tableau[$n][$m]=$nbre;
$tzone[$m] = $tzone[$m] + $nbre;
$totalvar = $totalvar + $nbre;
$x = array($nbre);
echo("<td>$nbre</td>");
?>
<? } ?>
<td><strong><?=$totalvar;?></strong></td>
</tr>
<? } ?>
<tr align=center>
<td><strong>TOTAL</strong></td>
<?
$total = 0;
for ($k=1;$k<=$cptreg;$k++) {
$total = $total+$tzone[$k];
?>
<td><strong><?=$tzone[$k];?></strong></td>
<? } ?>
<td><strong><?=$total;?></strong></td>
</tr>
</table>
<?php
include ("jpgraph-1.21b/src/jpgraph.php");
include ("jpgraph-1.21b/src/jpgraph_bar.php");
setlocale (LC_ALL, 'et_EE.ISO-8859-1');
$data1y=array(1237,710,470);
$data2y=array(2060,1031,585);
$data3y=array(1186,514,440);
$data4y=array(622,877,475);
// Create the graph. These two calls are always required
$graph = new Graph(500,400,"auto");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(60,50,40,60);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetPattern(BAND_RDIAG,"white");
$b1plot->SetLegend("NB");
$b1plot->SetFillColor("orange");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("orange");
$b2plot->SetLegend("NJ");
$b3plot = new BarPlot($data3y);
$b3plot->SetFillGradient('white','green',GRAD_CENTER);
$b3plot->SetLegend("PB");
$b4plot = new BarPlot($data4y);
$b4plot->SetFillColor("green");
$b4plot->SetLegend("PJ");
$graph->SetBackgroundGradient('#9999FF','white',GRAD_HOR,BGRAD_MARGIN);
$graph->legend->Pos(0.03,0.5,"right","center");
$graph->legend->SetFont(FF_FONT1,FS_BOLD);
// Create the grouped bar plot
$gbplot = new AccBarPlot(array($b1plot,$b2plot,$b3plot,$b4plot));
$lbl = array("Roussillon","Gard-Crau","Vallée Rhône");
$graph->xaxis->SetTickLabels($lbl);
// ...and add it to the graPH
$graph->Add($gbplot);
$graph->title->Set("Prévisions apports S28 par région
");
$graph->xaxis->title->Set("Régions");
$graph->yaxis->title->Set("Tonnes");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
// Display the graph
$graph->Stroke();
?> |
Partager