diff --git a/prisma/migrations/20241003045028_remove_unused_field/migration.sql b/prisma/migrations/20241003045028_remove_unused_field/migration.sql new file mode 100644 index 0000000..90f9942 --- /dev/null +++ b/prisma/migrations/20241003045028_remove_unused_field/migration.sql @@ -0,0 +1,8 @@ +/* + Warnings: + + - You are about to drop the column `vatExcluded` on the `Quotation` table. All the data in the column will be lost. + +*/ +-- AlterTable +ALTER TABLE "Quotation" DROP COLUMN "vatExcluded"; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 63a588e..e3e5f3c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1053,7 +1053,6 @@ model Quotation { totalPrice Float totalDiscount Float vat Float - vatExcluded Float finalPrice Float createdAt DateTime @default(now()) diff --git a/src/controllers/05-quotation-controller.ts b/src/controllers/05-quotation-controller.ts index 4505c80..a8095af 100644 --- a/src/controllers/05-quotation-controller.ts +++ b/src/controllers/05-quotation-controller.ts @@ -339,8 +339,8 @@ export class QuotationController extends Controller { const price = list.reduce( (a, c) => { const price = c.pricePerUnit * c.amount; - const discount = price * c.discount; - const vat = (price - discount) * c.vat; + const discount = Math.round(price * c.discount * 100) / 100; + const vat = Math.round((price - discount) * c.vat * 100) / 100; a.totalPrice += price; a.totalDiscount += discount; @@ -353,7 +353,6 @@ export class QuotationController extends Controller { totalPrice: 0, totalDiscount: 0, vat: 0, - vatExcluded: 0, finalPrice: 0, }, ); @@ -547,7 +546,6 @@ export class QuotationController extends Controller { totalPrice: 0, totalDiscount: 0, vat: 0, - vatExcluded: 0, finalPrice: 0, }, );