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

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



Revision: 1726
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1726&view=rev
Author:   tetragon
Date:     2007-10-09 07:55:27 -0700 (Tue, 09 Oct 2007)

Log Message:
-----------
Add links to account GL reports in the balance sheet

Modified Paths:
--------------
    trunk/LedgerSMB/RP.pm
    trunk/bin/rp.pl
    trunk/templates/demo/balance_sheet.html

Modified: trunk/LedgerSMB/RP.pm
===================================================================
--- trunk/LedgerSMB/RP.pm	2007-10-09 04:13:18 UTC (rev 1725)
+++ trunk/LedgerSMB/RP.pm	2007-10-09 14:55:27 UTC (rev 1726)
@@ -539,15 +539,18 @@
 
         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 @@
                     $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 @@
                     }
                 }
 
-                $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 @@
             }
         }
 
-        $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"} },

Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl	2007-10-09 04:13:18 UTC (rev 1725)
+++ trunk/bin/rp.pl	2007-10-09 14:55:27 UTC (rev 1726)
@@ -1095,6 +1095,7 @@
 
 sub generate_balance_sheet {
 
+	##SC: START HTML
     $form->{padding} = "  ";
     $form->{bold}    = "<b>";
     $form->{endbold} = "</b>";
@@ -1112,26 +1113,30 @@
     # 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 @@
         my $E = shift;
         $form->error( $E->stacktrace );
     };
-
 }
 
 sub generate_projects {

Modified: trunk/templates/demo/balance_sheet.html
===================================================================
--- trunk/templates/demo/balance_sheet.html	2007-10-09 04:13:18 UTC (rev 1725)
+++ trunk/templates/demo/balance_sheet.html	2007-10-09 14:55:27 UTC (rev 1726)
@@ -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&amp;path=<?lsmb path ?>&amp;login=<?lsmb login ?>&amp;sessionid=<?lsmb sessionid ?>&amp;l_transdate=Y&amp;l_reference=Y&amp;l_description=Y&amp;l_source=Y&amp;l_debit=Y&amp;l_credit=Y&amp;l_gifi_accno=Y&amp;category=X&amp;gifi_accno=<?lsmb account_data.account ?>"><?lsmb
+		account_data.text; ?></a><?lsmb
+	ELSIF account_data.account; ?><a href="gl.pl?action=generate_report&amp;path=<?lsmb path ?>&amp;login=<?lsmb login ?>&amp;sessionid=<?lsmb sessionid ?>&amp;l_transdate=Y&amp;l_reference=Y&amp;l_description=Y&amp;l_source=Y&amp;l_debit=Y&amp;l_credit=Y&amp;l_accno=Y&amp;category=X&amp;accno=<?lsmb account_data.account ?>"><?lsmb
+		account_data.text; ?></a><?lsmb
+	ELSIF account_data.subtotal; ?><b>&nbsp;&nbsp;<?lsmb
+		account_data.text; ?></b><?lsmb
+	ELSIF account_data.current_earnings; ?>&nbsp;&nbsp;<?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>


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