@@ -, +, @@ form. --- .../prog/en/modules/members/paycollect.tt | 88 +++++++++++++++++----- members/paycollect.pl | 34 +++++++-- 2 files changed, 97 insertions(+), 25 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -5,13 +5,6 @@ [% INCLUDE 'doc-head-close.inc' %] - @@ -93,14 +90,32 @@ function moneyFormat(textObj) {
-[% IF ( error_over ) %] +[% IF (error_negative) %]
- You must pay a value less than or equal to [% total_due | format('%.2f') %]. + The amount paid can't be negative!
[% END %] +[% IF (error_collected_less) %] +
+ The amount collected can't be lower than the amount paid! +
+[% END %] + +[% UNLESS (writeoff_individual) %] +
+[% END %] + +[% IF (give_change) %] +
+ The amount collected is greater than the total amount paid.
+ Change to give back: [% give_change %]

+ + Cancel +
+[% END %] + [% IF ( pay_individual ) %] - @@ -142,12 +157,32 @@ function moneyFormat(textObj) {
    - + [% IF ( give_change ) %]
  1. - - - + + + + [% amount_paid %]
  2. +
  3. + + [% amount_collected %] +
  4. +
  5. + + [% give_change %] +
  6. + [% ELSE %] +
  7. + + + [% amount_paid %] +
  8. +
  9. + + +
  10. + [% END %]
@@ -196,7 +231,6 @@ function moneyFormat(textObj) {
[% ELSE %] -
@@ -208,11 +242,31 @@ function moneyFormat(textObj) { Total amount outstanding: [% total | format('%.2f') %] + [% IF ( give_change ) %] +
  • + + + +
  • +
  • + + [% amount_collected %] +
  • +
  • + + [% give_change %] +
  • + [% ELSE %] +
  • + + +
  • - + - +
  • + [% END %]
  • --- a/members/paycollect.pl +++ a/members/paycollect.pl @@ -55,11 +55,11 @@ my $branch = C4::Context->userenv->{'branch'}; my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber); my $total_paid = $input->param('paid'); +my $total_collected = $input->param('collected'); my $individual = $input->param('pay_individual'); my $writeoff = $input->param('writeoff_individual'); -my $select_lines = $input->param('selected'); -my $select = $input->param('selected_accts'); +my $select = ($input->param('selected') || $input->param('selected_accts')); my $payment_note = uri_unescape $input->param('payment_note'); my $accountno; my $accountlines_id; @@ -94,20 +94,38 @@ if ( $individual || $writeoff ) { notify_level => $notify_level, payment_note => $payment_note, ); -} elsif ($select_lines) { - $total_due = $input->param('amt'); +} elsif ($select) { + $total_due = ($input->param('amt') || $input->param('total')); $template->param( - selected_accts => $select_lines, + selected_accts => $select, amt => $total_due, selected_accts_notes => scalar $input->param('notes'), ); } if ( $total_paid and $total_paid ne '0.00' ) { - if ( $total_paid < 0 or $total_paid > $total_due ) { + if ( $total_paid < 0 ) { $template->param( - error_over => 1, - total_due => $total_due + error_negative => 1, + ); + } + elsif (($total_collected - $total_paid) < 0) { + $template->param( + error_collected_less => 1, + ); + } + elsif ($total_paid > $total_due) { + $template->param( + amount_paid => sprintf('%.2f', $total_due), + amount_collected => sprintf('%.2f', $total_collected), + give_change => sprintf('%.2f',($total_collected-$total_due)) + ); + } + elsif ($total_paid < $total_due and $total_collected ne $total_paid) { + $template->param( + amount_paid => sprintf('%.2f', $total_paid), + amount_collected => sprintf('%.2f', $total_collected), + give_change => sprintf('%.2f',($total_collected-$total_paid)) ); } else { if ($individual) { --