cost/price/margin

This commit is contained in:
Thanakorn S
2026-05-06 09:37:28 +07:00
parent 6501d326ca
commit d8131a01b7
10 changed files with 130 additions and 27 deletions
+15 -2
View File
@@ -197,6 +197,8 @@
<th width="75px"></th>
<th>Product</th>
<th>SKU</th>
<th style="text-align: right;">Price / Cost</th>
<th style="text-align: right;">Margin</th>
<th>UOM</th>
<th style="text-align: right;">Current Stock</th>
<th style="text-align: right;">Min Stock</th>
@@ -345,7 +347,7 @@
if (filtered.length === 0) {
$("table#product > tbody").html(
'<tr><td colspan="9" class="text-center py-5 text-muted">No products match your search.</td></tr>'
'<tr><td colspan="11" class="text-center py-5 text-muted">No products match your search.</td></tr>'
);
return;
}
@@ -362,6 +364,17 @@
</td>
<td class="py-3">${item['product_name']}</td>
<td class="py-3">${item['sku']}</td>
<td class="py-3 text-end">
<div>${format_number(item['price'], 2)}</div>
<small class="text-muted">${format_number(item['cost_price'], 2)}</small>
</td>
<td class="py-3 text-end">
${(item['price'] > 0 && item['cost_price'] > 0)
? `<span class="${((item['price'] - item['cost_price']) / item['price'] * 100) >= 0 ? 'text-success' : 'text-danger'} fw-semibold">
${format_number((item['price'] - item['cost_price']) / item['price'] * 100, 1)}%
</span>`
: '<span class="text-muted">—</span>'}
</td>
<td class="py-3"><span class="badge bg-light text-secondary border">${item['uom'] || 'pcs'}</span></td>
<td class="py-3">
<div class="d-flex justify-content-end align-items-baseline gap-1">
@@ -472,4 +485,4 @@
</body>
</html>
</html>