summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2008-08-25 05:53:14 +0000
committerjeff <jeff>2008-08-25 05:53:14 +0000
commit4783789db90ba00a0e57077464c689bd082ffb0f (patch)
tree6d975ba0bbbd6a66016c254b1dbc25e9f218b887
parent9698815f033fb517adb399dd437e6abc867a8528 (diff)
correct fallout from duplicate line items
-rw-r--r--FS/FS/Report/Table/Monthly.pm1
-rw-r--r--FS/FS/Schema.pm2
-rw-r--r--FS/FS/cust_bill_pkg.pm2
-rw-r--r--httemplate/search/cust_bill_pkg.cgi2
-rw-r--r--httemplate/search/report_prepaid_income.cgi5
-rwxr-xr-xhttemplate/search/report_tax.cgi3
6 files changed, 10 insertions, 5 deletions
diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm
index d75f0be79..0b8fca975 100644
--- a/FS/FS/Report/Table/Monthly.pm
+++ b/FS/FS/Report/Table/Monthly.pm
@@ -329,6 +329,7 @@ sub cust_bill_pkg {
LEFT JOIN cust_pkg USING ( pkgnum )
LEFT JOIN part_pkg USING ( pkgpart )
WHERE pkgnum != 0
+ AND ( duplicate IS NULL OR duplicate = '' )
AND $where
AND ". $self->in_time_period_and_agent($speriod, $eperiod, $agentnum)
);
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 530f632eb..3bcd078ab 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -500,7 +500,7 @@ sub tables_hashref {
'quantity', 'int', 'NULL', '', '', '',
'unitsetup', @money_typen, '', '',
'unitrecur', @money_typen, '', '',
- 'duplicate', 'char', 'NULL', 1, '', '', # does this need to be in db?
+ 'duplicate', 'char', 'NULL', 1, '', '',
'post_total', 'char', 'NULL', 1, '', '',
],
'primary_key' => 'billpkgnum',
diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm
index b3b8ea596..d3bf65bcb 100644
--- a/FS/FS/cust_bill_pkg.pm
+++ b/FS/FS/cust_bill_pkg.pm
@@ -370,7 +370,7 @@ sub owed_recur {
# modeled after cust_bill::owed...
sub owed {
my( $self, $field ) = @_;
- my $balance = $self->$field();
+ my $balance = $self->duplicate ? 0 : $self->$field();
$balance -= $_->amount foreach ( $self->cust_bill_pay_pkg($field) );
$balance -= $_->amount foreach ( $self->cust_credit_bill_pkg($field) );
$balance = sprintf( '%.2f', $balance );
diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi
index 74efe4f7e..2354be953 100644
--- a/httemplate/search/cust_bill_pkg.cgi
+++ b/httemplate/search/cust_bill_pkg.cgi
@@ -70,6 +70,8 @@ my $agentnums_sql =
my @where = ( $agentnums_sql );
+push @where, "(duplicate IS NULL OR duplicate = '' )";
+
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @where, "_date >= $beginning",
"_date <= $ending";
diff --git a/httemplate/search/report_prepaid_income.cgi b/httemplate/search/report_prepaid_income.cgi
index 27dbcbf9f..3694c7aae 100644
--- a/httemplate/search/report_prepaid_income.cgi
+++ b/httemplate/search/report_prepaid_income.cgi
@@ -43,8 +43,9 @@ my( $total, $total_legacy ) = ( 0, 0 );
my @cust_bill_pkg =
grep { $_->cust_pkg && $_->cust_pkg->part_pkg->freq !~ /^([01]|\d+[dw])$/ }
qsearch( 'cust_bill_pkg', {
- 'recur' => { op=>'!=', value=>0 },
- 'edate' => { op=>'>', value=>$now },
+ 'recur' => { op=>'!=', value=>0 },
+ 'edate' => { op=>'>', value=>$now },
+ 'duplicate' => '',
}, );
my @cust_pkg =
diff --git a/httemplate/search/report_tax.cgi b/httemplate/search/report_tax.cgi
index 3d37c47e4..dd6779a61 100755
--- a/httemplate/search/report_tax.cgi
+++ b/httemplate/search/report_tax.cgi
@@ -188,7 +188,8 @@ my $join_pkg = "
LEFT JOIN part_pkg USING ( pkgpart )
";
-my $where = "WHERE _date >= $beginning AND _date <= $ending ";
+my $where = "WHERE _date >= $beginning AND _date <= $ending ".
+ "AND (duplicate IS NULL or duplicate = '')";
my @base_param = qw( county county state state country );
if ( $conf->exists('tax-ship_address') ) {