Your IP : 216.73.216.65


Current Path : /home/ataenra/www/ATA/INTRANET/Tech/
Upload File :
Current File : /home/ataenra/www/ATA/INTRANET/Tech/calculFgaz.php

<?php 

//Numero de la fiche
$d1 = Date('Y');
$d2 = Date('d-m-Y');

$NumFiche = "".$d1."/C".$ID."/O".$R1->EQ."/";

//Detendeur de l'installation
$nomD = "".$R1->nom." ".$R1->prenom.""; 
$adresseD = "".$R1->rueC." ".$R1->CodePC." ".$R1->VilleC."";
$SiretD = "0";
if(isset($_POST['SiretD'])){$SiretD = $_POST['SiretD'];}

//NumCapacite 
$NumCapacite = "SQ01933-001";   

//Equipement
$Equipement = "".$R2->Marque." ".$R2->modele."";

//Fluide
if(isset($_POST['FLUIDE'])){$Fluide = $_POST['FLUIDE'];}else{$Fluide = $R2->GAZ;}

//Intervention
if(isset($_POST['INTERV'])){$Interv = $_POST['INTERV'];}else{$Interv = $R2->GAZ;}

//Identifiant Detecteur fuite
if(isset($_POST['DETECT'])){$IdetectF = $_POST['DETECT'];}else{$IdetectF = $R3->ref;}
$DControle = $R3->Dcontrol;

//Fuite sur installation
$PDfuite = "Non";
$Cfuites = "Non";
$Rfuites = "0"; //AJOUTER REPARATION FUITE POUR DEPANNEURS

//Quantite FLUDIE SELON INTERVENTION
if(isset($_POST['CHARGEI'])){$QuantiteI = $_POST['CHARGEI'];}
$QA = "0";
if(isset($_POST['CHARGEADD'])){$QA = $_POST['CHARGEADD'];}
$QB = "0";
$QC = "0";
$QD = "0";
$QE = "0";


$Trackdechets = "0";
$IDrecup = "0";
$DechetsA = "0";
$DechetsB = "0";
$InstallDesti = "0";


//OBSERVATIONS

$Observations = "0";
if(isset($_POST['OBSERVATIONS'])){$Observations = $_POST['OBSERVATIONS'];}

$OPnom = $R4->Nom;

$OPqualite = "Technicien";
$DateA = $d2;


if($QA!= "0"){$ChargeT = $QuantiteI+$QA;}else{$ChargeT = $QuantiteI;}

if($Fluide == "R-32"){
    $PRG = 0.675; $TCo2 = $ChargeT*$PRG;
if($TCo2 <5){$Quantite = "0";}elseif(($TCo2 >5 )&&($TCo2 <50)){$Quantite = "5";}else{$Quantite = "50";}
}
if($Fluide == "R-410A"){
    $PRG = 2.087; $TCo2 = $ChargeT*$PRG;
if($TCo2 <5){$Quantite = "0";}elseif(($TCo2 >5 )&&($TCo2 <50)){$Quantite = "5";}else{$Quantite = "50";}
}
if($Fluide == "R-290"){
    $PRG = 0.003; $TCo2 = $ChargeT*$PRG;
if($TCo2 <5){$Quantite = "0";}elseif(($TCo2 >5 )&&($TCo2 <50)){$Quantite = "5";}else{$Quantite = "50";}
}

$sth = $dbco->prepare("INSERT INTO fgaz (NumFiche, nomD, adresseD, NumCapacite, Equipement, Fluide, ChargeT, TCo2, Interv, IdetectF, DControle, PDfuite, Quantite, Cfuites, Rfuites, QuantiteI, QA, QB, QC, QD, QE, Trackdechets, IDrecup, DechetsA, DechetsB, InstallDesti, Observations, OPnom, OPqualite, DateA) 
VALUES (:NumFiche, :nomD, :adresseD, :NumCapacite, :Equipement, :Fluide, :ChargeT, :TCo2, :Interv, :IdetectF, :DControle, :PDfuite, :Quantite, :Cfuites, :Rfuites, :QuantiteI, :QA, :QB, :QC, :QD, :QE, :Trackdechets, :IDrecup, :DechetsA, :DechetsB, :InstallDesti, :Observations, :OPnom, :OPqualite, :DateA)");

$sth->bindParam(':NumFiche',$NumFiche);
$sth->bindParam(':nomD',$nomD);
$sth->bindParam(':adresseD',$adresseD);
$sth->bindParam(':NumCapacite',$NumCapacite);
$sth->bindParam(':Equipement',$Equipement);
$sth->bindParam(':Fluide',$Fluide);
$sth->bindParam(':ChargeT',$ChargeT);
$sth->bindParam(':TCo2',$TCo2);
$sth->bindParam(':Interv',$Interv);
$sth->bindParam(':IdetectF',$IdetectF);
$sth->bindParam(':DControle',$DControle);
$sth->bindParam(':PDfuite',$PDfuite);
$sth->bindParam(':Quantite',$Quantite);
$sth->bindParam(':Cfuites',$Cfuites);
$sth->bindParam(':Rfuites',$Rfuites);
$sth->bindParam(':QuantiteI',$QuantiteI);
$sth->bindParam(':QA',$QA);
$sth->bindParam(':QB',$QB);
$sth->bindParam(':QC',$QC);
$sth->bindParam(':QD',$QD);
$sth->bindParam(':QE',$QE);
$sth->bindParam(':Trackdechets',$Trackdechets);
$sth->bindParam(':IDrecup',$IDrecup);
$sth->bindParam(':DechetsA',$DechetsA);
$sth->bindParam(':DechetsB',$DechetsB);
$sth->bindParam(':InstallDesti',$InstallDesti);
$sth->bindParam(':DechetsA',$DechetsA);
$sth->bindParam(':Observations',$Observations);
$sth->bindParam(':OPnom',$OPnom);
$sth->bindParam(':OPqualite',$OPqualite);
$sth->bindParam(':DateA',$DateA);
$sth->execute();
$lastid = $dbco->lastInsertId();  

$Update = $dbco->prepare('UPDATE '.$R1->tableprojet.' SET FGaz = :FGaz WHERE IDdossier = :ID'); 
    $Update->bindvalue('ID', $ID);
    $Update->bindvalue(':FGaz',$lastid);
    $Update->execute();

    
?>