1 <& /elements/header-popup.html, 'Select tax product' &>
3 <& '/elements/xmlhttp.html',
4 'url' => $fsurl.'misc/xmlhttp-part_pkg_taxproduct.html',
5 'subs' => [ 'get_part_pkg_taxproduct'] &>
11 $('#taxproduct_submit').on('click', function() {
13 $('#service_code').val(),
14 $('#service_code').val() + ' ' + $('#service_code :selected').text()
19 // post the values back to the parent form
20 function select_taxproduct(taxproductnum, description) {
21 parent.document.getElementById('<% $id %>').value = taxproductnum;
22 parent.document.getElementById('<% $id %>_description').value = description;
26 function jopt(what,value,text) {
27 var optionName = new Option(text, value, false, false);
28 what.append(optionName);
31 function category_changed(what) {
32 var category = what.options[what.selectedIndex].value;
34 if ( category.length == 0 ) {
35 $('#product_code').empty();
36 $('#service_code').empty();
37 $('#taxproduct_submit').prop('disabled', true);
41 get_part_pkg_taxproduct(
42 'data_vendor', 'compliance_solutions', 'category', category,
45 $('#product_code').empty();
46 $('#service_code').empty();
47 $('#taxproduct_submit').prop('disabled', true);
49 var reply = JSON.parse(data);
51 jopt( $('#product_code'), '', 'Select product code' );
53 var part_pkg_taxproduct = reply.part_pkg_taxproduct;
54 for ( var s = 0; s < part_pkg_taxproduct.length; s=s+2 ) {
55 var product_code = part_pkg_taxproduct[s];
56 var description = part_pkg_taxproduct[s+1];
57 jopt( $('#product_code'), product_code, description );
65 function product_code_changed(what) {
66 var product_code = what.options[what.selectedIndex].value;
68 if ( product_code.length == 0 ) {
69 $('#service_code').empty();
70 $('#taxproduct_submit').prop('disabled', true);
74 get_part_pkg_taxproduct(
75 'data_vendor', 'compliance_solutions', 'product_code', product_code,
78 $('#service_code').empty();
79 $('#taxproduct_submit').prop('disabled', true);
81 jopt( $('#service_code'), '', 'Select service code' );
83 var reply = JSON.parse(data);
85 var part_pkg_taxproduct = reply.part_pkg_taxproduct;
86 for ( var s = 0; s < part_pkg_taxproduct.length; s=s+2 ) {
87 var product_service_code = part_pkg_taxproduct[s];
88 var description = part_pkg_taxproduct[s+1];
89 jopt( $('#service_code'), product_service_code, description );
97 function service_code_changed(what) {
98 var service_code = what.options[what.selectedIndex].value;
100 if ( service_code.length > 0 ) {
101 $('#taxproduct_submit').prop('disabled', false);
103 $('#taxproduct_submit').prop('disabled', true);
110 <% ntable('#cccccc', 2) %>
112 <& /elements/tr-select.html,
113 label => emt('Category'),
116 options => [ '', qw( C G N S T V W )],
118 '' => 'Select category',
120 'G' => 'GENERAL MERCHANDISE',
121 'N' => 'NON-TAXABLE AND EXEMPT',
127 onchange => 'category_changed(what);',
130 <& /elements/tr-select.html,
131 label => emt('Product code'),
132 field => 'product_code',
133 id => 'product_code',
134 onchange => 'product_code_changed(what);',
137 <& /elements/tr-select.html,
138 label => emt('Service code'),
139 field => 'service_code',
140 id => 'service_code',
141 onchange => 'service_code_changed(what);',
147 <input type="button" id="taxproduct_submit" value="Select Product" DISABLED>
150 <& /elements/footer-popup.html &>
154 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
156 $cgi->param('id') =~ /^\w+$/ or die "missing id parameter";
157 my $id = $cgi->param('id');
159 my $hashref = { data_vendor => 'compliance_solutions' };