diff --git a/bible-local/02-architecture.md b/bible-local/02-architecture.md index b61bcf5..f3bd969 100644 --- a/bible-local/02-architecture.md +++ b/bible-local/02-architecture.md @@ -72,6 +72,11 @@ Buy table column order: PN вендора | Описание | LOT | Кол-во | Estimate | Склад | Конкуренты | Ручная цена ``` +Buy table money cells (Estimate / Склад / Конкуренты / Ручная цена) show the row's line +total (unit × qty), the same as the Sale table's "Цена" — never a unit price; the footer +"Итого" is the sum of those cells. A "Ручная цена" share shown in a row is that row's share +of the manual total, not divided by qty. + Sale table column order: ``` diff --git a/web/templates/index.html b/web/templates/index.html index 7d5d4ba..714134d 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -200,7 +200,7 @@

Цена покупки

- Цены указаны за 1 шт. + Суммы за всё количество
@@ -249,7 +249,7 @@

Цена продажи

- Цены указаны за 1 шт. + Суммы за всё количество
@@ -4731,10 +4731,10 @@ async function renderPricingTab() { ${pnDescHtml} - - - - + + + + `; tbodyBuy.appendChild(tr); }); @@ -4979,7 +4979,6 @@ function applyCustomPrice(table) { let assigned = 0; rows.forEach((tr, i) => { const rowEst = parseFloat(tr.dataset.est) || 0; - const qty = Math.max(1, parseFloat(tr.dataset.qty) || 1); const cell = vendorCells[i]; if (!cell) return; let share; @@ -4989,7 +4988,7 @@ function applyCustomPrice(table) { share = Math.round((rowEst / estimateTotal) * customPrice * 100) / 100; assigned += share; } - cell.textContent = formatCurrency(share / qty); + cell.textContent = formatCurrency(share); cell.className = cell.className.replace(/\btext-(?:gray|green|red|blue)-\d+\b/g, '').trim(); cell.classList.add(rowEst > 0 ? _pctClass(share, rowEst) : 'text-blue-700'); }); @@ -5003,8 +5002,8 @@ function applyCustomPrice(table) { const cell = vendorCells[i]; if (!cell) return; cell.className = cell.className.replace(/\btext-(?:gray|green|red|blue)-\d+\b/g, '').trim(); - if (tr.dataset.vendorOrigUnit !== '') { - cell.textContent = formatCurrency(parseFloat(tr.dataset.vendorOrigUnit)); + if (tr.dataset.vendorOrig !== '') { + cell.textContent = formatCurrency(parseFloat(tr.dataset.vendorOrig)); } else { cell.textContent = '—'; cell.classList.add('text-gray-400'); @@ -5042,10 +5041,9 @@ function setPricingCustomPriceFromVendor() { rows.forEach((tr, i) => { const cell = vendorCells[i]; if (!cell) return; - const origUnit = tr.dataset.vendorOrigUnit; const origTotal = tr.dataset.vendorOrig; - if (origUnit !== '') { - cell.textContent = formatCurrency(parseFloat(origUnit)); + if (origTotal !== '') { + cell.textContent = formatCurrency(parseFloat(origTotal)); cell.className = cell.className.replace(/\btext-(?:gray|green|red|blue)-\d+\b/g, '').trim(); total += parseFloat(origTotal) || 0; hasAny = true;
${r.lotCell} ${r.qty}${r.estUnit > 0 ? formatCurrency(r.estUnit) : '—'}${worldMark(r.estWorld)}${r.warehouseUnit != null ? formatCurrency(r.warehouseUnit) : '—'}${worldMark(r.whWorld)}${r.competitorUnit != null ? formatCurrency(r.competitorUnit) : '—'}${worldMark(r.compWorld)}${r.vendorOrigUnit != null ? formatCurrency(r.vendorOrigUnit) : '—'}${r.est > 0 ? formatCurrency(r.est) : '—'}${worldMark(r.estWorld)}${r.warehouse != null ? formatCurrency(r.warehouse) : '—'}${worldMark(r.whWorld)}${r.competitor != null ? formatCurrency(r.competitor) : '—'}${worldMark(r.compWorld)}${r.vendorOrig != null ? formatCurrency(r.vendorOrig) : '—'}