diuversen opmerkingen 19062018

This commit is contained in:
2018-07-14 16:56:42 +02:00
parent 124be78a85
commit cecbfd83fb
20 changed files with 266 additions and 67 deletions
+1 -1
View File
@@ -132,4 +132,4 @@ $autoload['language'] = array();
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = ['beheer/User_model'];
$autoload['model'] = ['beheer/User_model', ];
@@ -0,0 +1,36 @@
<?php
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 20/06/2018
* Time: 14:16
*/
class AuthorisationController 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 getRoleAuthorisations()
{
$roleAuthorisations = Role::getPagesAccessByRole();
return $roleAuthorisations;
}
}
@@ -81,4 +81,11 @@ class ReportsController extends MY_Controller {
$this->json( $result );
}
public function saveCurrentFinnacialYear( $projectID )
{
$amount = $this->input->post( 'amount' );
Project::whereId( $projectID )->update( ['current_financial_year' => $amount] );
}
}
@@ -18,6 +18,7 @@ class Recapprojects {
private $employeeBudget;
private $uniqueEmployee;
private $uniqueEmployees;
private $currentFinancialYear;
private $projectEmployeeDetail;
private $projectEmployeeDetails;
@@ -81,6 +82,8 @@ class Recapprojects {
$this->setWorkInProgress();
$this->setCurrentFinancialYear();
$this->index ++;
}
}
@@ -223,6 +226,11 @@ class Recapprojects {
$this->projects[ $this->index ]['workInProgress'] = 0;
}
private function setCurrentFinancialYear()
{
$this->currentFinancialYear = $this->project['current_financial_year'];
}
private function setInvoicedYears()
{
foreach ( $this->projects as $this->project )
+9
View File
@@ -44,5 +44,14 @@ class Page extends Eloquent {
return $appPages;
}
public static function getPageAccessByRoleLevel( $roleLevel )
{
self::selectRaw( "
IF(id = page_id, 'MAIN', 'SUB') AS typepage,
IF((SELECT {$roleLevel} & pagelevel ) = 0, 'F', 'T') AS pageaccess" )
->orderByRaw( "id, IF(id = page_id, 0, 1)" )
->get();
}
}
+1 -1
View File
@@ -92,7 +92,7 @@ class Project extends BaseModel {
public static function getActiveProjects()
{
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber,
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, current_financial_year,
projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
->join( 'customers AS CUS', 'CUS.id', '=', 'projects.customer_id' )
->join( 'offers AS OFF', 'OFF.project_id', '=', 'projects.id' )
+14
View File
@@ -42,5 +42,19 @@ class Role extends BaseModel {
return $roleHierarchy;
}
public static function getPagesAccessByRole()
{
$roles = self::all();
foreach ( $roles as $role )
{
$pageroles[ $role->id ]['rolelevel'] = $role->rolelevel;
$pageroles[ $role->id ]['rolename'] = $role->rolename;
$pageroles[ $role->id ]['pagesAccess'] =
Page::getPageAccessByRoleLevel( $role->rolelevel );
}
}
}
+3 -3
View File
@@ -152,7 +152,7 @@
event:{keyup:validateNumber}">
</div>
<small>
eigen omzet (excl btw)
Eigen tarief omzet (excl btw)
</small>
</div>
<div class="col-md-4">
@@ -167,13 +167,13 @@
event:{keyup:validateNumber}">
</div>
<small>
overige omzet (excl btw)
Overige kosten (excl btw)
</small>
</div>
</div>
<div class="form-group row">
<label class="col-md-3 control-label">
kosten derden
&nbsp
</label>
<div class="col-md-4">
<div class="input-group input-group-icon">
@@ -103,21 +103,21 @@
</h3>
</div>
<div class="panel-body panel-body-project">
<label class="col-md-6 col-form-label">eigen omzet(excl.btw)</label>
<label class="col-md-6 col-form-label">Eigen tarief omzet(excl.btw)</label>
<div class="col-md-6">
<h4 class="form-control-label">
<i class="icon fa-euro"> </i><span class="euro-amount" data-bind="text:ownRevenue"></span>
</h4>
</div>
<div class="divider"></div>
<label class="col-md-6 col-form-label">overige omzet(excl.btw)</label>
<label class="col-md-6 col-form-label">Overige kosten(excl.btw)</label>
<div class="col-md-6">
<h4 class="form-control-label">
<i class="icon fa-euro"> </i><span class="euro-amount" data-bind="text:otherRevenue"></span>
</h4>
</div>
<div class="divider"></div>
<label class="col-md-6 col-form-label">kosten(excl.btw)</label>
<label class="col-md-6 col-form-label">Kosten derden(excl.btw)</label>
<div class="col-md-6">
<h4 class="form-control-label">
<i class="icon fa-euro"> </i><span class="euro-amount" data-bind="text:costs"></span>
@@ -0,0 +1,28 @@
<div class="AUTHORISATION">
<div class="row">
<div class="col-xs-12">
<table class="table table-condensed">
<thead>
<tr>
<th>rol</th>
<!-- ko foreach:roles -->
<th>
<span data-bind="text:rolename"></span>
</th>
<!-- /ko -->
</tr>
</thead>
<tbody>
<td>
<span data-bind="text:pagename"></span>
</td>
<!-- ko foreach:roles -->
<th>
<span data-bind="text:rolename"></span>
</th>
<!-- /ko -->
</tbody>
</table>
</div>
</div>
</div>
+3 -3
View File
@@ -5,9 +5,9 @@
<th class="table-tealish-header">projectleider</th>
<th class="table-tealish-header">klant</th>
<th class="table-tealish-header">start</th>
<th class="table-tealish-header align-right">eigen omzet</th>
<th class="table-tealish-header align-right">overige omzet</th>
<th class="table-tealish-header align-right">kosten</th>
<th class="table-tealish-header align-right">eigen tarief omzet</th>
<th class="table-tealish-header align-right">overige kosten</th>
<th class="table-tealish-header align-right">Kosten derden</th>
<th class="table-tealish-header align-right">totaal</th>
<th class="table-tealish-header">&nbsp;</th>
</tr>
+2
View File
@@ -29,6 +29,7 @@
<script src="js/lib/modules/beheer/customersModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/beheer/externalsModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/beheer/vatModule.js?version=<?= $this->version ?>"></script>
<script src="js/lib/modules/beheer/authorisationModule.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/employeehoursModule.js?version=<?= $this->version ?>"></script>
@@ -67,6 +68,7 @@
<script src="js/lib/dataservices/invoiceDataService.js"></script>
<script src="js/lib/dataservices/reservationsDataService.js"></script>
<script src="js/lib/dataservices/employeeTargetDataService.js"></script>
<script src="js/lib/dataservices/authorisationDataService.js"></script>
<script src="js/lib/services/chartService.js"></script>
@@ -7,9 +7,6 @@
<th class="rotate">
<div><span>instroom</span></div>
</th>
<th class="rotate">
<div><span>uitstroom</span></div>
</th>
<th class="rotate">
<div><span>naam</span></div>
</th>
@@ -39,18 +36,18 @@
<th class="rotate">
<div><span>OWP</span></div>
</th>
<!-- ko foreach: uniqueYears -->
<th class="rotate">
<div><span data-bind="text:year"></span></div>
<div><span>Lopend boekjaar</span></div>
</th>
<th class="rotate">
<div><span>Volgend boekjaar</span></div>
</th>
<!-- /ko -->
</tr>
</thead>
<tbody data-bind="foreach:recap">
<tr>
<td><span data-bind="text:projectnumber"></span></td>
<td><span data-bind="text:instroom"></span></td>
<td><span data-bind="text:uitstroom ? uitstroom : ''"></span></td>
<td><span data-bind="text:projectname"></span></td>
<td><span data-bind="text:name"></span></td>
<!-- ko foreach: employees -->
@@ -70,25 +67,20 @@
<th class="align-right">
<span data-bind="text:owp"></span>
</th>
<!-- <td class="align-right">-->
<!-- <span data-bind="text:externCosts"></span>-->
<!-- </td>-->
<!-- <th class="align-right">-->
<!-- <span data-bind="text:saldo"></span>-->
<!-- </th>-->
<!-- <th class="align-right">-->
<!-- <span data-bind="text:workInProgress"></span>-->
<!-- </th>-->
<!-- ko foreach:invoiced -->
<th class="align-right">
<span data-bind="text:invoiced"></span>
</th>
<!-- /ko -->
<td width="100px">
<input class="form-control form-control-xsm align-right"
data-bind="textInput:currentFinancialYear,
event:{keyup:$root.saveCurrentFinancialYear},
css:{'red-border': ! pristine()}"/>
</td>
<td class="align-right">
<span data-bind="text:nextFinancialYears"></span>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="align-right" colspan="5">totaal</th>
<th class="align-right" colspan="4">totaal</th>
<!-- ko foreach: totalPerEmployee -->
<th class="align-right">
<span data-bind="text:totalRevenue"></span>
@@ -106,39 +98,13 @@
<th class="align-right">
<span data-bind="text:totalOwp"></span>
</th>
<!-- <th class="align-right">-->
<!-- <span data-bind="text:totalCosts"></span>-->
<!-- </th>-->
<!-- <th class="align-right">-->
<!-- <span data-bind="text:totalSaldo"></span>-->
<!-- </th>-->
<!-- <th class="align-right">-->
<!-- <span data-bind="text:totalWorkInProgress"></span>-->
<!-- </th>-->
<!-- ko foreach:totalInvoicedYear -->
<th class="align-right">
<span data-bind="text:totalInvoiced"></span>
<span data-bind="text:totalCurrentFinancialYear"></span>
</th>
<th class="align-right">
<span data-bind="text:totalNextFinancialYear"></span>
</th>
<!-- /ko -->
</tr>
</tfoot>
</table>
<!--<div class="row">-->
<!-- <div class="col-md-3">-->
<!-- <div class="graph-holder" style="min-height:350px">-->
<!-- <canvas id="recap-revenues" width="300px"></canvas>-->
<!-- <div id="recap-revenues-legends"></div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="col-md-3">-->
<!-- <div class="graph-holder" style="min-height:350px">-->
<!-- <canvas id="recap-revenues-project" width="300px"></canvas>-->
<!-- <div id="recap-revenues-project-legends"></div>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="col-md-6">-->
<!-- <div class="graph-holder" style="min-height:350px">-->
<!-- <canvas id="recap-owh" width="300px"></canvas>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
+7
View File
@@ -1,3 +1,6 @@
/* @override
http://dbois.local/css/correction.css?* */
body{
padding-top:0;
/*font-size:12px;*/
@@ -58,3 +61,7 @@ body{
color: #000;
}
.form-control-xsm {
padding: 0px 3px;
}
+4
View File
@@ -111,6 +111,10 @@ th.focus-green{
border-bottom: 1px solid red !important;
}
.red-border{
border: 2px solid red !important;
}
/*********SWITCH************/
.onoffswitch {
position: relative;
@@ -0,0 +1,20 @@
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 20/06/2018
* Time: 14:15
*/
dbo.authorisationDataService = {
getRoleAuthorisations: function ( callback ) {
$.getJSON( 'index.php/beheer/AuthorisationController/getRoleAuthorisations' )
.done( function ( data ) {
callback( data );
} );
}
}
@@ -8,14 +8,14 @@
dbo.employeeTargetDataService = {
getEmployeeTargets: function ( employeeID, callback ) {
$.getJSON( 'index.php/beheer/employeetargetController/getEmployeeTargets/' + employeeID )
$.getJSON( 'index.php/beheer/employeeTargetController/getEmployeeTargets/' + employeeID )
.done( function ( data ) {
callback( data );
} );
},
saveEmployeeTarget: function ( submitDATA, callback ) {
$.post( 'index.php/beheer/employeetargetController/saveEmployeeTarget', submitDATA, function () {
$.post( 'index.php/beheer/employeeTargetController/saveEmployeeTarget', submitDATA, function () {
}, 'json' )
.done( function ( data ) {
callback( data );
@@ -27,6 +27,13 @@ dbo.reportsDataService = {
.done( function ( data ) {
callback( data );
} );
},
saveCurrentFinnacialYear: function(projectID, amount, callback){
$.post( 'index.php/reports/reportsController/saveCurrentFinnacialYear/' + projectID, {amount:amount} )
.done( function ( data ) {
callback( data );
}, 'json' );
}
}
@@ -0,0 +1,37 @@
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 20/06/2018
* Time: 14:11
*/
dbo.authorisationInit = function () {
if ( dbo.authorisationModel !== undefined ) {
} else {
dbo.authorisationModel = {
roles : ko.observableArray([]) ,
init: function () {
var self = dbo.authorisationModel;
self.refreshPageAuthorisations();
},
refreshPageAuthorisations: function () {
dbo.authorisationDataService.getRoleAuthorisations( function ( data ) {
console.log( data );
} );
}
};
dbo.authorisationModel.init();
ko.applyBindings( dbo.authorisationModel, document.getElementById( 'AUTHORISATION' ) );
}
};
@@ -35,6 +35,8 @@ dbo.monthlyemployeehoursInit = function () {
totalSaldo : ko.observable(),
totalOwp : ko.observable(),
totalWorkInProgress : ko.observable(),
totalCurrentFinancialYear : ko.observable(),
totalNextFinancialYear : ko.observable(),
totalInvoicedYear : ko.observableArray( [] ),
validYear : ko.observable( true ),
@@ -62,6 +64,8 @@ dbo.monthlyemployeehoursInit = function () {
vm.totalEmployeeHours( 0 );
vm.totalEmployeeAvailableHours( 0 );
vm.totalOwp( 0 );
vm.totalCurrentFinancialYear( 0 );
vm.totalNextFinancialYear( 0 );
vm.totalPerEmployee.removeAll();
vm.totalInvoicedYear.removeAll();
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
@@ -300,6 +304,7 @@ dbo.monthlyemployeehoursInit = function () {
var vm = dbo.monthlyEmployeeHoursModel;
var self = this;
self.projectID = data.id
self.projectnumber = data.projectnumber;
self.instroom = data.instroom;
self.uitstroom = data.uitstroom;
@@ -309,7 +314,14 @@ dbo.monthlyemployeehoursInit = function () {
self.hours = data.hours;
self.totalEmpoloyeeRevenues = 0;
self.availableRevenue = data.own_revenue - data.projectEuros;
self.owp = self.availableRevenue < 0 ? 0 : self.availableRevenue;
self.owpNumber = self.availableRevenue < 0 ? 0 : self.availableRevenue;
self.owp = self.owpNumber;
self.currentFinancialYear = ko.observable( data.current_financial_year );
self.pristine = ko.observable( true );
self.nextFinancialYears = ko.pureComputed( function () {
return dbo.helpers.thousandSeparator( Number( self.owpNumber ) - Number( self.currentFinancialYear() ) );
} );
self.externCosts = dbo.helpers.thousandSeparator( data.projectcosts );
self.budget = dbo.helpers.thousandSeparator( data.budget );
self.ownRevenue = dbo.helpers.thousandSeparator( data.own_revenue );
@@ -393,11 +405,53 @@ dbo.monthlyemployeehoursInit = function () {
this.hours = data.hours;
this.budget = data.budget;
this.availableHours = data.availableHours;
},
saveCurrentFinancialYear: function () {
var self = this;
self.pristine( false );
self.currentFinancialYear( dbo.helpers.validateNumber( self.currentFinancialYear() ) );
if ( timeout ) {
clearTimeout( timeout );
timeout = null;
}
timeout = setTimeout( function () {
if ( self.currentFinancialYear().length == 0 ) self.currentFinancialYear( 0 );
dbo.reportsDataService.saveCurrentFinnacialYear(
self.projectID, self.currentFinancialYear(), function () {
self.pristine( true );
} );
}, 400 );
}
};
dbo.monthlyEmployeeHoursModel.init();
dbo.monthlyEmployeeHoursModel.totalCurrentFinancialYear = ko.pureComputed( function () {
var totalCurrentFinancialYear = 0
var vm = dbo.monthlyEmployeeHoursModel;
_.each( vm.recap(), function ( p ) {
totalCurrentFinancialYear += Number( p.currentFinancialYear() );
} );
return dbo.helpers.thousandSeparator( totalCurrentFinancialYear );
} );
dbo.monthlyEmployeeHoursModel.totalNextFinancialYear = ko.pureComputed( function () {
var totalNextFinancialYear = 0
var vm = dbo.monthlyEmployeeHoursModel;
_.each( vm.recap(), function ( p ) {
totalNextFinancialYear += Number( p.owpNumber ) - Number( p.currentFinancialYear() );
} );
return dbo.helpers.thousandSeparator( totalNextFinancialYear );
} );
ko.applyBindings( dbo.monthlyEmployeeHoursModel, document.getElementById( "MONTHLYEMPLOYEEHOURS" ) );
}