fixed invoice with discount redirect

This commit is contained in:
Denis Duliçi 2020-06-26 00:22:16 +03:00
parent a72b422e15
commit f20f5c9def

View File

@ -65,10 +65,10 @@ abstract class DocumentModel extends Model
{
$percent = 0;
$discount = $this->totals->where('code', 'discount')->pluck('amount')->first();
$discount = $this->totals->where('code', 'discount')->makeHidden('title')->pluck('amount')->first();
if ($discount) {
$sub_total = $this->totals->where('code', 'sub_total')->pluck('amount')->first();
$sub_total = $this->totals->where('code', 'sub_total')->makeHidden('title')->pluck('amount')->first();
$percent = number_format((($discount * 100) / $sub_total), 0);
}