This commit is contained in:
2025-09-30 21:24:37 +02:00
parent d603fb452a
commit b7b9cebacb
258 changed files with 416 additions and 601 deletions

65
templates/Budget/edit.html.twig Executable file
View File

@@ -0,0 +1,65 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if fgprint is defined and fgprint %}
EXERCICE
{% elseif mode=="update" %}
Modification EXERCICE
{% elseif mode=="submit" %}
Création EXERCICE
{% endif %}
</h1>
{{ form_widget(form.submit) }}
{% if returnto is empty %}
<a class="btn btn-secondary" href={{ path('app_budget',{id:year.id}) }}>Annuler</a>
{% else %}
<a class="btn btn-secondary" href={{ path('app_budget',{id:returnto}) }}>Annuler</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="card">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
<div class="card-body">
{{ form_row(form.nbdaybudget) }}
{{ form_row(form.cabudget) }}
{{ form_row(form.careal) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$("#year_name").focus();
});
function myprint() {
href=document.location.href;
document.location.href=href+"?fgprint=true";
}
{% endblock %}

View File

@@ -0,0 +1,373 @@
{% 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%}
.group td, .tbsynthese .tdtotalgene {
font-size:120%;
text-transform: uppercase;
background-color:#212529;
color:#ffffff;
}
.total td{
font-size:120%;
background-color:#cdcdcd;
font-weight: bold;
}
.tbsynthese .tbhide {display:none}
{% endblock %}
{% block body %}
<h1 class="page-header">
BUDGET
</h1>
<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>
<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>
<div class="card">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Budget
</div>
{% 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 %}
<div class="card-body">
<div class="dataTable_wrapper">
<table class="table table-bordered tbdetail" id="dataTables" style="width:100%">
<thead>
<tr>
<th rowspan=2>Domaine</th>
<th rowspan=2 class="tbhide">Projet</th>
<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>
<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>
{% 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>
<td class="tbhide">{{project.name}}</td>
<td class="text-center tbhide">
<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>
<td class="text-center tbhide">
<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">
<a href="{{path("app_budget_update",{type:"budget",id:domaine.id,year:n1.id,returnto:n2.id})}}"><i class="fa fa-file"></i></a>
</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">
<a href="{{path("app_budget_update",{type:"budget",id:domaine.id,year:n2.id,returnto:n2.id})}}"><i class="fa fa-file"></i></a>
</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>
<tr class="total" data-domaine="{{domaine.name}}">
<td>{{domaine.name}}</td>
<td class="tbhide" >TOTAL</td>
<td class="no-print tbhide"> </td>
<td class="text-center">
{{domaine.nbdayrealn1}} jours<br>
<small>
{{domaine.nbetprealn1|number_format(2)}}ETP / {{domaine.nbcaarealn1+nbcaarealn1}}
</small>
{% set totdayrealn1 = totdayrealn1 + domaine.nbdayrealn1 %}
{% set totetprealn1 = totetprealn1 + domaine.nbetprealn1 %}
{% set totcaarealn1 = totcaarealn1 + domaine.nbcaarealn1+nbcaarealn1 %}
</td>
<td class="text-center">
{{domaine.nbdaybudgn1+nbdaybudgn1}} jours<br>
<small>
{{(domaine.nbetpbudgn1+nbetpbudgn1)|number_format(2)}}ETP / {{domaine.nbcaabudgn1+nbcaabudgn1}}
</small>
{% set totdaybudgn1 = totdaybudgn1 + domaine.nbdaybudgn1+nbdaybudgn1 %}
{% set totetpbudgn1 = totetpbudgn1 + domaine.nbetpbudgn1+nbetpbudgn1 %}
{% set totcaabudgn1 = totcaabudgn1 + domaine.nbcaabudgn1+nbcaabudgn1 %}
</td>
<td class="no-print tbhide"> </td>
<td class="text-center">
{{domaine.nbdayrealn2}} jours<br>
<small>
{{domaine.nbetprealn2|number_format(2)}}ETP / {{domaine.nbcaarealn2+nbcaarealn2}}
</small>
{% set totdayrealn2 = totdayrealn2 + domaine.nbdayrealn2 %}
{% set totetprealn2 = totetprealn2 + domaine.nbetprealn2 %}
{% set totcaarealn2 = totcaarealn2 + domaine.nbcaarealn2+nbcaarealn2 %}
</td>
<td class="text-center">
{{domaine.nbdaybudgn2+nbdaybudgn2}} jours<br>
<small>
{{(domaine.nbetpbudgn2+nbetpbudgn2)|number_format(2)}}ETP / {{domaine.nbcaabudgn2+nbcaabudgn2}}
</small>
{% set totdaybudgn2 = totdaybudgn2 + domaine.nbdaybudgn2+nbdaybudgn2 %}
{% set totetpbudgn2 = totetpbudgn2 + domaine.nbetpbudgn2+nbetpbudgn2 %}
{% set totcaabudgn2 = totcaabudgn2 + domaine.nbcaabudgn2+nbcaabudgn2 %}
</td>
</tr>
{% endfor %}
<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>
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
var groupColumn = 0;
html="";
$('.total').each(function() {
html+="<tr>"+$(this).html()+"</tr>";
});
$("#tbsynthesebody").html(html);
var table = $('.tbdetail').DataTable({
"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(
'<tr class="group"><td colspan="7">'+group+'</td></tr>'
);
last = group;
}
} );
}
} );
// Order by the grouping
$('.tbdetail tbody').on( 'click', 'tr.group', function () {
var currentOrder = table.order()[0];
if ( currentOrder[0] === groupColumn && currentOrder[1] === 'asc' ) {
table.order( [ groupColumn, 'desc' ] ).draw();
}
else {
table.order( [ groupColumn, 'asc' ] ).draw();
}
} );
$('#exercice').change(function() {
id=$(this).val();
url="{{ path('app_budget',{id:'xxx'}) }}";
url=url.replace("xxx",id);
document.location=url;
});
});
function myprint() {
href=document.location.href;
document.location.href=href+"?fgprint=true";
}
{% endblock %}