minor fixes

This commit is contained in:
ludo
2023-12-11 21:09:48 +01:00
parent 0ff39c1401
commit 501f3a5ab9
2 changed files with 2 additions and 2 deletions

View File

@@ -78,7 +78,7 @@ class Invoices
public static function getNewRef() public static function getNewRef()
{ {
$ref = date('ymd').'00000'; $ref = date('ymd').'00000';
$lastRef = Invoice::where($ref, '>', $ref)->orderBy('id', 'desc')->first(); $lastRef = Invoice::where('ref', '>', $ref)->orderBy('id', 'desc')->first();
return $lastRef ? $lastRef->ref + 1 : $ref + 1; return $lastRef ? $lastRef->ref + 1 : $ref + 1;
} }

View File

@@ -112,7 +112,7 @@ class Orders
public static function getNewRef() public static function getNewRef()
{ {
$ref = date('ymd').'00000'; $ref = date('ymd').'00000';
$lastRef = Order::where($ref, '>', $ref)->orderBy('id', 'desc')->first(); $lastRef = Order::where('ref', '>', $ref)->orderBy('id', 'desc')->first();
return $lastRef ? $lastRef->ref + 1 : $ref + 1; return $lastRef ? $lastRef->ref + 1 : $ref + 1;
} }