From e5b2660aefd03bc4b32386e1c38c53814c002c8d Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 20 Jun 2017 16:32:00 -0700 Subject: Compliance Solutions integration, RT#75262 --- .../part_pkg_taxproduct/compliance_solutions.html | 163 +++++++++++++++++++++ httemplate/browse/part_pkg_taxproduct/suretax.html | 1 + 2 files changed, 164 insertions(+) create mode 100644 httemplate/browse/part_pkg_taxproduct/compliance_solutions.html (limited to 'httemplate/browse') diff --git a/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html b/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html new file mode 100644 index 000000000..cf07b3189 --- /dev/null +++ b/httemplate/browse/part_pkg_taxproduct/compliance_solutions.html @@ -0,0 +1,163 @@ +<& /elements/header-popup.html, $title &> +<& /browse/elements/browse.html, + 'name_singular' => 'tax product', + #'html_form' => include('.form', $category_code), + 'query' => { + 'table' => 'part_pkg_taxproduct', + 'hashref' => $hashref, + 'order_by' => 'ORDER BY taxproduct', + }, + 'count_query' => $count_query, + 'header' => \@header, + 'fields' => \@fields, + 'align' => $align, + 'links' => [], + 'link_onclicks' => \@link_onclicks, + 'nohtmlheader' => 1, + 'disable_total' => 1, +&> + +
+ +Please contact Compliance Solutions for a full list of your product and service codes.

+ +
+ <% emt('Add tax product') %> + <% ntable('#cccccc', 2) %> + <& /elements/tr-input-text.html, + 'label' => emt('Product code'), + 'field' => 'new_taxproduct', + 'id' => 'new_taxproduct', + 'size' => 4, + 'maxlength' => 4, + &> + <& /elements/tr-input-text.html, + 'label' => emt('Service code'), + 'field' => 'new_taxproduct2', + 'id' => 'new_taxproduct2', + 'size' => 3, + 'maxlength' => 3, + &> + <& /elements/tr-input-text.html, + 'label' => emt('Product name'), + 'field' => 'new_taxproduct_desc', + 'id' => 'new_taxproduct_desc', + &> + +%# + +
+ +<& /elements/footer-popup.html &> +<%shared> +# populate dropdown + +#taxproduct is 7 digits: 4-digit (well, alpha) productcode + 3-digit servicecode +# Description is also two parts, corresponding to those codes, separated with +# a :. + +my (@productcodes, @servicecodes); +foreach my $row ( qsearch({ + table => 'part_pkg_taxproduct', + select => 'DISTINCT substr(taxproduct, 1, 4) AS productcode ', + hashref => { data_vendor => 'compliance_solutions' }, + })) +{ + push @productcodes, $row->{productcode}; +} + +foreach my $row ( qsearch({ + table => 'part_pkg_taxproduct', + select => 'DISTINCT substr(taxproduct, 4, 3) AS servicecode ', + hashref => { data_vendor => 'compliance_solutions' }, + })) +{ + push @servicecodes, $row->{servicecode}; +} + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +$cgi->param('id') =~ /^\w+$/ or die "missing id parameter"; +my $id = $cgi->param('id'); + +my $select_onclick = sub { + my $row = shift; + my $taxnum = $row->taxproductnum; + my $desc = $row->taxproduct . ' ' . $row->description; + "select_taxproduct('$taxnum', '$desc')"; +}; + +my @menubar; +my $title = 'Tax Products'; + +my $hashref = { data_vendor => 'compliance_solutions' }; + +#my ($category_code, $taxproduct); +#if ( $cgi->param('category_code') =~ /^(\d+)$/ ) { +# $category_code = $1; +# $taxproduct = $category_code . '%'; +#} else { +# $taxproduct = '%'; +#} +my $taxproduct = '%'; + +$hashref->{taxproduct} = { op => 'LIKE', value => $taxproduct }; + +my $count_query = "SELECT COUNT(*) FROM part_pkg_taxproduct ". + "WHERE data_vendor = 'compliance_solutions' AND ". + "taxproduct LIKE '$taxproduct'"; + +my @fields = ( + 'taxproduct', + 'description', +# 'note' +); + +my @header = ( + 'Code', + 'Description', +# '', +); + +my $align = 'lll'; +my @link_onclicks = ( $select_onclick, $select_onclick ); + + diff --git a/httemplate/browse/part_pkg_taxproduct/suretax.html b/httemplate/browse/part_pkg_taxproduct/suretax.html index 178062c4a..4605c1f34 100755 --- a/httemplate/browse/part_pkg_taxproduct/suretax.html +++ b/httemplate/browse/part_pkg_taxproduct/suretax.html @@ -91,6 +91,7 @@ function select_taxproduct(taxproductnum, description) { +<& /elements/footer-popup.html &> <%shared> # populate dropdown -- cgit v1.2.1