Reports
Financial and operational analytics
{/* Tabs */}
{(["overview", "collections", "tickets"] as Tab[]).map(t => (
))}
{/* Overview Tab */}
{tab === "overview" && (
Collection by Collector
{collLoading ? :
collection.length === 0 ? No collection data for this period
: (
<>
{collection.map((c, i) => (
{c.collector}
{c.paymentCount} payments
{formatCurrency(c.totalAmount)}
))}
Total{formatCurrency(totalCollected)}
`₱${(v/1000).toFixed(0)}k`} /> formatCurrency(Number(v))} />
>
)
}
Accounts Receivable Aging
{aging.map((a) => (
{a.bucket} days
{a.invoiceCount} invoices
0 ? agingRisk[a.bucket] ?? "text-gray-800" : "text-gray-400"}`}>{formatCurrency(a.totalAmount)}
))}
Total Outstanding{formatCurrency(totalOutstanding)}
{revenue.length > 0 && (
Revenue Trend (Monthly)
`₱${(v/1000).toFixed(0)}k`} />
formatCurrency(Number(v))} />
)}
Subscribers by Status
{subByStatus.length === 0 ? No subscriber data
: (
{subByStatus.map((_, i) => | )}
{subByStatus.map((s, i) => (
))}
Total{totalSubs}
)}
{subByArea.length > 0 && (
Active Subscribers by Area
{subByArea.map(a => (
))}
)}
)}
{/* Collections Tab */}
{tab === "collections" && (
Payment Collections
| Date | Client | Amount | Channel | Reference | Notes |
{payments.length === 0 ? :
payments.map((p: any) => (
{formatDate(p.paymentDate ?? p.createdAt)} |
{p.client ? `${p.client.firstName} ${p.client.lastName}` : "—"} |
{formatCurrency(Number(p.amount))} |
{p.channel} |
{p.referenceNumber ?? "—"} |
{p.notes ?? "—"} |
))
}
)}
{/* Tickets Tab */}
{tab === "tickets" && (
{ticketsData && (
<>
{ticketsData.open}
Open
{ticketsData.resolved}
Resolved
{ticketsData.total}
Total
Recent Tickets
| Subject | Client | Type | Priority | Status | Created |
{ticketsData.list.length === 0 ? :
ticketsData.list.map((t: any) => (
{t.subject} |
{t.client ? `${t.client.firstName} ${t.client.lastName}` : "—"} |
{t.type} |
{t.priority} |
{t.status} |
{formatDate(t.createdAt)} |
))
}
>
)}
)}
);
}