summaryrefslogtreecommitdiff
path: root/httemplate/elements/table-commissions.html
blob: b972ed9273aadb57291c091966bca2407aa90d92 (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
<FONT CLASS="fsinnerbox-title"><% mt('Commissions') |h %></FONT>
<TABLE CLASS="fsinnerbox">

% my $pkey = $object->primary_key;
% my $pkey_value = $object->$pkey();
% my $link_class = 'FS::'.$link_table;
% 
% #surprising amount of false laziness w/ edit/process/agent.cgi
% # (somewhat less now that we're more generic)
% my @pkg_class = qsearch($target_table, { 'disabled'=>'' });
% foreach my $pkg_class ( '', @pkg_class ) {
%   my %thing_pkg_class = ( $pkey    => $pkey_value,
%                           classnum => $pkg_class ? $pkg_class->classnum : ''
%                         );
%   my $thing_pkg_class =
%     qsearchs( $link_table, \%thing_pkg_class )
%     || $link_class->new( \%thing_pkg_class );
%   my $param = 'classnum'. $thing_pkg_class{classnum};

    <TR>
      <TD><% $pkg_class ? $pkg_class->classname : mt('(no package class)') |h %>: 
      </TD>
      <TD><INPUT TYPE      = "text"
                 NAME      = "<% $param %>"
                 VALUE     = "<% $cgi->param($param) || $thing_pkg_class->commission_percent |h %>"
                 SIZE      = 6
                 MAXLENGTH = 7
          >%
      </TD>
%     if ( $opt{'show_duration'} ) {
        <TD>
          for <INPUT TYPE = "text"
                        NAME = "<% $param %>_duration"
                        VALUE = "<% $cgi->param($param.'_duration') || $thing_pkg_class->commission_duration |h %>"
                 SIZE      = 2
                 MAXLENGTH = 3
              >
          months
        </TD>
%     }
    </TR>

% }

% if ( $opt{'show_duration'} ) {

    <TR>
      <TD COLSPAN=2>
      </TD>
      <TD>
        <FONT SIZE="-2"><I>blank for no time limit</I></FONT>
      </TD>
    </TR>

% }

</TABLE>

<%init>

my %opt = @_;

my $object = $opt{'source_obj'};
my $link_table = $opt{'link_table'};
my $target_table = $opt{'target_table'} || 'pkg_class';

</%init>