diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-01-18 19:43:48 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-01-18 19:52:12 -0800 |
commit | 1553b7eca477f52824b6b352a0e87df68622411b (patch) | |
tree | 2d91aa37492805547ee420a6076b595b711a8278 /httemplate/elements | |
parent | 6d3897cc5511c4f39bf6f9c02432ba7e600bfe74 (diff) |
one-time charges on quotations, RT#25561
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/one_time_charge_link.html | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/httemplate/elements/one_time_charge_link.html b/httemplate/elements/one_time_charge_link.html new file mode 100644 index 000000000..4ef5ede4d --- /dev/null +++ b/httemplate/elements/one_time_charge_link.html @@ -0,0 +1,114 @@ +<%doc> + +Example: + + <& /elements/one_time_charge_link.html, + + #one of these is required + 'custnum' => $custnum, + 'prospectnum' => $prospectnum, + + &> + +</%doc> +<SCRIPT TYPE="text/javascript"> + +function taxproductmagic(which) { + + var str = ''; + var elements = which.form.elements; + for (var i = 0; i<elements.length; i++) { + + if (elements[i].name == 'taxproductnum'){ + document.getElementById('taxproductnum').value = elements[i].value; + continue; + } + if (elements[i].name == 'taxproductnum_description'){ + continue; + } + + if (str.length){str += ';';} + + var value = ''; + if ( elements[i].type == 'checkbox' || elements[i].type == 'radio' ) { + if ( elements[i].checked == true ) { + value = elements[i].value; + //} else { + // value = ''; + } + } else { + value = elements[i].value; + } + str += elements[i].name + '=' + escape(value); + + } + document.getElementById('charge_storage').value = str; + cClick(); + overlib( OLiframeContent('<% $p %>/browse/part_pkg_taxproduct.cgi?_type=select&id=taxproductnum&onclick=taxproductquickchargemagic&taxproductnum='+document.getElementById('taxproductnum').value, 1000, 400, 'tax_product_popup'), CAPTION, 'Select product', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); +} + +function taxproductquickchargemagic() { + var str = document.getElementById('charge_storage').value; + if (str.length){str += ';';} + str += 'magic=taxproductnum;taxproductnum='; + str += escape(document.getElementById('taxproductnum').value); + cClick(); + overlib( OLiframeContent('<% $p %>/edit/quick-charge.html?'+str, 545, 336, 'One-time charge'), CAPTION, 'One-time charge', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '#333399', CGCOLOR, '#333399', CLOSETEXT, <% mt('Close') |js_string %>); + +} + +function taxoverridemagic(which) { + var str = ''; + var elements = which.ownerDocument.QuickChargeForm.elements; + for (var i = 0; i<elements.length; i++) { + if (elements[i].name == 'tax_override'){ + document.getElementById('tax_override').value = elements[i].value; + continue; + } + if (str.length){str += ';';} + str += elements[i].name + '=' + escape(elements[i].value); + } + document.getElementById('charge_storage').value = str; + cClick(); + overlib( OLiframeContent('<% $p %>/edit/part_pkg_taxoverride.html?element_name=tax_override;onclick=taxoverridequickchargemagic;selected='+document.getElementById('tax_override').value, 1100, 600, 'tax_product_popup'), CAPTION, 'Edit product tax overrides', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK); +} + +function taxoverridequickchargemagic() { + var str = document.getElementById('charge_storage').value; + if (str.length){str += ';';} + str += 'magic=taxoverride;tax_override='; + str += document.getElementById('tax_override').value; + cClick(); + overlib( OLiframeContent('<% $p %>/edit/quick-charge.html?'+str, 545, 336, 'One-time charge'), CAPTION, 'One-time charge', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK, BGCOLOR, '#333399', CGCOLOR, '#333399', CLOSETEXT, <% mt('Close') |js_string %>); + +} + +</SCRIPT> + +<FORM NAME='quickcharge' STYLE="margin:0; padding:0; display:inline"> +% for (qw( +% taxproductnum tax_override charge_storage taxproductnum_description +% )) { + <INPUT NAME="<% $_ %>" ID="<% $_ %>" TYPE="hidden"> +% } +</FORM> + +<% include('/elements/popup_link.html', { + 'action' => $p. 'edit/quick-charge.html?'. $query, + 'label' => emt('One-time charge'), + 'actionlabel' => emt('One-time charge'), + 'color' => '#333399', + 'width' => 763, + 'height' => 460, #more for more room for lines of add'l description? + }) +%> + +<%init> + +my %opt = @_; + +my $query = $opt{custnum} ? 'custnum='.$opt{custnum} + : 'prospectnum='.$opt{prospectnum}; +$query .= ';quotationnum='.$opt{quotationnum} if $opt{quotationnum}; + +</%init> |