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