Removed redundant functions from Invoice, optimised Invoice tables

This commit is contained in:
Deon George
2022-04-22 14:41:18 +10:00
parent a16277d9bb
commit e1a4db700f
22 changed files with 361 additions and 349 deletions

View File

@@ -97,7 +97,7 @@ class AdminController extends Controller
if (collect($value)->sum() > $request->post('total_amt'))
$fail('Allocation is greater than payment total.');
}],
'invoices.*.id' => 'nullable|exists:ab_invoice,id',
'invoices.*.id' => 'nullable|exists:invoices,id',
]);
if (! $o->exists) {

View File

@@ -54,7 +54,7 @@ class HomeController extends Controller
*/
public function invoice_pdf(Invoice $o)
{
return PDF::loadView('u.invoice.home',['o'=>$o])->stream(sprintf('%s.pdf',$o->invoice_account_id));
return PDF::loadView('u.invoice.home',['o'=>$o])->stream(sprintf('%s.pdf',$o->sid));
}
/**

View File

@@ -24,13 +24,13 @@ class AccountController extends Controller
});
// Get our invoice due date for this invoice
$io->due_date = $s->min(function($item) { return $item->invoice_next; });
$io->due_at = $s->min(function($item) { return $item->invoice_next; });
// @todo The days in advance is an application parameter
$io->date_orig = $io->due_date->subDays(30);
$io->created_at = $io->due_at->subDays(30);
// Work out items to add to this invoice, plus any in the next additional days
$days = now()->diffInDays($io->due_date)+1+7;
$days = now()->diffInDays($io->due_at)+1+7;
foreach ($s as $so)
{
if ($so->isInvoiceDueSoon($days))