Show payments and paid bills on billing dashboards.
Deploy Ladill Care / deploy (push) Successful in 1m21s
Deploy Ladill Care / deploy (push) Successful in 1m21s
Cashiers and other bills.view roles get today's collections breakdown and a recent paid-invoice list under the existing metric cards. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -83,7 +83,9 @@ class CareWebTest extends TestCase
|
||||
->assertOk()
|
||||
->assertSee('Test Clinic')
|
||||
->assertSee('Revenue today')
|
||||
->assertSee('Open bills');
|
||||
->assertSee('Open bills')
|
||||
->assertSee('Payments today')
|
||||
->assertSee('Recently paid bills');
|
||||
}
|
||||
|
||||
public function test_doctor_dashboard_hides_finance_metrics(): void
|
||||
@@ -99,10 +101,98 @@ class CareWebTest extends TestCase
|
||||
->assertSee('No patients waiting right now.')
|
||||
->assertDontSee('Revenue today')
|
||||
->assertDontSee('Open bills')
|
||||
->assertDontSee('Payments today')
|
||||
->assertDontSee('Recently paid bills')
|
||||
->assertDontSee('Team members')
|
||||
->assertDontSee('Active branches');
|
||||
}
|
||||
|
||||
public function test_cashier_dashboard_shows_payments_and_paid_bills(): void
|
||||
{
|
||||
Member::where('user_ref', $this->user->public_id)->update([
|
||||
'role' => 'cashier',
|
||||
'branch_id' => Branch::firstOrFail()->id,
|
||||
]);
|
||||
|
||||
$branch = Branch::firstOrFail();
|
||||
$patient = \App\Models\Patient::create([
|
||||
'uuid' => (string) \Illuminate\Support\Str::uuid(),
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $branch->id,
|
||||
'patient_number' => 'LC-2026-00099',
|
||||
'first_name' => 'Ama',
|
||||
'last_name' => 'Mensah',
|
||||
]);
|
||||
|
||||
$visit = \App\Models\Visit::create([
|
||||
'uuid' => (string) \Illuminate\Support\Str::uuid(),
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $branch->id,
|
||||
'patient_id' => $patient->id,
|
||||
'status' => \App\Models\Visit::STATUS_COMPLETED,
|
||||
'checked_in_at' => now()->subHour(),
|
||||
'completed_at' => now(),
|
||||
]);
|
||||
|
||||
$bill = \App\Models\Bill::create([
|
||||
'uuid' => (string) \Illuminate\Support\Str::uuid(),
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'organization_id' => $this->organization->id,
|
||||
'branch_id' => $branch->id,
|
||||
'visit_id' => $visit->id,
|
||||
'patient_id' => $patient->id,
|
||||
'invoice_number' => 'INV-DASH-001',
|
||||
'status' => \App\Models\Bill::STATUS_PAID,
|
||||
'subtotal_minor' => 4500,
|
||||
'total_minor' => 4500,
|
||||
'amount_paid_minor' => 4500,
|
||||
'balance_minor' => 0,
|
||||
]);
|
||||
|
||||
\App\Models\Payment::create([
|
||||
'uuid' => (string) \Illuminate\Support\Str::uuid(),
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'bill_id' => $bill->id,
|
||||
'amount_minor' => 3000,
|
||||
'method' => \App\Models\Payment::METHOD_CASH,
|
||||
'status' => \App\Models\Payment::STATUS_PAID,
|
||||
'paid_at' => now(),
|
||||
'recorded_by' => $this->user->public_id,
|
||||
]);
|
||||
|
||||
\App\Models\Payment::create([
|
||||
'uuid' => (string) \Illuminate\Support\Str::uuid(),
|
||||
'owner_ref' => $this->user->public_id,
|
||||
'bill_id' => $bill->id,
|
||||
'amount_minor' => 1500,
|
||||
'method' => \App\Models\Payment::METHOD_MOMO,
|
||||
'status' => \App\Models\Payment::STATUS_PAID,
|
||||
'paid_at' => now(),
|
||||
'recorded_by' => $this->user->public_id,
|
||||
]);
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->get(route('care.dashboard'))
|
||||
->assertOk()
|
||||
->assertSee('Patients today')
|
||||
->assertSee('Open bills')
|
||||
->assertSee('Payments today')
|
||||
->assertSee('Collected')
|
||||
->assertSee('GHS 45.00')
|
||||
->assertSee('Cash')
|
||||
->assertSee('GHS 30.00')
|
||||
->assertSee('Other methods')
|
||||
->assertSee('GHS 15.00')
|
||||
->assertSee('Recently paid bills')
|
||||
->assertSee('INV-DASH-001')
|
||||
->assertSee('Ama Mensah')
|
||||
->assertSee(route('care.bills.show', $bill), false)
|
||||
->assertDontSee('Revenue today')
|
||||
->assertDontSee('Patients in queue');
|
||||
}
|
||||
|
||||
public function test_onboarding_creates_organization(): void
|
||||
{
|
||||
Organization::query()->delete();
|
||||
|
||||
Reference in New Issue
Block a user