Add account next invoice
This commit is contained in:
@@ -5,8 +5,6 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use Leenooks\Traits\ScopeActive;
|
||||
@@ -272,41 +270,6 @@ class User extends Authenticatable implements IDs
|
||||
return in_array($this->role(),['wholesaler']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the items for the next invoice
|
||||
*
|
||||
* @param bool $future
|
||||
* @return DatabaseCollection
|
||||
* @deprecated This should be done in accounts
|
||||
*/
|
||||
public function next_invoice_items(bool $future=FALSE): Collection
|
||||
{
|
||||
return collect();
|
||||
$result = new DatabaseCollection;
|
||||
$this->services->load(['invoice_items.taxes']);
|
||||
|
||||
foreach ($this->services as $o) {
|
||||
if ($future) {
|
||||
if ($o->invoice_next->subDays(config('app.invoice_inadvance'))->isPast())
|
||||
continue;
|
||||
|
||||
} else {
|
||||
if ($o->invoice_next->subDays(config('app.invoice_inadvance'))->isFuture())
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($o->next_invoice_items($future) as $oo)
|
||||
$result->push($oo);
|
||||
}
|
||||
|
||||
$result->load([
|
||||
'product.translate',
|
||||
'service.type',
|
||||
]);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine what the logged in user's role is
|
||||
* + Wholesaler - aka Super User
|
||||
|
Reference in New Issue
Block a user