Monthly hours and revenues per employee report

This commit is contained in:
2018-03-01 10:43:58 +01:00
parent f52b3539ba
commit 50cd8d8f08
13 changed files with 138 additions and 84 deletions
@@ -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()