Merge remote branch 'canonical/master' into merge-forward
[civicrm-core.git] / CRM / Contribute / BAO / Contribution / Utils.php
index b1a42a787a8c21463e5c69a36832c88427dbc3b1..f4b958f98d16d21531112566da4de6fae9fe3dfe 100644 (file)
@@ -860,5 +860,24 @@ LIMIT 1
     }
     return $_cache[$contactID];
   }
+
+  /**
+   * Calculate the tax amount based on given tax rate.
+   *
+   * @param float $amount amount of field.
+   * @param float $taxRate tax rate of selected financial account for field.
+   *
+   * @return array array of tax amount
+   *
+   * @access public
+   * @static
+   *
+   */
+  public static function calculateTaxAmount($amount, $taxRate) {
+    $taxAmount = array();
+    $taxAmount['tax_amount'] = ($taxRate/100) * $amount;
+
+    return $taxAmount;
+  }
 }