Lines 31-57
use Data::Dumper qw(Dumper);
Link Here
|
31 |
use vars qw($VERSION @ISA @EXPORT); |
31 |
use vars qw($VERSION @ISA @EXPORT); |
32 |
|
32 |
|
33 |
BEGIN { |
33 |
BEGIN { |
34 |
# set the version for version checking |
34 |
|
|
|
35 |
# set the version for version checking |
35 |
$VERSION = 3.07.00.049; |
36 |
$VERSION = 3.07.00.049; |
36 |
require Exporter; |
37 |
require Exporter; |
37 |
@ISA = qw(Exporter); |
38 |
@ISA = qw(Exporter); |
38 |
@EXPORT = qw( |
39 |
@EXPORT = qw( |
39 |
&recordpayment |
40 |
&recordpayment |
40 |
&makepayment |
41 |
&makepayment |
41 |
&manualinvoice |
42 |
&manualinvoice |
42 |
&getnextacctno |
43 |
&getnextacctno |
43 |
&reconcileaccount |
44 |
&reconcileaccount |
44 |
&getcharges |
45 |
&GetCharges |
45 |
&ModNote |
46 |
&ModNote |
46 |
&getcredits |
47 |
&GetCredits |
47 |
&getrefunds |
48 |
&GetRefunds |
48 |
&chargelostitem |
49 |
&chargelostitem |
49 |
&ReversePayment |
50 |
&ReversePayment |
50 |
&makepartialpayment |
51 |
&makepartialpayment |
51 |
&recordpayment_selectaccts |
52 |
&recordpayment_selectaccts |
52 |
&WriteOffFee |
53 |
&WriteOffFee |
53 |
&GetTotalFines |
54 |
&GetTotalFines |
54 |
); |
55 |
); |
55 |
} |
56 |
} |
56 |
|
57 |
|
57 |
=head1 NAME |
58 |
=head1 NAME |
Lines 666-686
sub refund {
Link Here
|
666 |
return ($amountleft); |
667 |
return ($amountleft); |
667 |
} |
668 |
} |
668 |
|
669 |
|
669 |
sub getcharges { |
670 |
sub GetCharges { |
670 |
my ( $borrowerno, $timestamp, $accountno ) = @_; |
671 |
my ( $borrowerno, $timestamp, $accountno ) = @_; |
671 |
my $dbh = C4::Context->dbh; |
672 |
|
672 |
my $timestamp2 = $timestamp - 1; |
673 |
my $dbh = C4::Context->dbh; |
673 |
my $query = ""; |
674 |
|
674 |
my $sth = $dbh->prepare( |
675 |
my $timestamp2 = $timestamp - 1; |
675 |
"SELECT * FROM accountlines WHERE borrowernumber=? AND accountno = ?" |
676 |
|
676 |
); |
677 |
my $sth = $dbh->prepare(" |
677 |
$sth->execute( $borrowerno, $accountno ); |
678 |
SELECT * |
678 |
|
679 |
FROM accountlines |
679 |
my @results; |
680 |
WHERE borrowernumber = ? |
680 |
while ( my $data = $sth->fetchrow_hashref ) { |
681 |
AND accountno = ? |
681 |
push @results,$data; |
682 |
"); |
682 |
} |
683 |
$sth->execute( $borrowerno, $accountno ); |
683 |
return (@results); |
684 |
|
|
|
685 |
my $results = $sth->fetchall_arrayref({}); |
686 |
|
687 |
return @$results; |
684 |
} |
688 |
} |
685 |
|
689 |
|
686 |
sub ModNote { |
690 |
sub ModNote { |
Lines 690-734
sub ModNote {
Link Here
|
690 |
$sth->execute( $note, $accountlines_id ); |
694 |
$sth->execute( $note, $accountlines_id ); |
691 |
} |
695 |
} |
692 |
|
696 |
|
693 |
sub getcredits { |
697 |
sub GetCredits { |
694 |
my ( $date, $date2 ) = @_; |
698 |
my ( $date, $date2 ) = @_; |
695 |
my $dbh = C4::Context->dbh; |
699 |
my $dbh = C4::Context->dbh; |
696 |
my $sth = $dbh->prepare( |
700 |
my $sth = $dbh->prepare(" |
697 |
"SELECT * FROM accountlines,borrowers |
701 |
SELECT * |
698 |
WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber |
702 |
FROM accountlines, |
699 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
703 |
borrowers |
700 |
); |
704 |
WHERE amount < 0 |
701 |
|
705 |
AND accounttype <> 'Pay' |
702 |
$sth->execute( $date, $date2 ); |
706 |
AND accountlines.borrowernumber = borrowers.borrowernumber |
703 |
my @results; |
707 |
AND TIMESTAMP >= TIMESTAMP(?) |
704 |
while ( my $data = $sth->fetchrow_hashref ) { |
708 |
AND TIMESTAMP < TIMESTAMP(?) |
705 |
$data->{'date'} = $data->{'timestamp'}; |
709 |
"); |
706 |
push @results,$data; |
710 |
|
707 |
} |
711 |
$sth->execute( $date, $date2 ); |
708 |
return (@results); |
712 |
|
|
|
713 |
my $results = $sth->fetchall_arrayref({}); |
714 |
|
715 |
return @$results; |
709 |
} |
716 |
} |
710 |
|
717 |
|
711 |
|
718 |
|
712 |
sub getrefunds { |
719 |
sub GetRefunds { |
713 |
my ( $date, $date2 ) = @_; |
720 |
my ( $date, $date2 ) = @_; |
714 |
my $dbh = C4::Context->dbh; |
721 |
|
715 |
|
722 |
my $dbh = C4::Context->dbh; |
716 |
my $sth = $dbh->prepare( |
723 |
my $sth = $dbh->prepare(" |
717 |
"SELECT *,timestamp AS datetime |
724 |
SELECT *, |
718 |
FROM accountlines,borrowers |
725 |
TIMESTAMP AS datetime |
719 |
WHERE (accounttype = 'REF' |
726 |
FROM accountlines, |
720 |
AND accountlines.borrowernumber = borrowers.borrowernumber |
727 |
borrowers |
721 |
AND date >=? AND date <?)" |
728 |
WHERE accounttype = 'REF' |
722 |
); |
729 |
AND accountlines.borrowernumber = borrowers.borrowernumber |
|
|
730 |
AND date >= ? |
731 |
AND date < ? |
732 |
"); |
723 |
|
733 |
|
724 |
$sth->execute( $date, $date2 ); |
734 |
$sth->execute( $date, $date2 ); |
725 |
|
735 |
|
726 |
my @results; |
736 |
my $results = $sth->fetchall_arrayref({}); |
727 |
while ( my $data = $sth->fetchrow_hashref ) { |
737 |
|
728 |
push @results,$data; |
738 |
return @$results; |
729 |
|
|
|
730 |
} |
731 |
return (@results); |
732 |
} |
739 |
} |
733 |
|
740 |
|
734 |
sub ReversePayment { |
741 |
sub ReversePayment { |