Payment summary improvements, removed invoice/payment API calls

This commit is contained in:
Deon George
2020-07-21 17:41:24 +10:00
parent 444f2cf52d
commit c97835edd1
10 changed files with 132 additions and 185 deletions

View File

@@ -27,21 +27,6 @@ class Invoice extends Model
// Array of items that can be updated with PushNew
protected $pushable = ['items'];
protected $appends = [
'date_due',
'due',
'invoice_id_url',
'total',
];
protected $visible = [
'date_due',
'due',
'id',
'invoice_id_url',
'total',
];
protected $with = [
'account.country.currency',
'items.taxes',
@@ -97,21 +82,11 @@ class Invoice extends Model
return $this->date_orig->format('Y-m-d');
}
public function getInvoiceIdAttribute()
{
return sprintf('%06s',$this->id);
}
public function getInvoiceAccountIdAttribute()
{
return sprintf('%02s-%04s-%06s',$this->site_id,$this->account_id,$this->invoice_id);
}
public function getInvoiceIdUrlAttribute()
{
return sprintf('<a href="/u/invoice/%s">%s</a>',$this->id,$this->invoice_account_id);
}
public function getInvoiceTextAttribute()
{
return sprintf('Thank you for using %s for your Internet Services.',config('SITE_SETUP')->site_name);

View File

@@ -20,19 +20,6 @@ class Payment extends Model
protected $dateFormat = 'U';
protected $with = ['account.country.currency','items'];
protected $appends = [
'date_paid',
'payment_id_url',
'total',
];
protected $visible = [
'date_paid',
'id',
'payment_id_url',
'total',
];
public function account()
{
return $this->belongsTo(Account::class);
@@ -48,16 +35,6 @@ class Payment extends Model
return $this->date_payment->format('Y-m-d');
}
public function getPaymentIdAttribute()
{
return sprintf('%02s-%04s+%05s',$this->site_id,$this->account_id,$this->id);
}
public function getPaymentIdUrlAttribute()
{
return sprintf('<a href="/u/payment/view/%s">%s</a>',$this->id,$this->payment_id);
}
public function getTotalAttribute()
{
return sprintf('%3.'.$this->currency()->rounding.'f',$this->total_amt);