rapport 1

This commit is contained in:
2018-02-18 21:00:07 +01:00
parent f3b40c5bce
commit 3f2fffd1d4
6 changed files with 279 additions and 12 deletions
@@ -40,9 +40,24 @@ class Projecthour extends BaseModel {
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours, 0)) AS oktober,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours, 0)) AS november,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours, 0)) AS december,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours * tarif, 0)) AS januariRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours * tarif, 0)) AS februariRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours * tarif, 0)) AS maartRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours * tarif, 0)) AS aprilRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours * tarif, 0)) AS meiRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours * tarif, 0)) AS juniRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours * tarif, 0)) AS juliRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours * tarif, 0)) AS augustusRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours * tarif, 0)) AS septemberRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours * tarif, 0)) AS oktoberRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours * tarif, 0)) AS novemberRevenue,
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours * tarif, 0)) AS decemberRevenue,
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours, 0)) AS totalyear,
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours, 0)) AS totalotheryears,
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours * tarif, 0)) AS totalyearRevenue,
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours * tarif, 0)) AS totalotheryearsRevenue,
SUM(projecthours.hours) AS totalhours,
SUM(projecthours.hours * tarif) AS totalhoursRevenue,
PEM.tarif,
PRJ.projectname" )
->join( 'projectemployees AS PEM', 'PEM.id', '=', 'projecthours.projectemployee_id' )
@@ -41,7 +41,27 @@
<!-- ko foreach:uniqueEmployees -->
<div class="tab-pane" data-bind="css:{'active':$root.sluggy() == slug}">
<?php $this->load->view('reports/monthlyemployeehours/employee_view'); ?>
<div style="position:relative">
<div style="position:absolute;right:20px; z-index:10;">
<div class="onoffswitch" data-bind="click:$root.toggleHourView">
<input type="checkbox"
name="onoffswitch"
class="onoffswitch-checkbox"
data-bind="checked:hourView"
id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
<!-- ko if : hourView() -->
<?php $this->load->view('reports/monthlyemployeehours/_employeehour_view'); ?>
<!-- /ko -->
<!-- ko if : ! hourView() -->
<?php $this->load->view('reports/monthlyemployeehours/_employeerevenue_view'); ?>
<!-- /ko -->
</div>
<!-- /ko -->
</div>
@@ -1,6 +1,6 @@
<div class="row">
<div class="col-md-12">
<h2>uren per project</h2>
<h2 style="margin-top:0">uren per project</h2>
<table class="table table-condensed table-bordered">
<thead>
<tr class="table-info">
@@ -119,13 +119,13 @@
<span data-bind="text:totalDecember "></span>
</th>
<th class="align-right">
<span data-bind="text:totalTotal"></span>
<span data-bind="text:totalTotal().toFixed(1)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalTotalOtheryears"></span>
<span data-bind="text:totalTotalOtheryears().toFixed(1)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalTotalOtheryears() + totalTotal()"></span>
<span data-bind="text:(totalTotalOtheryears() + totalTotal()).toFixed(1)"></span>
</th>
</tr>
</tfoot>
@@ -144,3 +144,5 @@
</div>
</div>
</div>
@@ -0,0 +1,146 @@
<div class="row">
<div class="col-md-12">
<h2 style="margin-top:0">omzet per project</h2>
<table class="table table-condensed table-bordered">
<thead>
<tr class="table-info">
<th>project</th>
<th class="align-right">tarief</th>
<th class="align-right">jan</th>
<th class="align-right">feb</th>
<th class="align-right">mrt</th>
<th class="align-right">apr</th>
<th class="align-right">mei</th>
<th class="align-right">juni</th>
<th class="align-right">juli</th>
<th class="align-right">aug</th>
<th class="align-right">sep</th>
<th class="align-right">okt</th>
<th class="align-right">nov</th>
<th class="align-right">dec</th>
<th class="align-right">tot jaar</th>
<th class="align-right">tot overig</th>
<th class="align-right">grand total</th>
</tr>
</thead>
<tbody data-bind="foreach:myData">
<tr>
<td>
<span data-bind="text:projectname"></span>
</td>
<td class="align-right">
<span data-bind="text:tarif"></span>
</td>
<td class="align-right">
<span data-bind="text:januariRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:februariRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:maartRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:aprilRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:meiRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:juniRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:juliRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:augustusRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:septemberRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:oktoberRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:novemberRevenue.toFixed(0)"></span>
</td>
<td class="align-right">
<span data-bind="text:decemberRevenue.toFixed(0)"></span>
</td>
<th class="align-right">
<span data-bind="text:totalyearRevenue.toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalotheryearsRevenue.toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalhoursRevenue.toFixed(0)"></span>
</th>
</tr>
</tbody>
<tfoot>
<tr class="table-info">
<th>totaal</th>
<th>&nbsp;</th>
<th class="align-right">
<span data-bind="text:totalJanuariRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalFebruariRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalMaartRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalAprilRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalMeiRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalJuniRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalJuliRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalAugustusRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalSeptemberRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalOktoberRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalNovemberRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalDecemberRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalTotalRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:totalTotalOtheryearsRevenue().toFixed(0)"></span>
</th>
<th class="align-right">
<span data-bind="text:(totalTotalOtheryearsRevenue() + totalTotalRevenue()).toFixed(0)"></span>
</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="graph-holder">
<canvas data-bind="attr:{id: 'revenue-per-month-' + slug}" height="300"></canvas>
</div>
</div>
<div class="col-md-6">
<div class="graph-holder">
<canvas data-bind="attr:{id: 'revenue-per-project-' + slug}" height="300"></canvas>
</div>
</div>
</div>
+15
View File
@@ -121,6 +121,13 @@
color: #FFFFFF;
}
.onoffswitch-inner-euro:before {
content: "u";
padding-left: 10px;
background-color: #63BE62;
color: #FFFFFF;
}
.onoffswitch-inner:after {
content: "nee";
padding-right: 10px;
@@ -129,6 +136,14 @@
text-align: right;
}
.onoffswitch-inner-euro:after {
content: "€";
padding-right: 10px;
background-color: #EEEEEE;
color: #999999;
text-align: right;
}
.onoffswitch-switch {
display: block;
width: 25px;
@@ -69,8 +69,23 @@ dbo.monthlyemployeehoursInit = function () {
vm.currentTab.totalDecember( 0 );
vm.currentTab.totalTotal( 0 );
vm.currentTab.totalTotalOtheryears( 0 );
var totalHoursChart = [];
var projectChart = [];
vm.currentTab.totalJanuariRevenue( 0 );
vm.currentTab.totalFebruariRevenue( 0 );
vm.currentTab.totalMaartRevenue( 0 );
vm.currentTab.totalAprilRevenue( 0 );
vm.currentTab.totalMeiRevenue( 0 );
vm.currentTab.totalJuniRevenue( 0 );
vm.currentTab.totalJuliRevenue( 0 );
vm.currentTab.totalAugustusRevenue( 0 );
vm.currentTab.totalSeptemberRevenue( 0 );
vm.currentTab.totalOktoberRevenue( 0 );
vm.currentTab.totalNovemberRevenue( 0 );
vm.currentTab.totalDecemberRevenue( 0 );
vm.currentTab.totalTotalRevenue( 0 );
vm.currentTab.totalTotalOtheryearsRevenue( 0 );
vm.currentTab.totalHoursChart = [];
vm.currentTab.totalHoursRevenueChart = [];
vm.currentTab.projectChart = [];
$.each( vm.currentTab.myData(), function ( i, q ) {
vm.currentTab.tarif( q.tarif );
vm.currentTab.totalJanuari( vm.currentTab.totalJanuari() + q.januari );
@@ -87,15 +102,50 @@ dbo.monthlyemployeehoursInit = function () {
vm.currentTab.totalDecember( vm.currentTab.totalDecember() + q.december );
vm.currentTab.totalTotal( vm.currentTab.totalTotal() + q.totalyear );
vm.currentTab.totalTotalOtheryears( vm.currentTab.totalTotalOtheryears() + q.totalotheryears );
totalHoursChart.push(q.totalhours);
projectChart.push(q.projectname)
vm.currentTab.totalJanuariRevenue( vm.currentTab.totalJanuariRevenue() + q.januariRevenue );
vm.currentTab.totalFebruariRevenue( vm.currentTab.totalFebruariRevenue() + q.februariRevenue );
vm.currentTab.totalMaartRevenue( vm.currentTab.totalMaartRevenue() + q.maartRevenue );
vm.currentTab.totalAprilRevenue( vm.currentTab.totalAprilRevenue() + q.aprilRevenue );
vm.currentTab.totalMeiRevenue( vm.currentTab.totalMeiRevenue() + q.meiRevenue );
vm.currentTab.totalJuniRevenue( vm.currentTab.totalJuniRevenue() + q.juniRevenue );
vm.currentTab.totalJuliRevenue( vm.currentTab.totalJuliRevenue() + q.juliRevenue );
vm.currentTab.totalAugustusRevenue( vm.currentTab.totalAugustusRevenue() + q.augustusRevenue );
vm.currentTab.totalSeptemberRevenue( vm.currentTab.totalSeptemberRevenue() + q.septemberRevenue );
vm.currentTab.totalOktoberRevenue( vm.currentTab.totalOktoberRevenue() + q.oktoberRevenue );
vm.currentTab.totalNovemberRevenue( vm.currentTab.totalNovemberRevenue() + q.novemberRevenue );
vm.currentTab.totalDecemberRevenue( vm.currentTab.totalDecemberRevenue() + q.decemberRevenue );
vm.currentTab.totalTotalRevenue( vm.currentTab.totalTotalRevenue() + q.totalyearRevenue );
vm.currentTab.totalTotalOtheryearsRevenue( vm.currentTab.totalTotalOtheryearsRevenue() + q.totalotheryearsRevenue );
vm.currentTab.projectChart.push( q.projectname );
vm.currentTab.totalHoursChart.push( q.totalhours );
vm.currentTab.totalHoursRevenueChart.push( q.totalhoursRevenue );
} );
var chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()]
dbo.charts.drawHoursChart( 'hours-per-month-' + vm.currentTab.slug, chartData, dbo.charts.monthLabels, 'uren per maand', '#f28f25' );
dbo.charts.drawHoursChart( 'hours-per-project-' + vm.currentTab.slug, totalHoursChart, projectChart, 'uren per project', '#0daef0' );
vm.currentTab.chartData = [vm.currentTab.totalJanuari(), vm.currentTab.totalFebruari(), vm.currentTab.totalMaart(), vm.currentTab.totalApril(), vm.currentTab.totalMei(), vm.currentTab.totalJuni(), vm.currentTab.totalJuli(), vm.currentTab.totalAugustus(), vm.currentTab.totalSeptember(), vm.currentTab.totalOktober(), vm.currentTab.totalNovember(), vm.currentTab.totalDecember()];
vm.currentTab.chartRevenueData = [vm.currentTab.totalJanuariRevenue(), vm.currentTab.totalFebruariRevenue(), vm.currentTab.totalMaartRevenue(), vm.currentTab.totalAprilRevenue(), vm.currentTab.totalMeiRevenue(), vm.currentTab.totalJuniRevenue(), vm.currentTab.totalJuliRevenue(), vm.currentTab.totalAugustusRevenue(), vm.currentTab.totalSeptemberRevenue(), vm.currentTab.totalOktoberRevenue(), vm.currentTab.totalNovemberRevenue(), vm.currentTab.totalDecemberRevenue()];
vm.drawCharts( vm.currentTab );
} );
},
drawCharts: function ( self ) {
if ( self.hourView() ) {
dbo.charts.drawHoursChart( 'hours-per-month-' + self.slug, self.chartData, dbo.charts.monthLabels, 'uren per maand', '#f28f25' );
dbo.charts.drawHoursChart( 'hours-per-project-' + self.slug, self.totalHoursChart, self.projectChart, 'uren per project', '#0daef0' );
} else {
dbo.charts.drawHoursChart( 'revenue-per-month-' + self.slug, self.chartRevenueData, dbo.charts.monthLabels, 'omzet per maand', '#f28f25' );
dbo.charts.drawHoursChart( 'revenue-per-project-' + self.slug, self.totalHoursRevenueChart, self.projectChart, 'omzet per project', '#0daef0' );
}
},
toggleHourView: function () {
this.hourView( !this.hourView() );
dbo.monthlyEmployeeHoursModel.drawCharts( this );
},
setActivetab: function ( tab ) {
var vm = dbo.monthlyEmployeeHoursModel;
@@ -136,6 +186,25 @@ dbo.monthlyemployeehoursInit = function () {
self.totalOtheryears = ko.observable( 0 );
self.totalTotalOtheryears = ko.observable( 0 );
self.totalJanuariRevenue = ko.observable( 0 );
self.totalFebruariRevenue = ko.observable( 0 );
self.totalMaartRevenue = ko.observable( 0 );
self.totalAprilRevenue = ko.observable( 0 );
self.totalMeiRevenue = ko.observable( 0 );
self.totalJuniRevenue = ko.observable( 0 );
self.totalJuliRevenue = ko.observable( 0 );
self.totalAugustusRevenue = ko.observable( 0 );
self.totalSeptemberRevenue = ko.observable( 0 );
self.totalOktoberRevenue = ko.observable( 0 );
self.totalNovemberRevenue = ko.observable( 0 );
self.totalDecemberRevenue = ko.observable( 0 );
self.totalTotalRevenue = ko.observable( 0 );
self.totalOtheryearsRevenue = ko.observable( 0 );
self.totalTotalOtheryearsRevenue = ko.observable( 0 );
self.hourView = ko.observable( true );
self.myData = ko.observableArray( [] );
},