Fix rounding error

This commit is contained in:
2024-06-28 20:52:46 +02:00
parent 638943d4c6
commit 5ba37dca9f
+2 -2
View File
@@ -10,7 +10,7 @@ export async function createPdf(filename: string, reportId: string, dateStart: s
let total : number = 0;
for(let container of containers){
let price = (container.price * container.checkouts.length);
let price = Math.round((container.price * container.checkouts.length) * 100) / 100;
total += price;
let bodyRow = [
@@ -38,7 +38,7 @@ export async function createPdf(filename: string, reportId: string, dateStart: s
startY: 40,
head: [['Drink', 'Price', 'Amount', 'Total']],
body: body,
foot: [["", "", "Total", "€" + total]]
foot: [["", "", "Total", "€" + (Math.round(total*100)/100)]]
});
let finalY = doc.autoTable.previous.finalY;