diff options
author | ivan <ivan> | 2002-05-04 15:00:18 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-05-04 15:00:18 +0000 |
commit | f36b6a178c9811357ff5d5291874aa239d22bc2a (patch) | |
tree | 6d736d1e181ba0865ad739cc94c971a441d6a4d0 /FS | |
parent | 8af9903c96ca6a3d78e7779cbc4c5e773aaf3ae0 (diff) |
schema changes for proper texas tax
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS.pm | 2 | ||||
-rw-r--r-- | FS/FS/cust_main_county.pm | 8 | ||||
-rw-r--r-- | FS/FS/cust_tax_exempt.pm | 131 | ||||
-rw-r--r-- | FS/FS/part_pkg.pm | 4 | ||||
-rw-r--r-- | FS/MANIFEST | 2 | ||||
-rw-r--r-- | FS/t/cust_tax_exempt.pm | 5 |
6 files changed, 150 insertions, 2 deletions
@@ -48,6 +48,8 @@ L<FS::part_referral> - Referral class L<FS::cust_main_county> - Locale (tax rate) class +L<FS::cust_tax_exempt> - Tax exemption record class + L<FS::svc_Common> - Service base class L<FS::svc_acct> - Account (shell, RADIUS, POP3) class diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm index 56d29da94..a9a4a85bd 100644 --- a/FS/FS/cust_main_county.pm +++ b/FS/FS/cust_main_county.pm @@ -57,6 +57,10 @@ currently supported: =item tax - percentage +=item taxclass + +=item exempt_amount + =back =head1 METHODS @@ -97,11 +101,15 @@ methods. sub check { my $self = shift; + $self->amount(0) unless $self->amount; + $self->ut_numbern('taxnum') || $self->ut_textn('state') || $self->ut_textn('county') || $self->ut_text('country') || $self->ut_float('tax') + || $self->ut_textn('taxclass') # ... + || $self->ut_money('amount') ; } diff --git a/FS/FS/cust_tax_exempt.pm b/FS/FS/cust_tax_exempt.pm new file mode 100644 index 000000000..ab873c0a7 --- /dev/null +++ b/FS/FS/cust_tax_exempt.pm @@ -0,0 +1,131 @@ +package FS::cust_tax_exempt; + +use strict; +use vars qw( @ISA ); +use FS::Record qw( qsearch qsearchs ); + +@ISA = qw(FS::Record); + +=head1 NAME + +FS::cust_tax_exempt - Object methods for cust_tax_exempt records + +=head1 SYNOPSIS + + use FS::cust_tax_exempt; + + $record = new FS::cust_tax_exempt \%hash; + $record = new FS::cust_tax_exempt { 'column' => 'value' }; + + $error = $record->insert; + + $error = $new_record->replace($old_record); + + $error = $record->delete; + + $error = $record->check; + +=head1 DESCRIPTION + +An FS::cust_tax_exempt object represents a historical record of a customer tax +exemption. Currently this is only used for "texas tax". FS::cust_tax_exempt +inherits from FS::Record. The following fields are currently supported: + +=over 4 + +=item exemptnum - primary key + +=item custnum - customer (see L<FS::cust_main>) + +=item taxnum - tax rate (see L<FS::cust_main_county>) + +=item year + +=item month + +=item amount + +=back + +=head1 METHODS + +=over 4 + +=item new HASHREF + +Creates a new exemption record. To add the example to the database, see +L<"insert">. + +Note that this stores the hash reference, not a distinct copy of the hash it +points to. You can ask the object for a copy with the I<hash> method. + +=cut + +# the new method can be inherited from FS::Record, if a table method is defined + +sub table { 'cust_tax_exempt'; } + +=item insert + +Adds this record to the database. If there is an error, returns the error, +otherwise returns false. + +=cut + +# the insert method can be inherited from FS::Record + +=item delete + +Delete this record from the database. + +=cut + +# the delete method can be inherited from FS::Record + +=item replace OLD_RECORD + +Replaces the OLD_RECORD with this one in the database. If there is an error, +returns the error, otherwise returns false. + +=cut + +# the replace method can be inherited from FS::Record + +=item check + +Checks all fields to make sure this is a valid example. If there is +an error, returns the error, otherwise returns false. Called by the insert +and replace methods. + +=cut + +# the check method should currently be supplied - FS::Record contains some +# data checking routines + +sub check { + my $self = shift; + + $self->ut_numbern('exemptnum') + || $self->ut_foreign_key('custnum', 'cust_main', 'custnum') + || $self->ut_foreign_key('taxnum', 'cust_main_county', 'taxnum') + || $self->ut_number('year') #check better + || $self->ut_number('month') #check better + || $self->ut_money('amount') + ; +} + +=back + +=head1 BUGS + +Texas tax is a royal pain in the ass. + +=head1 SEE ALSO + +L<FS::cust_main_county>, L<FS::cust_main>, L<FS::Record>, schema.html from the +base documentation. + +=cut + +1; + diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 8ab8ad452..1f3106544 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -235,7 +235,7 @@ sub check { || $self->ut_anything('plandata') || $self->ut_enum('setuptax', [ '', 'Y' ] ) || $self->ut_enum('recurtax', [ '', 'Y' ] ) - || $self->ut_enum('texastax', [ '', 'none', 'access', 'hosting' ] ) + || $self->ut_enum('taxclass', [ '', 'none', 'access', 'hosting' ] ) || $self->ut_enum('disabled', [ '', 'Y' ] ) ; } @@ -297,7 +297,7 @@ sub payby { =head1 VERSION -$Id: part_pkg.pm,v 1.12 2002-04-25 10:37:08 ivan Exp $ +$Id: part_pkg.pm,v 1.13 2002-05-04 15:00:18 ivan Exp $ =head1 BUGS diff --git a/FS/MANIFEST b/FS/MANIFEST index 86516e3d9..2e72d5af8 100644 --- a/FS/MANIFEST +++ b/FS/MANIFEST @@ -79,6 +79,7 @@ FS/radius_usergroup.pm FS/queue.pm FS/queue_arg.pm FS/msgcat.pm +FS/cust_tax_exempt.pm t/agent.t t/agent_type.t t/CGI.t @@ -136,3 +137,4 @@ t/queue.t t/queue_arg.t t/msgcat.t t/raddb.t +t/cust_tax_exempt.t diff --git a/FS/t/cust_tax_exempt.pm b/FS/t/cust_tax_exempt.pm new file mode 100644 index 000000000..8af13e3aa --- /dev/null +++ b/FS/t/cust_tax_exempt.pm @@ -0,0 +1,5 @@ +BEGIN { $| = 1; print "1..1\n" } +END {print "not ok 1\n" unless $loaded;} +use FS::cust_tax_exempt; +$loaded=1; +print "ok 1\n"; |