<<

NAME

Koha::Accounts - Module for managing payments and fees for patrons

pay

This method allows payments to be made against fees/fines

Koha::Account->new( { patron_id => $borrowernumber } )->pay( { amount => $amount, note => $note, description => $description, library_id => $branchcode, lines => $lines, # Arrayref of Koha::Account::Line objects to pay credit_type => $type, # credit_type_code code item_id => $itemnumber, # pass the itemnumber if this is a credit pertianing to a specific item (i.e LOST_FOUND) } );

add_credit

This method allows adding credits to a patron's account

my $credit_line = Koha::Account->new({ patron_id => $patron_id })->add_credit( { amount => $amount, description => $description, interface => $interface, issue_id => $checkout->id, item_id => $item_id, library_id => $library_id, note => $note, payment_type => $payment_type, type => $credit_type, user_id => $user_id, } );

$credit_type can be any of: - 'CREDIT' - 'PAYMENT' - 'FORGIVEN' - 'LOST_FOUND' - 'OVERPAYMENT' - 'PAYMENT' - 'WRITEOFF' - 'PROCESSING_FOUND'

payin_amount

    my $credit = $account->payin_amount(
        {
            amount          => $amount,
            type            => $credit_type,
            payment_type    => $payment_type,
            cash_register   => $register_id,
            interface       => $interface,
            library_id      => $branchcode,
            user_id         => $staff_id,
            debits          => $debit_lines,
            description     => $description,
            note            => $note
        }
    );

This method allows an amount to be paid into a patrons account and immediately applied against debts.

You can optionally pass a debts parameter which consists of an arrayref of Koha::Account::Line debit lines.

$credit_type can be any of: - 'PAYMENT' - 'WRITEOFF' - 'FORGIVEN'

add_debit

This method allows adding debits to a patron's account

    my $debit_line = Koha::Account->new({ patron_id => $patron_id })->add_debit(
        {
            amount           => $amount,
            description      => $description,
            note             => $note,
            user_id          => $user_id,
            interface        => $interface,
            library_id       => $library_id,
            type             => $debit_type,
            transaction_type => $transaction_type,
            cash_register    => $register_id,
            item_id          => $item_id,
            issue_id         => $issue_id
        }
    );

$debit_type can be any of: - ACCOUNT - ACCOUNT_RENEW - RESERVE_EXPIRED - LOST - sundry - NEW_CARD - OVERDUE - PROCESSING - RENT - RENT_DAILY - RENT_RENEW - RENT_DAILY_RENEW - RESERVE - PAYOUT

payout_amount

    my $debit = $account->payout_amount(
        {
            payout_type => $payout_type,
            register_id => $register_id,
            staff_id    => $staff_id,
            interface   => 'intranet',
            amount      => $amount,
            credits     => $credit_lines
        }
    );

This method allows an amount to be paid out from a patrons account against outstanding credits.

$payout_type can be any of the defined payment_types:

balance

my $balance = $self->balance

Return the balance (sum of amountoutstanding columns)

outstanding_debits

my $lines = Koha::Account->new({ patron_id => $patron_id })->outstanding_debits;

It returns the debit lines with outstanding amounts for the patron.

It returns a Koha::Account::Lines iterator.

outstanding_credits

my $lines = Koha::Account->new({ patron_id => $patron_id })->outstanding_credits;

It returns the credit lines with outstanding amounts for the patron.

It returns a Koha::Account::Lines iterator.

non_issues_charges

my $non_issues_charges = $self->non_issues_charges

Calculates amount immediately owing by the patron - non-issue charges.

Charges can be set as exempt from non-issue by editing the debit type in the Debit Types area of System Preferences.

lines

my $lines = $self->lines;

Return all credits and debits for the user, outstanding or otherwise

credits

  my $credits = $self->credits;

Return all credits for the user

debits

  my $debits = $self->debits;

Return all debits for the user

reconcile_balance

$account->reconcile_balance();

Find outstanding credits and use them to pay outstanding debits. Currently, this implicitly uses the 'First In First Out' rule for applying credits against debits.

AUTHORS

Kyle M Hall <kyle.m.hall@gmail.com> Tomás Cohen Arazi <tomascohen@gmail.com> Martin Renvoize <martin.renvoize@ptfs-europe.com>

<<