[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.84, 1.85 tax_rate.html, 1.1, 1.2

Jeff Finucane,420,, jeff at wavetail.420.am
Sun Apr 6 09:12:48 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv8622/httemplate/edit

Modified Files:
	part_pkg.cgi tax_rate.html 
Log Message:
new tax rating engine

Index: tax_rate.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/tax_rate.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tax_rate.html	1 Apr 2008 00:54:43 -0000	1.1
+++ tax_rate.html	6 Apr 2008 16:12:46 -0000	1.2
@@ -1,14 +1,21 @@
 <% include('elements/edit.html',
-     'popup'  => 1,
-     'name'   => 'Tax rate', #Edit tax rate
-     'table'  => 'tax_rate',
-     'labels' => $labels,
-     'fields' => \@fields,
+     'popup'          => 1,
+     'name'           => 'Tax rate', #Edit tax rate
+     'table'          => 'tax_rate',
+     'labels'         => $labels,
+     'fields'         => \@fields,
+     'value_callback' => $value_callback,
    )
 %>
 <%once>
 
 my $conf = new FS::Conf;
+my $value_callback =
+  sub { my ( $field, $value ) = @_;
+        ( $field =~ /^(tax|excessrate|usetax|useexcessrate)$/ )
+          ? $value*100
+          : $value;
+      };
 
 </%once>
 
@@ -90,16 +97,9 @@
     { field=>'passtype',             type=>'hidden' } ,
     { field=>'passtype_name',        type=>'fixed' } ,
     { field=>'passflag',             type=>'fixed' } ,
-    { field=>'setuptax',             type=>'checkbox' } ,
-    { field=>'recurtax',             type=>'checkbox' } ,
+    { field=>'setuptax',             type=>'checkbox', value=>'Y'  } ,
+    { field=>'recurtax',             type=>'checkbox', value=>'Y'  } ,
     { field=>'manual',               type=>'hidden', value=>'Y' } ,
 );
 
-#push @fields,
-#  { type=>'tablebreak-tr-title', value=>'Exemptions' },
-#  { field=>'setuptax', type=>'checkbox', value=>'Y', },
-#  { field=>'recurtax', type=>'checkbox', value=>'Y', },
-#  { field=>'exempt_amount', type=>'money', },
-#;
-
 </%init>

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- part_pkg.cgi	2 Apr 2008 20:42:43 -0000	1.84
+++ part_pkg.cgi	6 Apr 2008 16:12:45 -0000	1.85
@@ -94,7 +94,7 @@
         <TD align="right">Tax product</TD>
         <TD>
           <INPUT name="part_pkg_taxproduct_taxproductnum" id="taxproductnum" type="hidden" value="<% $hashref->{'taxproductnum'}%>">
-          <INPUT name="part_pkg_taxproduct_description" id="taxproduct_description" type="text" value="<% $taxproduct_description %>" size="12" onclick="overlib( OLiframeContent('part_pkg_taxproduct.html?'+document.getElementById('taxproductnum').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
+          <INPUT name="part_pkg_taxproduct_description" id="taxproductnum_description" type="text" value="<% $taxproduct_description %>" size="12" onclick="overlib( OLiframeContent('<% $p %>/browse/part_pkg_taxproduct.cgi?_type=select&id=taxproductnum&taxproductnum='+document.getElementById('taxproductnum').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); return false;">
         </TD>
       </TR>
       <TR>
@@ -111,6 +111,7 @@
 % } else { 
 
   <INPUT TYPE="hidden" NAME="taxproductnum" VALUE="<% $hashref->{taxproductnum} %>">
+  <INPUT TYPE="hidden" NAME="tax_override" VALUE="<% $tax_override %>">
 
 % } 
 
@@ -466,10 +467,16 @@
 } elsif ( $query && $query =~ /^(\d+)$/ ) {
   (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{'pkgpart'=>$1})
     unless $part_pkg;
-  $tax_override =
+  unless ($part_pkg) {
+    $tax_override =
     join (",", map {$_->taxclassnum}
-               qsearch('part_pkg_taxoverride',{'pkgpart'=>$1}))
-    unless $part_pkg;
+               qsearch( 'part_pkg_taxoverride', {'pkgpart' => $1} )
+         );
+#    join (",", map {$_->taxclassnum}
+#               $part_pkg->part_pkg_taxrate( 'cch', $conf->config('defaultloc')
+#         );
+#      unless $tax_override;
+  }
   $part_pkg ||= qsearchs('part_pkg',{'pkgpart'=>$1});
   $pkgpart = $part_pkg->pkgpart;
 } else {



More information about the freeside-commits mailing list