Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / paycollect.tt
1 [% USE Asset %]
2 [% USE Koha %]
3 [% USE Branches %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Patrons &rsaquo; Collect fine payment for  [% patron.firstname %] [% patron.surname %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="pat_paycollect" class="pat">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'patron-search.inc' %]
13 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Pay fines for [% patron.firstname %] [% patron.surname %]</a> &rsaquo; [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
14
15 <div id="doc3" class="yui-t2">
16
17 <div id="bd">
18 <div id="yui-main">
19 <div class="yui-b">
20 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
21
22
23 <!-- The manual invoice and credit buttons -->
24 <div class="statictabs">
25 <ul>
26     <li>
27     <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Account</a>
28     </li>
29     <li class="active">
30     <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]" >Pay fines</a>
31     </li>
32     <li>
33     <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual invoice</a>
34     </li>
35     <li>
36     <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual credit</a>
37     </li>
38 </ul>
39 <div class="tabs-container">
40 [% IF ( error_over ) %]
41     <div id="error_message" class="dialog alert">
42     You must pay a value less than or equal to [% total_due | format('%.2f') %].
43     </div>
44 [% END %]
45
46 [% IF ( pay_individual ) %]
47     <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
48     <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
49     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
50     <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
51     <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
52     <input type="hidden" name="description" id="description" value="[% description %]" />
53     <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
54     <input type="hidden" name="amount" id="amount" value="[% amount %]" />
55     <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
56     <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
57     <input type="hidden" name="title" id="title" value="[% title %]" />
58
59 <fieldset class="rows">
60     <legend>Pay an individual fine</legend>
61     <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
62     <table>
63     <thead><tr>
64             <th>Description</th>
65             <th>Account type</th>
66             <th>Amount</th>
67             <th>Amount outstanding</th>
68         </tr></thead>
69     <tfoot>
70         <td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td>
71     </tfoot>
72     <tbody><tr>
73             <td>
74                 [% individual_description %]
75             </td>
76             <td>[% accounttype %]</td>
77             <td class="debit">[% amount | format('%.2f') %]</td>
78             <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
79         </tr></tbody>
80 </table>
81
82 <ol>
83
84     <li>
85         <label for="paid">Collect from patron: </label>
86             <!-- default to paying all -->
87         <input name="paid" id="paid" value="[% amountoutstanding %]" />
88     </li>
89 </ol>
90 </fieldset>
91
92     <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
93         <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></div>
94     </form>
95 [% ELSIF ( writeoff_individual ) %]
96     <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
97     <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
98     <fieldset class="rows">
99     <legend>Write off an individual fine</legend>
100     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
101     <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
102     <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
103     <input type="hidden" name="description" id="description" value="[% description %]" />
104     <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
105     <input type="hidden" name="amount" id="amount" value="[% amount %]" />
106     <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
107     <input type="hidden" name="title" id="title" value="[% title %]" />
108     <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
109     <table>
110     <thead><tr>
111             <th>Description</th>
112             <th>Account type</th>
113             <th>Amount</th>
114             <th>Amount outstanding</th>
115         </tr></thead>
116     <tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
117     <tbody><tr>
118             <td>[% description %] [% title %]</td>
119             <td>[% accounttype %]</td>
120             <td class="debit">[% amount | format('%.2f') %]</td>
121             <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
122         </tr></tbody>
123     </table>
124
125             <ol>
126                 <li>
127                     <label for="paid">Writeoff amount: </label>
128                     <!-- default to writing off all -->
129                     <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding %]" />
130                 </li>
131             </ol>
132         </fieldset>
133         <div class="action"><input type="submit" name="confirm_writeoff" id="confirm_writeoff" value="Write off this charge" />
134         <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></div>
135     </form>
136 [% ELSE %]
137
138     <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
139     <input type="hidden" name="csrf_token" value="[% csrf_token %]" />
140     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
141     <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
142     <input type="hidden" name="total" id="total" value="[% total %]" />
143
144     <fieldset class="rows">
145     [% IF ( selected_accts ) %]<legend>Pay an amount toward selected fines</legend>[% ELSE %]<legend>Pay an amount toward all fines</legend>[% END %]
146     <ol>
147         <li>
148             <span class="label">Total amount outstanding: </span>
149             <span class="debit">[% total | format('%.2f') %]</span>
150         </li>
151     <li>
152         <label for="paid">Collect from patron: </label>
153         <!-- default to paying all -->
154         <input name="paid" id="paid" value="[% total | format('%.2f') %]" />
155     </li>
156     <li>
157         <label for="selected_accts_notes">Note: </label>
158         <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
159     </li>
160     </ol>
161     </fieldset>
162     <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
163         <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></div>
164     </form>
165 [% END %]
166 </div></div>
167 </div>
168 </div>
169
170 <div class="yui-b">
171 [% INCLUDE 'circ-menu.inc' %]
172 </div>
173 </div>
174
175 [% MACRO jsinclude BLOCK %]
176     [% Asset.js("js/members-menu.js") %]
177     <script type= "text/javascript">
178         $(document).ready(function() {
179             $('#payindivfine, #woindivfine, #payfine').preventDoubleFormSubmit();
180             $("#paid").on("change",function(){
181                 moneyFormat( this );
182             });
183         });
184
185         function moneyFormat(textObj) {
186             var newValue = textObj.value;
187             var decAmount = "";
188             var dolAmount = "";
189             var decFlag   = false;
190             var aChar     = "";
191
192             for(i=0; i < newValue.length; i++) {
193                 aChar = newValue.substring(i, i+1);
194                 if (aChar >= "0" && aChar <= "9") {
195                     if(decFlag) {
196                         decAmount = "" + decAmount + aChar;
197                     }
198                     else {
199                         dolAmount = "" + dolAmount + aChar;
200                     }
201                 }
202                 if (aChar == ".") {
203                     if (decFlag) {
204                         dolAmount = "";
205                         break;
206                     }
207                     decFlag = true;
208                 }
209             }
210
211             if (dolAmount == "") {
212                 dolAmount = "0";
213             }
214         // Strip leading 0s
215             if (dolAmount.length > 1) {
216                 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
217                     dolAmount = dolAmount.substring(1,dolAmount.length);
218                 }
219             }
220             if (decAmount.length > 2) {
221                 decAmount = decAmount.substring(0,2);
222             }
223         // Pad right side
224             if (decAmount.length == 1) {
225                decAmount = decAmount + "0";
226             }
227             if (decAmount.length == 0) {
228                decAmount = decAmount + "00";
229             }
230
231             textObj.value = dolAmount + "." + decAmount;
232         }
233     </script>
234 [% END %]
235
236 [% INCLUDE 'intranet-bottom.inc' %]