diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-09 14:55:27 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-09 14:55:27 +0000 |
commit | e1c0244de7d919a750ef6571596aa5e9867ea84f (patch) | |
tree | 493b467cb5f5dd9ce67e7e421fd964ca2ff7989a | |
parent | 198991e23e8459df24949a65f3363b56373b0e0c (diff) |
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
-rw-r--r-- | LedgerSMB/RP.pm | 27 | ||||
-rw-r--r-- | bin/rp.pl | 20 | ||||
-rw-r--r-- | 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"} }, @@ -1095,6 +1095,7 @@ sub generate_income_statement { sub generate_balance_sheet { + ##SC: START HTML $form->{padding} = " "; $form->{bold} = "<b>"; $form->{endbold} = "</b>"; @@ -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/<br>/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 @@ <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta name="robots" content="noindex,nofollow" /> + <style type="text/css"> + a { + color: inherit; + background-color: inherit; + text-decoration: none; + } + a:link { + color: inherit; + background-color: inherit; + text-decoration: none; + } + a:visited { + color: inherit; + background-color: inherit; + text-decoration: none; + } + a:hover { + color: inherit; + background-color: inherit; + text-decoration: none; + border-bottom: thin dashed; + } + </style> </head> +<?lsmb USE dumper(indent=0, pad="<br />") ?> +<?lsmb BLOCK account; # Handle account labels + RETURN UNLESS account_data.defined; + IF account_data.heading; ?><b><?lsmb + account_data.text; ?></b><?lsmb + ELSIF account_data.gifi_account; ?><a href="gl.pl?action=generate_report&path=<?lsmb path ?>&login=<?lsmb login ?>&sessionid=<?lsmb sessionid ?>&l_transdate=Y&l_reference=Y&l_description=Y&l_source=Y&l_debit=Y&l_credit=Y&l_gifi_accno=Y&category=X&gifi_accno=<?lsmb account_data.account ?>"><?lsmb + account_data.text; ?></a><?lsmb + ELSIF account_data.account; ?><a href="gl.pl?action=generate_report&path=<?lsmb path ?>&login=<?lsmb login ?>&sessionid=<?lsmb sessionid ?>&l_transdate=Y&l_reference=Y&l_description=Y&l_source=Y&l_debit=Y&l_credit=Y&l_accno=Y&category=X&accno=<?lsmb account_data.account ?>"><?lsmb + account_data.text; ?></a><?lsmb + ELSIF account_data.subtotal; ?><b> <?lsmb + account_data.text; ?></b><?lsmb + ELSIF account_data.current_earnings; ?> <?lsmb + account_data.text; + ELSE; + account_data; + END; +END ?> + <body> <h2 align="center"> @@ -19,7 +60,7 @@ <br /><?lsmb address ?> <br /><?lsmb text('Balance Sheet') ?> -<br />as at <?lsmb this_period ?> +<br /><?lsmb text('as at [_1]', this_period) ?> </h2> <?lsmb IF department ?> @@ -37,7 +78,7 @@ <?lsmb loop_count = loop.count - 1 ?> <tr> <td> </td> - <td><?lsmb asset_account.${loop_count} ?></td> + <td><?lsmb PROCESS account account_data=asset_account.${loop_count} ?></td> <td align="right"><?lsmb asset_this_period.${loop_count} ?></td> <td align="right"><?lsmb asset_last_period.${loop_count} ?></td> </tr> @@ -63,7 +104,7 @@ <?lsmb loop_count = loop.count - 1 ?> <tr> <td></td> - <td><?lsmb liability_account.${loop_count} ?></td> + <td><?lsmb PROCESS account account_data=liability_account.${loop_count} ?></td> <td align="right"><?lsmb liability_this_period.${loop_count} ?></td> <td align="right"><?lsmb liability_last_period.${loop_count} ?></td> </tr> @@ -90,7 +131,7 @@ <?lsmb loop_count = loop.count - 1 ?> <tr> <td></td> - <td><?lsmb equity_account.${loop_count} ?></td> + <td><?lsmb PROCESS account account_data=equity_account.${loop_count} ?></td> <td align="right"><?lsmb equity_this_period.${loop_count} ?></td> <td align="right"><?lsmb equity_last_period.${loop_count} ?></td> </tr> |