| Current Path : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/acc_config_sites.php |
<?php
require "../../Outils/co.php";
$IDpmo=$_GET['IDpmo'];
if(isset($_POST['year'])){
$_SESSION['year']=$_POST['year'];
}else{
$Today = date('Y');
$year = $Today-1;
$_SESSION['year']=$year;
}
$UP6 = $dbco->prepare('UPDATE gest_acc_pmo SET pmo_simul = :pmo_simul WHERE ID_pmo = :ID_pmo');
$UP6->bindvalue('pmo_simul',0);
$UP6->bindvalue('ID_pmo',$IDpmo);
$UP6->execute();
//RECUP DES INFORMATIONS SUR TABLE ACC PMO
//Tableau de tous les projets en cours
$list1 = $dbco->prepare("SELECT * FROM gest_acc_pmo WHERE ID_pmo='$IDpmo'");
$list1->execute();
$R1 = $list1->fetch(PDO::FETCH_OBJ);
$list2 = $dbco->prepare("SELECT * FROM gest_acc_pmo A JOIN gest_acc_sites S ON A.ID_pmo=S.ID_pmo WHERE A.ID_pmo='$IDpmo' AND S.site_type = 'Conso' ");
$list2->execute();
$list3 = $dbco->prepare("SELECT * FROM gest_acc_pmo A JOIN gest_acc_sites S ON A.ID_pmo=S.ID_pmo WHERE A.ID_pmo='$IDpmo' AND S.site_type = 'Prod' ");
$list3->execute();
$list4 = $dbco->prepare("SELECT * FROM gest_acc_pmo A JOIN gest_acc_sites S ON A.ID_pmo=S.ID_pmo WHERE A.ID_pmo='$IDpmo' AND S.site_type ='AutoConso' ");
$list4->execute();
$req = $dbco->query("SELECT COUNT(*) as Nbconso FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND site_type ='Conso'");
$nbconso = $req->fetch();
$req->closeCursor();
$req = $dbco->query("SELECT COUNT(*) as Nbprod FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND site_type ='Prod'");
$nbprod = $req->fetch();
$req->closeCursor();
$req = $dbco->query("SELECT COUNT(*) as Nbautoconso FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND site_type ='AutoConso'");
$nbautoconso = $req->fetch();
$req->closeCursor();
$req1 = $dbco->query("SELECT SUM(Consos) AS Consos_total FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND site_type ='AutoConso'");
$totalconsos = $req1->fetch();
$req1->closeCursor();
$req1 = $dbco->query("SELECT SUM(Prods) AS Prods_total FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND etat = 'Complet' AND site_type ='AutoConso'");
$totalprods = $req1->fetch();
$req1->closeCursor();
$req1 = $dbco->query("SELECT SUM(AutoConso) AS AutoConso_total FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND etat = 'Complet' AND site_type ='AutoConso'");
$totalautoconso = $req1->fetch();
$req1->closeCursor();
$req1 = $dbco->query("SELECT SUM(Injection) AS Injection_total FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND etat = 'Complet' AND site_type ='AutoConso'");
$totalinjection = $req1->fetch();
$req1->closeCursor();
$req1 = $dbco->query("SELECT SUM(Consos) AS Consos_total FROM gest_acc_sites WHERE ID_pmo = '$IDpmo' AND site_type IN ('Prod','Conso')");
$totalconsos2 = $req1->fetch();
$req1->closeCursor();
?>
<!-- DOCUMENT HTML A AFFICHER-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>GESTION PROJETS</title>
<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="../css/agcom.css" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<form method="post" autocomplete="off">
<div class="containerPage">
<div class="containerTitre">
<div class="row" >
<div class="col-md-2">
<img src="../../Outils/required/ATA_logo_horiz.jpg" alt="ISO" width=120% class="img-responsive" />
</div>
<div class="col-md-8">
<span class="align-middle"><?php echo $R1->Pmo_Nom; ?></span>
<div>
<span><?php if($R1->pmo_simul=="0") {echo '<a class="btn-lg btn-info" href="acc_simul_bdd_sites.php?IDpmo='.$IDpmo.'">SIMULER LE PROJET</a>'; }?></span>
</div>
</div>
<div class="col-md-2">
<a href="acc_config.php?IDpmo=<?php echo $IDpmo; ?>" title="">
<img alt="HOME" style="float:right;" src="../../Outils/required/home1.png" alt="ISO" width=30% class="img-responsive"/> </a>
</div>
</div>
</div>
</form>
<?php
if(isset($_POST['NSCE'])){ require 'CC/UpPointConso.php'; header("location:../Gestion_ACC/acc_config_sites.php?IDpmo=$IDpmo");}
if(isset($_POST['NSPE'])){ require 'PV/UpPointProd.php'; header("location:../Gestion_ACC/acc_config_sites.php?IDpmo=$IDpmo");}
if(isset($_POST['NSPEAC'])){ require 'PV/UpPointProdac.php'; header("location:../Gestion_ACC/acc_config_sites.php?IDpmo=$IDpmo");}
if(isset($_POST['NSPAC'])){ require 'AC/UpPointAutoConso.php'; header("location:../Gestion_ACC/acc_config_sites.php?IDpmo=$IDpmo");}
if(isset($_POST['NSC'])){ require 'CC/NewPointConso.php';}
if(isset($_POST['NSP'])){ require 'PV/NewPointProd.php';}
if(isset($_POST['NSAC'])){ require 'AC/NewPointAutoConso.php';}
if(isset($_GET['ACPV'])){ require 'PV/NewPointProdac.php'; $IDsite=$_GET['IDsite'];}
?>
<!--BOUTTONS POUR NEW SITE-->
<div class="container1">
<div class="row" >
<div class="col-md-12">
<div class="col-md-4">
<input class="btn-lg btn-info" type="Submit" name="NSAC" value="Nouveau Site d'AUTOCONSOMATION" />
</div>
<div class="col-md-4">
<input class="btn-lg btn-warning" type="Submit" name="NSC" value="Nouveau Site de CONSOMMATION" />
</div>
<div class="col-md-4">
<input class="btn-lg btn-success" type="Submit" name="NSP" value="Nouveau Site de PRODUCTION" />
</div>
</div>
</div>
</div>
<!--TABLEAU DES SITES D'AUTOCONSOMMATIONS-->
<div class="container1">
<div class="row" >
<div class="col-md-12">
<div class="table-responsive">
<h5 class="btn-lg btn-info">SITE D'AUTOCONSOMMATIONS</h5>
<table class="table table-condensed" border="0">
<thead>
<tr>
<th>NOM</th>
<th>CONSO (kwh)</th>
<th>PROD (kwh)</th>
<th>AUTOCONSO (kwh)</th>
<th>INJECTION (kwh)</th>
<th>Taux AutoConso </th>
<th>Taux AutoProd</th>
<th>Revente EDF</th>
<th>Eco Annuelle</th>
<th>ROI en ACI</th>
<th>ROI en ACC</th>
<th>ACTION</th> <!--A realiser / +info dans preparation / si validation => "Préparé le DATE" / passe Etat en :"A planifier"-->
</tr>
</thead>
<tbody>
<?php while ($R4 = $list4->fetch(PDO::FETCH_OBJ)) { ?>
<!--recuperer les infos dans la table du projet avec son nom et l'ID stocké dans dossier-->
<tr>
<td><?php echo $R4->Nom; ?></td>
<td><?php echo $R4->Consos; ?></td>
<td><?php echo $R4->Prods; ?></td>
<td><?php echo "".round($R4->AutoConso).""; ?></td>
<td><?php echo "".round($R4->Injection).""; ?></td>
<td><?php echo "".round($R4->TAC)." %"; ?></td>
<td><?php echo "".round($R4->TAP)." %"; ?></td>
<?php if(isset($R4->Injection)){$Inj = $R4->Injection;}else{$Inj = 0;}
if(isset($R4->PV_install)){$pvinstall = $R4->PV_install;}else{$pvinstall = 0;}
?>
<td><?php if($R4->pcentrale < 18 ){$mainkw = 30;}elseif(($R4->pcentrale >18)&&($R4->pcentrale <36)){$mainkw = 25;}elseif($R4->pcentrale >36){$mainkw = 20;}
$coutmaint = $R4->pcentrale * $mainkw;
$ac = round($Inj*$R4->site_pvinj);
echo "".$ac." euros"; ?></td>
<td><?php $eco = round($R4->AutoConso*$R4->site_pac)+$ac;
echo "".$eco." euros" ; ?></td>
<td><?php if($eco != 0 ){$roi = round(($pvinstall-$R4->site_prime+$coutmaint)/$eco); echo "".$roi." Ans"; }?></td>
<td><?php $ac1 = round($Inj*$R4->site_pac);
$turpe = 190;
$eco1 = round($R4->AutoConso*$R4->site_pac)+$ac1-$turpe;
if($eco != 0 ){$roi1 = round(($pvinstall-$R4->site_prime+$coutmaint)/$eco1);echo "".$roi1." Ans"; }?></td>
<td>
<?php $files = '../../../FICHIERS/ACC/'.$R4->ID_pmo.'/Sites/'.$R4->ID_acc_site.'/CC/CC.'.$R4->ID_acc_site.'.csv'; $check = @fopen($files, 'r');?>
<?php $files2 = '../../../FICHIERS/ACC/Temp/CP.'.$R4->ID_acc_site.'.csv'; $check2 = @fopen($files, 'r');?>
<?php if(($R4->CC=="Oui") && ($R4->Etat!="Complet") && ($check) && ($check2)) {echo '<a class="btn btn-warning" href="AC/toac.php?ID='.$R4->ID_acc_site.'&type=AC&IDpmo='.$IDpmo.'">Calculer</a>'; }?>
<?php if($R4->Etat=="Complet") {echo '<a class="btn btn-info" href="acc_site_synthese.php?ID='.$R4->ID_acc_site.'&IDpmo='.$IDpmo.'">Voir</a>'; }?>
<?php echo '<a class="btn btn-danger" href="acc_site_del.php?ID='.$R4->ID_acc_site.'">Supprimer</a>'; ?>
</td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
<!--TABLEAU DES SITES DE CONSOMMATIONS-->
<div class="container1">
<div class="row" >
<div class="col-md-12">
<div class="table-responsive">
<h5 class="btn-lg btn-warning">SITE DE CONSOMMATIONS</h5>
<table class="table table-condensed" border="0">
<thead>
<tr>
<th>NOM</th>
<th>CONSOMMATIONS en kwh</th>
<th>Prix achat kwh</th>
<th>Cout Annuel</th>
<th>ETAT</th>
<th>ACTION</th> <!--A realiser / +info dans preparation / si validation => "Préparé le DATE" / passe Etat en :"A planifier"-->
</tr>
</thead>
<tbody>
<?php while ($R2 = $list2->fetch(PDO::FETCH_OBJ)) { ?>
<!--recuperer les infos dans la table du projet avec son nom et l'ID stocké dans dossier-->
<tr>
<td><?php echo $R2->Nom; ?></td>
<td><?php echo $R2->Consos; ?></td>
<td><?php echo "".$R2->site_pac." euros/kwh"; ?></td>
<td><?php echo "".$R2->site_pac*$R2->Consos." euros"; ?></td>
<td><?php echo $R2->Etat; ?></td>
<td>
<?php $files = '../../../FICHIERS/ACC/'.$R2->ID_pmo.'/Sites/'.$R2->ID_acc_site.'/CC/CC.'.$R2->ID_acc_site.'.csv'; $check = @fopen($files, 'r');?>
<?php if(($R2->Etat=="Incomplet") && ($check)) {echo '<a class="btn btn-warning" href="CSVCC.php?ID='.$R2->ID_acc_site.'&Site='.$R2->Nom.'&IDpmo='.$IDpmo.'">Calculer</a>'; }?>
<?php if($R2->Etat=="Incomplet") {echo '<a class="btn btn-warning" href="acc_site_config.php?IDpmo='.$R2->ID_acc_site.'">Modifier</a>'; }?>
<?php if($R2->Etat=="Complet") {echo '<a class="btn btn-info" href="acc_site_synthese.php?ID='.$R2->ID_acc_site.'&IDpmo='.$IDpmo.'">Voir</a>'; }?>
<?php if(($R2->Etat=="Complet")&&($R2->site_type=='Conso')){
echo '<a class="btn btn-success" href="acc_config_sites.php?IDsite='.$R2->ID_acc_site.'&IDpmo='.$IDpmo.'&ACPV=Oui">Ajouter une centrale PV</a>';
}?>
<?php echo '<a class="btn btn-danger" href="acc_site_del.php?ID='.$R2->ID_acc_site.'">Supprimer</a>'; ?>
</td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
<!--TABLEAU DES SITES DE PRODUCTION-->
<div class="container1">
<div class="row" >
<div class="col-md-12">
<div class="table-responsive">
<h5 class="btn-lg btn-success">SITE DE PRODUCTIONS</h5>
<table class="table table-condensed" border="0">
<thead>
<tr>
<th>NOM</th>
<th>PRODUCTION en kwh</th>
<th>ETAT</th>
<th>ACTION</th> <!--A realiser / +info dans preparation / si validation => "Préparé le DATE" / passe Etat en :"A planifier"-->
</tr>
</thead>
<tbody>
<?php while ($R3 = $list3->fetch(PDO::FETCH_OBJ)) { ?>
<!--recuperer les infos dans la table du projet avec son nom et l'ID stocké dans dossier-->
<tr>
<td><?php echo $R3->Nom; ?></td>
<td><?php echo $R3->Prods; ?></td>
<td><?php echo $R3->Etat; ?></td>
<td>
<?php $files = '../../../FICHIERS/ACC/Temp/CP.'.$R3->ID_acc_site.'.1.csv'; $check = @fopen($files, 'r');?>
<?php if(($R3->Etat=="Incomplet") && ($check)) {echo '<a class="btn btn-danger" href="CSVCP.php?ID='.$R3->ID_acc_site.'&Site='.$R3->Nom.'">Calculer</a>'; }?>
<?php if($R3->Etat=="Incomplet") {echo '<a class="btn btn-warning" href="acc_site_config.php?ID='.$R3->ID_acc_site.'">Modifier</a>'; }?>
<?php if($R3->Etat=="Complet") {echo '<a class="btn btn-info" href="acc_site_synthese.php?ID='.$R3->ID_acc_site.'&IDpmo='.$IDpmo.'"">Voir</a>'; }?>
<?php echo '<a class="btn btn-danger" href="acc_site_del.php?ID='.$R3->ID_acc_site.'">Supprimer</a>'; ?>
</td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
<?php
?>
<script>
const ctx = document.getElementById('myChart');
new Chart(ctx, {
data: {
datasets: [{
type: 'bar',
label: 'Conso par jours',
data: <?php echo json_encode($pco); ?>,
}, {
type: 'bar',
label: 'Prod par jours',
data: <?php echo json_encode($pco2); ?>,
},
],
labels: <?php echo json_encode($jour);?>
},
options: {
scales: {
y: {
beginAtZero: true
}
}
plugins: {
legend: {
display: true,
position: 'right'
}
}
}
});
</script>
<script>
new Chart(document.getElementById("doughnutChartID"), {
type: 'doughnut',
data: {
datasets: [{
data: [<?php echo "".$nbprod['Nbprod'].", ".$nbautoconso['Nbautoconso'].", ".$nbconso['Nbconso'].""; ?>],
backgroundColor: ['rgb(99, 255, 151)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'],
}],
labels: ['Production', 'Autoconso', 'Consommation'],
},
options: {
plugins: {
legend: {
display: true,
position: 'right'
}
}
}
});
</script>
<script>
new Chart(document.getElementById("doughnutChartID1"), {
type: 'doughnut',
data: {
datasets: [{
data: [<?php echo "".$totalconsos['Consos_total'].", ".round($totalautoconso['AutoConso_total']).", ".$totalprods['Prods_total'].", ".round($totalinjection['Injection_total']).""; ?>],
backgroundColor: ['rgb(241, 74, 74)',
'rgb(54, 162, 235)',
'rgb(99, 255, 151)',
'rgb(255, 205, 86)'],
}],
labels: ['Consommations kwh', 'AutoConso kwh', 'Production kwh', 'Energie restante kwh'],
},
options: {
plugins: {
legend: {
display: true,
position: 'right'
}
}
}
});
</script>
<script>
new Chart(document.getElementById("doughnutChartID2"), {
type: 'doughnut',
data: {
datasets: [{
data: [<?php echo "".$totalconsos2['Consos_total'].", ".$totalprods['Prods_total'].", ".round($totalautoconso['AutoConso_total']).", ".round($totalinjection['Injection_total']).""; ?>],
backgroundColor: ['rgb(241, 74, 74)',
'rgb(99, 255, 151)',
'rgb(54, 162, 235)',
'rgb(255, 205, 86)'],
}],
labels: ['Consommations kwh', 'Production kwh', 'AutoConsommation', 'Injection'],
},
options: {
plugins: {
legend: {
display: true,
position: 'right'
}
}
}
});
</script>