Bug 3498 [ENH] Allow Partial Payment of Fines
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / paycollect.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Patrons &rsaquo; Collect Fine Payment for  [% borrower.firstname %] [% borrower.surname %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type= "text/javascript">
5 //<![CDATA[
6 function moneyFormat(textObj) {
7     var newValue = textObj.value;
8     var decAmount = "";
9     var dolAmount = "";
10     var decFlag   = false;
11     var aChar     = "";
12
13     for(i=0; i < newValue.length; i++) {
14         aChar = newValue.substring(i, i+1);
15         if (aChar >= "0" && aChar <= "9") {
16             if(decFlag) {
17                 decAmount = "" + decAmount + aChar;
18             }
19             else {
20                 dolAmount = "" + dolAmount + aChar;
21             }
22         }
23         if (aChar == ".") {
24             if (decFlag) {
25                 dolAmount = "";
26                 break;
27             }
28             decFlag = true;
29         }
30     }
31
32     if (dolAmount == "") {
33         dolAmount = "0";
34     }
35 // Strip leading 0s
36     if (dolAmount.length > 1) {
37         while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
38             dolAmount = dolAmount.substring(1,dolAmount.length);
39         }
40     }
41     if (decAmount.length > 2) {
42         decAmount = decAmount.substring(0,2);
43     }
44 // Pad right side
45     if (decAmount.length == 1) {
46        decAmount = decAmount + "0";
47     }
48     if (decAmount.length == 0) {
49        decAmount = decAmount + "00";
50     }
51
52     textObj.value = dolAmount + "." + decAmount;
53 }
54 //]]>
55 </script>
56 </head>
57 <body>
58 [% INCLUDE 'header.inc' %]
59 [% INCLUDE 'patron-search.inc' %]
60 <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; Pay Fines for [% borrower.firstname %] [% borrower.surname %]</div>
61
62 <div id="doc3" class="yui-t2">
63
64 <div id="bd">
65 <div id="yui-main">
66 <div class="yui-b">
67 [% INCLUDE 'members-toolbar.inc' %]
68
69
70 <!-- The manual invoice and credit buttons -->
71 <div class="toptabs">
72 <ul class="ui-tabs-nav">
73     <li>
74     <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a>
75     </li>
76     <li class="ui-tabs-selected">
77     <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a>
78     </li>
79     <li>
80     <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Invoice</a>
81     </li>
82     <li>
83     <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Credit</a>
84     </li>
85 </ul>
86 <div class="tabs-container">
87 [% IF ( error ) %]
88     <div id="error_message" class="dialog alert">
89     [% error %]
90     </div>
91 [% END %]
92
93 [% IF ( pay_individual ) %]
94     <form name="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
95     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
96     <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
97     <input type="hidden" name="description" id="description" value="[% description %]" />
98     <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
99     <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
100     <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
101     <input type="hidden" name="amount" id="amount" value="[% amount %]" />
102     <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
103     <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
104     <input type="hidden" name="title" id="title" value="[% title %]" />
105     <table>
106     <tr>
107         <th>Description</th>
108         <th>Account Type</th>
109         <th>Notify id</th>
110         <th>Level</th>
111         <th>Amount</th>
112         <th>Amount Outstanding</th>
113     </tr>
114     <tr>
115         <td>
116             [% description %] [% title  %]
117         </td>
118         <td>[% accounttype %]</td>
119         <td>[% notify_id %]</td>
120         <td>[% notify_level %]</td>
121         <td class="debit">[% amount | format('%.2f') %]</td>
122         <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
123     </tr>
124     <tr>
125         <td>Total Amount Payable : </td>
126         <td>[% amountoutstanding | format('%.2f') %]</td>
127         <td colspan="4"></td>
128     </tr>
129     <tr><td colspan="6"> </td></tr>
130     <tr>
131         <td>Collect From Patron: </td>
132         <td>
133             <!-- default to paying all -->
134         <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/>
135         </td>
136     </tr>
137     <tr><td colspan="6"></td></tr>
138     <tr>
139         <td colspan="6">
140         <input type="submit" name="submitbutton" value="Confirm" />
141         <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
142         </td>
143     </tr>
144
145     </table>
146     </form>
147 [% ELSIF ( writeoff_individual ) %]
148     <form name="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
149     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
150     <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
151     <input type="hidden" name="description" id="description" value="[% description %]" />
152     <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
153     <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
154     <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
155     <input type="hidden" name="amount" id="amount" value="[% amount %]" />
156     <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
157     <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
158     <input type="hidden" name="title" id="title" value="[% title %]" />
159     <table>
160     <tr>
161         <th>Description</th>
162         <th>Account Type</th>
163         <th>Notify id</th>
164         <th>Level</th>
165         <th>Amount</th>
166         <th>Amount Outstanding</th>
167     </tr>
168     <tr>
169         <td>[% description %] [% title %]</td>
170         <td>[% accounttype %]</td>
171         <td>[% notify_id %]</td>
172         <td>[% notify_level %]</td>
173         <td class="debit">[% amount | format('%.2f') %]</td>
174         <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
175     </tr>
176     <tr><td colspan="6"> </td></tr>
177     <tr><td colspan="6"><strong>Writeoff This Charge?</strong></td></tr>
178     <tr><td> </td></tr>
179     <tr>
180         <td colspan="6">
181         <input type="submit" name="confirm_writeoff" id="confirm_writeoff" value="Confirm" />
182         <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
183         </td>
184     </tr>
185
186     </table>
187     </form>
188 [% ELSE %]
189
190     <form name="payfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
191     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
192     <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
193     <input type="hidden" name="total" id="total" value="[% total %]" />
194
195     <table>
196     <tr>
197         <td>Total Amount Outstanding : </td>
198         <td class="debit">[% total | format('%.2f') %]</td>
199     </tr>
200     <tr><td colspan="2"> </td></tr>
201     <tr>
202         <td>Collect From Patron: </td>
203         <td>
204         <!-- default to paying all -->
205         <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payfine.paid)"/>
206         </td>
207     </tr>
208     <tr><td></td></tr>
209     <tr>
210         <td colspan="2">
211         <input type="submit" name="submitbutton" value="Confirm" />
212         <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
213         </td>
214     </tr>
215     </table>
216     </form>
217 [% END %]
218 </div></div>
219 </div>
220 </div>
221
222 <div class="yui-b">
223 [% INCLUDE 'circ-menu.tt' %]
224 </div>
225 </div>
226 [% INCLUDE 'intranet-bottom.inc' %]
227