| Current Path : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/ |
| Current File : /home/ataenra/www/ATA/INTRANET/Admin/Gestion_ACC/acc_config_sites_A.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>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBJK0GVBASHQUIFbE3NudYEWFtodD9bM_s&callback=initMap"></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>
<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>
<!--BOUTTONS POUR NEW SITE-->
<!--TABLEAU DES SITES D'AUTOCONSOMMATIONS-->
<div class="container1">
<div class="row" >
<div class="col-md-12">
<div id="map"></div>
<!--Emplacement des site-->
</div>
</div>
</div>
<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->Etat=="Complet") {echo '<a class="btn btn-info" href="acc_site_synthese.php?ID='.$R4->ID_acc_site.'&IDpmo='.$IDpmo.'">Voir</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=="Complet") {echo '<a class="btn btn-info" href="acc_site_synthese.php?ID='.$R2->ID_acc_site.'&IDpmo='.$IDpmo.'">Voir</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.'.csv'; $check = @fopen($files, 'r');?>
<?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>'; }?>
</td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
<?php
$list1 = $dbco->prepare("SELECT * FROM gest_acc_sites S JOIN gest_acc_pmo P ON S.ID_pmo=P.ID_pmo WHERE S.ID_pmo='$IDpmo'");
$list1->execute();
?>
<style>
* {
margin: 0;
padding: 0;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
.card {
background: white;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.header {
background: #2563eb;
color: white;
padding: 1rem;
}
.header h1 {
font-size: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.error-message {
margin-top: 0.5rem;
background: #1d4ed8;
padding: 0.5rem;
border-radius: 0.25rem;
font-size: 0.875rem;
}
.content {
padding: 1rem;
display: grid;
grid-template-columns: 2fr 1fr;
gap: 1rem;
}
#map {
height: 500px;
border-radius: 0.5rem;
overflow: hidden;
}
.coordinates {
background: #f8fafc;
padding: 1rem;
border-radius: 0.5rem;
}
.coordinates h2 {
font-size: 1.25rem;
margin-bottom: 1rem;
color: #1e293b;
}
.coordinate-box {
background: white;
padding: 0.75rem;
border-radius: 0.375rem;
margin-bottom: 0.5rem;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.coordinate-box p:first-child {
color: #64748b;
font-size: 0.875rem;
margin-bottom: 0.25rem;
}
.coordinate-box p:last-child {
font-family: monospace;
font-size: 1.125rem;
}
@media (max-width: 1000px) {
.content {
grid-template-columns: 1fr;
}
}
</style>
<script>
var lat = 50.3479;
var lng = 3.2016;
const DEFAULT_LOCATION = { lat , lng };
let map, marker, latitude, longitude;
function initMap() {
// Fonction pour initialiser la carte avec une position
function createMap(position) {
map = new google.maps.Map(document.getElementById('map'), {
center: position,
zoom: 14.5,
styles: [{
featureType: "poi",
elementType: "labels",
stylers: [{ visibility: "off" }]
}]
});
// Créer le marqueur
marker = new google.maps.Marker({
position: position,
map: map,
animation: google.maps.Animation.DROP
});
<?php
$i=1;
while($R1 = $list1->fetch(PDO::FETCH_OBJ)){
echo"var oMarker = new google.maps.Marker({
position: new google.maps.LatLng(".$R1->latitude.", ".$R1->longitude."),
map: map
});
";
$i++;
}
?>
}
createMap(DEFAULT_LOCATION);
}
window.initMap = initMap;
</script>