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
| <?php
include("fonctions.php");
?>
<html>
<head>
<script type="text/javascript" src="menu.js"></script>
<link href="donnees.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" media="screen" type="text/css" title="Menu" href="menu.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Création d'un DEVIS Client</title>
</head>
<body>
<?php
menu();
?>
<em><strong>CLIENT DU DEVIS</strong></em><br />
<form id="id_client" name="client" method="POST" action="c_devis.php">
<?php //création de la Liste déroulante Clients
connectMaBase();
$sql_client = " SELECT nom_prenom FROM clients ORDER BY nom_prenom ";
$result_client = mysql_query($sql_client) or die("Requete pas comprise");
echo "<form action='c_devis.php' method='POST'>
<table>Sélection du Client :<select name='lst_client' id='lst_clients' onChange='submit()'>";
while ($row_client=mysql_fetch_array($result_client))
{
echo "<option>$row_client[0]</option>";
}
echo"</select>
</table>";
?>
<a href="clients.php">Créer un Nouveau Client</a>
<?php //sélection du Client et Affichage de toutes ces infos
$client=$_POST['lst_client'];
$link = mysql_connect('xx', 'xx', 'xx');
if (!$link) {
die('Impossible de se connecter : ' . mysql_error());
}
$result = mysql_query("SELECT * FROM clients WHERE nom_prenom='".$client."'");
if (!$result) {
echo 'Impossible d\'exécuter la requête : ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
$id_client=$row[0];
$type_client=$row[1];
$nom_prenom=$row[2];
$adresse_client=$row[3];
$code_postal=$row[4];
$ville=$row[5];
$civilite=$row[6];
$societe=$row[7];
$tel=$row[8];
$fax=$row[9];
?>
<table width="983" border="0">
<tr>
<td>ID Client:</td>
<td><input type="text" id="champ_id_client" name="id_client" disabled="disabled" value="<?php echo $id_client; ?>"/></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="164">Type Client:</td>
<td width="193"><input name="type_selection" type="text" disabled="disabled" id="champ_type_selection" value="<?php echo $type_client; ?>"/></td>
<td width="55"><div align="right">Société:</div></td>
<td width="553"><input type="text" name="societe" id="champ_societe" disabled="disabled" value="<?php echo $societe; ?>"/></td>
</tr>
<tr>
<td>Civilité:</td>
<td><input type="text" name="civilite" id="champ_civilite" disabled="disabled" value="<?php echo $civilite; ?>"/></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Nom et Prénom:</td>
<td><input type="text" id="champ_nom_prenom" name="nom_prenom" disabled="disabled" value="<?php echo $nom_prenom; ?>"/></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Adresse:</td>
<td><input type="text" id="champ_adresse" name="adresse" disabled="disabled" value="<?php echo $adresse_client; ?>"/></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Code Postal: </td>
<td><input type="text" name="code_postal" id="champ_postal" disabled="disabled" value="<?php echo $code_postal; ?>"/></td>
<td><div align="right">Ville:</div></td>
<td><input type="text" name="ville" id="champ_ville" disabled="disabled" value="<?php echo $ville; ?>"/></td>
</tr>
<tr>
<td>Téléphone:</td>
<td><input type="text" name="tel" id="champ_tel" disabled="disabled" value="<?php echo $tel; ?>"/></td>
<td><div align="right">FAX:</div></td>
<td><input type="text" name="fax" id="champ_fax" disabled="disabled" value="<?php echo $fax; ?>"/></td>
</tr>
</table>
<!--</form>-->
<p><em><strong>ETAT DES LIEUX</strong></em><br />
</p>
<!--<form id="id_devis" name="devis" method="post" action="c_devis.php">-->
<table width="564" border="0">
<tr>
<td>Vous êtes :</td>
<td><select name="type_acheteur">
<option value="proprio">Propriétaire</option>
<option value="locataire">Locataire</option>
</select></td>
</tr>
<tr>
<td>Type de local ou d'habitation :</td>
<td><select name="type_habitation">
<option value="maison">Maison</option>
<option value="appart">Appartement</option>
</select></td>
</tr>
<tr>
<td>Préciser son état :</td>
<td><select name="etat">
<option value="plan">Sur plan d'Architecte</option>
<option value="construction">En Construction</option>
<option value="termine">Terminé</option>
<option value="renovation">En Rénovation</option>
<option value="existante">Existante</option>
</select></td>
</tr>
<tr>
<td>Type d'intervention souhaitée :</td>
<td><select name="type_intervention">
<option value="cablage">Câblage</option>
<option value="depannage">Dépannage</option>
<option value="modification">Modification</option>
<option value="conception">Conception</option>
</select></td>
</tr>
</table>
Type de prestations souhaité :
<table width="824">
<tr>
<td width="301"><label>
<input type="checkbox" name="check_prestations1" value="oui" id="check_prestations_0" />
Commande de volet à distance</label></td>
<td width="301"><input type="checkbox" name="check_prestations4" value="oui" id="check_prestations_3" />
Portail automatique</td>
<td width="301"><input type="checkbox" name="check_prestations7" value="oui" id="check_prestations_6" />
Protection incendie</td>
</tr>
<tr>
<td><label>
<input type="checkbox" name="check_prestations2" value="oui" id="check_prestations_1" />
Variation de lumière</label></td>
<td><input type="checkbox" name="check_prestations5" value="oui" id="check_prestations_4" />
Télésurveillance</td>
<td><input type="checkbox" name="check_prestations8" value="oui" id="check_prestations_7" />
Gestion de l'éclairage</td>
</tr>
<tr>
<td><label>
<input type="checkbox" name="check_prestations3" value="oui" id="check_prestations_2" />
Prévention vol-cambriolage</label></td>
<td><input type="checkbox" name="check_prestations6" value="oui" id="check_prestations_5" />
Gestion de chauffage à distance</td>
<td><input type="checkbox" name="check_prestations_6" value="oui" id="check_prestations_8" />
Autre
</td>
</tr>
</table>
Si autre, préciser : <input type="text" name="presta_autre" id="id_autre" /><br>
Type de chauffage actuel :
<select name="chauffage">
<option value="electrique">Electrique</option>
<option value="gaz">Gaz</option>
<option value="fioul">Fioul</option>
</select>
<table width="824" border="0">
<tr>
<td width="950"><strong><em>Plus d'informations :</em></strong><br />
Vous devez préciser la demande.<br />
Expliquez les besoins "précis" du Client. </td>
</tr>
<tr>
<td><textarea rows="6" style="width: 60%" name="info" id="info"></textarea></td>
</tr>
</table>
<input type="submit" name="valider" id="id_valider" value="Valider Devis" >
<?php
if (isset ($_POST['valider'])){
$id_client=$_POST['id_client']; // récupére les Infos Clients
$nom_prenom=$_POST['nom_prenom'];
$ville=$_POST['ville'];
// récupère les Info DEVIS
$type_acheteur=$_POST['type_acheteur'];
$type_habitation=$_POST['type_habitation'];
$etat=$_POST['etat'];
$intervention=$_POST['type_intervention'];
// récupère les différentes prestations souhaitées par le Client
$volets=$_POST['check_prestations1']; // volets
$variation_lumiere=$_POST['check_prestations2']; // variation lumière
$alarme=$_POST['check_prestations3']; // alarme
$portail=$_POST['check_prestations4']; // portail
$tele_surveillance=$_POST['check_prestations5']; //tele-surveillance
$chauffage=$_POST['check_prestations6']; // chauffage
$incendie=$_POST['check_prestations7']; // incendie
$eclairage=$_POST['check_prestations8']; // éclairage
$presta_autre=$_POST['presta_autre'];
$type_chauffage=$_POST['chauffage'];
$info=$_POST['info'];
$echec='';
if($info=="")
$echec=$echec."- Le champ Info est obligatoire<br>";
if($nom_prenom=="")
$echec=$echec."- Veuillez sélectionner un Client<br>";
if($echec=="") {
connectMaBase();
$sql = 'INSERT INTO devis VALUES("","'.$id_client.'","'.$nom_prenom.'","'.$ville.'","'.$type_acheteur.'","'.$type_habitation.'","'.$etat.'","'.$intervention.'","'.$volets.'","'.$variation_lumiere.'","'.$alarme.'","'.$portail.'","'.$tele_surveillance.'","'.$chauffage.'","'.$incendie.'","'.$eclairage.'","'.$presta_autre.'","'.$type_chauffage.'","'.$info.'")';
mysql_query ($sql) or die ('Erreur SQL !'.$sql.'<br />'.mysql_error());
mysql_close();
$message="Succès.<br>Votre saisie a été prise en compte.<br>Merci";
print $message;
}
else {
$message="Echec.<br>Corrigez votre saisie.<br>".$echec;
print $message;
}
}
?>
</form>
</body>
</html> |
Partager