From e1c0244de7d919a750ef6571596aa5e9867ea84f Mon Sep 17 00:00:00 2001 From: tetragon Date: Tue, 9 Oct 2007 14:55:27 +0000 Subject: Add links to account GL reports in the balance sheet git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1726 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/RP.pm | 27 ++++++++++++++------- bin/rp.pl | 20 +++++++++------- templates/demo/balance_sheet.html | 49 +++++++++++++++++++++++++++++++++++---- 3 files changed, 76 insertions(+), 20 deletions(-) diff --git a/LedgerSMB/RP.pm b/LedgerSMB/RP.pm index 922de64c..c46ee788 100644 --- a/LedgerSMB/RP.pm +++ b/LedgerSMB/RP.pm @@ -539,15 +539,18 @@ sub balance_sheet { foreach $key ( sort keys %{ $form->{$category} } ) { - $str = ( $form->{l_heading} ) ? $form->{padding} : ""; +## $str = ( $form->{l_heading} ) ? $form->{padding} : ""; + $str = ""; if ( $form->{$category}{$key}{charttype} eq "A" ) { $str .= ( $form->{l_accno} ) ? "$form->{$category}{$key}{accno} - $form->{$category}{$key}{description}" : "$form->{$category}{$key}{description}"; + $str = {account => $form->{$category}{$key}{accno}, text => $str}; + $str->{gifi_account} = 1 if $form->{accounttype} eq 'gifi'; } - if ( $form->{$category}{$key}{charttype} eq "H" ) { + elsif ( $form->{$category}{$key}{charttype} eq "H" ) { if ( $account{$category}{subtotal} && $form->{l_subtotal} ) { @@ -555,7 +558,10 @@ sub balance_sheet { $dash = "- "; push( @{ $form->{"$account{$category}{label}_account"} }, -"$str$form->{bold}$account{$category}{subdescription}$form->{endbold}" + { + text => "$account{$category}{subdescription}", + subtotal => 1 + }, ); push( @{ $form->{"$account{$category}{label}_this_period"} }, @@ -585,8 +591,10 @@ sub balance_sheet { } } - $str = -"$form->{bold}$form->{$category}{$key}{description}$form->{endbold}"; + $str = { + text => "$form->{$category}{$key}{description}", + heading => 1 + }; $account{$category}{subthis} = $form->{$category}{$key}{this}; $account{$category}{sublast} = $form->{$category}{$key}{last}; @@ -637,11 +645,14 @@ sub balance_sheet { } } - $str = ( $form->{l_heading} ) ? $form->{padding} : ""; + #$str = ( $form->{l_heading} ) ? $form->{padding} : ""; + $str = ""; if ( $account{$category}{subtotal} && $form->{l_subtotal} ) { push( - @{ $form->{"$account{$category}{label}_account"} }, -"$str$form->{bold}$account{$category}{subdescription}$form->{endbold}" + @{ $form->{"$account{$category}{label}_account"} }, { + text => "$account{$category}{subdescription}", + subtotal => 1, + }, ); push( @{ $form->{"$account{$category}{label}_this_period"} }, diff --git a/bin/rp.pl b/bin/rp.pl index a444f7b3..1cd178ad 100644 --- a/bin/rp.pl +++ b/bin/rp.pl @@ -1095,6 +1095,7 @@ sub generate_income_statement { sub generate_balance_sheet { + ##SC: START HTML $form->{padding} = "  "; $form->{bold} = ""; $form->{endbold} = ""; @@ -1112,26 +1113,30 @@ sub generate_balance_sheet { # define Current Earnings account $padding = ( $form->{l_heading} ) ? $form->{padding} : ""; push( - @{ $form->{equity_account} }, - $padding . $locale->text('Current Earnings') + @{ $form->{equity_account} }, { current_earnings => 1, + text => $locale->text('Current Earnings')} ); $form->{this_period} = $locale->date( \%myconfig, $form->{asofdate}, 0 ); $form->{last_period} = $locale->date( \%myconfig, $form->{compareasofdate}, 0 ); - $form->{IN} = "balance_sheet.html"; - # setup company variables for the form - for (qw(company address businessnumber nativecurr)) { + for (qw(company address businessnumber nativecurr login)) { $form->{$_} = $myconfig{$_}; } $form->{address} =~ s/\\n/
/g; + ##SC: END HTML $form->{templates} = $myconfig{templates}; - my $template = LedgerSMB::Template->new( user => \%myconfig, - template => $form->{'formname'}, format => uc $form->{format} ); + my $template = LedgerSMB::Template->new( + user => \%myconfig, + locale => $locale, + template => 'balance_sheet', + format => $form->{format}? uc $form->{format}: 'HTML', + no_auto_output => 1, + ); try { $template->render($form); $template->output(%{$form}); @@ -1140,7 +1145,6 @@ sub generate_balance_sheet { my $E = shift; $form->error( $E->stacktrace ); }; - } sub generate_projects { diff --git a/templates/demo/balance_sheet.html b/templates/demo/balance_sheet.html index c82ada28..995fb5ab 100644 --- a/templates/demo/balance_sheet.html +++ b/templates/demo/balance_sheet.html @@ -10,8 +10,49 @@ + +") ?> +     +

@@ -19,7 +60,7 @@

-
as at +

@@ -37,7 +78,7 @@ - + @@ -63,7 +104,7 @@ - + @@ -90,7 +131,7 @@ - + -- cgit v1.2.3