refactor!: remove unused field

This commit is contained in:
Methapon Metanipat 2024-10-03 11:58:27 +07:00
parent c5c26400f8
commit ab91d0923f
3 changed files with 10 additions and 5 deletions

View file

@ -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";

View file

@ -1053,7 +1053,6 @@ model Quotation {
totalPrice Float totalPrice Float
totalDiscount Float totalDiscount Float
vat Float vat Float
vatExcluded Float
finalPrice Float finalPrice Float
createdAt DateTime @default(now()) createdAt DateTime @default(now())

View file

@ -339,8 +339,8 @@ export class QuotationController extends Controller {
const price = list.reduce( const price = list.reduce(
(a, c) => { (a, c) => {
const price = c.pricePerUnit * c.amount; const price = c.pricePerUnit * c.amount;
const discount = price * c.discount; const discount = Math.round(price * c.discount * 100) / 100;
const vat = (price - discount) * c.vat; const vat = Math.round((price - discount) * c.vat * 100) / 100;
a.totalPrice += price; a.totalPrice += price;
a.totalDiscount += discount; a.totalDiscount += discount;
@ -353,7 +353,6 @@ export class QuotationController extends Controller {
totalPrice: 0, totalPrice: 0,
totalDiscount: 0, totalDiscount: 0,
vat: 0, vat: 0,
vatExcluded: 0,
finalPrice: 0, finalPrice: 0,
}, },
); );
@ -547,7 +546,6 @@ export class QuotationController extends Controller {
totalPrice: 0, totalPrice: 0,
totalDiscount: 0, totalDiscount: 0,
vat: 0, vat: 0,
vatExcluded: 0,
finalPrice: 0, finalPrice: 0,
}, },
); );