Issue cashier booth tickets when financial gates block service.
Deploy Ladill Care / deploy (push) Successful in 41s
Deploy Ladill Care / deploy (push) Successful in 41s
Pay-before-service holds now create a billing queue ticket (via an open bill) so cashiers can Call next / Serve; clearance completes the ticket and releases the clinical line as before. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Services\Care\Workflow;
|
||||
|
||||
use App\Models\Organization;
|
||||
use App\Models\Visit;
|
||||
use App\Models\WorkflowStage;
|
||||
use App\Services\Care\CareFeatures;
|
||||
use App\Services\Care\CareQueueContexts;
|
||||
|
||||
@@ -42,6 +43,13 @@ class WorkflowQueueGate
|
||||
return true;
|
||||
}
|
||||
|
||||
// Pay-before-service holds belong on the cashier / billing line, not the
|
||||
// clinical service queue for the current stage.
|
||||
if ($queueContext === CareQueueContexts::BILLING
|
||||
&& $this->isAwaitingFinancialGate($organization, $visit, $stage)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! $this->contextsMatch($stage->queue_context, $stage->type, $queueContext)) {
|
||||
return false;
|
||||
}
|
||||
@@ -53,12 +61,36 @@ class WorkflowQueueGate
|
||||
return $this->engine->isQueueReleasable($visit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the visit is blocked on a before-service financial gate.
|
||||
*/
|
||||
public function isAwaitingFinancialGate(
|
||||
Organization $organization,
|
||||
Visit $visit,
|
||||
?WorkflowStage $stage = null,
|
||||
): bool {
|
||||
if (! $this->features->enabled($organization, CareFeatures::FINANCIAL_GATES)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$stage ??= $this->engine->currentStage($visit);
|
||||
if ($stage === null || ! $stage->gatesBeforeService()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ! $this->engine->isQueueReleasable($visit);
|
||||
}
|
||||
|
||||
protected function contextsMatch(?string $stageContext, string $stageType, string $queueContext): bool
|
||||
{
|
||||
if ($stageContext === $queueContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($stageType === 'payment' && $queueContext === CareQueueContexts::BILLING) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Specialty appointments still fulfill a consultation workflow stage.
|
||||
return $stageType === 'consultation'
|
||||
&& CareQueueContexts::isSpecialty($queueContext)
|
||||
|
||||
Reference in New Issue
Block a user