Merge pull request #12592 from civicrm/5.4
[civicrm-core.git] / templates / CRM / Price / Page / LineItem.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2018 |
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. *}
28 {foreach from=$lineItem item=value key=priceset}
29 {if $value neq 'skip'}
30 {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
31 {if $priceset GT 0}
32 <br />
33 {/if}
34 <strong>{ts}Participant {$priceset+1}{/ts}</strong> {$part.$priceset.info}
35 {/if}
36 <table>
37 <tr class="columnheader">
38 <th>{ts}Item{/ts}</th>
39 {if $displayLineItemFinancialType}
40 <th>{ts}Financial Type{/ts}</th>
41 {/if}
42 {if $context EQ "Membership"}
43 <th class="right">{ts}Fee{/ts}</th>
44 {else}
45 <th class="right">{ts}Qty{/ts}</th>
46 <th class="right">{ts}Unit Price{/ts}</th>
47 {if !$getTaxDetails}
48 <th class="right">{ts}Total Price{/ts}</th>
49 {/if}
50 {/if}
51
52 {if $getTaxDetails}
53 <th class="right">{ts}Subtotal{/ts}</th>
54 <th class="right">{ts}Tax Rate{/ts}</th>
55 <th class="right">{ts}Tax Amount{/ts}</th>
56 <th class="right">{ts}Total Amount{/ts}</th>
57 {/if}
58
59 {if $pricesetFieldsCount}
60 <th class="right">{ts}Total Participants{/ts}</th>
61 {/if}
62 </tr>
63 {foreach from=$value item=line}
64 <tr{if $line.qty EQ 0} class="cancelled"{/if}>
65 <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>
66 {if $displayLineItemFinancialType}
67 <td>{$line.financial_type}</td>
68 {/if}
69 {if $context NEQ "Membership"}
70 <td class="right">{$line.qty}</td>
71 <td class="right">{$line.unit_price|crmMoney}</td>
72 {else}
73 <td class="right">{$line.line_total|crmMoney}</td>
74 {/if}
75 {if !$getTaxDetails && $context NEQ "Membership"}
76 <td class="right">{$line.line_total|crmMoney}</td>
77 {/if}
78 {if $getTaxDetails}
79 <td class="right">{$line.line_total|crmMoney}</td>
80 {if $line.tax_rate != "" || $line.tax_amount != ""}
81 <td class="right">{$taxTerm} ({$line.tax_rate}%)</td>
82 <td class="right">{$line.tax_amount|crmMoney}</td>
83 {else}
84 <td></td>
85 <td></td>
86 {/if}
87 <td class="right">{$line.line_total+$line.tax_amount|crmMoney}</td>
88 {/if}
89 {if $pricesetFieldsCount}
90 <td class="right">{$line.participant_count}</td>
91 {/if}
92 </tr>
93 {/foreach}
94 </table>
95 {/if}
96 {/foreach}
97
98 <div class="crm-section no-label total_amount-section">
99 <div class="content bold">
100 {if $getTaxDetails && $totalTaxAmount}
101 {ts 1=$taxTerm}Total %1 Amount{/ts}: {$totalTaxAmount|crmMoney}<br />
102 {/if}
103 {if $context EQ "Contribution"}
104 {ts}Contribution Total{/ts}:
105 {elseif $context EQ "Event"}
106 {if $totalTaxAmount}
107 {ts}Event SubTotal: {$totalAmount-$totalTaxAmount|crmMoney}{/ts}<br />
108 {/if}
109 {ts}Event Total{/ts}:
110 {elseif $context EQ "Membership"}
111 {ts}Membership Fee Total{/ts}:
112 {else}
113 {ts}Total Amount{/ts}:
114 {/if}
115 {$totalAmount|crmMoney}
116 </div>
117 <div class="clear"></div>
118 <div class="content bold">
119 {if $pricesetFieldsCount}
120 {ts}Total Participants{/ts}:
121 {foreach from=$lineItem item=pcount}
122 {if $pcount neq 'skip'}
123 {assign var="lineItemCount" value=0}
124
125 {foreach from=$pcount item=p_count}
126 {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
127 {/foreach}
128 {if $lineItemCount < 1 }
129 {assign var="lineItemCount" value=1}
130 {/if}
131 {assign var="totalcount" value=$totalcount+$lineItemCount}
132 {/if}
133 {/foreach}
134 {$totalcount}
135 {/if}
136 </div>
137 <div class="clear"></div>
138 </div>
139
140 {if $hookDiscount.message}
141 <div class="crm-section hookDiscount-section">
142 <em>({$hookDiscount.message})</em>
143 </div>
144 {/if}
145 {literal}
146 <script type="text/javascript">
147 CRM.$(function($) {
148 {/literal}
149 var comma = '{$config->monetaryThousandSeparator}';
150 var dot = '{$config->monetaryDecimalPoint}';
151 var format = '{$config->moneyformat}';
152 var currency = '{$currency}';
153 var currencySymbol = '{$currencySymbol}';
154 {literal}
155 // Todo: This function should be a utility
156 function moneyFormat(amount) {
157 amount = parseFloat(amount).toFixed(2);
158 amount = amount.replace(',', 'comma').replace('.', 'dot');
159 amount = amount.replace('comma', comma).replace('dot', dot);
160 return format.replace('%C', currency).replace('%c', currencySymbol).replace('%a', amount);
161 }});
162 </script>
163 {/literal}