From 6776188f7beb4b9e7872e233b52ed351eaba3a41 Mon Sep 17 00:00:00 2001 From: HAM Date: Tue, 16 Sep 2025 09:50:23 +0700 Subject: [PATCH] fix: decimal number --- src/services/flowaccount.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/services/flowaccount.ts b/src/services/flowaccount.ts index 0bb5512..fde345d 100644 --- a/src/services/flowaccount.ts +++ b/src/services/flowaccount.ts @@ -372,7 +372,7 @@ const flowAccount = { items: product.map((v) => ({ type: ProductAndServiceType.ProductNonInv, name: v.product.name, - pricePerUnit: v.pricePerUnit, + pricePerUnit: Math.round(v.pricePerUnit * 100) / 100, quantity: v.amount, discountAmount: v.discount, total: (v.pricePerUnit - (v.discount || 0)) * v.amount + v.vat, @@ -443,8 +443,7 @@ const flowAccount = { sellDescription: body.detail, sellVatType: 3, unitName: "Unit", - categoryName: "Car", - }; // helper function สำหรับสร้าง product + }; const createProduct = async (price: any, vatIncluded: boolean) => { try { @@ -463,7 +462,7 @@ const flowAccount = { if (!res.ok) { throw new Error(`Request failed with status ${res.status}`); - } // ป้องกัน response ที่ไม่ใช่ JSON หรือว่าง + } let json: any = null; try { @@ -506,7 +505,7 @@ const flowAccount = { sellVatType: 3, unitName: "Unit", categoryName: "Car", - }; // helper function สำหรับสร้าง product + }; const editProduct = async (id: String, price: any, vatIncluded: boolean) => { try { @@ -525,7 +524,7 @@ const flowAccount = { if (!res.ok) { throw new Error(`Request failed with status ${res.status}`); - } // ป้องกัน response ที่ไม่ใช่ JSON หรือว่าง + } let json: any = null; try {