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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
| <form name="vente_hebdo" method="POST" action="./pdf/pdf_hebdo.php">
Volumes de ventes réalisés en semaine <?=$ww?>
<?php //Création du tableau des ventes hebdomadaires ?>
<table width=* border=1 cellspacing=0 cellpadding=5>
<tr align=center valign=center>
<td rowspan=2><strong>Semaine <?=$ww;?></strong></td>
<?
$sql = "SELECT * FROM regions ORDER BY regions_id;";
$result = mysql_query($sql);
$nbreg = 0;
while ($rs = mysql_fetch_array($result)) {
$nbreg++;
$treg[$nbreg] = $rs['regions_id'];
$regions_nom = $rs['regions_nom'];
echo("<td colspan=2><strong>$regions_nom</strong></td>");
$tfra[$nbreg] = 0;
$texp[$nbreg] = 0;
}
$tvar = array('NB','nb','NJ','nj','PB','pb','PJ','pj');
?>
<td colspan=2><strong>Total</strong></td>
</tr>
<? for ($n=1;$n<=$nbreg+1;$n++) { ?>
<td><strong>France</strong></td>
<td><strong>Export</strong></td>
<? } ?>
<?
for ($n=1;$n<=4;$n++) {
$tmpfra = "volh_".$tvar[($n*2)-1]."_fra";
$tmpexp = "volh_".$tvar[($n*2)-1]."_exp";
$var = $tvar[($n-1)*2];
echo("<tr align=center>");
echo("<td><strong>$var</strong></td>");
$totfra = 0;
$totexp = 0;
for ($m=1;$m<=$nbreg;$m++) {
$reg = $treg[$m];
$sql2 = "SELECT SUM($tmpfra) AS fra, SUM($tmpexp) AS exp FROM volh, operateurs WHERE volh.operateurs_id = operateurs.operateurs_id AND volh_ss = $ww AND regions_id = $reg;";
$rs2 = mysql_fetch_array(mysql_query($sql2));
$fra = $rs2['fra']*1;
$exp = $rs2['exp']*1;
$totfra = $totfra + $fra;
$totexp = $totexp + $exp;
$tfra[$m] = $tfra[$m] + $fra;
$texp[$m] = $texp[$m] + $exp;
echo("<td>$fra</td>");
echo("<td>$exp</td>");
}
echo("<td><strong>$totfra</strong></td>");
echo("<td><strong>$totexp</strong></td>");
echo("</tr>");
}
?>
<tr align=center>
<td><strong>TOTAL</strong>
<?
$totfra = 0;
$totexp = 0;
for ($n=1;$n<=$nbreg;$n++) {
$f = $tfra[$n];
$e = $texp[$n];
$totfra = $totfra + $f;
$totexp = $totexp + $e;
echo("<td><strong>$f</strong></td>");
echo("<td><strong>$e</strong></td>");
}?>
<td><strong><?=$totfra;?></strong></td>
<td><strong><?=$totexp;?></strong></td>
</tr>
<tr align=center>
<td><strong>%</strong></td>
<?
for ($n=1;$n<=$nbreg;$n++) {
if (($totfra+$totexp)<>0){
$pfra = round(100*$totfra/($totfra+$totexp),0);
$pexp = round(100*$totexp/($totfra+$totexp),0);
echo("<td><strong>$pfra</strong></td>");
echo("<td><strong>$pexp</strong></td>");
} else {
echo("<td><strong>0</strong></td>");
echo("<td><strong>0</strong></td>");
}
}
if (($f+$e)<>0){
$pf = round(100*$f/($f+$e),0);
$pe = round(100*$e/($f+$e),0);
echo("<td><strong>$pf</strong></td>");
echo("<td><strong>$pe</strong></td>");
} else {
echo("<td><strong>0</strong></td>");
echo("<td><strong>0</strong></td>");
}
?>
</tr>
</table>
</center>
<br>
<br>
<?php
//include charts.php to access the InsertChart function
include "charts.php";?>
<table>
<tr>
<td><?php
//Insertion du graphique des ventes hebdomadaires
echo InsertChart ( "charts.swf", "charts_library", "sample4.php", 600, 400 );?> </td>
<td valign =center><?php
//Insertion du premier commentaire réalisé
$com1=$_POST['commentaire1'];
echo "$com1";?></td>
</tr>
</table>
<br>
<br>
<?php
//Insertion du deuxième commentaire réalisé
$com2=$_POST['commentaire2'];
echo "$com2";?>
<br>
<br>
<center>
<input type="hidden" name="commentaire1" value="<?=$com1?>">
<input type="hidden" name="commentaire2" value="<?=$com2?>">
<input type="submit" target="_blank" value="Visualiser la page au format pdf"></input>
</form> |
Partager