Final touches for the balance and transactions.

This commit is contained in:
James Cole
2021-04-10 17:56:09 +02:00
parent 0426fa63d0
commit 202facf43d
6 changed files with 43 additions and 10 deletions

View File

@@ -226,6 +226,24 @@ trait AccountServiceTrait
}
}
/**
* Delete TransactionGroup with liability credit in it.
*
* @param Account $account
*/
protected function deleteCreditTransaction(Account $account): void
{
Log::debug(sprintf('deleteCreditTransaction() for account #%d', $account->id));
$creditGroup = $this->getCreditTransaction($account);
if (null !== $creditGroup) {
Log::debug('Credit journal found, delete journal.');
/** @var TransactionGroupDestroyService $service */
$service = app(TransactionGroupDestroyService::class);
$service->destroy($creditGroup);
}
}
/**
* Returns the opening balance group, or NULL if it does not exist.
*