From 88629a14da020ee7d747ef293a06389beeebf003 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Fri, 16 Oct 2026 21:30:46 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=C2=AB=D0=A6=D0=B5=D0=BD=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA=D1=83=D0=BF=D0=BA=D0=B8=C2=BB=20=D0=BF=D0=BE=D0=BA?= =?UTF-8?q?=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=20=D1=81=D1=83=D0=BC?= =?UTF-8?q?=D0=BC=D1=8B=20=D0=BF=D0=BE=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D0=B5=20(=D1=86=D0=B5=D0=BD=D0=B0=20=C3=97=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BB-=D0=B2=D0=BE),=20=D0=BA=D0=B0=D0=BA=20=C2=AB=D0=A6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B4=D0=B0=D0=B6=D0=B8=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- bible-local/02-architecture.md | 5 +++++ web/templates/index.html | 24 +++++++++++------------- 2 files changed, 16 insertions(+), 13 deletions(-) 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) : '—'}