| <?xml version="1.0" encoding="UTF-8"?> | 
| <WebLink xmlns="http://soap.sforce.com/2006/04/metadata"> | 
|     <fullName>Tender_Lost</fullName> | 
|     <availability>online</availability> | 
|     <displayType>button</displayType> | 
|     <linkType>javascript</linkType> | 
|     <masterLabel>失单</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")}; | 
|   | 
| function foo(){ | 
|   | 
| var sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'"; | 
| var sqlResult = sforce.connection.query(sql); | 
| //简档权限  2S1_销售医院担当  2S4_销售管理者  系统管理员 | 
| if ('{!$Profile.Id}' != '00e10000000xnp2' && '{!$Profile.Id}' != '00e10000000xnpH' && '{!$Profile.Id}' != '00e10000000Y3o5') { | 
| alert("您没有权限,无法创建询价提交失单。"); | 
| return; | 
| } | 
| // 判断内部确认状态 | 
| if({!Tender_information__c.status__c == '01.待确认'|| Tender_information__c.status__c == '02.不相关'}){ | 
| alert('状态为待确认或不相关,不可以做失单。'); | 
| return; | 
| } | 
| // 判断是否需要新建询价 | 
| if({!Tender_information__c.status__c == '05.询价中'|| Tender_information__c.status__c == '06.成交' || Tender_information__c.status__c == '07.部分成交' || Tender_information__c.status__c == '08.失单'} || sqlResult.size > 0){ | 
|   if(!confirm('此项目已关联询价,请确实是否新建询价提交失单。')) { | 
|     return; | 
|   } | 
| } | 
| // 判断是否需要新建询价 | 
| //if(sqlResult.size > 0){ | 
|   //if(!confirm('已有关联询价,是否创建新的询价。')) { | 
|     //return; | 
|   //} | 
| //} | 
| window.open('/apex/TenderLostPage?id={!Tender_information__c.Id}','','height=500,width=800,top=200,left=250,location=no'); | 
|   | 
|   | 
| } | 
|   | 
|   | 
| foo();</url> | 
| </WebLink> |