Invoice rendering for service, and unit testing for Invoice Item quantity

This commit is contained in:
Deon George
2020-02-06 18:31:43 +09:00
parent 5f5d114f42
commit ebd4367975
14 changed files with 541 additions and 236 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Leenooks\Carbon;
class InvoiceItem extends Model
{
@@ -36,6 +37,36 @@ class InvoiceItem extends Model
/** ATTRIBUTES **/
/**
* Start date for the invoice item line
*
* We need cast this value to a Leenooks\Carbon for access to startOfHalf() endOfHalf() methods
*
* @param $value
* @return Carbon
* @throws \Exception
*/
public function getDateStartAttribute($value)
{
if (! is_null($value))
return Carbon::createFromTimestamp($value);
}
/**
* End date for the invoice item line
*
* We need cast this value to a Leenooks\Carbon for access to startOfHalf() endOfHalf() methods
*
* @param $value
* @return Carbon
* @throws \Exception
*/
public function getDateStopAttribute($value)
{
if (! is_null($value))
return Carbon::createFromTimestamp($value);
}
public function getItemTypeNameAttribute()
{
$types = [