diversen
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 15:58
|
||||
*/
|
||||
|
||||
class Invoice extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function payments()
|
||||
{
|
||||
return $this->hasMany( 'Payment' );
|
||||
}
|
||||
|
||||
public function vat()
|
||||
{
|
||||
return $this->belongsTo( 'Vat' );
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ class Payment extends BaseModel {
|
||||
|
||||
protected $table = "payments";
|
||||
|
||||
public function offer()
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo( 'Offer' );
|
||||
return $this->belongsTo( 'Invoice' );
|
||||
}
|
||||
|
||||
public static function savePayment( $paymentID, $payment )
|
||||
|
||||
@@ -21,6 +21,16 @@ class Project extends BaseModel {
|
||||
return $this->hasMany( 'Projectemployee' );
|
||||
}
|
||||
|
||||
public function projectcosts()
|
||||
{
|
||||
return $this->hasMany( 'Projectcost' );
|
||||
}
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany( 'Invoice' );
|
||||
}
|
||||
|
||||
public function projectleader()
|
||||
{
|
||||
return $this->belongsTo( 'User', 'projectleader_id' );
|
||||
@@ -66,17 +76,16 @@ class Project extends BaseModel {
|
||||
}] )
|
||||
->with( [
|
||||
'offers' => function ( $q ) {
|
||||
$q->whereArchive( 'F' )
|
||||
->with( [
|
||||
'payments' => function ( $q ) {
|
||||
$q->selectRaw( '*' );
|
||||
}] );
|
||||
$q->whereArchive( 'F' );
|
||||
}] )
|
||||
->with( [
|
||||
'projectemployees.user' => function ( $q ) {
|
||||
$q->selectRaw( "id, CONCAT(firstname, ' ', middlename, ' ', lastname) AS fullname" );
|
||||
}] )
|
||||
->with( 'projectemployees.projecthours' )
|
||||
->with( 'projectcosts.external' )
|
||||
->with( 'invoices.payments' )
|
||||
->with( 'invoices.vat' )
|
||||
->with( 'customer' );
|
||||
|
||||
return $project;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 11:37
|
||||
*/
|
||||
|
||||
class Projectcost extends BaseModel {
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo( 'Project' );
|
||||
}
|
||||
|
||||
public function external()
|
||||
{
|
||||
return $this->belongsTo( 'External' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 23/01/2018
|
||||
* Time: 19:37
|
||||
*/
|
||||
|
||||
class Vat extends BaseModel {
|
||||
|
||||
public function invoices()
|
||||
{
|
||||
return $this->hasMany( 'Invoice' );
|
||||
}
|
||||
|
||||
public static function getVats( $archive )
|
||||
{
|
||||
if ( $archive == 'F' )
|
||||
{
|
||||
$vats = vat::whereArchive( 'F' )->get();
|
||||
}
|
||||
else
|
||||
{
|
||||
$vats = Vat::get();
|
||||
}
|
||||
|
||||
return $vats;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user