fix: forgot price per unit

This commit is contained in:
puriphatt 2024-10-09 09:52:34 +07:00
parent 06c96d1136
commit 93b184d40d

View file

@ -207,7 +207,14 @@ function mapNode() {
const noNameObjects = v.work const noNameObjects = v.work
.filter((w: Work) => !w.name) .filter((w: Work) => !w.name)
.flatMap((w: Work) => .flatMap((w: Work) =>
w.productOnWork.map((p) => ({ w.productOnWork.map((p) => {
const price = prop.agentPrice
? p.product.agentPrice
: p.product.price;
const pricePerUnit = p.product.vatIncluded
? precisionRound(price / (1 + (config.value?.vat || 0.07)))
: price;
return {
type: 'product', type: 'product',
id: p.product.id, id: p.product.id,
title: p.product.name, title: p.product.name,
@ -216,7 +223,7 @@ function mapNode() {
remark: p.product.remark, remark: p.product.remark,
value: { value: {
vat: 0, vat: 0,
pricePerUnit: 0, pricePerUnit,
discount: 0, discount: 0,
amount: 0, amount: 0,
service: v.raw, service: v.raw,
@ -227,7 +234,8 @@ function mapNode() {
icon: 'mdi-shopping-outline', icon: 'mdi-shopping-outline',
bg: 'hsla(var(--teal-10-hsl)/0.1)', bg: 'hsla(var(--teal-10-hsl)/0.1)',
fg: 'var(--teal-10)', fg: 'var(--teal-10)',
})), };
}),
); );
const withNameObjects = v.work const withNameObjects = v.work
.filter((w: Work) => w.name) .filter((w: Work) => w.name)
@ -490,6 +498,7 @@ watch(
class="q-py-sm q-px-lg" class="q-py-sm q-px-lg"
style="background: hsla(var(--info-bg) / 0.1)" style="background: hsla(var(--info-bg) / 0.1)"
> >
0
{{ {{
$t('general.list', { $t('general.list', {
msg: $t('productService.title'), msg: $t('productService.title'),