svc_cable service have a single serial / MAC / model, not one-to-many devices like...
[freeside.git] / httemplate / edit / tax_rate.html
1 <% include('elements/edit.html',
2      'popup'          => 1,
3      'name'           => 'Tax rate', #Edit tax rate
4      'table'          => 'tax_rate',
5      'labels'         => $labels,
6      'fields'         => \@fields,
7      'value_callback' => $value_callback,
8    )
9 %>
10 <%once>
11
12 my $conf = new FS::Conf;
13 my $value_callback =
14   sub { my ( $field, $value ) = @_;
15         ( $field =~ /^(tax|excessrate|usetax|useexcessrate)$/ )
16           ? $value*100
17           : $value;
18       };
19
20 </%once>
21
22 <%init>
23
24 die "access denied"
25   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
26
27 my $taxnum;
28 if ( $cgi->param('error') ) {
29   $cgi->param('taxnum') =~ /^(\d+)$/ or die 'error, but no taxnum';
30   $taxnum = $1;
31 } else {
32   my($query) = $cgi->keywords;
33   $query =~ /^(\d+)$/ or die 'no taxnum';
34   $taxnum = $1;
35 }
36
37 my $tax_rate = qsearchs('tax_rate', { 'taxnum' => $taxnum })
38   or die "unknown taxnum $1";
39
40 my $labels =  { 'taxnum'               => 'Tax',
41                 'data_vendor'          => 'Data vendor',
42                 'geocode'              => 'Vendor location code',
43                 'location'             => 'Tax auth loc code',
44                 'taxclass_description' => 'Tax class',
45                 'taxname'              => 'Tax name',
46                 'effective_date'       => 'Effective date',
47                 'tax'                  => 'Tax rate (1st bracket)',
48                 'excessrate'           => 'Tax rate (2nd bracket)',
49                 'taxbase'              => 'First bracket',
50                 'taxmax'               => 'Max tax',
51                 'usetax'               => 'Use tax rate (1st bracket)',
52                 'useexcessrate'        => 'Use tax rate (2nd bracket)',
53                 'unittype_name'        => 'Units',
54                 'fee'                  => 'Fee per unit (1st bracket)',
55                 'excessfee'            => 'Fee per unit (2st bracket)',
56                 'feebase'              => 'Units in first bracket',
57                 'feemax'               => 'Max Units',
58                 'maxtype_name'         => 'Threshold accumulation',
59                 'taxauth_name',        => 'Tax authority',
60                 'basetype_name'        => 'Basis',
61                 'passtype_name'        => 'Passthru',
62                 'passflag'             => 'Passable',
63                 'setuptax'             => 'This tax not applicable to setup fees',
64                 'recurtax'             => 'This tax not applicable to recurring fees',
65               };
66
67 my @fields = (
68     { type=>'tablebreak-tr-title',   value=>'Location' },
69     { field=>'data_vendor',          type=>'hidden',},
70     { field=>'geocode',              type=>'fixed' },
71     { field=>'taxclassnum',          type=>'hidden' } ,
72     { field=>'taxclass_description', type=>'fixed' } ,
73     { field=>'taxname',              type=>'text' } ,
74     { field=>'effective_date',       type=>'fixed' } ,
75     { field=>'location',             type=>'text' },
76     { type=>'tablebreak-tr-title',   value=>'Money based rates' },
77     { field=>'tax',                  type=>'percentage' } ,
78     { field=>'excessrate',           type=>'percentage' } ,
79     { field=>'taxbase',              type=>'money' } ,
80     { field=>'taxmax',               type=>'money' } ,
81     { field=>'usetax',               type=>'percentage' } ,
82     { field=>'useexcessrate',        type=>'percentage' } ,
83     { type=>'tablebreak-tr-title',   value=>'Service based rates' },
84     { field=>'unittype',             type=>'hidden' } ,
85     { field=>'unittype_name',        type=>'fixed' } ,
86     { field=>'fee',                  type=>'money' } ,
87     { field=>'excessfee',            type=>'money' } ,
88     { field=>'feebase',              type=>'text' } ,
89     { field=>'feemax',               type=>'text' } ,
90     { type=>'tablebreak-tr-title',   value=>'Taxation rules' },
91     { field=>'maxtype',              type=>'hidden' } ,
92     { field=>'maxtype_name',         type=>'fixed' } ,
93     { field=>'taxauth',              type=>'hidden' } ,
94     { field=>'taxauth_name',         type=>'fixed' } ,
95     { field=>'basetype',             type=>'hidden' } ,
96     { field=>'basetype_name',        type=>'fixed' } ,
97     { field=>'passtype',             type=>'hidden' } ,
98     { field=>'passtype_name',        type=>'fixed' } ,
99     { field=>'passflag',             type=>'fixed' } ,
100     { field=>'setuptax',             type=>'checkbox', value=>'Y'  } ,
101     { field=>'recurtax',             type=>'checkbox', value=>'Y'  } ,
102     { field=>'disabled',             type=>'checkbox', value=>'Y'  } ,
103     { field=>'manual',               type=>'hidden', value=>'Y' } ,
104 );
105
106 </%init>