Fixes for company ledger

This commit is contained in:
David Bomba 2022-05-20 09:21:47 +10:00
parent d8b37a08ab
commit accd408ba1

View File

@ -47,7 +47,7 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
*/ */
public function handle() :void public function handle() :void
{ {
nlog("Updating company ledgers"); nlog("Updating company ledger for client ". $this->client->id);
MultiDB::setDb($this->company->db); MultiDB::setDb($this->company->db);
@ -62,8 +62,14 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
->orderBy('id', 'DESC') ->orderBy('id', 'DESC')
->first(); ->first();
if(!$last_record) if(!$last_record){
return;
$last_record = CompanyLedger::where('client_id', $company_ledger->client_id)
->where('company_id', $company_ledger->company_id)
->orderBy('id', 'DESC')
->first();
}
nlog("Updating Balance NOW"); nlog("Updating Balance NOW");
@ -72,13 +78,7 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
}); });
nlog("Finished checking company ledgers"); nlog("Updating company ledger for client ". $this->client->id);
}
public function checkLedger()
{
} }