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
@@ -70,6 +70,7 @@ class EmployeeHoursController extends MY_Controller {
}
elseif ( $hourType == 'OFFERS' )
{
$data['projectemployee_id'] = $data['employee_id'];
unset( $data['employee_id'] );
$data['hourtype_id'] = $data['hourtype_id'] - 8;
@@ -27,14 +27,14 @@ class ProjectsController extends MY_Controller {
}
public function getAllProjects( )
public function getAllProjects()
{
$archive = $this->clean_input( 'archive' );
$search = $this->clean_input( 'search' );
$order = $this->clean_input( 'order' );
$direction = $this->clean_input( 'direction' );
$projects = Project::getAllProjects( $archive, $search, $order, $direction );
$projects = Project::getAllProjects( $archive, $search, $order, $direction );
$this->json( $projects );
}
@@ -46,6 +46,9 @@ class ProjectsController extends MY_Controller {
$project->invoiceDetails =
$this->Invoices_model->getOutstandingPerProject( $project->id );
$project->hourTotals =
Projecthour::getTotalHoursPerProject( $project->id );
$this->json( $project );
}
@@ -27,9 +27,9 @@ class ReportsController extends MY_Controller {
}
public function recapProjects()
public function recapProjects( $archive )
{
$recapprojects = new Recapprojects();
$recapprojects = new Recapprojects( $archive );
$projects = $recapprojects->getProjects();
@@ -51,17 +51,17 @@ class ReportsController extends MY_Controller {
$result = $query->result();
foreach($result as $user)
foreach ( $result as $user )
{
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month);
$user->targethours = Employeetarget::getTargetHoursPerEmployee( $user->user_id, $year, $month );
}
$this->json( $result );
}
public function getInvoiceOverview( $year = FALSE )
public function getInvoiceOverview( $year = FALSE, $orderType, $orderDirection, $archive )
{
$invoices = new Invoices( $year );
$invoices = new Invoices( $year, $orderType, $orderDirection, $archive );
$invoiceReport = $invoices->getInvoiceReport();
@@ -74,7 +74,7 @@ class ReportsController extends MY_Controller {
$invoiceReport = $invoices->getInvoiceReport();
new InvoiceSpreadsheet($invoiceReport);
new InvoiceSpreadsheet( $invoiceReport );
}
public function saveCurrentFinnacialYear( $projectID )
+1 -1
View File
@@ -16,7 +16,7 @@ class MY_Controller extends CI_Controller {
{
parent::__construct();
$this->version = '1.00.00';
$this->version = '1.00.01';
$this->load->library( 'beheer/session/RetrieveUserSession' );
@@ -10,6 +10,7 @@ class Recapprojects {
private $ci;
private $index;
private $archive;
private $project;
private $projects;
private $employeeHours;
@@ -22,10 +23,12 @@ class Recapprojects {
private $projectEmployeeDetail;
private $projectEmployeeDetails;
public function __construct()
public function __construct( $archive )
{
$this->ci =& get_instance();
$this->archive = $archive;
$this->ci->load->Model( 'projects/Invoices_model' );
$this->handle();
@@ -51,7 +54,7 @@ class Recapprojects {
private function setProjects()
{
$this->projects = Project::getActiveProjects()->toArray();
$this->projects = Project::getActiveProjects( $this->archive )->toArray();
}
private function setUniqueEmployees()
@@ -222,8 +225,8 @@ class Recapprojects {
$this->projects[ $this->index ]['projectcosts'] -
$this->projects[ $this->index ]['totalInvoiced'];
if( $this->projects[ $this->index ]['workInProgress'] < 0 )
$this->projects[ $this->index ]['workInProgress'] = 0;
if ( $this->projects[ $this->index ]['workInProgress'] < 0 )
$this->projects[ $this->index ]['workInProgress'] = 0;
}
private function setCurrentFinancialYear()
@@ -19,6 +19,7 @@ class InvoiceOverview {
private $invoicesTotal;
private $needInvoice;
private $projectDetails;
private $projectnumber;
public function __construct( $project, $year )
{
@@ -41,6 +42,8 @@ class InvoiceOverview {
private function handle()
{
$this->setProjectnumber();
$this->setProjectname();
$this->setCustomer();
@@ -60,9 +63,14 @@ class InvoiceOverview {
$this->setProjectDetails();
}
private function setProjectnumber()
{
$this->projectnumber = $this->project->projectnumber;
}
private function setProjectname()
{
$this->projectname = $this->project->projectname . '(' . $this->project->projectnumber . ')';
$this->projectname = $this->project->projectname;
}
private function setCustomer()
@@ -111,6 +119,7 @@ class InvoiceOverview {
private function setProjectDetails()
{
$this->projectDetails = [
'projectnumber' => $this->projectnumber,
'projectname' => $this->projectname,
'customer' => $this->customer,
'totalToInvoicingExcl' => number_format( $this->totalToInvoicingExcl, 0, ',', '.' ),
@@ -20,10 +20,16 @@ class Invoices {
private $invoiceForecasts;
private $invoiceOverviews = [];
private $invoiceReport = [];
private $orderType;
private $orderDirection;
private $archive;
public function __construct( $year )
public function __construct( $year, $orderType, $orderDirection, $archive )
{
$this->year = $year;
$this->orderType = $orderType;
$this->orderDirection = $orderDirection;
$this->archive = $archive;
$this->handle();
}
@@ -44,7 +50,8 @@ class Invoices {
private function setProjects()
{
$this->projects = Project::getProjectsForReport();
$this->projects =
Project::getProjectsForReport( $this->orderType, $this->orderDirection, $this->archive );
}
private function loopProjects()
+21 -14
View File
@@ -48,7 +48,7 @@ class Project extends BaseModel {
public function vat()
{
return $this->belongsTo('Vat');
return $this->belongsTo( 'Vat' );
}
public function projectleader()
@@ -65,11 +65,11 @@ class Project extends BaseModel {
{
$projects = Project::getBaseProject();
$projects = $projects->selectRaw('projects.*')
->join('customers AS CUS', 'CUS.id', '=', 'projects.customer_id')
->join('users AS USR', 'USR.id', '=', 'projects.projectleader_id')
->where('projects.projectnumber', 'LIKE', "%{$search}%")
->orderBy($order, $direction);
$projects = $projects->selectRaw( 'projects.*' )
->join( 'customers AS CUS', 'CUS.id', '=', 'projects.customer_id' )
->join( 'users AS USR', 'USR.id', '=', 'projects.projectleader_id' )
->where( 'projects.projectnumber', 'LIKE', "%{$search}%" )
->orderBy( $order, $direction );
if ( $archive == 'F' ) $projects = $projects->where( 'projects.archive', '=', 'F' );
@@ -96,7 +96,7 @@ class Project extends BaseModel {
Project::whereId( $projectID )->delete();
}
public static function getActiveProjects()
public static function getActiveProjects($archive = 'T')
{
$projects = Project::selectRaw( "projects.id, YEAR(projects.startdate) AS instroom, YEAR(projects.enddate) AS uitstroom, projectnumber, current_financial_year,
projectname, CUS.name, OFF.own_revenue, OFF.other_revenue" )
@@ -104,15 +104,22 @@ class Project extends BaseModel {
->join( 'offers AS OFF', 'OFF.project_id', '=', 'projects.id' )
->groupBy( 'projects.id' )
->groupBy( 'OFF.own_revenue' )
->groupBy( 'OFF.other_revenue' )
->get();
->groupBy( 'OFF.other_revenue' );
if( $archive == 'F') $projects = $projects->where('projects.archive', '=', 'F');
$projects = $projects->get();
return $projects;
}
public static function getProjectsForReport()
public static function getProjectsForReport( $orderType, $orderDirection, $archive = 'F' )
{
$projects = self::getBaseProject()->get();
$projects = self::getBaseProject();
if ( $archive == 'F' ) $projects = $projects->whereArchive( 'F' );
$projects = $projects->orderBy( $orderType, $orderDirection )->get();
return $projects;
}
@@ -128,9 +135,9 @@ class Project extends BaseModel {
'projectemployees.user' => function ( $q ) {
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
}] )
->with('vat')
->with(['forecasts'])
->with(['reservations'])
->with( 'vat' )
->with( ['forecasts'] )
->with( ['reservations'] )
->with( 'projectemployees.projecthours' )
->with( 'projectcosts.external' )
->with( 'invoices.payments' )
+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;
}
}
@@ -49,7 +49,21 @@ class QEmployeeHours {
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
$sql .= "
GROUP BY PEM.user_id, MONTH(hourdate)
UNION
SELECT PH.projectemployee_id AS user_id,
MONTH(hourdate) monthID,
SUM(hours) AS projecthours,
0 AS profitablehours,
SUM(IF(hourtype_id = 3, hours, 0)) AS nonprofitablehours,
0 AS revenues,
0 AS nonprojecthours
FROM projecthours PH
WHERE YEAR(hourdate) = '{$year}' ";
if( $month != 0 ) $sql .= "AND MONTH(hourdate) = '$month' ";
$sql .= "
GROUP BY PH.projectemployee_id, MONTH(hourdate)
) AS Q1
JOIN users AS USR
ON USR.id = Q1.user_id
GROUP BY user_id ";
@@ -0,0 +1,57 @@
<div class="panel panel-bordered panel-primary panel-line">
<div class="panel-heading panel-heading-project">
<h3 class="">
projecturen
</h3>
</div>
<div class="panel-body panel-body-project">
<table class="table table-sm">
<thead>
<th class="table-cyanish-header" width="40%">
medewerker
</th>
<th class="table-cyanish-header align-right" width="20%">
niet declarabel
</th>
<th class="table-cyanish-header align-right" width="20%">
declarabel
</th>
<th class="table-cyanish-header align-right" width="20%">
omzet
</th>
</thead>
<tbody data-bind="foreach:hourTotals">
<tr>
<td>
<span data-bind="text:fullname"></span>
</td>
<td class="align-right">
<span data-bind="text:nondeclarable"></span> uur
</td>
<td class="align-right">
<span data-bind="text:declarable"></span> uur
</td>
<td class="align-right">
<span data-bind="text:revenues"></span>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="table-cyanish-header">
totaal
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:totalNonDeclarable"></span> uur
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:totalDeclarable"></span> uur
</th>
<th class="align-right table-cyanish-header">
<span data-bind="text:totalRevenueHours"></span>
</th>
</tr>
</tfoot>
</table>
</div>
</div>
+1 -1
View File
@@ -65,7 +65,7 @@
<?php $this->load->view( 'modals/partials/_projectemployees' ); ?>
</div>
<div class="col-md-7">
<?php $this->load->view( 'modals/partials/_hours' ); ?>
<?php $this->load->view( 'modals/partials/_hourTotals' ); ?>
</div>
</div>
</div>
@@ -12,6 +12,24 @@
maak spreadsheet
</button>
</div>
<div class="col-md-3">
<div class="row form-horizontal">
<label class="col-md-4 form-control-label">archief</label>
<div class="col-md-8">
<div class="onoffswitch" data-bind="click:toggleArchive">
<input type="checkbox"
name="onoffswitch"
class="onoffswitch-checkbox"
data-bind="checked:archive"
id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
@@ -8,6 +8,26 @@
<!-- <div class="invalid-feedback" data-bind="visible: ! validYear()">geen geldig jaar</div>-->
<!-- </div>-->
<!-- </div>-->
<div class="row">
<div class="col-xs-3">
<div class="row form-horizontal">
<label class="col-md-4 form-control-label">archief</label>
<div class="col-md-8">
<div class="onoffswitch" data-bind="click:toggleArchive">
<input type="checkbox"
name="onoffswitch"
class="onoffswitch-checkbox"
data-bind="checked:archive"
id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch">
<span class="onoffswitch-inner"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="nav-tabs-horizontal">
+2 -2
View File
@@ -25,7 +25,7 @@
<th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'USR.firstname')">projectleider</th>
<th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'CUS.name')">klant</th>
data-bind="click:directionOrderProjects.bind($data, 'projectname')">projectnaam</th>
<th class="table-tealish-header pointer"
data-bind="click:directionOrderProjects.bind($data, 'startdate')">start</th>
<th class="table-tealish-header align-right">eigen tarief omzet</th>
@@ -44,7 +44,7 @@
<span data-bind="text:projectleader"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:customer"></span>
<span data-bind="text:projectname, attr:{title:customer}"></span>
</td>
<td data-bind="click:$root.selectPoject" class="pointer">
<span data-bind="text:startdate"></span>
@@ -1,6 +1,13 @@
<table class="table table-condensed" style="font-size:0.8em;">
<thead>
<tr>
<th class="rotate">
<div class="pointer">
<span data-bind="click:sortList.bind($data, 'projectnumber')">
projectnummer
</span>
</div>
</th>
<th class="rotate">
<div><span>project</span></div>
</th>
@@ -30,6 +37,7 @@
<tbody>
<!-- ko foreach: invoiceOverview -->
<tr>
<td><span data-bind="text:projectnumber"></span></td>
<td><span data-bind="text:projectname"></span></td>
<td><span data-bind="text:customer"></span></td>
<td class="align-right"><span data-bind="text:totalToInvoicingExcl"></span></td>
@@ -43,7 +51,7 @@
</tbody>
<tfoot>
<tr>
<th colspan="2" class="align-right">
<th colspan="3" class="align-right">
totaal
</th>
<th class="align-right">