refs #1408 Fixed invoice total discount feature..

This commit is contained in:
Cüneyt Şentürk
2020-04-20 03:42:13 +03:00
parent 024c70da84
commit e3240fa43b
7 changed files with 44 additions and 4 deletions

View File

@ -117,6 +117,31 @@ class InvoiceItem extends Model
return $text;
}
/**
* Get the formatted discount.
*
* @return string
*/
public function getDiscountRateAttribute($value = 0)
{
$discount_rate = 0;
switch (setting('localisation.discount_location', 'total')) {
case 'no':
case 'total':
$discount_rate = 0;
break;
case 'item':
$discount_rate = $value;
break;
case 'both':
$discount_rate = $value;
break;
}
return $discount_rate;
}
/**
* Convert tax to Array.
*