fix: decimal number
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
This commit is contained in:
parent
892d76583f
commit
6776188f7b
1 changed files with 5 additions and 6 deletions
|
|
@ -372,7 +372,7 @@ const flowAccount = {
|
||||||
items: product.map((v) => ({
|
items: product.map((v) => ({
|
||||||
type: ProductAndServiceType.ProductNonInv,
|
type: ProductAndServiceType.ProductNonInv,
|
||||||
name: v.product.name,
|
name: v.product.name,
|
||||||
pricePerUnit: v.pricePerUnit,
|
pricePerUnit: Math.round(v.pricePerUnit * 100) / 100,
|
||||||
quantity: v.amount,
|
quantity: v.amount,
|
||||||
discountAmount: v.discount,
|
discountAmount: v.discount,
|
||||||
total: (v.pricePerUnit - (v.discount || 0)) * v.amount + v.vat,
|
total: (v.pricePerUnit - (v.discount || 0)) * v.amount + v.vat,
|
||||||
|
|
@ -443,8 +443,7 @@ const flowAccount = {
|
||||||
sellDescription: body.detail,
|
sellDescription: body.detail,
|
||||||
sellVatType: 3,
|
sellVatType: 3,
|
||||||
unitName: "Unit",
|
unitName: "Unit",
|
||||||
categoryName: "Car",
|
};
|
||||||
}; // helper function สำหรับสร้าง product
|
|
||||||
|
|
||||||
const createProduct = async (price: any, vatIncluded: boolean) => {
|
const createProduct = async (price: any, vatIncluded: boolean) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -463,7 +462,7 @@ const flowAccount = {
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(`Request failed with status ${res.status}`);
|
throw new Error(`Request failed with status ${res.status}`);
|
||||||
} // ป้องกัน response ที่ไม่ใช่ JSON หรือว่าง
|
}
|
||||||
|
|
||||||
let json: any = null;
|
let json: any = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -506,7 +505,7 @@ const flowAccount = {
|
||||||
sellVatType: 3,
|
sellVatType: 3,
|
||||||
unitName: "Unit",
|
unitName: "Unit",
|
||||||
categoryName: "Car",
|
categoryName: "Car",
|
||||||
}; // helper function สำหรับสร้าง product
|
};
|
||||||
|
|
||||||
const editProduct = async (id: String, price: any, vatIncluded: boolean) => {
|
const editProduct = async (id: String, price: any, vatIncluded: boolean) => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -525,7 +524,7 @@ const flowAccount = {
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(`Request failed with status ${res.status}`);
|
throw new Error(`Request failed with status ${res.status}`);
|
||||||
} // ป้องกัน response ที่ไม่ใช่ JSON หรือว่าง
|
}
|
||||||
|
|
||||||
let json: any = null;
|
let json: any = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue