Files
DentalManagementMH07/apps/Frontend/src/pages/reports-page.tsx
Gitead c9d08028a9 feat: teach AI classifier to recognize "comp" and tooth surface notation
Add "comp" as alias for composite in CDT lookup. Update classifier
prompt with explicit examples for "claim comp #8 ml for lisa today"
and dental surface letter definitions (M/D/L/F/B/O/V/I) so the LLM
correctly treats #tooth+surfaces as composite fillings, not insurance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-28 20:55:41 -04:00

90 lines
2.9 KiB
TypeScript
Executable File

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 PatientsNoBalanceReport from "@/components/reports/patients-no-balance-report";
import SummaryCards from "@/components/reports/summary-cards";
import CommissionSection from "@/components/reports/commission-section";
type ReportType =
| "patients_with_balance"
| "patients_no_balance"
| "monthly_collections"
| "procedure_codes_by_doctor"
| "payment_methods"
| "insurance_vs_patient_payments"
| "aging_report";
export default function ReportPage() {
const { user } = useAuth();
const [startDate, setStartDate] = useState<string>(() => {
const d = new Date();
d.setMonth(d.getMonth() - 1);
return d.toISOString().split("T")[0] ?? "";
});
const [endDate, setEndDate] = useState<string>(
() => new Date().toISOString().split("T")[0] ?? ""
);
const [selectedReportType, setSelectedReportType] = useState<ReportType>(
"patients_with_balance"
);
const [npiProviderId, setNpiProviderId] = useState<number | null>(null);
if (!user) {
return (
<div className="text-center py-8">Please sign in to view reports.</div>
);
}
return (
<div className="container mx-auto space-y-6">
{/* Header Section */}
<div className="flex justify-between items-center">
<div>
<h1 className="text-3xl font-bold tracking-tight">
Financial Reports
</h1>
<p className="text-muted-foreground">
Generate comprehensive financial reports for your practice
</p>
</div>
</div>
<div className="mb-4">
<ReportConfig
startDate={startDate}
endDate={endDate}
setStartDate={setStartDate}
setEndDate={setEndDate}
selectedReportType={selectedReportType}
setSelectedReportType={setSelectedReportType}
npiProviderId={npiProviderId}
setNpiProviderId={setNpiProviderId}
/>
</div>
{/* SINGLE authoritative SummaryCards instance for the page */}
<div className="mb-4">
<SummaryCards startDate={startDate} endDate={endDate} npiProviderId={npiProviderId} selectedReportType={selectedReportType} />
</div>
<div>
{selectedReportType === "patients_with_balance" && (
<PatientsWithBalanceReport startDate={startDate} endDate={endDate} npiProviderId={npiProviderId} />
)}
{selectedReportType === "patients_no_balance" && (
<PatientsNoBalanceReport startDate={startDate} endDate={endDate} npiProviderId={npiProviderId} />
)}
</div>
{/* Commission section */}
<div className="mt-8">
<CommissionSection />
</div>
</div>
);
}