Optimize "Customer has a referring customer" condition, RT#74452
[freeside.git] / httemplate / edit / cust_pay-pkgnum.html
1 <& /elements/header-popup.html, 'Change payment package' &>
2
3 <& /elements/error.html &>
4
5 <FORM NAME="PaymentForm" ACTION="<% popurl(1) %>process/cust_pay-pkgnum.html" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="paynum" VALUE="<% $cust_pay->paynum %>">
7
8 <BR>
9
10 <% mt('Payment') |h %> 
11 <% ntable("#cccccc", 2) %>
12
13 <TR>
14   <TD ALIGN="right"><% mt('Date') |h %></TD>
15   <TD COLSPAN=2 BGCOLOR="#eeeeee"><% time2str($date_format.' %r',$cust_pay->_date) |h %>
16   </TD>
17 </TR>
18
19 <TR>
20   <TD ALIGN="right"><% mt('Amount') |h %></TD>
21   <TD COLSPAN=2 BGCOLOR="#eeeeee">
22    <% $money_char. $cust_pay->paid %>
23    <% mt('by') |h %>
24    <B><% mt(FS::payby->payname($cust_pay->payby)) |h %></B></TD>
25 </TR>
26
27 % if ( $cust_pay->payby eq 'BILL' ) { 
28   <TR>
29     <TD ALIGN="right"><% mt('Check #') |h %></TD>
30     <TD COLSPAN=2><% $cust_pay->payinfo |h %></TD>
31   </TR>
32 % } elsif ( $cust_pay->payby eq 'CASH' and $conf->exists('require_cash_deposit_info') ) {
33   <TR>
34     <TD ALIGN="right"><% mt('Bank') |h %></TD>
35     <TD COLSPAN=3><% $cust_pay->bank |h %></TD>
36   </TR>
37   <TR>
38     <TD ALIGN="right"><% mt('Check #') |h %></TD>
39     <TD COLSPAN=2><% $cust_pay->payinfo |h %></TD>
40   </TR>
41   <TR>
42     <TD ALIGN="right"><% mt('Teller #') |h %></TD>
43     <TD COLSPAN=2><% $cust_pay->teller |h %></TD>
44   </TR>
45   <TR>
46     <TD ALIGN="right"><% mt('Depositor') |h %></TD>
47     <TD COLSPAN=3><% $cust_pay->depositor |h %></TD>
48   </TR>
49   <TR>
50     <TD ALIGN="right"><% mt('Account #') |h %></TD>
51     <TD COLSPAN=2><% $cust_pay->account |h %></TD>
52   </TR>
53 % }
54
55 % if ( $conf->exists('pkg-balances') ) {
56 %   $cgi->param('pkgnum', $cust_pay->pkgnum);
57     <& /elements/tr-select-cust_pkg-balances.html,
58                  'custnum' => $cust_pay->custnum,
59                  'cgi'     => $cgi,
60     &>
61 % } else {
62   <INPUT TYPE="hidden" NAME="pkgnum" VALUE="">
63 % }
64
65 </TABLE>
66
67 <BR>
68 <INPUT TYPE="submit" VALUE="<% mt('Change payment package') |h %>">
69
70 </FORM>
71 </BODY>
72 </HTML>
73
74 <%init>
75
76 my $conf = new FS::Conf;
77
78 my $money_char  = $conf->config('money_char')  || '$';
79 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
80
81 die "access denied"
82   unless $FS::CurrentUser::CurrentUser->access_right('Apply payment'); #own ACL?
83
84 my $cust_pay = qsearchs({
85   'select'    => 'cust_pay.*',
86   'table'     => 'cust_pay',
87   'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
88   'hashref'   => { paynum => scalar($cgi->param('paynum')), },
89   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
90 })
91   or die 'unknown payment';
92
93 </%init>