Files
resatennis_tyroltenn/www/site_marchand/admin/detcmd.php

415 lines
12 KiB
PHP
Executable File

<?php
session_start();
$idcmde=$HTTP_GET_VARS["idcmde"];
$idcli=$HTTP_GET_VARS["idcli"];
$idadm=$HTTP_SESSION_VARS["idadm"]
?>
<html>
<head>
<title>
Partie Administrateur
</title>
</head>
<body>
<div align="center">
<table align=center>
<tr align="center">
<td>
<a href="gestcli.php?loguer=oui&<?php print session_name() ?>=<?php print session_id() ?>">Gestion des clients</a>
</td>
<td>
<a href="produit.php?loguer=oui&<?php print session_name() ?>=<?php print session_id() ?>">Gestion des produits</a>
</td>
<td>
<a href="commande.php?loguer=oui&<?php print session_name() ?>=<?php print session_id() ?>">Gestion des commandes</a>
</td>
</tr>
</table>
<br>
<?php
if (isset($_SESSION['idadm']))
{
?>
<br>
<table>
<tr>
<td>
<a href="selectcmd.php?loguer=oui&etatcmde=debut&<?php print session_name()?>=<?php print session_id()?>">Commandes non validees</a>
</td>
<td>
<a href="selectcmd.php?loguer=oui&etatcmde=print&<?php print session_name()?>=<?php print session_id()?>">Commandes en cours</a>
</td>
<td>
<a href="selectcmd.php?loguer=oui&etatcmde=fin&<?php print session_name()?>=<?php print session_id()?>">Commandes traitees </a>
</td>
</tr>
</table>
<br><br>
</div>
<table>
<tr>
<td colspan=2>
<table>
<?php
require("../connexion.php");
$conn = mysql_connect($host, $user, $password);
mysql_select_db($bdd) or die("Impossible d'ouvrir la base de donnee $bdd");
/* INFORMATION SUR LE CLIENT */
$requete5 = "select idcli,nomcli,prenomcli,telfixe,telport,fax,email,typecli,societe,coordbanc,totalcom from client where idcli='$idcli'";
$result5=mysql_query($requete5) or die ("Erreur SQL :$requete2<br>".mysql_error()."...");
while ($ligne5=mysql_fetch_row($result5))
{
$idcli=$ligne5[0];
$nomcli=$ligne5[1];
$prenomcli=$ligne5[2];
$telfixe=$ligne5[3];
$telport=$ligne5[4];
$fax=$ligne5[5];
$email=$ligne5[6];
$typecli=$ligne5[7];
$societe=$ligne5[8];
$coordbanc=$ligne5[9];
$totalcom=$ligne5[10];
?>
<tr>
<td>
<h3><b> Information sur le client</b></h3>
</td>
</tr>
<tr>
<td>
<b>Nom :</b> <?php print $nomcli?>&nbsp
<b>Prenom : </b><?php print $prenomcli?><br>
<b>Tel Fixe : </b><?php print $telfixe ?>&nbsp
<b>Tel Port : </b><?php print $telport ?>&nbsp
<b>email : </b><A HREF="mailto:<?php print $email?>"><?php print $email ?></A><br>
<b>Type de client : </b><?php print $typecli?>&nbsp
<b>societe : </b><?php print $societe ?><br>
<b>coord.Bancaire : </b><?php print coordbanc?><br>
<b>total des commandes : </b><?php print $totalcom?>
</td>
</tr>
<?php
}
?>
</table>
<?php
/* INFORMATION SUR LA COMMANDE */
$requete2 = "select idcmde,datecmde,montantcmde,etatcmde,modepaiement,message,idcli from commande where idcmde='$idcmde'";
$result2=mysql_query($requete2) or die ("Erreur SQL :$requete2<br>".mysql_error()."...");
?>
</td>
</tr>
<tr>
<td>
<table>
<tr align=center>
<td>
<div align="left">
<h3><b> Information sur la commande</b></h3>
</div>
</td>
</tr>
<?php
while ($ligne2=mysql_fetch_row($result2))
{
$idcmde=$ligne2[0];
$datecmde=$ligne2[1];
$montantcmde=$ligne2[2];
$etatcmde=$ligne2[3];
$modepaiement=$ligne2[4];
$message=$ligne2[5];
$idcli=$ligne2[6];
?>
<tr>
<td align="left">
<form name="fc" action="modifcom.php" method="POST">
<table>
<tr>
<td>
<b>date : </b><?php print $datecmde ?>
</td>
<td>
<b>montant : </b><?php print $montantcmde ?>
</td>
</tr>
<tr>
<td colspan=2>
Mode paiement : <input type="text" name="modepaiement" value="<?php print $modepaiement ?>"/>
</td>
</tr>
<tr>
<td>
Inserer un msg pour le client :
</td>
<td>
<textarea name="message" cols=15 rows=5><?php print $message ?></textarea>
</td>
<tr>
<tr align=center>
<td colspan=2>
Etat de la commande :
<input type="hidden" name="<?php print session_name();?>" value="<?php print session_id();?>"/>
<input type="hidden" name="loguer" value="oui"/>
<select name="etatcmde">
<?php
if ($etatcmde=='debut')
{
?>
<option value="debut" selected="selected">Debut</option>
<?php
}
else
{
?>
<option value="debut">Debut</option>
<?php
}
if ($etatcmde=='print')
{
?>
<option value="print" selected="selected">En cours</option>
<?php
}
else
{
?>
<option value="print">En cours</option>
<?php
}
if ($etatcmde=='fin')
{
?>
<option value="fin" selected="selected">Traite</option>
<?php
}
else
{
?>
<option value="fin">Traite</option>
<?php
}
?>
</select>
</td>
<tr align=center>
<td colspan=2>
<input type="hidden" name="idcmde" value="<?php print $idcmde?>"/>
<input type="submit" value="Modifier"/>
</td>
</tr>
</table>
</form>
</td>
</tr>
<?php
}
?>
</table>
<div align=center>
<form name="supcmd" action="supcmde.php" method="POST">
<input type="hidden" name="idcmde" value="<?php print $idcmde?>"/>
<input type="submit" value="Supprimer la commande"/>
</form>
</div>
</td>
<td>
<table>
<tr>
<td colspan=6>
<h3><b>Produits commandes</b></h3>
</td>
</tr>
<tr align="center">
<td>
Produit
</td>
<td>
Colisage
</td>
<td>
Quantite commandee
</td>
<td>
Prix Total (HT)
</td>
</tr>
<?php
$tot=0;
/* DETAIL DE LA COMMANDE */
$requete3 = "select idcmde,idcomp,idprod,qtecmde from composee where idcmde='$idcmde'";
$result3=mysql_query($requete3) or die ("Erreur SQL :$requete2<br>".mysql_error()."...");
$i=0;
$j=0;
while ($ligne3=mysql_fetch_row($result3))
{
$i++;
$idcmde=$ligne3[0];
$idcomp=$ligne3[1];
$idprod=$ligne3[2];
$qtecmde=$ligne3[3];
$requete4 = "select idprod,denomination,prixht1,prixht2,prixht3,qteprod1,qteprod2,qteprod3,poidsprod1,poidsprod2,poidsprod3 from produit where idprod='$idprod'";
$result4=mysql_query($requete4) or die ("Erreur SQL :$requete2<br>".mysql_error()."...");
while ($ligne4=mysql_fetch_row($result4))
{
$idprod=$ligne4[0];
$denomination=$ligne4[1];
$prixht1=$ligne4[2];
$prixht2=$ligne4[3];
$prixht3=$ligne4[4];
$qteprod1=$ligne4[5];
$qteprod2=$ligne4[6];
$qteprod3=$ligne4[7];
$poidsprod1=$ligne4[8];
$poidsprod2=$ligne4[9];
$poidsprod3=$ligne4[10];
}
?>
<br>
<tr align="center">
<td>
<?php print $denomination?>
</td>
<td>
<table cellpadding="0" cellspacing="0" border="1">
<form name="fairien">
<tr align=center>
<td colspan=3 bgcolor=#FF9933>
Quantite
</td>
</tr>
<tr align=center>
<td>
<?php print $qteprod1?>
</td>
<td>
<?php print $qteprod2?>
</td>
<td>
<?php print $qteprod3?>
</td>
</tr>
<tr align=center>
<td colspan=3 bgcolor=#FF9933>
Prix
</td>
</tr>
<tr align=center>
<td>
<?php print $prixht1?>
</td>
<td>
<?php print $prixht2?>
</td>
<td>
<?php print $prixht3?>
</td>
</tr>
<tr align=center>
<td colspan=3 bgcolor=#FF9933>
Poids (pour ports)
</td>
</tr>
<tr align=center>
<td>
<?php print $poidsprod1?>
</td>
<td>
<?php print $poidsprod2?>
</td>
<td>
<?php print $poidsprod3?>
</td>
</tr>
</form>
</table>
</td>
<td>
<?php print $qtecmde?>
</td>
<td>
<?php
//prix total $prixtot;
//Quantite de produit commandee $qtecmde;
//Colisage $qteprod[i] $prixht[i] $poidsprod[i], i=1,2 ou 3 (3 colisage différent possible)
if($qteprod3)
{
if ($qtecmde >= $qteprod2)
{
do
{
$qtecmde = $qtecmde - $qteprod3;
$prixtot+=$prixht3;
print "$prixtot<br>";
}
while ($qtecmde >= $qteprod3);
}
}
if($qteprod2)
{
if ($qtecmde >= $qteprod2)
{
do
{
$qtecmde = $qtecmde - $qteprod2;
$prixtot+=$prixht2;
print "$prixtot<br>";
}
while ($qtecmde >= $qteprod2);
}
}
if($qtecmde>0)
{
do
{
$qtecmde-=$qteprod1;
$prixtot+=$prixht1;
print $prixtot;
print "<br>qtecmde:$qtecmde<br>";
}
while ($qtecmde != 0);
}
?>
</td>
</tr>
<?php
}
?>
</table>
<div align="center">
<?php
print "<br><h3><b>Total de la commande : </b>$prixtot</h3><br>";
?>
</div>
</div>
</td>
</tr>
</table>
<a href="commande.php?loguer=oui&<?php print session_name();?>=<?php print session_id();?>">Retour</a>
<?php
}
else
{
print "Erreur de connection";
}
?>
</body>
</html>