Merge pull request #12682 from eileenmcnaughton/date_extension
[civicrm-core.git] / templates / CRM / Price / Page / LineItem.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
fee14197 3 | CiviCRM version 5 |
6a488035 4 +--------------------------------------------------------------------+
8c9251b3 5 | Copyright CiviCRM LLC (c) 2004-2018 |
6a488035
TO
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25*}
26
27{* Displays contribution/event fees when price set is used. *}
eb6acea3
JP
28{if !$currency && $fee_currency}
29 {assign var=currency value="$fee_currency"}
30{/if}
31
6a488035
TO
32{foreach from=$lineItem item=value key=priceset}
33 {if $value neq 'skip'}
34 {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
35 {if $priceset GT 0}
36 <br />
37 {/if}
38 <strong>{ts}Participant {$priceset+1}{/ts}</strong> {$part.$priceset.info}
39 {/if}
40 <table>
d7266ca8 41 <tr class="columnheader">
152ff8b9 42 <th>{ts}Item{/ts}</th>
64525dae 43 {if $displayLineItemFinancialType}
44 <th>{ts}Financial Type{/ts}</th>
45 {/if}
d7266ca8
DG
46 {if $context EQ "Membership"}
47 <th class="right">{ts}Fee{/ts}</th>
48 {else}
49 <th class="right">{ts}Qty{/ts}</th>
50 <th class="right">{ts}Unit Price{/ts}</th>
24f81279 51 {if !$getTaxDetails}
52 <th class="right">{ts}Total Price{/ts}</th>
53 {/if}
a32709be 54 {/if}
a32709be 55
03b412ae 56 {if $getTaxDetails}
a32709be
PB
57 <th class="right">{ts}Subtotal{/ts}</th>
58 <th class="right">{ts}Tax Rate{/ts}</th>
59 <th class="right">{ts}Tax Amount{/ts}</th>
60 <th class="right">{ts}Total Amount{/ts}</th>
61 {/if}
152ff8b9 62
d7266ca8
DG
63 {if $pricesetFieldsCount}
64 <th class="right">{ts}Total Participants{/ts}</th>
65 {/if}
66 </tr>
67 {foreach from=$value item=line}
68 <tr{if $line.qty EQ 0} class="cancelled"{/if}>
fa742e4e 69 <td>{if $line.field_title && $line.html_type neq 'Text'}{$line.field_title} &ndash; {$line.label}{else}{$line.label}{/if} {if $line.description}<div class="description">{$line.description}</div>{/if}</td>
64525dae 70 {if $displayLineItemFinancialType}
71 <td>{$line.financial_type}</td>
72 {/if}
d7266ca8
DG
73 {if $context NEQ "Membership"}
74 <td class="right">{$line.qty}</td>
eb6acea3 75 <td class="right">{$line.unit_price|crmMoney:$currency}</td>
d75f2f47 76 {else}
eb6acea3 77 <td class="right">{$line.line_total|crmMoney:$currency}</td>
d7266ca8 78 {/if}
d75f2f47 79 {if !$getTaxDetails && $context NEQ "Membership"}
eb6acea3 80 <td class="right">{$line.line_total|crmMoney:$currency}</td>
d75f2f47
EM
81 {/if}
82 {if $getTaxDetails}
eb6acea3 83 <td class="right">{$line.line_total|crmMoney:$currency}</td>
d75f2f47 84 {if $line.tax_rate != "" || $line.tax_amount != ""}
cc3f313d 85 <td class="right">{$taxTerm} ({$line.tax_rate}%)</td>
eb6acea3 86 <td class="right">{$line.tax_amount|crmMoney:$currency}</td>
d75f2f47
EM
87 {else}
88 <td></td>
89 <td></td>
90 {/if}
eb6acea3 91 <td class="right">{$line.line_total+$line.tax_amount|crmMoney:$currency}</td>
d75f2f47 92 {/if}
d7266ca8
DG
93 {if $pricesetFieldsCount}
94 <td class="right">{$line.participant_count}</td>
95 {/if}
96 </tr>
97 {/foreach}
6a488035 98 </table>
d7266ca8 99 {/if}
6a488035
TO
100{/foreach}
101
102<div class="crm-section no-label total_amount-section">
d7266ca8 103 <div class="content bold">
24f81279 104 {if $getTaxDetails && $totalTaxAmount}
eb6acea3 105 {ts 1=$taxTerm}Total %1 Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}<br />
24f81279 106 {/if}
d7266ca8
DG
107 {if $context EQ "Contribution"}
108 {ts}Contribution Total{/ts}:
109 {elseif $context EQ "Event"}
24f81279 110 {if $totalTaxAmount}
eb6acea3 111 {ts}Event SubTotal: {$totalAmount-$totalTaxAmount|crmMoney:$currency}{/ts}<br />
a32709be 112 {/if}
d7266ca8
DG
113 {ts}Event Total{/ts}:
114 {elseif $context EQ "Membership"}
115 {ts}Membership Fee Total{/ts}:
116 {else}
117 {ts}Total Amount{/ts}:
118 {/if}
eb6acea3 119 {$totalAmount|crmMoney:$currency}
d7266ca8
DG
120 </div>
121 <div class="clear"></div>
122 <div class="content bold">
123 {if $pricesetFieldsCount}
6a488035
TO
124 {ts}Total Participants{/ts}:
125 {foreach from=$lineItem item=pcount}
126 {if $pcount neq 'skip'}
127 {assign var="lineItemCount" value=0}
128
129 {foreach from=$pcount item=p_count}
130 {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
131 {/foreach}
132 {if $lineItemCount < 1 }
133 {assign var="lineItemCount" value=1}
134 {/if}
135 {assign var="totalcount" value=$totalcount+$lineItemCount}
136 {/if}
137 {/foreach}
138 {$totalcount}
d7266ca8
DG
139 {/if}
140 </div>
141 <div class="clear"></div>
6a488035
TO
142</div>
143
144{if $hookDiscount.message}
145 <div class="crm-section hookDiscount-section">
d7266ca8 146 <em>({$hookDiscount.message})</em>
6a488035
TO
147 </div>
148{/if}
149{literal}
150<script type="text/javascript">
32678ccb 151CRM.$(function($) {
6a488035
TO
152 {/literal}
153 var comma = '{$config->monetaryThousandSeparator}';
154 var dot = '{$config->monetaryDecimalPoint}';
155 var format = '{$config->moneyformat}';
156 var currency = '{$currency}';
157 var currencySymbol = '{$currencySymbol}';
152ff8b9 158 {literal}
6a488035
TO
159 // Todo: This function should be a utility
160 function moneyFormat(amount) {
161 amount = parseFloat(amount).toFixed(2);
162 amount = amount.replace(',', 'comma').replace('.', 'dot');
163 amount = amount.replace('comma', comma).replace('dot', dot);
164 return format.replace('%C', currency).replace('%c', currencySymbol).replace('%a', amount);
165 }});
166</script>
167{/literal}