From dbb2e37427b0edc90a633dd6a23aea57faf949ad Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 8 Aug 2016 20:20:16 -0500 Subject: RT#71969: High-priority: Add reason to cancellations details for Reports -> Packages -> Package churn --- httemplate/search/cust_pkg_churn.html | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg_churn.html b/httemplate/search/cust_pkg_churn.html index 30962c996..4c7e7e8b2 100644 --- a/httemplate/search/cust_pkg_churn.html +++ b/httemplate/search/cust_pkg_churn.html @@ -18,7 +18,7 @@ emt('Susp.'), emt('Changed'), emt('Cancel'), - #emt('Reason'), # hard to do this right + @reason_header, FS::UI::Web::cust_header( $cgi->param('cust_fields') ), @@ -45,6 +45,7 @@ ( map { time_or_blank($_) } qw( setup last_bill bill susp change_date cancel ) ), + @reason_fields, \&FS::UI::Web::cust_fields, ], 'sort_fields' => [ @@ -53,21 +54,25 @@ ('') x 3, # can't use at all # use the plain SQL column names qw( setup last_bill bill susp change_date cancel ), + @reason_blank, # cust_fields can take care of themselves ], 'color' => [ ('') x 15, + @reason_blank, FS::UI::Web::cust_colors(), ], 'style' => [ ('') x 15, + @reason_blank, FS::UI::Web::cust_styles() ], 'size' => [ '', '', '', '', '-1' ], - 'align' => 'rrlcccrrlrrrrrr'. FS::UI::Web::cust_aligns(). 'r', + 'align' => 'rrlcccrrlrrrrrr'.$reason_align. FS::UI::Web::cust_aligns(). 'r', 'links' => [ $link, $link, $link, ('') x 12, + @reason_blank, ( map { $_ ne 'Cust. Status' ? $clink : '' } FS::UI::Web::cust_header( $cgi->param('cust_fields') @@ -184,4 +189,16 @@ sub time_or_blank { }; } +my (@reason_header,@reason_fields,@reason_blank); +my $reason_align = ''; +if ($status eq 'cancel') { + push @reason_header, emt('Cancel Reason'); + push @reason_fields, sub { + my $c = shift; + my $cust_pkg_reason = $c->last_cust_pkg_reason('cancel'); + $cust_pkg_reason ? $cust_pkg_reason->reason->reason : ''; + }; + push @reason_blank, ''; + $reason_align = 'l'; +} -- cgit v1.2.1 From bcaab65d7ce645ea7fef8361fe57fbcde532b0ab Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 26 Aug 2016 15:44:02 -0700 Subject: agent-virtual contract end date report, #71964 --- httemplate/search/cust_pkg-date.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html index 1b9377546..5bb772bf6 100644 --- a/httemplate/search/cust_pkg-date.html +++ b/httemplate/search/cust_pkg-date.html @@ -36,6 +36,8 @@ my @sort_fields = ( map '', @fields ); # should only ever sort by $col push @header, FS::UI::Web::cust_header($cust_fields); push @fields, \&FS::UI::Web::cust_fields; +my $agentnums_sql = $curuser->agentnums_sql('table' => 'cust_main'); + my $query = { 'table' => 'cust_pkg', 'addl_from' => FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg'), @@ -43,11 +45,13 @@ my $query = { $col => { op => '!=', value => '' }, 'cancel' => '', }, - 'order_by' => "ORDER BY $col", + 'extra_sql' => ' AND '.$agentnums_sql, + 'order_by' => "ORDER BY $col", }; my $count_query = - "SELECT COUNT(*) FROM cust_pkg WHERE $col IS NOT NULL AND cancel IS NULL"; + "SELECT COUNT(*) FROM cust_pkg JOIN cust_main USING (custnum) ". + "WHERE $col IS NOT NULL AND cancel IS NULL AND $agentnums_sql"; my $pkg_link = sub { my $self = shift; -- cgit v1.2.1 From 501210e1bbf79d8a9d6308257124c44a261bf379 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Wed, 3 Aug 2016 23:04:05 -0500 Subject: RT#42043: Check for cancelled packages with a cancellation date age option [age_newest options] --- httemplate/edit/process/part_event.html | 4 ++-- httemplate/elements/tr-freq.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/part_event.html b/httemplate/edit/process/part_event.html index bac69241c..0293af886 100644 --- a/httemplate/edit/process/part_event.html +++ b/httemplate/edit/process/part_event.html @@ -39,8 +39,8 @@ split(/\0/, $value) }; } elsif ( $info->{'type'} eq 'freq' ) { - $value = '0' if !length($value); - $value .= $params->{$cgi_field.'_units'}; + $value = '0' if !length($value) and !$info->{'allow_blank'}; + $value .= $params->{$cgi_field.'_units'} if length($value); } #warn "value of $cgi_field is $value\n"; diff --git a/httemplate/elements/tr-freq.html b/httemplate/elements/tr-freq.html index cb58bf6b5..795684cf7 100644 --- a/httemplate/elements/tr-freq.html +++ b/httemplate/elements/tr-freq.html @@ -15,7 +15,7 @@ <% $freq eq $units ? 'SELECTED' : '' %> ><% $freq{$freq} %> % } - + <% $opt{'post_text'} || '' %> -- cgit v1.2.1 From a31ad48b7e59c261ada66682b2892c5fa3ea5ffc Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 25 Jul 2016 22:01:03 -0500 Subject: RT#71049: Add order_number to payment reports [show_order_number checkboxes] --- httemplate/search/cust_bill_pay_pkg.html | 30 ++++++++++++++-------- httemplate/search/cust_pay.html | 1 - httemplate/search/elements/cust_pay_or_refund.html | 2 +- .../search/elements/report_cust_pay_or_refund.html | 6 +++++ httemplate/search/report_cust_bill_pay_pkg.html | 7 +++++ 5 files changed, 34 insertions(+), 12 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_bill_pay_pkg.html b/httemplate/search/cust_bill_pay_pkg.html index 7c231a65d..e2ffd1258 100644 --- a/httemplate/search/cust_bill_pay_pkg.html +++ b/httemplate/search/cust_bill_pay_pkg.html @@ -14,7 +14,7 @@ #payment 'Date', - 'Order Number', + @on_header, 'By', #application @@ -44,7 +44,7 @@ ? cardtype($cust_pay->paymask) : ''; }, sub { time2str('%b %d %Y', shift->get('cust_pay_date') ) }, - sub { shift->cust_bill_pay->cust_pay->order_number }, + @on_field, sub { shift->cust_bill_pay->cust_pay->otaker }, sub { sprintf($money_char.'%.2f', shift->amount ) }, @@ -66,7 +66,7 @@ '', #payinfo/paymask '', #cardtype 'cust_pay_date', - '', #order_number + @on_null, #order_number '', #'otaker', '', #amount '', #line item description @@ -83,7 +83,7 @@ '', '', '', - '', + @on_null, '', '', '', @@ -96,10 +96,9 @@ FS::UI::Web::cust_header() ), ], - 'align' => 'rcrlrrlrlll', -#original value before cardtype & package were added -#why are there 13 cols? -#'rcrrlrlllrrcl'. + 'align' => 'rcrlr'. + $on_align. + 'lrlll'. $post_desc_align. 'rr'. FS::UI::Web::cust_aligns(), @@ -109,7 +108,7 @@ '', '', '', - '', + @on_null, '', '', '', @@ -126,7 +125,7 @@ '', '', '', - '', + @on_null, '', '', '', @@ -148,6 +147,17 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); +my @on_header = (); +my @on_field = (); +my @on_null = (); +my $on_align = ''; +if ($cgi->param('show_order_number')) { + @on_header = ('Order Number'); + @on_field = (sub { shift->cust_bill_pay->cust_pay->order_number }); + @on_null = (''); + $on_align = 'r'; +} + my $conf = new FS::Conf; my %payby = FS::payby->payby2shortname; diff --git a/httemplate/search/cust_pay.html b/httemplate/search/cust_pay.html index 536ab291f..e466f6afa 100755 --- a/httemplate/search/cust_pay.html +++ b/httemplate/search/cust_pay.html @@ -4,5 +4,4 @@ 'name_singular' => emt('payment'), 'name_verb' => emt('paid'), 'show_card_type' => 1, - 'show_order_number' => 1, &> diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html index 4ed297dac..896f0fa2d 100755 --- a/httemplate/search/elements/cust_pay_or_refund.html +++ b/httemplate/search/elements/cust_pay_or_refund.html @@ -211,7 +211,7 @@ push @links, ''; push @fields, sub { time2str('%b %d %Y', shift->_date ) }; push @sort_fields, '_date'; -if ($opt{'show_order_number'}) { +if ($cgi->param('show_order_number')) { push @header, emt('Order Number'); $align .= 'r'; push @links, ''; diff --git a/httemplate/search/elements/report_cust_pay_or_refund.html b/httemplate/search/elements/report_cust_pay_or_refund.html index 730db68e8..806746a23 100644 --- a/httemplate/search/elements/report_cust_pay_or_refund.html +++ b/httemplate/search/elements/report_cust_pay_or_refund.html @@ -151,6 +151,12 @@ Examples: 'value' => 1, &> + <& /elements/tr-checkbox.html, + 'label' => emt('Include order number'), + 'field' => 'show_order_number', + 'value' => 1, + &> + % } diff --git a/httemplate/search/report_cust_bill_pay_pkg.html b/httemplate/search/report_cust_bill_pay_pkg.html index 2347bab6d..bdcd1549e 100644 --- a/httemplate/search/report_cust_bill_pay_pkg.html +++ b/httemplate/search/report_cust_bill_pay_pkg.html @@ -41,6 +41,13 @@ field => 'paid', &> + <& /elements/tr-checkbox.html, + 'label' => emt('Display order number'), + 'field' => 'show_order_number', + 'value' => 1, + 'cell_style' => 'font-weight: normal', #for consistency + &> + Yes, transaction completed sucessfully. -% if ( $action eq 'complete' ) { +% if ( $action eq 'complete' ) {     +% if ($authorized) { + + + +% } else { +% }     - % } + + @@ -156,6 +165,8 @@ my $cust_pay_pending = }) or die 'unknown paypendingnum'; +my $authorized = ($cust_pay_pending->status eq 'authorized') ? 1 : 0; + my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; diff --git a/httemplate/edit/process/cust_pay_pending.html b/httemplate/edit/process/cust_pay_pending.html index 1bad6cffe..0ff7d26d0 100644 --- a/httemplate/edit/process/cust_pay_pending.html +++ b/httemplate/edit/process/cust_pay_pending.html @@ -59,6 +59,15 @@ if ( $action eq 'delete' ) { $title = 'Pending payment completed (decline)'; } +} elsif ( $action eq 'reverse' ) { + + $error = $cust_pay_pending->reverse; + if ( $error ) { + $title = 'Error reversing pending payment'; + } else { + $title = 'Pending payment completed (reverse)'; + } + } else { die "unknown action $action"; diff --git a/httemplate/search/cust_pay_pending.html b/httemplate/search/cust_pay_pending.html index 942085c6c..52646265b 100755 --- a/httemplate/search/cust_pay_pending.html +++ b/httemplate/search/cust_pay_pending.html @@ -17,7 +17,7 @@ my %statusaction = ( 'new' => 'delete', 'pending' => 'complete', - #'authorized' => '', + 'authorized' => 'complete', 'captured' => 'capture', #'declined' => '', #wouldn't need to take action on a done state#'done' diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html index 896f0fa2d..cbda680ca 100755 --- a/httemplate/search/elements/cust_pay_or_refund.html +++ b/httemplate/search/elements/cust_pay_or_refund.html @@ -91,29 +91,30 @@ my $title = ''; $title = 'Unapplied ' if $unapplied; $title .= "\u$name_singular Search Results"; -my $link = ''; -if ( ( $curuser->access_right('View invoices') #remove in 2.5 (2.7?) - || ($curuser->access_right('View payments') && $table =~ /^cust_pay/) - || ($curuser->access_right('View refunds') && $table eq 'cust_refund') - ) - && ! $opt{'disable_link'} - ) -{ - - my $key; - my $q = ''; - if ( $table eq 'cust_pay_void' ) { - $key = 'paynum'; - $q .= 'void=1;'; - } elsif ( $table eq /^cust_(\w+)$/ ) { - $key = $1.'num'; - } - - if ( $key ) { - $q .= "$key="; - $link = [ "${p}view/$table.html?$q", $key ] - } -} +###NOT USED??? +#my $link = ''; +#if ( ( $curuser->access_right('View invoices') #remove in 2.5 (2.7?) +# || ($curuser->access_right('View payments') && $table =~ /^cust_pay/) +# || ($curuser->access_right('View refunds') && $table eq 'cust_refund') +# ) +# && ! $opt{'disable_link'} +# ) +#{ +# +# my $key; +# my $q = ''; +# if ( $table eq 'cust_pay_void' ) { +# $key = 'paynum'; +# $q .= 'void=1;'; +# } elsif ( $table eq /^cust_(\w+)$/ ) { +# $key = $1.'num'; +# } +# +# if ( $key ) { +# $q .= "$key="; +# $link = [ "${p}view/$table.html?$q", $key ] +# } +#} my $cust_link = sub { my $cust_thing = shift; @@ -166,12 +167,18 @@ if ( $opt{'pre_header'} ) { push @sort_fields, @{ $opt{'pre_fields'} }; } -my $sub_receipt = sub { +my $sub_receipt = $opt{'disable_link'} ? '' : sub { my $obj = shift; my $objnum = $obj->primary_key . '=' . $obj->get($obj->primary_key); + my $table = $obj->table; + my $void = ''; + if ($table eq 'cust_pay_void') { + $table = 'cust_pay'; + $void = ';void=1'; + } include('/elements/popup_link_onclick.html', - 'action' => $p.'view/cust_pay.html?link=popup;'.$objnum, + 'action' => $p.'view/'.$table.'.html?link=popup;'.$objnum.$void, 'actionlabel' => emt('Payment Receipt'), ); }; diff --git a/httemplate/view/cust_main/payment_history/pending_payment.html b/httemplate/view/cust_main/payment_history/pending_payment.html index 31149231b..cf7ef7c08 100644 --- a/httemplate/view/cust_main/payment_history/pending_payment.html +++ b/httemplate/view/cust_main/payment_history/pending_payment.html @@ -12,6 +12,7 @@ my %statusaction = ( 'new' => 'delete', 'thirdparty' => 'delete', 'pending' => 'complete', + 'authorized' => 'complete', 'captured' => 'capture', ); -- cgit v1.2.1 From b6cbc6cc5b933c08bf4f1132df7aee7910636295 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Thu, 4 Aug 2016 21:07:24 -0500 Subject: RT#71930: Package fields are not showing up in...Advanced wireless broadband report --- httemplate/search/svc_broadband.cgi | 39 ++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_broadband.cgi b/httemplate/search/svc_broadband.cgi index 8cdf29d1c..0e52d5fb6 100755 --- a/httemplate/search/svc_broadband.cgi +++ b/httemplate/search/svc_broadband.cgi @@ -10,6 +10,7 @@ 'Router', @tower_header, 'IP Address', + @header_pkg, emt('Pkg. Status'), FS::UI::Web::cust_header($cgi->param('cust_fields')), ], @@ -21,6 +22,7 @@ }, @tower_fields, 'ip_addr', + @fields_pkg, sub { $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg; return '' unless $cust_pkg_cache{$_[0]->svcnum}; @@ -32,20 +34,25 @@ $link, '', #$link_router, (map '', @tower_fields), - $link, + $link, # ip_addr + @blank_pkg, '', # pkg status ( map { $_ ne 'Cust. Status' ? $link_cust : '' } FS::UI::Web::cust_header($cgi->param('cust_fields')) ), ], - 'align' => 'rll'.('r' x @tower_fields).'rr'. + 'align' => 'rll'.('r' x @tower_fields). + 'r'. # ip_addr + $align_pkg. + 'r'. # pkg status FS::UI::Web::cust_aligns(), 'color' => [ '', '', '', (map '', @tower_fields), - '', + '', # ip_addr + @blank_pkg, sub { $cust_pkg_cache{$_[0]->svcnum} ||= $_[0]->cust_svc->cust_pkg; return '' unless $cust_pkg_cache{$_[0]->svcnum}; @@ -59,8 +66,9 @@ '', '', (map '', @tower_fields), - '', - 'b', + '', # ip_addr + @blank_pkg, + 'b', # pkg status FS::UI::Web::cust_styles(), ], @@ -129,4 +137,25 @@ $html_init .= ' | ' . $fsurl . 'search/svc_broadband-map.html?' . $cgi->query_string . '">' . emt('View a map of these services') . ''; +my (@header_pkg,@fields_pkg,@blank_pkg); +my $align_pkg = ''; +#false laziness with search/svc_acct.cgi +$cgi->param('cust_pkg_fields') =~ /^([\w\,]*)$/ or die "bad cust_pkg_fields"; +my @pkg_fields = split(',', $1); +foreach my $pkg_field ( @pkg_fields ) { + ( my $header = ucfirst($pkg_field) ) =~ s/_/ /; #:/ + push @header_pkg, $header; + + #not the most efficient to do it every field, but this is of niche use. so far + push @fields_pkg, sub { my $svc_x = shift; + my $cust_pkg = $svc_x->cust_svc->cust_pkg or return ''; + my $value = $cust_pkg->get($pkg_field);#closures help alot + $value ? time2str('%b %d %Y', $value ) : ''; + }; + + push @blank_pkg, ''; + $align_pkg .= 'c'; +} + + -- cgit v1.2.1 From 7258c57a184360cf89730f81db915791c389c7e7 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 30 Aug 2016 12:24:36 -0700 Subject: add agent and cust-fields selection to package contract end date report, #71964 --- httemplate/elements/menu.html | 2 +- httemplate/search/cust_pkg-date.html | 34 ++++++++++++++++---------- httemplate/search/report_cust_pkg-date.html | 38 +++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 14 deletions(-) create mode 100755 httemplate/search/report_cust_pkg-date.html (limited to 'httemplate') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 582dda622..cdb1d733c 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -274,7 +274,7 @@ $report_packages{'Suspension summary'} = [ $fsurl.'search/cust_pkg_susp.html', ' $report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ]; $report_packages{'FCC Form 477'} = [ $fsurl.'search/report_477.html' ] if $conf->exists('part_pkg-show_fcc_options'); -$report_packages{'Contract end dates'} = [ $fsurl.'search/cust_pkg-date.html?date=contract_end', 'Show packages by contract end date' ]; +$report_packages{'Contract end dates'} = [ $fsurl.'search/report_cust_pkg-date.html?date=contract_end', 'Show packages by contract end date' ]; $report_packages{'Advanced package reports'} = [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ]; tie my %report_inventory, 'Tie::IxHash', diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html index 5bb772bf6..231bbac16 100644 --- a/httemplate/search/cust_pkg-date.html +++ b/httemplate/search/cust_pkg-date.html @@ -1,3 +1,16 @@ +<& elements/search.html, + 'title' => $title, + 'name' => 'packages', + 'query' => $query, + 'count_query' => $count_query, + 'header' => \@header, + 'fields' => \@fields, + 'align' => 'rrrl'. FS::UI::Web::cust_aligns(), + 'color' => \@color, + 'style' => \@style, + 'links' => \@links, + 'cell_style' => [ $date_color_sub ], +&> <%init> my $curuser = $FS::CurrentUser::CurrentUser; die 'access denied' unless $curuser->access_right('List packages'); @@ -18,8 +31,7 @@ my $col = $cgi->param('date'); die "invalid date column" unless $cols{$col}; my $title = 'Packages by ' . lc($cols{$col}) . ' date'; -# second option on the cust_fields_avail list, plus email -my $cust_fields = 'Cust# | Customer | Day phone | Night phone | Mobile phone | Invoicing email(s)'; +my $cust_fields = $cgi->param('cust_fields'); my @header = ( $cols{$col}, emt('#'), emt('Quan.'), @@ -32,11 +44,18 @@ my @fields = ( sub { time2str('%b %d %Y', $_[0]->$col) }, 'pkg_label', ); my @sort_fields = ( map '', @fields ); # should only ever sort by $col +my @color = ( map '', @fields ); +my @style = ( map '', @fields ); push @header, FS::UI::Web::cust_header($cust_fields); push @fields, \&FS::UI::Web::cust_fields; +push @color, FS::UI::Web::cust_colors(); +push @style, FS::UI::Web::cust_styles(); my $agentnums_sql = $curuser->agentnums_sql('table' => 'cust_main'); +if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) { + $agentnums_sql .= " AND agentnum = $1"; +} my $query = { 'table' => 'cust_pkg', @@ -80,15 +99,4 @@ my $date_color_sub = sub { }; -<& elements/search.html, - 'title' => $title, - 'name' => 'packages', - 'query' => $query, - 'count_query' => $count_query, - 'header' => \@header, - 'fields' => \@fields, - 'align' => 'rrrl'. FS::UI::Web::cust_aligns(), - 'links' => \@links, - 'cell_style' => [ $date_color_sub ], -&> diff --git a/httemplate/search/report_cust_pkg-date.html b/httemplate/search/report_cust_pkg-date.html new file mode 100755 index 000000000..ceb9a9c75 --- /dev/null +++ b/httemplate/search/report_cust_pkg-date.html @@ -0,0 +1,38 @@ +<& /elements/header.html, mt($title) &> + +
+ + + + + <& /elements/tr-select-agent.html, + 'curr_value' => scalar( $cgi->param('agentnum') ), + 'disable_empty' => 0, + &> + + <& /elements/tr-select-cust-fields.html &> + +
+ +
+ + +
+ +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List packages'); + +# for the page title +my %cols = ( + 'contract_end' => 'Contract end' +); + +# or let the column be selected here? +my $col = $cgi->param('date'); +die "invalid date column" unless $cols{$col}; +my $title = 'Packages by ' . lc($cols{$col}) . ' date'; + + -- cgit v1.2.1 From b44c17c7d9686e3a0227f15a567fe39de508160f Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 30 Aug 2016 16:01:48 -0700 Subject: fix cust-fields, #71964 --- httemplate/search/cust_pkg-date.html | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html index 231bbac16..22a67402b 100644 --- a/httemplate/search/cust_pkg-date.html +++ b/httemplate/search/cust_pkg-date.html @@ -5,6 +5,7 @@ 'count_query' => $count_query, 'header' => \@header, 'fields' => \@fields, + 'sort_fields' => [], 'align' => 'rrrl'. FS::UI::Web::cust_aligns(), 'color' => \@color, 'style' => \@style, @@ -31,7 +32,6 @@ my $col = $cgi->param('date'); die "invalid date column" unless $cols{$col}; my $title = 'Packages by ' . lc($cols{$col}) . ' date'; -my $cust_fields = $cgi->param('cust_fields'); my @header = ( $cols{$col}, emt('#'), emt('Quan.'), @@ -43,14 +43,25 @@ my @fields = ( sub { time2str('%b %d %Y', $_[0]->$col) }, 'quantity', 'pkg_label', ); -my @sort_fields = ( map '', @fields ); # should only ever sort by $col my @color = ( map '', @fields ); my @style = ( map '', @fields ); -push @header, FS::UI::Web::cust_header($cust_fields); +my $pkg_link = sub { + my $self = shift; + my $frag = 'cust_pkg'. $self->pkgnum; + [ "${p}view/cust_main.cgi?custnum=".$self->custnum. + ";show=packages;fragment=$frag#cust_pkg", + 'pkgnum' + ]; +}; + +my @links = ( '', ($pkg_link) x 3 ); + +push @header, FS::UI::Web::cust_header($cgi->param('cust_fields')); push @fields, \&FS::UI::Web::cust_fields; -push @color, FS::UI::Web::cust_colors(); -push @style, FS::UI::Web::cust_styles(); +push @color, FS::UI::Web::cust_colors(); +push @style, FS::UI::Web::cust_styles(); +push @links, FS::UI::Web::cust_links(); my $agentnums_sql = $curuser->agentnums_sql('table' => 'cust_main'); if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) { @@ -58,6 +69,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) { } my $query = { + 'select' => join(',', 'cust_pkg.*', FS::UI::Web::cust_sql_fields() ), 'table' => 'cust_pkg', 'addl_from' => FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg'), 'hashref' => { @@ -72,17 +84,6 @@ my $count_query = "SELECT COUNT(*) FROM cust_pkg JOIN cust_main USING (custnum) ". "WHERE $col IS NOT NULL AND cancel IS NULL AND $agentnums_sql"; -my $pkg_link = sub { - my $self = shift; - my $frag = 'cust_pkg'. $self->pkgnum; - [ "${p}view/cust_main.cgi?custnum=".$self->custnum. - ";show=packages;fragment=$frag#cust_pkg", - 'pkgnum' - ]; -}; - -my @links = ( '', ($pkg_link) x 3, - FS::UI::Web::cust_links() ); my $date_color_sub = sub { my $self = shift; -- cgit v1.2.1 From f61619b95f05b576518ea698ad7e22267b4c36c4 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Tue, 9 Aug 2016 00:55:45 -0500 Subject: RT#71890: SelfService API: Return monthly recurring fee [display_recurring, v3 reconcile] --- httemplate/view/cust_main/billing.html | 73 ++-------------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index 3d0983e67..eed3baf4b 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -28,79 +28,12 @@ % # customer base, and compare it to a graph of the overhead for generating this % # information. (and optimize it better, we could get it more from SQL) % if ( $cust_main->num_ncancelled_pkgs < 54 ) { -% my $sth = dbh->prepare(" -% SELECT DISTINCT freq FROM cust_pkg LEFT JOIN part_pkg USING (pkgpart) -% WHERE freq IS NOT NULL AND freq != '0' -% AND ( cancel IS NULL OR cancel = 0 ) -% AND custnum = ? -% ") or die $DBI::errstr; -% -% $sth->execute($cust_main->custnum) or die $sth->errstr; - -% #not really a numeric sort because freqs can actually be all sorts of things -% # but good enough for the 99% cases of ordering monthly quarterly annually -% my @freqs = sort { $a <=> $b } map { $_->[0] } @{ $sth->fetchall_arrayref }; -% -% foreach my $freq (@freqs) { -% my @cust_pkg = qsearch({ -% 'table' => 'cust_pkg', -% 'addl_from' => 'LEFT JOIN part_pkg USING (pkgpart)', -% 'hashref' => { 'custnum' => $cust_main->custnum, }, -% 'extra_sql' => 'AND ( cancel IS NULL OR cancel = 0 ) -% AND freq = '. dbh->quote($freq), -% 'order_by' => 'ORDER BY COALESCE(start_date,0), pkgnum', # to ensure old pkgs come before change_to_pkg -% }) or next; -% -% my $freq_pretty = $cust_pkg[0]->part_pkg->freq_pretty; -% -% my $amount = 0; -% my $skip_pkg = {}; -% foreach my $cust_pkg (@cust_pkg) { -% my $part_pkg = $cust_pkg->part_pkg; -% next if $cust_pkg->susp -% && ! $cust_pkg->option('suspend_bill') -% && ( ! $part_pkg->option('suspend_bill') -% || $cust_pkg->option('no_suspend_bill') -% ); -% -% #pkg change handling -% next if $skip_pkg->{$cust_pkg->pkgnum}; -% if ($cust_pkg->change_to_pkgnum) { -% #if change is on or before next bill date, use new pkg -% next if $cust_pkg->expire <= $cust_pkg->bill; -% #if change is after next bill date, use old (this) pkg -% $skip_pkg->{$cust_pkg->change_to_pkgnum} = 1; -% } -% -% my $pkg_amount = 0; -% -% #add recurring amounts for this package and its billing add-ons -% foreach my $l_part_pkg ( $part_pkg->self_and_bill_linked ) { -% $pkg_amount += $l_part_pkg->base_recur($cust_pkg); -% } -% -% #subtract amounts for any active discounts -% #(there should only be one at the moment, otherwise this makes no sense) -% foreach my $cust_pkg_discount ( $cust_pkg->cust_pkg_discount_active ) { -% my $discount = $cust_pkg_discount->discount; -% #and only one of these for each -% $pkg_amount -= $discount->amount; -% $pkg_amount -= $amount * $discount->percent/100; -% } -% -% $pkg_amount *= ( $cust_pkg->quantity || 1 ); -% -% $amount += $pkg_amount; -% -% } - +% foreach my $freq_info ($cust_main->display_recurring) { - <% emt( ucfirst($freq_pretty). ' recurring' ) %> - <% $money_char. sprintf('%.2f', $amount) %> - + <% emt( ucfirst($freq_info->{'freq_pretty'}). ' recurring' ) %> + <% $money_char. sprintf('%.2f', $freq_info->{'amount'}) %> % } - % } % if ( $conf->exists('cust_main-select-prorate_day') ) { -- cgit v1.2.1 From 259777e4667fc8a45496ba2805d1f7e01c75ac7b Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Wed, 31 Aug 2016 22:26:32 -0500 Subject: RT#71890: SelfService API: Return monthly recurring fee [display_recurring, v3 reconcile bug fix] --- httemplate/view/cust_main/billing.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html index eed3baf4b..7be320131 100644 --- a/httemplate/view/cust_main/billing.html +++ b/httemplate/view/cust_main/billing.html @@ -30,8 +30,8 @@ % if ( $cust_main->num_ncancelled_pkgs < 54 ) { % foreach my $freq_info ($cust_main->display_recurring) { - <% emt( ucfirst($freq_info->{'freq_pretty'}). ' recurring' ) %> - <% $money_char. sprintf('%.2f', $freq_info->{'amount'}) %> + <% emt( ucfirst($freq_info->{'freq_pretty'}). ' recurring' ) %> + <% $money_char. sprintf('%.2f', $freq_info->{'amount'}) %> % } % } -- cgit v1.2.1 From 0b8f014e86b3464cca92fd925159e457ae54c2b8 Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Sat, 6 Aug 2016 00:10:39 -0500 Subject: RT#71696: OFM Request for additional action on Billing Events --- httemplate/elements/select-rt-queue.html | 2 +- httemplate/elements/tr-select-rt-queue.html | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 httemplate/elements/tr-select-rt-queue.html (limited to 'httemplate') diff --git a/httemplate/elements/select-rt-queue.html b/httemplate/elements/select-rt-queue.html index 4ae8bc942..289336516 100644 --- a/httemplate/elements/select-rt-queue.html +++ b/httemplate/elements/select-rt-queue.html @@ -1,4 +1,4 @@ -> % while ( @fields ) { % my $value = shift @fields; % my $label = shift @fields; diff --git a/httemplate/elements/tr-select-rt-queue.html b/httemplate/elements/tr-select-rt-queue.html new file mode 100644 index 000000000..ac3689b1c --- /dev/null +++ b/httemplate/elements/tr-select-rt-queue.html @@ -0,0 +1,7 @@ + +<& 'tr-td-label.html', @_ &> + +<& 'select-rt-queue.html', @_ &> + + + -- cgit v1.2.1