Merge pull request #4193 from colemanw/CRM-15342
[civicrm-core.git] / templates / CRM / Price / Form / LineItem.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
819d0d41 3 | CiviCRM version 4.5 |
6a488035 4 +--------------------------------------------------------------------+
819d0d41 5 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
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}<br />{/if}
32 <strong>{ts}Participant {$priceset+1}{/ts}</strong> {$part.$priceset.info}
152ff8b9 33 {/if}
6a488035
TO
34 <table>
35 <tr class="columnheader">
152ff8b9 36 <th>{ts}Item{/ts}</th>
37 {if $context EQ "Membership"}
38 <th class="right">{ts}Fee{/ts}</th>
6a488035 39 {else}
152ff8b9 40 <th class="right">{ts}Qty{/ts}</th>
6a488035 41 <th class="right">{ts}Unit Price{/ts}</th>
152ff8b9 42 <th class="right">{ts}Total Price{/ts}</th>
43
44 {if $context EQ "Contribution" && $action eq 2}
45 <th class="right">{ts}Paid{/ts}</th>
46 <th class="right">{ts}Owing{/ts}</th>
47 <th class="right">{ts}Amount of<br>Current Payment {/ts}</th>
48 {/if}
49 {/if}
50
51 {if $pricesetFieldsCount}
52 <th class="right">{ts}Total Participants{/ts}</th>{/if}
6a488035
TO
53 </tr>
54 {foreach from=$value item=line}
55 <tr>
56 <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>
152ff8b9 57 {if $context NEQ "Membership"}
58 <td class="right">{$line.qty}</td>
6a488035 59 <td class="right">{$line.unit_price|crmMoney}</td>
152ff8b9 60 {/if}
6a488035 61 <td class="right">{$line.line_total|crmMoney}</td>
152ff8b9 62 {if $pricesetFieldsCount}<td class="right">{$line.participant_count}</td> {/if}
63 {if $context EQ "Contribution" && $action eq 2}
64 <td class="right">{$pricefildTotal.LineItems[$line.price_field_value_id]|crmMoney}</td>
65 <td class="right">
66 {assign var="fildTotal" value=$line.line_total-$pricefildTotal[$pricefildTotal.id][$line.price_field_value_id]}
67 {$fildTotal|crmMoney}
68 </td>
69 <td class="left">$<input type='text' id= 'txt-price[{$line.price_field_value_id}]' name = 'txt-price[{$line.price_field_value_id}]' size='4' class= 'distribute'>&nbsp<input type='checkbox' id= 'cb-price[{$line.price_field_value_id}]' name = 'cb-price[{$line.price_field_value_id}]' price = '{$fildTotal}' class = 'payFull' /></td>
70 {/if}
6a488035
TO
71 </tr>
72 {/foreach}
152ff8b9 73 {if $context EQ "Contribution" && $action eq 2}
6a488035 74 <tr><td>
152ff8b9 75
6a488035
TO
76 {ts}Contribution Total{/ts}:
77 </td>
152ff8b9 78 <td></td>
79 <td></td>
80 <td class="right">{$totalAmount|crmMoney}</td>
81 <td class="right">{$pricefildTotal.total|crmMoney}</td>
82 <td class="right">{assign var="total" value= $totalAmount-$pricefildTotal.total}{$total|crmMoney}</td>
83 <td class="left"><h5 class='editPayment'></h5>
6a488035
TO
84{literal}
85<script type="text/javascript">
ae8f569f 86CRM.$(function($) {
32678ccb 87 $(document).on('blur', '.distribute', function() {
6a488035 88 var totalAmount = 0;
32678ccb
CW
89 $('.distribute').each(function (){
90 if($(this).val( ).length > 0){
91 totalAmount = parseFloat( totalAmount ) + parseFloat( $(this).val( ) );
152ff8b9 92 }
93 });
6a488035 94
32678ccb 95 $('.editPayment').text('$ '+totalAmount);
6a488035 96 var unlocateAmount = '{/literal}{$total}{literal}';
32678ccb 97 $('.unlocateAmount').text('$ '+(unlocateAmount - totalAmount));
6a488035
TO
98 });
99});
100</script>
101{/literal}
102
152ff8b9 103 </td>
104 </tr>
105 <tr>
106 <td colspan= 6 class="right"><strong>Unallocated Amount</strong></td>
107 <td><h5 class='unlocateAmount'>{$total|crmMoney} </h5></td>
108 </tr>
6a488035
TO
109 {/if}
110 </table>
111 {/if}
112{/foreach}
113
114<div class="crm-section no-label total_amount-section">
115 <div class="content bold">
116 {if $context EQ "Contribution"}
117 {ts}Contribution Total{/ts}:
118 {elseif $context EQ "Event"}
152ff8b9 119 {ts}Event Total{/ts}:
120 {elseif $context EQ "Membership"}
121 {ts}Membership Fee Total{/ts}:
6a488035 122 {else}
152ff8b9 123 {ts}Total Amount{/ts}:
6a488035
TO
124 {/if}
125 {$totalAmount|crmMoney}
126 </div>
127 <div class="content bold">
128 {if $pricesetFieldsCount}
129 {ts}Total Participants{/ts}:
130 {foreach from=$lineItem item=pcount}
131 {if $pcount neq 'skip'}
132 {assign var="lineItemCount" value=0}
152ff8b9 133
6a488035
TO
134 {foreach from=$pcount item=p_count}
135 {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
136 {/foreach}
137 {if $lineItemCount < 1 }
152ff8b9 138 {assign var="lineItemCount" value=1}
6a488035
TO
139 {/if}
140 {assign var="totalcount" value=$totalcount+$lineItemCount}
152ff8b9 141 {/if}
6a488035
TO
142 {/foreach}
143 {$totalcount}
144 {/if}
152ff8b9 145 </div>
6a488035
TO
146</div>
147
148{if $hookDiscount.message}
149 <div class="crm-section hookDiscount-section">
150 <em>({$hookDiscount.message})</em>
151 </div>
152{/if}