diff options
author | ivan <ivan> | 2009-10-12 01:45:12 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-10-12 01:45:12 +0000 |
commit | 0b94e40c533288be69a4fe60da36a385d31eff7f (patch) | |
tree | 8284d3c555e7b0cdfd731c567059f7f60319e3c0 /FS/FS | |
parent | 990e040448691dd4bd26c871274c65204cb7707b (diff) |
UI for per-city taxes (setup and assigning to customers/package locations), RT#5852
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/Mason.pm | 4 | ||||
-rw-r--r-- | FS/FS/Misc.pm | 25 | ||||
-rw-r--r-- | FS/FS/Schema.pm | 12 | ||||
-rw-r--r-- | FS/FS/cust_main_county.pm | 10 |
4 files changed, 41 insertions, 10 deletions
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index 6e6072e..98cf254 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -118,7 +118,9 @@ if ( -e $addl_handler_use_file ) { use FS::UI::Web::small_custview qw(small_custview); use FS::UI::bytecount; use FS::Msgcat qw(gettext geterror); - use FS::Misc qw( send_email send_fax states_hash counties state_label ); + use FS::Misc qw( send_email send_fax + states_hash counties cities state_label + ); use FS::Misc::eps2png qw( eps2png ); use FS::Report::Table::Monthly; use FS::TicketSystem; diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index 5231350..dca906c 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -14,7 +14,7 @@ use File::Temp; @ISA = qw( Exporter ); @EXPORT_OK = qw( generate_email send_email send_fax - states_hash counties state_label + states_hash counties cities state_label card_types generate_ps generate_pdf do_print csv_from_fixed @@ -556,6 +556,7 @@ Returns a list of counties for this state and country. sub counties { my( $state, $country ) = @_; + map { $_ } #return num_counties($state, $country) unless wantarray; sort map { s/[\n\r]//g; $_; } map { $_->county } qsearch({ @@ -567,6 +568,28 @@ sub counties { }); } +=item cities COUNTY STATE COUNTRY + +Returns a list of cities for this county, state and country. + +=cut + +sub cities { + my( $county, $state, $country ) = @_; + + map { $_ } #return num_cities($county, $state, $country) unless wantarray; + sort map { s/[\n\r]//g; $_; } + map { $_->city } + qsearch({ + 'select' => 'DISTINCT city', + 'table' => 'cust_main_county', + 'hashref' => { 'county' => $county, + 'state' => $state, + 'country' => $country, + }, + }); +} + =item state_label STATE COUNTRY_OR_LOCALE_SUBCOUNRY_OBJECT =cut diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 6f53b2a..946cf7f 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -405,12 +405,13 @@ sub tables_hashref { 'printed', 'int', '', '', '', '', #specific use cases - 'closed', 'char', 'NULL', 1, '', '', + 'closed', 'char', 'NULL', 1, '', '', #not yet used much 'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements + 'agent_invid', 'int', 'NULL', '', '', '', #(varchar?) importing legacy ], 'primary_key' => 'invnum', - 'unique' => [], - 'index' => [ ['custnum'], ['_date'], ['statementnum'], ], + 'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum? huh + 'index' => [ ['custnum'], ['_date'], ['statementnum'], ['agent_invid'] ], }, 'cust_statement' => { @@ -866,8 +867,9 @@ sub tables_hashref { # a tax rate. 'columns' => [ 'taxnum', 'serial', '', '', '', '', - 'state', 'varchar', 'NULL', $char_d, '', '', + 'city', 'varchar', 'NULL', $char_d, '', '', 'county', 'varchar', 'NULL', $char_d, '', '', + 'state', 'varchar', 'NULL', $char_d, '', '', 'country', 'char', '', 2, '', '', 'taxclass', 'varchar', 'NULL', $char_d, '', '', 'exempt_amount', @money_type, '', '', @@ -879,7 +881,7 @@ sub tables_hashref { 'primary_key' => 'taxnum', 'unique' => [], # 'unique' => [ ['taxnum'], ['state', 'county'] ], - 'index' => [ [ 'county' ], [ 'state' ], [ 'country' ], + 'index' => [ [ 'city' ], [ 'county' ], [ 'state' ], [ 'country' ], [ 'taxclass' ], ], }, diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm index bb60abb..ab1ac1e 100644 --- a/FS/FS/cust_main_county.pm +++ b/FS/FS/cust_main_county.pm @@ -2,7 +2,7 @@ package FS::cust_main_county; use strict; use vars qw( @ISA @EXPORT_OK $conf - @cust_main_county %cust_main_county $countyflag ); + @cust_main_county %cust_main_county $countyflag ); # $cityflag ); use Exporter; use FS::Record qw( qsearch dbh ); use FS::cust_bill_pkg; @@ -17,6 +17,7 @@ use FS::cust_tax_exempt_pkg; @cust_main_county = (); $countyflag = ''; +#$cityflag = ''; #ask FS::UID to run this stuff for us later $FS::UID::callback{'FS::cust_main_county'} = sub { @@ -55,10 +56,12 @@ currently supported: =item taxnum - primary key (assigned automatically for new tax rates) -=item state +=item city =item county +=item state + =item country =item tax - percentage @@ -116,8 +119,9 @@ sub check { $self->exempt_amount(0) unless $self->exempt_amount; $self->ut_numbern('taxnum') - || $self->ut_anything('state') + || $self->ut_textn('city') || $self->ut_textn('county') + || $self->ut_anything('state') || $self->ut_text('country') || $self->ut_float('tax') || $self->ut_textn('taxclass') # ... |