fix: .01 wrong price
This commit is contained in:
parent
ee53b8cbc4
commit
bb0d14ce92
1 changed files with 17 additions and 12 deletions
|
|
@ -477,13 +477,15 @@ 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 originalPrice = body.agentPrice ? p.agentPrice : p.price;
|
||||||
|
const finalPriceWithVat = precisionRound(
|
||||||
|
originalPrice + (p.vatIncluded ? 0 : originalPrice * 1.07),
|
||||||
|
);
|
||||||
|
|
||||||
|
const price = finalPriceWithVat;
|
||||||
const pricePerUnit = p.vatIncluded ? price / (1 + VAT_DEFAULT) : price;
|
const pricePerUnit = p.vatIncluded ? price / (1 + VAT_DEFAULT) : price;
|
||||||
const vat = p.calcVat
|
const vat = p.calcVat ? (pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT : 0;
|
||||||
? (pricePerUnit * (v.discount ? v.amount : 1) - (v.discount || 0)) *
|
|
||||||
VAT_DEFAULT *
|
|
||||||
(!v.discount ? v.amount : 1)
|
|
||||||
: 0;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
order: i + 1,
|
order: i + 1,
|
||||||
|
|
@ -742,13 +744,16 @@ 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 originalPrice = record.agentPrice ? p.agentPrice : p.price;
|
||||||
|
const finalPriceWithVat = precisionRound(
|
||||||
|
originalPrice + (p.vatIncluded ? 0 : originalPrice * 1.07),
|
||||||
|
);
|
||||||
|
|
||||||
|
const price = finalPriceWithVat;
|
||||||
const pricePerUnit = p.vatIncluded ? price / (1 + VAT_DEFAULT) : price;
|
const pricePerUnit = p.vatIncluded ? price / (1 + VAT_DEFAULT) : price;
|
||||||
const vat = p.calcVat
|
const vat = p.calcVat ? (pricePerUnit * v.amount - (v.discount || 0)) * VAT_DEFAULT : 0;
|
||||||
? (pricePerUnit * (v.discount ? v.amount : 1) - (v.discount || 0)) *
|
|
||||||
VAT_DEFAULT *
|
|
||||||
(!v.discount ? v.amount : 1)
|
|
||||||
: 0;
|
|
||||||
return {
|
return {
|
||||||
order: i + 1,
|
order: i + 1,
|
||||||
productId: v.productId,
|
productId: v.productId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue