39 lines
681 B
PHP
39 lines
681 B
PHP
<?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;
|
|
}
|
|
|
|
public static function getCurrentVat()
|
|
{
|
|
$currentVat = Vat::whereActive('T')->whereArchive('F')->first();
|
|
|
|
if( ! $currentVat) return 0;
|
|
|
|
return $currentVat->vatrate;
|
|
}
|
|
|
|
} |