Fixes for auto billing

This commit is contained in:
David Bomba 2021-09-03 19:30:44 +10:00
parent 592387874e
commit 0f6af65f53

View File

@ -56,8 +56,8 @@ class AutoBillCron
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill"); nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill");
$auto_bill_partial_invoices->cursor()->each(function ($invoice){ $auto_bill_partial_invoices->cursor()->each(function ($invoice) use($db){
$this->runAutoBiller($invoice); $this->runAutoBiller($invoice, $db);
}); });
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now()) $auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
@ -69,8 +69,8 @@ class AutoBillCron
nlog($auto_bill_invoices->count(). " full invoices to auto bill"); nlog($auto_bill_invoices->count(). " full invoices to auto bill");
$auto_bill_invoices->cursor()->each(function ($invoice){ $auto_bill_invoices->cursor()->each(function ($invoice) use($db){
$this->runAutoBiller($invoice); $this->runAutoBiller($invoice, $db);
}); });
@ -89,7 +89,7 @@ class AutoBillCron
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill db = {$db}"); nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill db = {$db}");
$auto_bill_partial_invoices->cursor()->each(function ($invoice)use($db){ $auto_bill_partial_invoices->cursor()->each(function ($invoice) use($db){
$this->runAutoBiller($invoice, $db); $this->runAutoBiller($invoice, $db);
}); });
@ -110,7 +110,7 @@ class AutoBillCron
} }
} }
private function runAutoBiller(Invoice $invoice) private function runAutoBiller(Invoice $invoice, $db)
{ {
info("Firing autobill for {$invoice->company_id} - {$invoice->number}"); info("Firing autobill for {$invoice->company_id} - {$invoice->number}");