游畅
2023-04-29 cc266a1e4080bb3ecc47ea4a202dd549545111e1
force-app/main/default/pages/SelectAssetEstimateURF.page
@@ -7,8 +7,8 @@
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="/soap/ajax/29.0/connection.js"/>
    <apex:includeScript value="/soap/ajax/29.0/apex.js"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
<style type="text/css">
    table { border-collapse: collapse; }
    
@@ -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 提交时的提示框
@@ -92,6 +102,7 @@
    blockme();
    searchfunc();
}
//<!-- HWAG-B4R3SS  END 20181026-->
// 初始化设定画面项目不可用
function pageSetDisabled(){
@@ -102,6 +113,10 @@
        j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).attr("disabled", true);
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).attr("disabled", true);
        j$(escapeVfId('allPage:allForm:allBlock:contract:EndUserType')).attr("disabled", true);
        //URF限次合同2期 LY 20220811 start
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).attr("disabled", true);
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).attr("disabled", true);
        //URF限次合同2期 LY 20220811 end
        var rowCnt = {!productCount};
        for (var i = 0; i < rowCnt; i++) {
            var isManual = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsManual')).text();
@@ -133,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') {
@@ -208,7 +226,7 @@
            //j$(escapeVfId('allPage:allForm:decidebtn')).attr("class", 'btnDisabled');
            
            if (confirm(Confirm_EstimateRefresh)) {
                window.location.href="/apex/SelectAssetEstimateVM?copyid={!URLENCODE(targetEstimateId)}";
                window.location.href="/apex/SelectAssetEstimateURF?copyid={!URLENCODE(targetEstimateId)}";
                return true;
            } else {
                if ('{!DecideBtnDisabled}' == 'false') {
@@ -240,7 +258,7 @@
            //j$(escapeVfId('allPage:allForm:decidebtn')).attr("class", 'btnDisabled');
            
            if (confirm('已超过创建日6个月,是否更新报价?')) {
                window.location.href="/apex/SelectAssetEstimateVM?copyid={!URLENCODE(targetEstimateId)}";
                window.location.href="/apex/SelectAssetEstimateURF?copyid={!URLENCODE(targetEstimateId)}";
                return true;
            } else {
                if ('{!DecideBtnDisabled}' == 'false') {
@@ -261,9 +279,11 @@
function checkAll(checker) {
    var cnt = j$(escapeVfId('allPage:allForm:allBlock:assetSection:productCnt')).val();
    for (var i = 0; i < cnt; i++) {
        //2021-11-30 fy add LJPH-C8W8FV 置顶 start
        if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) {
            break;
            continue;
        }
        //2021-11-30 fy add LJPH-C8W8FV 置顶 end
        document.getElementById('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox').checked = checker.checked;
    }
}
@@ -318,6 +338,49 @@
    //contractStartDateChange();
    refreshAsset(cnt);
}
//URF限次合同2期 LY 20220811 start
function checkVMaxRepairCount(val, cnt) {
    var uRFSeriesMap =[];
    for (var i = 0; i < cnt; i++) {
        var uRFSeries = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uRFSeries')).text();
        // var uRFSeries = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uRFSeries')).value();
        uRFSeriesMap.push(uRFSeries);
    }
    if ((val == null || val == "" || val == "0") && uRFSeriesMap.includes('URF-V')){
        alert("合同对象设备中含有URF-V系列,必须选择URF-V的最大大修次数!");
        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) {
        alert("合同对象设备中不含有URF-V系列,URF-V的最大大修次数必须选择/!");
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("0");
    }
    refreshAsset(cnt);
}
function checkPMaxRepairCount(val, cnt) {
    var uRFSeriesMap =[];
    for (var i = 0; i < cnt; i++) {
        var uRFSeries = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uRFSeries')).text();
        uRFSeriesMap.push(uRFSeries);
    }
    if ((val == null || val == "" || val == "0") && uRFSeriesMap.includes('URF-P')){
        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的最大大修次数必须选择/!");
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("0");
    }
    refreshAsset(cnt);
}
//URF限次合同2期 LY 20220811 end
function checkContractEstiStartDate(val, cnt) {
    if (val == null || val == "") {
@@ -389,9 +452,18 @@
    var upPriceSum = 0;
    // 合同月数乗算
    var month = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
    if (month == undefined || month == "") {
        month = 1;
    //URF限次合同2期 LY 20220811 start
    var estimateURFVMaxRepairCount=localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val())
    var estimateURFPMaxRepairCount=localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val())
    //URF限次合同2期 LY 20220811 end
    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
    var Contract_year = 0;
    if (month == undefined || month == "" || month <= 12) {
        Contract_year = 1;
    } else{
        Contract_year = Math.ceil(month / 12);
    }
    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
    var month2 = 0;
    if (month > 12) {
        month2 = month - 12;
@@ -413,6 +485,7 @@
        var isManual = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsManual')).text();
        var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val();
        var assetListmonth = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
        if (isManual == 'true') {
            var a = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Assert')).value();
            if (a != '') {
@@ -425,14 +498,38 @@
                //}
                strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                //URF限次合同2期 LY 20220811 start
                var uRFSeries= j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uRFSeries')).value();
                if (uRFSeries=='URF-V' && estimateURFVMaxRepairCount==2) {
                    strMoneyMax = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMaxPrice')).val();
                    strMoneyMin = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMinPrice')).val();
                }else if (uRFSeries=='URF-V' && estimateURFVMaxRepairCount==0) {
                    strMoneyMax = 0;
                    strMoneyMin = 0;
                }else if (uRFSeries=='URF-P' && estimateURFPMaxRepairCount==0){
                    strMoneyMax = 0;
                    strMoneyMin = 0;
                }else{
                    strMoneyMax = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMaxPrice3')).val();
                    strMoneyMin = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMinPrice3')).val();
                }
                //URF限次合同2期 LY 20220811 end
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
                // alert(strMoney);
                Price_YearTXT = strMoney * 12;
                if (isnew == 'true') {
                    newCount ++;
                    strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
                    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                    strMoneyMin = Contract_year * strMoneyMin;
                    strMoneyMax = Contract_year * strMoneyMax;
                    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
                } else {
                    newCon = false;
                    strMoney = month * strMoney + month2 * strMoney;
                    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                    strMoneyMin = Contract_year * strMoneyMin;
                    strMoneyMax = Contract_year * strMoneyMax;
                    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
                }
                var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
                var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
@@ -476,9 +573,11 @@
                    //         upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                    //         downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                    //     }else{
                            upPrice = strMoney;
                            // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                            upPrice = strMoneyMax;
                            // downPrice = strMoney * 0.8;
                            downPrice = strMoney;
                            downPrice = strMoneyMin;
                            // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
                    //     }
                    // }else{
                    //     upPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
@@ -486,9 +585,11 @@
                    // }
                }else{
                    //firstCCount ++;
                    upPrice = strMoney;
                    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                    upPrice = strMoneyMax;
                    // downPrice = strMoney * 0.8;
                    downPrice = strMoney;
                    downPrice = strMoneyMin;
                    // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
                }
                // 上下限四舍五入
                upPrice = upPrice.toFixed(2);
@@ -535,11 +636,35 @@
                newCon = false;
            }
            strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
            // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
            //URF限次合同2期 LY 20220811 start
            var uRFSeries= j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uRFSeries')).value();
            if (uRFSeries=='URF-V' && estimateURFVMaxRepairCount==2) {
                strMoneyMax = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMaxPrice')).val();
                strMoneyMin = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMinPrice')).val();
            }else if (uRFSeries=='URF-V' && estimateURFVMaxRepairCount==0) {
                    strMoneyMax = 0;
                    strMoneyMin = 0;
            }else if (uRFSeries=='URF-P' && estimateURFPMaxRepairCount==0){
                    strMoneyMax = 0;
                    strMoneyMin = 0;
            }else{
                strMoneyMax = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMaxPrice3')).val();
                strMoneyMin = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uFRMinPrice3')).val();
            }
            //URF限次合同2期 LY 20220811 end
            // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
            Price_YearTXT = strMoney * 12;
            if (isnew == 'true') {
                strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                strMoneyMin = Contract_year * strMoneyMin;
                strMoneyMax = Contract_year * strMoneyMax;
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
            } else {
                strMoney = month * strMoney + month2 * strMoney;
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                strMoneyMin = Contract_year * strMoneyMin;
                strMoneyMax = Contract_year * strMoneyMax;
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
            }
            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
            var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
@@ -582,9 +707,11 @@
                //         upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                //         downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                //     }else{
                        upPrice = strMoney;
                        // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                        upPrice = strMoneyMax;
                        // downPrice = strMoney * 0.8;
                        downPrice = strMoney;
                        downPrice = strMoneyMin;
                        // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
                //     }
                // }else{
                //     upPrice = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
@@ -597,9 +724,11 @@
                    newCon = false;
                    firstCCount ++;
                }
                upPrice = strMoney;
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start
                upPrice = strMoneyMax;
                // downPrice = strMoney * 0.8;
                downPrice = strMoney;
                downPrice = strMoneyMin;
                // XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end
            }
            // 上下限四舍五入
            upPrice = upPrice.toFixed(2);
@@ -768,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
    }
}
@@ -828,7 +966,11 @@
    var alert1s = 0;
    var today = new Date();
    today.setMonth(today.getMonth() - 3);
    //URF限次合同2期 LY 20220811 start
    var uRFSeriesMap =[];
    var valURFV =j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val();
    var valURFP =j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val();
    //URF限次合同2期 LY 20220811 end
    for (var i = 0; i < cntWithKara; i++) {
        var isManual = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsManual')).text();
        if (isManual == 'true') {
@@ -850,7 +992,33 @@
                alerts = 1;
            }
        }
        //URF限次合同2期 LY 20220811 start
        var uRFSeries = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':uRFSeries')).text();
        uRFSeriesMap.push(uRFSeries);
        //URF限次合同2期 LY 20220811 end
    }
    //URF限次合同2期 LY 20220811 start
    if ((valURFV == null || valURFV == "" || valURFV == "0") && uRFSeriesMap.includes('URF-V')){
        alert("合同对象设备中含有URF-V系列,必须选择URF-V的最大大修次数!");
        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 (uRFSeriesMap.includes('URF-P')==false) {
        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("0");
    }
    //URF限次合同2期 LY 20220811 end
    if (alerts == 1) {
        if (confirm("选择的保有设备[最后点检日]为空或已经超过三个月之前,是否继续?")) {
            
@@ -986,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();
@@ -1062,6 +1232,24 @@
            var dayStr = '00' + contractDate.getDate();
            dayStr = dayStr.substring(dayStr.length-2, dayStr.length);
            var contractDateStr = contractDate.getFullYear() + '/' + monthStr + '/' + dayStr;
            //贸易合规 you 20230414 start
            var AccDealerBlacklist = j$(escapeVfId('allPage:allForm:AccDealerBlacklist')).value();//黑名单,警示名单
            var TradeComplianceStatusFlagFW = '{!$Label.TradeComplianceStatusFlagFW}';//贸易合规开关
            var IFTradeComplianceAlert = '{!$Label.IFTradeComplianceAlert}';//贸易合规提醒
            if(TradeComplianceStatusFlagFW=='true'){
            if(AccDealerBlacklist =='1'){
               alert('您所选择的客户(医院/经销商)存在贸易合规风险,无法签订服务合同,建议您向客户做好不签约说明,'+IFTradeComplianceAlert);
               var reflag = interceptsend();
               unblockUI();
               return null;
            }else if(AccDealerBlacklist =='2'){
               if (!confirm('您所选择的客户(医院/经销商)存在贸易合规警示风险,不建议签订服务合同,请您确认是否继续申请,'+IFTradeComplianceAlert)) {
                    unblockUI();
                    return null;
                }
            }
            }
            //贸易合规 you 20230414 end
            //var neDt = contractDate.getFullYear() + contractDate.getMonth() + contractDate.getDate();
            //monthStr = '00' + (oldDate.getMonth()+1);
@@ -1117,22 +1305,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(){
@@ -1150,9 +1348,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));
@@ -1177,6 +1377,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}" />
@@ -1187,6 +1418,9 @@
    <apex:inputHidden id="changedAfterPrint" value="{!changedAfterPrint}"/>
    <apex:inputHidden id="changedSubmitPrice" value="{!changedSubmitPrice}"/>
    <apex:inputHidden id="isSaveOrApproval" value="{!isSaveOrApproval}"/>
    <!-- 贸易合规 you 20230414-->
    <apex:inputHidden id="AccDealerBlacklist" value="{!contract.AccDealerBlacklist__c}"/>
    <apex:actionFunction name="interceptsend" action="{!interceptsend}"  oncomplete="unblockUI();"/>
    <!-- HWAG-B4R3SS  START 20181026-->
    <apex:actionFunction name="searchfunc" action="{!searchBtn}" rerender="Form,Block,assetSection2,pageMessages,allBlock" onComplete="unblockUI();"></apex:actionFunction>
@@ -1196,6 +1430,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');
@@ -1215,7 +1454,7 @@
       
        <apex:pageMessages id="pageMessages"></apex:pageMessages>
        <!-- update 合同报价页面的优化 添加‘assetSection’ fxk 2021/9/10 Star-->
        <apex:actionFunction name="refreshProductData" action="{!refreshProductData}" rerender="pageMessages,EquipmentGuaranteeFlg,EGFlgassHidden,EquipmentGuaranteeFlgtxt, assetListPriceHidden, productCount3, assetSection" oncomplete="refreshAsset({!productCount});unblockUI();">
        <apex:actionFunction name="refreshProductData" action="{!refreshProductData}" rerender="pageMessages,EquipmentGuaranteeFlg,EGFlgassHidden,EquipmentGuaranteeFlgtxt, assetListPriceHidden, productCount3, assetSection, uFRMaxPrice, uFRMinPrice, uFRMaxPrice3, uFRMinPrice3,uRFSeries" oncomplete="refreshAsset({!productCount});unblockUI();">
            <apex:param assignTo="{!productIdx}" name="productIdx" value=""/>
        </apex:actionFunction>
        <!-- update 合同报价页面的优化 添加‘assetSection’ fxk 2021/9/10 End-->
@@ -1345,17 +1584,41 @@
                <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>
            
            <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>
                <td>
                    <apex:inputField value="{!estimate.URF_V_MaxRepairCount__c}" required="false" id="estimateURFVMaxRepairCount" onchange="checkVMaxRepairCount(this.value,{!productCount})" style="margin-left:5px"/>次
                </td>
            </tr>
            <tr>
                <td  width="50%" align="right">
                    <label class="labelCol vfLabelColTextWrap " style="margin-left:30%">URF-P最大大修次数:</label></td>
                <td width="50%" align="left">
                    <apex:inputField value="{!estimate.URF_P_MaxRepairCount__c}" required="false" id="estimateURFPMaxRepairCount" onchange="checkPMaxRepairCount(this.value,{!productCount})" style="margin-left:5px"/>次
                </td>
            </tr>
            <!-- URF限次合同2期 LY 20220811 end -->
        </table>
        <script type="text/javascript">
            j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).children('option[value=]').remove();
            resetDealer();
            j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).children('option[value=]').remove();
            j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).children('option[value=]').remove();
        </script>
        </apex:outputPanel>
        </apex:pageBlockSection>
@@ -1387,13 +1650,20 @@
                    <tr class="headerRow" height="30px">
                        <th style="width:25px" class="headerRow  booleanColumn"><input type='checkbox' onClick='checkAll(this)'/></th>
                        <th class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Name.label}</th>
                        <!-- 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>
                        <th class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.EGFlg_fromContract_asset__c.label}</th>
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.InstallDate.label}</th>
                        <!--add点检改善:新增一个点检对象复选框字段,默认为true 2021.6.8 fxk Star-->
                        <th style="width:70px" class="headerRow  booleanColumn">
                        {!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Check_Object__c.label}</th>
                        <!-- URF限次合同2期 LY 20220811 start -->
                        <!-- <th style="width:70px" class="headerRow  booleanColumn">
                        {!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Check_Object__c.label}</th> -->
                        <!-- URF限次合同2期 LY 20220811 end -->
                        <!--add点检改善:新增一个点检对象复选框字段,默认为true 2021.6.8 fxk end-->
                        <th style="width:40px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.IsNew__c.label}</th>
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Department_Name__c.label}</th>
@@ -1438,6 +1708,17 @@
                                    <apex:inputField value="{!ar.mcae.Product_Manual__c}" id="Assert" style="width:90%;" rendered="{!ar.IsManual}" onchange="blockme();refreshProductData({!ar.lineNo});"/>
                                    <apex:inputText id="ProductId" value="{!ar.mcae.Product_Manual__c}" style="display:none;" disabled="true"/>
                                </td>
                                <!-- URF限次合同2期 LY 20220811 start -->
                                <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)}" />
                                </td>
@@ -1455,9 +1736,11 @@
                                    <apex:outputField value="{!ar.rec.InstallDate}" id="InstallDate" rendered="{!Not(ar.IsManual)}" />
                                </td>
                                <!--add点检改善:新增一个点检对象复选框字段,默认为true 2021.6.8 fxk Star-->
                                <td class="dataCell" width="70px" style="text-align:center" >
                                <!-- URF限次合同2期 LY 20220811 start -->
                                <!-- <td class="dataCell" width="70px" style="text-align:center" >
                                    <apex:inputCheckbox value="{!ar.mcae.Check_Object__c}" id="assetCheck" disabled="{!ar.CheckRows}"/>
                                </td>
                                </td> -->
                                <!-- URF限次合同2期 LY 20220811 end -->
                                <!--add点检改善:新增一个点检对象复选框字段,默认为true 2021.6.8 fxk end-->
                                <td class="dataCell" width="40px" style="text-align:center" >
                                    <apex:inputCheckbox value="{!ar.mcae.IsNew__c}" id="assetNew" disabled="true"/>
@@ -1499,6 +1782,14 @@
                                    <apex:inputHidden value="{!ar.mcae.Adjustment_Lower_price__c}" id="Adjustment_Lower_priceHidden"/>
                                    <apex:outputPanel layout="none" rendered="{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.createable}" >
                                        <apex:inputHidden value="{!ar.mcae.Estimate_List_Price__c}" id="assetListPriceHidden"/>
                                        <!-- XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 start -->
                                        <apex:inputHidden value="{!ar.uFRMaxPrice}" id="uFRMaxPrice"/>
                                        <apex:inputHidden value="{!ar.uFRMinPrice}" id="uFRMinPrice"/>
                                        <!-- XLIU-CE7AVC【委托】URF限次修理合同的最高价格修改 thh 20220509 end -->
                                        <!-- URF限次合同2期 LY 20220811 start -->
                                        <apex:inputHidden value="{!ar.uFRMaxPrice3}" id="uFRMaxPrice3"/>
                                        <apex:inputHidden value="{!ar.uFRMinPrice3}" id="uFRMinPrice3"/>
                                        <!-- URF限次合同2期 LY 20220811 end -->
                                        <apex:inputHidden value="{!ar.mcae.Estimate_List_Price_Page__c}" id="assetListPricePageHidden" />
                                        <apex:inputHidden value="{!ar.rec.CurrentContract_F__r.Estimate_Num__c}" id="Estimate_NumHidden" />
                                    </apex:outputPanel>
@@ -1617,6 +1908,9 @@
                    <tr class="headerRow" height="30px">
                        <th style="width:25px" class="headerRow  booleanColumn"><input type='checkbox' onClick='checkAll2(this)'/></th>
                        <th style="width:25%" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Name.label}</th>
                        <!-- URF限次合同2期 LY 20220811 start -->
                        <th style="width:90px" class="headerRow  booleanColumn">限次系列<!-- {!$ObjectType.Asset.fields.Product2.ProductURF__r.URFLimitSerial__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>
                        <th class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Department_Name__c.label}</th>
@@ -1638,12 +1932,21 @@
                    <apex:repeat value="{!unCheckedAssetsView}" var="assetsView" id="outassetTable2">
                        <apex:repeat value="{!assetsView}" var="ar" id="assetTable2">
                            <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
                                <td class="dataCell" width="25px">
                                <!-- <td class="dataCell" width="25px">
                                    <apex:inputCheckbox value="{!ar.rec_checkBox_c}" id="assetRowCheckbox2" disabled="{!IF(ar.uFRPrice == 0 || ar.rec.IF_Warranty__c = '否', 'true', 'false')}"/>
                                </td> -->
                                <!-- gzw update 20220823 -->
                                <td class="dataCell" width="25px">
                                    <apex:inputCheckbox value="{!ar.rec_checkBox_c}" id="assetRowCheckbox2" disabled="{!IF( ar.rec.IF_Warranty__c = '否', 'true', 'false')}"/>
                                </td>
                                <td class="dataCell" width="25%">
                                    <apex:outputField value="{!ar.rec.name}" id="assetName"/>
                                </td>
                                <!-- URF限次合同2期 LY 20220811 start -->
                                <td class="dataCell" width="90px">
                                    <!-- <apex:outputField value="{!ar.rec.Product2.ProductURF__r.URFLimitSerial__c}"/> --><apex:outputText value="{!ar.uFRSerial}"/>
                                </td>
                                <!-- URF限次合同2期 LY 20220811 end -->
                                <td class="dataCell" width="70px">
                                    <apex:outputField value="{!ar.rec.Asset_situation__c}"/>
                                </td>
@@ -1788,7 +2091,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}"  />
@@ -2023,7 +2329,7 @@
    // 选择设备后价格变更check
    if (assIds.length > 0) {
        // alert('222222222222' + assIds);
        var sql = "SELECT Id, Maintenance_Price_Month__c,Product2.UFR_Maintenance_Price_Month__c, Posting_Date__c, InstallDate from Asset where Id In(" + assIds + ")";
        var sql = "SELECT Id, Maintenance_Price_Month__c,Product2.UFR_Maintenance_Price_Month__c, Posting_Date__c, InstallDate,Product2.UFR_Maintenance_Price_Month_3__c from Asset where Id In(" + assIds + ")";
        var rt = sforce.connection.query(sql);
        var asList = rt.getArray("records"); 
        if (asList != null) {
@@ -2033,7 +2339,10 @@
                var asId = asvar["Id"];
                // alert('asvar++++' + asvar["Product2"].["ProductURF__r"].["UFR_Maintenance_Price_Month__c"]);
                // var mprice = asvar["Maintenance_Price_Month__c"];
                var mprice = asvar["Product2"].UFR_Maintenance_Price_Month__c;
                //URF限次合同2期 LY 20220811 start
                //var mprice = asvar["Product2"].UFR_Maintenance_Price_Month__c;
                var mprice = asvar["Product2"].UFR_Maintenance_Price_Month_3__c;
                //URF限次合同2期 LY 20220811 end
                var ptDt = asvar["Posting_Date__c"];
                var postingDate = null;
                if (ptDt != null && ptDt != '') {
@@ -2071,7 +2380,7 @@
                return true;
            }
        } else {
            var sql = "SELECT Id, Maintenance_Price_Month__c,UFR_Maintenance_Price_Month__c from Product2 where Id In(" + proIds + ")";
            var sql = "SELECT Id, Maintenance_Price_Month__c,UFR_Maintenance_Price_Month__c,UFR_Maintenance_Price_Month_3__c from Product2 where Id In(" + proIds + ")";
            var rt = sforce.connection.query(sql);
            var pdList = rt.getArray("records");
            if (pdList != null) {
@@ -2079,7 +2388,10 @@
                    var pdvar = pdList[i];
                    var pdId = pdvar["Id"];
                    // var mprice = pdvar["Maintenance_Price_Month__c"];
                    var mprice = pdvar["UFR_Maintenance_Price_Month__c"];
                    //URF限次合同2期 LY 20220811 strat
                    //var mprice = pdvar["UFR_Maintenance_Price_Month__c"];
                    var mprice = pdvar["UFR_Maintenance_Price_Month_3__c"];
                    //URF限次合同2期 LY 20220811 end
                    var priceShow = priceMap.get(pdId);
                    if (Number(mprice).toFixed(2) != Number(priceShow).toFixed(2)) {
                        needClearId = true;