enhance invoice display
This commit is contained in:
@@ -62,6 +62,7 @@ class Invoices
|
||||
{
|
||||
InvoiceStats::increase($data['total_taxed']);
|
||||
$data['uuid'] = Str::uuid()->toString();
|
||||
$data['ref'] = self::getNewRef();
|
||||
|
||||
return Invoice::create($data);
|
||||
}
|
||||
@@ -77,7 +78,7 @@ class Invoices
|
||||
public static function getNewRef()
|
||||
{
|
||||
$ref = date('ymd').'00000';
|
||||
$lastRef = Invoice::orderBy('id', 'desc')->first();
|
||||
$lastRef = Invoice::where($ref, '>', $ref)->orderBy('id', 'desc')->first();
|
||||
|
||||
return $lastRef ? $lastRef->ref + 1 : $ref + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user