From 68c776b1b81217be620c9a4212d6652cc44452e5 Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 13 Jan 2012 10:14:17 +0000 Subject: sales tax districts, #15089 --- httemplate/browse/cust_main_county.cgi | 34 ++++++++++++++++++++++++++-------- httemplate/edit/cust_main_county.html | 4 ++++ httemplate/elements/location.html | 8 ++++++++ httemplate/view/cust_main/misc.html | 10 ++++++++++ 4 files changed, 48 insertions(+), 8 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index c6484cacd..dfbe11917 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -10,7 +10,7 @@ 'table' => 'cust_main_county', 'hashref' => $hashref, 'order_by' => - 'ORDER BY country, state, county, city, taxclass', + 'ORDER BY country, state, county, city, district, taxclass', }, 'count_query' => $count_query, 'header' => \@header, @@ -440,11 +440,12 @@ if ( $taxclass ) { $cell_style = ''; -my @header = ( 'Country', 'State/Province', 'County', 'City' ); -my @header2 = ( '', '', '', '', ); -my @links = ( '', '', '', '', ); -my @link_onclicks = ( '', '', '', '', ); -my $align = 'llll'; +my @header = ( 'Country', 'State/Province', 'County', 'City', '' ); +# last column is 'district', but usually unused +my @header2 = ( '', '', '', '', '' ); +my @links = ( '', '', '', '', '' ); +my @link_onclicks = ( '', '', '', '', '' ); +my $align = 'lllll'; my %seen_country = (); my %seen_state = (); @@ -532,7 +533,8 @@ my @fields = ( my $r = shift; if ( $r->city ) { - if ( $r->taxclass ) { #but if it has a taxclass, can't remove + if ( $r->taxclass #but if it has a taxclass, can't remove + or $r->district ) { # or a district $r->city; } else { $r->city. ' '. @@ -551,6 +553,21 @@ my @fields = ( ); } }, + + #district + sub { + my $r = shift; + if ( $r->district ) { + $r->district . ' '. + remove_link( col => 'district', + label=> 'remove district', + row => $r, + cgi => $cgi, + ); + } + # manually editing districts is not exactly intended + }, + ); my @color = ( @@ -607,7 +624,8 @@ my $cb_sub = sub { my $cust_main_county = shift; if ( $cb_oldrow ) { - if ( $cb_oldrow->city ne $cust_main_county->city + if ( $cb_oldrow->district ne $cust_main_county->district + || $cb_oldrow->city ne $cust_main_county->city || $cb_oldrow->county ne $cust_main_county->county || $cb_oldrow->state ne $cust_main_county->state || $cb_oldrow->country ne $cust_main_county->country diff --git a/httemplate/edit/cust_main_county.html b/httemplate/edit/cust_main_county.html index 11b8e43cd..9d21cc8a0 100644 --- a/httemplate/edit/cust_main_county.html +++ b/httemplate/edit/cust_main_county.html @@ -7,6 +7,7 @@ 'state' => 'State', 'county' => 'County', 'city' => 'City', + 'district' => 'District', 'taxclass' => 'Tax class', 'taxname' => 'Tax name', 'tax' => 'Tax rate', @@ -48,6 +49,9 @@ my @fields = ( { field=>'city', type=>'fixed', }, ); +push @fields, { field=>'district', type=>'fixed', } + if $cust_main_county->district; + push @fields, { field=>'taxclass', type=>'fixed', } if $conf->exists('enable_taxclasses'); diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html index c5509c1a9..13797fe61 100644 --- a/httemplate/elements/location.html +++ b/httemplate/elements/location.html @@ -209,6 +209,14 @@ Example: % } else { % } +% if ( $conf->config('tax_district_method') or $object->get('district') ) { + + <<%$th%> ALIGN="right">Tax district
(automatic)> + + + + +% } % } <%init> diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html index fb2e0a160..c7a3ebf86 100644 --- a/httemplate/view/cust_main/misc.html +++ b/httemplate/view/cust_main/misc.html @@ -127,6 +127,16 @@ % } +% if ( $cust_main->district ) { + + + <% mt('Tax district') |h %> + <% $cust_main->district %> + + +% } + + % if ( $conf->exists('ticket_system-selfservice_edit_subject') ) { -- cgit v1.2.1