texas tax calc

Rick Eicher II rick at pbol.net
Thu Mar 14 10:18:33 PST 2002


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





More information about the freeside-devel mailing list