Merge pull request #1020 from lcdservices/CRM-12814
[civicrm-core.git] / templates / CRM / Price / Page / LineItem.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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 <th class="right">{ts}Total Price{/ts}</th>
45 {/if}
46
47 {if $pricesetFieldsCount}
48 <th class="right">{ts}Total Participants{/ts}</th>{/if}
49 </tr>
50 {foreach from=$value item=line}
51 <tr>
52 <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>
53 {if $context NEQ "Membership"}
54 <td class="right">{$line.qty}</td>
55 <td class="right">{$line.unit_price|crmMoney}</td>
56 {/if}
57 <td class="right">{$line.line_total|crmMoney}</td>
58 {if $pricesetFieldsCount}<td class="right">{$line.participant_count}</td> {/if}
59 </tr>
60 {/foreach}
61 </table>
62 {/if}
63 {/foreach}
64
65 <div class="crm-section no-label total_amount-section">
66 <div class="content bold">
67 {if $context EQ "Contribution"}
68 {ts}Contribution Total{/ts}:
69 {elseif $context EQ "Event"}
70 {ts}Event Total{/ts}:
71 {elseif $context EQ "Membership"}
72 {ts}Membership Fee Total{/ts}:
73 {else}
74 {ts}Total Amount{/ts}:
75 {/if}
76 {$totalAmount|crmMoney}
77 </div>
78 <div class="clear"></div>
79 <div class="content bold">
80 {if $pricesetFieldsCount}
81 {ts}Total Participants{/ts}:
82 {foreach from=$lineItem item=pcount}
83 {if $pcount neq 'skip'}
84 {assign var="lineItemCount" value=0}
85
86 {foreach from=$pcount item=p_count}
87 {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
88 {/foreach}
89 {if $lineItemCount < 1 }
90 {assign var="lineItemCount" value=1}
91 {/if}
92 {assign var="totalcount" value=$totalcount+$lineItemCount}
93 {/if}
94 {/foreach}
95 {$totalcount}
96 {/if}
97 </div>
98 <div class="clear"></div>
99 </div>
100
101 {if $hookDiscount.message}
102 <div class="crm-section hookDiscount-section">
103 <em>({$hookDiscount.message})</em>
104 </div>
105 {/if}
106 {literal}
107 <script type="text/javascript">
108 cj(document).ready(function($) {
109 {/literal}
110 var comma = '{$config->monetaryThousandSeparator}';
111 var dot = '{$config->monetaryDecimalPoint}';
112 var format = '{$config->moneyformat}';
113 var currency = '{$currency}';
114 var currencySymbol = '{$currencySymbol}';
115 {literal}
116 // Todo: This function should be a utility
117 function moneyFormat(amount) {
118 amount = parseFloat(amount).toFixed(2);
119 amount = amount.replace(',', 'comma').replace('.', 'dot');
120 amount = amount.replace('comma', comma).replace('dot', dot);
121 return format.replace('%C', currency).replace('%c', currencySymbol).replace('%a', amount);
122 }});
123 </script>
124 {/literal}