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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
|
<?php
session_start();
?>
<?php include('connexion.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>INTRANET IFC - Accueil</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="design.css" />
</head>
<body>
<?php
include("entete.php");
include("menu.php");
include("consultation_notes_services.php");
?>
<div id="corps">
<center>
<h3>
<u>Appel d'Offre</u>
</h3>
</center>
<?php
include('connexion.php');
/*récuperation de l'Id_ao dans l'url et remise au format pour affichage*/
$idao=$_GET['idao'];
$num=explode('_',$idao);
$dernierchiffre=$num[2];
$dernierannee=$num[1];
$nouveaunum='AO'.$annee.''.$dernierchiffre;
/*recherche des données lié à l'AO dont l'id est dans l'url*/
$sqldonnee=odbc_do($cnx,"select Date_AO,Date_butoir_AO,Ref_AO,Id_contact from T_AO where Id_AO ='$idao'");
$result=odbc_fetch_array($sqldonnee);
$idcontact=$result['Id_contact'];
$date_b=$result['Date_butoir_AO'];
$date_a=$result['Date_AO'];
$ref=$result['Ref_AO'];
/*mise au format de la date butoir*/
$date_b1=explode('-',$date_b);
$jourb=$date_b1[2];
$moisb=$date_b1[1];
$anneeb=$date_b1[0];
$date_butoir=$jourb.'/'.$moisb.'/'.$anneeb;
/*mise au format de la date ao*/
$date_a1=explode('-',$date_a);
$joura=$date_a1[2];
$moisa=$date_a1[1];
$anneea=$date_a1[0];
$date_ao=$joura.'/'.$moisa.'/'.$anneea;
/*récupération des données du contact qui à creer l'AO*/
$sqldonneec=odbc_do($cnx,'select Nom_contact, Prenom_contact,Mail_contact From T_contact_ifc where Id_contact='.$idcontact.'');
$resultc=odbc_fetch_array($sqldonneec);
$nom=$resultc['Nom_contact'];
$prenom=$resultc['Prenom_contact'];
$mail=$resultc['Mail_contact'];
/*Si il n'y a pas dans l'url l'id_ao*/
if($idao=="")
{
echo 'Erreur de la page! Réessayer, Si le problème persiste, faites appel au modérateur';
}
else
{ /*Entete infos sur les AO*/
?>
<form name="ajout" method="post"><input type='hidden' id='Id_AO' name='Id_AO' value='<?php echo $id; ?>'>
<table id="table_ao">
<tr>
<td colspan="2">
<strong>Chargé d'Affaire:</strong>
</td>
<td colspan="2">
<?php
echo $nom.' '.$prenom;
?>
<input type='hidden' id='Id_contact' name='Id_contact' value='<?php echo $Idcontact; ?>'>
</td>
</tr>
<tr>
<td colspan="4"><?php echo $mail; ?>
</td>
</tr>
<tr>
<td>
<strong>N°AO :</strong>
</td>
<td>
<?php
echo $nouveaunum;
?>
</td>
<td>
<strong>Ref client :</strong>
</td>
<td>
<?php
echo $ref;
?>
</td>
</tr>
<tr>
<td>
<strong>Le :</strong>
</td>
<td>
<?php
echo $date_ao;
?>
</td>
<?php If($date_butoir!="//") { ?>
<td>
<strong>Date butoir :</strong>
</td>
<td>
<?php
echo $date_butoir;
?>
</td>
<?php } ?>
</tr>
</table>
</form>
<br>
<div id="client">
<center>
Client:
<br>
<br>
<?php
/*Création de la liste deroulante concernant le client*/
echo '<center><form>
<select onChange="location = this.options
[this.selectedIndex].value">
<option value="" selected>Selectionner un client</option>';
$req1 = odbc_exec( $cnx, 'SELECT Code_client FROM T_clients ORDER BY 1'); // requete de la liste déroulante
while( $resultat = odbc_fetch_array( $req1 ) ) //tant que c pas la fin de la table
{
echo '<option value="gestion_AO_a.php?idao='.$idao.'&idc=' . $resultat['Code_client'] . '">' . $resultat['Code_client'] .'</option>';
}
echo '</select>
</form></center>';
if (isset($_GET['idc']))
{
$idc = $_GET['idc'];
if ($idc != '')
{
/*Création de la requete permettant de recupérer les infos du client*/
$sql = odbc_exec( $cnx,"SELECT Code_client, T_dept.Libelle_dept, Ville_client, T_pays.Libelle_pays, T_secteur.Libelle_secteur FROM T_clients, T_secteur ,T_pays , T_dept WHERE T_dept.Id_dept = T_clients.Id_dept and T_clients.Id_secteur = T_secteur.Id_secteur and T_clients.Id_pays = T_pays.Id_pays and Code_client='$idc'");
$resultat = odbc_fetch_array( $sql );
$code = $idc;
$dept = $resultat['Libelle_dept'];
$ville = $resultat['Ville_client'];
$pays=$resultat['Libelle_pays'];
$secteur=$resultat['Libelle_secteur'];
/*Affichage des infos concernant le client*/
echo '<table>';
echo '<tr>';
echo '<td>Client :</td>';
echo '<td>'.$code.'</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Ville :</td>';
If ($ville=="")
{
echo '<td>non renseigné</td>';
}
else
{
echo '<td> ' . $ville . '</td>';
}
echo '</tr>';
echo '<tr>';
echo '<td>Département :</td>';
If ($dept=="")
{
echo '<td>non renseigné</td>';
}
else
{
echo '<td> ' . $dept . '</td>';
}
echo '</tr>';
echo '<tr>';
echo '<td>Pays :</td>';
If ($pays=="")
{
echo '<td>non renseigné</td>';
}
else
{
echo '<td>' . $pays . '</td>';
}
echo '</tr>';
echo '<tr>';
echo '<td>Secteur :</td>';
If ($secteur=="")
{
echo '<td>non renseigné</td>';
}
else
{
echo '<td>'. $secteur . '</td>';
}
echo '</tr>';
echo '</table>';
}
}
odbc_close( $cnx); ?>
</div>
<br>
<div id="Produit">
<center>
Produit
<br>
<br>
<?php
$sqlcount=odbc_do($cnx,"select count(Id_produit) as nb from T_contenir where Id_AO='$idao'");
$count=odbc_fetch_array($sqlcount);
$nb=$count['nb'];
If($nb!=0)
{
?>
<table class="tabprod">
<tr><th>Famille</th><th>Produit</th><th>Qté</th><th>Description</th></tr>
<?php
/*Création de la requete permettant de connaitre si il y déja des produit pour cette AO*/
$sql=odbc_exec($cnx,"Select T_contenir.Id_produit, Ref_produit, Libelle_famille , Qte ,Commentaire from T_contenir , T_produits , T_familles where T_contenir.Id_produit=T_produits.Id_produit and T_produits.Id_famille=T_familles.Id_famille and Id_AO='$idao' order by 1");
while( $result = odbc_fetch_array( $sql ) ) /*tant que c pas la fin de la table remplir le tableau*/
{
?>
<tr><td><?php echo $result['Libelle_famille'];?></td>
<td><?php echo $result['Ref_produit'];?></td>
<td><?php echo $result['Qte'];?></td>
<td><?php echo $result['Commentaire'];?></td><form name="supp" method="post">
<td><input type="submit" id='sup' value="" class="bt_supp_img" width="24px">
<?php $idpro=$result['Id_produit']; ?>
<input type="hidden" name='prodasupp' value=<?php echo $idpro; ?>></td></tr>
</form>
<?php
}
?></table></center><?php }
/*Si on appuie sur le bouton supprimer, cela supprime le produit qui a été selection car idbt=idproduit*/
if(isset($_POST['prodasupp']))
{
$idbt=$_POST['prodasupp'];
$sql="delete from T_contenir where Id_AO='$idao' and Id_produit=".$idbt."";
odbc_do($cnx,$sql);
odbc_close($cnx);
echo '<script language="Javascript">
<!--
document.location.replace("gestion_AO_a.php?idao='.$idao.'&idc='.$idc.'");
// -->
</script>';
}
echo '<br>';
/*Création de la liste deroulante Famille (selection de la famille d'un produit)*/
echo '<form name="ajout" method="post">';
echo '<center><form>
<select onChange="location = this.options
[this.selectedIndex].value">
<option value="" selected>Selectionner une famille de produit</option>';
$req1 = odbc_exec( $cnx, 'SELECT Id_famille, Libelle_famille FROM T_familles ORDER BY 2'); // requete de la liste déroulante
while( $resultat = odbc_fetch_array( $req1 ) ) //tant que c pas la fin de la table on remplie la liste deroulante
{
echo '<option value="gestion_AO_a.php?idao='.$idao.'&idc='.$idc.'&id=' . $resultat['Id_famille'] . '">' . $resultat['Libelle_famille'] .'</option>';
}
echo '</select>
</form></center>';
//Si on a une famille on selection tout les produit de la categorie
if (isset($_GET['id']))
{
$id = $_GET['id'];
echo '<br>';
echo '<center><form>
<select onChange="location = this.options
[this.selectedIndex].value">
<option value="" selected>Selectionner un produit</option>';
$req11 = odbc_exec( $cnx, 'SELECT Id_produit, Ref_produit, Id_famille FROM T_produits where Id_famille='.$id.' ORDER BY 2'); // requete de la liste déroulante
while( $resultat1 = odbc_fetch_array( $req11 ) ) //tant que c pas la fin de la table
{
echo '<option value="gestion_AO_a.php?idao='.$idao.'&idc='.$idc.'&id='.$id.'&id1=' . $resultat1['Id_produit'] . '">' . $resultat1['Ref_produit'] .'</option>';
}
}
echo '</select>
</form></center>';
/*si on selection un produit , cela affiche les données du produit*/
if (isset($_GET['id1']))
{
$id1 = $_GET['id1'];
if ($id1 !='')
{
/*Requete permettant de retrouver les infos sur le produit*/
$reql2 = odbc_exec( $cnx, 'SELECT Ref_produit, Libelle_famille from T_produits, T_familles WHERE T_produits.Id_famille=T_familles.Id_famille and Id_produit='.$id1.'');
$resultat2 = odbc_fetch_array( $reql2 );
$ref = $resultat2['Ref_produit'];
$fam = $resultat2['Libelle_famille'];
/*Affichage des données du produit choisi + champs pour la quantité et le commentaire*/
echo '<br><center><table>
<tr>
<td>Famille</td>
<td>Produit</td>
<td>Qté</td>
<td>Commentaire</td>
</tr>
<tr>
<td>'. $fam . '</td>
<td>'. $ref . '</td>
<td><input type="text" size="3" name="Qte" value='.$Qte.'></td>
<td><input type="text" name="Commentaire" value='.$Commentaire.'></td>
</tr>
<tr>
<td>
<input type="submit" value="Ajouter" >
<input type="hidden" name="ajout" value='.$id1.'>
</td>
</tr>
</table></center>';
}
}
/*Ajout du produit dans la table T_contenir*/
If(isset($_POST['ajout']))
{
$c=$_POST['Commentaire'];
$q=$_POST['Qte'];
$ajout="Insert into T_contenir(Id_AO,Id_produit,Qte,Commentaire) values ('$idao','$id1','$q','$c') ";
odbc_do($cnx,$ajout);
odbc_close($cnx);
echo '
<script language="Javascript">
<!--
document.location.replace("gestion_AO_a.php?idao='.$idao.'&idc='.$idc.'");
// -->
</script>';
}
}
?>
</div>
<div id="bt_ao">
<input type="submit" name="confirmer" value="confirmer">
<input type="submit" name="annuler" value="annuler">
</div>
</div>
<?php include("piedpage.php"); ?>
</body>
</html> |
Partager