texas tax patch
Rick Eicher II
rick at pbol.net
Mon Apr 1 12:29:14 PST 2002
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="">
More information about the freeside-users
mailing list