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
|
<?php
session_start();
if( isset($_SESSION['panier'])){
$panier = $_SESSION['panier'];
$tot=0;// initialisation du total.
$tottva1=0;// initialisation du total.
?>
<?php
if(!isset($_SESSION['pseudo']))
{
echo "<script language='javascript'>document.location='index.php?page=1'</script>";
}
?>
<SCRIPT LANGUAGE="Javascript">
function calcul_vente()
{
window.document.calcul.euro.value=eval(window.document.calcul.prix_achat.value*window.document.calcul.coeff.value);
if(window.document.calcul.euro.value=="NaN" )
{
alert ("Vous n'avez pas saisi un nombre" );
}
}
function calcul_coeff()
{
window.document.calcul.coeff.value=eval(window.document.calcul.euro.value/window.document.calcul.prix_achat.value);
if(window.document.calcul.coeff.value=="NaN" )
{
alert ("Vous n'avez pas saisi un nombre" );
}
}
function calcul_remise()
{
window.document.calcul.euro.value=eval((window.document.calcul.prix_achat.value*window.document.calcul.coeff.value)*(1-(window.document.calcul.remise.value/100)));
if(window.document.calcul.euro.value=="NaN" )
{
alert ("Vous n'avez pas saisi un nombre" );
}
}
function start()
{
window.document.calcul.euro.value=eval(window.document.calcul.prix_achat.value*window.document.calcul.coeff.value);
}
</SCRIPT>
<table border="0" align="center" bgcolor="cccccc" width="95%">
<tr bgcolor='white'>
<td width="">Ref: Produit</td>
<td width="">Produit</td>
<td width="">Quantité</td>
<td width="">Px Unité HT</td>
<td width="">Total HT </td>
<td width=""> </td>
</tr>
<!--// le caddie sera dans un formulaire pour pouvoir réaliser des changements.-->
<form method="post" action="index.php?page=17&pages=33">
<?php // connexion à votre base
connecter();
foreach ($panier as $valeur=>$cde){//$valeur est l'ID de la fleur et $cde sa quantité dans le panier
$sql="select * from article where id='$valeur'";
$req=mysql_query($sql);
while( $data=mysql_fetch_array($req) ){
$nom=$data['des'];
$ref=$data['ref'];//nom de la fleur
$prix=$data['prix_ht'];// prix unitaire de la fleur
$pxligne=$prix*$cde; //prix pour la ligne de commande
$tot+=$pxligne;//valorisation du total général
$tottva=$tot*1.196;
$tottva1=$tottva-$tot;
$total=$tot+$tottva1;
echo"<tr><td>$ref</td><td>$nom</td><td>$cde</td><td>$prix</td><td align='right'>$pxligne </td><td><input type='checkbox' name='case[]' value='".$data['id']."'></td></tr>";
}
}
?>
<tr><td colspan='4' align='right'>Total TVA...</td><td align='right'><?php
echo number_format($tottva1, 2, ',', ' ')?> </td></tr>
<body onLoad="start()">
<form name="calcul">
<input type="hidden" name="prix_achat" value="10">
<input type="hidden" name="coeff" size="10" value="1.2" onKeyUp="calcul_vente()">
<input type="hidden" name="remise" size="10" value="0" onKeyUp="calcul_remise()">
<br><input type="hidden" name="euro" size="10" onKeyUp="calcul_coeff()">
<input type="hidden" name="franc" size="10" disabled>
</form>
<body onLoad="start()">
<form name="calcul">
<tr><td colspan='4' align='right'>Total ...</td><td align='right'><input type="hidden" name="prix_achat" value="<?php echo number_format($total, 2)?>"> </td></tr>
<input type="hidden" name="coeff" size="10" value="1.0" onKeyUp="calcul_vente()">
<tr><td colspan='4' align='right'>Remise % ...</td><td align='right'><input type="text" name="remise" size="3" value="0" onKeyUp="calcul_remise()">
<tr><td colspan='4' align='right'>Total Commandé ...</td><td align='right'><input type="text" name="euro" size="3" onKeyUp="calcul_coeff()"> </td></tr>
</form>
<tr><td colspan='4' align='right'>Nom Client...</td><td align='right'><?php echo $nom_client; ?> </td></tr></table>
<input type="hidden" name="nom_client" value="<?php echo $nom_client;?>">
<?php
mysql_close();}
?>
<tr bgcolor='white'>
<td colspan="6" align="center"><input type="submit" name="action" value="Supprimer"> <input type="submit" name="action" value="Changer"> <input type="submit" name="action" value="Encaisser"></td></tr>
</form> |
Partager