Lines 69-77
my $total_due = $account->outstanding_debits->total_outstanding;
Link Here
|
69 |
|
69 |
|
70 |
my $total_paid = $input->param('paid'); |
70 |
my $total_paid = $input->param('paid'); |
71 |
|
71 |
|
72 |
my $selected_lines = $input->param('selected'); |
72 |
my $selected_lines = $input->param('selected'); # comes from pay.pl |
73 |
my $pay_individual = $input->param('pay_individual'); |
73 |
my $pay_individual = $input->param('pay_individual'); |
74 |
my $selected_accts = $input->param('selected_accts'); |
74 |
my $selected_accts = $input->param('selected_accts'); # comes from paycollect.pl |
75 |
my $payment_note = uri_unescape scalar $input->param('payment_note'); |
75 |
my $payment_note = uri_unescape scalar $input->param('payment_note'); |
76 |
my $payment_type = scalar $input->param('payment_type'); |
76 |
my $payment_type = scalar $input->param('payment_type'); |
77 |
my $accountlines_id; |
77 |
my $accountlines_id; |
Lines 128-134
if ( $pay_individual || $writeoff_individual ) {
Link Here
|
128 |
payment_note => $payment_note, |
128 |
payment_note => $payment_note, |
129 |
); |
129 |
); |
130 |
} elsif ($selected_lines) { |
130 |
} elsif ($selected_lines) { |
131 |
$total_due = $input->param('amt'); |
|
|
132 |
$template->param( |
131 |
$template->param( |
133 |
selected_accts => $selected_lines, |
132 |
selected_accts => $selected_lines, |
134 |
amt => $total_due, |
133 |
amt => $total_due, |
Lines 181-198
if ( $total_paid and $total_paid ne '0.00' ) {
Link Here
|
181 |
{ order_by => 'date' } |
180 |
{ order_by => 'date' } |
182 |
); |
181 |
); |
183 |
|
182 |
|
184 |
$payment_id = $account->pay( |
183 |
$total_due = 0; # Reset and recalculate total due |
185 |
{ |
184 |
map { $total_due += $_->amountoutstanding } @lines; |
186 |
type => $type, |
185 |
|
187 |
amount => $total_paid, |
186 |
if ( $total_paid > $total_due ) { |
188 |
library_id => $library_id, |
187 |
$template->param( |
189 |
lines => \@lines, |
188 |
error_over => 1, |
190 |
note => $note, |
189 |
total_due => $total_due |
191 |
interface => C4::Context->interface, |
190 |
); |
192 |
payment_type => $payment_type, |
191 |
} else { |
193 |
cash_register => $registerid |
192 |
$payment_id = $account->pay( |
194 |
} |
193 |
{ |
195 |
); |
194 |
type => $type, |
|
|
195 |
amount => $total_paid, |
196 |
library_id => $library_id, |
197 |
lines => \@lines, |
198 |
note => $note, |
199 |
interface => C4::Context->interface, |
200 |
payment_type => $payment_type, |
201 |
cash_register => $registerid |
202 |
} |
203 |
); |
204 |
} |
196 |
} |
205 |
} |
197 |
else { |
206 |
else { |
198 |
my $note = $input->param('selected_accts_notes'); |
207 |
my $note = $input->param('selected_accts_notes'); |
199 |
- |
|
|