'credit_weight' => 'Credit weight',
'agentnum' => 'Agent',
'amount' => 'Flat fee amount',
- 'percent' => 'Percentage of invoice amount',
'basis' => 'Based on',
'setuprecur' => 'Report this fee as',
'minimum' => 'Minimum fee',
%locale_labels
},
'fields' => \@fields,
+ 'viewall_dir' => 'browse',
'edit_callback' => $edit_callback,
'error_callback' => $error_callback,
&>
@tax_fields = (
{ field => 'taxable', type => 'checkbox', value => 'Y' },
);
- push (
+ push @tax_fields,
+ (
{ field => 'taxclass', type => 'select-taxclass' },
) if $conf->exists('enable_taxclasses');
}
my (@locale_fields, %locale_labels);
foreach (@locales) {
push @locale_fields,
- { field => 'feepartmsgnum'. $n, type => 'hidden' },
- { field => 'feepartmsgnum'. $n. '_locale', type => 'hidden' },
+ { field => 'feepartmsgnum'. $n, type => 'hidden' },
+ { field => 'feepartmsgnum'. $n. '_locale', type => 'hidden', value => $_ },
{ field => 'feepartmsgnum'. $n. '_itemdesc', type => 'text', size => 40 },
;
$locale_labels{ 'feepartmsgnum'.$n.'_itemdesc' } =
$n++;
}
+$n = 0;
+my %layer_fields = (
+ 'charged' => [
+ 'charged_percent' => { label => 'Fraction of invoice total', type => 'percentage', },
+ ],
+ 'owed' => [
+ 'owed_percent' => { label => 'Fraction of balance', type => 'percentage', },
+ ],
+ 'usage' => [
+ 'usage' => { type => 'part_fee_usage' }
+ ],
+);
+
my @fields = (
{ field => 'itemdesc', type => 'text', size => 40, },
'recur' => 'a recurring charge' },
},
- { type => 'justtitle', value => 'Fee calculation' },
+ { type => 'tablebreak-tr-title', value => 'Fee calculation' },
{ field => 'amount', type => 'money', },
- { field => 'percent', type => 'percentage', },
{ field => 'basis',
- type => 'select',
- options => [ 'charged', 'owed' ],
- labels => { 'charged' => 'amount charged',
- 'owed' => 'balance due', },
+ type => 'selectlayers',
+ options => [ 'charged', 'owed', 'usage' ],
+ labels => { 'charged' => 'amount charged',
+ 'owed' => 'balance due',
+ 'usage' => 'usage charges' },
+ layer_fields => \%layer_fields,
+ layer_values_callback => sub {
+ my ($cgi, $obj) = @_;
+ {
+ 'charged' => { charged_percent => $obj->percent },
+ 'owed' => { owed_percent => $obj->percent },
+ 'usage' => { usage => [ $obj->part_fee_usage ] },
+ }
+ },
},
-
{ field => 'minimum', type => 'money', },
{ field => 'maximum', type => 'money', },
{ field => 'limit_credit',
type => 'checkbox',
value => 'Y' },
- { type => 'justtitle', value => 'Taxation' },
+ { type => 'tablebreak-tr-title', value => 'Taxation' },
@tax_fields,
);