employeehours report
This commit is contained in:
@@ -27,6 +27,15 @@ class EmployeeHoursController extends MY_Controller {
|
||||
|
||||
}
|
||||
|
||||
public function recapProjects()
|
||||
{
|
||||
$recapprojects = new Recapprojects();
|
||||
|
||||
$projects = $recapprojects->getProjects();
|
||||
|
||||
$this->json( $projects );
|
||||
}
|
||||
|
||||
public function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
|
||||
{
|
||||
$monthlyhours = Projecthour::getMonthlyEmployeeHoursPerProject( $employeeID, $year );
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 20/02/2018
|
||||
* Time: 16:49
|
||||
*/
|
||||
|
||||
class Recapprojects {
|
||||
|
||||
private $ci;
|
||||
private $index;
|
||||
private $project;
|
||||
private $projects;
|
||||
private $invoicedYears = [];
|
||||
private $projectTotals;
|
||||
private $uniqueEmployee;
|
||||
private $uniqueEmployees;
|
||||
private $projectEmployeeDetail;
|
||||
private $projectEmployeeDetails;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->ci->load->Model( 'projects/Invoices_model' );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getProjects()
|
||||
{
|
||||
return $this->projects;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjects();
|
||||
|
||||
$this->setUniqueEmployees();
|
||||
|
||||
$this->loopProjects();
|
||||
|
||||
$this->setInvoicedYears();
|
||||
|
||||
$this->loopProjectsForInvoicedYears();
|
||||
}
|
||||
|
||||
private function setProjects()
|
||||
{
|
||||
$this->projects = Project::getActiveProjects()->toArray();
|
||||
}
|
||||
|
||||
private function setUniqueEmployees()
|
||||
{
|
||||
$this->uniqueEmployees = Projectemployee::getUniqueProjectEmployees();
|
||||
}
|
||||
|
||||
private function loopProjects()
|
||||
{
|
||||
$this->index = 0;
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
$this->projectTotals = 0;
|
||||
|
||||
$this->setProjectEmployeeDetails();
|
||||
|
||||
$this->loopUniqueEmployees();
|
||||
|
||||
$this->setBudget();
|
||||
|
||||
$this->setProjectCosts();
|
||||
|
||||
$this->setBudgetAvailable();
|
||||
|
||||
$this->setSaldo();
|
||||
|
||||
$this->setInvoiced();
|
||||
|
||||
$this->setWorkInProgress();
|
||||
|
||||
$this->index ++;
|
||||
}
|
||||
}
|
||||
|
||||
private function setProjectEmployeeDetails()
|
||||
{
|
||||
$this->projectEmployeeDetails =
|
||||
Projectemployee::getProjectemployeeDetailsPerProject( $this->project['id'] );
|
||||
}
|
||||
|
||||
private function loopUniqueEmployees()
|
||||
{
|
||||
foreach ( $this->uniqueEmployees as $this->uniqueEmployee )
|
||||
{
|
||||
$this->setProjectEmployeeDetail();
|
||||
|
||||
$this->setEmployeeDetails();
|
||||
|
||||
$this->setProjectTotals();
|
||||
}
|
||||
}
|
||||
|
||||
private function setProjectEmployeeDetail()
|
||||
{
|
||||
foreach ( $this->projectEmployeeDetails as $this->projectEmployeeDetail )
|
||||
{
|
||||
if ( $this->uniqueEmployee->id == $this->projectEmployeeDetail->id ) return;
|
||||
}
|
||||
|
||||
$this->projectEmployeeDetail = FALSE;
|
||||
}
|
||||
|
||||
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,
|
||||
'revenues' => $this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0,
|
||||
'budget' => $budget,
|
||||
'availableHours' => $budget - $hours
|
||||
];
|
||||
}
|
||||
|
||||
private function setProjectTotals()
|
||||
{
|
||||
if ( ! isset( $this->projects[ $this->index ]['projectHours'] ) )
|
||||
$this->projects[ $this->index ]['projectHours'] = 0;
|
||||
if ( ! isset( $this->projects[ $this->index ]['projectEuros'] ) )
|
||||
$this->projects[ $this->index ]['projectEuros'] = 0;
|
||||
|
||||
$this->projects[ $this->index ]['projectHours'] +=
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->hours : 0;
|
||||
$this->projects[ $this->index ]['projectEuros'] +=
|
||||
$this->projectEmployeeDetail ? $this->projectEmployeeDetail->revenues : 0;
|
||||
}
|
||||
|
||||
private function setBudget()
|
||||
{
|
||||
$this->projects[ $this->index ]['budget'] =
|
||||
round( ( $this->projects[ $this->index ]['own_revenue'] + $this->projects[ $this->index ]['other_revenue'] ), 0 );
|
||||
}
|
||||
|
||||
private function setProjectCosts()
|
||||
{
|
||||
$this->projects[ $this->index ]['projectcosts'] =
|
||||
Projectcost::getCostsPerPerProject( $this->projects[ $this->index ]['id'] );
|
||||
}
|
||||
|
||||
private function setBudgetAvailable()
|
||||
{
|
||||
$this->projects[ $this->index ]['budgetAvailable'] =
|
||||
$this->projects[ $this->index ]['budget'] - $this->projects[ $this->index ]['projectcosts'];
|
||||
}
|
||||
|
||||
private function setSaldo()
|
||||
{
|
||||
$this->projects[ $this->index ]['saldo'] =
|
||||
$this->projects[ $this->index ]['budgetAvailable'] - $this->projects[ $this->index ]['projectEuros'];
|
||||
}
|
||||
|
||||
private function setInvoiced()
|
||||
{
|
||||
$invoiced =
|
||||
$this->ci->Invoices_model->getInvoicedPerYearPerProject( $this->projects[ $this->index ]['id'] );
|
||||
|
||||
foreach ( $invoiced ? $invoiced : [] as $invoice )
|
||||
{
|
||||
$this->projects[ $this->index ]['invoiced'][] = [
|
||||
'year' => $invoice->invoiceyear,
|
||||
'invoiced' => $invoice->invoiced
|
||||
];
|
||||
|
||||
$this->setTotalInvoiced( $invoice->invoiced );
|
||||
}
|
||||
|
||||
if ( ! isset( $this->projects[ $this->index ]['invoiced'] ) )
|
||||
{
|
||||
$this->projects[ $this->index ]['invoiced'] = [];
|
||||
$this->projects[ $this->index ]['totalInvoiced'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function setTotalInvoiced( $invoiced )
|
||||
{
|
||||
if ( ! isset( $this->projects[ $this->index ]['totalInvoiced'] ) )
|
||||
$this->projects[ $this->index ]['totalInvoiced'] = 0;
|
||||
|
||||
$this->projects[ $this->index ]['totalInvoiced'] += $invoiced;
|
||||
}
|
||||
|
||||
private function setWorkInProgress()
|
||||
{
|
||||
$this->projects[ $this->index ]['workInProgress'] =
|
||||
$this->projects[ $this->index ]['projectEuros'] +
|
||||
$this->projects[ $this->index ]['projectcosts'] -
|
||||
$this->projects[ $this->index ]['totalInvoiced'];
|
||||
}
|
||||
|
||||
private function setInvoicedYears()
|
||||
{
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
foreach ( $this->project['invoiced'] as $year )
|
||||
{
|
||||
if ( in_array( $year['year'], $this->invoicedYears ) ) continue;
|
||||
|
||||
array_push( $this->invoicedYears, $year['year'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function loopProjectsForInvoicedYears()
|
||||
{
|
||||
$this->index = 0;
|
||||
|
||||
foreach ( $this->projects as $this->project )
|
||||
{
|
||||
foreach ( $this->invoicedYears as $invoiceYear )
|
||||
{
|
||||
$hasYear = FALSE;
|
||||
foreach ( $this->project['invoiced'] as $year )
|
||||
{
|
||||
if ( $invoiceYear == $year['year'] ) $hasYear = TRUE;
|
||||
}
|
||||
|
||||
if ( ! $hasYear ) $this->projects[ $this->index ]['invoiced'][] = [
|
||||
'year' => $invoiceYear,
|
||||
'invoiced' => 0
|
||||
];
|
||||
}
|
||||
usort( $this->projects[ $this->index ]['invoiced'], function ( $a, $b ) {
|
||||
return $a['year'] - $b['year'];
|
||||
} );
|
||||
$this->index ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
* Time: 15:58
|
||||
*/
|
||||
|
||||
|
||||
class Invoice extends BaseModel {
|
||||
|
||||
public function project()
|
||||
|
||||
@@ -68,6 +68,20 @@ class Project extends BaseModel {
|
||||
Project::whereId( $projectID )->delete();
|
||||
}
|
||||
|
||||
public static function getActiveProjects()
|
||||
{
|
||||
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber,
|
||||
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' )
|
||||
->groupBy( 'projects.id' )
|
||||
->groupBy( 'OFF.own_revenue' )
|
||||
->groupBy( 'OFF.other_revenue' )
|
||||
->get();
|
||||
|
||||
return $projects;
|
||||
}
|
||||
|
||||
public static function getBaseProject()
|
||||
{
|
||||
$project = Project::with( [
|
||||
|
||||
@@ -35,4 +35,13 @@ class Projectcost extends BaseModel {
|
||||
return $projectID;
|
||||
}
|
||||
|
||||
public static function getCostsPerPerProject( $projectID )
|
||||
{
|
||||
$projectCosts = Projectcost::selectraw( 'ROUND(COALESCE(SUM(costs), 0), 0) AS costs')
|
||||
->whereProjectId($projectID)
|
||||
->first();
|
||||
|
||||
return $projectCosts->costs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,29 @@ class Projectemployee extends BaseModel {
|
||||
return $availableEmployees;
|
||||
}
|
||||
|
||||
public static function getUniqueProjectEmployees()
|
||||
{
|
||||
$projectemployees = Projectemployee::selectRaw( "USR.id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" )
|
||||
->distinct()
|
||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
||||
->get();
|
||||
|
||||
return $projectemployees;
|
||||
}
|
||||
|
||||
public static function getProjectemployeeDetailsPerProject( $projectID )
|
||||
{
|
||||
$details = Projectemployee::selectRaw( 'USR.id, budget, project_id, ROUND(SUM(hours), 0) AS hours, ROUND(SUM(hours * tarif), 0) AS revenues, projectemployees.id AS projectemployeeID' )
|
||||
->join( 'users AS USR', 'USR.id', '=', 'projectemployees.user_id' )
|
||||
->join( 'projecthours AS PRH', 'PRH.projectemployee_id', '=', 'projectemployees.id' )
|
||||
->where( 'projectemployees.project_id', '=', $projectID )
|
||||
->where( 'PRH.hourtype_id', '=', 1 )
|
||||
->groupBy( 'projectemployees.id' )
|
||||
->get();
|
||||
|
||||
return $details;
|
||||
}
|
||||
|
||||
public static function createProjectEmployee( $projectID )
|
||||
{
|
||||
$projectemployee = Projectemployee::create( [
|
||||
|
||||
@@ -27,50 +27,18 @@ class Projecthour extends BaseModel {
|
||||
|
||||
public static function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
|
||||
{
|
||||
$projectHours = Projecthour::selectRaw( "
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours, 0)) AS januari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours, 0)) AS februari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours, 0)) AS maart,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours, 0)) AS april,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours, 0)) AS mei,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours, 0)) AS juni,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours, 0)) AS juli,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours, 0)) AS augustus,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours, 0)) AS september,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours, 0)) AS oktober,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours, 0)) AS november,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours, 0)) AS december,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours * tarif, 0)) AS januariRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours * tarif, 0)) AS februariRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours * tarif, 0)) AS maartRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours * tarif, 0)) AS aprilRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours * tarif, 0)) AS meiRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours * tarif, 0)) AS juniRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours * tarif, 0)) AS juliRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours * tarif, 0)) AS augustusRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours * tarif, 0)) AS septemberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours * tarif, 0)) AS oktoberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours * tarif, 0)) AS novemberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours * tarif, 0)) AS decemberRevenue,
|
||||
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours, 0)) AS totalyear,
|
||||
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours, 0)) AS totalotheryears,
|
||||
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours * tarif, 0)) AS totalyearRevenue,
|
||||
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours * tarif, 0)) AS totalotheryearsRevenue,
|
||||
SUM(projecthours.hours) AS totalhours,
|
||||
SUM(projecthours.hours * tarif) AS totalhoursRevenue,
|
||||
PEM.tarif,
|
||||
PRJ.projectname" )
|
||||
->join( 'projectemployees AS PEM', 'PEM.id', '=', 'projecthours.projectemployee_id' )
|
||||
->join( 'projects AS PRJ', 'PRJ.id', '=', 'PEM.project_id' )
|
||||
->where( 'PEM.user_id', '=', $employeeID )
|
||||
->groupBy('PRJ.id')
|
||||
->groupBy('PEM.tarif')
|
||||
->groupBy('PRJ.projectname')
|
||||
->get();
|
||||
$projectHours = ProjecthoursPerEmployeePerMonth::fire($employeeID, $year);
|
||||
|
||||
return $projectHours;
|
||||
}
|
||||
|
||||
public static function recapProjects()
|
||||
{
|
||||
$recaps = QRecapProjects::fire();
|
||||
|
||||
return $recaps;
|
||||
}
|
||||
|
||||
public static function saveProjecthour( $projecthourID, $projecthour )
|
||||
{
|
||||
$projecthour = (array) $projecthour;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 20/02/2018
|
||||
* Time: 09:36
|
||||
*/
|
||||
|
||||
class ProjecthoursPerEmployeePerMonth extends BaseModel {
|
||||
|
||||
public static function fire($employeeID, $year)
|
||||
{
|
||||
$projectHours = Projecthour::selectRaw( "
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours, 0)) AS januari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours, 0)) AS februari,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours, 0)) AS maart,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours, 0)) AS april,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours, 0)) AS mei,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours, 0)) AS juni,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours, 0)) AS juli,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours, 0)) AS augustus,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours, 0)) AS september,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours, 0)) AS oktober,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours, 0)) AS november,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours, 0)) AS december,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-1', projecthours.hours * tarif, 0)) AS januariRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-2', projecthours.hours * tarif, 0)) AS februariRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-3', projecthours.hours * tarif, 0)) AS maartRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-4', projecthours.hours * tarif, 0)) AS aprilRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-5', projecthours.hours * tarif, 0)) AS meiRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-6', projecthours.hours * tarif, 0)) AS juniRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-7', projecthours.hours * tarif, 0)) AS juliRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-8', projecthours.hours * tarif, 0)) AS augustusRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-9', projecthours.hours * tarif, 0)) AS septemberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-10', projecthours.hours * tarif, 0)) AS oktoberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-11', projecthours.hours * tarif, 0)) AS novemberRevenue,
|
||||
SUM(IF(CONCAT(YEAR(hourdate), '-', MONTH(hourdate)) = '{$year}-12', projecthours.hours * tarif, 0)) AS decemberRevenue,
|
||||
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours, 0)) AS totalyear,
|
||||
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours, 0)) AS totalotheryears,
|
||||
SUM(IF(YEAR(hourdate) = {$year},projecthours.hours * tarif, 0)) AS totalyearRevenue,
|
||||
SUM(IF(YEAR(hourdate) != {$year},projecthours.hours * tarif, 0)) AS totalotheryearsRevenue,
|
||||
SUM(projecthours.hours) AS totalhours,
|
||||
SUM(projecthours.hours * tarif) AS totalhoursRevenue,
|
||||
PEM.tarif,
|
||||
PRJ.projectname" )
|
||||
->join( 'projectemployees AS PEM', 'PEM.id', '=', 'projecthours.projectemployee_id' )
|
||||
->join( 'projects AS PRJ', 'PRJ.id', '=', 'PEM.project_id' )
|
||||
->where( 'PEM.user_id', '=', $employeeID )
|
||||
->groupBy('PRJ.id')
|
||||
->groupBy('PEM.tarif')
|
||||
->groupBy('PRJ.projectname')
|
||||
->get();
|
||||
|
||||
return $projectHours;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 20/02/2018
|
||||
* Time: 09:45
|
||||
*/
|
||||
|
||||
class QRecapProjects {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 21/02/2018
|
||||
* Time: 10:34
|
||||
*/
|
||||
|
||||
class Invoices_model extends MY_Model {
|
||||
|
||||
protected $tablename = 'invoices';
|
||||
|
||||
public function getInvoicedPerYearPerProject( $projectID )
|
||||
{
|
||||
$this->sql = "
|
||||
SELECT ROUND(COALESCE(SUM(invoiceamount), 0),0) AS invoiced, YEAR(invoicedate) AS invoiceyear
|
||||
FROM invoices
|
||||
WHERE project_id = {$projectID}
|
||||
GROUP BY YEAR(invoicedate)
|
||||
ORDER BY YEAR(invoicedate) ";
|
||||
|
||||
$invoiced = $this->get_query_result();
|
||||
|
||||
return $invoiced;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,30 @@
|
||||
<div class="MONTHLYEMPLOYEEHOURS">
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
<div class="col-xl-1">
|
||||
<label>jaar</label>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="col-xl-3">
|
||||
<select class="form-control form-control-sm"
|
||||
data-bind="options:years,
|
||||
optionsText:'year',
|
||||
optionsValue: 'id',
|
||||
value:selectedYear,
|
||||
event:{change:refreshTab}"></select>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<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')">
|
||||
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'euro')" style="z-index:10">
|
||||
<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')">
|
||||
<li class="nav-item" data-bind="click:setActivetab.bind($data, 'hours')" style="z-index:10">
|
||||
<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)">
|
||||
<li class="nav-item" data-bind="click:$root.setActivetab.bind($data, slug)" style="z-index:10">
|
||||
<a class="nav-link" data-bind="text:fullname, css:{'active':$root.sluggy() == slug}"></a>
|
||||
</li>
|
||||
<!-- /ko -->
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<script src="js/vendor/froala/js/froala_editor.min.js"></script>
|
||||
<script src="js/vendor/froala/js/plugins/knockout-froala.js"></script>
|
||||
<script src="js/vendor/Chart.js"></script>
|
||||
<script src="js/vendor/lodash.js"></script>
|
||||
|
||||
|
||||
<!--<script src="js/vendor/mousewheel/jquery.mousewheel.js"></script>-->
|
||||
|
||||
@@ -1 +1,141 @@
|
||||
<h1>EURO'S</h1>
|
||||
<table class="table" style="font-size:.8em;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
</th>
|
||||
<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>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
<div><span data-bind="text:fullname"></span></div>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="rotate">
|
||||
<div><span>totaal</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>budget (ex btw)</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>derden (ex btw)</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>beschikbaar</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>saldo</span></div>
|
||||
</th>
|
||||
<th class="rotate">
|
||||
<div><span>OWP</span></div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueYears -->
|
||||
<th class="rotate">
|
||||
<div><span data-bind="text:year"></span></div>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="rotate">
|
||||
<div><span>OWP</span></div>
|
||||
</th>
|
||||
</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 -->
|
||||
<td class="align-right">
|
||||
<span data-bind="text:revenues"></span>
|
||||
</td>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:budget"></span>
|
||||
</td>
|
||||
<td class="align-right">
|
||||
<span data-bind="text:externCosts"></span>
|
||||
</td>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:budgetAvailable"></span>
|
||||
</th>
|
||||
<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 -->
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th class="align-right" colspan="5">totaal</th>
|
||||
<!-- ko foreach: totalPerEmployee -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalRevenue"></span>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeRevenues"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalBudget"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalCosts"></span>
|
||||
</th>
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalAvailableBudget"></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>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-xl-3">
|
||||
<div class="graph-holder" style="height:100%">
|
||||
<canvas id="recap-revenues" width="300px"></canvas>
|
||||
<div id="recap-revenues-legends"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-3">
|
||||
<div class="graph-holder" style="height:100%">
|
||||
<canvas id="recap-revenues-project" width="300px"></canvas>
|
||||
<div id="recap-revenues-project-legends"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xl-6">
|
||||
<div class="graph-holder" style="height:100%">
|
||||
<canvas id="recap-owh" width="300px"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1 +1,62 @@
|
||||
<h1>hours</h1>
|
||||
<table class="table" style="font-size:.8em;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rotate">
|
||||
<div><span>projectnummer</span></div>
|
||||
</th>
|
||||
<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>
|
||||
<th class="rotate">
|
||||
<div><span>opdrachtgever</span></div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
<div><span data-bind="text:fullname + ' geschreven'"></span></div>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="rotate">
|
||||
<div><span>totaal fact. uren gerealisserd</span></div>
|
||||
</th>
|
||||
<!-- ko foreach: uniqueEmployees -->
|
||||
<th class="rotate">
|
||||
<div><span data-bind="text:fullname + ' beschikbaar'"></span></div>
|
||||
</th>
|
||||
<!-- /ko -->
|
||||
<th class="rotate">
|
||||
<div><span>totaal beschikbare uren</span></div>
|
||||
</th>
|
||||
</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 -->
|
||||
<td class="align-right">
|
||||
<span data-bind="text:hours"></span>
|
||||
</td>
|
||||
<!-- /ko -->
|
||||
<th class="align-right">
|
||||
<span data-bind="text:totalEmployeeHours"></span>
|
||||
</th>
|
||||
<!-- ko foreach: employees -->
|
||||
<td class="align-right">
|
||||
<span data-bind="text:availableHours"></span>
|
||||
</td>
|
||||
<!-- /ko -->
|
||||
<td class="align-right">
|
||||
<span data-bind=""></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user