|
Lines 68-78
patron.
Link Here
|
| 68 |
|
68 |
|
| 69 |
=head2 recordpayment |
69 |
=head2 recordpayment |
| 70 |
|
70 |
|
| 71 |
&recordpayment($borrowernumber, $payment); |
71 |
&recordpayment($borrowernumber, $payment, $sip_paytype); |
| 72 |
|
72 |
|
| 73 |
Record payment by a patron. C<$borrowernumber> is the patron's |
73 |
Record payment by a patron. C<$borrowernumber> is the patron's |
| 74 |
borrower number. C<$payment> is a floating-point number, giving the |
74 |
borrower number. C<$payment> is a floating-point number, giving the |
| 75 |
amount that was paid. |
75 |
amount that was paid. C<$sip_paytype> is an optional flag to indicate this |
|
|
76 |
payment was made over a SIP2 interface, rather than the staff client. The |
| 77 |
value passed is the SIP2 payment type value (message 37, characters 21-22) |
| 76 |
|
78 |
|
| 77 |
Amounts owed are paid off oldest first. That is, if the patron has a |
79 |
Amounts owed are paid off oldest first. That is, if the patron has a |
| 78 |
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment |
80 |
$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment |
|
Lines 85-91
will be credited to the next one.
Link Here
|
| 85 |
sub recordpayment { |
87 |
sub recordpayment { |
| 86 |
|
88 |
|
| 87 |
#here we update the account lines |
89 |
#here we update the account lines |
| 88 |
my ( $borrowernumber, $data ) = @_; |
90 |
my ( $borrowernumber, $data, $sip_paytype ) = @_; |
| 89 |
my $dbh = C4::Context->dbh; |
91 |
my $dbh = C4::Context->dbh; |
| 90 |
my $newamtos = 0; |
92 |
my $newamtos = 0; |
| 91 |
my $accdata = ""; |
93 |
my $accdata = ""; |
|
Lines 135-144
sub recordpayment {
Link Here
|
| 135 |
# create new line |
137 |
# create new line |
| 136 |
my $usth = $dbh->prepare( |
138 |
my $usth = $dbh->prepare( |
| 137 |
"INSERT INTO accountlines |
139 |
"INSERT INTO accountlines |
| 138 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) |
140 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding, manager_id) |
| 139 |
VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)" |
141 |
VALUES (?,?,now(),?,?,?,?,?)" |
| 140 |
); |
142 |
); |
| 141 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id ); |
143 |
my $payment_description = "Payment, thanks"; |
|
|
144 |
$payment_description .= " (via SIP2)" if defined $sip_paytype; |
| 145 |
my $paytype = "Pay"; |
| 146 |
$paytype .= "-$sip_paytype" if defined $sip_paytype; |
| 147 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $payment_description, $paytype, 0 - $amountleft, $manager_id ); |
| 142 |
$usth->finish; |
148 |
$usth->finish; |
| 143 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
149 |
UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno ); |
| 144 |
$sth->finish; |
150 |
$sth->finish; |
|
Lines 614-620
sub getcredits {
Link Here
|
| 614 |
my $dbh = C4::Context->dbh; |
620 |
my $dbh = C4::Context->dbh; |
| 615 |
my $sth = $dbh->prepare( |
621 |
my $sth = $dbh->prepare( |
| 616 |
"SELECT * FROM accountlines,borrowers |
622 |
"SELECT * FROM accountlines,borrowers |
| 617 |
WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber |
623 |
WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber |
| 618 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
624 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
| 619 |
); |
625 |
); |
| 620 |
|
626 |
|