| Current Path : /home/ataenra/www/ATA/INTRANET/Tech/MesSav/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Tech/MesSav/MESnewAA.php |
<?php
if (isset($_POST['up'])) {
$MesCreation = $dbco->prepare("INSERT INTO gest_mes ( RefF, Fabricant, Etat, DossierType, DossierInt, ObsD, Ens_ae, Ens_aa, NomC, CPC, TelC, AdresseC, VilleC, EmailC)
VALUES( :RefF, :Fabricant, :Etat, :DossierType, :DossierInt, :ObsD, :Ens_ae, :Ens_aa, :NomC, :CPC, :TelC, :AdresseC, :VilleC, :EmailC)");
$MesCreation->bindParam(':RefF',$_POST['RefF']);
$MesCreation->bindParam(':Fabricant',$_POST['Fabricant']);
$MesCreation->bindvalue(':Etat',"Soumis");
$MesCreation->bindParam(':DossierType',$_POST['DossierType']);
$MesCreation->bindParam(':DossierInt',$_POST['DossierInt']);
$MesCreation->bindParam(':ObsD',$_POST['ObsD']);
$MesCreation->bindParam(':Ens_ae',$_POST['Ens_ae']);
$MesCreation->bindvalue(':Ens_aa',"0");
$MesCreation->bindParam(':NomC',$_POST['NomC']);
$MesCreation->bindParam(':CPC',$_POST['CPC']);
$MesCreation->bindParam(':TelC',$_POST['TelC']);
$MesCreation->bindParam(':AdresseC',$_POST['AdresseC']);
$MesCreation->bindParam(':VilleC',$_POST['VilleC']);
$MesCreation->bindParam(':EmailC',$_POST['EmailC']);
$MesCreation->execute();
$ld=$dbco->lastInsertId();
// Le nom du répertoire à créer
$chemin1 ="./ATA/FICHIERS/MES/$ld";
$chemin2 ="./ATA/FICHIERS/MES/$ld/BC";
// Vérifie si le répertoire existe :
if (!is_dir($chemin1)) {mkdir($chemin1, 0777,true);}
if (!is_dir($chemin2)) {mkdir($chemin2, 0777,true);}
//TELECHARGER LE BC
if(isset($_FILES['BC']) && $_FILES['BC']['error'] === 0) {
$filename = $_FILES["BC"]["name"];
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$newname = "MES";
$reff=$_POST['RefF'];
$cheminD ="./ATA/FICHIERS/MES/$ld/BC/$newname.$ld.$reff.$extension";
if (move_uploaded_file($_FILES["BC"]["tmp_name"], $cheminD)) {
echo "<h4>Le fichier BC est valide, et a été téléchargé avec succès.\n</h4>";
} else {
echo "<h4>Fichiers non téléchargés
Voici plus d'informations :\n</h4>";
}
}
$_SESSION['ACTION']="MES en cours";
header("location: ../../../index.php/hmes");
}
if($com=="Di4lz"){
$Lmachine = $dbco->prepare("SELECT DISTINCT E.ID_Ens,G.gamme_Nom,E.Puissance FROM gest_gamme_pac G JOIN gest_ens_pac_ae E ON G.ID_gamme=E.ID_gamme WHERE G.TypeL = 'GAZ'");
$Lmachine->execute();
}else{
$Lmachine = $dbco->prepare("SELECT DISTINCT E.ID_Ens,G.gamme_Nom,E.Puissance FROM gest_gamme_pac G JOIN gest_ens_pac_ae E ON G.ID_gamme=E.ID_gamme WHERE G.Fabricant = '$FAB' AND G.TypeL = 'GAZ'");
$Lmachine->execute();
}
?>
<form enctype="multipart/form-data" method="POST" autocomplete="off" >
<div class="container1">
<h5 class="btn-lg btn-info"> NOUVELLE DEMANDE</h5>
<div style="overflow-x: hidden; overflow-y: hidden; width: 100%; height: 600px;">
<div class="row">
<div class="col-md-4-l">
<h3>Informations Dossier : </h3>
<p> Type de dossier : <select class="form-control" name="DossierType" required></p>
<option selected>Une maison</option>
<option>Un appartement</option>
<option>Une entreprise</option>
</select>
<p> Reference <?php echo $com; ?> :<input class="form-control" type="text" name="RefF" required toggle="tooltip" data-placement="top" title="Reference interne fabricant"/></p>
<p> Délai d'intervention :<select class="form-control" name="DossierInt" required toggle="tooltip" data-placement="top" title="Délai d'intervention souhaité, Standard sous 72h.<br> Préventive pour bloquer une intervention, Urgent pour intervention le lendemain (soumis à surfacturation)."></p>
<option>Urgent +24h</option>
<option selected>Standard +72h</option>
<option>Préventive sur rdv client</option>
</select>
</div>
<div class="col-md-4-l">
<h3> Informations Client final</h3>
<div class="col-md-5">
<p> Nom/Prenom :<input class="form-control" type="text" name="NomC" required/></p>
<p> Code Postal :<input class="form-control" type="text" name="CPC" minlength="5" maxlength="5" pattern="[0-9]{5}" placeholder="59000" required/></p>
<p> Téléphone :<input class="form-control" type="text" name="TelC" required/></p>
</div>
<div class="col-md-5">
<p> Adresse :<input class="form-control" type="text" name="AdresseC" required /></p>
<p> Ville :<input class="form-control" type="text" name="VilleC" placeholder="Lille" required/></p>
<p> Email :<input class="form-control" type="text" name="EmailC" required/></p>
</div>
</div>
<div class="col-md-4-l">
<h3>Informations techniques : </h3>
<p> Machine :<select class="form-control" name="Ens_ae" required>
<option value="">Selection de la machine</option>
<?php while($LM = $Lmachine->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LM->ID_Ens;?>"><?php echo $LM->gamme_Nom; ?> <?php echo $LM->Puissance; ?></option>
<?php } ?></select></p>
<p> Observations :<textarea class="form-control" rows="5" name="ObsD" ></textarea></p>
<p> Document interne : <input name="BC" type="file" required/></p>
<input type="hidden" name="Fabricant" value="<?php echo $com;?>">
</div>
</div>
<div class="row">
<div class="col-md-12-r">
<input class="btn-lg btn-success" type="submit" name="up" value="Soumettre">
</div>
</div>
</div>
</div>