NCD Medication Audit
Compare fixed NCD prescriptions with recorded dispensing by clinic, General ID and visit date.
Source coverage · {{ $filters['from'] }} to {{ $filters['to'] }}
| Clinic | NCD follow-up rows | Consumption rows scanned | Comparisons | Status |
|---|---|---|---|---|
| {{ $clinics[$source['clinic']] }} | {{ $source['followups'] ?? '—' }} | {{ $source['consumptions'] ?? '—' }} | {{ $source['comparisons'] ?? '—' }} | {{ $source['message'] }} |
Rows compare medicines, not patient totals. “No matching prescription” may need review against another prescribing service. Self-funded prescriptions without clinic consumption are listed separately. Whole-tablet rounding is informational. Duplicate visits, duplicate consumption rows and malformed records are never labelled matched. Stock items use generic-name matching or a configured stock mapping; brand-only names need mapping.
{{ $filters['show']==='issues' ? 'Comparisons needing attention' : 'All medicine comparisons' }}
{{ number_format($rows->total()) }} rows · page {{ $rows->currentPage() }} of {{ max(1,$rows->lastPage()) }}| Clinic / visit date | General ID / medicine | NCD prescription | Dispensing consumption | Comparison |
|---|---|---|---|---|
| {{ $clinics[$row['clinic']] }} {{ $row['date'] ? \Carbon\Carbon::parse($row['date'])->format('d-m-Y') : 'Date unavailable' }} |
{{ $row['pid'] ?: 'ID unavailable' }} {{ $row['medicine_name'] }} |
@forelse($row['prescriptions'] as $prescription)
{{ $prescription['text'] }}Follow-up row #{{ $prescription['followup_id'] }}
@emptyNo dose recorded for this medicine.@endforelse
@if($row['expected_mg']!==null)Required: {{ $number($row['expected_mg']) }} mg @endif
@if(count($row['prescriptions'])===1 && $row['prescriptions'][0]['days']!==null)
{{ $row['prescriptions'][0]['days'] }} saved days · next appointment {{ $row['prescriptions'][0]['next_date'] ?? 'unavailable' }}
@endif
ncd_followups: {{ $row['followup_ids'] ? '#'.implode(', #',$row['followup_ids']) : 'no matching visit' }}
|
@forelse($row['dispensed'] as $stock)
{{ $number($stock['quantity']) }} {{ ($stock['unit'] ?? null)==='tablet' ? 'tablets' : 'stock units' }} · {{ $stock['name'] }}Stock #{{ $stock['id'] }} · consumption #{{ $stock['consumption_id'] }}@if($stock['strength_mg']!==null) · {{ $number($stock['strength_mg']) }} mg/tablet @endif
@emptyNo fixed-medicine consumption recorded.@endforelse
@if($row['dispensed'] && $row['actual_mg']!==null)Recorded: {{ $number($row['actual_mg']) }} mg @endif
consumptions: {{ $row['consumption_ids'] ? '#'.implode(', #',$row['consumption_ids']) : 'no matching record' }}
|
{{ $labels[$row['status']] }} {{ $row['note'] }} @if($row['difference_mg']!==null && $row['expected_mg']!==null)Recorded − required: {{ $row['difference_mg']>0 ? '+' : '' }}{{ $number($row['difference_mg']) }} mg@endif @foreach($row['issues'] as $issue){{ $issue }}@endforeach |
| @if(collect($sources)->every(static fn($s)=>!$s['ok'])) No clinic data could be audited. @elseif($filters['show']==='issues' && array_sum($counts)>0) No discrepancies found in {{ array_sum($counts) }} medicine comparisons. Choose Show → All comparisons to see the matching records. @else No fixed-medicine comparisons found for these filters. Check source coverage and the selected visit dates above. @endif | ||||
Printed output includes this page of results only. No stock balance reconciliation is performed.
@endif @include('Monitor.partials.ncdConsumptionHistory') @if(isset($flowRan, $flowDate)) @include('Monitor.partials.ncdClinicTime') @endif