public with sharing class lexTmsformController {
|
@AuraEnabled
|
public static InitData initData (String SalesdepartmentValue,String provinceValue,String City_MasterValue,String productTypeValue,String customerTypeValue,String fiscalYearValue,String Dealer_Name){
|
InitData ins = new InitData();
|
Date today = Date.today();
|
Integer monthNum = Date.today().month();
|
// Integer monthNum = 12;
|
Date lastYearDate = Date.today().addYears(-1);
|
ins.threemonthAug = 0;
|
// if (provinceValue !=null && provinceValue !='') {
|
// provinceValue = provinceValue.substring(0,15);
|
// }
|
ins.FY_BO_1 =0;
|
ins.FY_BO_10 =0;
|
ins.FY_BO_11 =0;
|
ins.FY_BO_12 =0;
|
ins.FY_BO_2 =0;
|
ins.FY_BO_3 =0;
|
ins.FY_BO_4 =0;
|
ins.FY_BO_5 =0;
|
ins.FY_BO_6 =0;
|
ins.FY_BO_7 =0;
|
ins.FY_BO_8 =0;
|
ins.FY_BO_9 =0;
|
ins.FY_O_1 =0;
|
ins.FY_O_10 =0;
|
ins.FY_O_12 =0;
|
ins.FY_O_11 =0;
|
ins.FY_O_3 =0;
|
ins.FY_O_2 =0;
|
ins.FY_O_4 =0;
|
ins.FY_O_5 =0;
|
ins.FY_O_6 =0;
|
ins.FY_O_7 =0;
|
ins.FY_O_8 =0;
|
ins.FY_O_9 =0;
|
ins.FY_P_1 =0;
|
ins.FY_P_10 =0;
|
ins.FY_P_11 =0;
|
ins.FY_P_12 =0;
|
ins.FY_P_2 =0;
|
ins.FY_P_3 =0;
|
ins.FY_P_4 =0;
|
ins.FY_P_5 =0;
|
ins.FY_P_6 =0;
|
ins.FY_P_7 =0;
|
ins.FY_P_8 =0;
|
ins.FY_P_9 =0;
|
ins.FY_S_1 =0;
|
ins.FY_S_10 =0;
|
ins.FY_S_11 =0;
|
ins.FY_S_12 =0;
|
ins.FY_S_2 =0;
|
ins.FY_S_3 =0;
|
ins.FY_S_4 =0;
|
ins.FY_S_5 =0;
|
ins.FY_S_6 =0;
|
ins.FY_S_7 =0;
|
ins.FY_S_8 =0;
|
ins.FY_S_9 =0;
|
|
|
ins.FY_I_1 = 0;
|
ins.FY_I_2 = 0;
|
ins.FY_I_3 = 0;
|
ins.FY_I_4 = 0;
|
ins.FY_I_5 = 0;
|
ins.FY_I_6 = 0;
|
ins.FY_I_7 = 0;
|
ins.FY_I_8 = 0;
|
ins.FY_I_9 = 0;
|
ins.FY_I_10 = 0;
|
ins.FY_I_11 = 0;
|
ins.FY_I_12 = 0;
|
|
ins.FY_TI_1 = 0;
|
ins.FY_TI_2 = 0;
|
ins.FY_TI_3 = 0;
|
ins.FY_TI_4 = 0;
|
ins.FY_TI_5 = 0;
|
ins.FY_TI_6 = 0;
|
ins.FY_TI_7 = 0;
|
ins.FY_TI_8 = 0;
|
ins.FY_TI_9 = 0;
|
ins.FY_TI_10 = 0;
|
ins.FY_TI_11 = 0;
|
ins.FY_TI_12 = 0;
|
|
ins.FY_SP_1 = '0';
|
ins.FY_SP_2 = '0';
|
ins.FY_SP_3 = '0';
|
ins.FY_SP_4 = '0';
|
ins.FY_SP_5 = '0';
|
ins.FY_SP_6 = '0';
|
ins.FY_SP_7 = '0';
|
ins.FY_SP_8 = '0';
|
ins.FY_SP_9 = '0';
|
ins.FY_SP_10 = '0';
|
ins.FY_SP_11 = '0';
|
ins.FY_SP_12 = '0';
|
|
ins.annual_1 = 0;
|
ins.annual_2 = 0;
|
ins.annual_3 = 0;
|
ins.annual_4 = 0;
|
ins.annual_5 = 0;
|
ins.annual_8 = 0;
|
ins.annual_7 = 0;
|
ins.annual_9 = 0;
|
ins.annual_10 = 0;
|
ins.annual_6 = '0';
|
|
ins.YTDTotal1 = 0;
|
ins.YTDTotal2 = 0;
|
ins.YTDTotal3 = 0;
|
ins.YTDTotal4 = 0;
|
ins.YTDTotal5 = 0;
|
ins.YTDTotal8 = 0;
|
ins.YTDTotal6 = '0';
|
if (Dealer_Name != null &&Dealer_Name != '') {
|
Account Dealer1 = [select Id,ISVirtualDealer__c,OCM_man_province_HP__c from Account where id = :Dealer_Name limit 1];
|
if (Dealer1.ISVirtualDealer__c) {
|
Dealer_Name = '';
|
provinceValue = Dealer1.OCM_man_province_HP__c;
|
}
|
}
|
|
String query3 = 'SELECT id,FY_BO_A_1__c,FY_BO_A_10__c,FY_BO_A_11__c,FY_BO_A_12__c,FY_BO_A_2__c,FY_BO_A_3__c,FY_BO_A_4__c,FY_BO_A_5__c,FY_BO_A_6__c,FY_BO_A_7__c,FY_BO_A_8__c,FY_BO_A_9__c '
|
+' ,FY_O_1__c,FY_O_10__c,FY_O_11__c,FY_O_12__c,FY_O_2__c,FY_O_3__c,FY_O_4__c,FY_O_5__c,FY_O_6__c,FY_O_7__c,FY_O_8__c,FY_O_9__c'
|
+',FY_P_1__c,FY_P_10__c,FY_P_11__c,FY_P_12__c,FY_P_2__c,FY_P_3__c,FY_P_4__c,FY_P_5__c,FY_P_6__c,FY_P_7__c,FY_P_8__c,FY_P_9__c'
|
+',FY_S_1__c,FY_S_10__c,FY_S_11__c,FY_S_12__c,FY_S_2__c,FY_S_3__c,FY_S_4__c,FY_S_5__c,FY_S_6__c,FY_S_7__c,FY_S_8__c,FY_S_9__c'
|
+',FY_I_1__c,FY_I_10__c,FY_I_11__c,FY_I_12__c,FY_I_2__c,FY_I_3__c,FY_I_4__c,FY_I_5__c,FY_I_6__c,FY_I_7__c,FY_I_8__c,FY_I_9__c'
|
+',StockAmount_1__c,StockAmount_10__c,StockAmount_11__c,StockAmount_12__c,StockAmount_2__c,StockAmount_3__c,StockAmount_4__c,StockAmount_5__c,StockAmount_6__c,StockAmount_7__c,StockAmount_8__c,StockAmount_9__c'
|
+',TMS_Unpaid_amount_1__c,TMS_Unpaid_amount_2__c,TMS_Unpaid_amount_3__c,TMS_Unpaid_amount_4__c,TMS_Unpaid_amount_5__c,TMS_Unpaid_amount_6__c,TMS_Unpaid_amount_7__c,TMS_Unpaid_amount_8__c,TMS_Unpaid_amount_9__c,TMS_Unpaid_amount_10__c,TMS_Unpaid_amount_11__c,TMS_Unpaid_amount_12__c'
|
+',IMS_Prediction_1__c,IMS_Prediction_2__c,IMS_Prediction_3__c,IMS_Prediction_4__c,IMS_Prediction_5__c,IMS_Prediction_6__c,IMS_Prediction_7__c,IMS_Prediction_8__c,IMS_Prediction_9__c,IMS_Prediction_10__c,IMS_Prediction_11__c,IMS_Prediction_12__c'
|
+',IMS_Shipments_1__c,IMS_Shipments_2__c,IMS_Shipments_3__c,IMS_Shipments_4__c,IMS_Shipments_5__c,IMS_Shipments_6__c,IMS_Shipments_7__c,IMS_Shipments_8__c,IMS_Shipments_9__c,IMS_Shipments_10__c,IMS_Shipments_11__c,IMS_Shipments_12__c'
|
+',TMS_Prediction_1__c,TMS_Prediction_2__c,TMS_Prediction_3__c,TMS_Prediction_4__c,TMS_Prediction_5__c,TMS_Prediction_6__c,TMS_Prediction_7__c,TMS_Prediction_8__c,TMS_Prediction_9__c,TMS_Prediction_10__c,TMS_Prediction_11__c,TMS_Prediction_12__c'
|
+',TMS_PredictionFulfillment_1__c,TMS_PredictionFulfillment_2__c,TMS_PredictionFulfillment_3__c,TMS_PredictionFulfillment_4__c,TMS_PredictionFulfillment_5__c,TMS_PredictionFulfillment_6__c,TMS_PredictionFulfillment_7__c,TMS_PredictionFulfillment_8__c,TMS_PredictionFulfillment_9__c,TMS_PredictionFulfillment_10__c,TMS_PredictionFulfillment_11__c,TMS_PredictionFulfillment_12__c'
|
+ ' FROM Dealer_ConsumableManage__c where FY__c = :fiscalYearValue ';
|
if(Dealer_Name != null &&Dealer_Name != ''){
|
query3 += 'and Dealer_Name__c = ' + ' :Dealer_Name ';
|
}
|
if(SalesdepartmentValue != null && SalesdepartmentValue !=''){
|
query3 += 'and TMS_Salesdepartment__c = ' + ' :SalesdepartmentValue ';
|
}
|
// 省市查询条件待确认
|
if(provinceValue != null && provinceValue !='' && !Test.isRunningTest()){
|
query3 += 'and TMS_Province__c = ' + ' :provinceValue ';
|
}
|
if(City_MasterValue != null && City_MasterValue !=''){
|
query3 += 'and City_Master__c = ' + ' :City_MasterValue ';
|
}
|
if(productTypeValue != null && productTypeValue != ''){
|
if (productTypeValue == 'ET耗材') {
|
query3 += ' and ET_ENG__c = \'ET\'';
|
}
|
if (productTypeValue == '外科耗材') {
|
query3 += ' and ET_ENG__c = \'ENG\'';
|
}
|
}
|
|
|
//第二张表
|
List<Dealer_ConsumableManage__c> dcList = new List<Dealer_ConsumableManage__c>();
|
dcList = Database.query(query3);
|
for (Dealer_ConsumableManage__c dc: dcList) {
|
if (dc.FY_BO_A_1__c !=null) {
|
ins.FY_BO_1 += dc.FY_BO_A_1__c;
|
}
|
if (dc.FY_BO_A_10__c !=null) {
|
ins.FY_BO_10 +=dc.FY_BO_A_10__c;
|
}
|
if (dc.FY_BO_A_11__c !=null) {
|
ins.FY_BO_11 +=dc.FY_BO_A_11__c;
|
}
|
if (dc.FY_BO_A_12__c !=null) {
|
ins.FY_BO_12 +=dc.FY_BO_A_12__c;
|
}
|
if (dc.FY_BO_A_2__c !=null) {
|
ins.FY_BO_2 +=dc.FY_BO_A_2__c;
|
}
|
if (dc.FY_BO_A_3__c !=null) {
|
ins.FY_BO_3 +=dc.FY_BO_A_3__c;
|
}
|
if (dc.FY_BO_A_4__c !=null) {
|
ins.FY_BO_4 +=dc.FY_BO_A_4__c;
|
}
|
if (dc.FY_BO_A_5__c !=null) {
|
ins.FY_BO_5 +=dc.FY_BO_A_5__c;
|
}
|
if (dc.FY_BO_A_6__c !=null) {
|
ins.FY_BO_6 +=dc.FY_BO_A_6__c;
|
}
|
if (dc.FY_BO_A_7__c !=null) {
|
ins.FY_BO_7 +=dc.FY_BO_A_7__c;
|
}
|
if (dc.FY_BO_A_8__c !=null) {
|
ins.FY_BO_8 +=dc.FY_BO_A_8__c;
|
}
|
if (dc.FY_BO_A_9__c !=null) {
|
ins.FY_BO_9 +=dc.FY_BO_A_9__c;
|
}
|
|
|
|
if (dc.FY_O_1__c !=null) {
|
ins.FY_O_1 += dc.FY_O_1__c;
|
}
|
if (dc.FY_O_10__c !=null) {
|
ins.FY_O_10 +=dc.FY_O_10__c;
|
}
|
if (dc.FY_O_11__c !=null) {
|
ins.FY_O_11 +=dc.FY_O_11__c;
|
}
|
if (dc.FY_O_12__c !=null) {
|
ins.FY_O_12 +=dc.FY_O_12__c;
|
}
|
if (dc.FY_O_2__c !=null) {
|
ins.FY_O_2 +=dc.FY_O_2__c;
|
}
|
if (dc.FY_O_3__c !=null) {
|
ins.FY_O_3 +=dc.FY_O_3__c;
|
}
|
if (dc.FY_O_4__c !=null) {
|
ins.FY_O_4 +=dc.FY_O_4__c;
|
}
|
if (dc.FY_O_5__c !=null) {
|
ins.FY_O_5 +=dc.FY_O_5__c;
|
}
|
if (dc.FY_O_6__c !=null) {
|
ins.FY_O_6 +=dc.FY_O_6__c;
|
}
|
if (dc.FY_O_7__c !=null) {
|
ins.FY_O_7 +=dc.FY_O_7__c;
|
}
|
if (dc.FY_O_8__c !=null) {
|
ins.FY_O_8 +=dc.FY_O_8__c;
|
}
|
if (dc.FY_O_9__c !=null) {
|
ins.FY_O_9 +=dc.FY_O_9__c;
|
}
|
|
if (dc.FY_P_1__c !=null) {
|
ins.FY_P_1 += dc.FY_P_1__c;
|
}
|
if (dc.FY_P_10__c !=null) {
|
ins.FY_P_10 +=dc.FY_P_10__c;
|
}
|
if (dc.FY_P_11__c !=null) {
|
ins.FY_P_11 +=dc.FY_P_11__c;
|
}
|
if (dc.FY_P_12__c !=null) {
|
ins.FY_P_12 +=dc.FY_P_12__c;
|
}
|
if (dc.FY_P_2__c !=null) {
|
ins.FY_P_2 +=dc.FY_P_2__c;
|
}
|
if (dc.FY_P_3__c !=null) {
|
ins.FY_P_3 +=dc.FY_P_3__c;
|
}
|
if (dc.FY_P_4__c !=null) {
|
ins.FY_P_4 +=dc.FY_P_4__c;
|
}
|
if (dc.FY_P_5__c !=null) {
|
ins.FY_P_5 +=dc.FY_P_5__c;
|
}
|
if (dc.FY_P_6__c !=null) {
|
ins.FY_P_6 +=dc.FY_P_6__c;
|
}
|
if (dc.FY_P_7__c !=null) {
|
ins.FY_P_7 +=dc.FY_P_7__c;
|
}
|
if (dc.FY_P_8__c !=null) {
|
ins.FY_P_8 +=dc.FY_P_8__c;
|
}
|
if (dc.FY_P_9__c !=null) {
|
ins.FY_P_9 +=dc.FY_P_9__c;
|
}
|
|
if (dc.FY_S_1__c !=null) {
|
ins.FY_S_1 += dc.FY_S_1__c;
|
}
|
if (dc.FY_S_10__c !=null) {
|
ins.FY_S_10 +=dc.FY_S_10__c;
|
}
|
if (dc.FY_S_11__c !=null) {
|
ins.FY_S_11 +=dc.FY_S_11__c;
|
}
|
if (dc.FY_S_12__c !=null) {
|
ins.FY_S_12 +=dc.FY_S_12__c;
|
}
|
if (dc.FY_S_2__c !=null) {
|
ins.FY_S_2 +=dc.FY_S_2__c;
|
}
|
if (dc.FY_S_3__c !=null) {
|
ins.FY_S_3 +=dc.FY_S_3__c;
|
}
|
if (dc.FY_S_4__c !=null) {
|
ins.FY_S_4 +=dc.FY_S_4__c;
|
}
|
if (dc.FY_S_5__c !=null) {
|
ins.FY_S_5 +=dc.FY_S_5__c;
|
}
|
if (dc.FY_S_6__c !=null) {
|
ins.FY_S_6 +=dc.FY_S_6__c;
|
}
|
if (dc.FY_S_7__c !=null) {
|
ins.FY_S_7 +=dc.FY_S_7__c;
|
}
|
if (dc.FY_S_8__c !=null) {
|
ins.FY_S_8 +=dc.FY_S_8__c;
|
}
|
if (dc.FY_S_9__c !=null) {
|
ins.FY_S_9 +=dc.FY_S_9__c;
|
}
|
|
if (dc.FY_I_1__c !=null) {
|
ins.FY_I_1 += dc.FY_I_1__c;
|
}
|
if (dc.FY_I_10__c !=null) {
|
ins.FY_I_10 +=dc.FY_I_10__c;
|
}
|
if (dc.FY_I_11__c !=null) {
|
ins.FY_I_11 +=dc.FY_I_11__c;
|
}
|
if (dc.FY_I_12__c !=null) {
|
ins.FY_I_12 +=dc.FY_I_12__c;
|
}
|
if (dc.FY_I_2__c !=null) {
|
ins.FY_I_2 +=dc.FY_I_2__c;
|
}
|
if (dc.FY_I_3__c !=null) {
|
ins.FY_I_3 +=dc.FY_I_3__c;
|
}
|
if (dc.FY_I_4__c !=null) {
|
ins.FY_I_4 +=dc.FY_I_4__c;
|
}
|
if (dc.FY_I_5__c !=null) {
|
ins.FY_I_5 +=dc.FY_I_5__c;
|
}
|
if (dc.FY_I_6__c !=null) {
|
ins.FY_I_6 +=dc.FY_I_6__c;
|
}
|
if (dc.FY_I_7__c !=null) {
|
ins.FY_I_7 +=dc.FY_I_7__c;
|
}
|
if (dc.FY_I_8__c !=null) {
|
ins.FY_I_8 +=dc.FY_I_8__c;
|
}
|
if (dc.FY_I_9__c !=null) {
|
ins.FY_I_9 +=dc.FY_I_9__c;
|
}
|
|
|
if (dc.TMS_Unpaid_amount_1__c !=null) {
|
ins.TMS_Unpaid_amount_1 += dc.TMS_Unpaid_amount_1__c;
|
}
|
if (dc.TMS_Unpaid_amount_10__c !=null){
|
ins.TMS_Unpaid_amount_10 +=dc.TMS_Unpaid_amount_10__c;
|
}
|
if (dc.TMS_Unpaid_amount_11__c !=null) {
|
ins.TMS_Unpaid_amount_11 +=dc.TMS_Unpaid_amount_11__c;
|
}
|
if (dc.TMS_Unpaid_amount_12__c !=null) {
|
ins.TMS_Unpaid_amount_12 +=dc.TMS_Unpaid_amount_12__c;
|
}
|
if (dc.TMS_Unpaid_amount_2__c !=null) {
|
ins.TMS_Unpaid_amount_2 +=dc.TMS_Unpaid_amount_2__c;
|
}
|
if (dc.TMS_Unpaid_amount_3__c !=null) {
|
ins.TMS_Unpaid_amount_3 +=dc.TMS_Unpaid_amount_3__c;
|
}
|
if (dc.TMS_Unpaid_amount_4__c !=null) {
|
ins.TMS_Unpaid_amount_4 +=dc.TMS_Unpaid_amount_4__c;
|
}
|
if (dc.TMS_Unpaid_amount_5__c !=null) {
|
ins.TMS_Unpaid_amount_5 +=dc.TMS_Unpaid_amount_5__c;
|
}
|
if (dc.TMS_Unpaid_amount_6__c !=null) {
|
ins.TMS_Unpaid_amount_6 +=dc.TMS_Unpaid_amount_6__c;
|
}
|
if (dc.TMS_Unpaid_amount_7__c !=null) {
|
ins.TMS_Unpaid_amount_7 +=dc.TMS_Unpaid_amount_7__c;
|
}
|
if (dc.TMS_Unpaid_amount_8__c !=null) {
|
ins.TMS_Unpaid_amount_8 +=dc.TMS_Unpaid_amount_8__c;
|
}
|
if (dc.TMS_Unpaid_amount_9__c !=null) {
|
ins.TMS_Unpaid_amount_9 +=dc.TMS_Unpaid_amount_9__c;
|
}
|
|
if (dc.TMS_Prediction_1__c !=null) {
|
ins.TMS_Prediction_1 += dc.TMS_Prediction_1__c;
|
}
|
if (dc.TMS_Prediction_11__c !=null){
|
ins.TMS_Prediction_11 +=dc.TMS_Prediction_11__c;
|
}
|
if (dc.TMS_Prediction_10__c !=null) {
|
ins.TMS_Prediction_10 += dc.TMS_Prediction_10__c ;
|
}
|
if (dc.TMS_Prediction_2__c !=null) {
|
ins.TMS_Prediction_2 +=dc.TMS_Prediction_2__c;
|
}
|
if (dc.TMS_Prediction_3__c !=null) {
|
ins.TMS_Prediction_3 +=dc.TMS_Prediction_3__c;
|
}
|
if (dc.TMS_Prediction_4__c !=null) {
|
ins.TMS_Prediction_4 +=dc.TMS_Prediction_4__c;
|
}
|
if (dc.TMS_Prediction_5__c !=null) {
|
ins.TMS_Prediction_5 +=dc.TMS_Prediction_5__c;
|
}
|
if (dc.TMS_Prediction_6__c !=null) {
|
ins.TMS_Prediction_6 +=dc.TMS_Prediction_6__c;
|
}
|
if (dc.TMS_Prediction_7__c !=null) {
|
ins.TMS_Prediction_7 +=dc.TMS_Prediction_7__c;
|
}
|
if (dc.TMS_Prediction_8__c !=null) {
|
ins.TMS_Prediction_8 +=dc.TMS_Prediction_8__c;
|
}
|
if (dc.TMS_Prediction_9__c !=null) {
|
ins.TMS_Prediction_9 +=dc.TMS_Prediction_9__c;
|
}
|
if (dc.TMS_Prediction_12__c !=null) {
|
ins.TMS_Prediction_12 +=dc.TMS_Prediction_12__c;
|
}
|
|
if (dc.IMS_Shipments_1__c !=null) {
|
ins.IMS_Shipments_1 += dc.IMS_Shipments_1__c;
|
}
|
if (dc.IMS_Shipments_11__c !=null){
|
ins.IMS_Shipments_11 +=dc.IMS_Shipments_11__c;
|
}
|
if (dc.IMS_Shipments_10__c !=null) {
|
ins.IMS_Shipments_10 += dc.IMS_Shipments_10__c ;
|
}
|
if (dc.IMS_Shipments_2__c !=null) {
|
ins.IMS_Shipments_2 +=dc.IMS_Shipments_2__c;
|
}
|
if (dc.IMS_Shipments_3__c !=null) {
|
ins.IMS_Shipments_3 +=dc.IMS_Shipments_3__c;
|
}
|
if (dc.IMS_Shipments_4__c !=null) {
|
ins.IMS_Shipments_4 +=dc.IMS_Shipments_4__c;
|
}
|
if (dc.IMS_Shipments_5__c !=null) {
|
ins.IMS_Shipments_5 +=dc.IMS_Shipments_5__c;
|
}
|
if (dc.IMS_Shipments_6__c !=null) {
|
ins.IMS_Shipments_6 +=dc.IMS_Shipments_6__c;
|
}
|
if (dc.IMS_Shipments_7__c !=null) {
|
ins.IMS_Shipments_7 +=dc.IMS_Shipments_7__c;
|
}
|
if (dc.IMS_Shipments_8__c !=null) {
|
ins.IMS_Shipments_8 +=dc.IMS_Shipments_8__c;
|
}
|
if (dc.IMS_Shipments_9__c !=null) {
|
ins.IMS_Shipments_9 +=dc.IMS_Shipments_9__c;
|
}
|
if (dc.IMS_Shipments_12__c !=null) {
|
ins.IMS_Shipments_12 +=dc.IMS_Shipments_12__c;
|
}
|
|
if (dc.IMS_Prediction_1__c !=null) {
|
ins.IMS_Prediction_1 += dc.IMS_Prediction_1__c;
|
}
|
if (dc.IMS_Prediction_11__c !=null){
|
ins.IMS_Prediction_11 +=dc.IMS_Prediction_11__c;
|
}
|
if (dc.IMS_Prediction_10__c !=null) {
|
ins.IMS_Prediction_10 += dc.IMS_Prediction_10__c ;
|
}
|
if (dc.IMS_Prediction_2__c !=null) {
|
ins.IMS_Prediction_2 +=dc.IMS_Prediction_2__c;
|
}
|
if (dc.IMS_Prediction_3__c !=null) {
|
ins.IMS_Prediction_3 +=dc.IMS_Prediction_3__c;
|
}
|
if (dc.IMS_Prediction_4__c !=null) {
|
ins.IMS_Prediction_4 +=dc.IMS_Prediction_4__c;
|
}
|
if (dc.IMS_Prediction_5__c !=null) {
|
ins.IMS_Prediction_5 +=dc.IMS_Prediction_5__c;
|
}
|
if (dc.IMS_Prediction_6__c !=null) {
|
ins.IMS_Prediction_6 +=dc.IMS_Prediction_6__c;
|
}
|
if (dc.IMS_Prediction_7__c !=null) {
|
ins.IMS_Prediction_7 +=dc.IMS_Prediction_7__c;
|
}
|
if (dc.IMS_Prediction_8__c !=null) {
|
ins.IMS_Prediction_8 +=dc.IMS_Prediction_8__c;
|
}
|
if (dc.IMS_Prediction_9__c !=null) {
|
ins.IMS_Prediction_9 +=dc.IMS_Prediction_9__c;
|
}
|
if (dc.IMS_Prediction_12__c !=null) {
|
ins.IMS_Prediction_12 +=dc.IMS_Prediction_12__c;
|
}
|
|
|
if (dc.StockAmount_1__c !=null) {
|
ins.StockAmount_1 += dc.StockAmount_1__c;
|
}
|
if (dc.StockAmount_11__c !=null){
|
ins.StockAmount_11 +=dc.StockAmount_11__c;
|
}
|
if (dc.StockAmount_10__c !=null) {
|
ins.StockAmount_10 += dc.StockAmount_10__c ;
|
}
|
if (dc.StockAmount_2__c !=null) {
|
ins.StockAmount_2 +=dc.StockAmount_2__c;
|
}
|
if (dc.StockAmount_3__c !=null) {
|
ins.StockAmount_3 +=dc.StockAmount_3__c;
|
}
|
if (dc.StockAmount_4__c !=null) {
|
ins.StockAmount_4 +=dc.StockAmount_4__c;
|
}
|
if (dc.StockAmount_5__c !=null) {
|
ins.StockAmount_5 +=dc.StockAmount_5__c;
|
}
|
if (dc.StockAmount_6__c !=null) {
|
ins.StockAmount_6 +=dc.StockAmount_6__c;
|
}
|
if (dc.StockAmount_7__c !=null) {
|
ins.StockAmount_7 +=dc.StockAmount_7__c;
|
}
|
if (dc.StockAmount_8__c !=null) {
|
ins.StockAmount_8 +=dc.StockAmount_8__c;
|
}
|
if (dc.StockAmount_9__c !=null) {
|
ins.StockAmount_9 +=dc.StockAmount_9__c;
|
}
|
if (dc.StockAmount_12__c !=null) {
|
ins.StockAmount_12 +=dc.StockAmount_12__c;
|
}
|
|
if (dc.TMS_PredictionFulfillment_1__c !=null) {
|
ins.TMS_PredictionFulfillment_1 += dc.TMS_PredictionFulfillment_1__c;
|
}
|
if (dc.TMS_PredictionFulfillment_11__c !=null){
|
ins.TMS_PredictionFulfillment_11 +=dc.TMS_PredictionFulfillment_11__c;
|
}
|
if (dc.TMS_PredictionFulfillment_10__c !=null) {
|
ins.TMS_PredictionFulfillment_10 += dc.TMS_PredictionFulfillment_10__c ;
|
}
|
if (dc.TMS_PredictionFulfillment_2__c !=null) {
|
ins.TMS_PredictionFulfillment_2 +=dc.TMS_PredictionFulfillment_2__c;
|
}
|
if (dc.TMS_PredictionFulfillment_3__c !=null) {
|
ins.TMS_PredictionFulfillment_3 +=dc.TMS_PredictionFulfillment_3__c;
|
}
|
if (dc.TMS_PredictionFulfillment_4__c !=null) {
|
ins.TMS_PredictionFulfillment_4 +=dc.TMS_PredictionFulfillment_4__c;
|
}
|
if (dc.TMS_PredictionFulfillment_5__c !=null) {
|
ins.TMS_PredictionFulfillment_5 +=dc.TMS_PredictionFulfillment_5__c;
|
}
|
if (dc.TMS_PredictionFulfillment_6__c !=null) {
|
ins.TMS_PredictionFulfillment_6 +=dc.TMS_PredictionFulfillment_6__c;
|
}
|
if (dc.TMS_PredictionFulfillment_7__c !=null) {
|
ins.TMS_PredictionFulfillment_7 +=dc.TMS_PredictionFulfillment_7__c;
|
}
|
if (dc.TMS_PredictionFulfillment_8__c !=null) {
|
ins.TMS_PredictionFulfillment_8 +=dc.TMS_PredictionFulfillment_8__c;
|
}
|
if (dc.TMS_PredictionFulfillment_9__c !=null) {
|
ins.TMS_PredictionFulfillment_9 +=dc.TMS_PredictionFulfillment_9__c;
|
}
|
if (dc.TMS_PredictionFulfillment_12__c !=null) {
|
ins.TMS_PredictionFulfillment_12 +=dc.TMS_PredictionFulfillment_12__c;
|
}
|
|
}
|
ins.annual_4 = ins.FY_BO_1+ins.FY_BO_2+ins.FY_BO_3+ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8+ins.FY_BO_9+ins.FY_BO_10+ins.FY_BO_11+ins.FY_BO_12;
|
ins.annual_2 = ins.FY_O_1+ins.FY_O_2+ins.FY_O_3+ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8+ins.FY_O_9+ins.FY_O_10+ins.FY_O_11+ins.FY_O_12;
|
ins.annual_22 = ins.StockAmount_1+ins.StockAmount_2+ins.StockAmount_3+ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8+ins.StockAmount_9+ins.StockAmount_10+ins.StockAmount_11+ins.StockAmount_12;
|
ins.annual_1 = ins.FY_P_1+ins.FY_P_2+ins.FY_P_3+ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8+ins.FY_P_9+ins.FY_P_10+ins.FY_P_11+ins.FY_P_12;
|
ins.annual_3 = ins.FY_S_1+ins.FY_S_2+ins.FY_S_3+ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8+ins.FY_S_9+ins.FY_S_10+ins.FY_S_11+ins.FY_S_12;
|
ins.annual_5 = ins.FY_I_1+ins.FY_I_2+ins.FY_I_3+ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8+ins.FY_I_9+ins.FY_I_10+ins.FY_I_11+ins.FY_I_12;
|
ins.annual_14 = ins.TMS_Unpaid_amount_1+ins.TMS_Unpaid_amount_2+ins.TMS_Unpaid_amount_3+ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8+ins.TMS_Unpaid_amount_9+ins.TMS_Unpaid_amount_10+ins.TMS_Unpaid_amount_11+ins.TMS_Unpaid_amount_12;
|
if (ins.annual_1 !=0) {
|
ins.annual_6 = ((ins.annual_3/ins.annual_1)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_1 !=0) {
|
ins.FY_SP_1 = ((ins.FY_S_1/ins.FY_P_1)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_11 !=0) {
|
ins.FY_SP_11 = ((ins.FY_S_11/ins.FY_P_11)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_12 !=0) {
|
ins.FY_SP_12 = ((ins.FY_S_12/ins.FY_P_12)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_2 !=0) {
|
ins.FY_SP_2 = ((ins.FY_S_2/ins.FY_P_2)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_3 !=0) {
|
ins.FY_SP_3 = ((ins.FY_S_3/ins.FY_P_3)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_4 !=0) {
|
ins.FY_SP_4 = ((ins.FY_S_4/ins.FY_P_4)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_5 !=0) {
|
ins.FY_SP_5 = ((ins.FY_S_5/ins.FY_P_5)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_6 !=0) {
|
ins.FY_SP_6 = ((ins.FY_S_6/ins.FY_P_6)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_7 !=0) {
|
ins.FY_SP_7 = ((ins.FY_S_7/ins.FY_P_7)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_8 !=0) {
|
ins.FY_SP_8 = ((ins.FY_S_8/ins.FY_P_8)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_9 !=0) {
|
ins.FY_SP_9 = ((ins.FY_S_9/ins.FY_P_9)*100).setScale(0)+'%';
|
}
|
if (ins.FY_P_10 !=0) {
|
ins.FY_SP_10 = ((ins.FY_S_10/ins.FY_P_10)*100).setScale(0)+'%';
|
}
|
// 待修改
|
ins.FY_TI_1 = ins.FY_S_1-ins.IMS_Shipments_1;
|
ins.FY_TI_2 = ins.FY_S_2-ins.IMS_Shipments_2;
|
ins.FY_TI_3 = ins.FY_S_3-ins.IMS_Shipments_3;
|
ins.FY_TI_4 = ins.FY_S_4-ins.IMS_Shipments_4;
|
ins.FY_TI_5 = ins.FY_S_5-ins.IMS_Shipments_5;
|
ins.FY_TI_6 = ins.FY_S_6-ins.IMS_Shipments_6;
|
ins.FY_TI_7 = ins.FY_S_7-ins.IMS_Shipments_7;
|
ins.FY_TI_8 = ins.FY_S_8-ins.IMS_Shipments_8;
|
ins.FY_TI_9 = ins.FY_S_9-ins.IMS_Shipments_9;
|
ins.FY_TI_10 = ins.FY_S_10-ins.IMS_Shipments_10;
|
ins.FY_TI_11 = ins.FY_S_11-ins.IMS_Shipments_11;
|
ins.FY_TI_12 = ins.FY_S_12-ins.IMS_Shipments_12;
|
ins.annual_8 = ins.FY_TI_1+ins.FY_TI_2+ins.FY_TI_3+ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8+ins.FY_TI_9+ins.FY_TI_10+ins.FY_TI_11+ins.FY_TI_12;
|
ins.annual_11 = ins.TMS_PredictionFulfillment_1+ins.TMS_PredictionFulfillment_2+ins.TMS_PredictionFulfillment_3+ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8+ins.TMS_PredictionFulfillment_9+ins.TMS_PredictionFulfillment_10+ins.TMS_PredictionFulfillment_11+ins.TMS_PredictionFulfillment_12;
|
ins.annual_9 = ins.IMS_Prediction_1+ins.IMS_Prediction_2+ins.IMS_Prediction_3+ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8+ins.IMS_Prediction_9+ins.IMS_Prediction_10+ins.IMS_Prediction_11+ins.IMS_Prediction_12;
|
ins.annual_7 = ins.IMS_Shipments_1+ins.IMS_Shipments_2+ins.IMS_Shipments_3+ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8+ins.IMS_Shipments_9+ins.IMS_Shipments_10+ins.IMS_Shipments_11+ins.IMS_Shipments_12;
|
ins.annual_10 = ins.TMS_Prediction_1+ins.TMS_Prediction_2+ins.TMS_Prediction_3+ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8+ins.TMS_Prediction_9+ins.TMS_Prediction_10+ins.TMS_Prediction_11+ins.TMS_Prediction_12;
|
if (monthNum == 1 || Test.isRunningTest()) {
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8+ins.IMS_Shipments_9+ins.IMS_Shipments_10+ins.IMS_Shipments_11+ins.IMS_Shipments_12;
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8+ins.FY_BO_9+ins.FY_BO_10+ins.FY_BO_11+ins.FY_BO_12;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8+ins.FY_P_9+ins.FY_P_10+ins.FY_P_11+ins.FY_P_12;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8+ins.TMS_PredictionFulfillment_9+ins.TMS_PredictionFulfillment_10+ins.TMS_PredictionFulfillment_11+ins.TMS_PredictionFulfillment_12;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8+ins.FY_O_9+ins.FY_O_10+ins.FY_O_11+ins.FY_O_12;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8+ins.StockAmount_9+ins.StockAmount_10+ins.StockAmount_11+ins.StockAmount_12;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8+ins.FY_S_9+ins.FY_S_10+ins.FY_S_11+ins.FY_S_12;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8+ins.FY_I_9+ins.FY_I_10+ins.FY_I_11+ins.FY_I_12;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8+ins.FY_TI_9+ins.FY_TI_10+ins.FY_TI_11+ins.FY_TI_12;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8+ins.IMS_Prediction_9+ins.IMS_Prediction_10+ins.IMS_Prediction_11+ins.IMS_Prediction_12;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8+ins.TMS_Prediction_9+ins.TMS_Prediction_10+ins.TMS_Prediction_11+ins.TMS_Prediction_12;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8+ins.TMS_Unpaid_amount_9+ins.TMS_Unpaid_amount_10+ins.TMS_Unpaid_amount_11+ins.TMS_Unpaid_amount_12;
|
ins.threemonthAug = (ins.FY_I_2+ins.FY_I_3+ins.FY_I_4)/3;
|
} if(monthNum == 2 || Test.isRunningTest()){
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8+ins.IMS_Shipments_9+ins.IMS_Shipments_10+ins.IMS_Shipments_11+ins.IMS_Shipments_12+ins.IMS_Shipments_1;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8+ins.StockAmount_9+ins.StockAmount_10+ins.StockAmount_11+ins.StockAmount_12+ins.StockAmount_1;
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8+ins.FY_BO_9+ins.FY_BO_10+ins.FY_BO_11+ins.FY_BO_12+ins.FY_BO_1;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8+ins.FY_P_9+ins.FY_P_10+ins.FY_P_11+ins.FY_P_12+ins.FY_P_1;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8+ins.TMS_PredictionFulfillment_9+ins.TMS_PredictionFulfillment_10+ins.TMS_PredictionFulfillment_11+ins.TMS_PredictionFulfillment_12+ins.TMS_PredictionFulfillment_1;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8+ins.FY_O_9+ins.FY_O_10+ins.FY_O_11+ins.FY_O_12+ins.FY_O_1;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8+ins.FY_S_9+ins.FY_S_10+ins.FY_S_11+ins.FY_S_12+ins.FY_S_1;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8+ins.FY_I_9+ins.FY_I_10+ins.FY_I_11+ins.FY_I_12+ins.FY_I_1;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8+ins.FY_TI_9+ins.FY_TI_10+ins.FY_TI_11+ins.FY_TI_12+ins.FY_TI_1;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8+ins.IMS_Prediction_9+ins.IMS_Prediction_10+ins.IMS_Prediction_11+ins.IMS_Prediction_12+ins.IMS_Prediction_1;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8+ins.TMS_Prediction_9+ins.TMS_Prediction_10+ins.TMS_Prediction_11+ins.TMS_Prediction_12+ins.TMS_Prediction_1;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8+ins.TMS_Unpaid_amount_9+ins.TMS_Unpaid_amount_10+ins.TMS_Unpaid_amount_11+ins.TMS_Unpaid_amount_12+ins.TMS_Unpaid_amount_1;
|
ins.threemonthAug = (ins.FY_I_5+ins.FY_I_3+ins.FY_I_4)/3;
|
} if(monthNum == 3 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8+ins.FY_BO_9+ins.FY_BO_10+ins.FY_BO_11+ins.FY_BO_12+ins.FY_BO_1+ins.FY_BO_2+ins.FY_BO_3;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8+ins.FY_P_9+ins.FY_P_10+ins.FY_P_11+ins.FY_P_12+ins.FY_P_1+ins.FY_P_2+ins.FY_P_3;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8+ins.FY_O_9+ins.FY_O_10+ins.FY_O_11+ins.FY_O_12+ins.FY_O_1+ins.FY_O_2+ins.FY_O_3;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8+ins.FY_S_9+ins.FY_S_10+ins.FY_S_11+ins.FY_S_12+ins.FY_S_1+ins.FY_S_2+ins.FY_S_3;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8+ins.FY_I_9+ins.FY_I_10+ins.FY_I_11+ins.FY_I_12+ins.FY_I_1+ins.FY_I_2+ins.FY_I_3;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8+ins.FY_TI_9+ins.FY_TI_10+ins.FY_TI_11+ins.FY_TI_12+ins.FY_TI_1+ins.FY_TI_2+ins.FY_TI_3;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8+ins.TMS_PredictionFulfillment_9+ins.TMS_PredictionFulfillment_10+ins.TMS_PredictionFulfillment_11+ins.TMS_PredictionFulfillment_12+ins.TMS_PredictionFulfillment_1+ins.TMS_PredictionFulfillment_2+ins.TMS_PredictionFulfillment_3;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8+ins.IMS_Prediction_9+ins.IMS_Prediction_10+ins.IMS_Prediction_11+ins.IMS_Prediction_12+ins.IMS_Prediction_1+ins.IMS_Prediction_2+ins.IMS_Prediction_3;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8+ins.TMS_Prediction_9+ins.TMS_Prediction_10+ins.TMS_Prediction_11+ins.TMS_Prediction_12+ins.TMS_Prediction_1+ins.TMS_Prediction_2+ins.TMS_Prediction_3;
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8+ins.IMS_Shipments_9+ins.IMS_Shipments_10+ins.IMS_Shipments_11+ins.IMS_Shipments_12+ins.IMS_Shipments_1+ins.IMS_Shipments_2+ins.IMS_Shipments_3;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8+ins.StockAmount_9+ins.StockAmount_10+ins.StockAmount_11+ins.StockAmount_12+ins.StockAmount_1+ins.StockAmount_2+ins.StockAmount_3;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8+ins.TMS_Unpaid_amount_9+ins.TMS_Unpaid_amount_10+ins.TMS_Unpaid_amount_11+ins.TMS_Unpaid_amount_12+ins.TMS_Unpaid_amount_1+ins.TMS_Unpaid_amount_2+ins.TMS_Unpaid_amount_3;
|
ins.threemonthAug = (ins.FY_I_5+ins.FY_I_6+ins.FY_I_4)/3;
|
} if(monthNum == 4 || Test.isRunningTest()){
|
ins.YTDTotal4 = 0;
|
ins.YTDTotal1 = 0;
|
ins.YTDTotal2 = 0;
|
ins.YTDTotal22 = 0;
|
ins.YTDTotal3 = 0;
|
ins.YTDTotal5 = 0;
|
ins.YTDTotal8 = 0;
|
ins.YTDTotal7 = 0;
|
ins.YTDTotal9 = 0;
|
ins.YTDTotal10 = 0;
|
ins.YTDTotal14 = 0;
|
ins.YTDTotal11 = 0;
|
ins.threemonthAug = (ins.FY_I_5+ins.FY_I_6+ins.FY_I_7)/3;
|
} if(monthNum == 5 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4;
|
ins.YTDTotal1 = ins.FY_P_4;
|
ins.YTDTotal2 = ins.FY_O_4;
|
ins.YTDTotal22 = ins.StockAmount_4;
|
ins.YTDTotal3 = ins.FY_S_4;
|
ins.YTDTotal5 = ins.FY_I_4;
|
ins.YTDTotal8 = ins.FY_TI_4;
|
ins.YTDTotal7 = ins.IMS_Shipments_4;
|
ins.YTDTotal9 = ins.IMS_Prediction_4;
|
ins.YTDTotal10 = ins.TMS_Prediction_4;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4;
|
ins.threemonthAug = (ins.FY_I_8+ins.FY_I_6+ins.FY_I_7)/3;
|
} if(monthNum == 6 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5;
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5;
|
ins.threemonthAug = (ins.FY_I_8+ins.FY_I_9+ins.FY_I_7)/3;
|
} if(monthNum == 7 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6;
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6;
|
ins.threemonthAug = (ins.FY_I_8+ins.FY_I_9+ins.FY_I_10)/3;
|
} if(monthNum == 8 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7;
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7;
|
ins.threemonthAug = (ins.FY_I_11+ins.FY_I_9+ins.FY_I_10)/3;
|
} if(monthNum == 9 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8;
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8;
|
ins.threemonthAug = (ins.FY_I_11+ins.FY_I_12+ins.FY_I_10)/3;
|
} if(monthNum == 10 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8+ins.FY_BO_9;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8+ins.FY_P_9;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8+ins.FY_O_9;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8+ins.StockAmount_9;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8+ins.FY_S_9;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8+ins.FY_I_9;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8+ins.FY_TI_9;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8+ins.IMS_Prediction_9;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8+ins.TMS_Prediction_9;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8+ins.TMS_PredictionFulfillment_9;
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8+ins.IMS_Shipments_9;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8+ins.TMS_Unpaid_amount_9;
|
ins.threemonthAug = (ins.FY_I_11+ins.FY_I_12+ins.FY_I_1)/3;
|
} if(monthNum == 11 || Test.isRunningTest()){
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8+ins.FY_BO_9+ins.FY_BO_10;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8+ins.FY_P_9+ins.FY_P_10;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8+ins.FY_O_9+ins.FY_O_10;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8+ins.StockAmount_9+ins.StockAmount_10;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8+ins.FY_S_9+ins.FY_S_10;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8+ins.FY_I_9+ins.FY_I_10;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8+ins.FY_TI_9+ins.FY_TI_10;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8+ins.TMS_PredictionFulfillment_9+ins.TMS_PredictionFulfillment_10;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8+ins.IMS_Prediction_9+ins.IMS_Prediction_10;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8+ins.TMS_Prediction_9+ins.TMS_Prediction_10;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8+ins.TMS_Unpaid_amount_9+ins.TMS_Unpaid_amount_10;
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8+ins.IMS_Shipments_9+ins.IMS_Shipments_10;
|
|
ins.threemonthAug = (ins.FY_I_1+ins.FY_I_12+ins.FY_I_2)/3;
|
} if(monthNum == 12 || Test.isRunningTest()){
|
ins.YTDTotal7 = ins.IMS_Shipments_4+ins.IMS_Shipments_5+ins.IMS_Shipments_6+ins.IMS_Shipments_7+ins.IMS_Shipments_8+ins.IMS_Shipments_9+ins.IMS_Shipments_10+ins.IMS_Shipments_11;
|
ins.YTDTotal4 = ins.FY_BO_4+ins.FY_BO_5+ins.FY_BO_6+ins.FY_BO_7+ins.FY_BO_8+ins.FY_BO_9+ins.FY_BO_10+ins.FY_BO_11;
|
ins.YTDTotal1 = ins.FY_P_4+ins.FY_P_5+ins.FY_P_6+ins.FY_P_7+ins.FY_P_8+ins.FY_P_9+ins.FY_P_10+ins.FY_P_11;
|
ins.YTDTotal2 = ins.FY_O_4+ins.FY_O_5+ins.FY_O_6+ins.FY_O_7+ins.FY_O_8+ins.FY_O_9+ins.FY_O_10+ins.FY_O_11;
|
ins.YTDTotal22 = ins.StockAmount_4+ins.StockAmount_5+ins.StockAmount_6+ins.StockAmount_7+ins.StockAmount_8+ins.StockAmount_9+ins.StockAmount_10+ins.StockAmount_11;
|
ins.YTDTotal3 = ins.FY_S_4+ins.FY_S_5+ins.FY_S_6+ins.FY_S_7+ins.FY_S_8+ins.FY_S_9+ins.FY_S_10+ins.FY_S_11;
|
ins.YTDTotal5 = ins.FY_I_4+ins.FY_I_5+ins.FY_I_6+ins.FY_I_7+ins.FY_I_8+ins.FY_I_9+ins.FY_I_10+ins.FY_I_11;
|
ins.YTDTotal11 = ins.TMS_PredictionFulfillment_4+ins.TMS_PredictionFulfillment_5+ins.TMS_PredictionFulfillment_6+ins.TMS_PredictionFulfillment_7+ins.TMS_PredictionFulfillment_8+ins.TMS_PredictionFulfillment_9+ins.TMS_PredictionFulfillment_10+ins.TMS_PredictionFulfillment_11;
|
ins.YTDTotal8 = ins.FY_TI_4+ins.FY_TI_5+ins.FY_TI_6+ins.FY_TI_7+ins.FY_TI_8+ins.FY_TI_9+ins.FY_TI_10+ins.FY_TI_11;
|
ins.YTDTotal9 = ins.IMS_Prediction_4+ins.IMS_Prediction_5+ins.IMS_Prediction_6+ins.IMS_Prediction_7+ins.IMS_Prediction_8+ins.IMS_Prediction_9+ins.IMS_Prediction_10+ins.IMS_Prediction_11;
|
ins.YTDTotal10 = ins.TMS_Prediction_4+ins.TMS_Prediction_5+ins.TMS_Prediction_6+ins.TMS_Prediction_7+ins.TMS_Prediction_8+ins.TMS_Prediction_9+ins.TMS_Prediction_10+ins.TMS_Prediction_11;
|
ins.YTDTotal14 = ins.TMS_Unpaid_amount_4+ins.TMS_Unpaid_amount_5+ins.TMS_Unpaid_amount_6+ins.TMS_Unpaid_amount_7+ins.TMS_Unpaid_amount_8+ins.TMS_Unpaid_amount_9+ins.TMS_Unpaid_amount_10+ins.TMS_Unpaid_amount_11;
|
ins.threemonthAug = (ins.FY_I_1+ins.FY_I_3+ins.FY_I_2)/3;
|
}
|
|
|
if (ins.YTDTotal1 !=0) {
|
ins.YTDTotal6 = ((ins.YTDTotal3/ins.YTDTotal1)*100).setScale(0)+'%';
|
}
|
|
ins.YTDTotal7 = ins.YTDTotal7.setScale(0);
|
ins.YTDTotal4 = ins.YTDTotal4.setScale(0);
|
ins.YTDTotal1 = ins.YTDTotal1.setScale(0);
|
ins.YTDTotal2 = ins.YTDTotal2.setScale(0);
|
ins.YTDTotal22 = ins.YTDTotal22.setScale(0);
|
ins.YTDTotal3 = ins.YTDTotal3.setScale(0);
|
ins.YTDTotal5 = ins.YTDTotal5.setScale(0);
|
ins.YTDTotal11 = ins.YTDTotal11.setScale(0);
|
ins.YTDTotal8 = ins.YTDTotal8.setScale(0);
|
ins.YTDTotal9 = ins.YTDTotal9.setScale(0);
|
ins.YTDTotal10 = ins.YTDTotal10.setScale(0);
|
ins.YTDTotal14 = ins.YTDTotal14.setScale(0);
|
|
ins.FY_TI_1 = ins.FY_TI_1.setScale(0);
|
ins.FY_TI_10 = ins.FY_TI_10.setScale(0);
|
ins.FY_TI_11 = ins.FY_TI_11.setScale(0);
|
ins.FY_TI_12 = ins.FY_TI_12.setScale(0);
|
ins.FY_TI_2 = ins.FY_TI_2.setScale(0);
|
ins.FY_TI_3 = ins.FY_TI_3.setScale(0);
|
ins.FY_TI_4 = ins.FY_TI_4.setScale(0);
|
ins.FY_TI_5 = ins.FY_TI_5.setScale(0);
|
ins.FY_TI_6 = ins.FY_TI_6.setScale(0);
|
ins.FY_TI_7 = ins.FY_TI_7.setScale(0);
|
ins.FY_TI_8 = ins.FY_TI_8.setScale(0);
|
ins.FY_TI_9 = ins.FY_TI_9.setScale(0);
|
|
ins.FY_O_1 = ins.FY_O_1.setScale(0);
|
ins.FY_O_10 = ins.FY_O_10.setScale(0);
|
ins.FY_O_11 = ins.FY_O_11.setScale(0);
|
ins.FY_O_12 = ins.FY_O_12.setScale(0);
|
ins.FY_O_2 = ins.FY_O_2.setScale(0);
|
ins.FY_O_3 = ins.FY_O_3.setScale(0);
|
ins.FY_O_4 = ins.FY_O_4.setScale(0);
|
ins.FY_O_5 = ins.FY_O_5.setScale(0);
|
ins.FY_O_6 = ins.FY_O_6.setScale(0);
|
ins.FY_O_7 = ins.FY_O_7.setScale(0);
|
ins.FY_O_8 = ins.FY_O_8.setScale(0);
|
ins.FY_O_9 = ins.FY_O_9.setScale(0);
|
|
ins.FY_P_1 = ins.FY_P_1.setScale(0);
|
ins.FY_P_10 = ins.FY_P_10.setScale(0);
|
ins.FY_P_11 = ins.FY_P_11.setScale(0);
|
ins.FY_P_12 = ins.FY_P_12.setScale(0);
|
ins.FY_P_2 = ins.FY_P_2.setScale(0);
|
ins.FY_P_3 = ins.FY_P_3.setScale(0);
|
ins.FY_P_4 = ins.FY_P_4.setScale(0);
|
ins.FY_P_5 = ins.FY_P_5.setScale(0);
|
ins.FY_P_6 = ins.FY_P_6.setScale(0);
|
ins.FY_P_7 = ins.FY_P_7.setScale(0);
|
ins.FY_P_8 = ins.FY_P_8.setScale(0);
|
ins.FY_P_9 = ins.FY_P_9.setScale(0);
|
|
ins.FY_S_1 = ins.FY_S_1.setScale(0);
|
ins.FY_S_10 = ins.FY_S_10.setScale(0);
|
ins.FY_S_11 = ins.FY_S_11.setScale(0);
|
ins.FY_S_12 = ins.FY_S_12.setScale(0);
|
ins.FY_S_2 = ins.FY_S_2.setScale(0);
|
ins.FY_S_3 = ins.FY_S_3.setScale(0);
|
ins.FY_S_4 = ins.FY_S_4.setScale(0);
|
ins.FY_S_5 = ins.FY_S_5.setScale(0);
|
ins.FY_S_6 = ins.FY_S_6.setScale(0);
|
ins.FY_S_7 = ins.FY_S_7.setScale(0);
|
ins.FY_S_8 = ins.FY_S_8.setScale(0);
|
ins.FY_S_9 = ins.FY_S_9.setScale(0);
|
|
ins.FY_BO_1 = ins.FY_BO_1.setScale(0);
|
ins.FY_BO_10 = ins.FY_BO_10.setScale(0);
|
ins.FY_BO_11 = ins.FY_BO_11.setScale(0);
|
ins.FY_BO_12 = ins.FY_BO_12.setScale(0);
|
ins.FY_BO_2 = ins.FY_BO_2.setScale(0);
|
ins.FY_BO_3 = ins.FY_BO_3.setScale(0);
|
ins.FY_BO_4 = ins.FY_BO_4.setScale(0);
|
ins.FY_BO_5 = ins.FY_BO_5.setScale(0);
|
ins.FY_BO_6 = ins.FY_BO_6.setScale(0);
|
ins.FY_BO_7 = ins.FY_BO_7.setScale(0);
|
ins.FY_BO_8 = ins.FY_BO_8.setScale(0);
|
ins.FY_BO_9 = ins.FY_BO_9.setScale(0);
|
|
ins.FY_I_1 = ins.FY_I_1.setScale(0);
|
ins.FY_I_10 = ins.FY_I_10.setScale(0);
|
ins.FY_I_11 = ins.FY_I_11.setScale(0);
|
ins.FY_I_12 = ins.FY_I_12.setScale(0);
|
ins.FY_I_2 = ins.FY_I_2.setScale(0);
|
ins.FY_I_3 = ins.FY_I_3.setScale(0);
|
ins.FY_I_4 = ins.FY_I_4.setScale(0);
|
ins.FY_I_5 = ins.FY_I_5.setScale(0);
|
ins.FY_I_6 = ins.FY_I_6.setScale(0);
|
ins.FY_I_7 = ins.FY_I_7.setScale(0);
|
ins.FY_I_8 = ins.FY_I_8.setScale(0);
|
ins.FY_I_9 = ins.FY_I_9.setScale(0);
|
|
ins.IMS_Shipments_1 = ins.IMS_Shipments_1.setScale(0);
|
ins.IMS_Shipments_10 = ins.IMS_Shipments_10.setScale(0);
|
ins.IMS_Shipments_11 = ins.IMS_Shipments_11.setScale(0);
|
ins.IMS_Shipments_12 = ins.IMS_Shipments_12.setScale(0);
|
ins.IMS_Shipments_2 = ins.IMS_Shipments_2.setScale(0);
|
ins.IMS_Shipments_3 = ins.IMS_Shipments_3.setScale(0);
|
ins.IMS_Shipments_4 = ins.IMS_Shipments_4.setScale(0);
|
ins.IMS_Shipments_5 = ins.IMS_Shipments_5.setScale(0);
|
ins.IMS_Shipments_6 = ins.IMS_Shipments_6.setScale(0);
|
ins.IMS_Shipments_7 = ins.IMS_Shipments_7.setScale(0);
|
ins.IMS_Shipments_8 = ins.IMS_Shipments_8.setScale(0);
|
ins.IMS_Shipments_9 = ins.IMS_Shipments_9.setScale(0);
|
|
ins.TMS_Unpaid_amount_1 = ins.TMS_Unpaid_amount_1.setScale(0);
|
ins.TMS_Unpaid_amount_10 = ins.TMS_Unpaid_amount_10.setScale(0);
|
ins.TMS_Unpaid_amount_11 = ins.TMS_Unpaid_amount_11.setScale(0);
|
ins.TMS_Unpaid_amount_12 = ins.TMS_Unpaid_amount_12.setScale(0);
|
ins.TMS_Unpaid_amount_2 = ins.TMS_Unpaid_amount_2.setScale(0);
|
ins.TMS_Unpaid_amount_3 = ins.TMS_Unpaid_amount_3.setScale(0);
|
ins.TMS_Unpaid_amount_4 = ins.TMS_Unpaid_amount_4.setScale(0);
|
ins.TMS_Unpaid_amount_5 = ins.TMS_Unpaid_amount_5.setScale(0);
|
ins.TMS_Unpaid_amount_6 = ins.TMS_Unpaid_amount_6.setScale(0);
|
ins.TMS_Unpaid_amount_7 = ins.TMS_Unpaid_amount_7.setScale(0);
|
ins.TMS_Unpaid_amount_8 = ins.TMS_Unpaid_amount_8.setScale(0);
|
ins.TMS_Unpaid_amount_9 = ins.TMS_Unpaid_amount_9.setScale(0);
|
|
ins.TMS_PredictionFulfillment_1 = ins.TMS_PredictionFulfillment_1.setScale(0);
|
ins.TMS_PredictionFulfillment_10 = ins.TMS_PredictionFulfillment_10.setScale(0);
|
ins.TMS_PredictionFulfillment_11 = ins.TMS_PredictionFulfillment_11.setScale(0);
|
ins.TMS_PredictionFulfillment_12 = ins.TMS_PredictionFulfillment_12.setScale(0);
|
ins.TMS_PredictionFulfillment_2 = ins.TMS_PredictionFulfillment_2.setScale(0);
|
ins.TMS_PredictionFulfillment_3 = ins.TMS_PredictionFulfillment_3.setScale(0);
|
ins.TMS_PredictionFulfillment_4 = ins.TMS_PredictionFulfillment_4.setScale(0);
|
ins.TMS_PredictionFulfillment_5 = ins.TMS_PredictionFulfillment_5.setScale(0);
|
ins.TMS_PredictionFulfillment_6 = ins.TMS_PredictionFulfillment_6.setScale(0);
|
ins.TMS_PredictionFulfillment_7 = ins.TMS_PredictionFulfillment_7.setScale(0);
|
ins.TMS_PredictionFulfillment_8 = ins.TMS_PredictionFulfillment_8.setScale(0);
|
ins.TMS_PredictionFulfillment_9 = ins.TMS_PredictionFulfillment_9.setScale(0);
|
|
ins.StockAmount_1 = ins.StockAmount_1.setScale(0);
|
ins.StockAmount_10 = ins.StockAmount_10.setScale(0);
|
ins.StockAmount_11 = ins.StockAmount_11.setScale(0);
|
ins.StockAmount_12 = ins.StockAmount_12.setScale(0);
|
ins.StockAmount_2 = ins.StockAmount_2.setScale(0);
|
ins.StockAmount_3 = ins.StockAmount_3.setScale(0);
|
ins.StockAmount_4 = ins.StockAmount_4.setScale(0);
|
ins.StockAmount_5 = ins.StockAmount_5.setScale(0);
|
ins.StockAmount_6 = ins.StockAmount_6.setScale(0);
|
ins.StockAmount_7 = ins.StockAmount_7.setScale(0);
|
ins.StockAmount_8 = ins.StockAmount_8.setScale(0);
|
ins.StockAmount_9 = ins.StockAmount_9.setScale(0);
|
|
|
ins.annual_1= ins.annual_1.setScale(0);
|
|
ins.annual_2= ins.annual_2.setScale(0);
|
|
ins.annual_3= ins.annual_3.setScale(0);
|
|
ins.annual_4= ins.annual_4.setScale(0);
|
|
ins.annual_5= ins.annual_5.setScale(0);
|
|
ins.annual_8= ins.annual_8.setScale(0);
|
|
ins.annual_7= ins.annual_7.setScale(0);
|
|
ins.annual_9= ins.annual_9.setScale(0);
|
|
ins.annual_10= ins.annual_10.setScale(0);
|
|
|
|
system.debug('ins=='+ins);
|
return ins;
|
}
|
@AuraEnabled
|
public static List<InitDataUp> initData2 (String SalesdepartmentValue,String provinceValue,String City_MasterValue,String productTypeValue,String customerTypeValue,String fiscalYearValue,String Dealer_Name){
|
Map<String,InitDataUp> inslist = new Map<String,InitDataUp>();
|
Map<String,Integer> inslist2 = new Map<String,Integer>();
|
Map<String,Decimal> inslist3 = new Map<String,Decimal>();
|
Map<String,Decimal> inslist4 = new Map<String,Decimal>();
|
Date today = Date.today();
|
decimal totalNumberAll = 0;
|
decimal totalNumberAll2 = 0;
|
system.debug('provinceValue='+provinceValue);
|
Integer monthNum = Date.today().month();
|
String addName = '';
|
String agcName = '';
|
Date lastYearDate = Date.today().addYears(-1);
|
// String query = 'SELECT id,Current_FY_I__c,Current_Within1year__c,ConsumCategory3__c,ConsumCategory2_New__c,Category2__c '
|
// + ' FROM Dealer_ConsumableManage__c where id !=null ';
|
String query = 'SELECT id,Intra_Trade_List_RMB__c,Consumable_Category3__c,Consumable_Category2__c,Product_Type__c '
|
+ 'FROM Consumable_order_details2__c where id !=null and Inventory_Status__c = \'经销商库存\' ' ;
|
String query2 = 'SELECT id,Intra_Trade_List_RMB__c,Consumable_Category3__c,Consumable_Category2__c,Product_Type__c '
|
+ 'FROM Consumable_order_details2__c where id !=null and Inventory_Status__c = \'经销商库存\' and Deliver_date__c <= :today and Deliver_date__c >= :lastYearDate ' ;
|
|
String whereSql = '';
|
if(productTypeValue != null && productTypeValue != ''){
|
if (productTypeValue == 'ET耗材') {
|
whereSql += ' and Product_Type__c = \'ET\'';
|
}
|
if (productTypeValue == '外科耗材') {
|
whereSql += ' and Product_Type__c = \'ENG\'';
|
}
|
}
|
if(SalesdepartmentValue != null && SalesdepartmentValue !=''){
|
whereSql += 'and SalesDepartment_Dealer__c = ' + ' :SalesdepartmentValue ';
|
}
|
|
if(customerTypeValue != null && customerTypeValue != ''){
|
whereSql += ' and Consumable_Category3__c = '+' :customerTypeValue ';
|
}
|
|
if(Dealer_Name != null && Dealer_Name !=''){
|
// Account Agc = [select name from Account where Id = :Dealer_Name limit 1];
|
// if (Agc!=null) {
|
// agcname = Agc.name ;
|
whereSql += 'and Dealer_Info_ID__c = ' + ' :Dealer_Name ';
|
// }
|
}
|
// 省市查询条件待确认
|
if(provinceValue != null && provinceValue !='' && !Test.isRunningTest()){
|
whereSql += 'and Province_Account__c = ' + ' :provinceValue ';
|
}
|
// if(City_MasterValue != null && City_MasterValue !=''){
|
// whereSql += 'and City_Master__c = ' + ' :City_MasterValue ';
|
// }
|
if ((Dealer_Name == null || Dealer_Name == '') && SalesdepartmentValue== '') {
|
whereSql += ' limit 1000';
|
}
|
|
query += whereSql;
|
query2 += whereSql;
|
List<Consumable_order_details2__c> cl = new List<Consumable_order_details2__c>();
|
cl = Database.query(query);
|
if (cl.size() ==0) {
|
InitDataUp insUp = new InitDataUp();
|
inslist.put('1',insUp);
|
}
|
integer Num = 1;
|
for (Consumable_order_details2__c cod2: cl) {
|
InitDataUp insUp = new InitDataUp();
|
InitDataUp insUp2 = new InitDataUp();
|
InitDataUp insUp3 = new InitDataUp();
|
String codKey = cod2.Product_Type__c+':'+cod2.Consumable_Category2__c+':'+cod2.Consumable_Category3__c;
|
if (cod2.Intra_Trade_List_RMB__c !=null) {
|
if (!inslist.containsKey(codKey)) {
|
insUp.Category1 = cod2.Product_Type__c;
|
insUp.Category2 = cod2.Consumable_Category2__c;
|
insUp.Category3 = cod2.Consumable_Category3__c;
|
if (cod2.Intra_Trade_List_RMB__c !=null) {
|
insUp.Money = cod2.Intra_Trade_List_RMB__c.setScale(0);
|
}
|
inslist.put(codKey,insUp);
|
}else{
|
Decimal money1 = inslist.get(codKey).Money;
|
Decimal OneYearMoney1 = inslist.get(codKey).OneYearMoney;
|
insUp.Category1 = cod2.Product_Type__c;
|
insUp.Category2 = cod2.Consumable_Category2__c;
|
insUp.Category3 = cod2.Consumable_Category3__c;
|
insUp.OneYearMoney = OneYearMoney1;
|
if (cod2.Intra_Trade_List_RMB__c !=null) {
|
money1 += cod2.Intra_Trade_List_RMB__c.setScale(0);
|
}
|
insUp.Money = money1;
|
inslist.put(codKey,insUp);
|
}
|
|
if (!inslist2.containsKey(cod2.Consumable_Category2__c)) {
|
insUp2 = inslist.get(codKey);
|
insUp2.key = Num;
|
inslist.put(codKey,insUp2);
|
Num++;
|
inslist2.put(cod2.Consumable_Category2__c,Num);
|
}else{
|
insUp2 = inslist.get(codKey);
|
insUp2.key = inslist2.get(cod2.Consumable_Category2__c);
|
inslist.put(codKey,insUp2);
|
}
|
}
|
}
|
List<Consumable_order_details2__c> cl2 = new List<Consumable_order_details2__c>();
|
cl2 = Database.query(query2);
|
// 一年以内的
|
for (Consumable_order_details2__c cod2: cl2) {
|
InitDataUp insUp = new InitDataUp();
|
InitDataUp insUp2 = new InitDataUp();
|
String codKey = cod2.Product_Type__c+':'+cod2.Consumable_Category2__c+':'+cod2.Consumable_Category3__c;
|
if (cod2.Intra_Trade_List_RMB__c !=null) {
|
if (!inslist.containsKey(codKey)) {
|
insUp.Category1 = cod2.Product_Type__c;
|
insUp.Category2 = cod2.Consumable_Category2__c;
|
insUp.Category3 = cod2.Consumable_Category3__c;
|
insUp.OneYearMoney = cod2.Intra_Trade_List_RMB__c.setScale(0);
|
inslist.put(codKey,insUp);
|
}else{
|
insUp.Category1 = cod2.Product_Type__c;
|
insUp.Category2 = cod2.Consumable_Category2__c;
|
insUp.Category3 = cod2.Consumable_Category3__c;
|
Decimal money1 = inslist.get(codKey).OneYearMoney;
|
Decimal money2 = inslist.get(codKey).Money;
|
money1 += cod2.Intra_Trade_List_RMB__c.setScale(0);
|
insUp.OneYearMoney = money1;
|
insUp.Money = money2;
|
inslist.put(codKey,insUp);
|
}
|
if (!inslist2.containsKey(cod2.Consumable_Category2__c)) {
|
insUp2 = inslist.get(codKey);
|
insUp2.key = Num;
|
inslist.put(codKey,insUp2);
|
Num++;
|
inslist2.put(cod2.Consumable_Category2__c,Num);
|
}else{
|
insUp2 = inslist.get(codKey);
|
insUp2.key = inslist2.get(cod2.Consumable_Category2__c);
|
inslist.put(codKey,insUp2);
|
}
|
}
|
}
|
|
for ( InitDataUp ins: inslist.values()) {
|
if (!inslist3.containsKey(ins.Category2)) {
|
inslist3.put(ins.Category2,ins.Money);
|
}else{
|
Decimal num1 = inslist3.get(ins.Category2)+ins.Money;
|
inslist3.put(ins.Category2,num1);
|
}
|
if (!inslist4.containsKey(ins.Category2)) {
|
inslist4.put(ins.Category2,ins.OneYearMoney);
|
}else{
|
Decimal num1 = inslist4.get(ins.Category2)+ins.OneYearMoney;
|
inslist4.put(ins.Category2,num1);
|
}
|
|
if (ins.Money!=0 && ins.Money!=null) {
|
ins.healPercent = ((ins.OneYearMoney/ins.Money)*100).setScale(0)+'%';
|
}
|
totalNumberAll += ins.Money.setScale(0);
|
totalNumberAll2 += ins.OneYearMoney.setScale(0);
|
}
|
for (InitDataUp ins: inslist.values()) {
|
if (ins.Category2 !=null && inslist3.get(ins.Category2)!=null) {
|
ins.totalNumber = inslist3.get(ins.Category2).setScale(0);
|
}
|
if (ins.Category2 !=null && inslist4.get(ins.Category2)!=null) {
|
ins.totalNumberLast = inslist4.get(ins.Category2).setScale(0);
|
}
|
ins.totalNumberAll = totalNumberAll;
|
ins.totalNumberAll2 = totalNumberAll2;
|
}
|
|
for (InitDataUp ins: inslist.values()) {
|
ins.MoneyString = ins.Money.format();
|
ins.OneYearMoneyString = ins.OneYearMoney.format();
|
ins.totalNumberString = ins.totalNumber.format();
|
ins.totalNumberLastString = ins.totalNumberLast.format();
|
}
|
system.debug('inslist=='+inslist);
|
system.debug('inslist2=='+inslist2);
|
system.debug('inslist3=='+inslist3);
|
return inslist.values();
|
}
|
@AuraEnabled(cacheable=true)
|
public static User searchUser (){
|
String userId = UserInfo.getUserId();
|
String query = 'SELECT Id, Name,OCM_man_province__c,Salesdepartment__c FROM User WHERE Id = :userId LIMIT 1 ';
|
return Database.query(query);
|
}
|
@AuraEnabled()
|
public static String saveTms (List<String> savedataList,String Dealer_Name,String fiscalYearValue,String productTypeValue,String provinceValue){
|
String status = 'false';
|
List<Dealer_ConsumableManage__c> updateList = new List<Dealer_ConsumableManage__c>();
|
InitData ins = new InitData();
|
if(productTypeValue != null && productTypeValue != ''){
|
if (productTypeValue == 'ET耗材') {
|
productTypeValue = 'ET';
|
}
|
if (productTypeValue == '外科耗材') {
|
productTypeValue = 'ENG';
|
}
|
}
|
system.debug('savedataList='+savedataList);
|
List<Dealer_ConsumableManage__c> tmsList = [Select id ,IMS_Prediction_1__c,IMS_Prediction_2__c,IMS_Prediction_3__c,IMS_Prediction_4__c,IMS_Prediction_5__c,IMS_Prediction_6__c,IMS_Prediction_7__c,IMS_Prediction_8__c,IMS_Prediction_9__c,IMS_Prediction_10__c,IMS_Prediction_11__c,IMS_Prediction_12__c
|
,TMS_Prediction_1__c,TMS_Prediction_2__c,TMS_Prediction_3__c,TMS_Prediction_4__c,TMS_Prediction_5__c,TMS_Prediction_6__c,TMS_Prediction_7__c,TMS_Prediction_8__c,TMS_Prediction_9__c,TMS_Prediction_10__c,TMS_Prediction_11__c,TMS_Prediction_12__c
|
FROM Dealer_ConsumableManage__c
|
where FY__c = :fiscalYearValue and Dealer_Name__c = :Dealer_Name and ET_ENG__c=:productTypeValue and TMS_Province__c = :provinceValue];
|
|
for (String savedata:savedataList) {
|
String title = savedata.split('-')[0];
|
String name = savedata.split('-')[1];
|
String value = savedata.split('-')[2];
|
if (title =='TMS预测' ) {
|
if (name =='Apr') {
|
ins.TMS_Prediction_4 = Decimal.valueOf(value);
|
}
|
if (name =='May') {
|
ins.TMS_Prediction_5 = Decimal.valueOf(value);
|
}
|
if (name =='June') {
|
ins.TMS_Prediction_6 = Decimal.valueOf(value);
|
}
|
if (name =='July') {
|
ins.TMS_Prediction_7 = Decimal.valueOf(value);
|
}
|
if (name =='Aug') {
|
ins.TMS_Prediction_8 = Decimal.valueOf(value);
|
}
|
if (name =='Sept') {
|
ins.TMS_Prediction_9 = Decimal.valueOf(value);
|
}
|
if (name =='Oct') {
|
ins.TMS_Prediction_10 = Decimal.valueOf(value);
|
}
|
if (name =='Nov') {
|
ins.TMS_Prediction_11 = Decimal.valueOf(value);
|
}
|
if (name =='Dec') {
|
ins.TMS_Prediction_12 = Decimal.valueOf(value);
|
}
|
if (name =='Jan') {
|
ins.TMS_Prediction_1 = Decimal.valueOf(value);
|
}
|
if (name =='Feb') {
|
ins.TMS_Prediction_2 = Decimal.valueOf(value);
|
}
|
if (name =='Mar') {
|
ins.TMS_Prediction_3 = Decimal.valueOf(value);
|
}
|
}
|
if (title =='IMS预测' ) {
|
if (name =='Apr') {
|
ins.IMS_Prediction_4 = Decimal.valueOf(value);
|
}
|
if (name =='May') {
|
ins.IMS_Prediction_5 = Decimal.valueOf(value);
|
}
|
if (name =='June') {
|
ins.IMS_Prediction_6 = Decimal.valueOf(value);
|
}
|
if (name =='July') {
|
ins.IMS_Prediction_7 = Decimal.valueOf(value);
|
}
|
if (name =='Aug') {
|
ins.IMS_Prediction_8 = Decimal.valueOf(value);
|
}
|
if (name =='Sept') {
|
ins.IMS_Prediction_9 = Decimal.valueOf(value);
|
}
|
if (name =='Oct') {
|
ins.IMS_Prediction_10 = Decimal.valueOf(value);
|
}
|
if (name =='Nov') {
|
ins.IMS_Prediction_11 = Decimal.valueOf(value);
|
}
|
if (name =='Dec') {
|
ins.IMS_Prediction_12 = Decimal.valueOf(value);
|
}
|
if (name =='Jan') {
|
ins.IMS_Prediction_1 = Decimal.valueOf(value);
|
}
|
if (name =='Feb') {
|
ins.IMS_Prediction_2 = Decimal.valueOf(value);
|
}
|
if (name =='Mar') {
|
ins.IMS_Prediction_3 = Decimal.valueOf(value);
|
}
|
}
|
}
|
if (tmsList!=null) {
|
for(Dealer_ConsumableManage__c dc:tmsList){
|
Dealer_ConsumableManage__c dcNew = new Dealer_ConsumableManage__c();
|
dcNew.id = dc.id;
|
if (ins.TMS_Prediction_4 !=0 && ins.TMS_Prediction_4!=null) {
|
dcNew.TMS_Prediction_4__c = ins.TMS_Prediction_4;
|
}
|
if (ins.TMS_Prediction_5 !=0 && ins.TMS_Prediction_5!=null) {
|
dcNew.TMS_Prediction_5__c = ins.TMS_Prediction_5;
|
}
|
if (ins.TMS_Prediction_6 !=0 && ins.TMS_Prediction_6!=null) {
|
dcNew.TMS_Prediction_6__c = ins.TMS_Prediction_6;
|
}
|
if (ins.TMS_Prediction_7 !=0 && ins.TMS_Prediction_7!=null) {
|
dcNew.TMS_Prediction_7__c = ins.TMS_Prediction_7;
|
}
|
if (ins.TMS_Prediction_8 !=0 && ins.TMS_Prediction_8!=null) {
|
dcNew.TMS_Prediction_8__c = ins.TMS_Prediction_8;
|
}
|
if (ins.TMS_Prediction_9 !=0 && ins.TMS_Prediction_9!=null) {
|
dcNew.TMS_Prediction_9__c = ins.TMS_Prediction_9;
|
}
|
if (ins.TMS_Prediction_10 !=0 && ins.TMS_Prediction_10!=null) {
|
dcNew.TMS_Prediction_10__c = ins.TMS_Prediction_10;
|
}
|
if (ins.TMS_Prediction_11 !=0 && ins.TMS_Prediction_11!=null) {
|
dcNew.TMS_Prediction_11__c = ins.TMS_Prediction_11;
|
}
|
if (ins.TMS_Prediction_12 !=0 && ins.TMS_Prediction_12!=null) {
|
dcNew.TMS_Prediction_12__c = ins.TMS_Prediction_12;
|
}
|
if (ins.TMS_Prediction_1 !=0 && ins.TMS_Prediction_1!=null) {
|
dcNew.TMS_Prediction_1__c = ins.TMS_Prediction_1;
|
}
|
if (ins.TMS_Prediction_2 !=0 && ins.TMS_Prediction_2!=null) {
|
dcNew.TMS_Prediction_2__c = ins.TMS_Prediction_2;
|
}
|
if (ins.TMS_Prediction_3 !=0 && ins.TMS_Prediction_3!=null) {
|
dcNew.TMS_Prediction_3__c = ins.TMS_Prediction_3;
|
}
|
|
|
if (ins.IMS_Prediction_4 !=0 && ins.IMS_Prediction_4!=null) {
|
dcNew.IMS_Prediction_4__c = ins.IMS_Prediction_4;
|
}
|
if (ins.IMS_Prediction_5 !=0 && ins.IMS_Prediction_5!=null) {
|
dcNew.IMS_Prediction_5__c = ins.IMS_Prediction_5;
|
}
|
if (ins.IMS_Prediction_6 !=0 && ins.IMS_Prediction_6!=null) {
|
dcNew.IMS_Prediction_6__c = ins.IMS_Prediction_6;
|
}
|
if (ins.IMS_Prediction_7 !=0 && ins.IMS_Prediction_7!=null) {
|
dcNew.IMS_Prediction_7__c = ins.IMS_Prediction_7;
|
}
|
if (ins.IMS_Prediction_8 !=0 && ins.IMS_Prediction_8!=null) {
|
dcNew.IMS_Prediction_8__c = ins.IMS_Prediction_8;
|
}
|
if (ins.IMS_Prediction_9 !=0 && ins.IMS_Prediction_9!=null) {
|
dcNew.IMS_Prediction_9__c = ins.IMS_Prediction_9;
|
}
|
if (ins.IMS_Prediction_10 !=0 && ins.IMS_Prediction_10!=null) {
|
dcNew.IMS_Prediction_10__c = ins.IMS_Prediction_10;
|
}
|
if (ins.IMS_Prediction_11 !=0 && ins.IMS_Prediction_11!=null) {
|
dcNew.IMS_Prediction_11__c = ins.IMS_Prediction_11;
|
}
|
if (ins.IMS_Prediction_12 !=0 && ins.IMS_Prediction_12!=null) {
|
dcNew.IMS_Prediction_12__c = ins.IMS_Prediction_12;
|
}
|
if (ins.IMS_Prediction_1 !=0 && ins.IMS_Prediction_1!=null) {
|
dcNew.IMS_Prediction_1__c = ins.IMS_Prediction_1;
|
}
|
if (ins.IMS_Prediction_2 !=0 && ins.IMS_Prediction_2!=null) {
|
dcNew.IMS_Prediction_2__c = ins.IMS_Prediction_2;
|
}
|
if (ins.IMS_Prediction_3 !=0 && ins.IMS_Prediction_3!=null) {
|
dcNew.IMS_Prediction_3__c = ins.IMS_Prediction_3;
|
}
|
updateList.add(dcNew);
|
}
|
}
|
try{
|
if (updateList.size()>0) {
|
system.debug('updateList==='+updateList);
|
update updateList;
|
status = 'success';
|
}
|
if (tmsList.size()==0) {
|
status = '数据不存在';
|
}
|
if (updateList.size()==0) {
|
status = '数据不存在';
|
}
|
|
return status;
|
}catch(Exception err){
|
return err.getMessage();
|
}
|
}
|
public static String formatDecimalWithSeparator(Decimal myDecimal) {
|
String decimalString = String.valueOf(myDecimal);
|
String formattedValue = addThousandSeparator(decimalString);
|
return formattedValue;
|
}
|
|
private static String addThousandSeparator(String input) {
|
String integerPart;
|
String decimalPart = '';
|
|
if (input.contains('.')) {
|
List<String> parts = input.split('\\.');
|
integerPart = parts[0];
|
decimalPart = '.' + parts[1];
|
} else {
|
integerPart = input;
|
}
|
|
integerPart = reverseString(integerPart);
|
integerPart = addCommasToIntegerPart(integerPart);
|
integerPart = reverseString(integerPart);
|
|
String result = integerPart + decimalPart;
|
return result;
|
}
|
|
private static String reverseString(String input) {
|
String reversedString = '';
|
for (Integer i = input.length() - 1; i >= 0; i--) {
|
reversedString += input.substring(i, i + 1);
|
}
|
return reversedString;
|
}
|
|
private static String addCommasToIntegerPart(String input) {
|
Integer len = input.length();
|
Integer commaCount = len / 3;
|
|
for (Integer i = 0; i < commaCount; i++) {
|
Integer index = len - (i + 1) * 3;
|
if (index > 0) {
|
input = input.substring(0, index) + ',' + input.substring(index);
|
}
|
}
|
|
return input;
|
}
|
public class InitData{
|
|
@AuraEnabled
|
public Decimal FY_BO_1;
|
@AuraEnabled
|
public Decimal FY_BO_11;
|
@AuraEnabled
|
public Decimal FY_BO_12;
|
@AuraEnabled
|
public Decimal FY_BO_2;
|
@AuraEnabled
|
public Decimal FY_BO_3;
|
@AuraEnabled
|
public Decimal FY_BO_4;
|
@AuraEnabled
|
public Decimal FY_BO_5;
|
@AuraEnabled
|
public Decimal FY_BO_6;
|
@AuraEnabled
|
public Decimal FY_BO_7;
|
@AuraEnabled
|
public Decimal FY_BO_8;
|
@AuraEnabled
|
public Decimal FY_BO_9;
|
@AuraEnabled
|
public Decimal FY_BO_10;
|
|
@AuraEnabled
|
public Decimal FY_O_1;
|
@AuraEnabled
|
public Decimal FY_O_10;
|
@AuraEnabled
|
public Decimal FY_O_12;
|
@AuraEnabled
|
public Decimal FY_O_11;
|
@AuraEnabled
|
public Decimal FY_O_3;
|
@AuraEnabled
|
public Decimal FY_O_2;
|
@AuraEnabled
|
public Decimal FY_O_4;
|
@AuraEnabled
|
public Decimal FY_O_5;
|
@AuraEnabled
|
public Decimal FY_O_6;
|
@AuraEnabled
|
public Decimal FY_O_7;
|
@AuraEnabled
|
public Decimal FY_O_8;
|
@AuraEnabled
|
public Decimal FY_O_9;
|
|
@AuraEnabled
|
public Decimal FY_P_1;
|
@AuraEnabled
|
public Decimal FY_P_10;
|
@AuraEnabled
|
public Decimal FY_P_11;
|
@AuraEnabled
|
public Decimal FY_P_12;
|
@AuraEnabled
|
public Decimal FY_P_2;
|
@AuraEnabled
|
public Decimal FY_P_3;
|
@AuraEnabled
|
public Decimal FY_P_4;
|
@AuraEnabled
|
public Decimal FY_P_5;
|
@AuraEnabled
|
public Decimal FY_P_6;
|
@AuraEnabled
|
public Decimal FY_P_7;
|
@AuraEnabled
|
public Decimal FY_P_8;
|
@AuraEnabled
|
public Decimal FY_P_9;
|
|
@AuraEnabled
|
public Decimal FY_S_1;
|
@AuraEnabled
|
public Decimal FY_S_10;
|
@AuraEnabled
|
public Decimal FY_S_11;
|
@AuraEnabled
|
public Decimal FY_S_12;
|
@AuraEnabled
|
public Decimal FY_S_2;
|
@AuraEnabled
|
public Decimal FY_S_3;
|
@AuraEnabled
|
public Decimal FY_S_4;
|
@AuraEnabled
|
public Decimal FY_S_5;
|
@AuraEnabled
|
public Decimal FY_S_6;
|
@AuraEnabled
|
public Decimal FY_S_7;
|
@AuraEnabled
|
public Decimal FY_S_8;
|
@AuraEnabled
|
public Decimal FY_S_9;
|
|
@AuraEnabled
|
public Decimal FY_I_1;
|
@AuraEnabled
|
public Decimal FY_I_10;
|
@AuraEnabled
|
public Decimal FY_I_11;
|
@AuraEnabled
|
public Decimal FY_I_12;
|
@AuraEnabled
|
public Decimal FY_I_2;
|
@AuraEnabled
|
public Decimal FY_I_3;
|
@AuraEnabled
|
public Decimal FY_I_4;
|
@AuraEnabled
|
public Decimal FY_I_5;
|
@AuraEnabled
|
public Decimal FY_I_6;
|
@AuraEnabled
|
public Decimal FY_I_7;
|
@AuraEnabled
|
public Decimal FY_I_8;
|
@AuraEnabled
|
public Decimal FY_I_9;
|
|
@AuraEnabled
|
public Decimal FY_TI_1;
|
@AuraEnabled
|
public Decimal FY_TI_10;
|
@AuraEnabled
|
public Decimal FY_TI_11;
|
@AuraEnabled
|
public Decimal FY_TI_12;
|
@AuraEnabled
|
public Decimal FY_TI_2;
|
@AuraEnabled
|
public Decimal FY_TI_3;
|
@AuraEnabled
|
public Decimal FY_TI_4;
|
@AuraEnabled
|
public Decimal FY_TI_5;
|
@AuraEnabled
|
public Decimal FY_TI_6;
|
@AuraEnabled
|
public Decimal FY_TI_7;
|
@AuraEnabled
|
public Decimal FY_TI_8;
|
@AuraEnabled
|
public Decimal FY_TI_9;
|
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_1 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_10 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_11 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_12 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_2 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_3 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_4 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_5 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_6 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_7 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_8 = 0;
|
@AuraEnabled
|
public Decimal TMS_Unpaid_amount_9 = 0;
|
|
@AuraEnabled
|
public Decimal TMS_Prediction_1 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_10 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_11 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_12 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_2 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_3 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_4 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_5 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_6 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_7 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_8 = 0;
|
@AuraEnabled
|
public Decimal TMS_Prediction_9 = 0;
|
|
@AuraEnabled
|
public Decimal IMS_Shipments_1 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_10 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_11 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_12 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_2 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_3 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_4 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_5 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_6 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_7 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_8 = 0;
|
@AuraEnabled
|
public Decimal IMS_Shipments_9 = 0;
|
|
@AuraEnabled
|
public Decimal StockAmount_1 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_10 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_11 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_12 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_2 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_3 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_4 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_5 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_6 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_7 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_8 = 0;
|
@AuraEnabled
|
public Decimal StockAmount_9 = 0;
|
|
@AuraEnabled
|
public Decimal IMS_Prediction_1 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_10 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_11 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_12 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_2 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_3 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_4 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_5 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_6 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_7 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_8 = 0;
|
@AuraEnabled
|
public Decimal IMS_Prediction_9 = 0;
|
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_1 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_10 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_11 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_12 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_2 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_3 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_4 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_5 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_6 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_7 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_8 = 0;
|
@AuraEnabled
|
public Decimal TMS_PredictionFulfillment_9 = 0;
|
|
@AuraEnabled
|
public String FY_SP_1;
|
@AuraEnabled
|
public String FY_SP_10;
|
@AuraEnabled
|
public String FY_SP_11;
|
@AuraEnabled
|
public String FY_SP_12;
|
@AuraEnabled
|
public String FY_SP_2;
|
@AuraEnabled
|
public String FY_SP_3;
|
@AuraEnabled
|
public String FY_SP_4;
|
@AuraEnabled
|
public String FY_SP_5;
|
@AuraEnabled
|
public String FY_SP_6;
|
@AuraEnabled
|
public String FY_SP_7;
|
@AuraEnabled
|
public String FY_SP_8;
|
@AuraEnabled
|
public String FY_SP_9;
|
|
|
|
@AuraEnabled
|
public Decimal annual_1;
|
@AuraEnabled
|
public Decimal annual_11=0;
|
@AuraEnabled
|
public Decimal annual_2;
|
@AuraEnabled
|
public Decimal annual_22=0;
|
@AuraEnabled
|
public Decimal annual_3;
|
@AuraEnabled
|
public Decimal annual_4;
|
@AuraEnabled
|
public Decimal annual_5;
|
@AuraEnabled
|
public Decimal annual_8;
|
@AuraEnabled
|
public Decimal annual_7;
|
@AuraEnabled
|
public Decimal annual_9;
|
@AuraEnabled
|
public Decimal annual_10;
|
@AuraEnabled
|
public String annual_6;
|
@AuraEnabled
|
public Decimal annual_14 = 0;
|
|
@AuraEnabled
|
public Decimal YTDTotal1;
|
@AuraEnabled
|
public Decimal YTDTotal11=0;
|
@AuraEnabled
|
public Decimal YTDTotal2;
|
@AuraEnabled
|
public Decimal YTDTotal22=0;
|
@AuraEnabled
|
public Decimal YTDTotal3;
|
@AuraEnabled
|
public Decimal YTDTotal4;
|
@AuraEnabled
|
public Decimal YTDTotal5;
|
@AuraEnabled
|
public Decimal YTDTotal9=0;
|
@AuraEnabled
|
public Decimal YTDTotal7=0;
|
@AuraEnabled
|
public Decimal YTDTotal10=0;
|
|
@AuraEnabled
|
public Decimal YTDTotal8=0;
|
@AuraEnabled
|
public Decimal YTDTotal14;
|
@AuraEnabled
|
public String YTDTotal6;
|
|
@AuraEnabled
|
public Decimal threemonthAug;
|
|
|
}
|
|
public class InitDataUp{
|
@AuraEnabled
|
public String Category1='';
|
@AuraEnabled
|
public String Category2='';
|
@AuraEnabled
|
public String Category3='';
|
@AuraEnabled
|
public Integer key=0;
|
@AuraEnabled
|
public Boolean Hideflg = false;
|
@AuraEnabled
|
public Boolean Hideflg2 = false;
|
@AuraEnabled
|
public Decimal Money=0;
|
@AuraEnabled
|
public String MoneyString='0';
|
@AuraEnabled
|
public Decimal OneYearMoney=0;
|
@AuraEnabled
|
public String OneYearMoneyString='0';
|
@AuraEnabled
|
public String healPercent = '0';
|
@AuraEnabled
|
public Decimal totalNumber=0;
|
@AuraEnabled
|
public String totalNumberString='0';
|
@AuraEnabled
|
public Decimal totalNumberLast=0;
|
@AuraEnabled
|
public String totalNumberLastString='0';
|
@AuraEnabled
|
public Decimal totalNumberAll=0;
|
@AuraEnabled
|
public Decimal totalNumberAll2=0;
|
}
|
public lexTmsformController(){}
|
}
|