Fe changes

This commit is contained in:
2026-10-16 15:47:23 +05:30
parent 09d86835a2
commit c5a0992b5d
23 changed files with 2715 additions and 89 deletions
+74
View File
@@ -72,6 +72,80 @@ export interface ProductStockParams extends ProductReportParams {
lowStockOnly?: boolean
}
export interface StockOverview {
totalSkus: number
totalQty: number
totalValue: number
lowStockCount: number
outOfStockCount: number
expiringSoonCount: number
expiredCount: number
}
export type StockLedgerStatus = 'OK' | 'Low' | 'Out'
export interface StockLedgerRow {
itemId: string
sku: string
name: string
brand: string | null
category: string
uom: string
openingQty: number
qtyIn: number
qtyOut: number
closingQty: number
currentQty: number
costPrice: number | null
stockValue: number
reorderLevel: number | null
status: StockLedgerStatus
}
export interface StockExpiryRow {
itemId: string
sku: string
name: string
batchId: string
batchNumber: string | null
expiryDate: string
daysLeft: number
quantity: number
costPrice: number | null
value: number
locationId: string
locationType: string
locationName: string
}
export interface StockLedgerParams extends PageParams {
locationId?: string
categoryId?: string
brandId?: string
from?: string
to?: string
status?: 'low' | 'out'
activeOnly?: boolean
search?: string
}
export interface StockExpiryParams extends PageParams {
locationId?: string
days?: number
search?: string
}
export const stockReports = {
overview: (params?: { locationId?: string; expiryDays?: number }) =>
api.get<StockOverview>('/reports/stock/overview', { params }).then(r => r.data),
ledger: (params?: StockLedgerParams) =>
api.get<PaginatedResponse<StockLedgerRow>>('/reports/stock/ledger', { params }).then(r => r.data),
expiry: (params?: StockExpiryParams) =>
api.get<PaginatedResponse<StockExpiryRow>>('/reports/stock/expiry', { params }).then(r => r.data),
}
export const productReports = {
stock: (params?: ProductStockParams) =>
api.get<PaginatedResponse<ProductStockRow>>('/reports/products/stock', { params }).then(r => r.data),