|
Lines 38-47
BEGIN {
Link Here
|
| 38 |
&manualinvoice |
38 |
&manualinvoice |
| 39 |
&getnextacctno |
39 |
&getnextacctno |
| 40 |
&reconcileaccount |
40 |
&reconcileaccount |
| 41 |
&getcharges |
41 |
&GetCharges |
| 42 |
&ModNote |
42 |
&ModNote |
| 43 |
&getcredits |
43 |
&GetCredits |
| 44 |
&getrefunds |
44 |
&GetRefunds |
| 45 |
&chargelostitem |
45 |
&chargelostitem |
| 46 |
&ReversePayment |
46 |
&ReversePayment |
| 47 |
&makepartialpayment |
47 |
&makepartialpayment |
|
Lines 585-605
sub refund {
Link Here
|
| 585 |
return ($amountleft); |
585 |
return ($amountleft); |
| 586 |
} |
586 |
} |
| 587 |
|
587 |
|
| 588 |
sub getcharges { |
588 |
sub GetCharges { |
| 589 |
my ( $borrowerno, $timestamp, $accountno ) = @_; |
589 |
my ( $borrowerno, $timestamp, $accountno ) = @_; |
| 590 |
my $dbh = C4::Context->dbh; |
590 |
|
| 591 |
my $timestamp2 = $timestamp - 1; |
591 |
my $dbh = C4::Context->dbh; |
| 592 |
my $query = ""; |
592 |
|
| 593 |
my $sth = $dbh->prepare( |
593 |
my $timestamp2 = $timestamp - 1; |
| 594 |
"SELECT * FROM accountlines WHERE borrowernumber=? AND accountno = ?" |
594 |
|
| 595 |
); |
595 |
my $sth = $dbh->prepare(" |
| 596 |
$sth->execute( $borrowerno, $accountno ); |
596 |
SELECT * |
| 597 |
|
597 |
FROM accountlines |
| 598 |
my @results; |
598 |
WHERE borrowernumber = ? |
| 599 |
while ( my $data = $sth->fetchrow_hashref ) { |
599 |
AND accountno = ? |
| 600 |
push @results,$data; |
600 |
"); |
| 601 |
} |
601 |
$sth->execute( $borrowerno, $accountno ); |
| 602 |
return (@results); |
602 |
|
|
|
603 |
my $results = $sth->fetchall_arrayref({}); |
| 604 |
|
| 605 |
return @$results; |
| 603 |
} |
606 |
} |
| 604 |
|
607 |
|
| 605 |
sub ModNote { |
608 |
sub ModNote { |
|
Lines 609-653
sub ModNote {
Link Here
|
| 609 |
$sth->execute( $note, $accountlines_id ); |
612 |
$sth->execute( $note, $accountlines_id ); |
| 610 |
} |
613 |
} |
| 611 |
|
614 |
|
| 612 |
sub getcredits { |
615 |
sub GetCredits { |
| 613 |
my ( $date, $date2 ) = @_; |
616 |
my ( $date, $date2 ) = @_; |
| 614 |
my $dbh = C4::Context->dbh; |
617 |
my $dbh = C4::Context->dbh; |
| 615 |
my $sth = $dbh->prepare( |
618 |
my $sth = $dbh->prepare(" |
| 616 |
"SELECT * FROM accountlines,borrowers |
619 |
SELECT * |
| 617 |
WHERE amount < 0 AND accounttype <> 'Pay' AND accountlines.borrowernumber = borrowers.borrowernumber |
620 |
FROM accountlines, |
| 618 |
AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)" |
621 |
borrowers |
| 619 |
); |
622 |
WHERE amount < 0 |
| 620 |
|
623 |
AND accounttype <> 'Pay' |
| 621 |
$sth->execute( $date, $date2 ); |
624 |
AND accountlines.borrowernumber = borrowers.borrowernumber |
| 622 |
my @results; |
625 |
AND TIMESTAMP >= TIMESTAMP(?) |
|
|
626 |
AND TIMESTAMP < TIMESTAMP(?) |
| 627 |
"); |
| 628 |
|
| 629 |
$sth->execute( $date, $date2 ); |
| 630 |
my @results; |
| 623 |
while ( my $data = $sth->fetchrow_hashref ) { |
631 |
while ( my $data = $sth->fetchrow_hashref ) { |
| 624 |
$data->{'date'} = $data->{'timestamp'}; |
632 |
$data->{'date'} = $data->{'timestamp'}; |
| 625 |
push @results,$data; |
633 |
push @results,$data; |
| 626 |
} |
634 |
} |
| 627 |
return (@results); |
635 |
|
|
|
636 |
return @results; |
| 628 |
} |
637 |
} |
| 629 |
|
638 |
|
| 630 |
|
639 |
|
| 631 |
sub getrefunds { |
640 |
sub GetRefunds { |
| 632 |
my ( $date, $date2 ) = @_; |
641 |
my ( $date, $date2 ) = @_; |
| 633 |
my $dbh = C4::Context->dbh; |
642 |
|
| 634 |
|
643 |
my $dbh = C4::Context->dbh; |
| 635 |
my $sth = $dbh->prepare( |
644 |
my $sth = $dbh->prepare(" |
| 636 |
"SELECT *,timestamp AS datetime |
645 |
SELECT *, |
| 637 |
FROM accountlines,borrowers |
646 |
TIMESTAMP AS datetime |
| 638 |
WHERE (accounttype = 'REF' |
647 |
FROM accountlines, |
| 639 |
AND accountlines.borrowernumber = borrowers.borrowernumber |
648 |
borrowers |
| 640 |
AND date >=? AND date <?)" |
649 |
WHERE accounttype = 'REF' |
| 641 |
); |
650 |
AND accountlines.borrowernumber = borrowers.borrowernumber |
|
|
651 |
AND date >= ? |
| 652 |
AND date < ? |
| 653 |
"); |
| 642 |
|
654 |
|
| 643 |
$sth->execute( $date, $date2 ); |
655 |
$sth->execute( $date, $date2 ); |
| 644 |
|
656 |
|
| 645 |
my @results; |
657 |
my $results = $sth->fetchall_arrayref({}); |
| 646 |
while ( my $data = $sth->fetchrow_hashref ) { |
658 |
|
| 647 |
push @results,$data; |
659 |
return @$results; |
| 648 |
|
|
|
| 649 |
} |
| 650 |
return (@results); |
| 651 |
} |
660 |
} |
| 652 |
|
661 |
|
| 653 |
sub ReversePayment { |
662 |
sub ReversePayment { |