Diverse aanpassing nav mail Peter

This commit is contained in:
2019-02-22 14:19:03 +01:00
parent d71692f320
commit 695f6c6960
23 changed files with 295 additions and 79 deletions
+17 -1
View File
@@ -27,7 +27,7 @@ class Projecthour extends BaseModel {
public static function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
{
$projectHours = ProjecthoursPerEmployeePerMonth::fire($employeeID, $year);
$projectHours = ProjecthoursPerEmployeePerMonth::fire( $employeeID, $year );
return $projectHours;
}
@@ -61,5 +61,21 @@ class Projecthour extends BaseModel {
Projecthour::whereId( $projecthourID )->delete();
}
public static function getTotalHoursPerProject( $projectID )
{
$totalProjecthours =
self::selectRaw( "CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname,
SUM(IF(hourtype_id = 1, hours, 0)) AS declarable,
SUM(IF(hourtype_id = 1, hours * tarif, 0)) AS revenues,
SUM(IF(hourtype_id != 1, hours, 0)) AS nondeclarable" )
->join( 'projectemployees AS PRE', 'PRE.id', '=', 'projecthours.projectemployee_id' )
->join( 'users AS USR', 'USR.id', '=', 'PRE.user_id' )
->groupBy( 'USR.id' )
->where( 'PRE.project_id', '=', $projectID )
->get();
return $totalProjecthours;
}
}