3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 trait CRM_Financial_Form_SalesTaxTrait
{
20 * Assign the sales tax term to the template.
22 public function assignSalesTaxTermToTemplate() {
23 $this->assign('taxTerm', $this->getSalesTaxTerm());
27 * Assign sales tax rates to the template.
29 public function assignSalesTaxRates() {
30 $this->assign('taxRates', json_encode(CRM_Core_PseudoConstant
::getTaxRates()));
34 * Return the string to be assigned to the template for sales tax - e.g GST, VAT.
38 public function getSalesTaxTerm() {
39 if (!Civi
::settings()->get('invoicing')) {
42 return Civi
::settings()->get('tax_term');
46 * Assign information to the template required for sales tax purposes.
48 public function assignSalesTaxMetadataToTemplate() {
49 $this->assignSalesTaxRates();
50 $this->assignSalesTaxTermToTemplate();
54 * Get sales tax rates.
58 public function getTaxRatesForFinancialTypes() {
59 return CRM_Core_PseudoConstant
::getTaxRates();
63 * @param int $financialTypeID
67 public function getTaxRateForFinancialType($financialTypeID) {
68 return CRM_Utils_Array
::value($financialTypeID, $this->getTaxRatesForFinancialTypes());