présentaiton sous forme de tableau des consommation passé dans les rapports

This commit is contained in:
2020-06-17 14:48:18 +02:00
parent f944981109
commit 7edbdbd3e7
2 changed files with 60 additions and 35 deletions

View File

@@ -533,14 +533,14 @@ class ReportController extends AbstractController
->orderBy('event.start') ->orderBy('event.start')
->getQuery()->getResult(); ->getQuery()->getResult();
foreach($events as $event) { foreach($events as $event) {
if(!isset($tbproject["before"][$event->getStart()->format("Ym")])) { if(!isset($tbproject["before"][$event->getStart()->format("Y")][$event->getStart()->format("Ym")])) {
$tbproject["before"][$event->getStart()->format("Ym")] = [ $tbproject["before"][$event->getStart()->format("Y")][$event->getStart()->format("Ym")] = [
"idmonth" => $event->getStart()->format("Ym"), "idmonth" => $event->getStart()->format("Ym"),
"monthlabel"=>$event->getStart()->format("m/Y"), "monthlabel"=>$event->getStart()->format("m/Y"),
"duration" => 0, "duration" => 0,
]; ];
} }
$tbproject["before"][$event->getStart()->format("Ym")]["duration"]=$tbproject["before"][$event->getStart()->format("Ym")]["duration"]+$event->getDuration(); $tbproject["before"][$event->getStart()->format("Y")][$event->getStart()->format("Ym")]["duration"]=$tbproject["before"][$event->getStart()->format("Y")][$event->getStart()->format("Ym")]["duration"]+$event->getDuration();
} }
// Somme astreinte validé avant la date // Somme astreinte validé avant la date
@@ -561,14 +561,14 @@ class ReportController extends AbstractController
->orderBy('penalty.start') ->orderBy('penalty.start')
->getQuery()->getResult(); ->getQuery()->getResult();
foreach($penaltys as $penalty) { foreach($penaltys as $penalty) {
if(!isset($tbproject["beforeastreinte"][$penalty->getStart()->format("Ym")])) { if(!isset($tbproject["beforeastreinte"][$penalty->getStart()->format("Y")][$penalty->getStart()->format("Ym")])) {
$tbproject["beforeastreinte"][$penalty->getStart()->format("Ym")] = [ $tbproject["beforeastreinte"][$penalty->getStart()->format("Y")][$penalty->getStart()->format("Ym")] = [
"idmonth" => $penalty->getStart()->format("Ym"), "idmonth" => $penalty->getStart()->format("Ym"),
"monthlabel"=>$penalty->getStart()->format("m/Y"), "monthlabel"=>$penalty->getStart()->format("m/Y"),
"duration" => 0, "duration" => 0,
]; ];
} }
$tbproject["beforeastreinte"][$penalty->getStart()->format("Ym")]["duration"]=$tbproject["beforeastreinte"][$penalty->getStart()->format("Ym")]["duration"]+$penalty->getDuration(); $tbproject["beforeastreinte"][$penalty->getStart()->format("Y")][$penalty->getStart()->format("Ym")]["duration"]=$tbproject["beforeastreinte"][$penalty->getStart()->format("Y")][$penalty->getStart()->format("Ym")]["duration"]+$penalty->getDuration();
} }
// Recap des Commandes // Recap des Commandes
@@ -670,7 +670,6 @@ class ReportController extends AbstractController
} }
$tbprojects[$project->getId()]=$tbproject; $tbprojects[$project->getId()]=$tbproject;
} }
// Formater les utilisateurs // Formater les utilisateurs
$start=new \Datetime('first day of this month'); $start=new \Datetime('first day of this month');
$start->sub(new \DateInterval('P'.$nbmonth.'M')); $start->sub(new \DateInterval('P'.$nbmonth.'M'));

View File

@@ -125,39 +125,65 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<h4>RAPPORT</h4> <h3>RAPPORT</h3>
<div class="small"> <div class="small">
<h4>CONSOMMATION PASSEE</h4>
{% if project.hors!=0 %} {% if project.hors!=0 %}
consommé avant = {{ project.hors }}<br> Consommation précédente totale = {{ project.hors }}<br>
{% endif %} {% endif %}
{% set bycolonne = max(10,((project.before|length)/3)|round) %} <table>
{% for year in project.before %}
<tr class="text-center">
<td class="text-center">
Date
</td>
{% for month in year %}
<td class="text-center">
{{ month.monthlabel }}
</td>
{% endfor %}
</tr>
<tr class=" text-center">
<td class="text-center">
Consommé
</td>
{% for month in year %}
<td class="text-center">
{{ month.duration }}
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
{% set compteur = 0 %}
<div class="row">
<div class="col-md-4">
{% for month in project.before %}
{% set compteur = compteur + 1 %}
{% if compteur > bycolonne %}
</div>
<div class="col-md-4">
{% set compteur = 1 %}
{% endif %}
consommé le {{ month.monthlabel }} = {{ month.duration }}<br>
{% endfor %}
</div>
</div>
</div>
{% if not project.beforeastreinte is empty %} {% if not project.beforeastreinte is empty %}
<h4>ASTREINTE</h4> <h4>ASTREINTES</h4>
{% set compteur = 0 %} <table>
<div class="small"> {% for year in project.before %}
{% for month in project.beforeastreinte %} <tr class="text-center">
consommé le {{ month.monthlabel }} = {{ month.duration }}<br> <td class="text-center">
Date
</td>
{% for month in year %}
<td class="text-center">
{{ month.monthlabel }}
</td>
{% endfor %}
</tr>
<tr class=" text-center">
<td class="text-center">
Consommé
</td>
{% for month in year %}
<td class="text-center">
{{ month.duration }}
</td>
{% endfor %}
</tr>
{% endfor %} {% endfor %}
</div> </table>
{% endif %} {% endif %}
<div class="new-page">&nbsp;</div> <div class="new-page">&nbsp;</div>