denny chen
2023-03-29 db8e77d60465f32b033d7a67fb3a008263fd9e9e
force-app/main/default/pages/SelectAssetEstimateVM.page
@@ -271,9 +271,9 @@
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val('');
    }
    Price111 = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Limit_Price_Amount')).val();
    console.log('上限金额为'+Limit_Price_Amount);
    console.log('原有上限金额为'+Limit_PriceHidden);
    console.log('不是上限合同的金额为'+Price111);
    // console.log('上限金额为'+Limit_Price_Amount);
    // console.log('原有上限金额为'+Limit_PriceHidden);
    // console.log('不是上限合同的金额为'+Price111);
    //上限合同 20230103 hql end
    pageSetDisabled();
    var createdDate = new Date('{!estimate.CreatedDate}');
@@ -395,6 +395,7 @@
}
function checkDiscount(val) {
    var alerts = 0;
    if (val == null || val == "") {
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val("");
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:discount_Rate')).text("");
@@ -406,6 +407,27 @@
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:quotation_Amount')).val(0.00);
        return;
    }
    // 报价金额改善 20230314 start
    // var startime1 =  new Date(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value());
    // var startime2 = new Date(j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value());
    // var result = (startime2-startime1)/(3600*24*1000);
    // Is_Blank_period1 =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).value();
    // Cost_rate_ForecastF =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Cost_rate_ForecastF')).value();
    // downprice = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDown')).value();
    // var renewTenOFF = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:renewTenOFF')).value();
    // if (Is_Blank_period1 == 'true' && ((parseFloat(Cost_rate_ForecastF)<100)||Cost_rate_ForecastF.length == 0) && result <=1 && downprice > val ) {
    //    alerts = 1;
    // }
    // if (alerts == 1 && renewTenOFF == 'false') {
    //     if (confirm("本单可以继续申请10%折扣,请确认是否申请,申请后合同开始日自动锁定为合同预定开始日,后续无法更改合同开始日")) {
    //         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:renewTenOFF')).val(true);
    //         val = val*0.9;
    //         j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).attr("disabled", true);
    //     } else {
    //     }
    // }
    // 报价金额改善 20230314 end
    val = localParseFloat(val);
    //val = Math.round(val * 100) / 100;
    val = Math.round(val);
@@ -466,9 +488,188 @@
    console.log('方法2是否审批通过=='+ISReducedpriceapproval+'==============');
}
var number1 = 0;
// function seamlessRenew(cnt){
//     // 报价规则改善 20230309 start
//     var isSeamlessRenew = 0;
//     var isSeamlessRenew1 = 0;
//     var isSeamlessRenew3 = 0;
//     var isSeamlessRenew4 = 0;
//     // 报价规则改善 20230309 end
//     // 报价规则改善 20230310 start
//     var downPriceSum = 0;
//     var upPriceSum = 0;
//     var downPriceSum1 = 0;
//     var upPriceSum1 = 0;
//     var downPriceSum3 = 0;
//     var upPriceSum3 = 0;
//     var downPriceSum4 = 0;
//     var upPriceSum4 = 0;
//     // 报价规则改善 20230310 end
//     // 报价规则改善 20230310 start
//     var renewTenOFF = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:renewTenOFF')).value();
//     if (renewTenOFF == 'true') {
//         j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).attr("disabled", true);
//     }
//         document.getElementById("startdateaddsix1").value = addMonths(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value(),6);
//         document.getElementById("startdateaddsix2").value = addMonths(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value(),6);
//         document.getElementById("startdateaddsix3").value = addMonths(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value(),12);
//     // 报价规则改善 20230310 end
//     for (var i = 0; i < cnt; i++) {
//         // 报价规则改善 20230310 start
//         var  downPrice1 = 0;
//         var  upPrice1 = 0;
//         var  downPrice3 = 0;
//         var  upPrice3 = 0;
//         var  downPrice4 = 0;
//         var  upPrice4 = 0;
//          var Price_YearTXT = 0;
//         var LastMContract_Price = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContract_Price')).val());
//         var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val();
//         // 合同月数乗算
//         var month = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
//         if (month == undefined || month == "") {
//             month = 1;
//         }
//         var month2 = 0;
//         if (month > 12) {
//             month2 = month - 12;
//             month = 12;
//         }
//         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();
//         if(b != ''){
//                     // var lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value());
//                     var lastContRange = 0;
//                     if(LastMContractRecord == 'VM_Contract'){
//                         // lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
//                         lastContRange = 36;
//                     }else{
//                         lastContRange = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':lastContRange')).value();
//                     }
//         }
//         var Punish = calculateNtoMRatio( lastContRange,(month + month2));
//          // 报价规则改善 20230310 end
//         if (!isDisabled) {
//             var Adjustment_ratio_Lower = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_ratio_Lower')).val());
//             var Adjustment_ratio_Upper = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_ratio_Upper')).val());
//              strMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
//                 Price_YearTXT = strMoney * 12;
//                 if (isnew == 'true') {
//                     strMoney = month * strMoney + month2 * strMoney / {!isNewPriceAdj};
//                 } else {
//                     strMoney = month * strMoney + month2 * strMoney;
//                 }
//             // 服务合同报价规则改善 20230227 start
//                     var LastMContractID = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractID')).value();
//                     // var ISStandardPricing = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ISStandardPricing')).value();
//                     // 缺少首签设备逻辑
//                     if (LastMContractID == '') {
//                         console.log('新签设备');
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(strMoney));
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val(strMoney);
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(strMoney));
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val(strMoney);
//                     }
//             // 服务合同报价规则改善 20230227 end
//             var startdate11 = j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value();
//             var startdate1 = j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value();
//             var startdate = new Date(startdate1);
//             var startdatesix1 = new Date(addMonths(startdate11,6));
//             startdatesix1.setDate(startdatesix1.getDate()-1);
//             var startdatesix2 = new Date(addMonths(startdate11,6));
//             startdatesix2.setDate(startdatesix2.getDate()+1);
//             var startdatesix3 = new Date(addMonths(startdate11,12));
//             startdatesix3.setDate(startdatesix3.getDate()+1);
//             // 第一个日期
//             var result1 = Blankperiod(startdate,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,1);
//             var arr=result1.split( '/');
//             downPrice=parseInt(arr[0]);
//             upPrice=parseInt(arr[1]);
//             isSeamlessRenew=isSeamlessRenew+parseInt(arr[2]);
//             // console.log('result1='+result1);
//             // 第二个日期
//             var result2 = Blankperiod(startdatesix1,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,2);
//             var arr2=result2.split( '/');
//             downPrice1=parseInt(arr2[0]);
//             upPrice1=parseInt(arr2[1]);
//             isSeamlessRenew1=isSeamlessRenew1+parseInt(arr2[2]);
//             // console.log('result2='+result2);
//             // 第三个日期
//             var result3 = Blankperiod(startdatesix2,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,2);
//             var arr3=result3.split( '/');
//             downPrice3=parseInt(arr3[0]);
//             upPrice3=parseInt(arr3[1]);
//             isSeamlessRenew3=isSeamlessRenew3+parseInt(arr3[2]);
//             // console.log('result3='+result3);
//             // 第四个日期
//             var result4 = Blankperiod(startdatesix3,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,2);
//             var arr4=result4.split( '/');
//             downPrice4=parseInt(arr4[0]);
//             upPrice4=parseInt(arr4[1]);
//             isSeamlessRenew4=isSeamlessRenew4+parseInt(arr4[2]);
//             // console.log('result4='+result4);
//             // 报价规则改善 20230308 end
//             // 报价规则改善 20230310 start
//             downPriceSum = downPriceSum + localParseFloat(toNum(downPrice));
//             upPriceSum =  upPriceSum + localParseFloat(toNum(upPrice));
//             downPriceSum1 = downPriceSum1 + localParseFloat(toNum(downPrice1));
//             upPriceSum1 =  upPriceSum1 + localParseFloat(toNum(upPrice1));
//             downPriceSum3 = downPriceSum3 + localParseFloat(toNum(downPrice3));
//             upPriceSum3=  upPriceSum3 + localParseFloat(toNum(upPrice3));
//             downPriceSum4 = downPriceSum4 + localParseFloat(toNum(downPrice4));
//             upPriceSum4=  upPriceSum4 + localParseFloat(toNum(upPrice4));
//             // 报价规则改善 20230310 end
//         }
//     }
//     // 报价规则改善 20230309 start
//     // console.log('isSeamlessRenew='+isSeamlessRenew);
//         if (isSeamlessRenew==0) {
//             j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).val(true);
//         }else{
//             j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).val(false);
//         }
//         var startime1 =  new Date(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:PastContractendday')).value());
//         var startime2 = new Date(j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value());
//         var result = (startime2-startime1)/(3600*24*1000);
//         Is_Blank_period1 =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Is_Blank_period')).value();
//         Cost_rate_ForecastF =  j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Cost_rate_ForecastF')).value();
//         // 5.当预测成本率为空时实绩连动价格是否享受9折优惠
//         if (isSeamlessRenew==0 && ((parseFloat(Cost_rate_ForecastF)<100)||Cost_rate_ForecastF.length == 0)) {
//             downPriceSum = downPriceSum*0.9;
//             upPriceSum = upPriceSum*0.9;
//         }
//         if (isSeamlessRenew1==0) {
//             downPriceSum1 = downPriceSum1*0.9;
//             upPriceSum1 = upPriceSum1*0.9;
//         }
//         if (isSeamlessRenew3==0) {
//             downPriceSum3 = downPriceSum3*0.9;
//             upPriceSum3 = upPriceSum3*0.9;
//         }
//         if (isSeamlessRenew4==0) {
//             downPriceSum4 = downPriceSum4*0.9;
//             upPriceSum4 = upPriceSum4*0.9;
//         }
//         if (!isDisabled) {
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUp')).text(toNumComma(Math.round(upPriceSum)));
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUpHidden')).val(toNum(Math.round(upPriceSum)));
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDown')).text(toNumComma(Math.round(downPriceSum)));
//         j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDownHidden')).val(toNum(Math.round(downPriceSum)));
//         }
//         document.getElementById("GuidePriceDown5").value = toNumComma(Math.round(downPriceSum));
//         document.getElementById("GuidePriceUp5").value = toNumComma(Math.round(upPriceSum));
//         document.getElementById("GuidePriceDown4").value = toNumComma(Math.round(downPriceSum1));
//         document.getElementById("GuidePriceUp4").value = toNumComma(Math.round(upPriceSum1));
//         document.getElementById("GuidePriceDown3").value = toNumComma(Math.round(downPriceSum3));
//         document.getElementById("GuidePriceUp3").value = toNumComma(Math.round(upPriceSum3));
//         document.getElementById("GuidePriceDown2").value = toNumComma(Math.round(downPriceSum4));
//         document.getElementById("GuidePriceUp2").value = toNumComma(Math.round(upPriceSum4));
//     // 报价规则改善 20230309 end
// }
function refreshAsset(cnt) {
    console.log('执行refreshAsset');
    console.log('decide==='+{!DecideBtnDisabled});
     // alert(cnt);
    // 提交后就页面不计算了
    var isDisabled = {!PageDisabled};
@@ -488,6 +689,8 @@
    var GuranteeCount = 0;
    //多年保续签合同数量 thh 20220316 end
    //2022故障品加费 获取userInfo简档名称 是否为FSE start
    var isFSE = {!isFSE};
    // var isFSE = true;
@@ -503,6 +706,10 @@
    //20230208 上限合同开发 hql end
    // 预定开始日
    var startdate = new Date(j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value());
    // 报价规则改善
    // document.getElementById("startdateaddsix4").value = j$(escapeVfId('allPage:allForm:allBlock:contract:startdate')).value();
    // 报价规则改善
    // 预定开始日-6个月
    startdate.setMonth(startdate.getMonth() - 6);
    // 申请日 当前日期
@@ -529,6 +736,7 @@
        month = 12;
    }
    for (var i = 0; i < cnt; i++) {
        // console.log('第'+i+'个设备');
        var strMoney = 0;
        var repairMoney = 0;
        // 行项目 最高、最低价格合计
@@ -536,8 +744,7 @@
        // 下线价格
        var downPrice = 0;
        // 上线价格
        var upPrice = 0;
        var upPrice = 0;
        // 12个月合同金额
        var Price_YearTXT = 0;
@@ -620,6 +827,12 @@
                            var nowdate = new Date();
                            lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
                            nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                            if(nowdate < Date.parse(lastendDate)){
                                upPrice = strMoney;
                                downPrice = strMoney * 0.8;
                            }else{
                                upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                                downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                            //市场多年保修价格开发 DC 2023/1/30 start 
@@ -629,7 +842,7 @@
                            var ContractMonth = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
                            var AssetRate = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':AssetConsumptionRateNew')).val());
                            console.log('***消费率:'+AssetRate);
                            // console.log('***消费率:'+AssetRate);
                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contractrate')).text(AssetRate +'%');
@@ -678,40 +891,40 @@
                                
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end 
                            console.log('***最高系数'+Maxcoefficient);
                            console.log('***最低系数'+Mincoefficient);
                            // console.log('***最高系数'+Maxcoefficient);
                            // console.log('***最低系数'+Mincoefficient);
                        if(nowdate < Date.parse(lastendDate)){
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                        console.log('***小于2年半')
                        // console.log('***小于2年半')
                        // 市场多年保修价格开发 start DC 2023/01/19  
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            console.log('***设备型号'+AssetModelNo);
                            console.log('***产品类型'+Category4);
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<1.4){
                                upPrice = VMassetListmonth * ContractMonth /12;
                                console.log('消费率小于1.4 upPrice = 定价 *经历月数 /12'+ upPrice);
                                // console.log('消费率小于1.4 upPrice = 定价 *经历月数 /12'+ upPrice);
                                if(AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF')){
                                    downPrice = upPrice;
                                    console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                    // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                }else{
                                    downPrice = upPrice * 0.8;
                                    console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                }
                            }else{
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;   
                                console.log('消费率大于1.4 upPrice'+ upPrice);
                                console.log('消费率大于1.4 downPrice'+ downPrice);
                                // console.log('消费率大于1.4 upPrice'+ upPrice);
                                // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                            // 市场多年保修价格开发 end DC 2023/01/19  
                            }else{
@@ -724,8 +937,8 @@
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                                console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 upPrice'+ upPrice);
                                console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 downPrice'+ downPrice);
                                // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 upPrice'+ upPrice);
                                // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 downPrice'+ downPrice);
                                //市场多年保修价格开发 DC 2023/1/30 end 
                            
@@ -754,24 +967,12 @@
                //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceTXT')).text(toNumComma(Price_YearTXT));
                //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceTXTHidden')).val(Price_YearTXT);
                if (!isDisabled) {
                    // // 服务合同报价规则改善 20230227 start
                    // var LastMContractID = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractID')).value();
                    // var ISStandardPricing = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ISStandardPricing')).value();
                    // if (LastMContractID == '' && ISStandardPricing == '是') {
                    //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(upPrice));
                    //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val(upPrice);
                    //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice));
                    //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val(upPrice);
                    // }
                    // // 服务合同报价规则改善 20230227 end
                    // else{
                    // 实际联动价格 start
                    j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice));
                    j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val(downPrice);
                    j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice));
                    j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val(upPrice);
                    // 实际联动价格 end
                    // }
                }
                
                //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(strMoney));
@@ -815,7 +1016,7 @@
            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();
            console.log('***维修合同记录类型2'+LastMContractRecord);
            // console.log('***维修合同记录类型2'+LastMContractRecord);
            if(b != ''){
                conCCount ++;
@@ -862,16 +1063,16 @@
                        var nowdate = new Date();
                        lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':endDateGurantee_Text')).value());
                        nowdate = nowdate.setMonth(nowdate.getMonth() + 6);
                        console.log('**结束日',lastendDate);
                        // console.log('**结束日',lastendDate);
                        //市场多年保修价格开发 DC 2023/1/30 start 
                            var Maxcoefficient =0;
                            var Mincoefficient =0;
                            var ContractMonth = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contract:monthRange')).val());
                            console.log('***经历月数'+ContractMonth);
                            // console.log('***经历月数'+ContractMonth);
                            var AssetRate = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':AssetConsumptionRateNew')).val());
                            console.log('***消费率:'+AssetRate);
                            // console.log('***消费率:'+AssetRate);
                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contractrate')).text(AssetRate +'%');
@@ -920,40 +1121,45 @@
                                
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end 
                            console.log('***最高系数'+Maxcoefficient);
                            console.log('***最低系数'+Mincoefficient);
                            // console.log('***最高系数'+Maxcoefficient);
                            // console.log('***最低系数'+Mincoefficient);
                        if(nowdate < Date.parse(lastendDate)){
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                            upPrice = strMoney;
                            downPrice = strMoney * 0.8;
                        }else{
                            upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                            downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                        //     //设备小于两年半
                        //     // upPrice = strMoney;
                        //     // downPrice = strMoney * 0.8;
                            
                        // 市场多年保修价格开发 start DC 2023/01/19  
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            console.log('***设备型号'+AssetModelNo);
                            console.log('***产品类型'+Category4);
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<1.4){
                                upPrice = VMassetListmonth *ContractMonth / 12;
                                console.log('消费率小于1.4 upPrice = VMassetListmonth *month /12'+ upPrice);
                                // console.log('消费率小于1.4 upPrice = VMassetListmonth *month /12'+ upPrice);
                                if(AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF')){
                                    downPrice = upPrice;
                                    console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                    // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                }else{
                                    downPrice = upPrice * 0.8;
                                    console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                }
                            }else{
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;   
                                console.log('消费率大于1.4 upPrice'+ upPrice);
                                console.log('消费率大于1.4 downPrice'+ downPrice);
                                // console.log('消费率大于1.4 upPrice'+ upPrice);
                                // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                        // 市场多年保修价格开发 end DC 2023/01/19      
@@ -966,8 +1172,8 @@
                            upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                            downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;
                            console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 upPrice'+ upPrice);
                            console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 downPrice'+ downPrice);
                            // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 upPrice'+ upPrice);
                            // console.log('设备大于2年半 续签价格 = 定价 *消费率对应系数 / 12 *合同月数 downPrice'+ downPrice);
                            //市场多年保修价格开发 DC 2023/1/30 end 
                        }
                        // gzw 20220630  实际联动6个月价格区分
@@ -998,18 +1204,7 @@
            //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceTXT')).text(toNumComma(Price_YearTXT));
            //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceTXTHidden')).val(Price_YearTXT);
            if (!isDisabled) {
                // // 服务合同报价规则改善 20230227 start
                // var LastMContractID = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractID')).value();
                // var ISStandardPricing = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':ISStandardPricing')).value();
                // console.log('ISStandardPricing=='+ISStandardPricing);
                // if (LastMContractID == '' && ISStandardPricing == '是') {
                //     console.log('开始执行');
                //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(upPrice));
                //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val(upPrice);
                //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice));
                //     j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val(upPrice);
                // }
                // // 服务合同报价规则改善 20230227 end
                // else{
                // 实际联动价格 start
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice));
@@ -1021,13 +1216,14 @@
            }
            //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(strMoney));
            j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(strMoney);
            //<!-- (2022年12月上线)故障品加费 start -->
            
            //<!-- (2022年12月上线)故障品加费 start -->
            Repair_Price_AutoPrice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_Auto'));
            Repair_Price_Auto = Repair_Price_AutoPrice.value();
            repairMoney = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).value();
            Repair_Price_pass = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Repair_Price_pass')).val();
            console.log((i+1)+'号repairMoney='+repairMoney);
            // console.log((i+1)+'号repairMoney='+repairMoney);
            // console.log((i+1)+'号Repair_Price_Auto='+Repair_Price_Auto);
            if ((repairMoney+1)==1) {
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).val(Repair_Price_Auto);
@@ -1039,7 +1235,7 @@
            }
            repairMoney1 = localParseFloat(repairMoney);
            ISReducedpriceapproval = j$(escapeVfId('allPage:allForm:allBlock:ISReducedpriceapproval')).val();
            console.log('ISReducedpriceapproval=='+ISReducedpriceapproval);
            // console.log('ISReducedpriceapproval=='+ISReducedpriceapproval);
            var isDisabled = {!PageDisabled};
            if (ISReducedpriceapproval =='有八折以下待审批' || ISReducedpriceapproval =='是'|| isDisabled) {
                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':repairPrice')).attr("disabled", true);
@@ -1086,6 +1282,7 @@
        listSum = listSum + localParseFloat(toNum(strMoney));
        downPriceSum = downPriceSum + localParseFloat(toNum(downPrice));
        upPriceSum =  upPriceSum + localParseFloat(toNum(upPrice));
    }
    
   
@@ -1094,6 +1291,7 @@
    
    //j$(escapeVfId('allPage:allForm:allBlock:contractInfo:assetSumPrice')).text(toNumComma(listSum));
    //j$(escapeVfId('allPage:allForm:allBlock:contractInfo:assetSumPriceHidden')).val(toNum(listSum));
    if (!isDisabled) {
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUp')).text(toNumComma(Math.round(upPriceSum)));
        j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUpHidden')).val(toNum(Math.round(upPriceSum)));
@@ -1125,14 +1323,18 @@
    }else{
        result = '续签合同';
    }
    console.log(result);
    // console.log(result);
    document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXT").innerHTML = result;
    document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXTHidden").value = result;
    // 取消酸化水
    //NotUseOxygenatedWaterAmount(1);
    examinationPriceCal(cnt);
    getLastContractRate();
    // 报价规则改善 20230315 start
    // seamlessRenew(cnt);
    // 报价规则改善 20230315 end
    number1++;
}
function changeAsset(cnt) {
    console.log('执行了changeAsset');
@@ -1346,44 +1548,46 @@
                                
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end 
                            console.log('***最高系数'+Maxcoefficient);
                            console.log('***最低系数'+Mincoefficient);
                            // console.log('***最高系数'+Maxcoefficient);
                            // console.log('***最低系数'+Mincoefficient);
                        if(nowdate < Date.parse(lastendDate)){
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                        console.log('***小于2年半')
                        // console.log('***小于2年半')
                        // 市场多年保修价格开发 start DC 2023/01/19  
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            console.log('***设备型号'+AssetModelNo);
                            console.log('***产品类型'+Category4);
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<1.4){
                                upPrice = VMassetListmonth * ContractMonth / 12 ;
                                console.log('消费率小于1.4 upPrice = VMassetListmonth *ContractMonth / 12'+ upPrice);
                                // console.log('消费率小于1.4 upPrice = VMassetListmonth *ContractMonth / 12'+ upPrice);
                                if(AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF')){
                                    downPrice = upPrice;
                                    console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                    // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                }else{
                                    downPrice = upPrice * 0.8;
                                    console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                }
                            }else{
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;   
                                console.log('消费率大于1.4 upPrice'+ upPrice);
                                console.log('消费率大于1.4 downPrice'+ downPrice);
                                    // console.log('消费率大于1.4 upPrice'+ upPrice);
                                    // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                            // 市场多年保修价格开发 end DC 2023/01/19  
                            }else{
                                upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                                downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                                // upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                                // downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
@@ -1564,43 +1768,47 @@
                                
                            }
                            //市场多年保修价格开发 DC 2023/1/30 end 
                            console.log('***最高系数'+Maxcoefficient);
                            console.log('***最低系数'+Mincoefficient);
                            // console.log('***最高系数'+Maxcoefficient);
                            // console.log('***最低系数'+Mincoefficient);
                        if(nowdate < Date.parse(lastendDate)){
                            upPrice = strMoney;
                            downPrice = strMoney * 0.8;
                            //设备小于两年半
                            // upPrice = strMoney;
                            // downPrice = strMoney * 0.8;
                        console.log('***小于2年半')
                        // console.log('***小于2年半')
                        // 市场多年保修价格开发 start DC 2023/01/19  
                            //市场多年保设备小于2年半
                            var AssetModelNo = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Asset_Model_No__c')).value();
                            var Category4 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Category4__c')).value();
                            console.log('***设备型号'+AssetModelNo);
                            console.log('***产品类型'+Category4);
                            // console.log('***设备型号'+AssetModelNo);
                            // console.log('***产品类型'+Category4);
                            //设备设备消费率小于1.4
                            if(AssetRate<1.4){
                                upPrice = VMassetListmonth * ContractMonth /12;
                                console.log('消费率小于1.4 upPrice = VMassetListmonth *ContractMonth /12'+ upPrice);
                                // console.log('消费率小于1.4 upPrice = VMassetListmonth *ContractMonth /12'+ upPrice);
                                if(AssetModelNo.includes('290')&&( Category4 =='BF'|| Category4=='BF扇扫'||Category4=='CF')){
                                    downPrice = upPrice;
                                    console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                    // console.log('消费率小于1.4 产品无最低价 downPrice '+ downPrice);
                                }else{
                                    downPrice = upPrice * 0.8;
                                    console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                    // console.log('消费率小于1.4 产品最低价 downPrice = upPrice* 0.8:'+ downPrice);
                                }
                            }else{
                                upPrice = VMassetListmonth * ContractMonth *Maxcoefficient / 12;
                                downPrice = VMassetListmonth * ContractMonth * Mincoefficient / 12;   
                                console.log('消费率大于1.4 upPrice'+ upPrice);
                                console.log('消费率大于1.4 downPrice'+ downPrice);
                                // console.log('消费率大于1.4 upPrice'+ upPrice);
                                // console.log('消费率大于1.4 downPrice'+ downPrice);
                            }
                            // 市场多年保修价格开发 end DC 2023/01/19  
                        }else{
                             upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                            downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
                            // upPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Upper/100);
                            // downPrice = (assetListmonth * Punish) * (1 + Adjustment_ratio_Lower/100);
@@ -1785,6 +1993,9 @@
    }
    console.log('上限金额为'+Limit_Price_Amount);
    //上限合同 20230214 hql end
    // 报价规则改善 20230315 start
    // seamlessRenew(cnt);
    // 报价规则改善 20230315 end
}
@@ -2014,8 +2225,136 @@
    //     return true;
    // }
}
// 报价规则改善 20230310 start
// function addMonths(yearMonthDay ,monthNum){
//     var arr=yearMonthDay.split( '/');
//     var year=parseInt(arr[0]);
//     var month=parseInt(arr[1]);
//     var day=parseInt(arr[2]);
//     month=month+monthNum;
//     if(month>12){//月份加
//         var yearNum=parseInt( (month-1)/12);
//         month=month%12==0?12 :month%12;
//         year+=yearNum;
//         }else if(month<=0){//月份减
//             month=Math.abs( month);
//             var yearNum=parseInt( (month+12)/12);
//             year-=yearNum;
//         }
//         month=month<10?"0"+month :month;
//         return year+"/"+month+"/"+day;
// }
// function Blankperiod(startdate,i,LastMContract_Price,Punish,Adjustment_ratio_Upper,Adjustment_ratio_Lower,strMoney,type){
//             var  downPrice = 0;
//             var  upPrice = 0;
//             var  isSeamlessRenew = 0;
//             Blank_period = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).value();
//             var lastendDate1= j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value()
//             var lastendDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value());
//             // console.log("lastendDate1="+lastendDate1);
//             var today = new Date();
//             if (lastendDate1.length !=0) {
//                 if (startdate == null) {
//                     // console.log(1);
//                      Blank_period=(today-lastendDate)/(3600*24*1000);
//                 }else{
//                     // console.log(2);
//                     Blank_period=(startdate-lastendDate)/(3600*24*1000);
//                 }
//                 j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).val(Blank_period);
//             }
//             if (Number(Blank_period)<15&&Blank_period.length != 0) {
//                 // console.log(3);
//                 j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).val('无缝续签');
//             }
//             Blank_period1 = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Blank_period')).value();
//             // console.log('Blank_period1='+Blank_period1);
//             // 2.无空白期设备是否算无缝续签设备 是否包含在无缝续签的报价判断中(首签的设备)?
//             if (Blank_period1 != '无缝续签' && Blank_period.length != 0) {
//                 isSeamlessRenew++;
//             }
//             // 1.实绩连动价格和设备参保定价 逻辑查看
//             upPrice1 = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Upper/100);
//             downPrice1 = (LastMContract_Price * Punish) * (1 + Adjustment_ratio_Lower/100);
//             // 定价8折
//             downPrice2 = strMoney * 0.8;
//             upPrice1 = upPrice1.toFixed(2);
//             upPrice2 = strMoney.toFixed(2);
//             downPrice1 = downPrice1.toFixed(2);
//             downPrice2 = downPrice2.toFixed(2);
//             // console.log('LastMContract_Price='+LastMContract_Price);
//             // console.log('upPrice1='+upPrice1);
//             // console.log('downPrice1='+downPrice1);
//             // console.log('upPrice2='+upPrice2);
//             // console.log('downPrice2='+downPrice2);
//             if (!isDisabled) {
//                 if (Blank_period1.length==0) {
//                     downPrice = downPrice2;
//                     upPrice = upPrice2;
//                 }
//                 if (Blank_period1.length!=0 && Number(Blank_period1)<180 || Blank_period1 == '无缝续签' ) {
//                     if (type == 1) {
//                         console.log('续签设备小于6个月');
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice1));
//                         j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice1));
//                     }
//                      downPrice = downPrice1;
//                      upPrice = upPrice1;
//                 }
//                 if (Blank_period1 != '无缝续签' && Number(Blank_period1)>180 && Number(Blank_period1)<365) {
//                     if (downPrice1<downPrice2) {
//                         if (type == 1) {
//                             console.log('续签设备6-12个月1');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice2));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice2));
//                         }
//                         downPrice = downPrice2;
//                         upPrice = upPrice2;
//                     }else{
//                          if (type == 1) {
//                             console.log('续签设备6-12个月2');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice1));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice1));
//                           }
//                         downPrice = downPrice1;
//                         upPrice = upPrice1;
//                     }
//                 }
//                 if (Blank_period1 != '无缝续签' && Number(Blank_period1)>365) {
//                     if (downPrice1<upPrice2) {
//                         if (type == 1) {
//                             console.log('续签设备12个月1');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(upPrice2));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice2));
//                         }
//                         downPrice = upPrice2;
//                         upPrice = upPrice2;
//                     }else{
//                         if (type == 1) {
//                             console.log('续签设备12个月2');
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_price')).text(toNumComma(downPrice1));
//                             j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_price')).text(toNumComma(upPrice1));
//                         }
//                         downPrice = downPrice1;
//                         upPrice = upPrice1;
//                     }
//                 }
//             }
//         return downPrice+"/"+upPrice+"/"+isSeamlessRenew;
// }
// 报价规则改善 20230310 end
function changeEstiStartdate(val) {
    // 报价规则改善 20230310 start
       // var startday = addMonths(val,6);
       // var startday1 = addMonths(val,12);
       //  document.getElementById("startdateaddsix1").value = startday;
       //  document.getElementById("startdateaddsix2").value = startday;
       //  document.getElementById("startdateaddsix3").value = startday1;
       //  document.getElementById("startdateaddsix4").value = val;
    // 报价规则改善 20230310 end
    if ('{!SaveBtnDisabled}' == 'false') {
        j$(escapeVfId('allPage:allForm:contractstartdate')).val(val);
        changeContractStartdate(val);
@@ -2618,6 +2957,8 @@
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Department_Name__c.label}</th>
                        
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Management_Code__c.label}</th>
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Asset_Consumption_rate__c.label}</th>
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.CurrentContract_End_Date__c.label}</th>
                        <!-- 市场多年保修价格开发 DC 2023/02/20  start-->
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset__c.fields.IS_VMContract_Asset__c.label}</th>
@@ -2628,7 +2969,10 @@
                        <!-- <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Asset_Consumption_rate__c.label}</th>
 -->
                        <!-- 市场多年保修价格开发 DC 2023/1/30 end -->
                        <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.CurrentContract_End_Date__c.label}</th>
                        <th style="width:70px" class="headerRow  booleanColumn">
                            <!-- 最近一期维修合同结束 -->
                            {!$ObjectType.Asset.fields.CurrentContract_End_Date__c.label}
                        </th>
                        <!-- 实绩联动价格计算 start -->
                        <th style="width:35px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Adjustment_Upper_price__c.label}</th>
                        <th style="width:35px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.Adjustment_Lower_price__c.label}</th>
@@ -2749,9 +3093,14 @@
                                    <apex:outputField value="{!ar.mcae.Asset_Consumption_rate__c}" rendered="{!Not(ar.IsManual)}" id="Contractrate"/>
                                    <apex:inputHidden value="{!ar.rec.CurrentContract_F__r.Contract_Range__c}" id="lastContRange"/>
                                </td>
                                <!-- 2023/03/21  !ar.rec.CurrentContract_F_asset__r.IS_VMContract_Asset__c 为true  保有设备结束时间:true:多年保:保修期至;false.最近一期维修合同结束日 -->
                                <td class="dataCell" width="70px">
                                    <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_End_Date__c}" rendered="{!(Not(ar.IsManual)&& ar.rec.CurrentContract_F__c != null)}" id="End_Date" />
                                    <!-- old: 直接拿保有设备的最近一期维修合同 -->
                                    <!-- <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_End_Date__c}" rendered="{!(Not(ar.IsManual)&& ar.rec.CurrentContract_F__c != null)}" id="End_Date" /> -->
                                    <!-- new: 在获取保有设备信息时直接判断保有设备的字段时间(保修期至/最近一期维修合同结束日) -->
                                    <apex:outputField value="{!ar.rec.CurrentContract_End_Date__c}" rendered="{!(Not(ar.IsManual) && ar.rec.CurrentContract_F__c != null )}" id="End_Date" />
                                </td>
                                 <!-- 实绩联动价格计算 start -->
                                <td class="dataCell" width="35px">
                                    <apex:outputText value="{!ar.mcae.Adjustment_Upper_price__c}" id="Adjustment_Upper_price"/>
@@ -2788,6 +3137,9 @@
                                </td>
                               <!-- (2022年12月上线)故障品加费 start -->
                                <td class="dataCell" width="35px" style="text-align:right" >
                                     <!-- // 报价规则改善 20230308 start -->
                                  <!--   <apex:inputField value="{!ar.mcae.Blank_period__c}" id="Blank_period" style="display:none"/> -->
                                     <!-- // 报价规则改善 20230308 start -->
                                    <apex:outputText value="{!ar.Repair_Price_Auto}" id="Repair_Price_Auto" style="width:95%; "/>
                                    <!-- <apex:inputHiddenalue="{!ar.rec.Reson_Can_not_Warranty__c}" id="ResonCannotWarranty"/> -->
                                    <!-- <apex:outputText value="{!ar.Agreed_Date}" id="Agreed_Date" style="width:95%;display: none;"/> -->
@@ -3038,6 +3390,12 @@
                            <apex:inputField value="{!estimate.Limit_Price_Amount__c}" style="ime-mode: disabled; text-align: right; width:100px" id="Limit_Price_Amount" />
                            <apex:inputHidden value="{!isLimitPrice}" id="Limit_Price2Hidden" />
                            <apex:inputHidden value="{!OldLimitPrice}" id="Limit_PriceHidden" />
                            <!-- // 报价规则改善 20230309 start  -->
                            <!-- <apex:inputHidden value="{!Is_Blank_period}" id="Is_Blank_period" />
                            <apex:inputField value="{!estimate.Maintenance_Contract__r.Past_Contract_end_day__c}" style="display:none"  id="PastContractendday" />
                            <apex:inputHidden value="{!estimate.renewTen_OFF__c}" id="renewTenOFF" />
                            <apex:inputHidden value="{!Cost_rate_ForecastF}" id="Cost_rate_ForecastF" /> -->
                            <!-- // 报价规则改善 20230309 end  -->
                        </td>
                        <!-- 上限合同 20230103 hql end -->
                    </tr>
@@ -3085,6 +3443,71 @@
                        <td style="text-align: center"></td>
                    </tr>
                </table>
                <!-- // 报价规则改善 20230309 start  -->
               <!--  <table style="width:100%">
                    <tr>
                        <th style="text-align: center" colspan="3">请结合实际可以签约的日期,选择恰当的申请金额,以免后续空白期变化导致标准金额变化,再次申请价格延误时间</th>
                        <th style="text-align: center"></th>
                        <th style="text-align: center"></th>
                    </tr>
                    <tr>
                        <th style="text-align: center">本次计划【合同预定开始日】:<input type="text" id="startdateaddsix4" readonly="readonly" style="border: none;width:70px"></input> </th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown5" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp5" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">当【合同预定开始日】在<input type="text" id="startdateaddsix1" readonly="readonly" style="border: none;width:70px"></input> 之前</th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown4" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp4" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">当【合同预定开始日】在<input type="text" id="startdateaddsix2" readonly="readonly" style="border: none;width:70px"></input> 之后</th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown3" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp3" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                    <tr>
                        <th style="text-align: center">当【合同预定开始日】在<input type="text" id="startdateaddsix3" readonly="readonly" style="border: none;width:70px"></input> 之后</th>
                        <th style="text-align: center">标准价格的最低价总额</th>
                        <th style="text-align: center">标准价格的最高价总额</th>
                    </tr>
                    <tr>
                        <td style="text-align: center"></td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceDown2" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                        <td style="text-align: center">
                            CNY<input type="text" id="GuidePriceUp2" readonly="readonly" style="border: none;width:70px"></input>
                        </td>
                    </tr>
                </table> -->
                <!-- // 报价规则改善 20230309 end  -->
            </apex:outputPanel>
        </apex:pageblocksection>