Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
1188c7a8 | 3 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 4 | | | |
1188c7a8 TO |
5 | | This work is published under the GNU AGPLv3 license with some | |
6 | | permitted exceptions and without any warranty. For full license | | |
7 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 TO |
8 | +--------------------------------------------------------------------+ |
9 | *} | |
10 | ||
11 | {* Displays contribution/event fees when price set is used. *} | |
eb6acea3 JP |
12 | {if !$currency && $fee_currency} |
13 | {assign var=currency value="$fee_currency"} | |
14 | {/if} | |
15 | ||
6a488035 TO |
16 | {foreach from=$lineItem item=value key=priceset} |
17 | {if $value neq 'skip'} | |
18 | {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} | |
19 | {if $priceset GT 0} | |
20 | <br /> | |
21 | {/if} | |
22 | <strong>{ts}Participant {$priceset+1}{/ts}</strong> {$part.$priceset.info} | |
23 | {/if} | |
24 | <table> | |
d7266ca8 | 25 | <tr class="columnheader"> |
152ff8b9 | 26 | <th>{ts}Item{/ts}</th> |
64525dae | 27 | {if $displayLineItemFinancialType} |
28 | <th>{ts}Financial Type{/ts}</th> | |
29 | {/if} | |
d7266ca8 DG |
30 | {if $context EQ "Membership"} |
31 | <th class="right">{ts}Fee{/ts}</th> | |
32 | {else} | |
33 | <th class="right">{ts}Qty{/ts}</th> | |
34 | <th class="right">{ts}Unit Price{/ts}</th> | |
24f81279 | 35 | {if !$getTaxDetails} |
36 | <th class="right">{ts}Total Price{/ts}</th> | |
37 | {/if} | |
a32709be | 38 | {/if} |
a32709be | 39 | |
03b412ae | 40 | {if $getTaxDetails} |
a32709be PB |
41 | <th class="right">{ts}Subtotal{/ts}</th> |
42 | <th class="right">{ts}Tax Rate{/ts}</th> | |
43 | <th class="right">{ts}Tax Amount{/ts}</th> | |
44 | <th class="right">{ts}Total Amount{/ts}</th> | |
45 | {/if} | |
152ff8b9 | 46 | |
d7266ca8 DG |
47 | {if $pricesetFieldsCount} |
48 | <th class="right">{ts}Total Participants{/ts}</th> | |
49 | {/if} | |
50 | </tr> | |
51 | {foreach from=$value item=line} | |
52 | <tr{if $line.qty EQ 0} class="cancelled"{/if}> | |
fa742e4e | 53 | <td>{if $line.field_title && $line.html_type neq 'Text'}{$line.field_title} – {$line.label}{else}{$line.label}{/if} {if $line.description}<div class="description">{$line.description}</div>{/if}</td> |
64525dae | 54 | {if $displayLineItemFinancialType} |
55 | <td>{$line.financial_type}</td> | |
56 | {/if} | |
d7266ca8 DG |
57 | {if $context NEQ "Membership"} |
58 | <td class="right">{$line.qty}</td> | |
eb6acea3 | 59 | <td class="right">{$line.unit_price|crmMoney:$currency}</td> |
d75f2f47 | 60 | {else} |
eb6acea3 | 61 | <td class="right">{$line.line_total|crmMoney:$currency}</td> |
d7266ca8 | 62 | {/if} |
d75f2f47 | 63 | {if !$getTaxDetails && $context NEQ "Membership"} |
eb6acea3 | 64 | <td class="right">{$line.line_total|crmMoney:$currency}</td> |
d75f2f47 EM |
65 | {/if} |
66 | {if $getTaxDetails} | |
eb6acea3 | 67 | <td class="right">{$line.line_total|crmMoney:$currency}</td> |
d75f2f47 | 68 | {if $line.tax_rate != "" || $line.tax_amount != ""} |
cc3f313d | 69 | <td class="right">{$taxTerm} ({$line.tax_rate}%)</td> |
eb6acea3 | 70 | <td class="right">{$line.tax_amount|crmMoney:$currency}</td> |
d75f2f47 EM |
71 | {else} |
72 | <td></td> | |
73 | <td></td> | |
74 | {/if} | |
eb6acea3 | 75 | <td class="right">{$line.line_total+$line.tax_amount|crmMoney:$currency}</td> |
d75f2f47 | 76 | {/if} |
d7266ca8 DG |
77 | {if $pricesetFieldsCount} |
78 | <td class="right">{$line.participant_count}</td> | |
79 | {/if} | |
80 | </tr> | |
81 | {/foreach} | |
6a488035 | 82 | </table> |
d7266ca8 | 83 | {/if} |
6a488035 TO |
84 | {/foreach} |
85 | ||
86 | <div class="crm-section no-label total_amount-section"> | |
d7266ca8 | 87 | <div class="content bold"> |
24f81279 | 88 | {if $getTaxDetails && $totalTaxAmount} |
eb6acea3 | 89 | {ts 1=$taxTerm}Total %1 Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}<br /> |
24f81279 | 90 | {/if} |
d7266ca8 DG |
91 | {if $context EQ "Contribution"} |
92 | {ts}Contribution Total{/ts}: | |
93 | {elseif $context EQ "Event"} | |
24f81279 | 94 | {if $totalTaxAmount} |
eb6acea3 | 95 | {ts}Event SubTotal: {$totalAmount-$totalTaxAmount|crmMoney:$currency}{/ts}<br /> |
a32709be | 96 | {/if} |
d7266ca8 DG |
97 | {ts}Event Total{/ts}: |
98 | {elseif $context EQ "Membership"} | |
99 | {ts}Membership Fee Total{/ts}: | |
100 | {else} | |
101 | {ts}Total Amount{/ts}: | |
102 | {/if} | |
eb6acea3 | 103 | {$totalAmount|crmMoney:$currency} |
d7266ca8 DG |
104 | </div> |
105 | <div class="clear"></div> | |
106 | <div class="content bold"> | |
107 | {if $pricesetFieldsCount} | |
6a488035 TO |
108 | {ts}Total Participants{/ts}: |
109 | {foreach from=$lineItem item=pcount} | |
110 | {if $pcount neq 'skip'} | |
111 | {assign var="lineItemCount" value=0} | |
112 | ||
113 | {foreach from=$pcount item=p_count} | |
242f332b | 114 | {assign var="intPCount" value=$p_count.participant_count|intval} |
115 | {assign var="lineItemCount" value=$lineItemCount+$intPCount} | |
6a488035 TO |
116 | {/foreach} |
117 | {if $lineItemCount < 1 } | |
118 | {assign var="lineItemCount" value=1} | |
119 | {/if} | |
120 | {assign var="totalcount" value=$totalcount+$lineItemCount} | |
121 | {/if} | |
122 | {/foreach} | |
123 | {$totalcount} | |
d7266ca8 DG |
124 | {/if} |
125 | </div> | |
126 | <div class="clear"></div> | |
6a488035 TO |
127 | </div> |
128 | ||
c3f37ec2 | 129 | {if $hookDiscount && $hookDiscount.message} |
6a488035 | 130 | <div class="crm-section hookDiscount-section"> |
d7266ca8 | 131 | <em>({$hookDiscount.message})</em> |
6a488035 TO |
132 | </div> |
133 | {/if} | |
134 | {literal} | |
135 | <script type="text/javascript"> | |
32678ccb | 136 | CRM.$(function($) { |
6a488035 TO |
137 | {/literal} |
138 | var comma = '{$config->monetaryThousandSeparator}'; | |
139 | var dot = '{$config->monetaryDecimalPoint}'; | |
140 | var format = '{$config->moneyformat}'; | |
141 | var currency = '{$currency}'; | |
142 | var currencySymbol = '{$currencySymbol}'; | |
152ff8b9 | 143 | {literal} |
6a488035 TO |
144 | // Todo: This function should be a utility |
145 | function moneyFormat(amount) { | |
146 | amount = parseFloat(amount).toFixed(2); | |
147 | amount = amount.replace(',', 'comma').replace('.', 'dot'); | |
148 | amount = amount.replace('comma', comma).replace('dot', dot); | |
149 | return format.replace('%C', currency).replace('%c', currencySymbol).replace('%a', amount); | |
150 | }}); | |
151 | </script> | |
152 | {/literal} |