diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php index 79edf0baa97d..5b4a2b55b511 100644 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@ -606,6 +606,16 @@ protected static function getAmountOfLineItemPaid($lineItemID) { $paid += $entityFinancialTrxn['amount']; } } + + $lineItem = \Civi\Api4\LineItem::get(FALSE) + ->addWhere('id', '=', $lineItemID) + ->execute() + ->first(); + if (!empty($lineItem['tax_amount']) && $paid > 0) { + $total = floatval($lineItem['line_total']); + $tax = floatval($lineItem['tax_amount']); + $paid = ($total * $paid) / ($tax + $total); + } return (float) $paid; }