| Current Path : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_Materiel/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_Materiel/New_Ensemble.php |
<?php
require "../../Outils/co.php";
session_start();
//Recup des tables par le routeur
$sth = $dbco->prepare("SELECT * FROM gest_routeur WHERE routeur_Base = '".$_SESSION['BASE']."'");
$sth->execute();
$I = $sth->fetch(PDO::FETCH_OBJ);
$table_gamme = $I->table_gamme;
$table_jointure = $I->table_jointure;
$table_jointure_access = $I->table_jointure_access;
$table_ensemble = $I->table_ensemble;
$table_produits = $I->table_produits;
require "calculPack.php";
require "calcul.php";
//DEBUG
//echo "<pre>";
//print_r($_SESSION);
//print_r($_POST);
//print_r($_GET);
//echo "</pre>";
$list1 = $dbco->prepare("SELECT * FROM ".$table_ensemble." ORDER BY ID_Ens DESC LIMIT 1");
$list1->execute();
if((isset($_POST['Gamme']))){
$_SESSION['Gamme']=$_POST['Gamme'];
$_SESSION['IDens']="Choisir ID";
}
if((isset($_SESSION['Gamme']))&&($_SESSION['Gamme']!="Choisir la gamme")){
$gam = $dbco->prepare("SELECT ID_gamme FROM ".$table_gamme." WHERE gamme_Nom = '".$_SESSION['Gamme']."'");
$gam->execute();
$Gam = $gam->fetch(PDO::FETCH_OBJ); $_SESSION['ID_gamme']=$Gam->ID_gamme;
}
//CHOISIR LE BON FICHIER D'ACTION EN FONCTION DE LA DEMANDE. AJOUT OU SUPPRESSION
if(isset($_GET['Action'])){require "TypeProjet/Ensemble/".$_GET['Action'].".php";}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="../../Outils/css/NewEnsemble.css" rel="stylesheet" type="text/css">
<title>GESTION DES TABLES MATERIEL ATA</title>
</head>
<body>
<form method="post" autocomplete="off">
<!-- TITRE DE LA PAGE ET LE HEADER-->
<div class="containerPage">
<div class="containerTitre">
<div class="row">
<div class="col-sm-2">
<img src="../../Outils/required/ATA-Logo.jpg" alt="ISO" width=30% class= />
</div>
<div class="col-sm-8">
<span class="align-middle">GESTION DES ENSEMBLES : <?php echo $_SESSION['Gamme']; ?></span><br>
<?php if($_SESSION['Gamme']=="Choisir la gamme"){?>
<a><select class="form-control" name="Gamme">
<?php if(isset($_SESSION['Gamme'])){echo '<option hidden>'.$_SESSION['Gamme'].'</option>';}else{echo '<option value="" disabled selected hidden>Choisir la gamme</option>';}?>
<?php $ll3 = $dbco->prepare("SELECT G.gamme_Nom FROM gest_routeur R
JOIN ".$table_gamme." G ON R.ID_Routeur=G.ID_routeur
WHERE R.routeur_Famille = '".$_SESSION['Famille']."' ORDER BY G.Fabricant ASC"); $ll3->execute(); ?>
<?php while($LL3 = $ll3->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LL3->gamme_Nom; ?>" ><?php echo $LL3->gamme_Nom; ?></option>
<?php } ?></select></a>
<input class="btn btn-dark" type="submit" name="Table" Value="CHOISIR" >
<?php } ?>
<input class="btn btn-success" type="submit" name="NewEns" value="New">
</div>
<div class="col-sm-2">
<a href="./Gestion_Materiel.php" title="">
<img alt="HOME" src="../../Outils/required/home1.png" alt="ISO" width=30% class="img-responsive" class="align-right"/> </a>
</div>
</div>
</div>
</form>
<!-- FORMULAIRE DE CREATION DUN MATERIEL DANS LA TABLE CHOISIE-->
<?php if(isset($_POST['NewEns'])||(isset($_POST['NewEnsC']))){ ?>
<?php require "./TypeProjet/Ensemble/".$_SESSION['BASE'].".php"; ?>
<!-- LISTE DES DERNIERS MATERIEL AJOUTES-->
<div class="container11">
<h5 class="btn-lg btn-warning">Derniers ensembles matériels ajoutés</h5>
<div class="table-responsive">
<table class='table table-hover table-bordered table-condensed'>
<thead><tr><th>ID</th><th>FABRICANT</th><th>MODELE</th><th>PUISSANCE</th><th>ELEC</th></tr></thead>
<?php while ($R1 = $list1->fetch(PDO::FETCH_OBJ)) { ?>
<tr><td><?php echo $R1->ID_Ens; ?></td><td><?php echo $R1->Fabricant; ?></td><td><?php echo $R1->appel; ?></td><td><?php echo $R1->Puissance; ?></td><td><?php echo $R1->Elec; ?></td></tr>
<?php } ?>
</table>
</div>
</div>
<?php } ?>
<!--CONTAINER3-->
<div class="container1">
<div class="row">
<!--COLONNE 1-->
<?php if(isset($_GET['IDm'])){
$cat = $dbco->prepare("SELECT * FROM ".$table_gamme." G JOIN ".$table_ensemble." E ON G.ID_Gamme=E.ID_gamme WHERE ID_Ens='".$_GET['IDm']."'");
$cat->execute();
$CAT=$cat->fetch(PDO::FETCH_OBJ);
$_SESSION['IDm']=$CAT->gamme_Nom;
$_SESSION['Puissance']=$CAT->Puissance;
}?>
<div class="col-sm-8">
<h2 class="btn-lg btn-light">LISTE DES PRODUITS/ACCESSOIRES : <?php if(isset($_SESSION['IDm'])){ echo ''.$_SESSION['IDm']. ' '.$_SESSION['Puissance'].'';} ?></h2>
<h4>PRODUITS DE L'ENSEMBLE :</h4>
<?php if(isset($_GET['IDm'])){}else{echo "Choisir un ensemble a afficher";}?>
<?php if(isset($_GET['IDm'])){ $list4 = $dbco->prepare("SELECT * FROM ".$table_produits." D JOIN ".$table_jointure." J ON D.ID_Produit=J.ID_produit JOIN ".$table_ensemble." E ON E.ID_Ens=J.ID_ens JOIN ".$table_gamme." G ON G.ID_Gamme=E.ID_gamme WHERE J.ID_ens='".$_GET['IDm']."'"); $list4->execute();?>
<?php if(!empty($list4)) {?>
<!--TABLEAU 1 des produits-->
<div class="table-responsive">
<table class='table table-hover table-bordered table-condensed'>
<thead><tr><th>ID</th><th>Type</th><th>Ref</th><th>DESIGNATION</th><th>PUISSANCE</th><th>Fournisseur</th><th>Prix de vente</th><th>ACTION</th></tr></thead>
<?php while ($R4 = $list4->fetch(PDO::FETCH_OBJ)) { ?>
<tr> <td><?php echo $R4->ID_produit; ?></td><td><?php echo $R4->Emp; ?></td><td><?php echo $R4->Ref; ?></td><td><?php echo $R4->modele; ?></td><td><?php echo $R4->Puissance; ?></td><td><?php echo $R4->FRS; ?></td>
<td><?php echo $R4->pv ?>
<td><?php echo '<a class="btn btn-danger" href="./New_Ensemble.php?IDjoin='.$R4->ID_join.'&Action=DelP&IDm='.$_GET['IDm'].'">Supprimer</a>'?></td>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
<!--TABLEAU 2 des packs-->
<?php $list5 = $dbco->prepare("SELECT * FROM gest_articles_pack A JOIN ".$table_jointure_access." J ON A.ID_Pack=J.ID_pack WHERE J.ID_ens='".$_GET['IDm']."'"); $list5->execute();?>
<?php $R5 = $list5->fetch(PDO::FETCH_OBJ);?>
<?php if(!empty($R5)) {?>
<div class="table-responsive">
<h4>PACKS DE L'ENSEMBLE :</h4>
<table class='table table-hover table-bordered table-condensed'>
<thead><tr><th>ID</th><th>Designation</th><th>Prix de vente</th><th>Quantite</th><th>ACTION</th></tr></thead>
<?php if(isset($_GET['IDm'])){$list5->execute();while ($R5 = $list5->fetch(PDO::FETCH_OBJ)) { ?>
<?php $l5 = $dbco->prepare("SELECT * FROM gest_articles A JOIN gest_articles_join J ON A.ID_Article=J.ID_article WHERE J.ID_pack='".$R5->ID_Pack."'"); $l5->execute();?>
<tr bgcolor="#EEE8E7"><td><?php echo $R5->ID_Pack; ?></td><td><?php echo $R5->pack_designation; ?></td><td><?php echo $R5->pack_pv ?><td><?php echo $R5->QT_articles; ?></td>
<td><?php echo '<a class="btn btn-danger" href="./New_Ensemble.php?IDjoin='.$R5->ID_join_articles.'&Action=Delpack&IDm='.$_GET['IDm'].'">Supprimer</a>'?></td>
</tr>
<?php while ( $L5 = $l5->fetch(PDO::FETCH_OBJ)) {if(!empty($l5)){ ?>
<tr><td></td><td><?php echo $L5->DESIGNATION; ?></td><td><?php echo $L5->PV ?><td><?php echo $L5->QT_articles; ?></td></tr>
<?php }} ?>
<?php $l6 = $dbco->prepare("SELECT * FROM gest_mo M JOIN gest_articles_join J ON M.ID_Mo=J.ID_mo WHERE J.ID_pack='".$R5->ID_Pack."'"); $l6->execute();?>
<?php while ( $L6 = $l6->fetch(PDO::FETCH_OBJ)) {if(!empty($l6)){ ?>
<tr><td></td><td><?php echo $L6->mo_designation; ?></td><td><?php echo $L6->mo_pv ?><td><?php echo $L6->QT_articles; ?></td></tr>
<?php }} } ?>
</table>
</div>
<?php }} ?>
<!--TABLEAU 3 des accessoires-->
<?php $list6 = $dbco->prepare("SELECT * FROM gest_articles A JOIN ".$table_jointure_access." J ON A.ID_Article=J.ID_article JOIN gest_fournisseurs F ON F.IDfrs=A.FRS WHERE J.ID_ens='".$_GET['IDm']."'"); $list6->execute();?>
<?php $R6 = $list6->fetch(PDO::FETCH_OBJ);?>
<?php if(!empty($R6)) {?>
<div class="table-responsive">
<h4>ARTICLES DE L'ENSEMBLE :</h4>
<table class='table table-hover table-bordered table-condensed'>
<thead><tr><th>ID</th><th>Ref</th><th>Designation</th><th>Fournisseur</th><th>Prix de vente</th><th>ACTION</th></tr></thead>
<?php if(isset($_GET['IDm'])){$list6->execute(); while ($R6 = $list6->fetch(PDO::FETCH_OBJ)) { ?>
<tr><td><?php echo $R6->ID_Article; ?></td><td><?php echo $R6->REFfrs; ?></td><td><?php echo $R6->DESIGNATION; ?></td><td><?php echo $R6->frs_nom; ?></td>
<td><?php echo $R6->PV ?>
<td><?php echo '<a class="btn btn-danger" href="./New_Ensemble.php?IDjoin='.$R6->ID_join_articles.'&Action=DelA&IDm='.$_GET['IDm'].'">Supprimer</a>'?></td>
</tr>
<?php }} ?>
</table>
</div>
<?php } ?>
<!--TABLEAU 4 des Forfaits main oeuvre-->
<?php $list7 = $dbco->prepare("SELECT * FROM gest_mo_forfait M JOIN ".$table_jointure_access." J ON J.ID_forfait=M.ID_Forfait WHERE J.ID_ens='".$_GET['IDm']."'"); $list7->execute();?>
<?php $R7 = $list7->fetch(PDO::FETCH_OBJ);?>
<?php if(!empty($R7)) {?>
<div class="table-responsive">
<h4>FORFAITS DE L'ENSEMBLE :</h4>
<table class='table table-hover table-bordered table-condensed'>
<thead><tr><th>ID</th><th>Designation</th><th>Prix de vente</th><th>ACTION</th></tr></thead>
<?php if(isset($_GET['IDm'])){$list7->execute(); while ($R7 = $list7->fetch(PDO::FETCH_OBJ)) { ?>
<tr bgcolor="#EEE8E7"><td><?php echo $R7->ID_Forfait; ?></td><td><?php echo $R7->forfait_designation; ?></td><td><?php echo $R7->forfait_pv ?>
<td><?php echo '<a class="btn btn-danger" href="./New_Ensemble.php?IDjoin='.$R7->ID_join_articles.'&Action=Delouv&IDm='.$_GET['IDm'].'">Supprimer</a>'?></td>
</tr>
<?php }} ?>
</table>
</div>
<?php } ?>
<!--TABLEAU 5 des main oeuvre seules-->
<?php $list8 = $dbco->prepare("SELECT * FROM gest_mo M JOIN ".$table_jointure_access." J ON J.ID_mo=M.ID_Mo WHERE J.ID_ens='".$_GET['IDm']."'"); $list8->execute();?>
<?php $R8 = $list8->fetch(PDO::FETCH_OBJ);?>
<?php if(!empty($R8)) {?>
<div class="table-responsive">
<h4>MAIN OEUVRE DE L'ENSEMBLE :</h4>
<table class='table table-hover table-bordered table-condensed'>
<thead><tr><th>ID</th><th>Designation</th><th>Quantite</th><th>Prix de vente</th><th>ACTION</th></tr></thead>
<?php if(isset($_GET['IDm'])){$list8->execute(); while ($R5 = $list8->fetch(PDO::FETCH_OBJ)) { ?>
<tr><td><?php echo $R8->ID_Mo; ?></td><td><?php echo $R8->mo_designation; ?></td><td><?php echo $R8->QT_articles; ?></td>
<td><?php echo $R8->mo_pv ?>
<td><?php echo '<a class="btn btn-danger" href="./New_Ensemble.php?IDjoin='.$R8->ID_join_articles.'&Action=Delmo&IDm='.$_GET['IDm'].'">Supprimer</a>'?></td>
</tr>
<?php }} ?>
</table>
</div>
<?php } ?>
<?php } ?>
</div>
<!-- FIN COLONNE 1-->
<!--COLONNE 2-->
<div class="col-sm-4">
<!-- RECUP INFO LISTE ENSEBMLES de la bonne table-->
<?php $list3 = $dbco->prepare("SELECT * FROM ".$table_ensemble." E JOIN ".$table_gamme." G ON E.ID_gamme=G.ID_Gamme WHERE G.gamme_Nom='".$_SESSION['Gamme']."' "); $list3->execute(); ?>
<h4 class="btn-lg btn-light">LISTE DES ENSEMBLES DISPONIBLES</h4>
<div class="table-responsive">
<div style="overflow-x: hidden; overflow-y: scroll; width: 100%; height: 400px;">
<table class='table table-hover table-bordered table-condensed'>
<thead><tr><th>DESIGNATION</th><th>PV</th><th>ACTION</th></tr></thead>
<?php while ($R3 = $list3->fetch(PDO::FETCH_OBJ)) { ?>
<tr><td><?php echo ''.$R3->gamme_Nom.' '.$R3->Puissance.''; ?></td>
<td><?php echo $R3->ens_pv ; ?></td>
<td><?php echo '<a class="btn btn-warning" href="./New_Ensemble.php?IDm='.$R3->ID_Ens.'&A=V">VOIR</a>';
echo '<a class="btn btn-danger" href="./New_Ensemble.php?IDp='.$R3->ID_Ens.'&A='.$R3->appel.' '.$R3->Puissance.' '.$R3->Elec.'">MODIF</a>';?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
<h4 class="btn-lg btn-light">AJOUTER UN PRODUIT OU ACCESSOIRE :</h4>
<?php if(isset($_GET['IDm'])){ ?>
<div class="col-sm-8">
<div class="col-sm-10">
<form method="get" autocomplete="off">
<!--LIST SELECT DES PRODUITS A ASSEMBLER-->
<a><select class="form-control" name="IDd">
<option value="" disabled selected hidden>Materiel a ajouter</option>
<?php $fab= $dbco->prepare("SELECT Fabricant FROM $table_gamme WHERE ID_gamme='".$_SESSION['ID_gamme']."' "); $fab->execute(); $FAB = $fab->fetch(PDO::FETCH_OBJ); ?>
<?php //$lp= $dbco->prepare("SELECT * FROM $table_produits P JOIN $table_jointure J ON J.ID_produit=P.ID_Produit JOIN $table_ensemble E ON J.ID_ens=E.ID_Ens JOIN $table_gamme G ON G.ID_gamme=E.ID_gamme WHERE E.Fabricant='".$FAB->Fabricant."' "); $lp->execute(); ?>
<?php $lp= $dbco->prepare("SELECT * FROM $table_produits "); $lp->execute(); ?>
<?php while($LP = $lp->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LP->ID_Produit; ?>"><?php echo ''.$LP->modele.' '.$LP->Ref.''; ?></option>
<?php } ?></select></a><br>
</div>
<div class="col-sm-2">
<input required class="form-control" type="int" value="1" name="QT" placeholder="Quantite">
</div>
<input type="hidden" name="IDmat" value="<?php echo $_GET['IDm'];?>">
<input type="hidden" name="IDm" value="<?php echo $_GET['IDm'];?>">
</div>
<div class="col-sm-2">
<input class="btn btn-warning" type='submit' name="Action" Value="AddP"><br>
</form>
</div>
<!-- ADD ACCESSOIRE PACK -->
<div class="col-sm-8">
<div class="col-sm-10">
<form method="get" autocomplete="off">
<!--LIST SELECT DES PACKS A ASSEMBLER-->
<a><select class="form-control" name="IDa">
<option value="" disabled selected hidden>Pack a ajouter</option>
<?php $la= $dbco->prepare("SELECT * FROM gest_articles_pack"); $la->execute(); ?>
<?php while($LA = $la->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LA->ID_Pack; ?>"><?php echo $LA->pack_designation; ?></option>
<?php } ?></select></a><br>
</div>
<div class="col-sm-2">
<input required class="form-control" type="int" value="1" name="QT" placeholder="Quantite">
</div>
<input type="hidden" name="IDmat" value="<?php echo $_GET['IDm'];?>">
<input type="hidden" name="IDm" value="<?php echo $_GET['IDm'];?>">
</div>
<div class="col-sm-2">
<input class="btn btn-warning" type='submit' name="Action" Value="Addpack"><br>
</div>
</form>
<!-- ADD ACCESSOIRE SOLO -->
<div class="col-sm-8">
<div class="col-sm-10">
<form method="get" autocomplete="off">
<!--LIST SELECT DES ACCESSOIRES A ASSEMBLER-->
<a><select class="form-control" name="IDa">
<option value="" disabled selected hidden>Accessoire a ajouter</option>
<?php $la= $dbco->prepare("SELECT * FROM gest_articles"); $la->execute(); ?>
<?php while($LA = $la->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LA->ID_Article; ?>"><?php echo $LA->DESIGNATION; ?></option>
<?php } ?></select></a><br>
</div>
<div class="col-sm-2">
<input required class="form-control" type="int" value="1" name="QT" placeholder="Quantite">
</div>
<input type="hidden" name="IDmat" value="<?php echo $_GET['IDm'];?>">
<input type="hidden" name="IDm" value="<?php echo $_GET['IDm'];?>">
</div>
<div class="col-sm-2">
<input class="btn btn-warning" type='submit' name="Action" Value="AddA"><br>
</div>
</form>
<!-- OUVRAGE MO -->
<div class="col-sm-8">
<div class="col-sm-10">
<form method="get" autocomplete="off">
<!--LIST SELECT DES OUVRAGES MO A ASSEMBLER-->
<a><select class="form-control" name="IDa">
<option value="" disabled selected hidden>Ouvrages MO a ajouter</option>
<?php $la= $dbco->prepare("SELECT * FROM gest_mo_forfait"); $la->execute(); ?>
<?php while($LA = $la->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LA->ID_Forfait; ?>"><?php echo $LA->forfait_designation; ?></option>
<?php } ?></select></a><br>
</div>
<div class="col-sm-2">
<input required class="form-control" type="int" value="1" name="QT" placeholder="Quantite">
</div>
<input type="hidden" name="IDmat" value="<?php echo $_GET['IDm'];?>">
<input type="hidden" name="IDm" value="<?php echo $_GET['IDm'];?>">
</div>
<div class="col-sm-2">
<input class="btn btn-warning" type='submit' name="Action" Value="AddOuv"><br>
</div>
</form>
<!-- Main oeuvre -->
<div class="col-sm-8">
<div class="col-sm-10">
<form method="get" autocomplete="off">
<!--LIST SELECT DES MAIN Oeuvre A ASSEMBLER-->
<a><select class="form-control" name="IDa">
<option value="" disabled selected hidden>MO a ajouter</option>
<?php $la= $dbco->prepare("SELECT * FROM gest_mo"); $la->execute(); ?>
<?php while($LA = $la->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LA->ID_Mo; ?>"><?php echo $LA->mo_designation; ?></option>
<?php } ?></select></a><br>
</div>
<div class="col-sm-2">
<input required class="form-control" type="int" value="1" name="QT" placeholder="Quantite">
</div>
<input type="hidden" name="IDmat" value="<?php echo $_GET['IDm'];?>">
<input type="hidden" name="IDm" value="<?php echo $_GET['IDm'];?>">
</div>
<div class="col-sm-2">
<input class="btn btn-warning" type='submit' name="Action" Value="Addmo"><br>
</div>
</form>
<?php } ?>
<div class="col-sm-6">
<?php echo '<a class="btn btn-warning" href="./New_Produit.php">NEW PRODUIT</a>'; ?></div>
<div class="col-sm-6">
<?php echo '<a class="btn btn-danger" href="./Modif_Produit.php">MOD PRODUIT</a>'; ?></div>
</div>
</form>
</div>
</div>
<!--FIN COLONNE 2-->
</div>
</div>
</div>
</body>
<?php
?>
</html>