summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_credit-pkgnum.html
blob: a7c046b48199e1672128853196b608b1f58eef98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<& /elements/header-popup.html, mt('Change credit package') &>

<& /elements/error.html &>

<FORM NAME="credit_popup" ACTION="<% popurl(1) %>process/cust_credit-pkgnum.html" METHOD=POST>
<INPUT TYPE="hidden" NAME="crednum" VALUE="<% $cust_credit->crednum %>">

<% ntable("#cccccc", 2) %>

  <TR>
    <TD ALIGN="right"><% mt('Date') |h %></TD>
    <TD BGCOLOR="#eeeeee"><% time2str($date_format, $cust_credit->_date) |h %></TD>
  </TR>

  <TR>
    <TD ALIGN="right"><% mt('Amount') |h %></TD>
    <TD BGCOLOR="#eeeeee">
      <% $money_char. $cust_credit->amount %>
    </TD>
  </TR>

% if ( $cust_credit->addlinfo ) {
    <TR>
      <TD ALIGN="right"><% mt('Additional info') |h %></TD>
      <TD BGCOLOR="#eeeeee">
        <% $cust_credit->addlinfo |h %>
      </TD>
    </TR>
% }

% if ( $conf->exists('pkg-balances') ) {
%   $cgi->param('pkgnum', $cust_credit->pkgnum);
    <& /elements/tr-select-cust_pkg-balances.html,
                 'custnum' => $cust_credit->custnum,
                 'cgi'     => $cgi
    &>
% } else {
  <INPUT TYPE="hidden" NAME="pkgnum" VALUE="">
% }

</TABLE>

<BR>

<CENTER><INPUT TYPE="submit" ID="confirm_credit_button" VALUE="<% mt('Change credit package') |h %>"></CENTER>

</FORM>
</BODY>
</HTML>
<%init>

my $conf = new FS::Conf;

my $money_char  = $conf->config('money_char')  || '$';
my $date_format = $conf->config('date_format') || '%m/%d/%Y';

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); #own ACL?

my $cust_credit = qsearchs({
  'select'    => 'cust_credit.*',
  'table'     => 'cust_credit',
  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
  'hashref'   => { crednum => scalar($cgi->param('crednum')), },
  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
})
  or die 'unknown credit';

</%init>