TT#83355 consider prepaid call costs for reseller revenue

the cash_balance_interval column of customer's contract_balance
records does not include prepaid call costs.

nowadays there is the possibility to use data from
accounting.cdr_period_costs (fraud data)

Change-Id: I02ac981016d52eb9f7afdc4047aeaae143aea4dd
changes/56/40956/6
Rene Krenn 5 years ago
parent 32c2cff56c
commit 9d6fd2ab92

@ -79,13 +79,18 @@ sub _prepare_customer_sum {
my ($stime,$etime) = $self->_get_interval();
$c->stash(
customer_sum => $c->model('DB')->resultset('contract_balances')->search_rs({
'start' => { '>=' => $stime },
'end' => { '<' => $etime},
customer_sum => $c->model('DB')->resultset('cdr_period_costs')->search_rs({
'period_date' => {
'>=' => $stime,
'<' => $etime,
},
'period' => 'month',
'product.class' => { -in => [ 'sipaccount', 'pbxaccount' ] },
},{
join => { contract => 'product', },
})->get_column('cash_balance_interval'),
}, {
join => {
contract => 'product',
},
})->get_column('customer_cost'),
);
}

@ -71,20 +71,20 @@ sub reseller_sum {
sub _prepare_customer_sum {
my ($self, $c) = @_;
my ($stime,$etime) = $self->_get_interval();
# how to catchup contract balances of all contracts here?
# well, we don't care for a stats view ...
$c->stash(
customer_sum => $c->model('DB')->resultset('contract_balances')->search_rs({
'start' => { '>=' => $stime },
'end' => { '<' => $etime},
customer_sum => $c->model('DB')->resultset('cdr_period_costs')->search_rs({
'period_date' => {
'>=' => $stime,
'<' => $etime,
},
'period' => 'month',
'contact.reseller_id' => $c->user->reseller_id,
}, {
join => {
'contract' => 'contact',
},
})->get_column('cash_balance_interval'),
})->get_column('customer_cost'),
);
}

Loading…
Cancel
Save