summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-10 17:43:24 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-10-10 17:43:24 +0000
commit8066acc76d4098199b1bb60830dd881bd65f3900 (patch)
tree2263c4e4e47ad2aaa08ff8574f2a0397b7830ccd /LedgerSMB/DBObject
parentc7bed5b4b549b71f14acab6f1f55086f0fac899b (diff)
Merging in David Mora's payment changes. Still working on the template and workflow scripts.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1735 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/DBObject')
-rw-r--r--LedgerSMB/DBObject/Date.pm87
-rw-r--r--LedgerSMB/DBObject/Payment.pm36
2 files changed, 122 insertions, 1 deletions
diff --git a/LedgerSMB/DBObject/Date.pm b/LedgerSMB/DBObject/Date.pm
new file mode 100644
index 00000000..50d0bcd8
--- /dev/null
+++ b/LedgerSMB/DBObject/Date.pm
@@ -0,0 +1,87 @@
+
+=head1 NAME
+
+LedgerSMB::Date Date Handling Back-end Routines for LedgerSMB
+
+=head1 SYNOPSIS
+
+Provides the functions for generating the data structures for dates used in
+LedgerSMB.
+
+=cut
+
+package LedgerSMB::DBObject::Date;
+use base qw(LedgerSMB::DBObject);
+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 $self->build_filter_by_period()
+
+This function takes $locale as an argument to build the list boxes, of the
+period filter.
+
+It sets $self->{yearsOptions}, $self->{$monthsOptions}, $self->{radioOptions}
+so you just pass the hash to the template system. :)
+
+=back
+
+=cut
+
+
+sub build_filter_by_period {
+ my ($self, $locale) = @_;
+ my @all_years = $self->call_procedure(procname => 'date_get_all_years');
+ for my $ref (0 .. $#all_years) {
+ push @{$self->{yearsOptions}} , { value => $all_years[$ref]{year},
+ text => $all_years[$ref]{year}}
+ }
+ @{$self->{monthsOptions}} = (
+ { value => '01', text => $locale->text('January')},
+ { value => '02', text => $locale->text('February')},
+ { value => '03', text => $locale->text('March')},
+ { value => '04', text => $locale->text('April')},
+ { value => '05', text => $locale->text('May')},
+ { value => '06', text => $locale->text('June')},
+ { value => '07', text => $locale->text('July')},
+ { value => '08', text => $locale->text('August')},
+ { value => '09', text => $locale->text('September')},
+ { value => '10', text => $locale->text('October')},
+ { value => '11', text => $locale->text('November')},
+ { value => '12', text => $locale->text('December')}
+ );
+
+
+ @{$self->{radioOptions}} = (
+ {
+ label => $locale->text('Current'),
+ name => 'radioPeriod',
+ value => '1',
+ },
+ {
+ label => $locale->text('Month'),
+ name => 'radioPeriod',
+ value => '2',
+ active => '1',
+ },
+ {
+ label => $locale->text('Quarter'),
+ name => 'radioPeriod',
+ value => '3',
+ },
+ {
+ label => $locale->text('Year'),
+ name => 'radioPeriod',
+ value => '4',
+ });
+}
+1;
+
diff --git a/LedgerSMB/DBObject/Payment.pm b/LedgerSMB/DBObject/Payment.pm
index 8ee92792..f13a3d42 100644
--- a/LedgerSMB/DBObject/Payment.pm
+++ b/LedgerSMB/DBObject/Payment.pm
@@ -183,7 +183,7 @@ sub list_open_projects {
}
=over
-=item list_open_projects
+=item list_departments
This method gets the type of document as a parameter, and provides a list of departments
of the required type.
@@ -202,4 +202,38 @@ sub list_departments {
return @{$self->{departments}};
}
+=item list_open_vc
+
+This method gets the type of vc (vendor or customer) as a parameter, and provides a list of departments
+of the required type.
+The list is attached to $self->{departments} and returned.
+
+=back
+=cut
+
+sub list_departments {
+ my ($self) = shift @_;
+ my @args = @_;
+ @{$self->{departments}} = $self->call_procedure(
+ procname => 'department_list',
+ args => \@args
+ );
+ return @{$self->{departments}};
+}
+
+=item get_open_currencies
+
+This method gets a list of the open currencies inside the database, it requires that
+$self->{account_class} (must be 1 or 2) exist to work.
+
+=back
+=cut
+
+sub get_open_currencies {
+ my ($self) = shift @_;
+ @{$self->{openCurrencies}} = $self->exec_method( funcname => 'payments_get_open_currencies');
+ return @{$self->{openCurrencies}};
+}
+
+
1;