[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1741] trunk
- Subject: SF.net SVN: ledger-smb: [1741] trunk
- From: ..hidden..
- Date: Thu, 11 Oct 2007 06:34:46 -0700
Revision: 1741
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1741&view=rev
Author: tetragon
Date: 2007-10-11 06:34:46 -0700 (Thu, 11 Oct 2007)
Log Message:
-----------
Getting rid of most of the HTML in the bin/LSMB code for the income statement
Adding in the links
Modified Paths:
--------------
trunk/LedgerSMB/RP.pm
trunk/bin/rp.pl
trunk/templates/demo/income_statement.html
Modified: trunk/LedgerSMB/RP.pm
===================================================================
--- trunk/LedgerSMB/RP.pm 2007-10-11 06:11:07 UTC (rev 1740)
+++ trunk/LedgerSMB/RP.pm 2007-10-11 13:34:46 UTC (rev 1741)
@@ -251,13 +251,16 @@
# push description onto array
- $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" ) {
if ( $account{$category}{subtotal}
@@ -266,8 +269,10 @@
$dash = "- ";
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(
@@ -304,8 +309,10 @@
}
- $str =
-"$form->{br}$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};
@@ -357,11 +364,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}{labels}_this_period"} },
Modified: trunk/bin/rp.pl
===================================================================
--- trunk/bin/rp.pl 2007-10-11 06:11:07 UTC (rev 1740)
+++ trunk/bin/rp.pl 2007-10-11 13:34:46 UTC (rev 1741)
@@ -49,6 +49,7 @@
use LedgerSMB::PE;
use LedgerSMB::RP;
+#$form->{login} = 'test';
1;
# end of main
@@ -1019,11 +1020,6 @@
sub generate_income_statement {
- $form->{padding} = " ";
- $form->{bold} = "<b>";
- $form->{endbold} = "</b>";
- $form->{br} = "<br>";
-
RP->income_statement( \%myconfig, \%$form );
( $form->{department} ) = split /--/, $form->{department};
@@ -1034,26 +1030,21 @@
$form->{todate} = $form->current_date( \%myconfig ) unless $form->{todate};
# if there are any dates construct a where
- if ( $form->{fromdate} || $form->{todate} ) {
+ unless ( $form->{todate} ) {
+ $form->{todate} = $form->current_date( \%myconfig );
+ }
- unless ( $form->{todate} ) {
- $form->{todate} = $form->current_date( \%myconfig );
- }
+ $longtodate = $locale->date( \%myconfig, $form->{todate}, 1 );
+ $shorttodate = $locale->date( \%myconfig, $form->{todate}, 0 );
- $longtodate = $locale->date( \%myconfig, $form->{todate}, 1 );
- $shorttodate = $locale->date( \%myconfig, $form->{todate}, 0 );
+ $longfromdate = $locale->date( \%myconfig, $form->{fromdate}, 1 );
+ $shortfromdate = $locale->date( \%myconfig, $form->{fromdate}, 0 );
- $longfromdate = $locale->date( \%myconfig, $form->{fromdate}, 1 );
- $shortfromdate = $locale->date( \%myconfig, $form->{fromdate}, 0 );
+ $form->{this_period_from} = $shortfromdate;
+ $form->{this_period_to} = $shorttodate;
+ # example output: 2006-01-01 To 2007-01-01
+ $form->{period} = $locale->text('[_1] To [_2]', $longfromdate, $longtodate);
- $form->{this_period} = "$shortfromdate<br>\n$shorttodate";
- $form->{period} =
- $locale->text('for Period')
- . qq|<br>\n$longfromdate |
- . $locale->text('To')
- . qq| $longtodate|;
- }
-
if ( $form->{comparefromdate} || $form->{comparetodate} ) {
$longcomparefromdate =
$locale->date( \%myconfig, $form->{comparefromdate}, 1 );
@@ -1065,24 +1056,27 @@
$shortcomparetodate =
$locale->date( \%myconfig, $form->{comparetodate}, 0 );
- $form->{last_period} = "$shortcomparefromdate<br>\n$shortcomparetodate";
- $form->{period} .=
- "<br>\n$longcomparefromdate "
- . $locale->text('To')
- . qq| $longcomparetodate|;
+ $form->{last_period_from} = $shortcomparefromdate;
+ $form->{last_period_to} = $shortcomparetodate;
+ $form->{compare_period} = $locale->text('[_1] To [_2]',
+ $longcomparefromdate, $longcomparetodate);
}
# setup variables for the form
- @a = qw(company address businessnumber);
- for (@a) { $form->{$_} = $myconfig{$_} }
+ my @vars = qw(company address businessnumber);
+ for (@vars) { $form->{$_} = $myconfig{$_} }
+ ##SC: START HTML
$form->{address} =~ s/\\n/<br>/g;
+ ##SC: END HTML
- $form->{templates} = $myconfig{templates};
- $form->{IN} = "income_statement.html";
-
- my $template = LedgerSMB::Template->new( user => \%myconfig,
- template => $form->{'formname'}, format => uc $form->{format} );
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig,
+ locale => $locale,
+ template => 'income_statement',
+ format => 'HTML',
+ #no_escape => '1'
+ );
try {
$template->render($form);
$template->output(%{$form});
@@ -1096,7 +1090,6 @@
sub generate_balance_sheet {
- ##SC: START HTML
RP->balance_sheet( \%myconfig, \%$form );
$form->{asofdate} = $form->current_date( \%myconfig )
@@ -1122,6 +1115,7 @@
for (qw(company address businessnumber nativecurr login)) {
$form->{$_} = $myconfig{$_};
}
+ ##SC: START HTML
$form->{address} =~ s/\\n/<br>/g;
##SC: END HTML
Modified: trunk/templates/demo/income_statement.html
===================================================================
--- trunk/templates/demo/income_statement.html 2007-10-11 06:11:07 UTC (rev 1740)
+++ trunk/templates/demo/income_statement.html 2007-10-11 13:34:46 UTC (rev 1741)
@@ -35,36 +35,58 @@
</style>
</head>
+<?lsmb USE dumper(indent=0, pad="<br />") ?>
+<?lsmb BLOCK account; # Handle account labels
+ RETURN UNLESS account_data.defined;
+ IF account_data.heading; ?><br /><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; IF l_heading ?> <?lsmb END;
+ account_data.text;
+ ELSE;
+ account_data;
+ END;
+END ?>
+
<body>
<h2 align="center">
<?lsmb company ?>
<br /><?lsmb address ?>
-<br />INCOME STATEMENT
+<br /><?lsmb text('Income Statement') ?>
+<br /><?lsmb text('for Period') ?>
<br /><?lsmb period ?>
+<?lsmb IF compare_period ?>
+<br /><?lsmb compare_period ?>
+<?lsmb END ?>
</h2>
<?lsmb IF department ?>
-<h4>Department: <?lsmb department ?></h4>
+<h4><?lsmb text('Department: [_1]', department) ?></h4>
<?lsmb END ?>
<?lsmb IF projectnumber ?>
-<h4>Project Number: <?lsmb projectnumber ?></h4>
+<h4><?lsmb text('Project Number: [_1]', projectnumber) ?></h4>
<?lsmb END ?>
<table width="100%" border="0">
<tr>
- <th width="400" align="left" colspan="2">INCOME<br /><hr width="300" size="5" align="left" noshade="noshade" /></th>
- <th><?lsmb this_period ?></th>
- <th><?lsmb last_period ?></th>
+ <th width="400" align="left" colspan="2" style="text-transform: uppercase"><?lsmb text('Income') ?><br /><hr width="300" size="5" align="left" noshade="noshade" /></th>
+ <th><?lsmb this_period_from ?><br /><?lsmb this_period_to ?></th>
+ <th><?lsmb last_period_from ?><br /><?lsmb last_period_to ?></th>
</tr>
<?lsmb FOREACH income_account ?>
<?lsmb loop_count = loop.count - 1 ?>
<tr>
<td width="4"> </td>
- <td><?lsmb income_account.${loop_count} ?></td>
+ <td><?lsmb PROCESS account account_data=income_account.${loop_count} ?></td>
<td align="right"><?lsmb income_this_period.${loop_count} ?></td>
<td align="right"><?lsmb income_last_period.${loop_count} ?></td>
</tr>
@@ -78,20 +100,20 @@
<tr valign="top">
<td> </td>
- <th align="left">TOTAL INCOME</th>
+ <th align="left" style="text-transform: uppercase"><?lsmb text('Total Income') ?></th>
<td align="right"><?lsmb total_income_this_period ?><hr noshade="noshade" size="2" /></td>
<td align="right"><?lsmb total_income_last_period ?><hr noshade="noshade" size="2" /></td>
</tr>
<tr>
- <th align="left" colspan="2">EXPENSES<br /><hr width="300" size="5" align="left" noshade="noshade" /></th>
+ <th align="left" colspan="2" style="text-transform: uppercase"><?lsmb text('Expenses') ?><br /><hr width="300" size="5" align="left" noshade="noshade" /></th>
</tr>
<?lsmb FOREACH expense_account ?>
<?lsmb loop_count = loop.count - 1 ?>
<tr>
<td> </td>
- <td><?lsmb expense_account.${loop_count} ?></td>
+ <td><?lsmb PROCESS account account_data=expense_account.${loop_count} ?></td>
<td align="right"><?lsmb expenses_this_period.${loop_count} ?></td>
<td align="right"><?lsmb expenses_last_period.${loop_count} ?></td>
</tr>
@@ -105,13 +127,13 @@
<tr valign="top">
<td> </td>
- <th align="left">TOTAL EXPENSES</th>
+ <th align="left" style="text-transform: uppercase"><?lsmb text('Total Expenses') ?></th>
<td align="right"><?lsmb total_expenses_this_period ?><br /><hr noshade="noshade" size="2" /></td>
<td align="right"><?lsmb total_expenses_last_period ?><br /><hr noshade="noshade" size="2" /></td>
</tr>
<tr valign="top">
- <th align="left" colspan="2">INCOME / (LOSS)</th>
+ <th align="left" colspan="2" style="text-transform: uppercase"><?lsmb text('Income / (Loss)') ?></th>
<td align="right"><?lsmb total_this_period ?><br /><hr noshade="noshade" size="2" /></td>
<td align="right"><?lsmb total_last_period ?><br /><hr noshade="noshade" size="2" /></td>
</tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.