[freeside-devel] texas tax calc

Rick Eicher II rick at pbol.net
Thu Mar 14 10:32:04 PST 2002


Sorry old code.

Here what I have.

################################
if ( $part_pkg->dbdef_table->column('taxclass') && $part_pkg->taxclass !=
'none' ){
  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 ));
  }
####################


> -----Original Message-----
> From: ivan [mailto:ivan at 420.am]
> Sent: Thursday, March 14, 2002 12:24 PM
> To: ivan-freeside-devel at sisd.com
> Subject: Re: [freeside-devel] texas tax calc
>
>
> >      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