diff --git a/lib/NGCP/Panel/Controller/Reseller.pm b/lib/NGCP/Panel/Controller/Reseller.pm index f60d207c2f..961be06a0a 100644 --- a/lib/NGCP/Panel/Controller/Reseller.pm +++ b/lib/NGCP/Panel/Controller/Reseller.pm @@ -164,7 +164,6 @@ sub base :Chained('list_reseller') :PathPart('') :CaptureArgs(1) { ); NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/reseller')); } - $c->stash(contract => $c->stash->{resellers}->search_rs({ id => $reseller_id })->first->contract); $c->stash->{branding} = $c->stash->{reseller}->first->branding; } diff --git a/lib/NGCP/Panel/Utils/Contract.pm b/lib/NGCP/Panel/Utils/Contract.pm index 6dedd1fe14..1444b599a9 100644 --- a/lib/NGCP/Panel/Utils/Contract.pm +++ b/lib/NGCP/Panel/Utils/Contract.pm @@ -59,7 +59,7 @@ sub get_contract_balance_values{ if($free_time or $free_cash) { $etime->add(seconds => 1); my $ctime = NGCP::Panel::Utils::DateTime::current_local->truncate(to => 'day'); - if( ( $ctime->epoch >= $stime->epoch ) && ( $ctime->epoch <= $stime->epoch ) ){ + if( ( $ctime->epoch >= $stime->epoch ) && ( $ctime->epoch <= $etime->epoch ) ){ my $ratio = ($etime->epoch - $ctime->epoch) / ($etime->epoch - $stime->epoch); $cash_balance = sprintf("%.4f", $free_cash * $ratio); @@ -228,7 +228,6 @@ sub get_contracts_rs_sippbx{ my $reseller_condition; if($c->user->roles eq "reseller") { $reseller_condition = $c->user->reseller_id; - $reseller_condition = $c->user->reseller_id; } elsif($c->user->roles eq "subscriberadmin") { $reseller_condition = $c->user->contract->contact->reseller_id; } elsif($c->user->roles eq "admin") { @@ -271,7 +270,7 @@ sub get_contract_calls_rs{ # source_user_id => { 'in' => [ map {$_->uuid} @{$contract->{subscriber}} ] }, call_status => 'ok', source_user_id => { '!=' => '0' }, -# source_account_id => $contract_id, + source_account_id => $contract_id, # start_time => # [ -and => # { '>=' => $stime->epoch}, @@ -335,6 +334,7 @@ sub get_contract_zonesfees_rs { { '<=' => $etime->epoch}, ], source_account_id => $contract_id, + },{ 'select' => [ { sum => 'me.source_customer_cost', -as => 'customercost' }, { sum => 'me.source_carrier_cost', -as => 'carriercost' }, @@ -376,7 +376,7 @@ sub get_contract_zonesfees_rs { } ); return ($zonecalls_rs_in, $zonecalls_rs_out); - +} sub get_contract_zonesfees { my %params = @_;