No description
Every purchase order created from a stock item printed a £0.00 unit
price, even though a cost price was on the record and the form showed
the right number.
Cause: the PO snapshot took costPriceGBP from the stock item's stored
cost_price_gbp instead of from the form. The price the user sees (and
types) into the "Unit Price (£ GBP)" field landed in snapshot.costPrice,
which nothing renders, while the PO PDF renders snapshot.costPriceGBP
(pdf.ts: `£${item.costPriceGBP}`). So a price typed into the form was
discarded and the stock item's cached value was printed instead.
Because the stock item's cost_price_gbp was only written back to the
database AFTER the PO was created, the first PO of an item always showed
£0.00 and only the next one showed the price. Verified in production:
PO-20261023-002 stored costPrice 333.78 / costPriceGBP 0 and printed
£0.00, while the linked stock item's cost_price_gbp was 0 at the time
and was updated to 333.78 by the sync step three minutes later.
Fixes:
- PurchaseOrderForm: snapshot.costPriceGBP is now the price from the
form; snapshot.costPrice is the stock item's ZAR landed cost.
- PurchaseOrderForm: selecting a stock item with no GBP cost price
leaves the price field blank instead of showing £0.00, with a hint
that the supplier's GBP price still has to be entered. Most stock
items only carry a ZAR cost price, so £0.00 looked like a real price.
- EditPurchaseOrderDialog: preserve the ZAR cost price per row instead
of zeroing it when a PO is edited.
|
||
|---|---|---|
| .cursor | ||
| .playwright-mcp | ||
| backup | ||
| docs | ||
| n8n | ||
| pocketbase | ||
| public | ||
| scripts | ||
| server | ||
| src | ||
| .env.example | ||
| .gitignore | ||
| .mcp.json | ||
| AI_RULES.md | ||
| app-overview.png | ||
| components.json | ||
| dashboard-updated.png | ||
| eslint.config.js | ||
| index.html | ||
| LOGGING_IMPLEMENTATION.md | ||
| login-mobile-final.png | ||
| login-mobile.png | ||
| login-page-final.png | ||
| login-page.png | ||
| nixpacks.json | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.js | ||
| quote-dialog.png | ||
| quote-fixed.png | ||
| quote-form.png | ||
| quote-page.png | ||
| quote-page2.png | ||
| quote-screenshot.png | ||
| README.md | ||
| setup-users.js | ||
| tailwind.config.js | ||
| tailwind.config.ts | ||
| test-logging.js | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| vercel.json | ||
| vite.config.ts | ||