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
| $id_tarif=$_POST['tarif'];
$req1="select * from tarif where id_tarif='$id_tarif'";
$res1=mysql_query($req1);
while($data1=mysql_fetch_array($res1))
{
$factoring=$data1['factoring'];
$transport=$data1['transport'];
$rrr=$data1['rrr'];
}
$options = $_POST['options'];
$ctrl=sizeof($options);
if($ctrl=='1')
{
$o=$options[0];
$o1='';
$o2='';
$req = "SELECT * FROM articles where gamme='$o' and fax='1' order by gamme, origine, nom";
$res=mysql_query($req);
$total=mysql_num_rows($res);
}elseif($ctrl=='2')
{
$o=$options[0];
$o1=$options[1];
$o2='';
$req = "SELECT * FROM articles where gamme='$o' and fax='1' || gamme='$o1' and fax='1' order by gamme, origine, nom";
$res=mysql_query($req);
$total=mysql_num_rows($res);
}else
{
$o=$options[0];
$o1=$options[1];
$o2=$options[2];
$req = "SELECT * FROM articles where fax='1' order by gamme, origine, nom";
$res=mysql_query($req);
$total=mysql_num_rows($res);
}
echo'<center><table border="0" bordercolor="blue" height="100%" width="80%"><tr><td align="center">DELTA MAREE</td></tr>
<tr><td align="center">';
while($data=mysql_fetch_array($res))
{
$tablo[]=$data;
}
$nbcol=2; //--- détermine le nombre de colonnes
$nb=count($tablo);
for($i=0;$i<$nb;$i++){
//--- les valeurs que l'on souhaite afficher
$nom=$tablo[$i]['nom'];
$conditionnement=$tablo[$i]['conditionnement'];
$origine=$tablo[$i]['origine'];
$prix=$tablo[$i]['prix'];
$marge=$tablo[$i]['marge'];
$pm=$prix+$marge;
$pv=(($pm*$rrr)+$transport)*$factoring;
$pv=round($pv,2);
if($total>15)
{
if($i%$nbcol==0)
echo '<table border="0" width="70%" bordercolor="red" cellpadding="0" cellspacing="0">';
echo '<tr>';
echo '<td align="center" width="30%">',$nom,'</td>','<td align="center" width="20%">',$conditionnement,'</td>','<td align="center" width="30%">',$origine,'</td>','<td align="center" width="20%">',$pv,'</td>';
if($i%$nbcol==($nbcol-1))
echo '</tr>';
}
else{
echo'<table border="0" width="60%" bordercolor="red" cellpadding="0" cellspacing="0"><tr><td align="center" width="35%">',$nom,'</td>','<td align="center" width="20%">',$conditionnement,'</td>','<td align="center" width="25%">',$origine,'</td>','<td align="center" width="20%">',$pv,'</td></tr>';
}
}
echo'</table>'; |
Partager