From 2131ce8da39ec8b1b1d39e090a5825142f734028 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 27 Mar 2023 19:34:34 +1300 Subject: [PATCH] Update membership offline receipt away from form dependence --- CRM/Batch/Form/Entry.php | 2 +- .../WorkflowMessage/ContributionTrait.php | 20 +- CRM/Member/Form/Membership.php | 2 +- CRM/Member/Form/MembershipRenewal.php | 2 +- .../WorkflowMessage/Membership/Membership.php | 182 ++++++++++++++++++ .../MembershipOfflineReceipt.php | 1 + .../MembershipOnlineReceipt.php | 1 + .../WorkflowMessage/MembershipTrait.php | 11 -- Civi/Test/ExampleData/Contact/Barb.php | 16 -- .../CRM/Member/Form/MembershipTest.php | 8 +- .../membership_offline_receipt_html.tpl | 81 ++++---- .../membership_offline_receipt_text.tpl | 60 +++--- 12 files changed, 273 insertions(+), 113 deletions(-) create mode 100644 CRM/Member/WorkflowMessage/Membership/Membership.php diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 7a4a7fe715..a29e665abe 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -968,7 +968,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { 'modelProps' => [ 'contributionId' => $this->getCurrentRowContributionID(), 'contactId' => $form->_receiptContactId, - 'membershipId' => $this->getCurrentRowMembershipID(), + 'membershipID' => $this->getCurrentRowMembershipID(), ], ] ); diff --git a/CRM/Contribute/WorkflowMessage/ContributionTrait.php b/CRM/Contribute/WorkflowMessage/ContributionTrait.php index 91db22e4c5..7cdaed94b9 100644 --- a/CRM/Contribute/WorkflowMessage/ContributionTrait.php +++ b/CRM/Contribute/WorkflowMessage/ContributionTrait.php @@ -1,5 +1,7 @@ isShowLineItems)) { @@ -107,6 +110,7 @@ trait CRM_Contribute_WorkflowMessage_ContributionTrait { * Get the line items. * * @return array + * @throws \CRM_Core_Exception */ public function getLineItems(): array { if (isset($this->lineItems)) { @@ -119,13 +123,23 @@ trait CRM_Contribute_WorkflowMessage_ContributionTrait { // always have the contribution ID available as well as migrated ones. return []; } - return $order->getLineItems(); + $lineItems = $order->getLineItems(); + foreach ($lineItems as $index => $lineItem) { + if ($lineItem['entity_table'] === 'civicrm_membership' && !empty($lineItem['entity_id'])) { + // Add in some per line membership details. This could also go in the Order class? + $lineItems[$index]['membership'] = Membership::get(FALSE)->addWhere('id', '=', $lineItem['entity_id'])->addSelect('start_date', 'end_date')->execute()->first(); + } + } + return $lineItems; } /** * Get the line items. * * @return array + * @throws \CRM_Core_Exception + * + * @noinspection PhpUnused */ public function getTaxRateBreakdown(): array { if (isset($this->taxRateBreakdown)) { @@ -184,6 +198,8 @@ trait CRM_Contribute_WorkflowMessage_ContributionTrait { * and tax are a package. * * @param array $export + * + * @noinspection PhpUnused */ protected function exportExtraTplParams(array &$export): void { $export['isShowTax'] = (bool) Civi::settings()->get('invoicing'); diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index e0e362a850..2fbd84e928 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -983,7 +983,7 @@ DESC limit 1"); 'receiptText' => $this->getSubmittedValue('receipt_text'), 'contributionId' => $formValues['contribution_id'], 'contactId' => $this->_receiptContactId, - 'membershipId' => $this->getMembershipID(), + 'membershipID' => $this->getMembershipID(), ], ] ); diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 82dd22d5b6..2672509452 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -705,7 +705,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { 'modelProps' => [ 'receiptText' => $this->getSubmittedValue('receipt_text'), 'contactId' => $this->_receiptContactId, - 'contributionID' => $this->getContributionID(), + 'contributionId' => $this->getContributionID(), 'membershipID' => $this->_membershipId, ], ] diff --git a/CRM/Member/WorkflowMessage/Membership/Membership.php b/CRM/Member/WorkflowMessage/Membership/Membership.php new file mode 100644 index 0000000000..25c46a6950 --- /dev/null +++ b/CRM/Member/WorkflowMessage/Membership/Membership.php @@ -0,0 +1,182 @@ +execute()->first(); + if (empty($membershipType)) { + return; + } + $workflows = ['membership_online_receipt', 'membership_offline_receipt']; + $defaultCurrency = \Civi::settings()->get('defaultCurrency'); + $priceSets = $this->getPriceSet(); + + foreach ($workflows as $workflow) { + foreach ($priceSets as $priceSet) { + yield [ + 'name' => 'workflow/' . $workflow . '/' . strtolower($membershipType['name']) . '_' . strtolower($priceSet['name']) . '_' . strtolower($defaultCurrency), + 'title' => $priceSet['title'] . ' - ' . $membershipType['name'] . ' : ' . $defaultCurrency, + 'tags' => ['preview'], + 'workflow' => $workflow, + 'membership_type' => $membershipType, + 'currency' => $defaultCurrency, + 'price_set_id' => $priceSet['id'], + 'is_show_line_items' => !$priceSets['is_quick_config'], + ]; + } + } + } + + /** + * Build an example to use when rendering the workflow. + * + * @param array $example + * + * @throws \CRM_Core_Exception + */ + public function build(array &$example): void { + $workFlow = WorkflowMessage::get(TRUE)->addWhere('name', '=', $example['workflow'])->execute()->first(); + $this->setWorkflowName($workFlow['name']); + $messageTemplate = new $workFlow['class'](); + $this->addExampleData($messageTemplate, $example); + $example['data'] = $this->toArray($messageTemplate); + } + + /** + * Add relevant example data. + * + * @param \CRM_Member_WorkflowMessage_MembershipOfflineReceipt|\CRM_Member_WorkflowMessage_MembershipOnlineReceipt $messageTemplate + * @param array $example + * + * @throws \CRM_Core_Exception + * @throws \Civi\API\Exception\UnauthorizedException + */ + private function addExampleData(GenericWorkflowMessage $messageTemplate, array $example): void { + $messageTemplate->setContact(Test::example('entity/Contact/Barb')); + + $membership = [ + 'membership_type_id' => $example['membership_type']['id'], + 'membership_type_id:name' => $example['membership_type']['name'], + 'membership_type_id:label' => $example['membership_type']['name'], + 'status_id:name' => 'Current', + 'start_date' => date('Y-m-05', strtotime('-1 month')), + // Ideally we would leave blank for lifetime & maybe calculate more meaningfully. + 'end_date' => date('Y-m-05', strtotime('+ 11 months')), + ]; + $messageTemplate->setMembership($membership); + + $contribution = [ + 'id' => 50, + 'contact_id' => 100, + 'financial_type_id' => $example['membership_type']['financial_type_id'], + 'receive_date' => '2021-07-23 15:39:20', + 'total_amount' => $example['membership_type']['minimum_amount'], + 'fee_amount' => .99, + 'net_amount' => $example['membership_type']['minimum_amount'] - .99, + 'currency' => $example['currency'], + 'trxn_id' => 123, + 'invoice_id' => 'I-123', + 'contribution_status_id:name' => 'Completed', + 'contribution_status_id' => \CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'), + ]; + $contribution['contribution_status_id:label'] = \CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contribution['contribution_status_id']); + + if (isset($example['contribution_params'])) { + $contribution = array_merge($contribution, $example['contribution_params']); + } + + $mockOrder = new CRM_Financial_BAO_Order(); + $mockOrder->setTemplateContributionID(50); + + if (empty($example['is_show_line_items'])) { + $mockOrder->setPriceSetToDefault('membership'); + $mockOrder->setOverrideTotalAmount($example['membership_type']['minimum_fee']); + $mockOrder->setDefaultFinancialTypeID($example['membership_type']['financial_type_id']); + } + else { + $priceSet = $this->getPriceSet()[$example['price_set_id']]; + $mockOrder->setPriceSetID($priceSet['id']); + if ($priceSet['financial_type_id']) { + $mockOrder->setDefaultFinancialTypeID($priceSet['financial_type_id']); + } + } + foreach (PriceField::get()->addWhere('price_set_id', '=', $mockOrder->getPriceSetID())->execute() as $index => $priceField) { + $priceFieldValue = PriceFieldValue::get()->addWhere('price_field_id', '=', $priceField['id'])->execute()->first(); + if (empty($example['is_show_line_items'])) { + $priceFieldValue['amount'] = $contribution['total_amount']; + $priceFieldValue['financial_type_id'] = $contribution['financial_type_id']; + } + $this->setLineItem($mockOrder, $priceField, $priceFieldValue, $index, $membership); + } + + $contribution['total_amount'] = $mockOrder->getTotalAmount(); + $contribution['tax_amount'] = $mockOrder->getTotalTaxAmount() ? round($mockOrder->getTotalTaxAmount(), 2) : 0; + $messageTemplate->setContribution($contribution); + $messageTemplate->setOrder($mockOrder); + $messageTemplate->setContribution($contribution); + } + + /** + * Get a non-quick-config price set. + * + * @return array|null + * @throws \CRM_Core_Exception + */ + private function getPriceSet(): ?array { + // Permission check defaults to true - likely implicitly OK but may need to be false. + return (array) PriceSet::get() + ->addWhere('extends', '=', CRM_Core_Component::getComponentID('CiviMember')) + ->addOrderBy('is_quick_config', 'DESC') + ->execute()->indexBy('id'); + } + + /** + * @param \CRM_Financial_BAO_Order $mockOrder + * @param $priceField + * @param array|null $priceFieldValue + * @param $index + * @param $membership + * + * @throws \CRM_Core_Exception + */ + private function setLineItem(CRM_Financial_BAO_Order $mockOrder, $priceField, ?array $priceFieldValue, $index, $membership): void { + $lineItem = [ + 'price_field_id' => $priceField['id'], + 'price_field_id.label' => $priceField['label'], + 'price_field_value_id' => $priceFieldValue['id'], + 'qty' => $priceField['is_enter_qty'] ? 2 : 1, + 'unit_price' => $priceFieldValue['amount'], + 'line_total' => $priceField['is_enter_qty'] ? ($priceFieldValue['amount'] * 2) : $priceFieldValue['amount'], + 'label' => $priceFieldValue['label'], + 'financial_type_id' => $priceFieldValue['financial_type_id'], + 'non_deductible_amount' => $priceFieldValue['non_deductible_amount'], + ]; + if (!empty($priceFieldValue['membership_type_id'])) { + $lineItem['membership'] = ['start_date' => $membership['start_date'], 'end_date' => $membership['end_date']]; + } + $mockOrder->setLineItem($lineItem, $index); + } + +} diff --git a/CRM/Member/WorkflowMessage/MembershipOfflineReceipt.php b/CRM/Member/WorkflowMessage/MembershipOfflineReceipt.php index 171fe673c2..9522240d5c 100644 --- a/CRM/Member/WorkflowMessage/MembershipOfflineReceipt.php +++ b/CRM/Member/WorkflowMessage/MembershipOfflineReceipt.php @@ -22,6 +22,7 @@ use Civi\WorkflowMessage\GenericWorkflowMessage; */ class CRM_Member_WorkflowMessage_MembershipOfflineReceipt extends GenericWorkflowMessage { use CRM_Member_WorkflowMessage_MembershipTrait; + use CRM_Contribute_WorkflowMessage_ContributionTrait; public const WORKFLOW = 'membership_offline_receipt'; /** diff --git a/CRM/Member/WorkflowMessage/MembershipOnlineReceipt.php b/CRM/Member/WorkflowMessage/MembershipOnlineReceipt.php index 6ba72b0777..13f43f9258 100644 --- a/CRM/Member/WorkflowMessage/MembershipOnlineReceipt.php +++ b/CRM/Member/WorkflowMessage/MembershipOnlineReceipt.php @@ -22,6 +22,7 @@ use Civi\WorkflowMessage\GenericWorkflowMessage; */ class CRM_Member_WorkflowMessage_MembershipOnlineReceipt extends GenericWorkflowMessage { use CRM_Member_WorkflowMessage_MembershipTrait; + use CRM_Contribute_WorkflowMessage_ContributionTrait; public const WORKFLOW = 'membership_online_receipt'; } diff --git a/CRM/Member/WorkflowMessage/MembershipTrait.php b/CRM/Member/WorkflowMessage/MembershipTrait.php index 62a7fef27d..665fd4cb7e 100644 --- a/CRM/Member/WorkflowMessage/MembershipTrait.php +++ b/CRM/Member/WorkflowMessage/MembershipTrait.php @@ -4,8 +4,6 @@ * @method array getMembership() * @method ?int getMembershipID() * @method $this setMembershipID(?int $membershipID) - * @method ?int getContributionID() - * @method $this setContributionID(?int $membershipID) */ trait CRM_Member_WorkflowMessage_MembershipTrait { /** @@ -23,15 +21,6 @@ trait CRM_Member_WorkflowMessage_MembershipTrait { */ protected $membershipID; - /** - * Contribution ID. - * - * @var int - * - * @scope tokenContext as contributionId, tplParams as contributionID - */ - protected $contributionID; - /** * Set membership object. * diff --git a/Civi/Test/ExampleData/Contact/Barb.php b/Civi/Test/ExampleData/Contact/Barb.php index 3bbcdf99f8..3044a098c4 100644 --- a/Civi/Test/ExampleData/Contact/Barb.php +++ b/Civi/Test/ExampleData/Contact/Barb.php @@ -66,25 +66,9 @@ class Barb extends EntityExample { 'phone' => '393-7924', 'email_id' => '7', 'email' => 'barb@testing.net', - 'on_hold' => '0', - 'im_id' => NULL, - 'provider_id' => NULL, - 'im' => NULL, 'worldregion_id' => NULL, 'world_region' => NULL, - 'languages' => NULL, - 'individual_prefix' => NULL, - 'individual_suffix' => NULL, - 'communication_style' => NULL, - 'gender' => 'Female', - 'state_province_name' => NULL, - 'state_province' => NULL, - 'country' => NULL, - 'email_greeting_id' => 1, - 'email_greeting_custom' => NULL, 'email_greeting_display' => 'Dear Barb', - 'postal_greeting_id' => 1, - 'postal_greeting_custom' => NULL, 'postal_greeting_display' => 'Dear Barb', ]; } diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index 5fd4eaf963..23f9eb5913 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -18,6 +18,7 @@ */ use Civi\Api4\FinancialType; +use Civi\Api4\Membership; use Civi\Api4\MembershipType; use Civi\Api4\PriceFieldValue; @@ -1518,16 +1519,19 @@ Expires: ', * @return string[] */ private function getExpectedEmailStrings(): array { + $membership = Membership::get()->execute()->first(); return [ + ' ' . CRM_Utils_Date::formatDateOnlyLong($membership['start_date']) . ' ' . CRM_Utils_Date::formatDateOnlyLong($membership['end_date']) . ' ', '', - '
', + '
Item Fee SubTotal Tax Rate Tax Amount Total Membership Start Date Membership Expiration Date
Membership Amount - AnnualFixed
', '', '', - '', + '', 'Total Tax Amount ', 'Amount ', 'Paid By ', diff --git a/xml/templates/message_templates/membership_offline_receipt_html.tpl b/xml/templates/message_templates/membership_offline_receipt_html.tpl index 0d00a94e11..17b704ebf0 100644 --- a/xml/templates/message_templates/membership_offline_receipt_html.tpl +++ b/xml/templates/message_templates/membership_offline_receipt_html.tpl @@ -32,7 +32,7 @@
Item Fee SubTotal Tax Rate Tax Amount Total Membership Start Date Membership Expiration Date
Membership Amount - AnnualFixed $50.00 $50.00 10.00% $5.00 $55.00 ', 'Amount Before Tax: $50.00  Sales Tax 10.00%  $5.00 Sales Tax 10.00% $5.00 $5.00 $55.00 Check
- {if empty($lineItem)} + {if !$isShowLineItems} {/if} - {if empty($cancelled)} - {if empty($lineItem)} + {if '{membership.status_id:name}' !== 'Cancelled'} + {if !$isShowLineItems} @@ -62,36 +62,35 @@ {ts}Membership Expiration Date{/ts} {/if} - {if $formValues.total_amount OR $formValues.total_amount eq 0 } + {if '{contribution.total_amount|raw}' !== '0.00'} - {if !empty($formValues.contributionType_name)} + {if {contribution.financial_type_id|boolean}} {/if} - {if !empty($lineItem)} - {foreach from=$lineItem item=value key=priceset} + {if $isShowLineItems} - {/foreach} - {if !empty($dataArray)} - {if $formValues.total_amount and $totalTaxAmount} + + {if $isShowTax && '{contribution.tax_amount|raw}' !== '0.00'} - {/if} - {foreach from=$dataArray item=value key=priceset} + {foreach from=$taxRateBreakdown item=taxDetail key=taxRate} - {if $priceset} - - - {elseif $priceset == 0} - - - {/if} + + {/foreach} {/if} {/if} - {if $totalTaxAmount} + {if '{contribution.tax_amount|raw}' !== '0.00'} {/if} @@ -179,35 +168,35 @@ {ts}Amount{/ts} - {if !empty($receive_date)} + {if {contribution.receive_date|boolean}} {/if} - {if !empty($formValues.paidBy)} + {if {contribution.payment_instrument_id|boolean}} - {if !empty($formValues.check_number)} + {if {contribution.check_number|boolean}} {/if} diff --git a/xml/templates/message_templates/membership_offline_receipt_text.tpl b/xml/templates/message_templates/membership_offline_receipt_text.tpl index 16207453d0..5e2bd3461a 100644 --- a/xml/templates/message_templates/membership_offline_receipt_text.tpl +++ b/xml/templates/message_templates/membership_offline_receipt_text.tpl @@ -4,32 +4,31 @@ {$receipt_text} {else}{ts}Thank you for this contribution.{/ts}{/if} -{if empty($lineItem)} +{if !$isShowLineItems} =========================================================== {ts}Membership Information{/ts} =========================================================== -{ts}Membership Type{/ts}: {$membership_name} +{ts}Membership Type{/ts}: {membership.membership_type_id:name} {/if} -{if empty($cancelled)} -{if empty($lineItem)} -{ts}Membership Start Date{/ts}: {$mem_start_date} -{ts}Membership Expiration Date{/ts}: {$mem_end_date} +{if '{membership.status_id:name}' !== 'Cancelled'} +{if !$isShowLineItems} +{ts}Membership Start Date{/ts}: {membership.start_date|crmDate:"Full"} +{ts}Membership Expiration Date{/ts}: {membership.end_date|crmDate:"Full"} {/if} -{if $formValues.total_amount OR $formValues.total_amount eq 0 } +{if '{contribution.total_amount|raw}' !== '0.00'} =========================================================== {ts}Membership Fee{/ts} =========================================================== -{if !empty($formValues.contributionType_name)} -{ts}Financial Type{/ts}: {$formValues.contributionType_name} +{if {contribution.financial_type_id|boolean}} +{ts}Financial Type{/ts}: {contribution.financial_type_id:label} {/if} -{if !empty($lineItem)} -{foreach from=$lineItem item=value key=priceset} +{if $isShowLineItems} {capture assign=ts_item}{ts}Item{/ts}{/capture} {capture assign=ts_total}{ts}Fee{/ts}{/capture} -{if !empty($dataArray)} +{if $isShowTax && '{contribution.tax_amount|raw}' !== '0.00'} {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} @@ -37,40 +36,35 @@ {/if} {capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture} {capture assign=ts_end_date}{ts}Membership Expiration Date{/ts}{/capture} -{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {if !empty($dataArray)} {$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"} +{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {if $isShowTax && '{contribution.tax_amount|raw}' !== '0.00'} {$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"} {if !empty($dataArray)} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {$line.line_total+$line.tax_amount|crmMoney|string_format:"%10s"} {/if} {$line.start_date|string_format:"%20s"} {$line.end_date|string_format:"%20s"} -{/foreach} +{foreach from=$lineItems item=line} +{line.title} {$line.line_total|crmMoney|string_format:"%10s"} {if $isShowTax && '{contribution.tax_amount|raw}' !== '0.00'} {$line.unit_price*$line.qty|crmMoney:'{contribution.currency}'|string_format:"%10s"} {if $line.tax_rate || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:'{contribution.currency}'|string_format:"%10s"} {else} {/if} {$line.line_total+$line.tax_amount|crmMoney|string_format:"%10s"} {/if} {$line.membership.start_date|string_format:"%20s"} {$line.membership.end_date|string_format:"%20s"} {/foreach} -{if !empty($dataArray)} -{ts}Amount before Tax{/ts}: {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency} +{if $isShowTax && '{contribution.tax_amount|raw}' !== '0.00'} +{ts}Amount before Tax{/ts}: {contribution.tax_exclusive_amount} -{foreach from=$dataArray item=value key=priceset} -{if $priceset} -{$taxTerm} {$priceset|string_format:"%.2f"} %: {$value|crmMoney:$currency} -{elseif $priceset == 0} -{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency} -{/if} +{foreach from=$taxRateBreakdown item=taxDetail key=taxRate} +{if $taxRate == 0}{ts}No{/ts} {$taxTerm}{else} {$taxTerm} {$taxDetail.percentage}%{/if}: {$taxDetail.amount|crmMoney:'{contribution.currency}'} {/foreach} {/if} -------------------------------------------------------------------------------------------------- {/if} -{if $totalTaxAmount} -{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency} +{if '{contribution.tax_amount|raw}' !== '0.00'} +{ts}Total Tax Amount{/ts}: {contribution.tax_amount} {/if} -{ts}Amount{/ts}: {$formValues.total_amount|crmMoney} -{if !empty($receive_date)} -{ts}Date Received{/ts}: {$receive_date|truncate:10:''|crmDate} +{ts}Amount{/ts}: {contribution.total_amount} +{if {contribution.receive_date|boolean}} +{ts}Date Received{/ts}: {contribution.receive_date} {/if} -{if !empty($formValues.paidBy)} -{ts}Paid By{/ts}: {$formValues.paidBy} -{if !empty($formValues.check_number)} -{ts}Check Number{/ts}: {$formValues.check_number} +{if {contribution.payment_instrument_id|boolean}} +{ts}Paid By{/ts}: {contribution.payment_instrument_id:label} +{if {contribution.check_number|boolean}} +{ts}Check Number{/ts}: {contribution.check_number|boolean} {/if} {/if} {/if} -- 2.25.1
{ts}Membership Information{/ts} @@ -43,18 +43,18 @@ {ts}Membership Type{/ts} - {$membership_name} + {membership.membership_type_id:name}
{ts}Membership Start Date{/ts} - {$mem_start_date} + {membership.start_date|crmDate:"Full"}
- {$mem_end_date} + {membership.end_date|crmDate:"Full"}
{ts}Membership Fee{/ts}
{ts}Financial Type{/ts} - {$formValues.contributionType_name} + {contribution.financial_type_id:label}
- {if !empty($dataArray)} + {if $isShowTax && '{contribution.tax_amount|raw}' !== '0.00'} @@ -100,77 +99,67 @@ - {foreach from=$value item=line} + {foreach from=$lineItems item=line} - + - {if !empty($dataArray)} + {if $isShowTax && '{contribution.tax_amount|raw}' !== '0.00'} {if $line.tax_rate || $line.tax_amount != ""} {else} {/if} {/if} {/foreach}
{ts}Item{/ts} {ts}Fee{/ts}{ts}SubTotal{/ts} {ts}Tax Rate{/ts} {ts}Tax Amount{/ts}{ts}Membership Start Date{/ts} {ts}Membership Expiration Date{/ts}
- {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} -
{$line.description|truncate:30:"..."}
{/if} -
{$line.title} {$line.line_total|crmMoney} - {$line.unit_price*$line.qty|crmMoney} + {$line.unit_price*$line.qty|crmMoney:'{contribution.currency}'} {$line.tax_rate|string_format:"%.2f"}% - {$line.tax_amount|crmMoney} + {$line.tax_amount|crmMoney:'{contribution.currency}'} - {$line.line_total+$line.tax_amount|crmMoney} + {$line.line_total+$line.tax_amount|crmMoney:'{contribution.currency}'} - {$line.start_date} + {$line.membership.start_date|crmDate:"Full"} - {$line.end_date} + {$line.membership.end_date|crmDate:"Full"}
- {ts}Amount Before Tax:{/ts} + {ts}Amount Before Tax{/ts}: - {$formValues.total_amount-$totalTaxAmount|crmMoney} + {contribution.tax_exclusive_amount}
 {$taxTerm} {$priceset|string_format:"%.2f"}% {$value|crmMoney:$currency} {ts}No{/ts} {$taxTerm} {$value|crmMoney:$currency}{if $taxRate == 0}{ts}No{/ts} {$taxTerm}{else} {$taxTerm} {$taxDetail.percentage}%{/if}{$taxDetail.amount|crmMoney:'{contribution.currency}'}
{ts}Total Tax Amount{/ts} - {$totalTaxAmount|crmMoney:$currency} + {contribution.tax_amount}
- {$formValues.total_amount|crmMoney} + {contribution.total_amount}
{ts}Date Received{/ts} - {$receive_date|truncate:10:''|crmDate} + {contribution.receive_date}
{ts}Paid By{/ts} - {$formValues.paidBy} + {contribution.payment_instrument_id:label}
{ts}Check Number{/ts} - {$formValues.check_number} + {contribution.check_number}