From 4488f711dbc01a8db6753907cae2ef4021dede68 Mon Sep 17 00:00:00 2001
From: FUYU <fuyu@prec-tech.com>
Date: 星期三, 13 十二月 2023 16:30:27 +0800
Subject: [PATCH] 修改前备份
---
force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js | 3268 ++++++
force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js | 4128 ++++++-
force-app/main/default/lwc/lexNewQuoteEntry/__tests__/lexNewQuoteEntry.test.js | 25
force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.html | 858 +
force-app/main/default/classes/lexSINewQuoteEntryController.cls | 2645 +++++
force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.css | 42
force-app/main/default/classes/lexNewQuoteEntryControllerTest.cls | 1909 +++
force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js | 2417 ++++
force-app/main/default/lwc/lexSINewQuoteEntry/__tests__/lexSINewQuoteEntry.test.js | 25
force-app/main/default/lwc/lexNewQuoteEntry/lexquoteTrialUtil.js | 3347 ++++++
force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js-meta.xml | 5
force-app/main/default/lwc/lexSINewQuoteEntry/lexSINexQuoteEntryUtil.js | 2581 +++++
force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js-meta.xml | 16
force-app/main/default/classes/lexNewQuoteEntryController.cls | 2455 ++++
force-app/main/default/classes/lexSINewQuoteEntryControllerTest.cls | 1754 +++
force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.css | 81
force-app/main/default/lwc/lexSINewQuoteEntry/lexSIquoteTrialUtil.js | 3353 ++++++
force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.html | 867 +
18 files changed, 28,913 insertions(+), 863 deletions(-)
diff --git a/force-app/main/default/classes/lexNewQuoteEntryController.cls b/force-app/main/default/classes/lexNewQuoteEntryController.cls
new file mode 100644
index 0000000..dc818af
--- /dev/null
+++ b/force-app/main/default/classes/lexNewQuoteEntryController.cls
@@ -0,0 +1,2455 @@
+// Author: Fu,Yu
+// Created Date: 2023/08/07
+// Purpose: get page layout and record data
+// Test Class: lexNewQuoteEntryControllerTest
+public class lexNewQuoteEntryController{
+ public static Integer quoteEntryMaxLine;
+ public static List<QELine> activities;
+ public static List<QELine> tmpactivities;
+ public static List<QuoteLineItem> CheckItem;
+ public static Boolean WinOrDecideAlert;
+ public static Boolean errorflg;
+ public static String errormessage;
+ public static String errormessagewarn;
+ public static Map<Id, Product2> prd2LatestValMap;
+ public static Boolean productStatusUpdated;
+ public static Opportunity opp;
+ public static Quote quo;
+ public static Boolean enableSales;
+ public static String quoId;
+ public static String oppId;
+ public static Boolean newQuoteFlag;
+ public static Boolean changedAfterPrint;
+ public static string quoteGurantee_Period;
+ public static string quotemultiYearWarranty;
+ public static Pricebook2 standardPricebook;
+ public static Boolean detail;
+ public static String selection_hp;
+ public static String quoIdreturn;
+ public static String trade;
+ public static String searchMode;
+ public static Boolean filg;
+ public static Integer flglastbuy;
+ public static String errorProductmodel;
+ public static Boolean SkipQuotefilg;
+ public static Boolean QuoteDecision;
+ //瀛楁鎶ラ敊鏍囪瘑 start
+ public static Boolean dfpp = false;
+ public static Boolean qname = false;
+ public static Boolean qacc = false;
+ public static Boolean qaapc = false;
+ public static Boolean Agency1 = false;
+ public static Boolean nAgency1 = false;
+ public static Boolean oapp = false;
+ public static Boolean noapp = false;
+ public static Boolean Agency2 = false;
+ public static Boolean nAgency2 = false;
+ public static Boolean aapp = false;
+ public static Boolean naapp = false;
+ //瀛楁鎶ラ敊鏍囪瘑 end
+ public static Boolean hongzi = false;
+ @AuraEnabled
+ //鏍规嵁鎶ヤ环Id妫�绱㈡姤浠�
+ public static Quote selectQuoteById(String quoId){
+ Quote quo = new Quote();
+
+ if(String.isNotBlank(quoId)){
+ List<Quote> quoList =
+ [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
+ Dealer_Final_Price__c, TotalPrice__c, Estimation_List_Price__c, QuoteNumber,
+ QuoteToName, Quote_Expiration_Date__c, Quote_Comment__c, Stocking_Price__c, Unit_Price__c,
+ Offer_Amount__c, TOTAL__c, Discount__c, Pricing__c, Preferential_Trading_Price__c, Contract__c,
+ Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Print_HP_Name__c,
+ Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_No__c,
+ 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,
+ Preferential_Gurantee_Period__c,LineItemCount
+ ,IsQuoteTrial__c,OpportunityId,Opportunity.RecordType.DeveloperName
+ FROM Quote Where Id = :quoId];
+ quo = quoList[0];
+ }
+
+ return quo;
+ }
+ //妫�绱㈡姤浠疯椤圭洰琛屾暟
+ @AuraEnabled
+ public static List<Quote> selectQuoteListLineItemCount(String quoId,String oppId,String copyid){
+ List<Quote> quoList = new List<Quote>();
+ if(String.isBlank(oppId)){
+ if(String.isNotBlank(quoId)){
+ quoList = [select Id, OpportunityId, Opportunity.RecordType.DeveloperName,LineItemCount From Quote Where Id = :quoId];
+ }
+ }else{
+ if(String.isBlank(copyid)){
+ quoList =[select Id, OpportunityId,LineItemCount From Quote Where OpportunityId = :oppId];
+ }
+ }
+ return quoList;
+ }
+ //妫�绱㈡姤浠疯椤圭洰
+ @AuraEnabled
+ public static String selectQuoteLineItem(String quoId,String copyid){
+ List<QuoteLineItem> items =
+ [Select Id, Asset_Model_No__c, SFDA_Status__c, Product_Sales_Possibility__c,
+ Name__c, BSS_Category__c, Quote.Quote_Print_Date__c,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c,
+ Qty_Unit__c, Cost__c, UnitPrice__c, ListPrice__c, Quantity, TotalPrice__c,
+ PricebookEntry.Product2.SFDA_Status__c, ProductCode__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name,
+ PricebookEntryId, PricebookEntry.Product2Id, UnitPrice_Page__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.StorageStatus__c
+ , AgencyUnitPrice__c, AgencySubtotal__c, Present__c
+ , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c,
+ ServicePrice__c , GuranteePrice__c, ProductEntend_gurantee_period_all__c,
+ ProductGuranteePrice__c, GuranteeType__c,
+ warrantyType__c, productServicePrice__c, NoDiscountTotal__c
+ , provistonPeriod__c
+ , PricebookEntry.Product2.Entend_gurantee_period_all__c
+ , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c
+ , PricebookEntry.Product2.Intra_Trade_Service_RMB__c
+ , PricebookEntry.Product2.GuranteeType__c
+ , PricebookEntry.Product2.Maintenance_Price_Year__c
+ , Maintenance_Price_Year__c
+ ,PricebookEntry.Product2.Repair_Contract_USD__c
+ ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c
+ ,PricebookEntry.Product2.NoDiscount_Foreign__c
+ ,PricebookEntry.Product2.LastbuyProductFLG__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,PricebookEntry.Product2.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ ,Quote.Opportunity.Trade__c
+ ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c
+ From QuoteLineItem where Quoteid = :quoId Order by Item_Order__c, Id];
+ activities = new List<QELine>();
+ QELine cle = new QELine();
+ Integer i = 0;
+ if (items.size() > 0) {
+ for (QuoteLineItem olt : items) {
+ i++;
+ cle = new QELine(olt,i, copyid);
+ activities.add(cle);
+ }
+ }
+ return JSON.serialize(activities)+'---'+JSON.serialize(items);
+ }
+ //妫�绱㈢櫥褰曚汉淇℃伅
+ @AuraEnabled
+ public static User selecUser(){
+ User usobj =new User();
+ List<User> us = new List<User>();
+ String userid = UserInfo.getUserId();
+ if (userid != null) {
+ us = [Select Quote_Correct__c, Quote_Special_Operation__c, Cost_Referable__c, ViewSpecialAgencyAmout__c From User Where Id = :userid];
+ if (us.size() > 0) {
+ usobj = us[0];
+ }
+ }
+ return usobj;
+ }
+ @AuraEnabled
+ public static Boolean getquoDes() {
+ Schema.DescribeSObjectResult quoteDesc = Quote.SObjectType.getDescribe();
+ return quoteDesc.isUpdateable();
+ }
+ @AuraEnabled
+ public static Boolean QuotCalfagAss(){
+ String ProfileId= UserInfo.getProfileId().subString(0,15);
+ String QuotationCalculationPermission = System.Label.QuotationCalculationPermission;
+ return QuotationCalculationPermission.contains(ProfileId);
+ }
+ //鏍规嵁璇环Id妫�绱㈣浠�
+ @AuraEnabled
+ public static Opportunity selectOpportunityById(String oppId){
+ Opportunity opp = new Opportunity();
+ List<Opportunity> oppList =[SELECT Account.Name, Account.RecordType.DeveloperName,
+ CLBIC_Category__c, HP_Name__c, Name, CurrencyIsoCode, Wholesale_Price__c, Department_Name__c,
+ Direct_Separate__c, Trade__c, AccountId, New_Opportunity__c, Estimation_Decision__c, SAP_Send_OK__c, Sales_Root__c,
+ 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
+ , Hospital__c, Department_Class__c
+ ,Is_Corrosion__c,
+ If_Need_PriceApply__c
+ ,CelonOpportunity__c
+ , If_Account_Change__c
+ , Salesdepartment_Owner__c
+ ,Opportunity_Category__c
+ FROM Opportunity Where Id = :oppId];
+ if (oppList.size() > 0) {
+ opp = oppList[0];
+ }
+ return opp;
+ }
+ //妫�绱㈣浠疯椤圭洰
+ // @AuraEnabled
+ // public static String selectOpportunityLineItem(String oppId){
+ // List<OpportunityLineItem> items = New List<OpportunityLineItem>();
+ // items = [Select Id, Asset_Model_No__c, SFDA_Status__c, Name__c, ProductCode__c, PricebookEntry.Product2.StorageStatus__c,
+ // Qty_Unit__c, Cost__c, UnitPrice, ListPrice__c, Quantity, BSS_Category__c, TotalPrice,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c,
+ // PricebookEntry.Product2.SFDA_Status__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name,
+ // PricebookEntryId, PricebookEntry.Product2Id, Opportunity.Trade__c, PricebookEntry.Product2.Intra_Trade_List_RMB__c, PricebookEntry.Product2.Intra_Trade_Cost_RMB__c,
+ // PricebookEntry.Product2.Foreign_Trade_List_US__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.Foreign_Trade_Cost_US__c, UnitPrice__c, TotalPrice__c
+ // , AgencyUnitPrice__c, AgencySubtotal__c, Present__c
+ // , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c,
+ // ServicePrice__c , GuranteePrice__c,
+ // ProductEntend_gurantee_period_all__c,
+ // ProductGuranteePrice__c, GuranteeType__c,
+ // warrantyType__c, productServicePrice__c,
+ // NoDiscountTotal__c
+ // , provistonPeriod__c
+ // , PricebookEntry.Product2.Entend_gurantee_period_all__c
+ // , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c
+ // , PricebookEntry.Product2.Intra_Trade_Service_RMB__c
+ // , PricebookEntry.Product2.GuranteeType__c
+ // , PricebookEntry.Product2.Maintenance_Price_Year__c
+ // , Maintenance_Price_Year__c
+ // ,PricebookEntry.Product2.Repair_Contract_USD__c
+ // ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c
+ // ,PricebookEntry.Product2.NoDiscount_Foreign__c
+ // ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c
+ // From OpportunityLineItem
+ // Where OpportunityId = :oppId Order by Item_Order__c, Id];
+
+ // activities = new List<QELine>();
+ // QELine cle = new QELine();
+ // if (items.size() > 0) {
+ // for(OpportunityLineItem otlt : items) {
+ // cle = new QELine(otlt);
+ // activities.add(cle);
+ // }
+ // }
+ // return JSON.serialize(activities);
+ // }
+ //妫�绱㈠鎴�
+ @AuraEnabled
+ public static List<Account> selectAccountById(String accountid){
+ List<Account> accs2 = [Select Id, RecordType.DeveloperName, Hospital__c, Agent_Ref__c From Account Where Id = :accountid];
+ List<Account> accs = new List<Account>();
+ if (accs2.size() > 0) {
+ if (accs2[0].RecordType.DeveloperName != 'AgencyContract') {
+ accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Hospital__c];
+ } else {
+ accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Agent_Ref__c];
+ }
+ }
+ return accs;
+ }
+ //妫�绱笅鎷夊垪琛ㄥ��
+ @AuraEnabled
+ public static List<Map<String,String>> getPicklistValues(String objstr, String fld ,Boolean ifempty){
+ List<Map<String,String>> options = new List<Map<String,String>>();
+ Map<String,String> space = new Map<String,String>();
+ if(ifempty){
+ space.put('label', '--鏃�--');
+ space.put('value', '');
+ options.add(space);
+ }
+
+ Schema.sObjectType objType = Schema.getGlobalDescribe().get(objstr);
+ Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
+ map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
+ list<Schema.PicklistEntry> values = fieldMap.get(fld).getDescribe().getPickListValues();
+ system.debug(objstr + '=' + values);
+ for (Schema.PicklistEntry a : values)
+ {
+ if (!a.isActive()) continue;
+ Map<String,String> ses = new Map<String,String>();
+ ses.put('label', a.getLabel());
+ ses.put('value', a.getValue());
+ options.add(ses);
+ }
+ return options;
+ }
+ //淇濆瓨鎶ヤ环
+ @AuraEnabled
+ public static Map<String,String> SaveQuote(String activitiesCan,
+ String CheckItemCan ,
+ boolean WinOrDecideAlertc,
+ boolean productStatusUpdatedc,
+ String oppInfoc,
+ boolean enableSalesc,
+ String quoc,
+ String oppIdc,
+ String quoIdc,
+ boolean newQuoteFlagc,
+ Boolean changedAfterPrintc,
+ String quoteGurantee_Periodc,
+ String quotemultiYearWarrantyc,
+ String selection_hpc,
+ Boolean SkipQuotefilgc,
+ Boolean quoteflg){
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ oppId = oppIdc;
+ quoId = quoIdc;
+ System.debug('quoId+'+quoId);
+ System.debug('quoteflg+'+quoteflg);
+ System.debug('quoc:' + quoc);
+ WinOrDecideAlert = WinOrDecideAlertc;
+ productStatusUpdated = productStatusUpdatedc;
+ newQuoteFlag = newQuoteFlagc;
+ changedAfterPrint = changedAfterPrintc;
+ quoteGurantee_Period = quoteGurantee_Periodc;
+ quotemultiYearWarranty = quotemultiYearWarrantyc;
+ selection_hp = selection_hpc;
+ SkipQuotefilg = SkipQuotefilgc;
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ if(String.isNotBlank(CheckItemCan)){
+ CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class);
+ }else {
+ CheckItem = null;
+ }
+ enableSales = enableSalesc;
+ // errorMessagechack = null;
+ setOppFromOppInfo();
+ Savepoint sp = Database.setSavepoint();
+ Map<String,String> result = new Map<String,String>();
+ try {
+ //chenjingwu DB202308355043 2023.8.25 start
+ if(quoteflg){
+ if(checkVirtual('鍖呭惈铏氭嫙浜у搧锛屾棤娉曟姤浠疯绠�')){
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ if (!dataCheck()) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ return result;
+ }
+ if (dataEntry() == false) {
+ result.put('errormessage', errormessage);
+ return result;
+ } else {
+ result.put('success', System.Label.Message_002);
+ if(String.isBlank(quoId)){
+ result.put('quoId',quoIdreturn);
+ }
+ if(String.isNotBlank(quo.Quote_No__c)){
+ result.put('QuoteNo',quo.Quote_No__c);
+ }
+ if(errormessagewarn != null){
+ result.put('warn', errormessagewarn);
+ String act = JSON.serialize(activities);
+ result.put('act', act);
+ }
+ return result;
+ }
+ } catch (DmlException de) {
+ Database.rollback(sp);
+ // errormessage = de.getLineNumber()+'琛�'+de.getDmlMessage(0);
+ errormessage = de.getDmlMessage(0);
+ result.put('errormessage', errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, de.getMessage());
+ // system.debug(Logginglevel.ERROR, de.getStackTraceString());
+ } catch (Exception e) {
+ Database.rollback(sp);
+ // errormessage = e.getLineNumber()+'琛�'+e.getMessage();
+ errormessage = e.getMessage();
+ result.put('errormessage',errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, e.getMessage());
+ // system.debug(Logginglevel.ERROR, e.getStackTraceString());
+ }
+ }
+ public static Map<String,String> resultFlag(Map<String,String> result){
+ if(dfpp){
+ result.put('dfpp', 'dfpp');
+ }
+ if(qname){
+ result.put('qname', 'qname');
+ }
+ if(qacc){
+ result.put('qacc', 'qacc');
+ }
+ if(qaapc){
+ result.put('qaapc', 'qaapc');
+ }
+ if(Agency1){
+ result.put('Agency1', 'Agency1');
+ }
+ if(nAgency1){
+ result.put('nAgency1', 'nAgency1');
+ }
+ if(oapp){
+ result.put('oapp', 'oapp');
+ }
+ if(noapp){
+ result.put('noapp', 'noapp');
+ }
+ if(Agency2){
+ result.put('Agency2', 'Agency2');
+ }
+ if(nAgency2){
+ result.put('nAgency2', 'nAgency2');
+ }
+ if(aapp){
+ result.put('aapp', 'aapp');
+ }
+ if(naapp){
+ result.put('naapp', 'naapp');
+ }
+ return result;
+ }
+ //鎵撳嵃鎸夐挳淇濆瓨鎶ヤ环
+ @AuraEnabled
+ public static Map<String,String> Print(String activitiesCan,
+ String CheckItemCan ,
+ boolean WinOrDecideAlertc,
+ boolean productStatusUpdatedc,
+ String oppInfoc,
+ boolean enableSalesc,
+ String quoc,
+ String oppIdc,
+ String quoIdc,
+ boolean newQuoteFlagc,
+ Boolean changedAfterPrintc,
+ String quoteGurantee_Periodc,
+ String quotemultiYearWarrantyc,
+ String selection_hpc,
+ Boolean SkipQuotefilgc,
+ Boolean QuoteDecisionc) {
+ oppId = oppIdc;
+ quoId = quoIdc;
+ System.debug('quoId+'+quoId);
+ WinOrDecideAlert = WinOrDecideAlertc;
+ productStatusUpdated = productStatusUpdatedc;
+ newQuoteFlag = newQuoteFlagc;
+ changedAfterPrint = changedAfterPrintc;
+ quoteGurantee_Period = quoteGurantee_Periodc;
+ quotemultiYearWarranty = quotemultiYearWarrantyc;
+ selection_hp = selection_hpc;
+ SkipQuotefilg = SkipQuotefilgc;
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ if(String.isNotBlank(CheckItemCan)){
+ CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class);
+ }else {
+ CheckItem = null;
+ }
+ enableSales = enableSalesc;
+ QuoteDecision = QuoteDecisionc;
+ Savepoint sp = Database.setSavepoint();
+ Map<String,String> result = new Map<String,String>();
+ try {
+ if(checkVirtual('鍖呭惈铏氭嫙浜у搧锛屾棤娉曟墦鍗�')){
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ setOppFromOppInfo();
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ //Decide鍓峯r寰�
+ if (QuoteDecision == true) {
+ //NoSave
+ } else {
+ if (dataCheck() == false ) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ return result;
+ }
+
+ if (dataEntry() == false) {
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ }
+ List<Opportunity> opps = new List<Opportunity>();
+ if (String.isBlank(oppId)) {
+ } else {
+ opps = [Select Id
+ From Opportunity Where Id = : oppId];
+ if (opps.size() > 0) {
+ List<Quote> quos = New List<Quote>();
+ //ligthing bug 淇敼 fy start
+ // if (String.isBlank(quoId)) {
+ // } else {
+ // quos = [Select Id,
+ // Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoId];
+ if(String.isNotBlank(quoId)||(String.isBlank(quoId) && String.isNotBlank(quoIdreturn))){
+ String quoIds = String.isNotBlank(quoId) ? quoId : quoIdreturn;
+ quos = [Select Id,
+ Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoIds];
+ //ligthing bug 淇敼 fy end
+ if (quos.size() > 0) {
+ //浼樻儬鎴愪氦浠�
+ quos[0].Preferential_Trading_Price__c = quo.Preferential_Trading_Price__c;
+ //浼樻儬鎶樻墸
+ quos[0].Discount__c = quo.Discount__c;
+ //浼樻儬浠锋牸
+ quos[0].Pricing__c = quo.Pricing__c;
+ //鍗曚环
+ quos[0].Unit_Price__c = quo.Unit_Price__c;
+ //鎶ヤ环閲戦
+ quos[0].Offer_Amount__c = quo.Offer_Amount__c;
+ //Total
+ quos[0].TOTAL__c = quo.TOTAL__c;
+ //濂戠磩鍐呭
+ quos[0].Contract__c = quo.Contract__c;
+ //澶氬勾淇濅慨 start
+ quos[0].Preferential_Gurantee_Period__c = quo.Preferential_Gurantee_Period__c;
+ //澶氬勾淇濅慨 end
+ if (quos[0].Quote_Date__c == null) {
+ quos[0].Quote_Date__c = date.Today();
+ opps[0].Estimation_Proposal_Date__c = date.Today();
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update opps[0];
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+ quos[0].Quote_Print_Date__c = date.Today();
+ ControllerUtil.updQuote(quos[0]);
+ }
+ }
+ }
+ }
+ // pageArrange();
+ result.put('success', System.Label.Message_002);
+ if(String.isBlank(quoId)){
+ result.put('quoId',quoIdreturn);
+ }
+ if(errormessagewarn != null){
+ result.put('warn', errormessagewarn);
+ }
+ return result;
+ } catch (DmlException de) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = de.getDmlMessage(0);
+ result.put('errormessage', errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, de.getMessage());
+ // system.debug(Logginglevel.ERROR, de.getStackTraceString());
+ } catch (Exception e) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = e.getMessage();
+ result.put('errormessage', errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, e.getMessage());
+ // system.debug(Logginglevel.ERROR, e.getStackTraceString());
+ }
+ }
+ // opp銇敾闈€伄鍊ゃ倰瑷畾
+ public static void setOppFromOppInfo() {
+ opp.Agency1__c = quo.Agency1__c;
+ opp.Agency2__c = quo.Agency2__c;
+ }
+ //淇濆瓨chaeck
+ public static Boolean dataCheck() {
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ Boolean error = false;
+ Boolean error1 = false;
+ integer Gcnt = 0;
+ if (activities == null || activities.size() <= 0) {
+ errorflg = true;
+ errorMessage = '涓嶅厑璁镐繚瀛樼┖鐨勬姤浠峰崟锛岃閫夋嫨浜у搧';
+ return false;
+ }
+ if (WinOrDecideAlert && (!productStatusUpdated)) {
+ errorflg = true;
+ errorMessage = '浜у搧鐘舵�佸彂鐢熷彉鍖栵紝璇锋洿鏂�';
+ return false;
+ }
+ if (!checkSFDAStatus1(false)) {
+ errorflg = true;
+ errormessage = '璇锋洿鏂颁笉鍙攢鍞殑浜у搧銆�';
+ return false;
+ }
+ List<String> product2Ids = new List<String>();
+ if (activities.size() > 0) {
+ for (QELine a : activities) {
+ if (!String.isBlank(a.pageObject.Id__c)) {
+ product2Ids.add(a.pageObject.Id__c);
+ }
+ }
+ Map<String, String> loopMap = new Map<String, String>();
+ if (CheckItem != null) {
+ Gcnt = CheckItem.size();
+ if (CheckItem.size() > 0) {
+ for (QuoteLineItem qli : CheckItem) {
+ loopMap.put(qli.PricebookEntry.Product2Id, qli.SFDA_Status__c);
+ }
+ }
+ }
+ prd2LatestValMap = new Map<Id, Product2>();
+ integer cntPrd2 = 0;
+ for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c,LastbuyProductFLG__c
+ From Product2 Where Id IN :product2Ids]) {
+ cntPrd2 = cntPrd2 + 1;
+ if (prd2.Estimation_Entry_Possibility__c != '鈼�') {
+ error1 = true;
+ }
+ if (prd2.Estimation_Entry_Possibility__c == 'M') {
+ error1 = false;
+ }
+ if (prd2.SFDA_Status__c != loopMap.get(prd2.Id)) {
+ WinOrDecideAlert = true;
+ }
+
+ prd2LatestValMap.put(prd2.Id, prd2);
+ }
+ if (cntPrd2 != Gcnt) {
+ WinOrDecideAlert = false;
+ }
+
+ }
+ if(ContractAmountLimitJudge()){
+ return false;
+ }
+ if (error1 == true && WinOrDecideAlert == false) {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Error_Message37;
+ return false;
+ }
+
+ if (checkAgentsDeleteFlag() == false) {
+ return false;
+ }
+ if (enableSales == true && opp.Trade__c == '鍐呰部') {
+ Map<Id, String> proMap = new Map<Id, String>();
+ if (activities.size() > 0) {
+ for (QELine qli : activities) {
+ if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ proMap.put(qli.pageObject.Id__c, qli.pageObject.Name__c);
+ }
+ }
+ }
+ Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, '');
+ if (chkMap.size() > 0) {
+ errorflg = true;
+ if (chkMap.containsKey('agency')&&!opp.Is_Corrosion__c) {
+ errorflg = true;
+ errormessage = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��';
+ // return false;
+ }
+ Integer inerr = 0;
+ if (activities.size() > 0) {
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ s.haveno_Register = false;
+ s.wrong_Register = false;
+ if (chkMap.containsKey(s.pageObject.Id__c)) {
+ if (chkMap.get(s.pageObject.Id__c) == '1') {
+ s.haveno_Register = true;
+ inerr ++;
+ } else if (chkMap.get(s.pageObject.Id__c) == '2') {
+ s.wrong_Register = true;
+ inerr ++;
+ }
+ }
+ }
+ }
+ }
+ if (inerr > 0) {
+ errorflg = true;
+ errormessagewarn = '璇锋鏌ョ孩瀛楀唴瀹癸紙NMPA鐘舵�佺孩瀛楋紝涓嶅彲閿�鍞骇鍝侊紱浜у搧鍚嶇О绾㈠瓧锛岃秴杩囩粡閿�鍟嗙粡钀ヨ寖鍥达級銆�';
+ // errorMessagechack = '璇锋鏌ョ孩瀛楀唴瀹癸紙NMPA鐘舵�佺孩瀛楋紝涓嶅彲閿�鍞骇鍝侊紱浜у搧鍚嶇О绾㈠瓧锛岃秴杩囩粡閿�鍟嗙粡钀ヨ寖鍥达級銆�';
+ }
+ }
+ Boolean isDangerError = false;
+ Boolean isNotDangerError = false;
+ if (activities.size() > 0) {
+ for (QELine qli : activities) {
+ if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ if (opp.Is_Corrosion__c) {
+ if(!qli.Is_DangerousChemicals){
+ isNotDangerError =true;
+ qli.wrong_Register = true;
+ }
+ }else{
+ if(qli.Is_DangerousChemicals){
+ isDangerError =true;
+ qli.wrong_Register = true;
+ }
+ }
+ }
+ }
+ }
+ if (opp.Is_Corrosion__c) {
+ String str = OpportunityWebService.checkDangerItem(opp.agency1__c);
+ if (str != 'OK') {
+ errorflg = true;
+ errorMessage = str;
+ return false;
+ }
+ if(isNotDangerError){
+ errorflg = true;
+ errormessage = '褰撻樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佸繀椤诲叏閫夋嫨鍗卞寲鍝併��';
+ return false;
+ }
+ }else{
+ if(isDangerError){
+ errorflg = true;
+ errormessage = '褰撹浠蜂笉鏄樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佷笉鑳介�夋嫨鍗卞寲鍝併��';
+ return false;
+ }
+ }
+ }
+ detail = false;
+ if ((quo.QuoteName__c == null) || (quo.QuoteName__c == '')) {
+ // quo.QuoteName__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.QuoteName__c.label;
+ error = true;
+ qname = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.Quote_Adjust_Calculate__c == null) {
+ // quo.Quote_Adjust_Calculate__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Calculate__c.label;
+ error = true;
+ qacc = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.Quote_Adjust_Amount_Page__c == null) {
+ // quo.Quote_Adjust_Amount__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Amount__c.label;
+ error = true;
+ qaapc = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.Quote_Expiration_Date__c == null) {
+ // quo.Quote_Expiration_Date__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Quote_Expiration_Date__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ //decimal temSalesAmount1 = 0; // 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗皬璁″悎璁� end
+ system.debug('activities++++----****2'+activities);
+ for (QELine a : activities) {
+ if ((a.Asset_Model != null) && (a.Asset_Model != '')) {
+ if (a.pageObject.Quantity__c == null || a.pageObject.Quantity__c == 0) {
+ // a.pageObject.Quantity__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.QuoteLineItem.fields.Quantity__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (a.pageObject.UnitPrice_Page__c == null) {
+ // a.pageObject.UnitPrice__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.QuoteLineItem.fields.UnitPrice__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (a.pageObject.AgencyUnitPrice__c == null) {
+ // a.pageObject.AgencyUnitPrice__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.QuoteLineItem.fields.AgencyUnitPrice__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (a.pageObject.PricebookEntryId == null) {
+ error = true;
+ errormessage = System.Label.Error_Message27;
+ }
+ detail = true;
+ }
+ }
+ if (enableSales == true) {
+ // LHJ Start
+ system.debug('errormessage==='+errormessage);
+ if (quo.Agency1__c == null) {
+ // quo.Agency1__c.addError(System.Label.Error_Message3);
+ Agency1 = true;
+ String label = Schema.SObjectType.Quote.fields.Agency1__c.label;
+ error = true;
+ if(String.isNotBlank(errormessage)){
+ errormessage +='\n'+ label+':'+System.Label.Error_Message3;
+ }else {
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ }
+ system.debug('errormessage==='+errormessage);
+ // LHJ End
+ if (quo.OCM_Agent1_Price_Page__c == null) {
+ // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3);
+ oapp = true;
+ String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label;
+ error = true;
+ errormessage =label+':'+System.Label.Error_Message3;
+ } else {
+
+ }
+ } else {
+
+ if (opp.Agency1__c != null) {
+ // opp.Agency1__c.addError(System.Label.Error_Message30);
+ String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label;
+ error = true;
+ nAgency1 = true;
+ if(String.isNotBlank(errormessage)){
+ errormessage +='\n'+ label+':'+System.Label.Error_Message30;
+ }else {
+ errormessage = label+':'+System.Label.Error_Message30;
+ }
+ }
+ system.debug('errormessage==='+errormessage);
+ if (quo.OCM_Agent1_Price_Page__c != null) {
+ // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message30);
+ noapp = true;
+ String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label;
+ error = true;
+ errormessage =label+':'+System.Label.Error_Message30;
+ }
+ if (opp.Agency2__c != null) {
+ // opp.Agency2__c.addError(System.Label.Error_Message30);
+ nAgency2 = true;
+ String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message30;
+ }
+ if (quo.Agent1_Agent2_Price_Page__c != null) {
+ // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message30);
+ naapp = true;
+ String label = Schema.SObjectType.Quote.fields.Agent1_Agent2_Price__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message30;
+ }
+
+ }
+ if (quo.Agency1_Profit_Rate__c >= 1000 || quo.Agency1_Profit_Rate__c <= -1000) {
+ error = true;
+ errormessage = System.Label.Error_Message38;
+ }
+ if (quo.Agency2_Profit_Rate__c >= 1000 || quo.Agency2_Profit_Rate__c <= -1000) {
+ error = true;
+ errormessage = System.Label.Error_Message38;
+ }
+ if (error == true) {
+ errorflg = true;
+ return false;
+ }
+ // PageArrange();
+ errorflg = false;
+ errorMessage = null;
+ return true;
+ }
+ // 浜у搧鐘舵�佸垽鏂�
+ public static boolean checkSFDAStatus1(boolean dodecide) {
+ for (QELine a : activities) {
+ if ((a.Asset_Model != null) && (a.Asset_Model != '')) {
+ if (a.pageObject.SFDA_Status__c != '鏈夊姽' &&
+ a.pageObject.SFDA_Status__c != '鏈夊姽锛堝啀鐢宠珛涓級' &&
+ a.pageObject.SFDA_Status__c != '涓嶈' &&
+ a.pageObject.SFDA_Status__c != '澶卞姽锛堟湡闄愬唴鐢熺敚娓堝湪搴蹇滐級' &&
+ // LHJ CBPR 20181221 Start
+ (a.pageObject.SFDA_Status__c != '鏆傚仠鍑哄簱锛堥暱鏈燂級') &&
+ (a.pageObject.SFDA_Status__c != '鏆傚仠鍑哄簱锛堢煭鏈燂級') &&
+ // LHJ CBPR 20181221 End
+ (a.pageObject.SFDA_Status__c != '澶卞姽锛堝啀鐢宠珛涓級' || dodecide != false)
+ ) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ //鎶ヤ环鍚堝悓閲戦澧炲姞闄愬埗
+ public static boolean ContractAmountLimitJudge(){
+ if(opp.Sales_Root__c =='OCM鐩存帴閿�鍞�'){
+ return false;
+ }
+ Boolean error = false;
+ Double AccrualTotal=0;
+ Double sumContractAmount =0;
+ for(QELine aaa :activities){
+ // 2022-06-14 绱ф�ヤ慨澶� ssm
+ if (String.isBlank(aaa.Asset_Model)) {
+ continue;
+ }
+ if(aaa.pageObject.PricebookEntry.Product2Id!=null){
+ if(aaa.GuranteePrice==null){
+ aaa.GuranteePrice=0;
+ }
+ AccrualTotal += aaa.pageObject.Quantity__c*aaa.GuranteePrice;
+ }
+ }
+ if(quo.MultiYearWarrantyTotalPrice__c==null){
+ quo.MultiYearWarrantyTotalPrice__c=0;
+ }
+ sumContractAmount = AccrualTotal+quo.MultiYearWarrantyTotalPrice__c;
+ if(quo.OCM_Agent1_Price_Page__c<=sumContractAmount){
+ error = true;
+ errorflg = true;
+ errormessage = '棰勬祴閲戦涓鸿礋鏁帮紝璇锋纭~鍐欏悎鍚岄噾棰濄��';
+ }
+ if(quo.multiYearWarranty__c){
+ if(quo.OCM_Agent1_Price_Page__c<=0){
+ error = true;
+ errorflg = true;
+ errormessage = '棰勬祴閲戦涓鸿礋鏁帮紝璇锋纭~鍐欏悎鍚岄噾棰濄��';
+ }
+ }
+ return error;
+ }
+ //
+ public static Boolean checkAgentsDeleteFlag() {
+ // Check Agents
+ List<Id> accIds = new List<Id>();
+ if (opp.Agency1__c != null) {
+ accIds.add(opp.Agency1__c);
+ }
+ if (opp.Agency2__c != null) {
+ accIds.add(opp.Agency2__c);
+ }
+ if (accIds.size() > 0) {
+ List<Account> agentAccs = [SELECT Id, Delete_Flag__c, Is_Active_Formula__c, Sales_Shop_Class__c FROM Account WHERE Id IN :accIds];
+ String activeFormula1 = null, activeFormula2 = null;
+ for (Account local : agentAccs) {
+ if (local.Sales_Shop_Class__c == '鍖荤枟淇悊缁忛攢鍟�') {
+ // PageArrange();
+ errorflg = true;
+ if (local.Id == opp.Agency1__c) {
+ errorMessage = '璇风‘璁ょ涓�缁忛攢鍟嗙殑缁忛攢鍟嗚祫璐�';
+ return false;
+ }
+ }
+ if (local.Id == opp.Agency1__c) {
+ activeFormula1 = local.Is_Active_Formula__c;
+ }
+ }
+ for (Account local : agentAccs) {
+ if (local.Id == opp.Agency2__c) {
+ activeFormula2 = local.Is_Active_Formula__c;
+ }
+ }
+ if (activeFormula1 == '鏃犳晥' && activeFormula2 == '鏃犳晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Agent1_and_Agent2_were_Deleted;
+ return false;
+ } else if (activeFormula1 == '鏃犳晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Agent1_was_Deleted;
+ return false;
+ } else if (activeFormula2 == '鏃犳晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Agent2_was_Deleted;
+ return false;
+ }
+ }
+ // 鍐呰部銇牬鍚圕heck Agency1
+ if (opp.Agency1__c != null && opp.Trade__c == '鍐呰部') {
+ Account acc = [select Sales_Shop_Class__c, Business_Authorization_No__c, Business_Paper_Expiration_Date__c,
+ Tax_Practice_No__c, Tax_Practice_Expiration_Date__c, Medical_Equipment_Num__c, Is_Active_Formula__c,
+ Medical_Equipment_Expiration_Date__c from Account where Id = :opp.Agency1__c];
+ //缁忛攢鍟嗗垎绫诲彧鏈夌壒绾︺�佷竴绾ф垨鑰呴泦涓噰璐墠鍙互杩涜鎶ヤ环
+ List<String> salesClazz = new List<String> {'鐗圭磩璨╁2搴楋紙鍖哄煙锛�', '鐗圭磩璨╁2搴楋紙瑁藉搧锛�', '鐗圭磩璨╁2搴楋紙瑁藉搧+鍖哄煙锛�', '涓�绱氳博澹插簵', '闆嗛噰缁忛攢鍟�'};
+ // 鏈夋晥/鏃犳晥锛堝叕寮忥級!= 鏈夋晥
+ if (acc.Is_Active_Formula__c != '鏈夋晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = '璇烽�夋嫨鏈夋晥鐨勭粡閿�鍟�';
+ return false;
+ }
+ else if(!salesClazz.contains(acc.Sales_Shop_Class__c)){
+ // PageArrange();
+ errorflg = true;
+ errorMessage = '缁忛攢鍟�1鐨勭粡閿�鍟嗗垎绫讳负锛氱壒绾︼紝涓�绾э紝闆嗕腑閲囪喘鎵嶅彲浠ユ姤浠�';
+ return false;
+ }else if (!(String.isBlank(acc.Tax_Practice_No__c) == false
+ && (acc.Tax_Practice_Expiration_Date__c == null || acc.Tax_Practice_Expiration_Date__c >= Date.today())
+
+ && String.isBlank(acc.Business_Authorization_No__c) == false
+ && acc.Business_Paper_Expiration_Date__c != null && acc.Business_Paper_Expiration_Date__c >= Date.today())
+ ) {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = '璇风‘璁ょ涓�缁忛攢鍟嗙殑缁忛攢鍟嗚祫璐�';
+ return false;
+ }else {}
+ }
+ return true;
+ }
+ //淇濆瓨閫昏緫
+ public static boolean dataEntry() {
+ system.debug('activities++++----****3'+activities);
+ Boolean ifdecide=checkIsDecide();
+ standardPricebook = ControllerUtil.getStandardPricebook();
+ if(!ifdecide){
+
+ List<Quote> maxQuote_No = [select Quote_No__c From Quote Where OpportunityId = :oppid and (not Quote_No__c like '%Old') order by Quote_No_last2__c desc NULLS LAST limit 1];
+ String oppNo;
+ Integer l = 1;
+ if (maxQuote_No.size() > 0) {
+ try {
+ oppNo = maxQuote_No[0].Quote_No__c;
+ l = Integer.valueOf(oppNo.substring(oppNo.length() - 2)) + 1;
+ } catch (System.TypeException e) {
+ system.debug('maxQuote_No Error: quote.id=' + maxQuote_No[0].id);
+ }
+ } else {
+ system.debug('first Quote');
+ }
+ oppNo = '00' + String.valueof(l);
+ oppNo = oppNo.substring(oppNo.length() - 2);
+
+ Quote q = New Quote();
+ if (changedAfterPrint) {
+ system.debug('id绌�1锛�');
+ quoId = null;
+ SkipQuotefilg = true;
+ }
+ // CHAN-AVG3PW 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
+ if (newQuoteFlag) {
+ system.debug('id绌�3锛�');
+ quoId = null;
+ SkipQuotefilg = true;
+ }
+ System.debug('quoteGurantee_Period: ' + quoteGurantee_Period);
+ System.debug('quo.Gurantee_Period__c: ' + quo.Gurantee_Period__c);
+ System.debug('quotemultiYearWarranty: ' + quotemultiYearWarranty);
+ System.debug('quo.multiYearWarranty__c: ' + quo.multiYearWarranty__c);
+ if ((quoteGurantee_Period != null &&
+ !quoteGurantee_Period.equals(quo.Gurantee_Period__c))
+ ||
+ (quotemultiYearWarranty != null &&
+ !quotemultiYearWarranty.equals('' + quo.multiYearWarranty__c))
+ ) {
+ system.debug('id绌�5锛�');
+ quoId = null;
+ SkipQuotefilg = true;
+ }
+ if (String.isBlank(quoId)) {
+ q = New Quote();
+ q.OpportunityId = oppId;
+ if (detail == true) {
+ if (standardPricebook == null) {
+ errormessage = System.Label.Error_Message27;
+ errorflg = true;
+ return false;
+ } else {
+ q.Pricebook2Id = standardPricebook.Id;
+ }
+ }
+ } else {
+ List<Quote> qs = New List<Quote>();
+ qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
+ Stocking_Price__c, Discount_Amount__c, Discount_Amount_Calculate__c, Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c,
+ Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Quote_No__c,
+ 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
+ , Preferential_Gurantee_Period__c
+ ,IsQuoteTrial__c
+ From Quote Where Id = :quoId];
+ if (qs.size() > 0) {
+ q = qs[0];
+ }
+ if (q.Pricebook2Id == null) {
+ if (detail == true) {
+ if (standardPricebook == null) {
+ errormessage = System.Label.Error_Message27;
+ errorflg = true;
+ return false;
+ } else {
+ q.Pricebook2Id = standardPricebook.Id;
+ }
+ }
+ }
+ }
+ if (String.isBlank(quoId)) {
+ q.Quote_No__c = opp.Opportunity_No__c + '-' + oppNo;
+ q.PriceRefreshDate__c = Date.today();
+ }
+ if (productStatusUpdated) {
+ q.PriceRefreshDate__c = Date.today();
+ }
+ List<String> pIds = new List<String>();
+ system.debug('activities++++----****1'+activities);
+ for (QELine s : activities) {
+ if (String.isBlank(s.pageObject.Id__c) == false) {
+ pIds.add(s.pageObject.Id__c);
+ }
+ }
+ List<Product2> pList = [select Id from Product2 where Id in :pids and Category3__c = '涓绘満'];
+ if (pList.size() > 0) q.HasType3Machine__c = true;
+ q.Name = quo.QuoteName__c;
+ q.Estimation_List_Price__c = quo.Estimation_List_Price__c;
+ q.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c;
+ q.OCM_Sales_Forecast__c = quo.OCM_Sales_Forecast__c;//棰勬祴閲戦淇敼 fy
+ q.Stocking_Price__c = quo.Stocking_Price__c;
+ q.Quote_Adjust_Amount__c = quo.Quote_Adjust_Amount_Page__c;
+ q.Quote_Adjust_Calculate__c = quo.Quote_Adjust_Calculate__c;
+ q.Discount_Amount__c = quo.Discount_Amount__c;
+ q.Discount_Amount_Calculate__c = quo.Discount_Amount_Calculate__c;
+ q.Agency1__c = opp.Agency1__c;
+ q.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c;
+ q.Agency1_Profit__c = quo.Agency1_Profit__c;
+ q.AgencyDiscount__c = quo.AgencyDiscount__c;
+ q.Gurantee_Period__c = quo.Gurantee_Period__c;
+ q.multiYearWarranty__c = quo.multiYearWarranty__c;
+ q.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c;
+ q.quoteSavedDate__c = Date.today();
+ q.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c;
+ q.Agency2__c = opp.Agency2__c;
+ q.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c;
+ q.Agency2_Profit__c = quo.Agency2_Profit__c;
+ q.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c;
+ q.Print_HP_Name__c = selection_hp;
+ q.Quote_Expiration_Date__c = quo.Quote_Expiration_Date__c;
+ q.Quote_Comment__c = quo.Quote_Comment__c;
+ q.Installation_location__c = quo.Installation_location__c;
+ q.QuotationChange__c = quo.QuotationChange__c;
+ q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c;
+ q.Interdepartmental__c = quo.Interdepartmental__c;
+ if(!quo.IsQuoteTrial__c){
+ q.IsQuoteTrial__c = quo.IsQuoteTrial__c;
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ List<Id> idList = new List<Id>();
+ for (QELine s : activities) {
+ if (String.isNotBlank(s.pageObject.PricebookEntryId)) {
+ idList.add(s.pageObject.PricebookEntryId);
+ }
+ }
+ List<PricebookEntry> pb = [select Id from PricebookEntry where Product2.Category5__c = '铏氭嫙' and Id in: idList];
+ q.Have_Virtual__c = false;
+ if(pb.size() > 0){
+ q.Have_Virtual__c = true;
+ }
+ //chenjingwu DB202308355043 2023.8.25 end
+ if (String.isBlank(quoId)) {
+ insert q;
+ quo.Quote_No__c = q.Quote_No__c;
+ // quo.IsQuoteTrial__c = q.IsQuoteTrial__c;
+ // isQuoteTrialOnInit = q.IsQuoteTrial__c;
+ } else {
+ update q;
+ }
+ List<QuoteLineItem> qlist = New List<QuoteLineItem>();
+ qlist = [Select Id From QuoteLineItem Where QuoteId = :quoId];
+ if (qlist.size() > 0) {
+ delete qlist;
+ }
+ qlist = New List<QuoteLineItem>();
+ List<String> product_lines = new List<String>();
+ Boolean Is_Eng2_Opp = false;
+ Integer i = 1;
+ if (activities.size() > 0) {
+ system.debug('activities++++----****'+activities);
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ if (s.pageObject.PricebookEntryId != null) {
+ QuoteLineItem ql = s.pageObject.clone();
+ ql.Quantity = ql.Quantity__c;
+ ql.UnitPrice = 0;
+ ql.QuoteId = q.Id;
+ ql.Name__c = s.pageObject.Name__c;
+ ql.Cost__c = s.Cost_c;
+ ql.Cost_Subtotal__c = s.Cost_Subtotal_c;
+ // s.pageObject.Cost__c = s.Cost_c;
+ // s.pageObject.Cost_Subtotal__c = s.Cost_Subtotal_c;
+ ql.UnitPrice__c = ql.UnitPrice_Page__c;
+ ql.UnitPrice_Page__c = 0;
+ ql.ListPrice__c = s.ListPrice_Page;
+ ql.GuranteePrice__c = s.GuranteePrice;
+ ql.ProductGuranteePrice__c = s.ProductGuranteePrice;
+ ql.Maintenance_Price_Year__c = s.Maintenance_Price_Year;
+ ql.CanNotCancelFlag__c = s.CanNotCancelledGurantee;
+ ql.Item_Order__c = i;//棰勬祴閲戦淇敼 fy
+ if (s.pageObject.Subtotal__c != null && quo.OCM_Agent1_Price_Page__c != null && quo.QuoteTotal_Page__c != null) {
+ if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//棰勬祴閲戦淇敼 fy
+ ql.OCM_Sales_Forecast__c = quo.OCM_Agent1_Price_Page__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c);
+ }
+ }
+ qlist.add(ql);
+ product_lines.add(s.pageObject.PricebookEntryId);
+ i++;
+ }
+ }
+ }
+ system.debug('qlist+++---+++'+qlist);
+ insert qlist;
+ }
+ system.debug('鈼嬧棆鈼嬧棆鈼婼ave2鈼嬧棆鈼嬧棆鈼�');
+ List<PricebookEntry> entrys = product_lines!= null && product_lines.size() > 0 ? [select Id from PricebookEntry where Id in :product_lines and Product2.ENG_New__c = 'ENG2'] : null;
+ Is_Eng2_Opp = entrys != null && entrys.size() > 0 ? true : false;
+ Opportunity o = New Opportunity();
+ List<Opportunity> os = New List<Opportunity>();
+ os = [select Id, Estimation_List_Price__c, Dealer_Final_Price__c, Estimation_List_Price_Without_Tax__c,
+ Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Stocking_Price__c,
+ Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_Update_Sum__c , Hospital__c,Is_Corrosion__c
+ ,StageName ,OlyNumberHosts__c
+ From Opportunity Where Id = :oppid];
+ if (os.size() > 0) {
+ o = os[0];
+ o.Estimation_List_Price__c = quo.Estimation_List_Price__c;
+ o.Wholesale_Price__c = q.OCM_Sales_Forecast__c;//棰勬祴閲戦淇敼 fy
+ o.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c;
+ o.Agency1__c = opp.Agency1__c;
+ o.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c;
+ o.Agency1_Profit__c = quo.Agency1_Profit__c;
+ o.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c;
+ o.Agency2__c = opp.Agency2__c;
+ o.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c;
+ o.Agency2_Profit__c = quo.Agency2_Profit__c;
+ o.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c;
+ o.Stocking_Price__c = quo.Stocking_Price__c;
+ o.Estimation_No__c = q.Quote_No__c;
+ o.Estimation_Name__c = q.Name;
+ o.Estimation_Id__c = q.Id;
+ o.Installation_location__c = q.Installation_location__c;
+ o.HasType3Machine__c = q.HasType3Machine__c;
+ o.AgencyDiscount__c = quo.AgencyDiscount__c;
+ o.Gurantee_Period__c = quo.Gurantee_Period__c ;
+ o.multiYearWarranty__c = quo.multiYearWarranty__c ;
+ o.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c ;
+ o.quoteSavedDate__c = Date.today();
+ o.OlyNumberHosts__c = 0;
+ List<String> oppIds = New List<String>();
+ List<String> product2Ids = New List<String>();
+ Map<String,Decimal> product2IdsMap = new Map<String,Decimal>();
+ if (activities.size() > 0) {
+ for (QELine a : activities) {
+ if(String.isBlank(a.pageObject.Id__c) == false) {
+ product2Ids.add(a.pageObject.Id__c);
+ product2IdsMap.put(a.pageObject.Id__c,a.pageObject.Quantity__c);
+ }
+ }
+ for (Product2 prod : [Select Id,ProductClass__c From Product2 Where Id IN :product2Ids]) {
+ if(o.StageName == '寮曞悎' || o.StageName == '娉ㄦ畫' || o.StageName == '鍑鸿嵎' || o.StageName == '瀹屼簡'){
+ if(prod.ProductClass__c == '涓绘満'){
+ if(product2IdsMap.containsKey(prod.Id)){
+ o.OlyNumberHosts__c += product2IdsMap.get(prod.Id);
+ oppIds.add(o.Id);
+ ControllerUtil.UpdateBiddingFlag(oppIds);
+ }
+ }else{
+ o.OlyNumberHosts__c += 0;
+ }
+ }
+ }
+ }
+ if (o.Quote_Update_Sum__c == null) {
+ o.Quote_Update_Sum__c = 1;
+ } else {
+ o.Quote_Update_Sum__c = o.Quote_Update_Sum__c + 1;
+ }
+ o.ENG2_Opp__c = Is_Eng2_Opp;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update o;
+
+
+ //OpportunityLineItem--------------------------------------------
+ List<OpportunityLineItem> ols = New List<OpportunityLineItem>();
+ OpportunityLineItem ol = New OpportunityLineItem();
+ ols = [select Id, Quantity from OpportunityLineItem Where OpportunityId = :oppid];
+ if (ols.size() > 0) {
+ ControllerUtil.delOppLine(ols);
+ }
+ i = 1;
+ ols = New List<OpportunityLineItem>();
+ if (activities.size() > 0) {
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ if (s.pageObject.PricebookEntryId != null) {
+ ol = New OpportunityLineItem();
+ ol.OpportunityId = oppid;
+ ol.Id__c = s.pageObject.Id__c;
+ ol.SFDA_Status__c = s.pageObject.SFDA_Status__c;
+ ol.Name__c = s.pageObject.Name__c;
+ ol.ListPrice__c = s.ListPrice_Page;
+ ol.Quantity = s.pageObject.Quantity__c;
+ ol.UnitPrice = 0;
+ ol.UnitPrice__c = s.pageObject.UnitPrice_Page__c;
+ ol.AgencyUnitPrice__c = s.pageObject.AgencyUnitPrice__c;
+ ol.Present__c = s.pageObject.Present__c;
+ ol.AgencySubtotal__c = s.pageObject.AgencySubtotal__c;
+ ol.GuaranteePeriod__c = s.pageObject.GuaranteePeriod__c;
+ if (opp.CurrencyIsoCode != null ) {
+ ol.multiYearWarranty__c = s.pageObject.multiYearWarranty__c;
+ ol.ServicePrice__c = s.pageObject.ServicePrice__c;
+ ol.If_Cancel_Guarantee__c = s.pageObject.If_Cancel_Guarantee__c;
+ ol.ProductEntend_gurantee_period_all__c
+ = s.pageObject.ProductEntend_gurantee_period_all__c;
+ ol.GuranteeType__c = s.pageObject.GuranteeType__c;
+ ol.NoDiscountTotal__c = s.pageObject.NoDiscountTotal__c;
+ ol.warrantyType__c = s.pageObject.warrantyType__c;
+ ol.productServicePrice__c = s.pageObject.productServicePrice__c;
+ ol.GuranteePrice__c = s.GuranteePrice;
+ ol.ProductGuranteePrice__c = s.ProductGuranteePrice;
+ ol.Maintenance_Price_Year__c = s.Maintenance_Price_Year;
+ ol.provistonPeriod__c = s.pageObject.provistonPeriod__c;
+ }
+ ol.Qty_Unit__c = s.pageObject.Qty_Unit__c;
+ ol.Cost__c = s.pageObject.Cost__c;
+ ol.BSS_Category__c = s.pageObject.BSS_Category__c;
+ ol.CanNotCancelFlag__c = s.CanNotCancelledGurantee;//棰勬祴閲戦淇敼 fy
+ if (s.pageObject.Subtotal__c != null && o.Wholesale_Price__c != null && quo.QuoteTotal_Page__c != null) {
+ if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//棰勬祴閲戦淇敼 fy
+ ol.OCM_Sales_Forecast__c = o.Wholesale_Price__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c);
+ }
+ }
+ ol.PricebookEntryId = s.pageObject.PricebookEntryId;
+ ol.Item_Order__c = i;
+ ols.add(ol);
+ i++;
+ }
+ }
+ }
+ ControllerUtil.insOppLine(ols);
+ }
+
+ } else {
+ system.debug('*****SystemError OpportunityId is Null*****');
+ }
+ if (String.isBlank(quoId)) {
+ quoIdreturn = q.Id;
+ // newQuoteFlag = false;
+ }
+ }else{
+ errorflg = true;
+ errormessage = '璇ヨ浠峰凡缁廳ecide锛屼笉鍙啀淇敼';
+ return false;
+ }
+ return true;
+ }
+ //闃叉澶氬紑椤甸潰鍔犻獙璇佹煡璇�
+ private static boolean checkIsDecide() {
+ List<Opportunity> oppsde = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId];
+ if (oppsde.size() > 0) {
+ if(oppsde[0].Estimation_Decision__c){
+ return true;
+ }
+ }
+ return false;
+ }
+ //妫�绱㈡柊寤烘姤浠蜂骇鍝�
+ @AuraEnabled
+ public static List<PricebookEntry> serContact(String tradec,String SearchName,String celon){
+ trade = tradec;
+ String x = '脳';
+ String searchSql = 'select Id,Product2Id,Product2.Name,Product2.ProductCode,Product2.StorageStatus__c,Product2.OT_CODE_no_link__c, Product2.Alternative_Products__c, '
+ + 'Product2.Foreign_Trade_Cost_US__c, Product2.Foreign_Trade_List_US__c, Product2.Intra_Trade_Cost_RMB__c, Product2.Intra_Trade_List_RMB__c, '
+ + 'Product2.Asset_Model_No__c, Product2.Serial_Lot_No__c, Product2.Sales_Possibility__c, Product2.Estimation_Entry_Possibility__c, '
+ + 'Product2.SFDA_Status__c, Product2.Qty_Unit__c, Product2.BSSCategory__c, Product2.Asset_loaner_category__c, Product2.Packing_list_manual__c '
+ + ' ,Product2.Extend_new_product_gurantee_MD__c , Product2.Extend_new_product_gurantee__c , Product2.Entend_gurantee_period_all__c , '
+ + ' Product2.Intra_Trade_Gurantee_RMB__c '
+ + ',Product2.Intra_Trade_Foreign_RMB__c,Product2.NoDiscount_Foreign__c,Product2.Repair_Contract_USD__c '
+ + ' , Product2.Intra_Trade_Service_RMB__c,Product2.CanNotCancelledGurantee__c,Product2.Is_DangerousChemicals__c '
+ + ' , Product2.GuranteeType__c , product2.VenderName__c , product2.Maintenance_Price_Year__c '
+ + ' , Product2.suitDepartment__c '
+ //chenjingwu DB202308355043 2023.8.25 start
+ + ' , Product2.Category5__c '
+ //chenjingwu DB202308355043 2023.8.25 end
+ + ' , Product2.Estimated_ConsumptionDueDate__c '
+ + 'FROM PricebookEntry ';
+ String whereStr = 'Where Product2.Asset_Model_No__c != null And Product2.Manual_Entry__c = false And Product2.Estimation_Entry_Possibility__c !=' + '\'' + x + '\' '
+ + 'AND CurrencyIsoCode =' + '\'' + String.escapeSingleQuotes(trade) + '\' '
+ + 'AND IsActive = true ';
+ String whereSql = '';
+ if (searchMode == 'CS') {
+ whereSql += 'and Product2.Asset_loaner_category__c = \'涓鸿�楁潗绠$悊\' ';
+ }
+ if (SearchName != null && SearchName != '') {
+ String likename = String.escapeSingleQuotes(SearchName);
+ String prdcd = String.escapeSingleQuotes(SearchName);
+ if (likename.indexOf('*') >= 0) {
+ likename = likename.replace('*', '%');
+ } else {
+ likename = '%' + likename + '%';
+ }
+ whereSql += 'and (Product2.Name Like ' + '\'' + likename + '\' or Product2.ProductCode = ' + '\'' + prdcd + '\' or Product2.Asset_Model_No__c Like ' + '\'' + likename + '\') ';
+ }
+ celon = String.isNotBlank(celon) ? celon : null;
+ whereSql += ' and Product2.Celon_Product__c = :celon ';
+ searchSql = searchSql + whereStr + whereSql;
+ searchSql += ' order by Product2.Asset_Model_No__c Limit 450';
+ List<PricebookEntry> pbes = Database.query(searchSql);
+ return pbes;
+ }
+ //妫�绱骇鍝侀厤濂�
+ @AuraEnabled
+ public static List<Product_Set__c> serSetContact(String SearchName,String SearchCode,String filterName){
+ String searchSql = 'Select id, name, Price__c, Product_Set_CD__c, Quantity__c,Valid_Status__c,Quote_Select_Info__c From Product_Set__c ';
+ String whereStr = 'Where Valid_Status__c = true ';
+ String whereSql = '';
+ if(SearchName != null && SearchName != ''){
+ whereSql += 'and name Like ' + '\'%' + SearchName + '%\' ';
+ }
+ if(filterName != null && filterName != ''){
+ whereSql += 'and Applicable_Department__c =\'' + filterName + '\'';
+ }
+ if(SearchCode != null && SearchCode != ''){
+ whereSql += 'and Product_Set_CD__c like ' + '\'%' + SearchCode + '%\' ';
+ }
+ searchSql = searchSql + whereStr + whereSql;
+ searchSql += ' order by Product_Set_CD__c limit 500';
+ List<Product_Set__c> cl = Database.query(searchSql);
+ return cl;
+ }
+ //浜у搧妫�绱㈤厤濂楄祴鍊�
+ @AuraEnabled
+ public static String setProductEntry(String setProduct_text,
+ String activitiesCan,
+ String oppInfoc,
+ String quoc) {
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ setOppFromOppInfo();
+ List<String> productIDLIST = new List<String>();
+ if (setProduct_text == null) {
+ // PageArrange();
+ return JSON.serialize(activities);
+ } else {
+ productIDLIST = setProduct_text.split(',');
+ }
+ System.debug('productIDLIST-c++'+productIDLIST);
+ List<Id> productIds = null;
+ List<Product_Set_Detail__c> productSetDetails = [SELECT Id, Product__c, Quantity__c, Product_Set__r.Name,Product__r.VenderName__c,Product__r.CanNotCancelledGurantee__c,Product__r.Is_DangerousChemicals__c FROM Product_Set_Detail__c Where Product_Set__c in :productIDLIST];
+ if (productSetDetails.size() == 0) {
+ // PageArrange();
+ return JSON.serialize(activities);
+ } else {
+ productIds = new List<Id>();
+ for (Product_Set_Detail__c local : productSetDetails) {
+ productIds.add(local.Product__c);
+ }
+ }
+ System.debug('productIds++'+productIds);
+ System.debug('activities++'+activities);
+ tmpactivities = activities;
+ activities = new List<QELine>();
+ boolean lineflg = false;
+ Map<Id, Product2> items = new Map<Id, Product2>();
+ List<Product2> products = [select Id, Name, ProductCode,
+ Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c,
+ Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c,
+ SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c
+ , Entend_gurantee_period_all__c
+ , Intra_Trade_Gurantee_RMB__c
+ , Intra_Trade_Service_RMB__c
+ , GuranteeType__c
+ , Maintenance_Price_Year__c
+ ,CanNotCancelledGurantee__c
+ ,Is_DangerousChemicals__c
+ ,Repair_Contract_USD__c
+ ,LastbuyProductFLG__c
+ ,Intra_Trade_Foreign_RMB__c
+ ,NoDiscount_Foreign__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ ,Estimated_ConsumptionDueDate__c
+ FROM Product2 Where Id IN :productIds
+ And Manual_Entry__c = false];
+ for (Product2 product : products) {
+ items.put(product.Id, product);
+ }
+ System.debug('items++'+items);
+ Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>();
+ List<PricebookEntry> workEntries = [
+ SELECT Id, Product2Id
+ FROM PricebookEntry Where Product2Id IN :productIds
+ AND CurrencyIsoCode = :(opp.Trade__c == '澶栬部' ? 'USD' : 'CNY')
+ AND IsActive = true
+ ];
+ for (PricebookEntry workEntry : workEntries) {
+ entries.put(workEntry.Product2Id, workEntry);
+ }
+ System.debug('entries-c++'+entries);
+ Integer i = 1;
+ Integer rightcnt = 0;
+ for (QELine t : tmpactivities) {
+ QELine a = New QELine();
+ a.lineNo = i;
+ System.debug('i-c++'+i);
+ a = t;
+ a.lineNo = i;
+ activities.add(a);
+
+ i++;
+ }
+ if (items.size() > 0) {
+ System.debug('productSetDetails-c++'+productSetDetails);
+ for (Integer l = 0; l < productSetDetails.size(); l++) {
+ Product_Set_Detail__c nowDetail = productSetDetails[l];
+ Product2 prd = items.get(nowDetail.product__c);
+ PricebookEntry pbe = entries.get(nowDetail.product__c);
+ if (pbe == null) {
+ } else {
+ QELine c = null;
+ Integer Quantity_c = nowDetail.Quantity__c > 0 ? Integer.valueOf(nowDetail.Quantity__c) : 1;
+ if (opp.Trade__c == '澶栬部') {
+ if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) {
+ c = new QELine(i, prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c,
+ prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c,
+ prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantity_c, prd.Foreign_Trade_List_US__c,
+ prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c,
+ prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Foreign_RMB__c
+ , prd.GuranteeType__c
+ , prd.NoDiscount_Foreign__c, prd.Repair_Contract_USD__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+ } else {
+ continue;
+ }
+ } else if (opp.Trade__c == '鍐呰部') {
+ if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) {
+ c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c,
+ prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c,
+ prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantity_c, prd.Intra_Trade_List_RMB__c,
+ prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c,
+ prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Gurantee_RMB__c
+ , prd.GuranteeType__c
+ , prd.Intra_Trade_Service_RMB__c
+ , prd.Maintenance_Price_Year__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+ } else {
+ continue;
+ }
+ } else {
+ continue;
+ }
+ activities.add(c);
+ i++;
+ rightcnt++;
+ lineflg = true;
+ }
+ }
+ }
+ // PageArrange();
+ if (productSetDetails.size() > 0) {
+ errorflg = true;
+ errormessage = productSetDetails[0].Product_Set__r.Name + ' 瀵煎叆缁撴潫锛屽鍏� ' + productSetDetails.size() + ' 浠讹紝鎴愬姛' + rightcnt + ' 浠�';
+ }
+ System.debug('activities-to++'+activities);
+ return errormessage + '---' + JSON.serialize(activities);
+ }
+ //excelImport
+ @AuraEnabled
+ public static String excelImport(String excel_text,
+ String activitiesCan,
+ String oppInfoc,
+ String quoc) {
+
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ setOppFromOppInfo();
+ errorflg = false;
+ errormessage = '';
+ Integer j = 0;
+ tmpactivities = activities;
+ activities = new List<QELine>();
+ Integer i = 0;
+ Integer xlscnt = 0;
+ Integer rightcnt = 0;
+
+ string[] xlslists = excel_text.split('\n', -1);
+ List<string> xlslist = New list<string>();
+ List<string> codelist = New List<string>();
+ List<Integer> Quantitylist = New List<Integer>();
+ //String str ;
+
+ Map<String, Integer> mp = new Map<String, Integer>();
+ string xlscode;
+ Integer xlsQuantity;
+
+ try {
+ for (string xls : xlslists) {
+ if (xls == null || xls == '') {
+ } else {
+ 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;
+ errormessage = System.Label.Error_Message31;
+ activities = tmpactivities;
+ // pageArrange();
+ return errormessage+'---'+JSON.serialize(activities);
+ } else {
+ s = s.trim();
+ xlsQuantity = Integer.valueOf(s);
+ Quantitylist.add(xlsQuantity);
+ }
+ } else {
+ system.debug('xlslist2+++'+s);
+ //even number
+ if (s == '' || s == null) {
+ errorflg = true;
+ errormessage = System.Label.Error_Message31;
+ activities = tmpactivities;
+ // pageArrange();
+ return errormessage+'---'+JSON.serialize(activities);
+ } else {
+ s = s.trim();
+ codelist.add(s);
+ xlscode = s;
+ }
+ }
+ i++;
+ }
+ //mp.put(xlscode, xlsQuantity);
+ xlscnt++;
+ }
+ }
+ } catch (Exception ex) {
+ system.debug('xlslist3+++'+xlscnt);
+ activities = tmpactivities;
+ errorflg = true;
+ errormessage = System.Label.Error_Message31;
+ // pageArrange();
+ return errormessage+'---'+JSON.serialize(activities);
+ }
+
+ system.debug(j);
+ system.debug('xlscnt:::::' + xlscnt);
+
+ 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 errormessage+'---'+JSON.serialize(activities);
+ }
+
+
+ i = 1;
+ boolean lineflg = false;
+ for (QELine t : tmpactivities) {
+ QELine a = New QELine();
+ a = t;
+ a.lineNo = i;
+ activities.add(a);
+ i++;
+ }
+ Map<String, Product2> mpProduct2 = new Map<String, Product2>();
+ String celon_type = String.isNotBlank(opp.CelonOpportunity__c) ? opp.CelonOpportunity__c : null;
+ List<Product2> items = [select Id, Name, ProductCode,
+ Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c,
+ Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c,
+ SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c
+ , Entend_gurantee_period_all__c
+ , Intra_Trade_Gurantee_RMB__c
+ , Intra_Trade_Service_RMB__c
+ , GuranteeType__c
+ , Maintenance_Price_Year__c
+ ,CanNotCancelledGurantee__c
+ ,Is_DangerousChemicals__c
+ ,Repair_Contract_USD__c
+ ,Intra_Trade_Foreign_RMB__c
+ ,NoDiscount_Foreign__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ ,Estimated_ConsumptionDueDate__c
+ FROM Product2 Where ProductCode In :codelist
+ And Celon_Product__c = :celon_type
+ And Manual_Entry__c = false];
+ for (Product2 prd : items) {
+ system.debug('prd.ProductCode:::::' + prd.ProductCode);
+ mpProduct2.put(prd.ProductCode, prd);
+ }
+ Map<String, PricebookEntry> entries = new Map<String, PricebookEntry>(); // key銇孭roductCode銇с仚銆�
+ List<PricebookEntry> pbes = [
+ select Id, PricebookEntry.Product2.ProductCode
+ FROM PricebookEntry Where PricebookEntry.Product2.ProductCode IN :codelist
+ AND CurrencyIsoCode = :(opp.Trade__c == '澶栬部' ? 'USD' : 'CNY')
+ AND IsActive = true];
+ for (PricebookEntry pbe : pbes) {
+ system.debug('pbe.Product2.ProductCode:::::' + pbe.Product2.ProductCode);
+ entries.put(pbe.Product2.ProductCode, pbe);
+ }
+
+ for (Integer l = 0; l < codelist.size(); l++) {
+ system.debug('codelist[l]:::::' + codelist[l]);
+ Product2 prd = mpProduct2.get(codelist[l]);
+ if (prd != null) {
+ PricebookEntry pbe = entries.get(codelist[l]);
+ QELine c = null;
+ if (pbe != null && (opp.Trade__c == '澶栬部' || opp.Trade__c == '鍐呰部')) {
+ if (opp.Trade__c == '澶栬部') {
+ if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) {
+ c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c, prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantitylist[l], prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c, prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Foreign_RMB__c
+ , prd.GuranteeType__c
+ , prd.NoDiscount_Foreign__c,
+ prd.Repair_Contract_USD__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+
+ } else {
+ continue;
+ }
+ } else {
+ if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) {
+ c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantitylist[l], prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c, prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Gurantee_RMB__c
+ , prd.GuranteeType__c
+ , prd.Intra_Trade_Service_RMB__c
+ , prd.Maintenance_Price_Year__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+
+ } else {
+ continue;
+ }
+ }
+ } else {
+ continue;
+ }
+ activities.add(c);
+ i++;
+ rightcnt++;
+ }
+ }
+ // message銈掑嚭銇�
+ errorflg = true;
+ errormessage = '鏁版嵁瀵煎叆缁撴潫锛屽鍏� ' + codelist.size() + ' 浠讹紝鎴愬姛' + rightcnt + ' 浠�';
+ // pageArrange();
+
+ return errormessage+'---'+JSON.serialize(activities);
+
+ }
+ //decide鎸夐挳
+ @AuraEnabled
+ public static Map<String,String> QuoteDecision(String activitiesCan,
+ String CheckItemCan ,
+ boolean WinOrDecideAlertc,
+ boolean productStatusUpdatedc,
+ String oppInfoc,
+ boolean enableSalesc,
+ String quoc,
+ String oppIdc,
+ String quoIdc,
+ boolean newQuoteFlagc,
+ Boolean changedAfterPrintc,
+ String quoteGurantee_Periodc,
+ String quotemultiYearWarrantyc,
+ String selection_hpc,
+ Boolean SkipQuotefilgc) {
+ oppId = oppIdc;
+ quoId = quoIdc;
+ System.debug('quoId+'+quoId);
+ WinOrDecideAlert = WinOrDecideAlertc;
+ productStatusUpdated = productStatusUpdatedc;
+ newQuoteFlag = newQuoteFlagc;
+ changedAfterPrint = changedAfterPrintc;
+ quoteGurantee_Period = quoteGurantee_Periodc;
+ quotemultiYearWarranty = quotemultiYearWarrantyc;
+ selection_hp = selection_hpc;
+ SkipQuotefilg = SkipQuotefilgc;
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ if(String.isNotBlank(CheckItemCan)){
+ CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class);
+ }else {
+ CheckItem = null;
+ }
+ enableSales = enableSalesc;
+ Savepoint sp = Database.setSavepoint();
+ Map<String,String> result = new Map<String,String>();
+ try {
+ setOppFromOppInfo();
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ if (!(opp.If_Account_Change__c != null ? opp.If_Account_Change__c : false)) {
+ if(!ReservedProductVerification()){
+ if(flglastbuy==1){
+ errorflg = true;
+ errormessage = '棰勭暀浜у搧琛ㄤ腑娌℃湁璇ヨ浠凤紝璇烽�氳繃鏈儴绐楀彛鑱旂郴钀ヤ笟绠$悊璇�' ;
+ result.put('errormessage', errormessage);
+ return result;
+ }else if(flglastbuy==2){
+ errorflg = true;
+ errormessage = errorProductmodel+'浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺' ;
+ result.put('errormessage', errormessage);
+ return result;
+ }else if(flglastbuy==3){
+ errorflg = true;
+ errormessage = '棰勭暀浜у搧'+errorProductmodel+'鏈綍鍏ラ鐣欎骇鍝佽〃';
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ }
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ if(checkVirtual('鍖呭惈铏氭嫙浜у搧锛屾棤娉曡繘琛宒ecide')){
+ errorflg = true;
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ //chenjingwu DB202308355043 2023.8.25 end
+ if (checkIsQuoteTrial()) {
+ errorflg = true;
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ if (enableSales == true) {
+ if (dataCheckDecide() == false) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ if(hongzi){
+ String act = JSON.serialize(activities);
+ result.put('act', act);
+ }
+ return result;
+ }
+ }
+ if (checkSFDAStatus2(true) == false) {
+ errorflg = true;
+ errormessage = '璇锋洿鏂颁笉鍙攢鍞殑浜у搧銆�';
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ if (dataCheck() == false) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ return result;
+ }
+ System.debug('oppId++'+oppId);
+ if (dataEntry() == false) {
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ if(SkipQuotefilg){
+ errorflg = true;
+ errormessage = '浜у搧閰嶇疆鎴栬�呯粡閿�鍟嗕俊鎭彂鐢熷彉鍖栵紝宸茬粡鐢熸垚鏂扮殑鎶ヤ环鍗曪紝璇烽噸鏂版搷浣滄姤浠疯绠�';
+ quo.IsQuoteTrial__c = false;
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ if (String.isBlank(oppId)) {
+ } else {
+ List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId];
+
+ if (opps.size() > 0) {
+ opps[0].Estimation_Decision__c = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update opps[0];
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+
+ Quote q = new Quote();
+ if(String.isBlank(quoId)){
+ q = [select Id from Quote where Id = :quoIdreturn];
+ }else{
+ q = [select Id from Quote where Id = :quoId];
+ }
+ q.Quote_Decision_Date__c = date.Today();
+ update q;
+ result.put('success', System.Label.Message_002);
+ if(String.isBlank(quoId)){
+ result.put('quoId',quoIdreturn);
+ }
+ if(errormessagewarn != null){
+ result.put('warn', errormessagewarn);
+ String act = JSON.serialize(activities);
+ result.put('act', act);
+ }
+ return result;
+
+ // pageArrange();
+ }
+ } catch (DmlException de) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = de.getDmlMessage(0);
+ result.put('errormessage', errormessage);
+ return result;
+ } catch (Exception e) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = e.getLineNumber()+':'+e.getMessage();
+ result.put('errormessage', errormessage);
+ return result;
+ }
+
+ return null;
+ }
+ //decide妫�鏌�
+ private static boolean dataCheckDecide() {
+ Boolean error = false;
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ if (quo.Dealer_Final_Price_Page__c == null) {
+ // quo.Dealer_Final_Price__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Dealer_Final_Price__c.label;
+ dfpp = true;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (checkAgentsDeleteFlag() == false) {
+ return false;
+ }
+ if (WinOrDecideAlert && (!productStatusUpdated)) {
+ // PriceStatusUpdate();
+ }
+ if (opp.Agency1__c == null) {
+ // opp.Agency1__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label;
+ error = true;
+ Agency1 = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.OCM_Agent1_Price_Page__c == null || quo.OCM_Agent1_Price_Page__c == 0) {
+ // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label;
+ error = true;
+ oapp = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (opp.Agency2__c == null && quo.Agent1_Agent2_Price_Page__c != null) {
+ // opp.Agency2__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label;
+ error = true;
+ Agency2 = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (opp.Agency2__c != null && quo.Agent1_Agent2_Price_Page__c == null) {
+ // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Opportunity.fields.Agent1_Agent2_Price__c.label;
+ error = true;
+ aapp = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+
+ if (opp.If_Need_Authorize__c == true) {
+ ID tmpid = opp.Agency2__c == null ? opp.Agency1__c : opp.Agency2__c;
+ List<Account> accName = [select name from Account where id = : tmpid];
+ if (accName[0].name != opp.Authorized_Finish_Sales__c) {
+ error = true;
+ errormessage = '缁忛攢鍟嗘湭鎺堟潈鎴栨巿鏉冩湭瀹屾垚锛岃鍏堟巿鏉冦��' ;
+ }
+ }
+ if (opp.Trade__c == '鍐呰部') {
+ Map<Id, String> proMap = new Map<Id, String>();
+ if (activities.size() > 0) {
+ for (QELine qli : activities) {
+ if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ proMap.put(qli.pageObject.Id__c, qli.PageObject.Name__c);
+ }
+ }
+ }
+ Map<String, String> chkMap = new Map<String, String>();
+ if(!opp.Is_Corrosion__c){
+ chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, '');
+ }
+ System.debug('chkMap++'+chkMap);
+ if (chkMap.size() > 0) {
+ errorflg = true;
+ error = true;
+ if (chkMap.containsKey('agency')) {
+ errormessage = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��';
+ }
+ Integer inerr = 0;
+ if (activities.size() > 0) {
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ if (chkMap.containsKey(s.PageObject.Id__c)) {
+ if (chkMap.get(s.PageObject.Id__c) == '1') {
+ s.haveno_Register = true;
+ inerr ++;
+ } else if (chkMap.get(s.PageObject.Id__c) == '2') {
+ s.wrong_Register = true;
+ inerr ++;
+ }
+ }
+ }
+ }
+ }
+ if (inerr > 0) {
+ errormessage = '璇锋鏌ョ孩瀛楀唴瀹癸紙NMPA鐘舵�佺孩瀛楋紝涓嶅彲閿�鍞骇鍝侊紱浜у搧鍚嶇О绾㈠瓧锛岃秴杩囩粡閿�鍟嗙粡钀ヨ寖鍥达級銆�';
+ hongzi = true;
+ }
+ return false;
+ }
+ Boolean isDangerError = false;
+ Boolean isNotDangerError = false;
+ if (activities.size() > 0) {
+ for (QELine qli : activities) {
+ if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ if (opp.Is_Corrosion__c) {
+ if(!qli.Is_DangerousChemicals){
+ isNotDangerError =true;
+ qli.wrong_Register = true;
+ }
+
+ }else{
+ if(qli.Is_DangerousChemicals){
+ isDangerError =true;
+ qli.wrong_Register = true;
+ }
+ }
+ }
+ }
+ }
+ if (enableSales == true&&opp.Is_Corrosion__c&&opp.Trade__c == '鍐呰部') {
+ String str = OpportunityWebService.checkDangerItem(opp.agency1__c);
+ if (str != 'OK') {
+ error = true;
+ errormessage = str;
+ }
+ if(isNotDangerError){
+ error = true;
+ errormessage = '褰撻樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佸繀椤诲叏閫夋嫨鍗卞寲鍝併��';
+ }
+ }else if(!opp.Is_Corrosion__c){
+ if(isDangerError){
+ error = true;
+ errormessage = '褰撹浠蜂笉鏄樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佷笉鑳介�夋嫨鍗卞寲鍝併��';
+ }
+ }
+ }
+ if (error == true) {
+ // PageArrange();
+ errorflg = true;
+ return false;
+ } else {
+ return true;
+ }
+ }
+ //妫�鏌ユ槸鍚︽姤浠疯绠�
+ private static boolean checkIsQuoteTrial() {
+ Boolean error = false;
+ errorflg = false;
+ errormessage = null;
+ if(opp.If_Need_PriceApply__c){
+ if(!quo.IsQuoteTrial__c){
+ error = true;
+ errormessage = 'decide鎶ヤ环杩樻病杩涜鎶ヤ环璇曠畻锛岃鍏堟姤浠疯瘯绠楋紒' ;
+ }
+ if(quoId !=null){
+ boolean IsActivePsp = true;
+ String errorPsp ='';
+ List<PromotionSalesProducts__c> promotionSalesProductsList =[select id,PromotionSales__c,QuantityId__c,PromotionSales__r.name,PromotionSales__r.IsPolicyEffective__c,recordTypeName__c from PromotionSalesProducts__c where QuantityId__c=: quoId];
+ if(promotionSalesProductsList.size()>0){
+ for(PromotionSalesProducts__c psp :promotionSalesProductsList){
+ if(psp.PromotionSales__r.IsPolicyEffective__c == '鏃犳晥'&&psp.recordTypeName__c!='NormalProduct'){
+ IsActivePsp =false;
+ errorPsp = psp.PromotionSales__r.name;
+ break;
+ }
+ }
+ }
+ if(!IsActivePsp){
+ error = true;
+ errormessage = '鎶ヤ环璇曠畻涓紝閫夋嫨鐨勪績閿�鏀跨瓥:'+errorPsp+',涓嶅湪鏈夋晥鏈熷唴锛岃妫�鏌ワ紒' ;
+ }
+ }
+ }
+ return error;
+ }
+ //lastbuy妫�鏌�
+ public static boolean ReservedProductVerification() {
+ filg=true;
+ Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>();
+ List<Id> lastProductFLGListId = new List<Id>();
+ List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>();
+ List<QuoteLineItem> act = new List<QuoteLineItem>();
+ List<QuoteLineItem> act2 = new List<QuoteLineItem>();
+ for(QELine aaa :activities){
+ if(aaa.pageObject.PricebookEntry.Product2Id!=null){
+ act.add(aaa.pageObject);
+ }
+ }
+ act2=act.deepClone();
+ Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>();
+ System.debug('activities1111111111112涓烘墍褰撲负澶氬!!!'+activities);
+ integer i =0;
+ for(QuoteLineItem pspsc :act2){
+ if(pspsc.PricebookEntry.Product2Id!=null){
+ if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){
+ QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id);
+ quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c;
+ map1.put(pspsc.PricebookEntry.Product2Id,quoteLine);
+ }else{
+ map1.put(pspsc.PricebookEntry.Product2Id,pspsc);
+ }
+ System.debug('34499879!!!'+activities);
+ }
+ }
+ System.debug('3434343!!!'+activities);
+ System.debug('5656565!!!'+map1);
+ for (QuoteLineItem value : map1.values()) {
+ if(value.PricebookEntry.Product2.LastbuyProductFLG__c){
+ lastProductFLGListId.add(value.PricebookEntry.Product2Id);
+ quotlinitMap.put(value.PricebookEntry.Product2Id,value);
+ lastProductFLGList.add(value);
+ }
+ }
+ System.debug('activities++++!!!'+activities);
+ System.debug('activities!!!'+map1.values());
+ System.debug('oppId!!!'+oppId);
+ System.debug('lastProductFLGList!!!'+lastProductFLGListId);
+ if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){
+ List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true];
+ Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>();
+ System.debug('LastbuyObjList+++++!!!'+LastbuyObjList);
+ if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){
+ for(LastbuyProduct__c lastbuypr :LastbuyObjList){
+ LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr);
+ }
+ }else{
+ flglastbuy=1;
+ filg=false;
+ return filg;
+ }
+ System.debug('LastbuyObjMap!!!'+LastbuyObjMap);
+ System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList);
+ if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){
+ for(QuoteLineItem lastbuypr :lastProductFLGList){
+ Decimal quoteLItemNum=0;
+ if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){
+ quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c;
+ System.debug('quoteLItemNum!!!'+quoteLItemNum);
+ System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c);
+ if(lastbuypr.Quantity__c>quoteLItemNum){
+ errorProductmodel=lastbuypr.Asset_Model_No__c;
+ flglastbuy=2;
+ filg=false;
+ break;
+ }
+ }else{
+ errorProductmodel=lastbuypr.Asset_Model_No__c;
+ flglastbuy=3;
+ filg=false;
+ break;
+ }
+ }
+ }
+ }
+ system.debug('filg====='+filg);
+ return filg;
+ }
+ // CHAN-AVG3PW 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
+ // 鎶ヤ环鍒涘缓鏃ヨ秴杩囦笁涓湀鏃讹紝濡備骇鍝佸仠浜ф垨CFDA澶辨晥锛屼笉鍙互淇濆瓨锛屾彁绀衡�滆鏇存柊鍋滄閿�鍞殑浜у搧鈥�
+ // 鍋欴ECIDE鏃讹紝濡備骇鍝佸仠浜ф垨CFDA澶辨晥锛屼笉鍙互淇濆瓨锛屾彁绀衡�滆鏇存柊鍋滄閿�鍞殑浜у搧鈥�
+ private static boolean checkSFDAStatus2(boolean dodecide) {
+ for (QELine a : activities) {
+ if ((a.Asset_Model != null) && (a.Asset_Model != '')) {
+ if (a.PageObject.SFDA_Status__c != '鏈夊姽' &&
+ a.PageObject.SFDA_Status__c != '鏈夊姽锛堝啀鐢宠珛涓級' &&
+ a.PageObject.SFDA_Status__c != '涓嶈' &&
+ a.PageObject.SFDA_Status__c != '鏆傚仠鍑哄簱锛堢煭鏈燂級' &&
+ a.PageObject.SFDA_Status__c != '澶卞姽锛堟湡闄愬唴鐢熺敚娓堝湪搴蹇滐級'
+ ) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ // DB202307431108 鎶ヤ环鍗曘�戠粡閿�鍟�1鍚堝悓閲戦榛樿鍊艰鍒欎慨鏀� fy start
+ public static String getValueFromJSONStringPlus(String jsonstring,String key,String key1) {
+ if (String.isNotBlank(jsonstring)) {
+ Map<String, Object> map1 = (Map<String, Object>) JSON.deserializeUntyped(jsonstring);
+ Map<String, Map<String,Object>> mapping = new Map<String, Map<String,Object>>();
+ for (String str : map1.keySet()) {
+ Map<String,Object> mapvalue = (Map<String,Object>) map1.get(str);
+ mapping.put(str, mapvalue);
+ }
+ return mapping.get(key) != null ? (mapping.get(key).get(key1) !=null ? String.valueOf(mapping.get(key).get(key1)) :( mapping.get(key).get('Other') !=null ? String.valueOf(mapping.get(key).get('Other')):null)) : (mapping.get('Default') != null ? (mapping.get('Default').get(key1) !=null ? String.valueOf(mapping.get('Default').get(key1)) : (mapping.get('Default').get('Other') != null ? String.valueOf(mapping.get('Default').get('Other')):null)): null);
+ }
+ return null;
+ }
+ //涓嬫媺鍒楄〃鍊艰幏鍙栧叡閫�
+ @AuraEnabled
+ public static InitData getModulus(String oppInfoc){
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ InitData res = new InitData();
+ String str_rate_hospital = ControllerUtil.getValueFromJSONString(System.Label.Quote_HospitalAmount_Rate, opp.Salesdepartment_Owner__c);
+ String str_rate_agency1 = lexNewQuoteEntryController.getValueFromJSONStringPlus(System.Label.Quote_Agency1Amount_Rate, opp.Salesdepartment_Owner__c,opp.Opportunity_Category__c);
+ res.rate_hospital = String.isNotBlank(str_rate_hospital) ? Decimal.valueOf(str_rate_hospital) : 1.0;
+ res.rate_agency1 = String.isNotBlank(str_rate_agency1) ? Decimal.valueOf(str_rate_agency1) : 1.0;
+ return res;
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ public static Boolean checkVirtual(String message){
+
+ List<String> idList = new List<String>();
+ for (QELine s : activities) {
+ if (String.isNotBlank(s.Category5) && s.Category5 == '铏氭嫙') {
+ idList.add(s.Category5);
+ }
+ System.debug('Category5+'+s.Category5);
+ }
+ if(idList.size() > 0){
+ errorMessage = message;
+ return true;
+ }
+ return false;
+ }
+ //chenjingwu DB202308355043 2023.8.25 end
+ public class InitData{
+ @AuraEnabled
+ public Decimal rate_hospital;
+ @AuraEnabled
+ public Decimal rate_agency1;
+ }
+ //琛岄」鐩嚜瀹氫箟缁撴瀯
+ //琛岄」鐩師鍊�
+ public class QELinelatestInfo {
+ public String ProductCode { get; set; }
+ public String ProductName { get; set; }
+ public String SFDA_Status { get; set; }
+ public String Sales_Possibility { get; set; }
+ public Decimal ListPrice { get; set; }
+ public Decimal Cost { get; set; }
+ public Integer Specifications {get; set;}
+ public string GuranteeType {get; set;}
+ public Decimal Intra_Trade_Gurantee {get; set;}
+ public Decimal ProductEntend_gurantee_period_all {get; set;}
+ public Decimal Intra_Trade_Service {get; set;}
+ public Decimal Maintenance_Price_Year {get; set;}
+ public Boolean CanNotCancelledGurantee {get; set;}
+ public Boolean Is_DangerousChemicals {get; set;}
+ }
+ //琛岄」鐩柊鍊�
+ public class QELine {
+ public Integer lineNo;
+ public String Asset_Model;
+ public String Sales_Possibility;
+ public QuoteLineItem pageObject;
+ public Decimal Cost_c;
+ public Decimal Cost_Subtotal_c;
+ public Decimal ListPrice_Page;
+ public String StorageStatus;
+ public Integer Specifications;
+ public String VenderName;
+ public Boolean CanNotCancelledGurantee;
+ public Boolean Is_DangerousChemicals;
+ public QELinelatestInfo latestInfo;
+ public boolean changed_name;
+ public boolean changed_sfda;
+ public boolean changed_list;
+ public boolean changed_cost;
+ public boolean haveno_Register;
+ public boolean wrong_Register;
+ public String Estimated_ConsumptionDueDate;
+ public Decimal GuranteePrice;
+ public Decimal ProductGuranteePrice;
+ public decimal Maintenance_Price_Year;
+ public String Category5;
+ public QELine(){}
+ public QELine(QuoteLineItem qli, Integer i, String copyQuoId) {
+ this.lineNo = i;
+ pageObject = qli.clone();
+ pageObject.Id__c = qli.PricebookEntry.Product2Id;
+ pageObject.Quantity__c = qli.Quantity;
+ if (String.isNotBlank(copyQuoId)) {
+ pageObject.SFDA_Status__c = qli.PricebookEntry.Product2.SFDA_Status__c;
+ pageObject.Name__c = qli.PricebookEntry.Product2.Name;
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ Category5 = qli.PricebookEntry.Product2.Category5__c;
+ //chenjingwu DB202308355043 2023.8.25 end
+ this.Asset_Model = qli.Asset_Model_No__c;
+ if (qli.Cost__c > 0 && qli.Quantity > 0) {
+ this.Cost_Subtotal_c = qli.Cost__c * qli.Quantity;
+ }
+ this.VenderName = qli.PricebookEntry.Product2.VenderName__c;
+ if(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c != null){
+ this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c).replaceAll('-','/');
+ }else{
+ this.Estimated_ConsumptionDueDate = '';
+ }
+ if(VenderName==null||VenderName==''){
+ this.VenderName =' 鏃� ';
+ }
+ this.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c;
+ this.Is_DangerousChemicals = qli.PricebookEntry.Product2.Is_DangerousChemicals__c;
+ this.StorageStatus = qli.PricebookEntry.Product2.StorageStatus__c;
+ this.ListPrice_Page = qli.ListPrice__c;
+ this.Cost_c = qli.Cost__c;
+ pageObject.Subtotal__c = qli.TotalPrice__c;
+ pageObject.UnitPrice_Page__c = qli.UnitPrice__c;
+ latestInfo = new QELinelatestInfo();
+ latestInfo.ProductCode = qli.ProductCode__c;
+ latestInfo.ProductName = qli.PricebookEntry.Product2.Name;
+ latestInfo.SFDA_Status = qli.PricebookEntry.Product2.SFDA_Status__c;
+ latestInfo.ProductEntend_gurantee_period_all = qli.PricebookEntry.Product2.Entend_gurantee_period_all__c;
+ if(qli.Quote.Opportunity.Trade__c == '鍐呰部'){
+ latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c;
+ latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.Intra_Trade_Service_RMB__c;
+ if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){
+ latestInfo.Maintenance_Price_Year = 0;
+ }else{
+ latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Maintenance_Price_Year__c;
+ }
+ }else if(qli.Quote.Opportunity.Trade__c == '澶栬部'){
+ latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c;
+ latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.NoDiscount_Foreign__c;
+ if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){
+ latestInfo.Maintenance_Price_Year = 0;
+ }else{
+ latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Repair_Contract_USD__c;
+ }
+ }
+ latestInfo.GuranteeType = qli.PricebookEntry.Product2.GuranteeType__c;
+ latestInfo.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c;
+ this.Maintenance_Price_Year = qli.Maintenance_Price_Year__c;
+ this.GuranteePrice = qli.GuranteePrice__c;
+ this.ProductGuranteePrice = qli.ProductGuranteePrice__c;
+ latestInfo.Sales_Possibility = qli.PricebookEntry.Product2.Sales_Possibility__c;
+ if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) {
+ latestInfo.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + '');
+ }
+ latestInfo.ListPrice = qli.Product_ListPrice__c;
+ latestInfo.Cost = qli.Product_Cost__c;
+ if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) {
+ this.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + '');
+ }
+ this.changed_name = false;
+ this.changed_sfda = false;
+ this.changed_list = false;
+ this.changed_cost = false;
+ this.haveno_Register = false;
+ this.wrong_Register = false;
+ }
+ public QELine(Integer i,Boolean Is_DangerousChemicals,Boolean CanNotCancelledGurantee,String VenderName,
+ Date Estimated_ConsumptionDueDate,
+ String PricebookEntryId,
+ String Asset_Model, String StorageStatus,
+ String ProductCode, String Id_c,
+ String SFDA_Status_c, String Sales_Possibility_c,
+ String Name_c, String BSS_Category_c,
+ Integer Quantity, Decimal ListPrice_c,
+ Decimal UnitPrice_c, Decimal Cost_c,
+ Decimal Packing_list_manual
+ , Decimal Entend_gurantee_period_all
+ , decimal ProductGuranteePrice
+ , string GuranteeType
+ , Decimal productServicePrice
+ , Decimal productMaintenance_Price_Year
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,String Category5
+ //chenjingwu DB202308355043 2023.8.25 end
+ ) {
+ pageObject = New QuoteLineItem();
+ pageObject.Quantity__c = Quantity;
+ this.lineNo = i;
+ this.Asset_Model = Asset_Model;
+ this.Sales_Possibility = Sales_Possibility_c;
+ if(Estimated_ConsumptionDueDate != null){
+ this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(Estimated_ConsumptionDueDate).replaceAll('-','/');
+ }else{
+ this.Estimated_ConsumptionDueDate = '';
+ }
+ this.StorageStatus = StorageStatus;
+ pageObject.Id__c = Id_c;
+ pageObject.SFDA_Status__c = SFDA_Status_c;
+ pageObject.Name__c = Name_c;
+ pageObject.BSS_Category__c = BSS_Category_c;
+ this.ListPrice_Page = ListPrice_c;
+ pageObject.UnitPrice_Page__c = UnitPrice_c;
+ pageObject.Subtotal__c = UnitPrice_c * Quantity;
+ //chenjingwu DB202308355043 2023.8.25 start
+ Category5 = Category5;
+ //chenjingwu DB202308355043 2023.8.25 end
+ if(VenderName==null||VenderName==''){
+ this.VenderName =' 鏃� ';
+ }else{
+ this.VenderName = VenderName;
+ }
+ this.CanNotCancelledGurantee = CanNotCancelledGurantee;
+ this.Is_DangerousChemicals = Is_DangerousChemicals;
+ pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all;
+ pageObject.productServicePrice__c = productServicePrice;
+ pageObject.GuranteeType__c = GuranteeType;
+ this.ProductGuranteePrice = ProductGuranteePrice;
+ this.Maintenance_Price_Year = productMaintenance_Price_Year;
+ this.Cost_c = Cost_c;
+ this.Cost_Subtotal_c = Cost_c * Quantity;
+ pageObject.PricebookEntryId = PricebookEntryId;
+ latestInfo = New QELinelatestInfo();
+ latestInfo.ProductCode = ProductCode;
+ latestInfo.ProductName = Name_c;
+ latestInfo.SFDA_Status = SFDA_Status_c;
+ latestInfo.Sales_Possibility = Sales_Possibility_c;
+ latestInfo.ListPrice = this.ListPrice_Page;
+ latestInfo.Cost = pageObject.Cost__c;
+ latestInfo.ProductEntend_gurantee_period_all = Entend_gurantee_period_all;
+ latestInfo.Intra_Trade_Gurantee = ProductGuranteePrice;
+ latestInfo.Intra_Trade_Service = productServicePrice;
+ latestInfo.GuranteeType = GuranteeType;
+ latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year;
+ latestInfo.CanNotCancelledGurantee = CanNotCancelledGurantee;
+ latestInfo.Is_DangerousChemicals = Is_DangerousChemicals;
+ if (Packing_list_manual != null) {
+ latestInfo.Specifications = integer.valueof('' + Packing_list_manual);
+ }
+ if (Packing_list_manual != null) {
+ this.Specifications = integer.valueof('' + Packing_list_manual);
+ }
+ this.changed_name = false;
+ this.changed_sfda = false;
+ this.changed_list = false;
+ this.changed_cost = false;
+ this.haveno_Register = false;
+ this.wrong_Register = false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexNewQuoteEntryControllerTest.cls b/force-app/main/default/classes/lexNewQuoteEntryControllerTest.cls
new file mode 100644
index 0000000..707b7ee
--- /dev/null
+++ b/force-app/main/default/classes/lexNewQuoteEntryControllerTest.cls
@@ -0,0 +1,1909 @@
+@isTest
+public class lexNewQuoteEntryControllerTest {
+ static final String RC_BYOUIN = '鐥呴櫌';
+ static final String RC_HANBAOITEN = '璨╁2搴�';
+ static final String RC_KEIYAKU = '濂戠磩';
+ private static String quoteNo = 'textQutote01';
+ public static String CurrencyIso = 'CNY';
+ private static Boolean isUnitPrice = true;
+ private static Boolean isOfferAmount = true;
+ private static Boolean isTotalPrice = true;
+ private static Boolean isDiscountRate = true;
+ private static Boolean isDiscountAmount = true;
+ private static Boolean isTradingPrice = true;
+ private static Boolean isContractDetail = true;
+
+ private static Date offerExpireDate = Date.today();
+ private static String clientName = 'test client';
+ private static String offerComment = 'test comment';
+ private static Date offerPrintDate = Date.today();
+ private static String agentName = 'test agent name';
+ @isTest
+ static void Test1(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ insert opp;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
+ PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ quoteflg = true;
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ lexNewQuoteEntryController.setOppFromOppInfo();
+ }
+ @isTest
+ static void Test2(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ insert opp;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ Product_Set__c ps1 = new Product_Set__c();
+ ps1.Name = '銈汇儍銉堝搧锛�';
+ ps1.Product_Set_CD__c = '111111';
+ ps1.Description__c = '瑾槑';
+ ps1.Qty__c = 10;
+ //ps1.Valid__c = true;
+ ps1.Valid_Date__c = date.today().addDays(-5);
+ insert ps1;
+
+ Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
+ psd1.Product_Set__c = ps1.id;
+ psd1.Price__c = 100;
+ psd1.Quantity__c = 10;
+ psd1.Product__c = product1.id;
+
+ insert psd1;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('鍝�','1','');
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ String oppInfoc = JSON.serialize(opp);
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String setProduct_text = ps1.Id;
+ String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
+ String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
+ String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+ private static Id pricebookId = ControllerUtil.getStandardPricebook().Id;
+
+ static testMethod void Test3(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+ // 浜у搧
+ Product2 prd1 = new Product2();
+ prd1.ProductCode_Ext__c = 'Prd1';
+ prd1.ProductCode = 'Prd1';
+ prd1.Repair_Product_Code__c = 'Prd1_RP';
+ prd1.Name = 'Prd1';
+ prd1.Manual_Entry__c = false;
+ prd1.Category2__c = '鏈綋';
+ prd1.Category3__c = '绾ょ淮闀�';
+ prd1.Category4__c = 'CV';
+ prd1.Category5__c = '260SL绯诲垪';
+ prd1.Asset_Model_No__c = '1001';
+ prd1.Important_product__c = true;
+ prd1.Important_Rroduct_1GI__c = true;
+ insert prd1;
+
+ PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
+ entry.UnitPrice = 0;
+ entry.IsActive = true;
+ entry.UseStandardPrice = false;
+ entry.CurrencyIsoCode = 'CNY';
+ insert entry;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ lexNewQuoteEntryController.selectAccountById(contractA.Id);
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ insert opp;
+
+
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":true,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quos.OpportunityId = opp.Id;
+ quos.Pricebook2Id = pricebookId;
+ quos.Opportunity.RecordType.Id=recKeiyaku.Id;
+ // 鍒犻櫎ID灞炴��
+ // 鎵ц鎻掑叆鎿嶄綔
+ insert quos;
+
+ Map<String,String> result = new Map<String,String>();
+ lexNewQuoteEntryController.changedAfterPrint=true;
+ lexNewQuoteEntryController.newQuoteFlag=true;
+ // lexNewQuoteEntryController.dataEntry();
+ lexNewQuoteEntryController.qname=true;
+ lexNewQuoteEntryController.dfpp=true;
+ lexNewQuoteEntryController.qacc=true;
+ lexNewQuoteEntryController.qaapc=true;
+ lexNewQuoteEntryController.Agency1=true;
+ lexNewQuoteEntryController.nAgency1=true;
+ lexNewQuoteEntryController.oapp=true;
+ lexNewQuoteEntryController.noapp=true;
+ lexNewQuoteEntryController.Agency2=true;
+ lexNewQuoteEntryController.nAgency2=true;
+ lexNewQuoteEntryController.aapp=true;
+ lexNewQuoteEntryController.naapp=true;
+ lexNewQuoteEntryController.resultFlag(result);
+ lexNewQuoteEntryController.selectQuoteById(quos.Id);
+
+ // 鎶ヤ环琛岄」鐩�
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quos.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = prd1.id;
+ target.PricebookEntryId = entry.Id;
+ insert target;
+
+
+
+
+
+ lexNewQuoteEntryController.selectQuoteLineItem(quos.Id,opp.Id);
+ lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),'');
+ lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'','');
+ lexNewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',true);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = true;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoteGurantee_Periodc = null;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ Boolean quoteflg = true;
+ prd1.Category5__c = '铏氭嫙';
+ update prd1;
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,'',quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false);
+ quoIdc = quos.Id;
+ oppIdc = null;
+ oppInfoc = JSON.serialize(opp);
+ lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false);
+ Product_Set__c ps1 = new Product_Set__c();
+ ps1.Name = '銈汇儍銉堝搧锛�';
+ ps1.Product_Set_CD__c = '111111';
+ ps1.Description__c = '瑾槑';
+ ps1.Qty__c = 10;
+ //ps1.Valid__c = true;
+ ps1.Valid_Date__c = date.today().addDays(-5);
+ insert ps1;
+ String setProduct_text = ps1.Id;
+ String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
+ }
+ @isTest
+ static void Test4(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'USD';
+ opp.Is_Corrosion__c = false;
+ opp.Purchase_Type__c = 'ET24鏅傞枔璨╁2';
+ opp.SAP_Province__c='涓婃捣甯�';
+ insert opp;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
+ PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ quoteflg = true;
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ newQuoteFlagc = false;
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ lexNewQuoteEntryController.setOppFromOppInfo();
+ }
+
+ static testMethod void Test5(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+ // 浜у搧
+ Product2 prd1 = new Product2();
+ prd1.ProductCode_Ext__c = 'Prd1';
+ prd1.ProductCode = 'Prd1';
+ prd1.Repair_Product_Code__c = 'Prd1_RP';
+ prd1.Name = 'Prd1';
+ prd1.Manual_Entry__c = false;
+ prd1.Category2__c = '鏈綋';
+ prd1.Category3__c = '绾ょ淮闀�';
+ prd1.Category4__c = 'CV';
+ prd1.Category5__c = '260SL绯诲垪';
+ prd1.Asset_Model_No__c = '1001';
+ prd1.Important_product__c = true;
+ prd1.Important_Rroduct_1GI__c = true;
+ insert prd1;
+
+
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ lexNewQuoteEntryController.selectAccountById(contractA.Id);
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = 'ET24鏅傞枔璨╁2';
+ opp.Promise_Class__c = '鍐呰部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ opp.Is_Corrosion__c=true;
+ opp.SAP_Province__c='涓婃捣甯�';
+ insert opp;
+ List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('鍝�','1','');
+ PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
+ entry.UnitPrice = 0;
+ entry.IsActive = true;
+ entry.UseStandardPrice = false;
+ entry.CurrencyIsoCode = 'CNY';
+ insert entry;
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ // 鍒犻櫎ID灞炴��
+ quos.Id = null;
+ quos.OpportunityId = opp.Id;
+ quos.Opportunity.RecordType.Id=recKeiyaku.Id;
+ quos.Pricebook2Id = pricebookId;
+ // 鎵ц鎻掑叆鎿嶄綔
+ insert quos;
+
+ lexNewQuoteEntryController.selectQuoteById(quos.Id);
+ // 鎶ヤ环琛岄」鐩�
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quos.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ // target.TotalPrice = 100;
+ target.UnitPrice = 10;
+ target.Product2Id = prd1.id;
+ target.PricebookEntryId = entry.Id;
+ target.Item_Order__c = 3;
+ insert target;
+
+
+
+ lexNewQuoteEntryController.selectQuoteLineItem(target.Id,opp.Id);
+ lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),'');
+ lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'','');
+ lexNewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',false);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = quos.Id;
+ quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ // 鍒犻櫎ID灞炴��
+ quos.Id = null;
+ quos.OpportunityId = opp.Id;
+ quos.Pricebook2Id = pricebookId;
+ // 鎵ц鎻掑叆鎿嶄綔
+ String quoteGurantee_Periodc = null;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,true);
+ lexNewQuoteEntryController.WinOrDecideAlert=true;
+ lexNewQuoteEntryController.productStatusUpdated=false;
+
+ }
+
+ @isTest
+ static void Test6(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ insert opp;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ Product_Set__c ps1 = new Product_Set__c();
+ ps1.Name = '銈汇儍銉堝搧锛�';
+ ps1.Product_Set_CD__c = '111111';
+ ps1.Description__c = '瑾槑';
+ ps1.Qty__c = 10;
+ //ps1.Valid__c = true;
+ ps1.Valid_Date__c = date.today().addDays(-5);
+ insert ps1;
+
+ Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
+ psd1.Product_Set__c = ps1.id;
+ psd1.Price__c = 100;
+ psd1.Quantity__c = 10;
+ psd1.Product__c = product1.id;
+
+ insert psd1;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('鍝�','1','');
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ String oppInfoc = JSON.serialize(opp);
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String setProduct_text = ps1.Id;
+ String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
+ String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
+ String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+ @isTest
+ static void Test7(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ lexNewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏆傚仠鍑哄簱锛堢煭鏈燂級","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏆傚仠鍑哄簱锛堢煭鏈燂級","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"Id__c":null,"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[1].pageObject.Id__c = product2.Id;
+ for(lexNewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ }
+ @isTest
+ static void Test8(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'USD';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ lexNewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ product1.LastbuyProductFLG__c = true;
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ LastbuyProduct__c lbp = new LastbuyProduct__c();
+ lbp.Name = 'Test0215';
+ lbp.ProductName__c = product1.Id;
+ lbp.InquiryCode__c = opp.Id;
+ lbp.effectiveFLG__c = true;
+ lbp.LastbuyQuantity__c = 1;
+ insert lbp;
+ Quote quote = new Quote( Name = '銉嗐偣銉堣绌�');
+ quote.OpportunityId = opp.Id;
+ quote.Pricebook2Id = pricebook.id;
+ quote.Quote_No__c = 'textQutote01';
+ quote.Unit_Price__c = isUnitPrice;
+ quote.Offer_Amount__c = isOfferAmount;
+ quote.TOTAL__c = isTotalPrice;
+ quote.Discount__c = isDiscountRate;
+ quote.Pricing__c = isDiscountAmount;
+ quote.Preferential_Trading_Price__c = isTradingPrice;
+ quote.Contract__c = isContractDetail;
+ quote.Quote_Comment__c = offerComment;
+ insert quote;
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quote.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = product1.id;
+ target.PricebookEntryId = pE.Id;
+ insert target;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
+ List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[0].pageObject.Quantity__c = 2;
+ activities[0].pageObject.PricebookEntryId = pE.Id;
+ for(lexNewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ }
+ @isTest
+ static void Test9(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'USD';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ lexNewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ product1.LastbuyProductFLG__c = false;
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ LastbuyProduct__c lbp = new LastbuyProduct__c();
+ lbp.Name = 'Test0215';
+ lbp.ProductName__c = product1.Id;
+ lbp.InquiryCode__c = opp.Id;
+ lbp.effectiveFLG__c = true;
+ lbp.LastbuyQuantity__c = 1;
+ // insert lbp;
+ Quote quote = new Quote( Name = '銉嗐偣銉堣绌�');
+ quote.OpportunityId = opp.Id;
+ quote.Pricebook2Id = pricebook.id;
+ quote.Quote_No__c = 'textQutote01';
+ quote.Unit_Price__c = isUnitPrice;
+ quote.Offer_Amount__c = isOfferAmount;
+ quote.TOTAL__c = isTotalPrice;
+ quote.Discount__c = isDiscountRate;
+ quote.Pricing__c = isDiscountAmount;
+ quote.Preferential_Trading_Price__c = isTradingPrice;
+ quote.Contract__c = isContractDetail;
+ quote.Quote_Comment__c = offerComment;
+ insert quote;
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quote.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = product1.id;
+ target.PricebookEntryId = pE.Id;
+ insert target;
+ License_Information__c linc = new License_Information__c( name='Test20181204',
+ LicenseType__c = '鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�',
+ BusinessLicense__c = '20180522',
+ ValidFrom__c = date.newinstance(2018, 05, 22),
+ ValidTo__c = date.newinstance(2088, 05, 22),
+ Scope3__c = '6815;6822;6823;6825',
+ LicenseAndAccount__c = sellerA.id
+ );
+ insert linc;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
+ List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[0].pageObject.Quantity__c = 2;
+ activities[0].pageObject.PricebookEntryId = pE.Id;
+ activities[0].pageObject.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ for(lexNewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quos.IsQuoteTrial__c = true;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ }
+ @isTest
+ static void Test10(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'USD';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ lexNewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ product1.LastbuyProductFLG__c = false;
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ LastbuyProduct__c lbp = new LastbuyProduct__c();
+ lbp.Name = 'Test0215';
+ lbp.ProductName__c = product1.Id;
+ lbp.InquiryCode__c = opp.Id;
+ lbp.effectiveFLG__c = true;
+ lbp.LastbuyQuantity__c = 1;
+ // insert lbp;
+ Quote quote = new Quote( Name = '銉嗐偣銉堣绌�');
+ quote.OpportunityId = opp.Id;
+ quote.Pricebook2Id = pricebook.id;
+ quote.Quote_No__c = 'textQutote01';
+ quote.Unit_Price__c = isUnitPrice;
+ quote.Offer_Amount__c = isOfferAmount;
+ quote.TOTAL__c = isTotalPrice;
+ quote.Discount__c = isDiscountRate;
+ quote.Pricing__c = isDiscountAmount;
+ quote.Preferential_Trading_Price__c = isTradingPrice;
+ quote.Contract__c = isContractDetail;
+ quote.Quote_Comment__c = offerComment;
+ insert quote;
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quote.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = product1.id;
+ target.PricebookEntryId = pE.Id;
+ insert target;
+ License_Information__c linc = new License_Information__c( name='Test20181204',
+ LicenseType__c = '鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�',
+ BusinessLicense__c = '20180522',
+ ValidFrom__c = date.newinstance(2018, 05, 22),
+ ValidTo__c = date.newinstance(2088, 05, 22),
+ Scope3__c = '6815;6822;6823;6825',
+ LicenseAndAccount__c = sellerA.id
+ );
+ insert linc;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
+ List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[0].pageObject.Quantity__c = 2;
+ activities[0].pageObject.PricebookEntryId = pE.Id;
+ activities[0].pageObject.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ for(lexNewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = false;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quos.IsQuoteTrial__c = true;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ }
+ @isTest
+ static void Test11(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ insert opp;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ Product_Set__c ps1 = new Product_Set__c();
+ ps1.Name = '銈汇儍銉堝搧锛�';
+ ps1.Product_Set_CD__c = '111111';
+ ps1.Description__c = '瑾槑';
+ ps1.Qty__c = 10;
+ //ps1.Valid__c = true;
+ ps1.Valid_Date__c = date.today().addDays(-5);
+ insert ps1;
+
+ Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
+ psd1.Product_Set__c = ps1.id;
+ psd1.Price__c = 100;
+ psd1.Quantity__c = 10;
+ psd1.Product__c = product1.id;
+
+ insert psd1;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('鍝�','1','');
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ String oppInfoc = JSON.serialize(opp);
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String setProduct_text = ps1.Id;
+ String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
+ String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
+ String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+
+ @isTest
+ static void Test12(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = 'ET24鏅傞枔璨╁2';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ opp.Is_Corrosion__c=true;
+ opp.SAP_Province__c='涓婃捣甯�';
+ insert opp;
+ Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss();
+ lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexNewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','','');
+ PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ quoteflg = true;
+ lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ lexNewQuoteEntryController.setOppFromOppInfo();
+
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexSINewQuoteEntryController.cls b/force-app/main/default/classes/lexSINewQuoteEntryController.cls
new file mode 100644
index 0000000..a30f0e0
--- /dev/null
+++ b/force-app/main/default/classes/lexSINewQuoteEntryController.cls
@@ -0,0 +1,2645 @@
+// Author: Fu,Yu
+// Created Date: 2023/08/07
+// Purpose: get page layout and record data
+// Test Class: lexSINewQuoteEntryControllerTest
+public class lexSINewQuoteEntryController {
+ public static Integer quoteEntryMaxLine;
+ public static List<QELine> activities;
+ public static List<QELine> tmpactivities;
+ public static List<QuoteLineItem> CheckItem;
+ public static Boolean WinOrDecideAlert;
+ public static Boolean errorflg;
+ public static String errormessage;
+ public static String errormessagewarn;
+ public static Map<Id, Product2> prd2LatestValMap;
+ public static Boolean productStatusUpdated;
+ public static Opportunity opp;
+ public static Quote quo;
+ public static Boolean enableSales;
+ public static String quoId;
+ public static String oppId;
+ public static Boolean newQuoteFlag;
+ public static Boolean changedAfterPrint;
+ public static string quoteGurantee_Period;
+ public static string quotemultiYearWarranty;
+ public static Pricebook2 standardPricebook;
+ public static Boolean detail;
+ public static String selection_hp;
+ public static String quoIdreturn;
+ public static String trade;
+ public static String searchMode;
+ public static Boolean filg;
+ public static Integer flglastbuy;
+ public static String errorProductmodel;
+ public static Boolean SkipQuotefilg;
+ public static Boolean QuoteDecision;
+ //瀛楁鎶ラ敊鏍囪瘑 start
+ public static Boolean dfpp = false;
+ public static Boolean qname = false;
+ public static Boolean qacc = false;
+ public static Boolean qaapc = false;
+ public static Boolean Agency1 = false;
+ public static Boolean nAgency1 = false;
+ public static Boolean oapp = false;
+ public static Boolean noapp = false;
+ public static Boolean Agency2 = false;
+ public static Boolean nAgency2 = false;
+ public static Boolean aapp = false;
+ public static Boolean naapp = false;
+ //瀛楁鎶ラ敊鏍囪瘑 end
+ public static Boolean hongzi = false;
+ @AuraEnabled
+ //鏍规嵁鎶ヤ环Id妫�绱㈡姤浠�
+ public static Quote selectQuoteById(String quoId){
+ Quote quo = new Quote();
+
+ if(String.isNotBlank(quoId)){
+ List<Quote> quoList =
+ [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
+ Dealer_Final_Price__c, TotalPrice__c, Estimation_List_Price__c, QuoteNumber,
+ CreatedByid,Queto_Confirm_Date__c,
+ QuoteToName, Quote_Expiration_Date__c, Quote_Comment__c, Stocking_Price__c, Unit_Price__c,
+ Offer_Amount__c, TOTAL__c, Discount__c, Pricing__c, Preferential_Trading_Price__c, Contract__c,
+ Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Print_HP_Name__c,
+ Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_No__c,
+ 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,
+ Preferential_Gurantee_Period__c,LineItemCount
+ ,IsQuoteTrial__c,OpportunityId,Opportunity.RecordType.DeveloperName
+ FROM Quote Where Id = :quoId];
+ quo = quoList[0];
+ }
+
+ return quo;
+ }
+ //妫�绱㈡姤浠疯椤圭洰琛屾暟
+ @AuraEnabled
+ public static List<Quote> selectQuoteListLineItemCount(String quoId,String oppId,String copyid){
+ List<Quote> quoList = new List<Quote>();
+ if(String.isBlank(oppId)){
+ if(String.isNotBlank(quoId)){
+ quoList = [select Id, OpportunityId, Opportunity.RecordType.DeveloperName,LineItemCount From Quote Where Id = :quoId];
+ }
+ }else{
+ if(String.isBlank(copyid)){
+ quoList =[select Id, OpportunityId,LineItemCount From Quote Where OpportunityId = :oppId];
+ }
+ }
+ return quoList;
+ }
+ //妫�绱㈡姤浠疯椤圭洰
+ @AuraEnabled
+ public static String selectQuoteLineItem(String quoId,String copyid){
+ List<QuoteLineItem> items =
+ [Select Id, Asset_Model_No__c, SFDA_Status__c, Product_Sales_Possibility__c,ProductSetName__c,
+ Name__c, BSS_Category__c, Quote.Quote_Print_Date__c,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c,
+ Qty_Unit__c, Cost__c, UnitPrice__c, ListPrice__c, Quantity, TotalPrice__c,
+ PricebookEntry.Product2.SFDA_Status__c, ProductCode__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name,
+ PricebookEntryId, PricebookEntry.Product2Id, UnitPrice_Page__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.StorageStatus__c
+ , AgencyUnitPrice__c, AgencySubtotal__c, Present__c
+ , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c,
+ ServicePrice__c , GuranteePrice__c, ProductEntend_gurantee_period_all__c,
+ ProductGuranteePrice__c, GuranteeType__c,
+ warrantyType__c, productServicePrice__c, NoDiscountTotal__c
+ , provistonPeriod__c
+ , PricebookEntry.Product2.Entend_gurantee_period_all__c
+ , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c
+ , PricebookEntry.Product2.Intra_Trade_Service_RMB__c
+ , PricebookEntry.Product2.GuranteeType__c
+ , PricebookEntry.Product2.Maintenance_Price_Year__c
+ , Maintenance_Price_Year__c
+ ,PricebookEntry.Product2.Repair_Contract_USD__c
+ ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c
+ ,PricebookEntry.Product2.NoDiscount_Foreign__c
+ ,PricebookEntry.Product2.LastbuyProductFLG__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,PricebookEntry.Product2.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ ,Quote.Opportunity.Trade__c
+ ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c
+ From QuoteLineItem where Quoteid = :quoId Order by Item_Order__c, Id];
+ activities = new List<QELine>();
+ QELine cle = new QELine();
+ Integer i = 0;
+ if (items.size() > 0) {
+ for (QuoteLineItem olt : items) {
+ i++;
+ cle = new QELine(olt,i, copyid);
+ activities.add(cle);
+ }
+ }
+ return JSON.serialize(activities)+'---'+JSON.serialize(items);
+ }
+ //妫�绱㈢櫥褰曚汉淇℃伅
+ @AuraEnabled
+ public static User selecUser(){
+ User usobj =new User();
+ List<User> us = new List<User>();
+ String userid = UserInfo.getUserId();
+ if (userid != null) {
+ us = [Select Id,Quote_Correct__c, Quote_Special_Operation__c, Cost_Referable__c, ViewSpecialAgencyAmout__c,ProfileId From User Where Id = :userid];
+ if (us.size() > 0) {
+ usobj = us[0];
+ }
+ }
+ return usobj;
+ }
+ @AuraEnabled
+ public static Boolean getquoDes() {
+ Schema.DescribeSObjectResult quoteDesc = Quote.SObjectType.getDescribe();
+ return quoteDesc.isUpdateable();
+ }
+ @AuraEnabled
+ public static Boolean QuotCalfagAss(){
+ String ProfileId= UserInfo.getProfileId().subString(0,15);
+ String QuotationCalculationPermission = System.Label.QuotationCalculationPermission;
+ return QuotationCalculationPermission.contains(ProfileId);
+ }
+ //鏍规嵁璇环Id妫�绱㈣浠�
+ @AuraEnabled
+ public static Opportunity selectOpportunityById(String oppId){
+ Opportunity opp = new Opportunity();
+ List<Opportunity> oppList =[SELECT Account.Name,BusinessFileArchived__c, Account.RecordType.DeveloperName,Opportunity_sub_owner__c,
+ CLBIC_Category__c, HP_Name__c, Name, CurrencyIsoCode, Wholesale_Price__c, Department_Name__c,
+ Direct_Separate__c, Trade__c, AccountId, New_Opportunity__c, Estimation_Decision__c, SAP_Send_OK__c, Sales_Root__c,
+ 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
+ , Hospital__c, Department_Class__c
+ ,Is_Corrosion__c,
+ If_Need_PriceApply__c
+ ,CelonOpportunity__c
+ , If_Account_Change__c
+ ,Configuration_Suggestion__c , Configuration_Suggestion_Feedback__c
+ , Salesdepartment_Owner__c
+ ,Opportunity_Category__c
+ FROM Opportunity Where Id = :oppId];
+ if (oppList.size() > 0) {
+ opp = oppList[0];
+ }
+ return opp;
+ }
+ //妫�绱㈣浠疯椤圭洰
+ // @AuraEnabled
+ // public static String selectOpportunityLineItem(String oppId){
+ // List<OpportunityLineItem> items = New List<OpportunityLineItem>();
+ // items = [Select Id, Asset_Model_No__c, SFDA_Status__c, Name__c, ProductCode__c, PricebookEntry.Product2.StorageStatus__c,
+ // Qty_Unit__c, Cost__c, UnitPrice, ListPrice__c, Quantity, BSS_Category__c, TotalPrice,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c,
+ // PricebookEntry.Product2.SFDA_Status__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name,
+ // PricebookEntryId, PricebookEntry.Product2Id, Opportunity.Trade__c, PricebookEntry.Product2.Intra_Trade_List_RMB__c, PricebookEntry.Product2.Intra_Trade_Cost_RMB__c,
+ // PricebookEntry.Product2.Foreign_Trade_List_US__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.Foreign_Trade_Cost_US__c, UnitPrice__c, TotalPrice__c
+ // , AgencyUnitPrice__c, AgencySubtotal__c, Present__c
+ // , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c,
+ // ServicePrice__c , GuranteePrice__c,
+ // ProductEntend_gurantee_period_all__c,
+ // ProductGuranteePrice__c, GuranteeType__c,
+ // warrantyType__c, productServicePrice__c,
+ // NoDiscountTotal__c
+ // , provistonPeriod__c
+ // , PricebookEntry.Product2.Entend_gurantee_period_all__c
+ // , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c
+ // , PricebookEntry.Product2.Intra_Trade_Service_RMB__c
+ // , PricebookEntry.Product2.GuranteeType__c
+ // , PricebookEntry.Product2.Maintenance_Price_Year__c
+ // , Maintenance_Price_Year__c
+ // ,PricebookEntry.Product2.Repair_Contract_USD__c
+ // ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c
+ // ,PricebookEntry.Product2.NoDiscount_Foreign__c
+ // ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c
+ // From OpportunityLineItem
+ // Where OpportunityId = :oppId Order by Item_Order__c, Id];
+
+ // activities = new List<QELine>();
+ // QELine cle = new QELine();
+ // if (items.size() > 0) {
+ // for(OpportunityLineItem otlt : items) {
+ // cle = new QELine(otlt);
+ // activities.add(cle);
+ // }
+ // }
+ // return JSON.serialize(activities);
+ // }
+ //妫�绱骇鍝�
+ @AuraEnabled
+ public static List<Product2> selectProById(String proList){
+ List<String> product2Ids = (List<String>)JSON.deserialize(proList,List<String>.class);
+ List<Product2> plo =
+ [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c,Packing_list_manual__c
+ , Intra_Trade_Gurantee_RMB__c,
+ Intra_Trade_Service_RMB__c
+ From Product2 Where Id IN :product2Ids];
+ return plo;
+ }
+ //妫�绱㈠鎴�
+ @AuraEnabled
+ public static List<Account> selectAccountById(String accountid){
+ List<Account> accs2 = [Select Id, RecordType.DeveloperName, Hospital__c, Agent_Ref__c From Account Where Id = :accountid];
+ List<Account> accs = new List<Account>();
+ if (accs2.size() > 0) {
+ if (accs2[0].RecordType.DeveloperName != 'AgencyContract') {
+ accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Hospital__c];
+ } else {
+ accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Agent_Ref__c];
+ }
+ }
+ return accs;
+ }
+ //妫�绱笅鎷夊垪琛ㄥ��
+ @AuraEnabled
+ public static List<Map<String,String>> getPicklistValues(String objstr, String fld ,Boolean ifempty){
+ List<Map<String,String>> options = new List<Map<String,String>>();
+ Map<String,String> space = new Map<String,String>();
+ if(ifempty){
+ space.put('label', '--鏃�--');
+ space.put('value', '');
+ options.add(space);
+ }
+
+ Schema.sObjectType objType = Schema.getGlobalDescribe().get(objstr);
+ Schema.DescribeSObjectResult objDescribe = objType.getDescribe();
+ map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap();
+ list<Schema.PicklistEntry> values = fieldMap.get(fld).getDescribe().getPickListValues();
+ system.debug(objstr + '=' + values);
+ for (Schema.PicklistEntry a : values)
+ {
+ if (!a.isActive()) continue;
+ Map<String,String> ses = new Map<String,String>();
+ ses.put('label', a.getLabel());
+ ses.put('value', a.getValue());
+ options.add(ses);
+ }
+ return options;
+ }
+ @AuraEnabled
+ public static Map<String,String> SaveQuote(String activitiesCan,
+ String CheckItemCan ,
+ boolean WinOrDecideAlertc,
+ boolean productStatusUpdatedc,
+ String oppInfoc,
+ boolean enableSalesc,
+ String quoc,
+ String oppIdc,
+ String quoIdc,
+ boolean newQuoteFlagc,
+ Boolean changedAfterPrintc,
+ String quoteGurantee_Periodc,
+ String quotemultiYearWarrantyc,
+ String selection_hpc,
+ Boolean SkipQuotefilgc,
+ Boolean quoteflg){
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ oppId = oppIdc;
+ quoId = quoIdc;
+ System.debug('quoId+'+quoId);
+ WinOrDecideAlert = WinOrDecideAlertc;
+ productStatusUpdated = productStatusUpdatedc;
+ newQuoteFlag = newQuoteFlagc;
+ changedAfterPrint = changedAfterPrintc;
+ quoteGurantee_Period = quoteGurantee_Periodc;
+ quotemultiYearWarranty = quotemultiYearWarrantyc;
+ selection_hp = selection_hpc;
+ SkipQuotefilg = SkipQuotefilgc;
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ if(String.isNotBlank(CheckItemCan)){
+ CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class);
+ }else {
+ CheckItem = null;
+ }
+ enableSales = enableSalesc;
+ // errorMessagechack = null;
+ setOppFromOppInfo();
+ Savepoint sp = Database.setSavepoint();
+ Map<String,String> result = new Map<String,String>();
+ try {
+ //chenjingwu DB202308355043 2023.8.25 start
+ if(quoteflg){
+ // if (opp.If_Need_Authorize__c == true) {
+ // ID tmpid = opp.Agency2__c == null ? opp.Agency1__c : opp.Agency2__c;
+ // List<Account> accName = [select name from Account where id = : tmpid];
+ // if(accName.size()>0){
+ // if (accName[0].name != opp.Authorized_Finish_Sales__c) {
+ // errormessage = '璇峰厛鎺堟潈鍚庯紝鍐嶈繘琛屾姤浠疯绠椼��';
+ // result.put('errormessage', errormessage);
+ // return result;
+ // }
+ // }
+ // }
+ if(checkVirtual('鍖呭惈铏氭嫙浜у搧锛屾棤娉曟姤浠疯绠�')){
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ }
+ System.debug('suoding1');
+ if (!dataCheck()) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ return result;
+ }
+ System.debug('suoding2');
+ QuoteConfirm(quoId);
+ System.debug('suoding3');
+ if (dataEntry() == false) {
+ result.put('errormessage', errormessage);
+ return result;
+ } else {
+ result.put('success', System.Label.Message_002);
+ if(String.isBlank(quoId)){
+ result.put('quoId',quoIdreturn);
+ }
+ if(String.isNotBlank(quo.Quote_No__c)){
+ result.put('QuoteNo',quo.Quote_No__c);
+ }
+ if(errormessagewarn != null){
+ result.put('warn', errormessagewarn);
+ String act = JSON.serialize(activities);
+ result.put('act', act);
+ }
+ return result;
+ }
+ } catch (DmlException de) {
+ Database.rollback(sp);
+ // errormessage = de.getLineNumber()+'琛�'+de.getDmlMessage(0);
+ errormessage = de.getDmlMessage(0);
+ result.put('errormessage',errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, de.getMessage());
+ // system.debug(Logginglevel.ERROR, de.getStackTraceString());
+ } catch (Exception e) {
+ Database.rollback(sp);
+ // errormessage = e.getLineNumber()+'琛�'+e.getMessage();
+ errormessage = e.getMessage();
+ result.put('errormessage', errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, e.getMessage());
+ // system.debug(Logginglevel.ERROR, e.getStackTraceString());
+ }
+ }
+ public static Map<String,String> resultFlag(Map<String,String> result){
+ if(dfpp){
+ result.put('dfpp', 'dfpp');
+ }
+ if(qname){
+ result.put('qname', 'qname');
+ }
+ if(qacc){
+ result.put('qacc', 'qacc');
+ }
+ if(qaapc){
+ result.put('qaapc', 'qaapc');
+ }
+ if(Agency1){
+ result.put('Agency1', 'Agency1');
+ }
+ if(nAgency1){
+ result.put('nAgency1', 'nAgency1');
+ }
+ if(oapp){
+ result.put('oapp', 'oapp');
+ }
+ if(noapp){
+ result.put('noapp', 'noapp');
+ }
+ if(Agency2){
+ result.put('Agency2', 'Agency2');
+ }
+ if(nAgency2){
+ result.put('nAgency2', 'nAgency2');
+ }
+ if(aapp){
+ result.put('aapp', 'aapp');
+ }
+ if(naapp){
+ result.put('naapp', 'naapp');
+ }
+ return result;
+ }
+ @AuraEnabled
+ public static Map<String,String> Print(String activitiesCan,
+ String CheckItemCan ,
+ boolean WinOrDecideAlertc,
+ boolean productStatusUpdatedc,
+ String oppInfoc,
+ boolean enableSalesc,
+ String quoc,
+ String oppIdc,
+ String quoIdc,
+ boolean newQuoteFlagc,
+ Boolean changedAfterPrintc,
+ String quoteGurantee_Periodc,
+ String quotemultiYearWarrantyc,
+ String selection_hpc,
+ Boolean SkipQuotefilgc,
+ Boolean QuoteDecisionc) {
+ oppId = oppIdc;
+ quoId = quoIdc;
+ System.debug('quoId+'+quoId);
+ WinOrDecideAlert = WinOrDecideAlertc;
+ productStatusUpdated = productStatusUpdatedc;
+ newQuoteFlag = newQuoteFlagc;
+ changedAfterPrint = changedAfterPrintc;
+ quoteGurantee_Period = quoteGurantee_Periodc;
+ quotemultiYearWarranty = quotemultiYearWarrantyc;
+ selection_hp = selection_hpc;
+ SkipQuotefilg = SkipQuotefilgc;
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ if(String.isNotBlank(CheckItemCan)){
+ CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class);
+ }else {
+ CheckItem = null;
+ }
+ enableSales = enableSalesc;
+ QuoteDecision = QuoteDecisionc;
+ Savepoint sp = Database.setSavepoint();
+ Map<String,String> result = new Map<String,String>();
+ try {
+ if(checkVirtual('鍖呭惈铏氭嫙浜у搧锛屾棤娉曟墦鍗�')){
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ setOppFromOppInfo();
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ //Decide鍓峯r寰�
+ if (QuoteDecision == true) {
+ //NoSave
+ } else {
+ if (dataCheck() == false ) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ return result;
+ }
+
+ if (dataEntry() == false) {
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ }
+ List<Opportunity> opps = new List<Opportunity>();
+ if (String.isBlank(oppId)) {
+ } else {
+ opps = [Select Id
+ From Opportunity Where Id = : oppId];
+ if (opps.size() > 0) {
+ List<Quote> quos = New List<Quote>();
+ //ligthing bug 淇敼 fy start
+ // if (String.isBlank(quoId)) {
+ // } else {
+ // quos = [Select Id,
+ // Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoId];
+ if(String.isNotBlank(quoId)||(String.isBlank(quoId) && String.isNotBlank(quoIdreturn))){
+ String quoIds = String.isNotBlank(quoId) ? quoId : quoIdreturn;
+ quos = [Select Id,
+ Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoIds];
+ //ligthing bug 淇敼 fy end
+ if (quos.size() > 0) {
+ //浼樻儬鎴愪氦浠�
+ quos[0].Preferential_Trading_Price__c = quo.Preferential_Trading_Price__c;
+ //浼樻儬鎶樻墸
+ quos[0].Discount__c = quo.Discount__c;
+ //浼樻儬浠锋牸
+ quos[0].Pricing__c = quo.Pricing__c;
+ //鍗曚环
+ quos[0].Unit_Price__c = quo.Unit_Price__c;
+ //鎶ヤ环閲戦
+ quos[0].Offer_Amount__c = quo.Offer_Amount__c;
+ //Total
+ quos[0].TOTAL__c = quo.TOTAL__c;
+ //濂戠磩鍐呭
+ quos[0].Contract__c = quo.Contract__c;
+ //澶氬勾淇濅慨 start
+ quos[0].Preferential_Gurantee_Period__c = quo.Preferential_Gurantee_Period__c;
+ //澶氬勾淇濅慨 end
+ if (quos[0].Quote_Date__c == null) {
+ quos[0].Quote_Date__c = date.Today();
+ opps[0].Estimation_Proposal_Date__c = date.Today();
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update opps[0];
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+ quos[0].Quote_Print_Date__c = date.Today();
+ ControllerUtil.updQuote(quos[0]);
+ }
+ }
+ }
+ }
+ // pageArrange();
+ result.put('success', System.Label.Message_002);
+ if(String.isBlank(quoId)){
+ result.put('quoId',quoIdreturn);
+ }
+ if(errormessagewarn != null){
+ result.put('warn', errormessagewarn);
+ }
+ return result;
+ } catch (DmlException de) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = de.getDmlMessage(0);
+ result.put('errormessage', errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, de.getMessage());
+ // system.debug(Logginglevel.ERROR, de.getStackTraceString());
+ } catch (Exception e) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = e.getMessage();
+ result.put('errormessage', errormessage);
+ return result;
+ // system.debug(Logginglevel.ERROR, e.getMessage());
+ // system.debug(Logginglevel.ERROR, e.getStackTraceString());
+ }
+ }
+ // opp銇敾闈€伄鍊ゃ倰瑷畾
+ public static void setOppFromOppInfo() {
+ opp.Agency1__c = quo.Agency1__c;
+ opp.Agency2__c = quo.Agency2__c;
+ }
+ //淇濆瓨chaeck
+ public static Boolean dataCheck() {
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ Boolean error = false;
+ Boolean error1 = false;
+ integer Gcnt = 0;
+ String lines = '';
+ system.debug(oppId+'^^^^^^^'+lines);
+ if(oppId != null){
+ lines = ControllerUtil.setQuote(oppId);
+ }
+ system.debug(oppId+'^^^^^^^'+lines);
+ if(lines!='Fin'){
+ errorMessage = lines;
+ }
+ if (activities == null || activities.size() <= 0) {
+ errorflg = true;
+ errorMessage = '涓嶅厑璁镐繚瀛樼┖鐨勬姤浠峰崟锛岃閫夋嫨浜у搧';
+ return false;
+ }
+ if (WinOrDecideAlert && (!productStatusUpdated)) {
+ errorflg = true;
+ errorMessage = '浜у搧鐘舵�佸彂鐢熷彉鍖栵紝璇锋洿鏂�';
+ return false;
+ }
+ if (!checkSFDAStatus1(false)) {
+ errorflg = true;
+ errormessage = '璇锋洿鏂颁笉鍙攢鍞殑浜у搧銆�';
+ return false;
+ }
+ List<String> product2Ids = new List<String>();
+ if (activities.size() > 0) {
+ for (QELine a : activities) {
+ if (!String.isBlank(a.pageObject.Id__c)) {
+ product2Ids.add(a.pageObject.Id__c);
+ }
+ }
+ Map<String, String> loopMap = new Map<String, String>();
+ if (CheckItem != null) {
+ Gcnt = CheckItem.size();
+ if (CheckItem.size() > 0) {
+ for (QuoteLineItem qli : CheckItem) {
+ loopMap.put(qli.PricebookEntry.Product2Id, qli.SFDA_Status__c);
+ }
+ }
+ }
+ prd2LatestValMap = new Map<Id, Product2>();
+ integer cntPrd2 = 0;
+ for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c,LastbuyProductFLG__c
+ From Product2 Where Id IN :product2Ids]) {
+ cntPrd2 = cntPrd2 + 1;
+ System.debug('prd2.Estimation_Entry_Possibility__c'+prd2.Estimation_Entry_Possibility__c);
+ if (prd2.Estimation_Entry_Possibility__c != '鈼�') {
+ error1 = true;
+ }
+ if (prd2.Estimation_Entry_Possibility__c == 'M') {
+ error1 = false;
+ }
+ if (prd2.SFDA_Status__c != loopMap.get(prd2.Id)) {
+ WinOrDecideAlert = true;
+ }
+
+ prd2LatestValMap.put(prd2.Id, prd2);
+ }
+ if (cntPrd2 != Gcnt) {
+ WinOrDecideAlert = false;
+ }
+
+ }
+ if(ContractAmountLimitJudge()){
+ return false;
+ }
+ if (error1 == true && WinOrDecideAlert == false) {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Error_Message37;
+ return false;
+ }
+
+ if (checkAgentsDeleteFlag() == false) {
+ return false;
+ }
+ if (enableSales == true && opp.Trade__c == '鍐呰部') {
+ Map<Id, String> proMap = new Map<Id, String>();
+ if (activities.size() > 0) {
+ for (QELine qli : activities) {
+ if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ proMap.put(qli.pageObject.Id__c, qli.pageObject.Name__c);
+ }
+ }
+ }
+ Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, '');
+ if (chkMap.size() > 0) {
+ errorflg = true;
+ if (chkMap.containsKey('agency')) {
+ errorflg = true;
+ errormessage = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��';
+ // return false;
+ }
+ Integer inerr = 0;
+ if (activities.size() > 0) {
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ s.haveno_Register = false;
+ s.wrong_Register = false;
+ if (chkMap.containsKey(s.pageObject.Id__c)) {
+ if (chkMap.get(s.pageObject.Id__c) == '1') {
+ s.haveno_Register = true;
+ inerr ++;
+ } else if (chkMap.get(s.pageObject.Id__c) == '2') {
+ s.wrong_Register = true;
+ inerr ++;
+ }
+ }
+ }
+ }
+ }
+ if (inerr > 0) {
+ errorflg = true;
+ errormessagewarn = '璇锋鏌ョ孩瀛楀唴瀹癸紙NMPA鐘舵�佺孩瀛楋紝涓嶅彲閿�鍞骇鍝侊紱浜у搧鍚嶇О绾㈠瓧锛岃秴杩囩粡閿�鍟嗙粡钀ヨ寖鍥达級銆�';
+ // errorMessagechack = '璇锋鏌ョ孩瀛楀唴瀹癸紙NMPA鐘舵�佺孩瀛楋紝涓嶅彲閿�鍞骇鍝侊紱浜у搧鍚嶇О绾㈠瓧锛岃秴杩囩粡閿�鍟嗙粡钀ヨ寖鍥达級銆�';
+ }
+ }
+ // Boolean isDangerError = false;
+ // Boolean isNotDangerError = false;
+ // if (activities.size() > 0) {
+ // for (QELine qli : activities) {
+ // if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ // if (opp.Is_Corrosion__c) {
+ // if(!qli.Is_DangerousChemicals){
+ // isNotDangerError =true;
+ // qli.wrong_Register = true;
+ // }
+ // }else{
+ // if(qli.Is_DangerousChemicals){
+ // isDangerError =true;
+ // qli.wrong_Register = true;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // if (opp.Is_Corrosion__c) {
+ // String str = OpportunityWebService.checkDangerItem(opp.agency1__c);
+ // if (str != 'OK') {
+ // errorflg = true;
+ // errorMessage = str;
+ // return false;
+ // }
+ // if(isNotDangerError){
+ // errorflg = true;
+ // errormessage = '褰撻樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佸繀椤诲叏閫夋嫨鍗卞寲鍝併��';
+ // return false;
+ // }
+ // }else{
+ // if(isDangerError){
+ // errorflg = true;
+ // errormessage = '褰撹浠蜂笉鏄樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佷笉鑳介�夋嫨鍗卞寲鍝併��';
+ // return false;
+ // }
+ // }
+ }
+ detail = false;
+ if ((quo.QuoteName__c == null) || (quo.QuoteName__c == '')) {
+ // quo.QuoteName__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.QuoteName__c.label;
+ error = true;
+ qname = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.Quote_Adjust_Calculate__c == null) {
+ // quo.Quote_Adjust_Calculate__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Calculate__c.label;
+ error = true;
+ qacc = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.Quote_Adjust_Amount_Page__c == null) {
+ // quo.Quote_Adjust_Amount__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Amount__c.label;
+ error = true;
+ qaapc = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.Quote_Expiration_Date__c == null) {
+ // quo.Quote_Expiration_Date__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Quote_Expiration_Date__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ //decimal temSalesAmount1 = 0; // 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗皬璁″悎璁� end
+ system.debug('activities++++----****2'+activities);
+ Decimal initPrice = 0;
+ for (QELine a : activities) {
+ if ((a.Asset_Model != null) && (a.Asset_Model != '')) {
+ if (a.pageObject.Quantity__c == null || a.pageObject.Quantity__c == 0) {
+ // a.pageObject.Quantity__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.QuoteLineItem.fields.Quantity__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (a.pageObject.UnitPrice_Page__c == null) {
+ // a.pageObject.UnitPrice__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.QuoteLineItem.fields.UnitPrice__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (a.pageObject.AgencyUnitPrice__c == null) {
+ // a.pageObject.AgencyUnitPrice__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.QuoteLineItem.fields.AgencyUnitPrice__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (a.pageObject.PricebookEntryId == null) {
+ error = true;
+ errormessage = System.Label.Error_Message27;
+ }
+ detail = true;
+ }
+ if(a.PageObject.UnitPrice_Page__c!=null){
+ initPrice += (a.VenderName=='OSH'?(a.PageObject.UnitPrice_Page__c*0.45):a.PageObject.UnitPrice_Page__c)*(a.PageObject.Quantity__c==null?0:a.PageObject.Quantity__c);
+ }
+ }
+ System.debug('initPrice'+initPrice);
+ if (enableSales == true) {
+ // LHJ Start
+ String profileId = UserInfo.getProfileId();
+ String SI_2M3_ID = System.Label.SI_2M3_ID_15;
+ String SI_2M3_Id_Bulleti = System.Label.SI_2M3_Id_Bulletin;
+ if(!profileId.left(15).equals(SI_2M3_ID)
+ && !profileId.left(15).equals(SI_2M3_Id_Bulleti)) {
+ if (quo.Agency1__c == null) {
+ // quo.Agency1__c.addError(System.Label.Error_Message3);
+ Agency1 = true;
+ String label = Schema.SObjectType.Quote.fields.Agency1__c.label;
+ error = true;
+ if(String.isNotBlank(errormessage)){
+ errormessage +='\n'+ label+':'+System.Label.Error_Message3;
+ }else {
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ }
+ }
+ System.debug('SI_2M3_ID'+SI_2M3_ID);
+ System.debug('SI_2M3_Id_Bulleti'+SI_2M3_Id_Bulleti);
+ System.debug('profileId'+profileId);
+ // LHJ End
+ if (quo.OCM_Agent1_Price_Page__c == null) {
+ // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3);
+ quo.OCM_Agent1_Price_Page__c = initPrice;
+ // String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label;
+ // error = true;
+ // errormessage = label+':'+System.Label.Error_Message3;
+ } else {
+
+ }
+ System.debug('error'+error);
+ System.debug('errormessage1'+errormessage);
+ } else {
+
+ if (opp.Agency1__c != null) {
+ // opp.Agency1__c.addError(System.Label.Error_Message30);
+ String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label;
+ error = true;
+ nAgency1 = true;
+ if(String.isNotBlank(errormessage)){
+ errormessage +='\n'+ label+':'+System.Label.Error_Message30;
+ }else {
+ errormessage = label+':'+System.Label.Error_Message30;
+ }
+ }
+ if (quo.OCM_Agent1_Price_Page__c != null) {
+ // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message30);
+ noapp = true;
+ String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message30;
+ }
+ if (opp.Agency2__c != null) {
+ // opp.Agency2__c.addError(System.Label.Error_Message30);
+ nAgency2 = true;
+ String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message30;
+ }
+ if (quo.Agent1_Agent2_Price_Page__c != null) {
+ // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message30);
+ naapp = true;
+ String label = Schema.SObjectType.Quote.fields.Agent1_Agent2_Price__c.label;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message30;
+ }
+
+ }
+ if (quo.Agency1_Profit_Rate__c >= 1000 || quo.Agency1_Profit_Rate__c <= -1000) {
+ error = true;
+ errormessage = System.Label.Error_Message38;
+ }
+ if (quo.Agency2_Profit_Rate__c >= 1000 || quo.Agency2_Profit_Rate__c <= -1000) {
+ error = true;
+ errormessage = System.Label.Error_Message38;
+ }
+
+ if (error == true) {
+ errorflg = true;
+ return false;
+ }
+ // PageArrange();
+ errorflg = false;
+ errorMessage = null;
+ return true;
+ }
+ // 浜у搧鐘舵�佸垽鏂�
+ public static boolean checkSFDAStatus1(boolean dodecide) {
+ for (QELine a : activities) {
+ if ((a.Asset_Model != null) && (a.Asset_Model != '')) {
+ if (a.pageObject.SFDA_Status__c != '鏈夊姽' &&
+ a.pageObject.SFDA_Status__c != '鏈夊姽锛堝啀鐢宠珛涓級' &&
+ a.pageObject.SFDA_Status__c != '涓嶈' &&
+ a.pageObject.SFDA_Status__c != '澶卞姽锛堟湡闄愬唴鐢熺敚娓堝湪搴蹇滐級' &&
+ // LHJ CBPR 20181221 Start
+ (a.pageObject.SFDA_Status__c != '鏆傚仠鍑哄簱锛堥暱鏈燂級') &&
+ (a.pageObject.SFDA_Status__c != '鏆傚仠鍑哄簱锛堢煭鏈燂級') &&
+ // LHJ CBPR 20181221 End
+ (a.pageObject.SFDA_Status__c != '澶卞姽锛堝啀鐢宠珛涓級' || dodecide != false)
+ ) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ public static boolean ContractAmountLimitJudge(){
+ if(opp.Sales_Root__c =='OCM鐩存帴閿�鍞�'){
+ return false;
+ }
+ Boolean error = false;
+ Double AccrualTotal=0;
+ Double sumContractAmount =0;
+ for(QELine aaa :activities){
+ // 2022-06-14 绱ф�ヤ慨澶� ssm
+ if (String.isBlank(aaa.Asset_Model)) {
+ continue;
+ }
+ if(aaa.pageObject.PricebookEntry.Product2Id!=null){
+ if(aaa.GuranteePrice==null){
+ aaa.GuranteePrice=0;
+ }
+ AccrualTotal += aaa.pageObject.Quantity__c*aaa.GuranteePrice;
+ }
+ }
+ if(quo.MultiYearWarrantyTotalPrice__c==null){
+ quo.MultiYearWarrantyTotalPrice__c=0;
+ }
+ sumContractAmount = AccrualTotal+quo.MultiYearWarrantyTotalPrice__c;
+ if(quo.OCM_Agent1_Price_Page__c<=sumContractAmount){
+ error = true;
+ errorflg = true;
+ errormessage = '棰勬祴閲戦涓鸿礋鏁帮紝璇锋纭~鍐欏悎鍚岄噾棰濄��';
+ }
+ if(quo.multiYearWarranty__c){
+ if(quo.OCM_Agent1_Price_Page__c<=0){
+ error = true;
+ errorflg = true;
+ errormessage = '棰勬祴閲戦涓鸿礋鏁帮紝璇锋纭~鍐欏悎鍚岄噾棰濄��';
+ }
+ }
+ return error;
+ }
+ public static Boolean checkAgentsDeleteFlag() {
+ // Check Agents
+ List<Id> accIds = new List<Id>();
+ if (opp.Agency1__c != null) {
+ accIds.add(opp.Agency1__c);
+ }
+ if (opp.Agency2__c != null) {
+ accIds.add(opp.Agency2__c);
+ }
+ if (accIds.size() > 0) {
+ List<Account> agentAccs = [SELECT Id, Delete_Flag__c, Is_Active_Formula__c, Sales_Shop_Class__c FROM Account WHERE Id IN :accIds];
+ String activeFormula1 = null, activeFormula2 = null;
+ for (Account local : agentAccs) {
+ if (local.Sales_Shop_Class__c == '鍖荤枟淇悊缁忛攢鍟�') {
+ // PageArrange();
+ errorflg = true;
+ if (local.Id == opp.Agency1__c) {
+ errorMessage = '璇风‘璁ょ涓�缁忛攢鍟嗙殑缁忛攢鍟嗚祫璐�';
+ return false;
+ }
+ }
+ if (local.Id == opp.Agency1__c) {
+ activeFormula1 = local.Is_Active_Formula__c;
+ }
+ }
+ for (Account local : agentAccs) {
+ if (local.Id == opp.Agency2__c) {
+ activeFormula2 = local.Is_Active_Formula__c;
+ }
+ }
+ if (activeFormula1 == '鏃犳晥' && activeFormula2 == '鏃犳晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Agent1_and_Agent2_were_Deleted;
+ return false;
+ } else if (activeFormula1 == '鏃犳晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Agent1_was_Deleted;
+ return false;
+ } else if (activeFormula2 == '鏃犳晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = System.Label.Agent2_was_Deleted;
+ return false;
+ }
+ }
+ // 鍐呰部銇牬鍚圕heck Agency1
+ if (opp.Agency1__c != null && opp.Trade__c == '鍐呰部') {
+ Account acc = [select Sales_Shop_Class__c, Business_Authorization_No__c, Business_Paper_Expiration_Date__c,
+ Tax_Practice_No__c, Tax_Practice_Expiration_Date__c, Medical_Equipment_Num__c, Is_Active_Formula__c,
+ Medical_Equipment_Expiration_Date__c from Account where Id = :opp.Agency1__c];
+ //缁忛攢鍟嗗垎绫诲彧鏈夌壒绾︺�佷竴绾ф垨鑰呴泦涓噰璐墠鍙互杩涜鎶ヤ环
+ List<String> salesClazz = new List<String> {'鐗圭磩璨╁2搴楋紙鍖哄煙锛�', '鐗圭磩璨╁2搴楋紙瑁藉搧锛�', '鐗圭磩璨╁2搴楋紙瑁藉搧+鍖哄煙锛�', '涓�绱氳博澹插簵', '闆嗛噰缁忛攢鍟�'};
+ // 鏈夋晥/鏃犳晥锛堝叕寮忥級!= 鏈夋晥
+ if (acc.Is_Active_Formula__c != '鏈夋晥') {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = '璇烽�夋嫨鏈夋晥鐨勭粡閿�鍟�';
+ return false;
+ }
+ else if(!salesClazz.contains(acc.Sales_Shop_Class__c)){
+ // PageArrange();
+ errorflg = true;
+ errorMessage = '缁忛攢鍟�1鐨勭粡閿�鍟嗗垎绫讳负锛氱壒绾︼紝涓�绾э紝闆嗕腑閲囪喘鎵嶅彲浠ユ姤浠�';
+ return false;
+ }else if (!(String.isBlank(acc.Tax_Practice_No__c) == false
+ && (acc.Tax_Practice_Expiration_Date__c == null || acc.Tax_Practice_Expiration_Date__c >= Date.today())
+ && String.isBlank(acc.Medical_Equipment_Num__c) == false
+ && acc.Medical_Equipment_Expiration_Date__c != null && acc.Medical_Equipment_Expiration_Date__c >= Date.today()
+ && String.isBlank(acc.Business_Authorization_No__c) == false
+ && acc.Business_Paper_Expiration_Date__c != null && acc.Business_Paper_Expiration_Date__c >= Date.today())
+ ) {
+ // PageArrange();
+ errorflg = true;
+ errorMessage = '璇风‘璁ょ涓�缁忛攢鍟嗙殑缁忛攢鍟嗚祫璐�';
+ return false;
+ }else {}
+ }
+ return true;
+ }
+ //淇濆瓨閫昏緫
+ public static boolean dataEntry() {
+ system.debug('activities++++----****3'+activities);
+ Boolean ifdecide=checkIsDecide();
+ standardPricebook = ControllerUtil.getStandardPricebook();
+ if(!ifdecide){
+
+ List<Quote> maxQuote_No = [select Quote_No__c From Quote Where OpportunityId = :oppid and (not Quote_No__c like '%Old') order by Quote_No_last2__c desc NULLS LAST limit 1];
+ String oppNo;
+ Integer l = 1;
+ if (maxQuote_No.size() > 0) {
+ try {
+ oppNo = maxQuote_No[0].Quote_No__c;
+ l = Integer.valueOf(oppNo.substring(oppNo.length() - 2)) + 1;
+ } catch (System.TypeException e) {
+ system.debug('maxQuote_No Error: quote.id=' + maxQuote_No[0].id);
+ }
+ } else {
+ system.debug('first Quote');
+ }
+ oppNo = '00' + String.valueof(l);
+ oppNo = oppNo.substring(oppNo.length() - 2);
+
+ Quote q = New Quote();
+ if (changedAfterPrint) {
+ system.debug('id绌�1锛�');
+ quoId = null;
+ SkipQuotefilg = true;
+ }
+ // if (changedAfterBid) {
+ // system.debug('id绌�1锛�');
+ // quoId = null;
+ // SkipQuotefilg = true;
+ // }
+ // CHAN-AVG3PW 璇环鎶ヤ环鐢婚潰瑙勫垯鍙樻洿
+ // if (quo.CreatedByid !=null && quo.CreatedByid != UserInfo.getUserId() ){
+ // system.debug('id绌�3锛�');
+ // quoId = null;
+ // SkipQuotefilg = true;
+ // }
+ if ((quoteGurantee_Period != null &&
+ !quoteGurantee_Period.equals(quo.Gurantee_Period__c))
+ ||
+ (quotemultiYearWarranty != null &&
+ !quotemultiYearWarranty.equals('' + quo.multiYearWarranty__c))
+ ) {
+ system.debug('id绌�8锛�');
+ quoId = null;
+ SkipQuotefilg = true;
+ }
+ if (String.isBlank(quoId)) {
+ system.debug('standardPricebook锛�'+standardPricebook);
+ q = New Quote();
+ q.OpportunityId = oppId;
+ if (detail == true) {
+ if (standardPricebook == null) {
+ errormessage = System.Label.Error_Message27;
+ errorflg = true;
+ return false;
+ } else {
+ q.Pricebook2Id = standardPricebook.Id;
+ }
+ }
+ } else {
+ List<Quote> qs = New List<Quote>();
+ qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c,
+ Stocking_Price__c, Discount_Amount__c, Discount_Amount_Calculate__c, Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c,
+ Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Quote_No__c,
+ 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
+ , Preferential_Gurantee_Period__c
+ ,IsQuoteTrial__c
+ From Quote Where Id = :quoId];
+ if (qs.size() > 0) {
+ q = qs[0];
+ }
+ if (q.Pricebook2Id == null) {
+ if (detail == true) {
+ if (standardPricebook == null) {
+ errormessage = System.Label.Error_Message27;
+ errorflg = true;
+ return false;
+ } else {
+ q.Pricebook2Id = standardPricebook.Id;
+ }
+ }
+ }
+ }
+ if (String.isBlank(quoId)) {
+ q.Quote_No__c = opp.Opportunity_No__c + '-' + oppNo;
+ q.PriceRefreshDate__c = Date.today();
+ }
+ if (productStatusUpdated) {
+ q.PriceRefreshDate__c = Date.today();
+ }
+ List<String> pIds = new List<String>();
+ system.debug('activities++++----****1'+activities);
+ for (QELine s : activities) {
+ if (String.isBlank(s.pageObject.Id__c) == false) {
+ pIds.add(s.pageObject.Id__c);
+ }
+ }
+ List<Product2> pList = [select Id from Product2 where Id in :pids and Category3__c = '涓绘満'];
+ if (pList.size() > 0) q.HasType3Machine__c = true;
+ q.Name = quo.QuoteName__c;
+ q.Estimation_List_Price__c = quo.Estimation_List_Price__c;
+ q.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c;
+ q.OCM_Sales_Forecast__c = quo.OCM_Sales_Forecast__c;//棰勬祴閲戦淇敼 fy
+ q.Stocking_Price__c = quo.Stocking_Price__c;
+ q.Quote_Adjust_Amount__c = quo.Quote_Adjust_Amount_Page__c;
+ q.Quote_Adjust_Calculate__c = quo.Quote_Adjust_Calculate__c;
+ q.Discount_Amount__c = quo.Discount_Amount__c;
+ q.Discount_Amount_Calculate__c = quo.Discount_Amount_Calculate__c;
+ q.Agency1__c = opp.Agency1__c;
+ q.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c;
+ q.Agency1_Profit__c = quo.Agency1_Profit__c;
+ q.AgencyDiscount__c = quo.AgencyDiscount__c;
+ q.Gurantee_Period__c = quo.Gurantee_Period__c;
+ q.multiYearWarranty__c = quo.multiYearWarranty__c;
+ q.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c;
+ q.quoteSavedDate__c = Date.today();
+ q.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c;
+ q.Agency2__c = opp.Agency2__c;
+ q.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c;
+ q.Agency2_Profit__c = quo.Agency2_Profit__c;
+ q.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c;
+ q.Opportunity_sub_owner__c = opp.Opportunity_sub_owner__c;
+ q.Print_HP_Name__c = selection_hp;
+ q.Quote_Expiration_Date__c = quo.Quote_Expiration_Date__c;
+ q.Quote_Comment__c = quo.Quote_Comment__c;
+ q.Installation_location__c = quo.Installation_location__c;
+ q.QuotationChange__c = quo.QuotationChange__c;
+ q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c;
+ q.Interdepartmental__c = quo.Interdepartmental__c;
+ if(!quo.IsQuoteTrial__c){
+ q.IsQuoteTrial__c = quo.IsQuoteTrial__c;
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ List<Id> idList = new List<Id>();
+ for (QELine s : activities) {
+ if (String.isNotBlank(s.pageObject.PricebookEntryId)) {
+ idList.add(s.pageObject.PricebookEntryId);
+ }
+ }
+ List<PricebookEntry> pb = [select Id from PricebookEntry where Product2.Category5__c = '铏氭嫙' and Id in: idList];
+ q.Have_Virtual__c = false;
+ if(pb.size() > 0){
+ q.Have_Virtual__c = true;
+ }
+ //chenjingwu DB202308355043 2023.8.25 end
+ if (String.isBlank(quoId)) {
+ insert q;
+ quo.Quote_No__c = q.Quote_No__c;
+ // quo.IsQuoteTrial__c = q.IsQuoteTrial__c;
+ // isQuoteTrialOnInit = q.IsQuoteTrial__c;
+ } else {
+ update q;
+ }
+ List<QuoteLineItem> qlist = New List<QuoteLineItem>();
+ qlist = [Select Id From QuoteLineItem Where QuoteId = :quoId];
+ if (qlist.size() > 0) {
+ delete qlist;
+ }
+ qlist = New List<QuoteLineItem>();
+ List<String> product_lines = new List<String>();
+ Boolean Is_Eng2_Opp = false;
+ Integer i = 1;
+ if (activities.size() > 0) {
+ system.debug('activities++++----****'+activities);
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ if (s.pageObject.PricebookEntryId != null) {
+ QuoteLineItem ql = s.pageObject.clone();
+ ql.Quantity = ql.Quantity__c;
+ ql.UnitPrice = 0;
+ ql.QuoteId = q.Id;
+ ql.ProductSetName__c = s.Product_Set_Name;
+ ql.Name__c = s.pageObject.Name__c;
+ ql.Cost__c = s.Cost_c;
+ ql.Cost_Subtotal__c = s.Cost_Subtotal_c;
+ // s.pageObject.Cost__c = s.Cost_c;
+ // s.pageObject.Cost_Subtotal__c = s.Cost_Subtotal_c;
+ ql.UnitPrice__c = ql.UnitPrice_Page__c;
+ ql.UnitPrice_Page__c = 0;
+ ql.ListPrice__c = s.ListPrice_Page;
+ ql.GuranteePrice__c = s.GuranteePrice;
+ ql.ProductGuranteePrice__c = s.ProductGuranteePrice;
+ ql.Maintenance_Price_Year__c = s.Maintenance_Price_Year;
+ ql.CanNotCancelFlag__c = s.CanNotCancelledGurantee;
+ ql.SFDA_Status__c = prd2LatestValMap.get(s.pageObject.Id__c).SFDA_Status__c;
+ ql.Item_Order__c = i;//棰勬祴閲戦淇敼 fy
+ if (s.pageObject.Subtotal__c != null && quo.OCM_Sales_Forecast__c != null && quo.QuoteTotal_Page__c != null) {
+ if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//棰勬祴閲戦淇敼 fy
+ ql.OCM_Sales_Forecast__c = quo.OCM_Sales_Forecast__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c);
+ }
+ }
+ qlist.add(ql);
+ product_lines.add(s.pageObject.PricebookEntryId);
+ i++;
+ }
+ }
+ }
+ system.debug('qlist+++---+++'+qlist);
+ insert qlist;
+ }
+ system.debug('鈼嬧棆鈼嬧棆鈼婼ave2鈼嬧棆鈼嬧棆鈼�');
+ List<PricebookEntry> entrys = product_lines!= null && product_lines.size() > 0 ? [select Id from PricebookEntry where Id in :product_lines and Product2.ENG_New__c = 'ENG2'] : null;
+ Is_Eng2_Opp = entrys != null && entrys.size() > 0 ? true : false;
+ Opportunity o = New Opportunity();
+ List<Opportunity> os = New List<Opportunity>();
+ os = [select Id, Estimation_List_Price__c, Dealer_Final_Price__c, Estimation_List_Price_Without_Tax__c,
+ Stock_Submit_Date__c,Stock_Confrim_Date__c,
+ Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Stocking_Price__c,
+ Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_Update_Sum__c , Hospital__c,Is_Corrosion__c
+ ,StageName ,OlyNumberHosts__c
+ From Opportunity Where Id = :oppid];
+ if (os.size() > 0) {
+ o = os[0];
+ o.Estimation_List_Price__c = quo.Estimation_List_Price__c;
+ o.Wholesale_Price__c = q.OCM_Sales_Forecast__c;//棰勬祴閲戦淇敼 fy
+ o.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c;
+ o.Agency1__c = opp.Agency1__c;
+ o.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c;
+ o.Agency1_Profit__c = quo.Agency1_Profit__c;
+ o.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c;
+ o.Agency2__c = opp.Agency2__c;
+ o.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c;
+ o.Agency2_Profit__c = quo.Agency2_Profit__c;
+ o.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c;
+ o.Stocking_Price__c = quo.Stocking_Price__c;
+ o.Estimation_No__c = q.Quote_No__c;
+ o.Estimation_Name__c = q.Name;
+ o.Estimation_Id__c = q.Id;
+ o.Installation_location__c = q.Installation_location__c;
+ o.HasType3Machine__c = q.HasType3Machine__c;
+ o.AgencyDiscount__c = quo.AgencyDiscount__c;
+ o.Gurantee_Period__c = quo.Gurantee_Period__c ;
+ o.multiYearWarranty__c = quo.multiYearWarranty__c ;
+ o.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c ;
+ o.quoteSavedDate__c = Date.today();
+ // o.OlyNumberHosts__c = 0;
+ // List<String> oppIds = New List<String>();
+ // List<String> product2Ids = New List<String>();
+ // Map<String,Decimal> product2IdsMap = new Map<String,Decimal>();
+ // if (activities.size() > 0) {
+ // for (QELine a : activities) {
+ // if(String.isBlank(a.pageObject.Id__c) == false) {
+ // product2Ids.add(a.pageObject.Id__c);
+ // product2IdsMap.put(a.pageObject.Id__c,a.pageObject.Quantity__c);
+ // }
+ // }
+ // for (Product2 prod : [Select Id,ProductClass__c From Product2 Where Id IN :product2Ids]) {
+ // if(o.StageName == '寮曞悎' || o.StageName == '娉ㄦ畫' || o.StageName == '鍑鸿嵎' || o.StageName == '瀹屼簡'){
+ // if(prod.ProductClass__c == '涓绘満'){
+ // if(product2IdsMap.containsKey(prod.Id)){
+ // o.OlyNumberHosts__c += product2IdsMap.get(prod.Id);
+ // oppIds.add(o.Id);
+ // ControllerUtil.UpdateBiddingFlag(oppIds);
+ // }
+ // }else{
+ // o.OlyNumberHosts__c += 0;
+ // }
+ // }
+ // }
+ // }
+ if(quoId==null && UserInfo.getProfileId() != System.Label.ProfileId_2S6){
+ o.Stock_Submit_Date__c = null;
+ o.Stock_Confrim_Date__c = null;
+ }
+ if (o.Quote_Update_Sum__c == null) {
+ o.Quote_Update_Sum__c = 1;
+ } else {
+ o.Quote_Update_Sum__c = o.Quote_Update_Sum__c + 1;
+ }
+ o.ENG2_Opp__c = Is_Eng2_Opp;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update o;
+
+
+ //OpportunityLineItem--------------------------------------------
+ List<OpportunityLineItem> ols = New List<OpportunityLineItem>();
+ OpportunityLineItem ol = New OpportunityLineItem();
+ ols = [select Id, Quantity from OpportunityLineItem Where OpportunityId = :oppid];
+ if (ols.size() > 0) {
+ ControllerUtil.delOppLine(ols);
+ }
+ i = 1;
+ ols = New List<OpportunityLineItem>();
+ if (activities.size() > 0) {
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ if (s.pageObject.PricebookEntryId != null) {
+ ol = New OpportunityLineItem();
+ ol.OpportunityId = oppid;
+ ol.Id__c = s.pageObject.Id__c;
+ // ol.SFDA_Status__c = s.pageObject.SFDA_Status__c;
+ ol.SFDA_Status__c = prd2LatestValMap.get(s.pageObject.Id__c).SFDA_Status__c;
+ ol.Name__c = s.pageObject.Name__c;
+ ol.ListPrice__c = s.ListPrice_Page;
+ ol.Quantity = s.pageObject.Quantity__c;
+ ol.UnitPrice = 0;
+ ol.UnitPrice__c = s.pageObject.UnitPrice_Page__c;
+ ol.AgencyUnitPrice__c = s.pageObject.AgencyUnitPrice__c;
+ ol.Present__c = s.pageObject.Present__c;
+ ol.AgencySubtotal__c = s.pageObject.AgencySubtotal__c;
+ ol.GuaranteePeriod__c = s.pageObject.GuaranteePeriod__c;
+ if (opp.CurrencyIsoCode != null ) {
+ ol.multiYearWarranty__c = s.pageObject.multiYearWarranty__c;
+ ol.ServicePrice__c = s.pageObject.ServicePrice__c;
+ ol.If_Cancel_Guarantee__c = s.pageObject.If_Cancel_Guarantee__c;
+ ol.ProductEntend_gurantee_period_all__c
+ = s.pageObject.ProductEntend_gurantee_period_all__c;
+ ol.GuranteeType__c = s.pageObject.GuranteeType__c;
+ ol.NoDiscountTotal__c = s.pageObject.NoDiscountTotal__c;
+ ol.warrantyType__c = s.pageObject.warrantyType__c;
+ ol.productServicePrice__c = s.pageObject.productServicePrice__c;
+ ol.GuranteePrice__c = s.GuranteePrice;
+ ol.ProductGuranteePrice__c = s.ProductGuranteePrice;
+ ol.Maintenance_Price_Year__c = s.Maintenance_Price_Year;
+ ol.provistonPeriod__c = s.pageObject.provistonPeriod__c;
+ }
+ ol.Qty_Unit__c = s.pageObject.Qty_Unit__c;
+ ol.Cost__c = s.pageObject.Cost__c;
+ ol.BSS_Category__c = s.pageObject.BSS_Category__c;
+ ol.CanNotCancelFlag__c = s.CanNotCancelledGurantee;//棰勬祴閲戦淇敼 fy
+ if (s.pageObject.Subtotal__c != null && o.Wholesale_Price__c != null && quo.QuoteTotal_Page__c != null) {
+ if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//棰勬祴閲戦淇敼 fy
+ ol.OCM_Sales_Forecast__c = o.Wholesale_Price__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c);
+ }
+ }
+ ol.PricebookEntryId = s.pageObject.PricebookEntryId;
+ ol.Item_Order__c = i;
+ ols.add(ol);
+ i++;
+ }
+ }
+ }
+ ControllerUtil.insOppLine(ols);
+ }
+
+ } else {
+ system.debug('*****SystemError OpportunityId is Null*****');
+ }
+ if (String.isBlank(quoId)) {
+ quoIdreturn = q.Id;
+ // newQuoteFlag = false;
+ }
+ }else{
+ errorflg = true;
+ errormessage = '璇ヨ浠峰凡缁廳ecide锛屼笉鍙啀淇敼';
+ return false;
+ }
+ return true;
+ }
+ //闃叉澶氬紑椤甸潰鍔犻獙璇佹煡璇�
+ private static boolean checkIsDecide() {
+ List<Opportunity> oppsde = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId];
+ if (oppsde.size() > 0) {
+ if(oppsde[0].Estimation_Decision__c){
+ return true;
+ }
+ }
+ return false;
+ }
+ //妫�绱㈡柊寤烘姤浠蜂骇鍝�
+ @AuraEnabled
+ public static List<PricebookEntry> serContact(String tradec,String SearchName,String celon){
+ trade = tradec;
+ String x = '脳';
+ String searchSql = 'select Id,Product2Id,Product2.Name,Product2.ProductCode,Product2.StorageStatus__c,Product2.OT_CODE_no_link__c, Product2.Alternative_Products__c, '
+ + 'Product2.Foreign_Trade_Cost_US__c, Product2.Foreign_Trade_List_US__c, Product2.Intra_Trade_Cost_RMB__c, Product2.Intra_Trade_List_RMB__c, '
+ + 'Product2.Asset_Model_No__c, Product2.Serial_Lot_No__c, Product2.Sales_Possibility__c, Product2.Estimation_Entry_Possibility__c, '
+ + 'Product2.SFDA_Status__c, Product2.Qty_Unit__c, Product2.BSSCategory__c, Product2.Asset_loaner_category__c, Product2.Packing_list_manual__c '
+ + ' ,Product2.Extend_new_product_gurantee_MD__c , Product2.Extend_new_product_gurantee__c , Product2.Entend_gurantee_period_all__c , '
+ + ' Product2.Intra_Trade_Gurantee_RMB__c '
+ + ',Product2.Intra_Trade_Foreign_RMB__c,Product2.NoDiscount_Foreign__c,Product2.Repair_Contract_USD__c '
+ + ' , Product2.Intra_Trade_Service_RMB__c,Product2.CanNotCancelledGurantee__c,Product2.Is_DangerousChemicals__c '
+ + ' , Product2.GuranteeType__c , product2.VenderName__c , product2.Maintenance_Price_Year__c '
+ + ' , Product2.suitDepartment__c '
+ //chenjingwu DB202308355043 2023.8.25 start
+ + ' , Product2.Category5__c '
+ //chenjingwu DB202308355043 2023.8.25 end
+ + ' , Product2.Estimated_ConsumptionDueDate__c '
+ + 'FROM PricebookEntry ';
+ String whereStr = 'Where Product2.Asset_Model_No__c != null And Product2.Manual_Entry__c = false And Product2.Estimation_Entry_Possibility__c !=' + '\'' + x + '\' '
+ + 'AND CurrencyIsoCode =' + '\'' + String.escapeSingleQuotes(trade) + '\' '
+ + 'AND IsActive = true ';
+ String whereSql = '';
+ if (searchMode == 'CS') {
+ whereSql += 'and Product2.Asset_loaner_category__c = \'涓鸿�楁潗绠$悊\' ';
+ }
+ if (SearchName != null && SearchName != '') {
+ String likename = String.escapeSingleQuotes(SearchName);
+ String prdcd = String.escapeSingleQuotes(SearchName);
+ if (likename.indexOf('*') >= 0) {
+ likename = likename.replace('*', '%');
+ } else {
+ likename = '%' + likename + '%';
+ }
+ whereSql += 'and (Product2.Name Like ' + '\'' + likename + '\' or Product2.ProductCode = ' + '\'' + prdcd + '\' or Product2.Asset_Model_No__c Like ' + '\'' + likename + '\') ';
+ }
+ celon = String.isNotBlank(celon) ? celon : null;
+ whereSql += ' and Product2.Celon_Product__c = :celon ';
+ searchSql = searchSql + whereStr + whereSql;
+ searchSql += ' order by Product2.Asset_Model_No__c Limit 450';
+ List<PricebookEntry> pbes = Database.query(searchSql);
+ return pbes;
+ }
+ //妫�绱骇鍝侀厤濂�
+ @AuraEnabled
+ public static List<Product_Set__c> serSetContact(String SearchName,String SearchCode,String filterName){
+ String searchSql = 'Select id, name, Price__c, Product_Set_CD__c, Quantity__c,Valid_Status__c,Quote_Select_Info__c From Product_Set__c ';
+ String whereStr = 'Where Valid_Status__c = true ';
+ String whereSql = '';
+ if(SearchName != null && SearchName != ''){
+ whereSql += 'and name Like ' + '\'%' + SearchName + '%\' ';
+ }
+ if(filterName != null && filterName != ''){
+ whereSql += 'and Applicable_Department__c =\'' + filterName + '\'';
+ }
+ if(SearchCode != null && SearchCode != ''){
+ whereSql += 'and Product_Set_CD__c like ' + '\'%' + SearchCode + '%\' ';
+ }
+ searchSql = searchSql + whereStr + whereSql;
+ searchSql += ' order by Product_Set_CD__c limit 500';
+ List<Product_Set__c> cl = Database.query(searchSql);
+ return cl;
+ }
+ //浜у搧妫�绱㈤厤濂楄祴鍊�
+ @AuraEnabled
+ public static String setProductEntry(String setProduct_text,
+ String activitiesCan,
+ String oppInfoc,
+ String quoc) {
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ setOppFromOppInfo();
+ List<String> productIDLIST = new List<String>();
+ if (setProduct_text == null) {
+ // PageArrange();
+ return JSON.serialize(activities);
+ } else {
+ productIDLIST = setProduct_text.split(',');
+ }
+ System.debug('productIDLIST-c++'+productIDLIST);
+ List<Id> productIds = null;
+ List<Product_Set_Detail__c> productSetDetails = [SELECT Id, Product__c, Quantity__c, Product_Set__r.Name,Product__r.VenderName__c,Product__r.CanNotCancelledGurantee__c,Product__r.Is_DangerousChemicals__c,Product__r.Estimated_ConsumptionDueDate__c FROM Product_Set_Detail__c Where Product_Set__c in :productIDLIST];
+ if (productSetDetails.size() == 0) {
+ // PageArrange();
+ return JSON.serialize(activities);
+ } else {
+ productIds = new List<Id>();
+ for (Product_Set_Detail__c local : productSetDetails) {
+ productIds.add(local.Product__c);
+ }
+ }
+ System.debug('productIds++'+productIds);
+ System.debug('activities++'+activities);
+ tmpactivities = activities;
+ activities = new List<QELine>();
+ boolean lineflg = false;
+ Map<Id, Product2> items = new Map<Id, Product2>();
+ List<Product2> products = [select Id, Name, ProductCode,
+ Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c,
+ Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c,
+ SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c
+ , Entend_gurantee_period_all__c
+ , Intra_Trade_Gurantee_RMB__c
+ , Intra_Trade_Service_RMB__c
+ , GuranteeType__c
+ , Maintenance_Price_Year__c
+ ,CanNotCancelledGurantee__c
+ ,Is_DangerousChemicals__c
+ ,Repair_Contract_USD__c
+ ,LastbuyProductFLG__c
+ ,Intra_Trade_Foreign_RMB__c
+ ,NoDiscount_Foreign__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ ,Estimated_ConsumptionDueDate__c
+ FROM Product2 Where Id IN :productIds
+ And Manual_Entry__c = false];
+ for (Product2 product : products) {
+ items.put(product.Id, product);
+ }
+ System.debug('items++'+items);
+ Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>();
+ List<PricebookEntry> workEntries = [
+ SELECT Id, Product2Id
+ FROM PricebookEntry Where Product2Id IN :productIds
+ AND CurrencyIsoCode = :(opp.Trade__c == '澶栬部' ? 'USD' : 'CNY')
+ AND IsActive = true
+ ];
+ for (PricebookEntry workEntry : workEntries) {
+ entries.put(workEntry.Product2Id, workEntry);
+ }
+ System.debug('entries-c++'+entries);
+ Integer i = 1;
+ Integer rightcnt = 0;
+ for (QELine t : tmpactivities) {
+ QELine a = New QELine();
+ a.lineNo = i;
+ System.debug('i-c++'+i);
+ a = t;
+ a.lineNo = i;
+ activities.add(a);
+
+ i++;
+ }
+ if (items.size() > 0) {
+ System.debug('productSetDetails-c++'+productSetDetails);
+ for (Integer l = 0; l < productSetDetails.size(); l++) {
+ Product_Set_Detail__c nowDetail = productSetDetails[l];
+ Product2 prd = items.get(nowDetail.product__c);
+ PricebookEntry pbe = entries.get(nowDetail.product__c);
+ if (pbe == null) {
+ } else {
+ QELine c = null;
+ Integer Quantity_c = nowDetail.Quantity__c > 0 ? Integer.valueOf(nowDetail.Quantity__c) : 1;
+ if (opp.Trade__c == '澶栬部') {
+ if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) {
+ c = new QELine(i, prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,nowDetail.Product_Set__r.Name,
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c,
+ prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c,
+ prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantity_c, prd.Foreign_Trade_List_US__c,
+ prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c,
+ prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Foreign_RMB__c
+ , prd.GuranteeType__c
+ , prd.NoDiscount_Foreign__c, prd.Repair_Contract_USD__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+ } else {
+ continue;
+ }
+ } else if (opp.Trade__c == '鍐呰部') {
+ if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) {
+ c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,nowDetail.Product_Set__r.Name,
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c,
+ prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c,
+ prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantity_c, prd.Intra_Trade_List_RMB__c,
+ prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c,
+ prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Gurantee_RMB__c
+ , prd.GuranteeType__c
+ , prd.Intra_Trade_Service_RMB__c
+ , prd.Maintenance_Price_Year__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+ } else {
+ continue;
+ }
+ } else {
+ continue;
+ }
+ activities.add(c);
+ i++;
+ rightcnt++;
+ lineflg = true;
+ }
+ }
+ }
+ // PageArrange();
+ if (productSetDetails.size() > 0) {
+ errorflg = true;
+ String Message = '';
+ List<String> Nl = new List<String>();
+ Map<String,String> nameMap = new Map<String,String>();
+ for(Product_Set_Detail__c Psd : productSetDetails){
+ nameMap.put(Psd.Product_Set__r.Name, Psd.Product_Set__r.Name);
+
+ }
+ for(String name : nameMap.keySet()){
+ Message += name+' ';
+ }
+ errormessage = Message + ' 瀵煎叆缁撴潫锛屽鍏� ' + productSetDetails.size() + ' 浠讹紝鎴愬姛' + rightcnt + ' 浠�';
+ }
+ System.debug('activities-to++'+activities);
+ return errormessage + '---' + JSON.serialize(activities);
+ }
+//excelImport
+@AuraEnabled
+public static String excelImport(String excel_text,
+ String activitiesCan,
+ String oppInfoc,
+ String quoc) {
+
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ setOppFromOppInfo();
+ errorflg = false;
+ errormessage = '';
+ Integer j = 0;
+ tmpactivities = activities;
+ activities = new List<QELine>();
+ Integer i = 0;
+ Integer xlscnt = 0;
+ Integer rightcnt = 0;
+
+ string[] xlslists = excel_text.split('\n', -1);
+ List<string> xlslist = New list<string>();
+ List<string> codelist = New List<string>();
+ List<Integer> Quantitylist = New List<Integer>();
+ //String str ;
+
+ Map<String, Integer> mp = new Map<String, Integer>();
+ string xlscode;
+ Integer xlsQuantity;
+
+ try {
+ for (string xls : xlslists) {
+ if (xls == null || xls == '') {
+ } else {
+ 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;
+ errormessage = System.Label.Error_Message31;
+ activities = tmpactivities;
+ // pageArrange();
+ return errormessage+'---'+JSON.serialize(activities);
+ } else {
+ s = s.trim();
+ xlsQuantity = Integer.valueOf(s);
+ Quantitylist.add(xlsQuantity);
+ }
+ } else {
+ system.debug('xlslist2+++'+s);
+ //even number
+ if (s == '' || s == null) {
+ errorflg = true;
+ errormessage = System.Label.Error_Message31;
+ activities = tmpactivities;
+ // pageArrange();
+ return errormessage+'---'+JSON.serialize(activities);
+ } else {
+ s = s.trim();
+ codelist.add(s);
+ xlscode = s;
+ }
+ }
+ i++;
+ }
+ //mp.put(xlscode, xlsQuantity);
+ xlscnt++;
+ }
+ }
+ } catch (Exception ex) {
+ system.debug('xlslist3+++'+xlscnt);
+ activities = tmpactivities;
+ errorflg = true;
+ errormessage = System.Label.Error_Message31;
+ // pageArrange();
+ return errormessage+'---'+JSON.serialize(activities);
+ }
+
+ system.debug(j);
+ system.debug('xlscnt:::::' + xlscnt);
+
+ 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 errormessage+'---'+JSON.serialize(activities);
+ }
+
+
+ i = 1;
+ boolean lineflg = false;
+ for (QELine t : tmpactivities) {
+ QELine a = New QELine();
+ a = t;
+ a.lineNo = i;
+ activities.add(a);
+ i++;
+ }
+ Map<String, Product2> mpProduct2 = new Map<String, Product2>();
+ List<Product2> items = [select Id, Name, ProductCode,
+ Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c,
+ Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c,
+ SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c
+ , Entend_gurantee_period_all__c
+ , Intra_Trade_Gurantee_RMB__c
+ , Intra_Trade_Service_RMB__c
+ , GuranteeType__c
+ , Maintenance_Price_Year__c
+ ,CanNotCancelledGurantee__c
+ ,Is_DangerousChemicals__c
+ ,Repair_Contract_USD__c
+ ,Intra_Trade_Foreign_RMB__c
+ ,NoDiscount_Foreign__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ ,Estimated_ConsumptionDueDate__c
+ FROM Product2 Where ProductCode In :codelist
+ And Manual_Entry__c = false];
+ for (Product2 prd : items) {
+ system.debug('prd.ProductCode:::::' + prd.ProductCode);
+ mpProduct2.put(prd.ProductCode, prd);
+ }
+ Map<String, PricebookEntry> entries = new Map<String, PricebookEntry>(); // key銇孭roductCode銇с仚銆�
+ List<PricebookEntry> pbes = [
+ select Id, PricebookEntry.Product2.ProductCode
+ FROM PricebookEntry Where PricebookEntry.Product2.ProductCode IN :codelist
+ AND CurrencyIsoCode = :(opp.Trade__c == '澶栬部' ? 'USD' : 'CNY')
+ AND IsActive = true];
+ for (PricebookEntry pbe : pbes) {
+ system.debug('pbe.Product2.ProductCode:::::' + pbe.Product2.ProductCode);
+ entries.put(pbe.Product2.ProductCode, pbe);
+ }
+
+ for (Integer l = 0; l < codelist.size(); l++) {
+ system.debug('codelist[l]:::::' + codelist[l]);
+ Product2 prd = mpProduct2.get(codelist[l]);
+ if (prd != null) {
+ PricebookEntry pbe = entries.get(codelist[l]);
+ QELine c = null;
+ if (pbe != null && (opp.Trade__c == '澶栬部' || opp.Trade__c == '鍐呰部')) {
+ if (opp.Trade__c == '澶栬部') {
+ if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) {
+ c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c, prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,'',
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantitylist[l], prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c, prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Foreign_RMB__c
+ , prd.GuranteeType__c
+ , prd.NoDiscount_Foreign__c,
+ prd.Repair_Contract_USD__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+
+ } else {
+ continue;
+ }
+ } else {
+ if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) {
+ c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c,
+ prd.Estimated_ConsumptionDueDate__c,'',
+ pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c,
+ Quantitylist[l], prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c, prd.Packing_list_manual__c
+ , prd.Entend_gurantee_period_all__c
+ , prd.Intra_Trade_Gurantee_RMB__c
+ , prd.GuranteeType__c
+ , prd.Intra_Trade_Service_RMB__c
+ , prd.Maintenance_Price_Year__c
+ //chenjingwu DB202308355043 2023.8.25 start
+ , prd.Category5__c
+ //chenjingwu DB202308355043 2023.8.25 end
+ );
+
+ } else {
+ continue;
+ }
+ }
+ } else {
+ continue;
+ }
+ activities.add(c);
+ i++;
+ rightcnt++;
+ }
+ }
+ // message銈掑嚭銇�
+ errorflg = true;
+ errormessage = '鏁版嵁瀵煎叆缁撴潫锛屽鍏� ' + codelist.size() + ' 浠讹紝鎴愬姛' + rightcnt + ' 浠�';
+ // pageArrange();
+
+ return errormessage+'---'+JSON.serialize(activities);
+
+}
+@AuraEnabled
+public static Map<String,String> QuoteDecision(String activitiesCan,
+ String CheckItemCan ,
+ boolean WinOrDecideAlertc,
+ boolean productStatusUpdatedc,
+ String oppInfoc,
+ boolean enableSalesc,
+ String quoc,
+ String oppIdc,
+ String quoIdc,
+ boolean newQuoteFlagc,
+ Boolean changedAfterPrintc,
+ String quoteGurantee_Periodc,
+ String quotemultiYearWarrantyc,
+ String selection_hpc,
+ Boolean SkipQuotefilgc) {
+ oppId = oppIdc;
+ quoId = quoIdc;
+ System.debug('quoId+'+quoId);
+ WinOrDecideAlert = WinOrDecideAlertc;
+ productStatusUpdated = productStatusUpdatedc;
+ newQuoteFlag = newQuoteFlagc;
+ changedAfterPrint = changedAfterPrintc;
+ quoteGurantee_Period = quoteGurantee_Periodc;
+ quotemultiYearWarranty = quotemultiYearWarrantyc;
+ selection_hp = selection_hpc;
+ SkipQuotefilg = SkipQuotefilgc;
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ quo = (Quote)JSON.deserialize(quoc,Quote.class);
+ if(String.isNotBlank(activitiesCan)){
+ activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class);
+ }else {
+ activities = null;
+ }
+ if(String.isNotBlank(CheckItemCan)){
+ CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class);
+ }else {
+ CheckItem = null;
+ }
+ enableSales = enableSalesc;
+ Savepoint sp = Database.setSavepoint();
+ Map<String,String> result = new Map<String,String>();
+ try {
+ setOppFromOppInfo();
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ //闇�姹傝〃娌¢�氳繃锛屾病鏈夐渶姹傝〃锛氭姤浠蜂笉鑳紻ecide,
+ List<IS_Opportunity_Demand__c> ISOstutas = [SELECT id,Approval_Date__c,Func_SOD_Status__c,Opportunity_ID__r.Stock_Confrim_Date__c from IS_Opportunity_Demand__c WHERE Opportunity_ID__c = :oppid];
+ List<opportunity> oldListCheck = [select Old_Opportunity_ID__c from Opportunity where id =:oppid];
+ integer PassFlg = 0;
+ Integer StockFlg = 0;
+ for(IS_Opportunity_Demand__c iso : ISOstutas){
+ if( iso.Approval_Date__c != null ){
+ PassFlg ++;
+ }
+ if(iso.Opportunity_ID__r.Stock_Confrim_Date__c ==null){
+ StockFlg++;
+ }
+ }
+ if (!(opp.If_Account_Change__c != null ? opp.If_Account_Change__c : false)) {
+ if(!ReservedProductVerification()){
+ if(flglastbuy==1){
+ errorflg = true;
+ errormessage = '棰勭暀浜у搧琛ㄤ腑娌℃湁璇ヨ浠凤紝璇烽�氳繃鏈儴绐楀彛鑱旂郴钀ヤ笟绠$悊璇�' ;
+ result.put('errormessage', errormessage);
+ return result;
+ }else if(flglastbuy==2){
+ errorflg = true;
+ errormessage = errorProductmodel+'浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺' ;
+ result.put('errormessage', errormessage);
+ return result;
+ }else if(flglastbuy==3){
+ errorflg = true;
+ errormessage = '棰勭暀浜у搧'+errorProductmodel+'鏈綍鍏ラ鐣欎骇鍝佽〃';
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ }
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ if(checkVirtual('鍖呭惈铏氭嫙浜у搧锛屾棤娉曡繘琛宒ecide')){
+ errorflg = true;
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ //chenjingwu DB202308355043 2023.8.25 end
+ if(PassFlg == 0&&oldListCheck[0].Old_Opportunity_ID__c==null){
+ errorflg = true;
+ errormessage = '娌℃湁鎵瑰噯鐨勯渶姹傝〃锛屼笉鑳紻ecide (From Apex 1120)';
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ if(StockFlg>0){//&&ISOstutas.size()>0
+ errorflg = true;
+ errormessage = '澶囪揣纭鏃ヤ负绌猴紝涓嶅彲浠ecide 鎶ヤ环 (From Apex 1125)';
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ String updateStr = ISO_DemandOperAndDemonsController.SetQuoteDecide(oppid);
+ // if (checkIsQuoteTrial()) {
+ // errorflg = true;
+ // result.put('errormessage', errormessage);
+ // return result;
+ // }
+ if (enableSales == true) {
+ if (dataCheckDecide() == false) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ if(hongzi){
+ String act = JSON.serialize(activities);
+ result.put('act', act);
+ }
+ return result;
+ }
+ }
+ if (dataCheck() == false) {
+ result.put('errormessage', errormessage);
+ result = resultFlag(result);
+ return result;
+ }
+ if (dataEntry() == false) {
+ result.put('errormessage', errormessage);
+ return result;
+ }
+ // if(SkipQuotefilg){
+ // errorflg = true;
+ // errormessage = '浜у搧閰嶇疆鎴栬�呯粡閿�鍟嗕俊鎭彂鐢熷彉鍖栵紝宸茬粡鐢熸垚鏂扮殑鎶ヤ环鍗曪紝璇烽噸鏂版搷浣滄姤浠疯绠�';
+ // quo.IsQuoteTrial__c = false;
+ // result.put('errormessage', errormessage);
+ // return result;
+ // }
+ if (String.isBlank(oppId)) {
+ } else {
+ List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId];
+
+ if (opps.size() > 0) {
+ opps[0].Estimation_Decision__c = true;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ update opps[0];
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+ system.debug('quoId+++++'+quoId);
+ Quote q = new Quote();
+ if(String.isBlank(quoId)){
+ q = [select Id from Quote where Id = :quoIdreturn];
+ }else{
+ q = [select Id from Quote where Id = :quoId];
+ }
+ q.Quote_Decision_Date__c = date.Today();
+ update q;
+ result.put('success', System.Label.Message_002);
+ if(String.isBlank(quoId)){
+ result.put('quoId',quoIdreturn);
+ }
+ if(errormessagewarn != null){
+ result.put('warn', errormessagewarn);
+ String act = JSON.serialize(activities);
+ result.put('act', act);
+ }
+ return result;
+
+ // pageArrange();
+ }
+ } catch (DmlException de) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = de.getDmlMessage(0);
+ result.put('errormessage', errormessage);
+ return result;
+ } catch (Exception e) {
+ Database.rollback(sp);
+ errorflg = true;
+ errormessage = e.getLineNumber()+':'+e.getMessage();
+ result.put('errormessage', errormessage);
+ return result;
+ }
+
+ return null;
+}
+private static boolean dataCheckDecide() {
+ Boolean error = false;
+ errorflg = false;
+ errormessage = null;
+ errormessagewarn = null;
+ if (quo.Dealer_Final_Price_Page__c == null) {
+ // quo.Dealer_Final_Price__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.Dealer_Final_Price__c.label;
+ dfpp = true;
+ error = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (checkAgentsDeleteFlag() == false) {
+ return false;
+ }
+ if (WinOrDecideAlert && (!productStatusUpdated)) {
+ // PriceStatusUpdate();
+ error = true;
+ errorMessage = '浜у搧鐘舵�佸彂鐢熷彉鍖栵紝璇锋洿鏂�';
+ }
+ if (opp.Agency1__c == null) {
+ // opp.Agency1__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label;
+ error = true;
+ Agency1 = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (quo.OCM_Agent1_Price_Page__c == null || quo.OCM_Agent1_Price_Page__c == 0) {
+ // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label;
+ error = true;
+ oapp = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (opp.Agency2__c == null && quo.Agent1_Agent2_Price_Page__c != null) {
+ // opp.Agency2__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label;
+ error = true;
+ Agency2 = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+ if (opp.Agency2__c != null && quo.Agent1_Agent2_Price_Page__c == null) {
+ // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message3);
+ String label = Schema.SObjectType.Opportunity.fields.Agent1_Agent2_Price__c.label;
+ error = true;
+ aapp = true;
+ errormessage = label+':'+System.Label.Error_Message3;
+ }
+
+ if (opp.If_Need_Authorize__c == true) {
+ ID tmpid = opp.Agency2__c == null ? opp.Agency1__c : opp.Agency2__c;
+ List<Account> accName = [select name from Account where id = : tmpid];
+ if (accName[0].name != opp.Authorized_Finish_Sales__c) {
+ error = true;
+ errormessage = '缁忛攢鍟嗘湭鎺堟潈鎴栨巿鏉冩湭瀹屾垚锛岃鍏堟巿鏉冦��' ;
+ }
+ }
+ //wql 鎶ヤ环璇曠畻 鍒ゆ柇鏄惁杩涜杩囨姤浠疯瘯绠� start
+ if(!quo.IsQuoteTrial__c){
+ //娌℃湁鎶ヤ环璇曠畻杩囪繘鍏�
+ error = true;
+ errormessage = 'decide鎶ヤ环杩樻病杩涜鎶ヤ环璇曠畻锛岃鍏堟姤浠疯瘯绠楋紒' ;
+
+ }
+
+ //wql 鎶ヤ环璇曠畻 鍒ゆ柇鏄惁杩涜杩囨姤浠疯瘯绠� end
+
+
+ //wql 鎶ヤ环璇曠畻 妫�绱績閿�鏀跨瓥鏄惁鏈夋晥 start
+ //1.鑾峰彇鎶ヤ环id
+ //2.鏍规嵁鎶ヤ环id 妫�绱㈠嚭鎵�鏈夋姤浠疯瘯绠楄锛屽苟甯﹀嚭姣忎竴琛岋紝閫夋嫨鐨勬斂绛栫殑鏈夋晥鏈� 3涓〃
+ //3.寰幆閬嶅巻 鏄惁鎵�鏈夐�夋嫨鐨勬斂绛栨湁鏁堟湡閮戒负true 鍙湁鏈変竴涓负false 灏辫繑鍥瀟rue 鐩存帴璺冲嚭寰幆
+ //濡傛灉鎶ヤ环id涓嶄负绌虹殑璇�
+ if(quoId !=null){
+ boolean IsActivePsp = true;
+ String errorPsp ='';
+ //鏍规嵁id 妫�绱� 鎵�鏈夌殑璇曠畻琛屼笂闈㈤�夋嫨鏀跨瓥鐨勬湁鏁堟湡
+ List<PromotionSalesProducts__c> promotionSalesProductsList =[select id,PromotionSales__c,QuantityId__c,PromotionSales__r.name,PromotionSales__r.IsPolicyEffective__c from PromotionSalesProducts__c where QuantityId__c=: quoId];
+ //濡傛灉鏈夋姤浠疯瘯绠楁暟鎹� 璇存槑閫夋嫨浜嗕績閿�鏀跨瓥
+ if(promotionSalesProductsList.size()>0){
+ for(PromotionSalesProducts__c psp :promotionSalesProductsList){
+ if(psp.PromotionSales__r.IsPolicyEffective__c == '鏃犳晥'){
+ IsActivePsp =false;
+ errorPsp = psp.PromotionSales__r.name;
+ break;
+ }
+ }
+ }
+
+ if(!IsActivePsp){
+ error = true;
+ errormessage = '鎶ヤ环璇曠畻涓紝閫夋嫨鐨勪績閿�鏀跨瓥:'+errorPsp+',涓嶅湪鏈夋晥鏈熷唴锛岃妫�鏌ワ紒' ;
+ }
+ }
+ if (opp.Trade__c == '鍐呰部') {
+ Map<Id, String> proMap = new Map<Id, String>();
+ if (activities.size() > 0) {
+ for (QELine qli : activities) {
+ if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ proMap.put(qli.pageObject.Id__c, qli.PageObject.Name__c);
+ }
+ }
+ }
+ Map<String, String> chkMap = new Map<String, String>();
+ chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, '');
+ if (chkMap.size() > 0) {
+ errorflg = true;
+ error = true;
+ if (chkMap.containsKey('agency')) {
+ errormessage = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��';
+ }
+ Integer inerr = 0;
+ if (activities.size() > 0) {
+ for (QELine s : activities) {
+ if (s.Asset_Model != null && s.Asset_Model != '') {
+ if (chkMap.containsKey(s.PageObject.Id__c)) {
+ if (chkMap.get(s.PageObject.Id__c) == '1') {
+ s.haveno_Register = true;
+ inerr ++;
+ } else if (chkMap.get(s.PageObject.Id__c) == '2') {
+ s.wrong_Register = true;
+ inerr ++;
+ }
+ }
+ }
+ }
+ }
+ if (inerr > 0) {
+ errormessage = '璇锋鏌ョ孩瀛楀唴瀹癸紙NMPA鐘舵�佺孩瀛楋紝涓嶅彲閿�鍞骇鍝侊紱浜у搧鍚嶇О绾㈠瓧锛岃秴杩囩粡閿�鍟嗙粡钀ヨ寖鍥达級銆�';
+ hongzi = true;
+ }
+ return false;
+ }
+ // Boolean isDangerError = false;
+ // Boolean isNotDangerError = false;
+ // if (activities.size() > 0) {
+ // for (QELine qli : activities) {
+ // if (qli.Asset_Model != null && qli.Asset_Model != '') {
+ // if (opp.Is_Corrosion__c) {
+ // if(!qli.Is_DangerousChemicals){
+ // isNotDangerError =true;
+ // qli.wrong_Register = true;
+ // }
+
+ // }else{
+ // if(qli.Is_DangerousChemicals){
+ // isDangerError =true;
+ // qli.wrong_Register = true;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // if (enableSales == true&&opp.Is_Corrosion__c&&opp.Trade__c == '鍐呰部') {
+ // String str = OpportunityWebService.checkDangerItem(opp.agency1__c);
+ // if (str != 'OK') {
+ // error = true;
+ // errormessage = str;
+ // }
+ // if(isNotDangerError){
+ // error = true;
+ // errormessage = '褰撻樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佸繀椤诲叏閫夋嫨鍗卞寲鍝併��';
+ // }
+ // }else if(!opp.Is_Corrosion__c){
+ // if(isDangerError){
+ // error = true;
+ // errormessage = '褰撹浠蜂笉鏄樋瑗垮澶氭椂锛岃椤圭洰鐨勪骇鍝佷笉鑳介�夋嫨鍗卞寲鍝併��';
+ // }
+ // }
+ }
+ if (error == true) {
+ // PageArrange();
+ errorflg = true;
+ return false;
+ } else {
+ return true;
+ }
+}
+private static boolean checkIsQuoteTrial() {
+ Boolean error = false;
+ errorflg = false;
+ errormessage = null;
+ if(opp.If_Need_PriceApply__c){
+ if(!quo.IsQuoteTrial__c){
+ error = true;
+ errormessage = 'decide鎶ヤ环杩樻病杩涜鎶ヤ环璇曠畻锛岃鍏堟姤浠疯瘯绠楋紒' ;
+ }
+ if(quoId !=null){
+ boolean IsActivePsp = true;
+ String errorPsp ='';
+ List<PromotionSalesProducts__c> promotionSalesProductsList =[select id,PromotionSales__c,QuantityId__c,PromotionSales__r.name,PromotionSales__r.IsPolicyEffective__c,recordTypeName__c from PromotionSalesProducts__c where QuantityId__c=: quoId];
+ if(promotionSalesProductsList.size()>0){
+ for(PromotionSalesProducts__c psp :promotionSalesProductsList){
+ if(psp.PromotionSales__r.IsPolicyEffective__c == '鏃犳晥'&&psp.recordTypeName__c!='NormalProduct'){
+ IsActivePsp =false;
+ errorPsp = psp.PromotionSales__r.name;
+ break;
+ }
+ }
+ }
+ if(!IsActivePsp){
+ error = true;
+ errormessage = '鎶ヤ环璇曠畻涓紝閫夋嫨鐨勪績閿�鏀跨瓥:'+errorPsp+',涓嶅湪鏈夋晥鏈熷唴锛岃妫�鏌ワ紒' ;
+ }
+ }
+ }
+ return error;
+}
+public static boolean ReservedProductVerification() {
+ filg=true;
+ Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>();
+ List<Id> lastProductFLGListId = new List<Id>();
+ List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>();
+ List<QuoteLineItem> act = new List<QuoteLineItem>();
+ List<QuoteLineItem> act2 = new List<QuoteLineItem>();
+ for(QELine aaa :activities){
+ if(aaa.pageObject.PricebookEntry.Product2Id!=null){
+ act.add(aaa.pageObject);
+ }
+ }
+ act2=act.deepClone();
+ Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>();
+ System.debug('activities1111111111112涓烘墍褰撲负澶氬!!!'+activities);
+ integer i =0;
+ for(QuoteLineItem pspsc :act2){
+ if(pspsc.PricebookEntry.Product2Id!=null){
+ if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){
+ QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id);
+ quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c;
+ map1.put(pspsc.PricebookEntry.Product2Id,quoteLine);
+ }else{
+ map1.put(pspsc.PricebookEntry.Product2Id,pspsc);
+ }
+ System.debug('34499879!!!'+activities);
+ }
+ }
+ System.debug('3434343!!!'+activities);
+ System.debug('5656565!!!'+map1);
+ for (QuoteLineItem value : map1.values()) {
+ if(value.PricebookEntry.Product2.LastbuyProductFLG__c){
+ lastProductFLGListId.add(value.PricebookEntry.Product2Id);
+ quotlinitMap.put(value.PricebookEntry.Product2Id,value);
+ lastProductFLGList.add(value);
+ }
+ }
+ System.debug('activities++++!!!'+activities);
+ System.debug('activities!!!'+map1.values());
+ System.debug('oppId!!!'+oppId);
+ System.debug('lastProductFLGList!!!'+lastProductFLGListId);
+ if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){
+ List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true];
+ Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>();
+ System.debug('LastbuyObjList+++++!!!'+LastbuyObjList);
+ if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){
+ for(LastbuyProduct__c lastbuypr :LastbuyObjList){
+ LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr);
+ }
+ }else{
+ flglastbuy=1;
+ filg=false;
+ return filg;
+ }
+ System.debug('LastbuyObjMap!!!'+LastbuyObjMap);
+ System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList);
+ if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){
+ for(QuoteLineItem lastbuypr :lastProductFLGList){
+ Decimal quoteLItemNum=0;
+ if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){
+ quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c;
+ System.debug('quoteLItemNum!!!'+quoteLItemNum);
+ System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c);
+ if(lastbuypr.Quantity__c>quoteLItemNum){
+ errorProductmodel=lastbuypr.Asset_Model_No__c;
+ flglastbuy=2;
+ filg=false;
+ break;
+ }
+ }else{
+ errorProductmodel=lastbuypr.Asset_Model_No__c;
+ flglastbuy=3;
+ filg=false;
+ break;
+ }
+ }
+ }
+ }
+ system.debug('filg====='+filg);
+ return filg;
+}
+// DB202307431108 鎶ヤ环鍗曘�戠粡閿�鍟�1鍚堝悓閲戦榛樿鍊艰鍒欎慨鏀� fy start
+public static String getValueFromJSONStringPlus(String jsonstring,String key,String key1) {
+ if (String.isNotBlank(jsonstring)) {
+ Map<String, Object> map1 = (Map<String, Object>) JSON.deserializeUntyped(jsonstring);
+ Map<String, Map<String,Object>> mapping = new Map<String, Map<String,Object>>();
+ for (String str : map1.keySet()) {
+ Map<String,Object> mapvalue = (Map<String,Object>) map1.get(str);
+ mapping.put(str, mapvalue);
+ }
+ return mapping.get(key) != null ? (mapping.get(key).get(key1) !=null ? String.valueOf(mapping.get(key).get(key1)) :( mapping.get(key).get('Other') !=null ? String.valueOf(mapping.get(key).get('Other')):null)) : (mapping.get('Default') != null ? (mapping.get('Default').get(key1) !=null ? String.valueOf(mapping.get('Default').get(key1)) : (mapping.get('Default').get('Other') != null ? String.valueOf(mapping.get('Default').get('Other')):null)): null);
+ }
+ return null;
+}
+@AuraEnabled
+public static InitData getModulus(String oppInfoc){
+ opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class);
+ InitData res = new InitData();
+ String str_rate_hospital = ControllerUtil.getValueFromJSONString(System.Label.Quote_HospitalAmount_Rate, opp.Salesdepartment_Owner__c);
+ String str_rate_agency1 = lexSINewQuoteEntryController.getValueFromJSONStringPlus(System.Label.Quote_Agency1Amount_Rate, opp.Salesdepartment_Owner__c,opp.Opportunity_Category__c);
+ res.rate_hospital = String.isNotBlank(str_rate_hospital) ? Decimal.valueOf(str_rate_hospital) : 1.0;
+ res.rate_agency1 = String.isNotBlank(str_rate_agency1) ? Decimal.valueOf(str_rate_agency1) : 1.0;
+ return res;
+}
+//chenjingwu DB202308355043 2023.8.25 start
+public static Boolean checkVirtual(String message){
+
+ List<String> idList = new List<String>();
+ for (QELine s : activities) {
+ if (String.isNotBlank(s.Category5) && s.Category5 == '铏氭嫙') {
+ idList.add(s.Category5);
+ }
+ System.debug('Category5+'+s.Category5);
+ }
+ if(idList.size() > 0){
+ errorMessage = message;
+ return true;
+ }
+ return false;
+}
+//chenjingwu DB202308355043 2023.8.25 end
+@AuraEnabled
+public static String submitOppoApplyStock(String oppIdc,String quoIdc){
+ oppId = oppIdc;
+ quoId = quoIdc;
+ id oppIDs = null;
+ if(oppid == null){
+ Quote qupSet = [SELECT Opportunityid from Quote WHERE id =:quoId];
+ oppIDs = qupSet.Opportunityid;
+ }else{
+ oppIDs = oppid;
+ }
+ Opportunity ops = [SELECT id,Stock_Submit_Date__c,Stock_Confrim_Date__c,Sales_assistant_ID__c,
+ Stock_Check_Leader__c,Quote_Update_Sum__c,
+ is_CheckTarget_TF__c from Opportunity WHERE id =:oppIDs];
+ User ThisAssisUser = [select id,SI_Stock_Checker__c,Salesdepartment__c,Profileid from user where id = :UserInfo.getUserId()];
+ String ProfileId_IThelp = System.Label.ProfileId_IThelp;
+ System.debug('ProfileId_IThelp'+ProfileId_IThelp);
+ if(ops.Sales_assistant_ID__c!=UserInfo.getUserId().substring(0,15) && ThisAssisUser.Profileid!=System.Label.ProfileId_SystemAdmin && ThisAssisUser.Profileid!=ProfileId_IThelp){
+ errormessage = 'errorss:鐢宠澶囪揣纭锛岄』鐢辫浠峰姪鐞嗘彁鍑虹敵璇� (From Apex 1043)';
+ return errormessage;
+ }else{
+ if(ThisAssisUser.SI_Stock_Checker__c == null){
+ if(ThisAssisUser.Salesdepartment__c == '5.鍗庝笢'){
+ ThisAssisUser.SI_Stock_Checker__c = System.label.SI_Stock_HD;
+ }else if(ThisAssisUser.Salesdepartment__c == '2.涓滃寳' || ThisAssisUser.Salesdepartment__c == '4.瑗垮崡'){
+ ThisAssisUser.SI_Stock_Checker__c = System.label.SI_Stock_HDHN;
+ }else if(ThisAssisUser.Salesdepartment__c == '1.鍗庡寳' || ThisAssisUser.Salesdepartment__c == '6.鍗庡崡'){
+ ThisAssisUser.SI_Stock_Checker__c = System.label.si_stock_dbhb;
+ }else if(ThisAssisUser.Salesdepartment__c == '3.瑗垮寳'){
+ ThisAssisUser.SI_Stock_Checker__c = System.label.SI_Stock_XBXN;
+ }
+ update ThisAssisUser;
+ }
+ ops.Stock_Submit_Date__c = Date.today();
+ if (ops.Quote_Update_Sum__c == null) {
+ ops.Quote_Update_Sum__c = 1;
+ } else {
+ ops.Quote_Update_Sum__c = ops.Quote_Update_Sum__c + 1;
+ }
+ Savepoint sp = Database.setSavepoint();
+ try{
+ update ops;
+ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
+ psr.setObjectId(oppIDs);
+ Approval.ProcessResult submitResult = Approval.process(psr);
+ errormessage = '澶囪揣纭鐢宠宸叉彁浜� (From Apex 1000)';
+ return errormessage;
+ }catch (Exception o){
+ Database.rollback(sp);
+ return 'errorss:'+o;
+ }
+ }
+}
+//鎶ヤ环纭
+@AuraEnabled
+public static String QuoteConfirm(String quoid){
+ System.debug('鎶ヤ环纭杩涘叆======');
+ List<Quote> QuoteList = [SELECT id,Queto_Confirm_Date__c,Opportunity.Sales_assistant_ID__c,
+ CreatedBy.SalesManager__c,CreatedBy.ZongjianApprovalManager__c,
+ CreatedBy.BuchangApprovalManagerSales__c,OpportunityId,Opportunity.Quote_Update_Sum__c
+ from Quote WHERE id=:quoid];
+ Map<Id,Opportunity> oppMap = new Map<Id,Opportunity>();
+ for(Quote Qu : QuoteList){
+ Qu.Queto_Confirm_Date__c = Date.today();
+ Qu.OpporsAssistance__c = Qu.Opportunity.Sales_assistant_ID__c;
+ Qu.Manager_Sell__c = Qu.CreatedBy.SalesManager__c;
+ Qu.Minister_Sell__c = Qu.CreatedBy.BuchangApprovalManagerSales__c;
+ Qu.Majordomo_Sell__c =Qu.CreatedBy.ZongjianApprovalManager__c;
+ if (String.isBlank(Qu.OpportunityId) == false) {
+ Opportunity opp = new Opportunity();
+ opp.Id = Qu.OpportunityId;
+ if (Qu.Opportunity.Quote_Update_Sum__c == null) {
+ opp.Quote_Update_Sum__c = 1;
+ } else {
+ opp.Quote_Update_Sum__c = Qu.Opportunity.Quote_Update_Sum__c + 1;
+ }
+ oppMap.put(Qu.id, opp);
+ }
+ }
+ Savepoint Sp = Database.setSavepoint();
+ try{
+ Update QuoteList;
+ Update oppMap.values();
+ return 'success';
+ }catch (Exception o){
+ Database.rollback(Sp);
+ return 'errorss:'+o;
+ }
+}
+public class InitData{
+ @AuraEnabled
+ public Decimal rate_hospital;
+ @AuraEnabled
+ public Decimal rate_agency1;
+}
+ //琛岄」鐩嚜瀹氫箟缁撴瀯
+ //琛岄」鐩師鍊�
+ public class QELinelatestInfo {
+ public String ProductCode { get; set; }
+ public String ProductName { get; set; }
+ public String SFDA_Status { get; set; }
+ public String Sales_Possibility { get; set; }
+ public Decimal ListPrice { get; set; }
+ public Decimal Cost { get; set; }
+ public Integer Specifications {get; set;}
+ public string GuranteeType {get; set;}
+ public Decimal Intra_Trade_Gurantee {get; set;}
+ public Decimal ProductEntend_gurantee_period_all {get; set;}
+ public Decimal Intra_Trade_Service {get; set;}
+ public Decimal Maintenance_Price_Year {get; set;}
+ public Boolean CanNotCancelledGurantee {get; set;}
+ public Boolean Is_DangerousChemicals {get; set;}
+ }
+ //琛岄」鐩柊鍊�
+ public class QELine {
+ public Integer lineNo;
+ public String Asset_Model;
+ public String Sales_Possibility;
+ public QuoteLineItem pageObject;
+ public Decimal Cost_c;
+ public Decimal Cost_Subtotal_c;
+ public Decimal ListPrice_Page;
+ public String StorageStatus;
+ public Integer Specifications;
+ public String VenderName;
+ public String Product_Set_Name;
+ public Boolean CanNotCancelledGurantee;
+ public Boolean Is_DangerousChemicals;
+ public QELinelatestInfo latestInfo;
+ public boolean changed_name;
+ public boolean changed_sfda;
+ public boolean changed_list;
+ public boolean changed_cost;
+ public boolean haveno_Register;
+ public boolean wrong_Register;
+ public String Estimated_ConsumptionDueDate;
+ public Decimal GuranteePrice;
+ public Decimal ProductGuranteePrice;
+ public decimal Maintenance_Price_Year;
+ public String Category5;
+ public QELine(){}
+ public QELine(QuoteLineItem qli, Integer i, String copyQuoId) {
+ this.lineNo = i;
+ pageObject = qli.clone();
+ pageObject.Id__c = qli.PricebookEntry.Product2Id;
+ pageObject.Quantity__c = qli.Quantity;
+ if (String.isNotBlank(copyQuoId)) {
+ pageObject.SFDA_Status__c = qli.PricebookEntry.Product2.SFDA_Status__c;
+ pageObject.Name__c = qli.PricebookEntry.Product2.Name;
+ }
+ //chenjingwu DB202308355043 2023.8.25 start
+ Category5 = qli.PricebookEntry.Product2.Category5__c;
+ //chenjingwu DB202308355043 2023.8.25 end
+ this.Asset_Model = qli.Asset_Model_No__c;
+ if (qli.Cost__c > 0 && qli.Quantity > 0) {
+ this.Cost_Subtotal_c = qli.Cost__c * qli.Quantity;
+ }
+ this.VenderName = qli.PricebookEntry.Product2.VenderName__c;
+ if(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c != null){
+ this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c).replaceAll('-','/');
+ }else{
+ this.Estimated_ConsumptionDueDate = '';
+ }
+ if(VenderName==null||VenderName==''){
+ this.VenderName =' 鏃� ';
+ }
+ this.Product_Set_Name = qli.ProductSetName__c;
+ this.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c;
+ this.Is_DangerousChemicals = qli.PricebookEntry.Product2.Is_DangerousChemicals__c;
+ this.StorageStatus = qli.PricebookEntry.Product2.StorageStatus__c;
+ this.ListPrice_Page = qli.ListPrice__c;
+ this.Cost_c = qli.Cost__c;
+ pageObject.Subtotal__c = qli.TotalPrice__c;
+ pageObject.UnitPrice_Page__c = qli.UnitPrice__c;
+ latestInfo = new QELinelatestInfo();
+ latestInfo.ProductCode = qli.ProductCode__c;
+ latestInfo.ProductName = qli.PricebookEntry.Product2.Name;
+ latestInfo.SFDA_Status = qli.PricebookEntry.Product2.SFDA_Status__c;
+ latestInfo.ProductEntend_gurantee_period_all = qli.PricebookEntry.Product2.Entend_gurantee_period_all__c;
+ if(qli.Quote.Opportunity.Trade__c == '鍐呰部'){
+ latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c;
+ latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.Intra_Trade_Service_RMB__c;
+ if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){
+ latestInfo.Maintenance_Price_Year = 0;
+ }else{
+ latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Maintenance_Price_Year__c;
+ }
+ }else if(qli.Quote.Opportunity.Trade__c == '澶栬部'){
+ latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c;
+ latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.NoDiscount_Foreign__c;
+ if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){
+ latestInfo.Maintenance_Price_Year = 0;
+ }else{
+ latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Repair_Contract_USD__c;
+ }
+ }
+ latestInfo.GuranteeType = qli.PricebookEntry.Product2.GuranteeType__c;
+ latestInfo.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c;
+ this.Maintenance_Price_Year = qli.Maintenance_Price_Year__c;
+ this.GuranteePrice = qli.GuranteePrice__c;
+ this.ProductGuranteePrice = qli.ProductGuranteePrice__c;
+ latestInfo.Sales_Possibility = qli.PricebookEntry.Product2.Sales_Possibility__c;
+ if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) {
+ latestInfo.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + '');
+ }
+ latestInfo.ListPrice = qli.Product_ListPrice__c;
+ latestInfo.Cost = qli.Product_Cost__c;
+ if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) {
+ this.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + '');
+ }
+ this.changed_name = false;
+ this.changed_sfda = false;
+ this.changed_list = false;
+ this.changed_cost = false;
+ this.haveno_Register = false;
+ this.wrong_Register = false;
+ }
+ public QELine(Integer i,Boolean Is_DangerousChemicals,Boolean CanNotCancelledGurantee,String VenderName,
+ Date Estimated_ConsumptionDueDate,String ProductSetName,
+ String PricebookEntryId,
+ String Asset_Model, String StorageStatus,
+ String ProductCode, String Id_c,
+ String SFDA_Status_c, String Sales_Possibility_c,
+ String Name_c, String BSS_Category_c,
+ Integer Quantity, Decimal ListPrice_c,
+ Decimal UnitPrice_c, Decimal Cost_c,
+ Decimal Packing_list_manual
+ , Decimal Entend_gurantee_period_all
+ , decimal ProductGuranteePrice
+ , string GuranteeType
+ , Decimal productServicePrice
+ , Decimal productMaintenance_Price_Year
+ //chenjingwu DB202308355043 2023.8.25 start
+ ,String Category5
+ //chenjingwu DB202308355043 2023.8.25 end
+ ) {
+ pageObject = New QuoteLineItem();
+ pageObject.Quantity__c = Quantity;
+ this.lineNo = i;
+ this.Asset_Model = Asset_Model;
+ this.Sales_Possibility = Sales_Possibility_c;
+ if(Estimated_ConsumptionDueDate != null){
+ this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(Estimated_ConsumptionDueDate).replaceAll('-','/');
+ }else{
+ this.Estimated_ConsumptionDueDate = '';
+ }
+ this.StorageStatus = StorageStatus;
+ pageObject.Id__c = Id_c;
+ pageObject.SFDA_Status__c = SFDA_Status_c;
+ pageObject.Name__c = Name_c;
+ pageObject.BSS_Category__c = BSS_Category_c;
+ this.ListPrice_Page = ListPrice_c;
+ pageObject.UnitPrice_Page__c = UnitPrice_c;
+ pageObject.Subtotal__c = UnitPrice_c * Quantity;
+ this.Product_Set_Name = ProductSetName;
+ //chenjingwu DB202308355043 2023.8.25 start
+ Category5 = Category5;
+ //chenjingwu DB202308355043 2023.8.25 end
+ if(VenderName==null||VenderName==''){
+ this.VenderName =' 鏃� ';
+ }else{
+ this.VenderName = VenderName;
+ }
+ this.CanNotCancelledGurantee = CanNotCancelledGurantee;
+ this.Is_DangerousChemicals = Is_DangerousChemicals;
+ pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all;
+ pageObject.productServicePrice__c = productServicePrice;
+ pageObject.GuranteeType__c = GuranteeType;
+ this.ProductGuranteePrice = ProductGuranteePrice;
+ this.Maintenance_Price_Year = productMaintenance_Price_Year;
+ this.Cost_c = Cost_c;
+ this.Cost_Subtotal_c = Cost_c * Quantity;
+ pageObject.PricebookEntryId = PricebookEntryId;
+ latestInfo = New QELinelatestInfo();
+ latestInfo.ProductCode = ProductCode;
+ latestInfo.ProductName = Name_c;
+ latestInfo.SFDA_Status = SFDA_Status_c;
+ latestInfo.Sales_Possibility = Sales_Possibility_c;
+ latestInfo.ListPrice = this.ListPrice_Page;
+ latestInfo.Cost = pageObject.Cost__c;
+ latestInfo.ProductEntend_gurantee_period_all = Entend_gurantee_period_all;
+ latestInfo.Intra_Trade_Gurantee = ProductGuranteePrice;
+ latestInfo.Intra_Trade_Service = productServicePrice;
+ latestInfo.GuranteeType = GuranteeType;
+ latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year;
+ latestInfo.CanNotCancelledGurantee = CanNotCancelledGurantee;
+ latestInfo.Is_DangerousChemicals = Is_DangerousChemicals;
+ if (Packing_list_manual != null) {
+ latestInfo.Specifications = integer.valueof('' + Packing_list_manual);
+ }
+ if (Packing_list_manual != null) {
+ this.Specifications = integer.valueof('' + Packing_list_manual);
+ }
+ this.changed_name = false;
+ this.changed_sfda = false;
+ this.changed_list = false;
+ this.changed_cost = false;
+ this.haveno_Register = false;
+ this.wrong_Register = false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexSINewQuoteEntryControllerTest.cls b/force-app/main/default/classes/lexSINewQuoteEntryControllerTest.cls
new file mode 100644
index 0000000..17a8352
--- /dev/null
+++ b/force-app/main/default/classes/lexSINewQuoteEntryControllerTest.cls
@@ -0,0 +1,1754 @@
+@isTest
+public class lexSINewQuoteEntryControllerTest {
+ static final String RC_BYOUIN = '鐥呴櫌';
+ static final String RC_HANBAOITEN = '璨╁2搴�';
+ static final String RC_KEIYAKU = '濂戠磩';
+ public static String CurrencyIso = 'CNY';
+ private static String quoteNo = 'textQutote01';
+ public static String trade = '鍐呰部';
+
+ private static Boolean isUnitPrice = true;
+ private static Boolean isOfferAmount = true;
+ private static Boolean isTotalPrice = true;
+ private static Boolean isDiscountRate = true;
+ private static Boolean isDiscountAmount = true;
+ private static Boolean isTradingPrice = true;
+ private static Boolean isContractDetail = true;
+
+ private static Date offerExpireDate = Date.today();
+ private static String clientName = 'test client';
+ private static String offerComment = 'test comment';
+ private static Date offerPrintDate = Date.today();
+ private static String agentName = 'test agent name';
+ @isTest
+ static void Test1(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ insert opp;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ lexSINewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堥暱鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堥暱鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ lexSINewQuoteEntryController.selectProById(prostr);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏆傚仠鍑哄簱锛堢煭鏈燂級","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ quoteflg = true;
+ lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ lexSINewQuoteEntryController.setOppFromOppInfo();
+ }
+ @isTest
+ static void Test2(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ insert opp;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ Product_Set__c ps1 = new Product_Set__c();
+ ps1.Name = '銈汇儍銉堝搧锛�';
+ ps1.Product_Set_CD__c = '111111';
+ ps1.Description__c = '瑾槑';
+ ps1.Qty__c = 10;
+ //ps1.Valid__c = true;
+ ps1.Valid_Date__c = date.today().addDays(-5);
+ insert ps1;
+
+ Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
+ psd1.Product_Set__c = ps1.id;
+ psd1.Price__c = 100;
+ psd1.Quantity__c = 10;
+ psd1.Product__c = product1.id;
+
+ insert psd1;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('12','121','122');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<Product_Set__c> pstc = lexSINewQuoteEntryController.serSetContact('鍝�','1','');
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ String oppInfoc = JSON.serialize(opp);
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String setProduct_text = ps1.Id;
+ String setprd = lexSINewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
+ String excel_text = 'OTV-SP1H-NA-12E\r1\nN1085630\r1\nN1085930\r1\nN1085530\r1\nN2303830\r1';
+ String eximt = lexSINewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+ private static Id pricebookId = ControllerUtil.getStandardPricebook().Id;
+
+ static testMethod void Test3(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+ // 浜у搧
+ Product2 prd1 = new Product2();
+ prd1.ProductCode_Ext__c = 'Prd1';
+ prd1.ProductCode = 'Prd1';
+ prd1.Repair_Product_Code__c = 'Prd1_RP';
+ prd1.Name = 'Prd1';
+ prd1.Manual_Entry__c = false;
+ prd1.Category2__c = '鏈綋';
+ prd1.Category3__c = '绾ょ淮闀�';
+ prd1.Category4__c = 'CV';
+ prd1.Category5__c = '260SL绯诲垪';
+ prd1.Asset_Model_No__c = '1001';
+ prd1.Important_product__c = true;
+ prd1.Important_Rroduct_1GI__c = true;
+ insert prd1;
+
+ PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
+ entry.UnitPrice = 0;
+ entry.IsActive = true;
+ entry.UseStandardPrice = false;
+ entry.CurrencyIsoCode = 'CNY';
+ insert entry;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ lexSINewQuoteEntryController.selectAccountById(contractA.Id);
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ insert opp;
+
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":true,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quos.OpportunityId = opp.Id;
+ quos.Pricebook2Id = pricebookId;
+ // 鍒犻櫎ID灞炴��
+ quos.Id = null;
+ // 鎵ц鎻掑叆鎿嶄綔
+ insert quos;
+
+ lexSINewQuoteEntryController.selectQuoteById(quos.Id);
+ // 鎶ヤ环琛岄」鐩�
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quos.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = prd1.id;
+ target.PricebookEntryId = entry.Id;
+ insert target;
+
+
+ lexSINewQuoteEntryController.selectQuoteLineItem(quos.Id,opp.Id);
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),'');
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'','');
+ lexSINewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',true);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoteGurantee_Periodc = null;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ Boolean quoteflg = true;
+ prd1.Category5__c = '铏氭嫙';
+ update prd1;
+ lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ lexSINewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,'',quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false);
+ quoIdc = quos.Id;
+ oppIdc = null;
+ oppInfoc = JSON.serialize(opp);
+ lexSINewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false);
+ }
+ static testMethod void Test5(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+ // 浜у搧
+ Product2 prd1 = new Product2();
+ prd1.ProductCode_Ext__c = 'Prd1';
+ prd1.ProductCode = 'Prd1';
+ prd1.Repair_Product_Code__c = 'Prd1_RP';
+ prd1.Name = 'Prd1';
+ prd1.Manual_Entry__c = false;
+ prd1.Category2__c = '鏈綋';
+ prd1.Category3__c = '绾ょ淮闀�';
+ prd1.Category4__c = 'CV';
+ prd1.Category5__c = '260SL绯诲垪';
+ prd1.Asset_Model_No__c = '1001';
+ prd1.Important_product__c = true;
+ prd1.Important_Rroduct_1GI__c = true;
+ insert prd1;
+
+ PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id);
+ entry.UnitPrice = 0;
+ entry.IsActive = true;
+ entry.UseStandardPrice = false;
+ entry.CurrencyIsoCode = 'CNY';
+ insert entry;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ lexSINewQuoteEntryController.selectAccountById(contractA.Id);
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = 'ET24鏅傞枔璨╁2';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ opp.Is_Corrosion__c=true;
+ opp.SAP_Province__c='涓婃捣甯�';
+
+
+ insert opp;
+
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quos.OpportunityId = opp.Id;
+ quos.Pricebook2Id = pricebookId;
+ // 鍒犻櫎ID灞炴��
+ quos.Id = null;
+ // 鎵ц鎻掑叆鎿嶄綔
+ insert quos;
+
+ lexSINewQuoteEntryController.selectQuoteById(quos.Id);
+ // 鎶ヤ环琛岄」鐩�
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quos.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ // target.TotalPrice = 100;
+ target.UnitPrice = 10;
+ target.Product2Id = prd1.id;
+ target.PricebookEntryId = entry.Id;
+ target.Item_Order__c = 3;
+
+ insert target;
+
+
+ lexSINewQuoteEntryController.selectQuoteLineItem(target.Id,opp.Id);
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),'');
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'','');
+ lexSINewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',false);
+ String CheckItemCan = null;
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ String quoIdc = quos.Id;
+ String quoteGurantee_Periodc = null;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexSINewQuoteEntryController.QuoteConfirm(quoIdc);
+ lexSINewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,true);
+ }
+ @isTest
+ static void Test4(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ insert opp;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ lexSINewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ lexSINewQuoteEntryController.selectProById(prostr);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏆傚仠鍑哄簱锛堢煭鏈燂級","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏆傚仠鍑哄簱锛堢煭鏈燂級","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"Id__c":null,"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[1].pageObject.Id__c = product2.Id;
+ for(lexSINewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg);
+ }
+ @isTest
+ static void Test6(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ insert opp;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ Product_Set__c ps1 = new Product_Set__c();
+ ps1.Name = '銈汇儍銉堝搧锛�';
+ ps1.Product_Set_CD__c = '111111';
+ ps1.Description__c = '瑾槑';
+ ps1.Qty__c = 10;
+ //ps1.Valid__c = true;
+ ps1.Valid_Date__c = date.today().addDays(-5);
+ insert ps1;
+
+ Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
+ psd1.Product_Set__c = ps1.id;
+ psd1.Price__c = 100;
+ psd1.Quantity__c = 10;
+ psd1.Product__c = product1.id;
+
+ insert psd1;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('12','121','122');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<Product_Set__c> pstc = lexSINewQuoteEntryController.serSetContact('鍝�','1','');
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ String oppInfoc = JSON.serialize(opp);
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String setProduct_text = ps1.Id;
+ String setprd = lexSINewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
+ String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
+ String eximt = lexSINewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+ @isTest
+ static void Test7(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '鍐呰部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'CNY';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ lexSINewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = CurrencyIso;
+ //pE.
+ insert pE2;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ lexSINewQuoteEntryController.selectProById(prostr);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏆傚仠鍑哄簱锛堢煭鏈燂級","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏆傚仠鍑哄簱锛堢煭鏈燂級","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"Id__c":null,"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[1].pageObject.Id__c = product2.Id;
+ for(lexSINewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ lexSINewQuoteEntryController.submitOppoApplyStock(opp.Id,'');
+ }
+ @isTest
+ static void Test8(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'USD';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ lexSINewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ product1.LastbuyProductFLG__c = true;
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ LastbuyProduct__c lbp = new LastbuyProduct__c();
+ lbp.Name = 'Test0215';
+ lbp.ProductName__c = product1.Id;
+ lbp.InquiryCode__c = opp.Id;
+ lbp.effectiveFLG__c = true;
+ lbp.LastbuyQuantity__c = 1;
+ insert lbp;
+ Quote quote = new Quote( Name = '銉嗐偣銉堣绌�');
+ quote.OpportunityId = opp.Id;
+ quote.Pricebook2Id = pricebook.id;
+ quote.Quote_No__c = 'textQutote01';
+ quote.Unit_Price__c = isUnitPrice;
+ quote.Offer_Amount__c = isOfferAmount;
+ quote.TOTAL__c = isTotalPrice;
+ quote.Discount__c = isDiscountRate;
+ quote.Pricing__c = isDiscountAmount;
+ quote.Preferential_Trading_Price__c = isTradingPrice;
+ quote.Contract__c = isContractDetail;
+ quote.Quote_Comment__c = offerComment;
+ insert quote;
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quote.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = product1.id;
+ target.PricebookEntryId = pE.Id;
+ insert target;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ lexSINewQuoteEntryController.selectProById(prostr);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = lexSINewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
+ List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[0].pageObject.Quantity__c = 2;
+ activities[0].pageObject.PricebookEntryId = pE.Id;
+ for(lexSINewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ }
+ @isTest
+ static void Test9(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'USD';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ lexSINewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ product1.LastbuyProductFLG__c = false;
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ LastbuyProduct__c lbp = new LastbuyProduct__c();
+ lbp.Name = 'Test0215';
+ lbp.ProductName__c = product1.Id;
+ lbp.InquiryCode__c = opp.Id;
+ lbp.effectiveFLG__c = true;
+ lbp.LastbuyQuantity__c = 1;
+ // insert lbp;
+ Quote quote = new Quote( Name = '銉嗐偣銉堣绌�');
+ quote.OpportunityId = opp.Id;
+ quote.Pricebook2Id = pricebook.id;
+ quote.Quote_No__c = 'textQutote01';
+ quote.Unit_Price__c = isUnitPrice;
+ quote.Offer_Amount__c = isOfferAmount;
+ quote.TOTAL__c = isTotalPrice;
+ quote.Discount__c = isDiscountRate;
+ quote.Pricing__c = isDiscountAmount;
+ quote.Preferential_Trading_Price__c = isTradingPrice;
+ quote.Contract__c = isContractDetail;
+ quote.Quote_Comment__c = offerComment;
+ insert quote;
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quote.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = product1.id;
+ target.PricebookEntryId = pE.Id;
+ insert target;
+ License_Information__c linc = new License_Information__c( name='Test20181204',
+ LicenseType__c = '鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�',
+ BusinessLicense__c = '20180522',
+ ValidFrom__c = date.newinstance(2018, 05, 22),
+ ValidTo__c = date.newinstance(2088, 05, 22),
+ Scope3__c = '6815;6822;6823;6825',
+ LicenseAndAccount__c = sellerA.id
+ );
+ insert linc;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ lexSINewQuoteEntryController.selectProById(prostr);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = lexSINewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
+ List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[0].pageObject.Quantity__c = 2;
+ activities[0].pageObject.PricebookEntryId = pE.Id;
+ activities[0].pageObject.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ activities[0].pageObject.UnitPrice_Page__c = 200;
+ activities[0].pageObject.AgencyUnitPrice__c = 200;
+ for(lexSINewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = true;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quos.IsQuoteTrial__c = true;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ }
+ @isTest
+ static void Test10(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Medical_Equipment_Num__c = '鏈夎瘉';
+ sellerA.Business_Authorization_No__c = '0001';
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ opp.CurrencyIsoCode = 'USD';
+ opp.Stock_Confrim_Date__c = Date.today().addDays(50);
+ insert opp;
+ IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c();
+ ISOhead.name = '*';
+ ISOhead.Opportunity_ID__c = opp.id;
+ ISOhead.Approval_Date__c = Date.today();
+ ISOhead.Public_Hospital_TF__c = true;
+ ISOhead.Preparation_Stage_TF__c = true;
+ ISOhead.Data_Check_TF__c = true;
+ ISOhead.Operating_Room_Plane_Graph_TF__c = true;
+ ISOhead.Demonstration_Area_Plane_Graph_TF__c = true;
+ insert ISOhead;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ lexSINewQuoteEntryController.getquoDes();
+
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ product1.LastbuyProductFLG__c = false;
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ LastbuyProduct__c lbp = new LastbuyProduct__c();
+ lbp.Name = 'Test0215';
+ lbp.ProductName__c = product1.Id;
+ lbp.InquiryCode__c = opp.Id;
+ lbp.effectiveFLG__c = true;
+ lbp.LastbuyQuantity__c = 1;
+ // insert lbp;
+ Quote quote = new Quote( Name = '銉嗐偣銉堣绌�');
+ quote.OpportunityId = opp.Id;
+ quote.Pricebook2Id = pricebook.id;
+ quote.Quote_No__c = 'textQutote01';
+ quote.Unit_Price__c = isUnitPrice;
+ quote.Offer_Amount__c = isOfferAmount;
+ quote.TOTAL__c = isTotalPrice;
+ quote.Discount__c = isDiscountRate;
+ quote.Pricing__c = isDiscountAmount;
+ quote.Preferential_Trading_Price__c = isTradingPrice;
+ quote.Contract__c = isContractDetail;
+ quote.Quote_Comment__c = offerComment;
+ insert quote;
+ QuoteLineItem target = new QuoteLineItem();
+ target.Name__c = '銉嗐偣銉堝晢鍝�';
+ target.QuoteId = quote.id;
+ target.Quantity = 1;
+ target.Cost_Subtotal__c = 0;
+ target.Cost__c = 200;
+ target.Item_Order__c = 3;
+ target.UnitPrice = 10;
+ target.Product2Id = product1.id;
+ target.PricebookEntryId = pE.Id;
+ insert target;
+ License_Information__c linc = new License_Information__c( name='Test20181204',
+ LicenseType__c = '鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�',
+ BusinessLicense__c = '20180522',
+ ValidFrom__c = date.newinstance(2018, 05, 22),
+ ValidTo__c = date.newinstance(2088, 05, 22),
+ Scope3__c = '6815;6822;6823;6825',
+ LicenseAndAccount__c = sellerA.id
+ );
+ insert linc;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','','');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<String> proList = new List<String>();
+ proList.add(product1.Id);
+ proList.add(product2.Id);
+ String prostr = JSON.serialize(proList);
+ lexSINewQuoteEntryController.selectProById(prostr);
+ Boolean SkipQuotefilgc = false;
+ boolean WinOrDecideAlertc = false;
+ String activitiesCan = lexSINewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id);
+ List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class);
+ List<QuoteLineItem> bbb = new List<QuoteLineItem>();
+ Integer i = 0;
+ activities[0].pageObject.Id__c = product1.Id;
+ activities[0].pageObject.Quantity__c = 2;
+ activities[0].pageObject.PricebookEntryId = pE.Id;
+ activities[0].pageObject.SFDA_Status__c = '鏆傚仠鍑哄簱锛堢煭鏈燂級';
+ for(lexSINewQuoteEntryController.QELine aa:activities){
+ bbb.add(aa.pageObject);
+ i++;
+ }
+ String CheckItemCan =JSON.serialize(bbb);
+ activitiesCan = JSON.serialize(activities);
+ Boolean changedAfterPrintc = false;
+ boolean enableSalesc = false;
+ boolean newQuoteFlagc = false;
+ String oppIdc = opp.Id;
+ String oppInfoc = JSON.serialize(opp);
+ boolean productStatusUpdatedc = false;
+ String quoIdc = '';
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quos.IsQuoteTrial__c = true;
+ quoc = JSON.serialize(quos);
+ String quoteGurantee_Periodc = null;
+ Boolean quoteflg = false;
+ String quotemultiYearWarrantyc = null;
+ String selection_hpc = '鏉窞甯備竵妗ュ尰闄�';
+ lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc,
+ oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,
+ quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc);
+ }
+ @isTest
+ static void Test11(){
+ RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1];
+ Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�');
+ hospital.RecordTypeId = recByoin.id;
+ hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�';
+ hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�';
+ insert hospital;
+
+ RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1];
+ Account sellerA = new Account(Name = '璨╁2搴�');
+ sellerA.RecordTypeId = recHanbaiten.id;
+ sellerA.Hospital__c = hospital.id;
+ sellerA.Tax_Practice_No__c = '001';
+ sellerA.Sales_Shop_Class__c = '鐗圭磩璨╁2搴楋紙鍖哄煙锛�';
+ sellerA.Business_Authorization_No__c = '001';
+ sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20);
+ sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20);
+ insert sellerA;
+
+ RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1];
+ Account contractA = new Account(Name = '*');
+ contractA.RecordTypeId = recKeiyaku.id;
+ contractA.Agent_Ref__c = sellerA.id;
+ contractA.Hospital__c=hospital.id;
+ contractA.ParentId = sellerA.id;
+ insert contractA;
+ StaticParameter.EscapeOppandStaTrigger = true;
+ Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today());
+ opp.Trade__c = '澶栬部';
+ //opp.CurrencyIsoCode = CurrencyIso;
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.StageName = '寮曞悎';
+ opp.Fixed_Check__c = false;
+ opp.owner_not_automatically_update__c = true;
+ //opp.Pricebook2Id = pricebook.id;
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Promise_Class__c = '澶栬部';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.AccountId = contractA.id;
+ opp.Hospital__c = contractA.id;
+ opp.Agency1__c = sellerA.id;
+ opp.Wholesale_Price__c = 9000;
+ opp.Opportunity_stage__c = '杩樻病鐢宠棰勭畻';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(50);
+ opp.Special_Opp_lanhai__c = false;
+ insert opp;
+ Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss();
+ lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id));
+ User us = lexSINewQuoteEntryController.selecUser();
+ Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id));
+ String oppvalue = JSON.serialize(opp1);
+ lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue);
+ Product2 product1 = new Product2( Name = '11111');
+ product1.SFDA_Status__c = '涓嶈';
+ product1.Intra_Trade_List_RMB_1__c = 100;
+ product1.Intra_Trade_List_RMB_Date1__c = date.today();
+ product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Intra_Trade_Cost_RMB_1__c = 200;
+ product1.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product1.Manual_Entry__c = false;
+ product1.Asset_Model_No__c = '11111';
+ product1.MDM_Model_No__c = '11111';
+ product1.ProductCode = 'OTV-SP1H-NA-12E';
+ product1.Foreign_Trade_Cost_US_1__c =10.00;
+ product1.Foreign_Trade_List_US_1__c =10.00;
+ product1.Foreign_Trade_Cost_US_Date1__c = date.today().addDays(-10);
+ product1.Foreign_Trade_Cost_US_Date2__c = date.today().addDays(-15);
+ product1.Foreign_Trade_Cost_US_End_Date1__c = date.today().addDays(10);
+ product1.Foreign_Trade_List_US_Date1__c = date.today().addDays(-10);
+ product1.Foreign_Trade_List_US_Date2__c = date.today().addDays(-15);
+ product1.Foreign_Trade_List_US_End_Date1__c = date.today().addDays(10);
+ insert product1;
+ system.debug('##product.Id=[' + product1.Id + ']' );
+
+ Product2 product2 = new Product2( Name = '11112');
+ product2.SFDA_Status__c = '涓嶈';
+ product2.Intra_Trade_List_RMB_1__c = 100;
+ product2.Intra_Trade_List_RMB_Date1__c = date.today();
+ product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Intra_Trade_Cost_RMB_1__c = 200;
+ product2.Intra_Trade_Cost_RMB_Date1__c = date.today();
+ product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1);
+ product2.Manual_Entry__c = false;
+ product2.Asset_Model_No__c = '11112';
+ product2.MDM_Model_No__c = '11112';
+ insert product2;
+ system.debug('##product1.Id=[' + product1.Id + ']' );
+ system.debug('##product2.Id=[' + product2.Id + ']' );
+
+ Pricebook2 pricebook = ControllerUtil.getStandardPricebook();
+
+ PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id);
+
+ pE.UnitPrice = 0;
+ pE.IsActive = true;
+ pE.UseStandardPrice = false;
+ pE.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE;
+
+ PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id);
+
+ pE2.UnitPrice = 0;
+ pE2.IsActive = true;
+ pE2.UseStandardPrice = false;
+ pE2.CurrencyIsoCode = 'USD';
+ //pE.
+ insert pE2;
+ Product_Set__c ps1 = new Product_Set__c();
+ ps1.Name = '銈汇儍銉堝搧锛�';
+ ps1.Product_Set_CD__c = '111111';
+ ps1.Description__c = '瑾槑';
+ ps1.Qty__c = 10;
+ //ps1.Valid__c = true;
+ ps1.Valid_Date__c = date.today().addDays(-5);
+ insert ps1;
+
+ Product_Set_Detail__c psd1 = new Product_Set_Detail__c();
+ psd1.Product_Set__c = ps1.id;
+ psd1.Price__c = 100;
+ psd1.Quantity__c = 10;
+ psd1.Product__c = product1.id;
+
+ insert psd1;
+ List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('12','121','122');
+ // PageReference page = new PageReference('/apex/lexNewQuoteEntry');
+ // System.Test.setCurrentPage(page);
+ Apexpages.currentPage().getParameters().put('oppid', opp.id);
+ List<Product_Set__c> pstc = lexSINewQuoteEntryController.serSetContact('鍝�','1','');
+ String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170绯诲垪","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170绯诲垪","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H170L:鐢靛瓙澶ц偁鍐呯闀�","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"鏈夊姽","Product_Sales_Possibility__c":"鈼�","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"甯傚満","warrantyType__c":"甯傚満澶氬勾淇濅慨","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"鍐呰部","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"鏈夊姽","Sales_Possibility__c":"鈼�","Name":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"甯傚満","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190绯诲垪","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"鏈夊姽","Sales_Possibility":"鈼�","ProductName":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"甯傚満","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190绯诲垪","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"甯傚満澶氬勾淇濅慨","NoDiscountTotal__c":31000,"SFDA_Status__c":"鏈夋晥","Name__c":"CF-H190I:鐢靛瓙缁撹偁鍐呯闀�","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]';
+ String oppInfoc = JSON.serialize(opp);
+ String quoc = '{"Name":"娴嬭瘯425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"涓婃捣浜ら�氬ぇ瀛﹀尰瀛﹂櫌闄勫睘鐟為噾鍖婚櫌鑸熷北鍒嗛櫌","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"娴嬭瘯425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}';
+ Quote quos = (Quote)JSON.deserialize(quoc,Quote.class);
+ quos.Agency1__c = sellerA.id;
+ quoc = JSON.serialize(quos);
+ String setProduct_text = ps1.Id;
+ String setprd = lexSINewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc);
+ String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1';
+ String eximt = lexSINewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc);
+ StaticParameter.EscapeOppandStaTrigger = false;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/__tests__/lexNewQuoteEntry.test.js b/force-app/main/default/lwc/lexNewQuoteEntry/__tests__/lexNewQuoteEntry.test.js
new file mode 100644
index 0000000..fef476d
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/__tests__/lexNewQuoteEntry.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexNewQuoteEntry from 'c/lexNewQuoteEntry';
+
+describe('c-lex-new-quote-entry', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-lex-new-quote-entry', {
+ is: LexNewQuoteEntry
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.css b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.css
new file mode 100644
index 0000000..3a3a667
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.css
@@ -0,0 +1,81 @@
+@import 'c/lexCssUtility';
+:host {
+ --slds-c-textarea-sizing-min-height: 200px;
+}
+.my-icon {
+ --slds-c-icon-color-foreground-default: white;
+}
+.quobutton{
+ font-size: 18px;
+ font-family: 'sans-serif';
+ font-weight:500;
+ width: 160px;
+ height: 36px;
+ border-radius: 4px;
+ opacity: 1;
+ background:#0A81DF;
+ color:#FFFFFF;
+}
+/* .slds-scope .slds-alert_error {
+ --slds-c-alert-color-background: #ba0517 !important;
+} */
+
+/* input[name="QuoteSalesBack"] {
+ text-align: right;
+}
+input[type="text" i] {
+ writing-mode: horizontal-tb !important;
+ padding-block: 1px;
+ padding-inline: 2px;
+ text-align: right;
+} */
+/*.THIS .QuoteSalesBack input {
+ text-align: right;
+}*/
+/* .QuoteSalesBack input {
+ text-align: right;
+} */
+.my-icons{
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ padding-top: var(--slds-c-alert-spacing-block-start, var(--sds-c-alert-spacing-block-start, var(--lwc-spacingXSmall,0.5rem)));
+ padding-right: var(--slds-c-alert-spacing-inline-end, var(--sds-c-alert-spacing-inline-end, var(--lwc-spacingXLarge,2rem)));
+ padding-bottom: var(--slds-c-alert-spacing-block-end, var(--sds-c-alert-spacing-block-end, var(--lwc-spacingXSmall,0.5rem)));
+ padding-left: var(--slds-c-alert-spacing-inline-start, var(--sds-c-alert-spacing-inline-start, var(--lwc-spacingXSmall,0.5rem)));
+ color: var(--slds-c-alert-text-color, var(--sds-c-alert-text-color, var(--slds-g-color-neutral-base-100, var(--lwc-colorTextInverse,rgb(255, 255, 255)))));
+ font-weight: var(--slds-c-alert-font-weight, var(--sds-c-alert-font-weight));
+ text-align: center;
+ background-color: var(--slds-c-alert-color-background, var(--sds-c-alert-color-background, var(--slds-g-color-neutral-base-50, var(--lwc-colorBackgroundToast,rgb(116, 116, 116)))));
+ /* background-image: var(--slds-c-alert-image-background, var(--sds-c-alert-image-background, linear-gradient(45deg, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 25%, transparent 25%, transparent 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 75%, transparent 75%, transparent))); */
+ background-size: var(--slds-c-alert-size-background, var(--sds-c-alert-size-background, 64px 64px));
+ --slds-c-alert-color-background: #ba0517 !important;
+}
+.inputs {
+ padding-top: 0;
+ padding-right: var(--slds-c-input-spacing-horizontal-end, var(--sds-c-input-spacing-horizontal-end, var(--lwc-spacingMedium,1rem)));
+ padding-bottom: 0;
+ padding-left: var(--slds-c-input-spacing-horizontal-start, var(--sds-c-input-spacing-horizontal-start, var(--lwc-spacingSmall,0.75rem)));
+ width: 100%;
+ height: 1.875rem;
+ border: var(--lwc-borderWidthThin,1px) solid var(--slds-c-input-color-border, var(--sds-c-input-color-border, var(--slds-g-color-border-base-4, var(--lwc-colorBorderInput,rgb(201, 201, 201)))));
+ border-radius: var(--slds-c-input-radius-border, var(--sds-c-input-radius-border, var(--lwc-borderRadiusMedium,0.25rem)));
+ background-color: var(--slds-c-input-color-background, var(--sds-c-input-color-background, var(--slds-g-color-neutral-base-100, var(--lwc-colorBackgroundInput,rgb(255, 255, 255)))));
+ color: var(--slds-c-input-text-color, var(--sds-c-input-text-color));
+ box-shadow: var(--slds-c-input-shadow, var(--sds-c-input-shadow));
+ transition: border var(--lwc-durationQuickly,0.1s) linear,background-color var(--lwc-durationQuickly,0.1s) linear;
+ display: inline-block;
+ text-align: right !important;
+}
+
+.THIS .myCustomClass input {
+ text-align: right;
+}
+.THIS .slds-form-element__control input {
+ text-align: right;
+}
+.myCustomClass ::part(input) {
+ text-align: right;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.html b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.html
new file mode 100644
index 0000000..ab24d42
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.html
@@ -0,0 +1,867 @@
+<template>
+ <!-- 鍏ㄥ眬鍔犺浇鏍囪瘑 -->
+ <div class="exampleHolder" if:true={IsLoading} >
+ <lightning-spinner alternative-text="Loading" size="large" style="height: 100%;top: 0%; z-index: 7"></lightning-spinner>
+ </div>
+ <div style="float:right; z-index: 8;" >
+ <div class="demo-only demo-only_viewport" style="height:4.5rem;" if:true = {Tongzhishow}>
+ <div class="slds-notification-container" style={IsLeftStyle}>
+ <div aria-live="assertive" aria-atomic="true" class="slds-assistive-text">鎻愮ず</div>
+ <section class="slds-notification" role="dialog" aria-labelledby="noti77" aria-describedby="dialog-body-id-43" >
+ <div class="slds-notification__body" id="dialog-body-id-43" >
+ <a class="slds-notification__target slds-media" href="#" style={BgColorStyle}>
+ <div class="slds-media__body">
+ <!-- <h2 class="slds-text-heading_small slds-m-bottom_xx-small" id="noti77" style="color:white;">
+ <span class="slds-assistive-text" >task notification:</span>
+ 鎻愮ず
+ </h2> -->
+ <p style="color:white;" >{SaveShowText}</p>
+ </div>
+ </a>
+ <button class="slds-button slds-button_icon slds-button_icon-container slds-notification__close" title="close">
+ <lightning-icon class="my-icon" icon-name="utility:close" alternative-text="close" title="close" size="x-small" onclick={CloseAlert}></lightning-icon>
+ </button>
+ </div>
+ </section>
+ </div>
+ </div>
+ </div>
+ <!-- 鍏ㄥ眬鍔犺浇鏍囪瘑 -->
+ <!-- 鍩烘湰淇℃伅 -->
+ <!-- 鍩烘湰淇℃伅 -->
+ <div >
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鍩烘湰淇℃伅</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div >
+ <!-- 鍖婚櫌鍚� -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {HPName}:</label>
+ <div class="slds-form-element__control" style="width:230px; display: inline-block;">{oppInfo.HP_Name__c}</div>
+ <!-- 鍖婚櫌鍚� -->
+ <!-- 绉戝鍚� -->
+ <label class="slds-form-element__label" style="width:50px;text-align:right;margin-left: 10px;"> {DepartmentName}:</label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Department_Name__c}</div>
+ <!-- 绉戝鍚� -->
+ <!-- 閿�鍞笭閬� -->
+ <label class="slds-form-element__label" style="width:95px;text-align:right;margin-left: 52px;"> {SalesRoot}:</label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Sales_Root__c}</div>
+ <!-- 閿�鍞笭閬� -->
+ <!-- 璐у竵 -->
+ <label class="slds-form-element__label" style="width:90px;text-align:right;margin-left: 80px;"> {Currency}:</label>
+ <div class="slds-form-element__control" style="width:60px; display: inline-block;">{oppInfo.CurrencyIsoCode}</div>
+ <!-- 璐у竵 -->
+ </div>
+ <div >
+ <!-- 鎶ヤ环缂栫爜 -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right; margin-left: 20px;"> {QuotoNo}:</label>
+ <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Quote_No__c}</div>
+ <!-- 鎶ヤ环缂栫爜 -->
+ <!-- 鎶ヤ环鍚嶇О -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {QuotoName}:</label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="text" value={quo.QuoteName__c} disabled ={Decisiontag} onblur={QuoteNameAssignment}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.qname}>璇疯緭鍏ュ�硷紒</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!-- 鎶ヤ环鍚嶇О -->
+ <!-- 鎶ヤ环鎬婚 -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {TotalPrice}:</label>
+ <div class ="slds-form-element__control" style=" width:200px;display: inline-block;">{quo.QuoteTotal_Page__c}</div>
+ <!-- 鎶ヤ环鎬婚 -->
+ <!-- 浜у搧鏍囧噯瀹氫环鎬婚 -->
+ <label class="slds-form-element__label" style="width:110px;text-align:right; margin-left: 10px;">浜у搧鏍囧噯瀹氫环鎬婚:</label>
+ <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Estimation_List_Price__c}</div>
+ <!-- 浜у搧鏍囧噯瀹氫环鎬婚 -->
+ </div>
+ <div >
+ <!-- 锛迹锛娴嬮閿�鍞� -->
+ <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ForecastAmounts}:</label>
+ <!-- <div class="slds-form-element__control" style="width:170px; display: inline-block;">{oppInfo.Wholesale_Price__c}</div> -->
+ <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.OCM_Sales_Forecast__c}</div>
+ <!-- 锛迹锛娴嬮閿�鍞� -->
+ <!-- 鏈�缁堝鎴锋垚浜や环锛堜粎OLY渚涜揣浜у搧) -->
+ <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ContactPrice}:</label>
+ <div class ="slds-form-element__control" style=" width:177px;display: inline-block;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Dealer_Final_Price_Page__c} disabled ={Decisiontag} onblur={DealerFinalPricePageChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.dfpp}>璇疯緭鍏ュ�硷紒</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!-- 鏈�缁堝鎴锋垚浜や环锛堜粎OLY渚涜揣浜у搧) -->
+ <!-- 涓绘満瑁呮満鍦� -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;">涓绘満瑁呮満鍦扮偣:</label>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;">
+ <lightning-combobox
+ name="progress"
+ value={quo.Installation_location__c}
+ options={HostInstallationLocationoptions}
+ onchange={HostInstallationLocationhandleChange} disabled ={Decisiontag}></lightning-combobox>
+ </div>
+ <!-- 涓绘満瑁呮満鍦� -->
+ <!-- 鎴愭湰 -->
+ <!-- <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 105px;"> {Cost} :</label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.Stocking_Price__c}</div> -->
+ <!-- 鎴愭湰 -->
+ </div>
+ <div >
+ <!-- 鍚堝悓淇濅慨鏈燂紙骞达級 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right; margin-left: 0px;">鍚堝悓淇濅慨鏈燂紙骞达級:</label>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:true={QuotCalfag}>
+ <lightning-combobox
+ data-parent-id="GuranteePeriodId"
+ name="progress"
+ value={quo.Gurantee_Period__c}
+ options={ContractWarrantyPeriodYearOptions}
+ onchange={ContractWarrantyPeriodYearHandleChange} disabled ={Decisiontag}></lightning-combobox>
+ </div>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:false={QuotCalfag}>
+ {quo.Gurantee_Period__c}
+ </div>
+ <!-- 鍚堝悓淇濅慨鏈燂紙骞达級 -->
+ <!-- 鍙栨秷甯傚満澶氬勾淇濅慨 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left:50px;">鍙栨秷甯傚満澶氬勾淇濅慨: </label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="checkbox" checked={quo.multiYearWarranty__c} disabled ={Decisiontag} onchange={multiYearWarrantyChange}> </lightning-input>
+ </div>
+ <!-- 鍙栨秷甯傚満澶氬勾淇濅慨 -->
+ <!-- 澶氬勾淇濅环鏍煎悎璁� -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 165px;">澶氬勾淇濅环鏍煎悎璁�: </label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.MultiYearWarrantyTotalPrice__c}</div>
+ <!-- 澶氬勾淇濅环鏍煎悎璁� -->
+ </div>
+ <div>
+ <!-- 鎶ヤ环鍙樺寲 -->
+ <label class="slds-form-element__label" style="width:80px;text-align:right; margin-left: 40px;">鎶ヤ环鍙樺寲: </label>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;">
+ <lightning-combobox
+ name="progress"
+ value={quo.QuotationChange__c}
+ options={QuotationChangesOptions}
+ onchange={QuotationChangesHandleChange} disabled ={Decisiontag}></lightning-combobox>
+ </div>
+ <!-- 鎶ヤ环鍙樺寲 -->
+ <!-- 涓绘満涓嶅甫鐩戣鍣ㄥ彴杞� -->
+ <label class="slds-form-element__label" style="width:130px;text-align:right;margin-left: 40px;">涓绘満涓嶅甫鐩戣鍣ㄥ彴杞�: </label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="checkbox" checked={quo.MainEngineWithoutMonitor__c} disabled ={Decisiontag} onchange={MainEngineWithoutMonitorChange}> </lightning-input>
+ </div>
+ <!-- 涓绘満涓嶅甫鐩戣鍣ㄥ彴杞� -->
+ <!-- 璺ㄧ瀹� -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 145px;">璺ㄧ瀹�: </label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="checkbox" checked={quo.Interdepartmental__c} disabled ={Decisiontag} onchange={InterdepartmentalChange}> </lightning-input>
+ </div>
+ <!-- 璺ㄧ瀹� -->
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鍩烘湰淇℃伅 -->
+ <!-- 缁忛攢鍟嗕环鏍� -->
+ <div >
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>缁忛攢鍟嗕环鏍�</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <!-- style="background-color:#ffd6c1" -->
+ <div >
+ <div style="margin-bottom: 15px; ">
+ <!--鎶ヤ环璋冩暣鎶樻墸 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">鎶ヤ环璋冩暣鎶樻墸</label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Calculate__c} disabled ={Decisiontag} onblur={QuoteAdjustCalculateChange} variant="label-hidden"> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.qacc}>璇疯緭鍏ュ�硷紒</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!--鎶ヤ环璋冩暣鎶樻墸 -->
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label>
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <!--鎶ヤ环璋冩暣閲戦 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">鎶ヤ环璋冩暣閲戦</label>
+ <div class ="slds-form-element__control" style=" display: inline-block; margin-left: 15px;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Amount_Page__c} disabled ={Decisiontag} onblur={QuoteAdjustAmountPageChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.qaapc}>璇疯緭鍏ュ�硷紒</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!--鎶ヤ环璋冩暣閲戦 -->
+ <!--鏄惁宸叉姤浠疯绠楁爣璇� -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 20px;">鏄惁宸叉姤浠疯绠�:</label>
+ <div class ="slds-form-element__control" style=" display: inline-block;" if:true={hidden}>
+ <lightning-input type="checkbox" checked={quo.IsQuoteTrial__c} disabled> </lightning-input>
+ </div>
+ <!--鏄惁宸叉姤浠疯绠楁爣璇� -->
+ </div>
+ <div style="margin-bottom: 5px; ">
+ <!--缁忛攢鍟嗕竴鍚嶇О -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">{SalesName1}</label>
+ <div style="display: inline-block;">
+ <c-jzlookuplightning2 data-parent-id="Agency1Id" recordid ={quoId} onsearchchange={onsearchchange1} objectname="Quote" fieldname="Agency1__c" variant = "label-hidden" lookupstyle="width:300px;"> </c-jzlookuplightning2>
+
+ <!-- <lightning-record-edit-form
+ object-api-name="Quote" record-id="0Q0Hy000000BMRYKA4">
+ <lightning-input-field field-name="Agency1__c" value="0011000000V9RBDAA3">
+ </lightning-input-field>
+ </lightning-record-edit-form>
+
+ <lightning-record-view-form
+ record-id="0Q0Hy000000BMRYKA4"
+ object-api-name="Quote">
+ <lightning-output-field field-name="Agency1__c" value="0011000000V9RBDAA3">
+ </lightning-output-field>
+ </lightning-record-view-form> -->
+
+
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency1}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency1}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!--缁忛攢鍟嗕竴鍚嶇О -->
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label>
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <!--缁忛攢鍟嗕竴鍚堝悓閲戦 -->
+ <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:false ={Decisiontag}>
+ <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={quo.IsQuoteTrial__c} onblur ={OCMAgent1PricePageonChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:true ={Decisiontag}>
+ <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={Decisiontag} onblur ={OCMAgent1PricePageonChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!--缁忛攢鍟嗕竴鍚堝悓閲戦 -->
+ <!-- 鍒╂鼎鏍囩 -->
+ <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}锛�</label>
+ <!-- 鍒╂鼎鏍囩 -->
+ <!--缁忛攢鍟嗕竴鍒╂鼎鏄剧ず -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency1_Profit__c}</div>
+ <!--缁忛攢鍟嗕竴鍒╂鼎鏄剧ず -->
+ <!--缁忛攢鍟嗕竴鐧惧垎姣旀樉绀� -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency1_Profit_Rate__c}</div>
+ <!--缁忛攢鍟嗕竴鐧惧垎姣旀樉绀� -->
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label>
+ <!-- 鐧惧垎姣旀爣绛� -->
+ </div>
+ <div style="margin-bottom: 15px; ">
+ <!--缁忛攢鍟嗕簩鍚嶇О -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">{Sales_Name2}</label>
+ <div style="display: inline-block;">
+ <c-jzlookuplightning2 data-parent-id="Agency2Id" recordid ={quoId} onsearchchange={onsearchchange2} objectname="Quote" fieldname="Agency2__c" variant = "label-hidden" lookupstyle="width:300px; display: inline-block;"> </c-jzlookuplightning2>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency2}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency2}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!--缁忛攢鍟嗕簩鍚嶇О -->
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label>
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <!--缁忛攢鍟嗕簩鍚堝悓閲戦 -->
+ <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Agent1_Agent2_Price_Page__c} disabled ={Decisiontag} onblur ={Agent1Agent2PricePageChange} > </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.aapp}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.naapp}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!--缁忛攢鍟嗕簩鍚堝悓閲戦 -->
+ <!-- 鍒╂鼎鏍囩 -->
+ <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}锛�</label>
+ <!-- 鍒╂鼎鏍囩 -->
+ <!--缁忛攢鍟嗕簩鍒╂鼎鏄剧ず -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency2_Profit__c}</div>
+ <!--缁忛攢鍟嗕簩鍒╂鼎鏄剧ず -->
+ <!--缁忛攢鍟嗕簩鐧惧垎姣旀樉绀� -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency2_Profit_Rate__c}</div>
+ <!--缁忛攢鍟嗕簩鐧惧垎姣旀樉绀� -->
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label>
+ <!-- 鐧惧垎姣旀爣绛� -->
+ </div>
+ <div style="margin-bottom: 15px; ">
+ <!-- 淇濆瓨 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={savebuttonClick} if:true={hidden}>淇濆瓨</button>
+ <!-- 淇濆瓨 -->
+ <!-- 淇濆瓨骞跺叧闂� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={Saveandback} if:true={hidden}>{Opp_Button}</button>
+ <!-- 淇濆瓨骞跺叧闂� -->
+ <!-- 鎶ヤ环璁$畻 -->
+ <button class={QTcss} style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={showQuotationCalculation} if:true={QuotCalfag}>鎶ヤ环璁$畻</button>
+ <!-- 鎶ヤ环璁$畻 -->
+ <!-- Decide -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decision_button} onclick={decisionbuttonClick} if:true={hidden}>{QuoteDecision_Button}</button>
+ <!-- Decide -->
+ <!-- 澶嶅埗 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={copyToClipboardNewQuoteEntry} if:true={hidden}>{Copy_Detail}</button>
+ <!-- 澶嶅埗 -->
+ <!-- 涓嶄繚瀛橈紙杩斿洖锛� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" onclick={noSaveback}>涓嶄繚瀛�(杩斿洖)</button>
+ <!-- 涓嶄繚瀛橈紙杩斿洖锛� -->
+ </div>
+
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 缁忛攢鍟嗕环鏍� -->
+ <!-- 閫夋嫨鎶ヤ环浜у搧 -->
+ <!-- <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct}></c-jz-data-table>
+ </div> -->
+ <div if:false={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>閫夋嫨鎶ヤ环浜у搧</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div style="margin-bottom: 15px; ">
+ <!-- 閫夋嫨浜у搧 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={NewQuotationProducts}>閫夋嫨浜у搧</button>
+ <!-- 閫夋嫨浜у搧 -->
+ <!-- 浜у搧閰嶅鎼滅储 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openSetProduct}>{SetProduct}</button>
+ <!-- 浜у搧閰嶅鎼滅储 -->
+ <!-- Excel瀵煎叆 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openQuoteExcelImport}>{ExcelImport}</button>
+ <!-- Excel瀵煎叆 -->
+ <!-- 鍒犻櫎 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={deletejzDataToBeproduct}>鍒犻櫎浜у搧</button>
+ <!-- 鍒犻櫎 -->
+ <!-- 鏇存柊浠锋牸鐘舵�� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick ={productCompare}>{StatusUpdate}</button>
+ <!-- 鏇存柊浠锋牸鐘舵�� -->
+ <!-- 鏇挎崲浜у搧otcode -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:130px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={updateOtcode}>鏇挎崲浜у搧otcode</button>
+ <!-- 鏇挎崲浜у搧otcode -->
+ </div>
+ <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table idkey="lineNo" miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct} if:true={tobeflag}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 閫夋嫨鎶ヤ环浜у搧 -->
+ <!-- 娴嬭瘯鎶ヤ环璁$畻缁勪欢 -->
+ <!-- <div if:true={pricePolicyflag1}>
+ <c-quote-trial paramid={quoId}></c-quote-trial>
+ </div> -->
+ <!-- 鎶ヤ环璁$畻寰呴�変骇鍝� -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鎶ヤ环璁$畻寰呴�変骇鍝�</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div style="min-height: 60px;">
+ <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedFnDefault} name="jzDataTableDefault" ongettabledata={getTableDataDefault} table-data={jzDataDefault} table-is-loding={tableIsLodingDefault} options={initDataTableDefault}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鎶ヤ环璁$畻寰呴�変骇鍝� -->
+ <!-- 鎶ヤ环璁$畻浣跨敤浠锋牸鏀跨瓥 -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鎶ヤ环璁$畻浣跨敤浠锋牸鏀跨瓥</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div if:true={buttonIsShow}>
+ <!-- <button class="slds-button slds-button_brand" onclick={showModal}>閫夋嫨淇冮攢鏂规鍥哄畾浠锋牸</button> -->
+ <!-- 閫夋嫨淇冮攢鏂规 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:170px;text-align:right; font-size:small;" onclick={showModal}>閫夋嫨淇冮攢鏂规鍥哄畾浠锋牸</button>
+ <!-- 閫夋嫨淇冮攢鏂规 -->
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalFix}>閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍�</button>
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={deleteFixedPrice}>鍒犻櫎</button>
+ </div>
+ <div if:true={jzDataTableFixedPriceIsShow}>
+ <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnFixedPrice} name="jzDataTableFixedPrice" ongettabledata={getTableDataFixedPrice} table-data={jzDataFixedPrice} table-is-loding={tableIsLodingFixedPrice} options={initDataTableFixedPrice} onsave={handleSaveFixedPrice} if:true={jzshows3}></c-jz-data-table>
+ </div>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鎶ヤ环璁$畻浣跨敤浠锋牸鏀跨瓥 -->
+ <!-- 鎶ヤ环璁$畻浣跨敤鎶樻墸鏀跨瓥 -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鎶ヤ环璁$畻浣跨敤鎶樻墸鏀跨瓥</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div if:true={buttonIsShow}>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalSpecial} >閫夋嫨鐗圭害鎶樻墸</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalCommonly}>閫夋嫨涓�鑸姌鎵�</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableDiscount}>鍒犻櫎</button>
+ </div>
+ <div if:true={jzDataTableDiscountIsShow}></div>
+ <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table class="jzdtdis" miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnDiscount} name="jzDataTableDiscount" ongettabledata={getTableDataDiscount} table-data={jzDataDiscount} table-is-loding={tableIsLodingDiscount} options={initDataTableDiscount} onsave={handleSaveDiscount} if:true={jzshows2}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鎶ヤ环璁$畻浣跨敤鎶樻墸鏀跨瓥 -->
+ <!-- 浜у搧鏄庣粏 -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>浜у搧鏄庣粏</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div if:true={buttonIsShow}>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableProduct}>鍒犻櫎</button>
+ </div>
+ <div style="min-height: 60px;max-height: 400px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table data-parent-id="chuxiao" idkey="DelectId" miniheight="min-height: 60px" onrowselection={SelectedFnProduct} name="jzDataTableProduct" ongettabledata={getTableDataProduct} table-data={jzDataProduct} table-is-loding={tableIsLodingProduct} options={initDataTableProduct} if:true={jzshows}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 浜у搧鏄庣粏 -->
+ <!-- 鎶ヤ环璁$畻搴曢儴 -->
+ <div if:true={pricePolicyflag}>
+ <!-- 鍚堝悓鎬讳环 -->
+ <p align="center" ><b>鍚堝悓鎬讳环锛歿ContractPrice}</b></p>
+ <!-- 鍚堝悓鎬讳环 -->
+ <!-- 淇濆瓨鎶ヤ环璁$畻缁撴灉鎸夐挳 -->
+ <div align="right" style="margin-bottom: 15px;margin-right: 15px; ">
+ <button if:true={buttonIsShow} style="font-size:small;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" onclick={saveAllDataProductFn}>淇濆瓨鎶ヤ环璁$畻缁撴灉</button>
+ </div>
+ <!-- 淇濆瓨鎶ヤ环璁$畻缁撴灉鎸夐挳 -->
+ </div>
+ <!-- 鎶ヤ环璁$畻搴曢儴 -->
+ <!-- 鏂囦欢鎵撳嵃 -->
+ <div >
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鏂囦欢鎵撳嵃</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div>
+ <!-- 鎵撳嵃鎶ヤ环 -->
+ <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Quote_Print}</label>
+ <!-- 鎵撳嵃鎶ヤ环 -->
+ <!-- 鍗曚环 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Unit_Price__c} onchange={UnitPriceChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">鍗曚环</label>
+ <!-- 鍗曚环 -->
+ <!-- 鎶ヤ环閲戦 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Offer_Amount__c} onchange={OfferAmountChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">鎶ヤ环閲戦</label>
+ <!-- 鎶ヤ环閲戦 -->
+ <!-- 鎶ヤ环鎬婚 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.TOTAL__c} onchange={TOTALChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{TotalPrice}</label>
+ <!-- 鎶ヤ环鎬婚 -->
+ <!-- 浼樻儬鎶樻墸 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Discount__c} onchange={DiscountChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Total_Discount_Percent}</label>
+ <!-- 浼樻儬鎶樻墸 -->
+ <!-- 浼樻儬浠锋牸 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Pricing__c} onchange={PricingChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">浼樻儬浠锋牸</label>
+ <!-- 浼樻儬浠锋牸 -->
+ <!-- 浼樻儬鎴愪氦浠� -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Preferential_Trading_Price__c} onchange={PreferentialTradingPriceChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Row_Total_Sum}</label>
+ <!-- 浼樻儬鎴愪氦浠� -->
+ <!-- 淇濅慨骞撮檺 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Preferential_Gurantee_Period__c} onchange={PreferentialGuranteePeriodChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;margin-left: 5px;">淇濅慨骞撮檺 </label>
+ <!-- 淇濅慨骞撮檺 -->
+ <!-- 鍚堝悓閰嶇疆 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px;" if:true={enableContract}>
+ <lightning-input type="checkbox" checked={quo.Contract__c} onchange={ContractcChange}> </lightning-input>
+ </div>
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px;" if:false={enableContract}>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;margin-left:5px;">{Contract_Breakdown}</label>
+ <!-- 鍚堝悓閰嶇疆 -->
+ </div>
+ <div>
+ <!-- 鎵撳嵃瀹㈡埛鍚嶇О -->
+ <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Print_HPName}</label>
+ <div class ="slds-form-element__control" style="width:400px; display: inline-block;">
+ <lightning-combobox
+ name="progress"
+ value={selection_hp}
+ options={PrintCustomerNameoptions}
+ onchange={PrintCustomerNamehandleChange} ></lightning-combobox>
+ </div>
+ <!-- 鎵撳嵃瀹㈡埛鍚嶇О -->
+ <!-- 鎵撳嵃鎸夐挳 -->
+ <div style="display: inline-block;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 380px; font-size:small;" disabled={print_buttonflg} onclick={PrintButton} if:true={hidden}>{Print_Button}</button>
+ </div>
+ <!-- 鎵撳嵃鎸夐挳 -->
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鏂囦欢鎵撳嵃 -->
+ <!-- 鏂板鎶ヤ环浜у搧妯℃�佹 -->
+ <div if:true = {showproductfalg} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-5">
+ <!-- 鎶ヤ环浜у搧鎼滅储妗� -->
+ <div class="exampleHolder" if:true={IsLoadingjdpt} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <!-- <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataProduct} options={initSearchFormProduct}></c-jz-search-form> -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label="浜у搧鍨嬪彿锛�" style="width:150px" onblur={jzProductsearchChange}></lightning-input>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={jzProductsearchbutton}>鎼滅储</button>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={additionaljzProductbutton}>杩藉姞</button>
+ </div>
+ <!-- 鎶ヤ环浜у搧鎼滅储妗� -->
+ <!-- 鎶ヤ环浜у搧鍒楄〃 -->
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedProductFn} data-parent-id="parent-div-productid" name="jzDataproductTable" ongettabledata={getTableProductData} table-data={jzProductData} table-is-loding={tableIsproductLoding} options={initDataProductTable} ></c-jz-data-table>
+ </div>
+ <!-- 鎶ヤ环浜у搧鍒楄〃 -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelProduct}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 鏂板鎶ヤ环浜у搧妯℃�佹 -->
+ <!-- 鏂板浜у搧閰嶅妯℃�佹 -->
+ <div if:true = {showSetProductfalg} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-10">
+ <!-- 浜у搧閰嶅鎼滅储妗� -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label=" 浜у搧閰嶅鍚嶏細" style="width:150px;margin-left: 20px;" onblur={jzSearchNameChange}></lightning-input>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label=" 浜у搧閰嶅缂栫爜锛�" style="width:150px;margin-left: 20px;" onblur={jzSearchCodeChange}></lightning-input>
+ </div>
+ <div class ="slds-form-element__control" style="width:150px; display: inline-block;;margin-left: 20px;">
+ <lightning-combobox
+ label = '閫傜敤绉戝 :'
+ name="setpro"
+ options={listViewOptions}
+ onchange={filterNameChange} ></lightning-combobox>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={jzsetProductsearchbutton}>鎼滅储</button>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={additionaljzsetProductbutton}>杩藉姞</button>
+ </div>
+ <!--浜у搧閰嶅鎼滅储妗� -->
+ <!-- 浜у搧閰嶅鍒楄〃 -->
+ <div class="exampleHolder" if:true={IsLoadingjdspt} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table data-parent-id="parent-div-setid" onrowselection={SelectedSetProductFn} name="jzDataSetProductTable" ongettabledata={getTableSetProductData} table-data={jzSetProductData} table-is-loding={tableIsSetProductLoding} options={initDataSetProductTable} ></c-jz-data-table>
+ </div>
+ <!-- 浜у搧閰嶅鍒楄〃 -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelsetProduct}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 鏂板浜у搧閰嶅妯℃�佹 -->
+ <!-- 鏂板Excel瀵煎叆妯℃�佹 -->
+ <div if:true = {showQuoteExcelImport} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-9">
+ <!-- 浜у搧閰嶅鎼滅储妗� -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{ImportText}</div>
+ <div class ="form-group" >
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{Tab_Text}</div>
+ </div>
+ <lightning-textarea class="inputFont" name="exceltext" onchange={exceltextChange} value={exceltextvalue}></lightning-textarea>
+
+ <!--浜у搧閰嶅鎼滅储妗� -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelQuoteExcelImport}>鍏抽棴</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSQuoteExcelImport} >淇濆瓨</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 鏂板Excel瀵煎叆妯℃�佹 -->
+ <!-- 閫夋嫨淇冮攢鏂规妯℃�佹 -->
+ <div if:true = {show} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
+ <!-- 淇冮攢鏂规鎼滅储妗� -->
+ <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchData} options={initSearchForm}></c-jz-search-form>
+ <!-- 淇冮攢鏂规鎼滅储妗� -->
+ <!-- 淇冮攢鏂规鍒楄〃 -->
+ <div class="exampleHolder" if:true={IsLoading6} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFn} data-parent-id="parent-div-id" name="jzDataTable1" ongettabledata={getTableData} table-data={jzData} table-is-loding={tableIsLoding} options={initDataTable} onsave={savejzData} if:true={jzdateflag}></c-jz-data-table>
+ </div>
+ <!-- 淇冮攢鏂规鍒楄〃 -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancel}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨淇冮攢鏂规妯℃�佹 -->
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍兼ā鎬佹 -->
+ <div if:true = {ShowFix} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2">
+ <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataFix} options={initSearchFormFix}></c-jz-search-form>
+ <c-jz-data-table onrowselection={SelectedFnFix} data-parent-id="parent-div-idFix" name="jzDataTableFix" ongettabledata={getTableDataFix} table-data={jzDataFix} table-is-loding={tableIsLodingFix} options={initDataTableFix}></c-jz-data-table>
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelFix}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍兼ā鎬佹 -->
+ <!-- 閫夋嫨鐗圭害鎶樻墸妯℃�佹 -->
+ <div if:true = {ShowSpecial} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <!-- 鐗圭害鎶樻墸妯℃�佹閿欒鎻愮ず -->
+ <div if:true = {ShowSpecialIsError}>
+ <div class="my-icons" role="alert">
+ <span class="slds-assistive-text">error</span>
+ <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed">
+ <svg class="slds-icon slds-icon_x-small" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use>
+ </svg>
+ </span>
+ <h2>{ShowSpecialError}
+ </h2>
+ <div class="slds-notify__close">
+ <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close">
+ <svg class="slds-button__icon" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use>
+ </svg>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ </div>
+ </div>
+ </div>
+ <!-- 鐗圭害鎶樻墸妯℃�佹閿欒鎻愮ず -->
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3">
+ <!-- 鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛� -->
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFnSpecial} data-parent-id="parent-div-idSpecial" name="jzDataTableSpecial" ongettabledata={getTableDataSpecial} table-data={jzDataSpecial} table-is-loding={tableIsLodingSpecial} options={initDataTableSpecial}></c-jz-data-table>
+ </div>
+ <!-- 鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛� -->
+ <!-- 鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛� -->
+ <div class="exampleHolder" if:true={IsLoading5} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%px;" size="medium"></lightning-spinner>
+ </div>
+ <div style="border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFnOtherData} data-parent-id="parent-div-idOtherData" name="jzDataTableOtherData" ongettabledata={getTableDataOtherData} table-data={jzDataOtherData} table-is-loding={tableIsLodingOtherData} options={initDataTableOtherData} onsave={SaveSpecialDiscount} if:true={jzshows5}></c-jz-data-table>
+ </div>
+ <!-- 鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛� -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSpecial}>鍏抽棴</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSpecial} >纭畾</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨鐗圭害鎶樻墸妯℃�佹 -->
+ <!-- 閫夋嫨涓�鑸姌鎵fā鎬佹 -->
+ <div if:true = {ShowCommonly} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <!-- 涓�鑸姌鎵fā鎬佹閿欒鎻愮ず -->
+ <div if:true = {ShowCommonlyIsError}>
+ <div class="my-icons" role="alert">
+ <span class="slds-assistive-text">error</span>
+ <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed">
+ <svg class="slds-icon slds-icon_x-small" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use>
+ </svg>
+ </span>
+ <h2>{ShowCommonlyError}
+ <a href="#"></a>
+ </h2>
+ <div class="slds-notify__close">
+ <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close">
+ <svg class="slds-button__icon" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use>
+ </svg>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ </div>
+ </div>
+ </div>
+ <!-- 涓�鑸姌鎵fā鎬佹閿欒鎻愮ず -->
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-4">
+ <!-- 浜у搧绯诲垪 -->
+ <div class ="form-group">
+ <div class ="form-group" style=" display: inline-block; margin-right: 20px;margin-bottom: 15px;">
+ <div class="slds-form-element">
+ <label class="slds-form-element__label" for="select-01">浜у搧绯诲垪锛�</label>
+ <div class="slds-form-element__control">
+ <div class="slds-select_container">
+ <select class="slds-select" style="width:150px" onchange={handleChangeLb}>
+ <option value="">閫夋嫨</option>
+ <option>GI鍒嗛噹</option>
+ <option>SP鍒嗛噹</option>
+ <option>ET鍒嗛噹</option>
+ <option>鑳介噺鍒�澶�</option>
+ </select>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 浜у搧绯诲垪 -->
+ <!-- 浣跨敤鎶樻墸 -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label="浣跨敤鎶樻墸锛�" style="width:150px" onblur={handleChangeZk}></lightning-input>
+ </div>
+ <!-- 浣跨敤鎶樻墸 -->
+ </div>
+ <!-- 涓�鑸姌鎵e緟閫変骇鍝佸垪琛� -->
+ <div class="exampleHolder" if:true={IsLoading4} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%px;" size="medium"></lightning-spinner>
+ </div>
+ <div style="border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFnCommonly} data-parent-id="parent-div-idCommonly" name="jzDataTableCommonly" ongettabledata={getTableDataCommonly} table-data={jzDataCommonly} table-is-loding={tableIsLodingCommonly} options={initDataTableCommonly} onsave={SaveGeneralDiscount} if:true={jzshows4}></c-jz-data-table>
+ </div>
+ <!-- 涓�鑸姌鎵e緟閫変骇鍝佸垪琛� -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelCommonly}>鍏抽棴</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSaveCommonly}>纭畾</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨涓�鑸姌鎵fā鎬佹 -->
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
new file mode 100644
index 0000000..4dc9370
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
@@ -0,0 +1,3268 @@
+import { LightningElement,wire,track,api} from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import Quoto_No from '@salesforce/label/c.Quoto_No';
+import Quoto_Name from '@salesforce/label/c.Quoto_Name';
+import HP_Name from '@salesforce/label/c.HP_Name';
+import Department_Name from '@salesforce/label/c.Department_Name';
+import Currency from '@salesforce/label/c.Currency';
+import Total_Price from '@salesforce/label/c.Total_Price';
+import Contact_Price from '@salesforce/label/c.Contact_Price';
+import Forecast_Amounts from '@salesforce/label/c.Forecast_Amounts';
+import Sales_Root from '@salesforce/label/c.Sales_Root';
+import Status_Update from '@salesforce/label/c.Status_Update';
+import Set_Product from '@salesforce/label/c.Set_Product';
+import Excel_Import from '@salesforce/label/c.Excel_Import';
+import deleteLabel from '@salesforce/label/c.deleteLabel';
+import Cost from '@salesforce/label/c.Cost';
+import Calculate from '@salesforce/label/c.Calculate';
+import AdjustAmount from '@salesforce/label/c.AdjustAmount';
+import Quote_Adjustment from '@salesforce/label/c.Quote_Adjustment';
+import Amount from '@salesforce/label/c.Amount';
+import Sales_Profit from '@salesforce/label/c.Sales_Profit';
+import Percent from '@salesforce/label/c.Percent';
+import Sales_Name1 from '@salesforce/label/c.Sales_Name1';
+import Sales_Name2 from '@salesforce/label/c.Sales_Name2';
+import Error_Message33 from '@salesforce/label/c.Error_Message33';
+import Opp_Button from '@salesforce/label/c.Opp_Button';
+import QuoteDecision_Button from '@salesforce/label/c.QuoteDecision_Button';
+import Copy_Detail from '@salesforce/label/c.Copy_Detail';
+import Quote_Print from '@salesforce/label/c.Quote_Print';
+import Detail_Price from '@salesforce/label/c.Detail_Price';
+import Detail_Sum from '@salesforce/label/c.Detail_Sum';
+import Total_Discount_Percent from '@salesforce/label/c.Total_Discount_Percent';
+import Total_Discount_Amount from '@salesforce/label/c.Total_Discount_Amount';
+import Row_Total_Sum from '@salesforce/label/c.Row_Total_Sum';
+import Contract_Breakdown from '@salesforce/label/c.Contract_Breakdown';
+import Print_HPName from '@salesforce/label/c.Print_HPName';
+import Print_Button from '@salesforce/label/c.Print_Button';
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import QuoteEntryMaxLine2 from '@salesforce/label/c.QuoteEntryMaxLine2';
+import Sales_Outlet from '@salesforce/label/c.Sales_Outlet';
+import OCM_Direct from '@salesforce/label/c.OCM_Direct';
+import Price_Valid_Period from '@salesforce/label/c.Price_Valid_Period';
+import Message_001 from '@salesforce/label/c.Message_001';
+import ImportText from '@salesforce/label/c.ImportText';
+import Tab_Text from '@salesforce/label/c.Tab_Text';
+import Paste_IE from '@salesforce/label/c.Paste_IE';
+import { CurrentPageReference } from "lightning/navigation";
+import selectQuoteById from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteById';
+import selectQuoteListLineItemCount from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteListLineItemCount';
+import selectQuoteLineItem from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteLineItem';
+import selecUser from '@salesforce/apex/lexNewQuoteEntryController.selecUser';
+import QuotCalfagAss from '@salesforce/apex/lexNewQuoteEntryController.QuotCalfagAss';
+import selectOpportunityById from '@salesforce/apex/lexNewQuoteEntryController.selectOpportunityById';
+import selectAccountById from '@salesforce/apex/lexNewQuoteEntryController.selectAccountById';
+import getPicklistValues from '@salesforce/apex/lexNewQuoteEntryController.getPicklistValues';
+import SaveQuote from '@salesforce/apex/lexNewQuoteEntryController.SaveQuote';
+import Print from '@salesforce/apex/lexNewQuoteEntryController.Print';
+import QuoteDecision from '@salesforce/apex/lexNewQuoteEntryController.QuoteDecision';
+import serContact from '@salesforce/apex/lexNewQuoteEntryController.serContact'
+import serSetContact from '@salesforce/apex/lexNewQuoteEntryController.serSetContact'
+import setProductEntry from '@salesforce/apex/lexNewQuoteEntryController.setProductEntry'
+import excelImport from '@salesforce/apex/lexNewQuoteEntryController.excelImport'
+import getModulus from '@salesforce/apex/lexNewQuoteEntryController.getModulus'
+import getquoDes from '@salesforce/apex/lexNewQuoteEntryController.getquoDes'
+import getProduct2 from '@salesforce/apex/NewQuoteEntryWebService.getProduct2';
+import updateOTCodeweb from '@salesforce/apex/NewQuoteEntryWebService.updateOTCode';
+import getQuoteLineItem from '@salesforce/apex/NewQuoteEntryWebService.getQuoteLineItem';
+import Message_Please_Save_Quote from '@salesforce/label/c.Please_Save_Quote';
+import Message_Check_Your_Clipboard from '@salesforce/label/c.Check_Your_Clipboard';
+import SelectAllDataDiscount from '@salesforce/apex/QuoteTrialController.selectAllDataDiscount';
+import GetPromotionDefalut from '@salesforce/apex/QuoteTrialController.GetPromotionDefalut';
+import GetPromotionPromotionSearch from '@salesforce/apex/QuoteTrialController.GetPromotionPromotionSearch';
+import GetNormalProductSearch from '@salesforce/apex/QuoteTrialController.GetNormalProductSearch';
+import GetAuthorizerSearch from '@salesforce/apex/QuoteTrialController.GetAuthorizerSearch';
+import GetSearchProductById from '@salesforce/apex/QuoteTrialController.GetSearchProductById';
+import saveAllDataProduct from '@salesforce/apex/QuoteTrialController.saveAllDataProduct';
+import SelectAllDataProduct from '@salesforce/apex/QuoteTrialController.selectAllDataProduct';
+import GetQuoteData from '@salesforce/apex/QuoteTrialController.GetQuoteData';
+import GetAgencyRName from '@salesforce/apex/QuoteTrialController.GetAgencyRName';
+import selectUpdateFiexedpriceData from '@salesforce/apex/QuoteTrialController.selectUpdateFiexedpriceData';
+import selectUpdateQuoteLineItemData from '@salesforce/apex/QuoteTrialController.selectUpdateQuoteLineItemData';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {localParseInt,toNum,initDataTableToBeproductConfig,saveEvoluationLogic,oppInfosave,quoLineItemsave,filterNameoptionList,initDataSetProductTablefig,quoteTotalPriceActionLogic,CheckForCost,actState,tStringe,
+toNumComma,localParseFloat,NewQcopyLogic,productCompareLogic,bflag,jzProductsearchLogic,additionaljzProductLogic,initDataProductTablefig,checkNMPA,saveQuotel,CheckForListPrice,calGuranteePeriodLogic,EstimationL,checkch,
+additionabuttonLoc,DataStatus,InitializeProductAssignment,PriceStatusUpdateLogic,newQuoteFlagex,calGuranteeAllFieldsLogic,MultiYearWarrantyTotalPriceExport,newQuoteFlagExp,AlertForCFDA,UnitPriceUpdateLogic,nafgExp,flg,
+PrintCustomerNameoptionsvlue,selection_hpExp,options_hpflgExp,initquoassignment,initquoassignmentcopy,salesProfit1Logic,salesCalculation1Logic,salesProfit2Logic,salesCalculation2Logic,SubtotalupdateLogic,alfExp,resultFlag,
+productStatusUpdatedExp,initQuoteLineItemcheck,MarkRed,quoteAgencyTotalPriceActionLogic,calPriceAllLogic,QuoteAdjustLogic,quoExp,AgencyDiscountCalculation1Logic,onsaveToBeproductLoc,fagExp,PrintButtonLoc,alertExp,decisionlol,
+saverebackloc,DisCalculationfunctionLoc,quoteTotalPriceLoc,calUnitPriceTotalLoc,ListPriceTotalExp,unitPriceTotalExp,pageArrangeLoc,openQuotePage,errorflg,StrExp,quoteinit,IsQuoteTrialExp,setOCMAmountc,DisAmountfunctionc} from "./lexNexQuoteEntryUtil.js";
+import {arrTempsss,arrProductTempsss,initDataTableProduct2,initDataTable2,initSearchForm2,getQueryVariable,ChangeFiexedData,GetUUID,initDataTableDefault2,
+initSearchFormDefalt2,QTcssE,initDataTableFixedPrice2,initDataTableDiscount2,initDataTableSpecial2,initSearchFormFix2,initDataTableFix2,CompareDataL,isChangeExp,
+initDataTableOtherData2,initDataTableCommonly2,ProductAssignmentSelect,ProductSelected,UnselectedScheme,SelectedScheme,commonlyDiscountLogic,ChangeProductData,
+PriceConsolidation,ReplacementUnitPriceLogic,ConsolidatedDiscountDetailsLogic,ConsolidatedDiscountPolicyLogic,
+addOfferLogic,ReverseCalculationModifyDiscountLogic,HeTongPriceComputeLogic,InverseCalculationTiShi,ContractPriceComputeLogic,GeneralDiscountContractSummaryLogic,handleSaveFixedPriceLogic,
+SpecialSavesChangePartLogic,NewDefaultDatass,AddProductDatass,jzDataFixedPriceTemps,jzDataDiscountTemps,updatesNumsLogic,updateCDLogic,DeftCopyQtyLists,initquoT,buttonIsShowE,initDTFP,initDTD,initDTOD,initDTC ,
+countListAndNodLogic,jzDataDefaultExp,jzDataProductExp,jzDataFixedPriceExp,jzDataDiscountExp,comparisonUniqueKeyLogic,SearchProductByIdLogic,jzDataDefaultCopyQuantityListExp,AddNumsLogic,CompareFullDataExp,SelectedFnCommonlyLogic,
+ComputeDataPromotionLogic,newArrsTemp3Exp,newArrsTemp4Exp,jzDataDefaultCopyExp,ComputeDataNormalProductLogic,ComputeDiscountAuthorizerLogic,newArrsTempExp,newArrsTemp2Exp,MergeDuplicateSchemesLogic,delectTableDiscountTempLogic,
+handleSaveDiscountLogic,booleanExp,boolean2Exp,boolean3Exp,newDataExp,newData2Exp,newData3Exp,editnewDateExp,GuaranteeDiscount__cZuiXiaoExp,NormalDiscount__cZuiXiaoExp,HeTongTotalExp,SelectedFnDataFixedPriceExp,deleteFixedPriceLogic,
+CompareFullDataTempExp,jzDataDefaultNotChangeExp,DeleteChangesFnLogic,deleteFixedPriceTempLogic,GetSearchProductByIdLogic,iflagExp,getTableDataCommonlyLogic,idsExp,DeleteIsChangelogicExp,DeleteIsChangesFnjiage,falgExp,
+DeleteIsChangesFnzhekou,SaveGeneralDiscountLogic,DeleteSchemeMatchingLogic,savecountLogic,ComparePushDataLogic,newTempExp,saveAllDataProductFnChuanshen,saveAllDataProductFnPanduan,ifnullExp} from "./lexquoteTrialUtil.js";
+
+export default class LexNewQuoteEntry extends LightningElement {
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.fragment;
+ if (urlValue) {
+ this.location = urlValue;
+ }
+ }
+ }
+ location = '';
+ @track
+ pricePolicyflag1 = false;
+ @track
+ ImportText = ImportText;
+ @track
+ Tab_Text = Tab_Text;
+ @track
+ Paste_IE = Paste_IE;
+ @track
+ QuotoNo = Quoto_No;
+ @track
+ QuotoName = Quoto_Name;
+ @track
+ HPName = HP_Name;
+ @track
+ DepartmentName = Department_Name;
+ @track
+ Currency = Currency;
+ @track
+ TotalPrice = Total_Price;
+ @track
+ ContactPrice = Contact_Price;
+ @track
+ ForecastAmounts = Forecast_Amounts;
+ @track
+ SalesRoot = Sales_Root;
+ @track
+ StatusUpdate = Status_Update;
+ @track
+ SetProduct = Set_Product;
+ @track
+ ExcelImport = Excel_Import;
+ @track
+ deleteLabel = deleteLabel;
+ @track
+ Cost = Cost;
+ @track
+ Calculate = Calculate;
+ @track
+ AdjustAmount = AdjustAmount;
+ @track
+ QuoteAdjustment = Quote_Adjustment;
+ @track
+ Amount = Amount;
+ @track
+ SalesProfit = Sales_Profit;
+ @track
+ Percent = Percent;
+ @track
+ SalesName1 = Sales_Name1;
+ @track
+ Sales_Name2 = Sales_Name2;
+ @track
+ Opp_Button = Opp_Button;
+ @track
+ QuoteDecision_Button = QuoteDecision_Button;
+ @track
+ Copy_Detail = Copy_Detail;
+
+ @track
+ Quote_Print = Quote_Print;
+ @track
+ Detail_Price = Detail_Price;
+ @track
+ Detail_Sum = Detail_Sum;
+ @track
+ Total_Discount_Percent = Total_Discount_Percent;
+ @track
+ Total_Discount_Amount = Total_Discount_Amount;
+ @track
+ Row_Total_Sum = Row_Total_Sum;
+ @track
+ Contract_Breakdown = Contract_Breakdown;
+ @track
+ Print_HPName = Print_HPName;
+ @track
+ Print_Button = Print_Button;
+ @track
+ QuotCalfag = false;
+
+ quoteEntryMaxLine = QuoteEntryMaxLine2;
+ @track
+ IsLoading = false;
+ OnLoading(flag) {
+ this.IsLoading = flag;
+ }
+ stylesLoaded = false;
+ renderedCallback(){
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ });
+ }
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
+ }
+ //鎶ヤ环瀵硅薄
+ @track
+ quo = {Installation_location__c:'',QuotationChange__c:''};
+ //璇环瀵硅薄
+ @track
+ oppInfo ={};
+ //鑷畾涔夌粨鏋�
+ @track
+ qb = {};
+ @track
+ hidden = false;
+ //鎴愭湰
+ hidden_Stocking_Price = '';
+ //璇环Id
+ oppId = '';
+ //鎶ヤ环Id
+ quoId = '';
+ //鏄惁璺宠繃鎶ヤ环璁$畻鏍囪瘑
+ SkipQuotefilg;
+ //澶嶅埗鎶ヤ环Id
+ copyid = '';
+ //鍐呭璐�
+ trade = '';
+ //鐩撮攢缁忛攢鍟嗘爣璇�
+ enableSales;
+ //鍒ゆ柇鐗规畩缁忛攢鍟嗕环鏍兼樉绀烘潈闄愭爣璇�
+ displayFlg;
+ //鐗规畩缁忛攢鍟嗕环鏍兼樉绀烘潈闄�
+ viewSpecialAgencyAmout
+ //褰撳墠鐧诲綍鐢ㄦ埛
+ User;
+ //鎶ヤ环淇敼鏉冮檺鏍囪瘑
+ verified;
+ //涓婁紶璁㈠崟鏉冮檺鏍囪瘑
+ specialAuthority;
+ //璇环浜у搧鎴愭湰鍙傜収鏉冮檺鏍囪瘑
+ displayCost;
+ //init鏌ヨ璇环鐩稿叧鏍囪瘑 start
+ QuoteDecision;
+ QuoteDecide;
+ QuoteSapSented;
+ QuoteCorrect;
+ @track
+ enableContract;
+ productStatusUpdated =false;
+ //init鏌ヨ璇环鐩稿叧鏍囪瘑 end
+ //鍚堝悓淇濅慨鏈燂紙骞达級鍏ㄥ眬
+ quoteGurantee_Period;
+ //鍙栨秷甯傚満澶氬勾淇濅慨鍏ㄥ眬
+ quotemultiYearWarranty;
+ //缁忛攢鍟嗗垵濮嬪寲鏃跺浠� start
+ agency1Name;
+ agency2Name;
+ Saleslet = false;
+ //缁忛攢鍟嗗垵濮嬪寲鏃跺浠� end
+ //鏁版嵁鏄惁鍙戠敓鍙樺寲鏍囪瘑
+ newQuoteFlag = false;
+ //鐘舵�佹洿鏂�
+ productStatusUpdated = false;
+ //鏌ヨ璇环鑾峰彇瀹㈡埛Id
+ accountid;
+ //鎵撳嵃鏍囪瘑
+ print_buttonflg = false;
+ //decide鎸夐挳鏍囪瘑
+ Decision_button = false;
+ sap_button;
+ //save鍜宒ecide鎸夐挳鏍囪瘑
+ Save_button = false;
+ Decisiontag = false;
+ //缁忛攢鍟嗕竴鍒╂鼎鏄剧ず
+ Salesprofit1value;
+ //缁忛攢鍟嗕簩鍒╂鼎鏄剧ず
+ Salesprofit2value;
+ //缁忛攢鍟嗕竴鐧惧垎姣旀樉绀�
+ SalesCalculation1value
+ //缁忛攢鍟嗕簩鐧惧垎姣旀樉绀�
+ SalesCalculation2value
+ //闅愯棌澶氬勾淇濅慨浠锋牸鍚堣
+ hidden_MultiYearWarrantyTotalPrice
+ //缁忛攢鍟嗘姌鎵�
+ WinOrDecideAlert;
+ //澶囦唤鍒濆鍖栨椂鐨勬姤浠疯椤圭洰
+ CheckItem;
+ //鍒濆鍖栨柟娉�
+ ifquocom = false;
+ acts = false;
+ actL = [];
+ connectedCallback() {
+ this.tobeflag = false;
+ this.quoteEntryMaxLine = Number(this.quoteEntryMaxLine);
+ debugger
+ this.SkipQuotefilg = false;
+ var quoteflg = true;
+ this.displayFlg = true;
+ this.WinOrDecideAlert = false;
+ this.OnLoading(true);
+ if(this.quoId == ''){
+ this.quoId = getQueryVariable('Id',this.location);
+ }
+ if(this.copyid == ''){
+ this.copyid = getQueryVariable('copyid',this.location);
+ }
+ if(this.oppId == ''){
+ this.oppId = getQueryVariable('oppid',this.location);
+ }
+ this.nafg = resultFlag(this.nafg,'');
+ selectQuoteListLineItemCount({quoId:this.quoId,oppId:this.oppId,copyid:this.copyid}).then(quoteByopp=>{
+ debugger
+ if(this.oppId){
+ if(this.copyid){
+ this.quoId = this.copyid;
+ }
+ }
+ if(quoteByopp.length > 0){
+ if (!this.oppId) {
+ this.oppId = quoteByopp[0].OpportunityId;
+ }
+ }
+ selecUser().then(Userobj=>{
+ this.User = Userobj;
+ if(JSON.stringify(Userobj) != "{}"){
+ this.verified =this.User.Quote_Correct__c;
+ this.specialAuthority = this.User.Quote_Special_Operation__c;
+ this.displayCost = this.User.Cost_Referable__c;
+ this.viewSpecialAgencyAmout = this.User.ViewSpecialAgencyAmout__c;
+ }
+ selectOpportunityById({oppId:this.oppId}).then(oppobj=>{
+ debugger
+ this.oppInfo = oppobj;
+ var oppvalue = JSON.stringify(oppobj);
+ getModulus({oppInfoc:oppvalue}).then(rtn=>{
+ this.oppInfo.rate_hospital = rtn.rate_hospital;
+ this.oppInfo.rate_agency1 = rtn.rate_agency1;
+ });
+ this.trade = '澶栬部';
+ if(JSON.stringify(oppobj) != "{}"){
+ this.trade = oppobj.Trade__c;
+ this.QuoteDecision = oppobj.Estimation_Decision__c;
+ this.QuoteDecide = this.QuoteDecision;
+ this.QuoteSapSented = oppobj.SAP_Send_OK__c;
+ this.QuoteCorrect = oppobj.New_Opportunity__c;
+ this.enableSales = false;
+ this.oppInfo.Wholesale_Price__c = toNumComma(oppobj.Wholesale_Price__c);
+ if (this.oppInfo.Sales_Root__c != null) {
+ if (oppobj.Sales_Root__c == '璨╁2搴�') {
+ this.enableSales = true;
+ this.oppInfo.Sales_Root__c = Sales_Outlet;
+ this.Saleslet = true;
+ } else {
+ this.enableSales = false;
+ this.oppInfo.Sales_Root__c = OCM_Direct;
+ }
+ }
+ this.accountid = this.oppInfo.AccountId;
+
+ if (this.QuoteDecision) {
+ this.enableContract = true;
+ } else {
+ this.enableContract = false;
+ }
+ this.oppInfo.SAP_Send_OK__c = true;
+ if (!this.oppInfo.SAP_Send_OK__c) {
+ this.displayFlg = true;
+ } else {
+ if(this.oppInfo.Agency1__r == undefined){
+ this.oppInfo.Agency1__r = {};
+ }
+ if(this.oppInfo.Agency2__r == undefined){
+ this.oppInfo.Agency2__r = {};
+ }
+ if(this.oppInfo.Account == undefined){
+ this.oppInfo.Account = {};
+ }else{
+ if(this.oppInfo.Account.Parent == undefined){
+ this.oppInfo.Account.Parent = {};
+ }
+ }
+ if (this.oppInfo.Agency1__r.Special__c || this.oppInfo.Agency2__r.Special__c || this.oppInfo.Account.Parent.Special__c) {
+ if (this.viewSpecialAgencyAmout) {
+ this.displayFlg = true;
+ } else {
+ this.displayFlg = false;
+ }
+ } else {
+ this.displayFlg = true;
+ }
+ }
+ }
+ debugger
+ if (!this.QuoteCorrect) {
+ this.print_buttonflg = true;
+ } else if (!this.verified) {
+ this.print_buttonflg = true;
+ } else {
+ this.print_buttonflg = false;
+ }
+ if (this.QuoteDecision == false) {
+ this.sap_button = true;
+ } else if (this.specialAuthority == false) {
+ this.sap_button = true;
+ } else {
+ this.sap_button = false;
+ }
+ if (this.verified) {
+ this.Decision_button = false;
+ } else if (!this.QuoteCorrect) {
+ this.Decision_button = true;
+ } else if (this.QuoteDecision) {
+ this.Decision_button = true;
+ } else {
+ this.Decision_button = false;
+ }
+ if (this.QuoteSapSented || this.QuoteDecision) {
+ this.Decision_button = true;
+ }
+ if (this.QuoteDecision) {
+ this.Save_button = true;
+ this.Decisiontag = true;
+ var lg = this.template.querySelectorAll('c-jzlookuplightning2');
+ lg.forEach(l=>{
+ l.todisabled();
+ })
+ } else {
+ this.Save_button = false;
+ this.Decisiontag = false;
+ this.initDataTableToBeproduct.columns[4].editable = true;
+ }
+ this.tobeflag = true;
+ this.OnLoading(false);
+ });
+ });
+ getquoDes().then(it=>{
+ QuotCalfagAss().then(r=>{
+ if(this.quoId !=''){
+ selectQuoteById({quoId:this.quoId}).then(quote=>{
+ debugger
+ this.quo=quote;
+ selectQuoteLineItem({quoId:this.quoId,copyid:this.copyid}).then(result=>{
+ debugger
+ var tempArr = result.split("---");
+ var quoteLineItem = JSON.parse(tempArr[0]);
+ this.CheckItem = JSON.parse(tempArr[1]);
+ if(JSON.stringify(quote) != "{}"){
+ debugger
+ if(this.copyid == ''){
+ this.quo = initquoassignment(quote,this.quo,it);
+ this.hidden = this.quo.rtn;
+ this.QuotCalfag = (r&&this.hidden);
+ this.quoteGurantee_Period = quote.Gurantee_Period__c;
+ this.quotemultiYearWarranty = quote.multiYearWarranty__c;
+ this.agency1Name = quote.Agency1__c;
+ this.agency2Name = quote.Agency2__c;
+ this.Salesprofit1value = quote.Agency1_Profit__c;
+ this.Salesprofit2value = quote.Agency2_Profit__c;
+ this.SalesCalculation1value = quote.Agency1_Profit_Rate__c;
+ this.SalesCalculation2value = quote.Agency2_Profit_Rate__c;
+ this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c;
+ this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c);
+ this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c);
+ }else{
+ this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c;
+ this.quo = initquoassignmentcopy(quote,this.quo,it);
+ this.hidden = this.quo.rtn;
+ this.QuotCalfag = (r&&this.hidden);
+ this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c);
+ this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c);
+
+ }
+ }
+ if(quoteLineItem.length > 0 && !this.QuoteDecision){
+ this.productStatusUpdated = false;
+ quoteLineItem = initQuoteLineItemcheck(quoteLineItem,this.productStatusUpdated);
+ this.newQuoteFlag = newQuoteFlagExp;
+ this.productStatusUpdated = productStatusUpdatedExp;
+ }
+ if(JSON.stringify(quoteLineItem) != "{}"){
+ quoteLineItem = InitializeProductAssignment(quoteLineItem);
+ if(this.acts){
+ quoteLineItem = actState(this.actL,quoteLineItem);
+ }
+ this.jzDataToBeproduct =[].concat(quoteLineItem);
+ }
+ this.pageArrange();
+ if (this.productStatusUpdated) {
+ this.calPriceAll();
+ this.setOCMAmount();
+ this.OnLoading(false);
+ } else {
+ this.EstimationListPrice();
+ this.calUnitPriceTotal();
+ this.setCostTatal();
+ this.checkProductStatusValidPeriod();
+ }
+ var IsQuoteTrial =this.quo.IsQuoteTrial__c;
+ this.ifquocom = IsQuoteTrial;
+ debugger
+ var z = this.quo.Estimation_List_Price__c;
+ var s = this.quo.OCM_Agent1_Price_Page__c;
+ var id = this.quoId;
+ debugger
+ if(!id){
+ if(!s){
+ var IsQuoteTrial =this.quo.IsQuoteTrial__c;
+ if(!IsQuoteTrial){
+ var mp =this.quo.MultiYearWarrantyTotalPrice__c;
+ mp = localParseFloat(mp);
+ var num = this.quo.Quote_Adjust_Calculate__c;
+ num = localParseFloat(num);
+ this.quo.Quote_Adjust_Calculate__c = toNumComma(num);
+ num = (100 + num) / 100;
+ z = localParseFloat(z);
+ var rh = this.oppInfo.rate_hospital;
+ var ra = this.oppInfo.rate_agency1;
+ this.quo.Dealer_Final_Price_Page__c = toNumComma(z*rh);
+ this.quo.OCM_Agent1_Price_Page__c = this.Saleslet ? toNumComma(z*num*ra+mp):'';
+ this.setOCMAmount()
+ this.calFromContactPrice();
+ }
+ }
+ this.OnLoading(false);
+ }
+ if(this.copyid){
+ this.quoId = '';
+ this.SkipQuotefilg = true;
+ }
+ });
+ this.quo = quoteinit(this.quo);
+ this.HiddenGurantee_Period = this.quo.Gurantee_Period__c;
+ });
+ }else{
+ this.quo = quoteinit(this.quo);
+ this.HiddenGurantee_Period = this.quo.Gurantee_Period__c;
+ this.quo.multiYearWarranty__c = false;
+ this.pageArrange();
+ this.hidden = it;
+ this.QuotCalfag = (r&&it);
+ }
+ });
+ });
+
+ });
+ //Add DTT - Hua Jian 20231018 Start
+ const inputAlignright = document.createElement('style');
+ inputAlignright .innerText = `.input-text-align_right input{ text-align: right!important; }`;
+ document.body.appendChild(inputAlignright);
+ //Add DTT - Hua Jian 20231018 End
+ }
+ pageArrange(){
+ this.quo = pageArrangeLoc(this.quo);
+ }
+ calPriceAll() {
+ debugger
+ this.calGuranteeAllFields();
+ this.jzDataToBeproduct = calPriceAllLogic(this.jzDataToBeproduct);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.EstimationListPrice();
+ this.calUnitPriceTotal();
+ this.quoteTotalPrice();
+ this.quoteAgencyTotalPriceAction();
+ this.AgencyDiscountCalculation1();
+ }
+ //
+ calGuranteeAllFields() {
+ this.jzDataToBeproduct = calGuranteeAllFieldsLogic(this.jzDataToBeproduct,this.quo);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.hidden_MultiYearWarrantyTotalPrice = MultiYearWarrantyTotalPriceExport;
+ this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(MultiYearWarrantyTotalPriceExport);
+ }
+ EstimationListPrice() {
+ this.jzDataToBeproduct = EstimationL(this.jzDataToBeproduct,this.quo);
+ this.quo = quoExp;
+ }
+
+ ListPriceTotalhidden = 0;
+ UnitPriceTotalhidden = 0;
+ calUnitPriceTotal() {
+ this.jzDataToBeproduct = calUnitPriceTotalLoc(this.jzDataToBeproduct);
+ this.ListPriceTotalhidden = ListPriceTotalExp;
+ this.UnitPriceTotalhidden = unitPriceTotalExp;
+ }
+
+ quoteTotalPrice() {
+ var result = quoteTotalPriceLoc(this.jzDataToBeproduct,this.quo,this.quoId,this.oppInfo,this.Saleslet);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(result);
+ var id = this.quoId;
+ if(!id){
+ var IsQuoteTrial =this.quo.IsQuoteTrial__c;
+ if(!IsQuoteTrial){
+ this.setOCMAmount();
+ this.calFromContactPrice();
+ }
+ }
+ this.DisAmountfunction();
+ this.QuoteAdjust();
+ this.salesProfit2();
+ this.setCostTatal();
+ }
+ setOCMAmount() {
+ debugger
+ this.oppInfo = setOCMAmountc(this.enableSales,this.quo,this.oppInfo);
+ this.quo = quoExp;
+ }
+ /*
+ 鍖婚櫌鐨勫悎鍚岄噾棰� 鏍煎紡鍖栦负 甯﹀垎浣嶇鐨勫瓧娈�;
+ */
+ calFromContactPrice() {
+ var x = 0;
+ x = this.quo.Dealer_Final_Price_Page__c;
+ x = localParseFloat(x);
+ this.quo.Dealer_Final_Price_Page__c = toNumComma(x);
+ this.DisAmountfunction();
+ this.salesProfit1();
+ this.salesProfit2();
+ this.setCostTatal();
+ }
+
+ DisAmountfunction() {
+ this.quo = DisAmountfunctionc(this.quo);
+ this.DisCalculationfunction();
+ }
+ DisCalculationfunction() {
+ this.quo = DisCalculationfunctionLoc(this.quo);
+ }
+ salesProfit1() {
+ this.Salesprofit1value = salesProfit1Logic(this.quo,this.Salesprofit1value);
+ this.quo = quoExp;
+ this.salesCalculation1();
+ }
+ salesCalculation1() {
+ this.SalesCalculation1value = salesCalculation1Logic(this.quo,this.Salesprofit1value,this.SalesCalculation1value);
+ this.quo = quoExp;
+ }
+ salesProfit2() {
+ this.Salesprofit2value = salesProfit2Logic(this.quo,this.Salesprofit2value);
+ this.quo = quoExp;
+ this.salesCalculation2();
+ this.salesProfit1();
+ }
+
+ salesCalculation2() {
+ this.SalesCalculation2value = salesCalculation2Logic(this.quo,this.Salesprofit2value,this.SalesCalculation2value)
+ this.quo = quoExp;
+ }
+ setCostTatal() {
+ var z = 0;
+ this.jzDataToBeproduct.forEach(jzdtbt=>{
+ var s = 0;
+ s = localParseFloat(jzdtbt.Cost_Subtotal_c);
+ if (!isNaN(s)) {
+ z = z + s;
+ }
+ });
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.hidden_Stocking_Price = toNum(z);
+ if (this.displayCost) {
+ this.quo.Stocking_Price__c = toNumComma(z);
+ }
+ }
+ QuoteAdjust() {
+ this.jzDataToBeproduct = QuoteAdjustLogic(this.jzDataToBeproduct,this.quo,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+
+ quoteAgencyTotalPriceAction() {
+ this.jzDataToBeproduct = quoteAgencyTotalPriceActionLogic(this.jzDataToBeproduct,this.quo,this.oppInfo,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+ AgencyDiscountCalculation1() {
+ this.jzDataToBeproduct = AgencyDiscountCalculation1Logic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+ Confirm_PriceRefresh = '鎶ヤ环浣滄垚鍚�'+Price_Valid_Period+'澶�,杩樻病鏈夋洿鏂拌繃浠锋牸锛岄渶瑕佹墽琛�'+Status_Update+'锛�';
+ checkProductStatusValidPeriod() {
+ var period = this.quo.PriceRefreshPeriod;
+ if (parseInt(period) > parseInt(Price_Valid_Period) && this.QuoteDecide != true) {
+ if (confirm(this.Confirm_PriceRefresh)) {
+ this.productCompare();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+ productCompare() {
+ try {
+ var returnflg;
+ var b = true;
+ var t = this.trade;
+ var ids = new Array();
+ this.jzDataToBeproduct.forEach(jzdtbt=>{
+ var id =jzdtbt.pageObject.Id__c;
+ if (id != '') {
+ ids.push(jzdtbt.pageObject.Id__c);
+ }
+ });
+ getProduct2({ids:ids}).then(results=>{
+ debugger
+ var id2Product = new Object();
+ for (var j = 0; j < results.length; j++) {
+ id2Product[results[j].Id] = results[j];
+ }
+ var reslut = productCompareLogic(this.jzDataToBeproduct,id2Product,t,b);
+ b = bflag;
+ this.jzDataToBeproduct =[].concat(reslut);
+ if (b == false) {
+ if (window.confirm(Message_001)) {
+ this.PriceStatusUpdate();
+ this.OnLoading(false);
+ this.productStatusUpdated = true;
+ this.WinOrDecideAlert = false;
+ returnflg = true;
+ } else {
+ returnflg = false;
+ }
+ } else {
+ this.Alert("浠锋牸鐘舵�佹病鏈夊彉鍖栥��",'warning');
+ this.productStatusUpdated = true;
+ returnflg = false;
+ }
+ });
+ return returnflg;
+ } catch (e) {
+ this.Alert(e,'error');
+ }
+
+ }
+ //鏇挎崲浜у搧otcode
+ updateOtcode() {
+ this.OnLoading(true);
+ var id = this.quoId;
+ var nmpa = checkNMPA(this.jzDataToBeproduct);
+ if (nmpa) {
+ updateOTCodeweb({tempQuoId: id}).then(results=>{
+ if (results) {
+ this.Alert('浜у搧otcode鏇挎崲瀹屾垚锛�','success');
+ window.location.reload();
+ } else {
+ this.Alert('浜у搧otcode鏇挎崲澶辫触锛岃鑱旂郴绠$悊鍛橈紒','error');
+ }
+ this.OnLoading(false);
+ });
+ } else {
+ this.OnLoading(false);
+ this.Alert('鎶ヤ环琛岄」鐩病鏈塏MPA鐘舵�佷负鍋滄鐨勪骇鍝侊紝鏃犳硶鏇挎崲锛�','error');
+ }
+ }
+ PriceStatusUpdate(){
+ this.setOppFromOppInfo();
+ //鍏ㄤ欢娲椼亜鏇裤亪銇椼伨銇欍��
+ if (this.jzDataToBeproduct.length > 0) {
+ this.jzDataToBeproduct = PriceStatusUpdateLogic(this.jzDataToBeproduct,this.newQuoteFlag);
+ this.newQuoteFlag = newQuoteFlagex;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.productStatusUpdated = true;
+ }
+ this.pageArrange();
+ this.calPriceAll();
+ this.Alert('鏇存柊瀹屾瘯锛�','success');
+ }
+ setOppFromOppInfo() {
+ this.oppInfo.Agency1__c = this.quo.Agency1__c;
+ this.oppInfo.Agency2__c = this.quo.Agency2__c;
+ }
+
+ quoteAgencyTotalPriceAction1(str) {
+ var Sales_Root = this.oppInfo.Sales_Root__c;
+ Sales_Root = Sales_Root + '';
+ Sales_Root = Sales_Root.replace(/\s+/g, "");
+ if (str == Sales_Root) {
+ this.quoteAgencyTotalPriceAction();
+ }
+ }
+ //鎶ヤ环鍚嶇О璧嬪��
+ QuoteNameAssignment(event){
+ this.quo.QuoteName__c = event.target.value;
+ }
+ //鏈�缁堝鎴锋垚浜や环Change浜嬩欢
+ DealerFinalPricePageChange(event){
+ this.quo.Dealer_Final_Price_Page__c = event.target.value;
+ debugger
+ this.calFromContactPrice();
+ this.setOCMAmount();
+ this.quoteAgencyTotalPriceAction1('OCM鐩存帴閿�鍞�');
+ }
+ //璁$畻锛呯殑change
+ QuoteAdjustCalculateChange(event){
+ debugger
+ if(this.quo.Quote_Adjust_Calculate__c !== event.target.value){
+ this.quo.Quote_Adjust_Calculate__c = event.target.value;
+ this.UnitPriceUpdate();
+ event.target.value = this.quo.Quote_Adjust_Calculate__c;
+ }
+ }
+ //璋冩暣閲戦鐨刢hange
+ QuoteAdjustAmountPageChange(event){
+ debugger
+ if(this.quo.Quote_Adjust_Amount_Page__c !== event.target.value){
+ this.quo.Quote_Adjust_Amount_Page__c = event.target.value;
+ this.calFromQuoAmont()
+ }
+ }
+ //缁忛攢鍟嗕竴鍚堝悓閲戦change
+ OCMAgent1PricePageonChange(event){
+ this.quo.OCM_Agent1_Price_Page__c = event.target.value;
+ this.salesProfit1();
+ this.setOCMAmount();
+ this.quoteAgencyTotalPriceAction1('缁忛攢鍟�');
+ this.AgencyDiscountCalculation1();
+ }
+ //缁忛攢鍟嗕簩鍚堝悓閲戦change
+ Agent1Agent2PricePageChange(event){
+ this.quo.Agent1_Agent2_Price_Page__c = event.target.value;
+ this.salesProfit2();
+ }
+
+ copyToClipboardNewQuoteEntry() {
+ var QuoteId = this.quoId;
+ if (QuoteId == null || QuoteId == '') {
+ this.Alert(Message_Please_Save_Quote,'error');
+ return null;
+ }
+ var records;
+ var x;
+ var targetString = tStringe;
+ try {
+ getQuoteLineItem({
+ quoId: QuoteId
+ }).then(reslut=>{
+ NewQcopyLogic(Message_Check_Your_Clipboard,records,x,targetString,reslut,this.displayCost,this.oppInfo.CurrencyIsoCode);
+ if(alfExp){
+ this.Alert(alertExp,'success');
+ }else{
+ this.Alert(alertExp,'error');
+ }
+ });
+ } catch (e) {
+ this.Alert(e.faultcode + ',' + e.faultstring,'error');
+ }
+ }
+ @track
+ nafg={};
+ //淇濆瓨鎶ヤ环鎸夐挳
+ savebuttonClick(){
+ this.OnLoading(true);
+ this.checkchangedAfterPrint('sa');
+ if(this.fg){
+ this.sal();
+ }
+ }
+ sal(){
+ debugger
+ this.tobeflag=false;
+ var shut = AlertForCFDA(this.jzDataToBeproduct);
+ if (shut == true) {
+ this.Alert('鎻愮ず锛氬寘鍚噸鏂扮敵璇稢FDA鐨勪骇鍝侊紝涓嶅彲杩涜璁㈣揣銆�','error');
+ }
+ var cost = CheckForCost(this.jzDataToBeproduct);
+ if (cost) {
+ this.Alert('浜у搧鎴愭湰涓虹┖鏃朵笉鍙姤浠�!','error');
+ this.OnLoading(false);
+ this.tobeflag=true;
+ } else {
+ var er = '';
+ var listPrice = CheckForListPrice(this.jzDataToBeproduct);
+ if (listPrice) {
+ er = '鐩墠浜у搧瀹氫环鏈‘瀹氾紝璇蜂簬浜у搧鏈儴鑱旂郴纭锛�';
+ }
+ var SaveQuotecan = saveQuotel(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert,this.productStatusUpdated,this.enableSales,
+ this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period,this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.quoteflg);
+ SaveQuote(SaveQuotecan).then(resaut=>{
+ debugger
+ var Setmap = new Map()
+ var key = Object.keys(resaut)
+ key.forEach(item=>{
+ Setmap.set(item,resaut[item]);
+ });
+ if(Setmap.has('errormessage')){
+ er += Setmap.get('errormessage');
+ this.quoteflg = false;
+ }else{
+ if(this.Sback){
+ window.open('/' +this.oppId, '_self');
+ }else{
+ if(Setmap.has('QuoteNo')){
+ this.quo.Quote_No__c = Setmap.get('QuoteNo');
+ }
+ if(this.quoteflg){
+ if(Setmap.has('quoId')){
+ this.quoId = Setmap.get('quoId');
+ this.quo.IsQuoteTrial__c = false;
+ this.ifquocom = false;
+ this.quoteGurantee_Period = this.quo.Gurantee_Period__c;
+ this.quotemultiYearWarranty = this.quo.multiYearWarranty__c;
+ }
+ this.index = 3;
+ this.quoteTrialInit();
+ }else{
+ if(Setmap.has('warn')){
+ this.Alert(Setmap.get('warn'),'warning');
+ this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct);
+ this.acts = true;
+ this.actL = Setmap.get('act');
+ }else{
+ this.Alert(Setmap.get('success'),'success');
+ }
+ if(Setmap.has('quoId')){
+ debugger
+ this.quoId = Setmap.get('quoId');
+ window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_top');
+ this.location = 'Id='+ Setmap.get('quoId');
+ this.copyid = '';
+ this.oppId = '';
+ this.connectedCallback();
+ }
+ }
+ }
+
+ }
+ this.nafg = resultFlag(this.nafg,Setmap);
+ if(er){
+ this.Alert(er,'error');
+ }
+ this.tobeflag=true;
+ this.OnLoading(false);
+ });
+ return true;
+ }
+ }
+ //浠锋牸鏀跨瓥琛ㄥ崟寮�鍏虫爣璇嗙
+ jzDataTableFixedPriceIsShow = false;
+ //鎶ヤ环璁$畻鍒濆鍖�
+ quoteTrialInit(){
+ this.OnLoadSavesDatas();
+ this.OnLoadQuoteData(this.quoId);
+ var event = {
+ page: 1,
+ pageLimit: 10,
+ search: "",
+ sortOrder: "asc",
+ sortPlus: undefined,
+ fag: true
+ };
+ setTimeout(() => {
+ this.getTableDataFix(event);
+ this.getTableData(event);
+ }, 1000);
+ }
+ OnLoadProduct = []; //鏈�夋嫨浜у搧
+ OnLoadSaveProduct = []; //宸查�夋嫨浜у搧
+ OnLoadDiscount = []; //鎶樻墸鏀跨瓥
+ OnLoadFixDiscount = []; //浠锋牸鏀跨瓥
+ flagall = false;
+ OnLoadSavesDatas() {
+ debugger
+ SelectAllDataDiscount({
+ ParamIdStr: this.quoId
+ }).then(result => {
+ result.forEach(item => {
+ if (item.ismatch__c == "0") {
+ item = ProductAssignmentSelect(item);
+ this.OnLoadProduct.push(item);
+ } else if (item.ismatch__c == "1") {
+ item = ProductSelected(item);
+ this.OnLoadSaveProduct.push(item);
+ }
+ })
+ var arrss = [].concat(this.OnLoadSaveProduct);
+ this.addOffer(arrss);
+ this.comparisonUniqueKey();
+ if (this.OnLoadProduct != undefined && this.OnLoadProduct.length > 0) {
+ this.flagall = true;
+ this.jzDataDefault = this.OnLoadProduct;
+ if (this.jzDataDefault != undefined && this.jzDataDefault.length > 0) {
+ this.UpdateSaveDataQuoteLineItemSelectByID(0);
+ }
+ }
+ if (this.OnLoadSaveProduct != undefined && this.OnLoadSaveProduct.length > 0) {
+ this.flagall = true;
+ this.jzDataProduct = this.OnLoadSaveProduct;
+ debugger
+ if (this.jzDataProduct != undefined && this.jzDataProduct.length > 0) {
+ this.UpdateSaveDataQuoteLineItemSelectByID(1);
+ }
+ this.updateIdStr("1");
+ this.ContractPriceCompute();
+ }
+ })
+ SelectAllDataProduct({
+ ParamIdStr: this.quoId
+ }).then(result => {
+ result.forEach(items => {
+ if (items.typess__c == "鎶樻墸鏀跨瓥") {
+ items = UnselectedScheme(items);
+ this.OnLoadDiscount.push(items);
+ } else if (items.typess__c == "浠锋牸鏀跨瓥") {
+ items = SelectedScheme(items)
+ this.OnLoadFixDiscount.push(items);
+ }
+ })
+ this.comparisonUniqueKey();
+ if (this.OnLoadFixDiscount != undefined && this.OnLoadFixDiscount.length > 0) {
+ this.jzDataFixedPrice = this.OnLoadFixDiscount;
+ if (this.jzDataFixedPrice != undefined && this.jzDataFixedPrice.length > 0) {
+ this.UpdateSaveDataFixedPriceSelectByID();
+ }
+ }
+ if (this.OnLoadDiscount != undefined && this.OnLoadDiscount.length > 0) {
+ this.jzDataDiscount = this.OnLoadDiscount;
+ this.updateIdStr("2");
+ }
+ })
+ }
+ //鍚堝苟涓婁竴娆$殑鎶ヤ环琛�
+ lastQuotation = [];
+ addOffer(TrialLine) {
+ this.lastQuotation = [].concat(addOfferLogic(TrialLine));
+ }
+ index = 3;
+ comparisonUniqueKey() {
+ this.index--;
+ if (this.index == 0) {
+ comparisonUniqueKeyLogic(this.index,this.flagall,this.jzDataDefaultCopy,this.jzDataDefault,this.jzDataProduct,this.jzDataFixedPrice,this.jzDataDiscount,this.lastQuotation);
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataProduct = jzDataProductExp;
+ this.jzDataFixedPrice = jzDataFixedPriceExp;
+ this.jzDataDiscount = jzDataDiscountExp;
+ this.ContractPriceCompute()
+ }
+ }
+ Complate = false;
+ //浠庢暟鎹簱鏇存柊宸蹭繚瀛樼殑鏁版嵁 浜у搧 UpdateBy 2021 06 29
+ UpdateSaveDataQuoteLineItemSelectByID(flag) {
+ if (flag == 0) {
+ var idArr = [];
+ this.jzDataDefault.forEach(item => {
+ idArr.push(item.QuiteLineitem__c);
+ })
+ selectUpdateQuoteLineItemData({
+ ItemId: idArr
+ }).then(result => {
+ var newArr = [];
+ this.jzDataDefault.forEach(dp => {
+ var temp = {
+ ...{},
+ ...dp
+ };
+ result.forEach(item => {
+ if (item.Id == temp.QuiteLineitem__c) {
+ var keys = Object.keys(temp);
+ keys.forEach(k => {
+ var flag = ChangeProductData(k);
+ if (flag && item[k] != undefined && item[k] != temp[k]) {
+ this.Complate = true;
+ temp[k] = item[k];
+ }
+ })
+ }
+ })
+ newArr.push(temp);
+ })
+ this.jzDataDefault = newArr;
+ })
+ }
+ if (flag == 1) {
+ var idArrPro = [];
+ this.jzDataProduct.forEach(item => {
+ idArrPro.push(item.QuiteLineitem__c);
+ })
+ selectUpdateQuoteLineItemData({
+ ItemId: idArrPro
+ }).then(result => {
+ var newArr = [];
+ this.jzDataProduct.forEach(dp => {
+ var temp = {
+ ...{},
+ ...dp
+ };
+ result.forEach(item => {
+ if (item.Id == temp.QuiteLineitem__c) {
+ var keys = Object.keys(temp);
+ keys.forEach(k => {
+ var flag = ChangeProductData(k);
+ if (flag && item[k] != undefined && item[k] != temp[k]) {
+ this.Complate = true;
+ temp[k] = item[k];
+ }
+ })
+ }
+ })
+ newArr.push(temp);
+ })
+ debugger
+ this.jzDataProduct = newArr;
+ this.updateIdStr("1");
+ this.ContractPriceCompute();
+ })
+ }
+ }
+ //鍒犻櫎鏃堕渶瑕佺敤鐨勫敮涓�id鐨勬坊鍔�
+ updateIdStr(str) {
+ var newArr = [];
+ var indexNum = 0;
+ var jzdpdc = [];
+ if (str == "1") {
+ jzdpdc = [].concat(this.jzDataProduct);
+ } else if (str == "2") {
+ jzdpdc = [].concat(this.jzDataDiscount);
+ } else if (str == "3") {
+ jzdpdc = [].concat(this.jzDataFixedPrice);
+ }
+ jzdpdc.forEach(item => {
+ indexNum++;
+ var temp = {
+ ...item
+ };
+ temp.DelectId = indexNum;
+ newArr.push(temp);
+ })
+ if (str == "1") {
+ this.jzDataProduct = [].concat(newArr);
+ } else if (str == "2") {
+ this.jzDataDiscount = [].concat(newArr);
+ } else if (str == "3") {
+ this.jzDataFixedPrice = [].concat(newArr);
+ }
+ }
+ //鍚堝悓浠锋牸姹囨��
+ ContractPrice = 0;
+ ContractPriceCompute() {
+ this.HeTongPriceCompute();
+ this.ContractPrice = 0;
+ var sum = this.ContractPrice;
+ sum = parseFloat(sum);
+ sum=ContractPriceComputeLogic(sum,this.jzDataProduct,this.jzDataDiscount,this.jzDataFixedPrice);
+ this.ContractPrice = sum;
+ }
+ HeTongPriceCompute() {
+ var HeTongPriceList = [];
+ HeTongPriceList=HeTongPriceComputeLogic(this.jzDataDiscount,this.jzDataProduct);
+ if (HeTongPriceList.length > 0) {
+ this.jzDataDiscount = HeTongPriceList;
+ }
+ }
+ //浠庢暟鎹簱鏇存柊宸蹭繚瀛樼殑鏁版嵁 鏂规 UpdateBy 2021 06 29
+ UpdateSaveDataFixedPriceSelectByID() {
+ var idArr = [];
+ this.jzDataFixedPrice.forEach(item => {
+ idArr.push(item.Id);
+ })
+ selectUpdateFiexedpriceData({
+ ProId: idArr
+ }).then(result => {
+ var newArr = [];
+ this.jzDataFixedPrice.forEach(dp => {
+ var temp = {
+ ...{},
+ ...dp
+ };
+ result.forEach(item => {
+ if (item.Id == temp.Id) {
+ var keys = Object.keys(temp);
+ keys.forEach(k => {
+ var flag = ChangeFiexedData(k);
+ if (flag && item[k] != undefined && item[k] != temp[k]) {
+ temp[k] = item[k];
+ this.Complate = true;
+ }
+ })
+ }
+ })
+ newArr.push(temp);
+ })
+ this.jzDataFixedPrice = newArr;
+ this.updateIdStr("3");
+ })
+ }
+ //鍔犺浇鎶ヤ环鏁版嵁
+ QuoteData = [];
+ OnLoadQuoteData(idStr) {
+ GetQuoteData({
+ QuoteID: idStr
+ }).then(result => {
+ var responseObj = JSON.parse(result);
+ this.QuoteData = initquoT(responseObj,this.buttonIsShow,this.initDataTableFixedPrice,this.initDataTableDiscount,this.initDataTableOtherData,this.initDataTableCommonly);
+ this.buttonIsShow = buttonIsShowE;
+ this.initDataTableFixedPrice = initDTFP;
+ this.initDataTableDiscount = initDTD;
+ this.initDataTableOtherData = initDTOD;
+ this.initDataTableCommonly = initDTC;
+ this.jzDataTableFixedPriceIsShow = true;
+ this.jzDataTableDiscountIsShow = true;
+ this.QTcss = QTcssE(this.pricePolicyflag);
+ this.pricePolicyflag = true;
+ if(!this.QuoteDecision){
+ this.Save_button = true;
+ this.Decision_button = true;
+ }
+ })
+ }
+ //鎵撳嵃鎸夐挳
+ PrintButton(){
+ var id = this.quoId;
+ if (id == null || id == '') {
+ this.Alert(Error_Message33,'error');
+ return false;
+ }
+ return this.chkEstimation_Entry_Possibility(id);
+ }
+ chkEstimation_Entry_Possibility(q) {
+ try {
+ this.OnLoading(true);
+ var dataChun = PrintButtonLoc(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert,
+ this.productStatusUpdated,this.enableSales,this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period,
+ this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.QuoteDecision)
+ Print(dataChun).then(resaut=>{
+ debugger
+ this.quoId = saverebackloc(resaut,this.quoId,this.nafg);
+ this.OnLoading(false);
+ if(errorflg){
+ this.Alert(alertExp,'error');
+ this.nafg = nafgExp;
+ }
+ if(flg){
+ this.location = 'Id='+ this.quoId;
+ this.copyid = '';
+ this.oppId = '';
+ this.connectedCallback();
+ }
+ openQuotePage(this.quo.Contract__c,errorflg,this.quoId);
+ });
+ } catch (e) {
+ this.Alert(e,'error');
+ }
+ }
+ //涓嶄繚瀛樿繑鍥炴寜閽�
+ noSaveback(){
+ window.open('/' +this.oppId, '_self');
+ }
+ Sback = false;
+ //淇濆瓨骞惰繑鍥�
+ Saveandback(){
+ this.Sback = true;
+ this.savebuttonClick();
+ }
+ //decide鎶ヤ环鎸夐挳
+ decisionbuttonClick(){
+ debugger
+ this.checkchangedAfterPrint('de');
+ if(this.fg){
+ this.decisionlo();
+ }
+ }
+ decisionlo(){
+ var ff = decisionlol(this.jzDataToBeproduct,this.oppInfo,this.QuotationCalculationFag);
+ if(ff){
+ this.Alert(alertExp,'error');
+ }else{
+ this.chkSalesPossibilityDecision();
+ }
+ }
+ chkSalesPossibilityDecision() {
+ try {
+ debugger
+ this.tobeflag=false;
+ var quoc = saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var CheckItemCan = JSON.stringify(this.CheckItem);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ this.OnLoading(true);
+ if(this.WinOrDecideAlert &&(!this.productStatusUpdated)){
+ this.PriceStatusUpdate();
+ }
+ QuoteDecision({activitiesCan:quoLineItemCan,
+ CheckItemCan:CheckItemCan,
+ WinOrDecideAlertc:this.WinOrDecideAlert,
+ productStatusUpdatedc:this.productStatusUpdated,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan,
+ enableSalesc:this.enableSales,
+ oppIdc:this.oppId,
+ quoIdc:this.quoId,
+ newQuoteFlagc:this.newQuoteFlag,
+ changedAfterPrintc:this.changedAfterPrint,
+ quoteGurantee_Periodc:this.quoteGurantee_Period,
+ quotemultiYearWarrantyc:this.quotemultiYearWarranty,
+ selection_hpc:this.selection_hp,
+ SkipQuotefilgc:this.SkipQuotefilg
+ }).then(resaut=>{
+ debugger
+ var Setmap = new Map()
+ var key = Object.keys(resaut)
+ key.forEach(item=>{
+ Setmap.set(item,resaut[item]);
+ });
+ if(Setmap.has('errormessage')){
+ this.Alert(Setmap.get('errormessage'),'error');
+ if(Setmap.get('act')){
+ this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct);
+ }
+ }else{
+ if(Setmap.has('warn')){
+ this.Alert(Setmap.get('warn'),'warning');
+ this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct);
+ this.acts = true;
+ this.actL = Setmap.get('act');
+ }else{
+ this.Alert(Setmap.get('success'),'success');
+ }
+ if(Setmap.has('quoId')){
+ window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_self');
+ this.location = 'Id='+ Setmap.get('quoId');
+ this.copyid = '';
+ this.oppId = '';
+ this.connectedCallback();
+ }
+ this.QuoteDecision = true;
+ this.enableContract = true;
+ this.Save_button = true;
+ this.Decisiontag = true;
+ var lg = this.template.querySelectorAll('c-jzlookuplightning2');
+ lg.forEach(l=>{
+ l.todisabled();
+ })
+ this.initDataTableToBeproduct.columns[4].editable = false;
+ if (this.QuoteDecision == false) {
+ this.sap_button = true;
+ } else if (this.specialAuthority == false) {
+ this.sap_button = true;
+ } else {
+ this.sap_button = false;
+ }
+ this.Decision_button = true;
+ }
+ this.nafg = resultFlag(this.nafg,Setmap);
+ this.tobeflag=true;
+ this.OnLoading(false);
+ });
+ return true;
+ } catch (e) {
+ this.Alert(e,'error');
+ }
+ }
+ //淇濆瓨鍒ゆ柇鏄惁鐢熸垚鏂版姤浠锋爣璇�
+ fg = true;
+ changedAfterPrint = false;
+ QuotationCalculationFag = false;
+ checkchangedAfterPrint(dec) {
+ this.fg = true;
+ var id = this.quoId;
+ this.changedAfterPrint = false;
+ var detailChanged = false;
+ if (!id) {
+ return;
+ }else{
+ this.fg = false;
+ }
+ var activities = checkch(this.jzDataToBeproduct);
+ getQuoteLineItem({
+ quoId: id
+ }).then(results=>{
+ debugger
+ var quote_Date__c = null;
+ if (results.length > 0) {
+ quote_Date__c = results[0]['Quote']['Quote_Date__c'];
+ }
+ if (!detailChanged) {
+ if (activities.length != results.length) {
+ detailChanged = true;
+ }
+ }
+ if (!detailChanged) {
+ for (var j = 0; j < results.length; j++) {
+ if (results[j].PricebookEntryId != activities[j].PricebookEntryId ||
+ results[j].SFDA_Status__c != activities[j].SFDA_Status__c ||
+ results[j].UnitPrice__c != activities[j].UnitPrice__c ||
+ results[j].ListPrice__c != activities[j].ListPrice__c ||
+ results[j].Quantity != activities[j].Quantity
+ ) {
+ detailChanged = true;
+ break;
+ }
+ }
+ }
+ if(dec === 'de'){
+ var IsQuoteTrial = this.quo.IsQuoteTrial__c;
+ }else if(dec === 'sa'){
+ var IsQuoteTrial = this.ifquocom;
+ }
+ if (detailChanged && ((quote_Date__c != null && quote_Date__c != "" && quote_Date__c != undefined) || IsQuoteTrial)) {
+ this.changedAfterPrint = true;
+ }
+ if(detailChanged && !this.changedAfterPrint){
+ this.QuotationCalculationFag= true;
+ }else{
+ this.QuotationCalculationFag= false;
+ }
+ if(dec === 'de'){
+ this.decisionlo();
+ }else if(dec === 'sa'){
+ this.sal();
+ }
+ });
+ return;
+ }
+ calFromQuoAmont() {
+ var x = 0,
+ y = 0;
+ x = this.quo.hidden_Estimation_List;
+ x = localParseFloat(x);
+ y = this.quo.Quote_Adjust_Amount_Page__c;
+ this.quo.Quote_Adjust_Amount_Page__c = toNumComma(y);
+ y = localParseFloat(y);
+ var noDiscountPriceTotal = this.hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ this.quo.QuoteTotal_Page__c = toNumComma(y + x + noDiscountPriceTotal);
+ var z = this.quo.Estimation_List_Price__c;
+ var id = this.quoId;
+ if(!id){
+ var IsQuoteTrial = this.quo.IsQuoteTrial__c;
+ if(!IsQuoteTrial){
+ var mp =this.quo.MultiYearWarrantyTotalPrice__c;
+ mp = localParseFloat(mp);
+ var num = this.quo.Quote_Adjust_Calculate__c;
+ num = localParseFloat(num);
+ this.quo.Quote_Adjust_Calculate__c = toNumComma(num);
+ num = (100 + num) / 100;
+ z = localParseFloat(z);
+ var rh = this.oppInfo.rate_hospital;
+ var ra = this.oppInfo.rate_agency1;
+ this.quo.Dealer_Final_Price_Page__c = toNumComma(z*rh);
+ this.quo.OCM_Agent1_Price_Page__c = this.Saleslet ? toNumComma(z*num*ra+mp) : '';
+ this.setOCMAmount();
+ this.calFromContactPrice();
+ }
+ }
+ if (y == 0) {
+ this.quo.Quote_Adjust_Calculate__c = 0;
+ this.UnitPriceUpdate();
+ } else {
+ this.quoteTotalPriceAction();
+ }
+ }
+ UnitPriceUpdate() {
+ this.jzDataToBeproduct = UnitPriceUpdateLogic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.Subtotalupdate();
+ this.calUnitPriceTotal();
+ this.quoteTotalPrice();
+ }
+ Subtotalupdate() {
+ this.jzDataToBeproduct = SubtotalupdateLogic(this.jzDataToBeproduct);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+ quoteTotalPriceAction() {
+ this.jzDataToBeproduct = quoteTotalPriceActionLogic(this.quo,this.jzDataToBeproduct,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ debugger
+ this.quo = quoExp;
+ this.calUnitPriceTotal();
+ this.QuoteAdjust();
+ this.DisAmountfunction();
+ }
+
+ multiYearWarrantyChange(event){
+ debugger
+ this.quo.multiYearWarranty__c = event.detail.checked;
+ this.calPriceAll();
+ }
+ //涓绘満涓嶅甫鐩戣鍣ㄥ彴杞hange浜嬩欢
+ MainEngineWithoutMonitorChange(event){
+ this.quo.MainEngineWithoutMonitor__c = event.detail.checked;
+ }
+ //璺ㄧ瀹hange浜嬩欢
+ InterdepartmentalChange(event){
+ this.quo.Interdepartmental__c = event.detail.checked;
+ this.calPriceAll();
+ }
+ //鍗曚环change浜嬩欢
+ UnitPriceChange(event){
+ this.quo.Unit_Price__c = event.detail.checked;
+ }
+ //鎶ヤ环閲戦change浜嬩欢
+ OfferAmountChange(event){
+ this.quo.Offer_Amount__c = event.detail.checked;
+ }
+ //鎶ヤ环鎬婚change浜嬩欢
+ TOTALChange(event){
+ this.quo.TOTAL__c = event.detail.checked;
+ }
+ //浼樻儬鎶樻墸change浜嬩欢
+ DiscountChange(event){
+ this.quo.Discount__c = event.detail.checked;
+ }
+ //浼樻儬浠锋牸change浜嬩欢
+ PricingChange(event){
+ this.quo.Pricing__c = event.detail.checked;
+ }
+ //浼樻儬鎴愪氦浠穋hange浜嬩欢
+ PreferentialTradingPriceChange(event){
+ this.quo.Preferential_Trading_Price__c = event.detail.checked;
+ }
+ //淇濅慨骞撮檺change浜嬩欢
+ PreferentialGuranteePeriodChange(event){
+ this.quo.Preferential_Gurantee_Period__c = event.detail.checked;
+ }
+ //鍚堝悓閰嶇疆change浜嬩欢
+ ContractcChange(event){
+ this.quo.Contract__c = event.detail.checked;
+ }
+
+ //涓绘満瑁呮満鍦� optionList
+ HostInstallationLocationoptionsvalue = [];
+ get HostInstallationLocationoptions() {
+ if(this.HostInstallationLocationoptionsvalue.length<=0){
+ getPicklistValues({objstr:'Quote',fld:'Installation_location__c',ifempty:true}).then(keyvalue=>{
+ this.HostInstallationLocationoptionsvalue = keyvalue;
+ });
+ }else{
+ return this.HostInstallationLocationoptionsvalue
+ }
+ }
+
+ HostInstallationLocationhandleChange(event) {
+ this.quo.Installation_location__c = event.detail.value;
+ }
+
+ //鍚堝悓淇濅慨鏈燂紙骞达級start
+ ContractWarrantyPeriodYearOptionsvalue = [];
+ get ContractWarrantyPeriodYearOptions() {
+ if(this.ContractWarrantyPeriodYearOptionsvalue.length<=0){
+ getPicklistValues({objstr:'Quote',fld:'Gurantee_Period__c',ifempty:false}).then(keyvalue=>{
+ this.ContractWarrantyPeriodYearOptionsvalue = keyvalue;
+ });
+ }else{
+ return this.ContractWarrantyPeriodYearOptionsvalue
+ }
+ }
+
+ ContractWarrantyPeriodYearHandleChange(event) {
+ debugger
+ this.quo.Gurantee_Period__c = event.detail.value;
+ this.calGuranteePeriod();
+ }
+ // 鏇存柊澶氬勾淇濅慨 淇濅慨鏈�
+ //闅愯棌鍚堝悓淇濅慨鏈燂紙骞达級
+ HiddenGurantee_Period;
+ calGuranteePeriod() {
+ var AllGurantee_Period = this.quo.Gurantee_Period__c;
+ this.HiddenGurantee_Period = AllGurantee_Period;
+ this.jzDataToBeproduct = calGuranteePeriodLogic(this.jzDataToBeproduct,AllGurantee_Period);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+
+ //鎶ヤ环鍙樺寲 start
+ QuotationChangesOptionsvalue = [];
+ get QuotationChangesOptions() {
+ if(this.QuotationChangesOptionsvalue.length<=0){
+ getPicklistValues({objstr:'Quote',fld:'QuotationChange__c',ifempty:true}).then(keyvalue=>{
+ this.QuotationChangesOptionsvalue = keyvalue;
+ });
+ }else{
+ return this.QuotationChangesOptionsvalue
+ }
+ }
+
+ QuotationChangesHandleChange(event) {
+ this.quo.QuotationChange__c = event.detail.value;
+ }
+ // 缁忛攢鍟嗕竴鍚嶇О杈撳叆妗� start
+ onsearchchange1(event){
+ this.quo.Agency1__c = event.detail.value;
+ }
+ // 缁忛攢鍟嗕簩鍚嶇О杈撳叆妗� start
+ onsearchchange2(event){
+ this.quo.Agency2__c = event.detail.value;
+ }
+ //鎶ヤ环浜у搧閫変腑鏁版嵁
+ @track
+ selectjzDataTableToBeproduct = [];
+ SelectedToBeproduct(event) {
+ let arr = event.detail.rows;
+ this.selectjzDataTableToBeproduct = arr;
+ }
+ //鍒犻櫎鎶ヤ环浜у搧鎸夐挳
+ deletejzDataToBeproduct(){
+ debugger
+ var delFlag=false;
+ var num = this.jzDataToBeproduct.length;
+ for (var j = 0; j < this.selectjzDataTableToBeproduct.length; j++) {
+ for (var i = 0; i < this.jzDataToBeproduct.length; i++) {
+ if (this.selectjzDataTableToBeproduct[j].lineNo == this.jzDataToBeproduct[i].lineNo) {
+ this.jzDataToBeproduct.splice(i, 1);
+ i--;
+ delFlag=true;
+ }
+ }
+ }
+ var ItemL = MarkRed(this.jzDataToBeproduct);
+ this.jzDataToBeproduct =[].concat(ItemL);
+ if(this.jzDataToBeproduct.length!=num){
+ this.quo.IsQuoteTrial__c = false;
+ }
+ if(!delFlag){
+ this.Alert("璇烽�夋嫨鍙互鎿嶄綔鐨勮",'error');
+ }
+ console.warn(this.jzDataToBeproduct.length);
+ this.calPriceAll();
+ }
+ getTableDataToBeproduct(event) {
+ }
+ @track jzDataToBeproduct = [];
+ @track tableIsLodingToBeproduct = false;
+ @track
+ initDataTableToBeproduct = initDataTableToBeproductConfig;
+ @track
+ tobeflag = true
+ //鎶ヤ环浜у搧缂栬緫鍒�
+ onsaveToBeproduct(event){
+ debugger
+ this.tobeflag = false
+ var data = event.detail.rows;
+ this.jzDataToBeproduct = onsaveToBeproductLoc(data,this.jzDataToBeproduct);
+ if(fagExp){
+ this.quo.IsQuoteTrial__c = false;
+ this.quoteAgencyTotalPriceAction();
+ this.AgencyDiscountCalculation1();
+ }
+ this.updateNoDiscountPricetotal();
+ this.EstimationListPrice();
+ this.calUnitPriceTotal();
+ this.quoteTotalPrice();
+ setTimeout(() => {
+ this.tobeflag = true;
+ },1);
+ }
+ // 璁$畻 No Discount Price鍚堣
+ updateNoDiscountPricetotal() {
+ var noDiscountPriceTotal = 0;
+ this.jzDataToBeproduct.forEach(jzdtbt=>{
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ var Quantity = jzdtbt.Quantity__c;
+ Quantity = localParseFloat(Quantity);
+ noDiscountPriceTotal = noDiscountPriceTotal + noDiscountPrice * Quantity;
+ if (jzdtbt.NoDiscountTotal__c) {
+ jzdtbt.NoDiscountTotal__c = toNumComma(noDiscountPrice * Quantity);
+ }
+ });
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.hidden_MultiYearWarrantyTotalPrice = noDiscountPriceTotal;
+ this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(noDiscountPriceTotal);
+ }
+ handleRowAction(event){
+ debugger
+ const actionName = event.detail.row;
+ }
+ //鎵撳紑浜у搧閰嶅妯℃�佹寮�鍏�
+ @track
+ showSetProductfalg = false;
+ //浜у搧閰嶅鎸夐挳
+ openSetProduct(event){
+ this.showSetProductfalg = true;
+ }
+ //浜у搧閰嶅 optionList
+ get listViewOptions() {
+ return filterNameoptionList();
+ }
+ // 浜у搧閰嶅妯℃�佹鍏抽棴
+ cancelsetProduct(){
+ this.showSetProductfalg = false;
+ this.jzSetProductData = [];
+ }
+ // 閫傜敤绉戝
+ filterName;
+ // 閫傜敤绉戝Change浜嬩欢
+ filterNameChange(event){
+ this.filterName = event.target.value;
+ }
+ // 浜у搧閰嶅鍚�
+ setSearchName;
+ //浜у搧閰嶅鍚岰hange浜嬩欢
+ jzSearchNameChange(event){
+ this.setSearchName = event.target.value;
+ }
+ //浜у搧閰嶅缂栫爜
+ SearchCode;
+ //浜у搧閰嶅缂栫爜Change浜嬩欢
+ jzSearchCodeChange(event){
+ this.SearchCode = event.target.value;
+ }
+ initDataSetProductTable = initDataSetProductTablefig;
+ @track
+ jzSetProductData = [];
+ @track
+ tableIsSetProductLoding = false;
+ @track
+ IsLoadingjdspt = false;
+ //浜у搧閰嶅鎼滅储
+ jzsetProductsearchbutton(){
+ debugger
+ this.IsLoadingjdspt = true;
+ let SearchCode = this.SearchCode;
+ let filterName = this.filterName;
+ let setSearchName = this.setSearchName;
+ serSetContact({SearchName:setSearchName,SearchCode:SearchCode,filterName:filterName}).then(result=>{
+ this.jzSetProductData = result;
+ this.IsLoadingjdspt = false;
+ });
+ }
+ //浜у搧閰嶅閫変腑鏁版嵁
+ SelectedNewsetProduct = []
+ //浜у搧閰嶅閫変腑鏁版嵁
+ SelectedSetProductFn(event){
+ let arr = event.detail.rows;
+ this.SelectedNewsetProduct = arr;
+ }
+ //杩藉姞浜у搧閰嶅鎼滅储
+ additionaljzsetProductbutton(){
+ debugger
+ var dataChunanshen = additionabuttonLoc(this.SelectedNewsetProduct,this.quo,this.oppInfo,this.jzDataToBeproduct)
+ var num = this.jzDataToBeproduct.length;
+ var isPrepared = DataStatus;
+ var Str = StrExp;
+ if(isPrepared!='Fin'){
+ confirm(isPrepared);
+ }else if(!Str){
+ if(confirm("鎮ㄥ皻鏈�夊彇浠讳綍浜у搧閰嶅锛岀‘璁ゅ畬鎴愪箞锛�")){
+ this.cancelsetProduct();
+ }else{
+ }
+ }else{
+ this.OnLoading(true);
+ setProductEntry(dataChunanshen).then(reslut=>{
+ var tempArr=reslut.split("---");
+ var errormessage=tempArr[0];
+ var quoteLineItem=JSON.parse(tempArr[1]);
+ quoteLineItem=InitializeProductAssignment(quoteLineItem);
+ this.jzDataToBeproduct=quoteLineItem;
+ if(quoteLineItem.length!=num){
+ this.quo.IsQuoteTrial__c=false;
+ }
+ this.calPriceAll();
+ if(errormessage.indexOf('鎴愬姛') >= 0){
+ this.Alert(errormessage,'success');
+ }else{
+ this.Alert(errormessage,'error');
+ }
+ this.OnLoading(false);
+ });
+ this.cancelsetProduct();
+ }
+ this.SelectedNewsetProduct = [];
+ }
+
+ getTableSetProductData(event) {
+ this.tableIsproductLoding = false;
+ }
+ @track
+ showQuoteExcelImport = false;
+ openQuoteExcelImport(event){
+ this.showQuoteExcelImport = true;
+ }
+ cancelQuoteExcelImport(){
+ this.showQuoteExcelImport = false;
+ this.exceltextvalue = '';
+ }
+ SavesSQuoteExcelImport(){
+ let Str = this.exceltextvalue;
+ var num = this.jzDataToBeproduct.length;
+ var quoc = saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ this.OnLoading(true);
+ excelImport({excel_text:Str,
+ activitiesCan:quoLineItemCan,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan}).then(reslut=>{
+ debugger
+ var tempArr = reslut.split("---");
+ var errormessage = tempArr[0];
+ var quoteLineItem = JSON.parse(tempArr[1]);
+ quoteLineItem = InitializeProductAssignment(quoteLineItem);
+ this.jzDataToBeproduct = quoteLineItem;
+ if(quoteLineItem.length!=num){
+ this.quo.IsQuoteTrial__c = false;
+ }
+ this.calPriceAll();
+ if(errormessage.indexOf('鎴愬姛') >= 0){
+ this.Alert(errormessage,'success');
+ }else{
+ this.Alert(errormessage,'error');
+ }
+
+ this.OnLoading(false);
+ this.cancelQuoteExcelImport();
+ });
+ }
+ @track
+ exceltextvalue;
+ exceltextChange(event){
+ let value = event.detail.value;
+ this.exceltextvalue = value;
+ }
+ //鎵撳紑鏂板缓浜у搧妯℃�佹寮�鍏�
+ showproductfalg = false;
+ //鏂板鎶ヤ环浜у搧鎸夐挳
+ NewQuotationProducts(event){
+ this.showproductfalg = true;
+ }
+ @track
+ IsLoadingjdpt = false;
+ //閫夋嫨鏁版嵁
+ SelectedNewProduct = [];
+ //鏂板鎶ヤ环浜у搧鍒楄〃閫変簨浠�
+ SelectedProductFn(event) {
+ let arr = event.detail.rows;
+ this.SelectedNewProduct = arr;
+ }
+ //杩藉姞鏂板浜у搧鎸夐挳
+ additionaljzProductbutton(){
+ debugger
+ if(this.SelectedNewProduct.length == 0){
+ if(confirm("鎮ㄥ皻鏈�夊彇浠讳綍浜у搧锛岀‘璁ゅ畬鎴愪箞锛�")){
+ this.cancelProduct();
+ }
+ }else{
+ this.tobeflag = false
+ var selectvlue = this.SelectedNewProduct;
+ var Listvalue = this.jzDataToBeproduct;
+ this.jzDataToBeproduct = additionaljzProductLogic(selectvlue,Listvalue,this.oppInfo.CurrencyIsoCode,this.quo.IsQuoteTrial__c);
+ if(alertExp){
+ this.Alert(alertExp,'error');
+ }
+ setTimeout(() => {
+ this.tobeflag = true;
+ },1);
+ this.quo.IsQuoteTrial__c = IsQuoteTrialExp;
+ this.calPriceAll();
+ this.cancelProduct();
+ this.SelectedNewProduct = [];
+ }
+ }
+ //鏂板鎶ヤ环浜у搧妯℃�佹鍙栨秷鎸夐挳
+ cancelProduct() {
+ this.showproductfalg = false;
+ this.jzProductData = [];
+ }
+ //鏂板鎶ヤ环浜у搧妫�绱㈡潯浠�
+ @track
+ SearchName = '';
+ jzProductsearchChange(event){
+ if(this.SearchName != event.target.value){
+ this.SearchName = event.target.value;
+ }
+ }
+ //鏂板鎶ヤ环浜у搧妫�绱㈡寜閽�
+ jzProductsearchbutton(event){
+ debugger
+ this.IsLoadingjdpt = true;
+ let tradec = this.oppInfo.CurrencyIsoCode;
+ let celon = this.oppInfo.CelonOpportunity;
+ let SearchName = this.SearchName;
+ serContact({tradec:tradec,SearchName:SearchName,celon:celon}).then(result=>{
+ this.jzProductData = jzProductsearchLogic(result);
+ this.IsLoadingjdpt = false;
+ });
+ }
+ //鏂板鎶ヤ环浜у搧鍒楄〃鍔犺浇鏁版嵁
+ getTableProductData(event) {
+ this.tableIsproductLoding = false;
+ }
+ //鏂板鎶ヤ环浜у搧鍒楄〃鏁版嵁
+ @track jzProductData = [];
+ //鏂板鎶ヤ环浜у搧鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsproductLoding = true;
+ // 鏂板鎶ヤ环浜у搧鍒楄〃鍒楅厤缃�
+ @track
+ initDataProductTable = initDataProductTablefig;
+
+ //鎵撳紑鎶ヤ环璁$畻鏍囪瘑
+ quoteflg = false;
+ @track
+ QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder";
+ showQuotationCalculation(event){
+ debugger
+ if(this.pricePolicyflag){
+ this.QTcss = QTcssE(this.pricePolicyflag);
+ this.pricePolicyflag = false;
+ this.quoteflg = false;
+ this.OnLoadProduct = [];
+ this.jzDataDefault = [];
+ this.OnLoadSaveProduct = [];
+ this.jzDataProduct = [];
+ this.OnLoadDiscount = [];
+ this.jzDataDiscount = [];
+ this.OnLoadFixDiscount = [];
+ this.jzDataFixedPrice = [];
+ this.ContractPriceCompute();
+ if(!this.QuoteDecision){
+ this.Save_button = false;
+ this.Decision_button = false;
+ }
+ }else{
+ this.quoteflg = true;
+ if(this.QuoteDecision){
+ this.quoteTrialInit();
+ }else{
+ this.savebuttonClick();
+ }
+ }
+ }
+ //鎶ヤ环璁$畻鍖哄煙灞曞紑鏍囪瘑
+ pricePolicyflag = false;
+ //鎶ヤ环璁$畻鎸夐挳灞曞紑鏍囪瘑
+ buttonIsShow = false;
+ //鍚堝悓鎬讳环
+ ContractPrice = 0;
+ ifFTip=true;
+ //淇濆瓨鎶ヤ环璁$畻缁撴灉鎸夐挳鏂规硶
+ saveAllDataProductFn() {
+ var dataChunanshen = saveAllDataProductFnChuanshen(this.jzDataFixedPrice,this.jzDataDiscount,this.quoId,this.QuoteData,this.jzDataProduct,this.jzDataDefault,this.ContractPrice)
+ var newTemp = newTempExp;
+ if (this.jzDataDefault.length == 0) {
+ var ifnunum = saveAllDataProductFnPanduan(this.jzDataProduct,newTemp);
+ var ifnull = ifnullExp;
+ if (ifnull&&ifnunum==1) {
+ this.IsLoading=true;
+ saveAllDataProduct(dataChunanshen).then(result => {
+ this.IsLoading=false;
+ this.quo.IsQuoteTrial__c = true;
+ this.SkipQuotefilg = false;
+ this.ifquocom = true;
+ if(this.oppInfo.Sales_Root__c == Sales_Outlet){
+ var target = {value :this.ContractPrice}
+ var event = {target:target}
+ this.OCMAgent1PricePageonChange(event);
+ }else{
+ this.quo.Dealer_Final_Price_Page__c = toNumComma(this.ContractPrice);
+ var target = {value :this.ContractPrice}
+ var event = {target:target}
+ this.DealerFinalPricePageChange(event);
+ }
+ this.Alert("鏁版嵁宸蹭繚瀛�", 'success');
+ });
+ } else {
+ if(ifnunum==2){
+ this.ifFTip=false;
+ this.Alert("浜у搧鏄庣粏涓噾棰濇湁璐熸暟锛屼笉鍙繚瀛�",'error');
+ }else{
+ this.ifFTip=false;
+ this.Alert("涓�鑸骇鍝佺殑鍚堝悓浠锋牸涓虹┖锛屼笉鍙繚瀛�",'error');
+ }
+ }
+ } else {
+ this.ifFTip=false;
+ this.Alert("浜у搧鏈�夊畬锛屼笉鍙繚瀛�",'error');
+ }
+ }
+ //鎶ヤ环璁$畻鎵撳紑鎸夐挳 end
+ SelectedFnDefault(rows) {
+ let arr = rows;
+ }
+ //鑾峰彇寰呴�夋嫨浜у搧鍒楄〃鏁版嵁
+ UniqueKey = new Map();
+ getTableDataDefault(event) {
+ let data = [];
+ //todu10
+ GetPromotionDefalut({
+ IdParam: this.quoId
+ }).then(result => {
+ this.jzDataDefaultNotChange = [];
+ this.jzDataDefaultCopy = [];
+ var i = 1;
+ result.forEach(rItem => {
+ rItem.ListPrice = rItem.ListPrice__c;
+ rItem.HangHao = i++;
+ rItem.Id = rItem.Product2Id;
+ let tempS = {
+ ...{},
+ ...rItem
+ };
+ this.jzDataDefaultNotChange.push(tempS);
+ this.jzDataDefaultCopy.push(tempS);
+ });
+ this.getschemedetails();
+ if (this.flagall) {
+ var newList = [];
+ this.OnLoadProduct.forEach(items => {
+ var DataTemp = {};
+ result.forEach(reItgem => {
+ if (reItgem.Id == items.Id) {
+ DataTemp = reItgem;
+ return;
+ }
+ reItgem.ListPrice = reItgem.ListPrice__c;
+ })
+ if (DataTemp != undefined && DataTemp != {}) {
+ DataTemp = {
+ ...DataTemp,
+ ...items
+ };
+ }
+ newList.push(DataTemp);
+ })
+ this.jzDataDefault = newList;
+ this.tableIsLodingDefault = false;
+ this.comparisonUniqueKey();
+ return;
+ } else {
+ result.forEach(rItems => {
+ rItems.ListPrice = rItems.ListPrice__c;
+ });
+ this.jzDataDefault = result;
+ this.tableIsLodingDefault = false;
+ var event = {
+ page: 1,
+ pageLimit: 10,
+ search: "",
+ sortOrder: "asc",
+ sortPlus: undefined,
+ fag: true
+ };
+ this.getTableDataFix(event);
+ }
+ })
+ this.tableIsLodingDefault = false;
+ }
+ //鏌ヨ浠锋牸鏀跨瓥鏂规鍏宠仈浜у搧鏄庣粏
+ //绠楀嚭鐨勫悎璁�
+ sumTotal = [];
+ getschemedetails() {
+ this.jzDataFixedPrice.forEach(jdfp => {
+ var SeachData = {
+ SearchId: jdfp.Id
+ };
+ GetSearchProductById(SeachData).then(result => {
+ var tempObject = {
+ ...{},
+ ...jdfp
+ }
+ jdfp = this.countListAndNod(tempObject, result);
+ this.sumTotal.push(jdfp);
+ });
+ });
+ }
+ @track jzDataDefault = []; //鏁版嵁 寰呴�夋嫨浜у搧鏁版嵁鎹�
+ jzDataDefaultNotChange = [];
+ jzDataDefaultCopy = [];
+ @track tableIsLodingDefault = true;
+ @track
+ initSearchFormDefalt = initSearchFormDefalt2;
+ @track
+ initDataTableDefault = initDataTableDefault2;
+ @track
+ show = false
+ //閫夋嫨淇冮攢鏂规鎵撳紑鎸夐挳
+ showModal(){
+ this.show = true;
+ let inputFields=this.template.querySelectorAll('c-jz-data-table');
+ console.log("=====show======");
+ console.log(JSON.parse(JSON.stringify(inputFields)));
+ inputFields.forEach(field => {
+ console.log(JSON.parse(JSON.stringify(field.name)));
+ });
+ }
+ //閫夋嫨淇冮攢鏂规妯℃�佹鍙栨秷鎸夐挳
+ cancel() {
+ this.show = false
+ }
+ @track ShowFix;
+ showModalFix() {
+ this.ShowFix = true
+ }
+ cancelFix() {
+ this.ShowFix = false
+ }
+ @track
+ initSearchFormFix = initSearchFormFix2;
+ @track
+ initDataTableFix = initDataTableFix2;
+
+ @track jzDataFix = [];
+ @track tableIsLodingFix = true;
+ // 鐐瑰嚮鎼滅储瑙﹀彂
+ searchDataFix(event) {
+ let searchParams = event.detail.searchParams || {};
+ this.template.querySelector('[data-parent-id="parent-div-idFix"]').refreshDataTable({
+ searchParams: searchParams
+ });
+ }
+ deleteFixedPrice(){
+ debugger
+ var fag = deleteFixedPriceLogic(this.SelectedFnDataFixedPrice,this.CompareFullData);
+ this.SelectedFnDataFixedPrice = SelectedFnDataFixedPriceExp;
+ this.CompareFullData = CompareFullDataExp;
+ var ids = idsExp;
+ if (fag) {
+ //鍒犻櫎鎵�閫夋柟妗堝尮閰嶇殑浜у搧
+ this.DeleteChangesFn(ids, "浠锋牸鏀跨瓥");
+ //璋冪敤鍒犻櫎浠锋牸鏀跨瓥
+ this.deleteFixedPriceTemp();
+ this.ContractPriceCompute();
+ }else{
+ this.Alert("涓�鑸骇鍝佷负寮哄埗鍖归厤锛屼笉鍙垹闄�",'error');
+ }
+ }
+ // 鍒犻櫎鎵�閫夋柟妗堝尮閰嶇殑浜у搧
+ DeleteChangesFn(ids, TypeName) {
+ var CompareFullDataTemp = [];
+ ids.forEach(id => {
+ this.jzDataProduct = DeleteChangesFnLogic(id,TypeName,CompareFullDataTemp,this.CompareFullData,this.jzDataFixedPrice,this.jzDataDiscount,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultNotChange);
+ CompareFullDataTemp = CompareFullDataTempExp;
+ this.jzDataFixedPrice = jzDataFixedPriceExp;
+ this.jzDataDiscount = jzDataDiscountExp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultNotChange = jzDataDefaultNotChangeExp;
+ this.ContractPriceCompute();
+ });
+ this.CompareFullData = CompareFullDataTemp;
+ }
+ //鍒犻櫎浠锋牸鏀跨瓥
+ deleteFixedPriceTemp() {
+ this.jzDataFixedPrice = deleteFixedPriceTempLogic(this.SelectedFnDataFixedPrice,this.jzDataFixedPrice,this.CompareFullData);
+ this.CompareFullData = CompareFullDataExp;
+ this.SelectedFnDataFixedPrice = [];
+ }
+ //浠锋牸鏀跨瓥鍒楄〃閫変腑鐨勬暟鎹�
+ @track SelectedFnDataFixedPrice = [];
+ //浠锋牸鏀跨瓥閫夋嫨浜嬩欢
+ SelectedFnFixedPrice(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnDataFixedPrice = arr;
+ }
+ //浠锋牸鏀跨瓥鍒楄〃閰嶇疆鍒�
+ @track
+ initDataTableFixedPrice = initDataTableFixedPrice2;
+ //浠锋牸鏀跨瓥鍔犺浇鏁版嵁鏂规硶
+ getTableDataFixedPrice(event) {
+ this.tableIsLodingFixedPrice = false;
+ }
+ //浠锋牸鏀跨瓥鏁版嵁
+ @track jzDataFixedPrice = [];
+ //浠锋牸鏀跨瓥鍒楄〃loding
+ @track tableIsLodingFixedPrice = true;
+ //浠锋牸鏀跨瓥鍒楄〃灞曠ず鏍囪瘑
+ @track jzshows3 = true;
+ //瀵规瘮浠锋牸鏀跨瓥璧嬪��
+ comparativeAssignment() {
+ debugger
+ this.jzDataFixedPrice.forEach(jdfp => {
+ this.sumTotal.forEach(stl => {
+ if (jdfp.Id == stl.Id) {
+ if (stl.sumListPrice != undefined && stl.sumNoDiscount != undefined) {
+ jdfp.sumListPrice = stl.sumListPrice;
+ jdfp.sumNoDiscount = stl.sumNoDiscount;
+ }
+ }
+ });
+ });
+ }
+
+ //淇濆瓨浠锋牸鏀跨瓥缂栬緫鍒楁柟娉�
+ handleSaveFixedPrice(event) {
+ this.comparativeAssignment();
+ let editnewDate = [];
+ editnewDate = handleSaveFixedPriceLogic(this.CompareFullData,event,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,this.jzDataDefault);
+ this.CompareFullData = CompareFullDataExp;
+ var HeTongTotal = HeTongTotalExp;
+ let newData = newDataExp;
+ var boolean = booleanExp;
+ var newArrs = [].concat(editnewDate);
+ if (boolean == 1) {
+ this.jzDataFixedPrice = newData;
+ newArrs.forEach(item => {
+ this.ComputeData(item.Id, '浠锋牸鏀跨瓥');
+ this.Alert("鏁版嵁淇敼鎴愬姛", 'success');
+ });
+ this.jzDataProduct = this.newArrsTemp3.concat(this.newArrsTemp4);
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ } else if (boolean == 3) {
+ this.Alert("淇敼閿欒锛屾鏁板凡缁忚秴杩囨渶澶у�硷紝涓嶅彲澧炲姞",'error');
+ } else if (boolean == 4) {
+ this.Alert("淇敼閿欒锛屾鏁颁笉鍙互涓�0",'error');
+ } else if (boolean == 5) {
+ this.Alert("璇ユ柟妗堜负寮哄埗鍖归厤锛屾鏁颁笉鍙慨鏀癸紒",'error');
+ } else if (boolean == 6) {
+ var str1 = String(HeTongTotal);
+ var str = "淇敼閿欒锛屽悎鍚屼环鏍间笉寰楀皬浜�";
+ var str3 = str + str1;
+ this.Alert(str3,'error');
+ }
+ //鍒锋柊
+ this.jzshows3 = false;
+ this.IsLoading3 = true;
+ setTimeout(() => {
+ this.IsLoading3 = false;
+ this.jzshows3 = true;
+ }, 800);
+ }
+ newArrsTemp3 = [];
+ newArrsTemp4 = [];
+ //========淇冮攢鏂规妯℃�佹 start=========
+ // 淇冮攢鏂规鎼滅储妗嗘悳绱㈡寜閽柟娉�
+ searchData(event) {
+ let searchParams = event.detail.searchParams || {};
+ let temp = this.template;
+ this.template.querySelector('[data-parent-id="parent-div-id"]').refreshDataTable({
+ searchParams: searchParams
+ });
+ }
+ // 淇冮攢鏂规鎼滅储妗嗛厤缃垪
+ @track
+ initSearchForm = initSearchForm2;
+ //淇冮攢鏂规鍒楄〃閫変簨浠�
+ SelectedFn(event) {
+ let arr = event.detail.rows;
+ if (arr.length > 1) {
+ this.Alert("浠锋牸鏀跨瓥鍙彲閫夋嫨涓�涓柟妗�",'error');
+ } else {
+ this.ifqianpi = true;
+ this.GetSearchProductByIdFn(arr[0].Id, arr[0], "浠锋牸鏀跨瓥", [], arr);
+ }
+ this.cancel();
+ }
+ //淇冮攢鏂规鍒楄〃鍔犺浇鏁版嵁
+ // 鍚庡彴浜や簰锛岃幏鍙栧垪琛ㄦ暟鎹�
+ getTableData(event) {
+ debugger
+ let listQuery = event;
+ if (event.fag == undefined) {
+ listQuery = event.detail.listQuery;
+ }
+ GetPromotionPromotionSearch(listQuery).then(result => { //淇冮攢鏂规鏌ヨ缁撴灉
+ debugger
+ var responseObj = JSON.parse(result);
+ responseObj.records.forEach(item => {
+ var SeachData = {
+ SearchId: item.Id
+ };
+ GetSearchProductById(SeachData).then(result => { //鏂规鍏宠仈鐨勪骇鍝�
+ debugger
+ var newarrjdf = SearchProductByIdLogic(result,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,item);
+ this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp;
+ this.jzDataFixedPrice = [].concat(newarrjdf);
+ });
+ });
+ this.jzData = [].concat(responseObj.records);
+ this.tableIsLoding = false;
+ })
+ }
+ jzDataDefaultCopyQuantityList = [];
+ // 鍚庡彴浜や簰锛岃幏鍙栦竴鑸骇鍝佸垪琛ㄦ暟鎹�
+ ifqianpi = true;
+ getTableDataFix(event) {
+ let listQuery = event;
+ if (event.fag) {
+ this.ifqianpi = false;
+ } else {
+ listQuery = event.detail.listQuery;
+ }
+ listQuery.pageLimit = 200;
+ GetNormalProductSearch(listQuery).then(result => {
+ //BBBB
+ var tempArr = result.split("--");
+ var responseObj = JSON.parse(tempArr[0]);
+ var responseObjAll = JSON.parse(tempArr[1]);
+ //鎺掑簭
+ var newArrs = new Array;
+ responseObjAll.forEach(item => {
+ newArrs.push(item);
+ })
+ newArrs.sort((a, b) => {
+ return a.OrderNo__c - b.OrderNo__c;
+ })
+ newArrs.forEach(item => { //鎺掑簭鍚庣殑涓�鑸骇鍝佷富鏁版嵁
+ var SeachData = {
+ SearchId: item.Id
+ };
+ GetSearchProductById(SeachData).then(results => {
+ var newarrjdf = GetSearchProductByIdLogic(item,results,this.jzDataDefaultCopyQuantityList,this.jzDataFixedPrice);
+ this.jzDataFixedPrice = [].concat(newarrjdf);
+ var iflag = iflagExp;
+ this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp;
+ if (event.fag && iflag) {
+ var newArr = [];
+ newArr.push(item);
+ this.ifqianpi = false;
+ this.GetSearchProductByIdFn(item.Id, item, "浠锋牸鏀跨瓥", [], newArr, false);
+ }
+ });
+ });
+ var respons = [];
+ responseObj.records.forEach(rrds => { //鏌ュ嚭鐨勫墠鍗佹潯
+ responseObjAll.forEach(rsja => { //鏌ュ嚭鐨勬墍鏈変竴鑸骇鍝佹暟鎹�
+ if (rrds.Id == rsja.Id) {
+ respons.push(rsja);
+ }
+ })
+ })
+ this.jzDataFix = [].concat(respons);
+ this.tableIsLodingFix = false;
+ })
+ }
+ SelectedFnFix(event) {
+ let arr = event.detail.rows;
+ this.ifqianpi = true;
+ if (arr.length > 1) {
+ this.Alert("浠锋牸鏀跨瓥鍙彲閫夋嫨涓�涓柟妗�",'error');
+ } else {
+ //鑾峰彇鏁版嵁
+ this.GetSearchProductByIdFn(arr[0].Id, arr[0], "浠锋牸鏀跨瓥", [], arr);
+ }
+ this.cancelFix();
+ }
+ //浠锋牸鏀跨瓥鍖归厤
+ GetSearchProductByIdFn(idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow = true) {
+ //dddd
+ var SeachData = {
+ SearchId: idStr
+ };
+ GetSearchProductById(SeachData).then(result => {
+ var tempObject = {
+ ...{},
+ ...jzDataProductParam
+ }
+ jzDataProductParam = this.countListAndNod(tempObject, result);
+ arrData = [].concat(jzDataProductParam);
+ //杩斿洖鏁版嵁姣旇緝瑙勫垯
+ this.CompareData(result, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow);
+ })
+ }
+ //璁$畻listPrice鐨勫拰浠ュ強nod鍜�
+ countListAndNod(item, result) {
+ var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //鍐呭璐镐俊鎭�
+ var copydate=this.jzDataDefaultCopy;
+ var DeftCopyQtyList = this.jzDataDefaultCopyQuantityList;
+ //璁$畻list鍜宯od鍚堣閫昏緫
+ item=countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList);
+ this.jzDataDefaultCopyQuantityList=DeftCopyQtyLists;
+ var arr = {
+ ...{},
+ ...item
+ };
+ return arr;
+ }
+ //鍖归厤浠锋牸鏀跨瓥鏃舵暟鎹瘮杈冭鍒�
+ CompareData(list, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow) {
+ var TempsJzDataToCompare = CompareDataL(list,this.jzDataDefault);
+ var isChange = isChangeExp;
+ //End
+ if (TempsJzDataToCompare.length == list.length&&list.length!=0) {
+ TempsJzDataToCompare.forEach(TempsItems => {
+ this.ComparePushData(TempsItems.item.Quantity, TempsItems.element.Quantity__c, TempsItems.element.Asset_Model_No__c, idStr, jzDataProductParam, TypeName);
+ });
+ //鍒ゆ柇鏄惁鏄剧ず 鎻愮ず妗�
+ if (isShow) {
+ if (this.ifqianpi) {
+ this.Alert("淇冮攢鏂规閫夋嫨瀹屾垚", 'success');
+ }
+ }
+ } else {
+ if (isShow) {
+ if (this.ifqianpi) {
+ this.Alert("淇冮攢鏂规涓嶆弧瓒筹紝璇烽噸鏂伴�夋嫨",'error');
+ }
+ }
+ return;
+ }
+ if (isChange) {
+ this.ChangeNumZeroTrueChanges();
+ }
+ var temps = this.CompareFullData;
+ //娣诲姞
+ this.UpdateJZData(arrData);
+ //鏇存柊娆℃暟
+ this.updatesNums();
+ //鍚堝苟閲嶅浠锋牸鏀跨瓥鏂规
+ var jzarr = [].concat(this.jzDataFixedPrice);;
+ this.MergeDuplicateSchemes(jzarr);
+ //淇濆瓨鏈�澶ф鏁�
+ this.savecount(idStr);
+ //璁$畻浠锋牸
+ this.ComputeData(idStr, '浠锋牸鏀跨瓥');
+ }
+ ComparePushData(length, Quantity, Asset_Model_No__c, Id, jzDataProductParam, TypeName) {
+ //淇敼 浜у搧鏄庣粏
+ let num = parseInt(length / Quantity);
+ var newDataDefault = ComparePushDataLogic(this.jzDataDefault,this.jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num);
+ this.jzDataProduct = jzDataProductExp;
+ this.ContractPriceCompute();
+ this.jzDataDefault = newDataDefault;
+ this.ChangeNumZeroTrue();
+ this.AddNums(TypeName, Asset_Model_No__c, num, Id);
+ }
+ ChangeNumZeroTrueChanges() {
+ if (this.jzDataDefault.length != this.ChangeNumZeroTrueData) {
+ this.jzDataDefault = this.ChangeNumZeroTrueData;
+ }
+ }
+ UpdateJZData(arrs) { //arrs 閫変腑鐨勬暟鎹泦鍚�
+ if (this.jzDataFixedPrice == null || this.jzDataFixedPrice.length <= 0) {
+ this.jzDataFixedPrice = arrs;
+ } else {
+ this.jzDataFixedPrice = this.jzDataFixedPrice.concat(arrs);
+ };
+ }
+ // =======鏇存柊淇冮攢鏂规娆℃暟鏁版嵁
+ updatesNums() {
+ var jzDataFixedPriceTemp = [].concat(this.jzDataFixedPrice);
+ var jzDataDiscountTemp = [].concat(this.jzDataDiscount);
+ var CompareFullData = this.CompareFullData;
+ updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData);
+ this.jzDataFixedPrice = jzDataFixedPriceTemps;
+ this.jzDataDiscount = jzDataDiscountTemps;
+ }
+ //鍚堝苟閲嶅浠锋牸鏀跨瓥鏂规
+ MergeDuplicateSchemes(SchemeSet) {
+ var arr = [];
+ arr = MergeDuplicateSchemesLogic(this.CompareFullData,SchemeSet);
+ this.CompareFullData = CompareFullDataExp;
+ this.jzDataFixedPrice = [].concat(arr);
+ this.ConsolidationProgramProducts(arr);
+ }
+ //璁$畻浠锋牸鏀跨瓥浠锋牸
+ ComputeData(id, category) { //id 閫変腑鐨勬暟鎹甀D category 鏂规绫诲瀷
+ //璋冪敤鏇挎崲listprice鍗曚环
+ this.ReplacementUnitPrice();
+ //鏁版嵁
+ this.updateIdStr("3");
+ var arrTemp = this.jzDataFixedPrice; // id 浠锋牸鏀跨瓥
+ this.updateIdStr("1");
+ var arrProductTemp = this.jzDataProduct; // PromotionId 浜у搧鏄庣粏
+ var arrTemp2 = this.jzDataDefault; //寰呴�変骇鍝�
+ if (category == '浠锋牸鏀跨瓥') {
+ arrTemp.forEach(item => { // item浠锋牸鏀跨瓥
+ if (id == item.Id) {
+ item.Total = item.Counts * item.Price_CNY__c;
+ item.sumNoDiscountTotal = item.sumNoDiscount * item.Counts;
+ //璁$畻淇冮攢鎬讳环&& item.HeTongTotal == undefined
+ if (item.Price_CNY__c != undefined) {
+ if (item.determine != '鏀硅繃') {
+ if (item.if_Contain_Nod__c) {
+ item.HeTongTotal = item.Total;
+ } else {
+ item.HeTongTotal = item.Total + item.sumNoDiscountTotal;
+ }
+ }
+ }
+ //璁$畻閫夋嫨淇冮攢鏀跨瓥鐨勭粡閿�鍟嗗崟浠峰拰灏忚
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Promotion") { //淇冮攢鏂规
+ arrProductTemp = ComputeDataPromotionLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault);
+ this.newArrsTemp3 = newArrsTemp3Exp;
+ this.newArrsTemp4 = newArrsTemp4Exp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultCopy = jzDataDefaultCopyExp;
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ } else if (PromotionHeadRecordId == "NormalProduct") { //涓�鑸骇鍝�
+ //todu3
+ arrProductTemp = ComputeDataNormalProductLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault);
+ this.newArrsTemp3 = newArrsTemp3Exp;
+ this.newArrsTemp4 = newArrsTemp4Exp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultCopy = jzDataDefaultCopyExp;
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ }
+ });
+ this.jzDataFixedPrice = [].concat(arrTemp);
+ }
+ }
+ ReplacementUnitPrice() {
+ var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //鍐呭璐�
+ var arr = [].concat(this.jzDataProduct);//20230214
+ this.jzDataProduct = [].concat(ReplacementUnitPriceLogic(arr, ifTrade));//20230214
+ this.ContractPriceCompute();
+ }
+ //淇濆瓨鏈�澶ф鏁�
+ savecount(idStr) { //idStr 閫変腑鐨勬暟鎹甀D
+ this.jzDataFixedPrice = savecountLogic(this.jzDataFixedPrice,idStr);
+ }
+ ChangeNumZeroTrueData = []
+ ChangeNumZeroTrue() {
+ this.ChangeNumZeroTrueData = [].concat(this.jzDataDefault);
+ var newJzDataDefault = this.ChangeNumZeroTrueData.filter(item => {
+ if (item.Quantity > 0) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ this.ChangeNumZeroTrueData = newJzDataDefault;
+ }
+ //鐢ㄤ簬濉厖娆℃暟
+ CompareFullData = []
+ AddNums(ListName, Asset_Model_No__c, addNums, Id) {
+ this.CompareFullData = AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,this.CompareFullData);
+ }
+ //褰掑苟鐩稿悓浠锋牸鏀跨瓥鏂规鐨勪骇鍝�
+ ConsolidationProgramProducts(arrSchemes) {
+ var jzdataList = [].concat(this.jzDataProduct);
+ this.jzDataProduct = PriceConsolidation(arrSchemes, jzdataList);
+ }
+ //淇冮攢鏂规鍒楄〃鏁版嵁
+ @track jzData = [];
+ //淇冮攢鏂规鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsLoding = true;
+ // 淇冮攢鏂规鍒楄〃鍒楅厤缃�
+ @track
+ initDataTable =initDataTable2;
+ jzdateflag=true;
+ IsLoading6 = false;
+ //淇冮攢鏂规鍒楄〃缂栬緫鍒椾繚瀛�
+ savejzData(event){
+ var data = event.detail.rows;
+ for (var i = 0; i < this.jzData.length; i++) {
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].Id.replace("row-", "");
+ if (this.jzData[i].Id == id) {
+ this.jzData[i].Quantity__c=data[j].Quantity__c;
+ }
+ }
+ }
+ this.jzdateflag = false;
+ this.IsLoading6 = true;
+ setTimeout(() => {
+ this.jzdateflag = true;
+ this.IsLoading6 = false;
+ }, 1000);
+ }
+ //=========淇冮攢鏂规妯℃�佹 end============
+ //***************浠锋牸鏀跨瓥 end**************
+
+ //********鎶樻墸鏀跨瓥 start***********
+ //閫夋嫨鐗圭害鎶樻墸鎵撳紑鎸夐挳
+ showModalSpecial(){
+ this.QuoteData.forEach(qtd => {
+ if (!qtd.Opportunity.IsAuthorized__c) {
+ this.Alert("璇ヨ浠蜂笉鏄壒绾︾粡閿�鍟嗘巿鏉�",'error');
+ } else {
+ this.ShowSpecial = true;
+ }
+ });
+ }
+ //閫夋嫨涓�鑸姌鎵f墦寮�鎸夐挳
+ showModalCommonly(){
+ this.ShowCommonly = true
+ }
+ //鎶樻墸鏀跨瓥鍒犻櫎鎸夐挳浜嬩欢
+ delectTableDiscount(){
+ let ids = [];
+ for (var j = 0; j < this.SelectedFnDataDiscount.length; j++) {
+ ids.push(this.SelectedFnDataDiscount[j].Id);
+ }
+ this.DeleteSchemeMatching(this.SelectedFnDataDiscount, "鎶樻墸鏀跨瓥");
+ this.delectTableDiscountTemp();
+ this.ContractPriceCompute();
+ }
+ DeleteSchemeMatching(ids, TypeName) {
+ var CompareFullDataTemp = [];
+ ids.forEach(id => {
+ this.jzDataProduct = DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,this.CompareFullData,this.jzDataFixedPrice,this.jzDataDiscount,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultNotChange);
+ CompareFullDataTemp = CompareFullDataTempExp;
+ this.jzDataFixedPrice = jzDataFixedPriceExp;
+ this.jzDataDiscount = jzDataDiscountExp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultNotChange = jzDataDefaultNotChangeExp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ });
+ this.CompareFullData = CompareFullDataTemp;
+ }
+ //鎶樻墸鏀跨瓥閫変腑鍒楄〃鏁版嵁
+ @track SelectedFnDataDiscount = []
+ //鎶樻墸鏀跨瓥閫夋嫨浜嬩欢
+ SelectedFnDiscount(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnDataDiscount = arr;
+ }
+ //鎶樻墸鏀跨瓥鍒楄〃鏁版嵁
+ @track jzDataDiscount = [];
+ //鎶樻墸鏀跨瓥鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsLodingDiscount = true;
+ //鎶樻墸鏀跨瓥鍒楄〃鍒楅厤缃�
+ @track
+ initDataTableDiscount = initDataTableDiscount2;
+ //鎶樻墸鏀跨瓥鍒楄〃鍒楀姞杞芥柟娉�
+ getTableDataDiscount(event) {
+ this.tableIsLodingDiscount = false;
+ }
+ @track
+ Tongzhishow = false; //鎻愮ず鏄剧ず鐨勬爣璇�
+ SaveShowText = "鎿嶄綔鎴愬姛"; //鎻愮ず妗嗙殑鏂囨湰
+ TongzhiIcon = 'standard:account' //鎻愮ず妗嗙殑鍥炬爣
+ IsLeftStyle = "" //鎻愮ず妗嗙殑鏍峰紡
+ BgColorStyle = ""
+ //寮规鎻愮ず content 鍐呭 error 鏄惁鏄敊璇彁绀烘 left 鏄惁灞呭乏
+ Alert(msg,type) {
+ if(type == 'success'){
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type,
+ });
+ this.dispatchEvent(event);
+ }else{
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type,
+ mode: 'sticky'
+ });
+ this.dispatchEvent(event);
+ }
+ }
+ //鎶樻墸鏀跨瓥缂栬緫鍒椾繚瀛樻柟娉�
+ handleSaveDiscount(event) {
+ this.jzDataDiscount = handleSaveDiscountLogic(this.jzDataDiscount,this.jzDataProduct,event);
+ var boolean = booleanExp;
+ var boolean2 = boolean2Exp;
+ var boolean3 = boolean3Exp;
+ let newData = newDataExp;
+ let newData2 = newData2Exp;
+ let newData3 = newData3Exp;
+ let editnewDate = editnewDateExp;
+ var GuaranteeDiscount__cZuiXiao = GuaranteeDiscount__cZuiXiaoExp;
+ var NormalDiscount__cZuiXiao = NormalDiscount__cZuiXiaoExp;
+ this.jzDataProduct = jzDataProductExp;
+ //haha2
+ debugger
+ if (boolean == 0) {
+ this.jzDataDiscount = newData;
+ var newArrs = [].concat(editnewDate);//20230214
+ newArrs.forEach(item => {
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ this.ComputeDiscount(item.Id, item.NormalDiscount__c_Input, item.GuaranteeDiscount__c_Input, item.Category__c, item.JxsType);
+ });
+ this.jzDataProduct = this.newArrsTemp2.concat(this.newArrsTemp);//20230213
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ this.Alert("鏁版嵁淇敼鎴愬姛", 'success');
+ } else if (boolean == 1) {
+ this.Alert("淇敼閿欒锛屽璞″搧鎶樻墸涓嶅緱灏忎簬瀵硅薄鍝佹渶浣庢姌鎵�:"+GuaranteeDiscount__cZuiXiao+"%",'error');
+ } else if (boolean == 2) {
+ this.Alert("淇敼閿欒锛岄潪瀵硅薄鍝佹姌鎵d笉寰楀皬浜庨潪瀵硅薄鍝佹渶浣庢姌鎵�:"+NormalDiscount__cZuiXiao+"%",'error');
+ } else if (boolean == 3) {
+ this.Alert("淇敼閿欒锛屼竴鑸姌鎵f病鏈夊璞″搧鎶樻墸",'error');
+ } else if (boolean == 5) {
+ this.Alert("闈炲璞″搧鎶樻墸涓嶅彲浠ヤ负绌烘垨灏忎簬0",'error');
+ } else if (boolean == 4) {
+ this.jzDataDiscount = newData;
+ var ffgg=0;
+ if(boolean3){
+ newData2.forEach(HeTo => {
+ //鏍规嵁鍚堝悓浠锋牸璁$畻涓�鑸姌鎵�
+ HeTo = this.ComouteProductDiscount(HeTo.Id,HeTo.Category__c,HeTo.GuaranteeDiscount__c_Input, HeTo.NormalDiscount__c_Input, HeTo.GuaranteeDiscount_H_Money__c,HeTo.NormalDiscount_H_Money__c, HeTo);
+ if(HeTo==1||HeTo==2||HeTo==12||HeTo==3){
+ ffgg=HeTo;
+ return ;
+ }
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ let jzDataDiscountx = [].concat(this.jzDataDiscount);//20230214
+ this.ConsolidatedDiscountPolicy(jzDataDiscountx);
+ //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
+ this.updateCommonlyDiscountLogic(HeTo.Id,HeTo.JxsType,HeTo.GuaranteeDiscount__c_Input,HeTo.NormalDiscount__c_Input,HeTo.Category__c,this.jzDataDiscount);
+ });
+ }
+ if(boolean2&&ffgg==0){
+ newData3.forEach(TeYue=>{
+ //鏍规嵁鍚堝悓浠锋牸璁$畻鐗圭害鎶樻墸
+ GuaranteeDiscount__cZuiXiao=parseFloat(TeYue.GuaranteeDiscount__c);
+ NormalDiscount__cZuiXiao=parseFloat(TeYue.NormalDiscount__c);
+ TeYue=this.ComouteProductDiscount(TeYue.Id,TeYue.Category__c,TeYue.GuaranteeDiscount__c_Input, TeYue.NormalDiscount__c_Input, TeYue.GuaranteeDiscount_H_Money__c,TeYue.NormalDiscount_H_Money__c, TeYue);
+ if(TeYue==1||TeYue==2||TeYue==12||TeYue==3){
+ ffgg=TeYue;
+ return ;
+ }else{
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
+ this.updateCommonlyDiscountLogic(TeYue.Id,TeYue.JxsType,TeYue.GuaranteeDiscount__c_Input,TeYue.NormalDiscount__c_Input,TeYue.Category__c,this.jzDataDiscount);
+ }
+ });
+ }
+ if(ffgg==1||ffgg==2||ffgg==12||ffgg==3){
+ this.Alert(InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao),'error');
+ }else{
+ this.Alert("鏁版嵁淇敼鎴愬姛", 'success');
+ }
+ }
+ //鍒锋柊
+ this.jzshows2 = false;
+ setTimeout(() => {
+ this.jzshows2 = true;
+ }, 800)
+ }
+ newArrsTemp = [];
+ newArrsTemp2 = [];
+ //璁$畻涓�鑸姌鎵i潪瀵硅薄鍝佹姌鎵�
+ ComouteProductDiscount(Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item) {
+ //todu12
+ this.updateIdStr("2");
+ this.updateIdStr("1");
+ var reslut=ReverseCalculationModifyDiscountLogic(this.jzDataDiscount,this.jzDataProduct,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item);
+ this.jzDataDiscount=[].concat(arrTempsss);
+ this.jzDataProduct=[].concat(arrProductTempsss);//20230214
+ return reslut;
+ }
+ //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
+ updateCommonlyDiscountLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount) {
+ //todu13
+ this.updateIdStr("1");
+ this.jzDataProduct=updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,this.jzDataProduct);
+ this.GeneralDiscountContractSummary();
+ }
+ //鏇存敼涓�鑸姌鎵e悎鍚屼环鏍艰绠楀悎鍚屾�讳环
+ GeneralDiscountContractSummary(){
+ this.ContractPrice = 0;
+ var sum = this.ContractPrice;
+ sum = parseFloat(sum);
+ sum=GeneralDiscountContractSummaryLogic(sum,this.jzDataDiscount,this.jzDataFixedPrice);
+ this.ContractPrice = sum;
+ }
+ //鎶樻墸鏀跨瓥鍒楄〃灞曠ず鏍囪瘑
+ jzshows2 = true;
+ ///鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄩ�夋嫨鏁版嵁
+ @track SelectedFnDataSpecial = [];
+ //鐗圭害鎶樻墸妯℃�佹閿欒鎻愮ず寮�鍏�
+ ShowSpecialIsError = false;
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄩ�変腑鏂规硶
+ SelectedFnSpecial(event) {
+ let arr = event.detail.rows;
+ if (event.detail.rows.length > 1) {
+ this.ShowSpecialIsError = true;
+ } else {
+ this.ShowSpecialIsError = false;
+ }
+ var TempArr = [];
+ TempArr.push(arr[0])
+ var tempObject = {
+ ...{},
+ ...TempArr[0]
+ }
+ tempObject.CompareId = GetUUID();
+ this.SelectedFnDataSpecial = [tempObject];
+ }
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄥ姞杞芥柟娉�
+ getTableDataSpecial(event) {
+ let listQuery = event.detail.listQuery;
+ var Agency1__c = this.QuoteData[0].Agency1__c;
+ listQuery.pageLimit = 40;
+ listQuery.Agency1c = Agency1__c;
+ GetAuthorizerSearch(listQuery).then(result => {
+ var responseObj = JSON.parse(result);
+ this.jzDataSpecial = responseObj.records;
+ this.jzDataSpecial.forEach(element => {
+ element.JxsType = "鐗圭害鎶樻墸";
+ element.NormalDiscount__c = element.NormalDiscount__c+"%";
+ element.GuaranteeDiscount__c = element.GuaranteeDiscount__c+'%';
+ });
+ GetAgencyRName().then(gar => {
+ var a = JSON.parse(gar);
+ a.forEach(ga => {
+ if (ga.Agency__r != undefined) {
+ var arr = [];
+ this.jzDataSpecial.forEach(jzdsc => {
+ if (ga.Agency__c == jzdsc.Agency__c) {
+ jzdsc.Agency__Name = ga.Agency__r.Name;
+ arr.push(jzdsc);
+ } else {
+ arr.push(jzdsc);
+ }
+ });
+ this.jzDataSpecial = [].concat(arr);
+ }
+ });
+ })
+ this.tableIsLodingSpecial = false;
+ })
+ }
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄥ垪閰嶇疆
+ @track
+ initDataTableSpecial = initDataTableSpecial2;
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄦ暟鎹�
+ @track jzDataSpecial = [];
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄥ姞杞藉姩鍥炬爣璇�
+ @track tableIsLodingSpecial = true;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄩ�夋嫨鏁版嵁
+ @track SelectedOtherDataArr = [];
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄩ�変腑鏂规硶
+ SelectedFnOtherData(event) {
+ let arr = event.detail.rows;
+ this.SelectedOtherDataArr = arr;
+ }
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄥ垪閰嶇疆
+ @track
+ initDataTableOtherData = initDataTableOtherData2;
+ @track jzDataOtherData = [];
+ @track tableIsLodingOtherData = true;
+ //鐗圭害鎶樻墸妯″紑鍏�
+ @track ShowSpecial;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄥ姞杞芥柟娉�
+ getTableDataOtherData(event) {
+ if (!this.IsLoadingFlag1) {
+ return
+ };
+ this.jzDataOtherData = this.jzDataDefault;
+ var jzDataOtherDataTemp = [];
+ this.jzDataOtherData.forEach(jzdod => {
+ var ItemsTemp = {
+ ...{},
+ ...jzdod
+ };
+ ItemsTemp.SplitQuantity = ItemsTemp.Quantity;
+ jzDataOtherDataTemp.push(ItemsTemp);
+ })
+ this.jzDataOtherData = jzDataOtherDataTemp;
+ this.tableIsLodingOtherData = false;
+ }
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄥ鍔犺浇鍔ㄥ浘鏍囪瘑
+ IsLoading5 = false;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸睍绀烘爣璇�
+ jzshows5 = true;
+ //
+ IsLoadingFlag1 = true;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佺紪杈戝垪淇濆瓨鏂规硶
+ SaveSpecialDiscount(event) {
+ debugger
+ var data = event.detail.rows;
+ let newData = [];
+ let editnewDate = [];
+ var boolean = 1;
+ for (var i = 0; i < this.jzDataOtherData.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].Id;
+ if (this.jzDataOtherData[i].Id == id) {
+ editData = {
+ SplitQuantity: ''
+ };
+ //鎷嗗垎娆℃暟
+ editData.SplitQuantity = data[j].SplitQuantity;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...this.jzDataOtherData[i],
+ ...{}
+ };
+ if (editData.SplitQuantity != undefined) {
+ newItem.SplitQuantity = Number(editData.SplitQuantity);
+ }
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...this.jzDataOtherData[i]
+ });
+ }
+ }
+ var newArrs = [].concat(editnewDate);
+ newArrs.forEach(item => {
+ if (item.Quantity < item.SplitQuantity) {
+ boolean = 2;
+ } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') {
+ boolean = 3;
+ }
+ });
+ if (boolean == 1) {
+ this.jzDataOtherData = newData;
+ this.ShowSpecialIsError = false;
+ } else if (boolean == 2) {
+ this.errorTiShi("淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰楀ぇ浜庢暟閲�");
+ } else if (boolean == 3) {
+ this.errorTiShi("淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰椾负0鎴栦负绌�");
+ }
+
+ this.jzshows5 = false;
+ this.IsLoading5 = true;
+ this.IsLoadingFlag1 = false;
+ setTimeout(() => {
+ this.SelectedOtherDataArr = [];
+ this.IsLoading5 = false;
+ this.jzshows5 = true;
+ }, 1000);
+ setTimeout(() => {
+ this.IsLoadingFlag1 = true;
+ }, 2000);
+ }
+ //鐗圭害閿欒鎻愮ず
+ errorTiShi(str){
+ this.ShowSpecialIsError = true;
+ this.ShowSpecial = true;
+ this.ShowSpecialError = str;
+ }
+ //鐗圭害鎶樻墸妯℃�佹鍙栨秷鎸夐挳鏂规硶
+ cancelSpecial() {
+ this.ShowSpecial = false
+ this.ShowSpecialIsError = false;
+ this.SelectedFnDataSpecial = [];
+ this.SelectedOtherDataArr = [];
+ }
+ //鐗圭害鎶樻墸妯℃�佹淇濆瓨鎸夐挳鏂规硶
+ SavesSpecial() {
+ this.ShowSpecialIsError = false;
+ this.ShowSpecial = false;
+ var ItempTempData = {
+ ...{},
+ ...this.SelectedFnDataSpecial[0]
+ };
+ if (this.SelectedOtherDataArr.length == 0 && this.SelectedFnDataSpecial.length != 0) {
+ this.errorTiShi("璇烽�夋嫨鐗圭害鎶樻墸浜у搧锛�");
+ } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length != 0) {
+ this.errorTiShi("璇烽�夋嫨鐗圭害鎶樻墸鏂规锛�");
+ } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length == 0) {
+ this.errorTiShi("璇烽�夋嫨鐗圭害鎶樻墸鏂规鍜屼骇鍝侊紒");
+ } else {
+ ItempTempData.itemss = this.SelectedOtherDataArr;
+ ItempTempData.IsTempItems = true;
+ ItempTempData.NormalDiscount__c_Input = ItempTempData.NormalDiscount__c;
+ ItempTempData.GuaranteeDiscount__c_Input = ItempTempData.GuaranteeDiscount__c;
+ this.SelectedFnDataSpecial[0] = ItempTempData;
+ this.UpdateDiscountData(this.SelectedFnDataSpecial);
+ this.SpecialSavesChange("鐗圭害鎶樻墸", ItempTempData, this.SelectedFnDataSpecial[0].Id, this.SelectedFnDataSpecial[0].CompareId);
+ this.Alert("鐗圭害鎶樻墸閫夋嫨瀹屾垚", 'success');
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType);
+ this.SelectedFnDataSpecial = [];
+ this.SelectedOtherDataArr = [];
+ }
+ }
+ //璁$畻鎶樻墸鏀跨瓥
+ ComputeDiscount(id, NormalDiscount__c_Input, GuaranteeDiscount__c_Input, Category__c, JxsType) {
+ this.updateIdStr("1");
+ var arrProductTemp = this.jzDataProduct;
+ this.updateIdStr("2");
+ var arrTemp1 = this.jzDataDiscount;
+ arrTemp1.forEach(item => {
+ if (JxsType == '鐗圭害鎶樻墸') {
+ if (item.JxsType == '鐗圭害鎶樻墸') {
+ if (id == item.Id) {
+ if (item.iftrue != "鏀硅繃" &&
+ item.GuaranteeDiscount__c_Input == undefined &&
+ item.NormalDiscount__c_Input == undefined) {
+ item.GuaranteeDiscount__c_Input = item.GuaranteeDiscount__c;
+ item.NormalDiscount__c_Input = item.NormalDiscount__c;
+ }
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input &&
+ GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) {
+ arrProductTemp = ComputeDiscountAuthorizerLogic(this.newArrsTemp,this.newArrsTemp2,item,arrProductTemp);
+ this.newArrsTemp = newArrsTempExp;
+ this.newArrsTemp2 = newArrsTemp2Exp;
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ }
+ }
+ } else if (JxsType == '涓�鑸姌鎵�') {
+ if (item.JxsType == '涓�鑸姌鎵�') {
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input &&
+ Category__c == item.Category__c) {
+ this.newArrsTemp = [];
+ this.newArrsTemp2 = [];
+ arrProductTemp.forEach(itemss => {
+ if (itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input &&
+ itemss.Category__c == item.Category__c) {
+ itemss = commonlyDiscountLogic(itemss, item); //涓�鑸姌鎵h绠楅�昏緫
+ this.newArrsTemp.push(itemss);
+ } else if (itemss.Category__c != item.Category__c ||
+ itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) {
+ this.newArrsTemp2.push(itemss);
+ }
+ });
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ }
+ }
+ });
+ this.jzDataDiscount = [].concat(arrTemp1);
+ }
+ //鎶樻墸鏀跨瓥鍖归厤瑙勫垯
+ SpecialSavesChange(SaveName, SelectedData, IdStr, CompareId) {
+ var newDicountData = [];
+ newDicountData=SpecialSavesChangePartLogic(this.jzDataDefault,SaveName, SelectedData, IdStr, CompareId,0,newDicountData,this.jzDataDiscount);
+ this.jzDataDefault = NewDefaultDatass;
+ this.jzDataProduct =this.jzDataProduct.concat(AddProductDatass);
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ this.jzDataDiscount = newDicountData;
+ }
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ ConsolidatedDiscountPolicy(SchemeSet) {
+ var arr = [];
+ arr = ConsolidatedDiscountPolicyLogic(SchemeSet, arr);
+ this.jzDataDiscount = [].concat(arr);
+ this.ConsolidatedDiscountDetails(arr);
+ }
+ //鍚堝苟鎶樻墸鏀跨瓥浜у搧鏄庣粏
+ ConsolidatedDiscountDetails(arrSchemes) {
+ var jzdataList = [].concat(this.jzDataProduct);
+ this.jzDataProduct = ConsolidatedDiscountDetailsLogic(arrSchemes, jzdataList);
+ }
+ //==========鐗圭害鎶樻墸妯℃�佹 end=============
+ //=========涓�鑸姌鎵fā鎬佹 start===========
+ //涓�鑸姌鎵fā鎬佹寮�鍏�
+ @track ShowCommonly;
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄥ鍔犺浇鍔ㄥ浘鏍囪瘑
+ IsLoading4 = false;
+ //涓�鑸姌鎵e緟閫変骇鍝佸睍绀烘爣璇�
+ jzshows4 = true;
+ //
+ IsLoadingFlag = true;
+ //涓�鑸姌鎵e緟閫変骇鍝佺紪杈戝垪淇濆瓨鏂规硶
+ SaveGeneralDiscount(event) {
+ var data = event.detail.rows;
+ let newData = SaveGeneralDiscountLogic(data,this.jzDataCommonly);
+ var boolean = booleanExp;
+ if (boolean == 1) {
+ this.jzDataCommonly = newData;
+ this.ShowCommonlyIsError = false;
+ } else if (boolean == 2) {
+ this.ShowCommonlyIsError = true;
+ this.ShowCommonlyError = "淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰楀ぇ浜庢暟閲�";
+ } else if (boolean == 3) {
+ this.ShowCommonlyIsError = true;
+ this.ShowCommonlyError = "淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰椾负0鎴栦负绌�";
+ }
+ this.jzshows4 = false;
+ this.IsLoading4 = true;
+ this.IsLoadingFlag = false;
+ setTimeout(() => {
+ this.SelectedFnCommonlyData = [];
+ this.IsLoading4 = false;
+ this.jzshows4 = true;
+ }, 1000);
+ setTimeout(() => {
+ this.IsLoadingFlag = true;
+ }, 2000);
+ }
+ //涓�鑸姌鎵fā鎬佹鍙栨秷鎸夐挳鏂规硶
+ cancelCommonly() {
+ this.ShowCommonly = false;
+ this.ShowCommonlyIsError = false;
+ this.SelectedFnCommonlyData = [];
+ this.SaveLb = '';
+ this.SaveZk = '';
+ }
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄥ垪閰嶇疆
+ @track
+ initDataTableCommonly = initDataTableCommonly2;
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄦ暟鎹�
+ @track jzDataCommonly = [];
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄥ姞杞藉姩鍥炬爣璇�
+ @track tableIsLodingCommonly = true;
+ //涓�鑸姌鎵e緟閫夋柟妗堝垪琛ㄥ姞杞芥柟娉�
+ getTableDataCommonly(event) {
+ if (!this.IsLoadingFlag) {
+ return
+ };
+ this.jzDataCommonly = this.jzDataDefault;
+ this.jzDataCommonly = getTableDataCommonlyLogic(this.jzDataCommonly);
+ this.tableIsLodingCommonly = false;
+ }
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄩ�夋嫨鏁版嵁
+ SelectedFnCommonlyData = [];
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄩ�変腑鏂规硶
+ SelectedFnCommonly(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnCommonlyData = SelectedFnCommonlyLogic(arr);
+ }
+ //浜у搧绯诲垪鏁版嵁
+ SaveLb = '';
+ //浣跨敤鎶樻墸鏁版嵁
+ SaveZk = '';
+ //浜у搧绯诲垪鏂规硶
+ handleChangeLb(event) {
+ this.SaveLb = event.target.value;
+ }
+ //浣跨敤鎶樻墸鏂规硶
+ handleChangeZk(event) {
+ if (event.target.value !== '') {
+ event.target.value = parseFloat(event.target.value) + "%";
+ }
+ this.SaveZk = event.target.value;
+ }
+ //涓�鑸姌鎵fā鎬佹閿欒鎻愮ず鏂规硶
+ errorTiShiYi(str){
+ this.ShowCommonlyIsError = true;
+ this.ShowCommonlyError = str;
+ }
+ //涓�鑸姌鎵fā鎬佹閿欒鎻愮ず榛樿鍐呭
+ ShowCommonlyError = "璇烽�夋嫨涓�鑸骇鍝侊紒";
+ //涓�鑸姌鎵fā鎬佹閿欒鎻愮ず寮�鍏�
+ ShowCommonlyIsError = false;
+ //涓�鑸姌鎵fā鎬佹鍙栨秷鎸夐挳鏂规硶
+ cancelSaveCommonly() {
+ //澶勭悊鏁版嵁
+ var arr = this.SelectedFnCommonlyData;
+ this.ShowCommonlyIsError = false;
+ if (this.SelectedFnCommonlyData.length != 0) {
+ var ItempTempData = {};
+ ItempTempData.Id = GetUUID();
+ ItempTempData.CompareId = GetUUID();
+ ItempTempData.Name = '涓�鑸姌鎵�';
+ ItempTempData.JxsType = "涓�鑸姌鎵�";
+ ItempTempData.itemss = arr;
+ if (this.SaveLb == '' || this.SaveZk == '') {
+ if (this.SaveLb == '' && this.SaveZk != '') {
+ this.errorTiShiYi("璇烽�夋嫨浜у搧绫诲埆锛�");
+ } else if (this.SaveZk == '' && this.SaveLb != '') {
+ this.errorTiShiYi("璇疯緭鍏ヤ娇鐢ㄦ姌鎵o紒");
+ } else if (this.SaveZk == '' && this.SaveLb == '') {
+ this.errorTiShiYi("璇疯緭鍏ヤ娇鐢ㄦ姌鎵e拰浜у搧绫诲埆锛�");
+ }
+ } else {
+ ItempTempData.Category__c = this.SaveLb;
+ ItempTempData.NormalDiscount__c_Input = this.SaveZk;
+ ItempTempData.if_Contain_Nod__c = false;
+ var TempList = [];
+ TempList.push(ItempTempData);
+ this.UpdateDiscountData(TempList);
+ this.SpecialSavesChange("涓�鑸姌鎵�", ItempTempData, ItempTempData.Id, ItempTempData.CompareId);
+ this.cancelCommonly();
+ this.Alert("涓�鑸姌鎵i�夋嫨瀹屾垚", 'success');
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ //璁$畻鎶樻墸鏀跨瓥浠锋牸
+ this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c_Input, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType);
+ }
+ } else {
+ this.errorTiShiYi("璇烽�夋嫨涓�鑸骇鍝侊紒");
+ }
+ }
+ //灏嗕骇鍝佷笌鏂规鍖归厤
+ UpdateDiscountData(arrs) {
+ if (this.jzDataDiscount == null || this.jzDataDiscount.length <= 0) {
+ this.jzDataDiscount = arrs;
+ } else {
+ this.jzDataDiscount = this.jzDataDiscount.concat(arrs);
+ }
+ }
+ //=========涓�鑸姌鎵fā鎬佹 end=========
+ //*********鎶樻墸鏀跨瓥 end*********
+
+ //************浜у搧鏄庣粏 start***********
+ //浜у搧鏄庣粏鍒犻櫎鏂规硶
+ delectTableProduct(){
+ this.DeleteIsChangesFnSingle(this.SelectedFnProductData);
+ }
+ DeleteIsChangesFnSingle(list) {
+ let num = 0;
+ list.forEach(item => {
+ num++;
+ var falg = true;
+ if (item.TypeName == "浠锋牸鏀跨瓥") {
+ this.DeleteIsChangelogic(item, item.TypeName, num, list);
+ var TempItem = DeleteIsChangesFnjiage(this.jzDataFixedPrice,this.jzDataProduct,falg,item);
+ falg = falgExp;
+ if (TempItem && falg) {
+ this.SelectedFnDataFixedPrice.push(TempItem);
+ this.deleteFixedPriceTemp();
+ }
+ } else if (item.TypeName == "鎶樻墸鏀跨瓥") {
+ this.DeleteIsChangelogic(item, item.TypeName, num, list);
+ var TempItemTOName = DeleteIsChangesFnzhekou(this.jzDataDiscount,this.jzDataProduct,falg,item);
+ falg = falgExp;
+ if (TempItemTOName != undefined && falg) {
+ this.SelectedFnDataDiscount.push(TempItemTOName);
+ this.delectTableDiscountTemp();
+ }
+ }
+ this.ContractPriceCompute();
+ })
+ }
+ DeleteIsChangelogic(item, TypeName, num, list) {
+ var boofag = DeleteIsChangelogicExp(item,TypeName,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultCopy);
+ this.jzDataProduct = jzDataProductExp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultCopy = jzDataDefaultCopyExp;
+ if(boofag == 1){
+ this.Alert("淇冮攢鏂规鍐呬骇鍝佸瀷鍙凤紝鏁伴噺鍥哄畾锛屼笉鍙垹闄ゆ槑缁�",'error');
+ }else if(boofag == 2){
+ this.Alert("璇ヤ骇鍝佷负涓�鑸骇鍝侊紝涓嶅彲鍒犻櫎鏄庣粏",'error');
+ }
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ delectTableDiscountTemp() {
+ this.jzDataDiscount = delectTableDiscountTempLogic(this.SelectedFnDataDiscount,this.jzDataDiscount);
+ this.SelectedFnDataDiscount = [];
+ }
+ //浜у搧鏄庣粏鍒楄〃鏁版嵁鍔犺浇鏂规硶
+ getTableDataProduct(event) {
+ this.tableIsLodingProduct = false;
+ }
+ //浜у搧鏄庣粏閫変腑鍒楄〃鏁版嵁
+ @track SelectedFnProductData = [];
+ //浜у搧鏄庣粏閫変腑鍒楄〃鏂规硶
+ SelectedFnProduct(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnProductData = arr;
+ }
+ //浜у搧鏄庣粏鍒楄〃鍒楅厤缃�
+ @track
+ initDataTableProduct = initDataTableProduct2;
+ //浜у搧鏄庣粏鍒楄〃鏁版嵁
+ @track jzDataProduct = [];
+ //浜у搧鏄庣粏鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsLodingProduct = true;
+ //浜у搧鏄庣粏鍒楄〃灞曠ず鏍囪瘑
+ jzshows= true;
+ //*********浜у搧鏄庣粏 end**********
+ //鎵撳嵃瀹㈡埛鍚嶇О start
+ selection_hp = '';
+ options_hp = [];
+ options_hpflg = true;
+ get PrintCustomerNameoptions() {
+ debugger
+ if (this.accountid) {
+ if(this.options_hpflg){
+ selectAccountById({accountid : this.accountid}).then(accs =>{
+ this.options_hp = PrintCustomerNameoptionsvlue(this.options_hp,this.selection_hp,this.quo,this.options_hpflg,accs);
+ this.selection_hp = selection_hpExp;
+ this.options_hpflg = options_hpflgExp;
+ });
+ }else{
+ return this.options_hp;
+ }
+ }else{
+ return this.options_hp;
+ }
+ }
+ PrintCustomerNamehandleChange(event) {
+ this.selection_hp = event.detail.value;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js-meta.xml b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js-meta.xml
new file mode 100644
index 0000000..1e3e5c7
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js-meta.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle> -->
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexNewQuoteEntr">
+ <apiVersion>57.0</apiVersion>
+ <isExposed>true</isExposed>
+ <targets>
+ <target>lightning__Tab</target>
+ <target>lightning__AppPage</target>
+ <target>lightning__RecordPage</target>
+ <target>lightning__HomePage</target>
+ <target>lightning__RecordAction</target>
+ </targets>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js b/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js
new file mode 100644
index 0000000..933e46d
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js
@@ -0,0 +1,2417 @@
+export var bflag;
+export var oppInfosave;
+export var quoLineItemsave;
+export var DataStatus;
+export var newQuoteFlagex;
+export var MultiYearWarrantyTotalPriceExport;
+export var newQuoteFlagExp;
+export var productStatusUpdatedExp;
+export var quoExp;
+export var selection_hpExp;
+export var options_hpflgExp;
+export var fagExp;
+export var ListPriceTotalExp;
+export var unitPriceTotalExp;
+export var errorflg;
+export var StrExp;
+export var IsQuoteTrialExp;
+export var alertExp = '';
+export var alfExp = 0;
+export var nafgExp = {};
+export var flg = false;
+export var tStringe = 'No.\t缂栫爜\t鐘舵�乗t鍚嶇О\tListPrice\t鏁伴噺\t瑙勬牸\t鍖婚櫌鍗曚环\t鍖婚櫌灏忚\t璧犻�乗t缁忛攢鍟嗗崟浠穃t缁忛攢鍟嗗皬璁�';
+tStringe += '\t澶氬勾淇濅慨\t淇濅慨\tNoDiscount灏忚';
+tStringe += '\t淇濅慨鏈焅t閫氳揣';
+var addproductList = [];
+var trade;
+
+//閫夋嫨鎶ヤ环浜у搧閰嶇疆鍒�
+export var initDataTableToBeproductConfig = {
+ columns: [
+ {
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model',
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: 'NMPA鐘舵��',
+ fieldName: 'SFDA_Status__c',
+ type: 'text',
+ cellAttributes: {
+ class:{
+ fieldName:'SFDAStatuclass'
+ },
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '渚涘簲鍟嗗悕绉�',
+ fieldName: 'VenderName',
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '涓绘姤浠蜂环鏍�',
+ fieldName: 'ListPrice_Page',
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ },
+ cellAttributes: {
+ class:{
+ fieldName:'ListPricePageclass'
+ },
+ alignment: 'right'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity__c',
+ type: 'number',
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '瑙勬牸',
+ fieldName: 'Specifications',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'right'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '鍖婚櫌鍗曚环',
+ fieldName: 'UnitPrice_Page__c',
+ // editable: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right',
+ },
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '鍖婚櫌灏忚',
+ fieldName: 'Subtotal__c',
+ cellAttributes: {
+ alignment: 'right'
+ },
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '澶氬勾淇濅慨',
+ fieldName: 'multiYearWarranty__c',
+ type: 'boolean',
+ cellAttributes: {
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '淇濅慨',
+ fieldName: 'warrantyType__c',
+ type: 'text',
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '淇濅慨骞撮檺',
+ fieldName: 'GuaranteePeriod__c',
+ cellAttributes: {
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '棰勮娑堣�楄嚦',
+ fieldName: 'Estimated_ConsumptionDueDate',
+ type: 'date',
+ typeAttributes:{
+ // weekday: "long",
+ year: "numeric",
+ month: "long",
+ day: "2-digit"
+ },
+ cellAttributes: {
+ class:{
+ fieldName:'EstimatedConsumptionDueDateclass'
+ },
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '搴撳瓨鐘舵��',
+ fieldName: 'StorageStatus',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name',
+ type: 'url',
+ typeAttributes: {
+ label: {
+ fieldName: 'Name__c'
+ },
+ tooltip: {
+ fieldName: 'website'
+ },
+ target: '_blank'
+ },
+ cellAttributes: {
+ class:{
+ fieldName:'Nameclass'
+ },
+ },
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns: []
+};
+//浜у搧閰嶅閰嶇疆鍒�
+export var initDataSetProductTablefig = {
+ columns: [
+ {
+ label: '浜у搧閰嶅鍚�',
+ fieldName: 'Name',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '浜у搧閰嶅缂栫爜',
+ fieldName: 'Product_Set_CD__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '琛ヨ冻淇℃伅',
+ fieldName: 'Quote_Select_Info__c',
+ type: 'text',
+ cellAttributes: {
+ class: {},
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '鏈夊姽',
+ fieldName: 'Valid_Status__c',
+ type: 'boolean',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: []
+};
+//鏂板浜у搧浜у搧閰嶇疆鍒�
+export var initDataProductTablefig = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 110
+ },
+ {
+ label: '浜у搧缂栫爜',
+ fieldName: 'OT_CODE_no_link__c',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 270
+ },
+ {
+ label: '閫傜敤绉戝',
+ fieldName: 'suitDepartment__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: '浠f浛浜у搧',
+ fieldName: 'Alternative_Products__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: 'NMPA鐘舵��',
+ fieldName: 'SFDA_Status__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 115
+ },
+ {
+ label: 'ListPrice(鍐呰锤)',
+ fieldName: 'Intra_Trade_List_RMB__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 130
+ },
+ {
+ label: 'ListPrice(澶栬锤)',
+ fieldName: 'Foreign_Trade_List_US__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 130
+ },
+ {
+ label: '瑙勬牸',
+ fieldName: 'Packing_list_manual__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 60
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns:[]
+};
+export function localParseInt( input) {
+ input += "";
+ input = input.split(" ");
+ if (input.length > 1) {
+ input = input[1];
+ } else {
+ input = input[0];
+ }
+ input = input.replace(/,/g, "");
+ input = input.replace(/ /g, "");
+ if ( input == '' || isNaN( input)) {
+ input = 0;
+ }
+ input = parseInt(input);
+ if (isNaN( input)) input = 0.00;
+ return input;
+}
+export function number_format_common (number, decimals, dec_point, thousands_sep) {
+ number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
+ var n = !isFinite(+number) ? 0 : +number,
+ prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
+ sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
+ dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
+ s = '',
+ toFixedFix = function (n, prec) {
+ var k = Math.pow(10, prec);
+ return '' + Math.round(n * k) / k;
+ };
+ // Fix for IE parseFloat(0.55).toFixed(0) = 0;
+ s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
+ if (s[0].length > 3) {
+ s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
+ }
+ if ((s[1] || '').length < prec) {
+ s[1] = s[1] || '';
+ s[1] += new Array(prec - s[1].length + 1).join('0');
+ }
+ return ( s.join(dec));
+}
+export function toNum( input) {
+ return number_format_common( input, 2, ".", "");
+}
+export function toNumComma( input) {
+ return number_format_common( input, 2, ".", ",");
+}
+export function toNumComma_One_digit(input) {
+ return number_format_common( input, 1, ".", ",");
+}
+export function localParseFloat( input) {
+ input += "";
+ input = input.split(" ");
+ if (input.length > 1) {
+ input = input[1];
+ } else {
+ input = input[0];
+ }
+ input = input.replace(/,/g, "");
+ input = input.replace(/ /g, "");
+ if ( input == '' || isNaN( input)) {
+ input = 0.00;
+ }
+ input = parseFloat(input);
+ if (isNaN( input)) input = 0.00;
+ return input;
+}
+//澶嶅埗鎸夐挳change
+export function NewQcopyLogic(Check_Your_Clipboard,records,x,targetString,reslut,displayCost,CurrencyIsoCode){
+ records=reslut;
+ alfExp = false;
+ alertExp = '';
+ for (var i = 0; i < records.length; i++) {
+ x = records[i];
+ //鍒ゆ柇绌�
+ // x=IfCopyProperties(x);
+ targetString += '\r\n' + (i + 1) + '\t' + '=MID(( "_" & "' + x.ProductCode__c + '"),2,LEN("' + '_' + x.ProductCode__c + '")-1)' + '\t' + x.SFDA_Status__c + '\t' + x.Name__c + '\t' + toNumComma(x.ListPrice__c) + '\t' + x.Quantity + '\t' + (x.Qty_Unit__c == null ? '' : x.Qty_Unit__c) + '\t' + toNumComma(x.UnitPrice__c) + '\t' + toNumComma(x.UnitPrice__c * x.Quantity) +
+ '\t' + x.Present__c + '\t' + toNumComma_One_digit(x.AgencyUnitPrice__c) + '\t' + toNumComma_One_digit(x.AgencySubtotal__c);
+ if (!x.warrantyType__c) {
+ x.warrantyType__c = '';
+ }
+ targetString += '\t' + x.multiYearWarranty__c + '\t' + x.warrantyType__c +
+ '\t' + toNumComma(x.NoDiscountTotal__c);
+ targetString += '\t' + x.GuaranteePeriod__c;
+ ;
+ if (displayCost) {
+ targetString += '\t' + toNumComma(x.Cost__c) + '\t' + CurrencyIsoCode;
+ }
+ }
+ try {
+ console.warn(targetString);
+ var tag = document.createElement('textarea');
+ tag.setAttribute('id', 'cp_hgz_textarea');
+ var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length;
+ tag.maxLength=strlenght+666;
+ tag.value = targetString;
+ document.getElementsByTagName('body')[0].appendChild(tag);
+ document.getElementById('cp_hgz_textarea').select();
+ document.execCommand('copy');
+ document.getElementById('cp_hgz_textarea').remove();
+ alfExp = true;
+ alertExp = Check_Your_Clipboard;
+ } catch (error) {
+ alfExp = false;
+ alertExp = error;
+ }
+}
+export function productCompareLogic(jzDataToBeproduct,id2Product,t,b){
+ debugger
+ bflag = b;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var a = jzdtbt.pageObject.Id__c;
+ if (a != '') {
+ var newProductGuranteePrice = 0;
+ var newProductServicePrice = 0;
+ var newMaintenance_Price_Year = 0;
+ if (t == '澶栬部') {
+ var recordTypeRecord = id2Product[a];
+ var y1 = recordTypeRecord.Name;
+ var y2 = recordTypeRecord.Foreign_Trade_List_US__c;
+ var y3 = recordTypeRecord.Foreign_Trade_Cost_US__c;
+ newProductGuranteePrice = recordTypeRecord.Intra_Trade_Foreign_RMB__c;
+ newProductServicePrice = recordTypeRecord.NoDiscount_Foreign__c;
+ newMaintenance_Price_Year = recordTypeRecord.Repair_Contract_USD__c;
+ } else {
+ var recordTypeRecord = id2Product[a];
+ var y1 = recordTypeRecord.Name;
+ var y2 = recordTypeRecord.Intra_Trade_List_RMB__c;
+ var y3 = recordTypeRecord.Intra_Trade_Cost_RMB__c;
+ newProductGuranteePrice = recordTypeRecord.Intra_Trade_Gurantee_RMB__c;
+ newProductServicePrice = recordTypeRecord.Intra_Trade_Service_RMB__c;
+ newMaintenance_Price_Year = recordTypeRecord.Maintenance_Price_Year__c;
+ }
+ // 淇濅慨绫诲瀷
+ var newGuranteeType = recordTypeRecord.GuranteeType__c;
+ if (!newGuranteeType) {
+ var newGuranteeType = '';
+ }
+ var newProductEntend_gurantee_period_all = recordTypeRecord.Entend_gurantee_period_all__c;
+ var oldGuranteeType = jzdtbt.pageObject.GuranteeType__c;
+ var oldProductEntend_gurantee_period_all = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c;
+ var oldProductGuranteePrice = jzdtbt.ProductGuranteePrice;
+ var oldProductServicePrice = jzdtbt.pageObject.productServicePrice__c;
+ var oldMaintenance_Price_Year = jzdtbt.Maintenance_Price_Year;
+ oldProductServicePrice = localParseFloat(oldProductServicePrice);
+ newProductServicePrice = localParseFloat(newProductServicePrice);
+ oldProductGuranteePrice = localParseFloat(oldProductGuranteePrice);
+ newProductGuranteePrice = localParseFloat(newProductGuranteePrice);
+ newProductEntend_gurantee_period_all = localParseFloat(newProductEntend_gurantee_period_all);
+ oldMaintenance_Price_Year = localParseFloat(oldMaintenance_Price_Year);
+ newMaintenance_Price_Year = localParseFloat(newMaintenance_Price_Year);
+ var y4 = recordTypeRecord.SFDA_Status__c;
+ var s1 = recordTypeRecord.StorageStatus__c;
+ var x1 = jzdtbt.pageObject.Name__c;
+ var x2 = jzdtbt.ListPrice_Page;
+ var x3 = jzdtbt.Cost_c;
+ var x4 = jzdtbt.pageObject.SFDA_Status__c;
+ //閫g稓鍗婅銈广儦銉笺偣瀵惧繙
+ y1 = y1 + '';
+ // y1 = y1.replace(/\s+/g, " ");
+ x2 = localParseFloat(x2);
+ x3 = localParseFloat(x3);
+ y2 = localParseFloat(y2);
+ y3 = localParseFloat(y3);
+ if ((x1 === y1) && (x2 === y2) && (x3 === y3) && (x4 === y4)
+ &&
+ (oldGuranteeType === newGuranteeType) &&
+ (oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all) &&
+ (oldProductGuranteePrice === newProductGuranteePrice) &&
+ (oldProductServicePrice === newProductServicePrice) &&
+ (oldMaintenance_Price_Year === newMaintenance_Price_Year)
+ ) {} else {
+ console.warn('x1 === y1'+(x1 === y1));
+ console.warn('x2 === y2'+(x2 === y2));
+ console.warn('x3 === y3'+(x3 === y3));
+ console.warn('x4 === y4'+(x4 === y4));
+ console.warn('oldGuranteeType === newGuranteeType'+(oldGuranteeType === newGuranteeType));
+ console.warn('oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all'+(oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all));
+ console.warn('oldProductGuranteePrice === newProductGuranteePrice'+(oldProductGuranteePrice === newProductGuranteePrice));
+ console.warn('oldProductServicePrice === newProductServicePrice'+(oldProductServicePrice === newProductServicePrice));
+ console.warn('oldMaintenance_Price_Year === newMaintenance_Price_Year'+(oldMaintenance_Price_Year === newMaintenance_Price_Year));
+ bflag = false;
+ }
+
+ jzdtbt.latestInfo.GuranteeType = newGuranteeType;
+ jzdtbt.latestInfo.ProductEntend_gurantee_period_all = newProductEntend_gurantee_period_all;
+ jzdtbt.latestInfo.Intra_Trade_Gurantee = localParseFloat(recordTypeRecord.Intra_Trade_Gurantee_RMB__c);
+ jzdtbt.latestInfo.Intra_Trade_Service = localParseFloat(recordTypeRecord.Intra_Trade_Service_RMB__c);
+ jzdtbt.latestInfo.Maintenance_Price_Year = localParseFloat(recordTypeRecord.Maintenance_Price_Year__c);
+ jzdtbt.latestInfo.ProductName = recordTypeRecord.Name;
+ jzdtbt.latestInfo.ListPrice = y2;
+ jzdtbt.latestInfo.Cost = y3;
+ jzdtbt.latestInfo.SFDA_Status = y4;
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function TimeToString(newDate){
+ var value=newDate.toLocaleDateString();
+ var value2=value.split('/');
+ if(value2[1].length == 1){
+ value2[1]='0'+value2[1];
+ }
+ if(value2[2].length == 1){
+ value2[2]='0'+value2[2];
+ }
+ value=value2[0]+'-'+value2[1]+'-'+value2[2];
+ return value;
+}
+export function saveEvoluationLogic(quoin,oppInfoIn,quoLineItemIn){
+ debugger
+ var quo ={...{},...quoin};
+ 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.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;
+ quo.Agency1_Profit_Rate__c = quoin.Agency1_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency1_Profit_Rate__c):null;
+ quo.Agent1_Agent2_Price_Page__c = quoin.Agent1_Agent2_Price_Page__c!=undefined &&quoin.Agent1_Agent2_Price_Page__c!=='' ?localParseFloat(quoin.Agent1_Agent2_Price_Page__c):null;
+ quo.Agency2_Profit__c = quoin.Agency2_Profit__c !=undefined?localParseFloat(quoin.Agency2_Profit__c):null;
+ quo.Agency2_Profit_Rate__c = quoin.Agency2_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency2_Profit_Rate__c):null;
+ quo.Quote_Adjust_Amount_Page__c = quoin.Quote_Adjust_Amount_Page__c !=undefined&&quoin.Quote_Adjust_Amount_Page__c!==''?localParseFloat(quoin.Quote_Adjust_Amount_Page__c):null;
+ console.warn(quoin.Quote_Adjust_Amount_Page__c);
+ console.warn(quoin.Quote_Adjust_Amount_Page__c !=undefined && quoin.Quote_Adjust_Amount_Page__c!=='');
+ console.warn(quoin.Quote_Adjust_Amount_Page__c !=undefined);
+ console.warn(quoin.Quote_Adjust_Amount_Page__c!='0');
+ quo.Quote_Adjust_Calculate__c = quoin.Quote_Adjust_Calculate__c !=undefined&&quoin.Quote_Adjust_Calculate__c!==''?localParseFloat(quoin.Quote_Adjust_Calculate__c):null;
+ quo.Stocking_Price__c = quoin.Stocking_Price__c!=undefined? localParseFloat(quoin.Stocking_Price__c):null;
+ quo.Discount_Amount__c = quoin.Discount_Amount__c !=undefined?localParseFloat(quoin.Discount_Amount__c):null;
+ quo.AgencyDiscount__c = quoin.AgencyDiscount__c !=undefined?localParseFloat(quoin.AgencyDiscount__c):null;
+ quo.Discount_Amount_Calculate__c = quoin.Discount_Amount_Calculate__c !=undefined?localParseFloat(quoin.Discount_Amount_Calculate__c):null;
+ debugger
+ quo.PriceRefreshDate__c =quoin.PriceRefreshDate__c? TimeToString(new Date(quoin.PriceRefreshDate__c)):null;
+ quo.CreatedDate =quoin.CreatedDate? TimeToString(new Date(quoin.CreatedDate)):null;
+ quo.Quote_Expiration_Date__c =quoin.Quote_Expiration_Date__c? TimeToString(new Date(quoin.Quote_Expiration_Date__c)):null;
+ quo.Agency1__c =quoin.Agency1__c? quoin.Agency1__c:null;
+ quo.Agency2__c =quoin.Agency2__c? quoin.Agency2__c:null;
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = quoin.OCM_Sales_Forecast__c!=undefined? localParseFloat(quoin.OCM_Sales_Forecast__c):null;
+ //棰勬祴閲戦淇敼 fy
+
+ var oppInfo ={...{},...oppInfoIn};
+ oppInfo.Wholesale_Price__c =oppInfoIn.Wholesale_Price__c!=undefined? localParseFloat(oppInfoIn.Wholesale_Price__c):null;
+ oppInfosave = oppInfo;
+
+ var quoitemList = [...[],...quoLineItemIn];
+ quoitemList.forEach(quoitem=>{
+ debugger
+ quoitem.pageObject.Quantity__c = quoitem.Quantity__c;
+ quoitem.pageObject.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c);
+ quoitem.pageObject.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c);
+ quoitem.pageObject.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c);
+ quoitem.pageObject.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page);
+ quoitem.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c);
+ quoitem.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c);
+ quoitem.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c);
+ quoitem.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page);
+ quoitem.pageObject.multiYearWarranty__c = quoitem.multiYearWarranty__c;
+ quoitem.pageObject.GuaranteePeriod__c = quoitem.GuaranteePeriod__c;
+ quoitem.pageObject.warrantyType__c = quoitem.warrantyType__c;
+ quoitem.pageObject.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c);
+ quoitem.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c);
+ // quoitem.pageObject.SFDA_Status__c = quoitem.SFDA_Status__c;
+ quoitem.pageObject.Name__c = quoitem.Name__c;
+ quoitem.pageObject.Subtotal__c = localParseFloat(quoitem.Subtotal__c);
+ quoitem.Subtotal__c = localParseFloat(quoitem.Subtotal__c);
+ quoitem.Cost_Subtotal_c = localParseFloat(quoitem.Cost_Subtotal_c);
+ });
+ quoLineItemsave = quoitemList;
+
+ return quo;
+}
+export function jzProductsearchLogic(result){
+ debugger
+ var jzProductData =[...[],...result];
+ jzProductData.forEach(izpd=>{
+ izpd.Asset_Model_No__c = izpd.Product2.Asset_Model_No__c;
+ izpd.OT_CODE_no_link__c = izpd.Product2.OT_CODE_no_link__c;
+ izpd.Name = izpd.Product2.Name;
+ izpd.suitDepartment__c = izpd.Product2.suitDepartment__c;
+ izpd.Alternative_Products__c = izpd.Product2.Alternative_Products__c;
+ izpd.SFDA_Status__c = izpd.Product2.SFDA_Status__c;
+ izpd.SFDA_Status__c = SFDAtranslate(izpd.SFDA_Status__c);
+ izpd.Intra_Trade_List_RMB__c = izpd.Product2.Intra_Trade_List_RMB__c;
+ izpd.Foreign_Trade_List_US__c = izpd.Product2.Foreign_Trade_List_US__c;
+ izpd.Packing_list_manual__c = izpd.Product2.Packing_list_manual__c;
+ });
+ return jzProductData;
+}
+export function additionaljzProductLogic(selectvlue,Listvalue,tradec,IsQuoteTrial){
+ IsQuoteTrialExp = IsQuoteTrial;
+ debugger
+ var LineNoList = [];
+ Listvalue.forEach(lsv=>{
+ lsv.lineNo = localParseInt(lsv.lineNo);
+ if(lsv.lineNo){
+ LineNoList.push(lsv.lineNo);
+ }
+ });
+ var maxLineNo = FindMaximumMalue(LineNoList);
+ maxLineNo += 1;
+ // var newvalueList = [];
+ selectvlue.forEach(selectv=>{
+ debugger
+ alertExp = '';
+ // var newvalue = {...{},...selectv};
+ // var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c;
+ // var GuranteeType = selectv.Product2.GuranteeType__c;
+ //鏄惁鐧诲綍鎶ヤ环
+ if(selectv.Product2.Estimation_Entry_Possibility__c=='脳' ){
+ var Estimation_Entry_Possibility = true;
+ }else{
+ var Estimation_Entry_Possibility = false;
+ }
+ //鍐呰锤鎴愭湰
+ if(selectv.Product2.Intra_Trade_Cost_RMB__c > 0 ){
+ var CostFlag= false;
+ }else{
+ var CostFlag = true;
+ }
+ //鍐呭璐�
+ trade = tradec;
+ //鍐呰锤鎶ヤ环閲戦
+ var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c;
+ //澶栬锤鎶ヤ环閲戦
+ var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c;
+ //澶栬锤鎴愭湰
+ var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c;
+ //澶栬锤澶氬勾淇� 鍙栦骇鍝佷富鏁版嵁涓婄殑閲戦浠ュ強鎶ヤ环 绮剧悽鎶�鏈� wql start
+ // 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;
+ if(trade == "CNY") {
+ if(Estimation_Entry_Possibility){
+ alertExp = '浜у搧鏈櫥褰曟姤浠锋椂涓嶅彲鎶ヤ环!';
+ }else if(CostFlag){
+ alertExp = '浜у搧鐨勬垚鏈负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else if(!Intra_Trade_List_RMB__c||Intra_Trade_List_RMB__c<0){
+ alertExp = '浜у搧鐨勬姤浠烽噾棰濅负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else{
+ SetProductId(maxLineNo, selectv);
+ }
+ //澶栬锤
+ }else if(trade == "USD"){
+ if(Estimation_Entry_Possibility){
+ alertExp = '浜у搧鏈櫥褰曟姤浠锋椂涓嶅彲鎶ヤ环!';
+ }
+ else if(!Foreign_Trade_List_US__c||Foreign_Trade_List_US__c<0 ){
+ alertExp = '浜у搧鐨勬姤浠烽噾棰濅负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else if(!Foreign_Trade_Cost_US__c||Foreign_Trade_Cost_US__c<0){
+ alertExp = '浜у搧鐨勬垚鏈负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else{
+ SetProductId(maxLineNo, selectv);
+ }
+ }
+ maxLineNo++;
+ });
+ Listvalue = Listvalue.concat(addproductList);
+ addproductList = []
+ return Listvalue;
+}
+export function FindMaximumMalue(value){
+ if(value.length!=0){
+ var max = getMaximin(value,"max");
+ }else{
+ var max = 0;
+ }
+
+ return max;
+}
+function getMaximin(arr,maximin) {
+ if(maximin=="max") {
+ return Math.max.apply(Math,arr);
+ }
+ else if(maximin=="min") {
+ return Math.min.apply(Math, arr);
+ }
+}
+function SetProductId(lineno,selectv){
+ var Product2 = {};
+ var PricebookEntry = {Product2:Product2};
+ var latestInfo = {};
+ var pageObject = {};
+ var addobj = {PricebookEntry:PricebookEntry,
+ latestInfo:latestInfo,
+ pageObject:pageObject};
+ var Asset_Model_No__c = selectv.Product2.Asset_Model_No__c;
+ var Product2Id = selectv.Product2Id;
+ var SFDA_Status__c = selectv.Product2.SFDA_Status__c
+ var SFDA_Status = selectv.Product2.SFDA_Status__c;
+ var Estimated_ConsumptionDueDate__c = selectv.Product2.Estimated_ConsumptionDueDate__c;
+ var name = selectv.Product2.Name;
+ var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c;
+ var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c;
+ var NameCode = selectv.Product2.ProductCode;
+ var Sales_Possibility = selectv.Product2.Sales_Possibility__c;
+ var Intra_Trade_Cost_RMB__c = selectv.Product2.Intra_Trade_Cost_RMB__c;
+ var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c;
+ var Packing_list_manual__c = selectv.Product2.Packing_list_manual__c;
+ var Bsscategory = selectv.Product2.BSSCategory__c;
+ var PricebookEntryId = selectv.Id;
+ var StorageStatus__c = selectv.Product2.StorageStatus__c;
+ 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;
+
+ addobj.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c;
+ addobj.StorageStatus = StorageStatus__c;
+ addobj.lineNo = parseInt(lineno);
+ addobj.Asset_Model = Asset_Model_No__c;
+ addobj.SFDA_Status__c = SFDA_Status__c;
+ addobj.SFDA_Status__c = SFDAtranslate(addobj.SFDA_Status__c);
+ addobj.Estimated_ConsumptionDueDate = Estimated_ConsumptionDueDate__c;
+ addobj.Estimated_ConsumptionDueDate1 = Estimated_ConsumptionDueDate__c;
+ addobj.pageObject.SFDA_Status__c = SFDA_Status;
+ addobj.latestInfo.Specifications = Packing_list_manual__c;
+ addobj.Specifications = Packing_list_manual__c;
+ addobj.Name = '/'+Product2Id;
+ addobj.Name__c = name;
+ addobj.pageObject.Name__c = name;
+ var ListPrice = 0;
+ var Cost_c = 0;
+ // var Extend_new_product_gurantee = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee__c")).val();
+
+ // var Extend_new_product_gurantee_MD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee_MD__c")).val();
+
+ var GuranteeType = selectv.Product2.GuranteeType__c;
+ var Entend_gurantee_period_all = selectv.Product2.Entend_gurantee_period_all__c;
+ var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c;
+ var Intra_Trade_Service_RMB = selectv.Product2.Intra_Trade_Service_RMB__c;
+ var Maintenance_Price_Year = selectv.Product2.Maintenance_Price_Year__c;
+ if(selectv.Product2.VenderName__c==null||selectv.Product2.VenderName__c==null){
+ var VenderName =' 鏃� ';
+ }else{
+ var VenderName = selectv.Product2.VenderName__c;
+ }
+ var CanNotCancelledGurantee = selectv.Product2.CanNotCancelledGurantee__c;
+ var Is_DangerousChemicals = selectv.Product2.Is_DangerousChemicals__c;
+ var ProductGuranteePrice = 0;
+ var ProductServicePrice = 0;
+ var productMaintenance_Price_Year = 0;
+ if(trade == "CNY") {
+ ProductGuranteePrice = Intra_Trade_Gurantee_RMB;
+ ProductServicePrice = Intra_Trade_Service_RMB;
+ productMaintenance_Price_Year = Maintenance_Price_Year;
+ ListPrice = Intra_Trade_List_RMB__c;
+ Cost_c = Intra_Trade_Cost_RMB__c;
+ } else if(trade == "USD"){
+ ProductGuranteePrice = Intra_Trade_Gurantee_USD;
+ ProductServicePrice = Intra_Trade_Service_USD;
+ productMaintenance_Price_Year = Maintenance_Price_Year_USD;
+ ListPrice = Foreign_Trade_List_US__c;
+ Cost_c = Foreign_Trade_Cost_US__c;
+ }
+ Cost_c = toNum(Cost_c);
+ // ListPrice = toNum(ListPrice);
+ // addobj.ListPrice_Page = toNumComma(ListPrice);
+ addobj.ListPrice_Page = ListPrice;
+ addobj.pageObject.ListPrice_Page = ListPrice;
+ addobj.Quantity__c = 1;
+ // addobj.UnitPrice_Page__c = toNumComma(ListPrice);
+ addobj.UnitPrice_Page__c = ListPrice;
+ // addobj.Subtotal__c = toNumComma(ListPrice);
+ addobj.Subtotal__c = ListPrice;
+ addobj.pageObject.Subtotal__c = ListPrice;
+ addobj.latestInfo.ProductCode = NameCode;
+ addobj.latestInfo.ProductName = name;
+ addobj = MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c);
+ addobj.latestInfo.SFDA_Status = SFDA_Status__c;
+ addobj.latestInfo.Sales_Possibility = Sales_Possibility;
+ addobj.latestInfo.ListPrice = ListPrice;
+ addobj.latestInfo.Cost = Cost_c;
+ addobj.Cost_c = Cost_c;
+ addobj.Cost_Subtotal_c = Cost_c;
+ addobj.pageObject.BSS_Category__c = Bsscategory;
+ addobj.pageObject.Id__c = Product2Id;
+ addobj.pageObject.PricebookEntryId = PricebookEntryId;
+ addobj.pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all;
+ addobj.Maintenance_Price_Year = productMaintenance_Price_Year;
+ addobj.latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year;
+ addobj.pageObject.GuranteeType__c = GuranteeType;
+ addobj.VenderName = VenderName;
+ addobj.CanNotCancelledGurantee = CanNotCancelledGurantee;
+ addobj.Is_DangerousChemicals = Is_DangerousChemicals;
+ addobj.ProductGuranteePrice = ProductGuranteePrice;
+ addobj.pageObject.productServicePrice__c = ProductServicePrice;
+ //chenjingwu DB202308355043 2023.8.25 start
+ addobj.Category5 = selectv.Product2.Category5__c;
+ //chenjingwu DB202308355043 2023.8.25 end
+ addproductList.push(addobj);
+ // if(VenderName != 'OSH'&&VenderName != ''){
+ // window.opener.j$(escapeVfId('Page:mainForm:block:lists:'+lineno+':UnitPrice')).attr('disabled','disabled');
+ // }
+ IsQuoteTrialExp = false;
+}
+function MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c){
+
+ 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;
+
+ //棰勮娑堣�楀埌鏈熸棩 - 褰撳墠鏃� 鐩稿樊澶╂暟(difDate)
+ var ndate = new Date(currentdate);
+ var nowDate = ndate.getTime();
+ var edate = new Date(Estimated_ConsumptionDueDate__c);
+ var endDate = edate.getTime();
+ var difDate = (endDate - nowDate)/((1000 * 60 * 60 * 24));
+
+ //鍒ゆ柇
+ if(difDate < 90){
+ addobj.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ return addobj;
+}
+export function MarkRed(quoitemList) {
+ quoitemList.forEach(item=>{
+ var a = item.Asset_Model;
+ var b = item.Estimated_ConsumptionDueDate;
+ if (a != '') {
+ 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;
+
+ //棰勮娑堣�楀埌鏈熸棩 - 褰撳墠鏃� 鐩稿樊澶╂暟(difDate)
+ var ndate = new Date(currentdate);
+ var nowDate = ndate.getTime();
+ var edate = new Date(b);
+ var endDate = edate.getTime();
+ var difDate = (endDate - nowDate) / ((1000 * 60 * 60 * 24));
+
+ //鍒ゆ柇
+ if (difDate < 90) {
+ item.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps';
+ }else{
+ item.EstimatedConsumptionDueDateclass = '';
+ }
+ }
+ });
+ return quoitemList;
+}
+export function filterNameoptionList(){
+ var optionList = [{label:'--鏃�--',value: ''},
+ {label:'娑堝寲绉�',value: '娑堝寲绉�'},
+ {label:'鍛煎惛绉�',value: '鍛煎惛绉�'},
+ {label:'鏅绉�',value: '鏅绉�'},
+ {label:'娉屽翱绉�',value: '娉屽翱绉�'},
+ {label:'濡囩',value: '濡囩'},
+ {label:'鑰抽蓟鍠夌',value: '鑰抽蓟鍠夌'},
+ {label:'鑳介噺',value: '鑳介噺'},
+ {label:'SI',value: 'SI'},
+ {label:'澶栫閫氱敤',value: '澶栫閫氱敤'}];
+ return optionList;
+}
+export function SelectDone(activities){
+ debugger
+ var setPFString = '';
+ activities.forEach(arc=>{
+ if(!setPFString){
+ setPFString = arc.Id;
+ }else{
+ setPFString = setPFString+','+arc.Id;
+ }
+ });
+ DataStatus = 'Fin';
+ return setPFString;
+}
+//鍒濆鍖栦骇鍝佽祴鍊�
+export function InitializeProductAssignment(quoteLineItem){
+ debugger
+ console.warn(JSON.stringify(quoteLineItem));
+ quoteLineItem.forEach(quotltiem=>{
+ 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);
+ quotltiem.AgencySubtotal__c = quotltiem.pageObject.AgencySubtotal__c;
+ quotltiem.AgencyUnitPrice__c = quotltiem.pageObject.AgencyUnitPrice__c;
+ // quotltiem.ListPrice_Page = toNumComma(quotltiem.ListPrice_Page);
+ quotltiem.multiYearWarranty__c = quotltiem.pageObject.multiYearWarranty__c;
+ quotltiem.GuaranteePeriod__c = quotltiem.pageObject.GuaranteePeriod__c;
+ quotltiem.warrantyType__c = quotltiem.pageObject.warrantyType__c;
+ quotltiem.NoDiscountTotal__c = quotltiem.pageObject.NoDiscountTotal__c;
+ quotltiem.SFDA_Status__c = quotltiem.pageObject.SFDA_Status__c;
+ quotltiem.SFDA_Status__c = SFDAtranslate(quotltiem.SFDA_Status__c);
+ quotltiem.Name__c = quotltiem.pageObject.Name__c;
+ quotltiem.Subtotal__c = quotltiem.pageObject.Subtotal__c;
+ // quotltiem.Subtotal__c = toNumComma(quotltiem.Subtotal__c);
+ quotltiem.Name = '/'+quotltiem.pageObject.Id__c;
+ if((!(!quotltiem.pageObject.Product_Sales_Possibility__c || quotltiem.pageObject.Product_Sales_Possibility__c == '鈼�') && !quotltiem.changed_sfda)){
+ quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(quotltiem.haveno_Register){
+ quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(quotltiem.changed_list){
+ quotltiem.ListPricePageclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(quotltiem.changed_name == true || quotltiem.wrong_Register == true){
+ quotltiem.Nameclass = 'slds-text-color_red';
+ }
+
+ //浜у搧Id
+ });
+ const inputAlignright = document.createElement('style');
+ inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`;
+ document.body.appendChild(inputAlignright);
+ quoteLineItem = MarkRed(quoteLineItem);
+ return quoteLineItem;
+}
+export function actState(reslut,list){
+ var reslutList = JSON.parse(reslut);
+ var reMap = new Map();
+ reslutList.forEach(itm=>{
+ var val = {
+ haveno_Register:itm.haveno_Register,
+ wrong_Register:itm.wrong_Register
+ };
+ reMap.set(itm.pageObject.Id__c,val);
+ });
+ list.forEach(ac=>{
+ if(reMap.has(ac.pageObject.Id__c)){
+ var vlu = reMap.get(ac.pageObject.Id__c);
+ ac.haveno_Register = vlu.haveno_Register;
+ ac.wrong_Register = vlu.wrong_Register;
+ }
+ if((!(!ac.pageObject.Product_Sales_Possibility__c || ac.pageObject.Product_Sales_Possibility__c == '鈼�') && !ac.changed_sfda)){
+ ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(ac.haveno_Register){
+ ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(ac.changed_list){
+ ac.ListPricePageclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(ac.changed_name == true || ac.wrong_Register == true){
+ ac.Nameclass = 'slds-text-color_red';
+ }
+ });
+ const inputAlignright = document.createElement('style');
+ inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`;
+ document.body.appendChild(inputAlignright);
+ return list;
+}
+export function PriceStatusUpdateLogic(jzDataToBeproduct,newQuoteFlag){
+ newQuoteFlagex = newQuoteFlag;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ debugger
+ if ((jzdtbt.Asset_Model != null) && (jzdtbt.Asset_Model != '')&& (jzdtbt.Asset_Model.length>0)) {
+ // 鍙鏇存柊锛屽氨鐢熸垚鏂版姤浠风紪鐮�
+ jzdtbt.ListPrice_Page = localParseFloat(jzdtbt.ListPrice_Page);
+ if (jzdtbt.pageObject.SFDA_Status__c != jzdtbt.latestInfo.SFDA_Status ||
+ jzdtbt.pageObject.Name__c != jzdtbt.latestInfo.ProductName ||
+ jzdtbt.ListPrice_Page != jzdtbt.latestInfo.ListPrice ||
+ jzdtbt.pageObject.Cost__c != jzdtbt.latestInfo.Cost ||
+ jzdtbt.Cost_c != jzdtbt.latestInfo.Cost
+ //璁℃彁閲戦
+ || jzdtbt.ProductGuranteePrice != jzdtbt.latestInfo.Intra_Trade_Gurantee
+ || jzdtbt.pageObject.productServicePrice__c != jzdtbt.latestInfo.Intra_Trade_Service
+ // 缁翠慨鍚堝悓鎶ヤ环
+ || jzdtbt.Maintenance_Price_Year != jzdtbt.latestInfo.Maintenance_Price_Year
+ ) {
+ newQuoteFlagex = true;
+ }
+ if (jzdtbt.pageObject.Name__c != jzdtbt.latestInfo.ProductName) {
+ jzdtbt.changed_name = true;
+ }
+ if (jzdtbt.pageObject.SFDA_Status__c != jzdtbt.latestInfo.SFDA_Status) {
+ jzdtbt.changed_sfda = true;
+ }
+ if (jzdtbt.ListPrice_Page != jzdtbt.latestInfo.ListPrice) {
+ jzdtbt.changed_list = true;
+ }
+ if (jzdtbt.pageObject.Cost__c != jzdtbt.latestInfo.Cost) {
+ jzdtbt.changed_cost = true;
+ }
+ // TODO katsu SFDA銈广儐銉笺偪銈广伄纰鸿獚銇仼銇勩倝銇亜銇с仚銇嬶紙鏈�鏂板晢鍝乆XX銇爡鐩倐锛�
+ jzdtbt.pageObject.SFDA_Status__c = jzdtbt.latestInfo.SFDA_Status;
+ jzdtbt.SFDA_Status__c = jzdtbt.pageObject.SFDA_Status__c;
+ jzdtbt.pageObject.Name__c = jzdtbt.latestInfo.ProductName;
+ jzdtbt.Name__c = jzdtbt.pageObject.Name__c;
+ jzdtbt.ListPrice_Page = jzdtbt.latestInfo.ListPrice;
+ jzdtbt.pageObject.Cost__c = jzdtbt.latestInfo.Cost;
+ jzdtbt.Cost_c = jzdtbt.latestInfo.Cost;
+ jzdtbt.pageObject.ProductGuranteePrice__c = jzdtbt.latestInfo.Intra_Trade_Gurantee;
+ jzdtbt.pageObject.GuranteeType__c = jzdtbt.latestInfo.GuranteeType;
+ // 璁℃彁閲戦
+ jzdtbt.pageObject.productServicePrice__c = jzdtbt.latestInfo.Intra_Trade_Service;
+ // 澶氬勾淇濅慨骞撮檺
+ jzdtbt.pageObject.ProductEntend_gurantee_period_all__c
+ = jzdtbt.latestInfo.ProductEntend_gurantee_period_all;
+ // 缁翠慨鍚堝悓鎶ヤ环
+ jzdtbt.Maintenance_Price_Year = jzdtbt.latestInfo.Maintenance_Price_Year;
+ // jzdtbt.ListPrice_Page = toNumComma(jzdtbt.ListPrice_Page);
+ jzdtbt.ListPrice_Page = jzdtbt.ListPrice_Page;
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function calGuranteeAllFieldsLogic(jzDataToBeproduct,quo){
+ debugger
+ var AllGurantee_Period = quo.Gurantee_Period__c;
+ var contractmultiYearWarranty = true;
+ if (quo.multiYearWarranty__c != null) {
+ contractmultiYearWarranty = quo.multiYearWarranty__c;
+ }
+ var MultiYearWarrantyTotalPrice__c = 0.00;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var GuranteeType =jzdtbt.pageObject.GuranteeType__c;
+ // 淇濅慨绫诲瀷
+ var warrantyType = '';
+ // 浜у搧淇濅慨鏈�
+ var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c;
+ // 浜у搧璁℃彁閲戦
+ var ProductGuranteePrice__c = jzdtbt.ProductGuranteePrice;
+ // 浜у搧 service Price
+ var ServicePrice = jzdtbt.pageObject.productServicePrice__c;
+ // 淇濅慨
+ var multiYearWarranty = false;
+ // 鏄惁鍙栨秷淇濅慨
+ var If_Cancel_Guarantee = false;
+ //浜у搧涓绘暟鎹鍔犫�滀笉鍙彇娑堝骞翠繚鈥� 2020/08/28 绮剧悽鎶�鏈� wql start
+ var CanNotCancelledGurantee = jzdtbt.CanNotCancelledGurantee;
+ //浜у搧涓绘暟鎹鍔犫�滀笉鍙彇娑堝骞翠繚鈥� 2020/08/28 绮剧悽鎶�鏈� wql end
+ // 鑰� no discount price
+ var oldServicePrice =jzdtbt.pageObject.ServicePrice__c;
+ jzdtbt.pageObject.ServicePrice__c = 0;
+ jzdtbt.warrantyType__c = '';
+ var NoDiscountTotal = 0;
+ if (GuranteeType == '鏈嶅姟') {
+ multiYearWarranty = true;
+ jzdtbt.warrantyType__c = '鏈嶅姟澶氬勾淇濅慨';
+ warrantyType = '鏈嶅姟澶氬勾淇濅慨';
+ } else if (GuranteeType == '甯傚満' && contractmultiYearWarranty == false) {
+ multiYearWarranty = true;
+ jzdtbt.pageObject.ServicePrice__c = ServicePrice;
+ jzdtbt.warrantyType__c = '甯傚満澶氬勾淇濅慨';
+ warrantyType = '甯傚満澶氬勾淇濅慨';
+ var Quantity =jzdtbt.Quantity__c;
+ MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ }
+ else if (GuranteeType == '甯傚満' && contractmultiYearWarranty && CanNotCancelledGurantee) {
+ multiYearWarranty = true;
+ jzdtbt.pageObject.ServicePrice__c = ServicePrice;
+ jzdtbt.warrantyType__c = '甯傚満澶氬勾淇濅慨';
+ warrantyType = '甯傚満澶氬勾淇濅慨';
+ // 鏁伴噺
+ var Quantity = jzdtbt.Quantity__c;
+ MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ }
+ else if (GuranteeType == '甯傚満') {
+ If_Cancel_Guarantee = true;
+ }
+ // if (jzdtbt.NoDiscountTotal__c != null) {
+ jzdtbt.NoDiscountTotal__c = toNumComma(NoDiscountTotal);
+ // }
+
+ // 鏇存柊鍚庣殑 no discount price
+ var newServicePrice = jzdtbt.pageObject.ServicePrice__c;
+ newServicePrice = localParseFloat(newServicePrice);
+ oldServicePrice = localParseFloat(oldServicePrice);
+ if (newServicePrice != oldServicePrice) {
+ var unitPrice = jzdtbt.UnitPrice_Page__c;
+ unitPrice = localParseFloat(unitPrice);
+ // jzdtbt.UnitPrice_Page__c = toNum(unitPrice + newServicePrice - oldServicePrice);
+ jzdtbt.UnitPrice_Page__c = unitPrice + newServicePrice - oldServicePrice;
+ }
+ jzdtbt.pageObject.If_Cancel_Guarantee__c = If_Cancel_Guarantee;
+ // 璁剧疆淇濅慨
+ // if (jzdtbt.multiYearWarranty__c != null) {
+ jzdtbt.multiYearWarranty__c = multiYearWarranty;
+ // }
+ var GuranteePrice = 0;
+ // 璁℃彁骞撮檺
+ var provistonPeriod = 0;
+ // 鏍规嵁浜у搧淇℃伅璁剧疆淇濅慨骞撮檺 鍜岃鎻愰噾棰�
+ if (GuranteeType == '鏈嶅姟') {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ GuranteePrice = ProductGuranteePrice__c;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ provistonPeriod = ProductEntend_gurantee_period;
+ } else if (GuranteeType == '甯傚満') {
+ if (contractmultiYearWarranty == false) {
+ if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ provistonPeriod = ProductEntend_gurantee_period;
+ GuranteePrice = ProductGuranteePrice__c;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }else if (contractmultiYearWarranty && CanNotCancelledGurantee) {
+ if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ provistonPeriod = ProductEntend_gurantee_period;
+ GuranteePrice = ProductGuranteePrice__c;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }
+ else {
+ jzdtbt.pageObject.GuaranteePeriod__c = 1;
+ jzdtbt.GuaranteePeriod__c = 1;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }
+ jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0;
+
+ });
+ MultiYearWarrantyTotalPriceExport = MultiYearWarrantyTotalPrice__c;
+ return jzDataToBeproduct;
+}
+export function initQuoteLineItemcheck(quoteLineItem,productStatusUpdated){
+ debugger
+ newQuoteFlagExp = false;
+ productStatusUpdatedExp = productStatusUpdated;
+ quoteLineItem.forEach(a=>{
+ if(!a.Maintenance_Price_Year){
+ a.Maintenance_Price_Year = 0;
+ }
+ if(!a.latestInfo.Maintenance_Price_Year){
+ a.latestInfo.Maintenance_Price_Year = 0;
+ }
+ if(!a.pageObject.GuranteeType__c){
+ a.pageObject.GuranteeType__c = '';
+ }
+ if(!a.latestInfo.GuranteeType){
+ a.latestInfo.GuranteeType = '';
+ }
+ if (a.Asset_Model) {
+ if(a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status
+ ||a.pageObject.Name__c != a.latestInfo.ProductName
+ ||a.ListPrice_Page != a.latestInfo.ListPrice
+ ||a.pageObject.Cost__c != a.latestInfo.Cost
+ ||a.Cost_c != a.latestInfo.Cost
+ ||a.ProductGuranteePrice != a.latestInfo.Intra_Trade_Gurantee
+ ||a.pageObject.productServicePrice__c != a.latestInfo.Intra_Trade_Service
+ ||a.Maintenance_Price_Year != a.latestInfo.Maintenance_Price_Year
+ ||a.pageObject.GuranteeType__c != a.latestInfo.GuranteeType
+ ||a.pageObject.ProductEntend_gurantee_period_all__c != a.latestInfo.ProductEntend_gurantee_period_all
+ ||a.pageObject.PricebookEntry.Product2.CanNotCancelledGurantee__c != a.latestInfo.CanNotCancelledGurantee
+ ) {
+ newQuoteFlagExp = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.pageObject.Name__c != a.latestInfo.ProductName) {
+ a.changed_name = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status) {
+ a.changed_sfda = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.ListPrice_Page != a.latestInfo.ListPrice) {
+ a.changed_list = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.pageObject.Cost__c != a.latestInfo.Cost) {
+ a.changed_cost = true;
+ productStatusUpdatedExp = true;
+ }
+ a.pageObject.SFDA_Status__c = a.latestInfo.SFDA_Status;
+ a.pageObject.Name__c = a.latestInfo.ProductName;
+ a.ListPrice_Page = a.latestInfo.ListPrice;
+ a.pageObject.Cost__c = a.latestInfo.Cost;
+ a.Cost_c = a.latestInfo.Cost;
+ a.ProductGuranteePrice = a.latestInfo.Intra_Trade_Gurantee;
+ a.pageObject.productServicePrice__c = a.latestInfo.Intra_Trade_Service;
+ a.Maintenance_Price_Year = a.latestInfo.Maintenance_Price_Year;
+ a.pageObject.ProductEntend_gurantee_period_all__c= a.latestInfo.ProductEntend_gurantee_period_all;
+ a.pageObject.GuranteeType__c = a.latestInfo.GuranteeType;
+ }
+ });
+ return quoteLineItem;
+}
+//鍔犲ぉ鏁�
+export function addDay(dayNumber, date) {
+ var ms = dayNumber * (1000 * 60 * 60 * 24)
+ var newDate = new Date(date.getTime() + ms);
+ return newDate;
+}
+//璁$畻涓や釜鏃ユ湡涔嬮棿鐨勫ぉ鏁�
+export function dateDaysBetween(dateStrBegin, dateStrEnd) {
+ if (!dateStrBegin || !dateStrEnd) return 0;
+ var s1 = dateStrBegin.getTime(),
+ s2 = dateStrEnd.getTime();
+ var total = (s2 - s1) / 1000;
+ var day = parseInt(total / (24 * 60 * 60));
+ return day;
+}
+ /*
+ 璁$畻缁忛攢鍟嗗崟浠峰拰缁忛攢鍟嗗皬璁�
+ */
+ // quoteAgencyTotalPriceAction1
+// CHAN-B4YAB8 2018/9/28 璁$畻缁忛攢鍟嗗崟浠峰拰灏忚 start
+ // 濡傛灉鏄疧CSM鐩撮攢锛屽垯鏇存敼鍖婚櫌鍚堝悓浠锋牸鏃朵細璁$畻缁忛攢鍟嗗崟浠峰拰灏忚
+ // 濡傛灉鏄� 缁忛攢鍟嗛攢鍞紝鍒欐洿鏀� 绗竴缁忛攢鍟嗘�讳环鏄細璁$畻缁忛攢鍟嗗崟浠峰拰灏忚
+export function quoteAgencyTotalPriceActionLogic(jzDataToBeproduct,quo,oppInfo,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){
+ debugger
+ var s,l;
+ var SalesAmount1 = quo.OCM_Agent1_Price_Page__c;
+ var Estimation_List_Price = 0;
+ var thirdPartyEstimation_List_Price = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName == '' || VenderName == 'OSH') {
+ Estimation_List_Price = Estimation_List_Price + s * l;
+ } else {
+ thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + s * l;
+ }
+ });
+ // 鍖婚櫌鐨勫悎鍚岄噾棰�
+ var Dealer_Final_Price = quo.Dealer_Final_Price_Page__c;
+ // 閿�鍞笭閬�
+ var Sales_Root = oppInfo.Sales_Root__c;
+ var TotalPrice = 0;
+ var StardardPrice = 0;
+ var totalAgencyPrice = 0;
+ var AgencySubtotal = 0;
+ var LastAgencySubtotal = 0;
+ var j = 0;
+ var i = -1;
+ var lastQuantity = 0;
+ Sales_Root = Sales_Root + '';
+ Sales_Root = Sales_Root.replace(/\s+/g, "");
+ if (Sales_Root == '缁忛攢鍟�') {
+ TotalPrice = SalesAmount1;
+ } else {
+ TotalPrice = Dealer_Final_Price;
+ }
+ TotalPrice = localParseFloat(TotalPrice);
+ var oldTotalPrice = TotalPrice;
+ totalAgencyPrice = TotalPrice;
+ //no discount price 鍚堣
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ TotalPrice = TotalPrice - noDiscountPriceTotal;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ if ((s == 0) || (l == 0)) {
+ //鍑︾悊銇仐
+ } else if (oldTotalPrice == 0) {
+ jzdtbt.pageObject.AgencySubtotal__c = 0;
+ jzdtbt.AgencySubtotal__c = toNumComma_One_digit(0);
+ jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(0);
+ } else {
+ StardardPrice = s * l;
+ StardardPrice = localParseFloat(StardardPrice);
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ //琛岄」鐩� no discount price:
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ var Agency_UnitPrice = (l).toFixed(1);
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName == '' || VenderName == 'OSH') {
+ var Agency_UnitPrice = (StardardPrice * (TotalPrice - thirdPartyEstimation_List_Price) / (Estimation_List_Price * s) + noDiscountPrice ).toFixed(1);
+ }
+ AgencySubtotal = Agency_UnitPrice * s;
+ jzdtbt.pageObject.AgencySubtotal__c = AgencySubtotal;
+ jzdtbt.AgencySubtotal__c = toNumComma_One_digit(AgencySubtotal);
+ jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(Agency_UnitPrice);
+ totalAgencyPrice = totalAgencyPrice - toNum(AgencySubtotal);
+ i++;
+ j=i;
+ lastQuantity = s;
+ LastAgencySubtotal = AgencySubtotal;
+ }
+ });
+ if (oldTotalPrice != 0){
+ LastAgencySubtotal = LastAgencySubtotal + totalAgencyPrice;
+ if(jzDataToBeproduct.length>0){
+ jzDataToBeproduct[j].pageObject.AgencySubtotal__c = toNum(LastAgencySubtotal);
+ jzDataToBeproduct[j].AgencySubtotal__c = toNumComma_One_digit(LastAgencySubtotal);
+ jzDataToBeproduct[j].AgencyUnitPrice__c = toNumComma_One_digit(LastAgencySubtotal / lastQuantity);
+ }
+ }
+ return jzDataToBeproduct;
+}
+//鏍规嵁琛岄」鐩笂浜у搧鐨勪俊鎭� 鏇存柊澶氬勾淇濅慨琛岄」鐩墍鏈夊瓧娈碉紝 骞朵笖鏇存柊No Discount Price鍚堣
+export function calPriceAllLogic(jzDataToBeproduct){
+ var x, y, z, c;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.Quantity__c;
+ x = localParseInt(x);
+ if (x > 0) {
+ y = jzdtbt.UnitPrice_Page__c;
+ c = jzdtbt.Cost_c;
+ y = localParseFloat(y);
+ c = localParseFloat(c);
+ z = x * y;
+ // jzdtbt.Subtotal__c = toNumComma(z);
+ jzdtbt.Subtotal__c = z;
+ jzdtbt.pageObject.Subtotal__c = toNum(z);
+ z = x * c;
+ jzdtbt.Cost_Subtotal_c = toNum(z);
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function QuoteAdjustLogic(jzDataToBeproduct,quo,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){
+ debugger
+ var x = quo.QuoteTotal_Page__c;
+ x = localParseFloat(x);
+ var y = quo.hidden_Estimation_List;
+ y = localParseFloat(y);
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ var thirdPartyEstimation_List_Price = 0;
+ var price = 0;
+ var Quantity = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName != '' && VenderName != 'OSH') {
+ price = jzdtbt.ListPrice_Page;
+ price = localParseFloat(price);
+ Quantity = jzdtbt.Quantity__c;
+ Quantity = localParseInt(Quantity);
+ thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity;
+ }
+ });
+ thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price);
+ 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) / (y - thirdPartyEstimation_List_Price) * 100);
+ }
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+export function AgencyDiscountCalculation1Logic(quo,jzDataToBeproduct,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){
+ var y = quo.OCM_Agent1_Price_Page__c;
+ if (y != '' && y.length != 0) {
+ var Estimation_List_Price = quo.Estimation_List_Price__c;
+ y = y + '';
+ y = y.replace(/ /g, "");
+ if (Estimation_List_Price.length != 0) {
+ y = localParseFloat(y);
+ Estimation_List_Price = localParseFloat(Estimation_List_Price);
+ // 绗笁鏂逛骇鍝佹爣鍑嗗畾浠锋�婚
+ var thirdPartyEstimation_List_Price = 0;
+ var price = 0;
+ var Quantity = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName != '' && VenderName != 'OSH') {
+ price = jzdtbt.ListPrice_Page;
+ price = localParseFloat(price);
+ Quantity = jzdtbt.Quantity__c;
+ Quantity = localParseInt(Quantity);
+ thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity;
+ }
+ });
+ thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price);
+ if (Estimation_List_Price - thirdPartyEstimation_List_Price == 0) {
+ quo.AgencyDiscount__c = toNumComma(0);
+ // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0));
+ } else {
+ //no discount price 鍚堣
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ 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));
+ }
+ } else {
+ quo.AgencyDiscount__c = toNumComma(0);
+ // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0));
+ }
+ } else {
+ quo.AgencyDiscount__c = toNumComma(0);
+ // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0));
+ }
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+//妫�鏌ユ姤浠疯鐨凬MPA鐘舵��
+export function checkNMPA(jzDataToBeproduct) {
+ var cnt = 0;
+ var nmpa;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ nmpa = jzdtbt.SFDA_Status__c;
+ if (nmpa == '鍋滄') {
+ cnt = cnt + 1;
+ return;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+export function AlertAuthorize(oppInfo) {
+ var Authorized_DB_No = oppInfo.Authorized_DB_No__c;
+ var If_Need_Authorize = oppInfo.If_Need_Authorize__c;
+ if (If_Need_Authorize) {
+ if (Authorized_DB_No == null || Authorized_DB_No == '') {
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ return true;
+ }
+}
+export function AlertForCFDA(jzDataToBeproduct) {
+ var SFDA_Status__c, cnt;
+ cnt = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ SFDA_Status__c = jzdtbt.SFDA_Status__c;
+ if (SFDA_Status__c == '澶辨晥-閲嶆柊鐢宠涓�' || SFDA_Status__c == '澶卞姽锛堝啀鐢宠珛涓級') {
+ cnt = cnt + 1;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+export function CheckForCost(jzDataToBeproduct) {
+ var Cost, cnt, name;
+ cnt = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ Cost = jzdtbt.Cost_c;
+ name = jzdtbt.pageObject.Name__c;
+ if (name && Cost <= 0) {
+ cnt = cnt + 1;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+//妫�鏌ユ槸鍚︽湁鏍囧噯瀹氫环涓�0鐨勬儏鍐�
+export function CheckForListPrice(jzDataToBeproduct) {
+ var ListPrice, name;
+ var cnt = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ ListPrice = jzdtbt.ListPrice_Page;
+ ListPrice = localParseFloat(ListPrice);
+ name = jzdtbt.pageObject.Name__c;
+ if (name && ListPrice <= 0) {
+ cnt = cnt + 1;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+export function SubtotalupdateLogic(jzDataToBeproduct){
+ debugger
+ console.warn('Unit6');
+ var x, y, z;
+ z = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.Quantity__c;
+ x = localParseInt(x);
+ y = jzdtbt.UnitPrice_Page__c;
+ y = localParseFloat(y);
+ z = x * y;
+ if (jzdtbt.UnitPrice_Page__c != "") {
+ // jzdtbt.Subtotal__c = toNumComma(z);
+ jzdtbt.Subtotal__c = z;
+ jzdtbt.pageObject.Subtotal__c = toNum(z);
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function quoteTotalPriceActionLogic(quo,jzDataToBeproduct,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){
+ var s = 0;
+ var x = 0;
+ var l = 0;
+ // 闈炵涓夋柟浜у搧鏍囧噯瀹氫环鎬婚
+ var y = 0;
+ var yy = 0;
+ // 闈炵涓夋柟浜у搧鎶ヤ环鎬婚
+ var z = quo.QuoteTotal_Page__c;
+ // 浜у搧鎶ヤ环鎬婚
+ var zz = 0;
+ z = localParseFloat(z);
+ //no discount price 鍚堣
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ x = s * l;
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ // OSH 璁$畻鏍囧噯瀹氫环鎬婚
+ if (VenderName == 'OSH' || VenderName == '') {
+ y = y + x;
+ // 闈濷SH 灏嗕骇鍝佹姤浠锋�婚 鍑忓幓 绗笁鏂逛骇鍝�
+ } else {
+ z = z - x;
+ }
+ });
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ //琛岄」鐩� no discount price:
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ // 琛岄」鐩� 鏍囧噯瀹氫环灏忚
+ x = s * l;
+ x = localParseFloat(x);
+ if ((s == 0) || (x == 0)) {
+ //涓嶅鐞�
+ } else {
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName == 'OSH' || VenderName == '') {
+ 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;
+ // jzdtbt.UnitPrice_Page__c = toNumComma(yy / s + noDiscountPrice);
+ jzdtbt.UnitPrice_Page__c = yy / s + noDiscountPrice;
+ } else {
+ yy = localParseFloat(x);
+ }
+ zz = zz + yy;
+ }
+ });
+ quo.QuoteTotal_Page__c = toNumComma(zz + noDiscountPriceTotal);
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+//鍒犻櫎浜у搧鏄庣粏鍜屽緟閫変骇鍝� item鏄�変腑鐨勪骇鍝佹槑缁嗗璞� TypeName鏄�変腑鐨勪骇鍝佹槑缁嗗瀵瑰簲鐨勬柟妗堢被鍨�
+export function UnitPriceUpdateLogic(quo,jzDataToBeproduct,QuoteDecision_Button){
+ debugger
+ var num;
+ num = quo.Quote_Adjust_Calculate__c;
+ num = localParseFloat(num);
+ quo.Quote_Adjust_Calculate__c = toNumComma(num);
+ num = (100 + num) / 100;
+ var price = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ price = jzdtbt.ListPrice_Page;
+ price = localParseFloat(price);
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (price != '' && VenderName == 'OSH') {
+ // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice);
+ jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice;
+ } else if (price != '' && VenderName == '') {
+ // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice);
+ jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice;
+ }
+ });
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+export function calGuranteePeriodLogic(jzDataToBeproduct,AllGurantee_Period){
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ // 淇濅慨
+ var multiYearWarranty = true;
+ if (jzdtbt.multiYearWarranty__c) {
+ multiYearWarranty = jzdtbt.multiYearWarranty__c;
+ }
+ // 淇濅慨绫诲瀷
+ var warrantyType = jzdtbt.warrantyType__c;
+ // 浜у搧淇濅慨绫诲瀷
+ var GuranteeType = jzdtbt.pageObject.GuranteeType__c;
+ // 浜у搧淇濅慨鏈�
+ var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c;
+ // 璁℃彁骞撮檺
+ var provistonPeriod = 0;
+ // 鏍规嵁浜у搧淇℃伅璁剧疆淇濅慨骞撮檺
+ if (GuranteeType == '鏈嶅姟') {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ provistonPeriod = ProductEntend_gurantee_period;
+ } else if (GuranteeType == '甯傚満') {
+ if (multiYearWarranty == true) {
+ if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ provistonPeriod = ProductEntend_gurantee_period;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = 1;
+ jzdtbt.GuaranteePeriod__c = 1;
+ }
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0;
+ });
+ return jzDataToBeproduct;
+}
+export function PrintCustomerNameoptionsvlue(options_hp,selection_hp,quo,options_hpflg,accs){
+ if (JSON.stringify(accs) != "{}") {
+ if (accs[0].Name) {
+ var options_hpvalue = {};
+ options_hpvalue.label = accs[0].Name;
+ options_hpvalue.value = accs[0].Name;
+ options_hp.push(options_hpvalue);
+ }
+ if (accs[0].Site) {
+ var options_hpvalue = {};
+ options_hpvalue.label = accs[0].Site;
+ options_hpvalue.value = accs[0].Site;
+ options_hp.push(options_hpvalue);
+ }
+ if (accs[0].Alias_Name2__c) {
+ var options_hpvalue = {};
+ options_hpvalue.label = accs[0].Alias_Name2__c;
+ options_hpvalue.value = accs[0].Alias_Name2__c;
+ options_hp.push(options_hpvalue);
+ }
+ debugger
+ if (!quo.Print_HP_Name__c ||
+ (quo.Print_HP_Name__c !== accs[0].Name &&
+ quo.Print_HP_Name__c !== accs[0].Site &&
+ quo.Print_HP_Name__c !== accs[0].Alias_Name2__c)
+ ) {
+ selection_hp = accs[0].Name;
+ } else {
+ selection_hp = quo.Print_HP_Name__c;
+ }
+ options_hpflg = false;
+ }
+ selection_hpExp = selection_hp;
+ options_hpflgExp = options_hpflg;
+ console.warn('selection_hp'+selection_hp);
+ return options_hp
+}
+export function initquoassignment(quote,quoc,it){
+ var quo = quoc
+ var rtn = quo.Cancel_Decide__c;
+ quo.rtn = !rtn ? it : !rtn;
+ var CreatedDateTime = new Date(quote.CreatedDate);
+ var PriceRefreshDate = new Date(quote.PriceRefreshDate__c);
+ quo.PriceRefreshPeriod = dateDaysBetween(!PriceRefreshDate ? CreatedDateTime : PriceRefreshDate,new Date());
+ quo.QuoteName__c = quote.Name;
+ quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c);
+ quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c);
+ quo.Quote_Adjust_Amount_Page__c = toNumComma(quote.Quote_Adjust_Amount__c);
+ if(quo.OCM_Agent1_Price__c){
+ quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c);
+ }else{
+ quo.OCM_Agent1_Price_Page__c = '';
+ }
+ quo.MultiYearWarrantyTotalPrice__c = toNumComma(quo.MultiYearWarrantyTotalPrice__c);
+ quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c);
+ quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c);
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c);
+ //棰勬祴閲戦淇敼 fy
+ if(!quote.QuotationChange__c){
+ quo.QuotationChange__c = '';
+ }
+ if(!quote.Installation_location__c){
+ quo.Installation_location__c = '';
+ }
+
+ if(quote.Agent1_Agent2_Price__c){
+ quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c);
+ }else{
+ quo.Agent1_Agent2_Price_Page__c = '';
+ }
+ quo.hidden_Estimation_List = quote.Estimation_List_Price__c;
+ return quo;
+}
+export function initquoassignmentcopy(quote,quoc,it){
+ debugger
+ var quo = quoc
+ let Name = quote.Name;
+ var QX = Name.indexOf('宸插彇娑�:');
+ if (QX >= 0) {
+ quo.Name = quo.Name.substring(QX + 4);
+ }
+ quo.QuoteName__c = quo.Name;
+ quo.IsQuoteTrial__c = false;
+ quo.Cancel_Decide__c = false;
+ quo.PriceRefreshDate__c = new Date();
+ quo.Quote_Date__c = null;
+ quo.Quote_Print_Date__c = null;
+ quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c);
+ if(quo.OCM_Agent1_Price__c){
+ quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c);
+ }else{
+ quo.OCM_Agent1_Price_Page__c = '';
+ }
+ quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c);
+ quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c);
+ if(quote.Agent1_Agent2_Price__c){
+ quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c);
+ }else{
+ quo.Agent1_Agent2_Price_Page__c = '';
+ }
+ quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c);
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c);
+ //棰勬祴閲戦淇敼 fy
+ quo.Quote_Adjust_Calculate__c = '';
+ quo.Quote_Adjust_Amount_Page__c = '';
+ quo.hidden_Estimation_List = quote.Estimation_List_Price__c;
+ quo.PriceRefreshPeriod = null;
+ if(!quote.QuotationChange__c){
+ quo.QuotationChange__c = '';
+ }
+ if(!quote.Installation_location__c){
+ quo.Installation_location__c = '';
+ }
+ var rtn = quo.Cancel_Decide__c;
+ quo.rtn = !rtn ? it : !rtn;
+ return quo;
+}
+export function salesProfit1Logic(quo,Salesprofit1value){
+ var x = quo.Dealer_Final_Price_Page__c;
+ var y = quo.OCM_Agent1_Price_Page__c;
+ debugger
+ y = y + '';
+ y = y.replace(/ /g, "");
+ if (y.length == 0) {
+ var z = quo.Agent1_Agent2_Price_Page__c;
+ z = z + '';
+ z = z.replace(/ /g, "");
+ if (z.length == 0) {
+ quo.OCM_Agent1_Price_Page__c = '';
+ Salesprofit1value = '';
+ quo.Agency1_Profit__c = '';
+ } else {
+ quo.OCM_Agent1_Price_Page__c = toNumComma(0);
+ Salesprofit1value = toNum(0);
+ quo.Agency1_Profit__c = toNumComma(0);
+ }
+ } else {
+ quo.OCM_Agent1_Price_Page__c = toNumComma(y);
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ var t = quo.Agent1_Agent2_Price_Page__c;
+ if (t.length == 0) {
+ Salesprofit1value = toNum(x - y);
+ quo.Agency1_Profit__c = toNumComma(x - y);
+ } else {
+ t = localParseFloat(t);
+ Salesprofit1value = toNum(t - y);
+ quo.Agency1_Profit__c = toNumComma(t - y);
+ }
+ }
+ quoExp = quo;
+ return Salesprofit1value;
+}
+export function salesCalculation1Logic(quo,Salesprofit1value,SalesCalculation1value){
+ var w = quo.OCM_Agent1_Price_Page__c;
+ w = w + '';
+ w = w.replace(/ /g, '');
+ var x = Salesprofit1value;
+ var y = quo.Dealer_Final_Price_Page__c;
+ var z = quo.Agent1_Agent2_Price_Page__c;
+ z = z + '';
+ z = z.replace(/ /g, '');
+ if (w.length == 0) {
+ SalesCalculation1value = '';
+ quo.Agency1_Profit_Rate__c = '';
+ } else {
+ x = localParseFloat(x);
+ var t = 0;
+ if (z.length == 0) {
+ y = localParseFloat(y);
+ if (y != 0) {
+ t = x / y * 100;
+ } else {
+ t = 0;
+ }
+ } else {
+ z = localParseFloat(z);
+ if (z != 0) {
+ t = x / z * 100;
+ } else {
+ t = 0;
+ }
+ }
+ SalesCalculation1value = toNum(t);
+ quo.Agency1_Profit_Rate__c = toNumComma(t);
+ }
+ quoExp = quo;
+ return SalesCalculation1value;
+}
+export function salesProfit2Logic(quo,Salesprofit2value){
+ var x = quo.Dealer_Final_Price_Page__c;
+ var y = quo.Agent1_Agent2_Price_Page__c;
+ y = y + '';
+ y = y.replace(/ /g, "");
+ if (y.length == 0) {
+ quo.Agent1_Agent2_Price_Page__c = '';
+ Salesprofit2value ='';
+ quo.Agency2_Profit__c = '';
+ } else {
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ quo.Agent1_Agent2_Price_Page__c = toNumComma(y);
+ Salesprofit2value = toNum(x - y);
+ quo.Agency2_Profit__c = toNumComma(x - y);
+ }
+ quoExp = quo;
+ return Salesprofit2value;
+}
+/*
+ 璁$畻绗簩缁忛攢鍟嗘爮鏈�鍙宠竟鐨勭櫨鍒嗘瘮 2娆¤博澹插簵鍒╃泭鐜嘷鍏� = 绗簩缁忛攢鍟嗗埄娑﹂櫎浠ュ尰闄㈢殑鍚堝悓閲戦
+ */
+export function salesCalculation2Logic(quo,Salesprofit2value,SalesCalculation2value){
+ var w = quo.Agent1_Agent2_Price_Page__c;
+ w = w + '';
+ w = w.replace(/ /g, '');
+ var x = Salesprofit2value;
+ var y = quo.Dealer_Final_Price_Page__c;
+ if (w.length == 0) {
+ SalesCalculation2value = '';
+ quo.Agency2_Profit_Rate__c = '';
+ } else {
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ if ((y == 0)) {
+ SalesCalculation2value = toNum(0);
+ quo.Agency2_Profit_Rate__c = toNumComma(0);
+ } else {
+ var z = x / y * 100;
+ SalesCalculation2value = toNum(z);
+ quo.Agency2_Profit_Rate__c = toNumComma(z);
+ }
+ }
+ quoExp = quo;
+ return SalesCalculation2value;
+}
+export function additionabuttonLoc(SelectedNewsetProduct,quo,oppInfo,jzDataToBeproduct){
+ var Str = SelectDone(SelectedNewsetProduct);
+ var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ StrExp = Str;
+ return {setProduct_text:Str,
+ activitiesCan:quoLineItemCan,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan};
+}
+export function onsaveToBeproductLoc(data,jzDataToBeproduct){
+ var dataMap = new Map();
+ var fag = false;
+ data.forEach(item=>{
+ var key = Number(item.lineNo);
+ var value = {Quantity__c:'',UnitPrice_Page__c:''}
+ if(item.Quantity__c != undefined){
+ value.Quantity__c = item.Quantity__c;
+ fag = true;
+ }
+ if(item.UnitPrice_Page__c != undefined){
+ value.UnitPrice_Page__c = item.UnitPrice_Page__c;
+ }
+ dataMap.set(key,value);
+ });
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var x, y, z, c;
+ if(dataMap.has(jzdtbt.lineNo)){
+ var datavaue = dataMap.get(jzdtbt.lineNo);
+ if(datavaue.Quantity__c){
+ jzdtbt.Quantity__c = localParseInt(datavaue.Quantity__c);
+ }
+ if(datavaue.UnitPrice_Page__c){
+ // jzdtbt.UnitPrice_Page__c = toNumComma(datavaue.UnitPrice_Page__c);
+ jzdtbt.UnitPrice_Page__c = datavaue.UnitPrice_Page__c;
+ }
+ x = localParseInt(jzdtbt.Quantity__c);
+ y = localParseFloat(jzdtbt.UnitPrice_Page__c);
+ c = localParseFloat(jzdtbt.Cost_c);
+ z = x * y;
+ // jzdtbt.Subtotal__c = toNumComma(z)
+ jzdtbt.Subtotal__c = z
+ // jzdtbt.pageObject.Subtotal__c = toNumComma(z)
+ jzdtbt.pageObject.Subtotal__c = z
+ z = x * y;
+ jzdtbt.Cost_Subtotal_c = toNum(z);
+ }
+ });
+ fagExp = fag;
+ return jzDataToBeproduct;
+}
+export function PrintButtonLoc(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert,
+ productStatusUpdated,enableSales,oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period,
+ quotemultiYearWarranty,selection_hp,SkipQuotefilg,QuoteDecision){
+ debugger
+ var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var CheckItemCan = JSON.stringify(CheckItem);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ var data ={activitiesCan:quoLineItemCan,
+ CheckItemCan:CheckItemCan,
+ WinOrDecideAlertc:WinOrDecideAlert,
+ productStatusUpdatedc:productStatusUpdated,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan,
+ enableSalesc:enableSales,
+ oppIdc:oppId,
+ quoIdc:quoId,
+ newQuoteFlagc:newQuoteFlag,
+ changedAfterPrintc:changedAfterPrint,
+ quoteGurantee_Periodc:quoteGurantee_Period,
+ quotemultiYearWarrantyc:quotemultiYearWarranty,
+ selection_hpc:selection_hp,
+ SkipQuotefilgc:SkipQuotefilg,
+ QuoteDecisionc:QuoteDecision
+ };
+ return data;
+}
+export function saverebackloc(resaut,quoId,nafg){
+ alertExp = ''
+ var Setmap = new Map()
+ var key = Object.keys(resaut)
+ key.forEach(item=>{
+ Setmap.set(item,resaut[item]);
+ });
+ if(Setmap.has('errormessage')){
+ errorflg = true;
+ alertExp = Setmap.get('errormessage');
+ }else{
+ if(Setmap.has('quoId')){
+ quoId = Setmap.get('quoId');
+ }
+ if(Setmap.has('quoId')){
+ window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_self');
+ // window.location.href ='/lightning/n/lexNewQuoteEntry#Id='+Setmap.get('quoId');
+ flg = true;
+ }
+ errorflg = false;
+ }
+ nafgExp = resultFlag(nafg,Setmap)
+ return quoId;
+}
+// 浼樻儬鎶樻墸 = 浼樻儬浠锋牸 / 锛堟姤浠锋�婚 - No discount price 鍚堣锛夛紱
+export function DisCalculationfunctionLoc(quo){
+ var x = quo.Discount_Amount__c;
+ x = localParseFloat(x);
+ var y = quo.QuoteTotal_Page__c;
+ y = localParseFloat(y);
+ if ((y == 0)) {
+ quo.Discount_Amount_Calculate__c = '';
+ } else {
+ var z = 0;
+ z = x / y * 100;
+ z = z.toFixed(2);
+ quo.Discount_Amount_Calculate__c = toNum(z);
+ }
+ return quo;
+}
+// 鏍规嵁鍖婚櫌灏忚璁$畻鎶ヤ环鎬婚
+export function quoteTotalPriceLoc(jzDataToBeproduct,quo,quoId,oppInfo,Saleslet){
+ debugger
+ var x = 0;
+ var y = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.pageObject.Subtotal__c;
+ x = localParseFloat(x);
+ y = y + localParseFloat(x);
+ });
+ quo.QuoteTotal_Page__c = toNumComma(y);
+ var z = quo.Estimation_List_Price__c;
+ var id = quoId;
+ if(!id){
+ var IsQuoteTrial =quo.IsQuoteTrial__c;
+ if(!IsQuoteTrial){
+ var mp =quo.MultiYearWarrantyTotalPrice__c;
+ mp = localParseFloat(mp);
+ var num = quo.Quote_Adjust_Calculate__c;
+ num = localParseFloat(num);
+ 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) : '';
+ }
+ }
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+//璁$畻闅愯棌 listPirce 姹囨�� 鍜� UnitPrice(鍖婚櫌鍗曚环) 姹囨��
+export function calUnitPriceTotalLoc(jzDataToBeproduct){
+ var ListPriceTotal = 0.0,
+ listPrice = 0.0;
+ var unitPriceTotal = 0.0,
+ unitPrice = 0.0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ listPrice = jzdtbt.ListPrice_Page;
+ unitPrice = jzdtbt.UnitPrice_Page__c;
+ ListPriceTotal += localParseFloat(listPrice);
+ unitPriceTotal += localParseFloat(unitPrice);
+ });
+ ListPriceTotalExp = ListPriceTotal;
+ unitPriceTotalExp = unitPriceTotal;
+ jzDataToBeproduct =[].concat(jzDataToBeproduct);
+ return jzDataToBeproduct;
+}
+//鍒ゆ柇杩涢攢鍟�1 鍜� 2 娓呯┖ 鍒╂鼎鐧惧垎姣旀樉绀�
+export function pageArrangeLoc(quo){
+ if (!quo.OCM_Agent1_Price_Page__c) {
+ quo.Agency1_Profit__c = '';
+ quo.Agency1_Profit_Rate__c = '';
+ quo.OCM_Agent1_Price_Page__c = '';
+ }
+ if (!quo.Agent1_Agent2_Price_Page__c) {
+ quo.Agency2_Profit__c = '';
+ quo.Agency2_Profit_Rate__c = '';
+ quo.Agent1_Agent2_Price_Page__c = '';
+ }
+ return quo;
+}
+export function openQuotePage(b, b2, b3) {
+ var quoid = b3;
+ if (b2) {
+ } else {
+ if (b) {
+ //openPopup('/apex/contractdetailpdf?id=quoid');
+ window.open('/apex/contractdetailpdf?id=' + quoid, 'Contract');
+ } else {
+ //openPopup('/apex/quotepdf?id=quoid');
+ window.open('/apex/quotepdf?id=' + quoid, 'Quote');
+ }
+ }
+}
+export function quoteinit(quo){
+ if (!quo.Gurantee_Period__c) {
+ quo.Gurantee_Period__c = '1';
+ }
+ if (quo.Quote_Expiration_Date__c == null) {
+ quo.Quote_Expiration_Date__c = addDay(30,new Date());
+ }
+ quo.Offer_Amount__c = true;
+ quo.TOTAL__c = true;
+ quo.Preferential_Gurantee_Period__c = true;
+ return quo;
+}
+/*
+ 濡傛灉璇环鏄粡閿�鍟嗚穿鍗栵紝锛迹锛娴嬮閿�鍞� = 绗竴缁忛攢鍟�
+ 濡傛灉璇环鏄疧CM鐩撮攢锛岋集锛o辑棰勬祴棰濋攢鍞� = 鍖婚櫌鐨勫悎鍚岄噾棰�
+ */
+export function setOCMAmountc(enableSales,quo,oppInfo){
+ var s, t;
+ s = enableSales;
+ if (s) {
+ t = quo.OCM_Agent1_Price_Page__c;
+ } else {
+ t = quo.Dealer_Final_Price_Page__c;
+ }
+ t = localParseFloat(t);
+ oppInfo.hidden_Wholesale_Price = toNum(t);
+ oppInfo.Wholesale_Price__c = toNumComma(t);
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = toNumComma(t);
+ quoExp = quo;
+ //棰勬祴閲戦淇敼 fy
+ return oppInfo;
+}
+// 浼樻儬浠锋牸 = 鎶ヤ环鎬婚 - 鍖婚櫌鐨勫悎鍚岄噾棰�
+ // 鐒跺悗璋冪敤 DisCalculation
+export function DisAmountfunctionc(quo){
+ var x = quo.QuoteTotal_Page__c;
+ x = localParseFloat(x);
+ var y = quo.Dealer_Final_Price_Page__c;
+ y = localParseFloat(y);
+ quo.Discount_Amount__c = toNum(x - y);
+ return quo;
+}
+export function SFDAtranslate(key){
+ var value = '';
+ if(key == '婧栧倷涓�'){
+ value = '鍑嗗涓�';
+ }else if(key == '鏂拌=鍝佺敵璜嬩腑'){
+ value = '鏂颁骇鍝佹敞鍐屼腑';
+ }else if(key == '鏈夊姽'){
+ value = '鏈夋晥';
+ }else if(key == '澶卞姽锛堟湡闄愬唴鐢熺敚娓堝湪搴蹇滐級'){
+ value = '澶辨晥鎴栧仠姝紙娉ㄥ唽璇佹湁鏁堟湡鍐呯敓浜х殑搴撳瓨鍝佸搴旓級';
+ }else if(key == '澶卞姽锛堝啀鐢宠珛涓級'){
+ value = '澶辨晥-閲嶆柊鐢宠涓�';
+ }else if(key == '澶卞姽锛堢敵璜嬬劇锛�'){
+ value = '澶辨晥-涓嶅啀娉ㄥ唽';
+ }else if(key == '鏈夊姽锛堝啀鐢宠珛涓級'){
+ value = '鏈夋晥-閲嶆柊鐢宠涓�';
+ }else{
+ value = key;
+ }
+ return value;
+}
+export function decisionlol(jzDataToBeproduct,oppInfo,QuotationCalculationFag){
+ var ff = false;
+ alertExp = '';
+ var Shut = AlertForCFDA(jzDataToBeproduct);
+ var ifAuth = AlertAuthorize(oppInfo);
+ var arr = [];
+ var Venderflag = false;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ var prdouctName = jzdtbt.pageObject.Name__c;
+ if (prdouctName) {
+ arr.push(VenderName);
+ }
+ });
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[0] != arr[i]) {
+ Venderflag = true;
+ }
+ }
+ var listPrice = CheckForListPrice(jzDataToBeproduct);
+ var cost = CheckForCost(jzDataToBeproduct);
+ if (Shut == true) {
+ ff = true;
+ alertExp = '鎻愮ず锛氬寘鍚噸鏂扮敵璇稢FDA鐨勪骇鍝侊紝涓嶅彲Decide銆�';
+ } else if (ifAuth == false) {
+ ff = true;
+ alertExp = '鎻愮ず锛氳璇环鏈巿鏉冿紝涓嶅彲Decide';
+ } else if (Venderflag == true) {
+ ff = true;
+ alertExp = '鎻愮ず锛氳鎸夌収涓嶅悓渚涘簲鍟嗘媶鍗曪紝涓嶅厑璁竏ecide銆�';
+ }else if (listPrice == true || cost == true) {
+ ff = true;
+ alertExp = '浜у搧瀹氫环/鎴愭湰涓�0锛岃鑱旂郴浜у搧鏈儴銆�';
+ }else if(QuotationCalculationFag){
+ ff = true;
+ alertExp = '浜у搧閰嶇疆鍙戠敓鍙樺寲锛岃鍐嶆杩涜鎶ヤ环璁$畻';
+ }
+ return ff;
+}
+export function saveQuotel(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert,productStatusUpdated,enableSales,
+ oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period,quotemultiYearWarranty,selection_hp,SkipQuotefilg,quoteflg){
+ var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct);
+ debugger
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var CheckItemCan = JSON.stringify(CheckItem);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ var SaveQuotecan = {activitiesCan:quoLineItemCan,
+ CheckItemCan:CheckItemCan,
+ WinOrDecideAlertc:WinOrDecideAlert,
+ productStatusUpdatedc:productStatusUpdated,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan,
+ enableSalesc:enableSales,
+ oppIdc:oppId,
+ quoIdc:quoId,
+ newQuoteFlagc:newQuoteFlag,
+ changedAfterPrintc:changedAfterPrint,
+ quoteGurantee_Periodc:quoteGurantee_Period,
+ quotemultiYearWarrantyc:quotemultiYearWarranty,
+ selection_hpc:selection_hp,
+ SkipQuotefilgc:SkipQuotefilg,
+ quoteflg:quoteflg
+ }
+ return SaveQuotecan;
+}
+export function resultFlag(nafg,Setmap){
+ debugger
+ if(!Setmap){
+ nafg.dfpp = false;
+ nafg.qname = false;
+ nafg.qacc = false;
+ nafg.qaapc = false;
+ nafg.Agency1 = false;
+ nafg.nAgency1 = false;
+ nafg.oapp = false;
+ nafg.noapp = false;
+ nafg.Agency2 = false;
+ nafg.nAgency2 = false;
+ nafg.aapp = false;
+ nafg.naapp = false;
+ }else{
+ if(Setmap.has('dfpp')){
+ nafg.dfpp = true;
+ }else{
+ nafg.dfpp = false;
+ }
+ if(Setmap.has('qname')){
+ nafg.qname = true;
+ }else{
+ nafg.qname = false;
+ }
+ if(Setmap.has('qacc')){
+ nafg.qacc = true;
+ }else{
+ nafg.qacc = false;
+ }
+ if(Setmap.has('qaapc')){
+ nafg.qaapc = true;
+ }else{
+ nafg.qaapc = false;
+ }
+ if(Setmap.has('Agency1')){
+ nafg.Agency1 = true;
+ }else{
+ nafg.Agency1 = false;
+ }
+ if(Setmap.has('nAgency1')){
+ nafg.nAgency1 = true;
+ }else{
+ nafg.nAgency1 = false;
+ }
+ if(Setmap.has('oapp')){
+ nafg.oapp = true;
+ }else{
+ nafg.oapp = false;
+ }
+ if(Setmap.has('noapp')){
+ nafg.noapp = true;
+ }else{
+ nafg.noapp = false;
+ }
+ if(Setmap.has('Agency2')){
+ nafg.Agency2 = true;
+ }else{
+ nafg.Agency2 = false;
+ }
+ if(Setmap.has('nAgency2')){
+ nafg.nAgency2 = true;
+ }else{
+ nafg.nAgency2 = false;
+ }
+ if(Setmap.has('aapp')){
+ nafg.aapp = true;
+ }else{
+ nafg.aapp = false;
+ }
+ if(Setmap.has('naapp')){
+ nafg.naapp = true;
+ }else{
+ nafg.naapp = false;
+ }
+ }
+ return nafg;
+}
+// 璁$畻浜у搧鏍囧噯瀹氫环鎬婚
+export function EstimationL(jzDataToBeproduct,quo){
+ var x, y, z;
+ x = 0;
+ y = 0;
+ z = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.ListPrice_Page;
+ y = jzdtbt.Quantity__c;
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ z = z + (x * y);
+ });
+ jzDataToBeproduct =[].concat(jzDataToBeproduct);
+ quo.hidden_Estimation_List = toNum(z);
+ quo.Estimation_List_Price__c = toNumComma(z);
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+export function checkch(jzDataToBeproduct){
+ var activities = [];
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var lineId = jzdtbt.pageObject.PricebookEntryId;
+ if (lineId) {
+ var item = new Object();
+ item.PricebookEntryId = jzdtbt.pageObject.PricebookEntryId;
+ item.SFDA_Status__c = jzdtbt.pageObject.SFDA_Status__c;
+ item.UnitPrice__c = localParseFloat(jzdtbt.UnitPrice_Page__c);
+ item.ListPrice__c = localParseFloat(jzdtbt.ListPrice_Page);
+ item.Quantity = localParseInt(jzdtbt.Quantity__c);
+ item.Is_DangerousChemicals = jzdtbt.Is_DangerousChemicals;
+ item.Is_CanNotCancelFlag = jzdtbt.CanNotCancelledGurantee;
+ activities.push(item);
+ }
+ });
+ return activities;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexquoteTrialUtil.js b/force-app/main/default/lwc/lexNewQuoteEntry/lexquoteTrialUtil.js
new file mode 100644
index 0000000..88e816f
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexquoteTrialUtil.js
@@ -0,0 +1,3347 @@
+const initSearchFormProduct = [{
+ label: "浜у搧鍨嬪彿",
+ type: "text",
+ name: "Asset_Model_No__c",
+ isInput: true
+},
+{
+ label: "浜у搧鍚嶇О",
+ type: "text",
+ name: "Name__c",
+ isInput: true
+}
+]
+export var arrTempsss = [];
+export var arrProductTempsss = [];
+export var NewDefaultDatass = [];
+export var AddProductDatass = [];
+export var jzDataFixedPriceTemps = [];
+export var jzDataDiscountTemps = [];
+export var DeftCopyQtyLists = [];
+export var jzDataDefaultExp = [];
+export var jzDataProductExp = [];
+export var jzDataFixedPriceExp = [];
+export var jzDataDiscountExp = [];
+export var jzDataDefaultCopyQuantityListExp = [];
+export var newArrsTemp3Exp = [];
+export var newArrsTemp4Exp = [];
+export var jzDataDefaultCopyExp = [];
+export var newArrsTempExp = [];
+export var newArrsTemp2Exp = [];
+export var booleanExp = 0;
+export var boolean2Exp = false;
+export var boolean3Exp = false;
+export var dataExp = [];
+export var newDataExp = [];
+export var newData2Exp = [];
+export var newData3Exp = [];
+export var editnewDateExp = [];
+export var GuaranteeDiscount__cZuiXiaoExp =0;
+export var NormalDiscount__cZuiXiaoExp =0;
+export var CompareFullDataExp =[];
+export var HeTongTotalExp =[];
+export var SelectedFnDataFixedPriceExp = [];
+export var idsExp = [];
+export var CompareFullDataTempExp = [];
+export var jzDataDefaultNotChangeExp = [];
+export var iflagExp = false;
+export var falgExp = false;
+export var newTempExp = [];
+export var ifnullExp = true;
+export var isChangeExp;
+export var buttonIsShowE;
+export var initDTFP;
+export var initDTD;
+export var initDTOD;
+export var initDTC;
+
+
+
+
+export function GetName() {
+}
+//=======鏇存柊淇冮攢鏂规娆℃暟鏁版嵁閫昏緫
+export function updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData) {
+ CompareFullData.forEach(item => {
+ if (item.ListName == "浠锋牸鏀跨瓥") {
+ var filterTemp = jzDataFixedPriceTemp.filter(fItem => {
+ if (fItem.Id == item.Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (filterTemp != undefined || filterTemp.length > 0) {
+ var fileterTempObject = {
+ ...{},
+ ...filterTemp[0]
+ };
+ fileterTempObject.Counts = item.num;
+ jzDataFixedPriceTemp = jzDataFixedPriceTemp.map(element => {
+ if (element.Id == fileterTempObject.Id) {
+ element = fileterTempObject;
+ } else {
+ let elementTemp = {
+ ...{},
+ ...element
+ };
+ element = elementTemp;
+ }
+ return element;
+ });
+ }
+ }
+ if (item.ListName == "鎶樻墸鏀跨瓥") {
+ var filterTemp = jzDataDiscountTemp.filter(fItem => {
+ if (fItem.Id == item.Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (filterTemp != undefined || filterTemp.length > 0) {
+ var fileterTempObject = {
+ ...{},
+ ...filterTemp[0]
+ };
+ fileterTempObject.Counts = item.num;
+ jzDataDiscountTemp = jzDataDiscountTemp.map(element => {
+ if (element.Id == fileterTempObject.Id) {
+ element = fileterTempObject;
+ } else {
+ let elementTemp = {
+ ...{},
+ ...element
+ };
+ element = elementTemp;
+ }
+ return element;
+ });
+ }
+ }
+ })
+ jzDataFixedPriceTemps = jzDataFixedPriceTemp;
+ jzDataDiscountTemps = jzDataDiscountTemp;
+}
+//鍙嶇畻鎶樻墸鏃朵慨鏀规姌鎵f斂绛栭�昏緫
+export function ReverseCalculationModifyDiscountLogic(arrTemp1,arrProductTemp,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item){
+ //price鍜�
+ var sumListCount = 0;
+ //nod鍜�
+ var sumNodCount = 0;
+ //鐗圭害鎶樻墸nod鍜宭ist鍚�
+ var sumListAndNod = 0;
+ //鍚骞翠繚浜у搧list
+ var ObjectProducList=[];
+ //涓嶅惈澶氬勾淇濅骇鍝乴ist
+ var NotObjectProducList=[];
+ //鎶樻墸
+ var NormalDisN = 0;
+ var NormalDisG = 0;
+ var distinguish = 0;
+ var distinguish2 = 0;
+ arrProductTemp.forEach(itemss => {
+ if(itemss.recordTypeName__c=="Authorizer"){
+ if (itemss.PromotionId==Id&&
+ itemss.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ itemss.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input) {
+ if(itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ sumListAndNod +=itemss.Quantity *(itemss.ListPrice+itemss.ServicePrice__c);
+ ObjectProducList.push(itemss);
+ }else if(itemss.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ sumListCount += itemss.Quantity * itemss.ListPrice;
+ sumNodCount += itemss.Quantity * itemss.ServicePrice__c;
+ NotObjectProducList.push(itemss);
+ }
+ }
+ }else{
+ if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ itemss.Category__c == Category__c) {
+ sumListCount += itemss.Quantity * itemss.ListPrice;
+ sumNodCount += itemss.Quantity * itemss.ServicePrice__c;
+ }
+ }
+ });
+ if (sumListCount != 0||sumListAndNod!=0) {
+ if(item.JxsType=='涓�鑸姌鎵�'||NotObjectProducList.length!=0){
+ NormalDisN = ((NormalDiscount_H_Money__c - sumNodCount) / sumListCount * 100).toFixed(2);
+ if(item.JxsType!='涓�鑸姌鎵�'){
+ if(item.NormalDiscount__c!=undefined&&item.NormalDiscount__c!=''){
+ var NormalDiscount__cc=parseFloat(item.NormalDiscount__c);
+ if(NormalDisN<NormalDiscount__cc){
+ distinguish=1;
+ }
+ }
+ }else if(NormalDisN<0){
+ distinguish=3;
+ }
+ }
+ debugger
+ if(ObjectProducList.length!=0){
+ NormalDisG =(GuaranteeDiscount_H_Money__c/sumListAndNod*100).toFixed(2);
+ if(item.GuaranteeDiscount__c!=undefined&&item.GuaranteeDiscount__c!=''){
+ var GuaranteeDiscount__cc=parseFloat(item.GuaranteeDiscount__c);
+ if(NormalDisG<GuaranteeDiscount__cc){
+ distinguish2 = 2;
+ }
+ }
+ }
+ arrTemp1.forEach(arrte => {
+ if (item.JxsType=="涓�鑸姌鎵�") {
+ if(arrte.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrte.Category__c == Category__c){
+ if(distinguish==1||distinguish==3){
+ arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan;
+ item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan;
+ }else{
+ arrte.NormalDiscount__c_Input = NormalDisN+'%';
+ item.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ }
+ }else if(item.JxsType=="鐗圭害鎶樻墸"){
+ if(arrte.Id==Id&&
+ arrte.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrte.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){
+
+ if(distinguish2==2||distinguish==1||distinguish==3){
+ arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan;
+ item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan;
+ arrte.GuaranteeDiscount_H_Money__c = arrte.GuaranteeDiscount_H_Money_yuan;
+ item.GuaranteeDiscount_H_Money__c = item.GuaranteeDiscount_H_Money_yuan;
+ }else{
+ if(NormalDisN!=0){
+ arrte.NormalDiscount__c_Input = NormalDisN+'%';
+ item.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ if(NormalDisG!=0){
+ arrte.GuaranteeDiscount__c_Input = NormalDisG+'%';
+ item.GuaranteeDiscount__c_Input = NormalDisG+'%';
+ }
+ }
+ }
+ }
+ });
+ if(distinguish!=1&&distinguish2!=2&&distinguish!=3){
+ arrProductTemp.forEach(arrpt => {
+ if(arrpt.recordTypeName__c=="Authorizer"){
+ if(arrpt.PromotionId==Id&&
+ arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrpt.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){
+ if(NormalDisN!=0){
+ arrpt.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ if(NormalDisG!=0){
+ arrpt.GuaranteeDiscount__c_Input = NormalDisG+'%';
+ }
+ }
+ }else{
+ if (arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrpt.Category__c == Category__c) {
+ arrpt.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ }
+ });
+ }
+ arrTempsss =arrTemp1;
+ arrProductTempsss = arrProductTemp;
+ }
+ debugger
+ if(distinguish==1&&distinguish2!=2){
+ return 1;
+ }else if(distinguish!=1&&distinguish2==2){
+ return 2;
+ }else if(distinguish==1&&distinguish2==2){
+ return 12;
+ }else if(distinguish==3){
+ return 3;
+ }else{
+ return item;
+ }
+}
+//鍙嶇畻鎶樻墸鎻愮ず淇℃伅
+export function InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao){
+ if(ffgg==1){
+ return "淇敼閿欒锛岄潪瀵硅薄鍝佹姌鎵d笉寰楀皬浜庨潪瀵硅薄鍝佹渶浣庢姌鎵�:"+NormalDiscount__cZuiXiao+"%";
+ }else if(ffgg==2){
+ return "淇敼閿欒锛屽璞″搧鎶樻墸涓嶅緱灏忎簬瀵硅薄鍝佹渶浣庢姌鎵�:"+GuaranteeDiscount__cZuiXiao+"%";
+ }else if(ffgg==12){
+ return "淇敼閿欒锛屽璞″搧鎶樻墸涓嶅緱灏忎簬瀵硅薄鍝佹渶浣庢姌鎵o細"+GuaranteeDiscount__cZuiXiao+"%"+"锛屼笖闈炲璞″搧鎶樻墸涓嶅緱灏忎簬闈炲璞″搧鏈�浣庢姌鎵o細"+NormalDiscount__cZuiXiao+"%";
+ }else if(ffgg==3){
+ return "淇敼閿欒锛岄潪瀵硅薄鍝佹姌鎵d笉寰楀皬浜�0";
+ }else{
+ return "鏁版嵁淇敼鎴愬姛";
+ }
+}
+//鍚堝悓浠锋牸姹囨�婚�昏緫
+export function ContractPriceComputeLogic(sum,jzDataProductList,jzDataDiscountList,jzDataFixedPriceList){
+ var DataDiscount = []; //鎶樻墸鏀跨瓥浜у搧鏄庣粏
+ jzDataProductList.forEach(jdpd => {
+ jzDataDiscountList.forEach(jddp => {
+ var PromotionHeadRecordId = jddp.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (jdpd.PromotionId == jddp.Id && //鏂规Id
+ jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ DataDiscount.push(jdpd);
+ }
+ } else {
+ if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.Category__c == jdpd.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ DataDiscount.push(jdpd);
+ }
+ }
+ });
+ });
+ DataDiscount.forEach(jjc => {
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum = sum + jjc.AgencySubtotal__c;
+ });
+ jzDataFixedPriceList.forEach(jzdfp => {
+ var HeTongTotals = parseFloat(jzdfp.HeTongTotal)
+ if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") {
+ HeTongTotals = 0;
+ }
+ sum = sum + HeTongTotals;
+ });
+ sum = Math.round(sum * 100) / 100;
+ return sum;
+}
+ //璁$畻杩囧悗鐗圭害鎶樻墸鐨勫悎鍚屼环鏍�
+ export function SpecialPriceComputeReverse(DataDiscount,fag){
+ var sum=0;
+ var sum1=0
+ DataDiscount.forEach(jjc => {
+ if(jjc.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum = sum + jjc.AgencySubtotal__c;
+ sum=parseFloat(sum.toFixed(2));
+ }
+ if(jjc.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum1 = sum1 + jjc.AgencySubtotal__c;
+ sum1=parseFloat(sum1.toFixed(2));
+ }
+ });
+ if(fag){
+ return sum;
+ }else{
+ return sum1;
+ }
+}
+//鏇存敼涓�鑸姌鎵e悎鍚屼环鏍艰绠楀悎鍚屾�讳环閫昏緫
+export function GeneralDiscountContractSummaryLogic(sum,jzDataDiscountList,jzDataFixedPriceList){
+ jzDataDiscountList.forEach(jddp => {
+ var HeTongPrice = parseFloat(jddp.HeTongPrice)
+ if (jddp.HeTongPrice == undefined || jddp.HeTongPrice == "") {
+ HeTongPrice = 0;
+ }
+ sum =sum + HeTongPrice;
+ });
+ jzDataFixedPriceList.forEach(jzdfp =>{
+ var HeTongTotals = parseFloat(jzdfp.HeTongTotal)
+ if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") {
+ HeTongTotals = 0;
+ }
+ sum =sum + HeTongTotals;
+ });
+ sum = Math.round(sum * 100) / 100;
+ return sum;
+}
+//鎶樻墸鏀跨瓥鍖归厤瑙勫垯閮ㄥ垎閫昏緫
+//SelectedData 閫変腑鐨勬暟鎹� IdStr 閫変腑鐨勬暟鎹甀d CompareId 鏂规涓敤鍒扮殑uuid
+export function SpecialSavesChangePartLogic(jzDataDefaultList,SaveName, SelectedData, IdStr, CompareId,DefalutQuantity,newDicountData,jzDataDiscountList){
+ var NewDefaultData = [];
+ var AddProductData = [];
+ jzDataDefaultList.forEach(defaultItem => { //寰呴�変骇鍝�
+ var defaultItemTemp = {
+ ...{},
+ ...defaultItem
+ };
+ var SelectedList = SelectedData.itemss.filter(items => {
+ if (items.Id == defaultItem.Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (SelectedList != undefined && SelectedList.length > 0) {
+ var SelectedListDataTemp = {
+ ...{},
+ ...SelectedList[0]
+ };
+ SelectedListDataTemp.PromotionNo__c = SelectedData.PromotionNo__c;
+ SelectedListDataTemp.Name = SelectedData.Name;
+ SelectedListDataTemp.TypeName = "鎶樻墸鏀跨瓥";
+ SelectedListDataTemp.PromotionId = IdStr;
+ if (SaveName == "涓�鑸姌鎵�") {
+ SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c_Input;
+ } else {
+ SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c;
+ }
+ SelectedListDataTemp.GuaranteeDiscount__c_Input = SelectedData.GuaranteeDiscount__c;
+ SelectedListDataTemp.Category__c = SelectedData.Category__c;
+ SelectedListDataTemp.CompareId = CompareId;
+ SelectedListDataTemp.Quantity = SelectedListDataTemp.SplitQuantity;
+ if (defaultItemTemp.Quantity != SelectedListDataTemp.Quantity) {
+ defaultItemTemp.Quantity = defaultItemTemp.Quantity - SelectedListDataTemp.Quantity;
+ DefalutQuantity += defaultItemTemp.Quantity;
+ NewDefaultData.push(defaultItemTemp);
+ AddProductData.push(SelectedListDataTemp);
+ } else {
+ DefalutQuantity += SelectedListDataTemp.Quantity;
+ AddProductData.push(SelectedListDataTemp);
+ return
+ }
+ } else {
+ NewDefaultData.push(defaultItemTemp);
+ }
+ })
+ NewDefaultDatass=NewDefaultData;
+ AddProductDatass=AddProductData;
+ //娣诲姞鏁伴噺
+ jzDataDiscountList.forEach(disItem => { //鎶樻墸鏀跨瓥
+ var newTemp = {
+ ...{},
+ ...disItem
+ };
+ if (newTemp.Id == IdStr) {
+ newTemp.Counts = DefalutQuantity;
+ }
+ newDicountData.push(newTemp);
+ })
+ return newDicountData;
+}
+//鎶樻墸鏀跨瓥鍚堝悓浠锋牸姹囨�婚�昏緫
+export function HeTongPriceComputeLogic(jzdateList,jzDataProductList){
+ var HeTongPriceList = [];
+ jzdateList.forEach(jddp => {
+ var sum = 0;
+ var sumNor = 0;
+ var sumGua = 0;
+ var PromotionHeadRecordId = jddp.recordTypeName__c;
+ jzDataProductList.forEach(jdpd => {
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (jddp.Id == jdpd.PromotionId && //鏂规Id
+ jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ if(jdpd.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ sumGua = sumGua +jdpd.AgencySubtotal__c;
+ }else if(jdpd.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ sumNor = sumNor +jdpd.AgencySubtotal__c;
+ }
+ sum = sum + jdpd.AgencySubtotal__c;
+ }
+ } else {
+ if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.Category__c == jdpd.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ sum = sum + jdpd.AgencySubtotal__c;
+ }
+ }
+ });
+ sum = Math.round(sum * 100) / 100;
+ sumGua = Math.round(sumGua * 100) / 100;
+ sumNor = Math.round(sumNor * 100) / 100;
+ jddp.HeTongPrice = sum;
+ if(PromotionHeadRecordId == "Authorizer"){
+ jddp.GuaranteeDiscount_H_Money__c = sumGua;
+ jddp.NormalDiscount_H_Money__c = sumNor;
+ }else{
+ jddp.NormalDiscount_H_Money__c = sum;
+ }
+ HeTongPriceList.push(jddp);
+ });
+ return HeTongPriceList;
+}
+//浠锋牸绛栧悎骞舵槑缁嗛�昏緫
+export function PriceConsolidation(arrSchemes,jzdataList){
+ arrSchemes.forEach(arrsch=>{
+ var Setmap=new Map();
+ var arrList=[];
+ jzdataList.forEach(jdpd=>{
+ if(arrsch.Id==jdpd.PromotionId){
+ var object={};
+ if(Setmap.has(jdpd.Id)){
+ object={...{},...Setmap.get(jdpd.Id)};
+ object.Quantity=object.Quantity+jdpd.Quantity;
+ Setmap.set(jdpd.Id,object);
+ }else{
+ Setmap.set(jdpd.Id,jdpd);
+ }
+ }else{
+ arrList.push(jdpd);
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arrList.push(v);
+ }
+ // jzdataList=[...[],...arrList];//20230214
+ jzdataList = [].concat(arrList);//20230214
+ });
+ return jzdataList;
+}
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规閫昏緫
+export function ConsolidatedDiscountPolicyLogic(SchemeSet,arr){
+ var Setmap=new Map();
+ var arr2=SchemeSet;
+ arr2.forEach(arrs=>{
+ var object={};
+ var PromotionHeadRecordId = arrs.recordTypeName__c;
+ if(PromotionHeadRecordId == "Authorizer"){
+ var key=arrs.Id+"_"+arrs.NormalDiscount__c_Input+"_"+arrs.GuaranteeDiscount__c_Input;//鏂规Id/闈炲璞″搧鎶樻墸褰曞叆/瀵硅薄鍝佹姌鎵e綍鍏�
+ if(Setmap.has(key)){
+ object={...{},...Setmap.get(key)};
+ object.determine='';
+ arrs.HeTongPrice=Number(arrs.HeTongPrice);
+ object.HeTongPrice=Number(object.HeTongPrice);
+ object.HeTongPrice +=arrs.HeTongPrice;
+ arrs.GuaranteeDiscount_H_Money__c=Number(arrs.GuaranteeDiscount_H_Money__c);
+ object.GuaranteeDiscount_H_Money__c=Number(object.GuaranteeDiscount_H_Money__c);
+ object.GuaranteeDiscount_H_Money__c +=arrs.GuaranteeDiscount_H_Money__c;
+ arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c;
+ Setmap.set(key,object);
+ }else{
+ Setmap.set(key,arrs);
+ }
+ }else{
+ var key=arrs.NormalDiscount__c_Input+"_"+arrs.Category__c;//闈炲璞″搧鎶樻墸褰曞叆銆佹姌鎵f斂绛栧垎绫�
+ if(Setmap.has(key)){
+ object={...{},...Setmap.get(key)};
+ object.determine='';
+ arrs.HeTongPrice=Number(arrs.NormalDiscount_H_Money__c);
+ object.HeTongPrice=Number(object.HeTongPrice);
+ object.HeTongPrice +=arrs.HeTongPrice;
+ arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c;
+
+ Setmap.set(key,object);
+ }else{
+ Setmap.set(key,arrs);
+ }
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arr.push(v);
+ }
+ return arr;
+}
+//鍚堝苟鎶樻墸鏀跨瓥浜у搧鏄庣粏閫昏緫
+export function ConsolidatedDiscountDetailsLogic(arrSchemes,jzdataList){
+ arrSchemes.forEach(arrsch=>{
+ var Setmap=new Map();
+ var arrList=[];
+ jzdataList.forEach(jdpd=>{
+ var PromotionHeadRecordId = arrsch.recordTypeName__c;
+ if(PromotionHeadRecordId == "Authorizer"){
+ if(arrsch.Id==jdpd.PromotionId&&//鏂规Id
+ arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//闈炲璞″搧鎶樻墸褰曞叆
+ arrsch.GuaranteeDiscount__c_Input==jdpd.GuaranteeDiscount__c_Input){//瀵硅薄鍝佹姌鎵e綍鍏�
+ var object={};
+ if(Setmap.has(jdpd.Id)){
+ object={...{},...Setmap.get(jdpd.Id)};
+ object.Quantity=object.Quantity+jdpd.Quantity;
+ Setmap.set(jdpd.Id,object);
+ }else{
+ Setmap.set(jdpd.Id,jdpd);
+ }
+ }else{
+ arrList.push(jdpd);
+ }
+ }else{
+ if(arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//闈炲璞″搧鎶樻墸褰曞叆
+ arrsch.Category__c==jdpd.Category__c){//鎶樻墸鏀跨瓥鍒嗙被
+ var object={};
+ if(Setmap.has(jdpd.Id)){
+ object={...{},...Setmap.get(jdpd.Id)};
+ object.Quantity=object.Quantity+jdpd.Quantity;
+ Setmap.set(jdpd.Id,object);
+ }else{
+ Setmap.set(jdpd.Id,jdpd);
+ }
+ }else{
+ arrList.push(jdpd);
+ }
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arrList.push(v);
+ }
+ // jzdataList=[...[],...arrList];//20230214
+ jzdataList = [].concat(arrList);//20230214
+ });
+ return jzdataList;
+}
+//鍚堝苟涓婁竴娆$殑鎶ヤ环琛岀殑閫昏緫
+export function addOfferLogic(TrialLine){
+ var Offermap=new Map();
+ var arr=[];
+ var arr2=TrialLine;
+ arr2.forEach(arrs=>{
+ var object={};
+ if(Offermap.has(arrs.Id)){
+ object={...{},...Offermap.get(arrs.Id)};
+ object.Quantity=object.Quantity+arrs.Quantity;
+ Offermap.set(arrs.Id,object);
+ }else{
+ Offermap.set(arrs.Id,arrs);
+ }
+ });
+ for (let [k, v] of Offermap) {
+ arr.push(v);
+ }
+ return arr;
+}
+// ==============鐢熸垚UUID
+export function GetUUID() {
+ var s = [];
+ var hexDigits = "0123456789abcdef";
+ for (var i = 0; i < 36; i++) {
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
+ }
+ s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
+ s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
+ s[8] = s[13] = s[18] = s[23] = "-";
+ var uuid = s.join("");
+ return uuid;
+}
+//涓�鑸骇鍝侀儴鍒嗛�昏緫
+export function partGeneralDiscountLogical(itemsss,item){
+ itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity;
+ itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100;
+ itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100;
+ itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity;
+ itemsss.UseCount__c = item.Counts;
+ itemsss.ifNecessary__c = item.ifNecessary__c;
+ itemsss.recordTypeName__c = item.recordTypeName__c;
+ return itemsss;
+}
+//淇冮攢鏂规閮ㄥ垎閫昏緫
+export function partPromotionSchemeLogical(itemsss,item,multiYearWarranty__c){
+ debugger
+ if(multiYearWarranty__c){
+ itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice);
+ }else{
+ itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c;
+ }
+ itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity;
+ itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100;
+ itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100;
+ itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity;
+ itemsss.UseCount__c = item.Counts;
+ itemsss.if_Fix__c = item.if_Fix__c;
+ itemsss.if_Contain_Nod__c = item.if_Contain_Nod__c;
+ itemsss.recordTypeName__c = item.recordTypeName__c;
+ return itemsss;
+}
+//涓�鑸姌鎵h绠楅�昏緫
+export function commonlyDiscountLogic(itemss,item){
+ var Discount__c_Input = parseFloat(item.NormalDiscount__c_Input)*0.01;
+ debugger
+ itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input) + itemss.ServicePrice__c;
+ itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity;
+ itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100;
+ itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100;
+ itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity;
+ itemss.Discount__c_Input = item.NormalDiscount__c_Input;
+ itemss.Category__c=item.Category__c;
+ return itemss
+}
+//鐗圭害鎶樻墸璁$畻閫昏緫
+export function contributingDiscountLogic(itemss,Discount__c_Input,item){
+ if (itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨") {
+ itemss.AgencyUnitPrice__c = (itemss.ListPrice + itemss.ServicePrice__c) * (Discount__c_Input*0.01);
+ } else {
+ itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input*0.01) + itemss.ServicePrice__c;
+ }
+ itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity;
+ itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100;
+ itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100;
+ itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity;
+ debugger
+ itemss.Discount__c_Input = Discount__c_Input+"%";
+ // itemss.Discount__c_Input = Discount__c_Input;
+ itemss.GuaranteeDiscount__c_Input=item.GuaranteeDiscount__c_Input;
+ itemss.NormalDiscount__c_Input=item.NormalDiscount__c_Input;
+ itemss.recordTypeName__c = item.recordTypeName__c;
+ return itemss
+}
+//璁$畻浠锋牸鏀跨瓥鐨勬渶澶ф鏁伴�昏緫
+export function ComputationalLogic(Pricepolicy,b,selectproducts){
+ var num=0;
+ var flag=true;
+ for(var j=0;j<b.length;j++){
+ if(b[j].Id_H==Pricepolicy.PromotionNo__c){
+ var fg=true;
+ for(var i=0;i<selectproducts.length;i++){
+ if(b[j].Asset_Model_No__c==selectproducts[i].Product2.MDM_Model_No__c){
+ var frequency = parseInt(selectproducts[i].Quantity/b[j].Quantity__c__c);
+ if(frequency<1){
+ fg=true;
+ break;
+ }else{
+ if(flag){
+ num=frequency;
+ flag=false;
+ }else{
+ if(num>frequency){
+ num=frequency;
+ }
+ }
+ }
+ fg=false;
+ }
+ }
+ if(fg){
+ num=0;
+ break;
+ }
+ }
+ }
+ var Counts = Number(Pricepolicy.Counts);
+ return Counts+num;
+}
+//鏇挎崲listprice鍗曚环閫昏緫
+export function ReplacementUnitPriceLogic(arr,ifTrade){
+ arr.forEach(jdpct => { //浜у搧鏄庣粏
+ if (ifTrade == "鍐呰部") {
+ jdpct.ListPrice = jdpct.Product2.Intra_Trade_List_RMB__c;
+ if (jdpct.multiYearWarranty__c) {
+ jdpct.ServicePrice__c = jdpct.Product2.Intra_Trade_Service_RMB__c;
+ } else {
+ jdpct.ServicePrice__c = 0;
+ }
+ } else if (ifTrade == "澶栬部") {
+ jdpct.ListPrice = jdpct.Product2.Foreign_Trade_List_US__c;
+ if (jdpct.multiYearWarranty__c) {
+ jdpct.ServicePrice__c = jdpct.Product2.NoDiscount_Foreign__c;
+ } else {
+ jdpct.ServicePrice__c = 0;
+ }
+ }
+ });
+ return arr
+}
+//鍚堝苟鏂规
+export function ConsolidationScheme(data,ParamIdStr,Trade__c){
+ var NewData = [];
+ data.forEach(itms => { //浠锋牸鏀跨瓥鍜屾姌鍜屾姌鎵f斂绛�
+ let Temp = {};
+ Temp.itemCounts = itms.Counts + "";
+ Temp.Id = itms.Id;
+ Temp.JxsType = itms.JxsType;
+ //淇冮攢鏂规
+ if (itms.JxsType != "涓�鑸姌鎵�") {
+ var PromotionHeadRecordId = itms.recordTypeName__c;
+ //tt
+ if (itms.JxsType == "鐗圭害鎶樻墸") {
+ Temp.GuaranteeDiscountcInput = parseFloat(itms.GuaranteeDiscount__c_Input);
+ Temp.GuaranteeDiscountc = parseFloat(itms.GuaranteeDiscount__c);
+ Temp.NormalDiscountc = parseFloat(itms.NormalDiscount__c);
+ Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input);
+ }
+ }else{
+ //tt
+ Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input);
+ }
+ if (PromotionHeadRecordId == 'Promotion') {
+ Temp.Categoryc = '淇冮攢鏂规';
+ }
+ //涓�鑸骇鍝�
+ else if (PromotionHeadRecordId == 'NormalProduct') {
+ Temp.Categoryc = '涓�鑸骇鍝�';
+ }
+ //鐗圭害鍥哄畾
+ else if (PromotionHeadRecordId == 'Authorizer') {
+ Temp.Categoryc = '缁忛攢鍟嗗浐瀹氭姌鎵�';
+ } else {
+ Temp.Categoryc = itms.Category__c;
+ }
+ Temp.PromotionNocEqual = itms.PromotionNo__cEqual;
+ Temp.typess = itms.typess;
+ Temp.PromotionNoc = itms.PromotionNo__c;
+ Temp.Name = itms.Name;
+ Temp.ParamIdStr = ParamIdStr;
+ Temp.Descriptionc = itms.Description__c;
+ Temp.ifContainNodc = itms.if_Contain_Nod__c;
+ Temp.ifFixc = itms.if_Fix__c;
+ Temp.PriceCNYc = itms.Price_CNY__c;
+ Temp.Total = itms.Total;
+
+ Temp.ListPriceTotalc = itms.sumListPrice;
+ Temp.sumNod = itms.sumNoDiscount;
+ // Temp.sumNodUSD=itms.sumNodUSD;
+ Temp.HeTongTotal = itms.HeTongTotal;
+ Temp.ifNecessaryc = itms.ifNecessary__c;
+ Temp.Trade = Trade__c;
+ Temp.maxCounts = itms.maxCounts;
+ Temp.CompareId = itms.CompareId;
+ Temp.sumNoDiscountTotal = itms.sumNoDiscountTotal;
+ Temp.GuaranteeDiscountHMoneyc = itms.GuaranteeDiscount_H_Money__c;
+ Temp.NormalDiscountHMoneyc = itms.NormalDiscount_H_Money__c;
+ //...c/compent
+ NewData.push(Temp);
+ });
+ return NewData;
+}
+//寰呴�変骇鍝佹暟鎹彉鍖栧瓧娈佃祴鍊�
+export function ProductAssignmentSelect(item){
+ item.Quantity = item.Quantity__c;
+ item.Name = item.Name__c;
+ item.Name__c = item.Name_c__c;
+ item.ListPrice = item.ListPrice__c;
+ item.Id = item.QuoteTrialKey__c;
+ item.PromotionId = item.Promotion_id__c;
+ item.TypeName = item.TypeName__c;
+ item.RecordTypeId = item.RecordTypeId__c;
+ item.ParamIdStr = item.QuantityId__c;
+ item.Product2Id = item.Product2__c;
+ item.QuiteLineitem__c = item.QuiteLineitem__c;
+ return item;
+}
+//宸查�変骇鍝佹暟鎹彉鍖栧瓧娈佃祴鍊�
+export function ProductSelected(item){
+ item.Quantity = item.Quantity__c;
+ item.Name = item.Name__c;
+ item.Name__c = item.Name_c__c;
+ item.ListPrice = item.ListPrice__c;
+ item.Id = item.QuoteTrialKey__c;
+ item.Product2Id = item.Product2__c;
+ item.Product2 = item.Product2__r;
+ if (item.Name == "涓�鑸姌鎵�") {
+ item.PromotionId = item.PromotionSales__c;
+ // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c;
+ // item.Discount__c_Input = item.DiscountRate__c;
+ item.Discount__c_Input = item.DiscountRate__c+'%';
+ // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c
+ item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%';
+ } else {
+ item.PromotionId = item.Promotion_id__c;
+ if(item.TypeName__c != "浠锋牸鏀跨瓥"){
+ // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c;
+ item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c+'%';
+ // item.Discount__c_Input = item.DiscountRate__c;
+ item.Discount__c_Input = item.DiscountRate__c+'%';
+ // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c;
+ item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%';
+ // item.GuaranteeDiscount__c_Input=Number(item.GuaranteeDiscount__c_Input.toFixed(2));
+ }
+ }
+ item.warrantyType__c=item.GuranteeType__c;
+ item.TypeName = item.TypeName__c;
+ item.RecordTypeId = item.RecordTypeId__c;
+ item.ParamIdStr = item.QuantityId__c;
+ item.QuiteLineitem__c = item.QuiteLineitem__c;
+ item.CompareId = item.CompareId__c;
+ // item.Discount__c_Input=Number(item.Discount__c_Input.toFixed(2));
+ // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c;
+ // item.NormalDiscount__c_Input=Number(item.NormalDiscount__c_Input.toFixed(2));
+ return item;
+}
+//鎶樻墸鏂规鏁版嵁鍙樺寲瀛楁璧嬪��
+export function UnselectedScheme(items){
+ items.JxsType = items.JxsType__c;
+ // items.NormalDiscount__c_Input = items.NormalDiscount_c_Input__c;
+ items.NormalDiscount__c_Input=items.NormalDiscount_c_Input__c+'%';
+ // items.NormalDiscount__c_Input=Number(items.NormalDiscount__c_Input.toFixed(2));
+ items.TypeName = items.TypeName__c;
+ if (items.JxsType__c != "涓�鑸姌鎵�") {
+ items.Id = items.PromotionHead__c;
+ // items.NormalDiscount__c = items.NormalDiscountc__c;
+ items.NormalDiscount__c=items.NormalDiscountc__c+'%';
+ // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c;
+ items.GuaranteeDiscount__c=items.GuaranteeDiscount__c+'%';
+ // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c;
+ items.GuaranteeDiscount__c_Input=items.GuaranteeDiscount_c_Input__c+'%';
+ // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2));
+
+ }
+ // else{
+ // items.NormalDiscount__c = items.NormalDiscountc__c;
+ // items.NormalDiscount__c=items.NormalDiscountc__c+'%';
+ // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c;
+ // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c;
+ // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2));
+ // }
+ items.ParamIdStr = items.Quote__c;
+ items.sumNoDiscountTotal = items.sumNoDiscountTotal__c;
+ items.maxCounts = items.maxCounts__c;
+ items.CompareId = items.CompareId__c;
+ return items;
+}
+//寰幆鍒ゆ柇绌�
+export function IfCopyProperties(x){
+ debugger
+ if(x.Asset_Model_No__c==undefined){
+ x.Asset_Model_No__c='';
+ }
+ if(x.Name_c__c==undefined){
+ x.Name_c__c='';
+ }
+ if(x.Quantity__c==undefined){
+ x.Quantity__c='';
+ }
+ if(x.GuranteeType__c==undefined){
+ x.GuranteeType__c='';
+ }
+ if(x.PromotionNo__c==undefined){
+ x.PromotionNo__c='';
+ }
+ if(x.Name__c==undefined){
+ x.Name__c='';
+ }
+ if(x.ListPrice__c==undefined){
+ x.ListPrice__c='';
+ }
+ if(x.NoDiscountTotal__c==undefined){
+ x.NoDiscountTotal__c='';
+ }
+ if(x.DiscountRate__c==undefined){
+ x.DiscountRate__c='';
+ }
+ if(x.AgencyUnitPrice__c==undefined){
+ x.AgencyUnitPrice__c='';
+ }
+ if(x.AgencySubtotal__c==undefined){
+ x.AgencySubtotal__c='';
+ }
+ return x;
+}
+//浠锋牸鏂规鏁版嵁鍙樺寲瀛楁璧嬪��
+export function SelectedScheme(items){
+ items.Counts = items.itemCounts__c;
+ items.Total = items.Price_total__c;
+ items.HeTongTotal = items.contractPrice__c;
+ items.TypeName = items.TypeName__c;
+ items.Id = items.PromotionHead__c;
+ items.ParamIdStr = items.Quote__c;
+ if (items.trade__c == "鍐呰部") {
+ items.sumListPrice = items.ListPriceTotal__c;
+ items.sumNoDiscount = items.NodiscountTotal__c;
+ } else if (items.trade__c == "澶栬部") {
+ items.sumListPrice = items.ListPriceTotalUSD__c;
+ items.sumNoDiscount = items.NodiscountTotalUSD__c;
+ }
+ items.sumNoDiscountTotal = items.sumNoDiscountTotal__c;
+ items.maxCounts = items.maxCounts__c;
+ return items;
+}
+
+//鍚堝苟浜у搧
+export function MergeProducts(arr3,arr4,data,ParamIdStr){
+ var NewData1 = [];
+ var newTemp3 = [];
+ arr3.forEach(itmsss => { //浜у搧鏄庣粏
+ var itemTemp = {
+ ...{},
+ ...itmsss
+ };
+ // itemTemp.鍒嗙被鍚嶇О锛堟牴鎹� 浜у搧鐘舵�� 1锛� 0鏈尮閰� 2锛�1浠ュ尮閰嶏級
+ itemTemp.ismatch = '1';
+ newTemp3.push(itemTemp);
+ });
+ var newTemp4 = [];
+ arr4.forEach(itmsss => { //寰呴�変骇鍝�
+ var itemTemp = {
+ ...{},
+ ...itmsss
+ };
+ // itemTemp.鍒嗙被鍚嶇О锛堟牴鎹� 浜у搧鐘舵�� 1锛� 0鏈尮閰� 2锛�1浠ュ尮閰嶏級
+ itemTemp.ismatch = '0';
+ newTemp4.push(itemTemp);
+ });
+ // var data2 = [...newTemp3, ...newTemp4];//20230213
+ var data2 = newTemp3.concat(newTemp4);//20230213
+ data2.forEach(itmss => { //浜у搧鏄庣粏鍜屽緟閫変骇鍝�
+ let Temp1 = {};
+ Temp1.Id = itmss.Id;
+ Temp1.AssetModelNoc = itmss.Asset_Model_No__c;
+ Temp1.Namec = itmss.Name__c;
+ Temp1.Quantity = itmss.Quantity;
+ Temp1.GuranteeTypec = itmss.warrantyType__c;
+ Temp1.PromotionNoc = itmss.PromotionNo__c;
+ Temp1.Name = itmss.Name;
+ Temp1.ListPrice = itmss.ListPrice;
+ Temp1.AgencyUnitPricec = itmss.AgencyUnitPrice__c;
+ Temp1.AgencySubtotalc = itmss.AgencySubtotal__c;
+ Temp1.NoDiscountTotalc = itmss.NoDiscountTotal__c;
+ Temp1.ParamIdStr =ParamIdStr;
+ Temp1.TypeName = itmss.TypeName;
+ Temp1.UseCountc = itmss.UseCount__c;
+ if (itmss.TypeName == "浠锋牸鏀跨瓥") {
+ data.forEach(itemsss => {
+ if (itemsss.PromotionNo__c == itemsss.PromotionNo__c) {
+ Temp1.fanan_id = itemsss.Id;
+ }
+ });
+ } else if (itmss.TypeName == "鎶樻墸鏀跨瓥") {
+ data.forEach(itemss => {
+ if (itemss.PromotionNo__c == itemss.PromotionNo__c) {
+ Temp1.fanan_id = itemss.Id;
+ }
+ });
+
+ Temp1.DiscountcInput = parseFloat(itmss.Discount__c_Input);
+ if(itmss.Name=="涓�鑸姌鎵�"){
+ Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input);
+ }else{
+ Temp1.GuaranteeDiscountcInput = parseFloat(itmss.GuaranteeDiscount__c_Input);
+ Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input);
+ }
+ }
+ Temp1.ismatch = itmss.ismatch;
+ Temp1.PromotionId = itmss.PromotionId;
+ Temp1.Product2c = itmss.Product2Id;
+ Temp1.ServicePricec = itmss.ServicePrice__c;
+ Temp1.ifFixc = itmss.if_Fix__c;
+ Temp1.ifNecessaryc = itmss.ifNecessary__c;
+ Temp1.CompareId = itmss.CompareId;
+ Temp1.multiYearWarrantyc = itmss.multiYearWarranty__c;
+ Temp1.Categoryc = itmss.Category__c;
+
+ NewData1.push(Temp1);
+ });
+ return NewData1;
+}
+// //鏂规闇�瑕佹洿鏂扮殑瀛楁
+export function ChangeFiexedData(key) {
+ var keyArr = ['Status__c', 'ifNecessary__c', 'OrderNo__c', 'Price_CNY__c', 'Price_USD__c'];
+ var flag = false;
+ keyArr.forEach(item => {
+ if (item == key) {
+ flag = true;
+ }
+ })
+ return flag;
+}
+export function getQueryVariable(variable,location) { //id瀛楃涓�
+ debugger
+ var query = window.location.search.substring(1);
+ if(!query){
+ query = location;
+ }
+ var vars = query.split("&");
+ for (var i = 0; i < vars.length; i++) {
+ var pair = vars[i].split("=");
+ if (pair[0] == variable) {
+ return pair[1];
+ }
+ }
+ return '';
+}
+//璺宠浆璺緞
+export function PathJump(DeveloperName,ParamIdStr){
+ if(DeveloperName=='Opportunity'){
+ // 娴嬭瘯闈炲畬鏁磋矾寰勬槸涓嶆槸鍙互姝g‘璺宠浆
+ window.open('/apex/NewQuoteEntry?id=' + ParamIdStr, '_self');
+ }else if(DeveloperName=='SI_Oppor'){
+ // 娴嬭瘯闈炲畬鏁磋矾寰勬槸涓嶆槸鍙互姝g‘璺宠浆
+ window.open('/apex/SI_NewQuoteEntry?id=' + ParamIdStr, '_self');
+ }
+}
+//璁$畻杩囧悗涓�鑸姌鎵g殑鍚堝悓浠锋牸
+export function ContractPriceComputeReverse(DataDiscount){
+ var sum=0;
+ DataDiscount.forEach(jjc => {
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum = sum + jjc.AgencySubtotal__c;
+ });
+ sum=sum.toFixed(2);
+ return sum;
+}
+//澶嶅埗閫昏緫
+export function copyLogic(Check_Your_Clipboard,records,x,targetString,reslut){
+ records=reslut;
+ for (var i = 0; i < records.length; i++) {
+ x = records[i];
+ //鍒ゆ柇绌�
+ x=IfCopyProperties(x);
+ targetString += '\r\n' + x. Asset_Model_No__c + '\t' + x.Name_c__c + '\t' + x.Quantity__c + '\t' + x.GuranteeType__c + '\t' + x.PromotionNo__c +'\t' + x.Name__c + '\t' + x.ListPrice__c + '\t' + x.NoDiscountTotal__c + '\t' + x.DiscountRate__c +
+ '\t' + x.AgencyUnitPrice__c + '\t' + x.AgencySubtotal__c ;
+ console.warn(x.PromotionNo__c);
+ }
+ try {
+ console.warn(targetString);
+ var tag = document.createElement('textarea');
+ tag.setAttribute('id', 'cp_hgz_textarea');
+ var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length;
+ tag.maxLength=strlenght+666;
+ tag.value = targetString;
+ document.getElementsByTagName('body')[0].appendChild(tag);
+ document.getElementById('cp_hgz_textarea').select();
+ document.execCommand('copy');
+ document.getElementById('cp_hgz_textarea').remove();
+ alert(Check_Your_Clipboard);
+ } catch (error) {
+ alert(error);
+ }
+}
+//涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻閫昏緫
+export function updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,arrProductTemp){
+ var newArrsTempplus1=[];
+ var newArrsTempplus2=[];
+ var jzDataProductlast=[];
+ jzDataDiscount.forEach(item=>{
+ if(JxsType=="鐗圭害鎶樻墸"){
+ if(item.JxsType=="鐗圭害鎶樻墸"){
+ if (Id == item.Id) {
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ arrProductTemp.forEach(itemss => { //itemss浜у搧鏄庣粏
+ var Discount__c_Input = 0;
+ if (itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨") {
+ Discount__c_Input = item.GuaranteeDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ } else {
+ Discount__c_Input = item.NormalDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ }
+ debugger
+ if (itemss.PromotionId == item.Id && //鏂规Id
+ itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //瀵硅薄鍝佹姌鎵e綍鍏�
+ itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //闈炲璞″搧鎶樻墸褰曞叆
+ itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //鐗圭害鎶樻墸璁$畻閫昏緫
+ newArrsTempplus1.push(itemss);
+ } else if (itemss.PromotionId != item.Id ||
+ itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input ||
+ itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) {
+ newArrsTempplus2.push(itemss);
+ }
+ });
+ var newArrsplusG=[];
+ var newArrsplusN=[];
+ newArrsTempplus1.forEach(ntp=>{
+ if(ntp.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ newArrsplusG.push(ntp);
+ }else if(ntp.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ newArrsplusN.push(ntp);
+ }
+ });
+ if(newArrsplusG.length!=0){
+ var yibanSumG = SpecialPriceComputeReverse(newArrsTempplus1,true);
+ var chazhiG=(Number(item.GuaranteeDiscount_H_Money__c)*100-Number(yibanSumG)*100)/100;
+ var dangechazhiG=Math.round((chazhiG/newArrsplusG[0].Quantity) * 100) / 100;
+ newArrsplusG[0].AgencySubtotal__c =newArrsplusG[0].AgencySubtotal__c+chazhiG;
+ newArrsplusG[0].AgencyUnitPrice__c =newArrsplusG[0].AgencyUnitPrice__c+dangechazhiG;
+ }
+ if(newArrsplusN.length!=0){
+ var yibanSumN = SpecialPriceComputeReverse(newArrsTempplus1,false);
+ var chazhiN=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSumN)*100)/100;
+ var dangechazhiN=Math.round((chazhiN/newArrsplusN[0].Quantity) * 100) / 100;
+ newArrsplusN[0].AgencySubtotal__c =newArrsplusN[0].AgencySubtotal__c+chazhiN;
+ newArrsplusN[0].AgencyUnitPrice__c =newArrsplusN[0].AgencyUnitPrice__c+dangechazhiN;
+ }
+ // newArrsTempplus1=[...newArrsplusG,...newArrsplusN];//20230213
+ newArrsTempplus1=newArrsplusG.concat(newArrsplusN);//20230213
+ // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213
+ jzDataProductlast = newArrsTempplus1.concat(newArrsTempplus2);//20230213
+ }
+ }
+ }
+ }else if(JxsType=="涓�鑸姌鎵�"){
+ if(item.JxsType=="涓�鑸姌鎵�"){
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input &&
+ Category__c == item.Category__c){
+ arrProductTemp.forEach(itemss => { //itemss浜у搧鏄庣粏
+ if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ itemss.Category__c == Category__c) {
+ itemss = commonlyDiscountLogic(itemss, item); //涓�鑸姌鎵h绠楅�昏緫
+ newArrsTempplus1.push(itemss);
+ } else if (itemss.Category__c != Category__c ||
+ itemss.NormalDiscount__c_Input != NormalDiscount__c_Input) {
+ newArrsTempplus2.push(itemss);
+ }
+ });
+ var yibanSum = ContractPriceComputeReverse(newArrsTempplus1);//璁$畻杩囧悗涓�鑸姌鎵g殑鍚堝悓浠锋牸
+ var chazhi=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSum)*100)/100;
+ var dangechazhi=Math.round((chazhi/newArrsTempplus1[0].Quantity) * 100) / 100;
+ newArrsTempplus1[0].AgencySubtotal__c =newArrsTempplus1[0].AgencySubtotal__c+chazhi;
+ newArrsTempplus1[0].AgencyUnitPrice__c =newArrsTempplus1[0].AgencyUnitPrice__c+dangechazhi;
+ // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213
+ jzDataProductlast =newArrsTempplus1.concat(newArrsTempplus2);//20230213
+ console.warn('newArrsTempplus2'+newArrsTempplus2);
+ console.warn('jzDataProductlast'+jzDataProductlast);
+ }
+ }
+ }
+ });
+ return jzDataProductlast;
+}
+
+export function countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList){
+ var ListPrices = 0;
+ var Nodiscounts = 0;
+ result.forEach(itemss => { //鏂规涓绘暟鎹叧鑱旂殑浜у搧
+ copydate.forEach(jddc => { //鎶ヤ环琛岄」鐩富鏁版嵁
+ if (itemss.Asset_Model_No__c == jddc.Product2.MDM_Model_No__c) {
+ if (ifTrade == "鍐呰部") {
+ ListPrices += itemss.Quantity__c * jddc.Product2.Intra_Trade_List_RMB__c;
+ Nodiscounts += itemss.Quantity__c * jddc.Product2.Intra_Trade_Service_RMB__c;
+ } else if (ifTrade == "澶栬部") {
+ ListPrices += itemss.Quantity__c * jddc.Product2.Foreign_Trade_List_US__c;
+ Nodiscounts += itemss.Quantity__c * jddc.Product2.NoDiscount_Foreign__c;
+ }
+ var fl = true;
+ if (DeftCopyQtyList.length == 0) {
+ DeftCopyQtyList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ } else {
+ DeftCopyQtyList.forEach(jdcql => { //淇濆瓨鏂规鍏宠仈浜у搧鏁伴噺
+ if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) {
+ fl = false;
+ }
+ });
+ if (fl) {
+ DeftCopyQtyList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ }
+ }
+ }
+ });
+ });
+ item.sumListPrice = ListPrices;
+ item.sumNoDiscount = Nodiscounts;
+ DeftCopyQtyLists=DeftCopyQtyList;
+ return item;
+}
+//姣斿鎶ヤ环琛岄」鐩敼鍙樺悗璇曠畻鐣岄潰鐨勫彉鍖�
+//鈥樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐槸涓轰簡涓庣幇鍦ㄦ姤浠疯椤圭洰杩涜姣斿锛岀敤璇曠畻浜у搧琛ㄦ暟鎹悎骞跺嚭鐨勪笂涓�娆¤繘琛岃瘯绠楃殑鎶ヤ环琛岄」鐩�
+//璇曠畻涔嬪墠宸插皢鎶ヤ环琛岄」鐩浉鍚岀殑浜у搧杩涜浜嗗悎骞�
+//1.鈥樻姤浠疯椤圭洰鈥欐潯鏁板皯浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁版椂灏嗕箣鍓嶇殑璇曠畻娓呯┖锛屼娇鐢ㄦ柊鐨勬姤浠疯椤圭洰
+//2.褰撯�樻姤浠疯椤圭洰鈥欐潯鏁板ぇ浜庢垨绛変簬鈥樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁板皢涓ょ粍鏁版嵁杩涜姣斿
+// 2-1锛夊綋鈥樻姤浠疯椤圭洰鈥欐潯鏁扮瓑浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁版椂鍏堝姣斾袱缁勬暟鎹紙鏍规嵁浜у搧Id杩涜鍖归厤锛�
+// 锛�2-1-1锛夊綋鏁版嵁鍖归厤鎴愬姛鍚庡垽鏂叾鏁伴噺瀛楁锛屽綋鈥樻姤浠疯椤圭洰鈥欐暟閲忓皬浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐暟閲忔椂灏嗕箣鍓嶇殑璇曠畻娓呯┖锛屼娇鐢ㄦ柊鐨勬姤浠疯椤圭洰
+// 锛�2-1-2锛夌瓑浜庡垯鍒犻櫎鈥樿瘯绠楀悎鎴愬緟閫夋暟鎹�欎腑鍖归厤鎴愬姛鐨勬暟鎹�
+// 锛�2-1-3锛夊ぇ浜庡垯鐢ㄢ�樻姤浠疯椤圭洰鈥欐暟閲忓噺鍘烩�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐暟閲忓苟灏嗚繖鏉℃暟鎹瓨鍏ュ緟閫夋姤浠疯椤圭洰闆嗗悎
+// 2-2锛夊綋姣斿缁撴潫鍚庡鏋溾�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欎腑鏈夋暟鎹病鏈夎鍖归厤鍒欏皢涔嬪墠鐨勮瘯绠楁竻绌猴紝浣跨敤鏂扮殑鎶ヤ环琛岄」鐩�
+// 2-3锛夊綋鈥樻姤浠疯椤圭洰鈥欐潯鏁板ぇ浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁帮紝涓斺�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欓兘宸插尮閰嶅垯灏嗏�樻姤浠疯椤圭洰鈥欎腑鏈鍖归厤鐨勬暟鎹叏閮ㄥ瓨鍏ュ緟閫夋姤浠疯椤圭洰闆嗗悎
+export function comparisonUniqueKeyLogic(index,flagall,jzDataDefaultCopy,jzDataDefault,jzDataProduct,jzDataFixedPrice,jzDataDiscount,lastQuotationc){
+ debugger
+ if (index == 0) {
+ if (flagall) {
+ if (jzDataDefaultCopy.length < lastQuotationc.length) { //1銆佹潯鏁板皬浜�
+ jzDataDefault = [].concat(jzDataDefaultCopy);
+ jzDataProduct = [];
+ jzDataFixedPrice = [];
+ jzDataDiscount = [];
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ return;
+ } else { //2銆�
+ var lastQuotation = [].concat(lastQuotationc);
+ var DefaultCopy = [].concat(jzDataDefaultCopy);
+ var Default = [];
+ for (var j = 0; j < DefaultCopy.length; j++) {
+ var arrList = [];
+ var fag = true
+ if (lastQuotation.length != 0) {
+ for (var i = 0; i < lastQuotation.length; i++) {
+ if (DefaultCopy[j].Id == lastQuotation[i].Id) {
+ if (DefaultCopy[j].Quantity < lastQuotation[i].Quantity) { //2-1-1 鏁伴噺灏忎簬 clear
+ jzDataDefault = [].concat(jzDataDefaultCopy);
+ jzDataProduct = [];
+ jzDataFixedPrice = [];
+ jzDataDiscount = [];
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ return;
+ } else if (DefaultCopy[j].Quantity == lastQuotation[i].Quantity) { //2-1-2
+ fag = false;
+ } else { //2-1-3 鏁伴噺澶т簬 濉炲埌寰呴�変骇鍝�
+ DefaultCopy[j].Quantity = DefaultCopy[j].Quantity - lastQuotation[i].Quantity;
+ Default.push(DefaultCopy[j]);
+ fag = false;
+ }
+ } else {
+ arrList.push(lastQuotation[i]);
+ }
+ }
+ lastQuotation = arrList;
+ if (fag) {
+ Default.push(DefaultCopy[j]);
+ }
+
+ } else { //2-3 鏉℃暟澶т簬 灏嗘暟鎹鍒板緟閫変骇鍝�
+ Default.push(DefaultCopy[j]);
+ }
+ }
+ if (lastQuotation.length != 0) { //2-2 鍚堟垚鏁版嵁鏈夊墿浣�
+ jzDataDefault = [].concat(jzDataDefaultCopy);
+ jzDataProduct = [];
+ jzDataFixedPrice = [];
+ jzDataDiscount = [];
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ return;
+ }
+ jzDataDefault = [].concat(Default);
+ jzDataDefaultExp = jzDataDefault;
+ }
+ }
+ }
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+}
+export function SearchProductByIdLogic(result,jzDataFixedPrice,jzDataDefaultCopyQuantityList,item){
+ result.forEach(itemss => { //itemss鏂规鍏宠仈鐨勪骇鍝�
+ var fl = true;
+ if (jzDataDefaultCopyQuantityList.length == 0) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ } else {
+ jzDataDefaultCopyQuantityList.forEach(jdcql => { //淇濆瓨鏂规鍏宠仈浜у搧鐨勬暟閲�
+ if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) {
+ fl = false;
+ }
+ });
+ if (fl) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ }
+ }
+ });
+ var iflag = true;
+ var newarrjdf = [];
+ jzDataFixedPrice.forEach(jdf => { //jdf浠锋牸鏀跨瓥
+ if (jdf.Id == item.Id) {
+ iflag = false;
+ newarrjdf.push(jdf);
+ } else {
+ newarrjdf.push(jdf);
+ }
+ });
+ jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList;
+ return newarrjdf;
+}
+export function ComputeDataPromotionLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopy,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){
+ newArrsTemp3 = []; //闇�瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ newArrsTemp4 = []; //涓嶉渶瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ var newArrsTemp5 = [];
+ var newArrsTemp6 = [];
+ arrProductTemp.forEach(itemsss => { //itemsss浜у搧鏄庣粏
+
+ if (itemsss.PromotionId == item.Id) {
+ if (item.determine == '鏀硅繃') {
+ var flag = true;
+ var b = jzDataDefaultCopyQuantityList; //鑾峰彇鏂规涓殑浜у搧鏁伴噺
+ arrTemp2.forEach(datedefault => { //datedefault寰呴�変骇鍝�
+
+ var quantity = 0;
+ if (datedefault.Id == itemsss.Id) {
+ b.forEach(iem => { //iem鏂规涓殑浜у搧鏁伴噺
+ if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) {
+ quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity;
+ datedefault.Quantity = quantity;
+ itemsss.Quantity = iem.Quantity__c__c * item.Counts;
+ }
+ });
+ flag = false;
+ }
+ });
+ if (flag) {
+ jzDataDefaultCopy.forEach(add => { //add鎶ヤ环琛岄」鐩富鏁版嵁
+ var quantity = 0;
+ if (add.Id == itemsss.Id) {
+ b.forEach(iems => { //iems鏂规鍏宠仈浜у搧鏁伴噺
+ if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) {
+ quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts;
+ add.Quantity = quantity;
+ itemsss.Quantity = iems.Quantity__c__c * item.Counts;
+ arrTemp2.push(add);
+ }
+ });
+ flag = true;
+ }
+ });
+ }
+ }
+ itemsss = partPromotionSchemeLogical(itemsss, item,QuoteData[0].multiYearWarranty__c);
+ newArrsTemp3.push(itemsss);
+ } else if (itemsss.PromotionId != item.Id) {
+ newArrsTemp4.push(itemsss);
+ }
+ });
+ if (item.determine == '鏀硅繃') {
+ arrTemp2.forEach(itsss => { //itsss寰呴�変骇鍝�
+ if (itsss.Quantity != 0) {
+ newArrsTemp6.push(itsss);
+ }
+ });
+ newArrsTemp5 = [].concat(newArrsTemp6);
+ jzDataDefault = newArrsTemp5;
+ }
+ newArrsTemp3Exp = newArrsTemp3;
+ newArrsTemp4Exp = newArrsTemp4;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultCopyExp = jzDataDefaultCopy;
+ return arrProductTemp;
+}
+export function ComputeDataNormalProductLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopyc,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){
+ newArrsTemp3 = []; //闇�瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ newArrsTemp4 = []; //涓嶉渶瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ var newArrsTemp5 = [];
+ var newArrsTemp6 = [];
+ var jzDataDefaultCopy = jzDataDefaultCopyc;
+ arrProductTemp.forEach(itemsss => { //itemsss浜у搧鏄庣粏
+ var flag = true;
+ if (itemsss.PromotionId == item.Id) {
+ if (item.determine == '鏀硅繃') {
+ var b = jzDataDefaultCopyQuantityList; //鑾峰彇鏂规涓殑浜у搧鏁伴噺
+ jzDataDefaultCopy = jzDataDefaultCopyc;
+ arrTemp2.forEach(datedefault => { //datedefault寰呴�変骇鍝�
+ var quantity = 0;
+ if (datedefault.Id == itemsss.Id) {
+ b.forEach(iem => { //iem鏂规涓殑浜у搧鏁伴噺
+ if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) {
+ quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity;
+ datedefault.Quantity = quantity;
+ itemsss.Quantity = iem.Quantity__c__c * item.Counts;
+ }
+ });
+ flag = false;
+ }
+ });
+ if (flag) {
+ jzDataDefaultCopy.forEach(add => { //add鎶ヤ环琛岄」鐩富鏁版嵁
+ var quantity = 0;
+ if (add.Id == itemsss.Id) {
+ b.forEach(iems => { //iems鏂规鍏宠仈浜у搧鏁伴噺
+ if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) {
+ quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts;
+ add.Quantity = quantity;
+ itemsss.Quantity = iems.Quantity__c__c * item.Counts;
+ arrTemp2.push(add);
+ }
+ });
+ }
+ });
+ }
+ }
+ if(QuoteData[0].multiYearWarranty__c){
+ itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice);
+ }else{
+ itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c;
+ }
+ if (item.HeTongTotal == undefined || item.HeTongTotal == "") {
+ itemsss.AgencyUnitPrice__c = 0;
+ }
+ itemsss = partGeneralDiscountLogical(itemsss, item);
+ newArrsTemp3.push(itemsss);
+ } else if (itemsss.PromotionId != item.Id) {
+ newArrsTemp4.push(itemsss);
+ }
+ });
+ if (item.determine == '鏀硅繃') {
+ arrTemp2.forEach(itsss => { //寰呴�変骇鍝�
+ if (itsss.Quantity != 0) {
+ newArrsTemp6.push(itsss);
+ }
+ });
+ newArrsTemp5 = [].concat(newArrsTemp6);
+ jzDataDefault = newArrsTemp5;
+ }
+ newArrsTemp3Exp = newArrsTemp3;
+ newArrsTemp4Exp = newArrsTemp4;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultCopyExp = jzDataDefaultCopy;
+ return arrProductTemp;
+}
+export function ComputeDiscountAuthorizerLogic(newArrsTemp,newArrsTemp2,item,arrProductTemp){
+ newArrsTemp = [];
+ newArrsTemp2 = [];
+ arrProductTemp.forEach(itemss => { //itemss浜у搧鏄庣粏
+ var Discount__c_Input = 0;
+ if (itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨") {
+ Discount__c_Input = item.GuaranteeDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ } else {
+ Discount__c_Input = item.NormalDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ }
+ if (itemss.PromotionId == item.Id && //鏂规Id
+ itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //瀵硅薄鍝佹姌鎵e綍鍏�
+ itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //闈炲璞″搧鎶樻墸褰曞叆
+ itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //鐗圭害鎶樻墸璁$畻閫昏緫
+ newArrsTemp.push(itemss);
+ } else if (itemss.PromotionId != item.Id ||
+ itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input ||
+ itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) {
+ newArrsTemp2.push(itemss);
+ }
+ });
+ newArrsTempExp = newArrsTemp;
+ newArrsTemp2Exp = newArrsTemp2;
+ return arrProductTemp;
+}
+export function handleSaveDiscountLogic(jzDataDiscount,jzDataProduct,event){
+ var boolean = 0;
+ var boolean2 = false;
+ var boolean3 = false;
+ var data = event.detail.rows;
+ let newData = [];
+ let newData2 = [];
+ var newMap3 = new Map();
+ let newData3 = [];
+ var key=0;
+ let editnewDate = [];
+ var GuaranteeDiscount__cZuiXiao =0;
+ var NormalDiscount__cZuiXiao =0;
+ for (var i = 0; i < jzDataDiscount.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].DelectId.replace("row-", "");
+ if (jzDataDiscount[i].DelectId == id) {
+ editData = {
+ GuaranteeDiscount__c_Input: '',
+ NormalDiscount__c_Input: '',
+ HeTongPrice: '',
+ GuaranteeDiscount_H_Money__c: '',
+ NormalDiscount_H_Money__c: ''
+ };
+ //瀵硅薄鎶樻墸
+ editData.GuaranteeDiscount__c_Input = data[j].GuaranteeDiscount__c_Input;
+ //璧嬪�� 闈炲璞℃姌鎵�
+ editData.NormalDiscount__c_Input = data[j].NormalDiscount__c_Input;
+ //涓�鑸姌鎵e悎鍚屼环鏍�
+ editData.HeTongPrice = data[j].HeTongPrice;
+ //瀵硅薄鍝佸悎鍚岄噾棰�
+ editData.GuaranteeDiscount_H_Money__c = data[j].GuaranteeDiscount_H_Money__c;
+ //闈炲璞″搧鍚堝悓閲戦
+ editData.NormalDiscount_H_Money__c = data[j].NormalDiscount_H_Money__c;
+ // editData.id=id;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...jzDataDiscount[i],
+ ...{}
+ };
+ if (editData.GuaranteeDiscount__c_Input != undefined) {
+ if(newItem.JxsType == "鐗圭害鎶樻墸"){
+ var GuaranteeDiscount__c_Input = parseFloat(editData.GuaranteeDiscount__c_Input);
+ editData.GuaranteeDiscount__c_Input=GuaranteeDiscount__c_Input+'%';
+ var GuaranteeDiscount__c = parseFloat(newItem.GuaranteeDiscount__c);
+ if (GuaranteeDiscount__c_Input < GuaranteeDiscount__c) {
+ GuaranteeDiscount__cZuiXiao=GuaranteeDiscount__c;
+ boolean = 1;
+ break;
+ } else {
+ jzDataProduct.forEach(jdpt => {
+ if (newItem.Id == jdpt.PromotionId &&
+ newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input &&
+ newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) {
+ jdpt.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input;
+ }
+ });
+ newItem.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input;
+ newItem.iftrue = "鏀硅繃";
+ }
+ }else{
+ boolean = 3;
+ break;
+ }
+ }
+ if (editData.NormalDiscount__c_Input != undefined) {
+ if(editData.NormalDiscount__c_Input!=''&&editData.NormalDiscount__c_Input>=0){
+ var NormalDiscount__c_Input = parseFloat(editData.NormalDiscount__c_Input);
+ editData.NormalDiscount__c_Input = NormalDiscount__c_Input+'%';
+ var NormalDiscount__c = parseFloat(newItem.NormalDiscount__c);
+ if (NormalDiscount__c_Input < NormalDiscount__c) {
+ NormalDiscount__cZuiXiao=NormalDiscount__c;
+ boolean = 2;
+ break;
+ } else {
+ jzDataProduct.forEach(jdpt => {
+ if (newItem.Id == jdpt.PromotionId &&
+ newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input &&
+ newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) {
+ jdpt.NormalDiscount__c_Input = editData.NormalDiscount__c_Input;
+ }
+ });
+ newItem.NormalDiscount__c_Input = editData.NormalDiscount__c_Input;
+ newItem.iftrue = "鏀硅繃";
+ }
+ }else{
+ boolean = 5
+ break;
+ }
+ }
+ newItem.GuaranteeDiscount_H_Money_yuan=newItem.GuaranteeDiscount_H_Money__c;
+ if (editData.GuaranteeDiscount_H_Money__c != undefined) {
+ if(newItem.JxsType == "鐗圭害鎶樻墸"){
+ if(editData.GuaranteeDiscount_H_Money__c==""){
+ editData.GuaranteeDiscount_H_Money__c=0;
+ }
+ newItem.GuaranteeDiscount_H_Money__c = editData.GuaranteeDiscount_H_Money__c;
+ newMap3.set(key,newItem);
+ boolean = 4;
+ boolean2 = true ;
+ }else{
+ boolean = 3;
+ break;
+ }
+
+ }
+ newItem.NormalDiscount_H_Money_yuan=newItem.NormalDiscount_H_Money__c;
+ if (editData.NormalDiscount_H_Money__c != undefined) {
+ if(editData.NormalDiscount_H_Money__c==""){
+ editData.NormalDiscount_H_Money__c=0;
+ }
+ newItem.NormalDiscount_H_Money__c = editData.NormalDiscount_H_Money__c;
+ if(newItem.JxsType == "涓�鑸姌鎵�"){
+ newData2.push(newItem);
+ boolean = 4;
+ boolean3 = true;
+ }else{
+ newMap3.set(key,newItem);
+ boolean = 4;
+ boolean2 = true;
+ }
+ }
+ if (editData.NormalDiscount_H_Money__c != undefined||editData.GuaranteeDiscount_H_Money__c != undefined) {
+ if(newItem.JxsType == "涓�鑸姌鎵�"){
+ newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c)
+ }else{
+ newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c)+parseFloat(newItem.GuaranteeDiscount_H_Money__c);
+ }
+ }
+ key++;
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...jzDataDiscount[i]
+ });
+ }
+ }
+ for (let [k, v] of newMap3) {
+ newData3.push(v);
+ }
+ booleanExp = boolean;
+ boolean2Exp = boolean2;
+ boolean3Exp = boolean3;
+ newDataExp = newData;
+ newData2Exp = newData2;
+ newData3Exp = newData3;
+ editnewDateExp = editnewDate;
+ GuaranteeDiscount__cZuiXiaoExp = GuaranteeDiscount__cZuiXiao;
+ NormalDiscount__cZuiXiaoExp = NormalDiscount__cZuiXiao;
+ jzDataProductExp = jzDataProduct;
+ return jzDataDiscount;
+}
+export function AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,CompareFullData){
+ var FilterList = CompareFullData.filter(item => {
+ if (item.ListName == ListName && item.Id == Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (FilterList == undefined || FilterList.length <= 0) {
+ var newTemp = {
+ ListName: ListName,
+ Asset_Model_No__c: Asset_Model_No__c,
+ Id: Id,
+ num: addNums
+ }
+ CompareFullData.push(newTemp);
+ } else {
+ FilterList[0].Asset_Model_No__c += Asset_Model_No__c + "||";
+ FilterList[0].num = addNums;
+ }
+ return CompareFullData;
+}
+export function MergeDuplicateSchemesLogic(CompareFullData,SchemeSet){
+ var a = CompareFullData;
+ var CompareFullDataedit = [];
+ var Setmap = new Map();
+ var arr = [];
+ var arr2 = SchemeSet;
+ arr2.forEach(arrs => {
+ var object = {};
+ if (Setmap.has(arrs.Id)) {
+ object = {
+ ...{},
+ ...Setmap.get(arrs.Id)
+ };
+ object.Counts = object.Counts + arrs.Counts;
+ object.determine = '';
+ a.forEach(editnum => {
+ if (editnum.Id == object.Id) {
+ editnum.num = object.Counts;
+ CompareFullDataedit.push(editnum);
+ } else {
+ CompareFullDataedit.push(editnum);
+ }
+ });
+ CompareFullData = [].concat(CompareFullDataedit);
+ Setmap.set(arrs.Id, object);
+ } else {
+ object = {
+ ...{},
+ ...arrs
+ };
+ Setmap.set(arrs.Id, object);
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arr.push(v);
+ }
+ CompareFullDataExp = CompareFullData;
+ return arr;
+}
+//璁$畻浠锋牸鏀跨瓥鐨勬渶澶ф鏁�
+export function ComputeMaximumTimes(priceArr,jzDataDefaultCopyQuantityList,jzDataDefault) {
+ // var num=0;
+ var Pricepolicy = {
+ ...{},
+ ...priceArr
+ };
+ var b = jzDataDefaultCopyQuantityList; //鏌ュ嚭鐨勬瘡涓柟妗堢殑鏄庣粏鐨勬暟閲�
+ var selectproducts = jzDataDefault; //寰呴�変骇鍝�
+ Pricepolicy.maxCounts = ComputationalLogic(Pricepolicy, b, selectproducts);
+ return Pricepolicy;
+}
+export function handleSaveFixedPriceLogic(CompareFullData,event,jzDataFixedPrice,jzDataDefaultCopyQuantityList,jzDataDefault){
+ var a = CompareFullData;
+ var CompareFullDataedit = [];
+ var HeTongTotal = 0;
+ var data = event.detail.rows;
+ let newData = [];
+ let editnewDate = [];
+ var boolean = 1;
+ for (var i = 0; i < jzDataFixedPrice.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].DelectId.replace("row-", "");
+ if (jzDataFixedPrice[i].DelectId == id) {
+ // editData=data[j];
+ editData = {
+ Counts: '',
+ HeTongTotal: ''
+ };
+ //瀵硅薄鎶樻墸
+ editData.Counts = data[j].Counts;
+ //璧嬪�� 闈炲璞℃姌鎵�
+ editData.HeTongTotal = data[j].HeTongTotal;
+ // editData.id=id;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...jzDataFixedPrice[i],
+ ...{}
+ }; //浠锋牸鏀跨瓥鏁版嵁
+ //璁$畻鏈�澶ф鏁�
+ newItem = ComputeMaximumTimes(newItem,jzDataDefaultCopyQuantityList,jzDataDefault);
+ console.warn('ceshi1');
+ if (editData.Counts != undefined) {
+ var ifNec = true;
+ if (newItem.recordTypeName__c == "NormalProduct") {
+ if (newItem.ifNecessary__c) {
+ ifNec = false;
+ }
+ }
+ newItem.maxCounts = Number(newItem.maxCounts);
+ if (newItem.maxCounts >= editData.Counts && ifNec) {
+ if (editData.Counts == 0) {
+ boolean = 4;
+ } else {
+ if (newItem.if_Contain_Nod__c) {
+ HeTongTotal = newItem.Price_CNY__c * editData.Counts;
+ } else {
+ HeTongTotal = newItem.Price_CNY__c * editData.Counts + newItem.sumNoDiscount * editData.Counts;
+ }
+ newItem.Counts = editData.Counts;
+ if (newItem.recordTypeName__c == "Promotion") {
+ newItem.HeTongTotal = HeTongTotal;
+ }
+ newItem.determine = '鏀硅繃';
+ a.forEach(editnum => {
+ if (editnum.Id == newItem.Id) {
+ editnum.num = newItem.Counts;
+ CompareFullDataedit.push(editnum);
+ } else {
+ CompareFullDataedit.push(editnum);
+ }
+ });
+ CompareFullData = [].concat(CompareFullDataedit);//20230214
+ }
+ } else {
+ if (ifNec) {
+ boolean = 3;
+ } else {
+ boolean = 5;
+ }
+ }
+ }
+ console.warn('ceshi2');
+ if (editData.HeTongTotal != undefined) {
+ if (newItem.if_Contain_Nod__c) {
+ HeTongTotal = newItem.Price_CNY__c * newItem.Counts;
+ } else {
+ HeTongTotal = newItem.Price_CNY__c * newItem.Counts + newItem.sumNoDiscount * newItem.Counts;
+ }
+ if (editData.HeTongTotal < HeTongTotal) {
+ boolean = 6;
+ } else {
+ newItem.HeTongTotal = editData.HeTongTotal;
+ newItem.determine = '鏀硅繃';
+ }
+ }
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...jzDataFixedPrice[i]
+ });
+ }
+ }
+ CompareFullDataExp = CompareFullData;
+ booleanExp = boolean;
+ newDataExp = newData;
+ HeTongTotalExp = HeTongTotal;
+ return editnewDate;
+}
+export function deleteFixedPriceLogic(SelectedFnDataFixedPrice,CompareFullData){
+ let ids = [];
+ var fag = true;
+ var select = [];
+ for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) {
+ fag = true;
+ var PromotionHeadRecordId = SelectedFnDataFixedPrice[j].recordTypeName__c;
+ if (PromotionHeadRecordId == "NormalProduct") {
+ if (SelectedFnDataFixedPrice[j].ifNecessary__c) {
+ fag = false;
+ } else {
+ select.push(SelectedFnDataFixedPrice[j]);
+ }
+ } else {
+ select.push(SelectedFnDataFixedPrice[j]);
+ }
+ if (fag) {
+ var a = CompareFullData;
+ var compareFu = [];
+ ids.push(SelectedFnDataFixedPrice[j].Id);
+ a.forEach(deletId => {
+ if (SelectedFnDataFixedPrice[j].Id != deletId.Id) {
+ compareFu.push(deletId);
+ }
+ });
+ CompareFullData = [].concat(compareFu);//20230214
+ }
+ }
+ SelectedFnDataFixedPrice = [].concat(select);//20230214
+ CompareFullDataExp = CompareFullData;
+ SelectedFnDataFixedPriceExp = SelectedFnDataFixedPrice;
+ idsExp = ids;
+ return fag;
+}
+export function DeleteChangesFnLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){
+ //鍒犻櫎 瑙勫垯鏁伴噺
+ CompareFullData.forEach(cItem => {
+ if (cItem.Id == id && cItem.ListName == TypeName) {
+ } else {
+ CompareFullDataTemp.push(cItem);
+ }
+ })
+ //鍒犻櫎 宸查�変骇鍝�
+ var CurrentTemp = {};
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ CurrentTemp = jzDataFixedPrice.filter(fItem => {
+ if (fItem.Id == id) {
+ return true;
+ }
+ return false;
+ })[0];
+ }
+ if (TypeName == "鎶樻墸鏀跨瓥") {
+ CurrentTemp = jzDataDiscount.filter(fItem => {
+ if (fItem.Id == id) {
+ return true;
+ }
+ return false;
+ })[0];
+ }
+ //鍖归厤闇�瑕佸垹闄や骇鍝�
+ var ProductNumsTemp = [];
+ var NewjzDataProduct = [];;
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) {
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ });
+ } else if (TypeName == "鎶樻墸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ if (proItem.CompareId == CurrentTemp.CompareId) {
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ });
+ }
+ // 鎵ц鍒犻櫎
+ jzDataProduct = NewjzDataProduct;
+ // 娣诲姞鏁伴噺
+ var newjzDataDefaults = [];
+ var AddnumsTemp = [];
+ jzDataDefault.forEach(defItem => {
+ var defItemTemp = {
+ ...{},
+ ...defItem
+ };
+ ProductNumsTemp.forEach(pTempItem => {
+ if (pTempItem.Id == defItem.Id) {
+ defItemTemp.Quantity += pTempItem.num;
+ AddnumsTemp.push(pTempItem.Id);
+ }
+ });
+ newjzDataDefaults.push(defItemTemp);
+ })
+ jzDataDefault = newjzDataDefaults;
+ //娣诲姞鏁存潯鏁版嵁
+ var PFTempArr = ProductNumsTemp.filter(pTempItem => {
+ var flag = true;
+ AddnumsTemp.filter(addItem => {
+ if (addItem == pTempItem.Id) {
+ flag = false;
+ }
+ })
+ return flag;
+ })
+ jzDataDefaultNotChange.forEach(noChangeItem => {
+ PFTempArr.forEach(pftItem => {
+ if (pftItem.Id == noChangeItem.Id) {
+ let newChangeItem = {
+ ...{},
+ ...noChangeItem
+ };
+ newChangeItem.Quantity = pftItem.num;
+ jzDataDefault.push(newChangeItem);
+ }
+ })
+ })
+ CompareFullDataTempExp = CompareFullDataTemp;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultNotChangeExp = jzDataDefaultNotChange;
+ return jzDataProduct;
+}
+export function deleteFixedPriceTempLogic(SelectedFnDataFixedPrice,jzDataFixedPrice,CompareFullData){
+ let newarr = [];
+ for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) {
+ for (var i = 0; i < jzDataFixedPrice.length; i++) {
+ var a = CompareFullData;
+ var compareFu = [];
+ a.forEach(deletId => {
+ if (SelectedFnDataFixedPrice[j].Id != deletId.Id) {
+ compareFu.push(deletId);
+ }
+ });
+ CompareFullData = [].concat(compareFu);//20230214
+ if (SelectedFnDataFixedPrice[j].Id == jzDataFixedPrice[i].Id) {
+ jzDataFixedPrice.splice(i, 1); // 灏嗕娇鍚庨潰鐨勫厓绱犱緷娆″墠绉伙紝鏁扮粍闀垮害鍑�1
+ i--;
+ }
+ }
+ }
+ for (var i = 0; i < jzDataFixedPrice.length; i++) {
+ newarr.push(jzDataFixedPrice[i]);
+ }
+ CompareFullDataExp = CompareFullData;
+ return newarr;
+}
+export function GetSearchProductByIdLogic(item,results,jzDataDefaultCopyQuantityList,jzDataFixedPrice){
+ results.forEach(itemss => { //鏂规鍏宠仈鐨勪骇鍝�
+ var fl = true;
+ if (jzDataDefaultCopyQuantityList.length == 0) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ } else {
+ jzDataDefaultCopyQuantityList.forEach(jdcql => {
+ if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) {
+ fl = false;
+ }
+ });
+ if (fl) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ }
+ }
+ });
+ var iflag = true;
+ var newarrjdf = [];
+ jzDataFixedPrice.forEach(jdf => { //浠锋牸鏀跨瓥
+ if (jdf.Id == item.Id) {
+ iflag = false;
+ // jdf.sumListPrice = sumListPrice;
+ // jdf.sumNoDiscount = sumNoDiscount;
+ newarrjdf.push(jdf);
+ } else {
+ newarrjdf.push(jdf);
+ }
+ });
+ iflagExp = iflag;
+ jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList;
+ return newarrjdf;
+}
+export function getTableDataCommonlyLogic(jzDataCommonly){
+ var jzDataCommonlyTemp = [];
+ jzDataCommonly.forEach(items => {
+ var ItemsTemp = {
+ ...{},
+ ...items
+ };
+ ItemsTemp.JxsType = "涓�鑸姌鎵�";
+ ItemsTemp.SplitQuantity = ItemsTemp.Quantity;
+ jzDataCommonlyTemp.push(ItemsTemp);
+ })
+ return jzDataCommonlyTemp;
+}
+export function ComputeListPrice(PromotionId,jzDataProduct) {
+ var sum = 0;
+ jzDataProduct.forEach(jzdp => { //jzdp浜у搧鏄庣粏
+ if (jzdp.PromotionId == PromotionId) {
+ sum = sum + jzdp.ListPrice * jzdp.Quantity;
+ }
+ });
+ return sum;
+}
+export function delectComputeData(item,jzDataProduct) {
+ var sum = ComputeListPrice(item.PromotionId,jzDataProduct);
+ var jzProductarry = [].concat(jzDataProduct);
+ jzProductarry.forEach(japdt => {
+ if (item.PromotionId == japdt.PromotionId) {
+ japdt.AgencySubtotal__c = japdt.AgencySubtotal__c + item.AgencySubtotal__c * (japdt.ListPrice * japdt.Quantity / sum);
+ japdt.AgencyUnitPrice__c = japdt.AgencySubtotal__c / japdt.Quantity;
+ japdt.AgencySubtotal__c = Math.round(japdt.AgencySubtotal__c * 100) / 100;
+ japdt.AgencyUnitPrice__c = Math.round(japdt.AgencyUnitPrice__c * 100) / 100;
+ }
+ });
+ jzDataProduct = [].concat(jzProductarry);//20230214
+ return jzDataProduct;
+}
+export function DeleteIsChangelogicExp(item,TypeName,jzDataProduct,jzDataDefault,jzDataDefaultCopy){
+ var jzdatas = [];
+ var flg = true;
+ var booleanfag = 0;
+ jzDataProduct.forEach(proItem => { //proItem浜у搧鏄庣粏
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Promotion") {
+ if (!item.if_Fix__c) {
+ if (proItem.Id == item.Id && item.PromotionId == proItem.PromotionId) {} else {
+ jzdatas.push(proItem);
+ }
+ } else {
+ flg = false;
+ booleanfag = 1;
+
+ }
+ } else if (PromotionHeadRecordId == "NormalProduct") {
+ flg = false;
+ booleanfag = 2;
+ } else {
+ jzdatas.push(proItem);
+ }
+ } else if (TypeName == "鎶樻墸鏀跨瓥") {
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (proItem.Id == item.Id &&
+ item.PromotionId == proItem.PromotionId &&
+ item.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input &&
+ item.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) {} else {
+ jzdatas.push(proItem);
+ }
+ } else {
+ if (proItem.Id == item.Id &&
+ item.Category__c == proItem.Category__c &&
+ item.Discount__c_Input == proItem.Discount__c_Input) {} else {
+ jzdatas.push(proItem);
+ }
+ }
+
+ }
+ });
+ if (flg) {
+ jzDataProduct = [].concat(jzdatas);//20230214
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ //鍒犻櫎浠锋牸璁$畻
+ jzDataProduct = delectComputeData(item,jzDataProduct);
+ }
+ var fg = true;
+ var arr = jzDataDefault;
+ arr.forEach(jddf => { //jddf寰呴�変骇鍝�
+ if (jddf.Id == item.Id) {
+ jddf.Quantity = jddf.Quantity + item.Quantity
+ fg = false;
+ }
+ });
+ if (fg) {
+ jzDataDefaultCopy.forEach(itm => { //itm鎶ヤ环琛岄」鐩富鏁版嵁
+ if (itm.Id == item.Id) {
+ itm.Quantity = item.Quantity
+ arr.push(itm);
+ fg = false;
+ }
+ });
+ }
+ jzDataDefault = [].concat(arr);//20230214
+ }
+ jzDataProductExp = jzDataProduct;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultCopyExp = jzDataDefaultCopy;
+ return booleanfag;
+}
+export function DeleteIsChangesFnjiage(jzDataFixedPrice,jzDataProduct,falg,item){
+ console.warn('1111');
+ var arrTemp = [].concat(jzDataFixedPrice);//20230214
+ var TempItem = {};
+ arrTemp.forEach(atItem => {
+ if (atItem.Id == item.PromotionId) {
+ TempItem = atItem;
+ return;
+ }
+ })
+ console.warn('2222');
+ jzDataProduct.forEach(ite => { //ite浜у搧鏄庣粏
+ if (ite.PromotionId == TempItem.Id) {
+ falg = false;
+ }
+ });
+ falgExp = falg;
+ console.warn('3333');
+ return TempItem;
+}
+export function DeleteIsChangesFnzhekou(jzDataDiscount,jzDataProduct,falg,item){
+ var arrTempTOName = [].concat(jzDataDiscount);//20230214
+ var TempItemTOName = {};
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ arrTempTOName.forEach(atItem => {
+ if (atItem.Id == item.PromotionId && //鏂规Id
+ item.NormalDiscount__c_Input == atItem.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ item.GuaranteeDiscount__c_Input == atItem.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ TempItemTOName = atItem;
+ return;
+ }
+ })
+ jzDataProduct.forEach(ite => {
+ if (ite.PromotionId == TempItemTOName.Id &&
+ ite.NormalDiscount__c_Input == TempItemTOName.NormalDiscount__c_Input &&
+ ite.GuaranteeDiscount__c_Input == TempItemTOName.GuaranteeDiscount__c_Input) {
+ falg = false;
+ }
+ });
+ } else {
+ arrTempTOName.forEach(atItem => {
+ if (item.Category__c == atItem.Category__c &&
+ item.Discount__c_Input == atItem.NormalDiscount__c_Input) {
+ TempItemTOName = atItem;
+ return;
+ }
+ })
+ jzDataProduct.forEach(ite => {
+ if (ite.Category__c == TempItemTOName.Category__c &&
+ ite.Discount__c_Input == TempItemTOName.NormalDiscount__c_Input) {
+ falg = false;
+ }
+ });
+ }
+ falgExp = falg;
+ return TempItemTOName;
+}
+export function delectTableDiscountTempLogic(SelectedFnDataDiscount,jzDataDiscount){
+ let newarr = [];
+ for (var j = 0; j < SelectedFnDataDiscount.length; j++) {
+ for (var i = 0; i < jzDataDiscount.length; i++) {
+ var PromotionHeadRecordId = SelectedFnDataDiscount[j].recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (SelectedFnDataDiscount[j].Id == jzDataDiscount[i].Id &&
+ SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input &&
+ SelectedFnDataDiscount[j].GuaranteeDiscount__c_Input == jzDataDiscount[i].GuaranteeDiscount__c_Input) {
+ jzDataDiscount.splice(i, 1); // 灏嗕娇鍚庨潰鐨勫厓绱犱緷娆″墠绉伙紝鏁扮粍闀垮害鍑�1
+ i--;
+ }
+ } else {
+ if (SelectedFnDataDiscount[j].Category__c == jzDataDiscount[i].Category__c &&
+ SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input) {
+ jzDataDiscount.splice(i, 1); // 灏嗕娇鍚庨潰鐨勫厓绱犱緷娆″墠绉伙紝鏁扮粍闀垮害鍑�1
+ i--;
+ }
+ }
+ }
+ }
+ for (var i = 0; i < jzDataDiscount.length; i++) {
+ newarr.push(jzDataDiscount[i]);
+ }
+ return newarr;
+}
+export function SelectedFnCommonlyLogic(arr){
+ var newArr = [];
+ arr.forEach(item => {
+ var TempObject = {
+ ...{},
+ ...item
+ };
+ TempObject.JxsType = "涓�鑸姌鎵�";
+ newArr.push(TempObject);
+ })
+ return newArr;
+}
+export function SaveGeneralDiscountLogic(data,jzDataCommonly){
+ debugger;
+ let newData = [];
+ let editnewDate = [];
+ var boolean = 1;
+ for (var i = 0; i < jzDataCommonly.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].Id;
+ if (jzDataCommonly[i].Id == id) {
+ editData = {
+ SplitQuantity: ''
+ };
+ editData.SplitQuantity = data[j].SplitQuantity;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...jzDataCommonly[i],
+ ...{}
+ };
+ if (editData.SplitQuantity != undefined) {
+ newItem.SplitQuantity = Number(editData.SplitQuantity);
+ }
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...jzDataCommonly[i]
+ });
+ }
+ }
+ var newArrs = [].concat(editnewDate);//20230214
+ newArrs.forEach(item => {
+ if (item.Quantity < item.SplitQuantity) {
+ boolean = 2;
+ } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') {
+ boolean = 3;
+ }
+ });
+ booleanExp = boolean;
+ return newData;
+}
+export function DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){
+ //鍒犻櫎 瑙勫垯鏁伴噺
+ CompareFullData.forEach(cItem => {
+ if (cItem.Id == id.Id && cItem.ListName == TypeName) {
+ console.warn("CompareFullData 鍒犻櫎");
+ } else {
+ CompareFullDataTemp.push(cItem);
+ }
+ })
+ //鍒犻櫎 宸查�変骇鍝�
+ var CurrentTemp = {};
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ CurrentTemp = jzDataFixedPrice.filter(fItem => {
+ if (fItem.Id == id.Id) {
+ return true;
+ }
+ return false;
+ })[0];
+ }
+ if (TypeName == "鎶樻墸鏀跨瓥") {
+ CurrentTemp = jzDataDiscount.filter(fItem => {
+ var PromotionHeadRecordId = id.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (fItem.Id == id.Id && //鏂规Id
+ fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ fItem.GuaranteeDiscount__c_Input == id.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ return true;
+ }
+ } else {
+ if (fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input &&
+ fItem.Category__c == id.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ return true;
+ }
+ }
+ return false;
+ })[0];
+ }
+ //鍖归厤闇�瑕佸垹闄や骇鍝�
+ var ProductNumsTemp = [];
+ var NewjzDataProduct = [];;
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) {
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ });
+ } else if (TypeName == "鎶樻墸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ var PromotionHeadRecordId = id.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (CurrentTemp.Id == proItem.PromotionId && //鏂规Id
+ CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ CurrentTemp.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ } else {
+ if (CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input &&
+ CurrentTemp.Category__c == proItem.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ }
+ });
+ }
+ jzDataProduct = NewjzDataProduct;
+ var newjzDataDefaults = [];
+ var AddnumsTemp = [];
+ jzDataDefault.forEach(defItem => {
+ var defItemTemp = {
+ ...{},
+ ...defItem
+ };
+ ProductNumsTemp.forEach(pTempItem => {
+ if (pTempItem.Id == defItem.Id) {
+ defItemTemp.Quantity += pTempItem.num;
+ AddnumsTemp.push(pTempItem.Id);
+ }
+ });
+ newjzDataDefaults.push(defItemTemp);
+ })
+ jzDataDefault = newjzDataDefaults;
+ //娣诲姞鏁存潯鏁版嵁
+ var PFTempArr = ProductNumsTemp.filter(pTempItem => {
+ var flag = true;
+ AddnumsTemp.filter(addItem => {
+ if (addItem == pTempItem.Id) {
+ flag = false;
+ }
+ })
+ return flag;
+ })
+ jzDataDefaultNotChange.forEach(noChangeItem => {
+ PFTempArr.forEach(pftItem => {
+ if (pftItem.Id == noChangeItem.Id) {
+ let newChangeItem = {
+ ...{},
+ ...noChangeItem
+ };
+ newChangeItem.Quantity = pftItem.num;
+ jzDataDefault.push(newChangeItem);
+ }
+ })
+ })
+ CompareFullDataTempExp = CompareFullDataTemp;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultNotChangeExp = jzDataDefaultNotChange;
+ return jzDataProduct;
+}
+export function savecountLogic(jzDataFixedPrice,idStr){
+ var arr = []
+ jzDataFixedPrice.forEach(item => { //浠锋牸鏀跨瓥
+ if (idStr == item.Id) {
+ item.maxCounts = item.Counts
+ arr.push(item);
+ } else {
+ arr.push(item);
+ }
+ });
+ jzDataFixedPrice = arr;
+ return jzDataFixedPrice;
+}
+export function ComparePushDataLogic(jzDataDefault,jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num){
+ let addArr = [];
+ var newss = [].concat(jzDataDefault);
+ var newDataDefault = newss.map(item => {
+ if (item == undefined) {
+ console.warn("undefined!!");
+ }
+ if (item.Product2.MDM_Model_No__c == Asset_Model_No__c) {
+ let ItemTemp = {
+ ...{},
+ ...item
+ };
+ ItemTemp.Quantity = Quantity * num
+ ItemTemp.PromotionNo__c = jzDataProductParam.PromotionNo__c;
+ ItemTemp.Name = jzDataProductParam.Name;
+ ItemTemp.TypeName = TypeName;
+ ItemTemp.PromotionId = Id;
+ addArr.push(ItemTemp);
+ item.Quantity -= num * Quantity;
+ }
+ return item;
+ })
+ jzDataProduct = jzDataProduct.concat(addArr);
+ jzDataProductExp = jzDataProduct;
+ return newDataDefault;
+}
+export function saveAllDataProductFnChuanshen(jzDataFixedPrice,jzDataDiscount,quoId,QuoteData,jzDataProduct,jzDataDefault,ContractPrice){
+ var newTemp = [];
+ jzDataFixedPrice.forEach(item => { //浠锋牸鏀跨瓥
+ var itemTemp = {
+ ...{},
+ ...item
+ };
+ itemTemp.typess = "浠锋牸鏀跨瓥 ";
+ newTemp.push(itemTemp);
+ });
+ var newTemp2 = [];
+ jzDataDiscount.forEach(item => { //鎶樻墸鏀跨瓥
+ var itemTemp = {
+ ...{},
+ ...item
+ };
+ itemTemp.typess = "鎶樻墸鏀跨瓥";
+ newTemp2.push(itemTemp);
+ });
+ var data = newTemp.concat(newTemp2);//20230213
+ var ParamIdStr = quoId;
+ var Trade__c = QuoteData[0].Opportunity.Trade__c;
+ var NewData = ConsolidationScheme(data, ParamIdStr, Trade__c);
+ var NewData1 = MergeProducts(jzDataProduct, jzDataDefault, data, ParamIdStr);
+ var jsondatasss = JSON.stringify(NewData);
+ var jsondatassss = JSON.stringify(NewData1);
+ var Sales_Root__c = QuoteData[0].Opportunity.Sales_Root__c;
+ var QuoteId = QuoteData[0].Id;
+ var OpportunityId = QuoteData[0].OpportunityId;
+ var dataChunanshen = {
+ JsonStr: jsondatasss,
+ ParamIdStr: ParamIdStr,
+ JsonStr2: jsondatassss,
+ QuoteId: QuoteId,
+ SalesRootc: Sales_Root__c,
+ ContractPrice: ContractPrice,
+ OpportunityId: OpportunityId,
+ DealerFinalPriceFc: QuoteData[0].Dealer_Final_Price_F__c,
+ Agent1Agent2Pricec: QuoteData[0].Agent1_Agent2_Price__c
+
+ };
+ newTempExp = newTemp;
+ return dataChunanshen;
+}
+export function saveAllDataProductFnPanduan(jzDataProduct,newTemp){
+ var ifnull = true;
+ var ifnunum=1;
+ newTemp.forEach(ntp => { //浠锋牸鏀跨瓥
+ if (ntp.HeTongTotal == undefined || ntp.HeTongTotal == 0) {
+ ifnull = false;
+ }
+ });
+ jzDataProduct.forEach(jzdp=>{
+ if(jzdp.AgencyUnitPrice__c<0){
+ ifnunum=2;
+ return;
+ }
+ });
+ ifnullExp = ifnull;
+ return ifnunum;
+}
+export function QTcssE(pricePolicyflag){
+ var QTcss = '';
+ if(pricePolicyflag){
+ QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder";
+ }else{
+ QTcss="slds-button slds-button_neutral slds-button_stretch quobutton";
+ }
+ return QTcss;
+}
+export function CompareDataL(list,jzDataDefault){
+ debugger
+ var isChange = false;
+ var TempsJzData = []
+ TempsJzData = [].concat(jzDataDefault); //寰呴�変骇鍝�
+ var TempsJzDataToCompare = []
+ TempsJzData.forEach(item => {
+ list.forEach(element => { //淇冮攢鏂规涓绘暟鎹叧鑱斾骇鍝�
+ if (element.Asset_Model_No__c == item.Product2.MDM_Model_No__c) {
+ if (item.Quantity >= element.Quantity__c) {
+ isChange = true;
+ let CompareTemp = {
+ item: item,
+ element: element
+ }
+ TempsJzDataToCompare.push(CompareTemp);
+ }
+ }
+ });
+ })
+ //add 0602
+ var CheckMinNum = 0;
+ var newTempsJzDataToCompare = []
+ TempsJzDataToCompare.forEach(item => { //绗﹀悎瑙勫垯鐨勪骇鍝�
+ var intNum = parseInt(item.item.Quantity / item.element.Quantity__c);
+ if (CheckMinNum == 0) {
+ CheckMinNum = intNum;
+ }
+ if (intNum < CheckMinNum) {
+ CheckMinNum = intNum;
+ }
+ })
+ TempsJzDataToCompare.forEach(item => {
+ var newItem = {
+ ...{},
+ ...item.item
+ };
+ var newElement = {
+ ...{},
+ ...item.element
+ };
+ newItem.Quantity = item.element.Quantity__c * CheckMinNum;
+ var newObj = {};
+ newObj.item = newItem;
+ newObj.element = newElement;
+ newTempsJzDataToCompare.push(newObj);
+ })
+ TempsJzDataToCompare = [].concat(newTempsJzDataToCompare);
+ isChangeExp = isChange;
+ return TempsJzDataToCompare;
+}
+export function initquoT(responseObj,buttonIsShow,initDataTableFixedPrice,initDataTableDiscount,initDataTableOtherData,initDataTableCommonly){
+ var QuoteData = responseObj;
+ if(QuoteData[0].Dealer_Final_Price_F__c==undefined||QuoteData[0].Dealer_Final_Price_F__c===''){
+ QuoteData[0].Dealer_Final_Price_F__c=0
+ }
+ if(QuoteData[0].Agent1_Agent2_Price__c==undefined||QuoteData[0].Agent1_Agent2_Price__c===''){
+ QuoteData[0].Agent1_Agent2_Price__c=null;
+ }
+ debugger
+ if (QuoteData[0].Quote_Decision__c != "鈭�") {
+ buttonIsShow = true;
+ initDataTableFixedPrice.columns[7].editable = true;
+ initDataTableFixedPrice.columns[10].editable = true;
+ initDataTableDiscount.columns[2].editable = true;
+ initDataTableDiscount.columns[3].editable = true;
+ initDataTableDiscount.columns[4].editable = true;
+ initDataTableDiscount.columns[5].editable = true;
+ initDataTableOtherData.columns[3].editable = true;
+ initDataTableCommonly.columns[3].editable = true;
+ }else{
+ buttonIsShow = false;
+ }
+ buttonIsShowE = buttonIsShow;
+ initDTFP = initDataTableFixedPrice;
+ initDTD = initDataTableDiscount;
+ initDTOD = initDataTableOtherData;
+ initDTC = initDataTableCommonly;
+ return QuoteData;
+}
+//浜у搧闇�瑕佹洿鏂扮殑瀛楁
+export function ChangeProductData(key) {
+ var keyArr = [''];
+ var flag = false;
+ keyArr.forEach(item => {
+ if (item == key) {
+ flag = true;
+ }
+ })
+ return flag;
+}
+export const initDataTableProduct2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ sortable: true,
+ typeAttributes: {
+
+ },
+ hideDefaultActions: true,
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 205,
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ initialWidth: 88
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '淇冮攢鏂规鍚嶇О/浜у搧绯诲垪',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 124
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鎶樻墸',
+ fieldName: 'Discount__c_Input',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鍚堝悓鍗曚环',
+ fieldName: 'AgencyUnitPrice__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+ {
+ label: '鍚堝悓鎬讳环',
+ fieldName: 'AgencySubtotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+
+
+ ],
+ sortInterfaces: false,
+ searchColumns:initSearchFormProduct
+}
+
+export const initSearchForm2 = [{
+ label: "鏂规浠g爜",
+ type: "text",
+ name: "PromotionNo__cEqual",
+ isInput: true
+},
+{
+ label: "鍚嶇О",
+ type: "text",
+ name: "NameLike",
+ isInput: true
+}
+]
+
+export const initDataTable2 = {
+ columns: [{
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true,
+ // initialWidth: 100
+ },
+ {
+ label: '鍚嶇О',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+ {
+ label: '鎻忚堪',
+ fieldName: 'Description__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+ {
+ label: '淇冮攢浠锋牸',
+ fieldName: 'Price_CNY__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ initialWidth: 140
+ },
+ {
+ label: '鏄惁鍖呭惈澶氬勾淇濅慨浠锋牸',
+ fieldName: 'if_Contain_Nod__c',
+ sortable: true,
+ type: 'boolean',
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'center'
+ },
+ initialWidth: 170
+ },
+ {
+ label: '鏄惁鍥哄畾鏁伴噺',
+ type: 'boolean',
+ fieldName: 'if_Fix__c',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'center'
+ },
+ initialWidth: 130
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchForm2
+}
+export const initSearchFormFix2 = [{
+ label: "鏂规浠g爜",
+ type: "text",
+ name: "PromotionNo__cEqual",
+ isInput: true
+},
+{
+ label: "鍚嶇О",
+ type: "text",
+ name: "NameLike",
+ isInput: true
+}
+]
+export const initDataTableFix2 = {
+ columns: [{
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍚嶇О',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 351
+ },
+ {
+ label: '鎻忚堪',
+ fieldName: 'Description__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 327
+ },
+ {
+ label: '淇冮攢浠锋牸',
+ fieldName: 'Price_CNY__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鏄惁鍖呭惈澶氬勾淇濅慨浠锋牸',
+ fieldName: 'if_Contain_Nod__c',
+ type: 'boolean',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ },
+ {
+ label: '鏄惁鍥哄畾鏁伴噺',
+ fieldName: 'if_Fix__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ }
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormFix2
+}
+export const initSearchFormDefalt2 = [{
+ label: "浜у搧鍨嬪彿",
+ type: "text",
+ name: "Asset_Model_No__c",
+ isInput: true
+},
+{
+ label: "浜у搧鍚嶇О",
+ type: "text",
+ name: "Name__c",
+ isInput: true
+}
+]
+export const initDataTableDefault2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ hideDefaultActions: true,
+ sortable: true
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 251
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormDefalt2
+}
+export const initSearchFormFixedPrice2 = [{
+ label: "浜у搧鍨嬪彿",
+ type: "text",
+ name: "Asset_Model_No__c",
+ isInput: true
+},
+{
+ label: "浜у搧鍚嶇О",
+ type: "text",
+ name: "Name__c",
+ isInput: true
+}
+]
+export const initDataTableFixedPrice2 = {
+ columns: [{
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '淇冮攢鏂规鍚嶇О/浜у搧绯诲垪',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 196
+ },
+ {
+ label: '鏂规鎻忚堪',
+ fieldName: 'Description__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 105
+ },
+ {
+ label: '鍒嗙被',
+ fieldName: 'Category__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鏄惁鍖呭惈澶氬勾淇濅慨浠锋牸',
+ fieldName: 'if_Contain_Nod__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ },
+ {
+ label: '鏄惁鍥哄畾鏁伴噺',
+ fieldName: 'if_Fix__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ },
+ {
+ label: '淇冮攢鍗曚环',
+ fieldName: 'Price_CNY__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '娆℃暟',
+ fieldName: 'Counts',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ editable: false
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎悎璁�',
+ fieldName: 'sumNoDiscountTotal',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '淇冮攢鎬讳环',
+ fieldName: 'Total',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鍚堝悓浠锋牸',
+ fieldName: 'HeTongTotal',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ editable: false,
+ initialWidth: 100
+ },
+
+ ],
+ sortInterfaces: [],
+ searchColumns: initSearchFormFixedPrice2
+}
+export const initSearchFormDiscount2 = []
+export const initDataTableDiscount2 = {
+ columns: [{
+ label: '缁忛攢鍟嗗垎绫�',
+ fieldName: 'JxsType',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍒嗙被',
+ fieldName: 'Category__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ // {
+ // label: '瀵硅薄鍝佹姌鎵�',
+ // fieldName: 'GuaranteeDiscount__c',
+ // sortable: true,
+ // cellAttributes: {
+ // alignment: 'center'
+ // }
+ // },
+ // {
+ // label: '闈炲璞″搧鎶樻墸',
+ // fieldName: 'NormalDiscount__c',
+ // sortable: true,
+ // cellAttributes: {
+ // alignment: 'center'
+ // }
+ // },
+ {
+ label: '瀵硅薄鍝佹姌鎵�',
+ fieldName: 'GuaranteeDiscount__c_Input',
+ editable: false,
+ hideDefaultActions: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ },
+ {
+ label: '瀵硅薄鍝佸悎鍚岄噾棰�',
+ fieldName: 'GuaranteeDiscount_H_Money__c',
+ type: 'number',
+ editable: false,
+ hideDefaultActions: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+ {
+ label: '闈炲璞″搧鎶樻墸',
+ fieldName: 'NormalDiscount__c_Input',
+ editable: false,
+ hideDefaultActions: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ },
+ {
+ label: '闈炲璞″搧鍚堝悓閲戦',
+ fieldName: 'NormalDiscount_H_Money__c',
+ type: 'number',
+ hideDefaultActions: true,
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+ {
+ label: '鍚堝悓浠锋牸',
+ fieldName: 'HeTongPrice',
+ type: 'number',
+ hideDefaultActions: true,
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ }
+ ],
+ sortInterfaces: [],
+ searchColumns: initSearchFormDiscount2
+}
+export const initSearchFormSpecial2 = []
+export const initDataTableSpecial2 = {
+ columns: [{
+ label: '缂栫爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍗忚浜у搧',
+ fieldName: 'Department__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '瀵硅薄鍝佹姌鎵�',
+ fieldName: 'GuaranteeDiscount__c',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '闈炲璞″搧鎶樻墸',
+ fieldName: 'NormalDiscount__c',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鍗忚缂栫爜',
+ fieldName: 'Contract__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '缁忛攢鍟�',
+ fieldName: 'Agency__Name',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormSpecial2
+}
+export const initSearchFormOtherData2 = []
+export const initDataTableOtherData2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ sortable: true,
+ hideDefaultActions: true,
+ typeAttributes: {
+ },
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ hideDefaultActions: true,
+ sortable: true,
+
+ initialWidth: 268
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '浣跨敤鏁伴噺',
+ fieldName: 'SplitQuantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right',
+ class: {}
+ },
+ editable: false
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormOtherData2
+}
+export const initSearchFormCommonly2 = [{
+ label: "鏂规浠g爜",
+ type: "text",
+ name: "PromotionNo__cEqual",
+ isInput: true
+},
+{
+ label: "鍚嶇О",
+ type: "text",
+ name: "NameLike",
+ isInput: true
+}
+]
+export const initDataTableCommonly2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ sortable: true,
+ hideDefaultActions: true,
+ typeAttributes: {
+ },
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 268
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '浣跨敤鏁伴噺',
+ fieldName: 'SplitQuantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right',
+ class: {}
+ },
+ editable: false
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormCommonly2
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSINewQuoteEntry/__tests__/lexSINewQuoteEntry.test.js b/force-app/main/default/lwc/lexSINewQuoteEntry/__tests__/lexSINewQuoteEntry.test.js
new file mode 100644
index 0000000..2277302
--- /dev/null
+++ b/force-app/main/default/lwc/lexSINewQuoteEntry/__tests__/lexSINewQuoteEntry.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import LexSINewQuoteEntry from 'c/lexSINewQuoteEntry';
+
+describe('c-lex-si-new-quote-entry', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-lex-si-new-quote-entry', {
+ is: LexSINewQuoteEntry
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.css b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.css
index da958a0..6a38b4a 100644
--- a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.css
+++ b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.css
@@ -1,5 +1,39 @@
-.diap{
- font-family: "瀹嬩綋",sans-serif;
- color: red;
- opacity: 0.5;
+@import 'c/lexCssUtility';
+:host {
+ --slds-c-textarea-sizing-min-height: 200px;
+}
+.my-icon {
+ --slds-c-icon-color-foreground-default: white;
+}
+.quobutton{
+ font-size: 18px;
+ font-family: 'sans-serif';
+ font-weight:500;
+ width: 160px;
+ height: 36px;
+ border-radius: 4px;
+ opacity: 1;
+ background:#0A81DF;
+ color:#FFFFFF;
+}
+/* .slds-scope .slds-alert_error {
+ --slds-c-alert-color-background: #ba0517 !important;
+} */
+.my-icons{
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ padding-top: var(--slds-c-alert-spacing-block-start, var(--sds-c-alert-spacing-block-start, var(--lwc-spacingXSmall,0.5rem)));
+ padding-right: var(--slds-c-alert-spacing-inline-end, var(--sds-c-alert-spacing-inline-end, var(--lwc-spacingXLarge,2rem)));
+ padding-bottom: var(--slds-c-alert-spacing-block-end, var(--sds-c-alert-spacing-block-end, var(--lwc-spacingXSmall,0.5rem)));
+ padding-left: var(--slds-c-alert-spacing-inline-start, var(--sds-c-alert-spacing-inline-start, var(--lwc-spacingXSmall,0.5rem)));
+ color: var(--slds-c-alert-text-color, var(--sds-c-alert-text-color, var(--slds-g-color-neutral-base-100, var(--lwc-colorTextInverse,rgb(255, 255, 255)))));
+ font-weight: var(--slds-c-alert-font-weight, var(--sds-c-alert-font-weight));
+ text-align: center;
+ background-color: var(--slds-c-alert-color-background, var(--sds-c-alert-color-background, var(--slds-g-color-neutral-base-50, var(--lwc-colorBackgroundToast,rgb(116, 116, 116)))));
+ /* background-image: var(--slds-c-alert-image-background, var(--sds-c-alert-image-background, linear-gradient(45deg, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 25%, transparent 25%, transparent 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 75%, transparent 75%, transparent))); */
+ background-size: var(--slds-c-alert-size-background, var(--sds-c-alert-size-background, 64px 64px));
+ --slds-c-alert-color-background: #ba0517 !important;
}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.html b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.html
index 41a40c8..233130f 100644
--- a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.html
+++ b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.html
@@ -1 +1,857 @@
-<template></template>
\ No newline at end of file
+<template>
+ <!-- 鍏ㄥ眬鍔犺浇鏍囪瘑 -->
+ <div class="exampleHolder" if:true={IsLoading} >
+ <lightning-spinner alternative-text="Loading" size="large" style="height: 100%;top: 0%; z-index: 7"></lightning-spinner>
+ </div>
+ <div style="float:right; z-index: 8;" >
+ <div class="demo-only demo-only_viewport" style="height:4.5rem;" if:true = {Tongzhishow}>
+ <div class="slds-notification-container" style={IsLeftStyle}>
+ <div aria-live="assertive" aria-atomic="true" class="slds-assistive-text">鎻愮ず</div>
+ <section class="slds-notification" role="dialog" aria-labelledby="noti77" aria-describedby="dialog-body-id-43" >
+ <div class="slds-notification__body" id="dialog-body-id-43" >
+ <a class="slds-notification__target slds-media" href="#" style={BgColorStyle}>
+ <div class="slds-media__body">
+ <!-- <h2 class="slds-text-heading_small slds-m-bottom_xx-small" id="noti77" style="color:white;">
+ <span class="slds-assistive-text" >task notification:</span>
+ 鎻愮ず
+ </h2> -->
+ <p style="color:white;" >{SaveShowText}</p>
+ </div>
+ </a>
+ <button class="slds-button slds-button_icon slds-button_icon-container slds-notification__close" title="close">
+ <lightning-icon class="my-icon" icon-name="utility:close" alternative-text="close" title="close" size="x-small" onclick={CloseAlert}></lightning-icon>
+ </button>
+ </div>
+ </section>
+ </div>
+ </div>
+ </div>
+ <!-- 鍏ㄥ眬鍔犺浇鏍囪瘑 -->
+ <!-- 鍩烘湰淇℃伅 -->
+ <!-- 鍩烘湰淇℃伅 -->
+ <div >
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鍩烘湰淇℃伅</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div >
+ <!-- 鍖婚櫌鍚� -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {HPName}:</label>
+ <div class="slds-form-element__control" style="width:230px; display: inline-block;">{oppInfo.HP_Name__c}</div>
+ <!-- 鍖婚櫌鍚� -->
+ <!-- 绉戝鍚� -->
+ <label class="slds-form-element__label" style="width:50px;text-align:right;margin-left: 10px;"> {DepartmentName}:</label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Department_Name__c}</div>
+ <!-- 绉戝鍚� -->
+ <!-- 閿�鍞笭閬� -->
+ <label class="slds-form-element__label" style="width:95px;text-align:right;margin-left: 52px;"> {SalesRoot}:</label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Sales_Root__c}</div>
+ <!-- 閿�鍞笭閬� -->
+ <!-- 璐у竵 -->
+ <label class="slds-form-element__label" style="width:90px;text-align:right;margin-left: 80px;"> {Currency}:</label>
+ <div class="slds-form-element__control" style="width:60px; display: inline-block;">{oppInfo.CurrencyIsoCode}</div>
+ <!-- 璐у竵 -->
+ </div>
+ <div >
+ <!-- 鎶ヤ环缂栫爜 -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right; margin-left: 20px;"> {QuotoNo}:</label>
+ <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Quote_No__c}</div>
+ <!-- 鎶ヤ环缂栫爜 -->
+ <!-- 鎶ヤ环鍚嶇О -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {QuotoName}:</label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="text" value={quo.QuoteName__c} disabled ={Decisiontag} onblur={QuoteNameAssignment}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.qname}>璇疯緭鍏ュ�硷紒</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!-- 鎶ヤ环鍚嶇О -->
+ <!-- 鎶ヤ环鎬婚 -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {TotalPrice}:</label>
+ <div class ="slds-form-element__control" style=" width:200px;display: inline-block;">{quo.QuoteTotal_Page__c}</div>
+ <!-- 鎶ヤ环鎬婚 -->
+ <!-- 浜у搧鏍囧噯瀹氫环鎬婚 -->
+ <label class="slds-form-element__label" style="width:110px;text-align:right; margin-left: 10px;">浜у搧鏍囧噯瀹氫环鎬婚:</label>
+ <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Estimation_List_Price__c}</div>
+ <!-- 浜у搧鏍囧噯瀹氫环鎬婚 -->
+ </div>
+ <div >
+ <!-- 锛迹锛娴嬮閿�鍞� -->
+ <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ForecastAmounts}:</label>
+ <!-- <div class="slds-form-element__control" style="width:170px; display: inline-block;">{oppInfo.Wholesale_Price__c}</div> -->
+ <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.OCM_Sales_Forecast__c}</div>
+ <!-- 锛迹锛娴嬮閿�鍞� -->
+ <!-- 鏈�缁堝鎴锋垚浜や环锛堜粎OLY渚涜揣浜у搧) -->
+ <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ContactPrice}:</label>
+ <div class ="slds-form-element__control" style=" width:177px;display: inline-block;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Dealer_Final_Price_Page__c} disabled ={Decisiontag} onblur={DealerFinalPricePageChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.dfpp}>璇疯緭鍏ュ�硷紒</div>
+ <!-- <div style="font-size:1px;color:#ba0517">璇疯緭鍏ュ�硷紒</div> -->
+ </div>
+ <!-- 鏈�缁堝鎴锋垚浜や环锛堜粎OLY渚涜揣浜у搧) -->
+ <!-- 涓绘満瑁呮満鍦� -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;">涓绘満瑁呮満鍦扮偣:</label>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;">
+ <lightning-combobox
+ name="progress"
+ value={quo.Installation_location__c}
+ options={HostInstallationLocationoptions}
+ onchange={HostInstallationLocationhandleChange} disabled ={Decisiontag}></lightning-combobox>
+ </div>
+ <!-- 涓绘満瑁呮満鍦� -->
+ <!-- 鎴愭湰 -->
+ <!-- <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 105px;"> {Cost} :</label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.Stocking_Price__c}</div> -->
+ <!-- 鎴愭湰 -->
+ </div>
+ <div >
+ <!-- 鍚堝悓淇濅慨鏈燂紙骞达級 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right; margin-left: 0px;">鍚堝悓淇濅慨鏈燂紙骞达級:</label>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:true={QuotCalfag}>
+ <lightning-combobox
+ data-parent-id="GuranteePeriodId"
+ name="progress"
+ value={quo.Gurantee_Period__c}
+ options={ContractWarrantyPeriodYearOptions}
+ onchange={ContractWarrantyPeriodYearHandleChange} disabled ={Decisiontag}></lightning-combobox>
+ </div>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:false={QuotCalfag}>
+ {quo.Gurantee_Period__c}
+ </div>
+ <!-- 鍚堝悓淇濅慨鏈燂紙骞达級 -->
+ <!-- 鍙栨秷甯傚満澶氬勾淇濅慨 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left:50px;">鍙栨秷甯傚満澶氬勾淇濅慨: </label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="checkbox" checked={quo.multiYearWarranty__c} disabled ={Decisiontag} onchange={multiYearWarrantyChange}> </lightning-input>
+ </div>
+ <!-- 鍙栨秷甯傚満澶氬勾淇濅慨 -->
+ <!-- 澶氬勾淇濅环鏍煎悎璁� -->
+ <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 165px;">澶氬勾淇濅环鏍煎悎璁�: </label>
+ <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.MultiYearWarrantyTotalPrice__c}</div>
+ <!-- 澶氬勾淇濅环鏍煎悎璁� -->
+ </div>
+ <div>
+ <!-- 鎶ヤ环鍙樺寲 -->
+ <label class="slds-form-element__label" style="width:80px;text-align:right; margin-left: 40px;">鎶ヤ环鍙樺寲: </label>
+ <div class ="slds-form-element__control" style="width:120px; display: inline-block;">
+ <lightning-combobox
+ name="progress"
+ value={quo.QuotationChange__c}
+ options={QuotationChangesOptions}
+ onchange={QuotationChangesHandleChange} disabled ={Decisiontag}></lightning-combobox>
+ </div>
+ <!-- 鎶ヤ环鍙樺寲 -->
+
+ <!-- 涓绘満涓嶅甫鐩戣鍣ㄥ彴杞� -->
+ <label class="slds-form-element__label" style="width:130px;text-align:right;margin-left: 40px;">涓绘満涓嶅甫鐩戣鍣ㄥ彴杞�: </label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="checkbox" checked={quo.MainEngineWithoutMonitor__c} disabled ={Decisiontag} onchange={MainEngineWithoutMonitorChange}> </lightning-input>
+ </div>
+ <!-- 涓绘満涓嶅甫鐩戣鍣ㄥ彴杞� -->
+ <!-- 璺ㄧ瀹� -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 145px;">璺ㄧ瀹�: </label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="checkbox" checked={quo.Interdepartmental__c} disabled ={Decisiontag} onchange={InterdepartmentalChange}> </lightning-input>
+ </div>
+ <!-- 璺ㄧ瀹� -->
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鍩烘湰淇℃伅 -->
+ <!-- 缁忛攢鍟嗕环鏍� -->
+ <div >
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>缁忛攢鍟嗕环鏍�</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <!-- style="background-color:#ffd6c1" -->
+ <div >
+ <div style="margin-bottom: 15px; ">
+ <!--鎶ヤ环璋冩暣鎶樻墸 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">鎶ヤ环璋冩暣鎶樻墸</label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Calculate__c} disabled ={Decisiontag} onblur={QuoteAdjustCalculateChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.qacc}>璇疯緭鍏ュ�硷紒</div>
+ </div>
+ <!--鎶ヤ环璋冩暣鎶樻墸 -->
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label>
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <!--鎶ヤ环璋冩暣閲戦 -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">鎶ヤ环璋冩暣閲戦</label>
+ <div class ="slds-form-element__control" style=" display: inline-block; margin-left: 15px;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Amount_Page__c} disabled ={Decisiontag} onblur={QuoteAdjustAmountPageChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.qaapc}>璇疯緭鍏ュ�硷紒</div>
+ </div>
+ <!--鎶ヤ环璋冩暣閲戦 -->
+ <!--鏄惁宸叉姤浠疯绠楁爣璇� -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 20px;">鏄惁宸叉姤浠疯绠�:</label>
+ <div class ="slds-form-element__control" style=" display: inline-block;">
+ <lightning-input type="checkbox" checked={quo.IsQuoteTrial__c} disabled> </lightning-input>
+ </div>
+ <!--鏄惁宸叉姤浠疯绠楁爣璇� -->
+ </div>
+ <div style="margin-bottom: 5px; ">
+ <!--缁忛攢鍟嗕竴鍚嶇О -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">{SalesName1}</label>
+ <div style="display: inline-block;">
+ <c-jzlookuplightning2 data-parent-id="Agency1Id" recordid ={quoId} onsearchchange={onsearchchange1} objectname="Quote" fieldname="Agency1__c" variant = "label-hidden" lookupstyle="width:300px;"> </c-jzlookuplightning2>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency1}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency1}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ </div>
+ <!--缁忛攢鍟嗕竴鍚嶇О -->
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label>
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <!--缁忛攢鍟嗕竴鍚堝悓閲戦 -->
+ <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:false={Decisiontag}>
+ <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={quo.IsQuoteTrial__c} onblur ={OCMAgent1PricePageonChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ </div>
+ <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:true={Decisiontag}>
+ <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={Decisiontag} onblur ={OCMAgent1PricePageonChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ </div>
+ <!--缁忛攢鍟嗕竴鍚堝悓閲戦 -->
+ <!-- 鍒╂鼎鏍囩 -->
+ <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}锛�</label>
+ <!-- 鍒╂鼎鏍囩 -->
+ <!--缁忛攢鍟嗕竴鍒╂鼎鏄剧ず -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency1_Profit__c}</div>
+ <!--缁忛攢鍟嗕竴鍒╂鼎鏄剧ず -->
+ <!--缁忛攢鍟嗕竴鐧惧垎姣旀樉绀� -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency1_Profit_Rate__c}</div>
+ <!--缁忛攢鍟嗕竴鐧惧垎姣旀樉绀� -->
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label>
+ <!-- 鐧惧垎姣旀爣绛� -->
+ </div>
+ <div style="margin-bottom: 15px; ">
+ <!--缁忛攢鍟嗕簩鍚嶇О -->
+ <label class="slds-form-element__label" style="width:120px;text-align:right;">{Sales_Name2}</label>
+ <div style="display: inline-block;">
+ <c-jzlookuplightning2 data-parent-id="Agency2Id" recordid ={quoId} onsearchchange={onsearchchange2} objectname="Quote" fieldname="Agency2__c" variant = "label-hidden" lookupstyle="width:300px; display: inline-block;"> </c-jzlookuplightning2>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency2}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency2}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ </div>
+ <!--缁忛攢鍟嗕簩鍚嶇О -->
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label>
+ <!-- 鍚堝悓閲戦鏍囩 -->
+ <!--缁忛攢鍟嗕簩鍚堝悓閲戦 -->
+ <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;">
+ <lightning-input class="input-text-align_right" type="text" value={quo.Agent1_Agent2_Price_Page__c} disabled ={Decisiontag} onblur ={Agent1Agent2PricePageChange}> </lightning-input>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.aapp}>璇疯緭鍏ュ�硷紒</div>
+ <div style="font-size:12px;color:#ba0517" if:true={nafg.naapp}>璇蜂笉瑕佽緭鍏ュ�ゃ��</div>
+ </div>
+ <!--缁忛攢鍟嗕簩鍚堝悓閲戦 -->
+ <!-- 鍒╂鼎鏍囩 -->
+ <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}锛�</label>
+ <!-- 鍒╂鼎鏍囩 -->
+ <!--缁忛攢鍟嗕簩鍒╂鼎鏄剧ず -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency2_Profit__c}</div>
+ <!--缁忛攢鍟嗕簩鍒╂鼎鏄剧ず -->
+ <!--缁忛攢鍟嗕簩鐧惧垎姣旀樉绀� -->
+ <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency2_Profit_Rate__c}</div>
+ <!--缁忛攢鍟嗕簩鐧惧垎姣旀樉绀� -->
+ <!-- 鐧惧垎姣旀爣绛� -->
+ <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label>
+ <!-- 鐧惧垎姣旀爣绛� -->
+ </div>
+ <div style="margin-bottom: 15px; ">
+ <!-- 淇濆瓨 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={savebuttonClick} if:true={hidden}>淇濆瓨</button>
+ <!-- 淇濆瓨 -->
+ <!-- 淇濆瓨骞跺叧闂� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={Saveandback} if:true={hidden}>{Opp_Button}</button>
+ <!-- 淇濆瓨骞跺叧闂� -->
+ <!-- 鎶ヤ环璁$畻 -->
+ <button class={QTcss} style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={showQuotationCalculation} if:true={QuotCalfag}>鎶ヤ环璁$畻</button>
+ <!-- 鎶ヤ环璁$畻 -->
+ <!-- Decide -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decision_button} onclick={decisionbuttonClick} if:true={hidden}>{QuoteDecision_Button}</button>
+ <!-- Decide -->
+ <!-- 澶嶅埗 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={copyToClipboardNewQuoteEntry} if:true={hidden}>{Copy_Detail}</button>
+ <!-- 澶嶅埗 -->
+ <!-- 涓嶄繚瀛橈紙杩斿洖锛� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" onclick={noSaveback}>涓嶄繚瀛�(杩斿洖)</button>
+ <!-- 涓嶄繚瀛橈紙杩斿洖锛� -->
+ </div>
+ <div style="margin-bottom: 15px;" if:true={hidden}>
+ <!-- 澶囪揣纭鐢宠淇濆瓨 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={submitOppoApplyStockJs}>澶囪揣纭鐢宠</button>
+ <!-- 澶囪揣纭鐢宠 -->
+ <!-- CSV涓嬭浇 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={CSVflag} onclick={DownloadCsvGet}>CSV涓嬭浇</button>
+ <!-- CSV涓嬭浇 -->
+ <!-- 纭鎶ヤ环 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" if:true={UnConfirmQuote} onclick={QuoteConfirmJs}>纭鎶ヤ环</button>
+ <!-- 纭鎶ヤ环 -->
+ </div>
+
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 缁忛攢鍟嗕环鏍� -->
+ <!-- 閫夋嫨鎶ヤ环浜у搧 -->
+ <!-- <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct}></c-jz-data-table>
+ </div> -->
+ <div if:false={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>閫夋嫨鎶ヤ环浜у搧</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div style="margin-bottom: 15px; ">
+ <!-- 閫夋嫨浜у搧 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={NewQuotationProducts}>閫夋嫨浜у搧</button>
+ <!-- 閫夋嫨浜у搧 -->
+ <!-- 浜у搧閰嶅鎼滅储 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openSetProduct}>{SetProduct}</button>
+ <!-- 浜у搧閰嶅鎼滅储 -->
+ <!-- Excel瀵煎叆 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openQuoteExcelImport}>{ExcelImport}</button>
+ <!-- Excel瀵煎叆 -->
+ <!-- 鍒犻櫎 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={deletejzDataToBeproduct}>鍒犻櫎浜у搧</button>
+ <!-- 鍒犻櫎 -->
+ <!-- 鏇存柊浠锋牸鐘舵�� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick ={productCompare}>{StatusUpdate}</button>
+ <!-- 鏇存柊浠锋牸鐘舵�� -->
+ <!-- 鏇挎崲浜у搧otcode -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:130px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={updateOtcode}>鏇挎崲浜у搧otcode</button>
+ <!-- 鏇挎崲浜у搧otcode -->
+ </div>
+ <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table idkey="lineNo" miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct} if:true={tobeflag}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 閫夋嫨鎶ヤ环浜у搧 -->
+ <!-- 娴嬭瘯鎶ヤ环璁$畻缁勪欢 -->
+ <!-- <div if:true={pricePolicyflag1}>
+ <c-quote-trial paramid={quoId}></c-quote-trial>
+ </div> -->
+ <!-- 鎶ヤ环璁$畻寰呴�変骇鍝� -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鎶ヤ环璁$畻寰呴�変骇鍝�</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div style="min-height: 60px;">
+ <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedFnDefault} name="jzDataTableDefault" ongettabledata={getTableDataDefault} table-data={jzDataDefault} table-is-loding={tableIsLodingDefault} options={initDataTableDefault}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鎶ヤ环璁$畻寰呴�変骇鍝� -->
+ <!-- 鎶ヤ环璁$畻浣跨敤浠锋牸鏀跨瓥 -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鎶ヤ环璁$畻浣跨敤浠锋牸鏀跨瓥</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div if:true={buttonIsShow}>
+ <!-- <button class="slds-button slds-button_brand" onclick={showModal}>閫夋嫨淇冮攢鏂规鍥哄畾浠锋牸</button> -->
+ <!-- 閫夋嫨淇冮攢鏂规 -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:170px;text-align:right; font-size:small;" onclick={showModal}>閫夋嫨淇冮攢鏂规鍥哄畾浠锋牸</button>
+ <!-- 閫夋嫨淇冮攢鏂规 -->
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalFix}>閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍�</button>
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍� -->
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={deleteFixedPrice}>鍒犻櫎</button>
+ </div>
+ <div if:true={jzDataTableFixedPriceIsShow}>
+ <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnFixedPrice} name="jzDataTableFixedPrice" ongettabledata={getTableDataFixedPrice} table-data={jzDataFixedPrice} table-is-loding={tableIsLodingFixedPrice} options={initDataTableFixedPrice} onsave={handleSaveFixedPrice} if:true={jzshows3}></c-jz-data-table>
+ </div>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鎶ヤ环璁$畻浣跨敤浠锋牸鏀跨瓥 -->
+ <!-- 鎶ヤ环璁$畻浣跨敤鎶樻墸鏀跨瓥 -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鎶ヤ环璁$畻浣跨敤鎶樻墸鏀跨瓥</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div if:true={buttonIsShow}>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalSpecial} >閫夋嫨鐗圭害鎶樻墸</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalCommonly}>閫夋嫨涓�鑸姌鎵�</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableDiscount}>鍒犻櫎</button>
+ </div>
+ <div if:true={jzDataTableDiscountIsShow}></div>
+ <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table class="jzdtdis" miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnDiscount} name="jzDataTableDiscount" ongettabledata={getTableDataDiscount} table-data={jzDataDiscount} table-is-loding={tableIsLodingDiscount} options={initDataTableDiscount} onsave={handleSaveDiscount} if:true={jzshows2}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鎶ヤ环璁$畻浣跨敤鎶樻墸鏀跨瓥 -->
+ <!-- 浜у搧鏄庣粏 -->
+ <div if:true={pricePolicyflag}>
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>浜у搧鏄庣粏</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div if:true={buttonIsShow}>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableProduct}>鍒犻櫎</button>
+ </div>
+ <div style="min-height: 60px;max-height: 400px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table data-parent-id="chuxiao" idkey="DelectId" miniheight="min-height: 60px" onrowselection={SelectedFnProduct} name="jzDataTableProduct" ongettabledata={getTableDataProduct} table-data={jzDataProduct} table-is-loding={tableIsLodingProduct} options={initDataTableProduct} if:true={jzshows}></c-jz-data-table>
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 浜у搧鏄庣粏 -->
+ <!-- 鎶ヤ环璁$畻搴曢儴 -->
+ <div if:true={pricePolicyflag}>
+ <!-- 鍚堝悓鎬讳环 -->
+ <p align="center" ><b>鍚堝悓鎬讳环锛歿ContractPrice}</b></p>
+ <!-- 鍚堝悓鎬讳环 -->
+ <!-- 淇濆瓨鎶ヤ环璁$畻缁撴灉鎸夐挳 -->
+ <div align="right" style="margin-bottom: 15px;margin-right: 15px; ">
+ <button if:true={buttonIsShow} style="font-size:small;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" onclick={saveAllDataProductFn}>淇濆瓨鎶ヤ环璁$畻缁撴灉</button>
+ </div>
+ <!-- 淇濆瓨鎶ヤ环璁$畻缁撴灉鎸夐挳 -->
+ </div>
+ <!-- 鎶ヤ环璁$畻搴曢儴 -->
+ <!-- 鏂囦欢鎵撳嵃 -->
+ <div >
+ <article class="slds-card" >
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__header slds-grid" >
+ <header class="slds-media slds-media_center slds-has-flexi-truncate">
+ <div class="slds-media__body">
+ <h2 class="slds-card__header-title">
+ <a href="#" class="slds-card__header-link slds-truncate" title="Accounts">
+ <span>鏂囦欢鎵撳嵃</span>
+ </a>
+ </h2>
+ </div>
+ </header>
+ </div>
+ <!-- 鏍峰紡澶� -->
+ <div class="slds-card__body slds-card__body_inner">
+ <div>
+ <!-- 鎵撳嵃鎶ヤ环 -->
+ <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Quote_Print}</label>
+ <!-- 鎵撳嵃鎶ヤ环 -->
+ <!-- 鍗曚环 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Unit_Price__c} onchange={UnitPriceChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">鍗曚环</label>
+ <!-- 鍗曚环 -->
+ <!-- 鎶ヤ环閲戦 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Offer_Amount__c} onchange={OfferAmountChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">鎶ヤ环閲戦</label>
+ <!-- 鎶ヤ环閲戦 -->
+ <!-- 鎶ヤ环鎬婚 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.TOTAL__c} onchange={TOTALChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{TotalPrice}</label>
+ <!-- 鎶ヤ环鎬婚 -->
+ <!-- 浼樻儬鎶樻墸 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Discount__c} onchange={DiscountChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Total_Discount_Percent}</label>
+ <!-- 浼樻儬鎶樻墸 -->
+ <!-- 浼樻儬浠锋牸 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Pricing__c} onchange={PricingChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">浼樻儬浠锋牸</label>
+ <!-- 浼樻儬浠锋牸 -->
+ <!-- 浼樻儬鎴愪氦浠� -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Preferential_Trading_Price__c} onchange={PreferentialTradingPriceChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Row_Total_Sum}</label>
+ <!-- 浼樻儬鎴愪氦浠� -->
+ <!-- 淇濅慨骞撮檺 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;">
+ <lightning-input type="checkbox" checked={quo.Preferential_Gurantee_Period__c} onchange={PreferentialGuranteePeriodChange}> </lightning-input>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;margin-left: 5px;">淇濅慨骞撮檺 </label>
+ <!-- 淇濅慨骞撮檺 -->
+ <!-- 鍚堝悓閰嶇疆 -->
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px; " if:true={enableContract}>
+ <lightning-input type="checkbox" checked={quo.Contract__c} onchange={ContractcChange} > </lightning-input>
+ </div>
+ <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px;" if:false={enableContract}>
+ </div>
+ <label class="slds-form-element__label" style="text-align:right;margin-left:5px;">{Contract_Breakdown}</label>
+ <!-- 鍚堝悓閰嶇疆 -->
+ </div>
+ <div>
+ <!-- 鎵撳嵃瀹㈡埛鍚嶇О -->
+ <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Print_HPName}</label>
+ <div class ="slds-form-element__control" style="width:400px; display: inline-block;">
+ <lightning-combobox
+ name="progress"
+ value={selection_hp}
+ options={PrintCustomerNameoptions}
+ onchange={PrintCustomerNamehandleChange} ></lightning-combobox>
+ </div>
+ <!-- 鎵撳嵃瀹㈡埛鍚嶇О -->
+ <!-- 鎵撳嵃鎸夐挳 -->
+ <div style="display: inline-block;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 380px; font-size:small;" disabled={print_buttonflg} onclick={PrintButton} if:true={hidden}>{Print_Button}</button>
+ </div>
+ <!-- 鎵撳嵃鎸夐挳 -->
+ </div>
+ </div>
+ </article>
+ </div>
+ <!-- 鏂囦欢鎵撳嵃 -->
+ <!-- 鏂板鎶ヤ环浜у搧妯℃�佹 -->
+ <div if:true = {showproductfalg} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-5">
+ <!-- 鎶ヤ环浜у搧鎼滅储妗� -->
+ <div class="exampleHolder" if:true={IsLoadingjdpt} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <!-- <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataProduct} options={initSearchFormProduct}></c-jz-search-form> -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label="浜у搧鍨嬪彿锛�" style="width:150px" onblur={jzProductsearchChange}></lightning-input>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={jzProductsearchbutton}>鎼滅储</button>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={additionaljzProductbutton}>杩藉姞</button>
+ </div>
+ <!-- 鎶ヤ环浜у搧鎼滅储妗� -->
+ <!-- 鎶ヤ环浜у搧鍒楄〃 -->
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedProductFn} data-parent-id="parent-div-productid" name="jzDataproductTable" ongettabledata={getTableProductData} table-data={jzProductData} table-is-loding={tableIsproductLoding} options={initDataProductTable} ></c-jz-data-table>
+ </div>
+ <!-- 鎶ヤ环浜у搧鍒楄〃 -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelProduct}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 鏂板鎶ヤ环浜у搧妯℃�佹 -->
+ <!-- 鏂板浜у搧閰嶅妯℃�佹 -->
+ <div if:true = {showSetProductfalg} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-10">
+ <!-- 浜у搧閰嶅鎼滅储妗� -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label=" 浜у搧閰嶅鍚嶏細" style="width:150px;margin-left: 20px;" onblur={jzSearchNameChange}></lightning-input>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label=" 浜у搧閰嶅缂栫爜锛�" style="width:150px;margin-left: 20px;" onblur={jzSearchCodeChange}></lightning-input>
+ </div>
+ <div class ="slds-form-element__control" style="width:150px; display: inline-block;;margin-left: 20px;">
+ <lightning-combobox
+ label = '閫傜敤绉戝 :'
+ name="setpro"
+ options={listViewOptions}
+ onchange={filterNameChange} ></lightning-combobox>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={jzsetProductsearchbutton}>鎼滅储</button>
+ </div>
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={additionaljzsetProductbutton}>杩藉姞</button>
+ </div>
+ <!--浜у搧閰嶅鎼滅储妗� -->
+ <!-- 浜у搧閰嶅鍒楄〃 -->
+ <div class="exampleHolder" if:true={IsLoadingjdspt} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table data-parent-id="parent-div-setid" onrowselection={SelectedSetProductFn} name="jzDataSetProductTable" ongettabledata={getTableSetProductData} table-data={jzSetProductData} table-is-loding={tableIsSetProductLoding} options={initDataSetProductTable} ></c-jz-data-table>
+ </div>
+ <!-- 浜у搧閰嶅鍒楄〃 -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelsetProduct}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 鏂板浜у搧閰嶅妯℃�佹 -->
+ <!-- 鏂板Excel瀵煎叆妯℃�佹 -->
+ <div if:true = {showQuoteExcelImport} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-9">
+ <!-- 浜у搧閰嶅鎼滅储妗� -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{ImportText}</div>
+ <div class ="form-group" >
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{Tab_Text}</div>
+ </div>
+ <lightning-textarea class="inputFont" name="exceltext" onchange={exceltextChange} value={exceltextvalue}></lightning-textarea>
+
+ <!--浜у搧閰嶅鎼滅储妗� -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelQuoteExcelImport}>鍏抽棴</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSQuoteExcelImport} >淇濆瓨</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 鏂板Excel瀵煎叆妯℃�佹 -->
+ <!-- 閫夋嫨淇冮攢鏂规妯℃�佹 -->
+ <div if:true = {show} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
+ <!-- 淇冮攢鏂规鎼滅储妗� -->
+ <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchData} options={initSearchForm}></c-jz-search-form>
+ <!-- 淇冮攢鏂规鎼滅储妗� -->
+ <!-- 淇冮攢鏂规鍒楄〃 -->
+ <div class="exampleHolder" if:true={IsLoading6} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFn} data-parent-id="parent-div-id" name="jzDataTable1" ongettabledata={getTableData} table-data={jzData} table-is-loding={tableIsLoding} options={initDataTable} onsave={savejzData} if:true={jzdateflag}></c-jz-data-table>
+ </div>
+ <!-- 淇冮攢鏂规鍒楄〃 -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancel}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨淇冮攢鏂规妯℃�佹 -->
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍兼ā鎬佹 -->
+ <div if:true = {ShowFix} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2">
+ <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataFix} options={initSearchFormFix}></c-jz-search-form>
+ <c-jz-data-table onrowselection={SelectedFnFix} data-parent-id="parent-div-idFix" name="jzDataTableFix" ongettabledata={getTableDataFix} table-data={jzDataFix} table-is-loding={tableIsLodingFix} options={initDataTableFix}></c-jz-data-table>
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelFix}>鍏抽棴</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨涓�鑸骇鍝佸浐瀹氫环鏍兼ā鎬佹 -->
+ <!-- 閫夋嫨鐗圭害鎶樻墸妯℃�佹 -->
+ <div if:true = {ShowSpecial} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <!-- 鐗圭害鎶樻墸妯℃�佹閿欒鎻愮ず -->
+ <div if:true = {ShowSpecialIsError}>
+ <div class="my-icons" role="alert">
+ <span class="slds-assistive-text">error</span>
+ <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed">
+ <svg class="slds-icon slds-icon_x-small" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use>
+ </svg>
+ </span>
+ <h2>{ShowSpecialError}
+ </h2>
+ <div class="slds-notify__close">
+ <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close">
+ <svg class="slds-button__icon" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use>
+ </svg>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ </div>
+ </div>
+ </div>
+ <!-- 鐗圭害鎶樻墸妯℃�佹閿欒鎻愮ず -->
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3">
+ <!-- 鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛� -->
+ <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFnSpecial} data-parent-id="parent-div-idSpecial" name="jzDataTableSpecial" ongettabledata={getTableDataSpecial} table-data={jzDataSpecial} table-is-loding={tableIsLodingSpecial} options={initDataTableSpecial}></c-jz-data-table>
+ </div>
+ <!-- 鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛� -->
+ <!-- 鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛� -->
+ <div class="exampleHolder" if:true={IsLoading5} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <div style="border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFnOtherData} data-parent-id="parent-div-idOtherData" name="jzDataTableOtherData" ongettabledata={getTableDataOtherData} table-data={jzDataOtherData} table-is-loding={tableIsLodingOtherData} options={initDataTableOtherData} onsave={SaveSpecialDiscount} if:true={jzshows5}></c-jz-data-table>
+ </div>
+ <!-- 鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛� -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSpecial}>鍏抽棴</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSpecial} >纭畾</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨鐗圭害鎶樻墸妯℃�佹 -->
+ <!-- 閫夋嫨涓�鑸姌鎵fā鎬佹 -->
+ <div if:true = {ShowCommonly} >
+ <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
+ <div class="slds-modal__container">
+ <!-- 涓�鑸姌鎵fā鎬佹閿欒鎻愮ず -->
+ <div if:true = {ShowCommonlyIsError}>
+ <div class="my-icons" role="alert">
+ <span class="slds-assistive-text">error</span>
+ <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed">
+ <svg class="slds-icon slds-icon_x-small" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use>
+ </svg>
+ </span>
+ <h2>{ShowCommonlyError}
+ <a href="#"></a>
+ </h2>
+ <div class="slds-notify__close">
+ <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close">
+ <svg class="slds-button__icon" aria-hidden="true">
+ <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use>
+ </svg>
+ <span class="slds-assistive-text">Close</span>
+ </button>
+ </div>
+ </div>
+ </div>
+ <!-- 涓�鑸姌鎵fā鎬佹閿欒鎻愮ず -->
+ <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-4">
+ <!-- 浜у搧绯诲垪 -->
+ <div class ="form-group">
+ <div class ="form-group" style=" display: inline-block; margin-right: 20px;margin-bottom: 15px;">
+ <div class="slds-form-element">
+ <label class="slds-form-element__label" for="select-01">浜у搧绯诲垪锛�</label>
+ <div class="slds-form-element__control">
+ <div class="slds-select_container">
+ <select class="slds-select" style="width:150px" onchange={handleChangeLb}>
+ <option value="">閫夋嫨</option>
+ <option>GI鍒嗛噹</option>
+ <option>SP鍒嗛噹</option>
+ <option>ET鍒嗛噹</option>
+ <option>鑳介噺鍒�澶�</option>
+ </select>
+ </div>
+ </div>
+ </div>
+ </div>
+ <!-- 浜у搧绯诲垪 -->
+ <!-- 浣跨敤鎶樻墸 -->
+ <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">
+ <lightning-input type="text" name="input2" label="浣跨敤鎶樻墸锛�" style="width:150px" onblur={handleChangeZk}></lightning-input>
+ </div>
+ <!-- 浣跨敤鎶樻墸 -->
+ </div>
+ <!-- 涓�鑸姌鎵e緟閫変骇鍝佸垪琛� -->
+ <div class="exampleHolder" if:true={IsLoading4} >
+ <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner>
+ </div>
+ <div style="border-top: 1px solid rgb(201, 201, 201);">
+ <c-jz-data-table onrowselection={SelectedFnCommonly} data-parent-id="parent-div-idCommonly" name="jzDataTableCommonly" ongettabledata={getTableDataCommonly} table-data={jzDataCommonly} table-is-loding={tableIsLodingCommonly} options={initDataTableCommonly} onsave={SaveGeneralDiscount} if:true={jzshows4}></c-jz-data-table>
+ </div>
+ <!-- 涓�鑸姌鎵e緟閫変骇鍝佸垪琛� -->
+ </div>
+ <footer class="slds-modal__footer">
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelCommonly}>鍏抽棴</button>
+ <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSaveCommonly}>纭畾</button>
+ </footer>
+ </div>
+ </section>
+ <div class="slds-backdrop slds-backdrop_open"></div>
+ </div>
+ <!-- 閫夋嫨涓�鑸姌鎵fā鎬佹 -->
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js
index 707ee4e..deb308c 100644
--- a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js
+++ b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js
@@ -1,869 +1,3285 @@
-import { LightningElement, track, wire } from 'lwc';
-import jQuery from '@salesforce/resourceUrl/jquery183minjs';
-export default class lexSINewQuoteEntry extends LightningElement {
- renderedCallback() {
- Promise.all([loadScript(this, jQuery)])
- .then(() => {
- // jquery183minjs宸插姞杞芥垚鍔�
- const $ = jQuery.noConflict();
- // 鍙互鍦ㄨ繖閲屼娇鐢╦query
- })
- .catch(error => {
- console.error('Error ====> ', error);
- })
+import { LightningElement,wire,track,api} from 'lwc';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import Quoto_No from '@salesforce/label/c.Quoto_No';
+import Quoto_Name from '@salesforce/label/c.Quoto_Name';
+import HP_Name from '@salesforce/label/c.HP_Name';
+import Department_Name from '@salesforce/label/c.Department_Name';
+import Currency from '@salesforce/label/c.Currency';
+import Total_Price from '@salesforce/label/c.Total_Price';
+import Contact_Price from '@salesforce/label/c.Contact_Price';
+import Forecast_Amounts from '@salesforce/label/c.Forecast_Amounts';
+import Sales_Root from '@salesforce/label/c.Sales_Root';
+import Status_Update from '@salesforce/label/c.Status_Update';
+import Set_Product from '@salesforce/label/c.Set_Product';
+import Excel_Import from '@salesforce/label/c.Excel_Import';
+import deleteLabel from '@salesforce/label/c.deleteLabel';
+import Cost from '@salesforce/label/c.Cost';
+import Calculate from '@salesforce/label/c.Calculate';
+import AdjustAmount from '@salesforce/label/c.AdjustAmount';
+import Quote_Adjustment from '@salesforce/label/c.Quote_Adjustment';
+import Amount from '@salesforce/label/c.Amount';
+import Sales_Profit from '@salesforce/label/c.Sales_Profit';
+import Percent from '@salesforce/label/c.Percent';
+import Sales_Name1 from '@salesforce/label/c.Sales_Name1';
+import Sales_Name2 from '@salesforce/label/c.Sales_Name2';
+import Error_Message33 from '@salesforce/label/c.Error_Message33';
+import Opp_Button from '@salesforce/label/c.Opp_Button';
+import QuoteDecision_Button from '@salesforce/label/c.QuoteDecision_Button';
+import Copy_Detail from '@salesforce/label/c.Copy_Detail';
+import Quote_Print from '@salesforce/label/c.Quote_Print';
+import Detail_Price from '@salesforce/label/c.Detail_Price';
+import Detail_Sum from '@salesforce/label/c.Detail_Sum';
+import Total_Discount_Percent from '@salesforce/label/c.Total_Discount_Percent';
+import Total_Discount_Amount from '@salesforce/label/c.Total_Discount_Amount';
+import Row_Total_Sum from '@salesforce/label/c.Row_Total_Sum';
+import Contract_Breakdown from '@salesforce/label/c.Contract_Breakdown';
+import Print_HPName from '@salesforce/label/c.Print_HPName';
+import Print_Button from '@salesforce/label/c.Print_Button';
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
+import QuoteEntryMaxLine2 from '@salesforce/label/c.QuoteEntryMaxLine2';
+import Sales_Outlet from '@salesforce/label/c.Sales_Outlet';
+import OCM_Direct from '@salesforce/label/c.OCM_Direct';
+import Price_Valid_Period from '@salesforce/label/c.Price_Valid_Period';
+import Message_001 from '@salesforce/label/c.Message_001';
+import ImportText from '@salesforce/label/c.ImportText';
+import Tab_Text from '@salesforce/label/c.Tab_Text';
+import Paste_IE from '@salesforce/label/c.Paste_IE';
+import { CurrentPageReference } from "lightning/navigation";
+import Admin from '@salesforce/label/c.ProfileId_SystemAdmin';
+import Admin2 from '@salesforce/label/c.ProfileId_SystemAdmin2';
+import SI2M3ID from '@salesforce/label/c.SI_2M3_ID';
+import ProfSystAdmin from '@salesforce/label/c.ProfileId_SystemAdmin';
+import selectQuoteById from '@salesforce/apex/lexSINewQuoteEntryController.selectQuoteById';
+import selectQuoteListLineItemCount from '@salesforce/apex/lexSINewQuoteEntryController.selectQuoteListLineItemCount';
+import selectQuoteLineItem from '@salesforce/apex/lexSINewQuoteEntryController.selectQuoteLineItem';
+import selecUser from '@salesforce/apex/lexSINewQuoteEntryController.selecUser';
+import QuotCalfagAss from '@salesforce/apex/lexNewQuoteEntryController.QuotCalfagAss';
+import selectOpportunityById from '@salesforce/apex/lexSINewQuoteEntryController.selectOpportunityById';
+import selectAccountById from '@salesforce/apex/lexSINewQuoteEntryController.selectAccountById';
+import getPicklistValues from '@salesforce/apex/lexSINewQuoteEntryController.getPicklistValues';
+import SaveQuote from '@salesforce/apex/lexSINewQuoteEntryController.SaveQuote';
+import Print from '@salesforce/apex/lexSINewQuoteEntryController.Print';
+import QuoteDecision from '@salesforce/apex/lexSINewQuoteEntryController.QuoteDecision';
+import serContact from '@salesforce/apex/lexSINewQuoteEntryController.serContact'
+import serSetContact from '@salesforce/apex/lexSINewQuoteEntryController.serSetContact'
+import setProductEntry from '@salesforce/apex/lexSINewQuoteEntryController.setProductEntry'
+import excelImport from '@salesforce/apex/lexSINewQuoteEntryController.excelImport'
+import getModulus from '@salesforce/apex/lexSINewQuoteEntryController.getModulus'
+import submitOppoApplyStock from '@salesforce/apex/lexSINewQuoteEntryController.submitOppoApplyStock'
+import QuoteConfirm from '@salesforce/apex/lexSINewQuoteEntryController.QuoteConfirm'
+import selectProById from '@salesforce/apex/lexSINewQuoteEntryController.selectProById'
+import getquoDes from '@salesforce/apex/lexSINewQuoteEntryController.getquoDes'
+import getProduct2 from '@salesforce/apex/NewQuoteEntryWebService.getProduct2';
+import updateOTCodeweb from '@salesforce/apex/NewQuoteEntryWebService.updateOTCode';
+import getQuoteLineItem from '@salesforce/apex/NewQuoteEntryWebService.getQuoteLineItem';
+import Message_Please_Save_Quote from '@salesforce/label/c.Please_Save_Quote';
+import Message_Check_Your_Clipboard from '@salesforce/label/c.Check_Your_Clipboard';
+import SelectAllDataDiscount from '@salesforce/apex/QuoteTrialController.selectAllDataDiscount';
+import GetPromotionDefalut from '@salesforce/apex/QuoteTrialController.GetPromotionDefalut';
+import GetPromotionPromotionSearch from '@salesforce/apex/QuoteTrialController.GetPromotionPromotionSearch';
+import GetNormalProductSearch from '@salesforce/apex/QuoteTrialController.GetNormalProductSearch';
+import GetAuthorizerSearch from '@salesforce/apex/QuoteTrialController.GetAuthorizerSearch';
+import GetSearchProductById from '@salesforce/apex/QuoteTrialController.GetSearchProductById';
+import saveAllDataProduct from '@salesforce/apex/QuoteTrialController.saveAllDataProduct';
+import SelectAllDataProduct from '@salesforce/apex/QuoteTrialController.selectAllDataProduct';
+import GetQuoteData from '@salesforce/apex/QuoteTrialController.GetQuoteData';
+import GetAgencyRName from '@salesforce/apex/QuoteTrialController.GetAgencyRName';
+import selectUpdateFiexedpriceData from '@salesforce/apex/QuoteTrialController.selectUpdateFiexedpriceData';
+import selectUpdateQuoteLineItemData from '@salesforce/apex/QuoteTrialController.selectUpdateQuoteLineItemData';
+import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
+import {localParseInt,toNum,initDataTableToBeproductConfig,saveEvoluationLogic,oppInfosave,quoLineItemsave,filterNameoptionList,initDataSetProductTablefig,quoteTotalPriceActionLogic,CheckForCost,actState,MarkRed,EstimationL,resultFlag,
+toNumComma,localParseFloat,NewQcopyLogic,productCompareLogic,bflag,jzProductsearchLogic,additionaljzProductLogic,initDataProductTablefig,checkNMPA,saveQuotel,CheckForListPrice,calGuranteePeriodLogic,initOpportunityById,enableSalesExp,nafgExp,
+additionabuttonLoc,DataStatus,InitializeProductAssignment,PriceStatusUpdateLogic,newQuoteFlagex,calGuranteeAllFieldsLogic,MultiYearWarrantyTotalPriceExport,newQuoteFlagExp,AlertForCFDA,UnitPriceUpdateLogic,DisAmountfunctionc,enableContractExp,
+PrintCustomerNameoptionsvlue,selection_hpExp,options_hpflgExp,initquoassignment,initquoassignmentcopy,salesProfit1Logic,salesCalculation1Logic,salesProfit2Logic,salesCalculation2Logic,SubtotalupdateLogic,alfExp,IsQuoteTrialExp,displayFlgExp,
+initquocheck,lookMapE,quoteAgencyTotalPriceActionLogic,calPriceAllLogic,QuoteAdjustLogic,quoExp,AgencyDiscountCalculation1Logic,onsaveToBeproductLoc,fagExp,PrintButtonLoc,alertExp,setOCMAmountc,initOpportunityById2,decisionlol,flg,checkch,
+saverebackloc,DisCalculationfunctionLoc,quoteTotalPriceLoc,calUnitPriceTotalLoc,ListPriceTotalExp,unitPriceTotalExp,pageArrangeLoc,openQuotePage,errorflg,StrExp,quoteinit,Savebuttondetermine,submitOppoApplyStockJsLogic,QuoteConfirmJsExp,
+SbuttonExp,sapbuttonExp,pbuttonflgExp,selectQuoteLineExp,initQuoteLineItemcheck,productStatusUpdatedExp,Saleslet} from "./lexSINexQuoteEntryUtil.js";
+import {arrTempsss,arrProductTempsss,initDataTableProduct2,initDataTable2,initSearchForm2,getQueryVariable,ChangeFiexedData,GetUUID,initDataTableDefault2,
+initSearchFormDefalt2,initDataTableFixedPrice2,initDataTableDiscount2,initDataTableSpecial2,initSearchFormFix2,initDataTableFix2,CompareDataL,isChangeExp,
+initDataTableOtherData2,initDataTableCommonly2,ProductAssignmentSelect,ProductSelected,UnselectedScheme,SelectedScheme,commonlyDiscountLogic,ChangeProductData,
+PriceConsolidation,ReplacementUnitPriceLogic,ConsolidatedDiscountDetailsLogic,ConsolidatedDiscountPolicyLogic,QTcssE,initquoT,buttonIsShowE,initDTFP,initDTD,initDTOD,initDTC,
+addOfferLogic,ReverseCalculationModifyDiscountLogic,HeTongPriceComputeLogic,InverseCalculationTiShi,ContractPriceComputeLogic,GeneralDiscountContractSummaryLogic,handleSaveFixedPriceLogic,
+SpecialSavesChangePartLogic,NewDefaultDatass,AddProductDatass,jzDataFixedPriceTemps,jzDataDiscountTemps,updatesNumsLogic,updateCDLogic,DeftCopyQtyLists,
+countListAndNodLogic,jzDataDefaultExp,jzDataProductExp,jzDataFixedPriceExp,jzDataDiscountExp,comparisonUniqueKeyLogic,SearchProductByIdLogic,jzDataDefaultCopyQuantityListExp,AddNumsLogic,CompareFullDataExp,SelectedFnCommonlyLogic,
+ComputeDataPromotionLogic,newArrsTemp3Exp,newArrsTemp4Exp,jzDataDefaultCopyExp,ComputeDataNormalProductLogic,ComputeDiscountAuthorizerLogic,newArrsTempExp,newArrsTemp2Exp,MergeDuplicateSchemesLogic,delectTableDiscountTempLogic,
+handleSaveDiscountLogic,booleanExp,boolean2Exp,boolean3Exp,newDataExp,newData2Exp,newData3Exp,editnewDateExp,GuaranteeDiscount__cZuiXiaoExp,NormalDiscount__cZuiXiaoExp,HeTongTotalExp,SelectedFnDataFixedPriceExp,deleteFixedPriceLogic,
+CompareFullDataTempExp,jzDataDefaultNotChangeExp,DeleteChangesFnLogic,deleteFixedPriceTempLogic,GetSearchProductByIdLogic,iflagExp,getTableDataCommonlyLogic,idsExp,DeleteIsChangelogicExp,DeleteIsChangesFnjiage,falgExp,
+DeleteIsChangesFnzhekou,SaveGeneralDiscountLogic,DeleteSchemeMatchingLogic,savecountLogic,ComparePushDataLogic,newTempExp,saveAllDataProductFnChuanshen,saveAllDataProductFnPanduan,ifnullExp} from "./lexSIquoteTrialUtil.js";
+
+
+
+export default class LexSINewQuoteEntry extends LightningElement {
+ @wire(CurrentPageReference)
+ getStateParameters(currentPageReference) {
+ if (currentPageReference) {
+ const urlValue = currentPageReference.state.fragment;
+ if (urlValue) {
+ this.location = urlValue;
+ }
+ }
+ }
+ location = '';
+ @track
+ pricePolicyflag1 = false;
+ @track
+ ImportText = ImportText;
+ @track
+ Tab_Text = Tab_Text;
+ @track
+ Paste_IE = Paste_IE;
+ @track
+ QuotoNo = Quoto_No;
+ @track
+ QuotoName = Quoto_Name;
+ @track
+ HPName = HP_Name;
+ @track
+ DepartmentName = Department_Name;
+ @track
+ Currency = Currency;
+ @track
+ TotalPrice = Total_Price;
+ @track
+ ContactPrice = Contact_Price;
+ @track
+ ForecastAmounts = Forecast_Amounts;
+ @track
+ SalesRoot = Sales_Root;
+ @track
+ StatusUpdate = Status_Update;
+ @track
+ SetProduct = Set_Product;
+ @track
+ ExcelImport = Excel_Import;
+ @track
+ deleteLabel = deleteLabel;
+ @track
+ Cost = Cost;
+ @track
+ Calculate = Calculate;
+ @track
+ AdjustAmount = AdjustAmount;
+ @track
+ QuoteAdjustment = Quote_Adjustment;
+ @track
+ Amount = Amount;
+ @track
+ SalesProfit = Sales_Profit;
+ @track
+ Percent = Percent;
+ @track
+ SalesName1 = Sales_Name1;
+ @track
+ Sales_Name2 = Sales_Name2;
+ @track
+ Opp_Button = Opp_Button;
+ @track
+ QuoteDecision_Button = QuoteDecision_Button;
+ @track
+ Copy_Detail = Copy_Detail;
+
+ @track
+ Quote_Print = Quote_Print;
+ @track
+ Detail_Price = Detail_Price;
+ @track
+ Detail_Sum = Detail_Sum;
+ @track
+ Total_Discount_Percent = Total_Discount_Percent;
+ @track
+ Total_Discount_Amount = Total_Discount_Amount;
+ @track
+ Row_Total_Sum = Row_Total_Sum;
+ @track
+ Contract_Breakdown = Contract_Breakdown;
+ @track
+ Print_HPName = Print_HPName;
+ @track
+ Print_Button = Print_Button;
+ @track
+ QuotCalfag = false;
+
+ quoteEntryMaxLine = QuoteEntryMaxLine2;
+ // 鍏ㄥ眬鍔犺浇鏍囪瘑 start
+ @track
+ IsLoading = false;
+ OnLoading(flag) {
+ this.IsLoading = flag;
+ }
+ // 鍏ㄥ眬鍔犺浇鏍囪瘑 end
+
+ //椤甸潰鍒濆鍖栨柟娉�
+ //鍒濆鍖栨椂璋冪敤
+ stylesLoaded = false;
+ renderedCallback(){
+ if (!this.stylesLoaded) {
+ Promise.all([loadStyle(this, WrappedHeaderTable)])
+ .then(() => {
+ this.stylesLoaded = true;
+ })
+ .catch((error) => {
+ });
+ }
+ Promise.all([
+ loadStyle(this, lwcCSS)
+ ]);
+ }
+ //鎶ヤ环瀵硅薄
+ @track
+ quo = {Installation_location__c:'',QuotationChange__c:''};
+ //璇环瀵硅薄
+ @track
+ oppInfo ={};
+ //鑷畾涔夌粨鏋�
+ @track
+ qb = {};
+ @track
+ hidden = false;
+ //鎴愭湰
+ hidden_Stocking_Price = '';
+ //璇环Id
+ oppId = '';
+ //鎶ヤ环Id
+ quoId = '';
+ //鏄惁璺宠繃鎶ヤ环璁$畻鏍囪瘑
+ SkipQuotefilg = false;
+ //澶嶅埗鎶ヤ环Id
+ copyid = '';
+ //鍐呭璐�
+ trade = '';
+ //鐩撮攢缁忛攢鍟嗘爣璇�
+ enableSales;
+ //鍒ゆ柇鐗规畩缁忛攢鍟嗕环鏍兼樉绀烘潈闄愭爣璇�
+ displayFlg;
+ //鐗规畩缁忛攢鍟嗕环鏍兼樉绀烘潈闄�
+ viewSpecialAgencyAmout
+ //褰撳墠鐧诲綍鐢ㄦ埛
+ User;
+ //鎶ヤ环淇敼鏉冮檺鏍囪瘑
+ verified;
+ //涓婁紶璁㈠崟鏉冮檺鏍囪瘑
+ specialAuthority;
+ //璇环浜у搧鎴愭湰鍙傜収鏉冮檺鏍囪瘑
+ displayCost;
+ //init鏌ヨ璇环鐩稿叧鏍囪瘑 start
+ QuoteDecision;
+ QuoteDecide;
+ QuoteSapSented;
+ QuoteCorrect;
+ @track
+ enableContract;
+ productStatusUpdated =false;
+ //鍚堝悓淇濅慨鏈燂紙骞达級鍏ㄥ眬
+ quoteGurantee_Period;
+ //鍙栨秷甯傚満澶氬勾淇濅慨鍏ㄥ眬
+ quotemultiYearWarranty;
+ //缁忛攢鍟嗗垵濮嬪寲鏃跺浠� start
+ agency1Name;
+ agency2Name;
+ //缁忛攢鍟嗗垵濮嬪寲鏃跺浠� end
+ //鏁版嵁鏄惁鍙戠敓鍙樺寲鏍囪瘑
+ newQuoteFlag = false;
+ //鐘舵�佹洿鏂�
+ productStatusUpdated = false;
+ //鏌ヨ璇环鑾峰彇瀹㈡埛Id
+ accountid;
+ //鎵撳嵃鏍囪瘑
+ print_buttonflg = false;
+ //decide鎸夐挳鏍囪瘑
+ Decision_button = false;
+ sap_button;
+ //save鍜宒ecide鎸夐挳鏍囪瘑
+ Save_button = false;
+ Decisiontag = false;
+ //缁忛攢鍟嗕竴鍒╂鼎鏄剧ず
+ Salesprofit1value;
+ //缁忛攢鍟嗕簩鍒╂鼎鏄剧ず
+ Salesprofit2value;
+ //缁忛攢鍟嗕竴鐧惧垎姣旀樉绀�
+ SalesCalculation1value
+ //缁忛攢鍟嗕簩鐧惧垎姣旀樉绀�
+ SalesCalculation2value
+ //闅愯棌澶氬勾淇濅慨浠锋牸鍚堣
+ hidden_MultiYearWarrantyTotalPrice
+ //缁忛攢鍟嗘姌鎵�
+ WinOrDecideAlert;
+ //澶囦唤鍒濆鍖栨椂鐨勬姤浠疯椤圭洰
+ CheckItem;
+ Save_button1 = 0;
+ CSVflag = true;
+ UnConfirmQuote = false;
+ //鍒濆鍖栨柟娉�
+ ifquocom = false;
+ acts = false;
+ actL = [];
+ connectedCallback() {
+ this.tobeflag = false;
+ this.quoteEntryMaxLine = Number(this.quoteEntryMaxLine);
+ debugger
+ this.SkipQuotefilg = false;
+ var quoteflg = true;
+ this.displayFlg = true;
+ this.WinOrDecideAlert = false;
+ this.OnLoading(true);
+ if(this.quoId == ''){
+ this.quoId = getQueryVariable('Id',this.location);
+ this.CSVflag = this.quoId?false:true;
+ }
+ if(this.copyid == ''){
+ this.copyid = getQueryVariable('copyid',this.location);
+ }
+ if(this.oppId == ''){
+ this.oppId = getQueryVariable('oppid',this.location);
+ }
+ this.nafg = resultFlag(this.nafg,'');
+ QuotCalfagAss().then(r=>{
+ this.QuotCalfag = r;
+ });
+ selectQuoteListLineItemCount({quoId:this.quoId,oppId:this.oppId,copyid:this.copyid}).then(quoteByopp=>{
+ debugger
+ if(this.oppId){
+ if(this.copyid){
+ this.quoId = this.copyid;
+ this.CSVflag = this.quoId?false:true;
+ }
+ }
+ if(quoteByopp.length > 0){
+ if (!this.oppId) {
+ this.oppId = quoteByopp[0].OpportunityId;
+ }
+ }
+ selecUser().then(Userobj=>{
+ this.User = Userobj;
+ console.warn('aa '+ Userobj.length);
+ if(JSON.stringify(Userobj) != "{}"){
+ this.verified =this.User.Quote_Correct__c;
+ this.specialAuthority = this.User.Quote_Special_Operation__c;
+ this.displayCost = this.User.Cost_Referable__c;
+ this.viewSpecialAgencyAmout = this.User.ViewSpecialAgencyAmout__c;
+ }
+ selectOpportunityById({oppId:this.oppId}).then(oppobj=>{
+ debugger
+ this.oppInfo = oppobj;
+ var oppvalue = JSON.stringify(oppobj);
+ getModulus({oppInfoc:oppvalue}).then(rtn=>{
+ this.oppInfo.rate_hospital = rtn.rate_hospital;
+ this.oppInfo.rate_agency1 = rtn.rate_agency1;
+ });
+ this.trade = '澶栬部';
+ if(JSON.stringify(oppobj) != "{}"){
+ this.trade = oppobj.Trade__c;
+ this.QuoteDecision = oppobj.Estimation_Decision__c;
+ this.QuoteDecide = this.QuoteDecision;
+ this.QuoteSapSented = oppobj.SAP_Send_OK__c;
+ this.QuoteCorrect = oppobj.New_Opportunity__c;
+ this.enableSales = false;
+ this.accountid = this.oppInfo.AccountId;
+ this.oppInfo = initOpportunityById(this.oppInfo,oppobj,this.enableSales,this.QuoteDecision,this.enableContract,this.displayFlg,this.viewSpecialAgencyAmout,Sales_Outlet,OCM_Direct);
+ this.enableSales = enableSalesExp;
+ this.enableContract = enableContractExp;
+ this.displayFlg = displayFlgExp;
+ }
+ this.Decision_button = initOpportunityById2(this.QuoteCorrect,this.User,this.QuoteDecision,this.QuoteSapSented,this.print_buttonflg,this.sap_button,this.Decision_button,this.Save_button);
+ this.Save_button = SbuttonExp;
+ if(SbuttonExp){
+ this.Decisiontag = true;
+ var lg = this.template.querySelectorAll('c-jzlookuplightning2');
+ lg.forEach(l=>{
+ l.todisabled();
+ })
+ }else{
+ this.Decisiontag = false;
+ this.initDataTableToBeproduct.columns[4].editable = true;
+ }
+ this.sap_button = sapbuttonExp;
+ this.print_buttonflg = pbuttonflgExp;
+ this.Save_button1 = Savebuttondetermine(this.oppInfo,this.Save_button1);
+ this.tobeflag = true;
+ this.OnLoading(false);
+ });
+ });
+ getquoDes().then(it=>{
+ if(this.quoId !=''){
+ selectQuoteById({quoId:this.quoId}).then(quote=>{
+ debugger
+ this.quo=quote;
+ selectQuoteLineItem({quoId:this.quoId,copyid:this.copyid}).then(result=>{
+ debugger
+ var tempArr = result.split("---");
+ var quoteLineItem = JSON.parse(tempArr[0]);
+ this.CheckItem = JSON.parse(tempArr[1]);
+ if(JSON.stringify(quote) != "{}"){
+ debugger
+ if(this.copyid == ''){
+ this.quo = initquoassignment(quote,this.quo,it);
+ this.hidden = this.quo.rtn;
+ this.quoteGurantee_Period = quote.Gurantee_Period__c;
+ this.quotemultiYearWarranty = quote.multiYearWarranty__c;
+ this.agency1Name = quote.Agency1__c;
+ this.agency2Name = quote.Agency2__c;
+ this.Salesprofit1value = quote.Agency1_Profit__c;
+ this.Salesprofit2value = quote.Agency2_Profit__c;
+ this.SalesCalculation1value = quote.Agency1_Profit_Rate__c;
+ this.SalesCalculation2value = quote.Agency2_Profit_Rate__c;
+ this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c;
+ this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c);
+ this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c);
+ }else{
+ this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c;
+ this.quo = initquoassignmentcopy(quote,this.quo,it);
+ this.hidden = this.quo.rtn;
+ this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c);
+ this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c);
+
+ }
+ }
+ var product2Ids = initquocheck(quoteLineItem,this.CheckItem);
+ var loopMap = lookMapE;
+ if(this.CheckItem.length>0){
+ var proList = JSON.stringify(product2Ids);
+ selectProById({proList:proList}).then(plo=>{
+ if(plo.length>0){
+ plo.forEach(prd2=>{
+ if(prd2.SFDA_Status__c != loopMap.get(prd2.Id)){
+ this.WinOrDecideAlert = true;
+ }
+ });
+ }
+ if(quoteLineItem.length > 0 && !this.QuoteDecision){
+ this.productStatusUpdated = false;
+ quoteLineItem = initQuoteLineItemcheck(quoteLineItem,this.productStatusUpdated);
+ this.newQuoteFlag = newQuoteFlagExp;
+ this.productStatusUpdated = productStatusUpdatedExp;
+ }
+ if(JSON.stringify(quoteLineItem) != "{}"){
+ quoteLineItem = InitializeProductAssignment(quoteLineItem);
+ if(this.acts){
+ quoteLineItem = actState(this.actL,quoteLineItem);
+ }
+ this.jzDataToBeproduct =[].concat(quoteLineItem);
+ }
+ this.EstimationListPrice();
+ this.calUnitPriceTotal();
+ this.quoteTotalPrice();
+ this.setOCMAmount();
+ this.checkProductStatusValidPeriod();
+ setTimeout(() => {
+ debugger
+ if(this.WinOrDecideAlert){
+ this.Alert('浜у搧鐘舵�佸彂鐢熷彉鍖栥��','warning');
+ }
+ }, 1000);
+ this.calGuranteeAllFields();
+ this.OnLoading(false);
+ var IsQuoteTrial =this.quo.IsQuoteTrial__c;
+ this.ifquocom = IsQuoteTrial;
+ debugger
+ if(this.copyid){
+ this.quoId = '';
+ this.SkipQuotefilg = true;
+ }else{
+ debugger
+ this.UnConfirmQuote = selectQuoteLineExp(quote,this.User,SI2M3ID,ProfSystAdmin,this.UnConfirmQuote);
+ this.quo = quoExp;
+ if(alertExp){
+ this.Alert(alertExp,'error');
+ }
+ }
+ });
+ }
+ });
+ this.quo = quoteinit(this.quo);
+ this.HiddenGurantee_Period = this.quo.Gurantee_Period__c;
+ });
+ }else{
+ this.quo = quoteinit(this.quo);
+ this.HiddenGurantee_Period = this.quo.Gurantee_Period__c;
+ this.quo.multiYearWarranty__c = false;
+ this.pageArrange();
+ this.hidden = it;
+ }
+ });
+ });
+
+ //Add Jz - kkbes 20231019 Start
+ const inputAlignright = document.createElement('style');
+ inputAlignright .innerText = `.input-text-align_right input{ text-align: right!important; }`;
+ document.body.appendChild(inputAlignright);
+ //Add Jz - kkbes 20231019 End
}
- // //const duration = document.getElementById('dur');
- // //娣诲姞琛� html鐗规�у鍔犳粦鍔ㄦ潯 绮剧悽鎶�鏈� wql 2021/02/09 start
- // //dialog 寮圭獥 start
- // var popupBox;
- // popupBox = new SimpleDialog("SpeedDialogId", false); // 涓嶅彲鎷栧姩
- // popupBox.createDialog();
- // //绮剧悽鎶�鏈� 2021/02/08 start
- // function openAddMultipleRow(){
- // popupBox.setTitle("璇疯緭鍏ラ渶瑕佸鍔犵殑琛屽彿锛�");
- // popupBox.importContentNode(document.getElementById("speedDiv"));
- // popupBox.show(document.getElementById("speedDiv"));
- // document.getElementById("speedDiv").style.display = 'block';
-
- // }
- // //dialog 寮圭獥 end
- // // 娣诲姞琛� html鐗规�у鍔犳粦鍔ㄦ潯 绮剧悽鎶�鏈� wql 2021/02/09 end
+ pageArrange(){
+ this.quo = pageArrangeLoc(this.quo);
+ }
+
+ calPriceAll() {
+ debugger
+ this.calGuranteeAllFields();
+ this.jzDataToBeproduct = calPriceAllLogic(this.jzDataToBeproduct);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.EstimationListPrice();
+ this.calUnitPriceTotal();
+ this.quoteTotalPrice();
+ this.quoteAgencyTotalPriceAction();
+ this.AgencyDiscountCalculation1();
+ }
+ //
+ calGuranteeAllFields() {
+ this.jzDataToBeproduct = calGuranteeAllFieldsLogic(this.jzDataToBeproduct,this.quo);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.hidden_MultiYearWarrantyTotalPrice = MultiYearWarrantyTotalPriceExport;
+ this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(MultiYearWarrantyTotalPriceExport);
+ }
+ EstimationListPrice() {
+ this.jzDataToBeproduct = EstimationL(this.jzDataToBeproduct,this.quo);
+ this.quo = quoExp;
+ }
+
+ ListPriceTotalhidden = 0;
+ UnitPriceTotalhidden = 0;
+ calUnitPriceTotal() {
+ this.jzDataToBeproduct = calUnitPriceTotalLoc(this.jzDataToBeproduct);
+ this.ListPriceTotalhidden = ListPriceTotalExp;
+ this.UnitPriceTotalhidden = unitPriceTotalExp;
+ }
+
+ quoteTotalPrice() {
+ var result = quoteTotalPriceLoc(this.jzDataToBeproduct,this.quo,this.quoId,this.oppInfo,Saleslet);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(result);
+ var id = this.quoId;
+ if(!id){
+ var IsQuoteTrial =this.quo.IsQuoteTrial__c;
+ if(!IsQuoteTrial){
+ this.setOCMAmount();
+ this.calFromContactPrice();
+ }
+ }
+ this.DisAmountfunction();
+ this.QuoteAdjust();
+ this.salesProfit2();
+ this.setCostTatal();
+ }
+ setOCMAmount() {
+ debugger
+ this.oppInfo = setOCMAmountc(this.enableSales,this.quo,this.oppInfo);
+ this.quo = quoExp;
+ }
+ /*
+ 鍖婚櫌鐨勫悎鍚岄噾棰� 鏍煎紡鍖栦负 甯﹀垎浣嶇鐨勫瓧娈�;
+ */
+ calFromContactPrice() {
+ var x = 0;
+ x = this.quo.Dealer_Final_Price_Page__c;
+ x = localParseFloat(x);
+ this.quo.Dealer_Final_Price_Page__c = toNumComma(x);
+ this.DisAmountfunction();
+ this.salesProfit1();
+ this.salesProfit2();
+ this.setCostTatal();
+ }
+
+ DisAmountfunction() {
+ this.quo = DisAmountfunctionc(this.quo);
+ this.DisCalculationfunction();
+ }
+
+ DisCalculationfunction() {
+ this.quo = DisCalculationfunctionLoc(this.quo);
+ }
+ salesProfit1() {
+ this.Salesprofit1value = salesProfit1Logic(this.quo,this.Salesprofit1value);
+ this.quo = quoExp;
+ this.salesCalculation1();
+ }
+ salesCalculation1() {
+ this.SalesCalculation1value = salesCalculation1Logic(this.quo,this.Salesprofit1value,this.SalesCalculation1value);
+ this.quo = quoExp;
+ }
+ salesProfit2() {
+ this.Salesprofit2value = salesProfit2Logic(this.quo,this.Salesprofit2value);
+ this.quo = quoExp;
+ this.salesCalculation2();
+ this.salesProfit1();
+ }
+
+ salesCalculation2() {
+ this.SalesCalculation2value = salesCalculation2Logic(this.quo,this.Salesprofit2value,this.SalesCalculation2value)
+ this.quo = quoExp;
+ }
+ setCostTatal() {
+ var z = 0;
+ this.jzDataToBeproduct.forEach(jzdtbt=>{
+ var s = 0;
+ s = localParseFloat(jzdtbt.Cost_Subtotal_c);
+ if (!isNaN(s)) {
+ z = z + s;
+ }
+ });
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.hidden_Stocking_Price = toNum(z);
+ if (this.displayCost) {
+ this.quo.Stocking_Price__c = toNumComma(z);
+ }
+ }
+ QuoteAdjust() {
+ this.jzDataToBeproduct = QuoteAdjustLogic(this.jzDataToBeproduct,this.quo,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+
+ quoteAgencyTotalPriceAction() {
+ this.jzDataToBeproduct = quoteAgencyTotalPriceActionLogic(this.jzDataToBeproduct,this.quo,this.oppInfo,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+ AgencyDiscountCalculation1() {
+ this.jzDataToBeproduct = AgencyDiscountCalculation1Logic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+ Confirm_PriceRefresh = '鎶ヤ环浣滄垚鍚�'+Price_Valid_Period+'澶�,杩樻病鏈夋洿鏂拌繃浠锋牸锛岄渶瑕佹墽琛�'+Status_Update+'锛�';
+ checkProductStatusValidPeriod() {
+ debugger
+ var period = this.quo.PriceRefreshPeriod;
+ if (parseInt(period) > parseInt(Price_Valid_Period) && this.QuoteDecide != true) {
+ if (confirm(this.Confirm_PriceRefresh)) {
+ this.productCompare();
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return true;
+ }
+ productCompare() {
+ try {
+ var returnflg;
+ var b = true;
+ var t = this.trade;
+ var ids = new Array();
+ this.jzDataToBeproduct.forEach(jzdtbt=>{
+ var id =jzdtbt.pageObject.Id__c;
+ if (id != '') {
+ ids.push(jzdtbt.pageObject.Id__c);
+ }
+ });
+ getProduct2({ids:ids}).then(results=>{
+ debugger
+ var id2Product = new Object();
+ for (var j = 0; j < results.length; j++) {
+ id2Product[results[j].Id] = results[j];
+ }
+ var reslut = productCompareLogic(this.jzDataToBeproduct,id2Product,t,b);
+ b = bflag;
+ this.jzDataToBeproduct =[].concat(reslut);
+ if (b == false) {
+ if (window.confirm(Message_001)) {
+ this.PriceStatusUpdate();
+ this.OnLoading(false);
+ this.calPriceAll();
+ this.quoteAgencyTotalPriceAction()
+ this.productStatusUpdated = true;
+ this.WinOrDecideAlert = false;
+ returnflg = true;
+ } else {
+ returnflg = false;
+ }
+ } else {
+ this.Alert("浠锋牸鐘舵�佹病鏈夊彉鍖栥��",'warning');
+ this.productStatusUpdated = true;
+ returnflg = false;
+ }
+ });
+ return returnflg;
+ } catch (e) {
+ this.Alert(e,'error');
+ }
- // var QuoteEntryMaxLine = {!QuoteEntryMaxLine};
- // var trade = '{!oppInfo.Trade}';
- // var displayCost = '{!displayCost}';
- // var quoid = '{!quoid}';
- // var Session_ID = '{!$Api.Session_ID}';
- // var Price_Valid_Period = '{!$Label.Price_Valid_Period}';
- // var Message_001 = '{!$Label.Message_001}';
- // var Message_Please_Save_Quote = '{!$Label.Please_Save_Quote}';
- // var Message_Check_Your_Clipboard = '{!$Label.Check_Your_Clipboard}';
- // var Error_Message3 = '{!$Label.Error_Message3}';
- // var Error_Message11 = '{!$Label.Error_Message11}';
- // var Error_Message29 = '{!$Label.Error_Message29}';
- // var Error_Message33 = '{!$Label.Error_Message33}';
- // var Error_Message34 = '{!$Label.Error_Message34}';
- // var Error_Message35 = '{!$Label.Error_Message35}';
- // var Error_Message36 = '{!$Label.Error_Message36}';
- // var Error_Message40 = '{!$Label.Error_Message40}';
- // var Confirm_ChangedAfterPrint = '鎵撳嵃鍚庤淇℃伅鏈夊彉鍖栵紝鏄惁缁х画鎿嶄綔锛堟姤浠风紪鐮佷細鍙樻柊锛夛紵';
- // var Confirm_ChangedAfterBid = '璇ユ姤浠峰凡鎴愪负false浼犵エ锛屾槸鍚︾户缁搷浣滐紙灏嗕細鍋氬嚭涓�涓柊鐨勬姤浠凤級锛�';
- // var Confirm_PriceRefresh = '鎶ヤ环浣滄垚鍚巤!$Label.Price_Valid_Period}澶�,杩樻病鏈夋洿鏂拌繃浠锋牸锛岄渶瑕佹墽琛寋!$Label.Status_Update}锛�';
- // window.sfdcPage.appendToOnloadQueue(function() { calonLoad() });
- // var openQuoteExcelImportWindow = null;
-
- // function selectAll() {
- // var checklist = j$("input[name='checklist']");
- // var all = j$(escapeVfId("checkAll"));
- // for(var i = 0; i < checklist.length; i++){
- // if (all[0].checked == true) {
- // checklist[i].checked = true;
- // } else {
- // checklist[i].checked = false;
- // }
- // }
- // }
- // // xudan 20140627 鍓婇櫎寰屻伄銉併偋銉冦偗澶栥仚銉偢銉冦偗
- // function clearAllCheck() {
- // j$(escapeVfId("checkAll"))[0].checked = false;
- // var checklist = j$("input[name='checklist']");
- // for(var i = 0; i < checklist.length; i++){
- // checklist[i].checked = false;
- // }
- // }
- // // 鎶ヤ环璇曠畻
- // function JumpJs() {
- // // console.log(ApexPages.currentPage().getParameters().get('core.apexpages.request.devconsole'));
- // // var t = '{!quoId}';
- // // window.open('/apex/test02?Id=' + t);
- // blockme();
- // Jump.call();
- // return true;
- // }
- // function DownloadCsvGet(){
- // DownloadCsv();
- // }
- // function DownloadCsvJs(){
- // var a = j$(escapeVfId("Page:mainForm:oppoidforCSV")).val();
- // var b = '{!oppId}';
- // //window.open('/apex/SI_CsvModel?'+(a==''?'':'id='+a)+'&'+(a==''?'':'oppId='+b)+'','name','features','replace');
- // window.open('/apex/SI_CsvModel?id='+encodeURI(a),'name','features','replace');
- // }
- // function QuoteConfirmJs() {
- // debugger
- // // body...
- // blockme();
- // //SWAG-C5DBAL 銆愬鎵樸�� [绱ф�SI璇环鑲栧瘨鏃犳硶淇敼鎶ヤ环鍗� 绮剧悽鎶�鏈� 2021/07/30 start
- // //鑾峰彇褰撳墠鐧诲綍浜虹畝妗�
- // var profileId = '{!$User.profileId}';
- // //鑾峰彇鑷畾涔夋爣绛� 绯荤粺绠$悊鍛樼畝妗�
- // var adminId = '{!$Label.ProfileId_SystemAdmin}';
- // //XLIU-CHRD8P銆愬鎵樸�戙�怬BSAP銆戣缁橭BSAP绠�妗BA2_璇环绠$悊 SI璇环鎶ヤ环鍗曠‘璁ゆ潈闄� fy start
- // var adminId2 = '{!$Label.ProfileId_SystemAdmin2}';
- // var flag=true;
- // var profileId15=profileId;
- // if(profileId&&profileId.length>15){
- // profileId15=profileId.substring(0,15);
- // }
- // if(adminId2.includes(profileId15)){
- // flag=false;
- // }else{
- // flag=true;
- // }
- // //XLIU-CHRD8P銆愬鎵樸�戙�怬BSAP銆戣缁橭BSAP绠�妗BA2_璇环绠$悊 SI璇环鎶ヤ环鍗曠‘璁ゆ潈闄� fy end
- // //鍙湁绯荤粺绠$悊鍛樺彲浠ョ偣鍑�
- // if(profileId!=adminId&&flag){
- // alert('鍙湁绯荤粺绠$悊鍛樺拰钀ヤ笟鍔╃悊鏈夋潈闄愮‘璁ゆ姤浠凤紒');
- // unblockUI();
- // }else{
- // QuoteConfirm();
- // }
- // //SWAG-C5DBAL 銆愬鎵樸�� [绱ф�SI璇环鑲栧瘨鏃犳硶淇敼鎶ヤ环鍗� 绮剧悽鎶�鏈� 2021/07/30 end
- // // QuoteConfirm();
- // }
- // function ReloadPage() {
- // // body...
- // window.location.reload();
- // }
- // function submitOppoApplyStockJs(){
- // // SI璇环淇敼 update by vivek start 20191129
- // var Save_button1 = '{!Save_button1}';
- // console.log(Save_button1);
- // if(Save_button1 == '111'){
- // alert('1銆佽仈绯籗I鏈儴鍋氶厤缃缓璁�俓n2銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛�俓n3銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��');
- // }else if(Save_button1 == '211'){
- // alert('1銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛�俓n2銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��');
- // }else if(Save_button1 == '221'){
- // alert('1銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��');
- // }else if(Save_button1 == '1'){
- // alert('1銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��');
- // }else if(Save_button1 == '112'){
- // alert('1銆佽仈绯籗I鏈儴鍋氶厤缃缓璁�俓n2銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛��');
- // }else if(Save_button1 == '212'){
- // alert('1銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛��');
- // }else{
- // blockme();
- // submitOppoApplyStock();
- // }
- // // SI璇环淇敼 update by vivek end 20191129
- // // blockme();
- // // submitOppoApplyStock();
- // }
- // // SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek start
- // function IfRadioChecker2(){
- // var msg = "涓嶈兘鍒犻櫎锛屽鏋滃垹闄ゅ彲鑳藉奖鍝嶈澶囧畨瑁呫�俓n\n璇风‘璁わ紒";
- // if(confirm(msg)==true){
- // radioChecker2('del');
- // }
- // }
- // // SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek end
+ }
+ //鏇挎崲浜у搧otcode
+ updateOtcode() {
+ this.OnLoading(true);
+ var id = this.quoId;
+ var nmpa = checkNMPA(this.jzDataToBeproduct);
+ if (nmpa) {
+ updateOTCodeweb({tempQuoId: id}).then(results=>{
+ if (results) {
+ this.Alert('浜у搧otcode鏇挎崲瀹屾垚锛�','success');
+ window.location.reload();
+ } else {
+ this.Alert('浜у搧otcode鏇挎崲澶辫触锛岃鑱旂郴绠$悊鍛橈紒','error');
+ }
+ this.OnLoading(false);
+ });
+ } else {
+ this.OnLoading(false);
+ this.Alert('鎶ヤ环琛岄」鐩病鏈塏MPA鐘舵�佷负鍋滄鐨勪骇鍝侊紝鏃犳硶鏇挎崲锛�','error');
+ }
+ }
+ PriceStatusUpdate(){
+ this.setOppFromOppInfo();
+ //鍏ㄤ欢娲椼亜鏇裤亪銇椼伨銇欍��
+ if (this.jzDataToBeproduct.length > 0) {
+ this.jzDataToBeproduct = PriceStatusUpdateLogic(this.jzDataToBeproduct,this.newQuoteFlag);
+ this.newQuoteFlag = newQuoteFlagex;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.productStatusUpdated = true;
+ }
+ this.pageArrange();
+ this.calPriceAll();
+ this.Alert('鏇存柊瀹屾瘯锛�','success');
+ }
+ //
+ setOppFromOppInfo() {
+ this.oppInfo.Agency1__c = this.quo.Agency1__c;
+ this.oppInfo.Agency2__c = this.quo.Agency2__c;
+ }
+
+ quoteAgencyTotalPriceAction1(str) {
+ var Sales_Root = this.oppInfo.Sales_Root__c;
+ Sales_Root = Sales_Root + '';
+ Sales_Root = Sales_Root.replace(/\s+/g, "");
+ if (str == Sales_Root) {
+ this.quoteAgencyTotalPriceAction();
+ }
+ }
+ //鎶ヤ环鍚嶇О璧嬪��
+ QuoteNameAssignment(event){
+ this.quo.QuoteName__c = event.target.value;
+ }
+ //鏈�缁堝鎴锋垚浜や环Change浜嬩欢
+ DealerFinalPricePageChange(event){
+ this.quo.Dealer_Final_Price_Page__c = event.target.value;
+ debugger
+ this.calFromContactPrice();
+ this.setOCMAmount();
+ this.quoteAgencyTotalPriceAction1('OCM鐩存帴閿�鍞�');
+ }
+ //璁$畻锛呯殑change
+ QuoteAdjustCalculateChange(event){
+ if(this.quo.Quote_Adjust_Calculate__c !== event.target.value){
+ this.quo.Quote_Adjust_Calculate__c = event.target.value;
+ this.UnitPriceUpdate();
+ event.target.value = this.quo.Quote_Adjust_Calculate__c;
+ }
+ }
+ //璋冩暣閲戦鐨刢hange
+ QuoteAdjustAmountPageChange(event){
+ if(this.quo.Quote_Adjust_Amount_Page__c !== event.target.value){
+ this.quo.Quote_Adjust_Amount_Page__c = event.target.value;
+ this.calFromQuoAmont()
+ }
+ }
+ //缁忛攢鍟嗕竴鍚堝悓閲戦change
+ OCMAgent1PricePageonChange(event){
+ this.quo.OCM_Agent1_Price_Page__c = event.target.value;
+ this.salesProfit1();
+ this.setOCMAmount();
+ this.quoteAgencyTotalPriceAction1('缁忛攢鍟�');
+ this.AgencyDiscountCalculation1();
+ }
+ //缁忛攢鍟嗕簩鍚堝悓閲戦change
+ Agent1Agent2PricePageChange(event){
+ this.quo.Agent1_Agent2_Price_Page__c = event.target.value;
+ this.salesProfit2();
+ }
+ //澶嶅埗鎸夐挳change
+ copyToClipboardNewQuoteEntry() {
+ var QuoteId = this.quoId;
+ if (QuoteId == null || QuoteId == '') {
+ this.Alert(Message_Please_Save_Quote,'error');
+ return null;
+ }
+ var records;
+ var x;
+ var targetString = 'No.\t缂栫爜\t鐘舵�乗t鍚嶇О\tListPrice\t鏁伴噺\t瑙勬牸\t鍖婚櫌鍗曚环\t鍖婚櫌灏忚\t璧犻�乗t缁忛攢鍟嗗崟浠穃t缁忛攢鍟嗗皬璁�';
+ targetString += '\t澶氬勾淇濅慨\t淇濅慨\tNoDiscount灏忚';
+ targetString += '\t淇濅慨鏈焅t閫氳揣';
+ try {
+ getQuoteLineItem({
+ quoId: QuoteId
+ }).then(reslut=>{
+ NewQcopyLogic(Message_Check_Your_Clipboard,records,x,targetString,reslut,this.displayCost,this.oppInfo.CurrencyIsoCode);
+ if(alfExp){
+ this.Alert(alertExp,'success');
+ }else{
+ this.Alert(alertExp,'error');
+ }
+ });
+ } catch (e) {
+ this.Alert(e.faultcode + ',' + e.faultstring,'error');
+ }
+ }
+ @track
+ nafg={};
+ //淇濆瓨鎶ヤ环鎸夐挳
+ savebuttonClick(){
+ this.OnLoading(true);
+ this.checkchangedAfterPrint('sa');
+ if(this.fg){
+ this.sal();
+ }
+ }
+ sal(){
+ debugger
+ this.tobeflag=false;
+ var shut = AlertForCFDA(this.jzDataToBeproduct);
+ if (shut == true) {
+ this.Alert('鎻愮ず锛氬寘鍚噸鏂扮敵璇稢FDA鐨勪骇鍝侊紝涓嶅彲杩涜璁㈣揣銆�','error');
+ }
+ var cost = CheckForCost(this.jzDataToBeproduct);
+ if (cost) {
+ this.Alert('浜у搧鎴愭湰涓虹┖鏃朵笉鍙姤浠�!','error');
+ this.OnLoading(false);
+ this.tobeflag=true;
+ } else {
+ var er = '';
+ var listPrice = CheckForListPrice(this.jzDataToBeproduct);
+ if (listPrice) {
+ er = '鐩墠浜у搧瀹氫环鏈‘瀹氾紝璇蜂簬浜у搧鏈儴鑱旂郴纭锛�';
+ }
+ var SaveQuotecan = saveQuotel(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert,this.productStatusUpdated,this.enableSales,
+ this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period,this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.quoteflg);
+ SaveQuote(SaveQuotecan).then(resaut=>{
+ debugger
+ var Setmap = new Map()
+ var key = Object.keys(resaut)
+ key.forEach(item=>{
+ Setmap.set(item,resaut[item]);
+ });
+ if(Setmap.has('errormessage')){
+ er += Setmap.get('errormessage');
+ this.quoteflg = false;
+ }else{
+ if(this.Sback){
+ window.open('/' +this.oppId, '_self');
+ }else{
+ if(Setmap.has('QuoteNo')){
+ this.quo.Quote_No__c = Setmap.get('QuoteNo');
+ }
+ if(this.quoteflg){
+ if(Setmap.has('quoId')){
+ this.quoId = Setmap.get('quoId');
+ this.CSVflag = this.quoId?false:true;
+ this.quo.IsQuoteTrial__c = false;
+ this.ifquocom = false;
+ this.quoteGurantee_Period = this.quo.Gurantee_Period__c;
+ this.quotemultiYearWarranty = this.quo.multiYearWarranty__c;
+ }
+ this.index = 3;
+ this.quoteTrialInit();
+ }else{
+ if(Setmap.has('warn')){
+ this.Alert(Setmap.get('warn'),'warning');
+ this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct);
+ this.acts = true;
+ this.actL = Setmap.get('act');
+ }else{
+ this.Alert(Setmap.get('success'),'success');
+ }
+ if(Setmap.has('quoId')){
+ this.quoId = Setmap.get('quoId');
+ this.CSVflag = this.quoId?false:true;
+ window.open('/lightning/n/lexSINewQuoteEntry#Id=' + Setmap.get('quoId'), '_self');
+ this.location = 'Id='+ Setmap.get('quoId');
+ this.copyid = '';
+ this.oppId = '';
+ this.connectedCallback();
+ }
+ }
+ }
+ }
+ this.nafg = resultFlag(this.nafg,Setmap);
+ if(er){
+ this.Alert(er,'error');
+ }
+ this.tobeflag=true;
+ this.OnLoading(false);
+ });
+ return true;
+ }
+ }
+ //澶囪揣纭鐢宠
+ submitOppoApplyStockJs(){
+ this.OnLoading(true);
+ var flag =submitOppoApplyStockJsLogic(this.Save_button1);
+ if(flag){
+ submitOppoApplyStock({oppIdc:this.oppId,quoIdc:this.quoId}).then(rlt=>{
+ debugger
+ var relt = rlt.split('errorss:');
+ if(relt.length<2){
+ this.Alert(relt[0],'success');
+ }else{
+ this.Alert(relt[1],'error');
+ }
+ this.OnLoading(false);
+ });
+ }else{
+ this.Alert(alertExp,'error');
+ this.OnLoading(false);
+ }
+ }
+ DownloadCsvGet(){
+ window.open('/apex/SI_CsvModel?id='+encodeURI(this.quoId),'name','features','replace');
+ }
+ QuoteConfirmJs(){
+ this.OnLoading(true);
+ var a = QuoteConfirmJsExp(this.User,Admin,Admin2);
+ debugger
+ if(a){
+ this.Alert(alertExp,'error');
+ }else{
+ QuoteConfirm({quoid:this.quoId}).then(res=>{
+ var relt = res.split('errorss:');
+ if(relt.length > 2){
+ this.Alert(relt[1],'error');
+ }
+ this.OnLoading(false);
+ window.location.reload();
+ });
+ }
+ }
+ //浠锋牸鏀跨瓥琛ㄥ崟寮�鍏虫爣璇嗙
+ jzDataTableFixedPriceIsShow = false;
+ //鎶ヤ环璁$畻鍒濆鍖�
+ quoteTrialInit(){
+ this.OnLoadSavesDatas();
+ this.OnLoadQuoteData(this.quoId);
+ var event = {
+ page: 1,
+ pageLimit: 10,
+ search: "",
+ sortOrder: "asc",
+ sortPlus: undefined,
+ fag: true
+ };
+ setTimeout(() => {
+ this.getTableDataFix(event);
+ this.getTableData(event);
+ }, 1000);
+ }
+ OnLoadProduct = []; //鏈�夋嫨浜у搧
+ OnLoadSaveProduct = []; //宸查�夋嫨浜у搧
+ OnLoadDiscount = []; //鎶樻墸鏀跨瓥
+ OnLoadFixDiscount = []; //浠锋牸鏀跨瓥
+ flagall = false;
+ OnLoadSavesDatas() {
+ debugger
+ //鑾峰彇浜у搧鏁版嵁
+ SelectAllDataDiscount({
+ ParamIdStr: this.quoId
+ }).then(result => {
+ result.forEach(item => {
+ if (item.ismatch__c == "0") {
+ item = ProductAssignmentSelect(item);
+ this.OnLoadProduct.push(item);
+ } else if (item.ismatch__c == "1") {
+ item = ProductSelected(item);
+ this.OnLoadSaveProduct.push(item);
+ }
+ })
+ var arrss = [].concat(this.OnLoadSaveProduct);
+ this.addOffer(arrss);
+ this.comparisonUniqueKey();
+ if (this.OnLoadProduct != undefined && this.OnLoadProduct.length > 0) {
+ this.flagall = true;
+ this.jzDataDefault = this.OnLoadProduct;
+ if (this.jzDataDefault != undefined && this.jzDataDefault.length > 0) {
+ this.UpdateSaveDataQuoteLineItemSelectByID(0);
+ }
+ }
+ if (this.OnLoadSaveProduct != undefined && this.OnLoadSaveProduct.length > 0) {
+ this.flagall = true;
+ this.jzDataProduct = this.OnLoadSaveProduct;
+ debugger
+ if (this.jzDataProduct != undefined && this.jzDataProduct.length > 0) {
+ this.UpdateSaveDataQuoteLineItemSelectByID(1);
+ }
+ this.updateIdStr("1");
+ this.ContractPriceCompute();
+ }
+ })
+ //鑾峰彇 鎶樻墸鏂规鏁版嵁 UpdateBy 2021 06 29
+ SelectAllDataProduct({
+ ParamIdStr: this.quoId
+ }).then(result => {
+ result.forEach(items => {
+ if (items.typess__c == "鎶樻墸鏀跨瓥") {
+ items = UnselectedScheme(items);
+ this.OnLoadDiscount.push(items);
+ } else if (items.typess__c == "浠锋牸鏀跨瓥") {
+ items = SelectedScheme(items)
+ this.OnLoadFixDiscount.push(items);
+ }
+ })
+ this.comparisonUniqueKey();
+ if (this.OnLoadFixDiscount != undefined && this.OnLoadFixDiscount.length > 0) {
+ this.jzDataFixedPrice = this.OnLoadFixDiscount;
+ if (this.jzDataFixedPrice != undefined && this.jzDataFixedPrice.length > 0) {
+ this.UpdateSaveDataFixedPriceSelectByID();
+ }
+ }
+ if (this.OnLoadDiscount != undefined && this.OnLoadDiscount.length > 0) {
+ this.jzDataDiscount = this.OnLoadDiscount;
+ this.updateIdStr("2");
+ }
+ })
+ }
+ //鍚堝苟涓婁竴娆$殑鎶ヤ环琛�
+ lastQuotation = [];
+ addOffer(TrialLine) {
+ this.lastQuotation = [].concat(addOfferLogic(TrialLine));
+ }
+ index = 3;
+ comparisonUniqueKey() {
+ this.index--;
+ if (this.index == 0) {
+ comparisonUniqueKeyLogic(this.index,this.flagall,this.jzDataDefaultCopy,this.jzDataDefault,this.jzDataProduct,this.jzDataFixedPrice,this.jzDataDiscount,this.lastQuotation);
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataProduct = jzDataProductExp;
+ this.jzDataFixedPrice = jzDataFixedPriceExp;
+ this.jzDataDiscount = jzDataDiscountExp;
+ this.ContractPriceCompute()
+ }
+ }
+ Complate = false;
+ //浠庢暟鎹簱鏇存柊宸蹭繚瀛樼殑鏁版嵁 浜у搧 UpdateBy 2021 06 29
+ UpdateSaveDataQuoteLineItemSelectByID(flag) {
+ if (flag == 0) {
+ var idArr = [];
+ this.jzDataDefault.forEach(item => {
+ idArr.push(item.QuiteLineitem__c);
+ })
+ selectUpdateQuoteLineItemData({
+ ItemId: idArr
+ }).then(result => {
+ var newArr = [];
+ this.jzDataDefault.forEach(dp => {
+ var temp = {
+ ...{},
+ ...dp
+ };
+ result.forEach(item => {
+ if (item.Id == temp.QuiteLineitem__c) {
+ var keys = Object.keys(temp);
+ keys.forEach(k => {
+ var flag = ChangeProductData(k);
+ if (flag && item[k] != undefined && item[k] != temp[k]) {
+ this.Complate = true;
+ temp[k] = item[k];
+ }
+ })
+ }
+ })
+ newArr.push(temp);
+ })
+ this.jzDataDefault = newArr;
+ })
+ }
+ if (flag == 1) {
+ var idArrPro = [];
+ this.jzDataProduct.forEach(item => {
+ idArrPro.push(item.QuiteLineitem__c);
+ })
+ selectUpdateQuoteLineItemData({
+ ItemId: idArrPro
+ }).then(result => {
+ var newArr = [];
+ this.jzDataProduct.forEach(dp => {
+ var temp = {
+ ...{},
+ ...dp
+ };
+ result.forEach(item => {
+ if (item.Id == temp.QuiteLineitem__c) {
+ var keys = Object.keys(temp);
+ keys.forEach(k => {
+ var flag = ChangeProductData(k);
+ if (flag && item[k] != undefined && item[k] != temp[k]) {
+ this.Complate = true;
+ temp[k] = item[k];
+ }
+ })
+ }
+ })
+ newArr.push(temp);
+ })
+ debugger
+ this.jzDataProduct = newArr;
+ //瑙e喅鍒犻櫎鏍峰紡涓嶆洿鏂伴棶棰�
+ this.updateIdStr("1");
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ })
+ }
+ }
+ //鍒犻櫎鏃堕渶瑕佺敤鐨勫敮涓�id鐨勬坊鍔�
+ updateIdStr(str) {
+ var newArr = [];
+ var indexNum = 0;
+ var jzdpdc = [];
+ if (str == "1") {
+ jzdpdc = [].concat(this.jzDataProduct);
+ } else if (str == "2") {
+ jzdpdc = [].concat(this.jzDataDiscount);
+ } else if (str == "3") {
+ jzdpdc = [].concat(this.jzDataFixedPrice);
+ }
+ jzdpdc.forEach(item => {
+ indexNum++;
+ var temp = {
+ ...item
+ };
+ temp.DelectId = indexNum;
+ newArr.push(temp);
+ })
+ if (str == "1") {
+ this.jzDataProduct = [].concat(newArr);
+ } else if (str == "2") {
+ this.jzDataDiscount = [].concat(newArr);
+ } else if (str == "3") {
+ this.jzDataFixedPrice = [].concat(newArr);
+ }
+ }
+ //鍚堝悓浠锋牸姹囨��
+ ContractPrice = 0;
+ ContractPriceCompute() {
+ this.HeTongPriceCompute();
+ this.ContractPrice = 0;
+ var sum = this.ContractPrice;
+ sum = parseFloat(sum);
+ sum=ContractPriceComputeLogic(sum,this.jzDataProduct,this.jzDataDiscount,this.jzDataFixedPrice);
+ this.ContractPrice = sum;
+ }
+ HeTongPriceCompute() {
+ var HeTongPriceList = [];
+ HeTongPriceList=HeTongPriceComputeLogic(this.jzDataDiscount,this.jzDataProduct);
+ if (HeTongPriceList.length > 0) {
+ this.jzDataDiscount = HeTongPriceList;
+ }
+ }
+ //浠庢暟鎹簱鏇存柊宸蹭繚瀛樼殑鏁版嵁 鏂规 UpdateBy 2021 06 29
+ UpdateSaveDataFixedPriceSelectByID() {
+ var idArr = [];
+ this.jzDataFixedPrice.forEach(item => {
+ idArr.push(item.Id);
+ })
+ selectUpdateFiexedpriceData({
+ ProId: idArr
+ }).then(result => {
+ var newArr = [];
+ this.jzDataFixedPrice.forEach(dp => {
+ var temp = {
+ ...{},
+ ...dp
+ };
+ result.forEach(item => {
+ if (item.Id == temp.Id) {
+ var keys = Object.keys(temp);
+ keys.forEach(k => {
+ var flag = ChangeFiexedData(k);
+ if (flag && item[k] != undefined && item[k] != temp[k]) {
+ temp[k] = item[k];
+ this.Complate = true;
+ }
+ })
+ }
+ })
+ newArr.push(temp);
+ })
+ this.jzDataFixedPrice = newArr;
+ this.updateIdStr("3");
+ })
+ }
+ //鍔犺浇鎶ヤ环鏁版嵁
+ QuoteData = [];
+ OnLoadQuoteData(idStr) { //idStr 鎶ヤ环id
+ GetQuoteData({
+ QuoteID: idStr
+ }).then(result => {
+ var responseObj = JSON.parse(result);
+ this.QuoteData = initquoT(responseObj,this.buttonIsShow,this.initDataTableFixedPrice,this.initDataTableDiscount,this.initDataTableOtherData,this.initDataTableCommonly);
+ this.buttonIsShow = buttonIsShowE;
+ this.initDataTableFixedPrice = initDTFP;
+ this.initDataTableDiscount = initDTD;
+ this.initDataTableOtherData = initDTOD;
+ this.initDataTableCommonly = initDTC;
+ this.jzDataTableFixedPriceIsShow = true;
+ this.jzDataTableDiscountIsShow = true;
+ this.QTcss = QTcssE(this.pricePolicyflag);
+ this.pricePolicyflag = true;
+ if(!this.QuoteDecision){
+ this.Save_button = true;
+ this.Decision_button = true;
+ }
+ })
+ }
+ //鎵撳嵃鎸夐挳
+ PrintButton(){
+ var id = this.quoId;
+ if (id == null || id == '') {
+ this.Alert(Error_Message33,'error');
+ return false;
+ }
+ return this.chkEstimation_Entry_Possibility(id);
+ }
+ chkEstimation_Entry_Possibility(q) {
+ try {
+ this.OnLoading(true);
+ var dataChun = PrintButtonLoc(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert,
+ this.productStatusUpdated,this.enableSales,this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period,
+ this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.QuoteDecision)
+ Print(dataChun).then(resaut=>{
+ debugger
+ this.quoId = saverebackloc(resaut,this.quoId,this.nafg);
+ this.CSVflag = this.quoId?false:true;
+ this.OnLoading(false);
+ if(errorflg){
+ this.Alert(alertExp,'error');
+ this.nafg = nafgExp;
+ }
+ if(flg){
+ this.location = 'Id='+ this.quoId;
+ this.copyid = '';
+ this.oppId = '';
+ this.connectedCallback();
+ }
+ openQuotePage(this.quo.Contract__c,errorflg,this.quoId);
+ });
+ } catch (e) {
+ this.Alert(e,'error');
+ }
+ }
+ //涓嶄繚瀛樿繑鍥炴寜閽�
+ noSaveback(){
+ window.open('/' +this.oppId, '_self');
+ }
+ //淇濆瓨骞惰繑鍥�
+ Sback = false;
+ Saveandback(){
+ this.Sback = true;
+ this.savebuttonClick();
+ }
+ //decide鎶ヤ环鎸夐挳
+ decisionbuttonClick(){
+ debugger
+ this.checkchangedAfterPrint('de');
+ if(this.fg){
+ this.decisionlo();
+ }
+ }
+ decisionlo(){
+ var ff = decisionlol(this.jzDataToBeproduct,this.oppInfo,this.QuotationCalculationFag);
+ if(ff){
+ this.Alert(alertExp,'error');
+ }else{
+ this.chkSalesPossibilityDecision();
+ }
+ }
+ chkSalesPossibilityDecision() {
+ try {
+ debugger
+ this.tobeflag=false;
+ var quoc = saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var CheckItemCan = JSON.stringify(this.CheckItem);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ this.OnLoading(true);
+ if(this.WinOrDecideAlert &&(!this.productStatusUpdated)){
+ this.PriceStatusUpdate();
+ }
+ QuoteDecision({activitiesCan:quoLineItemCan,
+ CheckItemCan:CheckItemCan,
+ WinOrDecideAlertc:this.WinOrDecideAlert,
+ productStatusUpdatedc:this.productStatusUpdated,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan,
+ enableSalesc:this.enableSales,
+ oppIdc:this.oppId,
+ quoIdc:this.quoId,
+ newQuoteFlagc:this.newQuoteFlag,
+ changedAfterPrintc:this.changedAfterPrint,
+ quoteGurantee_Periodc:this.quoteGurantee_Period,
+ quotemultiYearWarrantyc:this.quotemultiYearWarranty,
+ selection_hpc:this.selection_hp,
+ SkipQuotefilgc:this.SkipQuotefilg
+ }).then(resaut=>{
+ debugger
+ var Setmap = new Map()
+ var key = Object.keys(resaut)
+ key.forEach(item=>{
+ Setmap.set(item,resaut[item]);
+ });
+ if(Setmap.has('errormessage')){
+ this.Alert(Setmap.get('errormessage'),'error');
+ if(Setmap.get('act')){
+ this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct);
+ }
+ }else{
+ if(Setmap.has('warn')){
+ this.Alert(Setmap.get('warn'),'warning');
+ this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct);
+ this.acts = true;
+ this.actL = Setmap.get('act');
+ }else{
+ this.Alert(Setmap.get('success'),'success');
+ }
+ if(Setmap.has('quoId')){
+ window.open('/lightning/n/lexSINewQuoteEntry#Id=' + Setmap.get('quoId'), '_self');
+ this.location = 'Id='+ Setmap.get('quoId');
+ this.copyid = '';
+ this.oppId = '';
+ this.connectedCallback();
+ }
+ this.QuoteDecision = true;
+ this.enableContract = true;
+ this.Save_button = true;
+ this.Decisiontag = true;
+ var lg = this.template.querySelectorAll('c-jzlookuplightning2');
+ lg.forEach(l=>{
+ l.todisabled();
+ })
+ this.initDataTableToBeproduct.columns[4].editable = false;
+ if (this.QuoteDecision == false) {
+ this.sap_button = true;
+ } else if (this.specialAuthority == false) {
+ this.sap_button = true;
+ } else {
+ this.sap_button = false;
+ }
+ this.Decision_button = true;
+ }
+ this.nafg = resultFlag(this.nafg,Setmap);
+ this.tobeflag=true;
+ this.OnLoading(false);
+ });
+ return true;
+ } catch (e) {
+ this.Alert(e,'error');
+ }
+ }
+ //淇濆瓨鍒ゆ柇鏄惁鐢熸垚鏂版姤浠锋爣璇�
+ fg = true;
+ changedAfterPrint = false;
+ QuotationCalculationFag = false;
+ checkchangedAfterPrint(dec) {
+ this.fg = true;
+ var id = this.quoId;
+ this.changedAfterPrint = false;
+ var detailChanged = false;
+ if (!id) {
+ return;
+ }else{
+ this.fg = false;
+ }
+ var activities = checkch(this.jzDataToBeproduct);
+ getQuoteLineItem({
+ quoId: id
+ }).then(results=>{
+ var quote_Date__c = null;
+ if (results.length > 0) {
+ quote_Date__c = results[0]['Quote']['Quote_Date__c'];
+ }
+ if (!detailChanged) {
+ if (activities.length != results.length) {
+ detailChanged = true;
+ }
+ }
+ if (!detailChanged) {
+ for (var j = 0; j < results.length; j++) {
+ if (results[j].PricebookEntryId != activities[j].PricebookEntryId ||
+ results[j].SFDA_Status__c != activities[j].SFDA_Status__c ||
+ results[j].UnitPrice__c != activities[j].UnitPrice__c ||
+ results[j].ListPrice__c != activities[j].ListPrice__c ||
+ results[j].Quantity != activities[j].Quantity
+ ) {
+ detailChanged = true;
+ break;
+ }
+ }
+ }
+ if(dec === 'de'){
+ var IsQuoteTrial = this.quo.IsQuoteTrial__c;
+ }else if(dec === 'sa'){
+ var IsQuoteTrial = this.ifquocom;
+ }
+ if (detailChanged && ((quote_Date__c != null && quote_Date__c != "" && quote_Date__c != undefined) || IsQuoteTrial)) {
+ this.changedAfterPrint = true;
+ }
+ if(detailChanged && !this.changedAfterPrint){
+ this.QuotationCalculationFag= true;
+ }else{
+ this.QuotationCalculationFag= false;
+ }
+ if(dec === 'de'){
+ this.decisionlo();
+ }else if(dec === 'sa'){
+ this.sal();
+ }
+ });
+ return;
+ }
+ calFromQuoAmont() {
+ var x = 0,
+ y = 0;
+ x = this.quo.hidden_Estimation_List;
+ x = localParseFloat(x);
+ y = this.quo.Quote_Adjust_Amount_Page__c;
+ this.quo.Quote_Adjust_Amount_Page__c = toNumComma(y);
+ y = localParseFloat(y);
+ var noDiscountPriceTotal = this.hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ this.quo.QuoteTotal_Page__c = toNumComma(y + x + noDiscountPriceTotal);
+ var z = this.quo.Estimation_List_Price__c;
+ var id = this.quoId;
+ if(!id){
+ var IsQuoteTrial = this.quo.IsQuoteTrial__c;
+ if(!IsQuoteTrial){
+ var mp =this.quo.MultiYearWarrantyTotalPrice__c;
+ mp = localParseFloat(mp);
+ var num = this.quo.Quote_Adjust_Calculate__c;
+ num = localParseFloat(num);
+ this.quo.Quote_Adjust_Calculate__c = toNumComma(num);
+ num = (100 + num) / 100;
+ z = localParseFloat(z);
+ var rh = this.oppInfo.rate_hospital;
+ var ra = this.oppInfo.rate_agency1;
+ this.quo.Dealer_Final_Price_Page__c = toNumComma(z*rh);
+ this.quo.OCM_Agent1_Price_Page__c = Saleslet ? toNumComma(z*num*ra+mp) : '';
+ this.setOCMAmount();
+ this.calFromContactPrice();
+ }
+ }
+ if (y == 0) {
+ this.quo.Quote_Adjust_Calculate__c = 0;
+ this.UnitPriceUpdate();
+ } else {
+ this.quoteTotalPriceAction();
+ }
+ }
+ UnitPriceUpdate() {
+ this.jzDataToBeproduct = UnitPriceUpdateLogic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button);
+ this.quo = quoExp;
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.Subtotalupdate();
+ this.calUnitPriceTotal();
+ this.quoteTotalPrice();
+ }
+ Subtotalupdate() {
+ this.jzDataToBeproduct = SubtotalupdateLogic(this.jzDataToBeproduct);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+ quoteTotalPriceAction() {
+ this.jzDataToBeproduct = quoteTotalPriceActionLogic(this.quo,this.jzDataToBeproduct,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.quo = quoExp;
+ this.calUnitPriceTotal();
+ this.QuoteAdjust();
+ this.DisAmountfunction();
+ }
+
+ //鍙栨秷甯傚満澶氬勾淇濅慨change浜嬩欢
+ multiYearWarrantyChange(event){
+ debugger
+ this.quo.multiYearWarranty__c = event.detail.checked;
+ this.calPriceAll();
+ }
+ //涓绘満涓嶅甫鐩戣鍣ㄥ彴杞hange浜嬩欢
+ MainEngineWithoutMonitorChange(event){
+ this.quo.MainEngineWithoutMonitor__c = event.detail.checked;
+ }
+ //璺ㄧ瀹hange浜嬩欢
+ InterdepartmentalChange(event){
+ this.quo.Interdepartmental__c = event.detail.checked;
+ this.calPriceAll();
+ }
+ //鍗曚环change浜嬩欢
+ UnitPriceChange(event){
+ this.quo.Unit_Price__c = event.detail.checked;
+ }
+ //鎶ヤ环閲戦change浜嬩欢
+ OfferAmountChange(event){
+ this.quo.Offer_Amount__c = event.detail.checked;
+ }
+ //鎶ヤ环鎬婚change浜嬩欢
+ TOTALChange(event){
+ this.quo.TOTAL__c = event.detail.checked;
+ }
+ //浼樻儬鎶樻墸change浜嬩欢
+ DiscountChange(event){
+ this.quo.Discount__c = event.detail.checked;
+ }
+ //浼樻儬浠锋牸change浜嬩欢
+ PricingChange(event){
+ this.quo.Pricing__c = event.detail.checked;
+ }
+ //浼樻儬鎴愪氦浠穋hange浜嬩欢
+ PreferentialTradingPriceChange(event){
+ this.quo.Preferential_Trading_Price__c = event.detail.checked;
+ }
+ //淇濅慨骞撮檺change浜嬩欢
+ PreferentialGuranteePeriodChange(event){
+ this.quo.Preferential_Gurantee_Period__c = event.detail.checked;
+ }
+ //鍚堝悓閰嶇疆change浜嬩欢
+ ContractcChange(event){
+ this.quo.Contract__c = event.detail.checked;
+ }
+
+ //涓绘満瑁呮満鍦� start
+ //涓绘満瑁呮満鍦� optionList
+ HostInstallationLocationoptionsvalue = [];
+ get HostInstallationLocationoptions() {
+ if(this.HostInstallationLocationoptionsvalue.length<=0){
+ getPicklistValues({objstr:'Quote',fld:'Installation_location__c',ifempty:true}).then(keyvalue=>{
+ this.HostInstallationLocationoptionsvalue = keyvalue;
+ });
+ }else{
+ return this.HostInstallationLocationoptionsvalue
+ }
+ }
+ HostInstallationLocationhandleChange(event) {
+ this.quo.Installation_location__c = event.detail.value;
+ }
+ //鍚堝悓淇濅慨鏈燂紙骞达級optionList
+ ContractWarrantyPeriodYearOptionsvalue = [];
+ get ContractWarrantyPeriodYearOptions() {
+ if(this.ContractWarrantyPeriodYearOptionsvalue.length<=0){
+ getPicklistValues({objstr:'Quote',fld:'Gurantee_Period__c',ifempty:false}).then(keyvalue=>{
+ this.ContractWarrantyPeriodYearOptionsvalue = keyvalue;
+ });
+ }else{
+ return this.ContractWarrantyPeriodYearOptionsvalue
+ }
+ }
+ ContractWarrantyPeriodYearHandleChange(event) {
+ this.quo.Gurantee_Period__c = event.detail.value;
+ this.calGuranteePeriod();
+ }
+ // 鏇存柊澶氬勾淇濅慨 淇濅慨鏈�
+ //闅愯棌鍚堝悓淇濅慨鏈燂紙骞达級
+ HiddenGurantee_Period;
+ calGuranteePeriod() {
+ var AllGurantee_Period = this.quo.Gurantee_Period__c;
+ this.HiddenGurantee_Period = AllGurantee_Period;
+ this.jzDataToBeproduct = calGuranteePeriodLogic(this.jzDataToBeproduct,AllGurantee_Period);
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ }
+ //鍚堝悓淇濅慨鏈燂紙骞达級end
+ //鎶ヤ环鍙樺寲 optionList
+ QuotationChangesOptionsvalue = [];
+ get QuotationChangesOptions() {
+ if(this.QuotationChangesOptionsvalue.length<=0){
+ getPicklistValues({objstr:'Quote',fld:'QuotationChange__c',ifempty:true}).then(keyvalue=>{
+ this.QuotationChangesOptionsvalue = keyvalue;
+ });
+ }else{
+ return this.QuotationChangesOptionsvalue
+ }
+ }
+ QuotationChangesHandleChange(event) {
+ this.quo.QuotationChange__c = event.detail.value;
+ }
+ //鎶ヤ环鍙樺寲 end
- // function changeV() {
- // var speed = document.getElementById('speed');
- // //durVal = parseFloat(duration.value);
- // spdVal = parseFloat(speed.value);
- // //const durationPercent = parseFloat(durVal, 2) * 100
- // const speedPercent = parseFloat((spdVal / 100), 2)*100;
- // //duration.style.backgroundSize = `${durationPercent}%, 100%`
- // speed.style.background = `linear-gradient(to right, #ffa200, white ${speedPercent}%, white`
- // document.getElementById("addMultipleRow").value= speed.value;
-
- // };
- // function changeI() {
- // var speed = document.getElementById('speed');
- // //durVal = parseFloat(duration.value);
- // spdVal = parseFloat(document.getElementById("addMultipleRow").value);
- // //const durationPercent = parseFloat(durVal, 2) * 100
- // const speedPercent = parseFloat((spdVal / 100), 2)*100;
- // //duration.style.backgroundSize = `${durationPercent}%, 100%`
- // speed.style.background = `linear-gradient(to right, #ffa200, white ${speedPercent}%, white`
- // speed.value = document.getElementById("addMultipleRow").value;
+ // 缁忛攢鍟嗕竴鍚嶇О杈撳叆妗� start
+ onsearchchange1(event){
+ debugger
+ this.quo.Agency1__c = event.detail.value;
+ }
+ // 缁忛攢鍟嗕竴鍚嶇О杈撳叆妗� end
-
- // };
+ // 缁忛攢鍟嗕簩鍚嶇О杈撳叆妗� start
+ onsearchchange2(event){
+ this.quo.Agency2__c = event.detail.value;
+ }
+ // 缁忛攢鍟嗕簩鍚嶇О杈撳叆妗� end
+ //鎶ヤ环浜у搧閫変腑鏁版嵁
+ @track
+ selectjzDataTableToBeproduct = [];
+ SelectedToBeproduct(event) {
+ let arr = event.detail.rows;
+ this.selectjzDataTableToBeproduct = arr;
+ }
+ //鍒犻櫎鎶ヤ环浜у搧鎸夐挳
+ deletejzDataToBeproduct(){
+ debugger
+ var msg = "涓嶈兘鍒犻櫎锛屽鏋滃垹闄ゅ彲鑳藉奖鍝嶈澶囧畨瑁呫�俓n\n璇风‘璁わ紒";
+ if(confirm(msg)){
+ var num = this.jzDataToBeproduct.length;
+ for (var j = 0; j < this.selectjzDataTableToBeproduct.length; j++) {
+ for (var i = 0; i < this.jzDataToBeproduct.length; i++) {
+ if (this.selectjzDataTableToBeproduct[j].lineNo == this.jzDataToBeproduct[i].lineNo) {
+ this.jzDataToBeproduct.splice(i, 1);
+ i--;
+ }
+ }
+ }
+ var ItemL = MarkRed(this.jzDataToBeproduct);
+ this.jzDataToBeproduct =[].concat(ItemL);
+ if(this.jzDataToBeproduct.length!=num){
+ this.quo.IsQuoteTrial__c = false;
+ }
+ console.warn(this.jzDataToBeproduct.length);
+ this.calPriceAll();
+ }
+ }
+ getTableDataToBeproduct(event) {
+ }
+ @track jzDataToBeproduct = [];
+ @track tableIsLodingToBeproduct = false;
+ @track
+ initDataTableToBeproduct = initDataTableToBeproductConfig;
+ @track
+ tobeflag = true
+ //鎶ヤ环浜у搧缂栬緫鍒�
+ onsaveToBeproduct(event){
+ debugger
+ this.tobeflag = false
+ var data = event.detail.rows;
+ this.jzDataToBeproduct = onsaveToBeproductLoc(data,this.jzDataToBeproduct);
+ if(fagExp){
+ this.quo.IsQuoteTrial__c = false;
+ this.quoteAgencyTotalPriceAction();
+ this.AgencyDiscountCalculation1();
+ }
+ this.updateNoDiscountPricetotal();
+ this.EstimationListPrice();
+ this.calUnitPriceTotal();
+ this.quoteTotalPrice();
+ setTimeout(() => {
+ this.tobeflag = true;
+ },1);
+ }
+ // 璁$畻 No Discount Price鍚堣
+ updateNoDiscountPricetotal() {
+ var noDiscountPriceTotal = 0;
+ this.jzDataToBeproduct.forEach(jzdtbt=>{
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ var Quantity = jzdtbt.Quantity__c;
+ Quantity = localParseFloat(Quantity);
+ noDiscountPriceTotal = noDiscountPriceTotal + noDiscountPrice * Quantity;
+ if (jzdtbt.NoDiscountTotal__c) {
+ jzdtbt.NoDiscountTotal__c = toNumComma(noDiscountPrice * Quantity);
+ }
+ });
+ this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
+ this.hidden_MultiYearWarrantyTotalPrice = noDiscountPriceTotal;
+ this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(noDiscountPriceTotal);
+ }
- // //SFDC鍋滄棰勮锛堥璁℃秷鑰楀埌鏈熸棩鏍囩孩锛� lt 20210928 add start
- // MarkRed();
- // //SFDC鍋滄棰勮锛堥璁℃秷鑰楀埌鏈熸棩鏍囩孩锛� lt 20210928 add end
-
-}
+ handleRowAction(event){
+ debugger
+ const actionName = event.detail.row;
+ }
+ //========鎼滅储浜у搧閰嶅妯℃�佹===========
+ //鎵撳紑浜у搧閰嶅妯℃�佹寮�鍏�
+ @track
+ showSetProductfalg = false;
+ //浜у搧閰嶅鎸夐挳
+ openSetProduct(event){
+ this.showSetProductfalg = true;
+ }
+ //浜у搧閰嶅 optionList
+ get listViewOptions() {
+ return filterNameoptionList();
+ }
+ // 浜у搧閰嶅妯℃�佹鍏抽棴
+ cancelsetProduct(){
+ this.showSetProductfalg = false;
+ this.jzSetProductData = [];
+ }
+ // 閫傜敤绉戝
+ filterName;
+ // 閫傜敤绉戝Change浜嬩欢
+ filterNameChange(event){
+ this.filterName = event.target.value;
+ }
+ // 浜у搧閰嶅鍚�
+ setSearchName;
+ //浜у搧閰嶅鍚岰hange浜嬩欢
+ jzSearchNameChange(event){
+ this.setSearchName = event.target.value;
+ }
+ //浜у搧閰嶅缂栫爜
+ SearchCode;
+ //浜у搧閰嶅缂栫爜Change浜嬩欢
+ jzSearchCodeChange(event){
+ this.SearchCode = event.target.value;
+ }
+ initDataSetProductTable = initDataSetProductTablefig;
+
+ @track
+ jzSetProductData = [];
+ @track
+ tableIsSetProductLoding = false;
+ @track
+ IsLoadingjdspt = false;
+ //浜у搧閰嶅鎼滅储
+ jzsetProductsearchbutton(){
+ debugger
+ this.IsLoadingjdspt = true;
+ let SearchCode = this.SearchCode;
+ let filterName = this.filterName;
+ let setSearchName = this.setSearchName;
+ serSetContact({SearchName:setSearchName,SearchCode:SearchCode,filterName:filterName}).then(result=>{
+ this.jzSetProductData = result;
+ this.IsLoadingjdspt = false;
+ });
+ }
+ //浜у搧閰嶅閫変腑鏁版嵁
+ SelectedNewsetProduct = []
+ //浜у搧閰嶅閫変腑鏁版嵁
+ SelectedSetProductFn(event){
+ let arr = event.detail.rows;
+ this.SelectedNewsetProduct = arr;
+ }
+ //杩藉姞浜у搧閰嶅鎼滅储
+ additionaljzsetProductbutton(){
+ debugger
+ var dataChunanshen = additionabuttonLoc(this.SelectedNewsetProduct,this.quo,this.oppInfo,this.jzDataToBeproduct)
+ var num = this.jzDataToBeproduct.length;
+ var isPrepared = DataStatus;
+ var Str = StrExp;
+ if(isPrepared!='Fin'){
+ confirm(isPrepared);
+ }else if(!Str){
+ if(confirm("鎮ㄥ皻鏈�夊彇浠讳綍浜у搧閰嶅锛岀‘璁ゅ畬鎴愪箞锛�")){
+ this.cancelsetProduct();
+ }else{
+ }
+ }else{
+ this.OnLoading(true);
+ setProductEntry(dataChunanshen).then(reslut=>{
+ var tempArr=reslut.split("---");
+ var errormessage=tempArr[0];
+ var quoteLineItem=JSON.parse(tempArr[1]);
+ quoteLineItem = InitializeProductAssignment(quoteLineItem);
+ this.jzDataToBeproduct = quoteLineItem;
+ if(quoteLineItem.length!=num){
+ this.quo.IsQuoteTrial__c = false;
+ }
+ this.calPriceAll();
+ if(errormessage.indexOf('鎴愬姛') >= 0){
+ this.Alert(errormessage,'success');
+ }else{
+ this.Alert(errormessage,'error');
+ }
+ this.OnLoading(false);
+ });
+ this.cancelsetProduct();
+ }
+ this.SelectedNewsetProduct = [];
+ }
+
+ getTableSetProductData(event) {
+ this.tableIsproductLoding = false;
+ }
+ //======鎼滅储浜у搧閰嶅妯℃�佹===========
+ //=======鏂板Excel瀵煎叆妯℃�佹=======
+ @track
+ showQuoteExcelImport = false;
+ //Excel瀵煎叆鎸夐挳
+ openQuoteExcelImport(event){
+ this.showQuoteExcelImport = true;
+ }
+ // Excel瀵煎叆鎬佹鍏抽棴
+ cancelQuoteExcelImport(){
+ this.showQuoteExcelImport = false;
+ this.exceltextvalue = '';
+ }
+ //Excel瀵煎叆淇濆瓨
+ SavesSQuoteExcelImport(){
+ let Str = this.exceltextvalue;
+ var num = this.jzDataToBeproduct.length;
+ var quoc = saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ this.OnLoading(true);
+ excelImport({excel_text:Str,
+ activitiesCan:quoLineItemCan,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan}).then(reslut=>{
+ debugger
+ var tempArr = reslut.split("---");
+ var errormessage = tempArr[0];
+ var quoteLineItem = JSON.parse(tempArr[1]);
+ quoteLineItem = InitializeProductAssignment(quoteLineItem);
+ this.jzDataToBeproduct = quoteLineItem;
+ if(quoteLineItem.length!=num){
+ this.quo.IsQuoteTrial__c = false;
+ }
+ this.calPriceAll();
+ if(errormessage.indexOf('鎴愬姛') >= 0){
+ this.Alert(errormessage,'success');
+ }else{
+ console.log('----------------------------SavesSQuoteExcelImport');
+ this.Alert(errormessage,'error');
+ }
+ this.OnLoading(false);
+ this.cancelQuoteExcelImport();
+ });
+ }
+ //excel鍊�
+ @track
+ exceltextvalue;
+ //textArea浜嬩欢
+ exceltextChange(event){
+ let value = event.detail.value;
+ this.exceltextvalue = value;
+ }
+
+ //鎵撳紑鏂板缓浜у搧妯℃�佹寮�鍏�
+ showproductfalg = false;
+ //鏂板鎶ヤ环浜у搧鎸夐挳
+ NewQuotationProducts(event){
+ this.showproductfalg = true;
+ }
+ @track
+ IsLoadingjdpt = false;
+ //閫夋嫨鏁版嵁
+ SelectedNewProduct = [];
+ //鏂板鎶ヤ环浜у搧鍒楄〃閫変簨浠�
+ SelectedProductFn(event) {
+ let arr = event.detail.rows;
+ this.SelectedNewProduct = arr;
+ }
+ //杩藉姞鏂板浜у搧鎸夐挳
+ additionaljzProductbutton(){
+ if(this.SelectedNewProduct.length == 0){
+ if(confirm("鎮ㄥ皻鏈�夊彇浠讳綍浜у搧锛岀‘璁ゅ畬鎴愪箞锛�")){
+ this.cancelProduct();
+ }
+ }else{
+ this.tobeflag = false
+ var selectvlue = this.SelectedNewProduct;
+ var Listvalue = this.jzDataToBeproduct;
+ this.jzDataToBeproduct = additionaljzProductLogic(selectvlue,Listvalue,this.oppInfo.CurrencyIsoCode,this.quo.IsQuoteTrial__c);
+ if(alertExp){
+ this.Alert(alertExp,'error');
+ }
+ setTimeout(() => {
+ this.tobeflag = true;
+ },1);
+ this.quo.IsQuoteTrial__c = IsQuoteTrialExp;
+ this.calPriceAll();
+ this.cancelProduct();
+ this.SelectedNewProduct= [];
+ }
+ }
+ //鏂板鎶ヤ环浜у搧妯℃�佹鍙栨秷鎸夐挳
+ cancelProduct() {
+ this.showproductfalg = false;
+ this.jzProductData = [];
+ }
+ //鏂板鎶ヤ环浜у搧妫�绱㈡潯浠�
+ @track
+ SearchName = '';
+ jzProductsearchChange(event){
+ if(this.SearchName != event.target.value){
+ this.SearchName = event.target.value;
+ }
+ }
+ //鏂板鎶ヤ环浜у搧妫�绱㈡寜閽�
+ jzProductsearchbutton(event){
+ debugger
+ this.IsLoadingjdpt = true;
+ let tradec = this.oppInfo.CurrencyIsoCode;
+ let celon = this.oppInfo.CelonOpportunity;
+ let SearchName = this.SearchName;
+ serContact({tradec:tradec,SearchName:SearchName,celon:celon}).then(result=>{
+ console.warn('1234'+JSON.stringify(result));
+ this.jzProductData = jzProductsearchLogic(result);
+ this.IsLoadingjdpt = false;
+ });
+ }
+ //鏂板鎶ヤ环浜у搧鍒楄〃鍔犺浇鏁版嵁
+ getTableProductData(event) {
+ this.tableIsproductLoding = false;
+ }
+ //鏂板鎶ヤ环浜у搧鍒楄〃鏁版嵁
+ @track jzProductData = [];
+ //鏂板鎶ヤ环浜у搧鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsproductLoding = true;
+ // 鏂板鎶ヤ环浜у搧鍒楄〃鍒楅厤缃�
+ @track
+ initDataProductTable = initDataProductTablefig;
+
+ //鎶ヤ环璁$畻鎵撳紑鎸夐挳 start
+ //鎵撳紑鎶ヤ环璁$畻鏍囪瘑
+ quoteflg = false;
+ @track
+ QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder";
+ showQuotationCalculation(event){
+ if(this.pricePolicyflag){
+ this.QTcss = QTcssE(this.pricePolicyflag);
+ this.pricePolicyflag = false;
+ this.quoteflg = false;
+ this.OnLoadProduct = [];
+ this.jzDataDefault = [];
+ this.OnLoadSaveProduct = [];
+ this.jzDataProduct = [];
+ this.OnLoadDiscount = [];
+ this.jzDataDiscount = [];
+ this.OnLoadFixDiscount = [];
+ this.jzDataFixedPrice = [];
+ this.ContractPriceCompute();
+ if(!this.QuoteDecision){
+ this.Save_button = false;
+ this.Decision_button = false;
+ }
+ }else{
+ this.quoteflg = true;
+ if(this.QuoteDecision){
+ this.quoteTrialInit();
+ }else{
+ this.savebuttonClick();
+ }
+ }
+ }
+ //鎶ヤ环璁$畻鍖哄煙灞曞紑鏍囪瘑
+ pricePolicyflag = false;
+ //鎶ヤ环璁$畻鎸夐挳灞曞紑鏍囪瘑
+ buttonIsShow = false;
+ //鍚堝悓鎬讳环
+ ContractPrice = 0;
+ ifFTip=true;
+ //淇濆瓨鎶ヤ环璁$畻缁撴灉鎸夐挳鏂规硶
+ saveAllDataProductFn() {
+ var dataChunanshen = saveAllDataProductFnChuanshen(this.jzDataFixedPrice,this.jzDataDiscount,this.quoId,this.QuoteData,this.jzDataProduct,this.jzDataDefault,this.ContractPrice)
+ var newTemp = newTempExp;
+ if (this.jzDataDefault.length == 0) {
+ var ifnunum = saveAllDataProductFnPanduan(this.jzDataProduct,newTemp);
+ var ifnull = ifnullExp;
+ if (ifnull&&ifnunum==1) {
+ this.IsLoading=true;
+ saveAllDataProduct(dataChunanshen).then(result => {
+ this.IsLoading=false;
+ this.quo.IsQuoteTrial__c = true;
+ this.SkipQuotefilg = false;
+ this.ifquocom = true;
+ if(this.oppInfo.Sales_Root__c == Sales_Outlet){
+ var target = {value :this.ContractPrice}
+ var event = {target:target}
+ this.OCMAgent1PricePageonChange(event);
+ }else{
+ this.quo.Dealer_Final_Price_Page__c = toNumComma(this.ContractPrice);
+ var target = {value :this.ContractPrice}
+ var event = {target:target}
+ this.DealerFinalPricePageChange(event);
+ }
+ this.Alert("鏁版嵁宸蹭繚瀛�", 'success');
+ });
+ } else {
+ if(ifnunum==2){
+ this.ifFTip=false;
+ this.Alert("浜у搧鏄庣粏涓噾棰濇湁璐熸暟锛屼笉鍙繚瀛�",'error');
+ }else{
+ this.ifFTip=false;
+ this.Alert("涓�鑸骇鍝佺殑鍚堝悓浠锋牸涓虹┖锛屼笉鍙繚瀛�",'error');
+ }
+ }
+ } else {
+ this.ifFTip=false;
+ this.Alert("浜у搧鏈�夊畬锛屼笉鍙繚瀛�",'error');
+ }
+ }
+ //鎶ヤ环璁$畻鎵撳紑鎸夐挳 end
+ SelectedFnDefault(rows) {
+ let arr = rows;
+ }
+ //鑾峰彇寰呴�夋嫨浜у搧鍒楄〃鏁版嵁
+ UniqueKey = new Map();
+ getTableDataDefault(event) {
+ let data = [];
+ //todu10
+ GetPromotionDefalut({
+ IdParam: this.quoId
+ }).then(result => {
+ this.jzDataDefaultNotChange = [];
+ this.jzDataDefaultCopy = [];
+ var i = 1;
+ result.forEach(rItem => {
+ rItem.ListPrice = rItem.ListPrice__c;
+ rItem.HangHao = i++;
+ // if (!this.flagall) {
+ rItem.Id = rItem.Product2Id;
+ // }
+ let tempS = {
+ ...{},
+ ...rItem
+ };
+ this.jzDataDefaultNotChange.push(tempS);
+ this.jzDataDefaultCopy.push(tempS);
+ });
+ this.getschemedetails();
+ if (this.flagall) {
+ var newList = [];
+ this.OnLoadProduct.forEach(items => {
+ var DataTemp = {};
+ result.forEach(reItgem => {
+ if (reItgem.Id == items.Id) {
+ DataTemp = reItgem;
+ return;
+ }
+ reItgem.ListPrice = reItgem.ListPrice__c;
+ })
+ if (DataTemp != undefined && DataTemp != {}) {
+ DataTemp = {
+ ...DataTemp,
+ ...items
+ };
+ }
+ newList.push(DataTemp);
+ })
+ this.jzDataDefault = newList;
+ this.tableIsLodingDefault = false;
+ this.comparisonUniqueKey();
+ return;
+ } else {
+ result.forEach(rItems => {
+ rItems.ListPrice = rItems.ListPrice__c;
+ });
+ this.jzDataDefault = result;
+ this.tableIsLodingDefault = false;
+ var event = {
+ page: 1,
+ pageLimit: 10,
+ search: "",
+ sortOrder: "asc",
+ sortPlus: undefined,
+ fag: true
+ };
+ this.getTableDataFix(event);
+ }
+ })
+ this.tableIsLodingDefault = false;
+ }
+ //鏌ヨ浠锋牸鏀跨瓥鏂规鍏宠仈浜у搧鏄庣粏
+ //绠楀嚭鐨勫悎璁�
+ sumTotal = [];
+ getschemedetails() {
+ this.jzDataFixedPrice.forEach(jdfp => {
+ var SeachData = {
+ SearchId: jdfp.Id
+ };
+ GetSearchProductById(SeachData).then(result => {
+ var tempObject = {
+ ...{},
+ ...jdfp
+ }
+ jdfp = this.countListAndNod(tempObject, result);
+ this.sumTotal.push(jdfp);
+ });
+ });
+ }
+ @track jzDataDefault = []; //鏁版嵁 寰呴�夋嫨浜у搧鏁版嵁鎹�
+ jzDataDefaultNotChange = [];
+ jzDataDefaultCopy = [];
+ @track tableIsLodingDefault = true;
+ @track
+ initSearchFormDefalt = initSearchFormDefalt2;
+ @track
+ initDataTableDefault = initDataTableDefault2;
+ //*******鎶ヤ环璁$畻寰呴�変骇鍝� end************
+ @track
+ show = false
+ //閫夋嫨淇冮攢鏂规鎵撳紑鎸夐挳
+ showModal(){
+ this.show = true;
+ }
+ //閫夋嫨淇冮攢鏂规妯℃�佹鍙栨秷鎸夐挳
+ cancel() {
+ this.show = false
+ }
+ @track ShowFix;
+ showModalFix() {
+ this.ShowFix = true
+ }
+ cancelFix() {
+ this.ShowFix = false
+ }
+ @track
+ initSearchFormFix = initSearchFormFix2;
+ @track
+ initDataTableFix = initDataTableFix2;
-// <!-- <template>
-// <!-- <link rel="stylesheet" type="text/css" href="{!URLFOR($Resource.blockUIcss)}"/>
-// <script src="{!URLFOR($Resource.jquery183minjs)}"></script>
-// <script src="{!URLFOR($Resource.PleaseWaitDialog)}"></script>
-// <script src="{!URLFOR($Resource.NewQuoteEntryJS)}"></script>
-// <script src="{!URLFOR($Resource.clipboardminjs)}"></script>
-// <script src="{!URLFOR($Resource.connection20)}"></script>
-// <script src="{!URLFOR($Resource.apex20)}"></script>
-// <script src="{!$Resource.lexSINewQuoteEntry+ '/lexSINewQuoteEntry.js'}"></script>
-// <link rel="stylesheet" type="text/css" href="{!$Resource.lexSINewQuoteEntry + '/lexSINewQuoteEntry.css'}"/> -->
-// <form id="mainForm">
-// <lightning-formatted-text id="hiddenQuoid" value="{!quoid}" style="display:none;"/>
-// <lightning-input type="hidden" id="oppoidforCSV" value="{!oppoidforCSV}"/>
-// <lightning-input type="hidden" id="changedAfterPrint" value="{!changedAfterPrint}"/>
-// <lightning-input type="hidden" id="changedAfterBid" value="{!changedAfterBid}"/>
-// <lightning-input type="hidden" id="productStatusUpdated" value="{!productStatusUpdated}"/>
-// <!-- 20211011 lt add MarkRed();-->
-// <apex:actionFunction action="{!setProductEntry}" name="setProductEntry" reRender="mainForm" oncomplete="unblockUI();calPriceAll();MarkRed();">
-// <apex:param assignTo="{! }" name="setProduct_text" value=""/>
-// </apex:actionFunction>
-// <!-- 20211011 lt add MarkRed();-->
-// <apex:actionFunction action="{!excelImport}" name="excelImport" reRender="mainForm" oncomplete="unblockUI();calPriceAll();MarkRed();">
-// <apex:param assignTo="{!excel_text}" name="select_index" value=""/>
-// </apex:actionFunction>
-// <apex:actionFunction action="{!addRow}" name="addRow" reRender="mainForm" oncomplete="unblockUI();calPriceAll();">
-// <apex:param assignTo="{!rowIdx}" name="rowIdx" value=""/>
-// </apex:actionFunction>
-// <!-- 娣诲姞琛� -->
-// <apex:actionFunction action="{!addMultipleRow}" name="addMultipleRow" reRender="mainForm" oncomplete="unblockUI();calPriceAll();">
-// <apex:param assignTo="{!rowIdx}" name="rowIdx" value=""/>
-// </apex:actionFunction>
-// <apex:actionFunction action="{!DownloadCsv}" name="DownloadCsv" reRender="oppoidforCSV" oncomplete="DownloadCsvJs();"/>
-// <apex:actionFunction action="{!submitOppoApplyStock}" name="submitOppoApplyStock" reRender="mainForm,message1" oncomplete="unblockUI();"/>
-// <apex:actionFunction action="{!QuoteConfirm}" name="QuoteConfirm" reRender="mainForm" oncomplete="unblockUI();ReloadPage();"/>
-// <apex:actionFunction action="{!getSalesId1}" name="getSalesId1" reRender="mainForm"/>
-// <apex:actionFunction action="{!getSalesId2}" name="getSalesId2" reRender="mainForm"/>
-// <!-- 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗崟浠疯绠� start -->
-// <apex:actionFunction action="{!PriceStatusUpdate}" name="PriceStatusUpdate" reRender="listsTable" oncomplete="unblockUI();calPriceAll();alert('鏇存柊瀹屾瘯锛�');quoteAgencyTotalPriceAction();"/>
-// <!-- 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗崟浠疯绠� end -->
-// <!-- CHAN-B8RCU9 start -->
-// <apex:actionFunction action="{!QuoteDecision}" name="QuoteDecision" reRender="mainForm" oncomplete="unblockUI();alertUpdatewhenDecide();"/>
-// <!-- CHAN-B8RCU9 start -->
+ @track jzDataFix = [];
+ @track tableIsLodingFix = true;
+ // 鐐瑰嚮鎼滅储瑙﹀彂
+ searchDataFix(event) {
+ let searchParams = event.detail.searchParams || {};
+ this.template.querySelector('[data-parent-id="parent-div-idFix"]').refreshDataTable({
+ searchParams: searchParams
+ });
+ }
+ deleteFixedPrice(){
+ debugger
+ var fag = deleteFixedPriceLogic(this.SelectedFnDataFixedPrice,this.CompareFullData);
+ this.SelectedFnDataFixedPrice = SelectedFnDataFixedPriceExp;
+ this.CompareFullData = CompareFullDataExp;
+ var ids = idsExp;
+ if (fag) {
+ //鍒犻櫎鎵�閫夋柟妗堝尮閰嶇殑浜у搧
+ this.DeleteChangesFn(ids, "浠锋牸鏀跨瓥");
+ //璋冪敤鍒犻櫎浠锋牸鏀跨瓥
+ this.deleteFixedPriceTemp();
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }else{
+ this.Alert("涓�鑸骇鍝佷负寮哄埗鍖归厤锛屼笉鍙垹闄�",'error');
+ }
+ }
+ // 鍒犻櫎鎵�閫夋柟妗堝尮閰嶇殑浜у搧
+ DeleteChangesFn(ids, TypeName) { // ids 閫変腑鐨勬柟妗圛d TypeName 鏂规绫诲瀷
+ var CompareFullDataTemp = [];
+ ids.forEach(id => {
+ this.jzDataProduct = DeleteChangesFnLogic(id,TypeName,CompareFullDataTemp,this.CompareFullData,this.jzDataFixedPrice,this.jzDataDiscount,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultNotChange);
+ CompareFullDataTemp = CompareFullDataTempExp;
+ this.jzDataFixedPrice = jzDataFixedPriceExp;
+ this.jzDataDiscount = jzDataDiscountExp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultNotChange = jzDataDefaultNotChangeExp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ });
+ this.CompareFullData = CompareFullDataTemp;
+ }
+ //鍒犻櫎浠锋牸鏀跨瓥
+ deleteFixedPriceTemp() {
+ this.jzDataFixedPrice = deleteFixedPriceTempLogic(this.SelectedFnDataFixedPrice,this.jzDataFixedPrice,this.CompareFullData);
+ this.CompareFullData = CompareFullDataExp;
+ this.SelectedFnDataFixedPrice = [];
+ }
+ //浠锋牸鏀跨瓥鍒楄〃閫変腑鐨勬暟鎹�
+ @track SelectedFnDataFixedPrice = [];
+ //浠锋牸鏀跨瓥閫夋嫨浜嬩欢
+ SelectedFnFixedPrice(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnDataFixedPrice = arr;
+ }
+ //浠锋牸鏀跨瓥鍒楄〃閰嶇疆鍒�
+ @track
+ initDataTableFixedPrice = initDataTableFixedPrice2;
+ //浠锋牸鏀跨瓥鍔犺浇鏁版嵁鏂规硶
+ getTableDataFixedPrice(event) {
+ this.tableIsLodingFixedPrice = false;
+ }
+ //浠锋牸鏀跨瓥鏁版嵁
+ @track jzDataFixedPrice = [];
+ //浠锋牸鏀跨瓥鍒楄〃loding
+ @track tableIsLodingFixedPrice = true;
+ //浠锋牸鏀跨瓥鍒楄〃灞曠ず鏍囪瘑
+ @track jzshows3 = true;
+ //瀵规瘮浠锋牸鏀跨瓥璧嬪��
+ comparativeAssignment() {
+ debugger
+ this.jzDataFixedPrice.forEach(jdfp => { //浠锋牸鏀跨瓥闆嗗悎
+ this.sumTotal.forEach(stl => { //鍒濆鍖栨椂浠锋牸鏀跨瓥闆嗗悎
+ if (jdfp.Id == stl.Id) {
+ if (stl.sumListPrice != undefined && stl.sumNoDiscount != undefined) {
+ jdfp.sumListPrice = stl.sumListPrice;
+ jdfp.sumNoDiscount = stl.sumNoDiscount;
+ }
+ }
+ });
+ });
+ }
+ //淇濆瓨浠锋牸鏀跨瓥缂栬緫鍒楁柟娉�
+ handleSaveFixedPrice(event) {
+ this.comparativeAssignment();
+ let editnewDate = [];
+ editnewDate = handleSaveFixedPriceLogic(this.CompareFullData,event,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,this.jzDataDefault);
+ this.CompareFullData = CompareFullDataExp;
+ var HeTongTotal = HeTongTotalExp;
+ let newData = newDataExp;
+ var boolean = booleanExp;
+ var newArrs = [].concat(editnewDate);//20230214
+ if (boolean == 1) {
+ this.jzDataFixedPrice = newData;
+ newArrs.forEach(item => {
+ this.ComputeData(item.Id, '浠锋牸鏀跨瓥');
+ this.Alert("鏁版嵁淇敼鎴愬姛", 'success');
+ });
+ this.jzDataProduct = this.newArrsTemp3.concat(this.newArrsTemp4);//20230213
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ } else if (boolean == 3) {
+ this.Alert("淇敼閿欒锛屾鏁板凡缁忚秴杩囨渶澶у�硷紝涓嶅彲澧炲姞",'error');
+ } else if (boolean == 4) {
+ this.Alert("淇敼閿欒锛屾鏁颁笉鍙互涓�0",'error');
+ } else if (boolean == 5) {
+ this.Alert("璇ユ柟妗堜负寮哄埗鍖归厤锛屾鏁颁笉鍙慨鏀癸紒",'error');
+ } else if (boolean == 6) {
+ var str1 = String(HeTongTotal);
+ var str = "淇敼閿欒锛屽悎鍚屼环鏍间笉寰楀皬浜�";
+ var str3 = str + str1;
+ this.Alert(str3,'error');
+ }
+ //鍒锋柊
+ this.jzshows3 = false;
+ this.IsLoading3 = true;
+ setTimeout(() => {
+ this.IsLoading3 = false;
+ this.jzshows3 = true;
+ }, 800);
+ }
+ newArrsTemp3 = [];
+ newArrsTemp4 = [];
+ //=======淇冮攢鏂规妯℃�佹 start=======
+ // 淇冮攢鏂规鎼滅储妗嗘悳绱㈡寜閽柟娉�
+ searchData(event) {
+ let searchParams = event.detail.searchParams || {};
+ let temp = this.template;
+ this.template.querySelector('[data-parent-id="parent-div-id"]').refreshDataTable({
+ searchParams: searchParams
+ });
+ }
+ // 淇冮攢鏂规鎼滅储妗嗛厤缃垪
+ @track
+ initSearchForm = initSearchForm2;
+ //淇冮攢鏂规鍒楄〃閫変簨浠�
+ SelectedFn(event) {
+ let arr = event.detail.rows;
+ if (arr.length > 1) {
+ this.Alert("浠锋牸鏀跨瓥鍙彲閫夋嫨涓�涓柟妗�",'error');
+ } else {
+ this.ifqianpi = true;
+ this.GetSearchProductByIdFn(arr[0].Id, arr[0], "浠锋牸鏀跨瓥", [], arr);
+ }
+ this.cancel();
+ }
+ //淇冮攢鏂规鍒楄〃鍔犺浇鏁版嵁
+ // 鍚庡彴浜や簰锛岃幏鍙栧垪琛ㄦ暟鎹�
+ getTableData(event) {
+ debugger
+ let listQuery = event;
+ if (event.fag == undefined) {
+ listQuery = event.detail.listQuery;
+ }
+ GetPromotionPromotionSearch(listQuery).then(result => { //淇冮攢鏂规鏌ヨ缁撴灉
+ debugger
+ var responseObj = JSON.parse(result);
+ responseObj.records.forEach(item => {
+ var SeachData = {
+ SearchId: item.Id
+ };
+ GetSearchProductById(SeachData).then(result => { //鏂规鍏宠仈鐨勪骇鍝�
+ debugger
+ var newarrjdf = SearchProductByIdLogic(result,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,item);
+ this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp;
+ this.jzDataFixedPrice = [].concat(newarrjdf);
+ });
+ });
+ this.jzData = [].concat(responseObj.records);
+ this.tableIsLoding = false;
+ })
+ }
+ jzDataDefaultCopyQuantityList = [];
+ // 鍚庡彴浜や簰锛岃幏鍙栦竴鑸骇鍝佸垪琛ㄦ暟鎹�
+ ifqianpi = true;
+ getTableDataFix(event) {
+ let listQuery = event;
+ if (event.fag) {
+ this.ifqianpi = false;
+ } else {
+ listQuery = event.detail.listQuery;
+ }
+ listQuery.pageLimit = 200;
+ GetNormalProductSearch(listQuery).then(result => {
+ //BBBB
+ var tempArr = result.split("--");
+ var responseObj = JSON.parse(tempArr[0]);
+ var responseObjAll = JSON.parse(tempArr[1]);
+ //鎺掑簭
+ var newArrs = new Array;
+ responseObjAll.forEach(item => {
+ newArrs.push(item);
+ })
+ newArrs.sort((a, b) => {
+ return a.OrderNo__c - b.OrderNo__c;
+ })
+ newArrs.forEach(item => { //鎺掑簭鍚庣殑涓�鑸骇鍝佷富鏁版嵁
+ var SeachData = {
+ SearchId: item.Id
+ };
+ GetSearchProductById(SeachData).then(results => {
+ var newarrjdf = GetSearchProductByIdLogic(item,results,this.jzDataDefaultCopyQuantityList,this.jzDataFixedPrice);
+ this.jzDataFixedPrice = [].concat(newarrjdf);
+ var iflag = iflagExp;
+ this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp;
+ if (event.fag && iflag) {
+ var newArr = [];
+ newArr.push(item);
+ this.ifqianpi = false;
+ this.GetSearchProductByIdFn(item.Id, item, "浠锋牸鏀跨瓥", [], newArr, false);
+ }
+ });
+ });
+ var respons = [];
+ responseObj.records.forEach(rrds => { //鏌ュ嚭鐨勫墠鍗佹潯
+ responseObjAll.forEach(rsja => { //鏌ュ嚭鐨勬墍鏈変竴鑸骇鍝佹暟鎹�
+ if (rrds.Id == rsja.Id) {
+ respons.push(rsja);
+ }
+ })
+ })
+ this.jzDataFix = [].concat(respons);
+ this.tableIsLodingFix = false;
+ })
+ }
+ SelectedFnFix(event) {
+ let arr = event.detail.rows;
+ this.ifqianpi = true;
+ if (arr.length > 1) {
+ this.Alert("浠锋牸鏀跨瓥鍙彲閫夋嫨涓�涓柟妗�",'error');
+ } else {
+ //鑾峰彇鏁版嵁
+ this.GetSearchProductByIdFn(arr[0].Id, arr[0], "浠锋牸鏀跨瓥", [], arr);
+ }
+ this.cancelFix();
+ }
+ //浠锋牸鏀跨瓥鍖归厤
+ GetSearchProductByIdFn(idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow = true) {
+ //dddd
+ var SeachData = {
+ SearchId: idStr
+ };
+ GetSearchProductById(SeachData).then(result => {
+ var tempObject = {
+ ...{},
+ ...jzDataProductParam
+ }
+ jzDataProductParam = this.countListAndNod(tempObject, result);
+ arrData = [].concat(jzDataProductParam);
+ //杩斿洖鏁版嵁姣旇緝瑙勫垯
+ this.CompareData(result, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow);
+ })
+ }
+ //璁$畻listPrice鐨勫拰浠ュ強nod鍜�
+ countListAndNod(item, result) {
+ var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //鍐呭璐镐俊鎭�
+ var copydate=this.jzDataDefaultCopy;
+ var DeftCopyQtyList = this.jzDataDefaultCopyQuantityList;
+ //璁$畻list鍜宯od鍚堣閫昏緫
+ item=countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList);
+ this.jzDataDefaultCopyQuantityList=DeftCopyQtyLists;
+ var arr = {
+ ...{},
+ ...item
+ };
+ return arr;
+ }
+ //鍖归厤浠锋牸鏀跨瓥鏃舵暟鎹瘮杈冭鍒�
+ CompareData(list, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow) {
+ var TempsJzDataToCompare = CompareDataL(list,this.jzDataDefault);
+ var isChange = isChangeExp;
+ //End
+ if (TempsJzDataToCompare.length == list.length&&list.length!=0) {
+ TempsJzDataToCompare.forEach(TempsItems => {
+ this.ComparePushData(TempsItems.item.Quantity, TempsItems.element.Quantity__c, TempsItems.element.Asset_Model_No__c, idStr, jzDataProductParam, TypeName);
+ });
+ //鍒ゆ柇鏄惁鏄剧ず 鎻愮ず妗�
+ if (isShow) {
+ if (this.ifqianpi) {
+ this.Alert("淇冮攢鏂规閫夋嫨瀹屾垚", 'success');
+ }
+ }
+ } else {
+ if (isShow) {
+ if (this.ifqianpi) {
+ this.Alert("淇冮攢鏂规涓嶆弧瓒筹紝璇烽噸鏂伴�夋嫨",'error');
+ }
+ }
+ return;
+ }
+ if (isChange) {
+ this.ChangeNumZeroTrueChanges();
+ }
+ var temps = this.CompareFullData;
+ //娣诲姞
+ this.UpdateJZData(arrData);
+ //鏇存柊娆℃暟
+ this.updatesNums();
+ //鍚堝苟閲嶅浠锋牸鏀跨瓥鏂规
+ var jzarr = [].concat(this.jzDataFixedPrice);;
+ this.MergeDuplicateSchemes(jzarr);
+ //淇濆瓨鏈�澶ф鏁�
+ this.savecount(idStr);
+ //璁$畻浠锋牸
+ this.ComputeData(idStr, '浠锋牸鏀跨瓥');
+ }
+ ComparePushData(length, Quantity, Asset_Model_No__c, Id, jzDataProductParam, TypeName) {
+ //淇敼 浜у搧鏄庣粏
+ let num = parseInt(length / Quantity);
+ var newDataDefault = ComparePushDataLogic(this.jzDataDefault,this.jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num);
+ this.jzDataProduct = jzDataProductExp;
+ this.ContractPriceCompute();
+ this.jzDataDefault = newDataDefault;
+ this.ChangeNumZeroTrue();
+ this.AddNums(TypeName, Asset_Model_No__c, num, Id);
+ }
+ ChangeNumZeroTrueChanges() {
+ if (this.jzDataDefault.length != this.ChangeNumZeroTrueData) {
+ this.jzDataDefault = this.ChangeNumZeroTrueData;
+ }
+ }
+ UpdateJZData(arrs) { //arrs 閫変腑鐨勬暟鎹泦鍚�
+ if (this.jzDataFixedPrice == null || this.jzDataFixedPrice.length <= 0) {
+ this.jzDataFixedPrice = arrs;
+ } else {
+ this.jzDataFixedPrice = this.jzDataFixedPrice.concat(arrs);
+ };
+ }
+ // =======鏇存柊淇冮攢鏂规娆℃暟鏁版嵁
+ updatesNums() {
+ var jzDataFixedPriceTemp = [].concat(this.jzDataFixedPrice);
+ var jzDataDiscountTemp = [].concat(this.jzDataDiscount);
+ var CompareFullData = this.CompareFullData;
+ updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData);
+ this.jzDataFixedPrice = jzDataFixedPriceTemps;
+ this.jzDataDiscount = jzDataDiscountTemps;
+ }
+ //鍚堝苟閲嶅浠锋牸鏀跨瓥鏂规
+ MergeDuplicateSchemes(SchemeSet) {
+ var arr = [];
+ arr = MergeDuplicateSchemesLogic(this.CompareFullData,SchemeSet);
+ this.CompareFullData = CompareFullDataExp;
+ this.jzDataFixedPrice = [].concat(arr);
+ this.ConsolidationProgramProducts(arr);
+ }
+ //璁$畻浠锋牸鏀跨瓥浠锋牸
+ ComputeData(id, category) {
+ this.ReplacementUnitPrice();
+ //鏁版嵁
+ this.updateIdStr("3");
+ var arrTemp = this.jzDataFixedPrice; // id 浠锋牸鏀跨瓥
+ this.updateIdStr("1");
+ var arrProductTemp = this.jzDataProduct; // PromotionId 浜у搧鏄庣粏
+ var arrTemp2 = this.jzDataDefault; //寰呴�変骇鍝�
+ if (category == '浠锋牸鏀跨瓥') {
+ arrTemp.forEach(item => { // item浠锋牸鏀跨瓥
+ if (id == item.Id) {
+ item.Total = item.Counts * item.Price_CNY__c;
+ item.sumNoDiscountTotal = item.sumNoDiscount * item.Counts;
+ //璁$畻淇冮攢鎬讳环&& item.HeTongTotal == undefined
+ if (item.Price_CNY__c != undefined) {
+ if (item.determine != '鏀硅繃') {
+ if (item.if_Contain_Nod__c) {
+ item.HeTongTotal = item.Total;
+ } else {
+ item.HeTongTotal = item.Total + item.sumNoDiscountTotal;
+ }
+ }
+ }
+ //璁$畻閫夋嫨淇冮攢鏀跨瓥鐨勭粡閿�鍟嗗崟浠峰拰灏忚
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Promotion") { //淇冮攢鏂规
+ arrProductTemp = ComputeDataPromotionLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault);
+ this.newArrsTemp3 = newArrsTemp3Exp;
+ this.newArrsTemp4 = newArrsTemp4Exp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultCopy = jzDataDefaultCopyExp;
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ } else if (PromotionHeadRecordId == "NormalProduct") { //涓�鑸骇鍝�
+ //todu3
+ arrProductTemp = ComputeDataNormalProductLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault);
+ this.newArrsTemp3 = newArrsTemp3Exp;
+ this.newArrsTemp4 = newArrsTemp4Exp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultCopy = jzDataDefaultCopyExp;
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ }
+ });
+ this.jzDataFixedPrice = [].concat(arrTemp);
+ }
+ }
+ ReplacementUnitPrice() {
+ var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //鍐呭璐�
+ var arr = [].concat(this.jzDataProduct);//20230214
+ this.jzDataProduct = [].concat(ReplacementUnitPriceLogic(arr, ifTrade));//20230214
+ this.ContractPriceCompute();
+ }
+ //淇濆瓨鏈�澶ф鏁�
+ savecount(idStr) { //idStr 閫変腑鐨勬暟鎹甀D
+ this.jzDataFixedPrice = savecountLogic(this.jzDataFixedPrice,idStr);
+ }
+ ChangeNumZeroTrueData = []
+ ChangeNumZeroTrue() {
+ this.ChangeNumZeroTrueData = [].concat(this.jzDataDefault);
+ var newJzDataDefault = this.ChangeNumZeroTrueData.filter(item => {
+ if (item.Quantity > 0) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ this.ChangeNumZeroTrueData = newJzDataDefault;
+ }
+ //鐢ㄤ簬濉厖娆℃暟
+ CompareFullData = []
+ AddNums(ListName, Asset_Model_No__c, addNums, Id) {
+ this.CompareFullData = AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,this.CompareFullData);
+ }
+ //褰掑苟鐩稿悓浠锋牸鏀跨瓥鏂规鐨勪骇鍝�
+ ConsolidationProgramProducts(arrSchemes) {
+ var jzdataList = [].concat(this.jzDataProduct);
+ this.jzDataProduct = PriceConsolidation(arrSchemes, jzdataList);
+ }
+ //淇冮攢鏂规鍒楄〃鏁版嵁
+ @track jzData = [];
+ //淇冮攢鏂规鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsLoding = true;
+ // 淇冮攢鏂规鍒楄〃鍒楅厤缃�
+ @track
+ initDataTable =initDataTable2;
+ jzdateflag=true;
+ IsLoading6 = false;
+ //淇冮攢鏂规鍒楄〃缂栬緫鍒椾繚瀛�
+ savejzData(event){
+ var data = event.detail.rows;
+ for (var i = 0; i < this.jzData.length; i++) {
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].Id.replace("row-", "");
+ if (this.jzData[i].Id == id) {
+ this.jzData[i].Quantity__c=data[j].Quantity__c;
+ }
+ }
+ }
+ this.jzdateflag = false;
+ this.IsLoading6 = true;
+ setTimeout(() => {
+ this.jzdateflag = true;
+ this.IsLoading6 = false;
+ }, 1000);
+ }
+ //============淇冮攢鏂规妯℃�佹 end==========
+ //**********浠锋牸鏀跨瓥 end**********
-// <!-- 鍋滄棰勮 20210930 lt add MarkRed(); -->
-// <apex:actionFunction action="{!Save}" name="Save" reRender="mainForm,message1" oncomplete="unblockUI();MarkRed();"/>
-// <!-- 鎶ヤ环璇曠畻 -->
-// <apex:actionFunction action="{!Jump}" name="Jump" reRender="mainForm" oncomplete="unblockUI();" />
-// <apex:actionFunction action="{!OppReflection}" name="OppReflection" reRender="mainForm" oncomplete="unblockUI();"/>
-// <apex:actionFunction action="{!Print}" name="Print" reRender="mainForm" oncomplete="openQuotePage('{!quo.Contract__c}','{!errorflg}','{!quoid}');unblockUI();"/>
-// <lightning-card id="block">
-// <lightning-input type="hidden" value="{!oppInfo.Direct_Separate}" id="Direct_Separate"/>
-// <lightning-input type="hidden" value="{!oppInfo.Trade}" id="Trade"/>
-// <lightning-input type="hidden" value="{!oppId}" id="oppId"/>
-// <lightning-input type="hidden" value="{!SalesId1}" id="SalesId1"/>
-// <lightning-input type="hidden" value="{!qb.PriceRefreshPeriod}" id="hidden_PriceRefreshPeriod"/>
-// <lightning-input type="hidden" value="{!qb.Estimation_List_Price}" id="hidden_Estimation_List" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!DisCalculation}" id="DisCalculationvalue" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!DisAmount}" id="hidden_DisAmountvalue" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!Salesprofit1}" id="Salesprofit1value" rendered="{!displayFlg}"/>
-// <!-- 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗘姌鎵� start -->
-// <lightning-input type="hidden" value="{!AgencyDiscount}" id="AgencyDiscountValue" rendered="{!displayFlg}"/>
-// <!-- 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗘姌鎵� end -->
-// <lightning-input type="hidden" value="{!Salesprofit2}" id="Salesprofit2value" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!qb.SalesCalculation1}" id="SalesCalculation1value" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!qb.SalesCalculation2}" id="SalesCalculation2value" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!quoStocking_Price_c}" id="hidden_Stocking_Price" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!oppInfo.Wholesale_Price}" id="hidden_Wholesale_Price" rendered="{!displayFlg}"/>
-// <!-- 澶氬勾淇濅慨 start -->
-// <lightning-input type="hidden" id="hidden_MultiYearWarrantyTotalPrice" value="{!quo.MultiYearWarrantyTotalPrice__c}"/>
-// <!-- 澶氬勾淇濅慨 end -->
-// <lightning-input type="hidden" value="{!enableSales}" id="SalesRoot_Flg"/>
-// <lightning-input type="hidden" value="{!oppInfo.CurrencyIsoCode}" id="CurrencyIsoCode"/>
-// <lightning-input type="hidden" value="{!baseUrl}" id="baseUrl"/>
-// <lightning-input type="hidden" value="{!WinOrDecideAlert}" id="SFDA_Flg"/>
-// <!-- LHJ Start -->
-// <lightning-input type="hidden" value="{!oppInfo.Authorized_DB_No}" id="Authorized_DB_No" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" value="{!oppInfo.If_Need_Authorize}" id="If_Need_Authorize" rendered="{!displayFlg}"/>
-// <!-- LHJ End -->
-// <template id="message1">
-// <apex:messages styleClass="editListError"/>
-// </template>
-// <template if:true="{!errorflg}" >
-// <table width="100%">
-// <tr>
-// <td align="left"><div class="errorMsg">{!errorMessage}</div></td>
-// </tr>
-// </table>
-// </template>
-// <template if:true="{!errorflg}" >
-// <table width="100%">
-// <tr>
-// <td align="left"><div style="font-size:22px" class="errorMsg">{!errorMessagechack}</div></td>
-// </tr>
-// </table>
-// </template>
-// <template if:true="{!Messageflg}" >
-// <table width="100%">
-// <tr>
-// <td align="left">{!Message}</td>
-// </tr>
-// </table>
-// </template>
-// <div>
-// <table border="0">
-// <tr>
-// <th style="text-align:right;width:90px;">{Label.Quoto_No}</th>
-// <td style="text-align:right;width:130px;"><span>{quo.Quote_No__c}</span></td>
-// <th style="text-align:right;width:80px;">{Label.Quoto_Name}</th>
-// <td style="width:110px;"><div class="requiredInput"><div class="requiredBlock"></div><lightning-input-field value={quo.QuoteName__c} /></div></td>
-// <th style="text-align:right;width:100px;">{Label.HP_Name}</th>
-// <td style="width:180px;"><span>{oppInfo.HP_Name}</span></td>
-// <th style="text-align:right;width:100px;">{Label.Department_Name}</th>
-// <td style="width:130px;"><span>{oppInfo.Department_Name}</span></td>
-// <th style="text-align:right;width:90px;">{Label.Currency}</th>
-// <td style="width:80px;"><span>{oppInfo.CurrencyIsoCode}</span></td>
-// </tr>
-// <tr>
-// <th style="text-align:right">{displayFlg ? Label.Total_ListPrice : ''}</th>
-// <td style="text-align:right;"><lightning-formatted-text id="Estimation_List_Price" style={displayFlg ? '' : 'display:none'} value="{0, number, ###,##0.00}">
-// <slot>{qb.Estimation_List_Price}</slot>
-// </lightning-formatted-text></td>
-// <th style="text-align:right;">{displayFlg ? Label.Total_Price : ''}</th>
-// <td><div style={displayFlg ? '' : 'display:none'}><lightning-input-field id="quoTotalPrice" value={quo.QuoteTotal_Page__c} onchange={quoteTotalPriceAction} disabled={true} style="text-align:right;"/></div></td>
-// <th style="text-align:right;">{displayFlg ? Label.Contact_Price : ''}</th>
-// <td><div class="requiredInput"><div class="requiredBlock"></div><lightning-input-field id="Dealer_Final_Price" value={quo.Dealer_Final_Price_Page__c} onchange={calFromContactPrice} onblur={setOCMAmount} onclick={quoteAgencyTotalPriceAction1} style={displayFlg ? '' : 'display:none'} ></lightning-input-field></div></td>
-// <th style="text-align:right;">{displayFlg ? Label.Forecast_Amounts : ''}</th>
-// <td style={displayFlg ? '' : 'display:none'}><span id="Wholesale_Price">{oppInfo.Wholesale_Price}</span></td>
-// <th style="text-align:right">{Label.Sales_Root}</th>
-// <td><span id="Sales_Root">{oppInfo.Sales_Root}</span></td>
-// </tr>
-// </table>
-// <table border="0">
-// <tr>
-// <th style="text-align:right;width:50px;"> </th>
-// <td style="text-align:right;width:110px;"><lightning-button onclick={productCompare} label={Label.Status_Update}></lightning-button></td>
-// <th style="text-align:right;width:50px;"> </th>
-// <td style="text-align:right;width:100px;"><lightning-button onclick={updateOtcode} label="鏇挎崲浜у搧otcode" ></lightning-button></td>
-// <th style="text-align:right;width:50px;"> </th>
-// <td style="width:110px;"><lightning-button id="SetProduct" onclick={searchSetProductSI} label={Label.Set_Product}></lightning-button></td>
-// <th style="text-align:right;width:50px;"> </th>
-// <td style="width:130px;"><lightning-button onclick={openQuoteExcelImport} label={Label.Excel_Import}></lightning-button></td>
-// <td style="text-align:right;width:50px;"><lightning-button id="Btn_RowDelete" onclick={IfRadioChecker2.bind(this, 'del')} value="{!Label.deleteLabel}" style="width:60px;"></lightning-button></td>
-// <!-- 娣诲姞琛� -->
-// <td width="40px;">
-// <lightning-button onclick={openAddMultipleRow} label="澧炲姞琛�" ></lightning-button>
-// </td>
-// <td style="width:130px;">
-// <lightning-button id="Btn_RowUp" onclick={radioChecker2.bind(this, 'up')} value="{!Label.Row_Up}" style="width:60px;"></lightning-button>
-// <lightning-button id="Btn_RowDown" onclick={radioChecker2.bind(this, 'down')} value="{!Label.Row_Down}" style="width:60px;"></lightning-button>
-// </td>
-// <th style="text-align:right;width:100px;">涓绘満瑁呮満鍦扮偣</th>
-// <td><lightning-input-field value={quo.Installation_location__c} /></td>
-// <th style="text-align:right;width:90px;">{displayCost && displayFlg ? Label.Cost : ''}</th>
-// <td style="text-align:right;width:80px;"><lightning-formatted-text id="Stocking_Price" value="{0, number, ###,##0.00}" style={displayCost && displayFlg ? '' : 'display:none;'}><apex:param value={quoStocking_Price_c}/></lightning-formatted-text></td>
-// </tr>
-// </table>
-// </div>
-// <!-- 澶氬勾淇濅慨 start -->
-// <!-- 鍘熶唬鐮� start
-// <table>
-// <tr>
-// <td> </td>
-// </tr>
-// </table>
-// -->
-// <!-- 鍘熶唬鐮� end -->
-// <table>
-// <tr>
-// <td> </td>
-// </tr>
-// <tr>
-// <th style="text-align:right;width:30px;"> </th>
-// <th style="text-align:right;width:50px;">鍚堝悓淇濅慨鏈燂紙骞达級: </th>
-// <td style="width:190px;">
-// <lightning-input-field id="AllGurantee_Period" value={quo.Gurantee_Period__c} onchange={calGuranteePeriod} style="width:50px; text-align:right;"></lightning-input-field>
-// <input type="hidden" id="Gurantee_Period_c" value={quo.Gurantee_Period__c}/>
-// </td>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount 鍚堣 闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 start -->
-// <template if:true={contractWarranty}>
-// <th style="text-align:right;width:50px;">
-// {!quoteObject.fields.MultiYearWarrantyTotalPrice__c.label}
-// </th>
-// <td style="width:470px;">
-// <lightning-formatted-text id="MultiYearWarrantyTotalPrice_out" value={quo.MultiYearWarrantyTotalPrice__c} style="text-align:right;width:180px;"></lightning-formatted-text>
-// </td>
-// <th style="text-align:right;width:50px;">
-// {!quoteObject.fields.multiYearWarranty__c.label}
-// </th>
-// <td style="width:200px;">
-// <lightning-input type="number" min="0" max="99" id="multiYearWarranty" value={quo.multiYearWarranty__c} onchange={callFromCancelgurantee_MD} style="text-align:right;width:30px;"></lightning-input>
-// </td>
-// </template>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount 鍚堣 闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 end -->
-// </tr>
-// <!-- 娣诲姞琛� 鏀惧湪澶栭潰 鍥犱负鍐呭璐镐笉鍚�-->
-// <!-- <th style="text-align:right;width:50px;">
-// 娣诲姞琛�
-// : </th> -->
-// <!-- 娣诲姞琛� html鐗规�у鍔犳粦鍔ㄦ潯 绮剧悽鎶�鏈� wql 2021/02/09 start -->
-// <!-- 鍙兘杈撳叆姝f暣鏁� 杈撳叆鍏跺畠浼氬己鍒舵竻绌� -->
-// <td style="width:200px;display: none;">
-// <div class="" id="speedDiv" style="">
-// <!-- <p>鍛ㄦ湡</p>
-// <input type="range" id="dur" value="0.50" min="0" max="1.00" step="0.01" onchange="changeV()"/>
-// <p>閫熷害</p> -->
-// <p class="diap">鈶犳粦鍔ㄩ�夋嫨琛屾暟!</p>
-// <!-- 婊戞潯 -->
-// <input type="range" id="speed" value="50" min="0" max="100" step="1" onchange="changeV()" style="background: linear-gradient(to right, rgb(255, 162, 0), white 50%, white);" />
-// <p class="diap">鈶¤緭鍏ラ�夋嫨琛屾暟!</p>
-// <!-- 杈撳叆妗� -->
-// <input id="addMultipleRow" value="50" style="text-align:right;width: 30px;" rendered="{!displayFlg}" class="diaInput" onchange="changeI();" onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
-// onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'0')}else{this.value=this.value.replace(/\D/g,'')}"/>
+ //*********鎶樻墸鏀跨瓥 start**********
+ //閫夋嫨鐗圭害鎶樻墸鎵撳紑鎸夐挳
+ showModalSpecial(){
+ this.QuoteData.forEach(qtd => {
+ if (!qtd.Opportunity.IsAuthorized__c) {
+ this.Alert("璇ヨ浠蜂笉鏄壒绾︾粡閿�鍟嗘巿鏉�",'error');
+ } else {
+ this.ShowSpecial = true;
+ }
+ });
+ }
+ //閫夋嫨涓�鑸姌鎵f墦寮�鎸夐挳
+ showModalCommonly(){
+ this.ShowCommonly = true
+ }
+ //鎶樻墸鏀跨瓥鍒犻櫎鎸夐挳浜嬩欢
+ delectTableDiscount(){
+ let ids = [];
+ for (var j = 0; j < this.SelectedFnDataDiscount.length; j++) {
+ ids.push(this.SelectedFnDataDiscount[j].Id);
+ }
+ this.DeleteSchemeMatching(this.SelectedFnDataDiscount, "鎶樻墸鏀跨瓥");
+ this.delectTableDiscountTemp();
+ this.ContractPriceCompute();
+ }
+ DeleteSchemeMatching(ids, TypeName) {
+ var CompareFullDataTemp = [];
+ ids.forEach(id => {
+ this.jzDataProduct = DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,this.CompareFullData,this.jzDataFixedPrice,this.jzDataDiscount,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultNotChange);
+ CompareFullDataTemp = CompareFullDataTempExp;
+ this.jzDataFixedPrice = jzDataFixedPriceExp;
+ this.jzDataDiscount = jzDataDiscountExp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultNotChange = jzDataDefaultNotChangeExp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ });
+ this.CompareFullData = CompareFullDataTemp;
+ }
+ //鎶樻墸鏀跨瓥閫変腑鍒楄〃鏁版嵁
+ @track SelectedFnDataDiscount = []
+ //鎶樻墸鏀跨瓥閫夋嫨浜嬩欢
+ SelectedFnDiscount(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnDataDiscount = arr;
+ }
+ //鎶樻墸鏀跨瓥鍒楄〃鏁版嵁
+ @track jzDataDiscount = [];
+ //鎶樻墸鏀跨瓥鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsLodingDiscount = true;
+ //鎶樻墸鏀跨瓥鍒楄〃鍒楅厤缃�
+ @track
+ initDataTableDiscount = initDataTableDiscount2;
+ //鎶樻墸鏀跨瓥鍒楄〃鍒楀姞杞芥柟娉�
+ getTableDataDiscount(event) {
+ this.tableIsLodingDiscount = false;
+ }
+ @track
+ Tongzhishow = false; //鎻愮ず鏄剧ず鐨勬爣璇�
+ SaveShowText = "鎿嶄綔鎴愬姛"; //鎻愮ず妗嗙殑鏂囨湰
+ TongzhiIcon = 'standard:account' //鎻愮ず妗嗙殑鍥炬爣
+ IsLeftStyle = "" //鎻愮ず妗嗙殑鏍峰紡
+ BgColorStyle = ""
+ //寮规鎻愮ず content 鍐呭 error 鏄惁鏄敊璇彁绀烘 left 鏄惁灞呭乏
+ Alert(msg,type) {
+ if(type == 'success'){
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type,
+ });
+ this.dispatchEvent(event);
+ }else{
+ const event = new ShowToastEvent({
+ message: msg,
+ variant: type,
+ mode: 'sticky'
+ });
+ this.dispatchEvent(event);
+ }
+ }
+ //鎶樻墸鏀跨瓥缂栬緫鍒椾繚瀛樻柟娉�
+ handleSaveDiscount(event) {
+ this.jzDataDiscount = handleSaveDiscountLogic(this.jzDataDiscount,this.jzDataProduct,event);
+ var boolean = booleanExp;
+ var boolean2 = boolean2Exp;
+ var boolean3 = boolean3Exp;
+ let newData = newDataExp;
+ let newData2 = newData2Exp;
+ let newData3 = newData3Exp;
+ let editnewDate = editnewDateExp;
+ var GuaranteeDiscount__cZuiXiao = GuaranteeDiscount__cZuiXiaoExp;
+ var NormalDiscount__cZuiXiao = NormalDiscount__cZuiXiaoExp;
+ this.jzDataProduct = jzDataProductExp;
+ //haha2
+ debugger
+ if (boolean == 0) {
+ this.jzDataDiscount = newData;
+ var newArrs = [].concat(editnewDate);//20230214
+ newArrs.forEach(item => {
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ this.ComputeDiscount(item.Id, item.NormalDiscount__c_Input, item.GuaranteeDiscount__c_Input, item.Category__c, item.JxsType);
+ });
+ this.jzDataProduct = this.newArrsTemp2.concat(this.newArrsTemp);//20230213
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ this.Alert("鏁版嵁淇敼鎴愬姛", 'success');
+ } else if (boolean == 1) {
+ this.Alert("淇敼閿欒锛屽璞″搧鎶樻墸涓嶅緱灏忎簬瀵硅薄鍝佹渶浣庢姌鎵�:"+GuaranteeDiscount__cZuiXiao+"%",'error');
+ } else if (boolean == 2) {
+ this.Alert("淇敼閿欒锛岄潪瀵硅薄鍝佹姌鎵d笉寰楀皬浜庨潪瀵硅薄鍝佹渶浣庢姌鎵�:"+NormalDiscount__cZuiXiao+"%",'error');
+ } else if (boolean == 3) {
+ this.Alert("淇敼閿欒锛屼竴鑸姌鎵f病鏈夊璞″搧鎶樻墸",'error');
+ } else if (boolean == 5) {
+ this.Alert("闈炲璞″搧鎶樻墸涓嶅彲浠ヤ负绌烘垨灏忎簬0",'error');
+ } else if (boolean == 4) {
+ this.jzDataDiscount = newData;
+ var ffgg=0;
+ if(boolean3){
+ newData2.forEach(HeTo => {
+ //鏍规嵁鍚堝悓浠锋牸璁$畻涓�鑸姌鎵�
+ HeTo = this.ComouteProductDiscount(HeTo.Id,HeTo.Category__c,HeTo.GuaranteeDiscount__c_Input, HeTo.NormalDiscount__c_Input, HeTo.GuaranteeDiscount_H_Money__c,HeTo.NormalDiscount_H_Money__c, HeTo);
+ if(HeTo==1||HeTo==2||HeTo==12||HeTo==3){
+ ffgg=HeTo;
+ return ;
+ }
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ let jzDataDiscountx = [].concat(this.jzDataDiscount);//20230214
+ this.ConsolidatedDiscountPolicy(jzDataDiscountx);
+ //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
+ this.updateCommonlyDiscountLogic(HeTo.Id,HeTo.JxsType,HeTo.GuaranteeDiscount__c_Input,HeTo.NormalDiscount__c_Input,HeTo.Category__c,this.jzDataDiscount);
+ });
+ }
+ if(boolean2&&ffgg==0){
+ newData3.forEach(TeYue=>{
+ //鏍规嵁鍚堝悓浠锋牸璁$畻鐗圭害鎶樻墸
+ GuaranteeDiscount__cZuiXiao=parseFloat(TeYue.GuaranteeDiscount__c);
+ NormalDiscount__cZuiXiao=parseFloat(TeYue.NormalDiscount__c);
+ TeYue=this.ComouteProductDiscount(TeYue.Id,TeYue.Category__c,TeYue.GuaranteeDiscount__c_Input, TeYue.NormalDiscount__c_Input, TeYue.GuaranteeDiscount_H_Money__c,TeYue.NormalDiscount_H_Money__c, TeYue);
+ if(TeYue==1||TeYue==2||TeYue==12||TeYue==3){
+ ffgg=TeYue;
+ return ;
+ }else{
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
+ this.updateCommonlyDiscountLogic(TeYue.Id,TeYue.JxsType,TeYue.GuaranteeDiscount__c_Input,TeYue.NormalDiscount__c_Input,TeYue.Category__c,this.jzDataDiscount);
+ }
+ });
+ }
+ if(ffgg==1||ffgg==2||ffgg==12||ffgg==3){
+ this.Alert(InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao),'error');
+ }else{
+ this.Alert("鏁版嵁淇敼鎴愬姛", 'success');
+ }
+ }
+ //鍒锋柊
+ this.jzshows2 = false;
+ setTimeout(() => {
+ this.jzshows2 = true;
+ }, 800)
+ }
+ newArrsTemp = [];
+ newArrsTemp2 = [];
+ //璁$畻涓�鑸姌鎵i潪瀵硅薄鍝佹姌鎵�
+ ComouteProductDiscount(Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item) {
+ //todu12
+ this.updateIdStr("2");
+ this.updateIdStr("1");
+ var reslut=ReverseCalculationModifyDiscountLogic(this.jzDataDiscount,this.jzDataProduct,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item);
+ this.jzDataDiscount=[].concat(arrTempsss);
+ this.jzDataProduct=[].concat(arrProductTempsss);//20230214
+ return reslut;
+ }
+ //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
+ updateCommonlyDiscountLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount) {
+ //todu13
+ this.updateIdStr("1");
+ this.jzDataProduct=updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,this.jzDataProduct);
+ this.GeneralDiscountContractSummary();
+ }
+ //鏇存敼涓�鑸姌鎵e悎鍚屼环鏍艰绠楀悎鍚屾�讳环
+ GeneralDiscountContractSummary(){
+ this.ContractPrice = 0;
+ var sum = this.ContractPrice;
+ sum = parseFloat(sum);
+ sum=GeneralDiscountContractSummaryLogic(sum,this.jzDataDiscount,this.jzDataFixedPrice);
+ this.ContractPrice = sum;
+ }
+ //鎶樻墸鏀跨瓥鍒楄〃灞曠ず鏍囪瘑
+ jzshows2 = true;
-// <div class="slds-text-align_center">
-// <lightning-button label="纭" onclick={addMultipleRowJS} style="margin: 20px 10px 0px 10px;"></lightning-button>
-// <lightning-button label="鍙栨秷" onclick={popupBoxHide} style="margin: 20px 10px 0px 10px;"></lightning-button>
-// </div>
-// </div>
-// </td>
-// <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy start -->
-// <tr>
-// <th style="text-align:right;width:30px;"> </th>
-// <th style="text-align:left;width:50px;">{!$ObjectType.Quote.fields.QuotationChange__c.label}: </th>
-// <td style="width:190px;"><lightning-input-field id="QuotationChange" value="{!quo.QuotationChange__c}" style="width:80px; text-align:right;" />
-// </td>
-// <th style="text-align:left;width:50px;">{!$ObjectType.Quote.fields.MainEngineWithoutMonitor__c.label}: </th>
-// <td style="width:500px;"><lightning-input-field id="RemarksOnChanges" value="{!quo.MainEngineWithoutMonitor__c}" style="width:450px; text-align:left;" />
-// </td>
-// <th style="text-align:right;width:50px;">
-// {!$ObjectType.Quote.fields.Interdepartmental__c.label}
-// : </th>
-// <td style="width:200px;"><lightning-input-field id="Interdepartmental" value="{!quo.Interdepartmental__c}" style="text-align:right;width:30px;" /></td>
-// </tr>
-// <!-- SWAG-CKDATG 銆愬鎵樸�戙�怬BSAP-鎶ヤ环濮旀墭銆戞姤浠峰鎵橀」鐩敼鍠�1 fy end -->
-// <tr>
-// <td> </td>
-// </tr>
-// </table>
-// <!-- 澶氬勾淇濅慨 end -->
-// <div style="width:1260px;">
-// <div style="overflow-x: auto;">
-// <!-- 澶栬锤澶氬勾淇� 鍐呭璐歌〃鏍奸暱搴︿竴鑷� 鍘�1635px 绮剧悽鎶�鏈� wql 2021/01/28 start -->
-// <table style="width:1935px;" border="0">
-// <!-- 澶栬锤澶氬勾淇� 鍐呭璐歌〃鏍奸暱搴︿竴鑷� 绮剧悽鎶�鏈� wql 2021/01/28 end -->
-// <tr>
-// <th style="text-align:center;width:20px;"> <input type="checkbox" id="checkAll" onclick="selectAll()" style="width:10px;"/></th>
-// <th style="text-align:center;width:15px;">No</th>
-// <th style="text-align:center;width:150px;">{!$Label.Asset_No}</th>
-// <th style="text-align:center;width:100px;">{!$Label.SFDA_Status}</th>
-// <th style="text-align:center;width:100px;">{!$ObjectType.product2.fields.VenderName__c.label}</th>
-
-// <th style="text-align:center;width:85px;">{!$Label.ListPrice}</th>
-// <th style="text-align:center;width:100px;">{!$Label.Quantity}</th>
-// <th style="text-align:center;width:50px;">{!$Label.Specifications}</th>
-// <th style="text-align:center;width:100px;">鍖婚櫌鍗曚环</th>
-// <th style="text-align:center;width:100px;">鍖婚櫌灏忚</th>
-// <!--
-// <th style="text-align:center;width:50px;">{!$Label.Present}</th>
-// --Savebutton-->
+ //============鐗圭害鎶樻墸妯℃�佹 start=========
+ ///鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄩ�夋嫨鏁版嵁
+ @track SelectedFnDataSpecial = [];
+ //鐗圭害鎶樻墸妯℃�佹閿欒鎻愮ず寮�鍏�
+ ShowSpecialIsError = false;
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄩ�変腑鏂规硶
+ SelectedFnSpecial(event) {
+ let arr = event.detail.rows;
+ if (event.detail.rows.length > 1) {
+ this.ShowSpecialIsError = true;
+ } else {
+ this.ShowSpecialIsError = false;
+ }
+ var TempArr = [];
+ TempArr.push(arr[0])
+ var tempObject = {
+ ...{},
+ ...TempArr[0]
+ }
+ tempObject.CompareId = GetUUID();
+ this.SelectedFnDataSpecial = [tempObject];
+ }
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄥ姞杞芥柟娉�
+ getTableDataSpecial(event) {
+ let listQuery = event.detail.listQuery;
+ var Agency1__c = this.QuoteData[0].Agency1__c;
+ listQuery.pageLimit = 40;
+ listQuery.Agency1c = Agency1__c;
+ GetAuthorizerSearch(listQuery).then(result => {
+ var responseObj = JSON.parse(result);
+ this.jzDataSpecial = responseObj.records;
+ this.jzDataSpecial.forEach(element => {
+ element.JxsType = "鐗圭害鎶樻墸";
+ element.NormalDiscount__c = element.NormalDiscount__c+"%";
+ element.GuaranteeDiscount__c = element.GuaranteeDiscount__c+'%';
+ });
+ GetAgencyRName().then(gar => { //鑾峰彇缁忛攢鍟嗗鍚�
+ var a = JSON.parse(gar);
+ a.forEach(ga => {
+ if (ga.Agency__r != undefined) {
+ var arr = [];
+ this.jzDataSpecial.forEach(jzdsc => { //鐗圭害鎶樻墸鏂规鏁版嵁
+ if (ga.Agency__c == jzdsc.Agency__c) {
+ jzdsc.Agency__Name = ga.Agency__r.Name;
+ arr.push(jzdsc);
+ } else {
+ arr.push(jzdsc);
+ }
+ });
+ this.jzDataSpecial = [].concat(arr);//20230214
+ }
+ });
+ })
+ this.tableIsLodingSpecial = false;
+ })
+ }
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄥ垪閰嶇疆
+ @track
+ initDataTableSpecial = initDataTableSpecial2;
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄦ暟鎹�
+ @track jzDataSpecial = [];
+ //鐗圭害鎶樻墸寰呴�夋柟妗堝垪琛ㄥ姞杞藉姩鍥炬爣璇�
+ @track tableIsLodingSpecial = true;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄩ�夋嫨鏁版嵁
+ @track SelectedOtherDataArr = [];
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄩ�変腑鏂规硶
+ SelectedFnOtherData(event) {
+ let arr = event.detail.rows;
+ this.SelectedOtherDataArr = arr;
+ }
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄥ垪閰嶇疆
+ @track
+ initDataTableOtherData = initDataTableOtherData2;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄦ暟鎹�
+ @track jzDataOtherData = [];
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄥ姞杞藉姩鍥炬爣璇�
+ @track tableIsLodingOtherData = true;
+ //鐗圭害鎶樻墸妯℃�佹寮�鍏�
+ @track ShowSpecial;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄥ姞杞芥柟娉�
+ getTableDataOtherData(event) {
+ if (!this.IsLoadingFlag1) {
+ return
+ };
+ this.jzDataOtherData = this.jzDataDefault;
+ var jzDataOtherDataTemp = [];
+ this.jzDataOtherData.forEach(jzdod => {
+ var ItemsTemp = {
+ ...{},
+ ...jzdod
+ };
+ ItemsTemp.SplitQuantity = ItemsTemp.Quantity;
+ jzDataOtherDataTemp.push(ItemsTemp);
+ })
+ this.jzDataOtherData = jzDataOtherDataTemp;
+ this.tableIsLodingOtherData = false;
+ }
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸垪琛ㄥ鍔犺浇鍔ㄥ浘鏍囪瘑
+ IsLoading5 = false;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佸睍绀烘爣璇�
+ jzshows5 = true;
+ //
+ IsLoadingFlag1 = true;
+ //鐗圭害鎶樻墸寰呴�変骇鍝佺紪杈戝垪淇濆瓨鏂规硶
+ SaveSpecialDiscount(event) {
+ debugger
+ var data = event.detail.rows;
+ let newData = [];
+ let editnewDate = [];
+ var boolean = 1;
+ for (var i = 0; i < this.jzDataOtherData.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].Id;
+ if (this.jzDataOtherData[i].Id == id) {
+ editData = {
+ SplitQuantity: ''
+ };
+ //鎷嗗垎娆℃暟
+ editData.SplitQuantity = data[j].SplitQuantity;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...this.jzDataOtherData[i],
+ ...{}
+ };
+ if (editData.SplitQuantity != undefined) {
+ newItem.SplitQuantity = Number(editData.SplitQuantity);
+ }
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...this.jzDataOtherData[i]
+ });
+ }
+ }
+ //haha4
+ var newArrs = [].concat(editnewDate);//20230214
+ newArrs.forEach(item => {
+ if (item.Quantity < item.SplitQuantity) {
+ boolean = 2;
+ } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') {
+ boolean = 3;
+ }
+ });
+ if (boolean == 1) {
+ this.jzDataOtherData = newData;
+ this.ShowSpecialIsError = false;
+ } else if (boolean == 2) {
+ this.errorTiShi("淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰楀ぇ浜庢暟閲�");
+ } else if (boolean == 3) {
+ this.errorTiShi("淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰椾负0鎴栦负绌�");
+ }
-// <!-- 2018/09/28 CHAN-B4YAB8 璧犻�併�佺粡閿�鍟嗕环鏍煎拰灏忚 end -->
-// <!-- 澶氬勾淇濅慨 start -->
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷澶氬勾淇濅慨 淇濅慨 闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 start -->
-// <apex:variable value="{!1}" var="abc" >
-// <th style="text-align:center;width:50px;">
-// {!$ObjectType.QuoteLineItem.fields.multiYearWarranty__c.label}
-// </th>
-// <th style="text-align:center;width:150px;">
-// {!$ObjectType.QuoteLineItem.fields.warrantyType__c.label}
-// </th>
-
-// </apex:variable>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷澶氬勾淇濅慨 淇濅慨 闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 end -->
-// <th style="text-align:center;width:50px;">
-// {!$ObjectType.QuoteLineItem.fields.GuaranteePeriod__c.label}</th>
-// <!-- 澶氬勾淇濅慨 end -->
-// <!-- 鏂板姞鐨� -->
-
-// <!-- SFDC鍋滄棰勮锛堥璁℃秷鑰楀埌鏈熸棩锛� lt 20210924 add start -->
-// <th style="text-align:center;width:130px;">{!$ObjectType.product2.fields.Estimated_ConsumptionDueDate__c.label}</th>
-// <!-- SFDC鍋滄棰勮锛堥璁℃秷鑰楀埌鏈熸棩锛� lt 20210924 add end -->
-
-// <th style="text-align:center;width:100px;">搴撳瓨鐘舵��</th>
-// <th style="text-align:center;width:100px;">浜у搧閰嶅</th>
-// <th style="text-align:center;width:350px;">{!$Label.Product_Name}</th>
-
-// <th style="text-align:center;width:100px;" hidden="hidden">{!$Label.AgencyPrice}</th>
-// <th style="text-align:center;width:100px;" hidden="hidden">{!$Label.AgencySum_Total}</th>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 start -->
-// <apex:variable value="{!1}" var="abc" >
-// <th style="text-align:center;width:100px;" hidden="hidden">
-// {!$ObjectType.QuoteLineItem.fields.NoDiscountTotal__c.label}
-// </th>
-// </apex:variable>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 end -->
-// <th style="text-align:center;width:20px;"><apex:image id="plusicon" value="{!$Resource.plusicon}" onclick="addRowJs(0);"/></th>
-// </tr>
-// </table>
-// <!-- 澶栬锤澶氬勾淇� 鍐呭璐竧able涓�鑷� 绮剧悽鎶�鏈� wql 2021/01/28 start -->
-// <div id="iframelike" style="width:1960px;">
-// <input type="hidden" id="ListPriceTotal" value="0" />
-// <input type="hidden" id="UnitPriceTotal" value="0" />
-// <template id="listsTable">
-// <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;width:1938px;" border="">
-// <!-- 澶栬锤澶氬勾淇� 鍐呭璐竧able涓�鑷� 绮剧悽鎶�鏈� wql 2021/01/28 end -->
-// <apex:variable value="{!1}" var="cnt" />
-// <apex:variable value="{!0}" var="CntIndex" />
-// <colgroup span="11"></colgroup>
-// <template for:each={} for:item="" for:index="">
-// <apex:repeat value="{!activities}" var="s" id="lists">
-// <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
-// <td class="dataCell" style="width:20px;">
-// <input type="checkbox" name="checklist" value="{!s.lineNo}" style="width:10px;"/>
-// </td>
-// <td class="dataCell" style="width:15px;text-align:right;">
-// <apex:outputLabel id="indexNo" value="{!IF(s.PageObject.Id__c==null,null,s.lineNo + 1)}" style="width:10px;"/>
-// </td>
-// <td class="dataCell" style="text-align:center;width:150px;">
-// <lightning-input id="Assert" style="width:120px;" value="{!s.Asset_Model}" onclick="searchProduct('{!s.lineNo}',this.value, '')" />
-// </td>
-// <td class="dataCell" id="{!Text(cnt-1)}:td_Status__c" style="width:100px;">
-// <lightning-output-field style="width:75px;" id="Status__c" value="{!s.PageObject.SFDA_Status__c}"/>
-// <lightning-input type="hidden" id="SFDA" value="{!s.PageObject.SFDA_Status__c}"/>
-// <template layout="none" rendered="{!IF(ISBLANK(s.PageObject.Product_Sales_Possibility__c) || s.PageObject.Product_Sales_Possibility__c == '鈼�', false, true)}">
-// <script type="text/javascript">
-// //alert(j$(escapeVfId('{!Text(cnt-1)}' + ':td_Status__c')).size());
-// j$(escapeVfId('{!Text(cnt-1)}' + ':td_Status__c')).css({"color":"red"});
-// </script>
-// </template>
-// <template layout="none" rendered="{!IF(s.haveno_Register == true, true, false)}">
-// <script type="text/javascript">
-// j$(escapeVfId('{!Text(cnt-1)}' + ':td_Status__c')).css({"color":"red"});
-// </script>
-// </template>
-// </td>
-// <td class="dataCell" style="width:100px;">
-// <lightning-formatted-text id="VenderName" value="{!s.VenderName}" />
-// <lightning-input type="hidden" id="VenderName__c" value="{!s.VenderName}" />
-// <!-- 浜у搧涓绘暟鎹鍔犫�滀笉鍙彇娑堝骞翠繚鈥� 2020/08/28 绮剧悽鎶�鏈� wql start -->
-// <lightning-input type="hidden" id="CanNotCancelledGurantee__c" value="{!s.CanNotCancelledGurantee}" />
-// <!-- 浜у搧涓绘暟鎹鍔犫�滀笉鍙彇娑堝骞翠繚鈥� 2020/08/28 绮剧悽鎶�鏈� wql end -->
-// </td>
-
-// <td class="dataCell" style="width:85px;text-align:right;">
-// <lightning-formatted-text style="width:85px;display:{!IF(displayFlg, '', 'none')}" id="ListPricetext" value="{0, number, ###,##0.00}">
-// <apex:param value="{!s.ListPrice_Page}" />
-// </lightning-formatted-text>
-// <lightning-input type="hidden" id="ListPrice" rendered="{!displayFlg}" value="{!s.ListPrice_Page}"/>
-// </td>
-// <td class="dataCell" style="text-align:center;width:100px;">
-// <!-- 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗崟浠疯绠� start -->
-// <lightning-input-field id="Quantity" style="width:30px;text-align:right;" value="{!s.PageObject.Quantity__c}" onChange="calPrice('{!s.lineNo}');quoteAgencyTotalPriceAction();AgencyDiscountCalculation1();"/>
-// <!-- 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗗崟浠疯绠� end -->
-// </td>
-
-// <td class="dataCell" style="width:50px;text-align:center">
-// <lightning-formatted-text style="width:40px;text-align:center;" id="Specifications" value="{!if(s.latestInfo.Specifications=0||s.latestInfo.Specifications=null,'',s.latestInfo.Specifications)}"/>
-// </td>
-
-// <td class="dataCell" style="text-align:center;width:100px;">
-// <lightning-input-field id="UnitPrice" style="width:80px;text-align:right;" rendered="{!displayFlg}" value="{!s.PageObject.UnitPrice_Page__c}" onChange="calPrice('{!s.lineNo}')"/>
-// <!-- &&IF(s.VenderName!='OSH',false,true) -->
-// <script type="text/javascript">
-// var isOSH = j$(escapeVfId('Page:mainForm:block:lists:'+{!CntIndex}+':VenderName')).value();
-// if(isOSH != 'OSH'&&isOSH != ''){
-// j$(escapeVfId('Page:mainForm:block:lists:'+{!CntIndex}+':UnitPrice')).attr('disabled','disabled');
-// }
-// </script>
-// <apex:variable value="{!CntIndex + 1}" var="CntIndex" />
-// </td>
-
-// <td class="dataCell" style="width:100px;text-align:right;">
-// <lightning-formatted-text style="width:80px;display:{!IF(displayFlg, '', 'none')}" id="TotalPrice" value="{0, number, ###,##0.00}">
-// <apex:param value="{!s.PageObject.Subtotal__c}" />
-// </lightning-formatted-text>
-// <lightning-input type="hidden" id="Subtotal__c" value="{!s.PageObject.Subtotal__c}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="NameCode" value="{!s.latestInfo.ProductCode}"/>
-// <lightning-input type="hidden" id="Product_Name" value="{!s.latestInfo.ProductName}"/>
-// <lightning-input type="hidden" id="Product_SFDA" value="{!s.latestInfo.SFDA_Status}"/>
-// <lightning-input type="hidden" id="Product_Specifications" value="{!s.latestInfo.Specifications}"/>
-// <lightning-input type="hidden" id="Sales_Possibility" value="{!s.latestInfo.Sales_Possibility}"/>
-// <lightning-input type="hidden" id="Product_ListPrice" value="{!s.latestInfo.ListPrice}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="Product_Cost" value="{!s.latestInfo.Cost}"/>
-// <lightning-input type="hidden" id="Cost" value="{!s.Cost_c}"/>
-// <lightning-input type="hidden" id="CostSubTotal" value="{!s.Cost_Subtotal_c}"/>
-// <lightning-input type="hidden" id="Bsscategory" value="{!s.PageObject.BSS_Category__c}"/>
-// <lightning-input type="hidden" id="Product_Id" value="{!s.PageObject.Id__c}"/>
-// <lightning-input type="hidden" id="PricebookEntryId" value="{!s.pageObject.PricebookEntryId}"/>
-// <lightning-input type="hidden" id="lineNo" value="{!s.lineNo}"/>
-// </td>
-
-// <!-- CHAN-B4YAB8 2018/9/28 缁忛攢鍟嗗崟浠峰拰灏忚 start -->
-// <!-- <td class="dataCell" style="width:15px;">
-// <lightning-input-field id="Present__c" style="width:10px;" value="{!s.PageObject.Present__c}"
-// onChange="quoteAgencyTotalPriceAction();AgencyDiscountCalculation1();" />
-// </td> -->
-
-// <!-- CHAN-B4YAB8 2018/9/28 缁忛攢鍟嗗崟浠峰拰灏忚 end -->
-// <!-- 澶氬勾淇濅慨 start -->
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷澶氬勾淇濅慨 淇濅慨鐨勯殣钘� 绮剧悽鎶�鏈� wql 2021/01/28 start rendered="{!IF(trade == '鍐呰部',true,false)}"-->
-// <apex:variable value="{!1}" id="warranty" var="abc" >
-// <td class="dataCell" style="width:50px;text-align:center;">
-// <lightning-input-field style="width:30px; text-align:center; display:{!IF(displayFlg, '', 'none')}" id="itemMultiYearWarranty" html-disabled="true" value="{!s.PageObject.multiYearWarranty__c}" />
-// </td>
-// <td class="dataCell" style="width:150px;text-align:center;">
-// <lightning-input-field style="width:120px; text-align:center; display:{!IF(displayFlg, '', 'none')}" id="warrantyType" html-disabled="true" value="{!s.PageObject.warrantyType__c}" />
-// </td>
-
-// </apex:variable>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷澶氬勾淇濅慨 淇濅慨鐨勯殣钘� 绮剧悽鎶�鏈� wql 2021/01/28 end rendered="{!IF(trade == '鍐呰部',true,false)}"-->
-
-// <td class="dataCell" style="width:50px;text-align:center;">
-// <lightning-output-field style="width:30px; text-align:center; display:{!IF(displayFlg, '', 'none')}" id="itemGuaranteePeriod" value="{!s.PageObject.GuaranteePeriod__c}" />
-// </td>
-// <!-- 澶氬勾淇濅慨 end -->
-
-// <!-- SFDC鍋滄棰勮锛堥璁℃秷鑰楀埌鏈熸棩锛� lt 20210924 add start -->
-// <td class="dataCell" style="width:130px;text-align: center;">
-// <lightning-formatted-text id="Estimated_ConsumptionDueDate" value="{!s.Estimated_ConsumptionDueDate}" />
-// <lightning-input type="hidden" id="Estimated_ConsumptionDueDate1" value="{!s.Estimated_ConsumptionDueDate}" />
-// </td>
-// <!-- SFDC鍋滄棰勮锛堥璁℃秷鑰楀埌鏈熸棩锛� lt 20210924 add end -->
-
-// <!-- 鏂板姞鐨� -->
-// <td class="dataCell" style="width:100px;text-align:center;">
-// <apex:outputLabel id="Storagestatustext" value="{!s.StorageStatus}"/>
-// <lightning-input type="hidden" id="Storagestatus" rendered="{!displayFlg}" value="{!s.StorageStatus}"/>
-// </td>
-// <td class="dataCell" style="width:100px;">
-// <lightning-input type="hidden" id="Product_Set_Name__c" value="{!s.Product_Set_Name}" />
-// <lightning-formatted-text id="Product_Set_Name" value="{!s.Product_Set_Name}" />
-// </td>
-// <td class="dataCell" id="{!Text(cnt-1)}:td_Name__c" style="width:350px;">
-// <div id="Page:mainForm:block:lists:{!s.lineNo}:NameLink"><apex:outputLink style="width:300px;" value="{!baseUrl}/{!s.PageObject.Id__c}" id="Nametext1" target="_blank">{!s.PageObject.Name__c}</apex:outputLink></div>
-// <lightning-input type="hidden" id="Name__c" value="{!s.PageObject.Name__c}"/>
-// <template layout="none" rendered="{!IF(s.wrong_Register == true, true, false)}">
-// <script type="text/javascript">
-// j$(escapeVfId('Page:mainForm:block:lists:{!Text(cnt-1)}' + ':Nametext1')).css({"color":"red"});
-// </script>
-// </template>
-// </td>
-
-// <!-- 鎶ヤ环璇曠畻 娉ㄩ噴 -->
-// <td class="dataCell" style="text-align:center;width:100px;" hidden="hidden">
-// <lightning-input-field id="Agency_UnitPrice" html-disabled="true" style="width:80px;text-align:right;" rendered="{!displayFlg}" value="{!s.PageObject.AgencyUnitPrice__c}" onChange="calAgencyPrice('{!s.lineNo}')"/>
-// </td>
-// <!-- 鎶ヤ环璇曠畻 娉ㄩ噴 -->
-// <td class="dataCell" style="width:100px;text-align:right;" hidden="hidden">
-// <lightning-formatted-text style="width:80px;display:{!IF(displayFlg, '', 'none')}" id="Agency_TotalPrice" value="{0, number, ###,##0.0}">
-// <apex:param value="{!IF(s.PageObject.Id__c==null,null,s.PageObject.AgencySubtotal__c)}"/>
-// </lightning-formatted-text>
-// <lightning-input type="hidden" id="AgencySubtotal__c" value="{!s.PageObject.AgencySubtotal__c}" rendered="{!displayFlg}"/>
-
-// <!-- 澶氬勾淇濅慨 start -->
-// <lightning-input type="hidden" id="GuaranteePeriod__c" value="{!s.PageObject.GuaranteePeriod__c}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="provistonPeriod__c" value="{!s.PageObject.provistonPeriod__c}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="If_Cancel_Guarantee__c" value="{!s.PageObject.If_Cancel_Guarantee__c}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="ServicePrice__c" value="{!s.PageObject.ServicePrice__c}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="GuranteePrice__c" value="{!s.GuranteePrice}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="Maintenance_Price_Year__c" value="{!s.Maintenance_Price_Year}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="GuranteeType" value="{!s.PageObject.GuranteeType__c}" rendered="{!displayFlg}"/>
-
-// <lightning-input type="hidden" id="ProductEntend_gurantee_period_all__c" value="{!s.PageObject.ProductEntend_gurantee_period_all__c}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="ProductGuranteePrice__c" value="{!s.ProductGuranteePrice}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="productServicePrice__c" value="{!s.PageObject.productServicePrice__c}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="latestGuranteeType"
-// value="{!s.latestInfo.GuranteeType}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="latestMaintenance_Price_Year" value="{!s.latestInfo.Maintenance_Price_Year}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="latestIntra_Trade_Gurantee"
-// value="{!s.latestInfo.Intra_Trade_Gurantee}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="latestProductEntend_gurantee_period_all"
-// value="{!s.latestInfo.ProductEntend_gurantee_period_all}" rendered="{!displayFlg}"/>
-// <lightning-input type="hidden" id="latestProductIntra_Trade_Service"
-// value="{!s.latestInfo.Intra_Trade_Service}" rendered="{!displayFlg}"/>
-// <!-- 澶氬勾淇濅慨 end -->
-// </td>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 start rendered="{!IF(trade == '鍐呰部',true,false)}"-->
-// <!--鎶ヤ环璇曠畻 娉ㄩ噴 -->
-// <apex:variable value="{!1}" id="warranty2" var="abc" >
-// <td class="dataCell" style="width:100px;text-align:right;" hidden="hidden">
-// <lightning-input-field style="width:80px;display:{!IF(displayFlg, '', 'none')}" html-disabled="true" id="NoDiscountTotal" value="{!s.PageObject.NoDiscountTotal__c}"/>
-// </td>
-// </apex:variable>
-// <!-- 澶栬锤澶氬勾淇� 鍙栨秷nodiscount闅愯棌 绮剧悽鎶�鏈� wql 2021/01/28 end -->
-// <td class="dataCell" style="width:15px;" >
-// <template if:true="{!s.lineNo < 149}" layout="none">
-// <apex:image id="plusicon" value="{!$Resource.plusicon}" onclick="addRowJs({!s.lineNo + 1});"/>
-// </template>
-// </td>
-// </tr>
-// <apex:variable value="{!cnt + 1}" var="cnt" />
-// </apex:repeat>
-// </table> <!-- /table class="list" -->
-// </template>
-// </div>
-// </div>
-// </div>
-// <BR></BR>
-// <div>
-// <table border="0">
-// <tr>
-// <td>
-// <!--澶氬勾淇濅慨 澧炲姞瀹藉害 start -->
-// <table border="0" style="background-color:#ffd6c1; width: 878px;">
-// <!--澶氬勾淇濅慨 end -->
-// <tr>
-// <th style="width:100px;"> </th>
-// <th style="width:140px;text-align:center;" bgcolor="#ffd6c1">{!$Label.Calculate}</th>
-// <!-- CHAN-B6H4MH 20181114UpdateStart-->
-// <th style="width:120px;text-align:center;" bgcolor="#ffd6c1">{!$Label.AdjustAmount}</th>
-// <!-- <th style="width:120px;" bgcolor="#ffd6c1"> </th>
-// <th style="width:120px;" bgcolor="#ffd6c1"> </th>
-// <th style="width:120px;text-align:center;" bgcolor="#ffd6c1">{!$Label.Calculate}</th>
-// <th style="width:120px;text-align:center;" bgcolor="#ffd6c1">{!$Label.Amount}</th> -->
-// <!-- CHAN-B6H4MH 20181114UpdateEnd-->
-// </tr>
-// <tr>
-// <th style="width:100px;text-align:right">{!$Label.Quote_Adjustment}</th>
-// <td style="width:140px;"><lightning-input style="width:110px;text-align:right" id="QuoCalculation" rendered="{!displayFlg}" value="{!qb.Quote_Adjust_Calculate}" onchange="UnitPriceUpdate();"/></td>
-// <td style="width:120px;"><lightning-input-field style="width:110px;text-align:right" id="QuoAmount" rendered="{!displayFlg}" value="{!quo.Quote_Adjust_Amount_Page__c}" onchange="calFromQuoAmont();"/></td>
-// <!-- CHAN-B6H4MH 20181114UpdateStart-->
-// <!-- <th style="width:120px;" bgcolor="#ffd6c1"> </th>
-// <th style="width:120px;text-align:center">{!$Label.Discount_Amount}</th>
-// <td style="width:120px;text-align:right"><apex:outputLabel style="width:110px;display:{!IF(displayFlg, '', 'none')}" id="DisCalculation" value="{!DisCalculation}"/></td>
-// <td style="width:120px;text-align:right"><lightning-formatted-text style="width:110px;display:{!IF(displayFlg, '', 'none')}" id="DisAmount" value="{0, number, ###,##0.00}"><apex:param value="{!DisAmount}"/></lightning-formatted-text></td> -->
-// <!-- CHAN-B6H4MH 20181114UpdateEnd-->
-// <th style="width:120px;text-align:center;"></th>
-// <td style="width:120px;" align="center">
-// <!-- <lightning-button action="{!Jump}" rerender="hiddenQuoid" value="璺宠浆" style="width:90px;"
-// /> -->
-// <lightning-button onclick="JumpJs();return false;" style="width:90px;" value="鎶ヤ环璁$畻"
-// />
-// </td>
-// <th style="width:100px;" bgcolor="#ffd6c1">
-// <!-- 鐢ㄨ繖涓� disabled 棰滆壊澶殫 -->
-// 鏄惁杩涜杩囨姤浠疯绠楋細<lightning-input-field style="width:20px;text-align:right" id="IsQuoteTrial" rendered="{!displayFlg}" value="{!quo.IsQuoteTrial__c}" onclick="return false;" />
-// </th>
-// </tr>
-// <tr><!-- style="display:{!IF(oppInfo.Account_RecordType_DeveloperName!='AgencyContract','table-row','none')};" -->
-// <th style="width:100px;"> </th>
-// <th colspan="2" style="width:260px;text-align:center;">{!$Label.Sales_Name}</th>
-// <!-- 鎶ヤ环璇曠畻娉ㄩ噴 -->
-// <!-- <th style="width:120px;text-align:center;">{!$Label.Sales_Div}</th> -->
-// <th style="width:120px;text-align:center;"></th>
-// <th style="width:120px;text-align:center;">{!$Label.Amount}</th>
-// <th style="width:120px;text-align:center;">{!$Label.Sales_Profit}</th>
-// <th style="width:120px;text-align:center;">{!$Label.Percent}</th>
-// </tr>
-// <tr>
-// <th style="width:100px;text-align:right;">{!$Label.Sales_Name1}</th>
-// <!-- 2018/09/28 CHAN-B4YAB8 鍘绘帀onchange function getID1(); start -->
-// <td colspan="2" style="width:260px;"><lightning-input-field style="width:230px;" id="SalesName1" value="{!quo.Agency1__c}"/></td>
-// <!-- 2018/09/28 CHAN-B4YAB8 鍘绘帀onchange function getID1(); end -->
-// <!-- 澶氬勾淇濅慨娉ㄩ噴 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗘姌鎵� start -->
-// <!--<td style="width:120px;text-align:center">
-// <lightning-formatted-text style="width:110px;text-align:right" id="AgencyDiscount" value="{!AgencyDiscount}"/>
-// </td> -->
-// <!-- 澶氬勾淇濅慨 绗竴缁忛攢鍟� 鎶樻墸鍙樹负 鍙緭鍏� start -->
-// <td style="width:120px;text-align:center" hidden="hidden">
-// <lightning-input style="width:50px;text-align:right" id="AgencyDiscount" value="{!AgencyDiscount}" onchange="callFromAgencyDiscount();"/>
-// </td>
-// <td style="width:120px;text-align:center" >
-// </td>
-// <!-- 澶氬勾淇濅慨 绗竴缁忛攢鍟� 鎶樻墸鍙樹负 鍙緭鍏� end -->
-// <td style="width:120px;"><lightning-input-field style="width:110px;text-align:right" id="SalesAmount1" value="{!quo.OCM_Agent1_Price_Page__c}" rendered="{!displayFlg}" onchange="salesProfit1();setOCMAmount();quoteAgencyTotalPriceAction1('缁忛攢鍟�');AgencyDiscountCalculation1();"/></td>
-// <!-- 2018/09/28 CHAN-B4YAB8 缁忛攢鍟嗘姌鎵� end -->
-// <td style="width:120px;text-align:right"><apex:outputLabel style="width:110px;display:{!IF(displayFlg, '', 'none')}" id="Salesprofit1" value="{!Salesprofit1}"/></td>
-// <td style="width:120px;text-align:right"><apex:outputLabel style="width:110px;display:{!IF(displayFlg, '', 'none')}" id="SalesCalculation1" value="{!qb.SalesCalculation1}" /></td>
-// </tr>
-// <tr>
-// <th style="width:100px;text-align:right;">{!$Label.Sales_Name2}</th>
-// <td colspan="2" style="width:260px;"><lightning-input-field style="width:230px;" id="SalesName2" value="{!quo.Agency2__c}" onChange="getId2();"/></td>
-// <td style="width:120px;"><apex:outputLabel style="width:110px;text-align:right;" id="SalesShopClass2" value="{!SalesShopClass2}" /></td>
-// <td style="width:120px;"><lightning-input-field style="width:110px;text-align:right;" id="SalesAmount2" value="{!quo.Agent1_Agent2_Price_Page__c}" rendered="{!displayFlg}" onchange="salesProfit2();"/></td>
-// <td style="width:120px;text-align:right;"><apex:outputLabel style="width:110px;display:{!IF(displayFlg, '', 'none')}" id="Salesprofit2" value="{!Salesprofit2}" /></td>
-// <td style="width:120px;text-align:right;"><apex:outputLabel style="width:110px;display:{!IF(displayFlg, '', 'none')}" id="SalesCalculation2" value="{!qb.SalesCalculation2}" /></td>
-// </tr>
-// </table>
-// </td>
-// <td>
-// <table border="0" style="display:{!IF(hiddenSaveBtn, 'none', '')}">
-// <!-- SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek start -->
-// <tr>
-// <td style="width:150px;" align="right"><lightning-button onclick="QuoteConfirmJs();return false;" rendered="{!UnConfirmQuote}" value="纭鎶ヤ环" style="width:90px;" /></td>
-// </tr>
-// <!-- SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek end -->
-// <tr>
-// <th style="width:150px;" align="right"> </th>
-// </tr>
-// <tr>
-// <td style="width:150px;" align="right"><lightning-button onclick="save2btn();return false;" rerender="hiddenQuoid,SFDA_Flg" value="{!$Label.Save_Button}" style="width:90px;" disabled="{!Save_button}" /></td>
-// </tr>
-// <tr>
-// <!-- SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek start -->
-// <td style="width:150px;" align="right"><lightning-button onclick="submitOppoApplyStockJs();return false;" rerender="hiddenQuoid,SFDA_Flg" value="澶囪揣纭鐢宠" style="width:90px;" disabled="{!Save_button}" /></td>
-// <!-- <td style="width:150px;" align="right"><lightning-button onclick="submitOppoApplyStockJs();return false;" rerender="hiddenQuoid,SFDA_Flg" value="澶囪揣纭鐢宠" style="width:90px;" disabled="{!Save_button1}" /></td> -->
-// <!-- SI涓氬姟绯荤粺娴佺▼鏀瑰杽鍜屾彁鍗囬」鐩�2019-10-28 by vivek end -->
-// </tr>
-// <tr>
-// <td style="width:150px;" align="right"><lightning-button onclick="oppReflection2btn();return false;" rerender="hiddenQuoid" value="{!$Label.Opp_Button}" style="width:90px;" disabled="{!Save_button}"/></td>
-// </tr>
-// <tr>
-// <!-- 20211029 lt SFDC鍋滄棰勮 add oncomplete="MarkRed();" -->
-// <td style="width:150px;" align="right"><lightning-button onclick="decision2btn();return false;" rerender="errorMsg,hiddenQuoid,SFDA_Flg" value="{!$Label.QuoteDecision_Button}" style="width:90px;" disabled="{!Decision_button}" oncomplete="MarkRed();"/></td>
-// <!--{!Decision_button} -->
-// </tr>
-// <tr>
-// <!-- 2018/09/28 CHAN-B4YAB8 澶嶅埗绮樿创鏉� start -->
-// <td style="width:150px;" align="right"><lightning-button onClick="copyToClipboardNewQuoteEntry(event, displayCost, document.getElementById( 'Page:mainForm:hiddenQuoid').innerHTML, '{!oppInfo.CurrencyIsoCode}');return false;" value="{!$Label.Copy_Detail}" style="width:90px;" rendered="{!displayFlg}" rerender="dummy"/></td>
-// <!-- 2018/09/28 CHAN-B4YAB8 澶嶅埗绮樿创鏉� end -->
-// </tr>
-// <tr>
-// <td style="width:150px;" align="right">
-// <lightning-button onclick="DownloadCsvGet()" disabled="{!IF(quoId!=null,false,true)}" value="CSV涓嬭浇" style="width:90px;" reRender="dummy"/>
-// </td>
-// </tr>
-// </table>
-// <table border="0" >
-// <tr>
-// <td style="width:150px;" align="right"><lightning-button action="{!Back}" rerender="hiddenQuoid" value="杩斿洖璇环" style="width:90px;" /></td>
-// </tr>
-// <!-- 鎶ヤ环璇曠畻 -->
-// <!-- <tr>
-// <td style="width:150px;" align="right">
-
-// <lightning-button onclick="JumpJs();return false;" style="width:90px;" value="鎶ヤ环璇曠畻"
-// />
-// </td>
-// </tr> -->
-// </table>
-// </td>
-// </tr>
-// </table>
-// <br></br>
-// <!--澶氬勾淇濅慨 澧炲姞瀹藉害 start -->
-// <table border="0" style="background-color:#ffd6c1; width: 878px;">
-// <!--澶氬勾淇濅慨 澧炲姞瀹藉害 end -->
-// <tr>
-// <th style="text-align:right;width:80px;">{!$Label.Quote_Print}</th>
-// <td style="text-align:center;width:80px;"><lightning-input value="{!quo.Unit_Price__c}"/>{!$Label.Detail_Price}</td>
-// <td style="text-align:center;width:80px;"><lightning-input value="{!quo.Offer_Amount__c}"/>{!$Label.Detail_Sum}</td>
-// <td style="text-align:center;width:80px;"><lightning-input value="{!quo.TOTAL__c}"/>{!$Label.Total_Price}</td>
-// <td style="text-align:center;width:80px;"><lightning-input value="{!quo.Discount__c}"/>{!$Label.Total_Discount_Percent}</td>
-// <td style="text-align:center;width:80px;"><lightning-input value="{!quo.Pricing__c}"/>{!$Label.Total_Discount_Amount}</td>
-// <td style="text-align:center;"><lightning-input value="{!quo.Preferential_Trading_Price__c}"/>{!$Label.Row_Total_Sum}</td>
-// <!-- 澶氬勾淇濅慨 start -->
-// <td style="text-align:center;width:80px;"><lightning-input value="{!quo.Preferential_Gurantee_Period__c}"/>{!$ObjectType.Quote.fields.Preferential_Gurantee_Period__c.label}</td>
-// <!-- 澶氬勾淇濅慨 end -->
-// <td style="width:120px;text-align:right" colspan="2"><lightning-input value="{!quo.Contract__c}" rendered="{!enableContract}"/>{!$Label.Contract_Breakdown}</td>
-// </tr>
-// <tr>
-// <th style="text-align:right;width:100px;">{!$Label.Print_HPName}</th>
-// <td colspan="6">
-// <lightning-combobox id="selection_hp" value="{!selection_hp}" style="width:400px;" size="1">
-// <apex:sele
-
-// ctOptions value="{!options_hp}"/>
-// </lightning-combobox>
-// </td>
-// <td colspan="2" align="right" style="display:{!IF(hiddenSaveBtn, 'none', '')}"><lightning-button onclick="print2btn();return false;" value="{!$Label.Print_Button}" style="width:90px;" disabled="{!print_button}" rendered="{!displayFlg}" rerender="dummy"/></td>
-// </tr>
-// </table>
-// </div>
-// </lightning-card>
-// </form>
-// <!-- 娣诲姞琛� html鐗规�у鍔犳粦鍔ㄦ潯 绮剧悽鎶�鏈� wql 2021/02/09 start -->
-// <script type="text/javascript">
-
-// </script>
-// <!-- //娣诲姞琛� html鐗规�у鍔犳粦鍔ㄦ潯 绮剧悽鎶�鏈� wql 2021/02/09 end -->
-
-
-
-
-// </template> -->
\ No newline at end of file
+ //鍒锋柊
+ this.jzshows5 = false;
+ this.IsLoading5 = true;
+ this.IsLoadingFlag1 = false;
+ setTimeout(() => {
+ this.SelectedOtherDataArr = [];
+ this.IsLoading5 = false;
+ this.jzshows5 = true;
+ }, 1000);
+ setTimeout(() => {
+ this.IsLoadingFlag1 = true;
+ }, 2000);
+ }
+ //鐗圭害閿欒鎻愮ず
+ errorTiShi(str){
+ this.ShowSpecialIsError = true;
+ this.ShowSpecial = true;
+ this.ShowSpecialError = str;
+ }
+ //鐗圭害鎶樻墸妯℃�佹鍙栨秷鎸夐挳鏂规硶
+ cancelSpecial() {
+ this.ShowSpecial = false
+ this.ShowSpecialIsError = false;
+ this.SelectedFnDataSpecial = [];
+ this.SelectedOtherDataArr = [];
+ }
+ //鐗圭害鎶樻墸妯℃�佹淇濆瓨鎸夐挳鏂规硶
+ SavesSpecial() {
+ this.ShowSpecialIsError = false;
+ this.ShowSpecial = false;
+ var ItempTempData = {
+ ...{},
+ ...this.SelectedFnDataSpecial[0]
+ };
+ if (this.SelectedOtherDataArr.length == 0 && this.SelectedFnDataSpecial.length != 0) {
+ this.errorTiShi("璇烽�夋嫨鐗圭害鎶樻墸浜у搧锛�");
+ } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length != 0) {
+ this.errorTiShi("璇烽�夋嫨鐗圭害鎶樻墸鏂规锛�");
+ } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length == 0) {
+ this.errorTiShi("璇烽�夋嫨鐗圭害鎶樻墸鏂规鍜屼骇鍝侊紒");
+ } else {
+ ItempTempData.itemss = this.SelectedOtherDataArr;
+ ItempTempData.IsTempItems = true;
+ ItempTempData.NormalDiscount__c_Input = ItempTempData.NormalDiscount__c;
+ ItempTempData.GuaranteeDiscount__c_Input = ItempTempData.GuaranteeDiscount__c;
+ this.SelectedFnDataSpecial[0] = ItempTempData;
+ this.UpdateDiscountData(this.SelectedFnDataSpecial);
+ this.SpecialSavesChange("鐗圭害鎶樻墸", ItempTempData, this.SelectedFnDataSpecial[0].Id, this.SelectedFnDataSpecial[0].CompareId);
+ this.Alert("鐗圭害鎶樻墸閫夋嫨瀹屾垚", 'success');
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType);
+ this.SelectedFnDataSpecial = [];
+ this.SelectedOtherDataArr = [];
+ }
+ }
+ //璁$畻鎶樻墸鏀跨瓥
+ ComputeDiscount(id, NormalDiscount__c_Input, GuaranteeDiscount__c_Input, Category__c, JxsType) {
+ //todu2
+ this.updateIdStr("1");
+ var arrProductTemp = this.jzDataProduct; // PromotionId 浜у搧鏄庣粏
+ this.updateIdStr("2");
+ var arrTemp1 = this.jzDataDiscount; //鎶樻墸鏀跨瓥
+ arrTemp1.forEach(item => { //item鎶樻墸鏀跨瓥
+ if (JxsType == '鐗圭害鎶樻墸') {
+ if (item.JxsType == '鐗圭害鎶樻墸') {
+ if (id == item.Id) {
+ if (item.iftrue != "鏀硅繃" &&
+ item.GuaranteeDiscount__c_Input == undefined &&
+ item.NormalDiscount__c_Input == undefined) {
+ item.GuaranteeDiscount__c_Input = item.GuaranteeDiscount__c;
+ item.NormalDiscount__c_Input = item.NormalDiscount__c;
+ }
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ arrProductTemp = ComputeDiscountAuthorizerLogic(this.newArrsTemp,this.newArrsTemp2,item,arrProductTemp);
+ this.newArrsTemp = newArrsTempExp;
+ this.newArrsTemp2 = newArrsTemp2Exp;
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ }
+ }
+ } else if (JxsType == '涓�鑸姌鎵�') {
+ if (item.JxsType == '涓�鑸姌鎵�') {
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input &&
+ Category__c == item.Category__c) {
+ this.newArrsTemp = [];
+ this.newArrsTemp2 = [];
+ arrProductTemp.forEach(itemss => { //itemss浜у搧鏄庣粏
+ if (itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input &&
+ itemss.Category__c == item.Category__c) {
+ itemss = commonlyDiscountLogic(itemss, item); //涓�鑸姌鎵h绠楅�昏緫
+ this.newArrsTemp.push(itemss);
+ } else if (itemss.Category__c != item.Category__c ||
+ itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) {
+ this.newArrsTemp2.push(itemss);
+ }
+ });
+ this.jzDataProduct = arrProductTemp;
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ }
+ }
+ });
+ this.jzDataDiscount = [].concat(arrTemp1);//20230214
+ }
+ //鎶樻墸鏀跨瓥鍖归厤瑙勫垯
+ SpecialSavesChange(SaveName, SelectedData, IdStr, CompareId) {
+ var newDicountData = [];
+ newDicountData=SpecialSavesChangePartLogic(this.jzDataDefault,SaveName, SelectedData, IdStr, CompareId,0,newDicountData,this.jzDataDiscount);
+ this.jzDataDefault = NewDefaultDatass;
+ this.jzDataProduct =this.jzDataProduct.concat(AddProductDatass);//20230213
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ this.jzDataDiscount = newDicountData;
+ }
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规
+ ConsolidatedDiscountPolicy(SchemeSet) {
+ var arr = [];
+ arr = ConsolidatedDiscountPolicyLogic(SchemeSet, arr);
+ this.jzDataDiscount = [].concat(arr);
+ this.ConsolidatedDiscountDetails(arr);
+ }
+ //鍚堝苟鎶樻墸鏀跨瓥浜у搧鏄庣粏
+ ConsolidatedDiscountDetails(arrSchemes) {
+ var jzdataList = [].concat(this.jzDataProduct);
+ this.jzDataProduct = ConsolidatedDiscountDetailsLogic(arrSchemes, jzdataList);
+ }
+ //=======鐗圭害鎶樻墸妯℃�佹 end======
+ //========涓�鑸姌鎵fā鎬佹 start========
+ //涓�鑸姌鎵fā鎬佹寮�鍏�
+ @track ShowCommonly;
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄥ鍔犺浇鍔ㄥ浘鏍囪瘑
+ IsLoading4 = false;
+ //涓�鑸姌鎵e緟閫変骇鍝佸睍绀烘爣璇�
+ jzshows4 = true;
+ //
+ IsLoadingFlag = true;
+ //涓�鑸姌鎵e緟閫変骇鍝佺紪杈戝垪淇濆瓨鏂规硶
+ SaveGeneralDiscount(event) {
+ var data = event.detail.rows;
+ let newData = SaveGeneralDiscountLogic(data,this.jzDataCommonly);
+ var boolean = booleanExp;
+ if (boolean == 1) {
+ this.jzDataCommonly = newData;
+ this.ShowCommonlyIsError = false;
+ } else if (boolean == 2) {
+ this.ShowCommonlyIsError = true;
+ this.ShowCommonlyError = "淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰楀ぇ浜庢暟閲�";
+ } else if (boolean == 3) {
+ this.ShowCommonlyIsError = true;
+ this.ShowCommonlyError = "淇敼閿欒锛屼娇鐢ㄦ暟閲忎笉寰椾负0鎴栦负绌�";
+ }
+ //鍒锋柊
+ this.jzshows4 = false;
+ this.IsLoading4 = true;
+ this.IsLoadingFlag = false;
+ setTimeout(() => {
+ this.SelectedFnCommonlyData = [];
+ this.IsLoading4 = false;
+ this.jzshows4 = true;
+ }, 1000);
+ setTimeout(() => {
+ this.IsLoadingFlag = true;
+ }, 2000);
+ }
+ //涓�鑸姌鎵fā鎬佹鍙栨秷鎸夐挳鏂规硶
+ cancelCommonly() {
+ this.ShowCommonly = false;
+ this.ShowCommonlyIsError = false;
+ this.SelectedFnCommonlyData = [];
+ this.SaveLb = '';
+ this.SaveZk = '';
+ }
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄥ垪閰嶇疆
+ @track
+ initDataTableCommonly = initDataTableCommonly2;
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄦ暟鎹�
+ @track jzDataCommonly = [];
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄥ姞杞藉姩鍥炬爣璇�
+ @track tableIsLodingCommonly = true;
+ //涓�鑸姌鎵e緟閫夋柟妗堝垪琛ㄥ姞杞芥柟娉�
+ getTableDataCommonly(event) {
+ if (!this.IsLoadingFlag) {
+ return
+ };
+ this.jzDataCommonly = this.jzDataDefault;
+ this.jzDataCommonly = getTableDataCommonlyLogic(this.jzDataCommonly);
+ this.tableIsLodingCommonly = false;
+ }
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄩ�夋嫨鏁版嵁
+ SelectedFnCommonlyData = [];
+ //涓�鑸姌鎵e緟閫変骇鍝佸垪琛ㄩ�変腑鏂规硶
+ SelectedFnCommonly(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnCommonlyData = SelectedFnCommonlyLogic(arr);
+ }
+ //浜у搧绯诲垪鏁版嵁
+ SaveLb = '';
+ //浣跨敤鎶樻墸鏁版嵁
+ SaveZk = '';
+ //浜у搧绯诲垪鏂规硶
+ handleChangeLb(event) {
+ this.SaveLb = event.target.value;
+ }
+ //浣跨敤鎶樻墸鏂规硶
+ handleChangeZk(event) {
+ if (event.target.value !== '') {
+ event.target.value = parseFloat(event.target.value) + "%";
+ }
+ this.SaveZk = event.target.value;
+ }
+ //涓�鑸姌鎵fā鎬佹閿欒鎻愮ず鏂规硶
+ errorTiShiYi(str){
+ this.ShowCommonlyIsError = true;
+ this.ShowCommonlyError = str;
+ }
+ //涓�鑸姌鎵fā鎬佹閿欒鎻愮ず榛樿鍐呭
+ ShowCommonlyError = "璇烽�夋嫨涓�鑸骇鍝侊紒";
+ //涓�鑸姌鎵fā鎬佹閿欒鎻愮ず寮�鍏�
+ ShowCommonlyIsError = false;
+ //涓�鑸姌鎵fā鎬佹鍙栨秷鎸夐挳鏂规硶
+ cancelSaveCommonly() {
+ //澶勭悊鏁版嵁
+ var arr = this.SelectedFnCommonlyData;
+ this.ShowCommonlyIsError = false;
+ if (this.SelectedFnCommonlyData.length != 0) {
+ var ItempTempData = {};
+ ItempTempData.Id = GetUUID();
+ ItempTempData.CompareId = GetUUID();
+ ItempTempData.Name = '涓�鑸姌鎵�';
+ ItempTempData.JxsType = "涓�鑸姌鎵�";
+ ItempTempData.itemss = arr;
+ if (this.SaveLb == '' || this.SaveZk == '') {
+ if (this.SaveLb == '' && this.SaveZk != '') {
+ this.errorTiShiYi("璇烽�夋嫨浜у搧绫诲埆锛�");
+ } else if (this.SaveZk == '' && this.SaveLb != '') {
+ this.errorTiShiYi("璇疯緭鍏ヤ娇鐢ㄦ姌鎵o紒");
+ } else if (this.SaveZk == '' && this.SaveLb == '') {
+ this.errorTiShiYi("璇疯緭鍏ヤ娇鐢ㄦ姌鎵e拰浜у搧绫诲埆锛�");
+ }
+ } else {
+ ItempTempData.Category__c = this.SaveLb;
+ ItempTempData.NormalDiscount__c_Input = this.SaveZk;
+ ItempTempData.if_Contain_Nod__c = false;
+ var TempList = [];
+ TempList.push(ItempTempData);
+ this.UpdateDiscountData(TempList);
+ this.SpecialSavesChange("涓�鑸姌鎵�", ItempTempData, ItempTempData.Id, ItempTempData.CompareId);
+ this.cancelCommonly();
+ this.Alert("涓�鑸姌鎵i�夋嫨瀹屾垚", 'success');
+ this.ConsolidatedDiscountPolicy(this.jzDataDiscount);
+ //璁$畻鎶樻墸鏀跨瓥浠锋牸
+ this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c_Input, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType);
+ }
+ } else {
+ this.errorTiShiYi("璇烽�夋嫨涓�鑸骇鍝侊紒");
+ }
+ }
+ //灏嗕骇鍝佷笌鏂规鍖归厤
+ UpdateDiscountData(arrs) { //閫変腑鐨勬暟鎹�
+ if (this.jzDataDiscount == null || this.jzDataDiscount.length <= 0) {
+ this.jzDataDiscount = arrs;
+ } else {
+ this.jzDataDiscount = this.jzDataDiscount.concat(arrs);
+ }
+ }
+ //========涓�鑸姌鎵fā鎬佹 end=======
+ //浜у搧鏄庣粏鍒犻櫎鏂规硶
+ delectTableProduct(){
+ this.DeleteIsChangesFnSingle(this.SelectedFnProductData);
+ }
+ DeleteIsChangesFnSingle(list) {
+ let num = 0;
+ list.forEach(item => {
+ num++;
+ var falg = true;
+ if (item.TypeName == "浠锋牸鏀跨瓥") {
+ this.DeleteIsChangelogic(item, item.TypeName, num, list);
+ var TempItem = DeleteIsChangesFnjiage(this.jzDataFixedPrice,this.jzDataProduct,falg,item);
+ falg = falgExp;
+ if (TempItem && falg) {
+ this.SelectedFnDataFixedPrice.push(TempItem);
+ this.deleteFixedPriceTemp();
+ }
+ } else if (item.TypeName == "鎶樻墸鏀跨瓥") {
+ this.DeleteIsChangelogic(item, item.TypeName, num, list);
+ var TempItemTOName = DeleteIsChangesFnzhekou(this.jzDataDiscount,this.jzDataProduct,falg,item);
+ falg = falgExp;
+ if (TempItemTOName != undefined && falg) {
+ this.SelectedFnDataDiscount.push(TempItemTOName);
+ this.delectTableDiscountTemp();
+ }
+ }
+ this.ContractPriceCompute();
+ })
+ }
+ //鍒犻櫎浜у搧鏄庣粏鍜屽緟閫変骇鍝� item鏄�変腑鐨勪骇鍝佹槑缁嗗璞� TypeName鏄�変腑鐨勪骇鍝佹槑缁嗗瀵瑰簲鐨勬柟妗堢被鍨�
+ DeleteIsChangelogic(item, TypeName, num, list) {
+ var boofag = DeleteIsChangelogicExp(item,TypeName,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultCopy);
+ this.jzDataProduct = jzDataProductExp;
+ this.jzDataDefault = jzDataDefaultExp;
+ this.jzDataDefaultCopy = jzDataDefaultCopyExp;
+ if(boofag == 1){
+ this.Alert("淇冮攢鏂规鍐呬骇鍝佸瀷鍙凤紝鏁伴噺鍥哄畾锛屼笉鍙垹闄ゆ槑缁�",'error');
+ }else if(boofag == 2){
+ this.Alert("璇ヤ骇鍝佷负涓�鑸骇鍝侊紝涓嶅彲鍒犻櫎鏄庣粏",'error');
+ }
+ //鍚堝悓浠锋牸姹囨��
+ this.ContractPriceCompute();
+ }
+ delectTableDiscountTemp() {
+ this.jzDataDiscount = delectTableDiscountTempLogic(this.SelectedFnDataDiscount,this.jzDataDiscount);
+ this.SelectedFnDataDiscount = [];
+ }
+ //浜у搧鏄庣粏鍒楄〃鏁版嵁鍔犺浇鏂规硶
+ getTableDataProduct(event) {
+ this.tableIsLodingProduct = false;
+ }
+ //浜у搧鏄庣粏閫変腑鍒楄〃鏁版嵁
+ @track SelectedFnProductData = [];
+ //浜у搧鏄庣粏閫変腑鍒楄〃鏂规硶
+ SelectedFnProduct(event) {
+ let arr = event.detail.rows;
+ this.SelectedFnProductData = arr;
+ }
+ //浜у搧鏄庣粏鍒楄〃鍒楅厤缃�
+ @track
+ initDataTableProduct = initDataTableProduct2;
+ //浜у搧鏄庣粏鍒楄〃鏁版嵁
+ @track jzDataProduct = [];
+ //浜у搧鏄庣粏鍒楄〃鍔犺浇鍔ㄥ浘鏍囪瘑
+ @track tableIsLodingProduct = true;
+ //浜у搧鏄庣粏鍒楄〃灞曠ず鏍囪瘑
+ jzshows= true;
+ //鎵撳嵃瀹㈡埛鍚嶇О start
+ selection_hp = '';
+ options_hp = [];
+ options_hpflg = true;
+ get PrintCustomerNameoptions() {
+ if (this.accountid) {
+ if(this.options_hpflg){
+ selectAccountById({accountid : this.accountid}).then(accs =>{
+ this.options_hp = PrintCustomerNameoptionsvlue(this.options_hp,this.selection_hp,this.quo,this.options_hpflg,accs);
+ this.selection_hp = selection_hpExp;
+ this.options_hpflg = options_hpflgExp;
+ });
+ }else{
+ return this.options_hp;
+ }
+ }else{
+ return this.options_hp;
+ }
+ }
+ PrintCustomerNamehandleChange(event) {
+ this.selection_hp = event.detail.value;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js-meta.xml b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js-meta.xml
index 171374b..42d26e2 100644
--- a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js-meta.xml
+++ b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINewQuoteEntry.js-meta.xml
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSINewQuoteEntry">
- <apiVersion>51.0</apiVersion>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>58.0</apiVersion>
<isExposed>true</isExposed>
<targets>
+ <target>lightning__Tab</target>
<target>lightning__AppPage</target>
<target>lightning__RecordPage</target>
<target>lightning__HomePage</target>
diff --git a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINexQuoteEntryUtil.js b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINexQuoteEntryUtil.js
new file mode 100644
index 0000000..d688305
--- /dev/null
+++ b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSINexQuoteEntryUtil.js
@@ -0,0 +1,2581 @@
+export var bflag;
+export var oppInfosave;
+export var quoLineItemsave;
+export var DataStatus;
+export var newQuoteFlagex;
+export var MultiYearWarrantyTotalPriceExport;
+export var newQuoteFlagExp;
+export var productStatusUpdatedExp;
+export var quoExp;
+export var selection_hpExp;
+export var options_hpflgExp;
+export var fagExp;
+export var ListPriceTotalExp;
+export var unitPriceTotalExp;
+export var errorflg;
+export var StrExp;
+export var IsQuoteTrialExp;
+export var alertExp = '';
+export var alfExp = 0;
+export var enableSalesExp;
+export var enableContractExp;
+export var displayFlgExp;
+export var SbuttonExp;
+export var sapbuttonExp;
+export var pbuttonflgExp;
+export var lookMapE;
+export var nafgExp = {};
+export var flg = false;
+export var Saleslet = false;
+var addproductList = [];
+var trade;
+//閫夋嫨鎶ヤ环浜у搧閰嶇疆鍒�
+export var initDataTableToBeproductConfig = {
+ columns: [
+ {
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model',
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: 'NMPA鐘舵��',
+ fieldName: 'SFDA_Status__c',
+ type: 'text',
+ cellAttributes: {
+ class:{
+ fieldName:'SFDAStatuclass'
+ },
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '渚涘簲鍟嗗悕绉�',
+ fieldName: 'VenderName',
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '涓绘姤浠蜂环鏍�',
+ fieldName: 'ListPrice_Page',
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ },
+ cellAttributes: {
+ class:{
+ fieldName:'ListPricePageclass'
+ },
+ alignment: 'right'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity__c',
+ type: 'number',
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '瑙勬牸',
+ fieldName: 'Specifications',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'right'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '鍖婚櫌鍗曚环',
+ fieldName: 'UnitPrice_Page__c',
+ // editable: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '鍖婚櫌灏忚',
+ fieldName: 'Subtotal__c',
+ cellAttributes: {
+ alignment: 'right'
+ },
+ type: 'number',
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '澶氬勾淇濅慨',
+ fieldName: 'multiYearWarranty__c',
+ type: 'boolean',
+ cellAttributes: {
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '淇濅慨',
+ fieldName: 'warrantyType__c',
+ type: 'text',
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '淇濅慨骞撮檺',
+ fieldName: 'GuaranteePeriod__c',
+ cellAttributes: {
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '棰勮娑堣�楄嚦',
+ fieldName: 'Estimated_ConsumptionDueDate',
+ type: 'date',
+ typeAttributes:{
+ // weekday: "long",
+ year: "numeric",
+ month: "long",
+ day: "2-digit"
+ },
+ cellAttributes: {
+ class:{
+ fieldName:'EstimatedConsumptionDueDateclass'
+ },
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '搴撳瓨鐘舵��',
+ fieldName: 'StorageStatus',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '浜у搧閰嶅',
+ fieldName: 'Product_Set_Name',
+ type: 'text',
+ hideDefaultActions: true,
+ initialWidth: 150
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name',
+ type: 'url',
+ typeAttributes: {
+ label: {
+ fieldName: 'Name__c'
+ },
+ tooltip: {
+ fieldName: 'website'
+ },
+ target: '_blank'
+ },
+ cellAttributes: {
+ class:{
+ fieldName:'Nameclass'
+ },
+ },
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns: []
+};
+//浜у搧閰嶅閰嶇疆鍒�
+export var initDataSetProductTablefig = {
+ columns: [
+ {
+ label: '浜у搧閰嶅鍚�',
+ fieldName: 'Name',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '浜у搧閰嶅缂栫爜',
+ fieldName: 'Product_Set_CD__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '琛ヨ冻淇℃伅',
+ fieldName: 'Quote_Select_Info__c',
+ type: 'text',
+ cellAttributes: {
+ class: {},
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ {
+ label: '鏈夊姽',
+ fieldName: 'Valid_Status__c',
+ type: 'boolean',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ // initialWidth: 150
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: []
+};
+//鏂板浜у搧浜у搧閰嶇疆鍒�
+export var initDataProductTablefig = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 110
+ },
+ {
+ label: '浜у搧缂栫爜',
+ fieldName: 'OT_CODE_no_link__c',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 120
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 270
+ },
+ {
+ label: '閫傜敤绉戝',
+ fieldName: 'suitDepartment__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: '浠f浛浜у搧',
+ fieldName: 'Alternative_Products__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 100
+ },
+ {
+ label: 'NMPA鐘舵��',
+ fieldName: 'SFDA_Status__c',
+ type: 'text',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 115
+ },
+ {
+ label: 'ListPrice(鍐呰锤)',
+ fieldName: 'Intra_Trade_List_RMB__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 130
+ },
+ {
+ label: 'ListPrice(澶栬锤)',
+ fieldName: 'Foreign_Trade_List_US__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 130
+ },
+ {
+ label: '瑙勬牸',
+ fieldName: 'Packing_list_manual__c',
+ type: 'number',
+ cellAttributes: {
+ alignment: 'left'
+ },
+ hideDefaultActions: true,
+ initialWidth: 60
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns:[]
+};
+export function localParseInt( input) {
+ input += "";
+ input = input.split(" ");
+ if (input.length > 1) {
+ input = input[1];
+ } else {
+ input = input[0];
+ }
+ input = input.replace(/,/g, "");
+ input = input.replace(/ /g, "");
+ if ( input == '' || isNaN( input)) {
+ input = 0;
+ }
+ input = parseInt(input);
+ if (isNaN( input)) input = 0.00;
+ return input;
+}
+export function number_format_common (number, decimals, dec_point, thousands_sep) {
+ number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
+ var n = !isFinite(+number) ? 0 : +number,
+ prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
+ sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
+ dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
+ s = '',
+ toFixedFix = function (n, prec) {
+ var k = Math.pow(10, prec);
+ return '' + Math.round(n * k) / k;
+ };
+ // Fix for IE parseFloat(0.55).toFixed(0) = 0;
+ s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
+ if (s[0].length > 3) {
+ s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
+ }
+ if ((s[1] || '').length < prec) {
+ s[1] = s[1] || '';
+ s[1] += new Array(prec - s[1].length + 1).join('0');
+ }
+ return ( s.join(dec));
+}
+export function toNum( input) {
+ return number_format_common( input, 2, ".", "");
+}
+export function toNumComma( input) {
+ return number_format_common( input, 2, ".", ",");
+}
+export function toNumComma_One_digit(input) {
+ return number_format_common( input, 1, ".", ",");
+}
+export function localParseFloat( input) {
+ input += "";
+ input = input.split(" ");
+ if (input.length > 1) {
+ input = input[1];
+ } else {
+ input = input[0];
+ }
+ input = input.replace(/,/g, "");
+ input = input.replace(/ /g, "");
+ if ( input == '' || isNaN( input)) {
+ input = 0.00;
+ }
+ input = parseFloat(input);
+ if (isNaN( input)) input = 0.00;
+ return input;
+}
+export function NewQcopyLogic(Check_Your_Clipboard,records,x,targetString,reslut,displayCost,CurrencyIsoCode){
+ records=reslut;
+ alfExp = false;
+ alertExp = '';
+ for (var i = 0; i < records.length; i++) {
+ x = records[i];
+ //鍒ゆ柇绌�
+ // x=IfCopyProperties(x);
+ targetString += '\r\n' + (i + 1) + '\t' + '=MID(( "_" & "' + x.ProductCode__c + '"),2,LEN("' + '_' + x.ProductCode__c + '")-1)' + '\t' + x.SFDA_Status__c + '\t' + x.Name__c + '\t' + toNumComma(x.ListPrice__c) + '\t' + x.Quantity + '\t' + (x.Qty_Unit__c == null ? '' : x.Qty_Unit__c) + '\t' + toNumComma(x.UnitPrice__c) + '\t' + toNumComma(x.UnitPrice__c * x.Quantity) +
+ '\t' + x.Present__c + '\t' + toNumComma_One_digit(x.AgencyUnitPrice__c) + '\t' + toNumComma_One_digit(x.AgencySubtotal__c);
+ if (!x.warrantyType__c) {
+ x.warrantyType__c = '';
+ }
+ targetString += '\t' + x.multiYearWarranty__c + '\t' + x.warrantyType__c +
+ '\t' + toNumComma(x.NoDiscountTotal__c);
+ targetString += '\t' + x.GuaranteePeriod__c;
+ ;
+ if (displayCost) {
+ targetString += '\t' + toNumComma(x.Cost__c) + '\t' + CurrencyIsoCode;
+ }
+ }
+ try {
+ console.warn(targetString);
+ var tag = document.createElement('textarea');
+ tag.setAttribute('id', 'cp_hgz_textarea');
+ var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length;
+ tag.maxLength=strlenght+666;
+ tag.value = targetString;
+ document.getElementsByTagName('body')[0].appendChild(tag);
+ document.getElementById('cp_hgz_textarea').select();
+ document.execCommand('copy');
+ document.getElementById('cp_hgz_textarea').remove();
+ alfExp = true;
+ alertExp = Check_Your_Clipboard;
+ } catch (error) {
+ alfExp = false;
+ alertExp = error;
+ }
+}
+export function productCompareLogic(jzDataToBeproduct,id2Product,t,b){
+ debugger
+ bflag = b;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var a = jzdtbt.pageObject.Id__c;
+ if (a != '') {
+ var newProductGuranteePrice = 0;
+ var newProductServicePrice = 0;
+ var newMaintenance_Price_Year = 0;
+ if (t == '澶栬部') {
+ var recordTypeRecord = id2Product[a];
+ var y1 = recordTypeRecord.Name;
+ var y2 = recordTypeRecord.Foreign_Trade_List_US__c;
+ var y3 = recordTypeRecord.Foreign_Trade_Cost_US__c;
+ newProductGuranteePrice = recordTypeRecord.Intra_Trade_Foreign_RMB__c;
+ newProductServicePrice = recordTypeRecord.NoDiscount_Foreign__c;
+ newMaintenance_Price_Year = recordTypeRecord.Repair_Contract_USD__c;
+ } else {
+ var recordTypeRecord = id2Product[a];
+ var y1 = recordTypeRecord.Name;
+ var y2 = recordTypeRecord.Intra_Trade_List_RMB__c;
+ var y3 = recordTypeRecord.Intra_Trade_Cost_RMB__c;
+ newProductGuranteePrice = recordTypeRecord.Intra_Trade_Gurantee_RMB__c;
+ newProductServicePrice = recordTypeRecord.Intra_Trade_Service_RMB__c;
+ newMaintenance_Price_Year = recordTypeRecord.Maintenance_Price_Year__c;
+ }
+ // 淇濅慨绫诲瀷
+ var newGuranteeType = recordTypeRecord.GuranteeType__c;
+ if (!newGuranteeType) {
+ var newGuranteeType = '';
+ }
+ var newProductEntend_gurantee_period_all = recordTypeRecord.Entend_gurantee_period_all__c;
+ var oldGuranteeType = jzdtbt.pageObject.GuranteeType__c;
+ var oldProductEntend_gurantee_period_all = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c;
+ var oldProductGuranteePrice = jzdtbt.ProductGuranteePrice;
+ var oldProductServicePrice = jzdtbt.pageObject.productServicePrice__c;
+ var oldMaintenance_Price_Year = jzdtbt.Maintenance_Price_Year;
+ oldProductServicePrice = localParseFloat(oldProductServicePrice);
+ newProductServicePrice = localParseFloat(newProductServicePrice);
+ oldProductGuranteePrice = localParseFloat(oldProductGuranteePrice);
+ newProductGuranteePrice = localParseFloat(newProductGuranteePrice);
+ newProductEntend_gurantee_period_all = localParseFloat(newProductEntend_gurantee_period_all);
+ oldMaintenance_Price_Year = localParseFloat(oldMaintenance_Price_Year);
+ newMaintenance_Price_Year = localParseFloat(newMaintenance_Price_Year);
+ var y4 = recordTypeRecord.SFDA_Status__c;
+ var s1 = recordTypeRecord.StorageStatus__c;
+ var x1 = jzdtbt.pageObject.Name__c;
+ var x2 = jzdtbt.ListPrice_Page;
+ var x3 = jzdtbt.Cost_c;
+ var x4 = jzdtbt.pageObject.SFDA_Status__c;
+ //閫g稓鍗婅銈广儦銉笺偣瀵惧繙
+ y1 = y1 + '';
+ // y1 = y1.replace(/\s+/g, " ");
+ x2 = localParseFloat(x2);
+ x3 = localParseFloat(x3);
+ y2 = localParseFloat(y2);
+ y3 = localParseFloat(y3);
+ if ((x1 === y1) && (x2 === y2) && (x3 === y3) && (x4 === y4)
+ &&
+ (oldGuranteeType === newGuranteeType) &&
+ (oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all) &&
+ (oldProductGuranteePrice === newProductGuranteePrice) &&
+ (oldProductServicePrice === newProductServicePrice) &&
+ (oldMaintenance_Price_Year === newMaintenance_Price_Year)
+ ) {} else {
+ bflag = false;
+ }
+ jzdtbt.latestInfo.GuranteeType = newGuranteeType;
+ jzdtbt.latestInfo.ProductEntend_gurantee_period_all = newProductEntend_gurantee_period_all;
+ jzdtbt.latestInfo.Intra_Trade_Gurantee = localParseFloat(recordTypeRecord.Intra_Trade_Gurantee_RMB__c);
+ jzdtbt.latestInfo.Intra_Trade_Service = localParseFloat(recordTypeRecord.Intra_Trade_Service_RMB__c);
+ jzdtbt.latestInfo.Maintenance_Price_Year = localParseFloat(recordTypeRecord.Maintenance_Price_Year__c);
+ jzdtbt.latestInfo.ProductName = recordTypeRecord.Name;
+ jzdtbt.latestInfo.ListPrice = y2;
+ jzdtbt.latestInfo.Cost = y3;
+ jzdtbt.latestInfo.SFDA_Status = y4;
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function TimeToString(newDate){
+ var value=newDate.toLocaleDateString();
+ var value2=value.split('/');
+ if(value2[1].length == 1){
+ value2[1]='0'+value2[1];
+ }
+ if(value2[2].length == 1){
+ value2[2]='0'+value2[2];
+ }
+ value=value2[0]+'-'+value2[1]+'-'+value2[2];
+ return value;
+}
+export function saveEvoluationLogic(quoin,oppInfoIn,quoLineItemIn){
+ debugger
+ var quo ={...{},...quoin};
+ 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.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;
+ quo.Agency1_Profit_Rate__c = quoin.Agency1_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency1_Profit_Rate__c):null;
+ quo.Agent1_Agent2_Price_Page__c = quoin.Agent1_Agent2_Price_Page__c!=undefined &&quoin.Agent1_Agent2_Price_Page__c!=='' ?localParseFloat(quoin.Agent1_Agent2_Price_Page__c):null;
+ quo.Agency2_Profit__c = quoin.Agency2_Profit__c !=undefined?localParseFloat(quoin.Agency2_Profit__c):null;
+ quo.Agency2_Profit_Rate__c = quoin.Agency2_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency2_Profit_Rate__c):null;
+ quo.Quote_Adjust_Amount_Page__c = quoin.Quote_Adjust_Amount_Page__c !=undefined&&quoin.Quote_Adjust_Amount_Page__c!==''?localParseFloat(quoin.Quote_Adjust_Amount_Page__c):null;
+ quo.Quote_Adjust_Calculate__c = quoin.Quote_Adjust_Calculate__c !=undefined&&quoin.Quote_Adjust_Calculate__c!==''?localParseFloat(quoin.Quote_Adjust_Calculate__c):null;
+ quo.Stocking_Price__c = quoin.Stocking_Price__c!=undefined? localParseFloat(quoin.Stocking_Price__c):null;
+ quo.Discount_Amount__c = quoin.Discount_Amount__c !=undefined?localParseFloat(quoin.Discount_Amount__c):null;
+ quo.AgencyDiscount__c = quoin.AgencyDiscount__c !=undefined?localParseFloat(quoin.AgencyDiscount__c):null;
+ quo.Discount_Amount_Calculate__c = quoin.Discount_Amount_Calculate__c !=undefined?localParseFloat(quoin.Discount_Amount_Calculate__c):null;
+ debugger
+ quo.PriceRefreshDate__c =quoin.PriceRefreshDate__c? TimeToString(new Date(quoin.PriceRefreshDate__c)):null;
+ quo.CreatedDate =quoin.CreatedDate? TimeToString(new Date(quoin.CreatedDate)):null;
+ quo.Quote_Expiration_Date__c =quoin.Quote_Expiration_Date__c? TimeToString(new Date(quoin.Quote_Expiration_Date__c)):null;
+ quo.Agency1__c =quoin.Agency1__c? quoin.Agency1__c:null;
+ quo.Agency2__c =quoin.Agency2__c? quoin.Agency2__c:null;
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = quoin.OCM_Sales_Forecast__c!=undefined? localParseFloat(quoin.OCM_Sales_Forecast__c):null;
+ //棰勬祴閲戦淇敼 fy
+
+ var oppInfo ={...{},...oppInfoIn};
+ oppInfo.Wholesale_Price__c =oppInfoIn.Wholesale_Price__c!=undefined? localParseFloat(oppInfoIn.Wholesale_Price__c):null;
+ oppInfosave = oppInfo;
+
+ var quoitemList = [...[],...quoLineItemIn];
+ quoitemList.forEach(quoitem=>{
+ debugger
+ quoitem.pageObject.Quantity__c = quoitem.Quantity__c;
+ quoitem.pageObject.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c);
+ quoitem.pageObject.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c);
+ quoitem.pageObject.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c);
+ quoitem.pageObject.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page);
+ quoitem.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c);
+ quoitem.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c);
+ quoitem.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c);
+ quoitem.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page);
+ quoitem.pageObject.multiYearWarranty__c = quoitem.multiYearWarranty__c;
+ quoitem.pageObject.GuaranteePeriod__c = quoitem.GuaranteePeriod__c;
+ quoitem.pageObject.warrantyType__c = quoitem.warrantyType__c;
+ quoitem.pageObject.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c);
+ quoitem.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c);
+ // quoitem.pageObject.SFDA_Status__c = quoitem.SFDA_Status__c;
+ quoitem.pageObject.Name__c = quoitem.Name__c;
+ quoitem.pageObject.Subtotal__c = localParseFloat(quoitem.Subtotal__c);
+ quoitem.Subtotal__c = localParseFloat(quoitem.Subtotal__c);
+ quoitem.Cost_Subtotal_c = localParseFloat(quoitem.Cost_Subtotal_c);
+ });
+ quoLineItemsave = quoitemList;
+
+ return quo;
+}
+export function jzProductsearchLogic(result){
+ debugger
+ var jzProductData =[...[],...result];
+ jzProductData.forEach(izpd=>{
+ izpd.Asset_Model_No__c = izpd.Product2.Asset_Model_No__c;
+ izpd.OT_CODE_no_link__c = izpd.Product2.OT_CODE_no_link__c;
+ izpd.Name = izpd.Product2.Name;
+ izpd.suitDepartment__c = izpd.Product2.suitDepartment__c;
+ izpd.Alternative_Products__c = izpd.Product2.Alternative_Products__c;
+ izpd.SFDA_Status__c = izpd.Product2.SFDA_Status__c;
+ izpd.SFDA_Status__c = SFDAtranslate(izpd.SFDA_Status__c);
+ izpd.Intra_Trade_List_RMB__c = izpd.Product2.Intra_Trade_List_RMB__c;
+ izpd.Foreign_Trade_List_US__c = izpd.Product2.Foreign_Trade_List_US__c;
+ izpd.Packing_list_manual__c = izpd.Product2.Packing_list_manual__c;
+ });
+ return jzProductData;
+}
+export function additionaljzProductLogic(selectvlue,Listvalue,tradec,IsQuoteTrial){
+ IsQuoteTrialExp = IsQuoteTrial;
+ debugger
+ var LineNoList = [];
+ Listvalue.forEach(lsv=>{
+ lsv.lineNo = localParseInt(lsv.lineNo);
+ if(lsv.lineNo){
+ LineNoList.push(lsv.lineNo);
+ }
+ });
+ var maxLineNo = FindMaximumMalue(LineNoList);
+ maxLineNo += 1;
+ // var newvalueList = [];
+ selectvlue.forEach(selectv=>{
+ debugger
+ alertExp = '';
+ // var newvalue = {...{},...selectv};
+ // var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c;
+ // var GuranteeType = selectv.Product2.GuranteeType__c;
+ //鏄惁鐧诲綍鎶ヤ环
+ if(selectv.Product2.Estimation_Entry_Possibility__c=='脳' ){
+ var Estimation_Entry_Possibility = true;
+ }else{
+ var Estimation_Entry_Possibility = false;
+ }
+ //鍐呰锤鎴愭湰
+ if(selectv.Product2.Intra_Trade_Cost_RMB__c > 0 ){
+ var CostFlag= false;
+ }else{
+ var CostFlag = true;
+ }
+ //鍐呭璐�
+ trade = tradec;
+ //鍐呰锤鎶ヤ环閲戦
+ var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c;
+ //澶栬锤鎶ヤ环閲戦
+ var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c;
+ //澶栬锤鎴愭湰
+ var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c;
+ //澶栬锤澶氬勾淇� 鍙栦骇鍝佷富鏁版嵁涓婄殑閲戦浠ュ強鎶ヤ环 绮剧悽鎶�鏈� wql start
+ // 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;
+ if(trade == "CNY") {
+ if(Estimation_Entry_Possibility){
+ alertExp = '浜у搧鏈櫥褰曟姤浠锋椂涓嶅彲鎶ヤ环!';
+ }else if(CostFlag){
+ alertExp = '浜у搧鐨勬垚鏈负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else if(!Intra_Trade_List_RMB__c||Intra_Trade_List_RMB__c<0){
+ alertExp = '浜у搧鐨勬姤浠烽噾棰濅负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else{
+ SetProductId(maxLineNo, selectv);
+ }
+ //澶栬锤
+ }else if(trade == "USD"){
+ if(Estimation_Entry_Possibility){
+ alertExp = '浜у搧鏈櫥褰曟姤浠锋椂涓嶅彲鎶ヤ环!';
+ }
+ else if(!Foreign_Trade_List_US__c||Foreign_Trade_List_US__c<0 ){
+ alertExp = '浜у搧鐨勬姤浠烽噾棰濅负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else if(!Foreign_Trade_Cost_US__c||Foreign_Trade_Cost_US__c<0){
+ alertExp = '浜у搧鐨勬垚鏈负绌烘椂涓嶅彲鎶ヤ环锛�';
+ }else{
+ SetProductId(maxLineNo, selectv);
+ }
+ }
+ maxLineNo++;
+ });
+ Listvalue = Listvalue.concat(addproductList);
+ addproductList = []
+ return Listvalue;
+}
+export function FindMaximumMalue(value){
+ if(value.length!=0){
+ var max = getMaximin(value,"max");
+ }else{
+ var max = 0;
+ }
+
+ return max;
+}
+function getMaximin(arr,maximin) {
+ if(maximin=="max") {
+ return Math.max.apply(Math,arr);
+ }
+ else if(maximin=="min") {
+ return Math.min.apply(Math, arr);
+ }
+}
+function SetProductId(lineno,selectv){
+ var Product2 = {};
+ var PricebookEntry = {Product2:Product2};
+ var latestInfo = {};
+ var pageObject = {};
+ var addobj = {PricebookEntry:PricebookEntry,
+ latestInfo:latestInfo,
+ pageObject:pageObject};
+ var Asset_Model_No__c = selectv.Product2.Asset_Model_No__c;
+ var Product2Id = selectv.Product2Id;
+ var SFDA_Status__c = selectv.Product2.SFDA_Status__c
+ var SFDA_Status = selectv.Product2.SFDA_Status__c;
+ var Estimated_ConsumptionDueDate__c = selectv.Product2.Estimated_ConsumptionDueDate__c;
+ var name = selectv.Product2.Name;
+ var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c;
+ var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c;
+ var NameCode = selectv.Product2.ProductCode;
+ var Sales_Possibility = selectv.Product2.Sales_Possibility__c;
+ var Intra_Trade_Cost_RMB__c = selectv.Product2.Intra_Trade_Cost_RMB__c;
+ var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c;
+ var Packing_list_manual__c = selectv.Product2.Packing_list_manual__c;
+ var Bsscategory = selectv.Product2.BSSCategory__c;
+ var PricebookEntryId = selectv.Id;
+ var StorageStatus__c = selectv.Product2.StorageStatus__c;
+ 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;
+
+ addobj.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c;
+ addobj.StorageStatus = StorageStatus__c;
+ addobj.lineNo = parseInt(lineno);
+ addobj.Asset_Model = Asset_Model_No__c;
+ addobj.SFDA_Status__c= SFDA_Status__c;
+ addobj.SFDA_Status__c = SFDAtranslate(addobj.SFDA_Status__c);
+ addobj.Estimated_ConsumptionDueDate = Estimated_ConsumptionDueDate__c;
+ addobj.Estimated_ConsumptionDueDate1 = Estimated_ConsumptionDueDate__c;
+ addobj.pageObject.SFDA_Status__c = SFDA_Status;
+ addobj.latestInfo.Specifications = Packing_list_manual__c;
+ addobj.Specifications = Packing_list_manual__c;
+ addobj.Name = '/'+Product2Id;
+ addobj.Name__c = name;
+ addobj.pageObject.Name__c = name;
+ var ListPrice = 0;
+ var Cost_c = 0;
+ // var Extend_new_product_gurantee = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee__c")).val();
+
+ // var Extend_new_product_gurantee_MD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee_MD__c")).val();
+
+ var GuranteeType = selectv.Product2.GuranteeType__c;
+ var Entend_gurantee_period_all = selectv.Product2.Entend_gurantee_period_all__c;
+ var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c;
+ var Intra_Trade_Service_RMB = selectv.Product2.Intra_Trade_Service_RMB__c;
+ var Maintenance_Price_Year = selectv.Product2.Maintenance_Price_Year__c;
+ if(selectv.Product2.VenderName__c==null||selectv.Product2.VenderName__c==null){
+ var VenderName =' 鏃� ';
+ }else{
+ var VenderName = selectv.Product2.VenderName__c;
+ }
+ var CanNotCancelledGurantee = selectv.Product2.CanNotCancelledGurantee__c;
+ var Is_DangerousChemicals = selectv.Product2.Is_DangerousChemicals__c;
+ var ProductGuranteePrice = 0;
+ var ProductServicePrice = 0;
+ var productMaintenance_Price_Year = 0;
+ if(trade == "CNY") {
+ ProductGuranteePrice = Intra_Trade_Gurantee_RMB;
+ ProductServicePrice = Intra_Trade_Service_RMB;
+ productMaintenance_Price_Year = Maintenance_Price_Year;
+ ListPrice = Intra_Trade_List_RMB__c;
+ Cost_c = Intra_Trade_Cost_RMB__c;
+ } else if(trade == "USD"){
+ ProductGuranteePrice = Intra_Trade_Gurantee_USD;
+ ProductServicePrice = Intra_Trade_Service_USD;
+ productMaintenance_Price_Year = Maintenance_Price_Year_USD;
+ ListPrice = Foreign_Trade_List_US__c;
+ Cost_c = Foreign_Trade_Cost_US__c;
+ }
+ Cost_c = toNum(Cost_c);
+ // ListPrice = toNum(ListPrice);
+ // addobj.ListPrice_Page = toNumComma(ListPrice);
+ addobj.ListPrice_Page = ListPrice;
+ addobj.pageObject.ListPrice_Page = ListPrice;
+ addobj.Quantity__c = 1;
+ // addobj.UnitPrice_Page__c = toNumComma(ListPrice);
+ addobj.UnitPrice_Page__c = ListPrice;
+ // addobj.Subtotal__c = toNumComma(ListPrice);
+ addobj.Subtotal__c = ListPrice;
+ addobj.pageObject.Subtotal__c = ListPrice;
+ addobj.latestInfo.ProductCode = NameCode;
+ addobj.latestInfo.ProductName = name;
+ addobj = MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c);
+ addobj.latestInfo.SFDA_Status = SFDA_Status__c;
+ addobj.latestInfo.Sales_Possibility = Sales_Possibility;
+ addobj.latestInfo.ListPrice = ListPrice;
+ addobj.latestInfo.Cost = Cost_c;
+ addobj.Cost_c = Cost_c;
+ addobj.Cost_Subtotal_c = Cost_c;
+ addobj.pageObject.BSS_Category__c = Bsscategory;
+ addobj.pageObject.Id__c = Product2Id;
+ addobj.pageObject.PricebookEntryId = PricebookEntryId;
+ addobj.pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all;
+ addobj.Maintenance_Price_Year = productMaintenance_Price_Year;
+ addobj.latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year;
+ addobj.pageObject.GuranteeType__c = GuranteeType;
+ addobj.VenderName = VenderName;
+ addobj.CanNotCancelledGurantee = CanNotCancelledGurantee;
+ addobj.Is_DangerousChemicals = Is_DangerousChemicals;
+ addobj.ProductGuranteePrice = ProductGuranteePrice;
+ addobj.pageObject.productServicePrice__c = ProductServicePrice;
+ //chenjingwu DB202308355043 2023.8.25 start
+ addobj.Category5 = selectv.Product2.Category5__c;
+ //chenjingwu DB202308355043 2023.8.25 end
+ addproductList.push(addobj);
+ // if(VenderName != 'OSH'&&VenderName != ''){
+ // window.opener.j$(escapeVfId('Page:mainForm:block:lists:'+lineno+':UnitPrice')).attr('disabled','disabled');
+ // }
+ IsQuoteTrialExp = false;
+}
+function MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c){
+
+ 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;
+
+ //棰勮娑堣�楀埌鏈熸棩 - 褰撳墠鏃� 鐩稿樊澶╂暟(difDate)
+ var ndate = new Date(currentdate);
+ var nowDate = ndate.getTime();
+ var edate = new Date(Estimated_ConsumptionDueDate__c);
+ var endDate = edate.getTime();
+ var difDate = (endDate - nowDate)/((1000 * 60 * 60 * 24));
+
+ //鍒ゆ柇
+ if(difDate < 90){
+ addobj.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ return addobj;
+}
+export function MarkRed(quoitemList) {
+ quoitemList.forEach(item=>{
+ var a = item.Asset_Model;
+ var b = item.Estimated_ConsumptionDueDate;
+ if (a != '') {
+ 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;
+
+ //棰勮娑堣�楀埌鏈熸棩 - 褰撳墠鏃� 鐩稿樊澶╂暟(difDate)
+ var ndate = new Date(currentdate);
+ var nowDate = ndate.getTime();
+ var edate = new Date(b);
+ var endDate = edate.getTime();
+ var difDate = (endDate - nowDate) / ((1000 * 60 * 60 * 24));
+
+ //鍒ゆ柇
+ if (difDate < 90) {
+ item.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps';
+ }else{
+ item.EstimatedConsumptionDueDateclass = '';
+ }
+ }
+ });
+ return quoitemList;
+}
+export function filterNameoptionList(){
+ var optionList = [{label:'--鏃�--',value: ''},
+ {label:'娑堝寲绉�',value: '娑堝寲绉�'},
+ {label:'鍛煎惛绉�',value: '鍛煎惛绉�'},
+ {label:'鏅绉�',value: '鏅绉�'},
+ {label:'娉屽翱绉�',value: '娉屽翱绉�'},
+ {label:'濡囩',value: '濡囩'},
+ {label:'鑰抽蓟鍠夌',value: '鑰抽蓟鍠夌'},
+ {label:'鑳介噺',value: '鑳介噺'},
+ {label:'SI',value: 'SI'},
+ {label:'澶栫閫氱敤',value: '澶栫閫氱敤'}];
+ return optionList;
+}
+export function SelectDone(activities){
+ debugger
+ var setPFString = '';
+ activities.forEach(arc=>{
+ if(!setPFString){
+ setPFString = arc.Id;
+ }else{
+ setPFString = setPFString+','+arc.Id;
+ }
+ });
+ DataStatus = 'Fin';
+ return setPFString;
+}
+//鍒濆鍖栦骇鍝佽祴鍊�
+export function InitializeProductAssignment(quoteLineItem){
+ debugger
+ console.warn(JSON.stringify(quoteLineItem));
+ quoteLineItem.forEach(quotltiem=>{
+ 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);
+ quotltiem.AgencySubtotal__c = quotltiem.pageObject.AgencySubtotal__c;
+ quotltiem.AgencyUnitPrice__c = quotltiem.pageObject.AgencyUnitPrice__c;
+ // quotltiem.ListPrice_Page = toNumComma(quotltiem.ListPrice_Page);
+ quotltiem.multiYearWarranty__c = quotltiem.pageObject.multiYearWarranty__c;
+ quotltiem.GuaranteePeriod__c = quotltiem.pageObject.GuaranteePeriod__c;
+ // if(!quotltiem.pageObject.GuranteeType__c){
+ // quotltiem.pageObject.GuranteeType__c = '';
+ // }
+ quotltiem.warrantyType__c = quotltiem.pageObject.warrantyType__c;
+ quotltiem.NoDiscountTotal__c = quotltiem.pageObject.NoDiscountTotal__c;
+ quotltiem.SFDA_Status__c = quotltiem.pageObject.SFDA_Status__c;
+ quotltiem.SFDA_Status__c = SFDAtranslate(quotltiem.SFDA_Status__c);
+ quotltiem.Name__c = quotltiem.pageObject.Name__c;
+ quotltiem.Subtotal__c = quotltiem.pageObject.Subtotal__c;
+ // quotltiem.Subtotal__c = toNumComma(quotltiem.Subtotal__c);
+ quotltiem.Name = '/'+quotltiem.pageObject.Id__c;
+ if((!(!quotltiem.pageObject.Product_Sales_Possibility__c || quotltiem.pageObject.Product_Sales_Possibility__c == '鈼�') && !quotltiem.changed_sfda)){
+ quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(quotltiem.haveno_Register){
+ quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(quotltiem.changed_list){
+ quotltiem.ListPricePageclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(quotltiem.changed_name == true || quotltiem.wrong_Register == true){
+ quotltiem.Nameclass = 'slds-text-color_red';
+ }
+
+ //浜у搧Id
+ });
+ const inputAlignright = document.createElement('style');
+ inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`;
+ document.body.appendChild(inputAlignright);
+ quoteLineItem = MarkRed(quoteLineItem);
+ return quoteLineItem;
+}
+export function actState(reslut,list){
+ var reslutList = JSON.parse(reslut);
+ var reMap = new Map();
+ reslutList.forEach(itm=>{
+ var val = {
+ haveno_Register:itm.haveno_Register,
+ wrong_Register:itm.wrong_Register
+ };
+ reMap.set(itm.pageObject.Id__c,val);
+ });
+ list.forEach(ac=>{
+ if(reMap.has(ac.pageObject.Id__c)){
+ var vlu = reMap.get(ac.pageObject.Id__c);
+ ac.haveno_Register = vlu.haveno_Register;
+ ac.wrong_Register = vlu.wrong_Register;
+ }
+ if((!(!ac.pageObject.Product_Sales_Possibility__c || ac.pageObject.Product_Sales_Possibility__c == '鈼�') && !ac.changed_sfda)){
+ ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(ac.haveno_Register){
+ ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(ac.changed_list){
+ ac.ListPricePageclass = 'slds-text-color_error slds-text-title_caps';
+ }
+ if(ac.changed_name == true || ac.wrong_Register == true){
+ ac.Nameclass = 'slds-text-color_red';
+ }
+ });
+ const inputAlignright = document.createElement('style');
+ inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`;
+ document.body.appendChild(inputAlignright);
+ return list;
+}
+export function PriceStatusUpdateLogic(jzDataToBeproduct,newQuoteFlag){
+ newQuoteFlagex = newQuoteFlag;
+ debugger
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ if ((jzdtbt.Asset_Model != null) && (jzdtbt.Asset_Model != '')) {
+ // TODO katsu SFDA銈广儐銉笺偪銈广伄纰鸿獚銇仼銇勩倝銇亜銇с仚銇嬶紙鏈�鏂板晢鍝乆XX銇爡鐩倐锛�
+ jzdtbt.pageObject.SFDA_Status__c = jzdtbt.latestInfo.SFDA_Status;
+ jzdtbt.SFDA_Status__c = SFDAtranslate(jzdtbt.pageObject.SFDA_Status__c);
+ jzdtbt.pageObject.Name__c = jzdtbt.latestInfo.ProductName;
+ jzdtbt.Name__c = jzdtbt.pageObject.Name__c;
+ jzdtbt.ListPrice_Page = jzdtbt.latestInfo.ListPrice;
+ jzdtbt.pageObject.Cost__c = jzdtbt.latestInfo.Cost;
+ jzdtbt.Cost_c = jzdtbt.latestInfo.Cost;
+ jzdtbt.pageObject.ProductGuranteePrice__c = jzdtbt.latestInfo.Intra_Trade_Gurantee;
+ jzdtbt.pageObject.productServicePrice__c = jzdtbt.latestInfo.Intra_Trade_Service;
+ jzdtbt.pageObject.GuranteeType__c = jzdtbt.latestInfo.GuranteeType;
+ // 璁℃彁閲戦
+ jzdtbt.pageObject.productServicePrice__c = jzdtbt.latestInfo.Intra_Trade_Service;
+ // 澶氬勾淇濅慨骞撮檺
+ jzdtbt.pageObject.ProductEntend_gurantee_period_all__c
+ = jzdtbt.latestInfo.ProductEntend_gurantee_period_all;
+ // 缁翠慨鍚堝悓鎶ヤ环
+ jzdtbt.Maintenance_Price_Year = jzdtbt.latestInfo.Maintenance_Price_Year;
+ // jzdtbt.ListPrice_Page = toNumComma(jzdtbt.ListPrice_Page);
+ jzdtbt.ListPrice_Page = jzdtbt.ListPrice_Page;
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function calGuranteeAllFieldsLogic(jzDataToBeproduct,quo){
+ debugger
+ var AllGurantee_Period = quo.Gurantee_Period__c;
+ var contractmultiYearWarranty = true;
+ if (quo.multiYearWarranty__c != null) {
+ contractmultiYearWarranty = quo.multiYearWarranty__c;
+ }
+ var MultiYearWarrantyTotalPrice__c = 0.00;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var GuranteeType =jzdtbt.pageObject.GuranteeType__c;
+ // 淇濅慨绫诲瀷
+ var warrantyType = '';
+ // 浜у搧淇濅慨鏈�
+ var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c;
+ // 浜у搧璁℃彁閲戦
+ var ProductGuranteePrice__c = jzdtbt.ProductGuranteePrice;
+ // 浜у搧 service Price
+ var ServicePrice = jzdtbt.pageObject.productServicePrice__c;
+ // 淇濅慨
+ var multiYearWarranty = false;
+ // 鏄惁鍙栨秷淇濅慨
+ var If_Cancel_Guarantee = false;
+ //浜у搧涓绘暟鎹鍔犫�滀笉鍙彇娑堝骞翠繚鈥� 2020/08/28 绮剧悽鎶�鏈� wql start
+ var CanNotCancelledGurantee = jzdtbt.CanNotCancelledGurantee;
+ //浜у搧涓绘暟鎹鍔犫�滀笉鍙彇娑堝骞翠繚鈥� 2020/08/28 绮剧悽鎶�鏈� wql end
+ // 鑰� no discount price
+ var oldServicePrice =jzdtbt.pageObject.ServicePrice__c;
+ jzdtbt.pageObject.ServicePrice__c = 0;
+ jzdtbt.warrantyType__c = '';
+ var NoDiscountTotal = 0;
+ if (GuranteeType == '鏈嶅姟') {
+ multiYearWarranty = true;
+ jzdtbt.warrantyType__c = '鏈嶅姟澶氬勾淇濅慨';
+ warrantyType = '鏈嶅姟澶氬勾淇濅慨';
+ } else if (GuranteeType == '甯傚満' && contractmultiYearWarranty == false) {
+ multiYearWarranty = true;
+ jzdtbt.pageObject.ServicePrice__c = ServicePrice;
+ jzdtbt.warrantyType__c = '甯傚満澶氬勾淇濅慨';
+ warrantyType = '甯傚満澶氬勾淇濅慨';
+ var Quantity =jzdtbt.Quantity__c;
+ MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ }
+ else if (GuranteeType == '甯傚満' && contractmultiYearWarranty && CanNotCancelledGurantee) {
+ multiYearWarranty = true;
+ jzdtbt.pageObject.ServicePrice__c = ServicePrice;
+ jzdtbt.warrantyType__c = '甯傚満澶氬勾淇濅慨';
+ warrantyType = '甯傚満澶氬勾淇濅慨';
+ // 鏁伴噺
+ var Quantity = jzdtbt.Quantity__c;
+ MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity);
+ }
+ else if (GuranteeType == '甯傚満') {
+ If_Cancel_Guarantee = true;
+ }
+ // if (jzdtbt.NoDiscountTotal__c != null) {
+ jzdtbt.NoDiscountTotal__c = toNumComma(NoDiscountTotal);
+ // }
+
+ // 鏇存柊鍚庣殑 no discount price
+ var newServicePrice = jzdtbt.pageObject.ServicePrice__c;
+ newServicePrice = localParseFloat(newServicePrice);
+ oldServicePrice = localParseFloat(oldServicePrice);
+ if (newServicePrice != oldServicePrice) {
+ var unitPrice = jzdtbt.UnitPrice_Page__c;
+ unitPrice = localParseFloat(unitPrice);
+ // jzdtbt.UnitPrice_Page__c = toNum(unitPrice + newServicePrice - oldServicePrice);
+ jzdtbt.UnitPrice_Page__c = unitPrice + newServicePrice - oldServicePrice;
+ }
+ jzdtbt.pageObject.If_Cancel_Guarantee__c = If_Cancel_Guarantee;
+ // 璁剧疆淇濅慨
+ // if (jzdtbt.multiYearWarranty__c != null) {
+ jzdtbt.multiYearWarranty__c = multiYearWarranty;
+ // }
+ var GuranteePrice = 0;
+ // 璁℃彁骞撮檺
+ var provistonPeriod = 0;
+ // 鏍规嵁浜у搧淇℃伅璁剧疆淇濅慨骞撮檺 鍜岃鎻愰噾棰�
+ if (GuranteeType == '鏈嶅姟') {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ GuranteePrice = ProductGuranteePrice__c;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ provistonPeriod = ProductEntend_gurantee_period;
+ } else if (GuranteeType == '甯傚満') {
+ if (contractmultiYearWarranty == false) {
+ if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ provistonPeriod = ProductEntend_gurantee_period;
+ GuranteePrice = ProductGuranteePrice__c;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }else if (contractmultiYearWarranty && CanNotCancelledGurantee) {
+ if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ provistonPeriod = ProductEntend_gurantee_period;
+ GuranteePrice = ProductGuranteePrice__c;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }
+ else {
+ jzdtbt.pageObject.GuaranteePeriod__c = 1;
+ jzdtbt.GuaranteePeriod__c = 1;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuranteePrice = GuranteePrice;
+ }
+ jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0;
+
+ });
+ MultiYearWarrantyTotalPriceExport = MultiYearWarrantyTotalPrice__c;
+ return jzDataToBeproduct;
+}
+export function initQuoteLineItemcheck(quoteLineItem,productStatusUpdated){
+ debugger
+ newQuoteFlagExp = false;
+ productStatusUpdatedExp = productStatusUpdated;
+ quoteLineItem.forEach(a=>{
+ if(!a.Maintenance_Price_Year){
+ a.Maintenance_Price_Year = 0;
+ }
+ if(!a.latestInfo.Maintenance_Price_Year){
+ a.latestInfo.Maintenance_Price_Year = 0;
+ }
+ if(!a.pageObject.GuranteeType__c){
+ a.pageObject.GuranteeType__c = '';
+ }
+ if(!a.latestInfo.GuranteeType){
+ a.latestInfo.GuranteeType = '';
+ }
+ if (a.Asset_Model) {
+ if(a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status
+ ||a.pageObject.Name__c != a.latestInfo.ProductName
+ ||a.ListPrice_Page != a.latestInfo.ListPrice
+ ||a.pageObject.Cost__c != a.latestInfo.Cost
+ ||a.Cost_c != a.latestInfo.Cost
+ ||a.ProductGuranteePrice != a.latestInfo.Intra_Trade_Gurantee
+ ||a.pageObject.productServicePrice__c != a.latestInfo.Intra_Trade_Service
+ ||a.Maintenance_Price_Year != a.latestInfo.Maintenance_Price_Year
+ ||a.pageObject.GuranteeType__c != a.latestInfo.GuranteeType
+ ||a.pageObject.ProductEntend_gurantee_period_all__c != a.latestInfo.ProductEntend_gurantee_period_all
+ ||a.pageObject.PricebookEntry.Product2.CanNotCancelledGurantee__c != a.latestInfo.CanNotCancelledGurantee
+ ) {
+ newQuoteFlagExp = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.pageObject.Name__c != a.latestInfo.ProductName) {
+ a.changed_name = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status) {
+ a.changed_sfda = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.ListPrice_Page != a.latestInfo.ListPrice) {
+ a.changed_list = true;
+ productStatusUpdatedExp = true;
+ }
+ if (a.pageObject.Cost__c != a.latestInfo.Cost) {
+ a.changed_cost = true;
+ productStatusUpdatedExp = true;
+ }
+ a.pageObject.SFDA_Status__c = a.latestInfo.SFDA_Status;
+ a.pageObject.Name__c = a.latestInfo.ProductName;
+ a.ListPrice_Page = a.latestInfo.ListPrice;
+ a.pageObject.Cost__c = a.latestInfo.Cost;
+ a.Cost_c = a.latestInfo.Cost;
+ a.ProductGuranteePrice = a.latestInfo.Intra_Trade_Gurantee;
+ a.pageObject.productServicePrice__c = a.latestInfo.Intra_Trade_Service;
+ a.Maintenance_Price_Year = a.latestInfo.Maintenance_Price_Year;
+ a.pageObject.ProductEntend_gurantee_period_all__c= a.latestInfo.ProductEntend_gurantee_period_all;
+ a.pageObject.GuranteeType__c = a.latestInfo.GuranteeType;
+ }
+ });
+ return quoteLineItem;
+}
+export function initquocheck(quoteLineItem,CheckItem){
+ var product2Ids = [];
+ if(quoteLineItem.length > 0){
+ quoteLineItem.forEach(a=>{
+ if (a.pageObject.Id__c) {
+ product2Ids.push(a.pageObject.Id__c);
+ }
+ });
+ }
+ var loopMap = new Map();
+ if(CheckItem.length>0){
+ CheckItem.forEach(qli=>{
+ loopMap.set(qli.PricebookEntry.Product2Id,qli.SFDA_Status__c);
+ });
+ }
+ lookMapE = loopMap;
+ return product2Ids;
+}
+//鍔犲ぉ鏁�
+export function addDay(dayNumber, date) {
+ var ms = dayNumber * (1000 * 60 * 60 * 24)
+ var newDate = new Date(date.getTime() + ms);
+ return newDate;
+}
+//璁$畻涓や釜鏃ユ湡涔嬮棿鐨勫ぉ鏁�
+export function dateDaysBetween(dateStrBegin, dateStrEnd) {
+ if (!dateStrBegin || !dateStrEnd) return 0;
+ var s1 = dateStrBegin.getTime(),
+ s2 = dateStrEnd.getTime();
+ var total = (s2 - s1) / 1000;
+ var day = parseInt(total / (24 * 60 * 60));
+ return day;
+}
+/*
+ 璁$畻缁忛攢鍟嗗崟浠峰拰缁忛攢鍟嗗皬璁�
+ */
+ // CHAN-B4YAB8 2018/9/28 璁$畻缁忛攢鍟嗗崟浠峰拰灏忚 start
+ // 濡傛灉鏄疧CSM鐩撮攢锛屽垯鏇存敼鍖婚櫌鍚堝悓浠锋牸鏃朵細璁$畻缁忛攢鍟嗗崟浠峰拰灏忚
+ // 濡傛灉鏄� 缁忛攢鍟嗛攢鍞紝鍒欐洿鏀� 绗竴缁忛攢鍟嗘�讳环鏄細璁$畻缁忛攢鍟嗗崟浠峰拰灏忚
+export function quoteAgencyTotalPriceActionLogic(jzDataToBeproduct,quo,oppInfo,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){
+ var s,l;
+ var SalesAmount1 = quo.OCM_Agent1_Price_Page__c;
+ var Estimation_List_Price = 0;
+ var thirdPartyEstimation_List_Price = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName == '' || VenderName == 'OSH') {
+ Estimation_List_Price = Estimation_List_Price + s * l;
+ } else {
+ thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + s * l;
+ }
+ });
+ // 鍖婚櫌鐨勫悎鍚岄噾棰�
+ var Dealer_Final_Price = quo.Dealer_Final_Price_Page__c;
+ // 閿�鍞笭閬�
+ var Sales_Root = oppInfo.Sales_Root__c;
+ var TotalPrice = 0;
+ var StardardPrice = 0;
+ var totalAgencyPrice = 0;
+ var AgencySubtotal = 0;
+ var LastAgencySubtotal = 0;
+ var j = 0;
+ var i = -1;
+ var lastQuantity = 0;
+ Sales_Root = Sales_Root + '';
+ Sales_Root = Sales_Root.replace(/\s+/g, "");
+ if (Sales_Root == '缁忛攢鍟�') {
+ TotalPrice = SalesAmount1;
+ } else {
+ TotalPrice = Dealer_Final_Price;
+ }
+ TotalPrice = localParseFloat(TotalPrice);
+ var oldTotalPrice = TotalPrice;
+ totalAgencyPrice = TotalPrice;
+ //no discount price 鍚堣
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ TotalPrice = TotalPrice - noDiscountPriceTotal;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ if ((s == 0) || (l == 0)) {
+ //鍑︾悊銇仐
+ } else if (oldTotalPrice == 0) {
+ jzdtbt.pageObject.AgencySubtotal__c = 0;
+ jzdtbt.AgencySubtotal__c = toNumComma_One_digit(0);
+ jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(0);
+ } else {
+ StardardPrice = s * l;
+ StardardPrice = localParseFloat(StardardPrice);
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ //琛岄」鐩� no discount price:
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ var Agency_UnitPrice = (l).toFixed(1);
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName == '' || VenderName == 'OSH') {
+ var Agency_UnitPrice = (StardardPrice * (TotalPrice - thirdPartyEstimation_List_Price) / (Estimation_List_Price * s) + noDiscountPrice ).toFixed(1);
+ }
+ AgencySubtotal = Agency_UnitPrice * s;
+ jzdtbt.pageObject.AgencySubtotal__c = AgencySubtotal;
+ jzdtbt.AgencySubtotal__c = toNumComma_One_digit(AgencySubtotal);
+ jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(Agency_UnitPrice);
+ totalAgencyPrice = totalAgencyPrice - toNum(AgencySubtotal);
+ i++;
+ j=i;
+ lastQuantity = s;
+ LastAgencySubtotal = AgencySubtotal;
+ }
+ });
+ if (oldTotalPrice != 0){
+ LastAgencySubtotal = LastAgencySubtotal + totalAgencyPrice;
+ if(jzDataToBeproduct.length>0){
+ jzDataToBeproduct[j].pageObject.AgencySubtotal__c = toNum(LastAgencySubtotal);
+ jzDataToBeproduct[j].AgencySubtotal__c = toNumComma_One_digit(LastAgencySubtotal);
+ jzDataToBeproduct[j].AgencyUnitPrice__c = toNumComma_One_digit(LastAgencySubtotal / lastQuantity);
+ }
+ }
+ return jzDataToBeproduct;
+}
+//鏍规嵁琛岄」鐩笂浜у搧鐨勪俊鎭� 鏇存柊澶氬勾淇濅慨琛岄」鐩墍鏈夊瓧娈碉紝 骞朵笖鏇存柊No Discount Price鍚堣
+export function calPriceAllLogic(jzDataToBeproduct){
+ var x, y, z, c;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.Quantity__c;
+ x = localParseInt(x);
+ if (x > 0) {
+ y = jzdtbt.UnitPrice_Page__c;
+ c = jzdtbt.Cost_c;
+ y = localParseFloat(y);
+ c = localParseFloat(c);
+ z = x * y;
+ // jzdtbt.Subtotal__c = toNumComma(z);
+ jzdtbt.Subtotal__c = z;
+ jzdtbt.pageObject.Subtotal__c = toNum(z);
+ z = x * c;
+ jzdtbt.Cost_Subtotal_c = toNum(z);
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function QuoteAdjustLogic(jzDataToBeproduct,quo,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){
+ var x = quo.QuoteTotal_Page__c;
+ x = localParseFloat(x);
+ var y = quo.hidden_Estimation_List;
+ y = localParseFloat(y);
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ var thirdPartyEstimation_List_Price = 0;
+ var price = 0;
+ var Quantity = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName != '' && VenderName != 'OSH') {
+ price = jzdtbt.ListPrice_Page;
+ price = localParseFloat(price);
+ Quantity = jzdtbt.Quantity__c;
+ Quantity = localParseInt(Quantity);
+ thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity;
+ }
+ });
+ thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price);
+ 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) / (y - thirdPartyEstimation_List_Price) * 100);
+ }
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+export function AgencyDiscountCalculation1Logic(quo,jzDataToBeproduct,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){
+ var y = quo.OCM_Agent1_Price_Page__c;
+ if (y != '' && y.length != 0) {
+ var Estimation_List_Price = quo.Estimation_List_Price__c;
+ y = y + '';
+ y = y.replace(/ /g, "");
+ if (Estimation_List_Price.length != 0) {
+ y = localParseFloat(y);
+ Estimation_List_Price = localParseFloat(Estimation_List_Price);
+ // 绗笁鏂逛骇鍝佹爣鍑嗗畾浠锋�婚
+ var thirdPartyEstimation_List_Price = 0;
+ var price = 0;
+ var Quantity = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName != '' && VenderName != 'OSH') {
+ price = jzdtbt.ListPrice_Page;
+ price = localParseFloat(price);
+ Quantity = jzdtbt.Quantity__c;
+ Quantity = localParseInt(Quantity);
+ thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity;
+ }
+ });
+ thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price);
+ if (Estimation_List_Price - thirdPartyEstimation_List_Price == 0) {
+ quo.AgencyDiscount__c = toNumComma(0);
+ // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0));
+ } else {
+ //no discount price 鍚堣
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ 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));
+ }
+ } else {
+ quo.AgencyDiscount__c = toNumComma(0);
+ // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0));
+ }
+ } else {
+ quo.AgencyDiscount__c = toNumComma(0);
+ // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0));
+ }
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+//妫�鏌ユ姤浠疯鐨凬MPA鐘舵��
+export function checkNMPA(jzDataToBeproduct) {
+ var cnt = 0;
+ var nmpa;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ nmpa = jzdtbt.SFDA_Status__c;
+ if (nmpa == '鍋滄') {
+ cnt = cnt + 1;
+ return;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+export function AlertAuthorize(oppInfo) {
+ var Authorized_DB_No = oppInfo.Authorized_DB_No__c;
+ var If_Need_Authorize = oppInfo.If_Need_Authorize__c;
+ if (If_Need_Authorize) {
+ if (Authorized_DB_No == null || Authorized_DB_No == '') {
+ return false;
+ } else {
+ return true;
+ }
+ } else {
+ return true;
+ }
+}
+export function AlertForCFDA(jzDataToBeproduct) {
+ var SFDA_Status__c, cnt;
+ cnt = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ SFDA_Status__c = jzdtbt.SFDA_Status__c;
+ if (SFDA_Status__c == '澶辨晥-閲嶆柊鐢宠涓�' || SFDA_Status__c == '澶卞姽锛堝啀鐢宠珛涓級') {
+ cnt = cnt + 1;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+export function CheckForCost(jzDataToBeproduct) {
+ var Cost, cnt, name;
+ cnt = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ Cost = jzdtbt.Cost_c;
+ name = jzdtbt.pageObject.Name__c;
+ if (name && Cost <= 0) {
+ cnt = cnt + 1;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+//妫�鏌ユ槸鍚︽湁鏍囧噯瀹氫环涓�0鐨勬儏鍐�
+export function CheckForListPrice(jzDataToBeproduct) {
+ var ListPrice, name;
+ var cnt = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ ListPrice = jzdtbt.ListPrice_Page;
+ ListPrice = localParseFloat(ListPrice);
+ name = jzdtbt.pageObject.Name__c;
+ if (name && ListPrice <= 0) {
+ cnt = cnt + 1;
+ }
+ });
+ if (cnt > 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+export function SubtotalupdateLogic(jzDataToBeproduct){
+ debugger
+ console.warn('Unit6');
+ var x, y, z;
+ z = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.Quantity__c;
+ x = localParseInt(x);
+ y = jzdtbt.UnitPrice_Page__c;
+ y = localParseFloat(y);
+ z = x * y;
+ if (jzdtbt.UnitPrice_Page__c != "") {
+ // jzdtbt.Subtotal__c = toNumComma(z);
+ jzdtbt.Subtotal__c = z;
+ jzdtbt.pageObject.Subtotal__c = toNum(z);
+ }
+ });
+ return jzDataToBeproduct;
+}
+export function quoteTotalPriceActionLogic(quo,jzDataToBeproduct,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){
+ var s = 0;
+ var x = 0;
+ var l = 0;
+ // 闈炵涓夋柟浜у搧鏍囧噯瀹氫环鎬婚
+ var y = 0;
+ var yy = 0;
+ // 闈炵涓夋柟浜у搧鎶ヤ环鎬婚
+ var z = quo.QuoteTotal_Page__c;
+ // 浜у搧鎶ヤ环鎬婚
+ var zz = 0;
+ z = localParseFloat(z);
+ //no discount price 鍚堣
+ var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice;
+ noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal);
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ x = s * l;
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ // OSH 璁$畻鏍囧噯瀹氫环鎬婚
+ if (VenderName == 'OSH' || VenderName == '') {
+ y = y + x;
+ // 闈濷SH 灏嗕骇鍝佹姤浠锋�婚 鍑忓幓 绗笁鏂逛骇鍝�
+ } else {
+ z = z - x;
+ }
+ });
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ //琛岄」鐩� no discount price:
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ // 渚涘簲鍟嗗悕绉�
+ var VenderName = jzdtbt.VenderName;
+ s = jzdtbt.Quantity__c;
+ s = localParseInt(s);
+ l = jzdtbt.ListPrice_Page;
+ l = localParseInt(l);
+ // 琛岄」鐩� 鏍囧噯瀹氫环灏忚
+ x = s * l;
+ x = localParseFloat(x);
+ if ((s == 0) || (x == 0)) {
+ //涓嶅鐞�
+ } else {
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (VenderName == 'OSH' || VenderName == '') {
+ 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;
+ // jzdtbt.UnitPrice_Page__c = toNumComma(yy / s + noDiscountPrice);
+ jzdtbt.UnitPrice_Page__c = yy / s + noDiscountPrice;
+ } else {
+ yy = localParseFloat(x);
+ }
+ zz = zz + yy;
+ }
+ });
+ quo.QuoteTotal_Page__c = toNumComma(zz + noDiscountPriceTotal);
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+export function UnitPriceUpdateLogic(quo,jzDataToBeproduct,QuoteDecision_Button){
+ var num;
+ num = quo.Quote_Adjust_Calculate__c;
+ num = localParseFloat(num);
+ quo.Quote_Adjust_Calculate__c = toNumComma(num);
+ num = (100 + num) / 100;
+ var price = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ price = jzdtbt.ListPrice_Page;
+ price = localParseFloat(price);
+ var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c;
+ noDiscountPrice = localParseFloat(noDiscountPrice);
+ var backbutton = QuoteDecision_Button;
+ if (backbutton == '') {
+ VenderName = '';
+ }
+ if (price != '' && VenderName == 'OSH') {
+ // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice);
+ jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice;
+ } else if (price != '' && VenderName == '') {
+ // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice);
+ jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice;
+ }
+ });
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+export function calGuranteePeriodLogic(jzDataToBeproduct,AllGurantee_Period){
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ // 淇濅慨
+ var multiYearWarranty = true;
+ if (jzdtbt.multiYearWarranty__c) {
+ multiYearWarranty = jzdtbt.multiYearWarranty__c;
+ }
+ // 淇濅慨绫诲瀷
+ var warrantyType = jzdtbt.warrantyType__c;
+ // 浜у搧淇濅慨绫诲瀷
+ var GuranteeType = jzdtbt.pageObject.GuranteeType__c;
+ // 浜у搧淇濅慨鏈�
+ var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c;
+ // 璁℃彁骞撮檺
+ var provistonPeriod = 0;
+ // 鏍规嵁浜у搧淇℃伅璁剧疆淇濅慨骞撮檺
+ if (GuranteeType == '鏈嶅姟') {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ provistonPeriod = ProductEntend_gurantee_period;
+ } else if (GuranteeType == '甯傚満') {
+ if (multiYearWarranty == true) {
+ if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) {
+ jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ provistonPeriod = ProductEntend_gurantee_period;
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = 1;
+ jzdtbt.GuaranteePeriod__c = 1;
+ }
+ } else {
+ jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period;
+ jzdtbt.GuaranteePeriod__c = AllGurantee_Period;
+ }
+ jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0;
+ });
+ return jzDataToBeproduct;
+}
+export function PrintCustomerNameoptionsvlue(options_hp,selection_hp,quo,options_hpflg,accs){
+ if (JSON.stringify(accs) != "{}") {
+ if (accs[0].Name) {
+ var options_hpvalue = {};
+ options_hpvalue.label = accs[0].Name;
+ options_hpvalue.value = accs[0].Name;
+ options_hp.push(options_hpvalue);
+ }
+ if (accs[0].Site) {
+ var options_hpvalue = {};
+ options_hpvalue.label = accs[0].Site;
+ options_hpvalue.value = accs[0].Site;
+ options_hp.push(options_hpvalue);
+ }
+ if (accs[0].Alias_Name2__c) {
+ var options_hpvalue = {};
+ options_hpvalue.label = accs[0].Alias_Name2__c;
+ options_hpvalue.value = accs[0].Alias_Name2__c;
+ options_hp.push(options_hpvalue);
+ }
+ if (!quo.Print_HP_Name__c ||
+ (quo.Print_HP_Name__c !== accs[0].Name &&
+ quo.Print_HP_Name__c !== accs[0].Site &&
+ quo.Print_HP_Name__c !== accs[0].Alias_Name2__c)
+ ) {
+ selection_hp = accs[0].Name;
+ } else {
+ selection_hp = quo.Print_HP_Name__c;
+ }
+ options_hpflg = false;
+ }
+ selection_hpExp = selection_hp;
+ options_hpflgExp = options_hpflg;
+ return options_hp
+}
+export function initquoassignment(quote,quoc,it){
+ var quo = quoc
+ var rtn = quo.Cancel_Decide__c;
+ quo.rtn = !rtn ? it : !rtn;
+ var CreatedDateTime = new Date(quote.CreatedDate);
+ var PriceRefreshDate = new Date(quote.PriceRefreshDate__c);
+ quo.PriceRefreshPeriod = dateDaysBetween(!PriceRefreshDate ? CreatedDateTime : PriceRefreshDate,new Date());
+ quo.QuoteName__c = quote.Name;
+ quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c);
+ quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c);
+ quo.Quote_Adjust_Amount_Page__c = toNumComma(quote.Quote_Adjust_Amount__c);
+ if(quo.OCM_Agent1_Price__c){
+ quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c);
+ }else{
+ quo.OCM_Agent1_Price_Page__c = '';
+ }
+ quo.MultiYearWarrantyTotalPrice__c = toNumComma(quo.MultiYearWarrantyTotalPrice__c);
+ quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c);
+ quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c);
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c);
+ //棰勬祴閲戦淇敼 fy
+ if(!quote.QuotationChange__c){
+ quo.QuotationChange__c = '';
+ }
+ if(!quote.Installation_location__c){
+ quo.Installation_location__c = '';
+ }
+ if(quote.Agent1_Agent2_Price__c){
+ quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c);
+ }else{
+ quo.Agent1_Agent2_Price_Page__c = '';
+ }
+ quo.hidden_Estimation_List = quote.Estimation_List_Price__c;
+ return quo;
+}
+export function initquoassignmentcopy(quote,quoc,it){
+ debugger
+ var quo = quoc
+ let Name = quote.Name;
+ var QX = Name.indexOf('宸插彇娑�:');
+ if (QX >= 0) {
+ quo.Name = quo.Name.substring(QX + 4);
+ }
+ quo.QuoteName__c = quo.Name;
+ quo.IsQuoteTrial__c = false;
+ quo.Cancel_Decide__c = false;
+ quo.PriceRefreshDate__c = new Date();
+ quo.Quote_Date__c = null;
+ quo.Quote_Print_Date__c = null;
+ quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c);
+ if(quo.OCM_Agent1_Price__c){
+ quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c);
+ }else{
+ quo.OCM_Agent1_Price_Page__c = '';
+ }
+ quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c);
+ quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c);
+ if(!quote.QuotationChange__c){
+ quo.QuotationChange__c = '';
+ }
+ if(!quote.Installation_location__c){
+ quo.Installation_location__c = '';
+ }
+ if(quote.Agent1_Agent2_Price__c){
+ quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c);
+ }else{
+ quo.Agent1_Agent2_Price_Page__c = '';
+ }
+ quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c);
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c);
+ //棰勬祴閲戦淇敼 fy
+ quo.Quote_Adjust_Calculate__c = '';
+ quo.Quote_Adjust_Amount_Page__c = '';
+ quo.hidden_Estimation_List = quote.Estimation_List_Price__c;
+ quo.PriceRefreshPeriod = null;
+ var rtn = quo.Cancel_Decide__c;
+ quo.rtn = !rtn ? it : !rtn;
+ return quo;
+}
+export function salesProfit1Logic(quo,Salesprofit1value){
+ var x = quo.Dealer_Final_Price_Page__c;
+ var y = quo.OCM_Agent1_Price_Page__c;
+ debugger
+ y = y + '';
+ y = y.replace(/ /g, "");
+ if (y.length == 0) {
+ var z = quo.Agent1_Agent2_Price_Page__c;
+ z = z + '';
+ z = z.replace(/ /g, "");
+ if (z.length == 0) {
+ quo.OCM_Agent1_Price_Page__c = '';
+ Salesprofit1value = '';
+ quo.Agency1_Profit__c = '';
+ } else {
+ quo.OCM_Agent1_Price_Page__c = toNumComma(0);
+ Salesprofit1value = toNum(0);
+ quo.Agency1_Profit__c = toNumComma(0);
+ }
+ } else {
+ quo.OCM_Agent1_Price_Page__c = toNumComma(y);
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ var t = quo.Agent1_Agent2_Price_Page__c;
+ if (t.length == 0) {
+ Salesprofit1value = toNum(x - y);
+ quo.Agency1_Profit__c = toNumComma(x - y);
+ } else {
+ t = localParseFloat(t);
+ Salesprofit1value = toNum(t - y);
+ quo.Agency1_Profit__c = toNumComma(t - y);
+ }
+ }
+ quoExp = quo;
+ return Salesprofit1value;
+}
+export function salesCalculation1Logic(quo,Salesprofit1value,SalesCalculation1value){
+ var w = quo.OCM_Agent1_Price_Page__c;
+ w = w + '';
+ w = w.replace(/ /g, '');
+ var x = Salesprofit1value;
+ var y = quo.Dealer_Final_Price_Page__c;
+ var z = quo.Agent1_Agent2_Price_Page__c;
+ z = z + '';
+ z = z.replace(/ /g, '');
+ if (w.length == 0) {
+ SalesCalculation1value = '';
+ quo.Agency1_Profit_Rate__c = '';
+ } else {
+ x = localParseFloat(x);
+ var t = 0;
+ if (z.length == 0) {
+ y = localParseFloat(y);
+ if (y != 0) {
+ t = x / y * 100;
+ } else {
+ t = 0;
+ }
+ } else {
+ z = localParseFloat(z);
+ if (z != 0) {
+ t = x / z * 100;
+ } else {
+ t = 0;
+ }
+ }
+ SalesCalculation1value = toNum(t);
+ quo.Agency1_Profit_Rate__c = toNumComma(t);
+ }
+ quoExp = quo;
+ return SalesCalculation1value;
+}
+export function salesProfit2Logic(quo,Salesprofit2value){
+ var x = quo.Dealer_Final_Price_Page__c;
+ var y = quo.Agent1_Agent2_Price_Page__c;
+ y = y + '';
+ y = y.replace(/ /g, "");
+ if (y.length == 0) {
+ quo.Agent1_Agent2_Price_Page__c = '';
+ Salesprofit2value ='';
+ quo.Agency2_Profit__c = '';
+ } else {
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ quo.Agent1_Agent2_Price_Page__c = toNumComma(y);
+ Salesprofit2value = toNum(x - y);
+ quo.Agency2_Profit__c = toNumComma(x - y);
+ }
+ quoExp = quo;
+ return Salesprofit2value;
+}
+/*
+ 璁$畻绗簩缁忛攢鍟嗘爮鏈�鍙宠竟鐨勭櫨鍒嗘瘮 2娆¤博澹插簵鍒╃泭鐜嘷鍏� = 绗簩缁忛攢鍟嗗埄娑﹂櫎浠ュ尰闄㈢殑鍚堝悓閲戦
+ */
+export function salesCalculation2Logic(quo,Salesprofit2value,SalesCalculation2value){
+ var w = quo.Agent1_Agent2_Price_Page__c;
+ w = w + '';
+ w = w.replace(/ /g, '');
+ var x = Salesprofit2value;
+ var y = quo.Dealer_Final_Price_Page__c;
+ if (w.length == 0) {
+ SalesCalculation2value = '';
+ quo.Agency2_Profit_Rate__c = '';
+ } else {
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ if ((y == 0)) {
+ SalesCalculation2value = toNum(0);
+ quo.Agency2_Profit_Rate__c = toNumComma(0);
+ } else {
+ var z = x / y * 100;
+ SalesCalculation2value = toNum(z);
+ quo.Agency2_Profit_Rate__c = toNumComma(z);
+ }
+ }
+ quoExp = quo;
+ return SalesCalculation2value;
+}
+export function additionabuttonLoc(SelectedNewsetProduct,quo,oppInfo,jzDataToBeproduct){
+ var Str = SelectDone(SelectedNewsetProduct);
+ var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ StrExp = Str;
+ return {setProduct_text:Str,
+ activitiesCan:quoLineItemCan,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan};
+}
+export function onsaveToBeproductLoc(data,jzDataToBeproduct){
+ var dataMap = new Map();
+ var fag = false;
+ data.forEach(item=>{
+ var key = Number(item.lineNo);
+ var value = {Quantity__c:'',UnitPrice_Page__c:''}
+ if(item.Quantity__c != undefined){
+ value.Quantity__c = item.Quantity__c;
+ fag = true;
+ }
+ if(item.UnitPrice_Page__c != undefined){
+ value.UnitPrice_Page__c = item.UnitPrice_Page__c;
+ }
+ dataMap.set(key,value);
+ });
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var x, y, z, c;
+ if(dataMap.has(jzdtbt.lineNo)){
+ var datavaue = dataMap.get(jzdtbt.lineNo);
+ if(datavaue.Quantity__c){
+ jzdtbt.Quantity__c = localParseInt(datavaue.Quantity__c);
+ }
+ if(datavaue.UnitPrice_Page__c){
+ // jzdtbt.UnitPrice_Page__c = toNumComma(datavaue.UnitPrice_Page__c);
+ jzdtbt.UnitPrice_Page__c = datavaue.UnitPrice_Page__c;
+ }
+ x = localParseInt(jzdtbt.Quantity__c);
+ y = localParseFloat(jzdtbt.UnitPrice_Page__c);
+ c = localParseFloat(jzdtbt.Cost_c);
+ z = x * y;
+ // jzdtbt.Subtotal__c = toNumComma(z)
+ jzdtbt.Subtotal__c = z
+ // jzdtbt.pageObject.Subtotal__c = toNumComma(z)
+ jzdtbt.pageObject.Subtotal__c = z
+ z = x * y;
+ jzdtbt.Cost_Subtotal_c = toNum(z);
+ }
+ });
+ fagExp = fag;
+ return jzDataToBeproduct;
+}
+export function PrintButtonLoc(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert,
+ productStatusUpdated,enableSales,oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period,
+ quotemultiYearWarranty,selection_hp,SkipQuotefilg,QuoteDecision){
+ var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var CheckItemCan = JSON.stringify(CheckItem);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ var data ={activitiesCan:quoLineItemCan,
+ CheckItemCan:CheckItemCan,
+ WinOrDecideAlertc:WinOrDecideAlert,
+ productStatusUpdatedc:productStatusUpdated,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan,
+ enableSalesc:enableSales,
+ oppIdc:oppId,
+ quoIdc:quoId,
+ newQuoteFlagc:newQuoteFlag,
+ changedAfterPrintc:changedAfterPrint,
+ quoteGurantee_Periodc:quoteGurantee_Period,
+ quotemultiYearWarrantyc:quotemultiYearWarranty,
+ selection_hpc:selection_hp,
+ SkipQuotefilgc:SkipQuotefilg,
+ QuoteDecisionc:QuoteDecision
+ };
+ return data;
+}
+export function saverebackloc(resaut,quoId,nafg){
+ alertExp = ''
+ var Setmap = new Map()
+ var key = Object.keys(resaut)
+ key.forEach(item=>{
+ Setmap.set(item,resaut[item]);
+ });
+ if(Setmap.has('errormessage')){
+ errorflg = true;
+ alertExp = Setmap.get('errormessage');
+ }else{
+ if(Setmap.has('quoId')){
+ quoId = Setmap.get('quoId');
+ }
+ if(Setmap.has('quoId')){
+ window.open('/lightning/n/lexSINewQuoteEntry#Id=' + Setmap.get('quoId'), '_self');
+ flg = true;
+ }
+ errorflg = false;
+ }
+ nafgExp = resultFlag(nafg,Setmap)
+ return quoId;
+}
+// 浼樻儬鎶樻墸 = 浼樻儬浠锋牸 / 锛堟姤浠锋�婚 - No discount price 鍚堣锛夛紱
+export function DisCalculationfunctionLoc(quo){
+ var x = quo.Discount_Amount__c;
+ x = localParseFloat(x);
+ var y = quo.QuoteTotal_Page__c;
+ y = localParseFloat(y);
+ if ((y == 0)) {
+ quo.Discount_Amount_Calculate__c = '';
+ } else {
+ var z = 0;
+ z = x / y * 100;
+ z = z.toFixed(2);
+ quo.Discount_Amount_Calculate__c = toNum(z);
+ }
+ return quo;
+}
+// 鏍规嵁鍖婚櫌灏忚璁$畻鎶ヤ环鎬婚
+export function quoteTotalPriceLoc(jzDataToBeproduct,quo,quoId,oppInfo,Saleslets){
+ debugger
+ var x = 0;
+ var y = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.pageObject.Subtotal__c;
+ x = localParseFloat(x);
+ y = y + localParseFloat(x);
+ });
+ quo.QuoteTotal_Page__c = toNumComma(y);
+ var z = quo.Estimation_List_Price__c;
+ var id = quoId;
+ if(!id){
+ var IsQuoteTrial =quo.IsQuoteTrial__c;
+ if(!IsQuoteTrial){
+ var mp =quo.MultiYearWarrantyTotalPrice__c;
+ mp = localParseFloat(mp);
+ var num = quo.Quote_Adjust_Calculate__c;
+ num = localParseFloat(num);
+ 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 = Saleslets ? toNumComma(z*num*ra+mp) : '';
+ }
+ }
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+//璁$畻闅愯棌 listPirce 姹囨�� 鍜� UnitPrice(鍖婚櫌鍗曚环) 姹囨��
+export function calUnitPriceTotalLoc(jzDataToBeproduct){
+ var ListPriceTotal = 0.0,
+ listPrice = 0.0;
+ var unitPriceTotal = 0.0,
+ unitPrice = 0.0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ listPrice = jzdtbt.ListPrice_Page;
+ unitPrice = jzdtbt.UnitPrice_Page__c;
+ ListPriceTotal += localParseFloat(listPrice);
+ unitPriceTotal += localParseFloat(unitPrice);
+ });
+ ListPriceTotalExp = ListPriceTotal;
+ unitPriceTotalExp = unitPriceTotal;
+ jzDataToBeproduct =[].concat(jzDataToBeproduct);
+ return jzDataToBeproduct;
+}
+//鍒ゆ柇杩涢攢鍟�1 鍜� 2 娓呯┖ 鍒╂鼎鐧惧垎姣旀樉绀�
+export function pageArrangeLoc(quo){
+ if (!quo.OCM_Agent1_Price_Page__c) {
+ quo.Agency1_Profit__c = '';
+ quo.Agency1_Profit_Rate__c = '';
+ quo.OCM_Agent1_Price_Page__c = '';
+ }
+ if (!quo.Agent1_Agent2_Price_Page__c) {
+ quo.Agency2_Profit__c = '';
+ quo.Agency2_Profit_Rate__c = '';
+ quo.Agent1_Agent2_Price_Page__c = '';
+ }
+ return quo;
+}
+export function openQuotePage(b, b2, b3) {
+ var quoid = b3;
+ if (b2) {
+ } else {
+ if (b) {
+ //openPopup('/apex/contractdetailpdf?id=quoid');
+ window.open('/apex/contractdetailpdf?id=' + quoid, 'Contract');
+ } else {
+ //openPopup('/apex/quotepdf?id=quoid');
+ window.open('/apex/quotepdf?id=' + quoid, 'Quote');
+ }
+ }
+}
+export function quoteinit(quo){
+ if (!quo.Gurantee_Period__c) {
+ quo.Gurantee_Period__c = '1';
+ }
+ if (quo.Quote_Expiration_Date__c == null) {
+ quo.Quote_Expiration_Date__c = addDay(30,new Date());
+ }
+ quo.Offer_Amount__c = true;
+ quo.TOTAL__c = true;
+ quo.Preferential_Gurantee_Period__c = true;
+ return quo;
+}
+/*
+濡傛灉璇环鏄粡閿�鍟嗚穿鍗栵紝锛迹锛娴嬮閿�鍞� = 绗竴缁忛攢鍟�
+濡傛灉璇环鏄疧CM鐩撮攢锛岋集锛o辑棰勬祴棰濋攢鍞� = 鍖婚櫌鐨勫悎鍚岄噾棰�
+*/
+export function setOCMAmountc(enableSales,quo,oppInfo){
+ var s, t;
+ s = enableSales;
+ if (s) {
+ t = quo.OCM_Agent1_Price_Page__c;
+ } else {
+ t = quo.Dealer_Final_Price_Page__c;
+ }
+ t = localParseFloat(t);
+ oppInfo.hidden_Wholesale_Price = toNum(t);
+ oppInfo.Wholesale_Price__c = toNumComma(t);
+ //棰勬祴閲戦淇敼 fy
+ quo.OCM_Sales_Forecast__c = toNumComma(t);
+ quoExp = quo;
+ //棰勬祴閲戦淇敼 fy
+ return oppInfo;
+}
+// 浼樻儬浠锋牸 = 鎶ヤ环鎬婚 - 鍖婚櫌鐨勫悎鍚岄噾棰�
+ // 鐒跺悗璋冪敤 DisCalculation
+export function DisAmountfunctionc(quo){
+ var x = quo.QuoteTotal_Page__c;
+ x = localParseFloat(x);
+ var y = quo.Dealer_Final_Price_Page__c;
+ y = localParseFloat(y);
+ quo.Discount_Amount__c = toNum(x - y);
+ return quo;
+}
+export function Savebuttondetermine(opp,Save_button1){
+ var QuoteBusiness = opp.BusinessFileArchived__c;
+ var Configuration_Suggestion = opp.Configuration_Suggestion__c;
+ var Configuration_Suggestion_Feedback = opp.Configuration_Suggestion_Feedback__c;
+ if(!Configuration_Suggestion && !Configuration_Suggestion_Feedback && !QuoteBusiness){
+ Save_button1 = 111;
+ }
+ if(Configuration_Suggestion == '鏈夊缓璁�' && !Configuration_Suggestion_Feedback && QuoteBusiness == false){
+ Save_button1 = 211;
+ }
+ if(Configuration_Suggestion == '鏈夊缓璁�' && Configuration_Suggestion_Feedback && QuoteBusiness == false){
+ Save_button1 = 221;
+ }
+ if(!Configuration_Suggestion && !Configuration_Suggestion_Feedback && QuoteBusiness == true){
+ Save_button1 = 112;
+ }
+ if(Configuration_Suggestion == '鏈夊缓璁�' && !Configuration_Suggestion_Feedback && QuoteBusiness == true){
+ Save_button1 = 212;
+ }
+ if(Configuration_Suggestion == '鏃犲缓璁�' && QuoteBusiness == false){
+ Save_button1 = 1;
+ }
+ return Save_button1;
+}
+export function submitOppoApplyStockJsLogic(Savebutton){
+ alertExp = '';
+ var Save_button1 = Savebutton;
+ var flag = false;
+ if(Save_button1 == 111){
+ alertExp = '1銆佽仈绯籗I鏈儴鍋氶厤缃缓璁�俓n2銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛�俓n3銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��';
+ }else if(Save_button1 == 211){
+ alertExp = '1銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛�俓n2銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��';
+ }else if(Save_button1 == 221){
+ alertExp = '1銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��';
+ }else if(Save_button1 == 1){
+ alertExp = '1銆佽SI鏈儴鍋氶厤缃枃浠舵鏌ャ��';
+ }else if(Save_button1 == 112){
+ alertExp = '1銆佽仈绯籗I鏈儴鍋氶厤缃缓璁�俓n2銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛��';
+ }else if(Save_button1 == 212){
+ alertExp = '1銆佽钀ヤ笟鏈儴鍋氶厤缃缓璁弽棣堛��';
+ }else{
+ flag = true;
+ }
+ return flag;
+}
+export function initOpportunityById(oppInfo,oppobj,enableSales,QuoteDecision,enableContract,displayFlg,viewSpecialAgencyAmout,Sales_Outlet,OCM_Direct){
+ if (oppInfo.Sales_Root__c != null) {
+ if (oppobj.Sales_Root__c == '璨╁2搴�') {
+ enableSales = true;
+ oppInfo.Sales_Root__c = Sales_Outlet;
+ Saleslet = true;
+ } else {
+ enableSales = false;
+ oppInfo.Sales_Root__c = OCM_Direct;
+ }
+ }
+
+ if (QuoteDecision) {
+ enableContract = true;
+ } else {
+ enableContract = false;
+ }
+ oppInfo.SAP_Send_OK__c = true;
+ if (!oppInfo.SAP_Send_OK__c) {
+ displayFlg = true;
+ } else {
+ if(oppInfo.Agency1__r == undefined){
+ oppInfo.Agency1__r = {};
+ }
+ if(oppInfo.Agency2__r == undefined){
+ oppInfo.Agency2__r = {};
+ }
+ if(oppInfo.Account == undefined){
+ oppInfo.Account = {};
+ }else{
+ if(oppInfo.Account.Parent == undefined){
+ oppInfo.Account.Parent = {};
+ }
+ }
+ if (oppInfo.Agency1__r.Special__c || oppInfo.Agency2__r.Special__c || oppInfo.Account.Parent.Special__c) {
+ // 鐗瑰垾璨╁2搴椼伄寮曞悎銇�
+ if (viewSpecialAgencyAmout) {
+ displayFlg = true;
+ } else {
+ displayFlg = false;
+ }
+ } else {
+ displayFlg = true;
+ }
+ }
+ enableSalesExp = enableSales;
+ enableContractExp = enableContract;
+ displayFlgExp = displayFlg;
+ return oppInfo;
+}
+export function QuoteConfirmJsExp(User,Admin,Admin2){
+ debugger
+ alertExp = '';
+ var profileId = User.ProfileId;
+ var adminId = Admin;
+ var adminId2 = Admin2;
+ var flag=true;
+ var profileId15=profileId;
+ var flg;
+ if(profileId&&profileId.length>15){
+ profileId15=profileId.substring(0,15);
+ }
+ if(adminId2.includes(profileId15)){
+ flag=false;
+ }else{
+ flag=true;
+ }
+ if(profileId!=adminId&&flag){
+ alertExp = '鍙湁绯荤粺绠$悊鍛樺拰钀ヤ笟鍔╃悊鏈夋潈闄愮‘璁ゆ姤浠凤紒';
+ flg = true;
+ }else{
+ flg = false;
+ }
+ return flg
+}
+export function initOpportunityById2(QuoteCorrect,User,QuoteDecision,QuoteSapSented,print_buttonflg,sap_button,Decision_button,Save_button){
+ var verified =User.Quote_Correct__c;
+ var specialAuthority = User.Quote_Special_Operation__c;
+ if (!QuoteCorrect) {
+ print_buttonflg = true;
+ } else if (!verified) {
+ print_buttonflg = true;
+ } else {
+ print_buttonflg = false;
+ }
+ if (QuoteDecision == false) {
+ sap_button = true;
+ } else if (specialAuthority == false) {
+ sap_button = true;
+ } else {
+ sap_button = false;
+ }
+ if (verified) {
+ Decision_button = false;
+ } else if (!QuoteCorrect) {
+ Decision_button = true;
+ } else if (QuoteDecision) {
+ Decision_button = true;
+ } else {
+ Decision_button = false;
+ }
+ if (QuoteSapSented || QuoteDecision) {
+ Decision_button = true;
+ }
+ if (QuoteDecision) {
+ Save_button = true;
+ } else {
+ Save_button = false;
+ }
+ SbuttonExp = Save_button;
+ sapbuttonExp = sap_button;
+ pbuttonflgExp = print_buttonflg;
+ return Decision_button;
+}
+export function selectQuoteLineExp(quote,User,SI2M3ID,ProfSystAdmin,UnConfirmQuote){
+ alertExp = '';
+ debugger
+ var quo=quote;
+ var quoteOwner = quo.CreatedById;
+ var ProfileIDStr = User.ProfileId;
+ if(quo.Queto_Confirm_Date__c ||
+ (!quo.Queto_Confirm_Date__c && (ProfileIDStr == SI2M3ID||ProfileIDStr == ProfSystAdmin||quoteOwner == User.Id))){
+ quo.QuoteName__c = quo.Name;
+ if(!quo.Queto_Confirm_Date__c){
+ UnConfirmQuote = true;
+ }else if(quo.Queto_Confirm_Date__c){
+ }else{
+ // Message = '璇峰強鏃剁‘璁ゆ姤浠�';
+ alertExp = '璇峰強鏃剁‘璁ゆ姤浠�';
+ }
+ }else{
+ quo = {};
+ UnConfirmQuote = false;
+ // errorMessage = '璇ユ姤浠峰皻鏈‘璁わ紝涓嶈兘鏌ョ湅';
+ alertExp = '璇ユ姤浠峰皻鏈‘璁わ紝涓嶈兘鏌ョ湅';
+ }
+ quoExp = quo;
+ return UnConfirmQuote;
+}
+export function SFDAtranslate(key){
+ var value = '';
+ if(key == '婧栧倷涓�'){
+ value = '鍑嗗涓�';
+ }else if(key == '鏂拌=鍝佺敵璜嬩腑'){
+ value = '鏂颁骇鍝佹敞鍐屼腑';
+ }else if(key == '鏈夊姽'){
+ value = '鏈夋晥';
+ }else if(key == '澶卞姽锛堟湡闄愬唴鐢熺敚娓堝湪搴蹇滐級'){
+ value = '澶辨晥鎴栧仠姝紙娉ㄥ唽璇佹湁鏁堟湡鍐呯敓浜х殑搴撳瓨鍝佸搴旓級';
+ }else if(key == '澶卞姽锛堝啀鐢宠珛涓級'){
+ value = '澶辨晥-閲嶆柊鐢宠涓�';
+ }else if(key == '澶卞姽锛堢敵璜嬬劇锛�'){
+ value = '澶辨晥-涓嶅啀娉ㄥ唽';
+ }else if(key == '鏈夊姽锛堝啀鐢宠珛涓級'){
+ value = '鏈夋晥-閲嶆柊鐢宠涓�';
+ }else{
+ value = key;
+ }
+ return value;
+}
+export function decisionlol(jzDataToBeproduct,oppInfo,QuotationCalculationFag){
+ var ff = false;
+ alertExp = '';
+ var Shut = AlertForCFDA(jzDataToBeproduct);
+ var ifAuth = AlertAuthorize(oppInfo);
+ var arr = [];
+ var Venderflag = false;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var VenderName = jzdtbt.VenderName;
+ var prdouctName = jzdtbt.pageObject.Name__c;
+ if (prdouctName) {
+ arr.push(VenderName);
+ }
+ });
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[0] != arr[i]) {
+ Venderflag = true;
+ }
+ }
+ var listPrice = CheckForListPrice(jzDataToBeproduct);
+ var cost = CheckForCost(jzDataToBeproduct);
+ if (Shut == true) {
+ ff = true;
+ alertExp = '鎻愮ず锛氬寘鍚噸鏂扮敵璇稢FDA鐨勪骇鍝侊紝涓嶅彲Decide銆�';
+ } else if (ifAuth == false) {
+ ff = true;
+ alertExp = '鎻愮ず锛氳璇环鏈巿鏉冿紝涓嶅彲Decide';
+ } else if (Venderflag == true) {
+ ff = true;
+ alertExp = '鎻愮ず锛氳鎸夌収涓嶅悓渚涘簲鍟嗘媶鍗曪紝涓嶅厑璁竏ecide銆�';
+ }else if (listPrice == true || cost == true) {
+ ff = true;
+ alertExp = '浜у搧瀹氫环/鎴愭湰涓�0锛岃鑱旂郴浜у搧鏈儴銆�';
+ }else if(QuotationCalculationFag){
+ ff = true;
+ alertExp = '浜у搧閰嶇疆鍙戠敓鍙樺寲锛岃鍐嶆杩涜鎶ヤ环璁$畻';
+ }
+ return ff;
+}
+export function saveQuotel(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert,productStatusUpdated,enableSales,
+ oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period,quotemultiYearWarranty,selection_hp,SkipQuotefilg,quoteflg){
+ var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct);
+ var oppInfoc = oppInfosave;
+ var quoLineItemc = quoLineItemsave;
+ var quoLineItemCan = JSON.stringify(quoLineItemc);
+ var CheckItemCan = JSON.stringify(CheckItem);
+ var oppInfoCan = JSON.stringify(oppInfoc);
+ var quoCan = JSON.stringify(quoc);
+ var SaveQuotecan = {activitiesCan:quoLineItemCan,
+ CheckItemCan:CheckItemCan,
+ WinOrDecideAlertc:WinOrDecideAlert,
+ productStatusUpdatedc:productStatusUpdated,
+ oppInfoc:oppInfoCan,
+ quoc:quoCan,
+ enableSalesc:enableSales,
+ oppIdc:oppId,
+ quoIdc:quoId,
+ newQuoteFlagc:newQuoteFlag,
+ changedAfterPrintc:changedAfterPrint,
+ quoteGurantee_Periodc:quoteGurantee_Period,
+ quotemultiYearWarrantyc:quotemultiYearWarranty,
+ selection_hpc:selection_hp,
+ SkipQuotefilgc:SkipQuotefilg,
+ quoteflg:quoteflg
+ }
+ return SaveQuotecan;
+}
+export function resultFlag(nafg,Setmap){
+ debugger
+ if(!Setmap){
+ nafg.dfpp = false;
+ nafg.qname = false;
+ nafg.qacc = false;
+ nafg.qaapc = false;
+ nafg.Agency1 = false;
+ nafg.nAgency1 = false;
+ nafg.oapp = false;
+ nafg.noapp = false;
+ nafg.Agency2 = false;
+ nafg.nAgency2 = false;
+ nafg.aapp = false;
+ nafg.naapp = false;
+ }else{
+ if(Setmap.has('dfpp')){
+ nafg.dfpp = true;
+ }else{
+ nafg.dfpp = false;
+ }
+ if(Setmap.has('qname')){
+ nafg.qname = true;
+ }else{
+ nafg.qname = false;
+ }
+ if(Setmap.has('qacc')){
+ nafg.qacc = true;
+ }else{
+ nafg.qacc = false;
+ }
+ if(Setmap.has('qaapc')){
+ nafg.qaapc = true;
+ }else{
+ nafg.qaapc = false;
+ }
+ if(Setmap.has('Agency1')){
+ nafg.Agency1 = true;
+ }else{
+ nafg.Agency1 = false;
+ }
+ if(Setmap.has('nAgency1')){
+ nafg.nAgency1 = true;
+ }else{
+ nafg.nAgency1 = false;
+ }
+ if(Setmap.has('oapp')){
+ nafg.oapp = true;
+ }else{
+ nafg.oapp = false;
+ }
+ if(Setmap.has('noapp')){
+ nafg.noapp = true;
+ }else{
+ nafg.noapp = false;
+ }
+ if(Setmap.has('Agency2')){
+ nafg.Agency2 = true;
+ }else{
+ nafg.Agency2 = false;
+ }
+ if(Setmap.has('nAgency2')){
+ nafg.nAgency2 = true;
+ }else{
+ nafg.nAgency2 = false;
+ }
+ if(Setmap.has('aapp')){
+ nafg.aapp = true;
+ }else{
+ nafg.aapp = false;
+ }
+ if(Setmap.has('naapp')){
+ nafg.naapp = true;
+ }else{
+ nafg.naapp = false;
+ }
+ }
+ return nafg;
+}
+// 璁$畻浜у搧鏍囧噯瀹氫环鎬婚
+export function EstimationL(jzDataToBeproduct,quo){
+ var x, y, z;
+ x = 0;
+ y = 0;
+ z = 0;
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ x = jzdtbt.ListPrice_Page;
+ y = jzdtbt.Quantity__c;
+ x = localParseFloat(x);
+ y = localParseFloat(y);
+ z = z + (x * y);
+ });
+ jzDataToBeproduct =[].concat(jzDataToBeproduct);
+ quo.hidden_Estimation_List = toNum(z);
+ quo.Estimation_List_Price__c = toNumComma(z);
+ quoExp = quo;
+ return jzDataToBeproduct;
+}
+export function checkch(jzDataToBeproduct){
+ var activities = [];
+ jzDataToBeproduct.forEach(jzdtbt=>{
+ var lineId = jzdtbt.pageObject.PricebookEntryId;
+ if (lineId) {
+ var item = new Object();
+ item.PricebookEntryId = jzdtbt.pageObject.PricebookEntryId;
+ item.SFDA_Status__c = jzdtbt.pageObject.SFDA_Status__c;
+ item.UnitPrice__c = localParseFloat(jzdtbt.UnitPrice_Page__c);
+ item.ListPrice__c = localParseFloat(jzdtbt.ListPrice_Page);
+ item.Quantity = localParseInt(jzdtbt.Quantity__c);
+ item.Is_DangerousChemicals = jzdtbt.Is_DangerousChemicals;
+ item.Is_CanNotCancelFlag = jzdtbt.CanNotCancelledGurantee;
+ activities.push(item);
+ }
+ });
+ return activities;
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSINewQuoteEntry/lexSIquoteTrialUtil.js b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSIquoteTrialUtil.js
new file mode 100644
index 0000000..10abc3b
--- /dev/null
+++ b/force-app/main/default/lwc/lexSINewQuoteEntry/lexSIquoteTrialUtil.js
@@ -0,0 +1,3353 @@
+const initSearchFormProduct = [{
+ label: "浜у搧鍨嬪彿",
+ type: "text",
+ name: "Asset_Model_No__c",
+ isInput: true
+},
+{
+ label: "浜у搧鍚嶇О",
+ type: "text",
+ name: "Name__c",
+ isInput: true
+}
+]
+export var arrTempsss = [];
+export var arrProductTempsss = [];
+export var NewDefaultDatass = [];
+export var AddProductDatass = [];
+export var jzDataFixedPriceTemps = [];
+export var jzDataDiscountTemps = [];
+export var DeftCopyQtyLists = [];
+export var jzDataDefaultExp = [];
+export var jzDataProductExp = [];
+export var jzDataFixedPriceExp = [];
+export var jzDataDiscountExp = [];
+export var jzDataDefaultCopyQuantityListExp = [];
+export var newArrsTemp3Exp = [];
+export var newArrsTemp4Exp = [];
+export var jzDataDefaultCopyExp = [];
+export var newArrsTempExp = [];
+export var newArrsTemp2Exp = [];
+export var booleanExp = 0;
+export var boolean2Exp = false;
+export var boolean3Exp = false;
+export var dataExp = [];
+export var newDataExp = [];
+export var newData2Exp = [];
+export var newData3Exp = [];
+export var editnewDateExp = [];
+export var GuaranteeDiscount__cZuiXiaoExp =0;
+export var NormalDiscount__cZuiXiaoExp =0;
+export var CompareFullDataExp =[];
+export var HeTongTotalExp =[];
+export var SelectedFnDataFixedPriceExp = [];
+export var idsExp = [];
+export var CompareFullDataTempExp = [];
+export var jzDataDefaultNotChangeExp = [];
+export var iflagExp = false;
+export var falgExp = false;
+export var newTempExp = [];
+export var ifnullExp = true;
+export var isChangeExp;
+export var buttonIsShowE;
+export var initDTFP;
+export var initDTD;
+export var initDTOD;
+export var initDTC;
+
+
+
+
+export function GetName() {
+ // debugger;
+ // var divs = template.querySelectorAll('div');
+
+
+ // var outLine=[];
+ // divs.forEach(item=>{
+ // debugger
+ // });
+}
+//=======鏇存柊淇冮攢鏂规娆℃暟鏁版嵁閫昏緫
+export function updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData) {
+ CompareFullData.forEach(item => {
+ if (item.ListName == "浠锋牸鏀跨瓥") {
+ var filterTemp = jzDataFixedPriceTemp.filter(fItem => {
+ if (fItem.Id == item.Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (filterTemp != undefined || filterTemp.length > 0) {
+ var fileterTempObject = {
+ ...{},
+ ...filterTemp[0]
+ };
+ fileterTempObject.Counts = item.num;
+ jzDataFixedPriceTemp = jzDataFixedPriceTemp.map(element => {
+ if (element.Id == fileterTempObject.Id) {
+ element = fileterTempObject;
+ } else {
+ let elementTemp = {
+ ...{},
+ ...element
+ };
+ element = elementTemp;
+ }
+ return element;
+ });
+ }
+ }
+ if (item.ListName == "鎶樻墸鏀跨瓥") {
+ var filterTemp = jzDataDiscountTemp.filter(fItem => {
+ if (fItem.Id == item.Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (filterTemp != undefined || filterTemp.length > 0) {
+ var fileterTempObject = {
+ ...{},
+ ...filterTemp[0]
+ };
+ fileterTempObject.Counts = item.num;
+ jzDataDiscountTemp = jzDataDiscountTemp.map(element => {
+ if (element.Id == fileterTempObject.Id) {
+ element = fileterTempObject;
+ } else {
+ let elementTemp = {
+ ...{},
+ ...element
+ };
+ element = elementTemp;
+ }
+ return element;
+ });
+ }
+ }
+ })
+ jzDataFixedPriceTemps = jzDataFixedPriceTemp;
+ jzDataDiscountTemps = jzDataDiscountTemp;
+}
+//鍙嶇畻鎶樻墸鏃朵慨鏀规姌鎵f斂绛栭�昏緫
+export function ReverseCalculationModifyDiscountLogic(arrTemp1,arrProductTemp,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item){
+ //price鍜�
+ var sumListCount = 0;
+ //nod鍜�
+ var sumNodCount = 0;
+ //鐗圭害鎶樻墸nod鍜宭ist鍚�
+ var sumListAndNod = 0;
+ //鍚骞翠繚浜у搧list
+ var ObjectProducList=[];
+ //涓嶅惈澶氬勾淇濅骇鍝乴ist
+ var NotObjectProducList=[];
+ //鎶樻墸
+ var NormalDisN = 0;
+ var NormalDisG = 0;
+ var distinguish = 0;
+ var distinguish2 = 0;
+ arrProductTemp.forEach(itemss => {
+ if(itemss.recordTypeName__c=="Authorizer"){
+ if (itemss.PromotionId==Id&&
+ itemss.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ itemss.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input) {
+ if(itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ sumListAndNod +=itemss.Quantity *(itemss.ListPrice+itemss.ServicePrice__c);
+ ObjectProducList.push(itemss);
+ }else if(itemss.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ sumListCount += itemss.Quantity * itemss.ListPrice;
+ sumNodCount += itemss.Quantity * itemss.ServicePrice__c;
+ NotObjectProducList.push(itemss);
+ }
+ }
+ }else{
+ if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ itemss.Category__c == Category__c) {
+ sumListCount += itemss.Quantity * itemss.ListPrice;
+ sumNodCount += itemss.Quantity * itemss.ServicePrice__c;
+ }
+ }
+ });
+ if (sumListCount != 0||sumListAndNod!=0) {
+ if(item.JxsType=='涓�鑸姌鎵�'||NotObjectProducList.length!=0){
+ NormalDisN = ((NormalDiscount_H_Money__c - sumNodCount) / sumListCount * 100).toFixed(2);
+ if(item.JxsType!='涓�鑸姌鎵�'){
+ if(item.NormalDiscount__c!=undefined&&item.NormalDiscount__c!=''){
+ var NormalDiscount__cc=parseFloat(item.NormalDiscount__c);
+ if(NormalDisN<NormalDiscount__cc){
+ distinguish=1;
+ }
+ }
+ }else if(NormalDisN<0){
+ distinguish=3;
+ }
+ }
+ debugger
+ if(ObjectProducList.length!=0){
+ NormalDisG =(GuaranteeDiscount_H_Money__c/sumListAndNod*100).toFixed(2);
+ if(item.GuaranteeDiscount__c!=undefined&&item.GuaranteeDiscount__c!=''){
+ var GuaranteeDiscount__cc=parseFloat(item.GuaranteeDiscount__c);
+ if(NormalDisG<GuaranteeDiscount__cc){
+ distinguish2 = 2;
+ }
+ }
+ }
+ arrTemp1.forEach(arrte => {
+ if (item.JxsType=="涓�鑸姌鎵�") {
+ if(arrte.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrte.Category__c == Category__c){
+ if(distinguish==1||distinguish==3){
+ arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan;
+ item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan;
+ }else{
+ arrte.NormalDiscount__c_Input = NormalDisN+'%';
+ item.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ }
+ }else if(item.JxsType=="鐗圭害鎶樻墸"){
+ if(arrte.Id==Id&&
+ arrte.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrte.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){
+
+ if(distinguish2==2||distinguish==1||distinguish==3){
+ arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan;
+ item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan;
+ arrte.GuaranteeDiscount_H_Money__c = arrte.GuaranteeDiscount_H_Money_yuan;
+ item.GuaranteeDiscount_H_Money__c = item.GuaranteeDiscount_H_Money_yuan;
+ }else{
+ if(NormalDisN!=0){
+ arrte.NormalDiscount__c_Input = NormalDisN+'%';
+ item.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ if(NormalDisG!=0){
+ arrte.GuaranteeDiscount__c_Input = NormalDisG+'%';
+ item.GuaranteeDiscount__c_Input = NormalDisG+'%';
+ }
+ }
+ }
+ }
+ });
+ if(distinguish!=1&&distinguish2!=2&&distinguish!=3){
+ arrProductTemp.forEach(arrpt => {
+ if(arrpt.recordTypeName__c=="Authorizer"){
+ if(arrpt.PromotionId==Id&&
+ arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrpt.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){
+ if(NormalDisN!=0){
+ arrpt.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ if(NormalDisG!=0){
+ arrpt.GuaranteeDiscount__c_Input = NormalDisG+'%';
+ }
+ }
+ }else{
+ if (arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ arrpt.Category__c == Category__c) {
+ arrpt.NormalDiscount__c_Input = NormalDisN+'%';
+ }
+ }
+ });
+ }
+ arrTempsss =arrTemp1;
+ arrProductTempsss = arrProductTemp;
+ }
+ debugger
+ if(distinguish==1&&distinguish2!=2){
+ return 1;
+ }else if(distinguish!=1&&distinguish2==2){
+ return 2;
+ }else if(distinguish==1&&distinguish2==2){
+ return 12;
+ }else if(distinguish==3){
+ return 3;
+ }else{
+ return item;
+ }
+}
+//鍙嶇畻鎶樻墸鎻愮ず淇℃伅
+export function InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao){
+ if(ffgg==1){
+ return "淇敼閿欒锛岄潪瀵硅薄鍝佹姌鎵d笉寰楀皬浜庨潪瀵硅薄鍝佹渶浣庢姌鎵�:"+NormalDiscount__cZuiXiao+"%";
+ }else if(ffgg==2){
+ return "淇敼閿欒锛屽璞″搧鎶樻墸涓嶅緱灏忎簬瀵硅薄鍝佹渶浣庢姌鎵�:"+GuaranteeDiscount__cZuiXiao+"%";
+ }else if(ffgg==12){
+ return "淇敼閿欒锛屽璞″搧鎶樻墸涓嶅緱灏忎簬瀵硅薄鍝佹渶浣庢姌鎵o細"+GuaranteeDiscount__cZuiXiao+"%"+"锛屼笖闈炲璞″搧鎶樻墸涓嶅緱灏忎簬闈炲璞″搧鏈�浣庢姌鎵o細"+NormalDiscount__cZuiXiao+"%";
+ }else if(ffgg==3){
+ return "淇敼閿欒锛岄潪瀵硅薄鍝佹姌鎵d笉寰楀皬浜�0";
+ }else{
+ return "鏁版嵁淇敼鎴愬姛";
+ }
+}
+//鍚堝悓浠锋牸姹囨�婚�昏緫
+export function ContractPriceComputeLogic(sum,jzDataProductList,jzDataDiscountList,jzDataFixedPriceList){
+ var DataDiscount = []; //鎶樻墸鏀跨瓥浜у搧鏄庣粏
+ jzDataProductList.forEach(jdpd => {
+ jzDataDiscountList.forEach(jddp => {
+ var PromotionHeadRecordId = jddp.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (jdpd.PromotionId == jddp.Id && //鏂规Id
+ jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ DataDiscount.push(jdpd);
+ }
+ } else {
+ if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.Category__c == jdpd.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ DataDiscount.push(jdpd);
+ }
+ }
+ });
+ });
+ DataDiscount.forEach(jjc => {
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum = sum + jjc.AgencySubtotal__c;
+ });
+ jzDataFixedPriceList.forEach(jzdfp => {
+ var HeTongTotals = parseFloat(jzdfp.HeTongTotal)
+ if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") {
+ HeTongTotals = 0;
+ }
+ sum = sum + HeTongTotals;
+ });
+ sum = Math.round(sum * 100) / 100;
+ return sum;
+}
+ //璁$畻杩囧悗鐗圭害鎶樻墸鐨勫悎鍚屼环鏍�
+ export function SpecialPriceComputeReverse(DataDiscount,fag){
+ var sum=0;
+ var sum1=0
+ DataDiscount.forEach(jjc => {
+ if(jjc.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum = sum + jjc.AgencySubtotal__c;
+ sum=parseFloat(sum.toFixed(2));
+ }
+ if(jjc.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum1 = sum1 + jjc.AgencySubtotal__c;
+ sum1=parseFloat(sum1.toFixed(2));
+ }
+ });
+ if(fag){
+ return sum;
+ }else{
+ return sum1;
+ }
+}
+//鏇存敼涓�鑸姌鎵e悎鍚屼环鏍艰绠楀悎鍚屾�讳环閫昏緫
+export function GeneralDiscountContractSummaryLogic(sum,jzDataDiscountList,jzDataFixedPriceList){
+ jzDataDiscountList.forEach(jddp => {
+ var HeTongPrice = parseFloat(jddp.HeTongPrice)
+ if (jddp.HeTongPrice == undefined || jddp.HeTongPrice == "") {
+ HeTongPrice = 0;
+ }
+ sum =sum + HeTongPrice;
+ });
+ jzDataFixedPriceList.forEach(jzdfp =>{
+ var HeTongTotals = parseFloat(jzdfp.HeTongTotal)
+ if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") {
+ HeTongTotals = 0;
+ }
+ sum =sum + HeTongTotals;
+ });
+ sum = Math.round(sum * 100) / 100;
+ return sum;
+}
+//鎶樻墸鏀跨瓥鍖归厤瑙勫垯閮ㄥ垎閫昏緫
+//SelectedData 閫変腑鐨勬暟鎹� IdStr 閫変腑鐨勬暟鎹甀d CompareId 鏂规涓敤鍒扮殑uuid
+export function SpecialSavesChangePartLogic(jzDataDefaultList,SaveName, SelectedData, IdStr, CompareId,DefalutQuantity,newDicountData,jzDataDiscountList){
+ var NewDefaultData = [];
+ var AddProductData = [];
+ jzDataDefaultList.forEach(defaultItem => { //寰呴�変骇鍝�
+ var defaultItemTemp = {
+ ...{},
+ ...defaultItem
+ };
+ var SelectedList = SelectedData.itemss.filter(items => {
+ if (items.Id == defaultItem.Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (SelectedList != undefined && SelectedList.length > 0) {
+ var SelectedListDataTemp = {
+ ...{},
+ ...SelectedList[0]
+ };
+ SelectedListDataTemp.PromotionNo__c = SelectedData.PromotionNo__c;
+ SelectedListDataTemp.Name = SelectedData.Name;
+ SelectedListDataTemp.TypeName = "鎶樻墸鏀跨瓥";
+ SelectedListDataTemp.PromotionId = IdStr;
+ if (SaveName == "涓�鑸姌鎵�") {
+ SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c_Input;
+ } else {
+ SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c;
+ }
+ SelectedListDataTemp.GuaranteeDiscount__c_Input = SelectedData.GuaranteeDiscount__c;
+ SelectedListDataTemp.Category__c = SelectedData.Category__c;
+ SelectedListDataTemp.CompareId = CompareId;
+ SelectedListDataTemp.Quantity = SelectedListDataTemp.SplitQuantity;
+ if (defaultItemTemp.Quantity != SelectedListDataTemp.Quantity) {
+ defaultItemTemp.Quantity = defaultItemTemp.Quantity - SelectedListDataTemp.Quantity;
+ DefalutQuantity += defaultItemTemp.Quantity;
+ NewDefaultData.push(defaultItemTemp);
+ AddProductData.push(SelectedListDataTemp);
+ } else {
+ DefalutQuantity += SelectedListDataTemp.Quantity;
+ AddProductData.push(SelectedListDataTemp);
+ return
+ }
+ } else {
+ NewDefaultData.push(defaultItemTemp);
+ }
+ })
+ NewDefaultDatass=NewDefaultData;
+ AddProductDatass=AddProductData;
+ //娣诲姞鏁伴噺
+ jzDataDiscountList.forEach(disItem => { //鎶樻墸鏀跨瓥
+ var newTemp = {
+ ...{},
+ ...disItem
+ };
+ if (newTemp.Id == IdStr) {
+ newTemp.Counts = DefalutQuantity;
+ }
+ newDicountData.push(newTemp);
+ })
+ return newDicountData;
+}
+//鎶樻墸鏀跨瓥鍚堝悓浠锋牸姹囨�婚�昏緫
+export function HeTongPriceComputeLogic(jzdateList,jzDataProductList){
+ var HeTongPriceList = [];
+ jzdateList.forEach(jddp => {
+ var sum = 0;
+ var sumNor = 0;
+ var sumGua = 0;
+ var PromotionHeadRecordId = jddp.recordTypeName__c;
+ jzDataProductList.forEach(jdpd => {
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (jddp.Id == jdpd.PromotionId && //鏂规Id
+ jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ if(jdpd.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ sumGua = sumGua +jdpd.AgencySubtotal__c;
+ }else if(jdpd.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ sumNor = sumNor +jdpd.AgencySubtotal__c;
+ }
+ sum = sum + jdpd.AgencySubtotal__c;
+ }
+ } else {
+ if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ jddp.Category__c == jdpd.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ sum = sum + jdpd.AgencySubtotal__c;
+ }
+ }
+ });
+ sum = Math.round(sum * 100) / 100;
+ sumGua = Math.round(sumGua * 100) / 100;
+ sumNor = Math.round(sumNor * 100) / 100;
+ jddp.HeTongPrice = sum;
+ if(PromotionHeadRecordId == "Authorizer"){
+ jddp.GuaranteeDiscount_H_Money__c = sumGua;
+ jddp.NormalDiscount_H_Money__c = sumNor;
+ }else{
+ jddp.NormalDiscount_H_Money__c = sum;
+ }
+ HeTongPriceList.push(jddp);
+ });
+ return HeTongPriceList;
+}
+//浠锋牸绛栧悎骞舵槑缁嗛�昏緫
+export function PriceConsolidation(arrSchemes,jzdataList){
+ arrSchemes.forEach(arrsch=>{
+ var Setmap=new Map();
+ var arrList=[];
+ jzdataList.forEach(jdpd=>{
+ if(arrsch.Id==jdpd.PromotionId){
+ var object={};
+ if(Setmap.has(jdpd.Id)){
+ object={...{},...Setmap.get(jdpd.Id)};
+ object.Quantity=object.Quantity+jdpd.Quantity;
+ Setmap.set(jdpd.Id,object);
+ }else{
+ Setmap.set(jdpd.Id,jdpd);
+ }
+ }else{
+ arrList.push(jdpd);
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arrList.push(v);
+ }
+ // jzdataList=[...[],...arrList];//20230214
+ jzdataList = [].concat(arrList);//20230214
+ });
+ return jzdataList;
+}
+ //鍚堝苟鎶樻墸鏀跨瓥閲嶅鏂规閫昏緫
+export function ConsolidatedDiscountPolicyLogic(SchemeSet,arr){
+ var Setmap=new Map();
+ var arr2=SchemeSet;
+ arr2.forEach(arrs=>{
+ var object={};
+ var PromotionHeadRecordId = arrs.recordTypeName__c;
+ if(PromotionHeadRecordId == "Authorizer"){
+ var key=arrs.Id+"_"+arrs.NormalDiscount__c_Input+"_"+arrs.GuaranteeDiscount__c_Input;//鏂规Id/闈炲璞″搧鎶樻墸褰曞叆/瀵硅薄鍝佹姌鎵e綍鍏�
+ if(Setmap.has(key)){
+ object={...{},...Setmap.get(key)};
+ object.determine='';
+ arrs.HeTongPrice=Number(arrs.HeTongPrice);
+ object.HeTongPrice=Number(object.HeTongPrice);
+ object.HeTongPrice +=arrs.HeTongPrice;
+ arrs.GuaranteeDiscount_H_Money__c=Number(arrs.GuaranteeDiscount_H_Money__c);
+ object.GuaranteeDiscount_H_Money__c=Number(object.GuaranteeDiscount_H_Money__c);
+ object.GuaranteeDiscount_H_Money__c +=arrs.GuaranteeDiscount_H_Money__c;
+ arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c;
+ Setmap.set(key,object);
+ }else{
+ Setmap.set(key,arrs);
+ }
+ }else{
+ var key=arrs.NormalDiscount__c_Input+"_"+arrs.Category__c;//闈炲璞″搧鎶樻墸褰曞叆銆佹姌鎵f斂绛栧垎绫�
+ if(Setmap.has(key)){
+ object={...{},...Setmap.get(key)};
+ object.determine='';
+ arrs.HeTongPrice=Number(arrs.NormalDiscount_H_Money__c);
+ object.HeTongPrice=Number(object.HeTongPrice);
+ object.HeTongPrice +=arrs.HeTongPrice;
+ arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c);
+ object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c;
+
+ Setmap.set(key,object);
+ }else{
+ Setmap.set(key,arrs);
+ }
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arr.push(v);
+ }
+ return arr;
+}
+//鍚堝苟鎶樻墸鏀跨瓥浜у搧鏄庣粏閫昏緫
+export function ConsolidatedDiscountDetailsLogic(arrSchemes,jzdataList){
+ arrSchemes.forEach(arrsch=>{
+ var Setmap=new Map();
+ var arrList=[];
+ jzdataList.forEach(jdpd=>{
+ var PromotionHeadRecordId = arrsch.recordTypeName__c;
+ if(PromotionHeadRecordId == "Authorizer"){
+ if(arrsch.Id==jdpd.PromotionId&&//鏂规Id
+ arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//闈炲璞″搧鎶樻墸褰曞叆
+ arrsch.GuaranteeDiscount__c_Input==jdpd.GuaranteeDiscount__c_Input){//瀵硅薄鍝佹姌鎵e綍鍏�
+ var object={};
+ if(Setmap.has(jdpd.Id)){
+ object={...{},...Setmap.get(jdpd.Id)};
+ object.Quantity=object.Quantity+jdpd.Quantity;
+ Setmap.set(jdpd.Id,object);
+ }else{
+ Setmap.set(jdpd.Id,jdpd);
+ }
+ }else{
+ arrList.push(jdpd);
+ }
+ }else{
+ if(arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//闈炲璞″搧鎶樻墸褰曞叆
+ arrsch.Category__c==jdpd.Category__c){//鎶樻墸鏀跨瓥鍒嗙被
+ var object={};
+ if(Setmap.has(jdpd.Id)){
+ object={...{},...Setmap.get(jdpd.Id)};
+ object.Quantity=object.Quantity+jdpd.Quantity;
+ Setmap.set(jdpd.Id,object);
+ }else{
+ Setmap.set(jdpd.Id,jdpd);
+ }
+ }else{
+ arrList.push(jdpd);
+ }
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arrList.push(v);
+ }
+ // jzdataList=[...[],...arrList];//20230214
+ jzdataList = [].concat(arrList);//20230214
+ });
+ return jzdataList;
+}
+//鍚堝苟涓婁竴娆$殑鎶ヤ环琛岀殑閫昏緫
+export function addOfferLogic(TrialLine){
+ var Offermap=new Map();
+ var arr=[];
+ var arr2=TrialLine;
+ arr2.forEach(arrs=>{
+ var object={};
+ if(Offermap.has(arrs.Id)){
+ object={...{},...Offermap.get(arrs.Id)};
+ object.Quantity=object.Quantity+arrs.Quantity;
+ Offermap.set(arrs.Id,object);
+ }else{
+ Offermap.set(arrs.Id,arrs);
+ }
+ });
+ for (let [k, v] of Offermap) {
+ arr.push(v);
+ }
+ return arr;
+}
+// ==============鐢熸垚UUID
+export function GetUUID() {
+ var s = [];
+ var hexDigits = "0123456789abcdef";
+ for (var i = 0; i < 36; i++) {
+ s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
+ }
+ s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
+ s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
+ s[8] = s[13] = s[18] = s[23] = "-";
+ var uuid = s.join("");
+ return uuid;
+}
+//涓�鑸骇鍝侀儴鍒嗛�昏緫
+export function partGeneralDiscountLogical(itemsss,item){
+ itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity;
+ itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100;
+ itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100;
+ itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity;
+ itemsss.UseCount__c = item.Counts;
+ itemsss.ifNecessary__c = item.ifNecessary__c;
+ itemsss.recordTypeName__c = item.recordTypeName__c;
+ return itemsss;
+}
+//淇冮攢鏂规閮ㄥ垎閫昏緫
+export function partPromotionSchemeLogical(itemsss,item,multiYearWarranty__c){
+ debugger
+ if(multiYearWarranty__c){
+ itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice);
+ }else{
+ itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c;
+ }
+ itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity;
+ itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100;
+ itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100;
+ itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity;
+ itemsss.UseCount__c = item.Counts;
+ itemsss.if_Fix__c = item.if_Fix__c;
+ itemsss.if_Contain_Nod__c = item.if_Contain_Nod__c;
+ itemsss.recordTypeName__c = item.recordTypeName__c;
+ return itemsss;
+}
+//涓�鑸姌鎵h绠楅�昏緫
+export function commonlyDiscountLogic(itemss,item){
+ var Discount__c_Input = parseFloat(item.NormalDiscount__c_Input)*0.01;
+ debugger
+ itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input) + itemss.ServicePrice__c;
+ itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity;
+ itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100;
+ itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100;
+ itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity;
+ itemss.Discount__c_Input = item.NormalDiscount__c_Input;
+ itemss.Category__c=item.Category__c;
+ return itemss
+}
+//鐗圭害鎶樻墸璁$畻閫昏緫
+export function contributingDiscountLogic(itemss,Discount__c_Input,item){
+ if (itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨") {
+ itemss.AgencyUnitPrice__c = (itemss.ListPrice + itemss.ServicePrice__c) * (Discount__c_Input*0.01);
+ } else {
+ itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input*0.01) + itemss.ServicePrice__c;
+ }
+ itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity;
+ itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100;
+ itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100;
+ itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity;
+ debugger
+ itemss.Discount__c_Input = Discount__c_Input+"%";
+ // itemss.Discount__c_Input = Discount__c_Input;
+ itemss.GuaranteeDiscount__c_Input=item.GuaranteeDiscount__c_Input;
+ itemss.NormalDiscount__c_Input=item.NormalDiscount__c_Input;
+ itemss.recordTypeName__c = item.recordTypeName__c;
+ return itemss
+}
+//璁$畻浠锋牸鏀跨瓥鐨勬渶澶ф鏁伴�昏緫
+export function ComputationalLogic(Pricepolicy,b,selectproducts){
+ var num=0;
+ var flag=true;
+ for(var j=0;j<b.length;j++){
+ if(b[j].Id_H==Pricepolicy.PromotionNo__c){
+ var fg=true;
+ for(var i=0;i<selectproducts.length;i++){
+ if(b[j].Asset_Model_No__c==selectproducts[i].Product2.MDM_Model_No__c){
+ var frequency = parseInt(selectproducts[i].Quantity/b[j].Quantity__c__c);
+ if(frequency<1){
+ fg=true;
+ break;
+ }else{
+ if(flag){
+ num=frequency;
+ flag=false;
+ }else{
+ if(num>frequency){
+ num=frequency;
+ }
+ }
+ }
+ fg=false;
+ }
+ }
+ if(fg){
+ num=0;
+ break;
+ }
+ }
+ }
+ var Counts = Number(Pricepolicy.Counts);
+ return Counts+num;
+}
+//鏇挎崲listprice鍗曚环閫昏緫
+export function ReplacementUnitPriceLogic(arr,ifTrade){
+ arr.forEach(jdpct => { //浜у搧鏄庣粏
+ if (ifTrade == "鍐呰部") {
+ jdpct.ListPrice = jdpct.Product2.Intra_Trade_List_RMB__c;
+ if (jdpct.multiYearWarranty__c) {
+ jdpct.ServicePrice__c = jdpct.Product2.Intra_Trade_Service_RMB__c;
+ } else {
+ jdpct.ServicePrice__c = 0;
+ }
+ } else if (ifTrade == "澶栬部") {
+ jdpct.ListPrice = jdpct.Product2.Foreign_Trade_List_US__c;
+ if (jdpct.multiYearWarranty__c) {
+ jdpct.ServicePrice__c = jdpct.Product2.NoDiscount_Foreign__c;
+ } else {
+ jdpct.ServicePrice__c = 0;
+ }
+ }
+ });
+ return arr
+}
+//鍚堝苟鏂规
+export function ConsolidationScheme(data,ParamIdStr,Trade__c){
+ var NewData = [];
+ data.forEach(itms => { //浠锋牸鏀跨瓥鍜屾姌鍜屾姌鎵f斂绛�
+ let Temp = {};
+ Temp.itemCounts = itms.Counts + "";
+ Temp.Id = itms.Id;
+ Temp.JxsType = itms.JxsType;
+ //淇冮攢鏂规
+ if (itms.JxsType != "涓�鑸姌鎵�") {
+ var PromotionHeadRecordId = itms.recordTypeName__c;
+ //tt
+ if (itms.JxsType == "鐗圭害鎶樻墸") {
+ Temp.GuaranteeDiscountcInput = parseFloat(itms.GuaranteeDiscount__c_Input);
+ Temp.GuaranteeDiscountc = parseFloat(itms.GuaranteeDiscount__c);
+ Temp.NormalDiscountc = parseFloat(itms.NormalDiscount__c);
+ Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input);
+ }
+ }else{
+ //tt
+ Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input);
+ }
+ if (PromotionHeadRecordId == 'Promotion') {
+ Temp.Categoryc = '淇冮攢鏂规';
+ }
+ //涓�鑸骇鍝�
+ else if (PromotionHeadRecordId == 'NormalProduct') {
+ Temp.Categoryc = '涓�鑸骇鍝�';
+ }
+ //鐗圭害鍥哄畾
+ else if (PromotionHeadRecordId == 'Authorizer') {
+ Temp.Categoryc = '缁忛攢鍟嗗浐瀹氭姌鎵�';
+ } else {
+ Temp.Categoryc = itms.Category__c;
+ }
+ Temp.PromotionNocEqual = itms.PromotionNo__cEqual;
+ Temp.typess = itms.typess;
+ Temp.PromotionNoc = itms.PromotionNo__c;
+ Temp.Name = itms.Name;
+ Temp.ParamIdStr = ParamIdStr;
+ Temp.Descriptionc = itms.Description__c;
+ Temp.ifContainNodc = itms.if_Contain_Nod__c;
+ Temp.ifFixc = itms.if_Fix__c;
+ Temp.PriceCNYc = itms.Price_CNY__c;
+ Temp.Total = itms.Total;
+
+ Temp.ListPriceTotalc = itms.sumListPrice;
+ Temp.sumNod = itms.sumNoDiscount;
+ // Temp.sumNodUSD=itms.sumNodUSD;
+ Temp.HeTongTotal = itms.HeTongTotal;
+ Temp.ifNecessaryc = itms.ifNecessary__c;
+ Temp.Trade = Trade__c;
+ Temp.maxCounts = itms.maxCounts;
+ Temp.CompareId = itms.CompareId;
+ Temp.sumNoDiscountTotal = itms.sumNoDiscountTotal;
+ Temp.GuaranteeDiscountHMoneyc = itms.GuaranteeDiscount_H_Money__c;
+ Temp.NormalDiscountHMoneyc = itms.NormalDiscount_H_Money__c;
+ //...c/compent
+ NewData.push(Temp);
+ });
+ return NewData;
+}
+//寰呴�変骇鍝佹暟鎹彉鍖栧瓧娈佃祴鍊�
+export function ProductAssignmentSelect(item){
+ item.Quantity = item.Quantity__c;
+ item.Name = item.Name__c;
+ item.Name__c = item.Name_c__c;
+ item.ListPrice = item.ListPrice__c;
+ item.Id = item.QuoteTrialKey__c;
+ item.PromotionId = item.Promotion_id__c;
+ item.TypeName = item.TypeName__c;
+ item.RecordTypeId = item.RecordTypeId__c;
+ item.ParamIdStr = item.QuantityId__c;
+ item.Product2Id = item.Product2__c;
+ item.QuiteLineitem__c = item.QuiteLineitem__c;
+ return item;
+}
+//宸查�変骇鍝佹暟鎹彉鍖栧瓧娈佃祴鍊�
+export function ProductSelected(item){
+ item.Quantity = item.Quantity__c;
+ item.Name = item.Name__c;
+ item.Name__c = item.Name_c__c;
+ item.ListPrice = item.ListPrice__c;
+ item.Id = item.QuoteTrialKey__c;
+ item.Product2Id = item.Product2__c;
+ item.Product2 = item.Product2__r;
+ if (item.Name == "涓�鑸姌鎵�") {
+ item.PromotionId = item.PromotionSales__c;
+ // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c;
+ // item.Discount__c_Input = item.DiscountRate__c;
+ item.Discount__c_Input = item.DiscountRate__c+'%';
+ // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c
+ item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%';
+ } else {
+ item.PromotionId = item.Promotion_id__c;
+ if(item.TypeName__c != "浠锋牸鏀跨瓥"){
+ // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c;
+ item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c+'%';
+ // item.Discount__c_Input = item.DiscountRate__c;
+ item.Discount__c_Input = item.DiscountRate__c+'%';
+ // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c;
+ item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%';
+ // item.GuaranteeDiscount__c_Input=Number(item.GuaranteeDiscount__c_Input.toFixed(2));
+ }
+ }
+ item.warrantyType__c=item.GuranteeType__c;
+ item.TypeName = item.TypeName__c;
+ item.RecordTypeId = item.RecordTypeId__c;
+ item.ParamIdStr = item.QuantityId__c;
+ item.QuiteLineitem__c = item.QuiteLineitem__c;
+ item.CompareId = item.CompareId__c;
+ // item.Discount__c_Input=Number(item.Discount__c_Input.toFixed(2));
+ // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c;
+ // item.NormalDiscount__c_Input=Number(item.NormalDiscount__c_Input.toFixed(2));
+ return item;
+}
+//鎶樻墸鏂规鏁版嵁鍙樺寲瀛楁璧嬪��
+export function UnselectedScheme(items){
+ items.JxsType = items.JxsType__c;
+ // items.NormalDiscount__c_Input = items.NormalDiscount_c_Input__c;
+ items.NormalDiscount__c_Input=items.NormalDiscount_c_Input__c+'%';
+ // items.NormalDiscount__c_Input=Number(items.NormalDiscount__c_Input.toFixed(2));
+ items.TypeName = items.TypeName__c;
+ if (items.JxsType__c != "涓�鑸姌鎵�") {
+ items.Id = items.PromotionHead__c;
+ // items.NormalDiscount__c = items.NormalDiscountc__c;
+ items.NormalDiscount__c=items.NormalDiscountc__c+'%';
+ // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c;
+ items.GuaranteeDiscount__c=items.GuaranteeDiscount__c+'%';
+ // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c;
+ items.GuaranteeDiscount__c_Input=items.GuaranteeDiscount_c_Input__c+'%';
+ // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2));
+
+ }
+ // else{
+ // items.NormalDiscount__c = items.NormalDiscountc__c;
+ // items.NormalDiscount__c=items.NormalDiscountc__c+'%';
+ // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c;
+ // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2));
+ // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c;
+ // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2));
+ // }
+ items.ParamIdStr = items.Quote__c;
+ items.sumNoDiscountTotal = items.sumNoDiscountTotal__c;
+ items.maxCounts = items.maxCounts__c;
+ items.CompareId = items.CompareId__c;
+ return items;
+}
+//寰幆鍒ゆ柇绌�
+export function IfCopyProperties(x){
+ debugger
+ if(x.Asset_Model_No__c==undefined){
+ x.Asset_Model_No__c='';
+ }
+ if(x.Name_c__c==undefined){
+ x.Name_c__c='';
+ }
+ if(x.Quantity__c==undefined){
+ x.Quantity__c='';
+ }
+ if(x.GuranteeType__c==undefined){
+ x.GuranteeType__c='';
+ }
+ if(x.PromotionNo__c==undefined){
+ x.PromotionNo__c='';
+ }
+ if(x.Name__c==undefined){
+ x.Name__c='';
+ }
+ if(x.ListPrice__c==undefined){
+ x.ListPrice__c='';
+ }
+ if(x.NoDiscountTotal__c==undefined){
+ x.NoDiscountTotal__c='';
+ }
+ if(x.DiscountRate__c==undefined){
+ x.DiscountRate__c='';
+ }
+ if(x.AgencyUnitPrice__c==undefined){
+ x.AgencyUnitPrice__c='';
+ }
+ if(x.AgencySubtotal__c==undefined){
+ x.AgencySubtotal__c='';
+ }
+ return x;
+}
+//浠锋牸鏂规鏁版嵁鍙樺寲瀛楁璧嬪��
+export function SelectedScheme(items){
+ items.Counts = items.itemCounts__c;
+ items.Total = items.Price_total__c;
+ items.HeTongTotal = items.contractPrice__c;
+ items.TypeName = items.TypeName__c;
+ items.Id = items.PromotionHead__c;
+ items.ParamIdStr = items.Quote__c;
+ if (items.trade__c == "鍐呰部") {
+ items.sumListPrice = items.ListPriceTotal__c;
+ items.sumNoDiscount = items.NodiscountTotal__c;
+ } else if (items.trade__c == "澶栬部") {
+ items.sumListPrice = items.ListPriceTotalUSD__c;
+ items.sumNoDiscount = items.NodiscountTotalUSD__c;
+ }
+ items.sumNoDiscountTotal = items.sumNoDiscountTotal__c;
+ items.maxCounts = items.maxCounts__c;
+ return items;
+}
+
+//鍚堝苟浜у搧
+export function MergeProducts(arr3,arr4,data,ParamIdStr){
+ var NewData1 = [];
+ var newTemp3 = [];
+ arr3.forEach(itmsss => { //浜у搧鏄庣粏
+ var itemTemp = {
+ ...{},
+ ...itmsss
+ };
+ // itemTemp.鍒嗙被鍚嶇О锛堟牴鎹� 浜у搧鐘舵�� 1锛� 0鏈尮閰� 2锛�1浠ュ尮閰嶏級
+ itemTemp.ismatch = '1';
+ newTemp3.push(itemTemp);
+ });
+ var newTemp4 = [];
+ arr4.forEach(itmsss => { //寰呴�変骇鍝�
+ var itemTemp = {
+ ...{},
+ ...itmsss
+ };
+ // itemTemp.鍒嗙被鍚嶇О锛堟牴鎹� 浜у搧鐘舵�� 1锛� 0鏈尮閰� 2锛�1浠ュ尮閰嶏級
+ itemTemp.ismatch = '0';
+ newTemp4.push(itemTemp);
+ });
+ // var data2 = [...newTemp3, ...newTemp4];//20230213
+ var data2 = newTemp3.concat(newTemp4);//20230213
+ data2.forEach(itmss => { //浜у搧鏄庣粏鍜屽緟閫変骇鍝�
+ let Temp1 = {};
+ Temp1.Id = itmss.Id;
+ Temp1.AssetModelNoc = itmss.Asset_Model_No__c;
+ Temp1.Namec = itmss.Name__c;
+ Temp1.Quantity = itmss.Quantity;
+ Temp1.GuranteeTypec = itmss.warrantyType__c;
+ Temp1.PromotionNoc = itmss.PromotionNo__c;
+ Temp1.Name = itmss.Name;
+ Temp1.ListPrice = itmss.ListPrice;
+ Temp1.AgencyUnitPricec = itmss.AgencyUnitPrice__c;
+ Temp1.AgencySubtotalc = itmss.AgencySubtotal__c;
+ Temp1.NoDiscountTotalc = itmss.NoDiscountTotal__c;
+ Temp1.ParamIdStr =ParamIdStr;
+ Temp1.TypeName = itmss.TypeName;
+ Temp1.UseCountc = itmss.UseCount__c;
+ if (itmss.TypeName == "浠锋牸鏀跨瓥") {
+ data.forEach(itemsss => {
+ if (itemsss.PromotionNo__c == itemsss.PromotionNo__c) {
+ Temp1.fanan_id = itemsss.Id;
+ }
+ });
+ } else if (itmss.TypeName == "鎶樻墸鏀跨瓥") {
+ data.forEach(itemss => {
+ if (itemss.PromotionNo__c == itemss.PromotionNo__c) {
+ Temp1.fanan_id = itemss.Id;
+ }
+ });
+
+ Temp1.DiscountcInput = parseFloat(itmss.Discount__c_Input);
+ if(itmss.Name=="涓�鑸姌鎵�"){
+ Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input);
+ }else{
+ Temp1.GuaranteeDiscountcInput = parseFloat(itmss.GuaranteeDiscount__c_Input);
+ Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input);
+ }
+ }
+ Temp1.ismatch = itmss.ismatch;
+ Temp1.PromotionId = itmss.PromotionId;
+ Temp1.Product2c = itmss.Product2Id;
+ Temp1.ServicePricec = itmss.ServicePrice__c;
+ Temp1.ifFixc = itmss.if_Fix__c;
+ Temp1.ifNecessaryc = itmss.ifNecessary__c;
+ Temp1.CompareId = itmss.CompareId;
+ Temp1.multiYearWarrantyc = itmss.multiYearWarranty__c;
+ Temp1.Categoryc = itmss.Category__c;
+
+ NewData1.push(Temp1);
+ });
+ return NewData1;
+}
+// //鏂规闇�瑕佹洿鏂扮殑瀛楁
+export function ChangeFiexedData(key) {
+ var keyArr = ['Status__c', 'ifNecessary__c', 'OrderNo__c', 'Price_CNY__c', 'Price_USD__c'];
+ var flag = false;
+ keyArr.forEach(item => {
+ if (item == key) {
+ flag = true;
+ }
+ })
+ return flag;
+}
+export function getQueryVariable(variable,location) { //id瀛楃涓�
+ var query = window.location.search.substring(1);
+ if(!query){
+ query = location;
+ }
+ var vars = query.split("&");
+ for (var i = 0; i < vars.length; i++) {
+ var pair = vars[i].split("=");
+ if (pair[0] == variable) {
+ return pair[1];
+ }
+ }
+ return '';
+}
+//璺宠浆璺緞
+export function PathJump(DeveloperName,ParamIdStr){
+ if(DeveloperName=='Opportunity'){
+ // 娴嬭瘯闈炲畬鏁磋矾寰勬槸涓嶆槸鍙互姝g‘璺宠浆
+ window.open('/apex/NewQuoteEntry?id=' + ParamIdStr, '_self');
+ }else if(DeveloperName=='SI_Oppor'){
+ // 娴嬭瘯闈炲畬鏁磋矾寰勬槸涓嶆槸鍙互姝g‘璺宠浆
+ window.open('/apex/SI_NewQuoteEntry?id=' + ParamIdStr, '_self');
+ }
+}
+//璁$畻杩囧悗涓�鑸姌鎵g殑鍚堝悓浠锋牸
+export function ContractPriceComputeReverse(DataDiscount){
+ var sum=0;
+ DataDiscount.forEach(jjc => {
+ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c)
+ sum = sum + jjc.AgencySubtotal__c;
+ });
+ sum=sum.toFixed(2);
+ return sum;
+}
+//澶嶅埗閫昏緫
+export function copyLogic(Check_Your_Clipboard,records,x,targetString,reslut){
+ records=reslut;
+ for (var i = 0; i < records.length; i++) {
+ x = records[i];
+ //鍒ゆ柇绌�
+ x=IfCopyProperties(x);
+ targetString += '\r\n' + x. Asset_Model_No__c + '\t' + x.Name_c__c + '\t' + x.Quantity__c + '\t' + x.GuranteeType__c + '\t' + x.PromotionNo__c +'\t' + x.Name__c + '\t' + x.ListPrice__c + '\t' + x.NoDiscountTotal__c + '\t' + x.DiscountRate__c +
+ '\t' + x.AgencyUnitPrice__c + '\t' + x.AgencySubtotal__c ;
+ console.warn(x.PromotionNo__c);
+ }
+ try {
+ console.warn(targetString);
+ var tag = document.createElement('textarea');
+ tag.setAttribute('id', 'cp_hgz_textarea');
+ var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length;
+ tag.maxLength=strlenght+666;
+ tag.value = targetString;
+ document.getElementsByTagName('body')[0].appendChild(tag);
+ document.getElementById('cp_hgz_textarea').select();
+ document.execCommand('copy');
+ document.getElementById('cp_hgz_textarea').remove();
+ alert(Check_Your_Clipboard);
+ } catch (error) {
+ alert(error);
+ }
+}
+//涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻閫昏緫
+export function updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,arrProductTemp){
+ var newArrsTempplus1=[];
+ var newArrsTempplus2=[];
+ var jzDataProductlast=[];
+ jzDataDiscount.forEach(item=>{
+ if(JxsType=="鐗圭害鎶樻墸"){
+ if(item.JxsType=="鐗圭害鎶樻墸"){
+ if (Id == item.Id) {
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ arrProductTemp.forEach(itemss => { //itemss浜у搧鏄庣粏
+ var Discount__c_Input = 0;
+ if (itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨") {
+ Discount__c_Input = item.GuaranteeDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ } else {
+ Discount__c_Input = item.NormalDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ }
+ debugger
+ if (itemss.PromotionId == item.Id && //鏂规Id
+ itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //瀵硅薄鍝佹姌鎵e綍鍏�
+ itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //闈炲璞″搧鎶樻墸褰曞叆
+ itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //鐗圭害鎶樻墸璁$畻閫昏緫
+ newArrsTempplus1.push(itemss);
+ } else if (itemss.PromotionId != item.Id ||
+ itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input ||
+ itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) {
+ newArrsTempplus2.push(itemss);
+ }
+ });
+ var newArrsplusG=[];
+ var newArrsplusN=[];
+ newArrsTempplus1.forEach(ntp=>{
+ if(ntp.warrantyType__c=="甯傚満澶氬勾淇濅慨"){
+ newArrsplusG.push(ntp);
+ }else if(ntp.warrantyType__c!="甯傚満澶氬勾淇濅慨"){
+ newArrsplusN.push(ntp);
+ }
+ });
+ if(newArrsplusG.length!=0){
+ var yibanSumG = SpecialPriceComputeReverse(newArrsTempplus1,true);
+ var chazhiG=(Number(item.GuaranteeDiscount_H_Money__c)*100-Number(yibanSumG)*100)/100;
+ var dangechazhiG=Math.round((chazhiG/newArrsplusG[0].Quantity) * 100) / 100;
+ newArrsplusG[0].AgencySubtotal__c =newArrsplusG[0].AgencySubtotal__c+chazhiG;
+ newArrsplusG[0].AgencyUnitPrice__c =newArrsplusG[0].AgencyUnitPrice__c+dangechazhiG;
+ }
+ if(newArrsplusN.length!=0){
+ var yibanSumN = SpecialPriceComputeReverse(newArrsTempplus1,false);
+ var chazhiN=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSumN)*100)/100;
+ var dangechazhiN=Math.round((chazhiN/newArrsplusN[0].Quantity) * 100) / 100;
+ newArrsplusN[0].AgencySubtotal__c =newArrsplusN[0].AgencySubtotal__c+chazhiN;
+ newArrsplusN[0].AgencyUnitPrice__c =newArrsplusN[0].AgencyUnitPrice__c+dangechazhiN;
+ }
+ // newArrsTempplus1=[...newArrsplusG,...newArrsplusN];//20230213
+ newArrsTempplus1=newArrsplusG.concat(newArrsplusN);//20230213
+ // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213
+ jzDataProductlast = newArrsTempplus1.concat(newArrsTempplus2);//20230213
+ }
+ }
+ }
+ }else if(JxsType=="涓�鑸姌鎵�"){
+ if(item.JxsType=="涓�鑸姌鎵�"){
+ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input &&
+ Category__c == item.Category__c){
+ arrProductTemp.forEach(itemss => { //itemss浜у搧鏄庣粏
+ if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input &&
+ itemss.Category__c == Category__c) {
+ itemss = commonlyDiscountLogic(itemss, item); //涓�鑸姌鎵h绠楅�昏緫
+ newArrsTempplus1.push(itemss);
+ } else if (itemss.Category__c != Category__c ||
+ itemss.NormalDiscount__c_Input != NormalDiscount__c_Input) {
+ newArrsTempplus2.push(itemss);
+ }
+ });
+ var yibanSum = ContractPriceComputeReverse(newArrsTempplus1);//璁$畻杩囧悗涓�鑸姌鎵g殑鍚堝悓浠锋牸
+ var chazhi=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSum)*100)/100;
+ var dangechazhi=Math.round((chazhi/newArrsTempplus1[0].Quantity) * 100) / 100;
+ newArrsTempplus1[0].AgencySubtotal__c =newArrsTempplus1[0].AgencySubtotal__c+chazhi;
+ newArrsTempplus1[0].AgencyUnitPrice__c =newArrsTempplus1[0].AgencyUnitPrice__c+dangechazhi;
+ // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213
+ jzDataProductlast =newArrsTempplus1.concat(newArrsTempplus2);//20230213
+ console.warn('newArrsTempplus2'+newArrsTempplus2);
+ console.warn('jzDataProductlast'+jzDataProductlast);
+ }
+ }
+ }
+ });
+ return jzDataProductlast;
+}
+
+export function countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList){
+ var ListPrices = 0;
+ var Nodiscounts = 0;
+ result.forEach(itemss => { //鏂规涓绘暟鎹叧鑱旂殑浜у搧
+ copydate.forEach(jddc => { //鎶ヤ环琛岄」鐩富鏁版嵁
+ if (itemss.Asset_Model_No__c == jddc.Product2.MDM_Model_No__c) {
+ if (ifTrade == "鍐呰部") {
+ ListPrices += itemss.Quantity__c * jddc.Product2.Intra_Trade_List_RMB__c;
+ Nodiscounts += itemss.Quantity__c * jddc.Product2.Intra_Trade_Service_RMB__c;
+ } else if (ifTrade == "澶栬部") {
+ ListPrices += itemss.Quantity__c * jddc.Product2.Foreign_Trade_List_US__c;
+ Nodiscounts += itemss.Quantity__c * jddc.Product2.NoDiscount_Foreign__c;
+ }
+ var fl = true;
+ if (DeftCopyQtyList.length == 0) {
+ DeftCopyQtyList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ } else {
+ DeftCopyQtyList.forEach(jdcql => { //淇濆瓨鏂规鍏宠仈浜у搧鏁伴噺
+ if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) {
+ fl = false;
+ }
+ });
+ if (fl) {
+ DeftCopyQtyList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ }
+ }
+ }
+ });
+ });
+ item.sumListPrice = ListPrices;
+ item.sumNoDiscount = Nodiscounts;
+ DeftCopyQtyLists=DeftCopyQtyList;
+ return item;
+}
+//姣斿鎶ヤ环琛岄」鐩敼鍙樺悗璇曠畻鐣岄潰鐨勫彉鍖�
+//鈥樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐槸涓轰簡涓庣幇鍦ㄦ姤浠疯椤圭洰杩涜姣斿锛岀敤璇曠畻浜у搧琛ㄦ暟鎹悎骞跺嚭鐨勪笂涓�娆¤繘琛岃瘯绠楃殑鎶ヤ环琛岄」鐩�
+//璇曠畻涔嬪墠宸插皢鎶ヤ环琛岄」鐩浉鍚岀殑浜у搧杩涜浜嗗悎骞�
+//1.鈥樻姤浠疯椤圭洰鈥欐潯鏁板皯浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁版椂灏嗕箣鍓嶇殑璇曠畻娓呯┖锛屼娇鐢ㄦ柊鐨勬姤浠疯椤圭洰
+//2.褰撯�樻姤浠疯椤圭洰鈥欐潯鏁板ぇ浜庢垨绛変簬鈥樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁板皢涓ょ粍鏁版嵁杩涜姣斿
+// 2-1锛夊綋鈥樻姤浠疯椤圭洰鈥欐潯鏁扮瓑浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁版椂鍏堝姣斾袱缁勬暟鎹紙鏍规嵁浜у搧Id杩涜鍖归厤锛�
+// 锛�2-1-1锛夊綋鏁版嵁鍖归厤鎴愬姛鍚庡垽鏂叾鏁伴噺瀛楁锛屽綋鈥樻姤浠疯椤圭洰鈥欐暟閲忓皬浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐暟閲忔椂灏嗕箣鍓嶇殑璇曠畻娓呯┖锛屼娇鐢ㄦ柊鐨勬姤浠疯椤圭洰
+// 锛�2-1-2锛夌瓑浜庡垯鍒犻櫎鈥樿瘯绠楀悎鎴愬緟閫夋暟鎹�欎腑鍖归厤鎴愬姛鐨勬暟鎹�
+// 锛�2-1-3锛夊ぇ浜庡垯鐢ㄢ�樻姤浠疯椤圭洰鈥欐暟閲忓噺鍘烩�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐暟閲忓苟灏嗚繖鏉℃暟鎹瓨鍏ュ緟閫夋姤浠疯椤圭洰闆嗗悎
+// 2-2锛夊綋姣斿缁撴潫鍚庡鏋溾�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欎腑鏈夋暟鎹病鏈夎鍖归厤鍒欏皢涔嬪墠鐨勮瘯绠楁竻绌猴紝浣跨敤鏂扮殑鎶ヤ环琛岄」鐩�
+// 2-3锛夊綋鈥樻姤浠疯椤圭洰鈥欐潯鏁板ぇ浜庘�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欐潯鏁帮紝涓斺�樿瘯绠楀悎鎴愬緟閫夋暟鎹�欓兘宸插尮閰嶅垯灏嗏�樻姤浠疯椤圭洰鈥欎腑鏈鍖归厤鐨勬暟鎹叏閮ㄥ瓨鍏ュ緟閫夋姤浠疯椤圭洰闆嗗悎
+export function comparisonUniqueKeyLogic(index,flagall,jzDataDefaultCopy,jzDataDefault,jzDataProduct,jzDataFixedPrice,jzDataDiscount,lastQuotationc){
+ debugger
+ if (index == 0) {
+ if (flagall) {
+ if (jzDataDefaultCopy.length < lastQuotationc.length) { //1銆佹潯鏁板皬浜�
+ jzDataDefault = [].concat(jzDataDefaultCopy);
+ jzDataProduct = [];
+ jzDataFixedPrice = [];
+ jzDataDiscount = [];
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ return;
+ } else { //2銆�
+ var lastQuotation = [].concat(lastQuotationc);
+ var DefaultCopy = [].concat(jzDataDefaultCopy);
+ var Default = [];
+ for (var j = 0; j < DefaultCopy.length; j++) {
+ var arrList = [];
+ var fag = true
+ if (lastQuotation.length != 0) {
+ for (var i = 0; i < lastQuotation.length; i++) {
+ if (DefaultCopy[j].Id == lastQuotation[i].Id) {
+ if (DefaultCopy[j].Quantity < lastQuotation[i].Quantity) { //2-1-1 鏁伴噺灏忎簬 clear
+ jzDataDefault = [].concat(jzDataDefaultCopy);
+ jzDataProduct = [];
+ jzDataFixedPrice = [];
+ jzDataDiscount = [];
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ return;
+ } else if (DefaultCopy[j].Quantity == lastQuotation[i].Quantity) { //2-1-2
+ fag = false;
+ } else { //2-1-3 鏁伴噺澶т簬 濉炲埌寰呴�変骇鍝�
+ DefaultCopy[j].Quantity = DefaultCopy[j].Quantity - lastQuotation[i].Quantity;
+ Default.push(DefaultCopy[j]);
+ fag = false;
+ }
+ } else {
+ arrList.push(lastQuotation[i]);
+ }
+ }
+ lastQuotation = arrList;
+ if (fag) {
+ Default.push(DefaultCopy[j]);
+ }
+
+ } else { //2-3 鏉℃暟澶т簬 灏嗘暟鎹鍒板緟閫変骇鍝�
+ Default.push(DefaultCopy[j]);
+ }
+ }
+ if (lastQuotation.length != 0) { //2-2 鍚堟垚鏁版嵁鏈夊墿浣�
+ jzDataDefault = [].concat(jzDataDefaultCopy);
+ jzDataProduct = [];
+ jzDataFixedPrice = [];
+ jzDataDiscount = [];
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ return;
+ }
+ jzDataDefault = [].concat(Default);
+ jzDataDefaultExp = jzDataDefault;
+ }
+ }
+ }
+ jzDataDefaultExp = jzDataDefault;
+ jzDataProductExp = jzDataProduct;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+}
+export function SearchProductByIdLogic(result,jzDataFixedPrice,jzDataDefaultCopyQuantityList,item){
+ result.forEach(itemss => { //itemss鏂规鍏宠仈鐨勪骇鍝�
+ var fl = true;
+ if (jzDataDefaultCopyQuantityList.length == 0) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ } else {
+ jzDataDefaultCopyQuantityList.forEach(jdcql => { //淇濆瓨鏂规鍏宠仈浜у搧鐨勬暟閲�
+ if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) {
+ fl = false;
+ }
+ });
+ if (fl) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ }
+ }
+ });
+ var iflag = true;
+ var newarrjdf = [];
+ jzDataFixedPrice.forEach(jdf => { //jdf浠锋牸鏀跨瓥
+ if (jdf.Id == item.Id) {
+ iflag = false;
+ newarrjdf.push(jdf);
+ } else {
+ newarrjdf.push(jdf);
+ }
+ });
+ jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList;
+ return newarrjdf;
+}
+export function ComputeDataPromotionLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopy,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){
+ newArrsTemp3 = []; //闇�瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ newArrsTemp4 = []; //涓嶉渶瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ var newArrsTemp5 = [];
+ var newArrsTemp6 = [];
+ arrProductTemp.forEach(itemsss => { //itemsss浜у搧鏄庣粏
+
+ if (itemsss.PromotionId == item.Id) {
+ if (item.determine == '鏀硅繃') {
+ var flag = true;
+ var b = jzDataDefaultCopyQuantityList; //鑾峰彇鏂规涓殑浜у搧鏁伴噺
+ arrTemp2.forEach(datedefault => { //datedefault寰呴�変骇鍝�
+
+ var quantity = 0;
+ if (datedefault.Id == itemsss.Id) {
+ b.forEach(iem => { //iem鏂规涓殑浜у搧鏁伴噺
+ if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) {
+ quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity;
+ datedefault.Quantity = quantity;
+ itemsss.Quantity = iem.Quantity__c__c * item.Counts;
+ }
+ });
+ flag = false;
+ }
+ });
+ if (flag) {
+ jzDataDefaultCopy.forEach(add => { //add鎶ヤ环琛岄」鐩富鏁版嵁
+ var quantity = 0;
+ if (add.Id == itemsss.Id) {
+ b.forEach(iems => { //iems鏂规鍏宠仈浜у搧鏁伴噺
+ if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) {
+ quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts;
+ add.Quantity = quantity;
+ itemsss.Quantity = iems.Quantity__c__c * item.Counts;
+ arrTemp2.push(add);
+ }
+ });
+ flag = true;
+ }
+ });
+ }
+ }
+ itemsss = partPromotionSchemeLogical(itemsss, item,QuoteData[0].multiYearWarranty__c);
+ newArrsTemp3.push(itemsss);
+ } else if (itemsss.PromotionId != item.Id) {
+ newArrsTemp4.push(itemsss);
+ }
+ });
+ if (item.determine == '鏀硅繃') {
+ arrTemp2.forEach(itsss => { //itsss寰呴�変骇鍝�
+ if (itsss.Quantity != 0) {
+ newArrsTemp6.push(itsss);
+ }
+ });
+ newArrsTemp5 = [].concat(newArrsTemp6);
+ jzDataDefault = newArrsTemp5;
+ }
+ newArrsTemp3Exp = newArrsTemp3;
+ newArrsTemp4Exp = newArrsTemp4;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultCopyExp = jzDataDefaultCopy;
+ return arrProductTemp;
+}
+export function ComputeDataNormalProductLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopyc,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){
+ newArrsTemp3 = []; //闇�瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ newArrsTemp4 = []; //涓嶉渶瑕佽绠楃殑浜у搧鏄庣粏鐨勬暟鎹�
+ var newArrsTemp5 = [];
+ var newArrsTemp6 = [];
+ var jzDataDefaultCopy = jzDataDefaultCopyc;
+ arrProductTemp.forEach(itemsss => { //itemsss浜у搧鏄庣粏
+ var flag = true;
+ if (itemsss.PromotionId == item.Id) {
+ if (item.determine == '鏀硅繃') {
+ var b = jzDataDefaultCopyQuantityList; //鑾峰彇鏂规涓殑浜у搧鏁伴噺
+ jzDataDefaultCopy = jzDataDefaultCopyc;
+ arrTemp2.forEach(datedefault => { //datedefault寰呴�変骇鍝�
+ var quantity = 0;
+ if (datedefault.Id == itemsss.Id) {
+ b.forEach(iem => { //iem鏂规涓殑浜у搧鏁伴噺
+ if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) {
+ quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity;
+ datedefault.Quantity = quantity;
+ itemsss.Quantity = iem.Quantity__c__c * item.Counts;
+ }
+ });
+ flag = false;
+ }
+ });
+ if (flag) {
+ jzDataDefaultCopy.forEach(add => { //add鎶ヤ环琛岄」鐩富鏁版嵁
+ var quantity = 0;
+ if (add.Id == itemsss.Id) {
+ b.forEach(iems => { //iems鏂规鍏宠仈浜у搧鏁伴噺
+ if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) {
+ quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts;
+ add.Quantity = quantity;
+ itemsss.Quantity = iems.Quantity__c__c * item.Counts;
+ arrTemp2.push(add);
+ }
+ });
+ }
+ });
+ }
+ }
+ if(QuoteData[0].multiYearWarranty__c){
+ itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice);
+ }else{
+ itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c;
+ }
+ if (item.HeTongTotal == undefined || item.HeTongTotal == "") {
+ itemsss.AgencyUnitPrice__c = 0;
+ }
+ itemsss = partGeneralDiscountLogical(itemsss, item);
+ newArrsTemp3.push(itemsss);
+ } else if (itemsss.PromotionId != item.Id) {
+ newArrsTemp4.push(itemsss);
+ }
+ });
+ if (item.determine == '鏀硅繃') {
+ arrTemp2.forEach(itsss => { //寰呴�変骇鍝�
+ if (itsss.Quantity != 0) {
+ newArrsTemp6.push(itsss);
+ }
+ });
+ newArrsTemp5 = [].concat(newArrsTemp6);
+ jzDataDefault = newArrsTemp5;
+ }
+ newArrsTemp3Exp = newArrsTemp3;
+ newArrsTemp4Exp = newArrsTemp4;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultCopyExp = jzDataDefaultCopy;
+ return arrProductTemp;
+}
+export function ComputeDiscountAuthorizerLogic(newArrsTemp,newArrsTemp2,item,arrProductTemp){
+ newArrsTemp = [];
+ newArrsTemp2 = [];
+ arrProductTemp.forEach(itemss => { //itemss浜у搧鏄庣粏
+ var Discount__c_Input = 0;
+ if (itemss.warrantyType__c=="甯傚満澶氬勾淇濅慨") {
+ Discount__c_Input = item.GuaranteeDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ } else {
+ Discount__c_Input = item.NormalDiscount__c_Input;
+ Discount__c_Input = parseFloat(Discount__c_Input);
+ }
+ if (itemss.PromotionId == item.Id && //鏂规Id
+ itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //瀵硅薄鍝佹姌鎵e綍鍏�
+ itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //闈炲璞″搧鎶樻墸褰曞叆
+ itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //鐗圭害鎶樻墸璁$畻閫昏緫
+ newArrsTemp.push(itemss);
+ } else if (itemss.PromotionId != item.Id ||
+ itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input ||
+ itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) {
+ newArrsTemp2.push(itemss);
+ }
+ });
+ newArrsTempExp = newArrsTemp;
+ newArrsTemp2Exp = newArrsTemp2;
+ return arrProductTemp;
+}
+export function handleSaveDiscountLogic(jzDataDiscount,jzDataProduct,event){
+ var boolean = 0;
+ var boolean2 = false;
+ var boolean3 = false;
+ var data = event.detail.rows;
+ let newData = [];
+ let newData2 = [];
+ var newMap3 = new Map();
+ let newData3 = [];
+ var key=0;
+ let editnewDate = [];
+ var GuaranteeDiscount__cZuiXiao =0;
+ var NormalDiscount__cZuiXiao =0;
+ for (var i = 0; i < jzDataDiscount.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].DelectId.replace("row-", "");
+ if (jzDataDiscount[i].DelectId == id) {
+ editData = {
+ GuaranteeDiscount__c_Input: '',
+ NormalDiscount__c_Input: '',
+ HeTongPrice: '',
+ GuaranteeDiscount_H_Money__c: '',
+ NormalDiscount_H_Money__c: ''
+ };
+ //瀵硅薄鎶樻墸
+ editData.GuaranteeDiscount__c_Input = data[j].GuaranteeDiscount__c_Input;
+ //璧嬪�� 闈炲璞℃姌鎵�
+ editData.NormalDiscount__c_Input = data[j].NormalDiscount__c_Input;
+ //涓�鑸姌鎵e悎鍚屼环鏍�
+ editData.HeTongPrice = data[j].HeTongPrice;
+ //瀵硅薄鍝佸悎鍚岄噾棰�
+ editData.GuaranteeDiscount_H_Money__c = data[j].GuaranteeDiscount_H_Money__c;
+ //闈炲璞″搧鍚堝悓閲戦
+ editData.NormalDiscount_H_Money__c = data[j].NormalDiscount_H_Money__c;
+ // editData.id=id;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...jzDataDiscount[i],
+ ...{}
+ };
+ if (editData.GuaranteeDiscount__c_Input != undefined) {
+ if(newItem.JxsType == "鐗圭害鎶樻墸"){
+ var GuaranteeDiscount__c_Input = parseFloat(editData.GuaranteeDiscount__c_Input);
+ editData.GuaranteeDiscount__c_Input=GuaranteeDiscount__c_Input+'%';
+ var GuaranteeDiscount__c = parseFloat(newItem.GuaranteeDiscount__c);
+ if (GuaranteeDiscount__c_Input < GuaranteeDiscount__c) {
+ GuaranteeDiscount__cZuiXiao=GuaranteeDiscount__c;
+ boolean = 1;
+ break;
+ } else {
+ jzDataProduct.forEach(jdpt => {
+ if (newItem.Id == jdpt.PromotionId &&
+ newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input &&
+ newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) {
+ jdpt.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input;
+ }
+ });
+ newItem.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input;
+ newItem.iftrue = "鏀硅繃";
+ }
+ }else{
+ boolean = 3;
+ break;
+ }
+ }
+ if (editData.NormalDiscount__c_Input != undefined) {
+ if(editData.NormalDiscount__c_Input!=''&&editData.NormalDiscount__c_Input>=0){
+ var NormalDiscount__c_Input = parseFloat(editData.NormalDiscount__c_Input);
+ editData.NormalDiscount__c_Input = NormalDiscount__c_Input+'%';
+ var NormalDiscount__c = parseFloat(newItem.NormalDiscount__c);
+ if (NormalDiscount__c_Input < NormalDiscount__c) {
+ NormalDiscount__cZuiXiao=NormalDiscount__c;
+ boolean = 2;
+ break;
+ } else {
+ jzDataProduct.forEach(jdpt => {
+ if (newItem.Id == jdpt.PromotionId &&
+ newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input &&
+ newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) {
+ jdpt.NormalDiscount__c_Input = editData.NormalDiscount__c_Input;
+ }
+ });
+ newItem.NormalDiscount__c_Input = editData.NormalDiscount__c_Input;
+ newItem.iftrue = "鏀硅繃";
+ }
+ }else{
+ boolean = 5
+ break;
+ }
+ }
+ newItem.GuaranteeDiscount_H_Money_yuan=newItem.GuaranteeDiscount_H_Money__c;
+ if (editData.GuaranteeDiscount_H_Money__c != undefined) {
+ if(newItem.JxsType == "鐗圭害鎶樻墸"){
+ if(editData.GuaranteeDiscount_H_Money__c==""){
+ editData.GuaranteeDiscount_H_Money__c=0;
+ }
+ newItem.GuaranteeDiscount_H_Money__c = editData.GuaranteeDiscount_H_Money__c;
+ newMap3.set(key,newItem);
+ boolean = 4;
+ boolean2 = true ;
+ }else{
+ boolean = 3;
+ break;
+ }
+
+ }
+ newItem.NormalDiscount_H_Money_yuan=newItem.NormalDiscount_H_Money__c;
+ if (editData.NormalDiscount_H_Money__c != undefined) {
+ if(editData.NormalDiscount_H_Money__c==""){
+ editData.NormalDiscount_H_Money__c=0;
+ }
+ newItem.NormalDiscount_H_Money__c = editData.NormalDiscount_H_Money__c;
+ if(newItem.JxsType == "涓�鑸姌鎵�"){
+ newData2.push(newItem);
+ boolean = 4;
+ boolean3 = true;
+ }else{
+ newMap3.set(key,newItem);
+ boolean = 4;
+ boolean2 = true;
+ }
+ }
+ if (editData.NormalDiscount_H_Money__c != undefined||editData.GuaranteeDiscount_H_Money__c != undefined) {
+ if(newItem.JxsType == "涓�鑸姌鎵�"){
+ newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c)
+ }else{
+ newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c)+parseFloat(newItem.GuaranteeDiscount_H_Money__c);
+ }
+ }
+ key++;
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...jzDataDiscount[i]
+ });
+ }
+ }
+ for (let [k, v] of newMap3) {
+ newData3.push(v);
+ }
+ booleanExp = boolean;
+ boolean2Exp = boolean2;
+ boolean3Exp = boolean3;
+ newDataExp = newData;
+ newData2Exp = newData2;
+ newData3Exp = newData3;
+ editnewDateExp = editnewDate;
+ GuaranteeDiscount__cZuiXiaoExp = GuaranteeDiscount__cZuiXiao;
+ NormalDiscount__cZuiXiaoExp = NormalDiscount__cZuiXiao;
+ jzDataProductExp = jzDataProduct;
+ return jzDataDiscount;
+}
+export function AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,CompareFullData){
+ var FilterList = CompareFullData.filter(item => {
+ if (item.ListName == ListName && item.Id == Id) {
+ return true;
+ } else {
+ return false;
+ }
+ })
+ if (FilterList == undefined || FilterList.length <= 0) {
+ var newTemp = {
+ ListName: ListName,
+ Asset_Model_No__c: Asset_Model_No__c,
+ Id: Id,
+ num: addNums
+ }
+ CompareFullData.push(newTemp);
+ } else {
+ FilterList[0].Asset_Model_No__c += Asset_Model_No__c + "||";
+ FilterList[0].num = addNums;
+ }
+ return CompareFullData;
+}
+export function MergeDuplicateSchemesLogic(CompareFullData,SchemeSet){
+ var a = CompareFullData;
+ var CompareFullDataedit = [];
+ var Setmap = new Map();
+ var arr = [];
+ var arr2 = SchemeSet;
+ arr2.forEach(arrs => {
+ var object = {};
+ if (Setmap.has(arrs.Id)) {
+ object = {
+ ...{},
+ ...Setmap.get(arrs.Id)
+ };
+ object.Counts = object.Counts + arrs.Counts;
+ object.determine = '';
+ a.forEach(editnum => {
+ if (editnum.Id == object.Id) {
+ editnum.num = object.Counts;
+ CompareFullDataedit.push(editnum);
+ } else {
+ CompareFullDataedit.push(editnum);
+ }
+ });
+ CompareFullData = [].concat(CompareFullDataedit);
+ Setmap.set(arrs.Id, object);
+ } else {
+ object = {
+ ...{},
+ ...arrs
+ };
+ Setmap.set(arrs.Id, object);
+ }
+ });
+ for (let [k, v] of Setmap) {
+ arr.push(v);
+ }
+ CompareFullDataExp = CompareFullData;
+ return arr;
+}
+//璁$畻浠锋牸鏀跨瓥鐨勬渶澶ф鏁�
+export function ComputeMaximumTimes(priceArr,jzDataDefaultCopyQuantityList,jzDataDefault) {
+ // var num=0;
+ var Pricepolicy = {
+ ...{},
+ ...priceArr
+ };
+ var b = jzDataDefaultCopyQuantityList; //鏌ュ嚭鐨勬瘡涓柟妗堢殑鏄庣粏鐨勬暟閲�
+ var selectproducts = jzDataDefault; //寰呴�変骇鍝�
+ Pricepolicy.maxCounts = ComputationalLogic(Pricepolicy, b, selectproducts);
+ return Pricepolicy;
+}
+export function handleSaveFixedPriceLogic(CompareFullData,event,jzDataFixedPrice,jzDataDefaultCopyQuantityList,jzDataDefault){
+ var a = CompareFullData;
+ var CompareFullDataedit = [];
+ var HeTongTotal = 0;
+ var data = event.detail.rows;
+ let newData = [];
+ let editnewDate = [];
+ var boolean = 1;
+ for (var i = 0; i < jzDataFixedPrice.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].DelectId.replace("row-", "");
+ if (jzDataFixedPrice[i].DelectId == id) {
+ // editData=data[j];
+ editData = {
+ Counts: '',
+ HeTongTotal: ''
+ };
+ //瀵硅薄鎶樻墸
+ editData.Counts = data[j].Counts;
+ //璧嬪�� 闈炲璞℃姌鎵�
+ editData.HeTongTotal = data[j].HeTongTotal;
+ // editData.id=id;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...jzDataFixedPrice[i],
+ ...{}
+ }; //浠锋牸鏀跨瓥鏁版嵁
+ //璁$畻鏈�澶ф鏁�
+ newItem = ComputeMaximumTimes(newItem,jzDataDefaultCopyQuantityList,jzDataDefault);
+ console.warn('ceshi1');
+ if (editData.Counts != undefined) {
+ var ifNec = true;
+ if (newItem.recordTypeName__c == "NormalProduct") {
+ if (newItem.ifNecessary__c) {
+ ifNec = false;
+ }
+ }
+ newItem.maxCounts = Number(newItem.maxCounts);
+ if (newItem.maxCounts >= editData.Counts && ifNec) {
+ if (editData.Counts == 0) {
+ boolean = 4;
+ } else {
+ if (newItem.if_Contain_Nod__c) {
+ HeTongTotal = newItem.Price_CNY__c * editData.Counts;
+ } else {
+ HeTongTotal = newItem.Price_CNY__c * editData.Counts + newItem.sumNoDiscount * editData.Counts;
+ }
+ newItem.Counts = editData.Counts;
+ if (newItem.recordTypeName__c == "Promotion") {
+ newItem.HeTongTotal = HeTongTotal;
+ }
+ newItem.determine = '鏀硅繃';
+ a.forEach(editnum => {
+ if (editnum.Id == newItem.Id) {
+ editnum.num = newItem.Counts;
+ CompareFullDataedit.push(editnum);
+ } else {
+ CompareFullDataedit.push(editnum);
+ }
+ });
+ CompareFullData = [].concat(CompareFullDataedit);//20230214
+ }
+ } else {
+ if (ifNec) {
+ boolean = 3;
+ } else {
+ boolean = 5;
+ }
+ }
+ }
+ console.warn('ceshi2');
+ if (editData.HeTongTotal != undefined) {
+ if (newItem.if_Contain_Nod__c) {
+ HeTongTotal = newItem.Price_CNY__c * newItem.Counts;
+ } else {
+ HeTongTotal = newItem.Price_CNY__c * newItem.Counts + newItem.sumNoDiscount * newItem.Counts;
+ }
+ if (editData.HeTongTotal < HeTongTotal) {
+ boolean = 6;
+ } else {
+ newItem.HeTongTotal = editData.HeTongTotal;
+ newItem.determine = '鏀硅繃';
+ }
+ }
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...jzDataFixedPrice[i]
+ });
+ }
+ }
+ CompareFullDataExp = CompareFullData;
+ booleanExp = boolean;
+ newDataExp = newData;
+ HeTongTotalExp = HeTongTotal;
+ return editnewDate;
+}
+export function deleteFixedPriceLogic(SelectedFnDataFixedPrice,CompareFullData){
+ let ids = [];
+ var fag = true;
+ var select = [];
+ for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) {
+ fag = true;
+ var PromotionHeadRecordId = SelectedFnDataFixedPrice[j].recordTypeName__c;
+ if (PromotionHeadRecordId == "NormalProduct") {
+ if (SelectedFnDataFixedPrice[j].ifNecessary__c) {
+ fag = false;
+ } else {
+ select.push(SelectedFnDataFixedPrice[j]);
+ }
+ } else {
+ select.push(SelectedFnDataFixedPrice[j]);
+ }
+ if (fag) {
+ var a = CompareFullData;
+ var compareFu = [];
+ ids.push(SelectedFnDataFixedPrice[j].Id);
+ a.forEach(deletId => {
+ if (SelectedFnDataFixedPrice[j].Id != deletId.Id) {
+ compareFu.push(deletId);
+ }
+ });
+ CompareFullData = [].concat(compareFu);//20230214
+ }
+ }
+ SelectedFnDataFixedPrice = [].concat(select);//20230214
+ CompareFullDataExp = CompareFullData;
+ SelectedFnDataFixedPriceExp = SelectedFnDataFixedPrice;
+ idsExp = ids;
+ return fag;
+}
+export function DeleteChangesFnLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){
+ //鍒犻櫎 瑙勫垯鏁伴噺
+ CompareFullData.forEach(cItem => {
+ if (cItem.Id == id && cItem.ListName == TypeName) {
+ } else {
+ CompareFullDataTemp.push(cItem);
+ }
+ })
+ //鍒犻櫎 宸查�変骇鍝�
+ var CurrentTemp = {};
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ CurrentTemp = jzDataFixedPrice.filter(fItem => {
+ if (fItem.Id == id) {
+ return true;
+ }
+ return false;
+ })[0];
+ }
+ if (TypeName == "鎶樻墸鏀跨瓥") {
+ CurrentTemp = jzDataDiscount.filter(fItem => {
+ if (fItem.Id == id) {
+ return true;
+ }
+ return false;
+ })[0];
+ }
+ //鍖归厤闇�瑕佸垹闄や骇鍝�
+ var ProductNumsTemp = [];
+ var NewjzDataProduct = [];;
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) {
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ });
+ } else if (TypeName == "鎶樻墸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ if (proItem.CompareId == CurrentTemp.CompareId) {
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ });
+ }
+ // 鎵ц鍒犻櫎
+ jzDataProduct = NewjzDataProduct;
+ // 娣诲姞鏁伴噺
+ var newjzDataDefaults = [];
+ var AddnumsTemp = [];
+ jzDataDefault.forEach(defItem => {
+ var defItemTemp = {
+ ...{},
+ ...defItem
+ };
+ ProductNumsTemp.forEach(pTempItem => {
+ if (pTempItem.Id == defItem.Id) {
+ defItemTemp.Quantity += pTempItem.num;
+ AddnumsTemp.push(pTempItem.Id);
+ }
+ });
+ newjzDataDefaults.push(defItemTemp);
+ })
+ jzDataDefault = newjzDataDefaults;
+ //娣诲姞鏁存潯鏁版嵁
+ var PFTempArr = ProductNumsTemp.filter(pTempItem => {
+ var flag = true;
+ AddnumsTemp.filter(addItem => {
+ if (addItem == pTempItem.Id) {
+ flag = false;
+ }
+ })
+ return flag;
+ })
+ jzDataDefaultNotChange.forEach(noChangeItem => {
+ PFTempArr.forEach(pftItem => {
+ if (pftItem.Id == noChangeItem.Id) {
+ let newChangeItem = {
+ ...{},
+ ...noChangeItem
+ };
+ newChangeItem.Quantity = pftItem.num;
+ jzDataDefault.push(newChangeItem);
+ }
+ })
+ })
+ CompareFullDataTempExp = CompareFullDataTemp;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultNotChangeExp = jzDataDefaultNotChange;
+ return jzDataProduct;
+}
+export function deleteFixedPriceTempLogic(SelectedFnDataFixedPrice,jzDataFixedPrice,CompareFullData){
+ let newarr = [];
+ for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) {
+ for (var i = 0; i < jzDataFixedPrice.length; i++) {
+ var a = CompareFullData;
+ var compareFu = [];
+ a.forEach(deletId => {
+ if (SelectedFnDataFixedPrice[j].Id != deletId.Id) {
+ compareFu.push(deletId);
+ }
+ });
+ CompareFullData = [].concat(compareFu);//20230214
+ if (SelectedFnDataFixedPrice[j].Id == jzDataFixedPrice[i].Id) {
+ jzDataFixedPrice.splice(i, 1); // 灏嗕娇鍚庨潰鐨勫厓绱犱緷娆″墠绉伙紝鏁扮粍闀垮害鍑�1
+ i--;
+ }
+ }
+ }
+ for (var i = 0; i < jzDataFixedPrice.length; i++) {
+ newarr.push(jzDataFixedPrice[i]);
+ }
+ CompareFullDataExp = CompareFullData;
+ return newarr;
+}
+export function GetSearchProductByIdLogic(item,results,jzDataDefaultCopyQuantityList,jzDataFixedPrice){
+ results.forEach(itemss => { //鏂规鍏宠仈鐨勪骇鍝�
+ var fl = true;
+ if (jzDataDefaultCopyQuantityList.length == 0) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ } else {
+ jzDataDefaultCopyQuantityList.forEach(jdcql => {
+ if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) {
+ fl = false;
+ }
+ });
+ if (fl) {
+ jzDataDefaultCopyQuantityList.push({
+ Asset_Model_No__c: itemss.Asset_Model_No__c,
+ Quantity__c__c: itemss.Quantity__c,
+ Id_H: item.PromotionNo__c
+ });
+ }
+ }
+ });
+ var iflag = true;
+ var newarrjdf = [];
+ jzDataFixedPrice.forEach(jdf => { //浠锋牸鏀跨瓥
+ if (jdf.Id == item.Id) {
+ iflag = false;
+ // jdf.sumListPrice = sumListPrice;
+ // jdf.sumNoDiscount = sumNoDiscount;
+ newarrjdf.push(jdf);
+ } else {
+ newarrjdf.push(jdf);
+ }
+ });
+ iflagExp = iflag;
+ jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList;
+ return newarrjdf;
+}
+export function getTableDataCommonlyLogic(jzDataCommonly){
+ var jzDataCommonlyTemp = [];
+ jzDataCommonly.forEach(items => {
+ var ItemsTemp = {
+ ...{},
+ ...items
+ };
+ ItemsTemp.JxsType = "涓�鑸姌鎵�";
+ ItemsTemp.SplitQuantity = ItemsTemp.Quantity;
+ jzDataCommonlyTemp.push(ItemsTemp);
+ })
+ return jzDataCommonlyTemp;
+}
+export function ComputeListPrice(PromotionId,jzDataProduct) {
+ var sum = 0;
+ jzDataProduct.forEach(jzdp => { //jzdp浜у搧鏄庣粏
+ if (jzdp.PromotionId == PromotionId) {
+ sum = sum + jzdp.ListPrice * jzdp.Quantity;
+ }
+ });
+ return sum;
+}
+export function delectComputeData(item,jzDataProduct) {
+ var sum = ComputeListPrice(item.PromotionId,jzDataProduct);
+ var jzProductarry = [].concat(jzDataProduct);
+ jzProductarry.forEach(japdt => {
+ if (item.PromotionId == japdt.PromotionId) {
+ japdt.AgencySubtotal__c = japdt.AgencySubtotal__c + item.AgencySubtotal__c * (japdt.ListPrice * japdt.Quantity / sum);
+ japdt.AgencyUnitPrice__c = japdt.AgencySubtotal__c / japdt.Quantity;
+ japdt.AgencySubtotal__c = Math.round(japdt.AgencySubtotal__c * 100) / 100;
+ japdt.AgencyUnitPrice__c = Math.round(japdt.AgencyUnitPrice__c * 100) / 100;
+ }
+ });
+ jzDataProduct = [].concat(jzProductarry);//20230214
+ return jzDataProduct;
+}
+export function DeleteIsChangelogicExp(item,TypeName,jzDataProduct,jzDataDefault,jzDataDefaultCopy){
+ var jzdatas = [];
+ var flg = true;
+ var booleanfag = 0;
+ jzDataProduct.forEach(proItem => { //proItem浜у搧鏄庣粏
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Promotion") {
+ if (!item.if_Fix__c) {
+ if (proItem.Id == item.Id && item.PromotionId == proItem.PromotionId) {} else {
+ jzdatas.push(proItem);
+ }
+ } else {
+ flg = false;
+ booleanfag = 1;
+
+ }
+ } else if (PromotionHeadRecordId == "NormalProduct") {
+ flg = false;
+ booleanfag = 2;
+ } else {
+ jzdatas.push(proItem);
+ }
+ } else if (TypeName == "鎶樻墸鏀跨瓥") {
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (proItem.Id == item.Id &&
+ item.PromotionId == proItem.PromotionId &&
+ item.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input &&
+ item.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) {} else {
+ jzdatas.push(proItem);
+ }
+ } else {
+ if (proItem.Id == item.Id &&
+ item.Category__c == proItem.Category__c &&
+ item.Discount__c_Input == proItem.Discount__c_Input) {} else {
+ jzdatas.push(proItem);
+ }
+ }
+
+ }
+ });
+ if (flg) {
+ jzDataProduct = [].concat(jzdatas);//20230214
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ //鍒犻櫎浠锋牸璁$畻
+ jzDataProduct = delectComputeData(item,jzDataProduct);
+ }
+ var fg = true;
+ var arr = jzDataDefault;
+ arr.forEach(jddf => { //jddf寰呴�変骇鍝�
+ if (jddf.Id == item.Id) {
+ jddf.Quantity = jddf.Quantity + item.Quantity
+ fg = false;
+ }
+ });
+ if (fg) {
+ jzDataDefaultCopy.forEach(itm => { //itm鎶ヤ环琛岄」鐩富鏁版嵁
+ if (itm.Id == item.Id) {
+ itm.Quantity = item.Quantity
+ arr.push(itm);
+ fg = false;
+ }
+ });
+ }
+ jzDataDefault = [].concat(arr);//20230214
+ }
+ jzDataProductExp = jzDataProduct;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultCopyExp = jzDataDefaultCopy;
+ return booleanfag;
+}
+export function DeleteIsChangesFnjiage(jzDataFixedPrice,jzDataProduct,falg,item){
+ console.warn('1111');
+ var arrTemp = [].concat(jzDataFixedPrice);//20230214
+ var TempItem = {};
+ arrTemp.forEach(atItem => {
+ if (atItem.Id == item.PromotionId) {
+ TempItem = atItem;
+ return;
+ }
+ })
+ console.warn('2222');
+ jzDataProduct.forEach(ite => { //ite浜у搧鏄庣粏
+ if (ite.PromotionId == TempItem.Id) {
+ falg = false;
+ }
+ });
+ falgExp = falg;
+ console.warn('3333');
+ return TempItem;
+}
+export function DeleteIsChangesFnzhekou(jzDataDiscount,jzDataProduct,falg,item){
+ var arrTempTOName = [].concat(jzDataDiscount);//20230214
+ var TempItemTOName = {};
+ var PromotionHeadRecordId = item.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ arrTempTOName.forEach(atItem => {
+ if (atItem.Id == item.PromotionId && //鏂规Id
+ item.NormalDiscount__c_Input == atItem.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ item.GuaranteeDiscount__c_Input == atItem.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ TempItemTOName = atItem;
+ return;
+ }
+ })
+ jzDataProduct.forEach(ite => {
+ if (ite.PromotionId == TempItemTOName.Id &&
+ ite.NormalDiscount__c_Input == TempItemTOName.NormalDiscount__c_Input &&
+ ite.GuaranteeDiscount__c_Input == TempItemTOName.GuaranteeDiscount__c_Input) {
+ falg = false;
+ }
+ });
+ } else {
+ arrTempTOName.forEach(atItem => {
+ if (item.Category__c == atItem.Category__c &&
+ item.Discount__c_Input == atItem.NormalDiscount__c_Input) {
+ TempItemTOName = atItem;
+ return;
+ }
+ })
+ jzDataProduct.forEach(ite => {
+ if (ite.Category__c == TempItemTOName.Category__c &&
+ ite.Discount__c_Input == TempItemTOName.NormalDiscount__c_Input) {
+ falg = false;
+ }
+ });
+ }
+ falgExp = falg;
+ return TempItemTOName;
+}
+export function delectTableDiscountTempLogic(SelectedFnDataDiscount,jzDataDiscount){
+ let newarr = [];
+ for (var j = 0; j < SelectedFnDataDiscount.length; j++) {
+ for (var i = 0; i < jzDataDiscount.length; i++) {
+ var PromotionHeadRecordId = SelectedFnDataDiscount[j].recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (SelectedFnDataDiscount[j].Id == jzDataDiscount[i].Id &&
+ SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input &&
+ SelectedFnDataDiscount[j].GuaranteeDiscount__c_Input == jzDataDiscount[i].GuaranteeDiscount__c_Input) {
+ jzDataDiscount.splice(i, 1); // 灏嗕娇鍚庨潰鐨勫厓绱犱緷娆″墠绉伙紝鏁扮粍闀垮害鍑�1
+ i--;
+ }
+ } else {
+ if (SelectedFnDataDiscount[j].Category__c == jzDataDiscount[i].Category__c &&
+ SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input) {
+ jzDataDiscount.splice(i, 1); // 灏嗕娇鍚庨潰鐨勫厓绱犱緷娆″墠绉伙紝鏁扮粍闀垮害鍑�1
+ i--;
+ }
+ }
+ }
+ }
+ for (var i = 0; i < jzDataDiscount.length; i++) {
+ newarr.push(jzDataDiscount[i]);
+ }
+ return newarr;
+}
+export function SelectedFnCommonlyLogic(arr){
+ var newArr = [];
+ arr.forEach(item => {
+ var TempObject = {
+ ...{},
+ ...item
+ };
+ TempObject.JxsType = "涓�鑸姌鎵�";
+ newArr.push(TempObject);
+ })
+ return newArr;
+}
+export function SaveGeneralDiscountLogic(data,jzDataCommonly){
+ debugger;
+ let newData = [];
+ let editnewDate = [];
+ var boolean = 1;
+ for (var i = 0; i < jzDataCommonly.length; i++) {
+ var editData = {};
+ var flag = false;
+ for (var j = 0; j < data.length; j++) {
+ var id = data[j].Id;
+ if (jzDataCommonly[i].Id == id) {
+ editData = {
+ SplitQuantity: ''
+ };
+ editData.SplitQuantity = data[j].SplitQuantity;
+ flag = true;
+ }
+ }
+ if (flag) {
+ var newItem = {
+ ...jzDataCommonly[i],
+ ...{}
+ };
+ if (editData.SplitQuantity != undefined) {
+ newItem.SplitQuantity = Number(editData.SplitQuantity);
+ }
+ newData.push(newItem);
+ editnewDate.push(newItem);
+ } else {
+ newData.push({
+ ...{},
+ ...jzDataCommonly[i]
+ });
+ }
+ }
+ var newArrs = [].concat(editnewDate);//20230214
+ newArrs.forEach(item => {
+ if (item.Quantity < item.SplitQuantity) {
+ boolean = 2;
+ } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') {
+ boolean = 3;
+ }
+ });
+ booleanExp = boolean;
+ return newData;
+}
+export function DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){
+ //鍒犻櫎 瑙勫垯鏁伴噺
+ CompareFullData.forEach(cItem => {
+ if (cItem.Id == id.Id && cItem.ListName == TypeName) {
+ console.warn("CompareFullData 鍒犻櫎");
+ } else {
+ CompareFullDataTemp.push(cItem);
+ }
+ })
+ //鍒犻櫎 宸查�変骇鍝�
+ var CurrentTemp = {};
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ CurrentTemp = jzDataFixedPrice.filter(fItem => {
+ if (fItem.Id == id.Id) {
+ return true;
+ }
+ return false;
+ })[0];
+ }
+ if (TypeName == "鎶樻墸鏀跨瓥") {
+ CurrentTemp = jzDataDiscount.filter(fItem => {
+ var PromotionHeadRecordId = id.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (fItem.Id == id.Id && //鏂规Id
+ fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ fItem.GuaranteeDiscount__c_Input == id.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ return true;
+ }
+ } else {
+ if (fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input &&
+ fItem.Category__c == id.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ return true;
+ }
+ }
+ return false;
+ })[0];
+ }
+ //鍖归厤闇�瑕佸垹闄や骇鍝�
+ var ProductNumsTemp = [];
+ var NewjzDataProduct = [];;
+ if (TypeName == "浠锋牸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) {
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ });
+ } else if (TypeName == "鎶樻墸鏀跨瓥") {
+ jzDataProduct.forEach(proItem => {
+ var PromotionHeadRecordId = id.recordTypeName__c;
+ if (PromotionHeadRecordId == "Authorizer") {
+ if (CurrentTemp.Id == proItem.PromotionId && //鏂规Id
+ CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && //闈炲璞″搧鎶樻墸褰曞叆
+ CurrentTemp.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) { //瀵硅薄鍝佹姌鎵e綍鍏�
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ } else {
+ if (CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input &&
+ CurrentTemp.Category__c == proItem.Category__c) { //鎶樻墸鏀跨瓥鍒嗙被
+ ProductNumsTemp.push({
+ Id: proItem.Id,
+ num: proItem.Quantity
+ })
+ } else {
+ NewjzDataProduct.push(proItem);
+ }
+ }
+ });
+ }
+ jzDataProduct = NewjzDataProduct;
+ var newjzDataDefaults = [];
+ var AddnumsTemp = [];
+ jzDataDefault.forEach(defItem => {
+ var defItemTemp = {
+ ...{},
+ ...defItem
+ };
+ ProductNumsTemp.forEach(pTempItem => {
+ if (pTempItem.Id == defItem.Id) {
+ defItemTemp.Quantity += pTempItem.num;
+ AddnumsTemp.push(pTempItem.Id);
+ }
+ });
+ newjzDataDefaults.push(defItemTemp);
+ })
+ jzDataDefault = newjzDataDefaults;
+ //娣诲姞鏁存潯鏁版嵁
+ var PFTempArr = ProductNumsTemp.filter(pTempItem => {
+ var flag = true;
+ AddnumsTemp.filter(addItem => {
+ if (addItem == pTempItem.Id) {
+ flag = false;
+ }
+ })
+ return flag;
+ })
+ jzDataDefaultNotChange.forEach(noChangeItem => {
+ PFTempArr.forEach(pftItem => {
+ if (pftItem.Id == noChangeItem.Id) {
+ let newChangeItem = {
+ ...{},
+ ...noChangeItem
+ };
+ newChangeItem.Quantity = pftItem.num;
+ jzDataDefault.push(newChangeItem);
+ }
+ })
+ })
+ CompareFullDataTempExp = CompareFullDataTemp;
+ jzDataFixedPriceExp = jzDataFixedPrice;
+ jzDataDiscountExp = jzDataDiscount;
+ jzDataDefaultExp = jzDataDefault;
+ jzDataDefaultNotChangeExp = jzDataDefaultNotChange;
+ return jzDataProduct;
+}
+export function savecountLogic(jzDataFixedPrice,idStr){
+ var arr = []
+ jzDataFixedPrice.forEach(item => { //浠锋牸鏀跨瓥
+ if (idStr == item.Id) {
+ item.maxCounts = item.Counts
+ arr.push(item);
+ } else {
+ arr.push(item);
+ }
+ });
+ jzDataFixedPrice = arr;
+ return jzDataFixedPrice;
+}
+export function ComparePushDataLogic(jzDataDefault,jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num){
+ let addArr = [];
+ var newss = [].concat(jzDataDefault);
+ var newDataDefault = newss.map(item => {
+ if (item == undefined) {
+ console.warn("undefined!!");
+ }
+ if (item.Product2.MDM_Model_No__c == Asset_Model_No__c) {
+ let ItemTemp = {
+ ...{},
+ ...item
+ };
+ ItemTemp.Quantity = Quantity * num
+ ItemTemp.PromotionNo__c = jzDataProductParam.PromotionNo__c;
+ ItemTemp.Name = jzDataProductParam.Name;
+ ItemTemp.TypeName = TypeName;
+ ItemTemp.PromotionId = Id;
+ addArr.push(ItemTemp);
+ item.Quantity -= num * Quantity;
+ }
+ return item;
+ })
+ jzDataProduct = jzDataProduct.concat(addArr);
+ jzDataProductExp = jzDataProduct;
+ return newDataDefault;
+}
+export function saveAllDataProductFnChuanshen(jzDataFixedPrice,jzDataDiscount,quoId,QuoteData,jzDataProduct,jzDataDefault,ContractPrice){
+ var newTemp = [];
+ jzDataFixedPrice.forEach(item => { //浠锋牸鏀跨瓥
+ var itemTemp = {
+ ...{},
+ ...item
+ };
+ itemTemp.typess = "浠锋牸鏀跨瓥 ";
+ newTemp.push(itemTemp);
+ });
+ var newTemp2 = [];
+ jzDataDiscount.forEach(item => { //鎶樻墸鏀跨瓥
+ var itemTemp = {
+ ...{},
+ ...item
+ };
+ itemTemp.typess = "鎶樻墸鏀跨瓥";
+ newTemp2.push(itemTemp);
+ });
+ var data = newTemp.concat(newTemp2);//20230213
+ var ParamIdStr = quoId;
+ var Trade__c = QuoteData[0].Opportunity.Trade__c;
+ var NewData = ConsolidationScheme(data, ParamIdStr, Trade__c);
+ var NewData1 = MergeProducts(jzDataProduct, jzDataDefault, data, ParamIdStr);
+ var jsondatasss = JSON.stringify(NewData);
+ var jsondatassss = JSON.stringify(NewData1);
+ var Sales_Root__c = QuoteData[0].Opportunity.Sales_Root__c;
+ var QuoteId = QuoteData[0].Id;
+ var OpportunityId = QuoteData[0].OpportunityId;
+ var dataChunanshen = {
+ JsonStr: jsondatasss,
+ ParamIdStr: ParamIdStr,
+ JsonStr2: jsondatassss,
+ QuoteId: QuoteId,
+ SalesRootc: Sales_Root__c,
+ ContractPrice: ContractPrice,
+ OpportunityId: OpportunityId,
+ DealerFinalPriceFc: QuoteData[0].Dealer_Final_Price_F__c,
+ Agent1Agent2Pricec: QuoteData[0].Agent1_Agent2_Price__c
+
+ };
+ newTempExp = newTemp;
+ return dataChunanshen;
+}
+export function saveAllDataProductFnPanduan(jzDataProduct,newTemp){
+ var ifnull = true;
+ var ifnunum=1;
+ newTemp.forEach(ntp => { //浠锋牸鏀跨瓥
+ if (ntp.HeTongTotal == undefined || ntp.HeTongTotal == 0) {
+ ifnull = false;
+ }
+ });
+ jzDataProduct.forEach(jzdp=>{
+ if(jzdp.AgencyUnitPrice__c<0){
+ ifnunum=2;
+ return;
+ }
+ });
+ ifnullExp = ifnull;
+ return ifnunum;
+}
+export function QTcssE(pricePolicyflag){
+ var QTcss = '';
+ if(pricePolicyflag){
+ QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder";
+ }else{
+ QTcss="slds-button slds-button_neutral slds-button_stretch quobutton";
+ }
+ return QTcss;
+}
+export function CompareDataL(list,jzDataDefault){
+ debugger
+ var isChange = false;
+ var TempsJzData = []
+ TempsJzData = [].concat(jzDataDefault); //寰呴�変骇鍝�
+ var TempsJzDataToCompare = []
+ TempsJzData.forEach(item => {
+ list.forEach(element => { //淇冮攢鏂规涓绘暟鎹叧鑱斾骇鍝�
+ if (element.Asset_Model_No__c == item.Product2.MDM_Model_No__c) {
+ if (item.Quantity >= element.Quantity__c) {
+ isChange = true;
+ let CompareTemp = {
+ item: item,
+ element: element
+ }
+ TempsJzDataToCompare.push(CompareTemp);
+ }
+ }
+ });
+ })
+ //add 0602
+ var CheckMinNum = 0;
+ var newTempsJzDataToCompare = []
+ TempsJzDataToCompare.forEach(item => { //绗﹀悎瑙勫垯鐨勪骇鍝�
+ var intNum = parseInt(item.item.Quantity / item.element.Quantity__c);
+ if (CheckMinNum == 0) {
+ CheckMinNum = intNum;
+ }
+ if (intNum < CheckMinNum) {
+ CheckMinNum = intNum;
+ }
+ })
+ TempsJzDataToCompare.forEach(item => {
+ var newItem = {
+ ...{},
+ ...item.item
+ };
+ var newElement = {
+ ...{},
+ ...item.element
+ };
+ newItem.Quantity = item.element.Quantity__c * CheckMinNum;
+ var newObj = {};
+ newObj.item = newItem;
+ newObj.element = newElement;
+ newTempsJzDataToCompare.push(newObj);
+ })
+ TempsJzDataToCompare = [].concat(newTempsJzDataToCompare);
+ isChangeExp = isChange;
+ return TempsJzDataToCompare;
+}
+export function initquoT(responseObj,buttonIsShow,initDataTableFixedPrice,initDataTableDiscount,initDataTableOtherData,initDataTableCommonly){
+ var QuoteData = responseObj;
+ if(QuoteData[0].Dealer_Final_Price_F__c==undefined||QuoteData[0].Dealer_Final_Price_F__c===''){
+ QuoteData[0].Dealer_Final_Price_F__c=0
+ }
+ if(QuoteData[0].Agent1_Agent2_Price__c==undefined||QuoteData[0].Agent1_Agent2_Price__c===''){
+ QuoteData[0].Agent1_Agent2_Price__c=null;
+ }
+ debugger
+ if (QuoteData[0].Quote_Decision__c != "鈭�") {
+ buttonIsShow = true;
+ initDataTableFixedPrice.columns[7].editable = true;
+ initDataTableFixedPrice.columns[10].editable = true;
+ initDataTableDiscount.columns[2].editable = true;
+ initDataTableDiscount.columns[3].editable = true;
+ initDataTableDiscount.columns[4].editable = true;
+ initDataTableDiscount.columns[5].editable = true;
+ initDataTableOtherData.columns[3].editable = true;
+ initDataTableCommonly.columns[3].editable = true;
+ }else{
+ buttonIsShow = false;
+ }
+ buttonIsShowE = buttonIsShow;
+ initDTFP = initDataTableFixedPrice;
+ initDTD = initDataTableDiscount;
+ initDTOD = initDataTableOtherData;
+ initDTC = initDataTableCommonly;
+ return QuoteData;
+}
+//浜у搧闇�瑕佹洿鏂扮殑瀛楁
+export function ChangeProductData(key) {
+ var keyArr = [''];
+ var flag = false;
+ keyArr.forEach(item => {
+ if (item == key) {
+ flag = true;
+ }
+ })
+ return flag;
+}
+export const initDataTableProduct2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ sortable: true,
+ typeAttributes: {
+
+ },
+ hideDefaultActions: true,
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 205
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ initialWidth: 88
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '淇冮攢鏂规鍚嶇О/浜у搧绯诲垪',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 124
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鎶樻墸',
+ fieldName: 'Discount__c_Input',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鍚堝悓鍗曚环',
+ fieldName: 'AgencyUnitPrice__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+ {
+ label: '鍚堝悓鎬讳环',
+ fieldName: 'AgencySubtotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+
+
+ ],
+ sortInterfaces: false,
+ searchColumns:initSearchFormProduct
+}
+
+export const initSearchForm2 = [{
+ label: "鏂规浠g爜",
+ type: "text",
+ name: "PromotionNo__cEqual",
+ isInput: true
+},
+{
+ label: "鍚嶇О",
+ type: "text",
+ name: "NameLike",
+ isInput: true
+}
+]
+
+export const initDataTable2 = {
+ columns: [{
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍚嶇О',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+ {
+ label: '鎻忚堪',
+ fieldName: 'Description__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+ {
+ label: '淇冮攢浠锋牸',
+ fieldName: 'Price_CNY__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ },
+ initialWidth: 140
+ },
+ {
+ label: '鏄惁鍖呭惈澶氬勾淇濅慨浠锋牸',
+ fieldName: 'if_Contain_Nod__c',
+ sortable: true,
+ type: 'boolean',
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'center'
+ },
+ initialWidth: 170
+ },
+ {
+ label: '鏄惁鍥哄畾鏁伴噺',
+ type: 'boolean',
+ fieldName: 'if_Fix__c',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'center'
+ },
+ initialWidth: 130
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchForm2
+}
+export const initSearchFormFix2 = [{
+ label: "鏂规浠g爜",
+ type: "text",
+ name: "PromotionNo__cEqual",
+ isInput: true
+},
+{
+ label: "鍚嶇О",
+ type: "text",
+ name: "NameLike",
+ isInput: true
+}
+]
+export const initDataTableFix2 = {
+ columns: [{
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍚嶇О',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 351
+ },
+ {
+ label: '鎻忚堪',
+ fieldName: 'Description__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 327
+ },
+ {
+ label: '淇冮攢浠锋牸',
+ fieldName: 'Price_CNY__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鏄惁鍖呭惈澶氬勾淇濅慨浠锋牸',
+ fieldName: 'if_Contain_Nod__c',
+ type: 'boolean',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ },
+ {
+ label: '鏄惁鍥哄畾鏁伴噺',
+ fieldName: 'if_Fix__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ }
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormFix2
+}
+export const initSearchFormDefalt2 = [{
+ label: "浜у搧鍨嬪彿",
+ type: "text",
+ name: "Asset_Model_No__c",
+ isInput: true
+},
+{
+ label: "浜у搧鍚嶇О",
+ type: "text",
+ name: "Name__c",
+ isInput: true
+}
+]
+export const initDataTableDefault2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ hideDefaultActions: true,
+ sortable: true
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 251
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormDefalt2
+}
+export const initSearchFormFixedPrice2 = [{
+ label: "浜у搧鍨嬪彿",
+ type: "text",
+ name: "Asset_Model_No__c",
+ isInput: true
+},
+{
+ label: "浜у搧鍚嶇О",
+ type: "text",
+ name: "Name__c",
+ isInput: true
+}
+]
+export const initDataTableFixedPrice2 = {
+ columns: [{
+ label: '鏂规浠g爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '淇冮攢鏂规鍚嶇О/浜у搧绯诲垪',
+ fieldName: 'Name',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 196
+ },
+ {
+ label: '鏂规鎻忚堪',
+ fieldName: 'Description__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 105
+ },
+ {
+ label: '鍒嗙被',
+ fieldName: 'Category__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鏄惁鍖呭惈澶氬勾淇濅慨浠锋牸',
+ fieldName: 'if_Contain_Nod__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ },
+ {
+ label: '鏄惁鍥哄畾鏁伴噺',
+ fieldName: 'if_Fix__c',
+ type: 'boolean',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'center'
+ }
+ },
+ {
+ label: '淇冮攢鍗曚环',
+ fieldName: 'Price_CNY__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '娆℃暟',
+ fieldName: 'Counts',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ editable: false
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎悎璁�',
+ fieldName: 'sumNoDiscountTotal',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '淇冮攢鎬讳环',
+ fieldName: 'Total',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鍚堝悓浠锋牸',
+ fieldName: 'HeTongTotal',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ editable: false,
+ initialWidth: 100
+ },
+
+ ],
+ sortInterfaces: [],
+ searchColumns: initSearchFormFixedPrice2
+}
+export const initSearchFormDiscount2 = []
+export const initDataTableDiscount2 = {
+ columns: [{
+ label: '缁忛攢鍟嗗垎绫�',
+ fieldName: 'JxsType',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍒嗙被',
+ fieldName: 'Category__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ // {
+ // label: '瀵硅薄鍝佹姌鎵�',
+ // fieldName: 'GuaranteeDiscount__c',
+ // sortable: true,
+ // cellAttributes: {
+ // alignment: 'center'
+ // }
+ // },
+ // {
+ // label: '闈炲璞″搧鎶樻墸',
+ // fieldName: 'NormalDiscount__c',
+ // sortable: true,
+ // cellAttributes: {
+ // alignment: 'center'
+ // }
+ // },
+ {
+ label: '瀵硅薄鍝佹姌鎵�',
+ fieldName: 'GuaranteeDiscount__c_Input',
+ editable: false,
+ hideDefaultActions: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ },
+ {
+ label: '瀵硅薄鍝佸悎鍚岄噾棰�',
+ fieldName: 'GuaranteeDiscount_H_Money__c',
+ type: 'number',
+ editable: false,
+ hideDefaultActions: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+ {
+ label: '闈炲璞″搧鎶樻墸',
+ fieldName: 'NormalDiscount__c_Input',
+ editable: false,
+ hideDefaultActions: true,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ },
+ {
+ label: '闈炲璞″搧鍚堝悓閲戦',
+ fieldName: 'NormalDiscount_H_Money__c',
+ type: 'number',
+ hideDefaultActions: true,
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ },
+ {
+ label: '鍚堝悓浠锋牸',
+ fieldName: 'HeTongPrice',
+ type: 'number',
+ hideDefaultActions: true,
+ editable: false,
+ cellAttributes: {
+ class: {},
+ alignment: 'right'
+ },
+ typeAttributes: {
+ minimumFractionDigits: '2',
+ maximumFractionDigits: '2'
+ }
+ }
+ ],
+ sortInterfaces: [],
+ searchColumns: initSearchFormDiscount2
+}
+export const initSearchFormSpecial2 = []
+export const initDataTableSpecial2 = {
+ columns: [{
+ label: '缂栫爜',
+ fieldName: 'PromotionNo__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '鍗忚浜у搧',
+ fieldName: 'Department__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '瀵硅薄鍝佹姌鎵�',
+ fieldName: 'GuaranteeDiscount__c',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '闈炲璞″搧鎶樻墸',
+ fieldName: 'NormalDiscount__c',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '鍗忚缂栫爜',
+ fieldName: 'Contract__c',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ {
+ label: '缁忛攢鍟�',
+ fieldName: 'Agency__Name',
+ sortable: true,
+ hideDefaultActions: true
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormSpecial2
+}
+export const initSearchFormOtherData2 = []
+export const initDataTableOtherData2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ sortable: true,
+ hideDefaultActions: true,
+ typeAttributes: {
+ },
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ hideDefaultActions: true,
+ sortable: true,
+
+ initialWidth: 268
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '浣跨敤鏁伴噺',
+ fieldName: 'SplitQuantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right',
+ class: {}
+ },
+ editable: false
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormOtherData2
+}
+export const initSearchFormCommonly2 = [{
+ label: "鏂规浠g爜",
+ type: "text",
+ name: "PromotionNo__cEqual",
+ isInput: true
+},
+{
+ label: "鍚嶇О",
+ type: "text",
+ name: "NameLike",
+ isInput: true
+}
+]
+export const initDataTableCommonly2 = {
+ columns: [{
+ label: '浜у搧鍨嬪彿',
+ fieldName: 'Asset_Model_No__c',
+ sortable: true,
+ hideDefaultActions: true,
+ typeAttributes: {
+ },
+ },
+ {
+ label: '浜у搧鍚嶇О',
+ fieldName: 'Name__c',
+ sortable: true,
+ hideDefaultActions: true,
+ initialWidth: 268
+ },
+ {
+ label: '鏁伴噺',
+ fieldName: 'Quantity',
+ type: 'number',
+ hideDefaultActions: true,
+ sortable: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '浣跨敤鏁伴噺',
+ fieldName: 'SplitQuantity',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right',
+ class: {}
+ },
+ editable: false
+ },
+ {
+ label: '淇濅慨绫诲瀷',
+ fieldName: 'warrantyType__c',
+ sortable: true,
+ hideDefaultActions: true,
+ },
+ {
+ label: '涓绘姤浠�',
+ fieldName: 'ListPrice',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+ {
+ label: '澶氬勾淇濅环鏍煎皬璁�',
+ fieldName: 'NoDiscountTotal__c',
+ type: 'number',
+ sortable: true,
+ hideDefaultActions: true,
+ cellAttributes: {
+ alignment: 'right'
+ }
+ },
+
+ ],
+ sortInterfaces: false,
+ searchColumns: initSearchFormCommonly2
+}
\ No newline at end of file
--
Gitblit v1.9.1