From 1949e7ccb3bfab67ad2b16d7e0172851c3f823bb Mon Sep 17 00:00:00 2001
From: 李彤 <litong@prec-tech.com>
Date: 星期六, 02 四月 2022 14:06:49 +0800
Subject: [PATCH] 先款后修上线内容

---
 force-app/main/default/pages/SelectAssetEstimateVM.page |  188 ++++++++++++++++++++++++++++------------------
 1 files changed, 115 insertions(+), 73 deletions(-)

diff --git a/force-app/main/default/pages/SelectAssetEstimateVM.page b/force-app/main/default/pages/SelectAssetEstimateVM.page
index 5dd3e7f..1dbdeeb 100644
--- a/force-app/main/default/pages/SelectAssetEstimateVM.page
+++ b/force-app/main/default/pages/SelectAssetEstimateVM.page
@@ -134,6 +134,7 @@
         var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
         if (target != '鍖婚櫌') {
             j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).attr("disabled", true);
+            j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd')).attr("disabled", true);
         }
     }
     if ('{!DecideBtnDisabled}' == 'false') {
@@ -266,8 +267,16 @@
 
 function checkAll(checker) {
     var cnt = j$(escapeVfId('allPage:allForm:allBlock:assetSection:productCnt')).val();
+
     for (var i = 0; i < cnt; i++) {
-        if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) {
+        //2021-11-30 fy add LJPH-C8W8FV 缃《 start
+        //if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) {
+        //    continue;
+        //}else{
+        //    document.getElementById('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox').checked = checker.checked;
+        //}
+        //2021-11-30 fy add LJPH-C8W8FV 缃《 end
+	 if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) {
             break;
         }
         document.getElementById('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox').checked = checker.checked;
@@ -325,42 +334,8 @@
     refreshAsset(cnt);
 }
 
-function checkContractEstiStartDate(val, cnt) {
-    if (val == null || val == "") {
-        return;
-    }
-    for (var i = 0; i < cnt; i++) {
-        var instaldate = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':InstallDate')).text();
-        if (instaldate != null && instaldate != '') {
-            var listprice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val();
-            var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val();
-            if (isnew == "true") {
-                listprice = listprice / {!isNewPriceAdj};
-            }
-            var startdate = new Date(val);
-            startdate.setMonth(startdate.getMonth() + isNewAddMonth);
-            instaldate = new Date(instaldate);
-            if (startdate < instaldate) {
-                listprice = listprice * {!isNewPriceAdj};
-                //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(listprice));
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val(listprice);
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(listprice);
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNew')).attr('checked',true);
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val('true');
-            } else {
-                //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(listprice));
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val(listprice);
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(listprice);
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNew')).attr('checked',false);
-                j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val('false');
-            }
-        }
-    }
-    
-    refreshAsset(cnt);
-}
-
 function refreshAsset(cnt) {
+    // alert(cnt);
     // 鎻愪氦鍚庡氨椤甸潰涓嶈绠椾簡
     var isDisabled = {!PageDisabled};
     // 鍚堝悓鎬荤悊
@@ -458,7 +433,7 @@
                     }
                     //鏈�鍚庣粨鏉熸棩+1骞�
                     lastendDate.setMonth(lastendDate.getMonth() + 12);
-                    if (Date.parse(contractStartDate) > Date.parse(lastendDate)) {
+                    if (Date.parse(contractStartDate) > Date.parse(lastendDate) ) {
                         oyearCount ++;
                     }
                     // 鍙栬仈鍔ㄤ环鏍�
@@ -544,7 +519,7 @@
             } else {
                 strMoney = month * strMoney + month2 * strMoney;
             }
-            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
+            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 != ''){
                 conCCount ++;
@@ -769,13 +744,16 @@
 function resetDealer() {
     var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val();
     var obj = document.getElementById('allPage:allForm:allBlock:contract:dealer');
+    var obj2 = document.getElementById('allPage:allForm:allBlock:contract:FirstParagraphEnd');
     var obj_lkwgt = document.getElementById('allPage:allForm:allBlock:contract:dealer_lkwgt');
     if (target == '鍖婚櫌') {
         obj.style.display = "none";
+        obj2.style.display = "none";
         obj_lkwgt.style.display = "none";
     } else {
         obj.style.display = "block";
         obj_lkwgt.style.display = "block";
+        obj2.style.display = "block";
     }
 }
 
@@ -1177,7 +1155,86 @@
         alert('鍚堝悓鏈熸渶闀垮彧鑳介�夋嫨60涓湀锛�');
         return 0;
     }
+
 }
+
+    //鑾峰彇缁忛攢鍟嗙殑鍏堟鏍囪瘑
+    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('璇锋敞鎰忥紝褰撳墠缁忛攢鍟嗕负鍏堟瀵硅薄銆�');
+        }
+    }
+
+//LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋  lt  20211221  start
+//鍚堝悓寮�濮嬫棩棰勫畾鏃ラ粯璁や负涓婃湡鍚堝悓1缁撴潫鏃ョ殑绗�2澶�
+// function DefaultStartDate(){
+//     //涓婃湡鍚堝悓1缁撴潫鏃�
+//     var LastContractEndDate;
+//     var LastContractEndDate2;  //鏃ユ湡鏍煎紡
+//     var cnt = j$(escapeVfId('allPage:allForm:allBlock:assetSection:productCnt')).val();
+//     for (var i = 0; i < cnt; i++){
+//         LastContractEndDate = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value();
+//          //鎴栬�呮崲闅愯棌鏍囩Maintenance_Contract__r.Past_Contract_end_day__c
+//         LastContractEndDate2 = LastContractEndDate;
+//         if(LastContractEndDate != null && LastContractEndDate != ''){
+//             break;
+//         }
+//     }
+
+//     if(LastContractEndDate != null && LastContractEndDate != ''){
+//         //涓婃湡鍚堝悓1缁撴潫鏃ョ殑绗�2澶�
+//         LastContractEndDate += " 00:00:00";//璁剧疆涓哄綋澶╁噷鏅�12鐐�
+//         LastContractEndDate = Date.parse(new Date(LastContractEndDate))/1000;//杞崲涓烘椂闂存埑
+//         LastContractEndDate += (86400) * 1;//淇敼鍚庣殑鏃堕棿鎴�
+//         var newDate = new Date(parseInt(LastContractEndDate) * 1000);//杞崲涓烘椂闂�
+//         var LastContractEndDate1 = newDate.getFullYear() + '/' + (newDate.getMonth() + 1) + '/' + newDate.getDate();;
+
+//         //鑾峰彇褰撳墠鏃ユ湡(currentdate)
+//         var date1 = new Date();
+//         var seperator = "/";
+//         var year = date1.getFullYear();
+//         var month = date1.getMonth() + 1;
+//         var day = date1.getDate();
+//         if (month >= 1 && month <= 9) {
+//             month = "0" + month;
+//         }
+//         if (day >= 0 && day <= 9) {
+//             day = "0" + day;
+//         }
+//         var currentdate = year + seperator + month + seperator + day;
+
+//         //涓婃湡鍚堝悓灏氭湭缁撴潫 , 寮�濮嬮瀹氭棩
+//         if(currentdate < LastContractEndDate2){
+//             document.getElementById("allPage:allForm:allBlock:contract:startdate").value = LastContractEndDate1;
+//         }
+//     }
+    
+// }
+//LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋  lt  20211221  end
+
 </script>
 <apex:form id="allForm">
     <apex:inputHidden id="alertStringValue" value="{!alertString}" />
@@ -1197,6 +1254,10 @@
     <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}" />
+    <!-- 缁忛攢鍟嗗彂鐢熷彉鍖栫殑change鏃堕棿 -->
+    <apex:actionFunction name="onChDealerUpdate" action="{!onChDealerUpdate}" rerender="contract" onComplete="hintAccount();">
+        <apex:param name="checkDealerId" assignTo="{!checkDealerId}" value="" />
+    </apex:actionFunction>
     <input type="hidden" id="oldContractDate" value="{!estimate.Contract_Start_Date__c}" />
 <script type="text/javascript">
 //j$(escapeVfId('allPage:allForm:changedAfterPrint')).val('false');
@@ -1311,10 +1372,10 @@
                     </td>
                     <td> </td>
                 </tr>
-
             </table>
             </apex:outputPanel>
         <apex:outputPanel >
+            
         <table align="center" width="100%"  style="border-collapse:separate; border-spacing:0px 10px" >
             <tr>    
                 <td width="50%" align="right"> <label class="labelCol vfLabelColTextWrap " style="margin-left:22%">鍚堝悓璇环缂栫爜</label> </td>
@@ -1350,9 +1411,15 @@
   
                 <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>
+            <!-- update     wangweipeng             2021/12/04         start -->
+                <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>
+            <!-- update     wangweipeng             2021/12/04         end -->
         </table>
         <script type="text/javascript">
             j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).children('option[value=]').remove();
@@ -1513,38 +1580,6 @@
                                     <!-- 20200103 Gzw 璁$畻瀹為檯鎶ヤ环閲戦 end -->
 
                                 </td>
-                                <!-- 瀹炵哗鑱斿姩浠锋牸璁$畻 end -->
-                                
-                                <!-- 闅愯棌鍚堝悓鏈堟暟
-                                <td class="dataCell" width="90px" style="text-align:right" >
-                                    <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_Range__c}" rendered="{!Not(ar.IsManual)}" id="lastContRange" />
-                                </td>-->
-                                
-                                <!-- <td class="dataCell" width="70px">
-                                    <apex:outputField value="{!ar.rec.Asset_Owner__c}" rendered="{!Not(ar.IsManual)}" />
-                                </td>
-                                <td class="dataCell" width="90px" style="text-align:right" >
-                                    <apex:outputField value="{!ar.rec.Accumulation_Repair_Amount__c}" rendered="{!Not(ar.IsManual)}" />
-                                </td> -->
-                                <!--<td class="dataCell" width="90px" style="text-align:right" >-->
-                                    <!-- 闅愯棌鏈嶅姟鍚堝悓浠锋牸
-                                    <apex:outputText value="{!ar.mcae.Estimate_List_Price__c}" id="assetListPrice" style="padding-right:3px;" />
-                                    <apex:outputPanel layout="none" rendered="{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.createable}" >
-                                        <apex:inputHidden value="{!ar.mcae.Estimate_List_Price__c}" id="assetListPriceHidden"/>
-                                        <apex:inputHidden value="{!ar.mcae.Estimate_List_Price_Page__c}" id="assetListPricePageHidden" />
-                                    </apex:outputPanel>
-                                    
-                                    <apex:outputPanel layout="none" rendered="{!Not($ObjectType.Maintenance_Contract_Asset_Estimate__c.createable)}" >
-                                        <input type="hidden" value="{!ar.mcae.Estimate_List_Price__c}" id="allPage:allForm:allBlock:assetSection:assetTable:{!Text(cnt-1)}:assetListPriceHidden"/>
-                                    </apex:outputPanel>-->
-                                <!--</td>-->
-                                <!--<td>
-                                    <apex:outputText value="{!ar.mcae.Maintenance_Price_YearTXT__c}" id="assetListPriceTXT" />
-                                    <apex:inputHidden value="{!ar.mcae.Maintenance_Price_YearTXT__c}" id="assetListPriceTXTHidden" />
-                                </td>-->
-
-
-
                                 <td class="dataCell" width="70px" style="text-align:right" >
                                     <apex:inputField value="{!ar.mcae.Repair_Price__c}" id="repairPrice" style="ime-mode: disabled; width:95%; text-align:right;" onchange="refreshAsset({!productCount});"/>
                                 </td>
@@ -1552,6 +1587,13 @@
                                     <apex:inputField value="{!ar.mcae.Comment__c}" id="comment" style="width:95%;"/>
                                 </td>
                             </tr>
+
+                            <!-- LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋  lt  20211221  start  -->
+                            <!-- <script>
+                                DefaultStartDate();
+                            </script> -->
+                            <!-- LJPH-C9SCX7 銆愬鎵樸�戝悎鍚屾棤绌虹櫧鏈熺殑鎻愰啋  lt  20211221  end  -->
+
                             <apex:variable value="{!cnt + 1}" var="cnt" />
                         </apex:repeat>
 

--
Gitblit v1.9.1