Your IP : 216.73.216.65


Current Path : /home/ataenra/www/ATA/INTRANET/MesSav/
Upload File :
Current File : /home/ataenra/www/ATA/INTRANET/MesSav/MESnewAE.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, EmailI, TelI, RaisonS)

    VALUES( :RefF, :Fabricant, :Etat, :DossierType, :DossierInt, :ObsD, :Ens_ae, :Ens_aa, :NomC, :CPC, :TelC, :AdresseC, :VilleC, :EmailC, :EmailI, :TelI, :RaisonS)");

    $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->bindParam(':EmailI',$_POST['EmailI']);
    $MesCreation->bindParam(':TelI',$_POST['TelI']);
    $MesCreation->bindParam(':RaisonS',$_POST['RaisonS']);
    $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.BC";
        $reff=$_POST['RefF'];
        $cheminD ="./ATA/FICHIERS/MES/$ld/BC/$newname.$ld.$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>";
        }
        }

        //mail require pour contact 
        //mail require pour validation
        //mail require pour client

        $_SESSION['ACTION']="MES en cours";



        header("location: ../../../index.php/hmes");

    }    





if($com=="Di4lz" || $com == "Adrien" || $com == "Thomas"){
$Lgamme = $dbco->prepare("SELECT ID_gamme, gamme_Nom FROM gest_gamme_pac WHERE TypeL = 'GAZ' ORDER BY gamme_Nom"); 
$Lgamme->execute();
    
}else{

$Lgamme = $dbco->prepare("SELECT ID_gamme, gamme_Nom FROM gest_gamme_pac WHERE Fabricant = '$FAB' AND TypeL = 'GAZ' ORDER BY gamme_Nom"); 
$Lgamme->execute();


}

?>



<form enctype="multipart/form-data" method="POST" autocomplete="off" >
<div class="container1">
    
        <h5 class="btn-lg btn-info"> NOUVELLE DEMANDE AIR/EAU</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> 
                    
                    <?php
                    if($com == "Di4lz" || $com == "Adrien" || $com == "Thomas"){
                        echo '<p> Reference ATA :<input class="form-control" type="text" name="RefF" required toggle="tooltip" data-placement="top" title="Reference interne"/></p>';

                    }else{

                        echo '<p> Reference '.$com.' :<input class="form-control" type="text" name="RefF" required toggle="tooltip" data-placement="top" title="Reference interne"/></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> Installateur</h3>
                    <div class="col-md-5">
                    <p> Raison Sociale :<input class="form-control" type="text" name="RaisonS" required/></p>
                    </div>

                    <div class="col-md-5">
                    <p> Téléphone :<input class="form-control" type="text" name="TelI" required/></p>
                    <p> Email :<input class="form-control" type="text" name="EmailI" required/></p>
                    </div>
                    
                    <h3> Informations Client</h3>
                    <div class="col-md-5">
                    <p> Nom/Prenom :<input class="form-control" type="text" name="NomC" required/></p>
                    <p> Adresse :<input class="form-control" type="text" name="AdresseC" 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>
                    </div>

                    <div class="col-md-5">
                    <p> Ville :<input class="form-control" type="text" name="VilleC" placeholder="Lille" required/></p>
                    <p> Téléphone Client final :<input class="form-control" type="text" name="TelC" required/></p>
                    <p> Email Client final :<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($LG = $Lgamme->fetch(PDO::FETCH_OBJ)) { ?>
                    <optgroup label="<?php echo $LG->gamme_Nom; ?>">
                    
                    <?php $Lmachine = $dbco->prepare("SELECT ID_Ens, appel, Puissance FROM gest_ens_pac_ae WHERE ID_gamme = '$LG->ID_gamme' "); 
                    $Lmachine->execute();?>

                    <?php while($LM = $Lmachine->fetch(PDO::FETCH_OBJ)) { ?>
                    <option value="<?php echo $LM->ID_Ens; ?>"><?php echo "".$LM->appel." "; echo $LM->Puissance; ?></option>
                    <?php } ?>  

                    <?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>

                    <?php 
                    if($com == "Di4lz" || $com == "Adrien" || $com == "Thomas"){
                        echo '<input type="hidden" name="Fabricant" value="ATA">';
                    
                        }else{ echo '<input type="hidden" name="Fabricant" value="'.$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>