Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Balance Sheet & Income Tax comparisons report by dates or by periods #8169

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/LedgerSMB/Report/Balance_Sheet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ Boolean, true if it is a gifi report.

has gifi => (is => 'rw', isa => 'Bool');

=item from_date
=item to_date

Dates come from LedgerSMB::Report::Dates

=cut

=item legacy_hierarchy

Boolean, true if the regular hierarchies need to be ignored,
Expand Down Expand Up @@ -168,8 +175,8 @@ sub run_report {

my $col_id = $self->cheads->map_path($self->column_path_prefix);
$self->cheads->id_props($col_id,
{ description => $self->date_to->to_output,
to_date => $self->date_to->to_output,
{ description => $self->date_to->to_output($self->{formatter_options}),
to_date => $self->date_to->to_output($self->{formatter_options}),
});

for my $line (@lines) {
Expand Down
4 changes: 2 additions & 2 deletions lib/LedgerSMB/Report/Dates.pm
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ sub _collect_dates_comparisons {

foreach my $i (1 .. $args{comparison_periods}) {
push @dates, {
from_date => LedgerSMB::PGDate->from_input($args{"from_date_$i"}),
to_date => LedgerSMB::PGDate->from_input($args{"to_date_$i"}),
from_date => LedgerSMB::PGDate->from_input($args{"from_date_$i"},$args{formatter_options}),
to_date => LedgerSMB::PGDate->from_input($args{"to_date_$i"},$args{formatter_options}),
column_path_prefix => [ $i ]
};
}
Expand Down
17 changes: 13 additions & 4 deletions lib/LedgerSMB/Report/PNL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ Boolean, true if it is a gifi report.

has gifi => (is => 'rw', isa => 'Bool');

=item from_date
=item to_date

Dates come from LedgerSMB::Report::Dates

=cut

=item legacy_hierarchy

Boolean, true if the regular hierarchies need to be ignored,
Expand Down Expand Up @@ -153,14 +160,16 @@ sub run_report {


my $col_id = $self->cheads->map_path($self->column_path_prefix);
my $_from_date = $self->from_date->to_output($self->{formatter_options});
my $_to_date = $self->to_date->to_output($self->{formatter_options});
$self->cheads->id_props($col_id,
{ description =>
$self->Text(
"[_1]\n[_2]",
$self->from_date->to_output,
$self->to_date->to_output),
from_date => $self->from_date->to_output,
to_date => $self->to_date->to_output,
$_from_date,
$_to_date),
from_date => $_from_date,
to_date => $_to_date
});

for my $line (@lines) {
Expand Down
7 changes: 4 additions & 3 deletions lib/LedgerSMB/Scripts/pnl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ sub generate_income_statement {
$rpt = LedgerSMB::Report::PNL::Income_Statement->new(
%$request,
formatter_options => $request->formatter_options,
from_date => $request->parse_date( $request->{from_date} ),
to_date => $request->parse_date( $request->{to_date} ),
column_path_prefix => [ 0 ]);
#die np $rpt;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove this stray comment?

$rpt->run_report($request);

for my $key (qw(from_month from_year from_date to_date interval)) {
Expand All @@ -85,7 +84,9 @@ sub generate_income_statement {

for my $cmp_dates (@{$rpt->comparisons}) {
my $cmp = LedgerSMB::Report::PNL::Income_Statement->new(
%$request, %$cmp_dates);
%$request,
formatter_options => $request->formatter_options,
%$cmp_dates);
$cmp->run_report($request);
$rpt->add_comparison($cmp);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/LedgerSMB/Scripts/reports.pm
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ sub generate_balance_sheet {
my $rpt = LedgerSMB::Report::Balance_Sheet->new(
%$request,
formatter_options => $request->formatter_options,
from_date => $request->parse_date( $request->{from_date} ),
to_date => $request->parse_date( $request->{to_date} ),
column_path_prefix => [ 0 ]);
$rpt->run_report($request);

Expand All @@ -213,7 +211,9 @@ sub generate_balance_sheet {

for my $cmp_dates (@{$rpt->comparisons}) {
my $cmp = LedgerSMB::Report::Balance_Sheet->new(
%$request, %$cmp_dates);
%$request,
formatter_options => $request->formatter_options,
%$cmp_dates);
$cmp->run_report($request);
$rpt->add_comparison($cmp);
}
Expand Down