[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6024] trunk
- Subject: SF.net SVN: ledger-smb:[6024] trunk
- From: ..hidden..
- Date: Sat, 14 Sep 2013 10:37:39 +0000
Revision: 6024
http://sourceforge.net/p/ledger-smb/code/6024
Author: einhverfr
Date: 2013-09-14 10:37:37 +0000 (Sat, 14 Sep 2013)
Log Message:
-----------
Moving gifi listing to new reporting framework
Modified Paths:
--------------
trunk/LedgerSMB/AM.pm
trunk/LedgerSMB/Scripts/reports.pm
trunk/bin/am.pl
trunk/sql/Pg-database.sql
trunk/sql/modules/Account.sql
trunk/sql/modules/menu_rebuild.sql
Added Paths:
-----------
trunk/LedgerSMB/Report/Listings/GIFI.pm
Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm 2013-09-14 10:15:04 UTC (rev 6023)
+++ trunk/LedgerSMB/AM.pm 2013-09-14 10:37:37 UTC (rev 6024)
@@ -59,40 +59,6 @@
my $logger = Log::Log4perl->get_logger('AM');
-=item AM->gifi_accounts($myconfig, $form);
-
-Populates the list referred to as $form->{ALL} with hashes of gifi numbers and
-descriptions in order of the GIFI number. The GIFI number referred to as
-'accno'.
-
-$myconfig is not used.
-
-=cut
-
-sub gifi_accounts {
-
- my ( $self, $myconfig, $form ) = @_;
-
- # connect to database
- my $dbh = $form->{dbh};
-
- my $query = qq|
- SELECT accno, description
- FROM gifi
- ORDER BY accno|;
-
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- while ( my $ref = $sth->fetchrow_hashref(NAME_lc) ) {
- push @{ $form->{ALL} }, $ref;
- }
-
- $sth->finish;
- $dbh->commit;
-
-}
-
=item AM->get_gifi($myconfig, $form);
Sets $form->{description} to the description of the GIFI number $form->{accno}.
Added: trunk/LedgerSMB/Report/Listings/GIFI.pm
===================================================================
--- trunk/LedgerSMB/Report/Listings/GIFI.pm (rev 0)
+++ trunk/LedgerSMB/Report/Listings/GIFI.pm 2013-09-14 10:37:37 UTC (rev 6024)
@@ -0,0 +1,97 @@
+=head1 NAME
+
+LedgerSMB::Report::Listings::GIFI - List GIFI for accounts in LedgerSMB
+
+=head1 SYNPOSIS
+
+ my $report = LedgerSMB::Report::Listings::GIFI->new()
+ $report->render;
+
+No $request is needed since there are no criteria.
+
+=cut
+
+package LedgerSMB::Report::Listings::GIFI;
+use Moose;
+extends 'LedgerSMB::Report';
+
+=head1 DESCRIPTION
+
+GIFI is the Generalized Index of Financial Information that the Canadian tax
+authorities use in tax reporting. LedgerSMB allows you to map accounts to GIFI
+codes for tax reporting. Non-Canadian users can use this to group accounts
+together for other reporting uses.
+
+=head1 REPORT CONSTANTS
+
+=head2 columns
+
+=over
+
+=item accno
+
+=item description
+
+=back
+
+=cut
+
+sub columns {
+ return [
+ { col_id => 'accno',
+ type => 'href',
+ href_base => 'am.pl?action=edit_gifi&coa=1&accno=',
+ name => LedgerSMB::Report::text('GIFI'), },
+
+ { col_id => 'description',
+ type => 'text',
+ name => LedgerSMB::Report::text('Description'), },
+
+ ];
+}
+
+=head2 header_lines
+
+None
+
+=cut
+
+sub header_lines { return []; }
+
+=head2 name
+
+GIFI
+
+=cut
+
+sub name { return LedgerSMB::Report::text('GIFI'); }
+
+=head1 REPORT CRITERIA
+
+None
+
+=head1 METHODS
+
+=head2 run_report
+
+=cut
+
+sub run_report {
+ my ($self) = @_;
+ my @rows = $self->exec_method(funcname => 'gifi__list');
+ for my $row (@rows){
+ $row->{row_id} = $row->{accno};
+ }
+ $self->rows(..hidden..);
+}
+
+=head1 COPYRIGHT
+
+Copyright (C) 2013 The LedgerSMB Core Team
+
+This file may be used in accordance with the GNU General Public License version
+2 or at your option any later version. Please see the included LICENSE.TXT.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
Modified: trunk/LedgerSMB/Scripts/reports.pm
===================================================================
--- trunk/LedgerSMB/Scripts/reports.pm 2013-09-14 10:15:04 UTC (rev 6023)
+++ trunk/LedgerSMB/Scripts/reports.pm 2013-09-14 10:37:37 UTC (rev 6024)
@@ -19,6 +19,7 @@
use LedgerSMB::Business_Unit_Class;
use LedgerSMB::Report::Balance_Sheet;
use LedgerSMB::Report::Listings::Business_Type;
+use LedgerSMB::Report::Listings::GIFI;
use strict;
=pod
@@ -109,6 +110,16 @@
$report->render($request);
}
+=item list_gifi
+
+List the gifi entries. No inputs expected or used.
+
+=cut
+
+sub list_gifi {
+ LedgerSMB::Report::Listings::GIFI->new()->render();
+}
+
=item balance_sheet
Generates a balance sheet
Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl 2013-09-14 10:15:04 UTC (rev 6023)
+++ trunk/bin/am.pl 2013-09-14 10:37:37 UTC (rev 6024)
@@ -178,80 +178,6 @@
}
-sub list_gifi {
-
- @{ $form->{fields} } = qw(accno description);
- $form->{table} = "gifi";
-
- AM->gifi_accounts( \%myconfig, \%$form );
-
- $form->{title} = $locale->text('GIFI');
- my %hiddens;
-
- # construct callback
- my $callback =
-"$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
- $form->{callback} = $callback;
- $hiddens{callback} = $callback;
- $hiddens{action} = 'list_gifi';
- $hiddens{path} = $form->{path};
- $hiddens{login} = $form->{login};
- $hiddens{sessionid} = $form->{sessionid};
-
- my @column_index = qw(accno description);
- my @rows;
-
- my $column_names = {
- accno => 'GIFI',
- description => 'Description'
- };
-
- my $i = 0;
- foreach $ca ( @{ $form->{ALL} } ) {
-
- my %column_data;
- $i++;
- $i %= 2;
- $column_data{i} = $i;
-
- $accno = $form->escape( $ca->{accno} );
- $column_data{accno} = {text => $ca->{accno}, href =>
- qq|$form->{script}?action=edit_gifi&coa=1&accno=$accno&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback|};
- $column_data{description} = $ca->{description};
-
- push @rows, \%column_data;
- }
-
- my @buttons;
- push @buttons, {
- name => 'action',
- value => 'csv_list_gifi',
- text => $locale->text('CSV Report'),
- type => 'submit',
- class => 'submit',
- };
-
- my $template = LedgerSMB::Template->new(
- user => \%myconfig,
- locale => $locale,
- path => 'UI',
- template => 'form-dynatable',
- format => ($form->{action} =~ /^csv/)? 'CSV': 'HTML');
-
- my $column_heading = $template->column_heading($column_names);
-
- $template->render({
- form => \%$form,
- hiddens => \%hiddens,
- buttons => ..hidden..,
- columns => ..hidden..,
- heading => $column_heading,
- rows => ..hidden..,
- });
-}
-
-sub csv_list_gifi { &list_gifi }
-
sub add_gifi {
$form->{title} = "Add";
Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql 2013-09-14 10:15:04 UTC (rev 6023)
+++ trunk/sql/Pg-database.sql 2013-09-14 10:37:37 UTC (rev 6024)
@@ -3138,7 +3138,7 @@
132 module account.pl 346
132 action yearend_info 347
139 module am.pl 357
-140 module am.pl 358
+140 module reports.pl 358
139 action add_gifi 361
140 action list_gifi 362
141 menu 1 363
Modified: trunk/sql/modules/Account.sql
===================================================================
--- trunk/sql/modules/Account.sql 2013-09-14 10:15:04 UTC (rev 6023)
+++ trunk/sql/modules/Account.sql 2013-09-14 10:37:37 UTC (rev 6024)
@@ -621,4 +621,11 @@
)
SELECT id, accno, level, string_to_array(path, '||||') as path
FROM account_headings;
+
+CREATE OR REPLACE FUNCTION gifi__list() RETURNS SETOF gifi
+LANGUAGE SQL AS
+$$
+SELECT * FROM gifi ORDER BY accno;
+$$;
+
COMMIT;
Modified: trunk/sql/modules/menu_rebuild.sql
===================================================================
--- trunk/sql/modules/menu_rebuild.sql 2013-09-14 10:15:04 UTC (rev 6023)
+++ trunk/sql/modules/menu_rebuild.sql 2013-09-14 10:37:37 UTC (rev 6024)
@@ -448,7 +448,7 @@
132 module account.pl 346
132 action yearend_info 347
139 module am.pl 357
-140 module am.pl 358
+140 module reports.pl 358
139 action add_gifi 361
140 action list_gifi 362
141 menu 1 363
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13.
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits