fix next number issue on estimate & invoice

This commit is contained in:
Mohit Panjwani
2020-12-31 11:52:42 +05:30
parent 1be462ef82
commit 0f1d7627ea
2 changed files with 9 additions and 9 deletions

View File

@ -77,7 +77,7 @@ class Estimate extends Model implements HasMedia
{
// Get the last created order
$lastOrder = Estimate::where('estimate_number', 'LIKE', $value . '-%')
->orderBy('created_at', 'desc')
->orderBy('estimate_number', 'desc')
->first();
if (!$lastOrder) {
@ -435,7 +435,7 @@ class Estimate extends Model implements HasMedia
if ($logo && $isLocalhost && $isSystem) {
$logo = $logo->getPath();
} else if($logo) {
} else if ($logo) {
$logo = $logo->getFullUrl();
}

View File

@ -81,7 +81,7 @@ class Invoice extends Model implements HasMedia
{
// Get the last created order
$lastOrder = Invoice::where('invoice_number', 'LIKE', $value . '-%')
->orderBy('created_at', 'desc')
->orderBy('invoice_number', 'desc')
->first();
@ -363,11 +363,11 @@ class Invoice extends Model implements HasMedia
}
$invoice = Invoice::with([
'items',
'user',
'invoiceTemplate',
'taxes'
])
'items',
'user',
'invoiceTemplate',
'taxes'
])
->find($invoice->id);
return $invoice;
@ -519,7 +519,7 @@ class Invoice extends Model implements HasMedia
if ($logo && $isLocalhost && $isSystem) {
$logo = $logo->getPath();
} else if($logo) {
} else if ($logo) {
$logo = $logo->getFullUrl();
}