accrual invoices/bills

This commit is contained in:
denisdulici
2017-11-07 05:11:03 +03:00
parent 7bba022101
commit 188953d862
21 changed files with 562 additions and 387 deletions

View File

@@ -84,6 +84,21 @@ class Invoice extends Model
return $this->hasMany('App\Models\Income\InvoiceHistory');
}
public function scopeDue($query, $date)
{
return $query->where('due_at', '=', $date);
}
public function scopeLatest($query)
{
return $query->orderBy('paid_at', 'desc');
}
public function scopeAccrued($query)
{
return $query->where('invoice_status_code', '!=', 'draft');
}
/**
* Convert amount to double.
*
@@ -105,9 +120,4 @@ class Invoice extends Model
{
$this->attributes['currency_rate'] = (double) $value;
}
public function scopeDue($query, $date)
{
return $query->where('due_at', '=', $date);
}
}