From 99b667bdfd8d4fd4d56c2952510169d7f7be794c Mon Sep 17 00:00:00 2001
From: 沙世明 <shashiming@prec-tech.com>
Date: 星期四, 09 三月 2023 17:12:43 +0800
Subject: [PATCH] 产品报价金额自动计算

---
 force-app/main/default/pages/NewQuoteEntry.page               |   13 ++++--
 force-app/main/default/classes/NewQuoteEntryController.cls    |   23 +++++++++++
 force-app/main/default/classes/ControllerUtil.cls             |   11 +++++
 force-app/main/default/classes/SI_NewQuoteEntryController.cls |   15 +++++++
 force-app/main/default/pages/SI_NewQuoteEntry.page            |    6 ++
 5 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/ControllerUtil.cls b/force-app/main/default/classes/ControllerUtil.cls
index a70f2f2..612ae43 100644
--- a/force-app/main/default/classes/ControllerUtil.cls
+++ b/force-app/main/default/classes/ControllerUtil.cls
@@ -5801,6 +5801,17 @@
     }
     // FY23淇敼 WLIG-CFV4AV 閲嶇偣浜у搧缁存姢锛堟柊锛塭nd
 
+    // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start
+    // Json瑙f瀽
+    public static String getValueFromJSONString(String jsonstring, String key) {
+        if (String.isNotBlank(jsonstring)) {
+            Map<String, Object> mapping = (Map<String, Object>) JSON.deserializeUntyped(jsonstring);
+            return mapping.get(key) != null ? String.valueOf(mapping.get(key)) : mapping.get('Default') != null ? String.valueOf(mapping.get('Default')) : null;
+        }
+        return null;
+    }
+    // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end
+
     //20221021  lt SWAG-CHL5XA銆怓Y23璇环鏀瑰杽銆�-缁熻涓绘満鍙版暟 start
     public static void UpdateBiddingFlag(List<String> oppId){
         List<Tender_Opportunity_Link__c> links = [SELECT Id, Tender_information__c, Tender_information__r.IsReactionOpp__c, Opportunity__c 
diff --git a/force-app/main/default/classes/NewQuoteEntryController.cls b/force-app/main/default/classes/NewQuoteEntryController.cls
index 0d9face..356a655 100644
--- a/force-app/main/default/classes/NewQuoteEntryController.cls
+++ b/force-app/main/default/classes/NewQuoteEntryController.cls
@@ -226,6 +226,9 @@
                // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 start
                , If_Account_Change__c 
                // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 end
+               // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start
+               , Salesdepartment_Owner__c 
+               // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end
                FROM Opportunity Where Id = :oppId];
     // 澶氬勾淇濅慨 start
     trade = '澶栬部';
@@ -384,7 +387,7 @@
           // 澶氬勾淇濅慨 end
           //鎶ヤ环璇曠畻 start
             ,IsQuoteTrial__c  
-            //鎶ヤ环璇曠畻 end
+            //鎶ヤ环璇曠畻 end 
           FROM Quote Where Id = :quoId];
       List<QuoteLineItem> items =
         [Select Id, Asset_Model_No__c, SFDA_Status__c, Product_Sales_Possibility__c,
@@ -1196,9 +1199,11 @@
           xlscode = null;
           xlsQuantity = null;
           xlslist = xls.split('\t', -1);
+          system.debug('xlslist+++'+xlslist);
           for (String s : xlslist) {
             //odd number or even number
             if (math.mod(i, 2) != 0) {
+              system.debug('xlslist1+++'+s);
               //odd number
               if (s == '' || s == null) {
                 errorflg = true;
@@ -1212,6 +1217,7 @@
                 Quantitylist.add(xlsQuantity);
               }
             } else {
+              system.debug('xlslist2+++'+s);
               //even number
               if (s == '' || s == null) {
                 errorflg = true;
@@ -1232,6 +1238,7 @@
         }
       }
     } catch (Exception ex) {
+      system.debug('xlslist3+++'+xlscnt);
       activities = tmpactivities;
       errorflg = true;
       errormessage = System.Label.Error_Message31;
@@ -1245,6 +1252,8 @@
     if (codelist.size() == 0 || Quantitylist.size() == 0) {
       activities = tmpactivities;
       errorflg = true;
+      system.debug('codelist+++'+codelist);
+      system.debug('Quantitylist+++'+Quantitylist);
       errormessage = System.Label.Error_Message31;
       pageArrange();
       return null;
@@ -3467,6 +3476,12 @@
     // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 start
     public Boolean is_changed_opp { get; set; }
     // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 end
+    // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start
+    // 鍖婚櫌鍚堝悓閲戦姣斾緥
+    public Decimal rate_hospital { get; set; }
+    // 缁忛攢鍟�1鍚堝悓閲戦姣斾緥
+    public Decimal rate_agency1 { get; set; }
+    // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end
 
     public OppInfo(Opportunity opp) {
       Account_RecordType_DeveloperName = opp.Account.RecordType.DeveloperName;
@@ -3487,6 +3502,12 @@
       // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 start
       is_changed_opp = opp.If_Account_Change__c != null ? opp.If_Account_Change__c : false;
       // lastbuy鍒ゆ柇鍙樻洿鐢ㄦ埛璇环 end
+      // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start
+      String str_rate_hospital = ControllerUtil.getValueFromJSONString(System.Label.Quote_HospitalAmount_Rate, opp.Salesdepartment_Owner__c);
+      String str_rate_agency1 = ControllerUtil.getValueFromJSONString(System.Label.Quote_Agency1Amount_Rate, opp.Salesdepartment_Owner__c);
+      rate_hospital = String.isNotBlank(str_rate_hospital) ? Decimal.valueOf(str_rate_hospital) : 1.0;
+      rate_agency1 = String.isNotBlank(str_rate_agency1) ? Decimal.valueOf(str_rate_agency1) : 1.0;
+      // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end
     }
   }
   //TODO 1.Quote銈儢銈搞偋銈儓杩藉姞
diff --git a/force-app/main/default/classes/SI_NewQuoteEntryController.cls b/force-app/main/default/classes/SI_NewQuoteEntryController.cls
index 9d2c622..9628ec8 100644
--- a/force-app/main/default/classes/SI_NewQuoteEntryController.cls
+++ b/force-app/main/default/classes/SI_NewQuoteEntryController.cls
@@ -221,6 +221,9 @@
                     // SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek start
                     ,Configuration_Suggestion__c , Configuration_Suggestion_Feedback__c
                     // SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek end
+                    // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start
+                    , Salesdepartment_Owner__c 
+                    // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end
                     FROM Opportunity Where Id = :oppId];
         // 澶氬勾淇濅慨 start
         trade = '澶栬部';
@@ -3430,6 +3433,12 @@
         public boolean If_Need_Authorize { get; set; }
         public String Authorized_DB_No { get; set; }
         // LHJ End
+        // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start
+        // 鍖婚櫌鍚堝悓閲戦姣斾緥
+        public Decimal rate_hospital { get; set; }
+        // 缁忛攢鍟�1鍚堝悓閲戦姣斾緥
+        public Decimal rate_agency1 { get; set; }
+        // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end
 
         public OppInfo(Opportunity opp) {
             Account_RecordType_DeveloperName = opp.Account.RecordType.DeveloperName;
@@ -3444,6 +3453,12 @@
             If_Need_Authorize = opp.If_Need_Authorize__c;
             Authorized_DB_No = opp.Authorized_DB_No__c;
             // LHJ End
+            // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start
+            String str_rate_hospital = ControllerUtil.getValueFromJSONString(System.Label.Quote_HospitalAmount_Rate, opp.Salesdepartment_Owner__c);
+            String str_rate_agency1 = ControllerUtil.getValueFromJSONString(System.Label.Quote_Agency1Amount_Rate, opp.Salesdepartment_Owner__c);
+            rate_hospital = String.isNotBlank(str_rate_hospital) ? Decimal.valueOf(str_rate_hospital) : 1.0;
+            rate_agency1 = String.isNotBlank(str_rate_agency1) ? Decimal.valueOf(str_rate_agency1) : 1.0;
+            // DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end
         }
     }
     //TODO 1.Quote銈儢銈搞偋銈儓杩藉姞
diff --git a/force-app/main/default/pages/NewQuoteEntry.page b/force-app/main/default/pages/NewQuoteEntry.page
index eb484ac..559cf10 100644
--- a/force-app/main/default/pages/NewQuoteEntry.page
+++ b/force-app/main/default/pages/NewQuoteEntry.page
@@ -1,6 +1,6 @@
 <!--<apex:page standardController="Quote" extensions="NewQuoteEntryController" sidebar="false" action="{!init}" id="Page">
 -->
-<apex:page controller="NewQuoteEntryController" sidebar="false" action="{!init}" id="Page" >
+<apex:page controller="NewQuoteEntryController" sidebar="false" action="{!init}" id="Page" lightningStylesheets="true" >
     <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
     <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
     <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
@@ -37,7 +37,7 @@
         // }
         //dialog 寮圭獥 end 
         // 娣诲姞琛� html鐗规�у鍔犳粦鍔ㄦ潯 绮剧悽鎶�鏈� wql 2021/02/09 end 
-
+            debugger
         var QuoteEntryMaxLine = {!QuoteEntryMaxLine};
         var trade = '{!oppInfo.Trade}';
         var displayCost = '{!displayCost}';
@@ -258,6 +258,10 @@
             <apex:inputHidden value="{!oppInfo.Authorized_DB_No}" id="Authorized_DB_No" rendered="{!displayFlg}"/>
             <apex:inputHidden value="{!oppInfo.If_Need_Authorize}" id="If_Need_Authorize" rendered="{!displayFlg}"/>
             <!-- LHJ End -->
+            <!-- DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start -->
+            <apex:inputHidden id="rateHospital" value="{!oppInfo.rate_hospital}"/>
+            <apex:inputHidden id="rateAgency1" value="{!oppInfo.rate_agency1}"/>
+            <!-- DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end -->
 
             <apex:outputPanel id="message1">
                 <apex:messages styleClass="editListError"/>
@@ -370,7 +374,7 @@
                     <th style="text-align:right;width:50px;">
                         {!$ObjectType.Quote.fields.MultiYearWarrantyTotalPrice__c.label}
                     :&nbsp;</th>
-                    <td style="width:470px;">
+                    <td style="width:370px;">
                         <apex:outputtext id="MultiYearWarrantyTotalPrice_out" value="{0, number, ###,##0.00}" 
                         style="text-align:right;width:180px;">
                             <apex:param value="{!quo.MultiYearWarrantyTotalPrice__c}"/>
@@ -402,10 +406,11 @@
                     </div>
                     </td>
                      
-                    <th style="text-align:right;width:50px;">
+                    <th style="text-align:right;width:20px;">
                         {!$ObjectType.Quote.fields.multiYearWarranty__c.label}
                     :&nbsp;</th>
                     <td style="width:200px;"><apex:inputField id="multiYearWarranty" value="{!quo.multiYearWarranty__c}" onchange="callFromCancelgurantee_MD();" style="text-align:right;width:30px;" /></td>
+                
                     </apex:variable>
                     <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount 鍚堣  绮剧悽鎶�鏈� wql 2021/01/18 end -->
                 </tr>
diff --git a/force-app/main/default/pages/SI_NewQuoteEntry.page b/force-app/main/default/pages/SI_NewQuoteEntry.page
index 4205ed6..a26c4b2 100644
--- a/force-app/main/default/pages/SI_NewQuoteEntry.page
+++ b/force-app/main/default/pages/SI_NewQuoteEntry.page
@@ -1,4 +1,4 @@
-<apex:page controller="SI_NewQuoteEntryController" sidebar="false" action="{!init}" id="Page">
+<apex:page controller="SI_NewQuoteEntryController" sidebar="false" action="{!init}" id="Page" lightningStylesheets="true">
 <!-- <apex:page standardController="Quote" extensions="SI_NewQuoteEntryController" sidebar="false" action="{!init}" id="Page" > -->
     <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
     <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
@@ -313,6 +313,10 @@
             <apex:inputHidden value="{!oppInfo.Authorized_DB_No}" id="Authorized_DB_No" rendered="{!displayFlg}"/>
             <apex:inputHidden value="{!oppInfo.If_Need_Authorize}" id="If_Need_Authorize" rendered="{!displayFlg}"/>
             <!-- LHJ End -->
+            <!-- DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm start -->
+            <apex:inputHidden id="rateHospital" value="{!oppInfo.rate_hospital}"/>
+            <apex:inputHidden id="rateAgency1" value="{!oppInfo.rate_agency1}"/>
+            <!-- DB202303051651 浜у搧鎶ヤ环閲戦鑷姩璁$畻 ssm end -->
             <apex:outputPanel id="message1">
                 <apex:messages styleClass="editListError"/>
             </apex:outputPanel>

--
Gitblit v1.9.1