| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>OPD_Report</fullName> | 
|     <availability>online</availability> | 
|     <displayType>button</displayType> | 
|     <linkType>javascript</linkType> | 
|     <masterLabel>OPD报告</masterLabel> | 
|     <openType>onClickJavaScript</openType> | 
|     <protected>false</protected> | 
|     <url>{!RequireScript("/soap/ajax/51.0/connection.js")}  | 
| {!RequireScript("/soap/ajax/51.0/apex.js")}  | 
| {!RequireScript("/resource/CommonUtilJs")}  | 
| //2021-10-21 gwy 版本更改为51.0 | 
| var foo = function() { | 
|    var Status = "{!OPDPlan__c.Status__c}"; | 
|    if(Status == '取消' || Status == '完毕' ){ | 
|       alert('OPD计划的状态为取消或完毕时,不能新建OPD报告'); | 
|       return; | 
|    } | 
| //SWAG-BVW8CW (只有1个出库的备品申请即可创建OPD报告) | 
| var status1="{!OPDPlan__c.Rental_Apply2_Status_New__c}"; | 
| var status2="{!OPDPlan__c.Rental_Apply1_Status_New__c}"; | 
| var status3="{!OPDPlan__c.Rental_Apply3_Status_New__c}"; | 
| var status4="{!OPDPlan__c.Rental_Apply4_Status_New__c}"; | 
| var status5="{!OPDPlan__c.Rental_Apply5_Status_New__c}"; | 
|   | 
| if(status1 != "已出库" && status1 != "申请者已收货" && status1 != "医院已装机确认" && status1 != "已回寄" && status1 != "已回收" && status1 != "完了" && status1 != "欠品中" && status2 != "已出库" && status2 != "申请者已收货" && status2 != "医院已装机确认" && status2 != "已回寄" && status2 != "已回收" && status2 != "完了" && status2 != "欠品中" && status3 != "已出库" && status3 != "申请者已收货" && status3 != "医院已装机确认" && status3 != "已回寄" && status3 != "已回收" && status3 != "完了" && status3 != "欠品中" && status4 != "已出库" && status4 != "申请者已收货" && status4 != "医院已装机确认" && status4 != "已回寄" && status4 != "已回收" && status4 != "完了" && status4 != "欠品中" && status5 != "已出库" && status5 != "申请者已收货" && status5 != "医院已装机确认" && status5 != "已回寄" && status5 != "已回收" && status5 != "完了" && status5 != "欠品中"){ | 
| alert("没有出库的申请不允许创建OPD报告!"); | 
| return; | 
| } | 
| var oppids="{!OPDPlan__c.Related_Opportunity1_IDId__c}"; | 
| var strs=''; | 
| if(""!=oppids && null!=oppids){ | 
| strs='&CF00N10000002DT68={!HTMLENCODE(OPDPlan__c.Related_Opportunity1_Name__c)}' + | 
| '&CF00N10000002DT68_lkid={!OPDPlan__c.Related_Opportunity1_IDId__c}'+ | 
| '&CF00N10000002DYCZ={!HTMLENCODE(OPDPlan__c.Related_Opportunity2_Name__c)}' + | 
| '&CF00N10000002DYCZ_lkid={!OPDPlan__c.Related_Opportunity2_IDId__c}'+ | 
| '&00N10000002DHk5=跟进询价' | 
| } | 
|    var Activity_Type = "{!OPDPlan__c.Activity_Type2__c}"; | 
|    var urlStr = ''; | 
|          | 
|      urlStr +=   '&CF00N10000002CWW4={!HTMLENCODE(OPDPlan__c.Account_Laboratory__c)}' + | 
|                  '&CF00N10000002CWW4_lkid={!HTMLENCODE(OPDPlan__c.Account_LaboratoryId__c)}' +  | 
|                  '&CF00N10000002Dh0f_lkid={!OPDPlan__c.OCM_category_ID__c}'+ | 
|                  '&CF00N10000002Dh0f={!HTMLENCODE(OPDPlan__c.OCM_category_Name__c)}'+ | 
|                  '&CF00N10000002DPUD_lkid={!OPDPlan__c.HospitalID__c}' + | 
|                  '&CF00N10000002DPUD={!HTMLENCODE(OPDPlan__c.HospitalName__c)}'; | 
|   | 
|    urlStr +=    '&CF00N10000004maf3={!OPDPlan__c.Rental_Apply2__c}' + | 
|                  '&CF00N10000008ps6d={!HTMLENCODE(OPDPlan__c.Name)}' +  | 
|                  '&CF00N10000008ps6d_lkid={!OPDPlan__c.Id}'; | 
|     | 
|   //SWAG-BVW8CW 20201217 让user自己选择recordtype | 
| //window.open('/a0B/e?retURL=%2F{!OPDPlan__c.Id}'+urlStr) | 
| window.open('/setup/ui/recordtypeselect.jsp?ent=01I10000000SWfe&retURL=%2F{!OPDPlan__c.Id}&save_new_url=%2Fa0B%2Fe%3FretURL%3D%252Fa0B%252Fo'+urlStr +strs) | 
| } | 
| foo();</url> | 
| </WebLink> |