feat: fallback to 0 if empty
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s

This commit is contained in:
Methapon2001 2025-04-23 09:03:03 +07:00
parent 601deffce4
commit d15aa488c1

View file

@ -480,19 +480,19 @@ export class ProductController extends Controller {
price: price:
typeof item.price === "number" typeof item.price === "number"
? item.price ? item.price
: +parseFloat(item.price.replace(",", "")).toFixed(6), : +parseFloat(item.price?.replace(",", "") || "0").toFixed(6),
calcVat: item.calcVat === "ใช่" ? true : false, calcVat: item.calcVat === "ใช่" ? true : false,
vatIncluded: item.vatIncluded === "รวม" ? true : false, vatIncluded: item.vatIncluded === "รวม" ? true : false,
agentPrice: agentPrice:
typeof item.agentPrice === "number" typeof item.agentPrice === "number"
? item.agentPrice ? item.agentPrice
: +parseFloat(item.agentPrice.replace(",", "")).toFixed(6), : +parseFloat(item.agentPrice?.replace(",", "") || "0").toFixed(6),
agentPriceCalcVat: item.agentPriceCalcVat === "ใช่" ? true : false, agentPriceCalcVat: item.agentPriceCalcVat === "ใช่" ? true : false,
agentPriceVatIncluded: item.agentPriceVatIncluded === "รวม" ? true : false, agentPriceVatIncluded: item.agentPriceVatIncluded === "รวม" ? true : false,
serviceCharge: serviceCharge:
typeof item.serviceCharge === "number" typeof item.serviceCharge === "number"
? item.serviceCharge ? item.serviceCharge
: +parseFloat(item.serviceCharge.replace(",", "")).toFixed(6), : +parseFloat(item.serviceCharge?.replace(",", "") || "0").toFixed(6),
serviceChargeCalcVat: item.serviceChargeCalcVat === "ใช่" ? true : false, serviceChargeCalcVat: item.serviceChargeCalcVat === "ใช่" ? true : false,
serviceChargeVatIncluded: item.serviceChargeVatIncluded === "รวม" ? true : false, serviceChargeVatIncluded: item.serviceChargeVatIncluded === "รวม" ? true : false,
}; };