+
+ /**
+ * Get all tax rates
+ *
+ * The static array tax rates is returned
+ *
+ * @static
+ *
+ * @return array - array list of tax rates with the financial type
+ */
+ public static function getTaxRates() {
+ if (!self::$taxRates) {
+ self::$taxRates = array();
+ $sql = "
+ SELECT fa.tax_rate, efa.entity_id
+ FROM civicrm_entity_financial_account efa
+ INNER JOIN civicrm_financial_account fa ON fa.id = efa.financial_account_id
+ INNER JOIN civicrm_option_value cov ON cov.value = efa.account_relationship
+ INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id
+ WHERE efa.entity_table = 'civicrm_financial_type'
+ AND cov.name = 'Sales Tax Account is'
+ AND cog.name = 'account_relationship'
+ AND fa.is_active = 1";
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ while ($dao->fetch()) {
+ self::$taxRates[$dao->entity_id] = $dao->tax_rate;
+ }
+ }
+
+ return self::$taxRates;
+ }
+}