fix: calc price
This commit is contained in:
parent
997d6c4afa
commit
6c299b8c1b
1 changed files with 16 additions and 15 deletions
|
|
@ -704,18 +704,22 @@ function handleUpdateProductTable(
|
|||
newInstallmentNo: number;
|
||||
},
|
||||
) {
|
||||
handleChangePayType(quotationFormData.value.payCondition);
|
||||
// calc price
|
||||
const calc = (c: QuotationPayload['productServiceList'][number]) => {
|
||||
const pricePerUnit = c.pricePerUnit || 0;
|
||||
const discount = c.discount || 0;
|
||||
|
||||
return (
|
||||
pricePerUnit * c.amount -
|
||||
discount +
|
||||
(c.product.calcVat
|
||||
? (pricePerUnit * c.amount - discount) * (config.value?.vat || 0.07)
|
||||
: 0)
|
||||
const originalPrice = c.pricePerUnit || 0;
|
||||
const finalPriceWithVat = precisionRound(
|
||||
originalPrice * (1 + (config.value?.vat || 0.07)),
|
||||
);
|
||||
const finalPriceNoVat =
|
||||
finalPriceWithVat / (1 + (config.value?.vat || 0.07));
|
||||
|
||||
const price = finalPriceNoVat * c.amount;
|
||||
const vat = c.product.calcVat
|
||||
? (finalPriceNoVat * c.amount - (c.discount || 0)) *
|
||||
(config.value?.vat || 0.07)
|
||||
: 0;
|
||||
return precisionRound(price + vat);
|
||||
};
|
||||
|
||||
// installment
|
||||
|
|
@ -2057,23 +2061,20 @@ watch(
|
|||
|
||||
<div class="surface-1 q-pa-md flex" style="gap: var(--size-2)">
|
||||
<SelectInput
|
||||
style="max-width: 250px"
|
||||
class="q-mr-xl"
|
||||
incremental
|
||||
class="q-mr-sm"
|
||||
v-model="templateForm"
|
||||
id="quotation-branch"
|
||||
:option="templateFormOption"
|
||||
:label="$t('quotation.templateForm')"
|
||||
:option-label="locale === 'eng' ? 'labelEN' : 'label'"
|
||||
/>
|
||||
<MainButton
|
||||
<!-- <MainButton
|
||||
outlined
|
||||
icon="mdi-play-box-outline"
|
||||
color="207 96% 32%"
|
||||
@click="storeDataLocal"
|
||||
>
|
||||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||
</MainButton>
|
||||
</MainButton> -->
|
||||
<MainButton
|
||||
solid
|
||||
icon="mdi-pencil-outline"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue