111
沙世明
2022-11-22 928399eceec50e3d37ea08669a12789a9410a9d2
force-app/main/default/pages/SelectAssetEstimateURF.page
@@ -57,6 +57,16 @@
            return false;  
        }
    }
    //URF限次合同2期 LY 20220920 start
    var FirstParagraphEnd = j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked;
    if(FirstParagraphEnd){
        if (confirm('本次签约经销商是先款对象,请确认是否提交报价?')) {
            return true;
        }else{
            return false;
        }
    }
    //URF限次合同2期 LY 20220920 end
        return true;
}
//add by gwy 2021-01-27 end 提交时的提示框
@@ -138,6 +148,9 @@
        var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
        if (target != '医院') {
            j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).attr("disabled", true);
            //URF限次合同2期 LY 20220920 start
            j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd')).attr("disabled", true);
            //URF限次合同2期 LY 20220920 end
        }
    }
    if ('{!DecideBtnDisabled}' == 'false') {
@@ -336,7 +349,12 @@
    }
    if ((val == null || val == "" || val == "0") && uRFSeriesMap.includes('URF-V')){
        alert("合同对象设备中含有URF-V系列,必须选择URF-V的最大大修次数!");
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("");
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("0");
        return;
    }
    if ((val == "3") && uRFSeriesMap.includes('URF-V')){
        alert("合同对象设备中URF-V系列目前不能选择3次!");
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("0");
        return;
    }
    if (uRFSeriesMap.includes('URF-V')==false) {
@@ -352,7 +370,8 @@
        uRFSeriesMap.push(uRFSeries);
    }
    if ((val == null || val == "" || val == "0") && uRFSeriesMap.includes('URF-P')){
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
        alert("合同对象设备中含有URF-P系列,URF-P的最大大修次数必须选择!");
        //j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
    }
    if (uRFSeriesMap.includes('URF-P')==false) {
        alert("合同对象设备中不含有URF-P系列,URF-P的最大大修次数必须选择/!");
@@ -878,13 +897,22 @@
function resetDealer() {
    var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
    var obj = document.getElementById('allPage:allForm:allBlock:contract:dealer');
    //URF限次合同2期 LY 20220920 start
    var obj2 = document.getElementById('allPage:allForm:allBlock:contract:FirstParagraphEnd');
    //URF限次合同2期 LY 20220920 end
    var obj_lkwgt = document.getElementById('allPage:allForm:allBlock:contract:dealer_lkwgt');
    if (target == '医院') {
        obj.style.display = "none";
        obj_lkwgt.style.display = "none";
        //URF限次合同2期 LY 20220920 start
        obj2.style.display = "none";
        //URF限次合同2期 LY 20220920 end
    } else {
        obj.style.display = "block";
        obj_lkwgt.style.display = "block";
        //URF限次合同2期 LY 20220920 start
        obj2.style.display = "block";
        //URF限次合同2期 LY 20220920 end
    }
}
@@ -976,12 +1004,17 @@
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("");
        return;
    }
    if ((valURFP == null || valURFP == "" || valURFP == "0") && uRFSeriesMap.includes('URF-P')){
        alert("合同对象设备中含有URF-P系列,必须选择URF-P的最大大修次数!");
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("0");
        return;
    }
    if (uRFSeriesMap.includes('URF-V')==false) {
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("0");
    }
    if ((valURFP == null || valURFP == "" || valURFP == "0") && uRFSeriesMap.includes('URF-P')){
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
    }
    // if ((valURFP == null || valURFP == "" || valURFP == "0") && uRFSeriesMap.includes('URF-P')){
    //     j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
    // }
    if (uRFSeriesMap.includes('URF-P')==false) {
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("0");
    }
@@ -1121,8 +1154,10 @@
function ComputeLTY() {
    var  urlNameJs = j$(escapeVfId('allPage:allForm:urlName')).val();
    urlNameJs = '{!$Label.ID_of_SelectAssetEstimate}'+urlNameJs ;
    var w = window.open(encodeURI(urlNameJs),'过去两年修理实绩','menubar=no,height=720,width=986');
    w.focus();
    //URF限次合同2期 LY 20220920 start
    //var w = window.open(encodeURI(urlNameJs),'过去两年修理实绩','menubar=no,height=720,width=986');
    //w.focus();
    //URF限次合同2期 LY 20220920 end
}
function recordNumChangeJs() {
    recordNumChangeAction();
@@ -1252,22 +1287,32 @@
    assetRepairSumPrice = localParseFloat(assetRepairSumPrice);
    // 计算实际报价总金额
    var realprice = mainteReal - assetRepairSumPrice;
    //URF限次合同2期 LY 20221009 start
    // 标准价格的最高价总额
    var GuidePriceUp = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUpHidden')).val());
    // //标准价格的最低价总额
    var GuidePriceDown = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDownHidden')).val());
    GuidePriceUp = localParseFloat(GuidePriceUp);
    GuidePriceDown = localParseFloat(GuidePriceDown);
    for (var i = 0; i < rowcount; i++) {
        // 去上限价格
        var assetListPrice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val();
        // //取下限价格
        var assetLowerPrice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val();
        assetListPrice = localParseFloat(assetListPrice);
        if(GuidePriceUp == 0){
            j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(0);
        var Estimate_Cost = 0;
        if(realprice == GuidePriceUp){
            Estimate_Cost = assetListPrice;
            // j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(0);
        } else if (realprice == GuidePriceDown){
            Estimate_Cost = assetLowerPrice;
        }else{
            var Estimate_Cost = (realprice * (assetListPrice / GuidePriceUp)).toFixed(2);
            j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(Estimate_Cost);
            Estimate_Cost = (realprice * (assetListPrice / GuidePriceUp)).toFixed(2);
        }
        j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(Estimate_Cost);
    
    }
    //URF限次合同2期 LY 20221009 end
}
function getLastContractRate(){
@@ -1285,9 +1330,11 @@
        }
    }
    var allContractRate = '' + 0.00 + '%';
    if( count > 0){
        allContractRate = '' + (Contractrate/count).toFixed(2) + '%';
    }
    //URF限次合同2期 LY 20220920 start
    // if( count > 0){
    //     allContractRate = '' + (Contractrate/count).toFixed(2) + '%';
    // }
    //URF限次合同2期 LY 20220920 end
    j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Combinedrate')).text(allContractRate);
    j$(escapeVfId('allPage:allForm:allBlock:contractInfo:CombinedrateHidden')).val(parseFloat(allContractRate));
@@ -1312,6 +1359,37 @@
        return 0;
    }
}
    //URF限次合同2期 LY 20220920 start
    //获取经销商的先款标识
    function onChDealerUpdateJs(oBj){
        //获取 报价提交对象  是否为经销商
        var estimateTarget = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget'))[0].value;
        if(estimateTarget == '经销商'){
            //判断经销商名是否为空
            var dealerValue = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).val();
            if(dealerValue != ''){
                //获取经销商名的id
                var dealerId = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer_lkid')).val();
                //由于salesforce的查找字段是可以输入的,所以判断他如果为空或者为 000000000000000 的时候,传的参数就位经销商中文名,其他情况传id
                if(dealerId != '' && dealerId != '000000000000000'){
                    onChDealerUpdate(dealerId);
                }else{
                    onChDealerUpdate(dealerValue);
                }
            }else{
                onChDealerUpdate('');
                //j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked = false;
            }
        }
    }
    //如果选择的经销商为先款对象,那么做一下提示
    function hintAccount(){
        var xkChecked = j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked;
        if(xkChecked){
            alert('请注意,当前经销商为先款对象。');
        }
    }
    //URF限次合同2期 LY 20220920 start
</script>
<apex:form id="allForm">
    <apex:inputHidden id="alertStringValue" value="{!alertString}" />
@@ -1331,6 +1409,11 @@
    <apex:actionFunction name="decide" action="{!decide}" rerender="allForm" oncomplete="unblockUI();"/>
    <apex:actionFunction name="decideCancle" action="{!decideCancle}" rerender="allForm" oncomplete="unblockUI();"/>
    <apex:inputHidden id="oldDecideContractDate" value="{!OldContractStartDate}" />
    <!-- URF限次合同2期 LY 20220920 start -->
    <apex:actionFunction name="onChDealerUpdate" action="{!onChDealerUpdate}" rerender="contract" onComplete="hintAccount();">
        <apex:param name="checkDealerId" assignTo="{!checkDealerId}" value="" />
    </apex:actionFunction>
    <!-- URF限次合同2期 LY 20220920 end -->
    <input type="hidden" id="oldContractDate" value="{!estimate.Contract_Start_Date__c}" />
<script type="text/javascript">
//j$(escapeVfId('allPage:allForm:changedAfterPrint')).val('false');
@@ -1480,13 +1563,19 @@
                <td width="50%" align="right"> <label class="labelCol vfLabelColTextWrap " style="margin-left:22%">制定日</label></td>
                <td width="50%" align="left"> <apex:outputField label="制定日" value="{!estimate.CreatedDate}" id="createDateShow"/> </td>
            </tr>
            <!-- URF限次合同2期 LY 20220811 start -->
            <tr>
  
                <td  width="50%" align="right">  
                    <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 经销商名</label></td>
                <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" /> </td>
                <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" onchange="onChDealerUpdateJs(this);return false;" style="float: left;"/> </td>
            </tr>
            <!-- URF限次合同2期 LY 20220811 start -->
            <tr>
                <td  width="50%" align="right">
                    <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 先款标识(经销商)</label></td>
                <td width="50%" align="left" > <apex:inputCheckbox value="{!estimate.Is_RecognitionModel__c}" id="FirstParagraphEnd" onClick="return false;" /> </td>
            </tr>
            <tr>
                <td width="50%" align="right"> 
                    <label class="labelCol vfLabelColTextWrap " style="margin-left:22%">URF-V最大大修次数:</label></td>
@@ -1543,6 +1632,7 @@
                        <!-- URF限次合同2期 LY 20220811 start -->
                        <th style="width:35px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.URF_Series__c.label}
                        </th>
                        <!-- <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.URF_Maintenance_Contract__c.label}</th> -->
                        <!-- URF限次合同2期 LY 20220811 end -->
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Asset_situation__c.label}</th>
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.SerialNumber.label}</th>
@@ -1601,6 +1691,12 @@
                                <td class="dataCell" width="70px" >
                                    <apex:outputText value="{!ar.uFRSerial}" id="uRFSeries"/>
                                </td>
                                <!-- <td class="dataCell" width="70px">
                                    <apex:outputField value="{!ar.rec.URF_Maintenance_Contract__r.Management_Code__c}" rendered="{!Not(ar.IsManual)}" id="URF_Contract_No"/>
                                </td> -->
                                    <apex:inputHidden value="{!ar.rec.URF_Maintenance_Contract__r.Management_Code__c}" rendered="{!Not(ar.IsManual)}" id="URF_Contract_No"/>
                                <!-- URF限次合同2期 LY 20220811 end -->
                                <td class="dataCell" width="70px">
                                    <apex:outputField value="{!ar.rec.Asset_situation__c}" rendered="{!Not(ar.IsManual)}" />
@@ -1974,7 +2070,10 @@
                            <apex:inputHidden value="{!estimate.Combined_rate__c}" id="CombinedrateHidden" />
                        </td>
                        <td style="text-align: center">
                            <apex:outputField value="{!estimate.Consumption_rate_Forecast__c}"  />
                            <!-- URF限次合同2期 LY 20220920 start -->
                            <!-- <apex:outputField value="{!estimate.Consumption_rate_Forecast__c}"  /> -->
                            -
                            <!-- URF限次合同2期 LY 20220920 end -->
                        </td>
                        <td style="text-align: center">
                            <apex:outputField value="{!estimate.Estimate_Price_range__c}"  />