From 1d920e3661c29398763d05c82bbe3a493a19fbae Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Feb 2008 01:21:15 +0000 Subject: update the tax class editor to enable taxclass adding, RT#2929 --- httemplate/browse/cust_main_county.cgi | 107 ++++++++++++++++++++++++++------- 1 file changed, 85 insertions(+), 22 deletions(-) (limited to 'httemplate/browse') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 3e67b1122..12bdeb333 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -1,6 +1,7 @@ <% include( 'elements/browse.html', - 'title' => 'Tax Rates', + 'title' => "Tax Rates $title", 'name_singular' => 'tax rate', + 'menubar' => \@menubar, 'html_init' => $html_init, 'html_posttotal' => $html_posttotal, 'query' => { @@ -89,11 +90,20 @@ my $edit_onclick = sub { }; sub expand_link { - my( $row, $desc, %opt ) = @_; + my( $row, $desc ) = @_; my $taxnum = $row->taxnum; - $taxnum = "taxclass$taxnum" if $opt{'taxclass'}; + my $url = "${p}edit/cust_main_county-expand.cgi?$taxnum"; my $color = '#333399'; - qq!!; + + qq!!; +} + +sub separate_taxclasses_link { + my( $row ) = @_; + my $taxnum = $row->taxnum; + my $url = "${p}edit/process/cust_main_county-expand.cgi?taxclass=1;taxnum=$taxnum"; + + qq!!; } @@ -106,10 +116,12 @@ die "access denied" #my $money_char = $conf->config('money_char') || '$'; my $enable_taxclasses = $conf->exists('enable_taxclasses'); +my @menubar; + my $html_init = "Click on add states to specify a country's tax rates by state or province.
Click on add counties to specify a state's tax rates by county."; -$html_init .= "
Click on add taxclasses to specify tax classes." +$html_init .= "
Click on separate taxclasses to specify taxes per taxclass." if $enable_taxclasses; $html_init .= '

'; @@ -120,23 +132,60 @@ $html_init .= qq( ); -my $filter_country = ''; -if ( $cgi->param('filter_country') =~ /^(\w\w)$/ ) { - $filter_country = $1; +my $title = ''; + +my $country = ''; +if ( $cgi->param('country') =~ /^(\w\w)$/ ) { + $country = $1; + $title = $country; +} +$cgi->delete('country'); + +my $state = ''; +if ( $cgi->param('state') =~ /^([\w \-\'\[\]]+)$/ ) { + $state = $1; + $title = "$state, $title"; +} +$cgi->delete('state'); + +my $county = ''; +if ( $cgi->param('county') =~ /^([\w \-\'\[\]]+)$/ ) { + $county = $1; + $title = "$county county, $title"; } -$cgi->delete('filter_country'); +$cgi->delete('county'); + +$title = " for $title" if $title; + +my $taxclass = ''; +if ( $cgi->param('taxclass') =~ /^([\w \-]+)$/ ) { + $taxclass = $1; + $title .= " for $taxclass tax class"; +} +$cgi->delete('taxclass'); + +if ( $country || $taxclass ) { + push @menubar, 'View all tax rates' => $p.'browse/cust_main_county.cgi'; +} + $cgi->param('dummy', 1); my $country_filter_change = "window.location = '". - $cgi->self_url. ";filter_country=' + this.options[this.selectedIndex].value;"; + $cgi->self_url. ";country=' + this.options[this.selectedIndex].value;"; + +#restore this so pagination works +$cgi->param('country', $country) if $country; +$cgi->param('state', $state ) if $state; +$cgi->param('county', $county ) if $county; +$cgi->param('taxclass', $county ) if $taxclass; my $html_posttotal = '(show country: '. - qq(). qq(
add new)!; push @header2, '(per-package classification)'; - push @fields, sub { $_[0]->taxclass || '(all) '. - expand_link($_[0], 'Add Taxclasses', 'taxclass'=>1). - 'add taxclasses
' - }; - push @color, sub { shift->taxclass ? '000000' : '999999' }; - push @links, ''; + push @fields, sub { $_[0]->taxclass || '(all) '. + separate_taxclasses_link($_[0], 'Separate Taxclasses'). + 'separate taxclasses
' + }; + push @color, sub { shift->taxclass ? '000000' : '999999' }; + push @links, ''; push @link_onclicks, ''; $align .= 'l'; } -- cgit v1.2.1