rapportrage dbois
This commit is contained in:
@@ -21,13 +21,17 @@ class EmployeeHoursController extends MY_Controller {
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getMonthlyEmployeeHoursPerProject()
|
||||
public function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
|
||||
{
|
||||
$monthlyhours = Projecthour::getMonthlyEmployeeHoursPerProject( $employeeID, $year );
|
||||
|
||||
$this->json( $monthlyhours );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 14/02/2018
|
||||
* Time: 11:18
|
||||
*/
|
||||
class ReportsdefaultController extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCES' );
|
||||
|
||||
$models = [];
|
||||
$libraries = [];
|
||||
|
||||
$this->load->model( $models );
|
||||
$this->load->library( $libraries );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getUsedYears()
|
||||
{
|
||||
$years = Projecthour::getUsedYears();
|
||||
|
||||
$this->json( $years );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,6 +15,47 @@ class Projecthour extends BaseModel {
|
||||
$this->belongsTo( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public static function getUsedYears()
|
||||
{
|
||||
$years = Projecthour::selectRaw( "YEAR(hourdate) AS year" )
|
||||
->distinct()
|
||||
->orderByRaw( 'YEAR( hourdate )' )
|
||||
->get();
|
||||
|
||||
return $years;
|
||||
}
|
||||
|
||||
public static function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
|
||||
{
|
||||
$projectHours = Projecthour::selectRaw( "
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours, 0)) AS januari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours, 0)) AS februari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours, 0)) AS maart,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours, 0)) AS april,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours, 0)) AS mei,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours, 0)) AS juni,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours, 0)) AS juli,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours, 0)) AS augustus,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours, 0)) AS september,
|
||||
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(YEAR(hourdate) = {$year},projecthours.hours, 0)) AS totalyear,
|
||||
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours, 0)) AS totalotheryears,
|
||||
SUM(projecthours.hours) AS totalhours,
|
||||
PEM.tarif,
|
||||
PRJ.projectname" )
|
||||
->join( 'projectemployees AS PEM', 'PEM.id', '=', 'projecthours.projectemployee_id' )
|
||||
->join( 'projects AS PRJ', 'PRJ.id', '=', 'PEM.project_id' )
|
||||
->where( 'PEM.user_id', '=', $employeeID )
|
||||
->groupBy('PRJ.id')
|
||||
->groupBy('PEM.tarif')
|
||||
->groupBy('PRJ.projectname')
|
||||
->get();
|
||||
|
||||
return $projectHours;
|
||||
}
|
||||
|
||||
public static function saveProjecthour( $projecthourID, $projecthour )
|
||||
{
|
||||
$projecthour = (array) $projecthour;
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
<div class="MONTHLYEMPLOYEEHOURS">
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
<label>jaar</label>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:years,
|
||||
optionsText:'year',
|
||||
optionsValue: 'id',
|
||||
value:selectedYear,
|
||||
event:{change:refreshTab}"></select>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="nav-tabs-horizontal">
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
<script src="js/lib/dataservices/projectsDataservice.js"></script>
|
||||
<script src="js/lib/dataservices/vatDataservice.js"></script>
|
||||
<script src="js/lib/dataservices/employeehoursDataservice.js"></script>
|
||||
<script src="js/lib/dataservices/reportsDataService.js"></script>
|
||||
|
||||
<script src="js/lib/services/chartService.js"></script>
|
||||
|
||||
|
||||
@@ -1,3 +1,146 @@
|
||||
<ul data-bind="foreach: myData">
|
||||
<li data-bind="text:test">text</li>
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>uren 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:januari"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:februari"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:maart"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:april"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:mei"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:juni"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:juli"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:augustus"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:september"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:oktober"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:november"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:december"></span>
|
||||
</td>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalyear"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalotheryears"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalhours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="table-info">
|
||||
<th>totaal</th>
|
||||
<th> </th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalJanuari "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalFebruari "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalMaart "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalApril "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalMei "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalJuni "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalJuli "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAugustus"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalSeptember "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalOktober "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalNovember "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalDecember "></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalTotal"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalTotalOtheryears"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalTotalOtheryears() + totalTotal()"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="graph-holder">
|
||||
<canvas data-bind="attr:{id: 'hours-per-month-' + slug}" id="" height="300"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="graph-holder">
|
||||
<canvas data-bind="attr:{id: 'hours-per-project-' + slug}" id="" height="300"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user