From 8d006ac357a60d77f086c37f2ae7338530a607f2 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期四, 11 四月 2024 15:30:55 +0800
Subject: [PATCH] 123
---
force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js | 2646 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 2,646 insertions(+), 0 deletions(-)
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..bac488e
--- /dev/null
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNexQuoteEntryUtil.js
@@ -0,0 +1,2646 @@
+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 errorflgw;
+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'
+ },
+ alignment: 'center'
+ },
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+ // chenjingwu 3+2澶氬勾淇濅慨 20240318 start
+ {
+ label: '寤朵繚骞撮檺',
+ fieldName: 'Learning_Community',
+ type: 'picklistColumn',
+ editable: true,
+ typeAttributes: {
+ placeholder:'--鏃�--',
+ options:{fieldName: 'Learning_CommunityOptions'},
+ value: { fieldName: 'Learning_Community' }
+ },
+ hideDefaultActions: true,
+ initialWidth: 300
+ },
+ // chenjingwu 3+2澶氬勾淇濅慨 20240318 end
+
+ ],
+ sortInterfaces: false,
+ 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=>{
+ console.log('123');
+ 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){
+ console.log(selectv);
+ //fy DB202312538864 2024.02.02 start
+ // var Product2 = {};
+ // var PricebookEntry = {Product2:Product2};
+ // var pageObject = {};
+ // var addobj = {PricebookEntry:PricebookEntry,
+ // latestInfo:latestInfo,
+ // pageObject:pageObject};
+ // var attributes1 = {type: "PricebookEntry"};
+ // var attributes2 = {type: "Product2"};
+ // var attributes3 = {type: "QuoteLineItem"};
+ var Product2 = {};
+ var PricebookEntry = {Product2:Product2};
+ var latestInfo = {};
+ var pageObject = {PricebookEntry:PricebookEntry,PricebookEntryId:''};
+ var addobj = {latestInfo:latestInfo,
+ pageObject:pageObject};
+ //fy DB202312538864 2024.02.02 end
+ var Asset_Model_No__c = selectv.Product2.Asset_Model_No__c;
+ var Product2Id = selectv.Product2Id;
+ var SFDA_Status__c = selectv.Product2.SFDA_Status__c
+ 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;
+
+ //fy DB202312538864 2024.02.02 start
+ // addobj.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c;
+ addobj.pageObject.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c;
+ addobj.pageObject.PricebookEntry.Id = PricebookEntryId;
+ addobj.pageObject.PricebookEntry.Product2Id = Product2Id;
+ addobj.pageObject.Asset_Model_No__c = Asset_Model_No__c;
+ addobj.pageObject.PricebookEntry.Product2.LastbuyProductFLG__c = selectv.Product2.LastbuyProductFLG__c;
+ addobj.pageObject.PricebookEntry.Product2.whetherOldCode_PrePro__c = selectv.Product2.whetherOldCode_PrePro__c;
+ //fy DB202312538864 2024.02.02 end
+ // chenijngwu 20240319 start
+ addobj.pageObject.PricebookEntry.Product2.ProductCategory__c = selectv.Product2.ProductCategory__c;
+ if(addobj.pageObject.PricebookEntry.Product2.ProductCategory__c == 'SP涓绘満'){
+ addobj.SPAssistantFlag = true;
+ }
+ // chenijngwu 20240319 end
+ 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;
+ //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� start
+ var IFEndoRapidFlag = selectv.Product2.IFEndoRapidFlag__c;
+ //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� end
+ 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
+ //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� start
+ addobj.IFEndoRapidFlag = IFEndoRapidFlag;
+ //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� 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;
+}
+//chenjingwu start
+//琛屼笂绉�
+function upGo(fieldData,index){
+ if(index!=0){
+ fieldData[index] = fieldData.splice(index-1, 1, fieldData[index])[0];
+ }else{
+ fieldData.push(fieldData.shift());
+ }
+}
+//琛屼笅绉�
+function downGo(fieldData,index) {
+ if(index!=fieldData.length-1){
+ fieldData[index] = fieldData.splice(index+1, 1, fieldData[index])[0];
+ }else{
+ fieldData.unshift( fieldData.splice(index,1)[0]);
+ }
+
+}
+
+// 琛寀p
+export function lineUp(jzDataToBeproduct1,selectjzDataTableToBeproduct1){
+ // 鐢ㄤ簬瀛樺偍鍘熶綅缃储寮�
+ var numList = [];
+ //寰幆鍘熶骇鍝佽鍒楄〃锛屾牴鎹凡閫夋嫨浜у搧鍒楄〃鐨刲ineNo鍖归厤锛屽彇鍑轰綅缃储寮�
+ jzDataToBeproduct1.forEach((item,index1)=>{
+ selectjzDataTableToBeproduct1.forEach((selectItem,index2)=>{
+ if(item.lineNo == selectItem.lineNo){
+ numList.push(index1);
+ }
+ });
+ });
+ //閫変腑琛屼笉鍖呭惈绗竴琛屽垯杩涜涓婄Щ
+ if(numList.length > 0 && numList[0] > 0){
+ numList.forEach(n=>{
+ upGo(jzDataToBeproduct1,n);
+ });
+ }
+ return jzDataToBeproduct1;
+}
+
+export function lineDown(jzDataToBeproduct1,selectjzDataTableToBeproduct1){
+ // 鐢ㄤ簬瀛樺偍鍘熶綅缃储寮�
+ var numList = [];
+ //寰幆鍘熶骇鍝佽鍒楄〃锛屾牴鎹凡閫夋嫨浜у搧鍒楄〃鐨刲ineNo鍖归厤锛屽彇鍑轰綅缃储寮�
+ jzDataToBeproduct1.forEach((item,index1)=>{
+ selectjzDataTableToBeproduct1.forEach((selectItem,index2)=>{
+ if(item.lineNo == selectItem.lineNo){
+ numList.push(index1);
+ }
+ });
+ });
+ //閫変腑琛屼笉鍖呭惈鏈�鍚庝竴琛屽垯杩涜涓嬬Щ
+ if(numList.length > 0 && numList[numList.length - 1] < jzDataToBeproduct1.length - 1){
+ var numListDesc = [];
+ //鏁扮粍鍙嶈浆锛岀‘淇濇渶涓嬮潰鐨勫厛涓嬬Щ
+ for(var i = numList.length-1;0 <= i;i--){
+ numListDesc.push(numList[i]);
+ }
+ numListDesc.forEach(n=>{
+ downGo(jzDataToBeproduct1,n);
+ });
+ }
+ return jzDataToBeproduct1;
+}
+//涓籮s鏂规硶鎷嗗垎锛堜富js瀛楄妭瓒呴檺锛�
+export function qwe(OnLoadProduct,result){
+ var newList = [];
+ 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);
+ })
+ return newList;
+}
+export function yingYanCheck(jzDataToBeproduct,yingYanAssetModel){
+ var yingYanFlag = false;
+ jzDataToBeproduct.forEach(pro=>{
+ if(yingYanAssetModel.includes(pro.Asset_Model)){
+ yingYanFlag = true;
+ }
+ });
+ return yingYanFlag;
+}
+//chenjingwu end
+//鍒濆鍖栦骇鍝佽祴鍊�
+export function InitializeProductAssignment(quoteLineItem){
+ debugger
+ console.warn(JSON.stringify(quoteLineItem));
+ quoteLineItem.forEach(quotltiem=>{
+ // chenjingwu 3+2 start
+ // quotltiem.Learning_CommunityOptions = [
+ // { label: '--鏃�--', value: '' },
+ // { label: '涓绘満', value: '涓绘満' },
+ // { label: '闀滃瓙', value: '闀滃瓙' },
+ // { label: '娲楁秷鏈�', value: '娲楁秷鏈�' },
+ // { label: '灏忛暅绉�', value: '灏忛暅绉�' },
+ // { label: '鑳介噺', value: '鑳介噺' },
+ // { label: '鍏夋簮', value: '鍏夋簮' },
+ // { label: '鍏朵粬', value: '鍏朵粬' }
+ // ];
+ // chenjingwu 3+2 end
+ //fy DB202312538864 2024.02.02 start
+ if(quotltiem.PricebookEntry === undefined){
+ quotltiem.PricebookEntry = {Product2:{}};
+ }else{
+ if(quotltiem.PricebookEntry.Product2 === undefined){
+ quotltiem.PricebookEntry.Product2 = {};
+ }
+ }
+ if(quotltiem.lastbuyProductFLGc !== undefined && quotltiem.lastbuyProductFLGc !== null){
+ quotltiem.PricebookEntry.Product2.LastbuyProductFLG__c = quotltiem.lastbuyProductFLGc;
+ }
+ // chenjingwu 20240411 start
+ if(quotltiem.ProductCategory !== undefined && quotltiem.ProductCategory !== null){
+ quotltiem.PricebookEntry.Product2.ProductCategory__c = quotltiem.ProductCategory;
+ }
+ // chenjingwu 20240411 end
+ if(quotltiem.whetherOldCode_PreProc !== undefined && quotltiem.whetherOldCode_PreProc !== null){
+ quotltiem.PricebookEntry.Product2.whetherOldCode_PrePro__c = quotltiem.whetherOldCode_PreProc;
+ }
+ //fy DB202312538864 2024.02.02 end
+ 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) != "{}" && 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
+ // DB202311242191 銆愭姤浠峰崟銆戞姤浠峰崟鍚堝悓閲戦鏇存柊鍜岀敓鎴愭柊鎶ヤ环鍗曡鍒欑‘璁ゅ拰淇敼 fy start
+ if(!quo.Quote_Adjust_Calculate__c){
+ quo.Quote_Adjust_Calculate__c = 0;
+ }
+ if(!quote.Quote_Adjust_Amount__c){
+ quo.Quote_Adjust_Amount_Page__c = 0;
+ }else{
+ quo.Quote_Adjust_Amount_Page__c = toNumComma(quote.Quote_Adjust_Amount__c);
+ }
+ // quo.Quote_Adjust_Calculate__c = '';
+ // quo.Quote_Adjust_Amount_Page__c = '';
+ // DB202311242191 銆愭姤浠峰崟銆戞姤浠峰崟鍚堝悓閲戦鏇存柊鍜岀敓鎴愭柊鎶ヤ环鍗曡鍒欑‘璁ゅ拰淇敼 fy end
+ 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:'',Learning_Community:''}
+ 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;
+ }
+ if(item.Learning_Community != undefined){
+ value.Learning_Community = item.Learning_Community;
+ }
+ 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;
+ }
+ if(datavaue.Learning_Community){
+ jzdtbt.Learning_Community = datavaue.Learning_Community;
+ }
+ 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,agency1Name){
+ 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,
+ // DB202311242191 銆愭姤浠峰崟銆戞姤浠峰崟鍚堝悓閲戦鏇存柊鍜岀敓鎴愭柊鎶ヤ环鍗曡鍒欑‘璁ゅ拰淇敼 fy start
+ agency1Namec:agency1Name
+ // DB202311242191 銆愭姤浠峰崟銆戞姤浠峰崟鍚堝悓閲戦鏇存柊鍜岀敓鎴愭柊鎶ヤ环鍗曡鍒欑‘璁ゅ拰淇敼 fy end
+ };
+ 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('warn')){
+ errorflgw = true;
+ alertExp = Setmap.get('warn');
+ }
+ 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,agency1Name){
+ 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,
+ // DB202311242191 銆愭姤浠峰崟銆戞姤浠峰崟鍚堝悓閲戦鏇存柊鍜岀敓鎴愭柊鎶ヤ环鍗曡鍒欑‘璁ゅ拰淇敼 fy start
+ agency1Namec:agency1Name
+ // DB202311242191 銆愭姤浠峰崟銆戞姤浠峰崟鍚堝悓閲戦鏇存柊鍜岀敓鎴愭柊鎶ヤ环鍗曡鍒欑‘璁ゅ拰淇敼 fy end
+ }
+ 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 = [];
+ var flag = false;
+ 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;
+ //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� start
+ item.IFEndoRapidFlag = jzdtbt.IFEndoRapidFlag;
+ //DB202312560765 you 鍚︽湁EndoRapid璧勮川妫�鏌� end
+ if(jzdtbt.PricebookEntry.Product2.ProductCategory__c == 'SP涓绘満'){
+ item.SPAssistantFlag = true;
+ flag = true;
+ }
+ activities.push(item);
+ }
+ });
+ var maps = new Map();
+ maps.set('activities',activities);
+ maps.set('flag',flag);
+ return maps;
+}
+export function Agent1comput(quo,Saleslet,oppInfo){
+ var z = quo.Estimation_List_Price__c;
+ 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):'';
+ return quo;
+}
\ No newline at end of file
--
Gitblit v1.9.1