Include PlatformFee in order detail total calculation

getDetail.php was computing total as subtotal + tax + tip, omitting the
Payfrit service fee. This caused the order detail view to show a lower
total than what the cart/checkout displayed at order time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-16 22:39:24 -07:00
parent 07abcee2fd
commit b5394aec7c

View file

@ -42,7 +42,7 @@ try {
SELECT SELECT
o.ID, o.UUID, o.BusinessID, o.UserID, o.ServicePointID, o.ID, o.UUID, o.BusinessID, o.UserID, o.ServicePointID,
o.StatusID, o.OrderTypeID, o.Remarks, o.AddedOn, o.LastEditedOn, o.StatusID, o.OrderTypeID, o.Remarks, o.AddedOn, o.LastEditedOn,
o.SubmittedOn, o.TipAmount, o.SubmittedOn, o.TipAmount, o.PlatformFee,
u.FirstName, u.LastName, u.ContactNumber, u.EmailAddress, u.FirstName, u.LastName, u.ContactNumber, u.EmailAddress,
sp.Name AS Name, sp.TypeID AS TypeID, sp.Name AS Name, sp.TypeID AS TypeID,
b.Name AS BizName, b.TaxRate b.Name AS BizName, b.TaxRate
@ -112,7 +112,8 @@ try {
$taxRate = (is_numeric($qOrder['TaxRate']) && (float) $qOrder['TaxRate'] > 0) ? (float) $qOrder['TaxRate'] : 0; $taxRate = (is_numeric($qOrder['TaxRate']) && (float) $qOrder['TaxRate'] > 0) ? (float) $qOrder['TaxRate'] : 0;
$tax = $subtotal * $taxRate; $tax = $subtotal * $taxRate;
$tip = is_numeric($qOrder['TipAmount']) ? (float) $qOrder['TipAmount'] : 0; $tip = is_numeric($qOrder['TipAmount']) ? (float) $qOrder['TipAmount'] : 0;
$total = $subtotal + $tax + $tip; $platformFee = is_numeric($qOrder['PlatformFee']) ? (float) $qOrder['PlatformFee'] : 0;
$total = $subtotal + $tax + $tip + $platformFee;
// Get staff who worked on this order // Get staff who worked on this order
$qStaff = queryTimed(" $qStaff = queryTimed("
@ -157,6 +158,7 @@ try {
'Subtotal' => $subtotal, 'Subtotal' => $subtotal,
'Tax' => $tax, 'Tax' => $tax,
'Tip' => $tip, 'Tip' => $tip,
'PlatformFee' => $platformFee,
'Total' => $total, 'Total' => $total,
'Notes' => $qOrder['Remarks'], 'Notes' => $qOrder['Remarks'],
'CreatedOn' => toISO8601($qOrder['AddedOn']), 'CreatedOn' => toISO8601($qOrder['AddedOn']),