diff options
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/part_pkg_taxproduct/compliance_solutions.html | 6 | ||||
-rw-r--r-- | httemplate/misc/xmlhttp-part_pkg_taxproduct.html | 33 |
2 files changed, 25 insertions, 14 deletions
diff --git a/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html b/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html index 78c1b0a1d..bbcb6877f 100644 --- a/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html +++ b/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html @@ -8,10 +8,12 @@ $().ready(function() { + $('#taxproduct_submit').on('click', function() { + var service_code = $('#service_code').val().split(' '); select_taxproduct( - $('#service_code').val(), - $('#service_code').val() + ' ' + $('#service_code :selected').text() + service_code[0], + service_code[1] + ' ' + $('#service_code :selected').text() ); }); }); diff --git a/httemplate/misc/xmlhttp-part_pkg_taxproduct.html b/httemplate/misc/xmlhttp-part_pkg_taxproduct.html index 4cc3a3e64..f7c8d24a6 100644 --- a/httemplate/misc/xmlhttp-part_pkg_taxproduct.html +++ b/httemplate/misc/xmlhttp-part_pkg_taxproduct.html @@ -1,4 +1,4 @@ -<% encode_json({ part_pkg_taxproduct => [ map { $_->taxproduct => $_->description } @part_pkg_taxproduct ] }) %>\ +<% encode_json({ part_pkg_taxproduct => \@part_pkg_taxproduct }) %>\ <%init> #compliance solutions specific for now, since they asked for a multi-level @@ -8,24 +8,33 @@ my( %args ) = $cgi->multi_param('arg'); -my $hashref = { 'data_vendor' => $args{'data_vendor'} }; +my @qsearch = ( + table => 'part_pkg_taxproduct', + hashref => { 'data_vendor' => $args{'data_vendor'} }, +); my @part_pkg_taxproduct; if ( $args{category} =~ /^(\w)$/ ) { + my $category = $1; - @part_pkg_taxproduct = qsearch({ - table => 'part_pkg_taxproduct', - hashref => $hashref, - extra_sql => " AND taxproduct LIKE '$category%' AND length(taxproduct) = 4 ", - }); + + @part_pkg_taxproduct = + map { $_->taxproduct => $_->description } + qsearch({ @qsearch, + extra_sql => " AND taxproduct LIKE '$category%' ". + " AND length(taxproduct) = 4 ", + }); } elsif ( $args{product_code} =~ /^([A-Z]\d+)$/ ) { + my $product_code = $1; - @part_pkg_taxproduct = qsearch({ - table => 'part_pkg_taxproduct', - hashref => $hashref, - extra_sql => " AND taxproduct LIKE '$product_code%' AND length(taxproduct) > 4 ", - }); + + @part_pkg_taxproduct = + map { $_->taxproductnum. ' '. $_->taxproduct => $_->description } + qsearch({ @qsearch, + extra_sql => " AND taxproduct LIKE '$product_code%'". + " AND length(taxproduct) > 4 ", + }); } else { die 'neither category nor product_code specified'; |