Add multi-series charts and enhance dashboard functionality
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 } from './reports'
|
||||
export { productReports, stockReports, dashboardReports } 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 } from './sys-config'
|
||||
|
||||
@@ -159,3 +159,41 @@ export const productReports = {
|
||||
summary: (params?: Pick<ProductReportParams, 'brandId' | 'categoryId' | 'warehouseId' | 'from' | 'to'>) =>
|
||||
api.get<ProductReportSummary>('/reports/products/summary', { params }).then(r => r.data),
|
||||
}
|
||||
|
||||
export interface SalesKpis {
|
||||
grossSales: number
|
||||
returnValue: number
|
||||
netSales: number
|
||||
orders: number
|
||||
averageOrderValue: number
|
||||
grossProfit: number
|
||||
grossProfitMarginPercent: number | null
|
||||
}
|
||||
|
||||
export interface DashboardSalesSummary {
|
||||
from: string
|
||||
to: string
|
||||
granularity: 'day' | 'month'
|
||||
kpis: { current: SalesKpis; previous: SalesKpis; previousFrom: string; previousTo: string }
|
||||
trend: Array<{ period: string; sales: number; returns: number }>
|
||||
byCategory: Array<{ id: string | null; name: string; amount: number }>
|
||||
byRegion: Array<{ id: string | null; name: string; amount: number }>
|
||||
byRep: Array<{ id: string | null; name: string; amount: number }>
|
||||
}
|
||||
|
||||
export interface DashboardInventorySummary {
|
||||
from: string
|
||||
to: string
|
||||
granularity: 'day' | 'month'
|
||||
valueByCategory: Array<{ category: string; quantity: number; value: number }>
|
||||
byWarehouse: Array<{ warehouseId: string; name: string; quantity: number; value: number }>
|
||||
movementTrend: Array<{ period: string; received: number; issued: number; net: number }>
|
||||
}
|
||||
|
||||
export const dashboardReports = {
|
||||
sales: (params?: { from?: string; to?: string; regionId?: string; categoryId?: string }) =>
|
||||
api.get<DashboardSalesSummary>('/reports/dashboard/sales', { params }).then(r => r.data),
|
||||
|
||||
inventory: (params?: { from?: string; to?: string; warehouseId?: string; categoryId?: string }) =>
|
||||
api.get<DashboardInventorySummary>('/reports/dashboard/inventory', { params }).then(r => r.data),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user