[freeside] texas tax patch

ivan ivan at 420.am
Mon Apr 15 13:17:54 PDT 2002


I can't even apply this patch to inspect the changes:

ivan at rootwood:~/texastax/freeside$ patch -p1 <../texastax.patch 
patching file FS/FS/cust_main.pm
patch: **** malformed patch at line 12: @@ -861,6 +861,9 @@

Can you send a usable patch, please?  If you can't apply the patch
yourself to an unmodified checkout of the code, that's a good indication
you shouldn't be sending it to the mailing list four times. 

>From a visual inspection of the patch it looks like you still need to (at 
least):
- patch README.1.4.0pre12
- add a configuration option so none of this gets turned on unless
  requested.
- allow null values in the `taxclass' field or otherwise handle folks
  upgrades from folks who *aren't* running this code.

I'm holding up 1.4.0pre12 for this (since this is the last prerelease I'd
like to make schema changes in) but I won't much longer.  If you (or
anyone else in texas) wants to see this in 1.4.0 you need to get on the
ball on this...


On Mon, Apr 01, 2002 at 02:29:09PM -0600, Rick Eicher II wrote:
> Only in freeside_new/FS/FS: CGIwrapper.pm
> Only in freeside/FS/FS: CVS
> Only in freeside/FS/FS/UI: CVS
> diff -rub freeside/FS/FS/cust_main.pm freeside_new/FS/FS/cust_main.pm
> --- freeside/FS/FS/cust_main.pm Fri Mar  1 05:14:08 2002
> +++ freeside_new/FS/FS/cust_main.pm     Mon Apr  1 08:17:55 2002
> @@ -29,7 +29,7 @@
> 
>  @ISA = qw( FS::Record );
> 
>  $import = 0;
> @@ -861,6 +861,9 @@
>    my( $total_setup, $total_recur ) = ( 0, 0 );
>    my( $taxable_setup, $taxable_recur ) = ( 0, 0 );
>    my @cust_bill_pkg = ();
> +  my $tax = 0;
> +  my $taxable_charged = 0;
> +  my $charged = 0;
> 
>    foreach my $cust_pkg (
>      qsearch('cust_pkg', { 'custnum' => $self->custnum } )
> @@ -981,24 +984,19 @@
>          push @cust_bill_pkg, $cust_bill_pkg;
>          $total_setup += $setup;
>          $total_recur += $recur;
> -        $taxable_setup += $setup
> +        $taxable_setup = $setup
>            unless $part_pkg->dbdef_table->column('setuptax')
>                   && $part_pkg->setuptax =~ /^Y$/i;
> -        $taxable_recur += $recur
> +        $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 '';
> -  }
> +    $taxable_charged = sprintf( "%.2f", $taxable_setup + $taxable_recur );
> 
>    unless ( $self->tax =~ /Y/i
>             || $self->payby eq 'COMP'
> @@ -1009,9 +1007,31 @@
>          'country' => $self->country,
>      } ) or die "fatal: can't find tax rate for state/county/country ".
>                 $self->state. "/". $self->county. "/". $self->country. "\n";
> -    my $tax = sprintf( "%.2f",
> -      $taxable_charged * ( $cust_main_county->getfield('tax') / 100 )
> -    );
> +     my $taxclass = $part_pkg->getfield('taxclass');
> +
> +     if ( $taxclass ne 'none' ){
> +       if ( $taxclass eq 'access' && $taxable_charged > 25){
> +         $taxable_charged = $taxable_charged - 25;
> +         $tax += sprintf( "%.2f",$taxable_charged * (
> $cust_main_county->getfield('tax') / 100 ));
> +      }elsif ($taxclass eq '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 ));
> +     }
> +    }
> +  }
> +  $tax = sprintf( "%.2f",$tax);
> +  $charged = sprintf( "%.2f", $total_setup + $total_recur );
> +
> +  unless ( @cust_bill_pkg ) {
> +    $dbh->commit or die $dbh->errstr if $oldAutoCommit;
> +    return '';
> +  }
> 
>      if ( $tax > 0 ) {
>        $charged = sprintf( "%.2f", $charged+$tax );
> @@ -1025,8 +1045,8 @@
>        });
>        push @cust_bill_pkg, $cust_bill_pkg;
>      }
> -  }
> 
>    my $cust_bill = new FS::cust_bill ( {
>      'custnum' => $self->custnum,
>      '_date'   => $time,
> diff -rub freeside/FS/FS/part_pkg.pm freeside_new/FS/FS/part_pkg.pm
> --- freeside/FS/FS/part_pkg.pm  Mon Feb 18 02:39:21 2002
> +++ freeside_new/FS/FS/part_pkg.pm      Mon Mar 18 08:10:33 2002
> @@ -59,6 +59,8 @@
> 
>  =item recurtax - Recurring fee tax exempt flag, empty or `Y'
> 
> +=item taxclass - Texas tax class flag, empty or `Y'
> +
>  =item plan - Price plan
> 
>  =item plandata - Price plan data
> @@ -224,6 +226,7 @@
>        || $self->ut_alphan('plan')
>        || $self->ut_anything('plandata')
>        || $self->ut_enum('setuptax', [ '', 'Y' ] )
> +      || $self->ut_enum('taxclass',['none','access','hosting' ] )
>        || $self->ut_enum('recurtax', [ '', 'Y' ] )
>        || $self->ut_enum('disabled', [ '', 'Y' ] )
>      ;
> diff -rub freeside/aspdocs/docs/schema.html
> freeside_new/aspdocs/docs/schema.html
> --- freeside/aspdocs/docs/schema.html   Thu Mar 14 06:06:14 2002
> +++ freeside_new/aspdocs/docs/schema.html       Mon Mar 18 08:08:11 2002
> @@ -226,7 +226,6 @@
>          <li>plan - price plan
>          <li>plandata - additional price plan data
>          <li>disabled - Disabled flag, empty or `Y'
> -        <li>taxclass - tax class used for calculating texas tax,
> none,access,hosting
>        </ul>
>      <li><a name="part_referral"
> href="man/FS/part_referral.html">part_referral</a> - Referral listing
>        <ul>
> Only in freeside_new/bin: .fs-setup.swp
> diff -rub freeside/bin/fs-setup freeside_new/bin/fs-setup
> --- freeside/bin/fs-setup       Mon Mar 18 08:18:27 2002
> +++ freeside_new/bin/fs-setup   Mon Mar 18 08:08:07 2002
> @@ -656,6 +656,7 @@
>          'plan',       'varchar', 'NULL', $char_d,
>          'plandata',   'text', 'NULL', '',
>          'disabled',   'char', 'NULL', 1,
> +        'taxclass',    'varchar',   '',   $char_d,
>        ],
>        'primary_key' => 'pkgpart',
>        'unique' => [ [] ],
> @@ -956,3 +957,4 @@
>    %tables;
> 
>  }
> +
> diff -rub freeside/httemplate/docs/schema.html
> freeside_new/httemplate/docs/schema.html
> --- freeside/httemplate/docs/schema.html        Thu Mar 14 06:06:14 2002
> +++ freeside_new/httemplate/docs/schema.html    Mon Mar 18 08:09:12 2002
> @@ -226,7 +226,6 @@
>          <li>plan - price plan
>          <li>plandata - additional price plan data
>          <li>disabled - Disabled flag, empty or `Y'
> +        <li>taxclass - tax class used for calculating texas tax,
> none,access,hosting
>        </ul>
>      <li><a name="part_referral"
> href="man/FS/part_referral.html">part_referral</a> - Referral listing
>        <ul>
> diff -rub freeside/httemplate/edit/part_pkg.cgi
> freeside_new/httemplate/edit/part_pkg.cgi
> --- freeside/httemplate/edit/part_pkg.cgi       Mon Feb 18 20:57:39 2002
> +++ freeside_new/httemplate/edit/part_pkg.cgi   Mon Mar 18 08:09:12 2002
> @@ -100,6 +100,26 @@
> 
>  print '</TD></TR>';
> 
> +print <<END;
> +<TR><TD ALIGN="right">Use Texas Tax Class</TD><TD>
> +END
> +
> +#print '<INPUT TYPE="text" NAME="taxclass">';
> +
> +print '<SELECT SIZE="1" NAME="taxclass">';
> +print '<OPTION VALUE="none"';
> +print ' SELECTED' if $hashref->{taxclass} eq "none";
> +print '>None</OPTION>';
> +print '<OPTION VALUE="access"';
> +print ' SELECTED' if $hashref->{taxclass} eq "access";
> +print '>access</OPTION>';
> +print '<OPTION VALUE="hosting"';
> +print ' SELECTED' if $hashref->{taxclass} eq "hosting";
> +print '>hosting</OPTION></SELECT>';
> +
> +print '</TD></TR>';
> +
> +
>  print '<TR><TD ALIGN="right">Disable new orders</TD><TD>';
>  print '<INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"';
>  print ' CHECKED' if $hashref->{disabled} eq "Y";
> @@ -354,7 +374,7 @@
>  }
> 
>  function fixup(what) {
> -<% foreach my $f ( qw( pkg comment freq ), @fixups ) { %>
> +<% foreach my $f ( qw( pkg comment freq taxclass), @fixups ) { %>
>    what.<%= $f %>.value = document.dummy.<%= $f %>.value;
>  <% } %>
>  <% foreach my $f ( qw( setuptax recurtax disabled ) ) { %>
> @@ -395,6 +415,7 @@
>  <INPUT TYPE="hidden" NAME="freq" VALUE="<%= $hashref->{freq} %>">
>  <INPUT TYPE="hidden" NAME="setuptax" VALUE="<%= $hashref->{setuptax} %>">
>  <INPUT TYPE="hidden" NAME="recurtax" VALUE="<%= $hashref->{recurtax} %>">
> +<INPUT TYPE="hidden" NAME="taxclass" VALUE="<%= $hashref->{taxclass} %>">
>  <INPUT TYPE="hidden" NAME="disabled" VALUE="<%= $hashref->{disabled} %>">
>  <% foreach my $f ( @fixups ) { %>
>  <INPUT TYPE="hidden" NAME="<%= $f %>" VALUE="">
> 
> 

-- 
_ivan



More information about the freeside-users mailing list