start reports
This commit is contained in:
@@ -34,6 +34,13 @@ class usersController extends MY_Controller {
|
|||||||
$this->json( $users );
|
$this->json( $users );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUniqueprojectEmployees()
|
||||||
|
{
|
||||||
|
$projectEmployees = User::getUniqueProjectUsers();
|
||||||
|
|
||||||
|
$this->json( $projectEmployees );
|
||||||
|
}
|
||||||
|
|
||||||
public function saveUser()
|
public function saveUser()
|
||||||
{
|
{
|
||||||
$userValidation = new UserValidation();
|
$userValidation = new UserValidation();
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 08/02/2018
|
||||||
|
* Time: 15:16
|
||||||
|
*/
|
||||||
|
class EmployeeHoursController 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 getMonthlyEmployeeHoursPerProject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,6 +11,16 @@ class User extends BaseModel {
|
|||||||
|
|
||||||
protected $table = "users";
|
protected $table = "users";
|
||||||
|
|
||||||
|
public function projectemployees()
|
||||||
|
{
|
||||||
|
return $this->hasMany( 'Projectemployee' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function projectemployee()
|
||||||
|
{
|
||||||
|
return $this->hasOne( 'Projectemployee' );
|
||||||
|
}
|
||||||
|
|
||||||
public function role()
|
public function role()
|
||||||
{
|
{
|
||||||
return $this->belongsTo( 'Role', 'level', 'rolelevel' );
|
return $this->belongsTo( 'Role', 'level', 'rolelevel' );
|
||||||
@@ -18,7 +28,7 @@ class User extends BaseModel {
|
|||||||
|
|
||||||
public static function getAllUsers( $archive )
|
public static function getAllUsers( $archive )
|
||||||
{
|
{
|
||||||
$users = User::selectRaw("*, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname")
|
$users = User::selectRaw( "*, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||||
->orderBy( 'lastname' );
|
->orderBy( 'lastname' );
|
||||||
|
|
||||||
if ( $archive == 'F' ) $users = $users->whereArchive( 'F' );
|
if ( $archive == 'F' ) $users = $users->whereArchive( 'F' );
|
||||||
@@ -68,5 +78,23 @@ class User extends BaseModel {
|
|||||||
User::whereId( $userID )->delete();
|
User::whereId( $userID )->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getUniqueProjectUsers()
|
||||||
|
{
|
||||||
|
//TODO: date range
|
||||||
|
$projectusers = User::selectRaw( "
|
||||||
|
users.id,
|
||||||
|
CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
|
||||||
|
SUBSTR(MD5(users.id), 1, 6) AS slug" )
|
||||||
|
->join( 'projectemployees AS PEM', 'PEM.user_id', '=', 'users.id' )
|
||||||
|
->with( [
|
||||||
|
'projectemployee.project' => function ( $q ) {
|
||||||
|
$q->selectRaw( "id, YEAR(startdate) AS instroom, COALESCE(YEAR(enddate), '') AS uitstroom" );
|
||||||
|
}] )
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return $projectusers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<div class="MONTHLYEMPLOYEEHOURS">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="nav-tabs-horizontal">
|
||||||
|
<ul class="nav nav-tabs nav-tabs-solid">
|
||||||
|
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'euro')">
|
||||||
|
<a class="nav-link" data-bind="css:{'active':sluggy() == 'euro'}">totaal euro's</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'hours')">
|
||||||
|
<a class="nav-link" data-bind="css:{'active':sluggy() == 'hours'}">totaal uren</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- ko foreach:uniqueEmployees -->
|
||||||
|
<li class="nav-item" data-bind="click:$root.setActivetab.bind($data, slug)">
|
||||||
|
<a class="nav-link" data-bind="text:fullname, css:{'active':$root.sluggy() == slug}"></a>
|
||||||
|
</li>
|
||||||
|
<!-- /ko -->
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane" data-bind="css:{'active':sluggy() == 'euro'}">
|
||||||
|
<?php $this->load->view('reports/monthlyemployeehours/euro_view'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" data-bind="css:{'active':sluggy() == 'hours'}">
|
||||||
|
<?php $this->load->view('reports/monthlyemployeehours/hours_view'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ko foreach:uniqueEmployees -->
|
||||||
|
<div class="tab-pane" data-bind="css:{'active':$root.sluggy() == slug}">
|
||||||
|
<?php $this->load->view('reports/monthlyemployeehours/employee_view'); ?>
|
||||||
|
</div>
|
||||||
|
<!-- /ko -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -68,6 +68,7 @@
|
|||||||
<script src="js/lib/modules/projects/offersModule.js?version=<?= $this->version ?>"></script>
|
<script src="js/lib/modules/projects/offersModule.js?version=<?= $this->version ?>"></script>
|
||||||
<script src="js/lib/modules/projects/projectsModule.js?version=<?= $this->version ?>"></script>
|
<script src="js/lib/modules/projects/projectsModule.js?version=<?= $this->version ?>"></script>
|
||||||
<script src="js/lib/modules/projects/employeehoursModule.js?version=<?= $this->version ?>"></script>
|
<script src="js/lib/modules/projects/employeehoursModule.js?version=<?= $this->version ?>"></script>
|
||||||
|
<script src="js/lib/modules/reports/monthlyEmployeeHoursModule.js?version=<?= $this->version ?>"></script>
|
||||||
|
|
||||||
<!-- ***********MODALS************* -->
|
<!-- ***********MODALS************* -->
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<ul data-bind="foreach: myData">
|
||||||
|
<li data-bind="text:test">text</li>
|
||||||
|
</ul>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<h1>EURO'S</h1>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<h1>hours</h1>
|
||||||
@@ -21,6 +21,13 @@ dbo.userDataService = {
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getUniqueProjectEmployees:function(callback){
|
||||||
|
$.post('index.php/beheer/usersController/getUniqueprojectEmployees', 'json')
|
||||||
|
.done(function(data){
|
||||||
|
callback(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
checkUsername: function ( username, callback ) {
|
checkUsername: function ( username, callback ) {
|
||||||
$.post( 'index.php/beheer/userController/checkUsername', 'json' )
|
$.post( 'index.php/beheer/userController/checkUsername', 'json' )
|
||||||
.done( function ( data ) {
|
.done( function ( data ) {
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/**
|
||||||
|
* Created by Pensare Software.
|
||||||
|
* User: Theo Weijmer
|
||||||
|
* Date: 08/02/2018
|
||||||
|
* Time: 15:32
|
||||||
|
*/
|
||||||
|
|
||||||
|
dbo.monthlyemployeehoursInit = function () {
|
||||||
|
|
||||||
|
if ( dbo.monthlyEmployeeHoursModel !== undefined ) {
|
||||||
|
|
||||||
|
dbo.monthlyEmployeeHoursModel.initModule();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
dbo.monthlyEmployeeHoursModel = {
|
||||||
|
|
||||||
|
uniqueEmployees: ko.observableArray( [] ),
|
||||||
|
sluggy : ko.observable( 'euro' ),
|
||||||
|
|
||||||
|
init: function () {
|
||||||
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
|
vm.initModule();
|
||||||
|
},
|
||||||
|
|
||||||
|
initModule: function () {
|
||||||
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
|
||||||
|
vm.uniqueEmployees.removeAll();
|
||||||
|
$.each( data, function ( i, p ) {
|
||||||
|
vm.uniqueEmployees.push(new vm.UniqueEmployee(p) )
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
|
setActivetab: function ( tab ) {
|
||||||
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
|
||||||
|
vm.sluggy( tab );
|
||||||
|
},
|
||||||
|
|
||||||
|
UniqueEmployee : function(data){
|
||||||
|
var vm = dbo.monthlyEmployeeHoursModel;
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
self.id = data.id;
|
||||||
|
self.fullname = data.fullname;
|
||||||
|
self.slug = data.slug;
|
||||||
|
|
||||||
|
self.myData = ko.observableArray([]);
|
||||||
|
|
||||||
|
for(var i=1; i<5; i++){
|
||||||
|
self.myData.push( new vm.Detail(data.fullname));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
Detail : function(data){
|
||||||
|
console.log( data );
|
||||||
|
this.test = data;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
dbo.monthlyEmployeeHoursModel.init();
|
||||||
|
|
||||||
|
ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user