Overview
The Reports module provides in-depth financial and operational analytics for clinic administrators. It offers insights into revenue trends, service profitability, patient distribution, and outstanding debts.This feature is restricted to users with
admin role. All monetary values are displayed in Dominican Peso (DOP).Report Categories
The reports page features two main sections accessible via tab navigation:- 📊 Estadísticas
- 💸 Cobros Pendientes
Statistical analysis including:
- Monthly revenue trends (6-month view)
- Top 5 services by income
- Patient distribution by branch
- Performance summary
Revenue Analysis
Monthly Income Chart
Visual representation of the last 6 months of revenue: Data Structure:- Horizontal bar chart with gradient fill
- Bars scaled relative to maximum monthly income
- Month labels formatted as “marzo 2026”
- Currency values displayed on bars
Top Services by Revenue
Displays the 5 most profitable treatment types: Metrics Shown:- Service/treatment name
- Total revenue generated
- Relative performance bar (scaled to #1 service)
The most profitable service is highlighted and referenced in the performance summary.
sp_get_main_reports() procedure, result set 1
Branch Analytics
Patient Distribution
Table showing patient counts across all clinic branches:| Column | Description |
|---|---|
| Sucursal | Branch name |
| Total Pacientes | Number of registered patients |
Performance Summary
The highlight card provides executive-level insights:Key Metrics
- Total Facturado Reciente: Sum of last 6 months revenue
- Top Service: Most profitable treatment type
- Priority Branch: Location with highest patient count
- Strategic Recommendations: Auto-generated based on data
Debt Management
Outstanding Debts Report
Comprehensive patient debt tracking with collection tools: Table Columns:Paciente
Paciente
Patient identification including:
- Full name (bold)
- Medical record number (
medrecno) - Contact phone number
Presupuestado
Presupuestado
Total amount budgeted/quoted for treatments in DOP
Pagado
Pagado
Total amount paid to date (displayed in green)
Saldo Pendiente
Saldo Pendiente
Outstanding balance due (displayed in red, bold)Calculated as:
total_budgeted - total_paidAcción
Acción
“Ver Ficha” button linking to
/patients/{id} for detailed patient profile and payment processingEmpty State
When no debts exist, displays: “No hay deudas pendientes registradas. ✅“
API Integration
Main Reports Endpoint
/src/routes/api/reports/+server.jsProcedure:
sp_get_main_reports()
Result Sets:
- Monthly income data (6 months)
- Top 5 services by revenue
- Patient counts by branch
Debts Report Endpoint
/src/routes/api/reports/debts/+server.jsProcedure:
sp_get_debts_report()
Print Functionality
Built-in print support for generating hard copies:
Print Styling:
- Header navigation hidden via
@media print - Clean layout for professional reports
- Currency and data formatting preserved
Visual Components
Chart Styling
The revenue chart uses a responsive design:Color Coding
Revenue
Teal gradient
#0d9488 → #14b8a6Paid Amounts
Green
var(--green)Debts
Rose (bold)
var(--rose)Usage Examples
Example 1: Analyzing Revenue Trends
Example 2: Managing Outstanding Debts
Example 3: Branch Performance Assessment
Data Refresh
Reports fetch fresh data on page load via parallel API calls:Related Pages
Analytics Dashboard
Deep-dive metrics with advanced visualizations
Admin Dashboard
Quick financial overview in dashboard stats
