summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-15 01:56:39 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-15 01:56:39 +0000
commit0825af53ea040e53372aa3ea475a658eb6d3eb22 (patch)
treec6c39b862dff89dd9c621a36496471f46b16a419 /LedgerSMB/DBObject
parentd2af7a60f383a1f59d1439cdd30dc28579a6dcac (diff)
Form.pm now uses strit mode except in the constructor
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1606 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/DBObject')
-rw-r--r--LedgerSMB/DBObject/Payment.pm108
1 files changed, 106 insertions, 2 deletions
diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm
index 8d299311..0cd63c38 100644
--- a/LedgerSMB/DBObject/Payment.pm
+++ b/LedgerSMB/DBObject/Payment.pm
@@ -1,6 +1,20 @@
-=head1: LedgerSMB::DBObject::Payment: Stub function for payments.
-=head1: Copyright (c) 2007. LedgerSMB Core Team
+=head1 NAME
+
+LedgerSMB::Payment: Payment Handling Back-end Routines for LedgerSMB
+
+=head1 SYNOPSIS
+
+Provides the functions for generating the data structures payments made in
+LedgerSMB. This module currently handles only basic payment logic, and does
+handle overpayment logic, though these features will be moved into this module
+in the near future.
+
+=head1 COPYRIGHT
+
+Copyright (c) 2007 The LedgerSMB Core Team. Licensed under the GNU General
+Public License version 2 or at your option any later version. Please see the
+included COPYRIGHT and LICENSE files for more information.
=cut
@@ -10,6 +24,31 @@ use strict;
use Math::BigFloat lib => 'GMP';
our $VERSION = '0.1.0';
+=head1 METHODS
+
+=over
+
+=item LedgerSMB::DBObject::Payment->new()
+
+Inherited from LedgerSMB::DBObject. Please see that documnetation for details.
+
+=item $oayment->get_open_accounts()
+
+This function returns a list of open accounts depending on the
+$payment->{account_class} property. If this property is 1, it returns a list
+of vendor accounts, for 2, a list of customer accounts are returned.
+
+The returned list of hashrefs is stored in the $payment->{accounts} property.
+Each hashref has the following keys: id (entity id), name, and entity_class.
+
+An account is considered open if there are outstanding, unpaid invoices
+attached to it. Customer/vendor payment threshold is not considered for this
+calculation.
+
+=back
+
+=cut
+
sub get_open_accounts {
my ($self) = @_;
@{$self->{accounts}} =
@@ -17,6 +56,21 @@ sub get_open_accounts {
return @{$self->{accounts}};
}
+=over
+
+=item $oayment->get_all_accounts()
+
+This function returns a list of open or closed accounts depending on the
+$payment->{account_class} property. If this property is 1, it returns a list
+of vendor accounts, for 2, a list of customer accounts are returned.
+
+The returned list of hashrefs is stored in the $payment->{accounts} property.
+Each hashref has the following keys: id (entity id), name, and entity_class.
+
+=back
+
+=cut
+
sub get_all_accounts {
my ($self) = @_;
@{$self->{accounts}} =
@@ -24,6 +78,23 @@ sub get_all_accounts {
return @{$self->{accounts}};
}
+=over
+
+=item $oayment->get_open_invoices()
+
+This function returns a list of open invoices depending on the
+$payment->{account_class}, $payment->{entity_id}, and $payment->{currency}
+properties. Account classes follow the conventions above. This list is hence
+specific to a customer or vendor and currency as well.
+
+The returned list of hashrefs is stored in the $payment->{open_invoices}
+property. Each hashref has the following keys: id (entity id), name, and
+entity_class.
+
+=back
+
+=cut
+
sub get_open_invoices {
my ($self) = @_;
@{$self->{open_invoices}} =
@@ -31,6 +102,39 @@ sub get_open_invoices {
return @{$self->{open_invoices}};
}
+=over
+
+=item $oayment->get_all_contact_invoices()
+
+This function returns a list of open accounts depending on the
+$payment->{account_class} property. If this property is 1, it returns a list
+of vendor accounts, for 2, a list of customer accounts are returned. Attached
+to each account is a list of open invoices. The data structure is somewhat
+complex.
+
+Each item in the list has the following keys: contact_id, contact_name, \
+account_number, total_due, and invoices.
+
+The invoices entry is a reference to an array of hashrefs. Each of these
+hashrefs has the following keys: invoice_id, invnumber, invoice_date, amount,
+discount, and due.
+
+These are filtered based on the (required) properties:
+$payment->{account_class}, $payment->{business_type}, $payment->{date_from},
+$payment->{date_to}, and $payment->{ar_ap_accno}.
+
+The $payment->{ar_ap_accno} property is used to filter out by AR or AP account.
+
+The following can also be optionally passed: $payment->{batch_id}. If this is
+patched, vouchers in the current batch will be picked up as well.
+
+The returned list of hashrefs is stored in the $payment->{contact} property.
+Each hashref has the following keys: id (entity id), name, and entity_class.
+
+=back
+
+=cut
+
sub get_all_contact_invoices {
my ($self) = @_;
@{$self->{contacts}} =