Fix cashier desk: unpaid bills on every demo branch.
Deploy Ladill Care / deploy (push) Successful in 39s

Demo seeding used i%3 for both branch and paid status, so Ridge Clinic only got paid invoices. Cashiers now default to outstanding balances and Call next is secondary to the walk-up unpaid list.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-18 23:22:54 +00:00
co-authored by Cursor
parent b84c7e31ba
commit a34d6579cd
7 changed files with 143 additions and 29 deletions
+36 -1
View File
@@ -159,6 +159,41 @@ class CareBillTest extends TestCase
->assertSee('INV-');
}
public function test_cashier_bills_index_defaults_to_outstanding(): void
{
$this->actingAs($this->user)
->post(route('care.bills.generate', $this->visit));
$open = Bill::firstOrFail();
$paid = Bill::create([
'uuid' => (string) \Illuminate\Support\Str::uuid(),
'owner_ref' => $this->user->public_id,
'organization_id' => $this->organization->id,
'branch_id' => $this->visit->branch_id,
'visit_id' => $this->visit->id,
'patient_id' => $this->visit->patient_id,
'invoice_number' => 'INV-PAID-001',
'status' => Bill::STATUS_PAID,
'subtotal_minor' => 1000,
'total_minor' => 1000,
'amount_paid_minor' => 1000,
'balance_minor' => 0,
]);
$this->actingAs($this->user)
->get(route('care.bills.index'))
->assertOk()
->assertSee($open->invoice_number)
->assertSee('Pay')
->assertDontSee($paid->invoice_number, false);
$this->actingAs($this->user)
->get(route('care.bills.index', ['status' => '']))
->assertOk()
->assertSee($paid->invoice_number);
}
public function test_cashier_bills_index_links_each_invoice_for_payment(): void
{
$this->actingAs($this->user)
@@ -191,6 +226,6 @@ class CareBillTest extends TestCase
$this->actingAs($this->user)
->post(route('care.bills.call-next'), ['branch_id' => Branch::firstOrFail()->id])
->assertRedirect()
->assertSessionHas('info', 'No patients waiting at the billing booth. Open an unpaid invoice below to record a walk-up payment.');
->assertSessionHas('info', 'No patients waiting at the billing booth. Open an unpaid invoice above to record a walk-up payment.');
}
}
+22
View File
@@ -377,6 +377,28 @@ class DemoSeedCommandTest extends TestCase
$this->assertNotNull($waiter->practitioner_id, 'Demo waiters must all have a doctor assigned');
$this->assertNotSame('unresolved', $waiter->queue_routing_status);
}
$branches = Branch::query()->where('organization_id', $org->id)->orderBy('id')->get();
$this->assertGreaterThanOrEqual(3, $branches->count());
foreach ($branches as $branch) {
$unpaid = Bill::query()
->where('organization_id', $org->id)
->where('branch_id', $branch->id)
->where('balance_minor', '>', 0)
->count();
$this->assertGreaterThan(
0,
$unpaid,
"Branch {$branch->name} must have unpaid demo invoices for cashiers",
);
}
$cashier = \App\Models\Member::query()
->where('organization_id', $org->id)
->where('role', 'cashier')
->first();
$this->assertNotNull($cashier);
$this->assertSame((int) $branches->first()->id, (int) $cashier->branch_id);
}
public function test_specialty_doctor_links_after_sso_public_id_remap(): void