mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Minor fixeS
This commit is contained in:
parent
7de0cd99f1
commit
2c567a0d95
@ -40,18 +40,25 @@ class UpdateLedger implements ShouldQueue
|
||||
*/
|
||||
public function handle() :void
|
||||
{
|
||||
// nlog("Updating company ledger for client ". $this->company_ledger_id);
|
||||
nlog("Updating company ledger for client ". $this->company_ledger_id);
|
||||
|
||||
MultiDB::setDb($this->db);
|
||||
|
||||
$cl = CompanyLedger::find($this->company_ledger_id);
|
||||
|
||||
$ledger_item = CompanyLedger::query()
|
||||
->where('company_id', $cl->company_id)
|
||||
->where('client_id', $cl->client_id)
|
||||
->where('company_ledgerable_id', $cl->company_ledgerable_id)
|
||||
->where('company_ledgerable_type', $cl->company_ledgerable_type)
|
||||
->exists();
|
||||
|
||||
if(!$cl)
|
||||
return;
|
||||
|
||||
$entity = $cl->company_ledgerable;
|
||||
$balance = $entity->calc()->getBalance();
|
||||
$cl->adjustment = $balance - $this->start_amount;
|
||||
$cl->adjustment = $ledger_item ? $balance - $this->start_amount : $balance;
|
||||
|
||||
$parent_ledger = CompanyLedger::query()
|
||||
->where('id', '<', $cl->id)
|
||||
|
@ -46,7 +46,7 @@ class MarkSent extends AbstractService
|
||||
// ->updateInvoiceBalance($adjustment, "Invoice {$this->invoice->number} marked as sent.");
|
||||
|
||||
|
||||
$this->invoice->ledger()->mutateInvoiceBalance($this->invoice->amount, "Invoice {$this->invoice->number} marked as sent.");
|
||||
$this->invoice->ledger()->mutateInvoiceBalance($this->invoice->amount, "Invoice {$this->invoice->number} marked as sent => {$this->invoice->amount}");
|
||||
$this->invoice->client->service()->calculateBalance();
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user