From 5f6b143801578ebcc30b97fba1b047f80fa232fe Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Sun, 9 Dec 2018 17:53:20 -0500 Subject: RT# 81706 Fix for transparent customer menu tabs --- httemplate/elements/dropdown-menu.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate') diff --git a/httemplate/elements/dropdown-menu.html b/httemplate/elements/dropdown-menu.html index 54447a23f..3c0f40f75 100644 --- a/httemplate/elements/dropdown-menu.html +++ b/httemplate/elements/dropdown-menu.html @@ -5,12 +5,17 @@ border: none; } +% if ( $opt{id} !~ /customer_/ ) { +% # Fix for changes to how jQuery UI applies state classes + #<% $opt{id} %> .ui-state-active { color: inherit; background-color: transparent; border-color: transparent; } +% } + #<% $opt{id} %> li { float: left; padding: .25em; -- cgit v1.2.1 From 006f36a6d2ee10664c3207b47ff046de447ea8bb Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 11 Dec 2018 18:01:30 -0500 Subject: RT# 74693 - Added Bulk edit of rates only --- httemplate/browse/cust_main_county.cgi | 59 +++++++++++++++++++++- httemplate/edit/bulk-cust_main_county.html | 30 +++++++---- httemplate/edit/process/bulk-cust_main_county.html | 11 +++- 3 files changed, 87 insertions(+), 13 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 552327836..722c699a2 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -260,6 +260,21 @@ if ( $country && $state && } $cgi->delete('county'); +my $city = ''; +if ( $country && $state && $county && + $cgi->param('city') =~ + /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]+)$/ + ) +{ + $city = $1; + if ( $city eq '__NONE__' ) { + $title = "No city, $title"; + } else { + $title = "$city city, $title"; + } +} +$cgi->delete('city'); + $title = " for $title" if $title; my $taxclass = ''; @@ -279,12 +294,18 @@ my $filter_change = "window.location = '". $cgi->self_url. ";country=' + encodeURIComponent( document.getElementById('country').options[document.getElementById('country').selectedIndex].value ) + ". "';state=' + encodeURIComponent( document.getElementById('state').options[document.getElementById('state').selectedIndex].value ) +". - "';county=' + encodeURIComponent( document.getElementById('county').options[document.getElementById('county').selectedIndex].value );"; + "';county=' + encodeURIComponent( document.getElementById('county').options[document.getElementById('county').selectedIndex].value )"; + +$filter_change .= " +';city=' + encodeURIComponent( document.getElementById('city').options[document.getElementById('city').selectedIndex].value )" + if $conf->exists('enable_taxclasses'); + +$filter_change .= ";"; #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('city', $city ) if $city; $cgi->param('taxclass', $county ) if $taxclass; my $html_posttotal = @@ -338,6 +359,31 @@ if ( scalar(@counties) > 1 ) { ''; } +if ( $conf->exists('enable_taxclasses') ) { + my @cities = ( $country && $state && $county ) ? cities($county, $state, $country) : (); + if ( scalar(@cities) > 1 ) { + $html_posttotal .= + ' show city: '. + include('/elements/select-city.html', + 'country' => $country, + 'state' => $state, + 'county' => $county, + 'city' => $city, + 'onchange' => $filter_change, + 'empty_label' => '(all)', + 'empty_data_label' => '(none)', + 'empty_data_value' => '__NONE__', + 'disable_empty' => 0, + 'disable_cityupdate' => 1, + ); + } else { + $html_posttotal .= + ''; + } +} + $html_posttotal .= ' )'; my $bulk_popup_link = @@ -412,6 +458,8 @@ my $html_foot = <Bulk edit selected | +Bulk edit rate only selected +| bulk edit with excel file END @@ -434,6 +482,15 @@ if ( $county ) { $count_query .= ' AND county = '. dbh->quote($county); } } +if ( $city ) { + if ( $city eq '__NONE__' ) { + $hashref->{'city'} = ''; + $count_query .= " AND ( city = '' OR city IS NULL ) "; + } else { + $hashref->{'city'} = $city; + $count_query .= ' AND city = '. dbh->quote($city); + } +} if ( $taxclass ) { $hashref->{'taxclass'} = $taxclass; $count_query .= ( $count_query =~ /WHERE/i ? ' AND ' : ' WHERE ' ). diff --git a/httemplate/edit/bulk-cust_main_county.html b/httemplate/edit/bulk-cust_main_county.html index 8b1234825..650fa7857 100644 --- a/httemplate/edit/bulk-cust_main_county.html +++ b/httemplate/edit/bulk-cust_main_county.html @@ -3,6 +3,7 @@
" METHOD="POST"> + @@ -45,11 +46,13 @@ % } -<% include('/elements/tr-input-text.html', +% unless ($rate_only) { + <% include('/elements/tr-input-text.html', 'field' => 'taxname', 'label' => 'Tax name' ) -%> + %> +% } <% include('/elements/tr-input-percentage.html', 'field' => 'tax', @@ -57,27 +60,29 @@ ) %> -<% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %> +% unless ($rate_only) { + <% include('/elements/tablebreak-tr-title.html', value=>'Exemptions' ) %> -<% include('/elements/tr-checkbox.html', + <% include('/elements/tr-checkbox.html', 'field' => 'setuptax', 'value' => 'Y', 'label' => 'This tax not applicable to setup fees', ) -%> + %> -<% include('/elements/tr-checkbox.html', + <% include('/elements/tr-checkbox.html', 'field' => 'recurtax', 'value' => 'Y', 'label' => 'This tax not applicable to recurring fees', ) -%> + %> -<% include('/elements/tr-input-money.html', + <% include('/elements/tr-input-money.html', 'field' => 'exempt_amount', 'label' => 'Monthly exemption per customer ($25 "Texas tax")', ) -%> + %> +% }
@@ -97,8 +102,13 @@ $cgi->param('taxnum') =~ /^([\d,]+)$/ or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected'); my @taxnum = split(',', $1); -$cgi->param('action') =~ /^(add|edit)$/ or die "unknown action"; +$cgi->param('action') =~ /^(add|edit|edit_rate_only)$/ or die "unknown action"; my $action = $1; +my $rate_only; +if ($action eq "edit_rate_only") { + $action = "edit"; + $rate_only = 1; +} my $title = "Bulk $action tax rate"; my @cust_main_county = diff --git a/httemplate/edit/process/bulk-cust_main_county.html b/httemplate/edit/process/bulk-cust_main_county.html index b5a0258b1..55832e9c5 100644 --- a/httemplate/edit/process/bulk-cust_main_county.html +++ b/httemplate/edit/process/bulk-cust_main_county.html @@ -27,6 +27,8 @@ my @taxnum = split(',', $1); $cgi->param('action') =~ /^(add|edit)$/ or die "unknown action"; my $action = $1; +my $rate_only = $cgi->param('rate_only') if $cgi->param('rate_only'); + my $error = ''; foreach my $taxnum ( @taxnum ) { @@ -35,8 +37,13 @@ foreach my $taxnum ( @taxnum ) { if ( $action eq 'edit' || $cust_main_county->tax == 0 ) { #let's replace - foreach (qw( taxname tax exempt_amount setuptax recurtax )) { - $cust_main_county->set( $_ => scalar($cgi->param($_)) ) + if ($rate_only) { + $cust_main_county->set( tax => scalar($cgi->param('tax')) ); + } + else { + foreach (qw( taxname tax exempt_amount setuptax recurtax )) { + $cust_main_county->set( $_ => scalar($cgi->param($_)) ) + } } $error = $cust_main_county->replace and last; -- cgit v1.2.1 From 639c645c0f00c082a735b40f97a4f830c5e84949 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 11 Dec 2018 18:08:18 -0500 Subject: Revert "RT# 74693 - Added ability to bulk edit rates with excel" This reverts commit 1d9fd3b93be720823656cd23db79ff74e2e7a829. --- httemplate/browse/cust_main_county.cgi | 2 - httemplate/misc/process/tax_edit_excel.html | 9 ---- httemplate/misc/tax_edit_excel.html | 70 ----------------------------- 3 files changed, 81 deletions(-) delete mode 100644 httemplate/misc/process/tax_edit_excel.html delete mode 100644 httemplate/misc/tax_edit_excel.html (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 722c699a2..9df8fed0b 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -459,8 +459,6 @@ my $html_foot = <Bulk edit selected | Bulk edit rate only selected -| -bulk edit with excel file END my $hashref = {}; diff --git a/httemplate/misc/process/tax_edit_excel.html b/httemplate/misc/process/tax_edit_excel.html deleted file mode 100644 index a9928f902..000000000 --- a/httemplate/misc/process/tax_edit_excel.html +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $server = new FS::UI::Web::JSRPC 'FS::cust_main_county::process_edit_import', $cgi; - - \ No newline at end of file diff --git a/httemplate/misc/tax_edit_excel.html b/httemplate/misc/tax_edit_excel.html deleted file mode 100644 index 1546393d9..000000000 --- a/httemplate/misc/tax_edit_excel.html +++ /dev/null @@ -1,70 +0,0 @@ -<% include('/elements/header.html', 'Edit tax rates with Excel' ) %> - -% # 'name' => 'RateImportForm', - -<& /elements/form-file_upload.html, - 'name' => 'TaxEditForm', - 'action' => 'process/tax_edit_excel.html', - 'num_files' => 1, - 'fields' => [ 'format' ], - 'message' => 'Tax Rate edit successful', - 'url' => $p."browse/cust_main_county.cgi", - 'onsubmit' => "document.TaxEditForm.submitButton.disabled=true;" -&> - -<% &ntable("#cccccc", 2) %> - - - File format should be as follows:
- - - - - - - -
Country as standard two letter code
State as standard two letter code
County name
City name
Tax name
Tax rate

- * first row should be blank or contain headers
- * Tax rate should be formated as a number not percentage. -

- - - - Upload tax rates with Excel (or other .XLS-compatible application) - - - - <% include( '/elements/file-upload.html', - 'field' => 'file', - 'label' => '', - 'label_align' => 'left', - ) - %> - - - - - - - - - - - - -<% include('/elements/footer.html') %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $sth = dbh->prepare('SELECT COUNT(*) FROM rate_detail WHERE conn_charge > 0 OR conn_sec > 0 LIMIT 1') - or die dbh->errstr; -$sth->execute or die $sth->errstr; -my $have_conn = $sth->fetchrow_arrayref->[0]; - - \ No newline at end of file -- cgit v1.2.1 From 88678677483b169d035d623cc1a07606dff6b046 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 11 Dec 2018 18:45:36 -0500 Subject: RT# 74693 - Added city select when using tax classes --- httemplate/elements/select-city.html | 176 +++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 httemplate/elements/select-city.html (limited to 'httemplate') diff --git a/httemplate/elements/select-city.html b/httemplate/elements/select-city.html new file mode 100644 index 000000000..09e28dd48 --- /dev/null +++ b/httemplate/elements/select-city.html @@ -0,0 +1,176 @@ +<%doc> + +Example: + + <& /elements/select-city.html, + #recommended + country => $current_country, + state => $current_state, + county => $current_county, + city => $current_city, + + #optional + prefix => $optional_unique_prefix, + onchange => $javascript, + disabled => 0, #bool + disable_empty => 1, #defaults to 1, set to 0 to disable the empty option + empty_label => 'all', #label for empty option + style => [ 'attribute:value', 'another:value' ], + &> + + +% if ( $cityflag ) { + + <% include('/elements/xmlhttp.html', + 'url' => $p.'misc/cities.cgi', + 'subs' => [ $pre. 'get_cities' ], + ) + %> + + + + + +% } else { + + + + + +% } + +<%init> + +my %opt = @_; +foreach my $opt (qw( city county state country prefix onchange disabled + empty_value )) { + $opt{$opt} = '' unless exists($opt{$opt}) && defined($opt{$opt}); +} + +$opt{'disable_empty'} = 1 unless exists($opt{'disable_empty'}); + +my $pre = $opt{'prefix'}; + +my $onchange = $opt{'onchange'}; + +my $city_style = $opt{'style'} ? [ @{ $opt{'style'} } ] : []; + +my @cities = (); +if ( $cityflag ) { + + @cities = map { length($_) ? $_ : $opt{'empty_data_value'} } + cities( $opt{'county'}, $opt{'state'}, $opt{'country'} ); + + push @$city_style, 'display:none' + unless scalar(@cities) > 1; + +} + +my $style = + scalar(@$city_style) + ? 'STYLE="'. join(';', @$city_style). '"' + : ''; + + +<%once> + +my $sql = "SELECT COUNT(*) FROM cust_main_county". + " WHERE city IS NOT NULL AND city != ''"; +my $sth = dbh->prepare($sql) or die dbh->errstr; +$sth->execute or die $sth->errstr; +my $cityflag = $sth->fetchrow_arrayref->[0]; + + \ No newline at end of file -- cgit v1.2.1 From 4d9e2d0980eb542aec39997b7bd92130b3a60676 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Tue, 18 Dec 2018 17:47:57 -0500 Subject: RT# 80488 Allow city select for tax_district_method=wa_sales --- httemplate/elements/city.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/city.html b/httemplate/elements/city.html index 05250fef5..3c5e91782 100644 --- a/httemplate/elements/city.html +++ b/httemplate/elements/city.html @@ -153,9 +153,7 @@ my %opt = @_; my $pre = $opt{'prefix'}; my $conf = new FS::Conf; -# Using tax_district_method implies that there's not a preloaded city/county -# tax district table. -my $disable_select = 1 if $conf->config('tax_district_method'); +my $disable_select = 0; $opt{'disable_empty'} = 1 unless exists($opt{'disable_empty'}); -- cgit v1.2.1 From 0ec0b91b7c383d626dd75b0c2b2d3969e5bdcbc7 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 28 Dec 2018 15:52:02 -0500 Subject: RT# 32917 - Added ability for taxes to be charged prior to applying the discount --- httemplate/edit/cust_main_county.html | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main_county.html b/httemplate/edit/cust_main_county.html index 9cc5131a2..b0823098f 100644 --- a/httemplate/edit/cust_main_county.html +++ b/httemplate/edit/cust_main_county.html @@ -14,6 +14,7 @@ 'setuptax' => 'This tax not applicable to setup fees', 'recurtax' => 'This tax not applicable to recurring fees', 'exempt_amount' => 'Monthly exemption per customer ($25 "Texas tax")', + 'charge_prediscount' => 'Charge this tax prior to any discounts', }, 'fields' => \@fields, ) @@ -60,6 +61,9 @@ push @fields, 'taxname', { field=>'tax', type=>'percentage', }, + { type=>'tablebreak-tr-title', value=>'Charging options' }, + { field=>'charge_prediscount', type=>'checkbox', value=>'Y', }, + { type=>'tablebreak-tr-title', value=>'Exemptions' }, { field=>'setuptax', type=>'checkbox', value=>'Y', }, { field=>'recurtax', type=>'checkbox', value=>'Y', }, -- cgit v1.2.1