Fe changes
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user