Files
schedule/templates/Budget/list.html.twig

373 lines
18 KiB
Twig
Raw Normal View History

2021-06-07 13:58:56 +02:00
{% extends "base.html.twig" %}
{% block localstyle %}
{% if fgprint is defined and fgprint %}
table { font-size:10px;}
th,td {
border: 1px solid #37474F;
}
thead {
display: table-header-group;
}
tr { page-break-inside: avoid; }
{%endif%}
2021-06-17 14:06:08 +02:00
.group td, .tbsynthese .tdtotalgene {
2021-06-07 15:05:20 +02:00
font-size:120%;
text-transform: uppercase;
background-color:#212529;
color:#ffffff;
}
.total td{
font-size:120%;
background-color:#cdcdcd;
font-weight: bold;
}
2021-06-17 14:06:08 +02:00
.tbsynthese .tbhide {display:none}
2021-06-07 13:58:56 +02:00
{% endblock %}
{% block body %}
<h1 class="page-header">
BUDGET
2021-06-07 15:05:20 +02:00
</h1>
2021-06-07 13:58:56 +02:00
2021-06-07 15:05:20 +02:00
<div class="form-group ">
<label class="control-label" for="project_active">Exercice</label>
<select id="exercice" class="form-control">
{% for year in years %}
{% set selected=""%}
{% if year.id==n2.id%}
{% set selected="selected" %}
{% endif %}
<option value="{{year.id}}" {{selected}}>{{year.start|date("m/Y")}}</option>
{% endfor %}
</select>
</div>
2021-06-17 14:06:08 +02:00
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Budget Synthèse
</div>
<div class="card-body">
<div class="dataTable_wrapper">
<table class="table table-bordered tbsynthese" id="dataTables" style="width:100%; zoom:70%">
<thead>
<tr>
<th rowspan=2>Domaine</th>
<th rowspan=2 class="tbhide">Projet</th>
<th class="text-center" style="width:150px" colspan=2>{{n1.start|date("m/Y")}}</th>
<th class="text-center" style="width:150px" colspan=2>{{n2.start|date("m/Y")}}</th>
</tr>
<tr>
<th width="20px" class="no-sort no-print tbhide"></th>
<th class="text-center" style="width:150px">Réel</th>
<th class="text-center" style="width:150px">Budget</th>
<th width="20px" class="no-sort no-print tbhide"></th>
<th class="text-center" style="width:150px">Réel</th>
<th class="text-center" style="width:150px">Budget</th>
</tr>
</thead>
<tbody id="tbsynthesebody">
<tbody>
</table>
</div>
</div>
</div>
2021-06-07 13:58:56 +02:00
<div class="card">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Budget
</div>
2021-06-17 14:06:08 +02:00
{% set totdayrealn1 = 0 %}
{% set totetprealn1 = 0 %}
{% set totcaarealn1 = 0 %}
{% set totdaybudgn1 = 0 %}
{% set totetpbudgn1 = 0 %}
{% set totcaabudgn1 = 0 %}
{% set totdayrealn2 = 0 %}
{% set totetprealn2 = 0 %}
{% set totcaarealn2 = 0 %}
{% set totdaybudgn2 = 0 %}
{% set totetpbudgn2 = 0 %}
{% set totcaabudgn2 = 0 %}
2021-06-07 13:58:56 +02:00
<div class="card-body">
<div class="dataTable_wrapper">
2021-06-17 14:06:08 +02:00
<table class="table table-bordered tbdetail" id="dataTables" style="width:100%">
2021-06-07 13:58:56 +02:00
<thead>
<tr>
<th rowspan=2>Domaine</th>
2021-06-17 14:06:08 +02:00
<th rowspan=2 class="tbhide">Projet</th>
2021-06-07 13:58:56 +02:00
<th class="text-center" style="width:150px" colspan=3>{{n1.start|date("m/Y")}}</th>
<th class="text-center" style="width:150px" colspan=3>{{n2.start|date("m/Y")}}</th>
</tr>
<tr>
2021-06-17 14:06:08 +02:00
<th width="20px" class="no-sort no-print tbhide"></th>
2021-06-07 13:58:56 +02:00
<th class="text-center" style="width:150px">Réel</th>
<th class="text-center" style="width:150px">Budget</th>
2021-06-17 14:06:08 +02:00
<th width="20px" class="no-sort no-print tbhide"></th>
2021-06-07 13:58:56 +02:00
<th class="text-center" style="width:150px">Réel</th>
<th class="text-center" style="width:150px">Budget</th>
</tr>
</thead>
<tbody>
{% for domaine in domaines %}
{% set nbdayrealn1 = 0 %}
{% set nbetprealn1 = 0 %}
{% set nbcaarealn1 = 0 %}
{% set nbdaybudgn1 = 0 %}
{% set nbetpbudgn1 = 0 %}
{% set nbcaabudgn1 = 0 %}
{% set nbdayrealn2 = 0 %}
{% set nbetprealn2 = 0 %}
{% set nbcaarealn2 = 0 %}
{% set nbdaybudgn2 = 0 %}
{% set nbetpbudgn2 = 0 %}
{% set nbcaabudgn2 = 0 %}
{% for project in domaine.projects %}
{% set nbdayrealn1 = nbdayrealn1+project.nbdayrealn1 %}
{% set nbetprealn1 = nbetprealn1+project.nbetprealn1 %}
{% set nbcaarealn1 = nbcaarealn1+project.nbcaarealn1 %}
{% set nbdaybudgn1 = nbdaybudgn1+project.nbdaybudgn1 %}
{% set nbetpbudgn1 = nbetpbudgn1+project.nbetpbudgn1 %}
{% set nbcaabudgn1 = nbcaabudgn1+project.nbcaabudgn1 %}
{% set nbdayrealn2 = nbdayrealn2+project.nbdayrealn2 %}
{% set nbetprealn2 = nbetprealn2+project.nbetprealn2 %}
{% set nbcaarealn2 = nbcaarealn2+project.nbcaarealn2 %}
{% set nbdaybudgn2 = nbdaybudgn2+project.nbdaybudgn2 %}
{% set nbetpbudgn2 = nbetpbudgn2+project.nbetpbudgn2 %}
{% set nbcaabudgn2 = nbcaabudgn2+project.nbcaabudgn2 %}
<tr>
<td>{{domaine.name}}</td>
2021-06-17 14:06:08 +02:00
<td class="tbhide">{{project.name}}</td>
2021-06-07 13:58:56 +02:00
2021-06-17 14:06:08 +02:00
<td class="text-center tbhide">
2021-06-07 13:58:56 +02:00
<a href="{{path("app_budget_update",{type:"project",id:project.id,year:n1.id,returnto:n2.id})}}"><i class="fa fa-file"></i></a>
</td>
<td class="text-center">
{{project.nbdayrealn1}} jours<br>
<small>
{{project.nbetprealn1|number_format(2)}}ETP / {{project.nbcaarealn1}}
</small>
</td>
<td class="text-center">
{{project.nbdaybudgn1}} jours<br>
<small>
{{project.nbetpbudgn1|number_format(2)}}ETP / {{project.nbcaabudgn1}}
</small>
</td>
2021-06-17 14:06:08 +02:00
<td class="text-center tbhide">
2021-06-07 13:58:56 +02:00
<a href="{{path("app_budget_update",{type:"project",id:project.id,year:n2.id})}}"><i class="fa fa-file"></i></a>
</td>
<td class="text-center">
{{project.nbdayrealn2}} jours<br>
<small>
{{project.nbetprealn2|number_format(2)}}ETP / {{project.nbcaarealn2}}
</small>
</td>
<td class="text-center">
{{project.nbdaybudgn2}} jours<br>
<small>
{{project.nbetpbudgn2|number_format(2)}}ETP / {{project.nbcaabudgn2}}
</small>
</td>
</tr>
{% endfor %}
<tr>
<td>{{domaine.name}}</td>
<td>Hors Projet</td>
<td class="text-center">
2021-06-07 15:05:20 +02:00
<a href="{{path("app_budget_update",{type:"budget",id:domaine.id,year:n1.id,returnto:n2.id})}}"><i class="fa fa-file"></i></a>
2021-06-07 13:58:56 +02:00
</td>
<td class="text-center">
{{(domaine.nbdayrealn1-nbdayrealn1)}} jours<br>
<small>
{{(domaine.nbetprealn1-nbetprealn1)|number_format(2)}}ETP / {{domaine.nbcaarealn1}}
</small>
</td>
<td class="text-center">
{{(domaine.nbdaybudgn1)}} jours<br>
<small>
{{domaine.nbetpbudgn1|number_format(2)}}ETP / {{(domaine.nbcaabudgn1)}}
</small>
</td>
<td class="text-center">
2021-06-07 15:05:20 +02:00
<a href="{{path("app_budget_update",{type:"budget",id:domaine.id,year:n2.id,returnto:n2.id})}}"><i class="fa fa-file"></i></a>
2021-06-07 13:58:56 +02:00
</td>
<td class="text-center">
{{(domaine.nbdayrealn2-nbdayrealn2)}} jours<br>
<small>
{{(domaine.nbetprealn2-nbetprealn2)|number_format(2)}}ETP / {{domaine.nbcaarealn2}}
</small>
</td>
<td class="text-center">
{{(domaine.nbdaybudgn2)}} jours<br>
<small>
{{domaine.nbetpbudgn2|number_format(2)}}ETP / {{(domaine.nbcaabudgn2)}}
</small>
</td>
</tr>
2021-06-17 14:06:08 +02:00
<tr class="total" data-domaine="{{domaine.name}}">
2021-06-07 13:58:56 +02:00
<td>{{domaine.name}}</td>
2021-06-17 14:06:08 +02:00
<td class="tbhide" >TOTAL</td>
2021-06-07 13:58:56 +02:00
2021-06-17 14:06:08 +02:00
<td class="no-print tbhide"> </td>
2021-06-07 13:58:56 +02:00
<td class="text-center">
{{domaine.nbdayrealn1}} jours<br>
<small>
{{domaine.nbetprealn1|number_format(2)}}ETP / {{domaine.nbcaarealn1+nbcaarealn1}}
</small>
2021-06-17 14:06:08 +02:00
{% set totdayrealn1 = totdayrealn1 + domaine.nbdayrealn1 %}
{% set totetprealn1 = totetprealn1 + domaine.nbetprealn1 %}
{% set totcaarealn1 = totcaarealn1 + domaine.nbcaarealn1+nbcaarealn1 %}
2021-06-07 13:58:56 +02:00
</td>
<td class="text-center">
{{domaine.nbdaybudgn1+nbdaybudgn1}} jours<br>
<small>
{{(domaine.nbetpbudgn1+nbetpbudgn1)|number_format(2)}}ETP / {{domaine.nbcaabudgn1+nbcaabudgn1}}
</small>
2021-06-17 14:06:08 +02:00
{% set totdaybudgn1 = totdaybudgn1 + domaine.nbdaybudgn1+nbdaybudgn1 %}
{% set totetpbudgn1 = totetpbudgn1 + domaine.nbetpbudgn1+nbetpbudgn1 %}
{% set totcaabudgn1 = totcaabudgn1 + domaine.nbcaabudgn1+nbcaabudgn1 %}
2021-06-07 13:58:56 +02:00
</td>
2021-06-17 14:06:08 +02:00
<td class="no-print tbhide"> </td>
2021-06-07 13:58:56 +02:00
<td class="text-center">
{{domaine.nbdayrealn2}} jours<br>
<small>
{{domaine.nbetprealn2|number_format(2)}}ETP / {{domaine.nbcaarealn2+nbcaarealn2}}
</small>
2021-06-17 14:06:08 +02:00
{% set totdayrealn2 = totdayrealn2 + domaine.nbdayrealn2 %}
{% set totetprealn2 = totetprealn2 + domaine.nbetprealn2 %}
{% set totcaarealn2 = totcaarealn2 + domaine.nbcaarealn2+nbcaarealn2 %}
2021-06-07 13:58:56 +02:00
</td>
<td class="text-center">
{{domaine.nbdaybudgn2+nbdaybudgn2}} jours<br>
<small>
{{(domaine.nbetpbudgn2+nbetpbudgn2)|number_format(2)}}ETP / {{domaine.nbcaabudgn2+nbcaabudgn2}}
</small>
2021-06-17 14:06:08 +02:00
{% set totdaybudgn2 = totdaybudgn2 + domaine.nbdaybudgn2+nbdaybudgn2 %}
{% set totetpbudgn2 = totetpbudgn2 + domaine.nbetpbudgn2+nbetpbudgn2 %}
{% set totcaabudgn2 = totcaabudgn2 + domaine.nbcaabudgn2+nbcaabudgn2 %}
2021-06-07 13:58:56 +02:00
</td>
</tr>
{% endfor %}
2021-06-17 14:06:08 +02:00
<tr class="total totalgene" data-domaine="TOTAL">
<td class="tdtotalgene" >RESULTAT</td>
<td class="tdtotalgene tbhide">RESULTAT</td>
<td class="no-print tbhide tdtotalgene"> </td>
<td class="text-center tdtotalgene">
{{totdayrealn1}} jours<br>
<small>
{{totetprealn1|number_format(2)}}ETP / {{totcaarealn1}}
</small>
</td>
<td class="text-center tdtotalgene">
{{totdaybudgn1}} jours<br>
<small>
{{totetpbudgn1|number_format(2)}}ETP / {{totcaabudgn1}}
</small>
</td>
<td class="no-print tbhide tdtotalgene"> </td>
<td class="text-center tdtotalgene">
{{totdayrealn2}} jours<br>
<small>
{{totetprealn2|number_format(2)}}ETP / {{totcaarealn2}}
</small>
</td>
<td class="text-center tdtotalgene">
{{totdaybudgn2}} jours<br>
<small>
{{totetpbudgn2|number_format(2)}}ETP / {{totcaabudgn2}}
</small>
</td>
</tr>
2021-06-07 13:58:56 +02:00
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
2021-06-07 15:05:20 +02:00
var groupColumn = 0;
2021-06-17 14:06:08 +02:00
html="";
$('.total').each(function() {
html+="<tr>"+$(this).html()+"</tr>";
});
$("#tbsynthesebody").html(html);
var table = $('.tbdetail').DataTable({
2021-06-07 13:58:56 +02:00
"columnDefs": [
{ "visible": false, "targets": groupColumn }
],
"order": [[ groupColumn, 'asc' ]],
"displayLength": 1500,
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(groupColumn, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
2021-06-07 15:05:20 +02:00
'<tr class="group"><td colspan="7">'+group+'</td></tr>'
2021-06-07 13:58:56 +02:00
);
last = group;
}
} );
}
} );
// Order by the grouping
2021-06-17 14:06:08 +02:00
$('.tbdetail tbody').on( 'click', 'tr.group', function () {
2021-06-07 13:58:56 +02:00
var currentOrder = table.order()[0];
if ( currentOrder[0] === groupColumn && currentOrder[1] === 'asc' ) {
table.order( [ groupColumn, 'desc' ] ).draw();
}
else {
table.order( [ groupColumn, 'asc' ] ).draw();
}
} );
2021-06-07 15:05:20 +02:00
$('#exercice').change(function() {
id=$(this).val();
url="{{ path('app_budget',{id:'xxx'}) }}";
url=url.replace("xxx",id);
document.location=url;
});
2021-06-07 13:58:56 +02:00
});
function myprint() {
href=document.location.href;
document.location.href=href+"?fgprint=true";
}
{% endblock %}