Fix rounding error
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user