diff options
author | ivan <ivan> | 2001-10-20 12:18:00 +0000 |
---|---|---|
committer | ivan <ivan> | 2001-10-20 12:18:00 +0000 |
commit | 60c837e0aaf454dfa0b0c0283dc36928782d1b6c (patch) | |
tree | e26ad576f72742c6dfa90a14170c4f7af805cfd6 /FS | |
parent | c095a5391475464fa816b7732c40ffa7d293ac6d (diff) |
setup and recurring fee tax exempt flags, UI to edit
rework part_pkg editing UI some more
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_main.pm | 39 | ||||
-rw-r--r-- | FS/FS/part_pkg.pm | 17 |
2 files changed, 41 insertions, 15 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index dce73c0ba..3895514d4 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -813,6 +813,7 @@ sub bill { # & generate invoice database. my( $total_setup, $total_recur ) = ( 0, 0 ); + my( $taxable_setup, $taxable_recur ) = ( 0, 0 ); my @cust_bill_pkg = (); foreach my $cust_pkg ( @@ -927,37 +928,49 @@ sub bill { push @cust_bill_pkg, $cust_bill_pkg; $total_setup += $setup; $total_recur += $recur; + $taxable_setup += $setup + unless $part_pkg->dbdef_table->column('setuptax') + || $part_pkg->setuptax =~ /^Y$/i; + $taxable_recur += $recur + unless $part_pkg->dbdef_table->column('recurtax') + || $part_pkg->recurtax =~ /^Y$/i; } } } my $charged = sprintf( "%.2f", $total_setup + $total_recur ); + my $taxable_charged = sprintf( "%.2f", $taxable_setup + $taxable_recur ); unless ( @cust_bill_pkg ) { $dbh->commit or die $dbh->errstr if $oldAutoCommit; return ''; } - unless ( $self->tax =~ /Y/i || $self->payby eq 'COMP' ) { + unless ( $self->tax =~ /Y/i + || $self->payby eq 'COMP' + || $taxable_charged == 0 ) { my $cust_main_county = qsearchs('cust_main_county',{ 'state' => $self->state, 'county' => $self->county, 'country' => $self->country, } ); my $tax = sprintf( "%.2f", - $charged * ( $cust_main_county->getfield('tax') / 100 ) + $taxable_charged * ( $cust_main_county->getfield('tax') / 100 ) ); - $charged = sprintf( "%.2f", $charged+$tax ); - - my $cust_bill_pkg = new FS::cust_bill_pkg ({ - 'pkgnum' => 0, - 'setup' => $tax, - 'recur' => 0, - 'sdate' => '', - 'edate' => '', - }); - push @cust_bill_pkg, $cust_bill_pkg; + + if ( $tax > 0 ) { + $charged = sprintf( "%.2f", $charged+$tax ); + + my $cust_bill_pkg = new FS::cust_bill_pkg ({ + 'pkgnum' => 0, + 'setup' => $tax, + 'recur' => 0, + 'sdate' => '', + 'edate' => '', + }); + push @cust_bill_pkg, $cust_bill_pkg; + } } my $cust_bill = new FS::cust_bill ( { @@ -1827,7 +1840,7 @@ sub append_fuzzyfiles { =head1 VERSION -$Id: cust_main.pm,v 1.41 2001-10-15 12:16:42 ivan Exp $ +$Id: cust_main.pm,v 1.42 2001-10-20 12:17:59 ivan Exp $ =head1 BUGS diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index d84b9c5b7..ceb2a0128 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -52,6 +52,10 @@ inherits from FS::Record. The following fields are currently supported: =item recur - Recurring fee expression +=item setuptax - Setup fee tax exempt flag, empty or `Y' + +=item recurtax - Recurring fee tax exempt flag, empty or `Y' + =item plan - Price plan =item plandata - Price plan data @@ -126,7 +130,7 @@ insert and replace methods. sub check { my $self = shift; - $self->ut_numbern('pkgpart') + my $error = $self->ut_numbern('pkgpart') || $self->ut_text('pkg') || $self->ut_text('comment') || $self->ut_anything('setup') @@ -135,6 +139,15 @@ sub check { || $self->ut_alphan('plan') || $self->ut_anything('plandata') ; + return $error if $error; + + $self->setuptax =~ /^(Y?)$/ or return "Illegal setuptax: ". $self->setuptax; + $self->setuptax($1); + + $self->recurtax =~ /^(Y?)$/ or return "Illegal recrutax: ". $self->recurtax; + $self->recurtax($1); + + ''; } =item pkg_svc @@ -172,7 +185,7 @@ sub svcpart { =head1 VERSION -$Id: part_pkg.pm,v 1.3 2001-10-15 10:42:28 ivan Exp $ +$Id: part_pkg.pm,v 1.4 2001-10-20 12:17:59 ivan Exp $ =head1 BUGS |