Merge pull request #12758 from samuelsov/DraftMailing
[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 {if !$currency && $fee_currency}
29 {assign var=currency value="$fee_currency"}
30 {/if}
31
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>
41 <tr class="columnheader">
42 <th>{ts}Item{/ts}</th>
43 {if $displayLineItemFinancialType}
44 <th>{ts}Financial Type{/ts}</th>
45 {/if}
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>
51 {if !$getTaxDetails}
52 <th class="right">{ts}Total Price{/ts}</th>
53 {/if}
54 {/if}
55
56 {if $getTaxDetails}
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}
62
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}>
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>
70 {if $displayLineItemFinancialType}
71 <td>{$line.financial_type}</td>
72 {/if}
73 {if $context NEQ "Membership"}
74 <td class="right">{$line.qty}</td>
75 <td class="right">{$line.unit_price|crmMoney:$currency}</td>
76 {else}
77 <td class="right">{$line.line_total|crmMoney:$currency}</td>
78 {/if}
79 {if !$getTaxDetails && $context NEQ "Membership"}
80 <td class="right">{$line.line_total|crmMoney:$currency}</td>
81 {/if}
82 {if $getTaxDetails}
83 <td class="right">{$line.line_total|crmMoney:$currency}</td>
84 {if $line.tax_rate != "" || $line.tax_amount != ""}
85 <td class="right">{$taxTerm} ({$line.tax_rate}%)</td>
86 <td class="right">{$line.tax_amount|crmMoney:$currency}</td>
87 {else}
88 <td></td>
89 <td></td>
90 {/if}
91 <td class="right">{$line.line_total+$line.tax_amount|crmMoney:$currency}</td>
92 {/if}
93 {if $pricesetFieldsCount}
94 <td class="right">{$line.participant_count}</td>
95 {/if}
96 </tr>
97 {/foreach}
98 </table>
99 {/if}
100 {/foreach}
101
102 <div class="crm-section no-label total_amount-section">
103 <div class="content bold">
104 {if $getTaxDetails && $totalTaxAmount}
105 {ts 1=$taxTerm}Total %1 Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}<br />
106 {/if}
107 {if $context EQ "Contribution"}
108 {ts}Contribution Total{/ts}:
109 {elseif $context EQ "Event"}
110 {if $totalTaxAmount}
111 {ts}Event SubTotal: {$totalAmount-$totalTaxAmount|crmMoney:$currency}{/ts}<br />
112 {/if}
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}
119 {$totalAmount|crmMoney:$currency}
120 </div>
121 <div class="clear"></div>
122 <div class="content bold">
123 {if $pricesetFieldsCount}
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}
139 {/if}
140 </div>
141 <div class="clear"></div>
142 </div>
143
144 {if $hookDiscount.message}
145 <div class="crm-section hookDiscount-section">
146 <em>({$hookDiscount.message})</em>
147 </div>
148 {/if}
149 {literal}
150 <script type="text/javascript">
151 CRM.$(function($) {
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}';
158 {literal}
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}