I would like to create new project Inventory
.
I am not clear for Collection Schema
with Inventory/Qty and AVG Cost
.
My Schema
Product = {code, name, cost, price....}
Purchase = {date, ....} ---> product details to Inventory
Sale = {date, ...} ---> product details to Inventory
Inventory = {
refType (Purchase, Sale),
refId (purchaseId, saleId),
productId,
qty (+ from purchase, - from sale),
amount,
total (qty * amount),
balance: {
qty (ending),
total (ending),
avgCost (ending)
}
}
Problem:
- Entry new `purchase or sale` on previous date
- Modifier old `purchase or sale` on previous date
- Dynamic view inventory report (current or previous date)
We should recalculate all next Inventory
records when have any modify
previous records???
Please advise!!!