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

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



Revision: 4996
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4996&view=rev
Author:   einhverfr
Date:     2012-07-16 00:17:46 +0000 (Mon, 16 Jul 2012)
Log Message:
-----------
basic report logic done for trial balance

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Report/Trial_Balance.pm
    trunk/sql/modules/Report.sql

Modified: trunk/LedgerSMB/DBObject/Report/Trial_Balance.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Report/Trial_Balance.pm	2012-07-15 15:00:11 UTC (rev 4995)
+++ trunk/LedgerSMB/DBObject/Report/Trial_Balance.pm	2012-07-16 00:17:46 UTC (rev 4996)
@@ -124,17 +124,17 @@
     return [
       {col_id => 'account_number',
          type => 'href',
-    href_base => 'report.pl?action=',
+    href_base => 'journal.pl?action=search&col_transdate=Y&col_reference=Y&col_description=Y&col_debits=Y&col_credits=Y&col_source=Y&col_accno=Y',
          name => $locale->text('Account Number') },
 
       {col_id => 'account_desc',
          type => 'href',
-    href_base => 'report.pl?action=',
+    href_base => 'journal.pl?action=search&col_transdate=Y&col_reference=Y&col_description=Y&col_debits=Y&col_credits=Y&col_source=Y&col_accno=Y',
          name => $locale->text('Account Description') },
 
       {col_id => 'gifi_accno',
          type => 'href',
-    href_base => 'report.pl?action=',
+    href_base => 'journal.pl?action=search&col_transdate=Y&col_reference=Y&col_description=Y&col_debits=Y&col_credits=Y&col_source=Y&col_accno=Y',
          name => $locale->text('GIFI') } ,
 
       {col_id => 'starting_balance',
@@ -156,12 +156,18 @@
     ];
 }
 
-=item report_heading
+=item header_lines 
 
 =cut
 
-sub report_heading {
-    return;
+sub header_lines {
+    return [{name => 'date_from'
+             text => $locale->text('From date') },
+            {name => 'date_to',
+             text => $locale->text('To Date') },
+            {name => 'yearend',
+             text => $locale->text('Ignore Yearends') },
+            ];
 }
 
 =back
@@ -199,6 +205,31 @@
 
 Runs the trial balance report.
 
+=cut
+
+sub run_report {
+    my ($self) = @_;
+    my @rows = $self->exec_method({funcname => 'report__gl'});
+    my $total_debits;
+    my $total_credits;
+    for my $ref(@rows){
+        my $href_suffix = "from_date=" . $self->from_date . 
+                          "&to_date=" . $self->to_date .
+                          "&accno=" . $ref->{account_number};
+        $total_debits += $ref->{debits}; 
+        $total_credits += $ref->{credits}; 
+        $ref->{account_number_href_suffix} = $href_suffix;
+        $ref->{account_desc_href_suffix} = $href_suffix;
+        $ref->{gifi_accno_href_suffix} = $href_suffix;
+        
+    }
+    push @rows {class => 'total', 
+               debits => $total_debits,
+              credits => $total_credits, };
+
+    $self->rows(..hidden..);
+}
+
 =back
 
 =head1 COPYRIGHT

Modified: trunk/sql/modules/Report.sql
===================================================================
--- trunk/sql/modules/Report.sql	2012-07-15 15:00:11 UTC (rev 4995)
+++ trunk/sql/modules/Report.sql	2012-07-16 00:17:46 UTC (rev 4996)
@@ -191,7 +191,9 @@
    t_balance := 0;
 ELSIF in_accno IS NOT NULL THEN
    SELECT id INTO t_chart_id FROM account WHERE accno  = in_accno;
-   t_balance := account__obtain_balance(in_from_date , t_accno);
+   t_balance := account__obtain_balance(in_from_date , 
+                                       (select id from account 
+                                         where accno = in_accno));
 ELSE
    t_balance := null;
 END IF;

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