summaryrefslogtreecommitdiff
path: root/LedgerSMB/DBObject/Date.pm
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/Date.pm
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/Date.pm')
-rw-r--r--LedgerSMB/DBObject/Date.pm87
1 files changed, 87 insertions, 0 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;
+