projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
import torrus 1.0.9
[freeside.git]
/
FS
/
FS
/
Report
/
Table
/
Monthly.pm
diff --git
a/FS/FS/Report/Table/Monthly.pm
b/FS/FS/Report/Table/Monthly.pm
index
4b866c4
..
376ee5c
100644
(file)
--- a/
FS/FS/Report/Table/Monthly.pm
+++ b/
FS/FS/Report/Table/Monthly.pm
@@
-1,13
+1,14
@@
package FS::Report::Table::Monthly;
use strict;
package FS::Report::Table::Monthly;
use strict;
-use vars qw( @ISA );
+use vars qw( @ISA
$DEBUG
);
use Time::Local;
use FS::UID qw( dbh );
use FS::Report::Table;
use FS::CurrentUser;
@ISA = qw( FS::Report::Table );
use Time::Local;
use FS::UID qw( dbh );
use FS::Report::Table;
use FS::CurrentUser;
@ISA = qw( FS::Report::Table );
+$DEBUG = 0; # turning this on will trace all SQL statements, VERY noisy
=head1 NAME
=head1 NAME
@@
-141,7
+142,7
@@
sub netsales { #net sales
my( $self, $speriod, $eperiod, $agentnum ) = @_;
$self->invoiced($speriod,$eperiod,$agentnum)
my( $self, $speriod, $eperiod, $agentnum ) = @_;
$self->invoiced($speriod,$eperiod,$agentnum)
- - $self->
credits(
$speriod,$eperiod,$agentnum);
+ - $self->
netcredits(
$speriod,$eperiod,$agentnum);
}
#deferred revenue
}
#deferred revenue
@@
-378,12
+379,12
@@
sub cust_bill_pkg {
}
if ( $opt{'use_override'} ) {
}
if ( $opt{'use_override'} ) {
- $where = "(
+ $where = "
AND
(
part_pkg.classnum $comparison AND pkgpart_override IS NULL OR
override.classnum $comparison AND pkgpart_override IS NOT NULL
)";
} else {
part_pkg.classnum $comparison AND pkgpart_override IS NULL OR
override.classnum $comparison AND pkgpart_override IS NOT NULL
)";
} else {
- $where = "part_pkg.classnum $comparison";
+ $where = "
AND
part_pkg.classnum $comparison";
}
}
}
}
@@
-404,7
+405,7
@@
sub cust_bill_pkg {
LEFT JOIN part_pkg USING ( pkgpart )
LEFT JOIN part_pkg AS override ON pkgpart_override = override.pkgpart
WHERE pkgnum != 0
LEFT JOIN part_pkg USING ( pkgpart )
LEFT JOIN part_pkg AS override ON pkgpart_override = override.pkgpart
WHERE pkgnum != 0
-
AND
$where
+ $where
AND ". $self->in_time_period_and_agent($speriod, $eperiod, $agentnum);
if ($opt{use_usage} && $opt{use_usage} eq 'recurring') {
AND ". $self->in_time_period_and_agent($speriod, $eperiod, $agentnum);
if ($opt{use_usage} && $opt{use_usage} eq 'recurring') {
@@
-569,6
+570,7
@@
sub in_time_period_and_agent {
sub scalar_sql {
my( $self, $sql ) = ( shift, shift );
my $sth = dbh->prepare($sql) or die dbh->errstr;
sub scalar_sql {
my( $self, $sql ) = ( shift, shift );
my $sth = dbh->prepare($sql) or die dbh->errstr;
+ warn "FS::Report::Table::Monthly\n$sql\n" if $DEBUG;
$sth->execute
or die "Unexpected error executing statement $sql: ". $sth->errstr;
$sth->fetchrow_arrayref->[0] || 0;
$sth->execute
or die "Unexpected error executing statement $sql: ". $sth->errstr;
$sth->fetchrow_arrayref->[0] || 0;