fix: «Цена покупки» показывает суммы по строке (цена × кол-во), как «Цена продажи»
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f30dd0d27
commit
88629a14da
2 files changed
+16
-13
No files matched your search
@@ -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:
|
||||
|
||||
```
|
||||
|
||||
+11
-13
@@ -200,7 +200,7 @@
|
||||
<div class="bg-white rounded-lg shadow p-4">
|
||||
<div class="flex items-baseline gap-3 mb-3">
|
||||
<h3 class="text-base font-semibold text-gray-800">Цена покупки</h3>
|
||||
<span class="text-xs text-gray-400">Цены указаны за 1 шт.</span>
|
||||
<span class="text-xs text-gray-400">Суммы за всё количество</span>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm border-collapse">
|
||||
@@ -249,7 +249,7 @@
|
||||
<div class="bg-white rounded-lg shadow p-4">
|
||||
<div class="flex items-baseline gap-3 mb-1">
|
||||
<h3 class="text-base font-semibold text-gray-800">Цена продажи</h3>
|
||||
<span class="text-xs text-gray-400">Цены указаны за 1 шт.</span>
|
||||
<span class="text-xs text-gray-400">Суммы за всё количество</span>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm border-collapse">
|
||||
@@ -4731,10 +4731,10 @@ async function renderPricingTab() {
|
||||
${pnDescHtml}
|
||||
<td class="px-2 py-0.5 text-xs ${borderTop}">${r.lotCell}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs ${borderTop}">${r.qty}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs ${borderTop} ${worldCls(r.estWorld)}">${r.estUnit > 0 ? formatCurrency(r.estUnit) : '—'}${worldMark(r.estWorld)}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs stock-price-col ${borderTop} ${worldCls(r.whWorld)}">${r.warehouseUnit != null ? formatCurrency(r.warehouseUnit) : '—'}${worldMark(r.whWorld)}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs ${borderTop} ${worldCls(r.compWorld)}">${r.competitorUnit != null ? formatCurrency(r.competitorUnit) : '—'}${worldMark(r.compWorld)}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs pricing-vendor-price-buy ${borderTop} ${r.vendorOrigUnit == null ? 'text-gray-400' : ''}">${r.vendorOrigUnit != null ? formatCurrency(r.vendorOrigUnit) : '—'}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs ${borderTop} ${worldCls(r.estWorld)}">${r.est > 0 ? formatCurrency(r.est) : '—'}${worldMark(r.estWorld)}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs stock-price-col ${borderTop} ${worldCls(r.whWorld)}">${r.warehouse != null ? formatCurrency(r.warehouse) : '—'}${worldMark(r.whWorld)}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs ${borderTop} ${worldCls(r.compWorld)}">${r.competitor != null ? formatCurrency(r.competitor) : '—'}${worldMark(r.compWorld)}</td>
|
||||
<td class="px-2 py-0.5 text-right text-xs pricing-vendor-price-buy ${borderTop} ${r.vendorOrig == null ? 'text-gray-400' : ''}">${r.vendorOrig != null ? formatCurrency(r.vendorOrig) : '—'}</td>
|
||||
`;
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user