This commit is contained in:
denisdulici
2017-10-04 01:25:03 +03:00
parent 88e62a8354
commit bbb34ab50a
8 changed files with 133 additions and 1 deletions

View File

@ -59,6 +59,28 @@ class Item extends Model
return $this->hasMany('App\Models\Income\Invoice');
}
/**
* Convert sale price to float.
*
* @param string $value
* @return void
*/
public function setSalePriceAttribute($value)
{
$this->attributes['sale_price'] = (float) $value;
}
/**
* Convert purchase price to float.
*
* @param string $value
* @return void
*/
public function setPurchasePriceAttribute($value)
{
$this->attributes['purchase_price'] = (float) $value;
}
public function getConvertedAmount($format = false)
{
return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format);