Revised database drivers, query builder, and file/inflector helpers for improved consistency and functionality. Updated copyrights, links, and standardized function names including deprecating `is_countable` in favor of `word_is_countable`. Added support for new SQL features and optimized query handling.
92 lines
2.2 KiB
PHP
92 lines
2.2 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( $archive )
|
|
{
|
|
$field = $this->input->post('field');
|
|
$direction = $this->input->post('direction');
|
|
|
|
$recapprojects = new Recapprojects( $archive, $field, $direction );
|
|
|
|
$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();
|
|
|
|
foreach ( $result as $user )
|
|
{
|
|
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month );
|
|
}
|
|
|
|
$this->json( $result );
|
|
}
|
|
|
|
public function getInvoiceOverview( $year, $orderType, $orderDirection, $archive )
|
|
{
|
|
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
|
|
|
|
$invoiceReport = $invoices->getInvoiceReport();
|
|
|
|
$this->json( $invoiceReport );
|
|
}
|
|
|
|
public function createInvoicesSpreadsheet( $year, $orderType, $orderDirection, $archive )
|
|
{
|
|
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
|
|
|
|
$invoiceReport = $invoices->getInvoiceReport();
|
|
|
|
new InvoiceSpreadsheet( $invoiceReport );
|
|
}
|
|
|
|
public function saveCurrentFinnacialYear( $projectID )
|
|
{
|
|
$amount = $this->input->post( 'amount' );
|
|
|
|
Project::whereId( $projectID )->update( ['current_financial_year' => $amount] );
|
|
}
|
|
|
|
}
|