$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);
- $this->assign('invoicing', $invoicing);
if ($invoicing) {
if ($this->_action & CRM_Core_Action::ADD) {
$line = $lineItem;
}
}
}
- else {
- $taxRate = array($submittedValues['tax_amount']);
- }
if ($invoicing) {
if ($this->_action & CRM_Core_Action::UPDATE) {
$this->assign('totalTaxAmount', $submittedValues['tax_amount']);
$this->assign('getTaxDetails', $getTaxDetails);
$this->assign('dataArray', $taxRate);
+ $this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings));
}
else {
$this->assign('totalTaxAmount', CRM_Utils_Array::value('tax_amount', $submittedValues));
}
}
$this->assign('totalTaxAmount', $totalTaxAmount);
+ $this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings));
$this->assign('dataArray', $dataArray);
}
if (!empty($additionalParticipantDetails)) {
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);
+ $taxAmount = FALSE;
$totalTaxAmount = 0;
foreach ($lineItem[$priceSetId] as & $priceFieldOp) {
if (!empty($priceFieldOp['membership_type_id'])) {
$priceFieldOp['start_date'] = $priceFieldOp['end_date'] = 'N/A';
}
if ($invoicing && isset($priceFieldOp['tax_amount'])) {
+ $taxAmount = TRUE;
$totalTaxAmount += $priceFieldOp['tax_amount'];
}
}
}
}
}
- $this->assign('totalTaxAmount', $totalTaxAmount);
+ if ($taxAmount) {
+ $this->assign('totalTaxAmount', $totalTaxAmount);
+ $this->assign('taxTerm', CRM_Utils_Array::value('tax_term', $invoiceSettings));
+ }
$this->assign('dataArray', $dataArray);
}
}
</td>
{if $line.tax_rate != "" || $line.tax_amount != ""}
<td>
- {$line.tax_rate}%
+ {$line.tax_rate|string_format:"%.2f"}%
</td>
<td>
{$line.tax_amount|crmMoney:$currency}
{/foreach}
{/if}
- {if $getTaxDetails && $totalTaxAmount !== 'null'}
+ {if isset($totalTaxAmount) && $totalTaxAmount !== 'null'}
<tr>
<td {$labelStyle}>
{ts}Total Tax Amount{/ts}
{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $getTaxDetails} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate} {$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"} {if $getTaxDetails}{$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {/if} {$line.line_total+$line.tax_amount|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 $getTaxDetails}{$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} {/if} {$line.line_total+$line.tax_amount|crmMoney:$currency|string_format:"%10s"}
{/foreach}
{/foreach}
{/if}
{/foreach}
{/if}
-{if $getTaxDetails && $totalTaxAmount !== 'null'}
+{if isset($totalTaxAmount) && $totalTaxAmount !== 'null'}
{ts}Total Tax Amount{/ts} : {$totalTaxAmount|crmMoney:$currency}
{/if}
{ts}Total Amount{/ts} : {$formValues.total_amount|crmMoney:$currency}
{/foreach}
{/if}
{/if}
- {if $totalTaxAmount}
+ {if isset($totalTaxAmount)}
<tr>
<td {$labelStyle}>
{ts}Total Tax Amount{/ts}
--------------------------------------------------------------------------------------------------
{/if}
-{if $totalTaxAmount}
+{if isset($totalTaxAmount)}
{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
{/if}
</td>
{if $line.tax_rate != "" || $line.tax_amount != ""}
<td>
- {$line.tax_rate}%
+ {$line.tax_rate|string_format:"%.2f"}%
</td>
<td>
{$line.tax_amount|crmMoney:$currency}
{/foreach}
{/if}
- {if $getTaxDetails && $totalTaxAmount !== 'null'}
+ {if isset($totalTaxAmount) && $totalTaxAmount !== 'null'}
<tr>
<td {$labelStyle}>
{ts}Total Tax Amount{/ts}
{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $getTaxDetails} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate} {$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"} {if $getTaxDetails}{$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {/if} {$line.line_total+$line.tax_amount|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 $getTaxDetails}{$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} {/if} {$line.line_total+$line.tax_amount|crmMoney:$currency|string_format:"%10s"}
{/foreach}
{/foreach}
{/if}
{/foreach}
{/if}
-{if $getTaxDetails && $totalTaxAmount !== 'null'}
+{if isset($totalTaxAmount) && $totalTaxAmount !== 'null'}
{ts}Total Tax Amount{/ts} : {$totalTaxAmount|crmMoney:$currency}
{/if}
{ts}Total Amount{/ts} : {$formValues.total_amount|crmMoney:$currency}
{/foreach}
{/if}
{/if}
- {if $totalTaxAmount}
+ {if isset($totalTaxAmount)}
<tr>
<td {$labelStyle}>
{ts}Total Tax Amount{/ts}
--------------------------------------------------------------------------------------------------
{/if}
-{if $totalTaxAmount}
+{if isset($totalTaxAmount)}
{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
{/if}