feat: Add Payment Analytics page and integrate payment reports API
This commit is contained in:
@@ -8,7 +8,7 @@ export { drivers, compliance } from './drivers'
|
||||
export { purchaseOrders, grn, purchaseReturns } from './procurement'
|
||||
export { rides, loadingSheets, deliveryTasks } from './operations'
|
||||
export { stock } from './stock'
|
||||
export { productReports, stockReports, dashboardReports } from './reports'
|
||||
export { productReports, stockReports, dashboardReports, paymentReports } from './reports'
|
||||
export { shopPos, invoices, payments } from './sales'
|
||||
export { saleReturns, claims, supplierClaims } from './returns-claims'
|
||||
export { sysConfig, ITEM_TRACKING_KEYS, GRN_TAX_KEYS, grnTaxSettings, DEFAULT_GRN_TAX_SETTINGS, invoiceCreationMode, INVOICE_CREATION_MODE_KEY, DEFAULT_INVOICE_CREATION_MODE } from './sys-config'
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user