| Current Path : /home/ataenra/www/ATA/INTRANET/Formulaires/CLIENT/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Formulaires/CLIENT/Adresse.php |
<?php
if(isset($_POST['Chantier'])&&$_POST['Chantier']=="Valider"){
$_SESSION['Adresse']="dif";
$_SESSION['ID_simulA']=$_POST['AdresseChantier'];
header("location:NouveauProjet.php");
}
if(isset($_POST['Chantierlog'])&&$_POST['Chantierlog']=="Valider"){
$_SESSION['Adresse']="log";
$_SESSION['ID_simulA']=$_POST['AdresseChantier'];
header("location:NouveauProjet.php");
}
if(isset($_POST['Adresselog'])&&$_POST['Adresselog']=="Valider"){
$client = $dbco->prepare("SELECT * FROM client WHERE IDc = '".$_SESSION['IDclient']."'"); //user='$AF' AND
$client->execute();
$CLI = $client->fetch(PDO::FETCH_OBJ);
//ENREGISTRER LA SIMULATION
$aides = $dbco->prepare("INSERT INTO cli_simulprime (ID_sp_client, PrimeATA, prop, proptype, hab, adressechantier, RueC, VilleC, CodePC, ancienprime, CouleurPrimeRenov, ProfilCee, NBPERS, revenu, revenus)
VALUES (:ID_sp_client, :PrimeATA, :prop, :proptype, :hab, :adressechantier, :RueC, :VilleC, :CodePC, :ancienprime, :CouleurPrimeRenov, :ProfilCee, :NBPERS, :revenu, :revenus)");
$aides->bindParam(':ID_sp_client',$_SESSION['IDclient']);
$aides->bindValue(':PrimeATA','NR');
$aides->bindParam(':prop',$_POST['Prop']);
$aides->bindParam(':proptype',$_POST['PropType']);
$aides->bindParam(':hab',$_POST['hab']);
$aides->bindValue(':adressechantier','facturation');
$aides->bindParam(':RueC',$CLI->rue);
$aides->bindParam(':VilleC',$CLI->Ville);
$aides->bindParam(':CodePC',$CLI->CodeP);
$aides->bindValue(':ancienprime','');
$aides->bindValue(':CouleurPrimeRenov','');
$aides->bindValue(':ProfilCee','');
$aides->bindValue(':NBPERS','');
$aides->bindValue(':revenu','');
$aides->bindValue(':revenus','');
$aides->execute();
$_SESSION['ID_simulA'] = $dbco->lastInsertId();
$_SESSION['Adresse']="log";
header("location:NouveauProjet.php");
}
if(isset($_POST['Adresse'])&&$_POST['Adresse']=="Valider"){
$client = $dbco->prepare("SELECT * FROM client WHERE IDc = '".$_SESSION['IDclient']."'"); //user='$AF' AND
$client->execute();
$CLI = $client->fetch(PDO::FETCH_OBJ);
//VERIF ADRESSE CHANTIER et enregister au besoin
if($_POST['adressechantier'] == "facturation"){
$adressechantier = $_POST['adressechantier'];
$RueC= $CLI->rue;
$CodePC = $CLI->CodeP;
$VilleC = $CLI->Ville;}
else{
$_POST['adressechantier'] = $_POST["adressechantier"];
$RueC = $_POST["rueC"];
$CodePC = $_POST["CodePC"];
$VilleC = $_POST["VilleC"];}
//ENREGISTRER LA SIMULATION
$aides = $dbco->prepare("INSERT INTO cli_simulprime (ID_sp_client, PrimeATA, prop, proptype, hab, adressechantier, RueC, VilleC, CodePC, ancienprime, CouleurPrimeRenov, ProfilCee, NBPERS, revenu, revenus)
VALUES (:ID_sp_client, :PrimeATA, :prop, :proptype, :hab, :adressechantier, :RueC, :VilleC, :CodePC, :ancienprime, :CouleurPrimeRenov, :ProfilCee, :NBPERS, :revenu, :revenus)");
$aides->bindParam(':ID_sp_client',$_SESSION['IDclient']);
$aides->bindValue(':PrimeATA','NR');
$aides->bindParam(':prop',$_POST['Prop']);
$aides->bindParam(':proptype',$_POST['PropType']);
$aides->bindParam(':hab',$_POST['hab']);
$aides->bindParam(':adressechantier',$_POST['adressechantier']);
$aides->bindParam(':RueC',$RueC);
$aides->bindParam(':VilleC',$VilleC);
$aides->bindParam(':CodePC',$CodePC);
$aides->bindValue(':ancienprime','');
$aides->bindValue(':CouleurPrimeRenov','');
$aides->bindValue(':ProfilCee','');
$aides->bindValue(':NBPERS','');
$aides->bindValue(':revenu','');
$aides->bindValue(':revenus','');
$aides->execute();
$_SESSION['ID_simulA'] = $dbco->lastInsertId();
$_SESSION['Adresse']="dif";
header("location:NouveauProjet.php");
}
$client = $dbco->prepare("SELECT * FROM cli_simulprime WHERE ID_sp_client = '".$_SESSION['IDclient']."'"); //user='$AF' AND
$client->execute();
$CLI = $client->fetch(PDO::FETCH_OBJ);
if((empty($CLI)||!empty($CLI))&&(isset($_GET['NewAdresse']))){
?>
<h3>ENREGISTER L'ADRESSE DU CHANTIER</h3>
<br>
<form method="post">
<div class="row">
<div class="col-md-6">
<p> Le logement est ?<select class="form-control" name="PropType"></p>
<option selected>Une maison</option>
<option>Un appartement</option></select>
<p> Je suis le ?<select class="form-control" name="Prop"></p>
<option selected>Proprietaire residence principale</option>
<option>Proprietaire residence secondaire</option>
<option>Proprietaire bailleur</option>
<option>Locataire avec bail</option>
<option>Locataire a titre gratuit</option></select>
<p> Le logement a ?<select class="form-control" name="hab"></p>
<option selected>Moins de 2 ans</option>
<option>Entre 2 et 15 ans</option>
<option>Plus de 15 ans</option></select>
</div>
<div class="col-md-6">
<div class="col-md-12">
<p>ADRESSE DU CHANTIER : </p>
<input type="hidden" name="adressechantier" value="differente" >
</div>
<div class="col-md-12">
<p> Adresse :<input class="form-control" type="text" name="rueC"/></p>
</div>
<div class="col-md-12" >
<div class="col-md-6">
Code Postal :<input class="form-control" type="text" name="CodePC" minlength="5" maxlength="5" pattern="[0-9]{5}" placeholder="59000" />
</div>
<div class="col-md-6">
Ville :<input class="form-control" type="text" name="VilleC" placeholder="Lille">
</div>
</div>
</div>
</div>
<div class="row">
<br><br>
<div class="col-md-8"></div>
<div class="col-md-4">
<input type="submit" name="Adresse" class="btn-l btn-primary" value="Valider" />
</div>
</div>
<?php }elseif(empty($CLI)&&($_GET['Adresse']=="log")){?>
<h3>DETAILLER L'ADRESSE DU CHANTIER</h3>
<br>
<form method="post">
<div class="row">
<div class="col-md-6">
<p> Le logement est ?<select class="form-control" name="PropType"></p>
<option selected>Une maison</option>
<option>Un appartement</option></select>
<p> Je suis le ?<select class="form-control" name="Prop"></p>
<option selected>Proprietaire residence principale</option>
<option>Proprietaire residence secondaire</option>
<option>Proprietaire bailleur</option>
<option>Locataire avec bail</option>
<option>Locataire a titre gratuit</option></select>
<p> Le logement a ?<select class="form-control" name="hab"></p>
<option selected>Moins de 2 ans</option>
<option>Entre 2 et 15 ans</option>
<option>Plus de 15 ans</option></select>
</div>
</div>
<div class="row">
<br><br>
<div class="col-md-8"></div>
<div class="col-md-4">
<input type="submit" name="Adresselog" class="btn-l btn-primary" value="Valider" />
</div>
</div>
<?php }elseif(!empty($CLI)&&($_GET['Adresse']=="log")){?>
<br><br>
<div class="row">
<?php echo '<h2>Numero de client : '.$_SESSION['IDclient'].'</h2>'; ?>
<h2>Selectionner l'adresse du chantier</h2>
<div class="col-md-6">
<center><img alt="HOME" src="../../Outils/required/Images/Bouton_adresse_ex.png" alt="ISO" width=80% class="img-responsive"/> </a></center>
</div>
<div class="col-md-6">
<a class="btn btn-lg btn-warning" href="NouveauProjet.php?NewAdresse=Oui">Nouvelle Adresse</a>
<h4>Retrouver le chantier</h4>
<form method="POST">
<select class="form-control" name="AdresseChantier"></p>
<?php $list1 = $dbco->prepare("SELECT * FROM cli_simulprime WHERE ID_sp_client = '".$_SESSION['IDclient']."' ");
$list1->execute();?>
<?php while($L1 = $list1->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $L1->ID_simulprime; ?>"><?php echo 'Adresse : '.$L1->RueC.' a '.$L1->VilleC.'' ?></option>
<?php } ?></select><br>
<input class="btn-l btn-primary" type="submit" name="Chantierlog" value="Valider">
</div>
</form>
</div>
<?php }else{ ?>
<br><br>
<div class="row">
<?php echo '<h2>Numero de client : '.$_SESSION['IDclient'].'</h2>'; ?>
<h2>Selectionner l'adresse du chantier</h2>
<div class="col-md-6">
<center><img alt="HOME" src="../../Outils/required/Images/Bouton_adresse_ex.png" alt="ISO" width=80% class="img-responsive"/> </a></center>
</div>
<div class="col-md-6">
<a class="btn btn-lg btn-warning" href="NouveauProjet.php?NewAdresse=Oui">Nouvelle Adresse</a>
<h4>Retrouver le chantier</h4>
<form method="POST">
<select class="form-control" name="AdresseChantier"></p>
<?php $list1 = $dbco->prepare("SELECT * FROM cli_simulprime WHERE ID_sp_client = '".$_SESSION['IDclient']."' ");
$list1->execute();?>
<?php while($L1 = $list1->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $L1->ID_simulprime; ?>"><?php echo 'Adresse : '.$L1->RueC.' a '.$L1->VilleC.'' ?></option>
<?php } ?></select><br>
<input class="btn-l btn-primary" type="submit" name="Chantier" value="Valider">
</div>
</form>
</div>
<?php } ?>