prepare(" SELECT p.*, u.username as doctor_name FROM patients p JOIN users u ON p.doctor_id = u.id WHERE p.id = ? AND p.status = 'Completed' ORDER BY p.updated_at DESC LIMIT 1 "); $stmt->execute([$patient_id]); $visit = $stmt->fetch(PDO::FETCH_ASSOC); } catch (PDOException $e) { $visit = null; // Log error } if (!$visit) { die("No completed visit found for this patient or an error occurred."); } ?>
Invoice #: INV-
Date:
Status:
Consulting Doctor: Dr.
| Service Rendered | Cost |
|---|---|
| $ |