X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_fee.html;h=5f6dc3818c7f4292ff5b235224b08e667a1437d3;hp=b1044c9212699dc634b9a24fd948bdbdc5076443;hb=11bbf29de447fe39e9d7155fe280a0df70fa8c3c;hpb=fbb18001e331de0a4826076dc25710cbe3664b26 diff --git a/httemplate/edit/part_fee.html b/httemplate/edit/part_fee.html index b1044c921..5f6dc3818 100644 --- a/httemplate/edit/part_fee.html +++ b/httemplate/edit/part_fee.html @@ -14,16 +14,15 @@ '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', 'maximum' => 'Maximum fee', 'limit_credit' => 'Limit to customer credit balance', - 'nextbill' => 'Hold until the customer\'s next invoice', %locale_labels }, 'fields' => \@fields, + 'viewall_dir' => 'browse', 'edit_callback' => $edit_callback, 'error_callback' => $error_callback, &> @@ -36,7 +35,7 @@ die "access denied" my $conf = FS::Conf->new; my @tax_fields; -if ( $conf->exists('enable_taxproducts') ) { +if ( $conf->config('tax_data_vendor') ) { @tax_fields = ( { field => 'taxproductnum', type => 'select-taxproduct' } ); @@ -44,7 +43,8 @@ if ( $conf->exists('enable_taxproducts') ) { @tax_fields = ( { field => 'taxable', type => 'checkbox', value => 'Y' }, ); - push ( + push @tax_fields, + ( { field => 'taxclass', type => 'select-taxclass' }, ) if $conf->exists('enable_taxclasses'); } @@ -56,8 +56,8 @@ my $n = 0; 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' } = @@ -65,6 +65,19 @@ foreach (@locales) { $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, }, @@ -87,11 +100,6 @@ my @fields = ( value => 'Y', }, - { field => 'nextbill', - type => 'checkbox', - value => 'Y', - }, - { field => 'setuprecur', type => 'select', options => [ 'setup', 'recur' ], @@ -99,24 +107,32 @@ my @fields = ( '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, );