<?php
// Generates CSV template for upload (compatible with your raw PHP style)
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="insurance_recon_template_' . date('Ymd') . '.csv"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

$output = fopen('php://output', 'w');

// Headers (match upload expectations)
fputcsv($output, [
    'claim_number',
    'patient_number',
    'amount',
    'claim_date',
    'status',
    'insurance_policy_no',
    'service_description'
]);

// Sample data rows
fputcsv($output, ['CLM-20251129-0001', 'ENT202512900001', '2500.00', '2025-11-29', 'APPROVED', 'POL-12345', 'ENT Consultation']);
fputcsv($output, ['CLM-20251129-0002', 'ENT202512900002', '4500.50', '2025-11-29', 'PENDING', 'POL-67890', 'Lab Tests & Imaging']);

fclose($output);
exit();
?>