Your IP : 216.73.216.212


Current Path : /home/a/t/a/ataenra/www/ATA/INTRANET/Admin/Gestion_Materiel/TypeProjet/Ensemble/
Upload File :
Current File : /home/a/t/a/ataenra/www/ATA/INTRANET/Admin/Gestion_Materiel/TypeProjet/Ensemble/AddA.php

<?php

//trouver le prix du materiel ajouté et multiplier par quantité
$art = $dbco->prepare("SELECT PV FROM gest_articles WHERE ID_Article = '".$_GET['IDa']."' "); $art->execute(); $Art = $art->fetch(PDO::FETCH_OBJ);   
$pv_tarif = $_GET['QT']*$Art->PV;

//Ajoutuer dans la table jointure Materiel_access
$Add = $dbco->prepare("INSERT INTO ".$table_jointure_access." (ID_ens, ID_article, QT_articles, PV_articles) VALUES (:ID_ens, :ID_article, :QT_articles, :PV_articles)");
$Add->bindParam(':ID_ens',$_GET['IDmat']);
$Add->bindParam(':ID_article',$_GET['IDa']);
$Add->bindParam(':QT_articles',$_GET['QT']);
$Add->bindParam(':PV_articles',$pv_tarif);
$Add->execute();

//on calcul le prix de l'ensemble materiel
$pt = $dbco->query("SELECT SUM(PV_p) AS T FROM ".$table_jointure." WHERE ID_ens ='".$_GET['IDmat']."'");
$PT = $pt->fetch();
$pt->closeCursor();
$P1= round($PT['T'], 2); 

//on calcul le prix de l'ensemble materiel
$pt = $dbco->query("SELECT SUM(PV_articles) AS T FROM ".$table_jointure_access." WHERE ID_ens ='".$_GET['IDmat']."'");
$PT = $pt->fetch();
$pt->closeCursor();
$P2= round($PT['T'], 2); 

$PTT = $P1+$P2;
//on met a jour le prix du pack  
$UP2 = $dbco->prepare("UPDATE $table_ensemble set ID_Ens = :id, ens_pv=:ens_pv where ID_Ens = :id");
$UP2->bindvalue('id',$_GET['IDmat']);
$UP2->bindvalue('ens_pv',$PTT);
$UP2->execute();

header("location:New_Ensemble.php?IDm=".$_GET['IDm']."&A=V");

?>