Files
dbois/application/controllers/reports/ReportsController.php
T
2018-03-07 19:45:31 +01:00

79 lines
1.6 KiB
PHP

<?php
defined( 'BASEPATH' ) OR exit( 'No direct script access allowed' );
/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 08/02/2018
* Time: 15:16
*/
class ReportsController 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 recapProjects()
{
$recapprojects = new Recapprojects();
$projects = $recapprojects->getProjects();
$this->json( $projects );
}
public function getMonthlyEmployeeHoursPerProject( $employeeID, $year )
{
$monthlyhours = Projecthour::getMonthlyEmployeeHoursPerProject( $employeeID, $year );
$this->json( $monthlyhours );
}
public function getMonthlyEmployeehours( $month, $year )
{
$sql = QEmployeeHours::fire( $month, $year );
$query = $this->db->query( $sql );
$result = $query->result();
$this->json( $result );
}
public function getInvoiceOverview( $year )
{
$sql = Qinvoiceoverview::fire( $year );
$query = $this->db->query( $sql );
$result = $query->result();
foreach ( $result as $project )
{
$sql = QinvoiceMonthOverview::fire( $project->id, $year );
$query = $this->db->query( $sql );
$months = $query->result();
$project->months = $months;
}
$this->json( $result );
}
}