From 35910c355f74e736e2068a0ffb7f39ae9615d8e1 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 24 五月 2024 16:29:00 +0800
Subject: [PATCH] 1

---
 force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js |  181 ++++++++------------------------------------
 1 files changed, 34 insertions(+), 147 deletions(-)

diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js b/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js
index ba822c9..7706a06 100644
--- a/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js
@@ -4,7 +4,6 @@
 export var DataStatus;
 export var newQuoteFlagex;
 export var MultiYearWarrantyTotalPriceExport;
-export var ExtendedWarrantyAmountTotalPriceExport;
 export var newQuoteFlagExp;
 export var productStatusUpdatedExp;
 export var quoExp;
@@ -14,7 +13,6 @@
 export var ListPriceTotalExp; 
 export var unitPriceTotalExp;
 export var errorflg;
-export var errorflgw;
 export var StrExp;
 export var IsQuoteTrialExp;
 export var alertExp = '';
@@ -201,42 +199,10 @@
                 class:{
                     fieldName:'Nameclass'
                 },
-                alignment: 'center'
             },
             hideDefaultActions: true,
             initialWidth: 300
         },
-        // chenjingwu 3+2澶氬勾淇濅慨 20240318 start
-        {
-            label: '寤朵繚閲戦',
-            fieldName: 'exPrice',
-            // editable: true,
-            cellAttributes: {
-                class: {},
-                alignment: 'right',
-            },
-            type: 'number', 
-            typeAttributes: {
-                minimumFractionDigits: '2',
-                maximumFractionDigits: '2'
-            },
-            hideDefaultActions: true,
-            initialWidth: 150
-        },
-        {
-            label: '寤朵繚骞撮檺',
-            fieldName: 'Learning_Community',
-            type: 'picklistColumn',
-            editable: true,
-            typeAttributes: {
-                placeholder:'--鏃�--',
-                options:{fieldName: 'Learning_CommunityOptions'},
-                value: { fieldName: 'Learning_Community' }
-            },
-            hideDefaultActions: true,
-            initialWidth: 300
-        }
-        // chenjingwu 3+2澶氬勾淇濅慨 20240318 end
         
     ],
     sortInterfaces: false,
@@ -607,7 +573,6 @@
     quo.Dealer_Final_Price_Page__c = quoin.Dealer_Final_Price_Page__c!=undefined&&quoin.Dealer_Final_Price_Page__c!=='' ?localParseFloat(quoin.Dealer_Final_Price_Page__c):null;
     quo.OCM_Agent1_Price_Page__c = quoin.OCM_Agent1_Price_Page__c!=undefined &&quoin.OCM_Agent1_Price_Page__c!==''? localParseFloat(quoin.OCM_Agent1_Price_Page__c):null;
     quo.MultiYearWarrantyTotalPrice__c = quoin.MultiYearWarrantyTotalPrice__c!=undefined? localParseFloat(quoin.MultiYearWarrantyTotalPrice__c):null;
-    quo.ExtendedWarrantyAmountTotalPrice__c = quoin.ExtendedWarrantyAmountTotalPrice__c!=undefined? localParseFloat(quoin.ExtendedWarrantyAmountTotalPrice__c):null;
     quo.Estimation_List_Price__c = quoin.Estimation_List_Price__c!=undefined? localParseFloat(quoin.Estimation_List_Price__c):null;
     quo.QuoteTotal_Page__c = quoin.QuoteTotal_Page__c !=undefined?localParseFloat(quoin.QuoteTotal_Page__c):null;
     quo.Agency1_Profit__c = quoin.Agency1_Profit__c !=undefined?localParseFloat(quoin.Agency1_Profit__c):null;
@@ -697,7 +662,6 @@
     maxLineNo += 1; 
     // var newvalueList = [];
     selectvlue.forEach(selectv=>{
-        console.log('123');
         debugger
         alertExp = '';
         // var newvalue = {...{},...selectv};
@@ -774,24 +738,13 @@
     } 
 } 
 function SetProductId(lineno,selectv){
-    console.log(selectv);
-    //fy DB202312538864 2024.02.02 start
-    // var Product2 = {};
-    // var PricebookEntry = {Product2:Product2};
-    // var pageObject = {};
-    // var addobj = {PricebookEntry:PricebookEntry,
-    //                 latestInfo:latestInfo,
-    //                 pageObject:pageObject};
-    // var attributes1 = {type: "PricebookEntry"};
-    // var attributes2 = {type: "Product2"};
-    // var attributes3 = {type: "QuoteLineItem"};
     var Product2 = {};
     var PricebookEntry = {Product2:Product2};
     var latestInfo = {};
-    var pageObject = {PricebookEntry:PricebookEntry,PricebookEntryId:''};
-    var addobj = {latestInfo:latestInfo,
+    var pageObject = {};
+    var addobj = {PricebookEntry:PricebookEntry,
+                    latestInfo:latestInfo,
                     pageObject:pageObject};
-    //fy DB202312538864 2024.02.02 end
     var Asset_Model_No__c = selectv.Product2.Asset_Model_No__c;
     var Product2Id = selectv.Product2Id;
     var SFDA_Status__c = selectv.Product2.SFDA_Status__c
@@ -811,22 +764,13 @@
     var Intra_Trade_Gurantee_USD = selectv.Product2.Intra_Trade_Foreign_RMB__c;
     var Intra_Trade_Service_USD = selectv.Product2.NoDiscount_Foreign__c;
     var Maintenance_Price_Year_USD = selectv.Product2.Repair_Contract_USD__c;
-
-    //fy DB202312538864 2024.02.02 start
-    // addobj.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c;
-    addobj.pageObject.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c;
-    addobj.pageObject.PricebookEntry.Id = PricebookEntryId;
-    addobj.pageObject.PricebookEntry.Product2Id = Product2Id;
-    addobj.pageObject.Asset_Model_No__c = Asset_Model_No__c;
-    addobj.pageObject.PricebookEntry.Product2.LastbuyProductFLG__c = selectv.Product2.LastbuyProductFLG__c;
-    addobj.pageObject.PricebookEntry.Product2.whetherOldCode_PrePro__c = selectv.Product2.whetherOldCode_PrePro__c;
-    //fy DB202312538864 2024.02.02 end
-    // chenijngwu 20240319 start
-    addobj.pageObject.PricebookEntry.Product2.ProductCategory__c = selectv.Product2.ProductCategory__c;
-    if(addobj.pageObject.PricebookEntry.Product2.ProductCategory__c == 'SP涓绘満'){
+    // chenijngwu 20240319 SP涓绘満 start
+    addobj.PricebookEntry.Product2.ProductCategory__c = selectv.Product2.ProductCategory__c;
+    if(addobj.PricebookEntry.Product2.ProductCategory__c == 'SP涓绘満'){
         addobj.SPAssistantFlag = true;
     }
-    // chenijngwu 20240319 end
+    // chenijngwu 20240319 SP涓绘満 end
+    addobj.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c;
     addobj.StorageStatus = StorageStatus__c;
     addobj.lineNo = parseInt(lineno);
     addobj.Asset_Model = Asset_Model_No__c;
@@ -1111,38 +1055,11 @@
     debugger
     console.warn(JSON.stringify(quoteLineItem));
     quoteLineItem.forEach(quotltiem=>{
-        // chenjingwu 3+2 start
-        // quotltiem.Learning_CommunityOptions =  [
-        //     { label: '--鏃�--', value: '' },
-        //     { label: '涓绘満', value: '涓绘満' },
-        //     { label: '闀滃瓙', value: '闀滃瓙' },
-        //     { label: '娲楁秷鏈�', value: '娲楁秷鏈�' },
-        //     { label: '灏忛暅绉�', value: '灏忛暅绉�' },
-        //     { label: '鑳介噺', value: '鑳介噺' },
-        //     { label: '鍏夋簮', value: '鍏夋簮' },
-        //     { label: '鍏朵粬', value: '鍏朵粬' }
-        // ];
-        // chenjingwu 3+2 end
-        //fy DB202312538864 2024.02.02 start
-        if(quotltiem.PricebookEntry === undefined){
-          quotltiem.PricebookEntry = {Product2:{}};
-        }else{
-            if(quotltiem.PricebookEntry.Product2 === undefined){
-                quotltiem.PricebookEntry.Product2 = {};
-            }
-        }
-        if(quotltiem.lastbuyProductFLGc !== undefined && quotltiem.lastbuyProductFLGc !== null){
-            quotltiem.PricebookEntry.Product2.LastbuyProductFLG__c = quotltiem.lastbuyProductFLGc;
-        }
         // chenjingwu 20240411 start
         if(quotltiem.ProductCategory !== undefined && quotltiem.ProductCategory !== null){
-            quotltiem.PricebookEntry.Product2.ProductCategory__c = quotltiem.ProductCategory;
+            quotltiem.pageObject.PricebookEntry.Product2.ProductCategory__c = quotltiem.ProductCategory;
         }
-         // chenjingwu 20240411 end
-        if(quotltiem.whetherOldCode_PreProc !== undefined && quotltiem.whetherOldCode_PreProc !== null){
-            quotltiem.PricebookEntry.Product2.whetherOldCode_PrePro__c = quotltiem.whetherOldCode_PreProc;
-        }
-        //fy DB202312538864 2024.02.02 end
+        // chenjingwu 20240411 end        
         quotltiem.Quantity__c = quotltiem.pageObject.Quantity__c;
         quotltiem.UnitPrice_Page__c = quotltiem.pageObject.UnitPrice_Page__c;
         // quotltiem.UnitPrice_Page__c = toNumComma(quotltiem.UnitPrice_Page__c);
@@ -1277,7 +1194,6 @@
         contractmultiYearWarranty = quo.multiYearWarranty__c;
     }
     var MultiYearWarrantyTotalPrice__c = 0.00;
-    var  ExtendedWarrantyAmountTotalPrice__c = 0.00;
     jzDataToBeproduct.forEach(jzdtbt=>{
         var GuranteeType =jzdtbt.pageObject.GuranteeType__c;
         // 淇濅慨绫诲瀷
@@ -1311,7 +1227,6 @@
             warrantyType = '甯傚満澶氬勾淇濅慨';
             var Quantity =jzdtbt.Quantity__c;
             MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity);
-            // ExtendedWarrantyAmountTotalPrice__c = ExtendedWarrantyAmountTotalPrice__c + localParseFloat(jzdtbt.exPrice) * localParseFloat(Quantity);
             NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity);
         }
         else if (GuranteeType == '甯傚満' && contractmultiYearWarranty && CanNotCancelledGurantee) {
@@ -1322,7 +1237,6 @@
             // 鏁伴噺
             var Quantity = jzdtbt.Quantity__c;
             MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity);
-            // ExtendedWarrantyAmountTotalPrice__c = ExtendedWarrantyAmountTotalPrice__c + localParseFloat(jzdtbt.exPrice) * localParseFloat(Quantity);
             NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity);
         }
         else if (GuranteeType == '甯傚満') {
@@ -1395,7 +1309,6 @@
 
     });
     MultiYearWarrantyTotalPriceExport = MultiYearWarrantyTotalPrice__c;
-    ExtendedWarrantyAmountTotalPriceExport= ExtendedWarrantyAmountTotalPrice__c;
     return jzDataToBeproduct;
 }
 export function initQuoteLineItemcheck(quoteLineItem,productStatusUpdated){
@@ -1531,9 +1444,7 @@
     //no discount price 鍚堣
     var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
     noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
-    var exPriceTotal = quo.ExtendedWarrantyAmountTotalPrice__c;
-    exPriceTotal = localParseFloat(exPriceTotal);
-    TotalPrice = TotalPrice - noDiscountPriceTotal - exPriceTotal;
+    TotalPrice = TotalPrice - noDiscountPriceTotal;
     jzDataToBeproduct.forEach(jzdtbt=>{
         s = jzdtbt.Quantity__c;
         s = localParseInt(s);
@@ -1609,8 +1520,6 @@
     x = localParseFloat(x);
     var y = quo.hidden_Estimation_List;
     y = localParseFloat(y);
-    var z = quo.ExtendedWarrantyAmountTotalPrice__c;
-    z = localParseFloat(z);
     var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
     noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
     var thirdPartyEstimation_List_Price = 0;
@@ -1631,11 +1540,11 @@
         }
     });
     thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price);
-    quo.Quote_Adjust_Amount_Page__c = toNumComma(x - noDiscountPriceTotal - y - z);
+    quo.Quote_Adjust_Amount_Page__c = toNumComma(x - noDiscountPriceTotal - y);
     if (y - thirdPartyEstimation_List_Price == 0) {
         quo.Quote_Adjust_Calculate__c = toNumComma(0);
     } else {
-        quo.Quote_Adjust_Calculate__c = toNumComma((x - noDiscountPriceTotal - y - z) / (y - thirdPartyEstimation_List_Price) * 100);
+        quo.Quote_Adjust_Calculate__c = toNumComma((x - noDiscountPriceTotal - y) / (y - thirdPartyEstimation_List_Price) * 100);
     }
     quoExp = quo;
     return jzDataToBeproduct;
@@ -1675,9 +1584,7 @@
                 //no discount price 鍚堣
                 var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
                 noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
-                var exPriceTotal = quo.ExtendedWarrantyAmountTotalPrice__c;
-                exPriceTotal = localParseFloat(exPriceTotal);
-                var t = (y - noDiscountPriceTotal - exPriceTotal - thirdPartyEstimation_List_Price) / (Estimation_List_Price - thirdPartyEstimation_List_Price) * 100;
+                var t = (y - noDiscountPriceTotal - thirdPartyEstimation_List_Price) / (Estimation_List_Price - thirdPartyEstimation_List_Price) * 100;
                 quo.AgencyDiscount__c = toNumComma(t);
                 // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(t));
             }
@@ -1805,8 +1712,6 @@
     //no discount price 鍚堣
     var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
     noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
-    var exPriceTotal = quo.ExtendedWarrantyAmountTotalPrice__c;
-    exPriceTotal = localParseFloat(exPriceTotal);
     jzDataToBeproduct.forEach(jzdtbt=>{
         s = jzdtbt.Quantity__c;
         s = localParseInt(s);
@@ -1848,7 +1753,7 @@
                 VenderName = '';
             }
             if (VenderName == 'OSH' || VenderName == '') {
-                yy = localParseFloat(x * (z - noDiscountPriceTotal - exPriceTotal) / y);
+                yy = localParseFloat(x * (z - noDiscountPriceTotal) / y);
                 jzdtbt.pageObject.Subtotal__c = toNum(yy + s * noDiscountPrice);
                 // jzdtbt.Subtotal__c = toNumComma(yy + s * noDiscountPrice);
                 jzdtbt.Subtotal__c = yy + s * noDiscountPrice;
@@ -1860,7 +1765,7 @@
             zz = zz + yy;
         }
     });
-    quo.QuoteTotal_Page__c = toNumComma(zz + noDiscountPriceTotal + exPriceTotal);
+    quo.QuoteTotal_Page__c = toNumComma(zz + noDiscountPriceTotal);
     quoExp = quo;
     return jzDataToBeproduct;
 }
@@ -1898,9 +1803,12 @@
     jzDataToBeproduct.forEach(jzdtbt=>{
         // 淇濅慨
         var multiYearWarranty = true;
-        if (jzdtbt.multiYearWarranty__c) {
-            multiYearWarranty = jzdtbt.multiYearWarranty__c;
-        }
+        //fy 3+2椤圭洰鍙戠幇鐨勯棶棰�0425 satrt
+        // if (jzdtbt.multiYearWarranty__c) {
+            if (jzdtbt.multiYearWarranty__c !== undefined) {
+                //fy 3+2椤圭洰鍙戠幇鐨勯棶棰�0425 end
+                    multiYearWarranty = jzdtbt.multiYearWarranty__c;
+                }
         // 淇濅慨绫诲瀷
         var warrantyType = jzdtbt.warrantyType__c;
         // 浜у搧淇濅慨绫诲瀷
@@ -1938,6 +1846,7 @@
 }
 export function PrintCustomerNameoptionsvlue(options_hp,selection_hp,quo,options_hpflg,accs){
     if (JSON.stringify(accs) != "{}" && JSON.stringify(accs) != "[]") {
+        debugger
         if (accs[0].Name) {
             var options_hpvalue = {};
             options_hpvalue.label = accs[0].Name;
@@ -2202,7 +2111,7 @@
     var fag = false;
     data.forEach(item=>{
         var key = Number(item.lineNo);
-        var value = {Quantity__c:'',UnitPrice_Page__c:'',Learning_Community:''}
+        var value = {Quantity__c:'',UnitPrice_Page__c:''}
         if(item.Quantity__c != undefined){
             value.Quantity__c = item.Quantity__c;
             fag = true;
@@ -2210,13 +2119,10 @@
         if(item.UnitPrice_Page__c != undefined){
             value.UnitPrice_Page__c = item.UnitPrice_Page__c;
         }
-        if(item.Learning_Community != undefined){
-            value.Learning_Community = item.Learning_Community;
-        }
         dataMap.set(key,value);
     });
     jzDataToBeproduct.forEach(jzdtbt=>{
-        var x, y, z, c ,e;
+        var x, y, z, c;
         if(dataMap.has(jzdtbt.lineNo)){
             var datavaue = dataMap.get(jzdtbt.lineNo);
             if(datavaue.Quantity__c){
@@ -2226,24 +2132,9 @@
                 // jzdtbt.UnitPrice_Page__c = toNumComma(datavaue.UnitPrice_Page__c);
                 jzdtbt.UnitPrice_Page__c = datavaue.UnitPrice_Page__c;
             }
-            console.log("saf");
-            console.log(jzdtbt);
-            if(datavaue.Learning_Community){
-                jzdtbt.Learning_Community = datavaue.Learning_Community;
-                jzdtbt.multiYearWarrantyList.forEach(item=>{
-                    if('' + (item.AgeLimit__c) == jzdtbt.Learning_Community){
-                        jzdtbt.exPrice = item.MultiOneYearWarrantyPrice__c;
-                    }
-                });
-                if(jzdtbt.exPrice == null || jzdtbt.exPrice == '' || jzdtbt.exPrice == undefined){
-                    jzdtbt.exPrice = 0;
-                }
-            }
-            console.log("saf");
             x = localParseInt(jzdtbt.Quantity__c);
             y = localParseFloat(jzdtbt.UnitPrice_Page__c);
             c = localParseFloat(jzdtbt.Cost_c);
-            e = localParseFloat(jzdtbt.exPrice);
             z = x * y;
             // jzdtbt.Subtotal__c = toNumComma(z)
             jzdtbt.Subtotal__c = z
@@ -2300,10 +2191,6 @@
         errorflg = true;
         alertExp = Setmap.get('errormessage');
     }else{
-        if(Setmap.has('warn')){
-            errorflgw = true;
-            alertExp = Setmap.get('warn');
-        }
         if(Setmap.has('quoId')){
             quoId = Setmap.get('quoId');
         }
@@ -2343,9 +2230,7 @@
         x = localParseFloat(x);
         y = y + localParseFloat(x);
     });
-    var e = quo.ExtendedWarrantyAmountTotalPrice__c;
-    e = localParseFloat(e);
-    quo.QuoteTotal_Page__c = toNumComma(y + e);
+    quo.QuoteTotal_Page__c = toNumComma(y);
     var z = quo.Estimation_List_Price__c;
     var id = quoId;
     // if(!id){
@@ -2355,15 +2240,13 @@
             mp = localParseFloat(mp);
             var num = quo.Quote_Adjust_Calculate__c;
             num = localParseFloat(num);
-            var ex = quo.ExtendedWarrantyAmountTotalPrice__c;
-            ex = localParseFloat(ex);
             quo.Quote_Adjust_Calculate__c = toNumComma(num);
             num = (100 + num) / 100;
             z=localParseFloat(z);
             var rh = oppInfo.rate_hospital;
             var ra = oppInfo.rate_agency1;
             quo.Dealer_Final_Price_Page__c = toNumComma(z*rh);
-            quo.OCM_Agent1_Price_Page__c = Saleslet ? toNumComma(z*num*ra+mp+ex) : '';
+            quo.OCM_Agent1_Price_Page__c = Saleslet ? toNumComma(z*num*ra+mp) : '';
         }
     // }
     quoExp = quo;
@@ -2648,7 +2531,9 @@
 }
 export function  checkch(jzDataToBeproduct){
     var activities = [];
+    // sp涓绘満 cjw start
     var flag = false;
+    // sp涓绘満 cjw start
     jzDataToBeproduct.forEach(jzdtbt=>{
         var lineId = jzdtbt.pageObject.PricebookEntryId;
         if (lineId) {
@@ -2663,25 +2548,27 @@
             //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� start 
             item.IFEndoRapidFlag = jzdtbt.IFEndoRapidFlag;
             //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� end
+            // sp涓绘満 cjw start
             var qwe = jzdtbt.PricebookEntry ? jzdtbt.PricebookEntry.Product2.ProductCategory__c : jzdtbt.pageObject.PricebookEntry.Product2.ProductCategory__c;
             if(qwe == 'SP涓绘満'){
                 item.SPAssistantFlag = true;
                 flag = true;
             }
+            // sp涓绘満 cjw start
             activities.push(item);
         }
     });
+    // sp涓绘満 cjw start
     var maps = new Map();
     maps.set('activities',activities);
     maps.set('flag',flag);
     return maps;
+    // sp涓绘満 cjw end
 }
 export function  Agent1comput(quo,Saleslet,oppInfo){
     var z = quo.Estimation_List_Price__c;
     var mp =quo.MultiYearWarrantyTotalPrice__c;
-    var ex = quo.ExtendedWarrantyAmountTotalPrice__c;
     mp = localParseFloat(mp);
-    ex = localParseFloat(ex);
     var num = quo.Quote_Adjust_Calculate__c;
     num = localParseFloat(num);
     quo.Quote_Adjust_Calculate__c = toNumComma(num);
@@ -2690,6 +2577,6 @@
     var rh = oppInfo.rate_hospital;
     var ra = oppInfo.rate_agency1;
     quo.Dealer_Final_Price_Page__c = toNumComma(z*rh);
-    quo.OCM_Agent1_Price_Page__c = Saleslet ? toNumComma(z*num*ra+mp+ex):'';
+    quo.OCM_Agent1_Price_Page__c = Saleslet ? toNumComma(z*num*ra+mp):'';
     return quo;
 }
\ No newline at end of file

--
Gitblit v1.9.1