feat: Add Payment Analytics page and integrate payment reports API

This commit is contained in:
2026-10-22 17:33:06 +05:30
parent 455ce699ad
commit 932d09c135
4 changed files with 293 additions and 2 deletions
+25
View File
@@ -206,3 +206,28 @@ export const dashboardReports = {
inventory: (params?: { from?: string; to?: string; warehouseId?: string; categoryId?: string }) =>
api.get<DashboardInventorySummary>('/reports/dashboard/inventory', { params }).then(r => r.data),
}
export interface PaymentAnalyticsResponse {
from: string
to: string
summary: {
invoiced: number
collected: number
creditExtended: number
outstanding: number
overdue: number
collectionRatePct: number | null
paymentCount: number
}
byMethod: Array<{ method: 'Cash' | 'Cheque' | 'Credit'; count: number; amount: number; sharePct: number }>
trend: Array<{ period: string; cash: number; cheque: number; credit: number }>
aging: Array<{ bucket: string; invoices: number; balance: number }>
topOutstanding: Array<{ storeId: string; storeName: string; invoices: number; balance: number; overdue: number }>
byAccount: Array<{ accountId: string | null; accountName: string; count: number; amount: number }>
cheques: Array<{ status: string; count: number; amount: number }>
}
export const paymentReports = {
analytics: (params?: { from?: string; to?: string; regionId?: string }) =>
api.get<PaymentAnalyticsResponse>('/reports/payments/analytics', { params }).then(r => r.data),
}