From b00657d2dd62614568501df47d1be4cbfa15eb48 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 27 Jul 2009 09:07:24 +0000 Subject: [PATCH 1/1] voided payment report, RT#5786 --- httemplate/elements/menu.html | 32 ++++++++++++++++------ httemplate/search/cust_pay_void.html | 13 +++++++++ httemplate/search/elements/cust_pay_or_refund.html | 4 ++- httemplate/search/report_cust_pay.html | 8 ++++-- httemplate/view/cust_pay.html | 32 +++++++++++++++++----- httemplate/view/cust_pay_void.html | 1 + 6 files changed, 72 insertions(+), 18 deletions(-) create mode 100755 httemplate/search/cust_pay_void.html create mode 100644 httemplate/view/cust_pay_void.html diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 999fa43ea..6b256c8d8 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -135,10 +135,19 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) { } if ( $svcdb eq 'svc_acct' ) { + $report_svc{"All $lcname never logged in"} = [ svc_url( %svc_url, 'query' => "magic=nologin;sortby=svcnum" ), '', ]; + + } elsif ( $svcdb eq 'svc_phone' ) { + + $report_svc{"${name}' total usage by time period"} = + [ $fsurl. 'search/report_svc_phone.html', + 'Total usage (minutes, and amount billed) for the specified time period, per phone number.', + ]; + } if ( $curuser->access_right('View/link unlinked services') ) { @@ -204,9 +213,20 @@ tie my %report_ticketing, 'Tie::IxHash', tie my %report_bill_event, 'Tie::IxHash', 'All billing events' => [ $fsurl.'search/report_cust_event.html', 'All billing events for a date range' ], 'Billing event errors' => [ $fsurl.'search/report_cust_event.html?failed=1', 'Failed credit cards, processor or printer problems, etc.' ], - 'All invoice events' => [ $fsurl.'search/cust_bill_event.html', 'Reports on deprecated, old-style invoice events for a date range' ], - 'Invoice event errors' => [ $fsurl.'search/cust_bill_event.html?failed=1', 'Reports on deprecated, old-style events for failed credit cards, processor or printer problems, etc.' ], +# 'All invoice events' => [ $fsurl.'search/cust_bill_event.html', 'Reports on deprecated, old-style invoice events for a date range' ], +# 'Invoice event errors' => [ $fsurl.'search/cust_bill_event.html?failed=1', 'Reports on deprecated, old-style events for failed credit cards, processor or printer problems, etc.' ], +; + +tie my %report_payments, 'Tie::IxHash', + 'Payments' => [ $fsurl.'search/report_cust_pay.html', 'Payment report (by type and/or date range)' ], ; +$report_payments{'Pending Payments'} = [ $fsurl.'search/cust_pay_pending.html?magic=_date;statusNOT=done', 'Pending real-time payments' ] + if $curuser->access_right('View customer pending payments'); +$report_payments{'Voided Payments'} = [ $fsurl.'search/report_cust_pay.html?void=1', 'Voided payment report (by type and/or date range)' ] + if $curuser->access_right('View customer pending payments'); +$report_payments{'Payment Batches'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ] + if $conf->exists('batch-enable') || $conf->config('batch-enable_payby'); +$report_payments{'Unapplied Payment Aging'} = [ $fsurl.'search/report_unapplied_cust_pay.html', 'Unapplied payment aging report' ]; tie my %report_financial, 'Tie::IxHash'; if($curuser->access_right('Financial reports')) { @@ -215,13 +235,7 @@ if($curuser->access_right('Financial reports')) { 'Sales, Credits and Receipts' => [ $fsurl.'graph/report_money_time.html', 'Sales, credits and receipts summary graph' ], 'Sales Report' => [ $fsurl.'graph/report_cust_bill_pkg.html', 'Sales report and graph (by agent, package class and/or date range)' ], 'Credit Report' => [ $fsurl.'search/report_cust_credit.html', 'Credit report (by employee and/or date range)' ], - 'Payment Report' => [ $fsurl.'search/report_cust_pay.html', 'Payment report (by type and/or date range)' ], ); - $report_financial{'Pending Payment Report'} = [ $fsurl.'search/cust_pay_pending.html?magic=_date;statusNOT=done', 'Pending real-time payments' ] - if $curuser->access_right('View customer pending payments'); - $report_financial{'Payment Batch Report'} = [ $fsurl.'search/pay_batch.html', 'Payment batches (by status and/or date range)' ] - if $conf->exists('batch-enable') || $conf->config('batch-enable_payby'); - $report_financial{'Unapplied payment Aging'} = [ $fsurl.'search/report_unapplied_cust_pay.html', 'Unapplied payment aging report' ]; $report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ]; $report_financial{'Prepaid Income'} = [ $fsurl.'search/report_prepaid_income.html', 'Prepaid income (unearned revenue) report' ]; $report_financial{'Sales Tax Liability'} = [ $fsurl.'search/report_tax.html', 'Sales tax liability report (internal taxclass system)' ]; @@ -239,6 +253,8 @@ $report_menu{'Customers'} = [ \%report_customers, 'Customer reports' ] if $curuser->access_right('List customers'); $report_menu{'Invoices'} = [ \%report_invoices, 'Invoice reports' ] if $curuser->access_right('List invoices'); +$report_menu{'Payments'} = [ \%report_payments, 'Payment reports' ] + if $curuser->access_right('Financial reports'); $report_menu{'Packages'} = [ \%report_packages, 'Package reports' ] if $curuser->access_right('List packages'); $report_menu{'Services'} = [ \%report_services, 'Services reports' ] diff --git a/httemplate/search/cust_pay_void.html b/httemplate/search/cust_pay_void.html new file mode 100755 index 000000000..431bb2c6b --- /dev/null +++ b/httemplate/search/cust_pay_void.html @@ -0,0 +1,13 @@ +<% include( 'elements/cust_pay_or_refund.html', + 'thing' => 'pay_void', + 'amount_field' => 'paid', + 'name_singular' => 'voided payment', + 'name_verb' => 'voided', # 'paid', + 'disable_by' => 1, #showing original not voiding otaker + 'addl_header' => [ 'Void Date', ], # 'Void Reason' ], + 'addl_fields' => [ + sub { time2str('%b %d %Y', shift->void_date ) }, + #'reason', + ], + ) +%> diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html index add8427ca..acd57912f 100755 --- a/httemplate/search/elements/cust_pay_or_refund.html +++ b/httemplate/search/elements/cust_pay_or_refund.html @@ -288,7 +288,9 @@ if ( ( $curuser->access_right('View invoices') #XXX for now && ! $opt{'disable_link'} ) { - $link = [ "${p}view/cust_$thing.html?${thing}num=", $thing.'num' ] + my $key = $thing eq 'pay_void' ? 'paynum' : $thing.'num'; + my $q = ( $thing eq 'pay_void' ? 'void=1;' : '' ). "$key="; + $link = [ "${p}view/cust_$thing.html?$q", $key ] } my $cust_link = sub { diff --git a/httemplate/search/report_cust_pay.html b/httemplate/search/report_cust_pay.html index 06271313f..a9695acb7 100644 --- a/httemplate/search/report_cust_pay.html +++ b/httemplate/search/report_cust_pay.html @@ -1,6 +1,6 @@ -<% include('/elements/header.html', 'Payment report' ) %> +<% include('/elements/header.html', $title ) %> -
+ @@ -76,4 +76,8 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); +my $void = $cgi->param('void') ? 1 : 0; + +my $title = $void ? 'Voided payment report' : 'Payment report'; + diff --git a/httemplate/view/cust_pay.html b/httemplate/view/cust_pay.html index c36d76904..a5c99ac55 100644 --- a/httemplate/view/cust_pay.html +++ b/httemplate/view/cust_pay.html @@ -1,12 +1,12 @@ % if ( $link eq 'popup' ) { - <% include('/elements/header-popup.html', "Payment Receipt" ) %> + <% include('/elements/header-popup.html', "$thing Receipt" ) %>
Print

% } elsif ( $link eq 'print' ) { - <% include('/elements/header-popup.html', "Payment Receipt" ) %> + <% include('/elements/header-popup.html', "$thing Receipt" ) %> % #it would be nice if the menubar could be hidden for print, but better to % # have it available than not, otherwise the user winds up at a dead end @@ -18,7 +18,7 @@ % } else { - <% include('/elements/header.html', "Payment Receipt", menubar( + <% include('/elements/header.html', "$thing Receipt", menubar( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", 'Print receipt' => $pr_link, )) @@ -48,6 +48,20 @@ +% if ( $void ) { + + + + + + +%# +%# +%# +%# + +% } + @@ -112,16 +126,20 @@ if ( $cgi->param('link') =~ /^(\w+)$/ ) { $link = $1; } +my $void = $cgi->param('void') ? 1 : 0; +my $thing = $void ? 'Voided Payment' : 'Payment'; +my $table = $void ? 'cust_pay_void' : 'cust_pay'; + my $cust_pay = qsearchs({ - 'select' => 'cust_pay.*', - 'table' => 'cust_pay', + 'select' => "$table.*", + 'table' => $table, 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'paynum' => $paynum }, 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, }); -die "Payment #$paynum not found!" unless $cust_pay; +die "$thing #$paynum not found!" unless $cust_pay; -my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum"; +my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void"; my $custnum = $cust_pay->custnum; my $display_custnum = $cust_pay->cust_main->display_custnum; diff --git a/httemplate/view/cust_pay_void.html b/httemplate/view/cust_pay_void.html new file mode 100644 index 000000000..8c22170d6 --- /dev/null +++ b/httemplate/view/cust_pay_void.html @@ -0,0 +1 @@ +<% include('cust_pay.html', @_, 'void' => 1 ) %> -- 2.11.0
<% time2str"%a %b %o, %Y %r", $cust_pay->_date %>
Void Date<% time2str"%a %b %o, %Y %r", $cust_pay->void_date %>
Void reason<% $cust_pay->reason %>
Amount <% $money_char. $cust_pay->paid %>