| Current Path : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_Materiel/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_Materiel/New_Produit.php |
<?php
require "../../Outils/co.php";
session_start();
//GAMME ET EMPLACEMENT
if(isset($_GET['Gamme'])){
$_SESSION['ID_gamme'] = $_GET['Gamme'];
$Emp = $_GET['Emp'];
}
//CHOIX DE LA FAMILLE
if(isset($_POST['Famille'])){
$_SESSION['Famille'] = $_POST['Famille'];
$famille = $_SESSION['Famille'];
$gamme="0";
$Emp="0";
}
$famille = $_SESSION['Famille'];
//DEBUG
//echo "<pre>";
//print_r($_SESSION);
//print_r($_POST);
//echo "</pre>";
// ROUTEUR DES TABLES DES CATEGORIES SELECTIONNES
$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;
if(isset($_POST['New'])){
//Calcul pente courbe puissance
$Pn35=$_POST['Pn35'];$Pp35=$_POST['Pp35'];
$Pn55=$_POST['Pn55'];$Pp55=$_POST['Pp55'];
$Pn70=$_POST['Pn70'];$Pp70=$_POST['Pp70'];
$Dt35=$Pp35-$Pn35;
$Dt55=$Pp55-$Pn55;
$Dt70=$Pp70-$Pn70;
if($Dt35 !=0) {$CoefA35=round($Dt35/14,2);$CoefB35=$Pn35-(-($Dt35/2));}else{$CoefA35=0;$CoefB35=0;};
if($Dt55 !=0) {$CoefA55=round($Dt55/14,2);$CoefB55=$Pn55-(-($Dt55/2));}else{$CoefA55=0;$CoefB55=0;};
if($Dt70 !=0) {$CoefA70=round($Dt70/14,2);$CoefB70=$Pn70-(-($Dt70/2));}else{$CoefA70=0;$CoefB70=0;};
//1 INSERTION DU PRODUIT
$NewProduit = $dbco->prepare("INSERT INTO ".$table_produits." (Pmax35, Pmax55, Pmax70, P7m35, P7m55, P7m70, P7p35, P7p55, P7p70, A35, B35, A55, B55, A70, B70, Ref, TypeL, lgmaxl, lgchargel, modele, pv, Emp, diamhydprim, Liaison, ChargeI, chargeadd, ScopBT35, ScopMT55, ScopHT70, NS35, NS55, NS70, ScopEcs, Volumeau, sectionalim, appoint, protecUE, protecUI, protecUIg, consomax, LimiteFc, LimiteFr, LimiteFecs, DiamEcs, Pacous, Pacous1m, CE35, CE55, CE70, NSEcs, CEEcs)
VALUES (:Pmax35, :Pmax55, :Pmax70, :P7m35, :P7m55, :P7m70, :P7p35, :P7p55, :P7p70, :A35, :B35, :A55, :B55, :A70, :B70, :Ref, :TypeL, :lgmaxl, :lgchargel, :modele, :pv, :Emp, :diamhydprim, :Liaison, :ChargeI, :chargeadd, :ScopBT35, :ScopMT55, :ScopHT70, :NS35, :NS55, :NS70, :ScopEcs, :Volumeau, :sectionalim, :appoint, :protecUE, :protecUI, :protecUIg, :consomax, :LimiteFc, :LimiteFr, :LimiteFecs, :DiamEcs, :Pacous, :Pacous1m, :CE35, :CE55, :CE70, :NSEcs, :CEEcs)");
$NewProduit->bindParam(':Pmax35',$_POST['Pmax35']);
$NewProduit->bindParam(':Pmax55',$_POST['Pmax55']);
$NewProduit->bindParam(':Pmax70',$_POST['Pmax70']);
$NewProduit->bindParam(':P7m35',$_POST['Pn35']);
$NewProduit->bindParam(':P7m55',$_POST['Pn55']);
$NewProduit->bindParam(':P7m70',$_POST['Pn70']);
$NewProduit->bindParam(':P7p35',$_POST['Pp35']);
$NewProduit->bindParam(':P7p55',$_POST['Pp55']);
$NewProduit->bindParam(':P7p70',$_POST['Pp70']);
$NewProduit->bindParam(':A35',$CoefA35);
$NewProduit->bindParam(':B35',$CoefB35);
$NewProduit->bindParam(':A55',$CoefA55);
$NewProduit->bindParam(':B55',$CoefB55);
$NewProduit->bindParam(':A70',$CoefA70);
$NewProduit->bindParam(':B70',$CoefB70);
$NewProduit->bindParam(':Ref',$_POST['Ref']);
$NewProduit->bindParam(':modele',$_POST['modele']);
$NewProduit->bindParam(':pv',$_POST['pv']);
$NewProduit->bindParam(':Emp',$_POST['Emp']);
$NewProduit->bindParam(':diamhydprim',$_POST['diamhydprim']);
$NewProduit->bindParam(':Liaison',$_POST['Liaison']);
$NewProduit->bindParam(':ChargeI',$_POST['ChargeI']);
$NewProduit->bindParam(':chargeadd',$_POST['chargeadd']);
$NewProduit->bindParam(':ScopBT35',$_POST['ScopBT35']);
$NewProduit->bindParam(':ScopMT55',$_POST['ScopMT55']);
$NewProduit->bindParam(':ScopHT70',$_POST['ScopHT70']);
$NewProduit->bindParam(':NS35',$_POST['NS35']);
$NewProduit->bindParam(':NS55',$_POST['NS55']);
$NewProduit->bindParam(':NS70',$_POST['NS70']);
$NewProduit->bindParam(':ScopEcs',$_POST['ScopEcs']);
$NewProduit->bindParam(':Volumeau',$_POST['Volumeau']);
$NewProduit->bindParam(':sectionalim',$_POST['sectionalim']);
$NewProduit->bindParam(':protecUE',$_POST['protecUE']);
$NewProduit->bindParam(':protecUI',$_POST['protecUI']);
$NewProduit->bindParam(':protecUIg',$_POST['protecUIg']);
$NewProduit->bindParam(':appoint',$_POST['appoint']);
$NewProduit->bindParam(':consomax',$_POST['consomax']);
$NewProduit->bindParam(':LimiteFc',$_POST['LimiteFc']);
$NewProduit->bindParam(':LimiteFr',$_POST['LimiteFr']);
$NewProduit->bindParam(':LimiteFecs',$_POST['LimiteFecs']);
$NewProduit->bindParam(':DiamEcs',$_POST['DiamEcs']);
$NewProduit->bindParam(':Pacous',$_POST['Pacous']);
$NewProduit->bindParam(':Pacous1m',$_POST['Pacous1m']);
$NewProduit->bindParam(':CE35',$_POST['CE35']);
$NewProduit->bindParam(':CE55',$_POST['CE55']);
$NewProduit->bindParam(':CE70',$_POST['CE70']);
$NewProduit->bindParam(':NSEcs',$_POST['NSEcs']);
$NewProduit->bindParam(':CEEcs',$_POST['CEEcs']);
$NewProduit->bindParam(':TypeL',$_POST['TypeL']);
$NewProduit->bindParam(':lgmaxl',$_POST['lgmaxl']);
$NewProduit->bindParam(':lgchargel',$_POST['lgchargel']);
$NewProduit->execute();
echo "Ok";
}
?>
<!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/agcom.css" rel="stylesheet" type="text/css">
<title>ATA PRODUIT</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-md-2">
<img src="../../Outils/required/ATA-Logo.jpg" alt="ISO" width=25% class= />
</div>
<div class="col-md-8">
<span class="align-middle">CREATION D'UN PRODUIT <?php echo $_SESSION['Famille']; ?></span>
<?php if($_SESSION['Famille']=="Choisir la famille"){?>
<select class="form-control" name="Famille">
<?php if(isset($_SESSION['Famille'])){echo '<option hidden>'.$_SESSION['Famille'].'</option>';}else{echo '<option value="" disabled selected hidden>Choisir la famille</option>';}?>
<?php $ll1= $dbco->prepare("SELECT * FROM gest_routeur WHERE routeur_Base = '".$_SESSION['BASE']."' GROUP BY routeur_Famille"); $ll1->execute(); ?>
<?php while($LL1 = $ll1->fetch(PDO::FETCH_OBJ)) { ?>
<option value="<?php echo $LL1->routeur_Famille; ?>"><?php echo $LL1->routeur_appel_famille; ?></option>
<?php } ?></select>
<input class="btn-lg btn-dark" type="submit" name="Table" Value="CHOISIR" >
<?php } ?>
</div>
<div class="col-md-2">
<a href="./Gestion_Materiel.php" title="">
<img alt="HOME" src="../../Outils/required/home1.png" alt="ISO" width=25% class="img-responsive" class="align-right"/> </a>
</div>
</div>
</div>
</form>
<!-- FILTRAGE FORMULAIRE SELON LE TYPE PAC_AE / PAC_AA / Exemple PAC_AE Fichier PAC_AE dans dossier produit-->
<?php if((isset($_SESSION['Famille'])||(isset($_GET['Gamme'])))){?>
<div class="container1">
<h5 class="btn-lg btn-info">Sélection de la gamme produit</h5>
<?php require "./TypeProjet/Produit/".$_SESSION['BASE'].".php"; ?>
</div>
<!-- FORMULAIRE DE CREATION DUN PRODUIT SELON LA FAMILLE... OOO_OO_X exemple si PAC_AE_M Fichier PAC_AE_M dans dossier produit-->
<?php if((isset($_GET['Choisir']))&&(isset($_GET['Famille']))&&($_SESSION['Gamme']!="0")){?>
<?php require "./TypeProjet/Produit/".$_SESSION['Famille'].".php"; ?>
<?php } ?>
<?php } ?>
<!-- LISTE DES DERNIERS PRODUITS AJOUTES-->
<div class="container1">
<h5 class="btn-lg btn-info">(5) Derniers produits ajoutés</h5>
<?php $list1 = $dbco->prepare("SELECT * FROM ".$table_gamme." G JOIN ".$table_ensemble." E ON E.ID_gamme=G.ID_Gamme JOIN ".$table_jointure." J ON J.ID_ens=E.ID_Ens JOIN ".$table_produits." P ON P.ID_Produit=J.ID_produit GROUP BY P.ID_Produit"); $list1->execute(); ?>
<div class="table-responsive">
<div style="overflow-x: hidden; overflow-y: scroll; width: 100%; height: 100%;">
<br>
<table class='table table-hover table-bordered table-condensed'>
<thead>
<tr>
<th>ID</th>
<th>Gamme</th>
<th>Type</th>
<th>Reference</th>
<th>Fabricant</th>
<th>Modele</th>
<th>Prix</th>
<th>ACTION</th>
</tr>
</thead>
<?php while ($R1 = $list1->fetch(PDO::FETCH_OBJ)) { ?>
<tr>
<td><?php echo $R1->ID_Produit; ?></td>
<td><?php echo $R1->gamme_Nom; ?></td>
<td><?php echo $R1->Emp; ?></td>
<td><?php echo $R1->Ref; ?></td>
<td><?php echo $R1->Fabricant; ?></td>
<td><?php echo $R1->modele; ?></td>
<td><?php echo $R1->pv; ?></td>
<td></td>
</tr>
<?php } ?>
<tr></tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>