diff --git a/app/Models/Charge.php b/app/Models/Charge.php index 8ea4929..994b47b 100644 --- a/app/Models/Charge.php +++ b/app/Models/Charge.php @@ -62,8 +62,8 @@ class Charge extends Model return sprintf('%s %s',$this->description,$this->getAttribute('attributes') ? join('|',unserialize($this->getAttribute('attributes'))) : ''); } - public function getTypeAttribute($value) + public function getTypeNameAttribute(): string { - return Arr::get(InvoiceItem::type,$value); + return Arr::get(InvoiceItem::type,$this->attribute('type')); } } \ No newline at end of file diff --git a/app/Models/InvoiceItem.php b/app/Models/InvoiceItem.php index bd6f302..43c87b3 100644 --- a/app/Models/InvoiceItem.php +++ b/app/Models/InvoiceItem.php @@ -160,7 +160,7 @@ class InvoiceItem extends Model */ public function getSubTotalAttribute(): float { - return sprintf('%3.2f',$this->quantity * $this->price_base); + return sprintf('%3.2f',$this->quantity * $this->price_base - $this->discount_amt); } /**