Skip to content

Commit

Permalink
Fix Balance Sheet & Income Tax comparisons report initial values
Browse files Browse the repository at this point in the history
  • Loading branch information
ylavoie committed Jun 5, 2024
1 parent d5c5efd commit fef1ae3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
6 changes: 1 addition & 5 deletions lib/LedgerSMB/Report/Dates.pm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ These are the first and last date in acc_trans.
=cut


sub get_bracket_dates {
my ($self) = @_;
my $return_hashref = {};
Expand Down Expand Up @@ -194,7 +193,7 @@ sub _build_comparisons {
from_date => $date,
to_date => $date->clone->add_interval($interval)
->add_interval('day', -1),
column_path_prefix => [ sprintf('%02u', $c_per) ]
column_path_prefix => [ $c_per ]
};
}
}
Expand Down Expand Up @@ -242,9 +241,6 @@ sub _set_lazy_dates {
return;
}




before 'render' => sub {
my ($self) = @_;
# Set lazy attributes
Expand Down
3 changes: 2 additions & 1 deletion lib/LedgerSMB/Scripts/pnl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ sub generate_income_statement {
$rpt = LedgerSMB::Report::PNL::Income_Statement->new(
%$request,
formatter_options => $request->formatter_options,
from_date => $request->{from_date} ? $request->parse_date( $request->{from_date} ) : undef,
to_date => $request->{to_date} ? $request->parse_date( $request->{to_date} ) : undef,
column_path_prefix => [ 0 ]);
#die np $rpt;
$rpt->run_report($request);

for my $key (qw(from_month from_year from_date to_date interval)) {
Expand Down
10 changes: 4 additions & 6 deletions lib/LedgerSMB/Scripts/reports.pm
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,18 @@ Generates a balance sheet
=cut

use Log::Any;
my $logger = Log::Any->get_logger(category => 'LedgerSMB::Scripts::reports');

sub generate_balance_sheet {
my ($request) = @_;
$logger->debug("Stub LedgerSMB::Scripts::reports->generate_balance_sheet\n");
my $rpt = LedgerSMB::Report::Balance_Sheet->new(
%$request,
formatter_options => $request->formatter_options,
from_date => $request->{from_date} ? $request->parse_date( $request->{from_date} ) : undef,
to_date => $request->{to_date} ? $request->parse_date( $request->{to_date} ) : undef,
column_path_prefix => [ 0 ]);
$rpt->run_report($request);

for my $key (qw(from_month from_year from_date to_date internal)) {
delete $request->{$_} for (grep { /^$key/ } keys %$request);
for my $key (qw(from_date to_date date_from date_to)) {
delete $rpt->{$_} for (grep { /^$key/ } keys %$rpt);
}

for my $cmp_dates (@{$rpt->comparisons}) {
Expand Down

0 comments on commit fef1ae3

Please sign in to comment.