Lines 57-71
Link Here
|
57 |
<ol> |
57 |
<ol> |
58 |
<li> |
58 |
<li> |
59 |
<label for="paid">Amount being paid: </label> |
59 |
<label for="paid">Amount being paid: </label> |
60 |
<input name="paid" id="paid" value="[% amountoutstanding | $Price on_editing => 1 %]"/> |
60 |
<input type="number" min="0.00" max="10000.00" step="0.01" name="paid" id="paid" value="[% amountoutstanding | $Price on_editing => 1 %]" readonly/> |
61 |
</li> |
61 |
</li> |
62 |
<li> |
62 |
<li> |
63 |
<label for="collected">Collected from patron: </label> |
63 |
<label for="collected">Collected from patron: </label> |
64 |
<input id="collected" value="[% amountoutstanding | $Price on_editing => 1 %]"/> |
64 |
<input type="number" min="0.00" max="10000.00" step="0.01" name="collected" id="collected" value=""/> |
65 |
</li> |
65 |
</li> |
66 |
<li> |
66 |
<li> |
67 |
<label>Change to give: </label> |
67 |
<label>Change to give: </label> |
68 |
<span id="change">0.00</span> |
68 |
<span id="change">0.00</span> |
|
|
69 |
<input type="hidden" name="change" value="0.00"/> |
69 |
</li> |
70 |
</li> |
70 |
|
71 |
|
71 |
[% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] |
72 |
[% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %] |
Lines 145-153
Link Here
|
145 |
[% INCLUDE 'pos-menu.inc' %] |
146 |
[% INCLUDE 'pos-menu.inc' %] |
146 |
</aside> |
147 |
</aside> |
147 |
</div> |
148 |
</div> |
148 |
|
|
|
149 |
</div> <!-- /.row --> |
149 |
</div> <!-- /.row --> |
150 |
|
150 |
|
|
|
151 |
<!-- Modal --> |
152 |
<div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true"> |
153 |
<div class="modal-dialog"> |
154 |
<div class="modal-content"> |
155 |
<div class="modal-header"> |
156 |
<h3>The amount collected is more than the outstanding charge</h3> |
157 |
</div> |
158 |
<div class="modal-body"> |
159 |
<p>The amount collected from the patron is higher than the amount to be paid.</p> |
160 |
<p>The change to give is <b><span id="modal_change">0.00</span></b>.</p> |
161 |
<p>Confirm this payment?</p> |
162 |
</div> |
163 |
<div class="modal-footer"> |
164 |
<button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button> |
165 |
<button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button> |
166 |
</div> |
167 |
</div> |
168 |
</div> |
169 |
</div> |
170 |
|
171 |
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] |
172 |
<!-- Automatic Print Reciept --> |
173 |
<a id="printReciept" style="display: none" href="#"></a> |
174 |
[% END %] |
175 |
|
151 |
[% MACRO jsinclude BLOCK %] |
176 |
[% MACRO jsinclude BLOCK %] |
152 |
[% Asset.js("js/admin-menu.js") | $raw %] |
177 |
[% Asset.js("js/admin-menu.js") | $raw %] |
153 |
[% INCLUDE 'datatables.inc' %] |
178 |
[% INCLUDE 'datatables.inc' %] |
Lines 170-176
Link Here
|
170 |
var decFlag = false; |
195 |
var decFlag = false; |
171 |
var aChar = ""; |
196 |
var aChar = ""; |
172 |
|
197 |
|
173 |
for(i=0; i < newValue.length; i++) { |
198 |
for(var i=0; i < newValue.length; i++) { |
174 |
aChar = newValue.substring(i, i+1); |
199 |
aChar = newValue.substring(i, i+1); |
175 |
if (aChar >= "0" && aChar <= "9") { |
200 |
if (aChar >= "0" && aChar <= "9") { |
176 |
if(decFlag) { |
201 |
if(decFlag) { |
Lines 222-227
Link Here
|
222 |
moneyFormat(change); |
247 |
moneyFormat(change); |
223 |
change.innerHTML = change.value; |
248 |
change.innerHTML = change.value; |
224 |
} |
249 |
} |
|
|
250 |
|
251 |
$(':input[name="change"]').val(change.value); |
225 |
$('#modal_change').html(change.innerHTML); |
252 |
$('#modal_change').html(change.innerHTML); |
226 |
} |
253 |
} |
227 |
|
254 |
|
Lines 256-262
Link Here
|
256 |
return value; |
283 |
return value; |
257 |
},{ |
284 |
},{ |
258 |
type : 'text' |
285 |
type : 'text' |
259 |
}) |
286 |
}); |
260 |
}, |
287 |
}, |
261 |
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { |
288 |
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { |
262 |
var iTotal = aData[1] * aData[2]; |
289 |
var iTotal = aData[1] * aData[2]; |
Lines 272-277
Link Here
|
272 |
iTotalPrice = Number.parseFloat(iTotalPrice).toFixed(2); |
299 |
iTotalPrice = Number.parseFloat(iTotalPrice).toFixed(2); |
273 |
nFoot.getElementsByTagName('td')[1].innerHTML = iTotalPrice; |
300 |
nFoot.getElementsByTagName('td')[1].innerHTML = iTotalPrice; |
274 |
$('#paid').val(iTotalPrice); |
301 |
$('#paid').val(iTotalPrice); |
|
|
302 |
$('#paid').trigger('change'); |
275 |
} |
303 |
} |
276 |
})); |
304 |
})); |
277 |
|
305 |
|
Lines 283-294
Link Here
|
283 |
"paginationType": "full", |
311 |
"paginationType": "full", |
284 |
})); |
312 |
})); |
285 |
|
313 |
|
286 |
$(".add_button").on("click", function(ev) { |
314 |
$(".add_button").on("click", function(e) { |
287 |
ev.preventDefault(); |
315 |
e.preventDefault(); |
288 |
fnClickAddRow(sale_table, $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); |
316 |
fnClickAddRow(sale_table, $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); |
289 |
items_table.fnFilter( '' ); |
317 |
items_table.fnFilter( '' ); |
290 |
}); |
318 |
}); |
291 |
|
319 |
|
|
|
320 |
// Change calculation and modal |
321 |
var change = $('#change')[0]; |
292 |
$("#paid, #collected").on("change",function() { |
322 |
$("#paid, #collected").on("change",function() { |
293 |
moneyFormat( this ); |
323 |
moneyFormat( this ); |
294 |
if (change != undefined) { |
324 |
if (change != undefined) { |
Lines 296-317
Link Here
|
296 |
} |
326 |
} |
297 |
}); |
327 |
}); |
298 |
|
328 |
|
299 |
$("#payForm").submit(function(e){ |
329 |
var checked = false; |
300 |
var rows = sale_table.fnGetData(); |
330 |
$('#modal_submit').click(function() { |
301 |
rows.forEach(function (row, index) { |
331 |
checked = true; |
302 |
var sale = { |
332 |
$('#payForm').submit(); |
303 |
code: row[0], |
|
|
304 |
price: row[1], |
305 |
quantity: row[2] |
306 |
}; |
307 |
$('<input>').attr({ |
308 |
type: 'hidden', |
309 |
name: 'sales', |
310 |
value: JSON.stringify(sale) |
311 |
}).appendTo('#payForm'); |
312 |
}); |
313 |
return true; |
314 |
}); |
333 |
}); |
|
|
334 |
|
335 |
$('#payForm').submit(function(e){ |
336 |
if (change != undefined && change.innerHTML > 0.00 && !checked) { |
337 |
e.preventDefault(); |
338 |
$("#confirm_change_form").modal("show"); |
339 |
} else { |
340 |
var rows = sale_table.fnGetData(); |
341 |
rows.forEach(function (row, index) { |
342 |
var sale = { |
343 |
code: row[0], |
344 |
price: row[1], |
345 |
quantity: row[2] |
346 |
}; |
347 |
$('<input>').attr({ |
348 |
type: 'hidden', |
349 |
name: 'sales', |
350 |
value: JSON.stringify(sale) |
351 |
}).appendTo('#payForm'); |
352 |
}); |
353 |
return true; |
354 |
} |
355 |
}); |
356 |
|
357 |
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] |
358 |
$("#printReciept").click(function() { |
359 |
var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&collected=[% collected | uri %]&change=[% change | uri %]', '_blank'); |
360 |
win.focus(); |
361 |
}); |
362 |
$("#printReciept").click(); |
363 |
[% END %] |
315 |
}); |
364 |
}); |
316 |
</script> |
365 |
</script> |
317 |
[% END %] |
366 |
[% END %] |