<apex:page id="Page" standardController="Agency_Opportunity__c" sidebar="false">
|
<apex:includeScript value="/soap/ajax/40.0/connection.js"/>
|
<apex:includeScript value="/soap/ajax/40.0/apex.js"/>
|
|
<script type="text/javascript">
|
sforce.connection.sessionId = "{!$Api.Session_ID}";
|
<!-- 判断是进入SI询价或者正常询价 -->
|
function SICheck() {
|
var SI_Flg = document.getElementById('Page:mainForm:idDayEdit:SI_Flg').checked;
|
var doubleFlg = false;
|
if (!doubleFlg) {
|
doubleFlg = true;
|
var newflag = true;
|
if ('{!Agency_Opportunity__c.Change_To_Opportunity__c}' != '') {
|
newflag = false;
|
alert("已经转成过【OCSM询价】。");
|
Ext.select('*[name=newopp]').set({
|
disabled: 'disabled',
|
class: 'btnDisabled'
|
}, true);
|
}
|
if (newflag) {
|
var query = "Select QualifiedApiName, EntityDefinition.KeyPrefix, DurableId From FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Opportunity'";
|
records = sforce.connection.query(query).getArray('records');
|
var prefix,
|
fId_Opportunity_Category__c,
|
fId_Close_Forecasted_Date__c,
|
fId_Opportunity_stage__c,
|
fId_Hospital__c,
|
fId_SAP_Province__c,
|
fId_Agency_Opportunity__c,
|
fId_Sales_Root__c,
|
fId_Trade__c,
|
fId_Promise_Class__c,
|
fId_Bid_Planned_Date__c,
|
fId_Opportunity_sub_owner__c;
|
|
for (var i = 0; i < records.length; i++) {
|
var record = records[i];
|
prefix = record.EntityDefinition.KeyPrefix.toString();
|
if (record.QualifiedApiName == 'Opportunity_Category__c')
|
fId_Opportunity_Category__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Close_Forecasted_Date__c')
|
fId_Close_Forecasted_Date__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Opportunity_stage__c')
|
fId_Opportunity_stage__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Hospital__c')
|
fId_Hospital__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'SAP_Province__c')
|
fId_SAP_Province__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Agency_Opportunity__c')
|
fId_Agency_Opportunity__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Sales_Root__c')
|
fId_Sales_Root__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Trade__c')
|
fId_Trade__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Promise_Class__c')
|
fId_Promise_Class__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Bid_Planned_Date__c')
|
fId_Bid_Planned_Date__c = record.DurableId.toString().split('.')[1];
|
if (record.QualifiedApiName == 'Opportunity_sub_owner__c')
|
fId_Opportunity_sub_owner__c = record.DurableId.toString().split('.')[1];
|
}
|
// 格式化时间
|
if("{!Agency_Opportunity__c.Bid_Planned_Date__c}" != null &&
|
"{!Agency_Opportunity__c.Bid_Planned_Date__c}" != ''){
|
var Bid_Planned_Date = new Date("{!Agency_Opportunity__c.Bid_Planned_Date__c}").toLocaleDateString();
|
}else{
|
var Bid_Planned_Date = '';
|
}
|
|
if("{!Agency_Opportunity__c.Close_Forecasted_Date__c}" != null &&
|
"{!Agency_Opportunity__c.Close_Forecasted_Date__c}" != ''){
|
var Close_Forecasted_Date = new Date("{!Agency_Opportunity__c.Close_Forecasted_Date__c}").toLocaleDateString();
|
}else{
|
var Close_Forecasted_Date = '';
|
}
|
if (SI_Flg) {
|
if('' == document.getElementById('Page:mainForm:idDayEdit:SI_OppoLeadSec').value){
|
document.getElementById('ErrorMessage').style.display = '';
|
return;
|
}
|
window.open("/006/e?retURL=%2F{!URLENCODE(Agency_Opportunity__c.Id)}" +
|
"&RecordType=012100000006KMe" + "&ent=Opportunity&opp11=引合" +
|
"&" +
|
fId_Opportunity_Category__c + "={!URLENCODE(Agency_Opportunity__c.Department_Cateogy__c)}" +
|
"&opp3={!Agency_Opportunity__c.Name}" +
|
"&" + fId_Close_Forecasted_Date__c + "=" + Close_Forecasted_Date +
|
"&" + fId_Bid_Planned_Date__c + "=" + Bid_Planned_Date +
|
"&" + fId_Opportunity_stage__c + "={!URLENCODE(Agency_Opportunity__c.StageName__c)}" +
|
"&CF" + fId_Hospital__c + "={!URLENCODE(Agency_Opportunity__c.hosName_opp__c)}" +
|
"&CF" + fId_Hospital__c + "_lkid={!URLENCODE(Agency_Opportunity__c.hosId_opp__c)}" +
|
"&" + fId_SAP_Province__c + "={!URLENCODE($User.Province_Text__c)}" +
|
"&CF" + fId_Agency_Opportunity__c + "_lkid={!URLENCODE(Agency_Opportunity__c.Id)}" +
|
"&CF" + fId_Agency_Opportunity__c + "={!URLENCODE(Agency_Opportunity__c.Name)}" +
|
"&CF" + fId_Opportunity_sub_owner__c +"_lkid=" +
|
document.getElementById('Page:mainForm:idDayEdit:SI_OppoLeadSec_lkid').value +
|
"&CF" + fId_Opportunity_sub_owner__c + "=" +
|
document.getElementById('Page:mainForm:idDayEdit:SI_OppoLeadSec').value +
|
"&opp6=经销商" +
|
"&" + fId_Sales_Root__c + "=販売店" +
|
"&" + fId_Trade__c + "=内貿" +
|
"&" + fId_Promise_Class__c + "=内貿" +
|
"&opp4={!URLENCODE(Agency_Opportunity__c.hosName_opp__c)}"
|
,'_self');
|
} else {
|
window.open("/006/e?retURL=%2F{!URLENCODE(Agency_Opportunity__c.Id)}" +
|
"&RecordType=01210000000QekK" +
|
"&ent=Opportunity&opp11=引合" +
|
"&" + fId_Opportunity_Category__c + "={!URLENCODE(Agency_Opportunity__c.Department_Cateogy__c)}" +
|
"&opp3={!Agency_Opportunity__c.Name}" +
|
"&" + fId_Close_Forecasted_Date__c + "=" + Close_Forecasted_Date +
|
"&" + fId_Bid_Planned_Date__c + "=" + Bid_Planned_Date +
|
"&" + fId_Opportunity_stage__c + "={!URLENCODE(Agency_Opportunity__c.StageName__c)}" +
|
"&CF" + fId_Hospital__c + "={!URLENCODE(Agency_Opportunity__c.hosName_opp__c)}" +
|
"&CF" + fId_Hospital__c + "_lkid={!URLENCODE(Agency_Opportunity__c.hosId_opp__c)}" +
|
"&" + fId_SAP_Province__c + "={!URLENCODE($User.Province_Text__c)}" +
|
"&CF" + fId_Agency_Opportunity__c + "_lkid={!URLENCODE(Agency_Opportunity__c.Id)}" +
|
"&CF" + fId_Agency_Opportunity__c + "={!URLENCODE(Agency_Opportunity__c.Name)}" +
|
"&CF" + fId_Opportunity_sub_owner__c +"_lkid=" +
|
document.getElementById('Page:mainForm:idDayEdit:SI_OppoLeadSec_lkid').value +
|
"&CF" + fId_Opportunity_sub_owner__c + "=" +
|
document.getElementById('Page:mainForm:idDayEdit:SI_OppoLeadSec').value +
|
"&opp6=经销商" +
|
"&" + fId_Sales_Root__c + "=販売店" +
|
"&" + fId_Trade__c + "=内貿" +
|
"&" + fId_Promise_Class__c + "=内貿" +
|
"&opp4={!URLENCODE(Agency_Opportunity__c.hosName_opp__c)}",'_self');
|
}
|
|
}
|
}
|
}
|
function reload() {
|
window.open("/{!URLENCODE(Agency_Opportunity__c.Id)}",'_self');
|
}
|
</script>
|
<style>
|
</style>
|
<!-- リード 取引の開始 -->
|
<apex:sectionHeader title="{!$ObjectType.Agency_Opportunity__c.Label}" subtitle="{!$Label.StartTrading_Subtitle}"/>
|
<apex:form id="mainForm">
|
<div id = 'ErrorMessage' style="display: none;">
|
<apex:pageMessage summary="转SI询价需要填写询价副担当" title="错误" severity="error" strength="2" />
|
</div>
|
<apex:pageBlock id="idDayEdit" title="" mode="edit" >
|
<apex:pageBlockButtons >
|
<!-- 进行询价 -->
|
<input type="button" class="btn" value="{!$Label.StartTrading_Subtitle}" onclick="SICheck();"/>
|
<!-- 关掉当前窗口 -->
|
<input type="button" class="btn" value="{!$Label.StartTrading_Cancel}" onclick="reload();"/>
|
</apex:pageBlockButtons>
|
<table>
|
<tr>
|
<td width="100px"></td>
|
<td>
|
{!$ObjectType.lead.fields.SI_OppoLeadSec__c.label}
|
</td>
|
<td>
|
<apex:inputField id="SI_OppoLeadSec" value="{!Agency_Opportunity__c.SI_OppoLeadSec__c}"/>
|
</td>
|
</tr>
|
<tr>
|
<td width="100px"></td>
|
<!-- 是否SI本部共同推进询价 -->
|
<td>是否SI本部共同推进询价</td>
|
<td><apex:inputCheckbox id="SI_Flg" />
|
</td>
|
</tr>
|
</table>
|
</apex:pageBlock>
|
</apex:form>
|
</apex:page>
|