voided payment report, RT#5786
authorivan <ivan>
Mon, 27 Jul 2009 09:07:24 +0000 (09:07 +0000)
committerivan <ivan>
Mon, 27 Jul 2009 09:07:24 +0000 (09:07 +0000)
httemplate/elements/menu.html
httemplate/search/cust_pay_void.html [new file with mode: 0755]
httemplate/search/elements/cust_pay_or_refund.html
httemplate/search/report_cust_pay.html
httemplate/view/cust_pay.html
httemplate/view/cust_pay_void.html [new file with mode: 0644]

index 999fa43..6b256c8 100644 (file)
@@ -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 (executable)
index 0000000..431bb2c
--- /dev/null
@@ -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',
+                ],
+          )
+%>
index add8427..acd5791 100755 (executable)
@@ -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 {
index 0627131..a9695ac 100644 (file)
@@ -1,6 +1,6 @@
-<% include('/elements/header.html', 'Payment report' ) %>
+<% include('/elements/header.html', $title ) %>
 
-<FORM ACTION="cust_pay.cgi" METHOD="GET">
+<FORM ACTION="<% $void ? 'cust_pay_void.html' : 'cust_pay.cgi' %>" METHOD="GET">
 <INPUT TYPE="hidden" NAME="magic" VALUE="_date">
 
 <TABLE>
@@ -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';
+
 </%init>
index c36d769..a5c99ac 100644 (file)
@@ -1,12 +1,12 @@
 % if ( $link eq 'popup' ) { 
 
-  <% include('/elements/header-popup.html', "Payment Receipt" ) %>
+  <% include('/elements/header-popup.html', "$thing Receipt" ) %>
 
   <CENTER><A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A></CENTER><BR>
 
 % } 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,
      ))
   <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_pay->_date %></B></TD>
 </TR>
 
+% if ( $void ) {
+
+  <TR>
+    <TD ALIGN="right">Void Date</TD>
+    <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_pay->void_date %></B></TD>
+  </TR>
+
+%#  <TR>
+%#    <TD ALIGN="right">Void reason</TD>
+%#    <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->reason %></B></TD>
+%#  </TR>
+
+% }
+
 <TR>
   <TD ALIGN="right">Amount</TD>
   <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay->paid %></B></TD>
@@ -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 (file)
index 0000000..8c22170
--- /dev/null
@@ -0,0 +1 @@
+<% include('cust_pay.html', @_, 'void' => 1 ) %>