diff --git a/web/templates/index.html b/web/templates/index.html
index f22dfd3..d4a2181 100644
--- a/web/templates/index.html
+++ b/web/templates/index.html
@@ -3953,6 +3953,9 @@ async function renderPricingTab() {
};
// Collect LOTs to price: from BOM rows (resolved) or from cart
+ // Use cart quantity when available (source of truth); fall back to BOM-computed quantity.
+ const _cartQtyMap = {};
+ cart.forEach(item => { if (item?.lot_name) _cartQtyMap[item.lot_name] = item.quantity; });
let itemsForPriceLevels = [];
if (bomRows.length) {
const seen = new Set();
@@ -3961,13 +3964,13 @@ async function renderPricingTab() {
const allocs = _getRowAllocations(row).filter(a => a.lot_name && _bomLotValid(a.lot_name) && a.quantity >= 1);
if (baseLot && !seen.has(baseLot)) {
seen.add(baseLot);
- itemsForPriceLevels.push({ lot_name: baseLot, quantity: row.quantity * _getRowLotQtyPerPN(row) });
+ itemsForPriceLevels.push({ lot_name: baseLot, quantity: _cartQtyMap[baseLot] ?? (row.quantity * _getRowLotQtyPerPN(row)) });
}
if (allocs.length) {
allocs.forEach(a => {
if (!seen.has(a.lot_name)) {
seen.add(a.lot_name);
- itemsForPriceLevels.push({ lot_name: a.lot_name, quantity: row.quantity * a.quantity });
+ itemsForPriceLevels.push({ lot_name: a.lot_name, quantity: _cartQtyMap[a.lot_name] ?? (row.quantity * a.quantity) });
}
});
}
@@ -4020,6 +4023,8 @@ async function renderPricingTab() {
// ─── Build shared row data (unit prices for display, totals for math) ────
// Each BOM row is exploded into per-LOT sub-rows; grouped by vendor PN via groupStart/groupSize.
+ const cartQtyMap = {};
+ cart.forEach(item => { if (item?.lot_name) cartQtyMap[item.lot_name] = item.quantity; });
const _buildRows = () => {
const result = [];
const coveredLots = new Set();
@@ -4064,7 +4069,7 @@ async function renderPricingTab() {
if (baseLot) {
const u = _getUnitPrices(priceMap[baseLot]);
const lotQty = _getRowLotQtyPerPN(row);
- const qty = row.quantity * lotQty;
+ const qty = cartQtyMap[baseLot] ?? (row.quantity * lotQty);
subRows.push({
lotCell: escapeHtml(baseLot), lotText: baseLot, qty,
estUnit: u.estUnit > 0 ? u.estUnit : 0,
@@ -4076,7 +4081,7 @@ async function renderPricingTab() {
}
allocs.forEach(a => {
const u = _getUnitPrices(priceMap[a.lot_name]);
- const qty = row.quantity * a.quantity;
+ const qty = cartQtyMap[a.lot_name] ?? (row.quantity * a.quantity);
subRows.push({
lotCell: escapeHtml(a.lot_name), lotText: a.lot_name, qty,
estUnit: u.estUnit > 0 ? u.estUnit : 0,