import React, { useState } from "react"; import { useAuth } from "@/hooks/use-auth"; import ReportConfig from "@/components/reports/report-config"; import PatientsWithBalanceReport from "@/components/reports/patients-with-balance-report"; import CollectionsByDoctorReport from "@/components/reports/collections-by-doctor-report"; import SummaryCards from "@/components/reports/summary-cards"; type ReportType = | "patients_with_balance" | "patients_no_balance" | "monthly_collections" | "collections_by_doctor" | "procedure_codes_by_doctor" | "payment_methods" | "insurance_vs_patient_payments" | "aging_report"; export default function ReportPage() { const { user } = useAuth(); const [startDate, setStartDate] = useState(() => { const d = new Date(); d.setMonth(d.getMonth() - 1); return d.toISOString().split("T")[0] ?? ""; }); const [endDate, setEndDate] = useState( () => new Date().toISOString().split("T")[0] ?? "" ); const [selectedReportType, setSelectedReportType] = useState( "patients_with_balance" ); if (!user) { return (
Please sign in to view reports.
); } return (
{/* Header Section */}

Financial Reports

Generate comprehensive financial reports for your practice

{/* SINGLE authoritative SummaryCards instance for the page */}
{selectedReportType === "patients_with_balance" && ( )} {selectedReportType === "collections_by_doctor" && ( )} {/* Add other report components here as needed */}
); }