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

SF.net SVN: ledger-smb:[2424] trunk/scripts/report.pl



Revision: 2424
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2424&view=rev
Author:   einhverfr
Date:     2008-12-05 18:30:17 +0000 (Fri, 05 Dec 2008)

Log Message:
-----------
Adding missing scripts/report.pl

Added Paths:
-----------
    trunk/scripts/report.pl

Added: trunk/scripts/report.pl
===================================================================
--- trunk/scripts/report.pl	                        (rev 0)
+++ trunk/scripts/report.pl	2008-12-05 18:30:17 UTC (rev 2424)
@@ -0,0 +1,42 @@
+
+package LedgerSMB::Scripts::report;
+use strict;
+use LedgerSMB::DBObject::Report;
+our $VERSION = 0.1;
+
+sub generate_report {
+    my ($request) = @_;
+    my $template = $request->{template};
+    my $report = new LedgerSMB::DBObject::Report->new({base => $request });
+    my $template = LedgerSMB::Template->new(
+        user =>$request->{_user}, 
+        locale => $request->{_locale},
+        path => 'UI/report',
+        template => $template,
+        format => 'HTML'
+    );
+
+    $report->run_report;
+    $report->{columns_shown} = [];
+    for (@{$report->{columns}}) {
+        if ($request->{$_}){
+            push (@{$report->{columns_shown}}, $_);
+        }
+    }
+}
+
+sub select_criteria {
+    my ($request) = @_;
+    my $report = new LedgerSMB::DBObject::Report->new({base => $request });
+    $report->can("definition_$request->{report}")->();
+    my $template = LedgerSMB::Template->new(
+        user =>$request->{_user}, 
+        locale => $request->{_locale},
+        path => 'UI/report',
+        template => 'criteria',
+        format => 'HTML'
+    );
+    $template->render($report);
+}    
+
+1;


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