function locale(n,t){var r;if(!t)return n;if(r=n,typeof n!="number"&&(n=Number(n)),isNaN(n))return r;var f=n.toFixed(2),u=f.split("."),i=u[0].split("").reverse().join("").replace(/(\d{3})+?/g,function(n){return n+","}).split("").reverse().join("");return i[0]==","&&(i=i.substring(1)),i+"."+u[1]}function OnExpendInTab(n){var t=$(n),i=t.attr("target");t.hasClass("iconchevrondown")?(t.removeClass("iconchevrondown").addClass("iconchevronright"),$("#"+i).hide()):(t.removeClass("iconchevronright").addClass("iconchevrondown"),$("#"+i).show())}function getMessageStatusHistoryText(n){var t=function(n){switch(n){case 0:return GetTextByKey("P_CU_PENDING","Pending");case 1:return GetTextByKey("P_WO_SENT","Sent");case 5:return GetTextByKey("P_CU_DELIVERYCONFIRMED","Delivery Confirmed");case 6:return GetTextByKey("P_CU_RESENT","Resent");case 9:case 10:case 412:return GetTextByKey("P_MA_FAILED","Failed");default:return GetTextByKey("P_CU_UNKNOWN","Unknown")}};return GetTextByKey("P_CU_UPDATESTATUSDESC","Status changed from {0} to {1}\nBy {2} on {3}").replace("{0}",t(n.History.StatusFrom)).replace("{1}",t(n.History.StatusTo)).replace("{2}",n.History.UpdatedBy).replace("{3}",n.UpdatedOnStr)}typeof $woinspection!="function"&&($woinspection=function(n){function u(){i&&i.css("height",$(window).height()-i.offset().top-4)}function e(){(i.empty(),f=[],t.option.workorderid&&t.option.workorderid!="")&&(r||(r=!0,typeof t.option.showloading=="function"&&t.option.showloading(!0),worequest("GetWOInspectItems",JSON.stringify([t.option.workorderid,t.option.machineid]),function(n){if(r=!1,typeof t.option.showloading=="function"&&t.option.showloading(!1),typeof n=="string"){showAlert(n,GetTextByKey("P_WO_ERROR","Error"));return}if(n.WorkOrderID!=t.option.workorderid){e();return}n=n.Data;n&&n.length>0?(f=n[0].WorkOrders,o(n)):(i.empty(),i.append($('
<\/div>').text(GetTextByKey("P_WO_NOINSPECTION","No Inspection"))));u()},function(){r=!1;typeof t.option.showloading=="function"&&t.option.showloading(!1)})))}function o(n){var a=i,o,e,l,v,p;for(a.empty(),o=0;o<\/div>'),r=$('<\/span>').data("iptid",t.Id).click(function(){var n=$(this),r=n.attr("target"),i,t;n.hasClass("iconchevrondown")?(n.removeClass("iconchevrondown").addClass("iconchevronright"),$("#"+r).hide()):(n.removeClass("iconchevronright").addClass("iconchevrondown"),$("#"+r).show(),i=n.data("iptid"),t=$("#iframe_"+i),t.data("load")==0&&(t.attr("src","../Inspection/ReportForWorkOrder.aspx?rid="+i),t.data("load",1)))});if(u.append(r),canExport){r=$('<\/span>');r.attr("title",GetTextByKey("P_IPT_DOWNLOAD","Download")).on("click",t,function(n){window.open("../Inspection/Inspection.aspx?rt=f&t=1&id="+n.data.Id+"&team=0","_blank")});u.append(r);r=$('<\/span>');r.attr("title",GetTextByKey("P_IPT_PRINT","Print")).on("click",t,function(n){if(navigator.userAgent.indexOf("Firefox")>=0||navigator.userAgent.indexOf("Opera")>=0){window.open("../Inspection/Inspection.aspx?rt=f&t=2&id="+n.data.Id+"&team=0","_blank");return}if($("#ifdiv").attr("src","../Inspection/Inspection.aspx?rt=f&t=2&id="+n.data.Id+"&team=0"),!$("#ifdiv").data("inited")){$("#ifdiv").on("load",function(){s()});$("#ifdiv").data("inited",1)}})}if(u.append(r),!WOReadOnly){r=$('<\/span>');t.VisibleToCustomer?r.data("checked",!0).removeClass("iconnotview").addClass("iconview").attr("title",GetTextByKey("P_WO_CUSTOMERVISIBLE","Customer Visible")):r.data("checked",!1).removeClass("iconview").addClass("iconnotview").attr("title",GetTextByKey("P_WO_NOTCUSTOMERVISIBLE","Not Customer Visible"));u.append(r);r.data("checked",t.VisibleToCustomer).on("click",t,function(n){var t=$(n.target);t.data("checked")==!0?t.data("checked",!1).removeClass("iconview").addClass("iconnotview").attr("title",GetTextByKey("P_WO_NOTCUSTOMERVISIBLE","Not Customer Visible")):t.data("checked",!0).removeClass("iconnotview").addClass("iconview").attr("title",GetTextByKey("P_WO_CUSTOMERVISIBLE","Customer Visible"));c(n.data.Id,t.data("checked"))})}if(e=$('<\/span>').text(t.TemplateName),u.append(e),e=$('<\/span>').text(t.CommitTimeLocalStr+" by "+t.CommitedByUserName),u.append(e),u.append(e),AllowReassignWorkorders){e=$('<\/span>').text(GetTextByKey("P_WO_WO_COLON","WO:"));u.append(e);l=$('