1 <FORM NAME="choosegeocodeform">
2 <CENTER><BR><B>Choose tax location</B><BR><BR>
3 <P STYLE="<% $style %>"><% $header %></P>
5 <SELECT NAME='geocodes' ID='geocodes' STYLE="<% $style %>">
6 % foreach my $location (@cust_tax_location) {
7 % my $value = encode_entities(objToJson({ zip => $zip5,
8 % map { $_ => $location->$_ }
9 % qw ( city state geocode )
13 % $content .= $location->$_. ' ' x ( $max{$_} - length($location->$_) )
14 % foreach qw( city county state );
15 % $content .= $location->cityflag eq 'I' ? 'Y' : 'N' ;
17 % if (!$have_selected && lc($location->city) eq lc($city)) {
18 % $selected = 'SELECTED';
20 <OPTION VALUE="<% $value %>" STYLE="<% $style %>" <% $selected %>><% $content %>
25 <TD> <BUTTON TYPE="button" onClick="set_geocode(document.getElementById('geocodes')); document.bottomform.submit();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Set location </BUTTON></TD>
26 <TD><BUTTON TYPE="button" onClick="document.bottomform.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission </BUTTON></TD>
34 my $conf = new FS::Conf;
35 my $have_selected = 0;
37 my ($data_vendor) = $cgi->param('data_vendor') =~ /^([-\w]+)$/;
38 my ($city) = $cgi->param('city') =~ /^([\w ]+)$/;
39 my ($state) = $cgi->param('state') =~ /^(\w+)$/;
40 my ($zip) = $cgi->param('zip') =~ /^([-\w]+)$/;
42 my($zip5, $zip4) = split('-', $zip);
44 my $hashref = { data_vendor => $data_vendor,
49 #my @keys = qw ( city state zip );
50 my @keys = qw ( zip );
51 my @cust_tax_location = ();
52 until ( @cust_tax_location ) {
53 @cust_tax_location = qsearch({ table => 'cust_tax_location',
55 order_by => 'LIMIT 50',
57 last unless scalar(@keys);
58 delete $hashref->{ shift @keys };
61 my %max = ( city => 4, county => 6, state => 5);
62 foreach my $location (@cust_tax_location) {
63 foreach ( qw( city county state ) ) {
64 my $length = length($location->$_);
65 $max{$_} = ($length > $max{$_}) ? $length : $max{$_};
68 $max{$_}++ foreach qw( city county state );
70 my $header = ' ';
71 $header .= $_. ' ' x ( $max{lc($_)} - length($_) )
72 foreach qw( City County State );
73 $header .= "In city?";
75 my $style = "font-family:monospace;";