Diverse aanpassing nav mail Peter
This commit is contained in:
@@ -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' )
|
||||
|
||||
Reference in New Issue
Block a user