{{-- The visit's financial summary (AppointmentController::visitTotals): what each part of the visit charged, paid, discount, promotion, balance — and the appointment doctor's commission on it. --}} @php $ft = app(\App\Http\Controllers\Patient\AppointmentController::class)->visitTotals($appointment); $vc = $ft['visit_commission']; // the commission: only the appointment's own doctor (his user is linked to that employee) $seeCommission = $vc && auth()->user()->employee_id && (int) auth()->user()->employee_id === $vc['doctor_id']; @endphp
| Charge | Paid | Discount | Promotion | Balance | |
|---|---|---|---|---|---|
| Nothing charged on this visit yet. | |||||
| {{ $section }} | {{ number_format($a['charge'], 2) }} | {{ number_format($a['paid'], 2) }} | {{ number_format($a['discount'], 2) }} | {{ number_format($a['promotion'], 2) }} | {{ number_format($bal, 2) }} |
| Total (whole visit) | {{ number_format($ft['appointment_price'], 2) }} | {{ number_format($ft['appointment_paid'], 2) }} | {{ number_format($ft['appointment_discount'], 2) }} | {{ number_format($ft['appointment_promotion'], 2) }} | {{ number_format($ft['appointment_balance'], 2) }} |
| Doctor commission — Dr {{ $vc['doctor'] }} ({{ collect($vc['rates'])->map(fn ($p) => rtrim(rtrim(number_format($p, 2), '0'), '.') . '%')->implode(' / ') }}) | on {{ number_format($vc['paid'], 2) }} paid | {{ number_format($vc['commission'], 2) }} | |||