CRM-13973 - work on the UI implementation, CRM-13965 - improvements to BAOs
[civicrm-core.git] / CRM / Price / BAO / LineItem.php
index 98a831ebc634929462f8a5fdc90a8294c6803d22..741a10c74dd1052fc399d54bbae0a446fb7427d6 100644 (file)
@@ -92,6 +92,16 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem {
     return NULL;
   }
 
+  static function getLineTotal($entityId, $entityTable) {
+    $sqlLineItemTotal = "SELECT SUM(li.line_total)
+FROM civicrm_line_item li
+INNER JOIN civicrm_participant_payment pp ON ( li.entity_id = pp.participant_id
+AND li.entity_table = '{$entityTable}'
+AND li.entity_id = {$entityId})";
+    $lineItemTotal = CRM_Core_DAO::singleValueQuery($sqlLineItemTotal);
+    return $lineItemTotal;
+  }
+
   /**
    * Given a participant id/contribution id,
    * return contribution/fee line items