Fix invoice creation with charges. Fix including discounts in invoices

This commit is contained in:
Deon George 2021-12-16 11:55:59 +11:00
parent 8a8e299c7b
commit 48a76bacb6
2 changed files with 3 additions and 3 deletions

View File

@ -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'));
}
}

View File

@ -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);
}
/**