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)
);
'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',
# 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 );
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";
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 =
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') ) {