1920 ) { // IE 2083 URL limit
+ alert('Too many selections'); // should do some session thing...
+ return false;
+ }
+ bulk_popup_link = bulk_popup_link.replace(/MAGIC_taxnum_MAGIC/, bulkstring);
+ eval(bulk_popup_link);
+ }
- print qq! collapse state! if $j>1;
+
- print "";
- }
+
+select all |
+unselect all |
+toggle all
+
+Add new tax to selected
-# $sup=$newsup;
+END
- print "{county} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{county};
+my $hashref = {};
+my $count_query = 'SELECT COUNT(*) FROM cust_main_county';
+if ( $country ) {
+ $hashref->{'country'} = $country;
+ $count_query .= ' WHERE country = '. dbh->quote($country);
+}
+if ( $state ) {
+ $hashref->{'state'} = $state;
+ $count_query .= ' AND state = '. dbh->quote($state);
+}
+if ( $county ) {
+ if ( $county eq '__NONE__' ) {
+ $hashref->{'county'} = '';
+ $count_query .= " AND ( county = '' OR county IS NULL ) ";
} else {
- print ' BGCOLOR="#cccccc">(ALL)';
- if ( $hashref->{state} ) {
- print qq!!.
- qq!expand state!;
- }
+ $hashref->{'county'} = $county;
+ $count_query .= ' AND county = '. dbh->quote($county);
}
- print " | ";
+}
+if ( $taxclass ) {
+ $hashref->{'taxclass'} = $taxclass;
+ $count_query .= ( $count_query =~ /WHERE/i ? ' AND ' : ' WHERE ' ).
+ ' taxclass = '. dbh->quote($taxclass);
+}
- print "{taxclass} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{taxclass};
+
+$cell_style = '';
+
+my @header = ( 'Country', 'State/Province', 'County',);
+my @header2 = ( '', '', '', );
+my @links = ( '', '', '', );
+my @link_onclicks = ( '', '', '', );
+my $align = 'lll';
+
+my @fields = (
+ sub { my $country = shift->country;
+ code2country($country). " ($country)";
+ },
+ sub { state_label($_[0]->state, $_[0]->country).
+ ( $_[0]->state
+ ? ''
+ : ' '. expand_link( desc => 'Add States',
+ row => $_[0],
+ label => 'add states',
+ )
+ )
+ },
+ sub { $_[0]->county || '(all) '.
+ expand_link( desc => 'Add Counties',
+ row => $_[0],
+ label => 'add counties',
+ )
+ },
+);
+
+my @color = (
+ '000000',
+ sub { shift->state ? '000000' : '999999' },
+ sub { shift->county ? '000000' : '999999' },
+);
+
+if ( $conf->exists('enable_taxclasses') ) {
+ push @header, qq!Tax class (add new)!;
+ push @header2, '(per-package classification)';
+ push @fields, sub { $_[0]->taxclass || '(all) '.
+ separate_taxclasses_link($_[0], 'Separate Taxclasses').
+ 'separate taxclasses'
+ };
+ push @color, sub { shift->taxclass ? '000000' : '999999' };
+ push @links, '';
+ push @link_onclicks, '';
+ $align .= 'l';
+}
+
+push @header,
+ '', #checkbox column
+ 'Tax name',
+ 'Rate', #'Tax',
+ 'Exemptions',
+ ;
+
+push @header2,
+ '',
+ '(printed on invoices)',
+ '',
+ '',
+ ;
+
+my $newregion = 1;
+my $cb_oldrow = '';
+my $cb_sub = sub {
+ my $cust_main_county = shift;
+
+ if ( $cb_oldrow ) {
+ if ( $cb_oldrow->country ne $cust_main_county->country
+ || $cb_oldrow->state ne $cust_main_county->state
+ || $cb_oldrow->county ne $cust_main_county->county
+ || $cb_oldrow->taxclass ne $cust_main_county->taxclass )
+ {
+ $newregion = 1;
+ } else {
+ $newregion = 0;
+ }
+
} else {
- print ' BGCOLOR="#cccccc">(ALL)';
- if ( $enable_taxclasses ) {
- print qq!!.
- qq!expand taxclasses!;
- }
+ $newregion = 1;
+ }
+ $cb_oldrow = $cust_main_county;
+ if ( $newregion ) {
+ my $taxnum = $cust_main_county->taxnum;
+ qq!!;
+ } else {
+ '';
}
- print " | ";
+};
- print "$hashref->{tax}% | ".
- '$'.
- sprintf("%.2f", $hashref->{exempt_amount} || 0). ' | '.
- '';
+push @fields,
+ $cb_sub,
+ sub { shift->taxname || 'Tax' },
+ sub { shift->tax. '% (edit)' },
+ $exempt_sub,
+;
-}
+push @color,
+ '000000',
+ sub { shift->taxname ? '000000' : '666666' },
+ sub { shift->tax ? '000000' : '666666' },
+ '000000',
+;
-print <
-