fix net sales amount (credits were being applied in wrong month), RT#7502
[freeside.git] / httemplate / misc / cancel_cust.html
1 <% include('/elements/header-popup.html', 'Cancel customer' ) %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME="cust_cancel_popup" ACTION="<% popurl(1) %>cust_main-cancel.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
7
8
9  <P ALIGN="center"><B>Permanently delete all services and cancel this customer?</B>
10
11  <% $ban %>
12  
13 <BR><BR>
14
15 <% ntable("#cccccc", 2) %>
16
17 <% include('/elements/tr-select-reason.html', 'reasonnum', 'C', $reasonnum, '', '', "document.getElementById('confirm_cancel_cust_button')",
18           )
19 %>
20
21 </TABLE>
22
23 <BR>
24 <P ALIGN="CENTER">
25 <INPUT TYPE="submit" NAME="submit" ID="confirm_cancel_cust_button" VALUE="Cancel customer" DISABLED> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE="BUTTON" VALUE="Don't cancel" onClick="parent.cClick();"> 
26
27 </FORM>
28 </BODY>
29 </HTML>
30
31 <%init>
32
33 $cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum';
34 my $custnum = $1;
35
36 my $reasonnum = '';
37 if ( $cgi->param('error') ) {
38   $reasonnum = $cgi->param('reasonnum');
39 }
40
41 my $curuser = $FS::CurrentUser::CurrentUser;
42
43 die "access denied" unless $curuser->access_right('Cancel customer');
44
45 my $cust_main = qsearchs( {
46   'table'     => 'cust_main',
47   'hashref'   => { 'custnum' => $custnum },
48   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
49 } );
50 die "No customer # $custnum" unless $cust_main;
51
52 my $ban = '';
53 if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) {
54   $ban = '<BR><P ALIGN="center">'.
55          '<INPUT TYPE="checkbox" NAME="ban" VALUE="1"> Ban this customer\'s ';
56   if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) {
57     $ban .= 'credit card';
58   } elsif (  $cust_main->payby =~ /^(CHEK|DCHK)$/ ) {
59     $ban .= 'ACH account';
60   }
61 }
62
63 </%init>
64