[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3311] trunk



Revision: 3311
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3311&view=rev
Author:   einhverfr
Date:     2011-06-21 23:43:31 +0000 (Tue, 21 Jun 2011)

Log Message:
-----------
First draft of taxform list functionality

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/TaxForm.pm
    trunk/UI/taxform/add_taxform.html
    trunk/scripts/taxform.pl
    trunk/sql/modules/1099_reports.sql
    trunk/sql/modules/TaxForm.sql

Modified: trunk/LedgerSMB/DBObject/TaxForm.pm
===================================================================
--- trunk/LedgerSMB/DBObject/TaxForm.pm	2011-06-21 23:19:01 UTC (rev 3310)
+++ trunk/LedgerSMB/DBObject/TaxForm.pm	2011-06-21 23:43:31 UTC (rev 3311)
@@ -32,6 +32,7 @@
     @{$self->{forms}} = $self->exec_method(
                 funcname => 'tax_form__list_all',
     );
+    return @{$self->{forms}};
 }
 
 sub get_metadata
@@ -46,4 +47,5 @@
     $self->{default_country} = $ref->{setting_get};
 }
 
+
 1;

Modified: trunk/UI/taxform/add_taxform.html
===================================================================
--- trunk/UI/taxform/add_taxform.html	2011-06-21 23:19:01 UTC (rev 3310)
+++ trunk/UI/taxform/add_taxform.html	2011-06-21 23:43:31 UTC (rev 3311)
@@ -15,9 +15,10 @@
 <div id = "taxform-countries" class="inputcountry">
 
 <?lsmb IF countries ?>
+<?lsmb IF !country_id; country_id = default_country; END ?>
  <?lsmb PROCESS select element_data = {
 		name = "country_id"
-		default_values = [default_country]
+		default_values = [country_id]
 		options = countries
 		value_attr = "id"
 		text_attr = "name"

Modified: trunk/scripts/taxform.pl
===================================================================
--- trunk/scripts/taxform.pl	2011-06-21 23:19:01 UTC (rev 3310)
+++ trunk/scripts/taxform.pl	2011-06-21 23:43:31 UTC (rev 3311)
@@ -177,6 +177,40 @@
     generate_report($request);    
 }
 
+
+sub list_all {
+    my ($request) = @_;
+
+    my $locale = $request->{_locale};
+    $request->{title} = $locale->text('Tax Form List');
+
+    my $taxform = LedgerSMB::DBObject::TaxForm->new({base => $request});
+    my @rows = $taxform->get_forms;
+    my $template = LedgerSMB::Template->new(
+        user => $request->{_user},
+        template => 'form-dynatable',
+        locale => $request->{_locale},
+        path => 'UI',
+        format => 'HTML'
+    );
+    
+    my @columns = qw(form_name);
+    my $heading = {form_name => $locale->text('Tax Form Name')};
+    for my $r (@rows){
+        $r->{form_name} = { text => $r->{form_name},
+                            href => "taxform.pl?action=add&id=$r->{id}".
+                                    "&country_id=$r->{country_id}".
+                                    "&form_name=$r->{form_name}",
+                          };
+    }
+    $template->render({
+        form => $request,
+     columns => ..hidden..,
+     heading => $heading,
+        rows => ..hidden..,
+    });
+}
+
 =head1 Copyright (C) 2007 The LedgerSMB Core Team
 
 Licensed under the GNU General Public License version 2 or later (at your 

Modified: trunk/sql/modules/1099_reports.sql
===================================================================
--- trunk/sql/modules/1099_reports.sql	2011-06-21 23:19:01 UTC (rev 3310)
+++ trunk/sql/modules/1099_reports.sql	2011-06-21 23:43:31 UTC (rev 3311)
@@ -20,12 +20,6 @@
     invnumber text, 
     duedate text);
 
-CREATE OR REPLACE FUNCTION tax_form__list_all()
-RETURNS SETOF country_tax_form AS
-$BODY$
-SELECT * FROM country_tax_form ORDER BY country_id;
-$BODY$ LANGUAGE SQL;
-
 CREATE OR REPLACE FUNCTION tax_form_summary_report(in_tax_form_id int, in_begin date, in_end date) 
 RETURNS SETOF tax_form_report_item AS $BODY$
 DECLARE

Modified: trunk/sql/modules/TaxForm.sql
===================================================================
--- trunk/sql/modules/TaxForm.sql	2011-06-21 23:19:01 UTC (rev 3310)
+++ trunk/sql/modules/TaxForm.sql	2011-06-21 23:43:31 UTC (rev 3311)
@@ -14,3 +14,10 @@
 as $$
 SELECT * FROM country_tax_form where id = $1;
 $$ language sql;
+
+CREATE OR REPLACE FUNCTION tax_form__list_all()
+RETURNS SETOF country_tax_form AS
+$BODY$
+SELECT * FROM country_tax_form ORDER BY country_id;
+$BODY$ LANGUAGE SQL;
+


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.