handlePrintButtonClickedInMyAccoutPage();function handlePrintButtonClickedInMyAccoutPage(){document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll(".wt_pklist_invoice_print, .wt_pklist_packinglist_print, .wt_pklist_deliverynote_print, .wt_pklist_dispatchlabel_print, .wt_pklist_shippinglabel_print, .wt_pklist_proformainvoice_print");e.forEach(function(e){e.addEventListener("click",function(e){e.preventDefault();var t=this.getAttribute("href");if("Yes"===wf_pklist_params_public.show_document_preview||"logged_in"===wf_pklist_params_public.document_access_type&&""===wf_pklist_params_public.is_user_logged_in){window.open(t,"_blank")}else if(window.innerWidth<=768){do_print_document_in_myaccount_page_in_mobile_device(t)}else{do_print_document_in_myaccount_page(t)}})})})}function do_print_document_in_myaccount_page_in_mobile_device(e){var t=window.open(e,"_blank");t.onload=function(){t.focus();t.print();setTimeout(function(){t.close()},2e3)}}function do_print_document_in_myaccount_page(e,t=false,n=false){var o=window.open("","_blank");if(o){o.document.open();o.document.write(wf_pklist_params_public.msgs.generating_document_text);o.document.close();o.document.body.style.cursor="progress"}var i=new XMLHttpRequest;i.open("GET",e,true);i.onload=function(){var e=i.responseText;var r=i.getResponseHeader("Content-Type");if(r&&r.includes("text/plain")){if(o){o.close()}setTimeout(function(){alert(e)},100);return}if(200===this.status){if(o){o.document.open();o.document.write("
"+wf_pklist_params_public.msgs.generating_document_text+'');o.document.close();var _=o.document.getElementById("printIframe");_.style.display="none";var s=_.contentDocument||_.contentWindow.document;s.open();s.write(i.responseText);s.close();var a=s.title||"Document";o.document.title=a;setTimeout(function(){_.contentWindow.focus();_.contentWindow.print();o.document.body.style.cursor="auto";o.document.body.removeChild(_);o.close();if(true===t){}else if(true===n){window.location.reload(true)}},500)}else{alert(wf_pklist_params_public.msgs.new_tab_open_error)}}else{if(o){o.document.body.style.cursor="auto"}alert(wf_pklist_params_public.msgs.error_loading_data)}};i.onerror=function(){if(o){o.document.body.style.cursor="auto"}alert(wf_pklist_params_public.msgs.request_error);setTimeout(function(){jQuery(".wf_cst_overlay, .wf_pklist_popup").hide()},1e3)};i.send()}function wf_Confirm_Notice_for_Manually_Creating_Invoicenumbers(e,t){if(1===t||"1"===t||2===t||"2"===t||3===t||"3"===t||"11"===t||11===t){if("2"===t||2===t){var n=wf_pklist_params_public.msgs.invoice_number_prompt_free_order}else if("11"===t||11===t){var n=wf_pklist_params_public.msgs.creditnote_number_prompt}else if("3"===t||3===t){var n=wf_pklist_params_public.msgs.invoice_number_prompt_no_from_addr;alert(n);return false}else{var o=1===t||"1"===t?wf_pklist_params_public.msgs.invoice_title_prompt:t;var n=o+" "+wf_pklist_params_public.msgs.invoice_number_prompt}if(true===wf_pklist_params_public.msgs.pop_dont_show_again){e=e+"&wt_dont_show_again=1";window.open(e,"_blank");setTimeout(function(){window.location.reload(true)},1e3)}else{if(confirm(n)){window.open(e,"_blank");setTimeout(function(){window.location.reload(true)},1e3)}else{return false}}}else{window.open(e,"_blank");setTimeout(function(){window.location.reload(true)},1e3)}return false}