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