Files
schedule/templates/Report/report.html.twig
2025-09-30 21:24:37 +02:00

392 lines
16 KiB
Twig

{% extends "base.html.twig" %}
{% block localstyle %}
.card {
margin: 20px 20px 0px 0px;
}
.card-body .month {
margin: 20px 0px 0px 0px;
}
.card-body .month:first-child {
margin: 0px;
}
.card-header h2 {
float:left;
}
.card-header .synthese {
float:right;
font-size:12px;
text-align: right;
}
.card-body h4 { margin: 20px 0px 0px 0px;}
.card-body h4:first-child { margin: 0px;}
th,td, tfoot {
border: 1px solid #37474F;
color: #000000;
background-color:#cccccc;
}
.recaptask td, .recapoffer td {
background-color:#ffffff;
color: #212529;
padding: 3px;
}
.recaptask tfoot td, .recapoffer thead td, .recapoffer tfoot td {
background-color:#cccccc;
font-weight: bold;
}
.intervenant {
width:200px;
padding-left:5px;
}
.total {
text-align:center;
width:70px;
background-color:#888888;
}
.day {
text-align:center;
width: 40px;
height:40px;
}
.astreinte {
height: 12px;
font-size: 10px;
}
{% if fgprint is defined and fgprint %}
h2, h3 {
display:block !important;
float:none !important;
margin:0px;
}
table { width:100%; font-size:10px;}
.card-header .synthese {
float:none !important;
text-align:left !important;
}
.day {
height:auto !important;
}
.small { font-size:10px;}
h4 {
padding-top: 20px;
}
{% endif %}
{% endblock %}
{% block body %}
{% if fgprint is defined and fgprint %}<h1>Planning</h1>{%endif%}
{% if access=="customer" and not app.user %}
<div class="no-print" style="margin-top:10px;">
<style> .select2-container { display:inline-block} </style>
<a class="btn btn-success" href="{{ path("app_customer_report",{"key":key})}}">Rapport</a>
<a class="btn btn-info" href="{{ path("app_customer_planning",{"key":key})}}">Planning</a>
&nbsp;&nbsp;Nombre de mois
<select class="form-control select2entity" id="sidemonth" name="sidemonth" style="width:auto; display:inline-block">
{% set selected="" %}
{% for i in 1..48 %}
{% set selected="" %}
{%if i==app.session.get('nbmonth') %}
{% set selected="selected" %}
{% endif %}
<option value="{{i}}" {{selected}}>{{i}}</option>
{% endfor %}
</select>
</div>
{% endif %}
{% for project in projects %}
{% if not project.months is empty or project.hors!=0 or not project.before is empty or not project.beforeastreinte is empty %}
<div class="card">
<div class="card-header">
<h2>{{ project.displayname }}</h2>
<div class="synthese">
Commandé = {{ project.proposed|number_format(2, '.', ' ') }}<br>
Consommé = {{ project.validate|number_format(2, '.', ' ') }}<br>
<b>RESTE = {{ (project.proposed - project.validate)|number_format(2, '.', ' ') }}</b>
</div>
</div>
<div class="card-body">
<h3>RAPPORT</h3>
<div class="small">
{% for month in project.months %}
<h3 class="month">{{ month.monthlabel }}</h3>
<table>
<thead>
<th class="intervenant">Intervenant</th>
{% for day in month.days %}
<th class="day" style="background-color: {{ day.daycolor }}">
{{ day.daylabel }}<br>
{{ day.daynumber }}
</th>
{% endfor %}
<th class="total">Total</th>
</thead>
{% for user in month.users %}
<tr>
<td class="intervenant">{{ user.displayname }}</td>
{% for day in user.days %}
<td class="day" style="background-color: {{ day.daycolor }}">
{% if day.duration > 0 %}
{{ day.duration }}
{% endif %}
{% if day.astreinte > 0 %}
<div class="astreinte">A</div>
{% endif %}
</td>
{% endfor %}
<td class="total">{{user.total}}</td>
</tr>
{% endfor %}
</table>
{% if month.total > 0 %}
<br>
<table class="recaptask small">
{% for task in month.tasks %}
<tr>
<td>{{ task.displayname }}</td>
<td class="text-right">{{ task.duration|number_format(2, '.', ' ') }}</td>
</tr>
{% endfor %}
{% if month.totala > 0 %}
<tr>
<td>Astreinte</td>
<td class="text-right">{{ month.totala|number_format(2, '.', ' ') }}</td>
</tr>
{% endif %}
<tfoot>
<tr>
<td style="min-width:200px">TOTAL</td>
<td class="text-right" style="min-width:100px">{{ (month.total + month.totala)|number_format(2, '.', ' ') }}</td>
</tr>
</tfoot>
</table>
{% endif %}
{% endfor %}
<h4>CUMUL HEBDOMADAIRE</h4>
<table>
{% for year, weeks in project.weeks %}
<thead>
<th class="text-center day">
{{ year}}
</th>
{% for week in weeks %}
<th class="text-center">
S{{ week.weeknumber}}
</th>
{% endfor %}
</thead>
<tr class="text-center">
<td class="text-center">
</td>
{% for week in weeks %}
<td class="text-center">
{{ week.cumul}}
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
{% if not project.offers is empty %}
<h4>COMMANDES</h4>
{% set count=(project.offers|length)-8 %}
{% set totbefore10=0 %}
{% set decoproposed=project.proposed %}
{% set decovalidate=project.validate %}
<table class="recapoffer small">
<thead>
<td width="200px">Libellé</td>
<td width="200px">Référence</td>
<td width="100px" class="text-center">Commandé</td>
<td width="100px" class="text-center">Consommé</td>
<td width="100px" class="text-center">Reste</td>
</thead>
{% set tot=0 %}
{% for offer in project.offers %}
{% if loop.index<count %}
{% set totbefore10=totbefore10+offer.quantity %}
{% if loop.index+1==count %}
<tr>
<td colspan="2">Précédente</td>
<td class="text-right">{{ totbefore10|number_format(2, '.', ' ') }}</td>
<td class="text-right">
{% if decovalidate >= totbefore10 %}
{{ totbefore10|number_format(2, '.', ' ') }}
{% set todel=totbefore10 %}
{% else %}
{% if decovalidate >= 0 %}
{{ decovalidate|number_format(2, '.', ' ') }}
{% set todel=decovalidate %}
{% else %}
0.00
{% set todel=0 %}
{% endif %}
{% endif %}
{% set decovalidate=decovalidate-totbefore10 %}
</td>
<td class="text-right">
{{ (totbefore10-todel)|number_format(2, '.', ' ') }}
{% set decoproposed=decoproposed-totbefore10 %}
</td>
</tr>
{% endif %}
{% else %}
{% if not loop.last %}
<tr>
<td>{{ offer.name }}</td>
<td>{{ offer.ref }}</td>
<td class="text-right">{{ offer.quantity|number_format(2, '.', ' ') }}</td>
<td class="text-right">
{% if decovalidate >= offer.quantity %}
{{ offer.quantity|number_format(2, '.', ' ') }}
{% set todel=offer.quantity %}
{% else %}
{% if decovalidate >= 0 %}
{{ decovalidate|number_format(2, '.', ' ') }}
{% set todel=decovalidate %}
{% else %}
0.00
{% set todel=0 %}
{% endif %}
{% endif %}
{% set decovalidate=decovalidate-offer.quantity %}
</td>
<td class="text-right">
{{ (offer.quantity-todel)|number_format(2, '.', ' ') }}
{% set decoproposed=decoproposed-totbefore10 %}
</td>
</tr>
{% else %}
<tr>
<td>{{ offer.name }}</td>
<td>{{ offer.ref }}</td>
<td class="text-right">{{ offer.quantity|number_format(2, '.', ' ') }}</td>
<td class="text-right">
{% if decovalidate >= 0 %}
{{ decovalidate|number_format(2, '.', ' ') }}
{% set todel=decovalidate %}
{% else %}
0.00
{% set todel=0 %}
{% endif %}
{% set decovalidate=decovalidate-offer.quantity %}
</td>
<td class="text-right">
{{ (offer.quantity-todel)|number_format(2, '.', ' ') }}
{% set decoproposed=decoproposed-totbefore10 %}
</td>
</tr>
{% endif %}
{% endif %}
{% endfor %}
<tfoot>
<td colspan="2">TOTAL</td>
<td class="text-right">{{ project.proposed|number_format(2, '.', ' ') }}</td>
<td class="text-right">{{ project.validate|number_format(2, '.', ' ') }}</td>
<td class="text-right">{{ (project.proposed - project.validate)|number_format(2, '.', ' ') }}</td>
</tfoot>
</table>
{% endif %}
<h4>CONSOMMATION PASSEE</h4>
{% if project.hors!=0 %}
Consommation précédente totale = {{ project.hors }}<br>
{% endif %}
<table>
{% for year in project.before %}
<thead>
<th class="text-center day">
Date
</th>
{% for month in year %}
<th class="text-center">
{{ month.monthlabel }}
</th>
{% endfor %}
</thead>
<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>
{% if not project.beforeastreinte is empty %}
<h4>ASTREINTES PASSEES</h4>
<table>
{% for year in project.beforeastreinte %}
<thead>
<th class="text-center day">
Date
</th>
{% for month in year %}
<th class="text-center">
{{ month.monthlabel }}
</th>
{% endfor %}
</thead>
<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>
{% endif %}
</div>
</div>
</div>
<div class="new-page">&nbsp;</div>
{% endif %}
{% endfor %}
<br>
{% endblock %}
{% block localjavascript %}
function myprint() {
href=document.location.href;
document.location.href=href+"?fgprint=true";
}
{% endblock %}