From fd3183035e6c28c2d6ac5b83bda6247a3c0b3110 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 22 Mar 2026 21:33:42 +0000 Subject: [PATCH] Fix receipt rounding: round line items to cents before summing Individual line prices were displayed rounded (via dollars()) but the raw floating-point values were accumulated into the subtotal. This caused totals like $0.99 instead of $1.00 when item prices had fractional cents. Co-Authored-By: Claude Opus 4.6 (1M context) --- receipt/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/receipt/index.php b/receipt/index.php index 3a3b242..53d97dc 100644 --- a/receipt/index.php +++ b/receipt/index.php @@ -91,10 +91,10 @@ foreach ($parentItems as $parent) { $qty = (int) $parent['Quantity']; if ((int) $parent['CategoryID'] !== 31) { - $payfritsCut += $price * $qty * (float) $order['PayfritFee']; + $payfritsCut += round($price * $qty * (float) $order['PayfritFee'], 2); } - $lineTotal = $price * $qty; + $lineTotal = round($price * $qty, 2); $cartGrandTotal += $lineTotal; $itemRows .= ''; @@ -116,7 +116,7 @@ foreach ($parentItems as $parent) { foreach ($children as $child) { $modParent = queryOne("SELECT Name FROM Items WHERE ID = ?", [(int) $child['ParentItemID']]); $modParentName = $modParent['Name'] ?? ''; - $modTotal = (float) $child['Price'] * $qty; + $modTotal = round((float) $child['Price'] * $qty, 2); $cartGrandTotal += $modTotal; $itemRows .= '';