stat cadoles
This commit is contained in:
@@ -56,6 +56,7 @@ class StatController extends AbstractController
|
||||
"id"=>$id,
|
||||
"name"=>$name,
|
||||
"services"=>$tbservices,
|
||||
"natures"=>$tbnatures,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -77,6 +78,26 @@ class StatController extends AbstractController
|
||||
->getQuery()->getResult();
|
||||
$totalmonth=($events[0]["somme"]?$events[0]["somme"]:0);
|
||||
|
||||
foreach($month["natures"] as $keynature => $nature) {
|
||||
$events = $em
|
||||
->createQueryBuilder('event')
|
||||
->select('SUM(event.duration) as somme')
|
||||
->from('App:Task','task')
|
||||
->from('App:Event','event')
|
||||
->andWhere('task.nature=:nature')
|
||||
->andWhere('event.task=task')
|
||||
->andWhere('event.start >=:start')
|
||||
->andWhere('event.end <:end')
|
||||
->setParameter('nature',$nature["id"])
|
||||
->setParameter('start',$start)
|
||||
->setParameter('end',$end)
|
||||
->getQuery()->getResult();
|
||||
|
||||
$tbmonths[$keymonth]["natures"][$keynature]["totalnature"]=($events[0]["somme"]?$events[0]["somme"]:0);
|
||||
$tbmonths[$keymonth]["natures"][$keynature]["totalmonth"]=$totalmonth;
|
||||
$tbmonths[$keymonth]["natures"][$keynature]["totalservice"]=0;
|
||||
}
|
||||
|
||||
foreach($month["services"] as $keyservice => $service) {
|
||||
$events = $em
|
||||
->createQueryBuilder('event')
|
||||
|
@@ -7,6 +7,17 @@ STATISTIQUES
|
||||
</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card homecard" style="width: 100%; height: 600px;">
|
||||
<div class="card-header">
|
||||
CADOLES
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div id="chart-c" style="height: 250px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="card homecard" style="width: 100%; height: 600px;">
|
||||
<div class="card-header">
|
||||
@@ -35,10 +46,45 @@ STATISTIQUES
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
|
||||
graphCadoles();
|
||||
graphDEV();
|
||||
graphCSS();
|
||||
});
|
||||
|
||||
function graphCadoles() {
|
||||
|
||||
new Morris.Line({
|
||||
element: 'chart-c',
|
||||
xkey: 'month',
|
||||
ymax: 350,
|
||||
ykeys: [
|
||||
'Total',
|
||||
{% for nature in tbnatures %}
|
||||
'{{ nature.name }}',
|
||||
{% endfor %}
|
||||
],
|
||||
data: [
|
||||
{% for month in tbmonths %}
|
||||
{ month: '{{ month.name }}',
|
||||
{% for nature in month.natures %}
|
||||
{% if loop.first %}
|
||||
'Total': {{ nature.totalmonth }},
|
||||
{% endif %}
|
||||
|
||||
'{{ nature.name }}': {{ nature.totalnature }},
|
||||
{% endfor %}
|
||||
},
|
||||
{% endfor %}
|
||||
],
|
||||
labels: [
|
||||
'Total',
|
||||
{% for nature in tbnatures %}
|
||||
'{{ nature.name }}',
|
||||
{% endfor %}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function graphDEV() {
|
||||
|
||||
|
Reference in New Issue
Block a user