fix: calculation
This commit is contained in:
parent
c13eeb9b14
commit
67c3ead7ec
1 changed files with 6 additions and 7 deletions
|
|
@ -340,7 +340,7 @@ export class QuotationController extends Controller {
|
||||||
|
|
||||||
const currentWork = currentService.work.find((d) => d.id === c.id);
|
const currentWork = currentService.work.find((d) => d.id === c.id);
|
||||||
|
|
||||||
if (!currentWork) return []; // should not possible
|
if (!currentWork) return []; // additional will get stripped
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: currentWork.id,
|
id: currentWork.id,
|
||||||
|
|
@ -352,11 +352,13 @@ export class QuotationController extends Controller {
|
||||||
|
|
||||||
if (!currentProduct) return []; // should not possible
|
if (!currentProduct) return []; // should not possible
|
||||||
|
|
||||||
price.totalPrice += currentProduct.price;
|
price.totalPrice += currentProduct.price * e.amount;
|
||||||
price.totalDiscount += Math.round(currentProduct.price * e.discount * 100) / 100;
|
price.totalDiscount +=
|
||||||
|
Math.round(currentProduct.price * e.amount * e.discount * 100) / 100;
|
||||||
price.totalVat +=
|
price.totalVat +=
|
||||||
Math.round(
|
Math.round(
|
||||||
(currentProduct.price - currentProduct.price * e.discount) *
|
(currentProduct.price * e.amount -
|
||||||
|
currentProduct.price * e.amount * e.discount) *
|
||||||
(e.vat === undefined ? 0.07 : e.vat) *
|
(e.vat === undefined ? 0.07 : e.vat) *
|
||||||
100,
|
100,
|
||||||
) / 100;
|
) / 100;
|
||||||
|
|
@ -373,9 +375,6 @@ export class QuotationController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
const quotation = await tx.quotation.create({
|
const quotation = await tx.quotation.create({
|
||||||
include: {
|
|
||||||
service: true,
|
|
||||||
},
|
|
||||||
data: {
|
data: {
|
||||||
...rest,
|
...rest,
|
||||||
statusOrder: +(rest.status === "INACTIVE"),
|
statusOrder: +(rest.status === "INACTIVE"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue