|
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 181-198
if ( $total_paid and $total_paid ne '0.00' ) {
Link Here
|
| 181 |
{ order_by => 'date' } |
181 |
{ order_by => 'date' } |
| 182 |
); |
182 |
); |
| 183 |
|
183 |
|
| 184 |
$payment_id = $account->pay( |
184 |
$total_due = 0; # Reset and recalculate total due |
| 185 |
{ |
185 |
map { $total_due += $_->amountoutstanding } @lines; |
| 186 |
type => $type, |
186 |
|
| 187 |
amount => $total_paid, |
187 |
if ( $total_paid > $total_due ) { |
| 188 |
library_id => $library_id, |
188 |
$template->param( |
| 189 |
lines => \@lines, |
189 |
error_over => 1, |
| 190 |
note => $note, |
190 |
total_due => $total_due |
| 191 |
interface => C4::Context->interface, |
191 |
); |
| 192 |
payment_type => $payment_type, |
192 |
} else { |
| 193 |
cash_register => $registerid |
193 |
$payment_id = $account->pay( |
| 194 |
} |
194 |
{ |
| 195 |
); |
195 |
type => $type, |
|
|
196 |
amount => $total_paid, |
| 197 |
library_id => $library_id, |
| 198 |
lines => \@lines, |
| 199 |
note => $note, |
| 200 |
interface => C4::Context->interface, |
| 201 |
payment_type => $payment_type, |
| 202 |
cash_register => $registerid |
| 203 |
} |
| 204 |
); |
| 205 |
} |
| 196 |
} |
206 |
} |
| 197 |
else { |
207 |
else { |
| 198 |
my $note = $input->param('selected_accts_notes'); |
208 |
my $note = $input->param('selected_accts_notes'); |
| 199 |
- |
|
|