This commit is contained in:
denisdulici
2017-10-21 14:23:57 +03:00
parent 07ef2dad8a
commit 5e7d3392ab
26 changed files with 177 additions and 57 deletions

View File

@ -80,25 +80,25 @@ class Bill extends Model
}
/**
* Convert amount to float.
* Convert amount to double.
*
* @param string $value
* @return void
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = (float) $value;
$this->attributes['amount'] = (double) $value;
}
/**
* Convert currency rate to float.
* Convert currency rate to double.
*
* @param string $value
* @return void
*/
public function setCurrencyRateAttribute($value)
{
$this->attributes['currency_rate'] = (float) $value;
$this->attributes['currency_rate'] = (double) $value;
}
public function scopeDue($query, $date)

View File

@ -33,4 +33,26 @@ class BillItem extends Model
{
return $this->belongsTo('App\Models\Setting\Tax');
}
/**
* Convert price to double.
*
* @param string $value
* @return void
*/
public function setPriceAttribute($value)
{
$this->attributes['price'] = (double) $value;
}
/**
* Convert total to double.
*
* @param string $value
* @return void
*/
public function setTotalAttribute($value)
{
$this->attributes['total'] = (double) $value;
}
}

View File

@ -45,4 +45,26 @@ class BillPayment extends Model
{
return $query->orderBy('paid_at', 'desc');
}
/**
* Convert amount to double.
*
* @param string $value
* @return void
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = (double) $value;
}
/**
* Convert currency rate to double.
*
* @param string $value
* @return void
*/
public function setCurrencyRateAttribute($value)
{
$this->attributes['currency_rate'] = (double) $value;
}
}

View File

@ -22,4 +22,15 @@ class BillTotal extends Model
{
return $this->belongsTo('App\Models\Expense\Bill');
}
/**
* Convert amount to double.
*
* @param string $value
* @return void
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = (double) $value;
}
}

View File

@ -65,25 +65,25 @@ class Payment extends Model
}
/**
* Convert amount to float.
* Convert amount to double.
*
* @param string $value
* @return void
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = (float) $value;
$this->attributes['amount'] = (double) $value;
}
/**
* Convert currency rate to float.
* Convert currency rate to double.
*
* @param string $value
* @return void
*/
public function setCurrencyRateAttribute($value)
{
$this->attributes['currency_rate'] = (float) $value;
$this->attributes['currency_rate'] = (double) $value;
}
public static function scopeLatest($query)