@_UI_STD_INIT_@ [if config SalesTax ne multi] [bounce page="__UI_BASE__/tax_simple"] [/if] [calc] $Values->{mv_data_table} = $CGI->{mv_data_table} = 'country'; $CGI->{no_dbmenu} = 1; return; [/calc] [flag type=write table=country] [flag type=write table=state] [set table_perm]1[/set] [set ui_class]Admin[/set] [set page_title][L]Tax configuration[/L][/set] [set help_name]tax.main[/set] [set icon_name]icon_config.gif[/set] @_UI_STD_HEAD_@

[form-session-id]
Set tax type
Country |
[if value taxcountry] [try] [perl tables="country state"] my $col = $::Variable->{MV_COUNTRY_TAX_FIELD} || 'tax'; my $taxdata; my $out; my $set; if($CGI->{tax_set}) { if($CGI->{taxtype} eq '' or $CGI->{taxtype} eq 'none') { $taxdata = ''; } elsif($CGI->{taxtype} eq 'simple:state') { $taxdata = 'simple:state'; } elsif($CGI->{taxtype} eq 'state') { $taxdata = 'state'; } else { $taxdata = $CGI->{taxdata} || 'default = 10%, food = 0'; } tag_data('country', $col, $CGI->{taxcountry}, { value => $taxdata }); if($taxdata eq 'state') { my $sdb = $Db{state}; my (@row) = split /\0/, $CGI->{taxstate}; my (@val) = split /\0/, $CGI->{taxstate_data}; my $scol = $::Variable->{MV_STATE_TAX_FIELD} || 'tax'; for(my $i = 0; $i < @row; $i++) { $sdb->set_field($row[$i], $scol, $val[$i]); } } } else { $taxdata = tag_data('country', $col, $Values->{taxcountry}); } if(! length($taxdata) ) { # None $Values->{taxtype} = 'none'; delete $Values->{taxdata}; } elsif($taxdata eq 'simple:state') { $Values->{taxtype} = 'simple:state'; delete $Values->{taxdata}; } elsif($taxdata eq 'state') { $Values->{taxtype} = 'state'; delete $Values->{taxdata}; } else { $Values->{taxtype} = 'vat'; $Values->{taxdata} = $taxdata; } return unless $set; $out = ::errmsg( "set tax type for %s to: %s", $CGI->{taxcountry}, $Values->{taxtype}, ); return qq{
Action | $out
}; [/perl] [/try]
Tax type | [catch]Trouble getting/setting tax data.[/catch]
[if value taxdata]
Tax Data | [value taxdata]
[/if] [if value taxtype eq 'state']
State Tax Data
[query list=1 table=country sql="select code,name,tax from state where country = '[value taxcountry]'" ]
[sql-param name] |
[/query] [/if]
[else]
[/else] [/if]

@_UI_STD_FOOTER_@