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

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



Revision: 4595
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4595&view=rev
Author:   einhverfr
Date:     2012-03-27 01:02:11 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Fixes to get GL reports entirely working

Modified Paths:
--------------
    trunk/Changelog
    trunk/LedgerSMB/DBObject/Report/GL.pm
    trunk/LedgerSMB/DBObject/Report.pm
    trunk/LedgerSMB/PGDate.pm
    trunk/LedgerSMB/PGNumber.pm
    trunk/LedgerSMB/Scripts/journal.pm
    trunk/UI/Reports/display_report.html
    trunk/UI/journal/search.html
    trunk/css/ledgersmb.css

Modified: trunk/Changelog
===================================================================
--- trunk/Changelog	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/Changelog	2012-03-27 01:02:11 UTC (rev 4595)
@@ -16,6 +16,9 @@
 * Simpler use of Log::Log4perl instead of LedgerSMB::Log (Chris T)
 * Changing all auth calls to hit postgres db instead of template1 (Chris T)
 
+New Reporting Framework
+* Easy bridge between SQL and display (Chris T)
+
 Customer/Vendor Handling 
 * Added sales tax id and license number fields for companies (Chris T)
 * Simpified database schema (Chris T)

Modified: trunk/LedgerSMB/DBObject/Report/GL.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/GL.pm	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/LedgerSMB/DBObject/Report/GL.pm	2012-03-27 01:02:11 UTC (rev 4595)
@@ -176,6 +176,35 @@
     return 'journal/search';
 }
 
+=item name
+
+Returns the localized template name
+
+=cut
+
+sub name {
+    return $locale->text('General Ledger Report');
+}
+
+=item header_lines
+
+Returns the inputs to display on header.
+
+=cut
+
+sub header_lines {
+    return [{name => 'date_from',
+             text => $locale->text('Start Date')},
+            {name => 'date_to',
+             text => $locale->text('End Date')},
+            {name => 'accno',
+             text => $locale->text('Account Number')},
+            {name => 'reference',
+             text => $locale->text('Reference')},
+            {name => 'source',
+             text => $locale->text('Source')}];
+}
+
 =head2 Criteria Properties
 
 Note that in all cases, undef matches everything.
@@ -300,6 +329,7 @@
     $request->{amount_to} = LedgerSMB::PGNumber->from_input(
                                $request->{amount_to}
     );
+    $request->{accno} =~ s/--.*$//;
 }
 
 =item run_report()

Modified: trunk/LedgerSMB/DBObject/Report.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report.pm	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/LedgerSMB/DBObject/Report.pm	2012-03-27 01:02:11 UTC (rev 4595)
@@ -138,8 +138,12 @@
         template => $template,
         format => uc($request->{format} || 'HTML'),
     );
-    $template->render({report => $self, request => $request,
-                       columns => $self->show_cols($request), rows => $self->rows});
+    $template->render({report => $self, 
+                      request => $request,
+                         name => $self->name,
+                       hlines => $self->header_lines,
+                      columns => $self->show_cols($request), 
+                         rows => $self->rows});
 }
 
 =item show_cols 

Modified: trunk/LedgerSMB/PGDate.pm
===================================================================
--- trunk/LedgerSMB/PGDate.pm	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/LedgerSMB/PGDate.pm	2012-03-27 01:02:11 UTC (rev 4595)
@@ -152,6 +152,7 @@
 
 sub from_input{
     my ($self, $input, $has_time) = @_;
+    return undef if !defined $input;
     my $format = $LedgerSMB::App_State::User->{dateformat};
     my $dt =  _parse_string($self, $input, uc($format), $has_time);
     return $self->new({date => $dt});
@@ -193,6 +194,7 @@
 sub from_db {
     use Carp;
     my ($self, $input, $type) = @_;
+    return undef if !defined $input;
     my $format = 'YYYY-MM-DD';
     my $has_time;
     if ((lc($type) eq 'datetime') or (lc($type) eq 'timestamp')) {

Modified: trunk/LedgerSMB/PGNumber.pm
===================================================================
--- trunk/LedgerSMB/PGNumber.pm	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/LedgerSMB/PGNumber.pm	2012-03-27 01:02:11 UTC (rev 4595)
@@ -120,6 +120,7 @@
 sub from_input {
     my $self   = shift @_;
     my $string = shift @_;
+    return undef if !defined $string;
     my $negate;
     my $pgnum;
     my $newval;
@@ -213,6 +214,7 @@
 
 sub from_db {
     my ($self, $string) = @_;
+    return undef if !defined $string;
     return $self->new($string);
 }
 

Modified: trunk/LedgerSMB/Scripts/journal.pm
===================================================================
--- trunk/LedgerSMB/Scripts/journal.pm	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/LedgerSMB/Scripts/journal.pm	2012-03-27 01:02:11 UTC (rev 4595)
@@ -84,6 +84,7 @@
 sub search {
     my ($request) = @_;
     delete $request->{category} if ($request->{category} = 'X');
+    LedgerSMB::DBObject::Report::GL->prepare_criteria($request);
     my $report = LedgerSMB::DBObject::Report::GL->new(%$request);
     $report->run_report;
     $report->render($request);

Modified: trunk/UI/Reports/display_report.html
===================================================================
--- trunk/UI/Reports/display_report.html	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/UI/Reports/display_report.html	2012-03-27 01:02:11 UTC (rev 4595)
@@ -12,7 +12,20 @@
 
 ?>
 <body>
-<?lsmb PROCESS dynatable tbody = {rows => rows } ?>
+<div class="report_header"><label><?lsmb text('Report Name') ?>:</label>
+<span class="report_header"><?lsmb name ?></span>
+</div>
+<body>
+<div class="report_header"><label><?lsmb text('Company') ?>:</label>
+<span class="report_header"><?lsmb request.company ?></span>
+</div>
+<?lsmb FOREACH LINE IN hlines ?>
+<div class="report_header"><label><?lsmb LINE.text ?>:</label>
+<span class="report_header"><?lsmb request.${LINE.name} ?></span>
+</div>
+<?lsmb END ?>
+<?lsmb PROCESS dynatable tbody = {rows => rows } 
+               attributes = {class = 'report' } ?>
 
 <a href="<?lsmb LINK ?>">[<?lsmb text('permalink') ?>]</a>&nbsp;
 <a href="<?lsmb LINK _ '&format=PDF' ?>">[<?lsmb text('PDF') ?>]</a>&nbsp;

Modified: trunk/UI/journal/search.html
===================================================================
--- trunk/UI/journal/search.html	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/UI/journal/search.html	2012-03-27 01:02:11 UTC (rev 4595)
@@ -32,7 +32,7 @@
           <th align="right"><?lsmb text('Account') ?></th>
           <td colspan="3">
               <?lsmb PROCESS ajaxselect element_data = {
-                     name = "account"
+                     name = "accno"
                      initial_value = ""
                      text_attr = 'accno'
                      value_attr = 'id'
@@ -84,13 +84,13 @@
 	  <th align="right"><?lsmb text('From') ?></th>
 	  <td><?lsmb PROCESS input element_data = {
                class="date" 
-               name="datefrom" 
+               name="date_from" 
                size="11" 
                title=datestyle } ?></td>
 	  <th align="right"><?lsmb text('To') ?></th>
 	  <td><?lsmb PROCESS input element_data = {
                  class="date" 
-                 name="dateto" 
+                 name="date_to" 
                  size="11" 
                  title=datestyle } ?></td>
 	</tr>

Modified: trunk/css/ledgersmb.css
===================================================================
--- trunk/css/ledgersmb.css	2012-03-26 16:09:29 UTC (rev 4594)
+++ trunk/css/ledgersmb.css	2012-03-27 01:02:11 UTC (rev 4595)
@@ -57,6 +57,23 @@
   text-align: right;
 }
 
+table.report {
+   width: 100%
+}
+
+div.report_header {
+   overflow: auto;
+}
+
+div.report_header label {
+   display: block;
+   float: left;
+   width: 12em;
+   font-weight: bold;
+   text-align: right;
+   margin-right: 1em;
+}
+
 body.admin {
   background-color: #FFFFFF;
   color: black;

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