1 <& /elements/header-popup.html, $title &>
2 <& /browse/elements/browse.html,
3 'name_singular' => 'tax product',
4 #'html_form' => include('.form', $category_code),
6 'table' => 'part_pkg_taxproduct',
8 'order_by' => 'ORDER BY taxproduct',
10 'count_query' => $count_query,
15 'link_onclicks' => \@link_onclicks,
20 $().ready(function() {
21 var new_taxproduct = $('#new_taxproduct');
22 var new_taxproduct2 = $('#new_taxproduct2');
23 // var new_category_desc = $('#new_category_desc');
24 var new_taxproduct_desc = $('#new_taxproduct_desc');
25 var new_taxproduct_submit = $('#new_taxproduct_submit');
27 // new_taxproduct.on('keyup', function() {
28 // var curr_value = this.value || '';
29 // if (curr_value.match(/^\d{7}$/)) {
30 // new_taxproduct_submit.prop('disabled', false);
32 // new_taxproduct_submit.prop('disabled', true);
36 new_taxproduct_submit.on('click', function() {
37 select_taxproduct( -1,
38 new_taxproduct.val() + new_taxproduct2.val()
40 // + new_category_desc.val()
42 + new_taxproduct_desc.val()
46 // post the values back to the parent form
47 function select_taxproduct(taxproductnum, description) {
48 parent.document.getElementById('<% $id %>').value = taxproductnum;
49 parent.document.getElementById('<% $id %>_description').value = description;
56 Please contact <a href="http://csilongwood.com/" target="_blank">Compliance Solutions</a> for a full list of your product and service codes.<BR><BR>
59 <FONT SIZE="+1"><B><% emt('Add tax product') %></B></FONT>
60 <% ntable('#cccccc', 2) %>
61 <& /elements/tr-input-text.html,
62 'label' => emt('Product code'),
63 'field' => 'new_taxproduct',
64 'id' => 'new_taxproduct',
68 <& /elements/tr-input-text.html,
69 'label' => emt('Service code'),
70 'field' => 'new_taxproduct2',
71 'id' => 'new_taxproduct2',
75 <& /elements/tr-input-text.html,
76 'label' => emt('Product name'),
77 'field' => 'new_taxproduct_desc',
78 'id' => 'new_taxproduct_desc',
81 %# <input type="button" id="new_taxproduct_submit" disabled=1 value="Add">
82 <input type="button" id="new_taxproduct_submit" value="Add">
85 <& /elements/footer-popup.html &>
89 #taxproduct is 7 digits: 4-digit (well, alpha) productcode + 3-digit servicecode
90 # Description is also two parts, corresponding to those codes, separated with
93 my (@productcodes, @servicecodes);
94 foreach my $row ( qsearch({
95 table => 'part_pkg_taxproduct',
96 select => 'DISTINCT substr(taxproduct, 1, 4) AS productcode ',
97 hashref => { data_vendor => 'compliance_solutions' },
100 push @productcodes, $row->{productcode};
103 foreach my $row ( qsearch({
104 table => 'part_pkg_taxproduct',
105 select => 'DISTINCT substr(taxproduct, 4, 3) AS servicecode ',
106 hashref => { data_vendor => 'compliance_solutions' },
109 push @servicecodes, $row->{servicecode};
116 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
118 $cgi->param('id') =~ /^\w+$/ or die "missing id parameter";
119 my $id = $cgi->param('id');
121 my $select_onclick = sub {
123 my $taxnum = $row->taxproductnum;
124 my $desc = $row->taxproduct . ' ' . $row->description;
125 "select_taxproduct('$taxnum', '$desc')";
129 my $title = 'Tax Products';
131 my $hashref = { data_vendor => 'compliance_solutions' };
133 #my ($category_code, $taxproduct);
134 #if ( $cgi->param('category_code') =~ /^(\d+)$/ ) {
135 # $category_code = $1;
136 # $taxproduct = $category_code . '%';
140 my $taxproduct = '%';
142 $hashref->{taxproduct} = { op => 'LIKE', value => $taxproduct };
144 my $count_query = "SELECT COUNT(*) FROM part_pkg_taxproduct ".
145 "WHERE data_vendor = 'compliance_solutions' AND ".
146 "taxproduct LIKE '$taxproduct'";
161 my @link_onclicks = ( $select_onclick, $select_onclick );