Minor bug fixes rendering services and invoicing
This commit is contained in:
@@ -37,16 +37,16 @@ class Service extends Model
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'order_info'=>'array',
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'date_last_invoice',
|
||||
'date_next_invoice',
|
||||
'date_start',
|
||||
'date_end',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'order_info'=>'array',
|
||||
];
|
||||
public $dateFormat = 'U';
|
||||
|
||||
protected $table = 'ab_service';
|
||||
@@ -334,7 +334,7 @@ class Service extends Model
|
||||
? $last->addDay()
|
||||
: ($this->date_next_invoice ? $this->date_next_invoice->clone() : Carbon::now());
|
||||
|
||||
return $date;
|
||||
return request()->wantsJson() ? $date->format('Y-m-d') : $date;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -803,7 +803,9 @@ class Service extends Model
|
||||
}
|
||||
|
||||
// If the service is active, there will be service charges
|
||||
if ($this->active OR $this->isPending()) {
|
||||
if ((! $this->invoice_items->filter(function($item) { return $item->item_type==0 AND ! $item->exists; })->sum('total'))
|
||||
AND ($this->active OR $this->isPending()))
|
||||
{
|
||||
do {
|
||||
$o = new InvoiceItem;
|
||||
$o->active = TRUE;
|
||||
|
Reference in New Issue
Block a user