From 79d001a2d5bbeb910826f3f8089c6d4ce9455583 Mon Sep 17 00:00:00 2001
From: Parag Bhilkar
Date: Thu, 26 Jun 2014 17:35:02 +0530
Subject: [PATCH] VAT-415 The default receipts that the system sends out should
be updated to show the VAT/Tax breakdown.
---
CRM/Contribute/Form/Contribution/Confirm.php | 18 ++++++
CRM/Event/Form/Participant.php | 22 +++++++
CRM/Event/Form/Registration/Confirm.php | 19 +++++++
CRM/Member/Form/Membership.php | 18 ++++++
.../contribution_offline_receipt_html.tpl | 49 ++++++++++++++++
.../contribution_offline_receipt_text.tpl | 24 +++++++-
.../contribution_online_receipt_html.tpl | 57 +++++++++++++++++++
.../contribution_online_receipt_text.tpl | 25 +++++++-
.../event_offline_receipt_html.tpl | 47 +++++++++++++++
.../event_offline_receipt_text.tpl | 26 ++++++++-
.../event_online_receipt_html.tpl | 47 +++++++++++++++
.../event_online_receipt_text.tpl | 26 ++++++++-
.../membership_offline_receipt_html.tpl | 51 +++++++++++++++++
.../membership_offline_receipt_text.tpl | 27 ++++++++-
.../membership_online_receipt_html.tpl | 51 +++++++++++++++++
.../membership_online_receipt_text.tpl | 27 ++++++++-
16 files changed, 522 insertions(+), 12 deletions(-)
diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php
index 79289b2a02..d758d59f64 100644
--- a/CRM/Contribute/Form/Contribution/Confirm.php
+++ b/CRM/Contribute/Form/Contribution/Confirm.php
@@ -392,6 +392,7 @@ 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']);
if (!empty($params['selectProduct']) && $params['selectProduct'] != 'no_thanks') {
$option = CRM_Utils_Array::value('options_' . $params['selectProduct'], $params);
$productID = $params['selectProduct'];
@@ -1296,6 +1297,23 @@ 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);
+ }
+ }
+ }
+ }
+ $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/Event/Form/Participant.php b/CRM/Event/Form/Participant.php
index c1c54904a5..06a73a5b26 100644
--- a/CRM/Event/Form/Participant.php
+++ b/CRM/Event/Form/Participant.php
@@ -1630,6 +1630,28 @@ 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
+ $totalTaxAmount = 0;
+ $dataArray = array();
+ if ($this->_action & CRM_Core_Action::ADD) {
+ $line = $lineItem[0];
+ }
+ 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);
+ }
+ }
+ }
+ $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/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php
index 057fcff93e..e44af41128 100644
--- a/CRM/Event/Form/Registration/Confirm.php
+++ b/CRM/Event/Form/Registration/Confirm.php
@@ -232,7 +232,10 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
) {
$this->_amount = array();
+ $taxAmount = 0;
foreach ($this->_params as $k => $v) {
+ //display tax amount on confirmation page
+ $taxAmount += $v['tax_amount'];
if (is_array($v)) {
foreach (array(
'first_name', 'last_name') as $name) {
@@ -272,6 +275,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
}
}
+ $this->assign('totalTaxAmount', $taxAmount);
$this->assign('part', $this->_part);
$this->set('part', $this->_part);
$this->assign('amounts', $this->_amount);
@@ -669,6 +673,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
}
$entityTable = 'civicrm_participant';
+ $totalTaxAmount = 0;
+ $dataArray = array();
foreach ($this->_lineItem as $key => $value) {
if (($value != 'skip') &&
($entityId = CRM_Utils_Array::value($key, $allParticipantIds))
@@ -681,7 +687,20 @@ 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);
+ }
+ }
+ }
}
+ $this->assign('dataArray', $dataArray);
+ $this->assign('totalTaxAmount', $totalTaxAmount);
}
//update status and send mail to cancelled additonal participants, CRM-4320
diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php
index 6818dc7ca8..14f6d4ba39 100644
--- a/CRM/Member/Form/Membership.php
+++ b/CRM/Member/Form/Membership.php
@@ -1657,6 +1657,7 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
}
if (!empty($lineItem[$priceSetId])) {
+ $totalTaxAmount = 0;
foreach ($lineItem[$priceSetId] as & $priceFieldOp) {
if (!empty($priceFieldOp['membership_type_id'])) {
$priceFieldOp['start_date'] = $membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'] ? CRM_Utils_Date::customFormat($membershipTypeValues[$priceFieldOp['membership_type_id']]['start_date'], '%d%f %b, %Y') : '-';
@@ -1666,8 +1667,25 @@ WHERE id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
else {
$priceFieldOp['start_date'] = $priceFieldOp['end_date'] = 'N/A';
}
+ if (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);
+ }
+ }
}
+ $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/xml/templates/message_templates/contribution_offline_receipt_html.tpl b/xml/templates/message_templates/contribution_offline_receipt_html.tpl
index 985ddc5585..28072b4404 100644
--- a/xml/templates/message_templates/contribution_offline_receipt_html.tpl
+++ b/xml/templates/message_templates/contribution_offline_receipt_html.tpl
@@ -58,6 +58,11 @@
| {ts}Item{/ts} |
{ts}Qty{/ts} |
{ts}Each{/ts} |
+ {if $totalTaxAmount}
+ {ts}Subtotal{/ts} |
+ {ts}Tax Rate{/ts} |
+ {ts}Tax Amount{/ts} |
+ {/if}
{ts}Total{/ts} |
{foreach from=$value item=line}
@@ -71,6 +76,17 @@
{$line.unit_price|crmMoney:$currency}
|
+ {if $totalTaxAmount}
+
+ {$line.unit_price*$line.qty|crmMoney:$currency}
+ |
+
+ {$line.tax_rate|crmMoney:$currency}
+ |
+
+ {$line.tax_amount|crmMoney:$currency}
+ |
+ {/if}
{$line.line_total|crmMoney:$currency}
|
@@ -81,6 +97,39 @@
{/foreach}
{/if}
+ {if $dataArray && $totalTaxAmount}
+
+ |
+ {ts} Amount before Tax : {/ts}
+ |
+
+ {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}
+ |
+
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset}
+ | Vat {$priceset|string_format:"%.2f"}% |
+ {$value|crmMoney:$currency} |
+ {elseif $priceset == 0}
+ No Vat |
+ {$value|crmMoney:$currency} |
+ {/if}
+
+ {/foreach}
+ {/if}
+
+ {if $totalTaxAmount}
+
+ |
+ {ts}Total Tax Amount{/ts}
+ |
+
+ {$totalTaxAmount|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 5406de7de0..eb2178b38a 100644
--- a/xml/templates/message_templates/contribution_offline_receipt_text.tpl
+++ b/xml/templates/message_templates/contribution_offline_receipt_text.tpl
@@ -16,15 +16,35 @@
{capture assign=ts_item}{ts}Item{/ts}{/capture}
{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{if $totalTaxAmount}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{/if}
{capture assign=ts_total}{ts}Total{/ts}{/capture}
-{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $totalTaxAmount} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"}
----------------------------------------------------------
{foreach from=$value item=line}
-{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {$line.line_total|crmMoney:$currency|string_format:"%10s"}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {if $totalTaxAmount}{$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {$line.tax_rate|crmMoney:$currency|string_format:"%10s"} {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {/if}{$line.line_total|crmMoney:$currency|string_format:"%10s"}
{/foreach}
{/foreach}
{/if}
+{if $dataArray && $totalTaxAmount}
+{ts}Amount before Tax{/ts}: {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset}
+{ts}Vat{$priceset|string_format:"%.2f"}%{/ts}: {$value|crmMoney:$currency}
+{elseif $priceset == 0}
+{ts}No Vat{/ts}: {$value|crmMoney:$currency}
+{/if}
+{/foreach}
+{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
{ts}Total Amount{/ts}: {$formValues.total_amount|crmMoney:$currency}
{if $receive_date}
{ts}Received Date{/ts}: {$receive_date|truncate:10:''|crmDate}
diff --git a/xml/templates/message_templates/contribution_online_receipt_html.tpl b/xml/templates/message_templates/contribution_online_receipt_html.tpl
index 8970c3af47..f5a86c11de 100644
--- a/xml/templates/message_templates/contribution_online_receipt_html.tpl
+++ b/xml/templates/message_templates/contribution_online_receipt_html.tpl
@@ -56,6 +56,11 @@
| {ts}Item{/ts} |
{ts}Qty{/ts} |
{ts}Each{/ts} |
+ {if $dataArray}
+ {ts}Subtotal{/ts} |
+ {ts}Tax Rate{/ts} |
+ {ts}Tax Amount{/ts} |
+ {/if}
{ts}Total{/ts} |
{foreach from=$value item=line}
@@ -69,6 +74,17 @@
{$line.unit_price|crmMoney:$currency}
|
+ {if $dataArray}
+
+ {$line.unit_price*$line.qty|crmMoney:$currency}
+ |
+
+ {$line.tax_rate|crmMoney:$currency}
+ |
+
+ {$line.tax_amount|crmMoney:$currency}
+ |
+ {/if}
{$line.line_total|crmMoney:$currency}
|
@@ -78,6 +94,37 @@
{/foreach}
+ {if $dataArray}
+
+ |
+ {ts} Amount before Tax : {/ts}
+ |
+
+ {$amount-$totalTaxAmount|crmMoney:$currency}
+ |
+
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset}
+ | Vat {$priceset|string_format:"%.2f"}% |
+ {$value|crmMoney:$currency} |
+ {elseif $priceset == 0}
+ No Vat |
+ {$value|crmMoney:$currency} |
+ {/if}
+
+ {/foreach}
+
+
+ |
+ {ts}Total Tax{/ts}
+ |
+
+ {$totalTaxAmount|crmMoney:$currency}
+ |
+
+ {/if}
|
{ts}Total Amount{/ts}
@@ -89,6 +136,16 @@
{else}
+ {if $totalTaxAmount}
+ |
+ |
+ {ts}Total Tax Amount{/ts}
+ |
+
+ {$totalTaxAmount|crmMoney:$currency}
+ |
+
+ {/if}
|
{ts}Amount{/ts}
diff --git a/xml/templates/message_templates/contribution_online_receipt_text.tpl b/xml/templates/message_templates/contribution_online_receipt_text.tpl
index aa8fe70241..1fe751a5cf 100644
--- a/xml/templates/message_templates/contribution_online_receipt_text.tpl
+++ b/xml/templates/message_templates/contribution_online_receipt_text.tpl
@@ -22,13 +22,34 @@
{capture assign=ts_item}{ts}Item{/ts}{/capture}
{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{if $totalTaxAmount}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{/if}
{capture assign=ts_total}{ts}Total{/ts}{/capture}
-{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $totalTaxAmount} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"}
----------------------------------------------------------
{foreach from=$value item=line}
-{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {$line.line_total|crmMoney:$currency|string_format:"%10s"}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {if $totalTaxAmount}{$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {$line.tax_rate|crmMoney:$currency|string_format:"%10s"} {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {/if}{$line.line_total|crmMoney:$currency|string_format:"%10s"}
+{/foreach}
{/foreach}
+
+{if $dataArray && $totalTaxAmount}
+{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset}
+{ts}Vat {$priceset|string_format:"%.2f"}%{/ts}: {$value|crmMoney:$currency}
+{elseif $priceset == 0}
+{ts}No Vat {/ts}: {$value|crmMoney:$currency}
+{/if}
{/foreach}
+{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
{ts}Total Amount{/ts}: {$amount|crmMoney:$currency}
{else}
diff --git a/xml/templates/message_templates/event_offline_receipt_html.tpl b/xml/templates/message_templates/event_offline_receipt_html.tpl
index 204506b218..d0de85aa29 100644
--- a/xml/templates/message_templates/event_offline_receipt_html.tpl
+++ b/xml/templates/message_templates/event_offline_receipt_html.tpl
@@ -181,6 +181,11 @@ registration process.{/ts}
| {ts}Item{/ts} |
{ts}Qty{/ts} |
{ts}Each{/ts} |
+ {if $totalTaxAmount}
+ {ts}SubTotal{/ts} |
+ {ts}Tax Rate{/ts} |
+ {ts}Tax Amount{/ts} |
+ {/if}
{ts}Total{/ts} |
{if $pricesetFieldsCount }{ts}Total Participants{/ts} | {/if}
@@ -195,6 +200,17 @@ registration process.{/ts}
{$line.unit_price|crmMoney}
|
+ {if $totalTaxAmount}
+
+ {$line.unit_price*$line.qty|crmMoney}
+ |
+
+ {$line.tax_rate|crmMoney}
+ |
+
+ {$line.tax_amount|crmMoney}
+ |
+ {/if}
{$line.line_total|crmMoney}
|
@@ -210,6 +226,27 @@ registration process.{/ts}
{/if}
{/foreach}
+ {if $dataArray && $totalTaxAmount}
+
+ |
+ {ts} Amount Before Tax : {/ts}
+ |
+
+ {$totalAmount-$totalTaxAmount|crmMoney}
+ |
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset}
+ | Vat {$priceset|string_format:"%.2f"}% |
+ {$value|crmMoney:$currency} |
+ {elseif $priceset == 0}
+ No Vat |
+ {$value|crmMoney:$currency} |
+ {/if}
+
+ {/foreach}
+ {/if}
{/if}
{if $amount && !$lineItem}
@@ -221,6 +258,16 @@ registration process.{/ts}
{/foreach}
{/if}
+ {if $totalTaxAmount}
+
+ |
+ {ts}Total Tax Amount{/ts}
+ |
+
+ {$totalTaxAmount|crmMoney:$currency}
+ |
+
+ {/if}
{if $isPrimary}
|
diff --git a/xml/templates/message_templates/event_offline_receipt_text.tpl b/xml/templates/message_templates/event_offline_receipt_text.tpl
index ef278336bb..33bde8e708 100644
--- a/xml/templates/message_templates/event_offline_receipt_text.tpl
+++ b/xml/templates/message_templates/event_offline_receipt_text.tpl
@@ -118,22 +118,44 @@ registration process.{/ts}
{capture assign=ts_item}{ts}Item{/ts}{/capture}
{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{if $totalTaxAmount}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{/if}
{capture assign=ts_total}{ts}Total{/ts}{/capture}
{capture assign=ts_participant_total}{if $pricesetFieldsCount }{ts}Total Participants{/ts}{/if}{/capture}
-{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $totalTaxAmount} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
{foreach from=$value item=line}
{if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if}
-{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney|string_format:"%10s"} {$line.line_total|crmMoney|string_format:"%10s"} {$ts_participant_count|string_format:"%10s"}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney|string_format:"%10s"} {if $totalTaxAmount} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {$line.tax_rate|crmMoney:$currency|string_format:"%10s"} {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {/if} {$line.line_total|crmMoney|string_format:"%10s"} {$ts_participant_count|string_format:"%10s"}
+{/foreach}
+{/if}
{/foreach}
+
+{if $dataArray && $totalTaxAmount}
+{ts}Amount before Tax{/ts}: {$totalAmount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset}
+{ts}Vat{$priceset|string_format:"%.2f"}%{/ts}: {$value|crmMoney:$currency}
+{elseif $priceset == 0}
+{ts}No Vat{/ts}: {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}
+{/if}
+
{if $amount && !$lineItem}
{foreach from=$amount item=amnt key=level}{$amnt.amount|crmMoney} {$amnt.label}
{/foreach}
{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
{if $isPrimary}
{if $balanceAmount}{ts}Total Paid{/ts}{else}{ts}Total Amount{/ts}{/if}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
diff --git a/xml/templates/message_templates/event_online_receipt_html.tpl b/xml/templates/message_templates/event_online_receipt_html.tpl
index 66953bcec6..0bea1998e8 100644
--- a/xml/templates/message_templates/event_online_receipt_html.tpl
+++ b/xml/templates/message_templates/event_online_receipt_html.tpl
@@ -215,6 +215,11 @@ registration process.{/ts}
| {ts}Item{/ts} |
{ts}Qty{/ts} |
{ts}Each{/ts} |
+ {if $dataArray}
+ {ts}SubTotal{/ts} |
+ {ts}Tax Rate{/ts} |
+ {ts}Tax Amount{/ts} |
+ {/if}
{ts}Total{/ts} |
{if $pricesetFieldsCount }{ts}Total Participants{/ts} | {/if}
@@ -229,6 +234,17 @@ registration process.{/ts}
{$line.unit_price|crmMoney:$currency}
|
+ {if $dataArray}
+
+ {$line.unit_price*$line.qty|crmMoney}
+ |
+
+ {$line.tax_rate|crmMoney}
+ |
+
+ {$line.tax_amount|crmMoney}
+ |
+ {/if}
{$line.line_total|crmMoney:$currency}
|
@@ -240,6 +256,27 @@ registration process.{/ts}
{/if}
{/foreach}
+ {if $dataArray}
+
+ |
+ {ts} Amount Before Tax: {/ts}
+ |
+
+ {$totalAmount-$totalTaxAmount|crmMoney}
+ |
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset}
+ | Vat {$priceset|string_format:"%.2f"}% |
+ {$value|crmMoney:$currency} |
+ {elseif $priceset == 0}
+ No Vat |
+ {$value|crmMoney:$currency} |
+ {/if}
+
+ {/foreach}
+ {/if}
{/if}
{if $amounts && !$lineItem}
@@ -252,6 +289,16 @@ registration process.{/ts}
{/foreach}
{/if}
+ {if $totalTaxAmount}
+
+ |
+ {ts}Total Tax Amount{/ts}
+ |
+
+ {$totalTaxAmount|crmMoney:$currency}
+ |
+
+ {/if}
{if $isPrimary}
|
diff --git a/xml/templates/message_templates/event_online_receipt_text.tpl b/xml/templates/message_templates/event_online_receipt_text.tpl
index 10847d8fe8..4653cb8a6d 100644
--- a/xml/templates/message_templates/event_online_receipt_text.tpl
+++ b/xml/templates/message_templates/event_online_receipt_text.tpl
@@ -134,22 +134,44 @@ You were registered by: {$payer.name}
{capture assign=ts_item}{ts}Item{/ts}{/capture}
{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{if $totalTaxAmount}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{/if}
{capture assign=ts_total}{ts}Total{/ts}{/capture}
{if $pricesetFieldsCount }{capture assign=ts_participant_total}{ts}Total Participants{/ts}{/capture}{/if}
-{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $totalTaxAmount} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
-----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
{foreach from=$value item=line}
{if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if}
-{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {$line.line_total|crmMoney:$currency|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {if $totalTaxAmount} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {$line.tax_rate|crmMoney:$currency|string_format:"%10s"} {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {/if} {$line.line_total|crmMoney:$currency|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"}
+{/foreach}
+{/if}
{/foreach}
+
+{if $dataArray && $totalTaxAmount}
+{ts}Amount before Tax{/ts}: {$totalAmount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset}
+{ts}Vat {$priceset|string_format:"%.2f"}%{/ts}: {$value|crmMoney:$currency}
+{elseif $priceset == 0}
+{ts}No Vat {/ts}: {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}
+{/if}
+
{if $amounts && !$lineItem}
{foreach from=$amounts item=amnt key=level}{$amnt.amount|crmMoney:$currency} {$amnt.label}
{/foreach}
{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
{if $isPrimary }
{ts}Total Amount{/ts}: {$totalAmount|crmMoney:$currency} {if $hookDiscount.message}({$hookDiscount.message}){/if}
diff --git a/xml/templates/message_templates/membership_offline_receipt_html.tpl b/xml/templates/message_templates/membership_offline_receipt_html.tpl
index da729d4433..cd7be66db3 100644
--- a/xml/templates/message_templates/membership_offline_receipt_html.tpl
+++ b/xml/templates/message_templates/membership_offline_receipt_html.tpl
@@ -95,6 +95,12 @@
|
| {ts}Item{/ts} |
{ts}Fee{/ts} |
+ {if $dataArray}
+ {ts}SubTotal{/ts} |
+ {ts}Tax Rate{/ts} |
+ {ts}Tax Amount{/ts} |
+ {ts}Total{/ts} |
+ {/if}
{ts}Membership Start Date{/ts} |
{ts}Membership End Date{/ts} |
@@ -106,6 +112,20 @@
{$line.line_total|crmMoney}
|
+ {if $dataArray}
+
+ {$line.unit_price*$line.qty|crmMoney}
+ |
+
+ {$line.tax_rate|crmMoney}
+ |
+
+ {$line.tax_amount|crmMoney}
+ |
+
+ {$line.line_total|crmMoney}
+ |
+ {/if}
{$line.start_date}
|
@@ -118,7 +138,38 @@
{/foreach}
+ {if $dataArray}
+
+ |
+ {ts}Amount Before Tax : {/ts}
+ |
+
+ {$formValues.total_amount-$totalTaxAmount|crmMoney}
+ |
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset}
+ | VAT {$priceset|string_format:"%.2f"}% |
+ {$value|crmMoney:$currency} |
+ {elseif $priceset == 0}
+ VAT |
+ {$value|crmMoney:$currency} |
+ {/if}
+
+ {/foreach}
+ {/if}
{/if}
+ {if $totalTaxAmount}
+
+ |
+ {ts}Total Tax Amount{/ts}
+ |
+
+ {$totalTaxAmount|crmMoney:$currency}
+ |
+
+ {/if}
|
{ts}Amount{/ts}
diff --git a/xml/templates/message_templates/membership_offline_receipt_text.tpl b/xml/templates/message_templates/membership_offline_receipt_text.tpl
index 812606bdce..d21c0b2ade 100644
--- a/xml/templates/message_templates/membership_offline_receipt_text.tpl
+++ b/xml/templates/message_templates/membership_offline_receipt_text.tpl
@@ -33,17 +33,40 @@
{foreach from=$lineItem item=value key=priceset}
{capture assign=ts_item}{ts}Item{/ts}{/capture}
{capture assign=ts_total}{ts}Fee{/ts}{/capture}
+{if $totalTaxAmount}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{/if}
{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}
{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}
-{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {$ts_start_date|string_format:"%20s"} {$ts_end_date|string_format:"%20s"}
+{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {if $totalTaxAmount} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {$ts_total|string_format:"%10s"} {/if} {$ts_start_date|string_format:"%20s"} {$ts_end_date|string_format:"%20s"}
--------------------------------------------------------------------------------------------------
{foreach from=$value item=line}
-{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.line_total|crmMoney|string_format:"%10s"} {$line.start_date|string_format:"%20s"} {$line.end_date|string_format:"%20s"}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.line_total|crmMoney|string_format:"%10s"} {if $totalTaxAmount} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {$line.tax_rate|crmMoney:$currency|string_format:"%10s"} {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {$line.line_total|crmMoney|string_format:"%10s"} {/if} {$line.start_date|string_format:"%20s"} {$line.end_date|string_format:"%20s"}
+{/foreach}
{/foreach}
+
+{if $dataArray && $totalTaxAmount}
+{ts}Amount before Tax{/ts}: {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset}
+{ts}Vat {$priceset|string_format:"%.2f"}%{/ts}: {$value|crmMoney:$currency}
+{elseif $priceset == 0}
+{ts}No Vat {/ts}: {$value|crmMoney:$currency}
+{/if}
{/foreach}
+{/if}
--------------------------------------------------------------------------------------------------
{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
+
{ts}Amount{/ts}: {$formValues.total_amount|crmMoney}
{if $receive_date}
{ts}Received Date{/ts}: {$receive_date|truncate:10:''|crmDate}
diff --git a/xml/templates/message_templates/membership_online_receipt_html.tpl b/xml/templates/message_templates/membership_online_receipt_html.tpl
index af216f8956..ad1d7fa35a 100644
--- a/xml/templates/message_templates/membership_online_receipt_html.tpl
+++ b/xml/templates/message_templates/membership_online_receipt_html.tpl
@@ -171,6 +171,12 @@
|
| {ts}Item{/ts} |
{ts}Fee{/ts} |
+ {if $dataArray}
+ {ts}SubTotal{/ts} |
+ {ts}Tax Rate{/ts} |
+ {ts}Tax Amount{/ts} |
+ {ts}Total{/ts} |
+ {/if}
{ts}Membership Start Date{/ts} |
{ts}Membership End Date{/ts} |
@@ -182,6 +188,20 @@
{$line.line_total|crmMoney}
|
+ {if $dataArray}
+
+ {$line.unit_price*$line.qty|crmMoney}
+ |
+
+ {$line.tax_rate|crmMoney}
+ |
+
+ {$line.tax_amount|crmMoney}
+ |
+
+ {$line.line_total|crmMoney}
+ |
+ {/if}
{$line.start_date}
|
@@ -194,6 +214,37 @@
{/foreach}
+ {if $dataArray}
+
+ |
+ {ts} Amount Before Tax : {/ts}
+ |
+
+ {$amount-$totalTaxAmount|crmMoney}
+ |
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset}
+ | VAT {$priceset|string_format:"%.2f"}% |
+ {$value|crmMoney:$currency} |
+ {elseif $priceset == 0}
+ VAT |
+ {$value|crmMoney:$currency} |
+ {/if}
+
+ {/foreach}
+ {/if}
+ {/if}
+ {if $totalTaxAmount}
+
+ |
+ {ts}Total Tax Amount{/ts}
+ |
+
+ {$totalTaxAmount|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 481eaf84a6..1a70f4c9a7 100644
--- a/xml/templates/message_templates/membership_online_receipt_text.tpl
+++ b/xml/templates/message_templates/membership_online_receipt_text.tpl
@@ -59,17 +59,40 @@
{foreach from=$lineItem item=value key=priceset}
{capture assign=ts_item}{ts}Item{/ts}{/capture}
{capture assign=ts_total}{ts}Fee{/ts}{/capture}
+{if $totalTaxAmount}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{/if}
{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}
{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}
-{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {$ts_start_date|string_format:"%20s"} {$ts_end_date|string_format:"%20s"}
+{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {if $totalTaxAmount} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {$ts_total|string_format:"%10s"} {/if} {$ts_start_date|string_format:"%20s"} {$ts_end_date|string_format:"%20s"}
--------------------------------------------------------------------------------------------------
{foreach from=$value item=line}
-{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.line_total|crmMoney|string_format:"%10s"} {$line.start_date|string_format:"%20s"} {$line.end_date|string_format:"%20s"}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.line_total|crmMoney|string_format:"%10s"} {if $totalTaxAmount} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {$line.tax_rate|crmMoney:$currency|string_format:"%10s"} {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {$line.line_total|crmMoney|string_format:"%10s"} {/if} {$line.start_date|string_format:"%20s"} {$line.end_date|string_format:"%20s"}
+{/foreach}
{/foreach}
+
+{if $dataArray && $totalTaxAmount}
+{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset}
+{ts}Vat {$priceset|string_format:"%.2f"}%{/ts}: {$value|crmMoney:$currency}
+{elseif $priceset == 0}
+{ts}No Vat {/ts}: {$value|crmMoney:$currency}
+{/if}
{/foreach}
+{/if}
--------------------------------------------------------------------------------------------------
{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
+
{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}
{/if}
{elseif $membership_amount}
--
2.25.1
|