[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1735] trunk
- Subject: SF.net SVN: ledger-smb: [1735] trunk
- From: ..hidden..
- Date: Wed, 10 Oct 2007 10:43:25 -0700
Revision: 1735
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1735&view=rev
Author: einhverfr
Date: 2007-10-10 10:43:24 -0700 (Wed, 10 Oct 2007)
Log Message:
-----------
Merging in David Mora's payment changes. Still working on the template and workflow scripts.
Modified Paths:
--------------
trunk/CONTRIBUTORS
trunk/LedgerSMB/Batch.pm
trunk/LedgerSMB/DBObject/Payment.pm
trunk/LedgerSMB.pm
trunk/UI/create_batch.html
trunk/sql/modules/Payment.sql
Added Paths:
-----------
trunk/LedgerSMB/DBObject/Date.pm
trunk/sql/modules/Date.sql
Modified: trunk/CONTRIBUTORS
===================================================================
--- trunk/CONTRIBUTORS 2007-10-10 16:58:25 UTC (rev 1734)
+++ trunk/CONTRIBUTORS 2007-10-10 17:43:24 UTC (rev 1735)
@@ -73,6 +73,8 @@
Chad Phillips [email omitted] Various bugfixes. Also contributed a template
widget system for 1.3.
+David Mora contributed the new Payment template/system.
+
Original Authors of SQL-Ledger:
===================================
Dieter Simader <dsimader @ sql-ledger.com>
Modified: trunk/LedgerSMB/Batch.pm
===================================================================
--- trunk/LedgerSMB/Batch.pm 2007-10-10 16:58:25 UTC (rev 1734)
+++ trunk/LedgerSMB/Batch.pm 2007-10-10 17:43:24 UTC (rev 1735)
@@ -3,3 +3,4 @@
package LedgerSMB::Batch;
use base qw(LedgerSMB::DBObject);
+1;
Added: trunk/LedgerSMB/DBObject/Date.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Date.pm (rev 0)
+++ trunk/LedgerSMB/DBObject/Date.pm 2007-10-10 17:43:24 UTC (rev 1735)
@@ -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;
+
Modified: trunk/LedgerSMB/DBObject/Payment.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Payment.pm 2007-10-10 16:58:25 UTC (rev 1734)
+++ trunk/LedgerSMB/DBObject/Payment.pm 2007-10-10 17:43:24 UTC (rev 1735)
@@ -183,7 +183,7 @@
}
=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 @@
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 => ..hidden..
+ );
+ 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;
Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm 2007-10-10 16:58:25 UTC (rev 1734)
+++ trunk/LedgerSMB.pm 2007-10-10 17:43:24 UTC (rev 1735)
@@ -205,8 +205,7 @@
$self->{_locale} = LedgerSMB::Locale->get_handle('en') # temporary
or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
- $self->{stylesheet} = 'ledgersmb.css'; # temporary
- #$self->{stylesheet} = $self->{_user}->{stylesheet};
+ $self->{stylesheet} = $self->{_user}->{stylesheet};
return $self;
Modified: trunk/UI/create_batch.html
===================================================================
--- trunk/UI/create_batch.html 2007-10-10 16:58:25 UTC (rev 1734)
+++ trunk/UI/create_batch.html 2007-10-10 17:43:24 UTC (rev 1735)
@@ -17,18 +17,34 @@
<body>
<form name="create_batch" method="post">
<div class="labelledinput">
- <div class="label">
+ <div class="input">
<?lsmb text("Batch Number") ?>
</div>
<div class="value">
- <input name="batchnumber" type="text" value="<?lsmb batchnumber ?>">
+ <input name="batchnumber" type="text" value="<?lsmb batchnumber ?>"/>
</div>
<div class="labelledinput">
<div class="label">
<?lsmb text("Description") ?>
</div>
+ <div class="input">
+ <input name="description" type="text" value="<?lsmb batchnumber ?>"/>
+ </div>
</div>
-<?lsmb FOREACH item = _hidden ?>
+<div class="labelledinput">
+ <div class="label">
+ <?lsmb text("Batch Date") ?>
+ </div>
+ <div class="input">
+ <input type=text class=date name="batch_date"
+ value="<?lsmb batch_date ?>" />
+ </div>
+</div>
+<div id="buttons">
+<button value="create_batch" type="submit" class="submit">
+<?lsmb text('Continue') ?></button>
+</div>
+<?lsmb FOREACH item = hidden ?>
<input type=hidden name="<?lsmb item.name ?>" value="<?lsmb item.value ?>">
<?lsmb END ?>
</form>
Added: trunk/sql/modules/Date.sql
===================================================================
--- trunk/sql/modules/Date.sql (rev 0)
+++ trunk/sql/modules/Date.sql 2007-10-10 17:43:24 UTC (rev 1735)
@@ -0,0 +1,17 @@
+CREATE OR REPLACE FUNCTION date_get_all_years() returns setof INT AS
+$$
+DECLARE
+ date_out record;
+ BEGIN
+ FOR date_out IN
+ SELECT EXTRACT('YEAR' from transdate) AS year
+ FROM acc_trans
+ GROUP BY EXTRACT('YEAR' from transdate)
+ ORDER BY year
+ LOOP
+ return next date_out.year;
+ END LOOP;
+ END;
+$$ language plpgsql;
+COMMENT ON FUNCTION date_get_all_years() IS
+$$ This function return each year inside transdate in transactions. $$;
Modified: trunk/sql/modules/Payment.sql
===================================================================
--- trunk/sql/modules/Payment.sql 2007-10-10 16:58:25 UTC (rev 1734)
+++ trunk/sql/modules/Payment.sql 2007-10-10 17:43:24 UTC (rev 1735)
@@ -215,7 +215,7 @@
COMMENT ON FUNCTION payment_post
(in_trans_id int, in_source text, in_amount numeric, in_ar_ap_accno text,
- in_cash_accno text, in_approved bool, in_payment_date,
+ in_cash_accno text, in_approved bool, in_payment_date date,
in_account_class int)
IS $$
This function takes the following arguments (prefaced with in_ in the db):
@@ -272,6 +272,21 @@
$$ This function returns all department that match the role provided as
the argument.$$;
-
-
-
+CREATE OR REPLACE FUNCTION payments_get_open_currencies(in_account_class int)returns setof char(3) AS
+$$
+DECLARE resultrow record;
+BEGIN
+ FOR resultrow IN
+ SELECT curr FROM ar
+ WHERE amount <> paid
+ AND in_account_class=2
+ UNION
+ SELECT curr FROM ap
+ WHERE amount <> paid
+ AND in_account_class=1
+ ORDER BY curr
+ LOOP
+ return next resultrow.curr;
+ END LOOP;
+END;
+$$ language plpgsql;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.