ChangeContractType
online
button
javascript
变更合同类型
onClickJavaScript
false
{!RequireScript("/soap/ajax/51.0/connection.js")}
{!RequireScript("/soap/ajax/51.0/apex.js")}
sforce.connection.sessionId = '{!$Api.Session_ID}';
var foo = function() {
var oppId = '{!Opportunity.Id}';
var str ;
var status = '{!Opportunity.StageName}';
var quostatus = '{!Opportunity.Estimation_Decision__c}';
var win = '{!Opportunity.SAP_Send_OK__c}';
var Auth = '{!Opportunity.If_Authorizing_Lock__c}';
if(status != '引合'){
alert('只有状态1是询价的可以更改合同类型');
return null;
}
if(Auth == '1'){
alert('询价正在授权申请中,请在SPO中驳回后再做转换。');
return null;
}
if(quostatus == 'true' || quostatus == true){
alert('已决定报价,不能修改内贸/外贸');
return null;
}
if(win == 'true' || win == true){
alert('请先取消WIN, 再转换内外贸');
return null;
}
if(confirm('变更合同类型会删除全部报价,是否继续?')){
str = sforce.apex.execute("OpportunityWebService", "changeTrade",{oppId:oppId });
}else{
return null;
}
if(str != '1'){
alert(str);
}
window.location.reload();
};
foo();