From 488d3c15c9aaea2a17826600ee332f0af9b0634d Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Thu, 28 Jan 2016 15:42:43 -0600 Subject: [PATCH] RT#39638: VoIP Usage cost reporting [bug fixes/cleanup] --- FS/FS/cdr.pm | 9 ++++----- httemplate/elements/menu.html | 4 ++-- .../{customer_usage_profit.html => customer_cdr_profit.html} | 7 ++++--- ...ustomer_usage_profit.html => report_customer_cdr_profit.html} | 7 ++++--- 4 files changed, 14 insertions(+), 13 deletions(-) rename httemplate/search/{customer_usage_profit.html => customer_cdr_profit.html} (97%) rename httemplate/search/{report_customer_usage_profit.html => report_customer_cdr_profit.html} (71%) diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index f8fea35d7..5a1d8ea23 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -464,9 +464,9 @@ Sets the status and rated price. Available options are: inbound, rated_pretty_dst, rated_regionname, rated_seconds, rated_minutes, rated_granularity, rated_ratedetailnum, -rated_classnum, rated_ratename, and set_rate_cost (if true, will set -a recalculated L in the rated_cost field after the other -fields are set; does not work with inbound.) +rated_classnum, rated_ratename. If rated_ratedetailnum is provided, +will also set a recalculated L in the rated_cost field +after the other fields are set (does not work with inbound.) If there is an error, returns the error, otherwise returns false. @@ -504,7 +504,7 @@ sub set_status_and_rated_price { qw( pretty_dst regionname seconds minutes granularity ratedetailnum classnum ratename ); $self->svcnum($svcnum) if $svcnum; - $self->rated_cost($self->rate_cost) if $opt{'set_rate_cost'}; + $self->rated_cost($self->rate_cost) if $opt{'rated_ratedetailnum'}; return $self->replace(); @@ -1005,7 +1005,6 @@ sub rate_prefix { 'rated_ratedetailnum' => $rate_detail->ratedetailnum, 'rated_classnum' => $rate_detail->classnum, #rated_ratedetailnum? 'rated_ratename' => $ratename, #not rate_detail - Intrastate/Interstate - 'set_rate_cost' => 1, ); } diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 1d5789d04..13478e979 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -290,6 +290,8 @@ $report_rating{'Call Detail Records (CDRs)'} = [ $fsurl.'search/report_cdr.html' if $curuser->access_right("Usage: Call Detail Records (CDRs)"); $report_rating{'Unrateable CDRs'} = [ $fsurl.'search/cdr.html?freesidestatus=failed;cdrbatchnum=_ALL_' ] if $curuser->access_right("Usage: Unrateable CDRs"); +$report_rating{'Customer CDRs Profit/Loss'} = [ $fsurl.'search/report_customer_cdr_profit.html', 'Profit/loss from customer CDRs' ] + if $curuser->access_right('Financial reports'); if ( $curuser->access_right("Usage: Time worked") ) { $report_rating{'Time worked'} = [ $fsurl.'search/report_rt_transaction.html', '' ]; $report_rating{'Time worked summary per ticket'} = [ $fsurl.'search/report_rt_ticket.html', '' ]; @@ -398,8 +400,6 @@ if( $curuser->access_right('Financial reports') ) { $report_financial{'Customer Accounting Summary'} = [ $fsurl.'search/report_customer_accounting_summary.html', 'Customer accounting summary report' ]; - $report_financial{'Customer Usage Profit/Loss'} = [ $fsurl.'search/report_customer_usage_profit.html', 'Customer usage profit/loss' ]; - } elsif($curuser->access_right('Receivables report')) { $report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ]; diff --git a/httemplate/search/customer_usage_profit.html b/httemplate/search/customer_cdr_profit.html similarity index 97% rename from httemplate/search/customer_usage_profit.html rename to httemplate/search/customer_cdr_profit.html index 9fcc92259..8dc06636a 100644 --- a/httemplate/search/customer_usage_profit.html +++ b/httemplate/search/customer_cdr_profit.html @@ -67,7 +67,7 @@ #warn "writing ".xl_rowcol_to_cell($r, $c)."\n"; $worksheet->write( $r, $c, $cell->{value}, $format{$f} ); } - $c++; + $c += $cell->{colspan} || 1; } #$cell $r++; } #$row @@ -119,7 +119,8 @@ as ">Excel spreadsheet <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + unless $FS::CurrentUser::CurrentUser->access_right('Financial reports') + && $FS::CurrentUser::CurrentUser->access_right('List rating data'); my ($agentnum,$sel_agent); if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { @@ -129,7 +130,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { } my $title = $sel_agent ? $sel_agent->agent.' ' : ''; -$title .= 'Customer Usage Profit/Loss Report'; +$title .= 'Customer CDRs Profit/Loss Report'; my @items = ('cust_bill_pkg_recur', 'cust_bill_pkg_recur', 'cust_bill_pkg_detail', 'cust_bill_pkg_detail' ); my @params = ( [], [ 'cost' => 1 ], [], [ 'cost' => 1 ] ); diff --git a/httemplate/search/report_customer_usage_profit.html b/httemplate/search/report_customer_cdr_profit.html similarity index 71% rename from httemplate/search/report_customer_usage_profit.html rename to httemplate/search/report_customer_cdr_profit.html index f16489b99..2a5efc3eb 100755 --- a/httemplate/search/report_customer_usage_profit.html +++ b/httemplate/search/report_customer_cdr_profit.html @@ -1,6 +1,6 @@ -<% include('/elements/header.html', 'Customer Usage Profit/Loss Report' ) %> +<% include('/elements/header.html', 'Customer CDRs Profit/Loss Report' ) %> -
+ @@ -24,6 +24,7 @@ <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + unless $FS::CurrentUser::CurrentUser->access_right('Financial reports') + && $FS::CurrentUser::CurrentUser->access_right('List rating data'); -- 2.11.0