diff --git a/src/controllers/04-product-controller.ts b/src/controllers/04-product-controller.ts index 80b7c71..3f2ff4e 100644 --- a/src/controllers/04-product-controller.ts +++ b/src/controllers/04-product-controller.ts @@ -480,19 +480,19 @@ export class ProductController extends Controller { price: typeof item.price === "number" ? item.price - : +parseFloat(item.price.replace(",", "")).toFixed(6), + : +parseFloat(item.price?.replace(",", "") || "0").toFixed(6), calcVat: item.calcVat === "ใช่" ? true : false, vatIncluded: item.vatIncluded === "รวม" ? true : false, agentPrice: typeof item.agentPrice === "number" ? item.agentPrice - : +parseFloat(item.agentPrice.replace(",", "")).toFixed(6), + : +parseFloat(item.agentPrice?.replace(",", "") || "0").toFixed(6), agentPriceCalcVat: item.agentPriceCalcVat === "ใช่" ? true : false, agentPriceVatIncluded: item.agentPriceVatIncluded === "รวม" ? true : false, serviceCharge: typeof item.serviceCharge === "number" ? item.serviceCharge - : +parseFloat(item.serviceCharge.replace(",", "")).toFixed(6), + : +parseFloat(item.serviceCharge?.replace(",", "") || "0").toFixed(6), serviceChargeCalcVat: item.serviceChargeCalcVat === "ใช่" ? true : false, serviceChargeVatIncluded: item.serviceChargeVatIncluded === "รวม" ? true : false, };