From 03b412ae5b8d7047f8e378038a32fe731b6e7fb0 Mon Sep 17 00:00:00 2001 From: Parag Bhilkar Date: Sat, 5 Jul 2014 15:37:04 +0530 Subject: [PATCH] VAT-572 Display Invoicing functionality based on admin globle setting under CiviContribute Component settings. --- CRM/Admin/Form/Preferences/Contribute.php | 24 +++++---- CRM/Contribute/Form/Contribution.php | 6 ++- CRM/Contribute/Form/Contribution/Confirm.php | 49 +++++++++++++------ CRM/Contribute/Form/Contribution/ThankYou.php | 19 ++++++- CRM/Contribute/Form/ContributionView.php | 5 +- CRM/Contribute/Page/UserDashboard.php | 3 ++ CRM/Event/Form/EventFees.php | 6 ++- CRM/Event/Form/Participant.php | 27 +++++----- CRM/Event/Form/ParticipantView.php | 6 ++- CRM/Event/Form/Registration/Confirm.php | 45 ++++++++++++----- CRM/Event/Form/Registration/ThankYou.php | 36 ++++++++++---- CRM/Member/Form/Membership.php | 30 ++++++------ CRM/Price/BAO/LineItem.php | 10 +++- CRM/Price/BAO/PriceField.php | 18 ++++--- CRM/Price/Page/Field.php | 7 ++- CRM/Price/Page/Option.php | 7 ++- css/civicrm.css | 31 ++++++------ .../CRM/Contribute/Form/ContributionView.tpl | 40 ++++++++------- .../CRM/Contribute/Page/UserDashboard.tpl | 6 +-- templates/CRM/Price/Form/PriceSet.tpl | 4 +- templates/CRM/Price/Page/Field.tpl | 9 ++-- templates/CRM/Price/Page/LineItem.tpl | 19 +++---- templates/CRM/Price/Page/Option.tpl | 9 ++-- .../contribution_offline_receipt_html.tpl | 4 +- .../contribution_offline_receipt_text.tpl | 4 +- .../contribution_online_receipt_html.tpl | 4 +- .../contribution_online_receipt_text.tpl | 4 +- .../event_offline_receipt_html.tpl | 4 +- .../event_offline_receipt_text.tpl | 4 +- .../event_online_receipt_html.tpl | 4 +- .../event_online_receipt_text.tpl | 4 +- .../membership_offline_receipt_html.tpl | 4 +- .../membership_offline_receipt_text.tpl | 4 +- .../membership_online_receipt_html.tpl | 4 +- .../membership_online_receipt_text.tpl | 4 +- 35 files changed, 290 insertions(+), 174 deletions(-) diff --git a/CRM/Admin/Form/Preferences/Contribute.php b/CRM/Admin/Form/Preferences/Contribute.php index af3d257d7d..ae629dda4a 100644 --- a/CRM/Admin/Form/Preferences/Contribute.php +++ b/CRM/Admin/Form/Preferences/Contribute.php @@ -17,42 +17,48 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences { $this->_varNames = array( CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME => array( + 'invoicing' => array( + 'html_type' => 'checkbox', + 'title' => ts('Sales Taxes and Invoicing'), + 'weight' => 1, + ), 'invoice_prefix' => array( 'html_type' => 'text', 'title' => ts('Invoice Prefix'), - 'weight' => 1, + 'weight' => 2, 'description' => ts('Enter prefix to be display on PDF for invoice'), ), 'credit_notes_prefix' => array( 'html_type' => 'text', 'title' => ts('Credit Notes Prefix'), - 'weight' => 2, + 'weight' => 3, 'description' => ts('Enter prefix to be display on PDF for credit notes.'), - ), + ), 'due_date' => array( 'html_type' => 'text', 'title' => ts('Due Date'), - 'weight' => 3, + 'weight' => 4, ), 'due_date_period' => array( 'html_type' => 'select', - 'weight' => 4, + 'weight' => 5, 'description' => ts('Select the interval for due date.'), ), 'notes' => array( 'html_type' => 'textarea', 'title' => ts('Notes or Standard Terms'), - 'weight' => 5, + 'weight' => 6, 'description' => ts('Enter note or message to be display on PDF invoice or credit notes '), ), + 'tax_term' => array( 'html_type' => 'text', 'title' => ts('Tax Term'), - 'weight' => 6, + 'weight' => 7, ), 'tax_display_settings'=> array( 'html_type' => 'select', - 'weight' => 7, + 'weight' => 8, ), ), ); @@ -77,7 +83,7 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences { ); $this->add('select','tax_display_settings', ts('Tax Display Settings'), array( - 'Do_not_show' => ts('Do not show brakedown, only show total -i.e '.$config->defaultCurrencySymbol.'120.00'), + 'Do_not_show' => ts('Do not show breakdown, only show total -i.e '.$config->defaultCurrencySymbol.'120.00'), 'Inclusive' => ts('Show [tax term] inclusive price - i.e. '.$config->defaultCurrencySymbol.'120.00 (includes [tax term] of '.$config->defaultCurrencySymbol.'20.00)'), 'Exclusive' => ts('Show [tax term] exclusive price - i.e. '.$config->defaultCurrencySymbol.'100.00 + '.$config->defaultCurrencySymbol.'20.00 [tax term]') ) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 8671dc81bc..aa27d77204 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -506,9 +506,11 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // build price set form. $buildPriceSet = FALSE; + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); - // showing tax amount on edit contribution page - if ($this->_action & CRM_Core_Action::UPDATE && isset($this->_values['tax_amount'])) { + // display tax amount on edit contribution page + if ($invoicing && $this->_action & CRM_Core_Action::UPDATE && isset($this->_values['tax_amount'])) { $this->assign('totalTaxAmount', $this->_values['tax_amount']); } diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index d758d59f64..7c04eb6b49 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -392,7 +392,24 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $amount_block_is_active = $this->get('amount_block_is_active'); $this->assign('amount_block_is_active', $amount_block_is_active); - $this->assign('totalTaxAmount', $params['tax_amount']); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + if ($invoicing) { + $getTaxDetails = FALSE; + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + foreach ($this->_lineItem as $key => $value) { + foreach ($value as $v) { + if (isset($v['tax_rate'])) { + if ($v['tax_rate'] != '') { + $getTaxDetails = TRUE; + } + } + } + } + $this->assign('getTaxDetails', $getTaxDetails); + $this->assign('taxTerm', $taxTerm); + $this->assign('totalTaxAmount', $params['tax_amount']); + } if (!empty($params['selectProduct']) && $params['selectProduct'] != 'no_thanks') { $option = CRM_Utils_Array::value('options_' . $params['selectProduct'], $params); $productID = $params['selectProduct']; @@ -1297,23 +1314,27 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr if (isset($params['amount'])) { $contribParams['line_item'] = $form->_lineItem; - //add dataArray in the receipt - $dataArray = array(); - foreach ($form->_lineItem as $lineItemKey => $lineItemValue) { - foreach ($lineItemValue as $key => $value) { - if (isset($value['tax_amount']) && isset($value['tax_rate'])) { - if (isset($dataArray[$value['tax_rate']])) { - $dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value); - } - else { - $dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + if ($invoicing) { + $totalTaxAmount = 0; + $dataArray = array(); + foreach ($form->_lineItem as $lineItemKey => $lineItemValue) { + foreach ($lineItemValue as $key => $value) { + if (isset($value['tax_amount']) && isset($value['tax_rate'])) { + if (isset($dataArray[$value['tax_rate']])) { + $dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value); + } + else { + $dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value); + } } } } + $smarty = CRM_Core_Smarty::singleton(); + $smarty->assign('dataArray', $dataArray); + $smarty->assign('totalTaxAmount', $params['tax_amount']); } - $smarty = CRM_Core_Smarty::singleton(); - $smarty->assign('dataArray', $dataArray); - $smarty->assign('totalTaxAmount', $totalTaxAmount); //add contribution record $contribution = CRM_Contribute_BAO_Contribution::add($contribParams, $ids); if (is_a($contribution, 'CRM_Core_Error')) { diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index c8b0895bbb..ce97026516 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -119,7 +119,24 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->assign('useForMember', $this->get('useForMember')); $params = $this->_params; - $this->assign('totalTaxAmount', $params['tax_amount']); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + if ($invoicing) { + $getTaxDetails = FALSE; + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + foreach ($this->_lineItem as $key => $value) { + foreach ($value as $v) { + if (isset($v['tax_rate'])) { + if ($v['tax_rate'] != '') { + $getTaxDetails = TRUE; + } + } + } + } + $this->assign('getTaxDetails', $getTaxDetails); + $this->assign('taxTerm', $taxTerm); + $this->assign('totalTaxAmount', $params['tax_amount']); + } if ($this->_honor_block_is_active && !empty($params['soft_credit_type_id'])) { $honorName = null; $softCreditTypes = CRM_Core_OptionGroup::values("soft_credit_type", FALSE); diff --git a/CRM/Contribute/Form/ContributionView.php b/CRM/Contribute/Form/ContributionView.php index 34a011edfa..364eb1e8e2 100644 --- a/CRM/Contribute/Form/ContributionView.php +++ b/CRM/Contribute/Form/ContributionView.php @@ -144,7 +144,10 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form { // assign values to the template $this->assign($values); - if (isset($values['tax_amount'])) { + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + $this->assign('invoicing', $invoicing); + if ($invoicing && isset($values['tax_amount'])) { $this->assign('totalTaxAmount', $values['tax_amount']); } diff --git a/CRM/Contribute/Page/UserDashboard.php b/CRM/Contribute/Page/UserDashboard.php index 42cf07fa6d..67ffb893f3 100644 --- a/CRM/Contribute/Page/UserDashboard.php +++ b/CRM/Contribute/Page/UserDashboard.php @@ -152,6 +152,9 @@ class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBo * @access public */ function run() { + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + $this->assign('invoicing', $invoicing); parent::preProcess(); $this->listContribution(); } diff --git a/CRM/Event/Form/EventFees.php b/CRM/Event/Form/EventFees.php index f81f3dc2b9..6b9add1c4f 100644 --- a/CRM/Event/Form/EventFees.php +++ b/CRM/Event/Form/EventFees.php @@ -380,6 +380,8 @@ SELECT id, html_type CRM_Event_Form_Registration::initEventFee($form, $event['id']); CRM_Event_Form_Registration_Register::buildAmount($form, TRUE, $form->_discountId); $lineItem = array(); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; if (!CRM_Utils_System::isNull(CRM_Utils_Array::value('line_items', $form->_values))) { $lineItem[] = $form->_values['line_items']; @@ -387,7 +389,9 @@ SELECT id, html_type $totalTaxAmount = $value['tax_amount'] + $totalTaxAmount; } } - $form->assign('totalTaxAmount', $totalTaxAmount); + if ($invoicing) { + $form->assign('totalTaxAmount', $totalTaxAmount); + } $form->assign('lineItem', empty($lineItem) ? FALSE : $lineItem); $discounts = array(); if (!empty($form->_values['discount'])) { diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 06a73a5b26..735429a2ec 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1630,8 +1630,11 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task { if ($this->_isPaidEvent) { // fix amount for each of participants ( for bulk mode ) $eventAmount = array(); - //add dataArray in the receipts in ADD and UPDATE condition + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; + + //add dataArray in the receipts in ADD and UPDATE condition $dataArray = array(); if ($this->_action & CRM_Core_Action::ADD) { $line = $lineItem[0]; @@ -1639,19 +1642,21 @@ class CRM_Event_Form_Participant extends CRM_Contact_Form_Task { elseif ($this->_action & CRM_Core_Action::UPDATE) { $line = $this->_values['line_items']; } - foreach ($line as $key => $value) { - if (isset($value['tax_amount'])) { - $totalTaxAmount += $value['tax_amount']; - if (isset($dataArray[$value['tax_rate']])) { - $dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value); - } - else { - $dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value); + if ($invoicing) { + foreach ($line as $key => $value) { + if (isset($value['tax_amount'])) { + $totalTaxAmount += $value['tax_amount']; + if (isset($dataArray[$value['tax_rate']])) { + $dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value); + } + else { + $dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value); + } } } + $this->assign('totalTaxAmount', $totalTaxAmount); + $this->assign('dataArray', $dataArray); } - $this->assign('totalTaxAmount', $totalTaxAmount); - $this->assign('dataArray', $dataArray); if (!empty($additionalParticipantDetails)) { $params['amount_level'] = preg_replace('//', '', $params['amount_level']) . ' - ' . $this->_contributorDisplayName; } diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index 815a4ead24..1429ce2119 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -179,6 +179,8 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $displayName = CRM_Contact_BAO_Contact::displayName($values[$participantID]['contact_id']); $participantCount = array(); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; foreach ($lineItem as $k => $v) { if (CRM_Utils_Array::value('participant_count', $lineItem[$k]) > 0) { @@ -186,7 +188,9 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { } $totalTaxAmount = $v['tax_amount'] + $totalTaxAmount; } - $this->assign('totalTaxAmount', $totalTaxAmount); + if ($invoicing) { + $this->assign('totalTaxAmount', $totalTaxAmount); + } if ($participantCount) { $this->assign('pricesetFieldsCount', $participantCount); } diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index e44af41128..0dda44eacb 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -275,7 +275,13 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } } - $this->assign('totalTaxAmount', $taxAmount); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + $this->assign('taxTerm', $taxTerm); + if ($invoicing) { + $this->assign('totalTaxAmount', $taxAmount); + } $this->assign('part', $this->_part); $this->set('part', $this->_part); $this->assign('amounts', $this->_amount); @@ -285,16 +291,27 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $lineItemForTemplate = array(); + $getTaxDetails = FALSE; foreach ($this->_lineItem as $key => $value) { if (!empty($value)) { $lineItemForTemplate[$key] = $value; } + if ($invoicing) { + foreach ($value as $v) { + if (isset($v['tax_rate'])) { + if ($v['tax_rate'] != '') { + $getTaxDetails = TRUE; + } + } + } + } } if (!empty($lineItemForTemplate)) { $this->assign('lineItem', $lineItemForTemplate); } } + $this->assign('getTaxDetails', $getTaxDetails); //display additional participants profile. self::assignProfiles($this); @@ -673,6 +690,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { } $entityTable = 'civicrm_participant'; + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; $dataArray = array(); foreach ($this->_lineItem as $key => $value) { @@ -687,20 +706,24 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $lineItem[$this->_priceSetId] = $value; CRM_Price_BAO_LineItem::processPriceSet($entityId, $lineItem, $contribution, $entityTable); } - foreach ($value as $line) { - if (isset($line['tax_amount']) && isset($line['tax_rate'])) { - $totalTaxAmount = $line['tax_amount'] + $totalTaxAmount; - if (isset($dataArray[$line['tax_rate']])) { - $dataArray[$line['tax_rate']] = $dataArray[$line['tax_rate']] + CRM_Utils_Array::value('tax_amount', $line); - } - else { - $dataArray[$line['tax_rate']] = CRM_Utils_Array::value('tax_amount', $line); + if ($invoicing) { + foreach ($value as $line) { + if (isset($line['tax_amount']) && isset($line['tax_rate'])) { + $totalTaxAmount = $line['tax_amount'] + $totalTaxAmount; + if (isset($dataArray[$line['tax_rate']])) { + $dataArray[$line['tax_rate']] = $dataArray[$line['tax_rate']] + CRM_Utils_Array::value('tax_amount', $line); + } + else { + $dataArray[$line['tax_rate']] = CRM_Utils_Array::value('tax_amount', $line); + } } } } } - $this->assign('dataArray', $dataArray); - $this->assign('totalTaxAmount', $totalTaxAmount); + if ($invoicing) { + $this->assign('dataArray', $dataArray); + $this->assign('totalTaxAmount', $totalTaxAmount); + } } //update status and send mail to cancelled additonal participants, CRM-4320 diff --git a/CRM/Event/Form/Registration/ThankYou.php b/CRM/Event/Form/Registration/ThankYou.php index eabe6d4cbf..4a0135d53f 100644 --- a/CRM/Event/Form/Registration/ThankYou.php +++ b/CRM/Event/Form/Registration/ThankYou.php @@ -101,12 +101,21 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { $taxAmount = 0; if ($this->_priceSetId && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config')) { $lineItemForTemplate = array(); + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); + $getTaxDetails = FALSE; foreach ($this->_lineItem as $key => $value) { if (!empty($value)) { $lineItemForTemplate[$key] = $value; - foreach ($value as $v) { - if (isset($v['tax_amount'])) { - $taxAmount += $v['tax_amount']; + if ($invoicing) { + foreach ($value as $v) { + if (isset($v['tax_amount']) || isset($v['tax_rate'])) { + $taxAmount += $v['tax_amount']; + if ($v['tax_rate'] != '') { + $getTaxDetails = TRUE; + } + } } } } @@ -116,18 +125,26 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { } } else { - foreach ($this->_lineItem as $lineItemKey => $lineItemValue) { - foreach ($lineItemValue as $v) { - if (isset($v['tax_amount'])) { - $taxAmount += $v['tax_amount']; + if ($invoicing) { + foreach ($this->_lineItem as $lineItemKey => $lineItemValue) { + foreach ($lineItemValue as $v) { + if (isset($v['tax_amount']) || isset($v['tax_rate'])) { + $taxAmount += $v['tax_amount']; + if ($v['tax_rate'] != '') { + $getTaxDetails = TRUE; + } + } } } } } - $this->assign('totalTaxAmount', $taxAmount); + if ($invoicing) { + $this->assign('getTaxDetails', $getTaxDetails); + $this->assign('totalTaxAmount', $taxAmount); + } $this->assign('totalAmount', $this->_totalAmount); - + $hookDiscount = $this->get('hookDiscount'); if ($hookDiscount) { $this->assign('hookDiscount', $hookDiscount); @@ -217,6 +234,7 @@ class CRM_Event_Form_Registration_ThankYou extends CRM_Event_Form_Registration { $this->assign('pcpLinkText', $dao->link_text); } + $this->assign('taxTerm', $taxTerm); // Assign Participant Count to Lineitem Table $this->assign('pricesetFieldsCount', CRM_Price_BAO_PriceSet::getPricesetCount($this->_priceSetId)); diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 14f6d4ba39..eebfeebecd 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -1657,6 +1657,8 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; } if (!empty($lineItem[$priceSetId])) { + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $totalTaxAmount = 0; foreach ($lineItem[$priceSetId] as & $priceFieldOp) { if (!empty($priceFieldOp['membership_type_id'])) { @@ -1667,25 +1669,25 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )'; else { $priceFieldOp['start_date'] = $priceFieldOp['end_date'] = 'N/A'; } - if (isset($priceFieldOp['tax_amount'])) { + if ($invoicing && isset($priceFieldOp['tax_amount'])) { $totalTaxAmount += $priceFieldOp['tax_amount']; } } - //add dataArray membership receipt - $dataArray = array(); - foreach ($lineItem[$priceSetId] as $key => $value) { - if (isset($value['tax_amount']) && isset($value['tax_rate'])) { - if (isset($dataArray[$value['tax_rate']])) { - $dataArray[$value['tax_rate']] += $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value); - } else { - $dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value); - } - } + if ($invoicing) { + $dataArray = array(); + foreach ($lineItem[$priceSetId] as $key => $value) { + if (isset($value['tax_amount']) && isset($value['tax_rate'])) { + if (isset($dataArray[$value['tax_rate']])) { + $dataArray[$value['tax_rate']] = $dataArray[$value['tax_rate']] + CRM_Utils_Array::value('tax_amount', $value); + } else { + $dataArray[$value['tax_rate']] = CRM_Utils_Array::value('tax_amount', $value); + } + } + } + $this->assign('totalTaxAmount', $totalTaxAmount); + $this->assign('dataArray', $dataArray); } - $smarty = CRM_Core_Smarty::singleton(); - $smarty->assign('dataArray', $dataArray); } - $this->assign('totalTaxAmount', $totalTaxAmount); $this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE); $receiptSend = FALSE; diff --git a/CRM/Price/BAO/LineItem.php b/CRM/Price/BAO/LineItem.php index 572b2804cf..9dad065dfc 100644 --- a/CRM/Price/BAO/LineItem.php +++ b/CRM/Price/BAO/LineItem.php @@ -163,6 +163,8 @@ AND li.entity_id = {$entityId} $dao = CRM_Core_DAO::executeQuery("$selectClause $fromClause $whereClause", $params); $getTaxDetails = FALSE; + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); while ($dao->fetch()) { if (!$dao->id) { continue; @@ -190,8 +192,12 @@ AND li.entity_id = {$entityId} $getTaxDetails = TRUE; } } - $smarty = CRM_Core_Smarty::singleton(); - $smarty->assign('getTaxDetails', $getTaxDetails); + if ($invoicing) { + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + $smarty = CRM_Core_Smarty::singleton(); + $smarty->assign('taxTerm', $taxTerm); + $smarty->assign('getTaxDetails', $getTaxDetails); + } return $lineItems; } diff --git a/CRM/Price/BAO/PriceField.php b/CRM/Price/BAO/PriceField.php index 4f34da3066..b0f4b2aa2c 100644 --- a/CRM/Price/BAO/PriceField.php +++ b/CRM/Price/BAO/PriceField.php @@ -283,6 +283,9 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { //use value field. $valueFieldName = 'amount'; $seperator = '|'; + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $displayOpt = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); $displayOpt = CRM_Utils_Array::value('tax_display_settings', $displayOpt); switch ($field->html_type) { @@ -291,8 +294,9 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $count = CRM_Utils_Array::value('count', $customOption[$optionKey], ''); $max_value = CRM_Utils_Array::value('max_value', $customOption[$optionKey], ''); $taxAmount = CRM_Utils_Array::value('tax_amount', $customOption[$optionKey]); - if ($taxAmount && $displayOpt) { + if ($taxAmount && $displayOpt && $invoicing) { $qf->assign('displayOpt', $displayOpt); + $qf->assign('taxTerm', $taxTerm); } $priceVal = implode($seperator, array($customOption[$optionKey][$valueFieldName] + $taxAmount, $count, $max_value)); @@ -355,7 +359,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { $taxAmount = CRM_Utils_Array::value('tax_amount', $opt); if ($field->is_display_amounts) { $opt['label'] = !empty($opt['label']) ? $opt['label'] : ''; - if ($taxAmount) { + if ($taxAmount && $invoicing) { if ($displayOpt == 'Do_not_show') { $opt['label'] = '' . CRM_Utils_Money::format($opt[$valueFieldName] + $taxAmount) . ' ' . $opt['label'] . ''; } @@ -370,7 +374,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } else { $opt['label'] = '' . CRM_Utils_Money::format($opt[$valueFieldName]) . ' ' . $opt['label'] . ''; - if (isset($opt['tax_amount']) && $displayOpt != 'Do_not_show') { + if (isset($opt['tax_amount']) && $displayOpt != 'Do_not_show' && $invoicing) { $opt['label'] .= ''. ts(' VAT (exempt)') .''; } } @@ -452,12 +456,12 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { if ($field->is_display_amounts) { $opt['label'] .= ' - '; - if ($taxAmount) { + if ($taxAmount && $invoicing) { $opt['label'] .= self::getTaxLabel($opt, $valueFieldName, $displayOpt); } else { $opt['label'] .= CRM_Utils_Money::format($opt[$valueFieldName]); - if (isset($opt['tax_amount']) && $displayOpt != 'Do_not_show') { + if (isset($opt['tax_amount']) && $displayOpt != 'Do_not_show' && $invoicing) { $opt['label'] .= ''. ts(' VAT (exempt)') .''; } } @@ -496,12 +500,12 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { if ($field->is_display_amounts) { $opt['label'] .= ' - '; - if ($taxAmount) { + if ($taxAmount && $invoicing) { $opt['label'] .= self::getTaxLabel($opt, $valueFieldName, $displayOpt); } else { $opt['label'] .= CRM_Utils_Money::format($opt[$valueFieldName]); - if (isset($opt['tax_amount']) && $displayOpt != 'Do_not_show') { + if (isset($opt['tax_amount']) && $displayOpt != 'Do_not_show' && $invoicing) { $opt['label'] .= ''. ts(' VAT (exempt)') .''; } } diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php index 495ca2476e..81e2d19089 100644 --- a/CRM/Price/Page/Field.php +++ b/CRM/Price/Page/Field.php @@ -132,6 +132,10 @@ class CRM_Price_Page_Field extends CRM_Core_Page { $priceFieldBAO->orderBy('weight, label'); $priceFieldBAO->find(); + // display taxTerm for priceFields + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $getTaxDetails = FALSE; $taxRate = CRM_Core_PseudoConstant::getTaxRates(); while ($priceFieldBAO->fetch()) { @@ -147,7 +151,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { $financialTypeId = $optionValues['financial_type_id']; $priceField[$priceFieldBAO->id]['price'] = CRM_Utils_Array::value('amount', $optionValues); - if (isset($taxRate[$financialTypeId])) { + if ($invoicing && isset($taxRate[$financialTypeId])) { $priceField[$priceFieldBAO->id]['tax_rate'] = $taxRate[$financialTypeId]; $getTaxDetails = TRUE; } @@ -196,6 +200,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { 'PriceField', $priceFieldBAO->id ); + $this->assign('taxTerm', $taxTerm); $this->assign('getTaxDetails', $getTaxDetails); } diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index fdcab22b32..e6263cdd5d 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -134,13 +134,17 @@ class CRM_Price_Page_Option extends CRM_Core_Page { $config = CRM_Core_Config::singleton(); $financialType = CRM_Contribute_PseudoConstant::financialType(); $taxRate = CRM_Core_PseudoConstant::getTaxRates(); + // display taxTerm for priceFields + $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,'contribution_invoice_settings'); + $taxTerm = CRM_Utils_Array::value('tax_term', $invoiceSettings); + $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings); $getTaxDetails = FALSE; foreach ($customOption as $id => $values) { $action = array_sum(array_keys($this->actionLinks())); // Adding the required fields in the array if (isset($taxRate[$values['financial_type_id']])) { $customOption[$id]['tax_rate'] = $taxRate[$values['financial_type_id']]; - if (isset($customOption[$id]['tax_rate'])) { + if ($invoicing && isset($customOption[$id]['tax_rate'])) { $getTaxDetails = TRUE; } $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($customOption[$id]['amount'], $customOption[$id]['tax_rate']); @@ -188,6 +192,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { 'id', $returnURL, $filter ); + $this->assign('taxTerm', $taxTerm); $this->assign('getTaxDetails', $getTaxDetails); $this->assign('customOption', $customOption); $this->assign('sid', $this->_sid); diff --git a/css/civicrm.css b/css/civicrm.css index 25dbe5f284..1d30bf5e75 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -2343,6 +2343,9 @@ div.grippie { } .crm-container a.button, +.crm-container a.crm-invoiceButton, +.crm-container a.crm-invoiceButton:link, +.crm-container a.crm-invoiceButton:visited, .crm-container a.button:link, .crm-container a.button:visited, .crm-container input.form-submit, @@ -2388,23 +2391,26 @@ div.grippie { } .crm-container a.button, +.crm-container a.crm-invoiceButton, +.crm-container a.crm-invoiceButton:link, +.crm-container a.crm-invoiceButton:visited, .crm-container a.button:link, .crm-container a.button:visited { display: block; float: left; } -.crm-container a.button span { +.crm-container a.button .crm-container a.crm-invoiceButton span { display: block; line-height: 14px; padding: 2px 0px; } -.crm-container .button .red { +.crm-container .button .red .crm-invoiceButton{ background-image: url(../i/icons/jquery-ui-FFFFFF.png); } -.crm-container a.button:active { +.crm-container a.button:active .crm-container a.crm-invoiceButton:active,{ color: #000; outline: none; /* hide dotted outline in Firefox */ @@ -2415,6 +2421,8 @@ div.grippie { .crm-container input[type=submit]:hover, .crm-container input[type=button]:hover, .crm-container a.button:hover, +.crm-container a.crm-invoiceButton:hover, +.crm-container a.crm-invoiceButton:focus, .crm-container a.button:focus { background-position: 0px -25px; } @@ -2547,6 +2555,7 @@ div.grippie { } .crm-container .button .icon, +.crm-container a.invoiceButton .icon, .crm-container .crm-button .icon, .crm-accordion-header .icon { position: relative; @@ -3736,6 +3745,8 @@ tbody.scrollContent tr.alternateRow { /* rounded corners - we will call dd_roundies on all this */ .crm-container .crm-button, .crm-container a.button, +.crm-container a.crm-invoiceButton, +.crm-container a.crm-invoiceButton:link, .crm-container a.button:link, .crm-container input.form-submit, .crm-container input[type=button], @@ -4675,18 +4686,4 @@ span.crm-status-icon { .crm-printButton { padding-left: 469px; -} - -.crm-invoiceButton { - text-shadow: 0 1px 0 black; - background: #70716B url(../i/crm-button-bg.gif) repeat-x top left; - color: #FFFFFF !important; - font-size: 13px; - font-weight: normal; - margin-right: 16px; - padding: 2px 6px; - text-decoration: none; - cursor: pointer; - border: 1px solid #3e3e3e; - border-radius: 3px 3px 3px 3px; } \ No newline at end of file diff --git a/templates/CRM/Contribute/Form/ContributionView.tpl b/templates/CRM/Contribute/Form/ContributionView.tpl index d6f32ccf6b..d4ba37f30c 100644 --- a/templates/CRM/Contribute/Form/ContributionView.tpl +++ b/templates/CRM/Contribute/Form/ContributionView.tpl @@ -47,16 +47,18 @@ {/if} {include file="CRM/common/formButtons.tpl" location="top"} + {assign var='pdfUrlParams' value="reset=1&id=$id&cid=$contact_id"} {assign var='emailUrlParams' value="reset=1&id=$id&cid=$contact_id&select=email"} - {assign var='invoiceUrlParams' value="reset=1&id=$id&cid=$contact_id"} - {if $contribution_status != 'Refunded'} -
- {ts}Print Invoice{/ts} - - {ts}Email Invoice{/ts}
- {else} -
- {ts}Print invoice and Credit note{/ts}
+ {if $invoicing} + {if $contribution_status != 'Refunded'} +
+ {ts}Print Invoice{/ts} + + {ts}Email Invoice{/ts}
+ {else} +
+ {ts}Print Invoice and Credit Note{/ts}
+ {/if} {/if} @@ -92,7 +94,7 @@ {/if} - {if $tax_amount} + {if $tax_amount && $invoicing} {ts}Total Tax Amount{/ts} {$tax_amount|crmMoney:$currency} @@ -323,14 +325,16 @@ class="icon delete-icon">{ts}Delete{/ts} {/if} {include file="CRM/common/formButtons.tpl" location="bottom"} - {if $contribution_status != 'Refunded'} -
- {ts}Print Invoice{/ts} - - {ts}Email Invoice{/ts}
- {else} -
- {ts}Print invoice and Credit note{/ts}
+ {if $invoicing} + {if $contribution_status != 'Refunded'} +
+ {ts}Print Invoice{/ts} + + {ts}Email Invoice{/ts}
+ {else} +
+ {ts}Print Invoice and Credit Note{/ts}
+ {/if} {/if} diff --git a/templates/CRM/Contribute/Page/UserDashboard.tpl b/templates/CRM/Contribute/Page/UserDashboard.tpl index 04ee6b6e4f..61b8b58f64 100644 --- a/templates/CRM/Contribute/Page/UserDashboard.tpl +++ b/templates/CRM/Contribute/Page/UserDashboard.tpl @@ -34,7 +34,7 @@ {ts}Received date{/ts} {ts}Receipt Sent{/ts} {ts}Status{/ts} - {if $invoices} + {if $invoicing && $invoices} {/if} @@ -50,14 +50,14 @@ {$row.receive_date|truncate:10:''|crmDate} {$row.receipt_date|truncate:10:''|crmDate} {$row.contribution_status} - {if $invoices} + {if $invoicing && $invoices} {assign var='urlParams' value="reset=1&id=$row.contribution_id&cid=$row.contact_id"} {if $row.contribution_status != 'Refunded'} {ts}Print Invoice{/ts} {else} - {ts}Print Credit Note{/ts} + {ts}Print Invoice and Credit Note{/ts} {/if} diff --git a/templates/CRM/Price/Form/PriceSet.tpl b/templates/CRM/Price/Form/PriceSet.tpl index ab29bb6f4f..8a46b2092a 100644 --- a/templates/CRM/Price/Form/PriceSet.tpl +++ b/templates/CRM/Price/Form/PriceSet.tpl @@ -71,7 +71,7 @@ {if $element.is_display_amounts && $element.html_type eq 'Text'} {foreach item=option from=$element.options} - {if $option.tax_amount && $displayOpt} + {if $invoicing && $option.tax_amount && $displayOpt} {assign var="amount" value=`$option.amount+$option.tax_amount`} {if $displayOpt == 'Do_not_show'} {$amount|crmMoney} @@ -84,7 +84,7 @@ {/if} {else} {$option.amount|crmMoney} - {if $option.tax_amount == "0" && $displayOpt != 'Do_not_show'} + {if $invoicing && $option.tax_amount == "0" && $displayOpt != 'Do_not_show'} {ts} VAT (exempt){/ts} {/if} {/if} diff --git a/templates/CRM/Price/Page/Field.tpl b/templates/CRM/Price/Page/Field.tpl index 77c2bd6c0e..af42c3e3f6 100644 --- a/templates/CRM/Price/Page/Field.tpl +++ b/templates/CRM/Price/Page/Field.tpl @@ -89,12 +89,9 @@ {if $row.html_type eq "Text / Numeric Quantity"}{$row.price|crmMoney}{else}{if $isReserved}{ts}View Price Options{/ts}{else}{ts}Edit Price Options{/ts}{/if}{/if} {if $getTaxDetails} {if $row.tax_rate != '' && $row.html_type eq "Text / Numeric Quantity"} - {if $row.tax_rate == 0.00} - {ts}VAT(Exempt){/ts} - {else} - {ts}VAT{/ts}({$row.tax_rate|string_format:"%.2f"}%) - {/if} - {/if} + {$taxTerm} ({$row.tax_rate|string_format:"%.2f"}%) + {/if} + {if $row.html_type eq "Text / Numeric Quantity" }{$row.tax_amount|crmMoney}{/if} {/if} {$row.action|replace:'xx':$row.id} diff --git a/templates/CRM/Price/Page/LineItem.tpl b/templates/CRM/Price/Page/LineItem.tpl index d73e103bd1..44380e0d28 100644 --- a/templates/CRM/Price/Page/LineItem.tpl +++ b/templates/CRM/Price/Page/LineItem.tpl @@ -41,12 +41,12 @@ {else} {ts}Qty{/ts} {ts}Unit Price{/ts} - {if !$totalTaxAmount} + {if !$getTaxDetails} {ts}Total Price{/ts} {/if} {/if} - {if $totalTaxAmount} + {if $getTaxDetails} {ts}Subtotal{/ts} {ts}Tax Rate{/ts} {ts}Tax Amount{/ts} @@ -65,20 +65,13 @@ {else} {$line.line_total|crmMoney} {/if} - {if !$totalTaxAmount && $context NEQ "Membership"} + {if !$getTaxDetails && $context NEQ "Membership"} {$line.line_total|crmMoney} {/if} - {if $totalTaxAmount} + {if $getTaxDetails} {$line.line_total-$line.tax_amount|crmMoney} - {if $line.tax_rate != ""} - {if $line.tax_rate == 0} - {ts}VAT(exempt){/ts} - {else} - {ts}VAT{/ts}({$line.tax_rate|string_format:"%.2f"}%) - {/if} - {$line.tax_amount|crmMoney} - {elseif $line.tax_amount != ''} - {ts}VAT(exempt){/ts} + {if $line.tax_rate != "" || $line.tax_amount != ""} + {$taxTerm} ({$line.tax_rate|string_format:"%.2f"}%) {$line.tax_amount|crmMoney} {else} diff --git a/templates/CRM/Price/Page/Option.tpl b/templates/CRM/Price/Page/Option.tpl index 53c4ffc5c0..efef17ae28 100644 --- a/templates/CRM/Price/Page/Option.tpl +++ b/templates/CRM/Price/Page/Option.tpl @@ -79,12 +79,9 @@ {$row.weight} {if $getTaxDetails} {if $row.tax_rate != '' } - {if $row.tax_rate == 0.00} - {ts}VAT(Exempt){/ts} - {else} - {ts}VAT{/ts}({$row.tax_rate|string_format:"%.2f"}%) - {/if} - {/if} + {$taxTerm} ({$row.tax_rate|string_format:"%.2f"}%) + {/if} + {$row.tax_amount|crmMoney} {/if} {if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if} diff --git a/xml/templates/message_templates/contribution_offline_receipt_html.tpl b/xml/templates/message_templates/contribution_offline_receipt_html.tpl index 433b3bc55e..41d7939dfe 100644 --- a/xml/templates/message_templates/contribution_offline_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_offline_receipt_html.tpl @@ -110,10 +110,10 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -  {ts}Vat{/ts}{$priceset|string_format:"%.2f"}% +  {$taxTerm} {$priceset|string_format:"%.2f"}%  {$value|crmMoney:$currency} {elseif $priceset == 0} -  {ts}No Vat{/ts} +  {ts}No{/ts} {$taxTerm}  {$value|crmMoney:$currency} {/if} diff --git a/xml/templates/message_templates/contribution_offline_receipt_text.tpl b/xml/templates/message_templates/contribution_offline_receipt_text.tpl index 026eade352..5a12f873f9 100644 --- a/xml/templates/message_templates/contribution_offline_receipt_text.tpl +++ b/xml/templates/message_templates/contribution_offline_receipt_text.tpl @@ -35,9 +35,9 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -{ts}Vat{/ts}{$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} {elseif $priceset == 0} -{ts}No Vat{/ts}: {$value|crmMoney:$currency} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} {/if} {/foreach} {/if} diff --git a/xml/templates/message_templates/contribution_online_receipt_html.tpl b/xml/templates/message_templates/contribution_online_receipt_html.tpl index 37693aa163..6357f3b1b4 100644 --- a/xml/templates/message_templates/contribution_online_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_online_receipt_html.tpl @@ -107,10 +107,10 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -  {ts}Vat{/ts}{$priceset|string_format:"%.2f"}% +  {$taxTerm} {$priceset|string_format:"%.2f"}%  {$value|crmMoney:$currency} {elseif $priceset == 0} -  {ts}No Vat{/ts} +  {ts}No{/ts} {$taxTerm}  {$value|crmMoney:$currency} {/if} diff --git a/xml/templates/message_templates/contribution_online_receipt_text.tpl b/xml/templates/message_templates/contribution_online_receipt_text.tpl index 3ea90d257c..2b1b419784 100644 --- a/xml/templates/message_templates/contribution_online_receipt_text.tpl +++ b/xml/templates/message_templates/contribution_online_receipt_text.tpl @@ -40,9 +40,9 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -{ts}Vat{/ts}{$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} {elseif $priceset == 0} -{ts}No Vat{/ts}: {$value|crmMoney:$currency} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} {/if} {/foreach} {/if} diff --git a/xml/templates/message_templates/event_offline_receipt_html.tpl b/xml/templates/message_templates/event_offline_receipt_html.tpl index e66e188516..39142ce3ba 100644 --- a/xml/templates/message_templates/event_offline_receipt_html.tpl +++ b/xml/templates/message_templates/event_offline_receipt_html.tpl @@ -238,10 +238,10 @@ registration process.{/ts}

{foreach from=$dataArray item=value key=priceset} {if $priceset} -  {ts}Vat{/ts}{$priceset|string_format:"%.2f"}% +  {$taxTerm} {$priceset|string_format:"%.2f"}%  {$value|crmMoney:$currency} {elseif $priceset == 0} -  {ts}No Vat{/ts} +  {ts}No{/ts} {$taxTerm}  {$value|crmMoney:$currency} {/if} diff --git a/xml/templates/message_templates/event_offline_receipt_text.tpl b/xml/templates/message_templates/event_offline_receipt_text.tpl index c7c98f1b93..8b745c844f 100644 --- a/xml/templates/message_templates/event_offline_receipt_text.tpl +++ b/xml/templates/message_templates/event_offline_receipt_text.tpl @@ -140,9 +140,9 @@ registration process.{/ts} {foreach from=$dataArray item=value key=priceset} {if $priceset} -{ts}Vat{/ts}{$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} {elseif $priceset == 0} -{ts}No Vat{/ts}: {$value|crmMoney:$currency} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} {/if} {/foreach} {/if} diff --git a/xml/templates/message_templates/event_online_receipt_html.tpl b/xml/templates/message_templates/event_online_receipt_html.tpl index f2e51553ab..62f977e14b 100644 --- a/xml/templates/message_templates/event_online_receipt_html.tpl +++ b/xml/templates/message_templates/event_online_receipt_html.tpl @@ -268,10 +268,10 @@ registration process.{/ts}

{foreach from=$dataArray item=value key=priceset} {if $priceset} -  {ts}Vat{/ts}{$priceset|string_format:"%.2f"}% +  {$taxTerm} {$priceset|string_format:"%.2f"}%  {$value|crmMoney:$currency} {elseif $priceset == 0} -  {ts}No Vat{/ts} +  {ts}No{/ts} {$taxTerm}  {$value|crmMoney:$currency} {/if} diff --git a/xml/templates/message_templates/event_online_receipt_text.tpl b/xml/templates/message_templates/event_online_receipt_text.tpl index 275240579d..ddf290d309 100644 --- a/xml/templates/message_templates/event_online_receipt_text.tpl +++ b/xml/templates/message_templates/event_online_receipt_text.tpl @@ -156,9 +156,9 @@ You were registered by: {$payer.name} {foreach from=$dataArray item=value key=priceset} {if $priceset} -{ts}Vat{/ts}{$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} {elseif $priceset == 0} -{ts}No Vat{/ts}: {$value|crmMoney:$currency} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} {/if} {/foreach} {/if} diff --git a/xml/templates/message_templates/membership_offline_receipt_html.tpl b/xml/templates/message_templates/membership_offline_receipt_html.tpl index 243d4e621b..4e90c32bda 100644 --- a/xml/templates/message_templates/membership_offline_receipt_html.tpl +++ b/xml/templates/message_templates/membership_offline_receipt_html.tpl @@ -150,10 +150,10 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -  {ts}VAT{/ts}{$priceset|string_format:"%.2f"}% +  {$taxTerm} {$priceset|string_format:"%.2f"}%  {$value|crmMoney:$currency} {elseif $priceset == 0} -  {ts}VAT{/ts} +  {ts}No{/ts} {$taxTerm}  {$value|crmMoney:$currency} {/if} diff --git a/xml/templates/message_templates/membership_offline_receipt_text.tpl b/xml/templates/message_templates/membership_offline_receipt_text.tpl index 81d3fc73cb..e2c81cd3ab 100644 --- a/xml/templates/message_templates/membership_offline_receipt_text.tpl +++ b/xml/templates/message_templates/membership_offline_receipt_text.tpl @@ -54,9 +54,9 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -{ts}Vat{/ts}{$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} {elseif $priceset == 0} -{ts}No Vat{/ts}: {$value|crmMoney:$currency} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} {/if} {/foreach} {/if} diff --git a/xml/templates/message_templates/membership_online_receipt_html.tpl b/xml/templates/message_templates/membership_online_receipt_html.tpl index b47d78a708..03e14a3157 100644 --- a/xml/templates/message_templates/membership_online_receipt_html.tpl +++ b/xml/templates/message_templates/membership_online_receipt_html.tpl @@ -226,10 +226,10 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -  {ts}VAT{/ts} {$priceset|string_format:"%.2f"}% +  {$taxTerm} {$priceset|string_format:"%.2f"}%  {$value|crmMoney:$currency} {elseif $priceset == 0} -  {ts}VAT{/ts} +  {ts}NO{/ts} {$taxTerm}  {$value|crmMoney:$currency} {/if} diff --git a/xml/templates/message_templates/membership_online_receipt_text.tpl b/xml/templates/message_templates/membership_online_receipt_text.tpl index e61d3295a2..8baf7a8765 100644 --- a/xml/templates/message_templates/membership_online_receipt_text.tpl +++ b/xml/templates/message_templates/membership_online_receipt_text.tpl @@ -80,9 +80,9 @@ {foreach from=$dataArray item=value key=priceset} {if $priceset} -{ts}Vat{/ts}{$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} +{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency} {elseif $priceset == 0} -{ts}No Vat{/ts}: {$value|crmMoney:$currency} +{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} {/if} {/foreach} {/if} -- 2.25.1