fix: price not accurate after recalc vat
This commit is contained in:
parent
f4bbfbbc08
commit
a4ba0e032f
1 changed files with 8 additions and 8 deletions
|
|
@ -419,11 +419,11 @@ export class QuotationController extends Controller {
|
||||||
const list = body.productServiceList.map((v, i) => {
|
const list = body.productServiceList.map((v, i) => {
|
||||||
const p = product.find((p) => p.id === v.productId)!;
|
const p = product.find((p) => p.id === v.productId)!;
|
||||||
const price = body.agentPrice ? p.agentPrice : p.price;
|
const price = body.agentPrice ? p.agentPrice : p.price;
|
||||||
const pricePerUnit = p.vatIncluded ? precisionRound(price / (1 + VAT_DEFAULT)) : price;
|
const pricePerUnit = p.vatIncluded ? price / (1 + VAT_DEFAULT) : price;
|
||||||
const vat = p.calcVat
|
const vat = p.calcVat
|
||||||
? precisionRound(
|
? (pricePerUnit * (v.discount ? v.amount : 1) - (v.discount || 0)) *
|
||||||
(pricePerUnit * (v.discount ? v.amount : 1) - (v.discount || 0)) * VAT_DEFAULT,
|
VAT_DEFAULT *
|
||||||
) * (!v.discount ? v.amount : 1)
|
(!v.discount ? v.amount : 1)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -684,11 +684,11 @@ export class QuotationController extends Controller {
|
||||||
const list = body.productServiceList?.map((v, i) => {
|
const list = body.productServiceList?.map((v, i) => {
|
||||||
const p = product.find((p) => p.id === v.productId)!;
|
const p = product.find((p) => p.id === v.productId)!;
|
||||||
const price = record.agentPrice ? p.agentPrice : p.price;
|
const price = record.agentPrice ? p.agentPrice : p.price;
|
||||||
const pricePerUnit = p.vatIncluded ? precisionRound(price / (1 + VAT_DEFAULT)) : price;
|
const pricePerUnit = p.vatIncluded ? price / (1 + VAT_DEFAULT) : price;
|
||||||
const vat = p.calcVat
|
const vat = p.calcVat
|
||||||
? precisionRound(
|
? (pricePerUnit * (v.discount ? v.amount : 1) - (v.discount || 0)) *
|
||||||
(pricePerUnit * (v.discount ? v.amount : 1) - (v.discount || 0)) * VAT_DEFAULT,
|
VAT_DEFAULT *
|
||||||
) * (!v.discount ? v.amount : 1)
|
(!v.discount ? v.amount : 1)
|
||||||
: 0;
|
: 0;
|
||||||
return {
|
return {
|
||||||
order: i + 1,
|
order: i + 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue