Monthly hours and revenues per employee report
This commit is contained in:
@@ -12,8 +12,10 @@ class Recapprojects {
|
||||
private $index;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $employeeHours;
|
||||
private $invoicedYears = [];
|
||||
private $projectTotals;
|
||||
private $employeeBudget;
|
||||
private $uniqueEmployee;
|
||||
private $uniqueEmployees;
|
||||
private $projectEmployeeDetail;
|
||||
@@ -95,6 +97,10 @@ class Recapprojects {
|
||||
{
|
||||
$this->setProjectEmployeeDetail();
|
||||
|
||||
$this->setEmployeeBudget();
|
||||
|
||||
$this->setEmployeeHours();
|
||||
|
||||
$this->setEmployeeDetails();
|
||||
|
||||
$this->setProjectTotals();
|
||||
@@ -111,17 +117,27 @@ class Recapprojects {
|
||||
$this->projectEmployeeDetail = FALSE;
|
||||
}
|
||||
|
||||
private function setEmployeeBudget()
|
||||
{
|
||||
$this->employeeBudget =
|
||||
is_null( $this->projectEmployeeDetail['budget'] ) ? 0 : $this->projectEmployeeDetail['budget'];
|
||||
}
|
||||
|
||||
private function setEmployeeHours()
|
||||
{
|
||||
$this->employeeHours =
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
|
||||
}
|
||||
|
||||
private function setEmployeeDetails()
|
||||
{
|
||||
$budget = is_null( $this->projectEmployeeDetail['budget'] ) ? 0 : $this->projectEmployeeDetail['budget'];
|
||||
$hours = $this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
|
||||
$this->projects[ $this->index ]['employees'][] = [
|
||||
'id' => $this->uniqueEmployee->id,
|
||||
'fullname' => $this->uniqueEmployee->fullname,
|
||||
'hours' => $hours,
|
||||
'hours' => $this->employeeHours,
|
||||
'revenues' => $this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0,
|
||||
'budget' => $budget,
|
||||
'availableHours' => $budget - $hours
|
||||
'budget' => $this->employeeBudget,
|
||||
'availableHours' => $this->employeeBudget - $this->employeeHours
|
||||
];
|
||||
}
|
||||
|
||||
@@ -131,11 +147,15 @@ class Recapprojects {
|
||||
$this->projects[ $this->index ]['projectHours'] = 0;
|
||||
if ( ! isset( $this->projects[ $this->index ]['projectEuros'] ) )
|
||||
$this->projects[ $this->index ]['projectEuros'] = 0;
|
||||
if ( ! isset( $this->projects[ $this->index ]['hoursAvailable'] ) )
|
||||
$this->projects[ $this->index ]['hoursAvailable'] = 0;
|
||||
|
||||
$this->projects[ $this->index ]['projectHours'] +=
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
|
||||
$this->projects[ $this->index ]['projectEuros'] +=
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0;
|
||||
$this->projects[ $this->index ]['hoursAvailable'] +=
|
||||
$this->employeeBudget - $this->employeeHours;
|
||||
}
|
||||
|
||||
private function setBudget()
|
||||
@@ -198,6 +218,9 @@ class Recapprojects {
|
||||
$this->projects[ $this->index ]['projectEuros'] +
|
||||
$this->projects[ $this->index ]['projectcosts'] -
|
||||
$this->projects[ $this->index ]['totalInvoiced'];
|
||||
|
||||
if( $this->projects[ $this->index ]['workInProgress'] < 0 )
|
||||
$this->projects[ $this->index ]['workInProgress'] = 0;
|
||||
}
|
||||
|
||||
private function setInvoicedYears()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">toevoegen / wijzigen externe</h5>
|
||||
<h5 class="modal-title">toevoegen / wijzigen onderaannemer</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
event:{keyup:validateNumber}">
|
||||
</div>
|
||||
<small>
|
||||
eigen omzet
|
||||
eigen omzet (excl btw)
|
||||
</small>
|
||||
</div>
|
||||
<div class="col-xl-4">
|
||||
@@ -164,7 +164,7 @@
|
||||
event:{keyup:validateNumber}">
|
||||
</div>
|
||||
<small>
|
||||
overige omzet
|
||||
overige omzet (excl btw)
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,19 +15,13 @@
|
||||
factuurdatum
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
bedrag (excl)
|
||||
bedrag (excl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
bedrag (incl)
|
||||
bedrag (incl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
openstaand
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
prognose(excl)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
prognose datum
|
||||
openstaand( incl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
btw tarief
|
||||
@@ -78,26 +72,26 @@
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(outstanding())"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind=" visible: ! inEdit()">
|
||||
<i class="icon fa-euro"></i>
|
||||
<span data-bind="text:dbo.helpers.numberWithPoints(forecastamount())"></span>
|
||||
</span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm align-right"
|
||||
paceholder="bedrag"
|
||||
data-bind="textInput:forecastamount, visible:inEdit,
|
||||
event:{change:$root.saveInvoice,keyup:$root.validateNumber.bind($data, 'forecastamount')}"/>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:forecastdate, visible:! inEdit()"></span>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="datum"
|
||||
data-bind="datepicker:{dateFormat: 'dd-mm-yy' },
|
||||
value:forecastdate, visible:inEdit,
|
||||
event:{change:$root.saveInvoice}"/>
|
||||
</td>
|
||||
<!-- <td class="align-right">-->
|
||||
<!-- <span data-bind=" visible: ! inEdit()">-->
|
||||
<!-- <i class="icon fa-euro"></i>-->
|
||||
<!-- <span data-bind="text:dbo.helpers.numberWithPoints(forecastamount())"></span>-->
|
||||
<!-- </span>-->
|
||||
<!-- <input type="text"-->
|
||||
<!-- class="form-control form-control-sm align-right"-->
|
||||
<!-- paceholder="bedrag"-->
|
||||
<!-- data-bind="textInput:forecastamount, visible:inEdit,-->
|
||||
<!-- event:{change:$root.saveInvoice,keyup:$root.validateNumber.bind($data, 'forecastamount')}"/>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="align-right">-->
|
||||
<!-- <span data-bind="text:forecastdate, visible:! inEdit()"></span>-->
|
||||
<!-- <input type="text"-->
|
||||
<!-- class="form-control form-control-sm"-->
|
||||
<!-- placeholder="datum"-->
|
||||
<!-- data-bind="datepicker:{dateFormat: 'dd-mm-yy' },-->
|
||||
<!-- value:forecastdate, visible:inEdit,-->
|
||||
<!-- event:{change:$root.saveInvoice}"/>-->
|
||||
<!-- </td>-->
|
||||
<td class="align-right">
|
||||
<span data-bind="visible:! inEdit()">
|
||||
<span data-bind="text:dbo.helpers.findArrayElement('id', 'vatrate', vat_id(), $root.vats())"></span>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<div class="panel panel-bordered panel-primary panel-line">
|
||||
<div class="panel-heading panel-heading-project">
|
||||
<h3 class="">
|
||||
inkomende facturen
|
||||
inkomende facturen (bedragen incl btw)
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body panel-body-project">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<th class="table-cyanish-header">
|
||||
externe
|
||||
onderaannemer
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
omschrijving
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
start
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
eigen omzet
|
||||
eigen omzet (excl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header align-right">
|
||||
overig omzet
|
||||
overig omzet (excl btw)
|
||||
</th>
|
||||
<th class="table-cyanish-header">
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">toevoegen / wijzigen gebruiker</h5>
|
||||
<h5 class="modal-title">toevoegen / wijzigen medewerker</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<tr>
|
||||
<td colspan="4" class="">
|
||||
<button class="btn btn-primary btn-round btn-sm" data-bind="click:newExternal">
|
||||
nieuwe externe
|
||||
nieuwe onderaannemer
|
||||
</button>
|
||||
</td>
|
||||
<td colspan="2" class="">
|
||||
|
||||
@@ -55,8 +55,29 @@
|
||||
</td>
|
||||
<!-- /ko -->
|
||||
<td class="align-right">
|
||||
<span data-bind=""></span>
|
||||
<span data-bind="text:hoursAvailable"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableHours"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeAvailableHours"></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@@ -58,8 +58,8 @@ $( function () {
|
||||
dbo.externalDataService.saveExternal( submitDATA, function ( data ) {
|
||||
if ( data.success ) {
|
||||
tellMe( {
|
||||
title : 'externe aangemaakt',
|
||||
message : 'externe is succesvol opgeslagen',
|
||||
title : 'onderaannemer aangemaakt',
|
||||
message : 'onderaannemer is succesvol opgeslagen',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.hideExternalModal();
|
||||
@@ -78,7 +78,7 @@ $( function () {
|
||||
} );
|
||||
errorMessage += '</ul>';
|
||||
tellMe( {
|
||||
title : 'fout aanmaken externe',
|
||||
title : 'fout aanmaken onderaannemer',
|
||||
message : errorMessage,
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
|
||||
@@ -62,27 +62,27 @@ dbo.externalsInit = function () {
|
||||
var self = this;
|
||||
|
||||
tellMe( {
|
||||
title : 'verwijderen externe',
|
||||
message : 'weet u zeker dat u de externe wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
title : 'verwijderen onderaannemer',
|
||||
message : 'weet u zeker dat u de onderaannemer wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
notify : true,
|
||||
noText : 'nee verwijder de externe niet',
|
||||
yesText : 'ja verwijder de externe',
|
||||
noText : 'nee verwijder de onderaannemer niet',
|
||||
yesText : 'ja verwijder de onderaannemer',
|
||||
modalClass: 'modal-warning'
|
||||
}, function ( response ) {
|
||||
if ( response ) {
|
||||
dbo.externalDataService.removeExternal( self.id, function ( data ) {
|
||||
if ( data.result ) {
|
||||
tellMe( {
|
||||
title : 'externe verwijderd',
|
||||
message : 'de externe is succesvol verwijderd',
|
||||
title : 'onderaannemer verwijderd',
|
||||
message : 'de onderaannemer is succesvol verwijderd',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.refreshExternals();
|
||||
} );
|
||||
} else {
|
||||
tellMe( {
|
||||
title : 'fout bij verwijderen externe',
|
||||
message : 'de externe kan niet worden verwijderd',
|
||||
title : 'fout bij verwijderen onderaannemer',
|
||||
message : 'de onderaannemer kan niet worden verwijderd',
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ dbo.usersInit = function () {
|
||||
var self = this;
|
||||
|
||||
tellMe( {
|
||||
title : 'verwijderen gebruiker',
|
||||
message : 'weet u zeker dat u de gebruiker wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
title : 'verwijderen medewerker',
|
||||
message : 'weet u zeker dat u de medewerker wilt verwijderen, dit kan niet ongedaan worden gemaakt',
|
||||
notify : true,
|
||||
noText : 'nee verwijder de gebruiker niet',
|
||||
yesText : 'ja verwijder de gebruiker',
|
||||
noText : 'nee verwijder de medewerker niet',
|
||||
yesText : 'ja verwijder de medewerker',
|
||||
modalClass: 'modal-warning'
|
||||
}, function ( response ) {
|
||||
console.log( response );
|
||||
@@ -81,16 +81,16 @@ dbo.usersInit = function () {
|
||||
dbo.userDataService.removeUser( self.id, function ( data ) {
|
||||
if ( data.result ) {
|
||||
tellMe( {
|
||||
title : 'gebruiker verwijderd',
|
||||
message : 'de gebruiker is succesvol verwijderd',
|
||||
title : 'medewerker verwijderd',
|
||||
message : 'de medewerker is succesvol verwijderd',
|
||||
modalClass: 'modal-success'
|
||||
}, function () {
|
||||
vm.refreshUsers();
|
||||
} );
|
||||
} else {
|
||||
tellMe( {
|
||||
title : 'fout bij verwijderen gebruiker',
|
||||
message : 'de gebruiker kan niet worden verwijderd',
|
||||
title : 'fout bij verwijderen medewerker',
|
||||
message : 'de medewerker kan niet worden verwijderd',
|
||||
modalClass: 'modal-danger'
|
||||
} );
|
||||
}
|
||||
|
||||
@@ -15,21 +15,23 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
|
||||
dbo.monthlyEmployeeHoursModel = {
|
||||
|
||||
uniqueEmployees : ko.observableArray( [] ),
|
||||
uniqueYears : ko.observableArray( [] ),
|
||||
sluggy : ko.observable( 'euro' ),
|
||||
years : ko.observableArray( [] ),
|
||||
selectedYear : ko.observable(),
|
||||
currentTab : false,
|
||||
recap : ko.observableArray( [] ),
|
||||
totalPerEmployee : ko.observableArray( [] ),
|
||||
totalEmployeeRevenues: ko.observable(),
|
||||
totalBudget : ko.observable(),
|
||||
totalCosts : ko.observable(),
|
||||
totalAvailableBudget : ko.observable(),
|
||||
totalSaldo : ko.observable(),
|
||||
totalWorkInProgress : ko.observable(),
|
||||
totalInvoicedYear : ko.observableArray( [] ),
|
||||
uniqueEmployees : ko.observableArray( [] ),
|
||||
uniqueYears : ko.observableArray( [] ),
|
||||
sluggy : ko.observable( 'euro' ),
|
||||
years : ko.observableArray( [] ),
|
||||
selectedYear : ko.observable(),
|
||||
currentTab : false,
|
||||
recap : ko.observableArray( [] ),
|
||||
totalPerEmployee : ko.observableArray( [] ),
|
||||
totalEmployeeRevenues : ko.observable(),
|
||||
totalEmployeeHours : ko.observable(),
|
||||
totalEmployeeAvailableHours: ko.observable(),
|
||||
totalBudget : ko.observable(),
|
||||
totalCosts : ko.observable(),
|
||||
totalAvailableBudget : ko.observable(),
|
||||
totalSaldo : ko.observable(),
|
||||
totalWorkInProgress : ko.observable(),
|
||||
totalInvoicedYear : ko.observableArray( [] ),
|
||||
|
||||
init: function () {
|
||||
var vm = dbo.monthlyEmployeeHoursModel;
|
||||
@@ -54,6 +56,8 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
vm.totalSaldo( 0 );
|
||||
vm.totalWorkInProgress( 0 );
|
||||
vm.totalEmployeeRevenues( 0 );
|
||||
vm.totalEmployeeHours( 0 );
|
||||
vm.totalEmployeeAvailableHours( 0 );
|
||||
vm.totalPerEmployee.removeAll();
|
||||
vm.totalInvoicedYear.removeAll();
|
||||
dbo.userDataService.getUniqueProjectEmployees( function ( data ) {
|
||||
@@ -79,6 +83,7 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
vm.totalSaldo( dbo.helpers.thousandSeparator( vm.totalSaldo() ) );
|
||||
vm.totalWorkInProgress( dbo.helpers.thousandSeparator( vm.totalWorkInProgress() ) );
|
||||
vm.totalEmployeeRevenues( dbo.helpers.thousandSeparator( vm.totalEmployeeRevenues() ) );
|
||||
vm.totalEmployeeHours( dbo.helpers.thousandSeparator( vm.totalEmployeeHours() ) );
|
||||
_.each( vm.totalPerEmployee(), function ( p ) {
|
||||
p.totalRevenue( dbo.helpers.thousandSeparator( p.totalRevenue() ) );
|
||||
} );
|
||||
@@ -112,8 +117,6 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
|
||||
if ( vm.currentTab == false ) return;
|
||||
|
||||
console.log( vm.currentTab );
|
||||
|
||||
dbo.reportsDataService.getEmployeeHours( vm.currentTab.id, vm.selectedYear(), function ( data ) {
|
||||
vm.currentTab.myData( data );
|
||||
vm.currentTab.totalJanuari( 0 );
|
||||
@@ -293,12 +296,17 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
$.each( data.employees, function ( i, p ) {
|
||||
self.employees.push( new vm.Employee( p ) );
|
||||
if ( !self.totalEmployeeRevenues ) self.totalEmployeeRevenues = 0;
|
||||
if ( !self.totalEmployeeHours ) self.totalEmployeeHours = 0;
|
||||
} );
|
||||
self.totalEmployeeRevenues = data.projectEuros;
|
||||
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
||||
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
||||
self.totalEmployeeHours = data.projectHours;
|
||||
self.hoursAvailable = data.hoursAvailable;
|
||||
vm.totalEmployeeRevenues( vm.totalEmployeeRevenues() + Number( self.totalEmployeeRevenues ) );
|
||||
vm.totalEmployeeHours( vm.totalEmployeeHours() + Number( self.totalEmployeeHours ) );
|
||||
vm.totalEmployeeAvailableHours( vm.totalEmployeeAvailableHours() + Number( self.hoursAvailable ) );
|
||||
self.totalEmployeeRevenues = dbo.helpers.thousandSeparator( self.totalEmployeeRevenues );
|
||||
self.workInProgress = dbo.helpers.thousandSeparator( data.workInProgress );
|
||||
self.hoursAvailable = data.hoursAvailable;
|
||||
|
||||
self.invoiced = ko.observableArray( [] );
|
||||
$.each( data.invoiced, function ( i, p ) {
|
||||
@@ -321,12 +329,20 @@ dbo.monthlyemployeehoursInit = function () {
|
||||
if ( vm.totalPerEmployee().length == 0 ) hasTotalEmployees = false;
|
||||
_.each( data.employees, function ( p ) {
|
||||
if ( !hasTotalEmployees ) {
|
||||
vm.totalPerEmployee.push( {id: p.id, fullname: p.fullname, totalRevenue: ko.observable( 0 )} );
|
||||
vm.totalPerEmployee.push( {
|
||||
id : p.id,
|
||||
fullname : p.fullname,
|
||||
totalRevenue : ko.observable( 0 ),
|
||||
totalHours : ko.observable( 0 ),
|
||||
totalAvailableHours: ko.observable( 0 )
|
||||
} );
|
||||
}
|
||||
var a = _.find( vm.totalPerEmployee(), function ( o ) {
|
||||
return o.id == p.id
|
||||
} );
|
||||
a.totalRevenue( a.totalRevenue() + p.revenues );
|
||||
a.totalRevenue( a.totalRevenue() + Number( p.revenues ) );
|
||||
a.totalHours( a.totalHours() + Number( p.hours ) );
|
||||
a.totalAvailableHours( a.totalAvailableHours() + Number( p.availableHours ) );
|
||||
} );
|
||||
|
||||
var hasTotalsOwpYear = true;
|
||||
|
||||
Reference in New Issue
Block a user