enhance invoice display

This commit is contained in:
ludo
2023-12-03 02:20:41 +01:00
parent ec509df665
commit b5da5fc881
12 changed files with 152 additions and 150 deletions

View File

@@ -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;
}