[freeside-devel] texas tax calc

ivan ivan at 420.am
Thu Mar 14 10:23:36 PST 2002


>      if ( $part_pkg->dbdef_table->column('taxclass') && $part_pkg->texastax
                                                                     ^^^^^^^^

for starters, you're still referring to the "texastax" field.

Also, please try to make sure the long lines in your code don't wrape in
your email. This makes it rather difficult for people to look at and
understand your changes. You shouldn't be going over 80 characters wide
anyway. 

Good luck.

On Thu, Mar 14, 2002 at 12:18:26PM -0600, Rick Eicher II wrote:
> Here is the code I have inserted in the foreach loop of cust_main.pm around
> line 995:
> 
> $taxable_charged = sprintf( "%.2f", $taxable_setup + $taxable_recur );
>     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,
>      } ) or die "fatal: can't find tax rate for state/county/country ".
>                $self->state. "/". $self->county. "/". $self->country. "\n";
>      if ( $part_pkg->dbdef_table->column('taxclass') && $part_pkg->texastax
> =~ /^Y$/i ){
>        if ( $part_pkg->taxclass == 'access' && $taxable_charged > 25){
>           $taxable_charged = $taxable_charged - 25;
>           $tax += sprintf( "%.2f",$taxable_charged * (
> $cust_main_county->getfield('tax') / 100 ));
>        }elsif ($part_pkg->taxclass == 'hosting') {
>           $taxable_charged = $taxable_charged * .80;
>           $tax += sprintf( "%.2f",$taxable_charged * (
> $cust_main_county->getfield('tax') / 100 ));
>        }else{
>           $tax += sprintf("%.2f",0);
>       }
>     }else{
>           $tax += sprintf( "%.2f",$taxable_charged * (
> $cust_main_county->getfield('tax') / 100 ));
>      }
>     }
> 
> 
> This is giving the wrong tax. I will contiune to work on this but wanted to
> submit this snip of code for suggestions and/or corrections.
> 
> rick
> 
> 

-- 
_ivan



More information about the freeside-devel mailing list