Wire Care lists into Ladill Queue workflows instead of reception panels.
Deploy Ladill Care / deploy (push) Successful in 1m45s
Deploy Ladill Care / deploy (push) Successful in 1m45s
When Queue integration is on, role pages issue tickets into their own department queues and drive Call next → Serve → Complete on the native lists. Integration off leaves existing UI unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -22,6 +22,7 @@ class BillService
|
||||
public function __construct(
|
||||
protected InvoiceNumberGenerator $invoices,
|
||||
protected MerchantGatewayService $gateway,
|
||||
protected CareQueueBridge $queueBridge,
|
||||
) {}
|
||||
|
||||
public function queryForOrganization(string $ownerRef, int $organizationId): Builder
|
||||
@@ -81,6 +82,11 @@ class BillService
|
||||
|
||||
AuditLogger::record($ownerRef, 'bill.created', $visit->organization_id, $actorRef, Bill::class, $bill->id);
|
||||
|
||||
$bill = $bill->fresh(['lineItems', 'patient', 'payments']);
|
||||
if ($visit->organization) {
|
||||
$this->queueBridge->issueForBill($visit->organization, $bill);
|
||||
}
|
||||
|
||||
return $bill->fresh(['lineItems', 'patient', 'payments']);
|
||||
}
|
||||
|
||||
@@ -441,6 +447,7 @@ class BillService
|
||||
$bill->refresh();
|
||||
$paid = $this->paidSum($bill);
|
||||
$balance = max(0, $bill->total_minor - $paid);
|
||||
$wasPaid = $bill->status === Bill::STATUS_PAID;
|
||||
|
||||
$status = Bill::STATUS_OPEN;
|
||||
if ($paid > 0 && $balance > 0) {
|
||||
@@ -460,6 +467,13 @@ class BillService
|
||||
'balance_minor' => $balance,
|
||||
'status' => $status,
|
||||
]);
|
||||
|
||||
if (! $wasPaid && $status === Bill::STATUS_PAID) {
|
||||
$organization = Organization::query()->find($bill->organization_id);
|
||||
if ($organization) {
|
||||
$this->queueBridge->complete($organization, $bill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function paidSum(Bill $bill): int
|
||||
|
||||
Reference in New Issue
Block a user