From 61d3da83d22c63d9ae7d434e3fdf023d5915f566 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期四, 11 四月 2024 19:01:09 +0800
Subject: [PATCH] 123

---
 force-app/main/default/classes/lexNewQuoteEntryController.cls |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/lexNewQuoteEntryController.cls b/force-app/main/default/classes/lexNewQuoteEntryController.cls
index 00c5590..ed09745 100644
--- a/force-app/main/default/classes/lexNewQuoteEntryController.cls
+++ b/force-app/main/default/classes/lexNewQuoteEntryController.cls
@@ -71,7 +71,7 @@
                 Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c, Discount_Amount__c, Discount_Amount_Calculate__c, Installation_location__c,
                 QuoteTotal_Page__c, Dealer_Final_Price_Page__c, Quote_Adjust_Amount_Page__c, OCM_Agent1_Price_Page__c, Agent1_Agent2_Price_Page__c
                 , AgencyDiscount__c,OCM_Sales_Forecast__c//棰勬祴閲戦淇敼 fy
-                , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c,
+                , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c,ExtendedWarrantyAmountTotalPrice__c,
                 Preferential_Gurantee_Period__c,LineItemCount 
                  ,IsQuoteTrial__c,OpportunityId,Opportunity.RecordType.DeveloperName
                 FROM Quote Where Id = :quoId];
@@ -183,7 +183,7 @@
              Agency1__c, Agency2__c, Stocking_Price__c, Purchasing_Cost__c, Opportunity_No__c, StageName,
              Agency1__r.Special__c, Agency2__r.Special__c, Account.Parent.Special__c
              , Authorized_DB_No__c, Authorized_Finish_Sales__c, If_Need_Authorize__c
-             , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c
+             , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c,ExtendedWarrantyAmountTotalPrice__c
              , Hospital__c, Department_Class__c
              ,Is_Corrosion__c,
              If_Need_PriceApply__c
@@ -231,12 +231,14 @@
 
   // }
   @AuraEnabled
-  public static Map<String,List<OptionTemplete>> addOptions(List<String> idList){
+  public static Map<String,Object> addOptions(List<String> idList){
     Map<String,Integer> intList = new Map<String,Integer>();
     for(AggregateResult  objAgr: [select ProductName__c,COUNT(Id) total from MultiYearWarranty__c where ProductName__c in:idList group by ProductName__c]){
       intList.put((String)objAgr.get('ProductName__c'), (Integer)objAgr.get('total'));
     }
     Map<String,List<OptionTemplete>> optionMap = new Map<String,List<OptionTemplete>>();
+    Map<String,Object> allMap = new Map<String,Object>();
+    Map<String,List<MultiYearWarranty__c>> priceMap = new Map<String,List<MultiYearWarranty__c>>();
     for(String id: idList){
       List<OptionTemplete> optionTempleteList = new List<OptionTemplete>();
       optionTempleteList.add(new OptionTemplete('0骞�',''));
@@ -249,7 +251,19 @@
         optionMap.put(id,optionTempleteList);
       }
     }
-    return optionMap;
+    allMap.put('optionMap',optionMap);
+    List<MultiYearWarranty__c> muList = [select Id,ProductName__c,MultiOneYearWarrantyPrice__c,AmountWithheld__c,AgeLimit__c from MultiYearWarranty__c where ProductName__c in:idList];
+    for(String id: idList){
+      List<MultiYearWarranty__c> muList1 = new List<MultiYearWarranty__c>();
+      for(MultiYearWarranty__c mu : muList){
+        if(mu.ProductName__c == id){
+          muList1.add(mu);
+        }
+      }
+      priceMap.put(id,muList1);
+    }
+    allMap.put('priceMap',priceMap);
+    return allMap;
   }
   // chenjingwu 20240409 end
   // DB202311242191 銆愭姤浠峰崟銆戞姤浠峰崟鍚堝悓閲戦鏇存柊鍜岀敓鎴愭柊鎶ヤ环鍗曡鍒欑‘璁ゅ拰淇敼 fy start
@@ -1006,7 +1020,11 @@
     if(quo.MultiYearWarrantyTotalPrice__c==null){
       quo.MultiYearWarrantyTotalPrice__c=0;
     }
-    sumContractAmount = AccrualTotal+quo.MultiYearWarrantyTotalPrice__c;
+    if(quo.ExtendedWarrantyAmountTotalPrice__c==null){
+      quo.ExtendedWarrantyAmountTotalPrice__c=0;
+    }
+  
+    sumContractAmount = AccrualTotal+quo.MultiYearWarrantyTotalPrice__c+quo.ExtendedWarrantyAmountTotalPrice__c;
     if(quo.OCM_Agent1_Price_Page__c<=sumContractAmount){
       error = true;
       errorflg = true;
@@ -1175,7 +1193,7 @@
               Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c,
               Preferential_Trading_Price__c, Discount__c, Pricing__c, Unit_Price__c, Offer_Amount__c, TOTAL__c,
               Contract__c, Print_HP_Name__c, Quote_Expiration_Date__c, Quote_Comment__c, OCM_Sales_Forecast__c, Installation_location__c, HasType3Machine__c
-              , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c
+              , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c,ExtendedWarrantyAmountTotalPrice__c
               , Preferential_Gurantee_Period__c
               ,IsQuoteTrial__c 
               From Quote Where Id = :quoId];
@@ -1226,6 +1244,7 @@
       q.Gurantee_Period__c = quo.Gurantee_Period__c;
       q.multiYearWarranty__c = quo.multiYearWarranty__c;
       q.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c;
+      q.ExtendedWarrantyAmountTotalPrice__c = quo.ExtendedWarrantyAmountTotalPrice__c;
       q.quoteSavedDate__c = Date.today();
       q.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c;
       q.Agency2__c = opp.Agency2__c;
@@ -1346,6 +1365,7 @@
         o.Gurantee_Period__c              = quo.Gurantee_Period__c ;
         o.multiYearWarranty__c            = quo.multiYearWarranty__c ;
         o.MultiYearWarrantyTotalPrice__c  = quo.MultiYearWarrantyTotalPrice__c ;
+        o.ExtendedWarrantyAmountTotalPrice__c = quo.ExtendedWarrantyAmountTotalPrice__c;
         o.quoteSavedDate__c = Date.today();
         o.OlyNumberHosts__c = 0;
         List<String> oppIds = New List<String>();
@@ -2910,6 +2930,7 @@
       // chenjingwu sp涓绘満绫诲瀷 20240318 end
       // chenjingwu 3+2澶氬勾淇� 20240401 start
       public String Learning_Community;
+      public Decimal exPrice;
       // public List<Map<String, String>> Learning_CommunityOptions = new List<Map<String, String>>(); 
       public List<OptionTemplete> Learning_CommunityOptions;
       public List<MultiYearWarranty__c> multiYearWarrantyList;
@@ -2943,6 +2964,13 @@
           }
           this.multiYearWarrantyList = [select Id,MultiOneYearWarrantyPrice__c,AmountWithheld__c,AgeLimit__c from MultiYearWarranty__c where ProductName__c =: qli.PricebookEntry.Product2Id];
           Integer period = this.multiYearWarrantyList.size();
+          if(qli.ExtendedWarrantyPeriod__c != null && qli.ExtendedWarrantyPeriod__c != 0){
+            for(MultiYearWarranty__c mu: this.multiYearWarrantyList){
+              if(mu.AgeLimit__c == qli.ExtendedWarrantyPeriod__c){
+                this.exPrice = mu.MultiOneYearWarrantyPrice__c;
+              }
+            }
+          }
           if(period > 0){
             List<OptionTemplete> optionTempleteList = new List<OptionTemplete>();
             optionTempleteList.add(new OptionTemplete('0骞�',''));

--
Gitblit v1.9.1