[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[3312] trunk
- Subject: SF.net SVN: ledger-smb:[3312] trunk
- From: ..hidden..
- Date: Wed, 22 Jun 2011 12:05:07 +0000
Revision: 3312
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3312&view=rev
Author: einhverfr
Date: 2011-06-22 12:05:07 +0000 (Wed, 22 Jun 2011)
Log Message:
-----------
Tax form listing confirmed to work, not hooked up to menu yet
Modified Paths:
--------------
trunk/LedgerSMB/DBObject/TaxForm.pm
trunk/UI/taxform/add_taxform.html
trunk/scripts/taxform.pl
trunk/sql/modules/TaxForm.sql
Added Paths:
-----------
trunk/sql/upgrade/3310-taxform-function.sql
Modified: trunk/LedgerSMB/DBObject/TaxForm.pm
===================================================================
--- trunk/LedgerSMB/DBObject/TaxForm.pm 2011-06-21 23:43:31 UTC (rev 3311)
+++ trunk/LedgerSMB/DBObject/TaxForm.pm 2011-06-22 12:05:07 UTC (rev 3312)
@@ -25,6 +25,16 @@
return $results[0];
}
+sub get_full_list
+{
+ my ($self) = @_;
+
+ @{$self->{forms}} = $self->exec_method(
+ funcname => 'tax_form__list_ext',
+ );
+ return @{$self->{forms}};
+}
+
sub get_forms
{
my ($self) = @_;
@@ -48,4 +58,5 @@
}
+
1;
Modified: trunk/UI/taxform/add_taxform.html
===================================================================
--- trunk/UI/taxform/add_taxform.html 2011-06-21 23:43:31 UTC (rev 3311)
+++ trunk/UI/taxform/add_taxform.html 2011-06-22 12:05:07 UTC (rev 3312)
@@ -7,9 +7,18 @@
?>
<?lsmb PROCESS 'elements.html' # Include form elements helper. ?>
<body>
-<div class="listtop"><?lsmb text('Create New TaxForm') ?></div>
+<?lsmb IF id;
+ title = text('Edit Taxform'); #'
+ ELSE;
+ title = text('Create New TaxForm'); #'
+ END ?>
+<div class="listtop"><?lsmb title ?></div>
<form name="add_taxform" method="post">
-
+<?lsmb PROCESS input element_data = {
+ type = "hidden"
+ name = "id"
+ value = id
+}; ?>
<div class="labelledinput">
<br>
<div id = "taxform-countries" class="inputcountry">
Modified: trunk/scripts/taxform.pl
===================================================================
--- trunk/scripts/taxform.pl 2011-06-21 23:43:31 UTC (rev 3311)
+++ trunk/scripts/taxform.pl 2011-06-22 12:05:07 UTC (rev 3312)
@@ -185,7 +185,7 @@
$request->{title} = $locale->text('Tax Form List');
my $taxform = LedgerSMB::DBObject::TaxForm->new({base => $request});
- my @rows = $taxform->get_forms;
+ my @rows = $taxform->get_full_list;
my $template = LedgerSMB::Template->new(
user => $request->{_user},
template => 'form-dynatable',
@@ -194,14 +194,22 @@
format => 'HTML'
);
- my @columns = qw(form_name);
- my $heading = {form_name => $locale->text('Tax Form Name')};
+ my @columns = qw(form_name country_name default_reportable);
+ my $heading = {form_name => $locale->text('Tax Form Name'),
+ country_name => $locale->text('Country'),
+ default_reportable => $locale->text('Default Reportable')};
for my $r (@rows){
$r->{form_name} = { text => $r->{form_name},
- href => "taxform.pl?action=add&id=$r->{id}".
+ href => "taxform.pl?action=add_taxform&id=$r->{id}".
"&country_id=$r->{country_id}".
- "&form_name=$r->{form_name}",
+ "&form_name=$r->{form_name}".
+ "&default_reportable=$r->{default_reportable}",
};
+ if ($r->{default_reportable}){
+ $r->{default_reportable} = $locale->text('Yes');
+ } else {
+ $r->{default_reportable} = $locale->text('No');
+ }
}
$template->render({
form => $request,
Modified: trunk/sql/modules/TaxForm.sql
===================================================================
--- trunk/sql/modules/TaxForm.sql 2011-06-21 23:43:31 UTC (rev 3311)
+++ trunk/sql/modules/TaxForm.sql 2011-06-22 12:05:07 UTC (rev 3312)
@@ -1,9 +1,21 @@
-CREATE OR REPLACE FUNCTION tax_form__save(in_country_id int, in_form_name text, in_default_reportable bool)
+CREATE OR REPLACE FUNCTION tax_form__save(in_id int, in_country_id int,
+ in_form_name text, in_default_reportable bool)
RETURNS int AS
$$
BEGIN
+ UPDATE country_tax_form
+ SET country_id = in_country_id,
+ form_name =in_form_name,
+ default_reportable = coalesce(in_default_reportable,false)
+ WHERE id = in_id;
+
+ IF FOUND THEN
+ RETURN in_id;
+ END IF;
+
insert into country_tax_form(country_id,form_name, default_reportable)
- values (in_country_id, in_form_name, in_default_reportable);
+ values (in_country_id, in_form_name,
+ coalesce(in_default_reportable, false));
RETURN currval('country_tax_form_id_seq');
END;
@@ -21,3 +33,19 @@
SELECT * FROM country_tax_form ORDER BY country_id;
$BODY$ LANGUAGE SQL;
+CREATE TYPE taxform_list AS (
+ id int,
+ form_name text,
+ country_id int,
+ country_name text,
+ default_reportable bool
+);
+
+CREATE OR REPLACE function tax_form__list_ext()
+RETURNS SETOF taxform_list AS
+$BODY$
+SELECT t.id, t.form_name, t.country_id, c.name, t.default_reportable
+ FROM country_tax_form t
+ JOIN country c ON c.id = t.country_id
+ ORDER BY c.name, t.form_name;
+$BODY$ language sql;
Added: trunk/sql/upgrade/3310-taxform-function.sql
===================================================================
--- trunk/sql/upgrade/3310-taxform-function.sql (rev 0)
+++ trunk/sql/upgrade/3310-taxform-function.sql 2011-06-22 12:05:07 UTC (rev 3312)
@@ -0,0 +1,3 @@
+DROP FUNCTION tax_form__save(in_country_id int,
+ in_form_name text, in_default_reportable bool);
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.