From 928399eceec50e3d37ea08669a12789a9410a9d2 Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期二, 22 十一月 2022 16:51:16 +0800
Subject: [PATCH] 111

---
 force-app/main/default/pages/SelectAssetEstimateURF.page |  135 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 117 insertions(+), 18 deletions(-)

diff --git a/force-app/main/default/pages/SelectAssetEstimateURF.page b/force-app/main/default/pages/SelectAssetEstimateURF.page
index a3f2dad..c0a193c 100644
--- a/force-app/main/default/pages/SelectAssetEstimateURF.page
+++ b/force-app/main/default/pages/SelectAssetEstimateURF.page
@@ -57,6 +57,16 @@
             return false;  
         }
     }
+    //URF闄愭鍚堝悓2鏈� LY 20220920 start
+    var FirstParagraphEnd = j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked;
+    if(FirstParagraphEnd){
+        if (confirm('鏈绛剧害缁忛攢鍟嗘槸鍏堟瀵硅薄锛岃纭鏄惁鎻愪氦鎶ヤ环锛�')) {
+            return true; 
+        }else{
+            return false;  
+        }
+    }
+    //URF闄愭鍚堝悓2鏈� LY 20220920 end
         return true;
 }
 //add by gwy 2021-01-27 end 鎻愪氦鏃剁殑鎻愮ず妗�
@@ -138,6 +148,9 @@
         var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
         if (target != '鍖婚櫌') {
             j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).attr("disabled", true);
+            //URF闄愭鍚堝悓2鏈� LY 20220920 start
+            j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd')).attr("disabled", true);
+            //URF闄愭鍚堝悓2鏈� LY 20220920 end
         }
     }
     if ('{!DecideBtnDisabled}' == 'false') {
@@ -336,7 +349,12 @@
     }
     if ((val == null || val == "" || val == "0") && uRFSeriesMap.includes('URF-V')){
         alert("鍚堝悓瀵硅薄璁惧涓惈鏈塙RF-V绯诲垪锛屽繀椤婚�夋嫨URF-V鐨勬渶澶уぇ淇鏁�!");
-        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("");
+        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("0");
+        return;
+    }
+    if ((val == "3") && uRFSeriesMap.includes('URF-V')){
+        alert("鍚堝悓瀵硅薄璁惧涓璘RF-V绯诲垪鐩墠涓嶈兘閫夋嫨3娆�!");
+        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("0");
         return;
     }
     if (uRFSeriesMap.includes('URF-V')==false) {
@@ -352,7 +370,8 @@
         uRFSeriesMap.push(uRFSeries);
     }
     if ((val == null || val == "" || val == "0") && uRFSeriesMap.includes('URF-P')){
-        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
+        alert("鍚堝悓瀵硅薄璁惧涓惈鏈塙RF-P绯诲垪锛孶RF-P鐨勬渶澶уぇ淇鏁板繀椤婚�夋嫨!");
+        //j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
     }
     if (uRFSeriesMap.includes('URF-P')==false) {
         alert("鍚堝悓瀵硅薄璁惧涓笉鍚湁URF-P绯诲垪锛孶RF-P鐨勬渶澶уぇ淇鏁板繀椤婚�夋嫨/!");
@@ -878,13 +897,22 @@
 function resetDealer() {
     var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
     var obj = document.getElementById('allPage:allForm:allBlock:contract:dealer');
+    //URF闄愭鍚堝悓2鏈� LY 20220920 start
+    var obj2 = document.getElementById('allPage:allForm:allBlock:contract:FirstParagraphEnd');
+    //URF闄愭鍚堝悓2鏈� LY 20220920 end
     var obj_lkwgt = document.getElementById('allPage:allForm:allBlock:contract:dealer_lkwgt');
     if (target == '鍖婚櫌') {
         obj.style.display = "none";
         obj_lkwgt.style.display = "none";
+        //URF闄愭鍚堝悓2鏈� LY 20220920 start
+        obj2.style.display = "none";
+        //URF闄愭鍚堝悓2鏈� LY 20220920 end
     } else {
         obj.style.display = "block";
         obj_lkwgt.style.display = "block";
+        //URF闄愭鍚堝悓2鏈� LY 20220920 start
+        obj2.style.display = "block";
+        //URF闄愭鍚堝悓2鏈� LY 20220920 end
     }
 }
 
@@ -976,12 +1004,17 @@
         j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("");
         return;
     }
+    if ((valURFP == null || valURFP == "" || valURFP == "0") && uRFSeriesMap.includes('URF-P')){
+        alert("鍚堝悓瀵硅薄璁惧涓惈鏈塙RF-P绯诲垪锛屽繀椤婚�夋嫨URF-P鐨勬渶澶уぇ淇鏁�!");
+        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("0");
+        return;
+    }
     if (uRFSeriesMap.includes('URF-V')==false) {
         j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFVMaxRepairCount')).val("0");
     }
-    if ((valURFP == null || valURFP == "" || valURFP == "0") && uRFSeriesMap.includes('URF-P')){
-        j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
-    }
+    // if ((valURFP == null || valURFP == "" || valURFP == "0") && uRFSeriesMap.includes('URF-P')){
+    //     j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("3");
+    // }
     if (uRFSeriesMap.includes('URF-P')==false) {
         j$(escapeVfId('allPage:allForm:allBlock:contract:estimateURFPMaxRepairCount')).val("0");
     }
@@ -1121,8 +1154,10 @@
 function ComputeLTY() {
     var  urlNameJs = j$(escapeVfId('allPage:allForm:urlName')).val();
     urlNameJs = '{!$Label.ID_of_SelectAssetEstimate}'+urlNameJs ;
-    var w = window.open(encodeURI(urlNameJs),'杩囧幓涓ゅ勾淇悊瀹炵哗','menubar=no,height=720,width=986');
-    w.focus();
+    //URF闄愭鍚堝悓2鏈� LY 20220920 start
+    //var w = window.open(encodeURI(urlNameJs),'杩囧幓涓ゅ勾淇悊瀹炵哗','menubar=no,height=720,width=986');
+    //w.focus();
+    //URF闄愭鍚堝悓2鏈� LY 20220920 end
 }
 function recordNumChangeJs() {
     recordNumChangeAction();
@@ -1252,22 +1287,32 @@
     assetRepairSumPrice = localParseFloat(assetRepairSumPrice);
     // 璁$畻瀹為檯鎶ヤ环鎬婚噾棰�
     var realprice = mainteReal - assetRepairSumPrice;
+    //URF闄愭鍚堝悓2鏈� LY 20221009 start
     // 鏍囧噯浠锋牸鐨勬渶楂樹环鎬婚
     var GuidePriceUp = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceUpHidden')).val());
+    // //鏍囧噯浠锋牸鐨勬渶浣庝环鎬婚
+    var GuidePriceDown = localParseFloat(j$(escapeVfId('allPage:allForm:allBlock:contractInfo:GuidePriceDownHidden')).val());
     GuidePriceUp = localParseFloat(GuidePriceUp);
+    GuidePriceDown = localParseFloat(GuidePriceDown);
     for (var i = 0; i < rowcount; i++) {
         // 鍘讳笂闄愪环鏍�
         var assetListPrice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Upper_priceHidden')).val();
+        // //鍙栦笅闄愪环鏍�
+        var assetLowerPrice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Adjustment_Lower_priceHidden')).val();
         assetListPrice = localParseFloat(assetListPrice);
-        if(GuidePriceUp == 0){
-            j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(0);
+        var Estimate_Cost = 0;
+        if(realprice == GuidePriceUp){
+            Estimate_Cost = assetListPrice;
+            // j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(0);
+        } else if (realprice == GuidePriceDown){
+            Estimate_Cost = assetLowerPrice;
         }else{
-            var Estimate_Cost = (realprice * (assetListPrice / GuidePriceUp)).toFixed(2);
-            j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(Estimate_Cost);
+            Estimate_Cost = (realprice * (assetListPrice / GuidePriceUp)).toFixed(2);
         }
-        
+        j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Estimate_Cost')).val(Estimate_Cost);
     
     }
+    //URF闄愭鍚堝悓2鏈� LY 20221009 end
 }
 
 function getLastContractRate(){
@@ -1285,9 +1330,11 @@
         }
     }
     var allContractRate = '' + 0.00 + '%';
-    if( count > 0){
-        allContractRate = '' + (Contractrate/count).toFixed(2) + '%';
-    }
+    //URF闄愭鍚堝悓2鏈� LY 20220920 start
+    // if( count > 0){
+    //     allContractRate = '' + (Contractrate/count).toFixed(2) + '%';
+    // }
+    //URF闄愭鍚堝悓2鏈� LY 20220920 end
     j$(escapeVfId('allPage:allForm:allBlock:contractInfo:Combinedrate')).text(allContractRate);
     j$(escapeVfId('allPage:allForm:allBlock:contractInfo:CombinedrateHidden')).val(parseFloat(allContractRate));
 
@@ -1312,6 +1359,37 @@
         return 0;
     }
 }
+    //URF闄愭鍚堝悓2鏈� LY 20220920 start
+    //鑾峰彇缁忛攢鍟嗙殑鍏堟鏍囪瘑
+    function onChDealerUpdateJs(oBj){
+        //鑾峰彇 鎶ヤ环鎻愪氦瀵硅薄  鏄惁涓虹粡閿�鍟�
+        var estimateTarget = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget'))[0].value;
+        if(estimateTarget == '缁忛攢鍟�'){
+            //鍒ゆ柇缁忛攢鍟嗗悕鏄惁涓虹┖
+            var dealerValue = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).val();
+            if(dealerValue != ''){
+                //鑾峰彇缁忛攢鍟嗗悕鐨刬d
+                var dealerId = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer_lkid')).val();
+                //鐢变簬salesforce鐨勬煡鎵惧瓧娈垫槸鍙互杈撳叆鐨勶紝鎵�浠ュ垽鏂粬濡傛灉涓虹┖鎴栬�呬负 000000000000000 鐨勬椂鍊欙紝浼犵殑鍙傛暟灏变綅缁忛攢鍟嗕腑鏂囧悕锛屽叾浠栨儏鍐典紶id
+                if(dealerId != '' && dealerId != '000000000000000'){
+                    onChDealerUpdate(dealerId);
+                }else{
+                    onChDealerUpdate(dealerValue);
+                }
+            }else{
+                onChDealerUpdate('');
+                //j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked = false;
+            }
+        }
+    }
+    //濡傛灉閫夋嫨鐨勭粡閿�鍟嗕负鍏堟瀵硅薄锛岄偅涔堝仛涓�涓嬫彁绀�
+    function hintAccount(){
+        var xkChecked = j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked;
+        if(xkChecked){
+            alert('璇锋敞鎰忥紝褰撳墠缁忛攢鍟嗕负鍏堟瀵硅薄銆�');
+        }
+    }
+    //URF闄愭鍚堝悓2鏈� LY 20220920 start
 </script>
 <apex:form id="allForm">
     <apex:inputHidden id="alertStringValue" value="{!alertString}" />
@@ -1331,6 +1409,11 @@
     <apex:actionFunction name="decide" action="{!decide}" rerender="allForm" oncomplete="unblockUI();"/>
     <apex:actionFunction name="decideCancle" action="{!decideCancle}" rerender="allForm" oncomplete="unblockUI();"/>
     <apex:inputHidden id="oldDecideContractDate" value="{!OldContractStartDate}" />
+    <!-- URF闄愭鍚堝悓2鏈� LY 20220920 start -->
+    <apex:actionFunction name="onChDealerUpdate" action="{!onChDealerUpdate}" rerender="contract" onComplete="hintAccount();">
+        <apex:param name="checkDealerId" assignTo="{!checkDealerId}" value="" />
+    </apex:actionFunction>
+    <!-- URF闄愭鍚堝悓2鏈� LY 20220920 end -->
     <input type="hidden" id="oldContractDate" value="{!estimate.Contract_Start_Date__c}" />
 <script type="text/javascript">
 //j$(escapeVfId('allPage:allForm:changedAfterPrint')).val('false');
@@ -1480,13 +1563,19 @@
                 <td width="50%" align="right"> <label class="labelCol vfLabelColTextWrap " style="margin-left:22%">鍒跺畾鏃�</label></td>
                 <td width="50%" align="left"> <apex:outputField label="鍒跺畾鏃�" value="{!estimate.CreatedDate}" id="createDateShow"/> </td>
             </tr>
+            <!-- URF闄愭鍚堝悓2鏈� LY 20220811 start -->
             <tr>
   
                 <td  width="50%" align="right">  
                     <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 缁忛攢鍟嗗悕</label></td>
-                <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" /> </td>
+                <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" onchange="onChDealerUpdateJs(this);return false;" style="float: left;"/> </td>
             </tr>
-            <!-- URF闄愭鍚堝悓2鏈� LY 20220811 start -->
+            
+            <tr>
+                <td  width="50%" align="right">  
+                    <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 鍏堟鏍囪瘑锛堢粡閿�鍟嗭級</label></td>
+                <td width="50%" align="left" > <apex:inputCheckbox value="{!estimate.Is_RecognitionModel__c}" id="FirstParagraphEnd" onClick="return false;" /> </td>
+            </tr>
             <tr>
                 <td width="50%" align="right"> 
                     <label class="labelCol vfLabelColTextWrap " style="margin-left:22%">URF-V鏈�澶уぇ淇鏁�:</label></td>
@@ -1543,6 +1632,7 @@
                         <!-- URF闄愭鍚堝悓2鏈� LY 20220811 start -->
                         <th style="width:35px" class="headerRow  booleanColumn">{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.fields.URF_Series__c.label}
                         </th>
+                        <!-- <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.URF_Maintenance_Contract__c.label}</th> -->
                         <!-- URF闄愭鍚堝悓2鏈� LY 20220811 end -->
                         <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.Asset_situation__c.label}</th>
                         <th style="width:70px" class="headerRow  booleanColumn">{!$ObjectType.Asset.fields.SerialNumber.label}</th>
@@ -1601,6 +1691,12 @@
                                 <td class="dataCell" width="70px" >
                                     <apex:outputText value="{!ar.uFRSerial}" id="uRFSeries"/>
                                 </td>
+                                <!-- <td class="dataCell" width="70px">
+                                    <apex:outputField value="{!ar.rec.URF_Maintenance_Contract__r.Management_Code__c}" rendered="{!Not(ar.IsManual)}" id="URF_Contract_No"/>
+                                </td> -->
+
+                                    <apex:inputHidden value="{!ar.rec.URF_Maintenance_Contract__r.Management_Code__c}" rendered="{!Not(ar.IsManual)}" id="URF_Contract_No"/>
+                                
                                 <!-- URF闄愭鍚堝悓2鏈� LY 20220811 end -->
                                 <td class="dataCell" width="70px">
                                     <apex:outputField value="{!ar.rec.Asset_situation__c}" rendered="{!Not(ar.IsManual)}" />
@@ -1974,7 +2070,10 @@
                             <apex:inputHidden value="{!estimate.Combined_rate__c}" id="CombinedrateHidden" />
                         </td>
                         <td style="text-align: center">
-                            <apex:outputField value="{!estimate.Consumption_rate_Forecast__c}"  />
+                            <!-- URF闄愭鍚堝悓2鏈� LY 20220920 start -->
+                            <!-- <apex:outputField value="{!estimate.Consumption_rate_Forecast__c}"  /> -->
+                            -
+                            <!-- URF闄愭鍚堝悓2鏈� LY 20220920 end -->
                         </td>
                         <td style="text-align: center">
                             <apex:outputField value="{!estimate.Estimate_Price_range__c}"  />

--
Gitblit v1.9.1