DNS, RT#8933
[freeside.git] / httemplate / view / cust_pay.html
1 % if ( $link eq 'popup' ) { 
2
3   <% include('/elements/header-popup.html', "$thing Receipt" ) %>
4
5   <CENTER><A HREF="javascript:self.parent.location = '<% $pr_link %>'">Print</A></CENTER><BR>
6
7 % } elsif ( $link eq 'print' ) { 
8
9   <% include('/elements/header-popup.html', "$thing Receipt" ) %>
10   
11 % #it would be nice if the menubar could be hidden for print, but better to
12 % # have it available than not, otherwise the user winds up at a dead end
13   <% menubar(
14        "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
15      )
16   %>
17   <BR><BR>
18
19 % } else { 
20
21   <% include('/elements/header.html', "$thing Receipt", menubar(
22        "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum",
23        'Print receipt' => $pr_link,
24      ))
25   %>
26
27 % }
28
29 % unless ($link eq 'popup' ) {
30   <% include('/elements/small_custview.html',
31                $custnum,
32                scalar($conf->config('countrydefault')),
33                1, #no balance
34             )
35   %>
36   <BR><BR>
37 % } 
38
39 <% ntable("#cccccc", 2) %>
40
41 <TR>
42   <TD ALIGN="right">Payment#</TD>
43   <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->paynum %></B></TD>
44 </TR>
45
46 <TR>
47   <TD ALIGN="right">Date</TD>
48   <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_pay->_date %></B></TD>
49 </TR>
50
51 % if ( $void ) {
52
53   <TR>
54     <TD ALIGN="right">Void Date</TD>
55     <TD BGCOLOR="#FFFFFF"><B><% time2str"%a&nbsp;%b&nbsp;%o,&nbsp;%Y&nbsp;%r", $cust_pay->void_date %></B></TD>
56   </TR>
57
58 %#  <TR>
59 %#    <TD ALIGN="right">Void reason</TD>
60 %#    <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->reason %></B></TD>
61 %#  </TR>
62
63 % }
64
65 <TR>
66   <TD ALIGN="right">Amount</TD>
67   <TD BGCOLOR="#FFFFFF"><B><% $money_char. $cust_pay->paid %></B></TD>
68 </TR>
69
70 <TR>
71   <TD ALIGN="right">Payment method</TD>
72   <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->payby_name %> #<% $cust_pay->paymask %></B></TD>
73 </TR>
74
75 % if ( $cust_pay->payby =~ /^(CARD|CHEK|LECB)$/ && $cust_pay->paybatch ) { 
76
77     <TR>
78       <TD ALIGN="right">Processor</TD>
79       <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->processor %></B></TD>
80     </TR>
81
82     <TR>
83       <TD ALIGN="right">Authorization#</TD>
84       <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->authorization %></B></TD>
85     </TR>
86
87 %   if ( $cust_pay->order_number ) {
88       <TR>
89         <TD ALIGN="right">Order#</TD>
90         <TD BGCOLOR="#FFFFFF"><B><% $cust_pay->order_number %></B></TD>
91       </TR>
92 %   }
93
94 % }
95
96 % if ( $conf->exists('pkg-balances') && $cust_pay->pkgnum ) {
97 %   my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cust_pay->pkgnum } );
98     <TR>
99       <TD ALIGN="right">For package</TD>
100       <TD BGCOLOR="#FFFFFF"><B><% $cust_pkg->pkg_label_long %></B></TD>
101     </TR>
102
103 % }
104
105 </TABLE>
106
107 % if ( $link eq 'print' ) {
108
109   <SCRIPT TYPE="text/javascript">
110     window.print();
111   </SCRIPT>
112
113 % }
114
115 % if ( $link =~ /^(popup|print)$/ ) { 
116     </BODY>
117   </HTML>
118 % } else {
119   <% include('/elements/footer.html') %>
120 % }
121
122 <%init>
123
124 my $curuser = $FS::CurrentUser::CurrentUser;
125
126 die "access denied"
127   unless $curuser->access_right('View invoices') #remove this in 1.9 EVENTUALLY
128   || $curuser->access_right('View customer payments');
129
130 $cgi->param('paynum') =~ /^(\d+)$/ or die "no paynum";
131 my $paynum = $1;
132
133 my $link = '';
134 if ( $cgi->param('link') =~ /^(\w+)$/ ) {
135   $link = $1;
136 }
137
138 my $void = $cgi->param('void') ? 1 : 0;
139 my $thing = $void ? 'Voided Payment' : 'Payment';
140 my $table = $void ? 'cust_pay_void'  : 'cust_pay';
141
142 my $cust_pay = qsearchs({
143   'select'    => "$table.*",
144   'table'     => $table,
145   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
146   'hashref'   => { 'paynum' => $paynum },
147   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
148 });
149 die "$thing #$paynum not found!" unless $cust_pay;
150
151 my $pr_link = "${p}view/cust_pay.html?link=print;paynum=$paynum;void=$void";
152
153 my $custnum = $cust_pay->custnum;
154 my $display_custnum = $cust_pay->cust_main->display_custnum;
155
156 my $conf = new FS::Conf;
157
158 my $money_char = $conf->config('money_char') || '$';
159
160 tie my %payby, 'Tie::IxHash', FS::payby->payby2longname;
161
162 </%init>