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,16 +533,16 @@ class ReportController extends AbstractController
->orderBy('event.start')
->getQuery()->getResult();
foreach($events as $event) {
if(!isset($tbproject["before"][$event->getStart()->format("Ym")])) {
$tbproject["before"][$event->getStart()->format("Ym")] = [
if(!isset($tbproject["before"][$event->getStart()->format("Y")][$event->getStart()->format("Ym")])) {
$tbproject["before"][$event->getStart()->format("Y")][$event->getStart()->format("Ym")] = [
"idmonth" => $event->getStart()->format("Ym"),
"monthlabel"=>$event->getStart()->format("m/Y"),
"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
$end=new \Datetime('first day of this month');
$end->sub(new \DateInterval('P'.$nbmonth.'M'));
@@ -561,14 +561,14 @@ class ReportController extends AbstractController
->orderBy('penalty.start')
->getQuery()->getResult();
foreach($penaltys as $penalty) {
if(!isset($tbproject["beforeastreinte"][$penalty->getStart()->format("Ym")])) {
$tbproject["beforeastreinte"][$penalty->getStart()->format("Ym")] = [
if(!isset($tbproject["beforeastreinte"][$penalty->getStart()->format("Y")][$penalty->getStart()->format("Ym")])) {
$tbproject["beforeastreinte"][$penalty->getStart()->format("Y")][$penalty->getStart()->format("Ym")] = [
"idmonth" => $penalty->getStart()->format("Ym"),
"monthlabel"=>$penalty->getStart()->format("m/Y"),
"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
@@ -670,7 +670,6 @@ class ReportController extends AbstractController
}
$tbprojects[$project->getId()]=$tbproject;
}
// Formater les utilisateurs
$start=new \Datetime('first day of this month');
$start->sub(new \DateInterval('P'.$nbmonth.'M'));

View File

@@ -125,39 +125,65 @@
</div>
<div class="card-body">
<h4>RAPPORT</h4>
<h3>RAPPORT</h3>
<div class="small">
<h4>CONSOMMATION PASSEE</h4>
{% if project.hors!=0 %}
consommé avant = {{ project.hors }}<br>
Consommation précédente totale = {{ project.hors }}<br>
{% endif %}
{% set bycolonne = max(10,((project.before|length)/3)|round) %}
{% set compteur = 0 %}
<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>
<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 %}
<h4>ASTREINTE</h4>
{% set compteur = 0 %}
<div class="small">
{% for month in project.beforeastreinte %}
consommé le {{ month.monthlabel }} = {{ month.duration }}<br>
<h4>ASTREINTES</h4>
<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 %}
</div>
</table>
{% endif %}
<div class="new-page">&nbsp;</div>