From 2f183a6b0a83ec3f7d35375d5d25d200efc2a3e1 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期二, 19 四月 2022 18:46:18 +0800
Subject: [PATCH] 20220419FixIssue

---
 force-app/main/default/pages/NewAndEditContact.page                |   12 
 force-app/main/default/classes/PIHelper.cls                        |    1 
 force-app/main/default/classes/FixtureRentalPDFController.cls      |   51 +
 force-app/main/default/classes/NewRepairController.cls             |   14 
 force-app/main/default/pages/NewRepair.page                        |   27 
 force-app/main/default/pages/XinDailyReport.page                   |  159 ++--
 force-app/main/default/pages/NewAndEditRepairSubOrder.page         |   43 
 force-app/main/default/classes/ConsumTrialPDFController.cls        |    2 
 force-app/main/default/classes/FileUploadControllerTest.cls        |    3 
 force-app/main/default/classes/NewAndEditBaseController.cls        |   53 +
 force-app/main/default/classes/ConsumTrialController.cls           |    6 
 force-app/main/default/classes/StartTradingController.cls          |    7 
 force-app/main/default/pages/NewAndEditAgencyContact.page          |   24 
 force-app/main/default/pages/FixtureRentalPDF.page                 |   13 
 force-app/main/default/pages/NewAndEditQIS.page                    |    6 
 force-app/main/default/classes/NewAndEditReportController.cls      |   27 
 force-app/main/default/classes/FileUploadController.cls            |    2 
 force-app/main/default/pages/NewAndEditCase.page                   |   27 
 force-app/main/default/pages/NewRentalApply.page                   |   95 ++
 force-app/main/default/classes/LightningUtil.cls                   |   40 
 force-app/main/default/classes/XinDailyReportController.cls        |    1 
 force-app/main/default/pages/NewOnCall.page                        |   50 +
 force-app/main/default/pages/NewConsumApply.page                   |   13 
 force-app/main/default/pages/NewAndEditASEActivity.page            |   37 
 force-app/main/default/pages/NewAndEditInspectionReport.page       |   17 
 force-app/main/default/pages/NewAndEditReport.page                 |   78 ++
 force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page |   16 
 force-app/main/default/classes/NewAndEditBaseControllerTest.cls    |    2 
 force-app/main/default/classes/RentalApplyController.cls           |   16 
 force-app/main/default/pages/ConsumTrial.page                      |  899 +++++++++++++++-------------
 force-app/main/default/pages/NewAndEditCampaignMember.page         |   15 
 force-app/main/default/pages/NewAndEditInquiryForm.page            |   21 
 force-app/main/default/pages/NewAndEditAddress.page                |   14 
 force-app/main/default/pages/NewAndEditLead.page                   |   12 
 force-app/main/default/pages/NewAndEditTenderinformation.page      |   20 
 35 files changed, 1,121 insertions(+), 702 deletions(-)

diff --git a/force-app/main/default/classes/ConsumTrialController.cls b/force-app/main/default/classes/ConsumTrialController.cls
index 35551fc..27470ce 100644
--- a/force-app/main/default/classes/ConsumTrialController.cls
+++ b/force-app/main/default/classes/ConsumTrialController.cls
@@ -231,7 +231,7 @@
                 FixtureUtil.withoutUpdate(rndList, true);
                 PageReference pag = new PageReference('/apex/ConsumTrial?id=' + parId + '&canedit=true&saveType=1');
                 pag.setRedirect(true);
-                return pag;
+                return null;
             }
             else{
                 init();
@@ -418,7 +418,7 @@
                     + String.join(assetFieldApiList, ',')
                     + (assetFieldApiList.size() > 0 ? ',' : '')
                     + String.join(receivingNoteFieldApiList, ',')
-                    + ',AWS_Data_Id__c'
+                    + ',AWS_Data_Id__c,Trial_User_Encrypt__c'
                  + ' FROM Consum_Apply_Equipment_Set_Detail__c '
                 + ' WHERE Consum_Apply_Equipment_Set__r.Consum_Apply__c = \'' + rn.Id + '\'' + wher
                   + ' AND (Cancel_Select__c = false OR NG_Select_Again__c = true)'
@@ -488,7 +488,7 @@
             // dataConfirmation = rnd1.DataConfirmation__c;
             lineNo = lineNo1 + 1;
             canChangeField = 'Show_demonstration__c, Operation_Type__c, Consum_Start_Date__c';
-            canChangeField += ',AWS_Data_Id__c, Case_OR_animal_organ__c, Trial_User__c, Follower_User__c, Spare__c, Comment__c, Degree_Of_Importance__c';
+            canChangeField += ',AWS_Data_Id__c, Case_OR_animal_organ__c, Trial_User__c,Trial_User_Encrypt__c, Follower_User__c, Spare__c, Comment__c, Degree_Of_Importance__c';
 
             haveAsset = String.isNotBlank(rnd1.Asset__c);
         }
diff --git a/force-app/main/default/classes/ConsumTrialPDFController.cls b/force-app/main/default/classes/ConsumTrialPDFController.cls
index 6a2e22f..5b6ddee 100644
--- a/force-app/main/default/classes/ConsumTrialPDFController.cls
+++ b/force-app/main/default/classes/ConsumTrialPDFController.cls
@@ -159,7 +159,7 @@
                   FROM Consum_Apply_Equipment_Set_Detail__c
                  WHERE Consum_Apply_Equipment_Set__r.Consum_Apply__c = :targetConsumApplyId  // 鑰楁潗澶囧搧閰嶅涓�瑙�.鑰楁潗澶囧搧鐢宠
                    AND (Cancel_Select__c = false OR NG_Select_Again__c = true)
-                   AND Shipment_request_time2__c != null
+                   //AND Shipment_request_time2__c != null
               ORDER BY Consum_Apply_Equipment_Set__r.Consum_Apply__c, Consum_Apply_Equipment_Set__c, Fixture_Model_No_F__c, Degree_Of_Importance__c
         ];
         if (consumApplySetDetailList.size() > 0) {
diff --git a/force-app/main/default/classes/FileUploadController.cls b/force-app/main/default/classes/FileUploadController.cls
index cfd13a7..13cb178 100644
--- a/force-app/main/default/classes/FileUploadController.cls
+++ b/force-app/main/default/classes/FileUploadController.cls
@@ -23,6 +23,8 @@
     global static Response saveFile(String fileName,String key,String transId,String parentId){
         FileAddress__c file = new FileAddress__c();
         PIHelper.PIIntegration pI=PIHelper.getPIIntegrationInfo('Document');
+        // 鍘婚櫎filename閲屽緱鈥�&鈥� bysushanhu 20220414
+        fileName = fileName.remove('&');
         file.DownloadLink__c =pI.undeleteUrl+key+'&fileName='+fileName;
         file.FileName__c =fileName;
         file.ViewLink__c =pI.queryUrl+key;
diff --git a/force-app/main/default/classes/FileUploadControllerTest.cls b/force-app/main/default/classes/FileUploadControllerTest.cls
index dc0e0c2..676ac12 100644
--- a/force-app/main/default/classes/FileUploadControllerTest.cls
+++ b/force-app/main/default/classes/FileUploadControllerTest.cls
@@ -1,7 +1,8 @@
 @isTest
 private class FileUploadControllerTest {
     static testMethod void testMethod1() {
-        TestDataUtility.CreatePIPolicyConfiguration('Document');
+        // TestDataUtility.CreatePIPolicyConfiguration('Document');
+        TestDataUtility.CreatePIPolicyConfiguration();
         Account acc = new Account(Name = 'test');
         Map<String,Object> accMap = new Map<String,Object>();
         accMap.put('Account',acc);
diff --git a/force-app/main/default/classes/FixtureRentalPDFController.cls b/force-app/main/default/classes/FixtureRentalPDFController.cls
index da042cf..0c0d353 100644
--- a/force-app/main/default/classes/FixtureRentalPDFController.cls
+++ b/force-app/main/default/classes/FixtureRentalPDFController.cls
@@ -36,6 +36,12 @@
     public Boolean addFlag { get; private set; }//鏁忔劅鍦板潃浣跨敤鏍囪
     public String qrcode { get; private set; }
     public String barcode { get; private set; }
+    // 20220413 ljh 鎶ご鏄剧ず add start
+    public String AgencyAddressName { get; private set; } 
+    public Boolean isAgencyOrCenter { get; private set; } 
+    public String AgencyOrCenterAddress { get; private set; }
+    // 20220413 ljh 鎶ご鏄剧ず add end
+
     public FixtureRentalPDFController() {
         pageNum = Integer.valueOf(ApexPages.currentPage().getParameters().get('page'));
         rentalApplyIdIMG = ApexPages.currentPage().getParameters().get('raid');
@@ -483,23 +489,40 @@
         //鏂板缓涓�椤�
         
         PDFInfo info = new PDFInfo(new Rental_Apply__c(),New List<Rental_Apply_Equipment_Set_Detail__c>());
+        // 20220413 ljh  鎶ご鏄剧ず update start
         //20201120 LJH OCSM_BP5-61 update start
+        // if(!IsShowLU){
+        //     if(!IsMain){
+        //         info.isAgencyOrCenter = true;//鍔炰簨澶�
+        //         info.AgencyAddressName = '璇峰皢澶囧搧鍥炲瘎鑷�';
+        //         info.AgencyAddressName += ApplyHeadShow.ToAgency__c == null ? '' : ApplyHeadShow.ToAgency__c;
+        //         info.AgencyAddressName += '鍔炰簨澶�';
+        //         info.AgencyOrCenterAddress = AgencyAddressIdMap.get(ApplyHeadShow.Id);
+        //     }else{
+        //         info.isAgencyOrCenter = false;//澶囧搧涓績
+        //         info.AgencyOrCenterAddress = centerAddressInfo;
+        //     }   
+        // }else{
+        //     info.isAgencyOrCenter = false;//澶囧搧涓績
+        //     info.AgencyOrCenterAddress = centerAddressInfo;
+        // }
+        //20201120 LJH OCSM_BP5-61 update  end
         if(!IsShowLU){
             if(!IsMain){
-                info.isAgencyOrCenter = true;//鍔炰簨澶�
-                info.AgencyAddressName = '璇峰皢澶囧搧鍥炲瘎鑷�';
-                info.AgencyAddressName += ApplyHeadShow.ToAgency__c == null ? '' : ApplyHeadShow.ToAgency__c;
-                info.AgencyAddressName += '鍔炰簨澶�';
-                info.AgencyOrCenterAddress = AgencyAddressIdMap.get(ApplyHeadShow.Id);
+                isAgencyOrCenter = true;//鍔炰簨澶�
+                AgencyAddressName = '璇峰皢澶囧搧鍥炲瘎鑷�';
+                AgencyAddressName += ApplyHeadShow.ToAgency__c == null ? '' : ApplyHeadShow.ToAgency__c;
+                AgencyAddressName += '鍔炰簨澶�';
+                AgencyOrCenterAddress = AgencyAddressIdMap.get(ApplyHeadShow.Id);
             }else{
-                info.isAgencyOrCenter = false;//澶囧搧涓績
-                info.AgencyOrCenterAddress = centerAddressInfo;
+                isAgencyOrCenter = false;//澶囧搧涓績
+                AgencyOrCenterAddress = centerAddressInfo;
             }   
         }else{
-            info.isAgencyOrCenter = false;//澶囧搧涓績
-            info.AgencyOrCenterAddress = centerAddressInfo;
+            isAgencyOrCenter = false;//澶囧搧涓績
+            AgencyOrCenterAddress = centerAddressInfo;
         }
-        //20201120 LJH OCSM_BP5-61 update  end
+        // 20220413 ljh  鎶ご鏄剧ず update end
         integer PageCut = 0;
         if (PageAllNum>=7) {
            PageAllNum=7;
@@ -579,9 +602,11 @@
     // Data Bean
     class PDFInfo {
         public String eSetName { get; private set; } //澶囧搧涓績绠$悊鍗曞彿
-        public String AgencyAddressName { get; private set; } //鍥炲瘎鍦板潃 20201123 LJH OCSM_BP5-61 add
-        public Boolean isAgencyOrCenter { get; private set; } //澶囧搧涓績锛熷姙浜嬪 20201123 LJH OCSM_BP5-61 add
-        public String AgencyOrCenterAddress { get; private set; }//20201124 LJH OCSM_BP5-61 add
+        // 20220413 ljh  鎶ご鏄剧ず update start
+        // public String AgencyAddressName { get; private set; } //鍥炲瘎鍦板潃 20201123 LJH OCSM_BP5-61 add
+        // public Boolean isAgencyOrCenter { get; private set; } //澶囧搧涓績锛熷姙浜嬪 20201123 LJH OCSM_BP5-61 add
+        // public String AgencyOrCenterAddress { get; private set; }//20201124 LJH OCSM_BP5-61 add
+        // 20220413 ljh  鎶ご鏄剧ず update end
         public String requestOwner { get; private set; } //鐢宠浜�
         public String salesDept { get; private set; } //鎵�灞炴湰閮�
         public String workPlace { get; private set; } //鎵�灞炲姙浜嬪
diff --git a/force-app/main/default/classes/LightningUtil.cls b/force-app/main/default/classes/LightningUtil.cls
index 85425e2..df9cfea 100644
--- a/force-app/main/default/classes/LightningUtil.cls
+++ b/force-app/main/default/classes/LightningUtil.cls
@@ -162,16 +162,16 @@
     //缁忛攢鍟嗙郴缁�
     public static List<Agency_Report__c> selectAgencyReport(Date week, String person_str) {
         if (String.isBlank(person_str)) {
-            List<Contact> person_list = selectAgencyPerson();
-            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c, productCategories__c,DealerPersonnel__c,WorkRecord__c,Purpose_Type__c,SupportNeeds__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+            List<Contact> person_list = selectAgencyPerson();//fy Department_Cateogy_text__c
+            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,Department_Cateogy_text__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c, productCategories__c,DealerPersonnel__c,WorkRecord__c,Purpose_Type__c,SupportNeeds__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                             Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                             doctor2__r.AWS_Data_Id__c,Person_In_Charge2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c,
                             UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name    
                             From Agency_Report__c
                             where Submit_date__c=:week and Person_In_Charge2__c in :person_list and WeeklyReportClassification__c = ''  order by LastModifiedDate desc];
-        } else {
-            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,DealerPersonnel__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,WorkRecord__c,Purpose_Type__c,SupportNeeds__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+        } else {//fy Department_Cateogy_text__c
+            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,Department_Cateogy_text__c,DealerPersonnel__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,WorkRecord__c,Purpose_Type__c,SupportNeeds__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                             Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                             doctor2__r.AWS_Data_Id__c,Person_In_Charge2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c,
@@ -184,17 +184,17 @@
     public static List<Agency_Report__c> selectAgencyReport01(Date week, String person_str) {
         system.debug('person_strperson_str=================>'+person_str);
         if (String.isBlank(person_str)) {
-            List<Contact> person_list = selectAgencyPerson01();
-            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,  DealerPersonnel__c,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
-                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
+            List<Contact> person_list = selectAgencyPerson01();//fy Department_Cateogy_text__c  doctor3__c
+            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,Department_Cateogy_text__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,  DealerPersonnel__c,WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c,doctor3__c, doctor2__r.Name, Submit_date__c,
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c,
                             doctor2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name    
                             From Agency_Report__c
                             where Submit_date__c=:week and Person_In_Charge2__c in :person_list and WeeklyReportClassification__c != '' order by LastModifiedDate desc];
-        } else {
-            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,DealerPersonnel__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c, WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
-                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
+        } else {//fy Department_Cateogy_text__c  doctor3__c
+            return [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c, WorkMark__c,warlocksNumber__c,Department_Cateogy__c,Department_Cateogy_text__c,DealerPersonnel__c,ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c, WorkRecord__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+                            Person_In_Charge2__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c,doctor3__c, doctor2__r.Name, Submit_date__c,
                             doctor2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c,
                             UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name   
@@ -203,8 +203,8 @@
         }
     }
     //缁忛攢鍟嗙郴缁�
-    public static List<Agency_Report__c> selectMAgencyReport(Date date1, Date date2 ,List<Contact> conMList) {
-        List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,Purpose_Type__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+    public static List<Agency_Report__c> selectMAgencyReport(Date date1, Date date2 ,List<Contact> conMList) {//fy Department_Cateogy_text__c
+        List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c,Department_Cateogy_text__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,Purpose_Type__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                             Person_In_Charge2__c,DealerPersonnel__r.Name,Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,//鏀彺闇�姹係upportNeeds__c
                             doctor2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c,SupportNeeds__c,
@@ -214,9 +214,9 @@
         return reportlist;
     }
     //杩芥函绯荤粺
-    public static List<Agency_Report__c> selectMAgencyReport01(Date date1, Date date2 ,List<Contact> conMList) {
-        List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
-                            Person_In_Charge2__c,DealerPersonnel__r.Name,Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
+    public static List<Agency_Report__c> selectMAgencyReport01(Date date1, Date date2 ,List<Contact> conMList) {//fy Department_Cateogy_text__c  doctor3__c
+        List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c,Department_Cateogy_text__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+                            Person_In_Charge2__c,DealerPersonnel__r.Name,Person_In_Charge2__r.Name, doctor2__c,doctor3__c, doctor2__r.Name, Submit_date__c,
                             doctor2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c,
                             UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name  
@@ -225,8 +225,8 @@
         return reportlist;
     }
     //缁忛攢鍟嗙郴缁熺殑
-    public static List<Agency_Report__c> selectAgencyReportById(String report_id) {
-        return [Select Id, Name, Department_Cateogy__c,Purpose_Type__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+    public static List<Agency_Report__c> selectAgencyReportById(String report_id) {//fy Department_Cateogy_text__c
+        return [Select Id, Name, Department_Cateogy__c,Department_Cateogy_text__c,Purpose_Type__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
                             Person_In_Charge2__c,DealerPersonnel__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
                             doctor2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c , Opportunity__c, Opportunity__r.Name
@@ -234,9 +234,9 @@
                             where id=:report_id ];
     }
     //杩芥函绯荤粺鐨�
-    public static List<Agency_Report__c> selectAgencyReportById01(String report_id) {
-        return [Select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
-                            Person_In_Charge2__c,DealerPersonnel__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,
+    public static List<Agency_Report__c> selectAgencyReportById01(String report_id) {//fy Department_Cateogy_text__c doctor3__c
+        return [Select Id, Name, Department_Cateogy__c,Department_Cateogy_text__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c,
+                            Person_In_Charge2__c,DealerPersonnel__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c,doctor3__c, doctor2__r.Name, Submit_date__c,
                             doctor2__r.AWS_Data_Id__c,// 20220222 PI鏀归�� by Bright
                             Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c 
                             From Agency_Report__c
diff --git a/force-app/main/default/classes/NewAndEditBaseController.cls b/force-app/main/default/classes/NewAndEditBaseController.cls
index 6474e93..462ae89 100644
--- a/force-app/main/default/classes/NewAndEditBaseController.cls
+++ b/force-app/main/default/classes/NewAndEditBaseController.cls
@@ -198,7 +198,13 @@
         Map<String, Schema.SObjectField> fieldAPIToTypeMap = leadSchema.getDescribe().fields.getMap();
         Map<String,Object> fieldValueMap = (Map<String,Object>)JSON.deserializeUntyped(leadJson);
         
-
+        system.debug('enter Foo');
+        string rtid = null;
+        if (fieldValueMap.containsKey('RecordTypeId')) {
+            rtid = String.valueOf(fieldValueMap.get('RecordTypeId'));
+        }
+        List<string> invalid_fields = GetInvalidFieldFromLayout(rtid,sobjectTypeValue);
+		
         Boolean isClone = false;
         //2. Save Record Process
         String status = 'success';    
@@ -210,6 +216,12 @@
             
             for (String fieldAPI: fieldValueMap.keySet()) {
                 system.debug('field API='+fieldAPI);
+                
+                if(invalid_fields.contains(fieldAPI)){
+                    system.debug(fieldAPI+' is invalid');
+                    continue;
+                }
+                
                 if(!fieldAPIToTypeMap.containskey(fieldAPI)){
                     continue;
                 }
@@ -252,7 +264,7 @@
                 isClone = sobjects.size() == 0;
             }
             System.debug('isNew---------'+isNew);
-            
+                       
             if(isNew || isClone){
                 System.debug('leadInfozhj = ' + leadInfo);
                 if(!Test.isRunningTest()){
@@ -312,4 +324,41 @@
         }
     }
     
+    public static List<string> GetInvalidFieldFromLayout(string rtid, string sobject_name){
+        List<string> ls = new List<string>();
+        string[] only_type = new string[]{'QIS_Report__c'};
+        if(!only_type.contains(sobject_name)){
+            system.debug('not allow');
+            return ls;
+        }
+        
+        List<Metadata.LayoutSection> sections = MetaDataUtility.GetRecordTypePageLayout(rtid, sobject_name);
+        
+        if (sections == null) {
+            System.debug('sections=null');
+            return ls;
+        }
+        
+        system.debug(Json.serialize(sections));
+        
+        for (Metadata.LayoutSection section : sections) {
+            if (section.layoutColumns != null) {
+                for (Metadata.LayoutColumn layoutColumn : section.layoutColumns) {
+                    if(layoutColumn.layoutItems != null){
+                        for (Metadata.LayoutItem item : layoutColumn.layoutItems) {
+            
+                            System.debug(item);
+                            if(item.field==null)continue;
+                            if (item.behavior == Metadata.UiBehavior.READONLY  ) {
+                                ls.add(item.field);
+                            }
+                        }
+                    }
+                    
+                }
+            }
+            
+        }
+        return ls;
+    }
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/NewAndEditBaseControllerTest.cls b/force-app/main/default/classes/NewAndEditBaseControllerTest.cls
index 16dac22..785498a 100644
--- a/force-app/main/default/classes/NewAndEditBaseControllerTest.cls
+++ b/force-app/main/default/classes/NewAndEditBaseControllerTest.cls
@@ -97,4 +97,6 @@
         NewAndEditBaseController.save(aseTest, baseJson, 'avgwshDFcxAS', true);
         Test.stopTest();
     }
+    
+    
 }
\ No newline at end of file
diff --git a/force-app/main/default/classes/NewAndEditReportController.cls b/force-app/main/default/classes/NewAndEditReportController.cls
index eec19b4..9481521 100644
--- a/force-app/main/default/classes/NewAndEditReportController.cls
+++ b/force-app/main/default/classes/NewAndEditReportController.cls
@@ -140,7 +140,17 @@
                 contactAWSDataId1 = '鏃�';
                 contactName1 = '鏃�';
             }
-        }else if(ApexPages.currentPage().getParameters().get('CF00N10000008ps6d_lkid') != null){
+        }else{
+            //鏂板缓
+            // Map<string,string> mso = ApexPages.currentPage().getParameters();
+            //鍖婚櫌/绉戝/缁忛攢鍟�(鎵嬪啓)
+            if(mso.containsKey('00N10000002GE3Z')){
+                controller.getRecord().put('Manual_Name__c',mso.get('00N10000002GE3Z'));
+            }
+            rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
+            obj.put('OwnerId',UserInfo.getUserId());
+        }
+        if(ApexPages.currentPage().getParameters().get('CF00N10000008ps6d_lkid') != null){
             //OPD璁″垝杩囨潵鐨勶紝閫氳繃Id鏌ュ嚭鍊熷嚭澶囧搧鐢宠No1杩涜灞曠ず
             String opdPlanId = ApexPages.currentPage().getParameters().get('CF00N10000008ps6d_lkid');
             if(String.isNotEmpty(opdPlanId)&&String.isNotBlank(opdPlanId)){
@@ -153,17 +163,10 @@
                     }                   
                 }
             }                                  
-            rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
-            obj.put('OwnerId',UserInfo.getUserId());
-        }else{
-            //鏂板缓
-            // Map<string,string> mso = ApexPages.currentPage().getParameters();
-            //鍖婚櫌/绉戝/缁忛攢鍟�(鎵嬪啓)
-            if(mso.containsKey('00N10000002GE3Z')){
-                controller.getRecord().put('Manual_Name__c',mso.get('00N10000002GE3Z'));
-            }
-            rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
-            obj.put('OwnerId',UserInfo.getUserId());
+        }
+        //OPD璁″垝
+        if(mso.containsKey('CF00N10000008ps6d_lkid')){
+            controller.getRecord().put('Report_OPDPlan__c',mso.get('CF00N10000008ps6d_lkid'));
         }
         LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Report__c','classic');
         layoutSections = LayoutWrapperValue.layoutSections;
diff --git a/force-app/main/default/classes/NewRepairController.cls b/force-app/main/default/classes/NewRepairController.cls
index 6e97867..9f7c0d1 100644
--- a/force-app/main/default/classes/NewRepairController.cls
+++ b/force-app/main/default/classes/NewRepairController.cls
@@ -363,6 +363,7 @@
         Map<String, Schema.SObjectField> fieldAPIToTypeMap = repairSchema.getDescribe().fields.getMap();
         Map<String,Object> fieldValueMap = (Map<String,Object>)JSON.deserializeUntyped(repairJson);
         Repair__c repairInfo = new Repair__c();
+        Boolean updateRepairCheck = false;
         //鑷畾涔夋牸寮忚浆鎹�
         for (String fieldAPI: fieldValueMap.keySet()) {
             system.debug('field API'+fieldAPI);
@@ -388,12 +389,15 @@
             }else if(String.valueOf(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='CURRENCY'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){
                 repairInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); 
             } else if(String.valueof(fielddataType)=='BOOLEAN'){
+                 //check repair check value 
+                if(fieldAPI == 'Return_Without_Repair__c'&&Boolean.valueof(fieldValueMap.get(fieldAPI))){
+                    updateRepairCheck = true;
+                }
                 repairInfo.put(fieldAPI, fieldValueMap.get(fieldAPI));
             }else {
                 repairInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI)));
             }                  
         }
-        
         //2. Save Record Process
         String status = 'success';    
         Response resp = new Response();
@@ -408,7 +412,13 @@
                 System.debug('into update');
                 String awsDataId = (String)repairInfo.get('AWS_Data_Id__c');
                 System.debug('awsDataId = ' + awsDataId);
-                Repair__c[] repairs = [select id from Repair__c where AWS_Data_Id__c =:awsDataId];
+                Repair__c[] repairs = [select id,Return_Without_Repair_Reason__c,SAP_Transfer_time__c from Repair__c where AWS_Data_Id__c =:awsDataId];
+                if(!updateRepairCheck){
+                    repairInfo.put('Return_Without_Repair_Reason__c',repairs[0].Return_Without_Repair_Reason__c);
+                }
+                if(repairs!=null&&repairs[0]!=null){
+                    repairInfo.put('SAP_Transfer_time__c',repairs[0].SAP_Transfer_time__c);
+                }
                 System.debug('repairs[0].id = ' + repairs[0].id);
                 repairInfo.put('Id',repairs[0].id);//For testing;
                 update repairInfo;
diff --git a/force-app/main/default/classes/PIHelper.cls b/force-app/main/default/classes/PIHelper.cls
index f4bb2b0..85faefd 100644
--- a/force-app/main/default/classes/PIHelper.cls
+++ b/force-app/main/default/classes/PIHelper.cls
@@ -144,6 +144,7 @@
         //鏌ヨurl
         System.debug('thhsobjectType = ' + sobjectType);
         PI_Policy_Configuration__c config = [SELECT Full_New_URL__c,Full_New_Encrypt_URL__c,Full_Update_Encrypt_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c FROM PI_Policy_Configuration__c WHERE Sobject_Type__c =:sobjectType];
+        // PI_Policy_Configuration__c config = [SELECT Full_New_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c,Full_New_Encrypt_URL__c FROM PI_Policy_Configuration__c WHERE Sobject_Type__c =:sobjectType];
         System.debug('thhconfig = ' + config);
 
         //鑾峰彇appid鍜宎ppsecret
diff --git a/force-app/main/default/classes/RentalApplyController.cls b/force-app/main/default/classes/RentalApplyController.cls
index fac0fb0..88b61a6 100644
--- a/force-app/main/default/classes/RentalApplyController.cls
+++ b/force-app/main/default/classes/RentalApplyController.cls
@@ -36,7 +36,7 @@
         if(!Test.isRunningTest()){
             controller.addFields(fieldList);
         }
-        SObject obj = controller.getRecord();        
+        SObject obj = controller.getRecord();
         if(obj.Id != null){
             //鏇存柊
             isNewMode = false;
@@ -79,9 +79,23 @@
             if(mso.containsKey('00N10000003OJzc')){
                 controller.getRecord().put('Loaner_received_staff__c',mso.get('00N10000003OJzc'));
             }
+            
+            
+            
             rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
             obj.put('OwnerId',UserInfo.getUserId());
         }
+        
+        if(mso.containsKey('00N10000003Mp2H')){
+            system.debug('00N10000003Mp2H='+mso.get('00N10000003Mp2H'));
+            controller.getRecord().put('Status__c',mso.get('00N10000003Mp2H'));
+        }
+        
+        if(mso.containsKey('00N10000007oQKh')){
+            system.debug('00N10000007oQKh='+mso.get('00N10000007oQKh'));
+            controller.getRecord().put('Split_Apply_Reason__c',mso.get('00N10000007oQKh'));
+        }
+        system.debug('Rental Apply Record Type:'+rtTypeId);
         LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Rental_Apply__c','classic');
         layoutSections = LayoutWrapperValue.layoutSections;
         layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute
diff --git a/force-app/main/default/classes/StartTradingController.cls b/force-app/main/default/classes/StartTradingController.cls
index 7d993a4..fc903e1 100644
--- a/force-app/main/default/classes/StartTradingController.cls
+++ b/force-app/main/default/classes/StartTradingController.cls
@@ -77,7 +77,7 @@
         // 銉兗銉夋儏鍫便倰鍙栧緱  
         this.lead = [select id,SI_OppoLeadSec__c,owner_not_automatically_update__c, Hospital_Name__c, Contact_Name__c, Contact_Name__r.Name, 
                      Opportunity_stage__c,Hospital_Name__r.RecordType.DeveloperName, Hospital_Name__r.Parent.RecordType.DeveloperName,
-                     LastName, FirstName, LeadSource, Other_Society__c, Opp_Name__c, Purchase_Reason__c, Trade__c, Sales_Root__c,
+                     LastName, FirstName, LeadSource, Other_Society__c, Opp_Name__c, Purchase_Reason__c, Trade__c, Sales_Root__c, Campaign__c, 
                      Close_Forecasted_Date__c, Competitor__c, Hospital_Budget__c, Promise_Class__c, Dicision_Maker__c, Purchase_Type__c,
                      Sales_Method__c, Fund_Basis__c, OwnerId, Wholesale_Price__c, Lead_No__c,Inquiry_Num__c,CreatedDate,CreatedById
                      from Lead where id =: this.leadId];
@@ -380,6 +380,11 @@
         System.debug('opp.Sales_Method__c:'+opp.Sales_Method__c);
         System.debug('opp.Fund_Basis__c:'+opp.Fund_Basis__c);
         System.debug('opp.SAP_Province__c:'+opp.SAP_Province__c);
+
+        // 2022-04-15 OBSAP鏂板淇敼 start
+        opp.CampaignId = this.lead.Campaign__c;
+        System.debug('opp.CampaignId:'+opp.CampaignId);
+        // 2022-04-15 OBSAP鏂板淇敼 end
         update opp;
         return null;
     }
diff --git a/force-app/main/default/classes/XinDailyReportController.cls b/force-app/main/default/classes/XinDailyReportController.cls
index c12d850..4d40ade 100644
--- a/force-app/main/default/classes/XinDailyReportController.cls
+++ b/force-app/main/default/classes/XinDailyReportController.cls
@@ -733,6 +733,7 @@
                         Purpose_Type__c = e.Purpose_Type__c,
                         Related_Opportunity1__c = e.Related_Opportunity1__c,
                         OPDPlan_Flag__c = e.OPDPlan_Flag__c,
+                        Opd_Plan__c = e.Opd_Plan__c,  //2022-4-14 yjk 澧炲姞opd璁″垝
                         Related_Opportunity1_ID__c = e.Related_Opportunity1_ID__c,
                         Related_Opportunity2__c = e.Related_Opportunity2__c,
                         Related_Opportunity2_ID__c = e.Related_Opportunity2_ID__c,
diff --git a/force-app/main/default/pages/ConsumTrial.page b/force-app/main/default/pages/ConsumTrial.page
index 84a2976..d546908 100644
--- a/force-app/main/default/pages/ConsumTrial.page
+++ b/force-app/main/default/pages/ConsumTrial.page
@@ -6,6 +6,12 @@
     <apex:includeScript value="{!URLFOR($Resource.ReceivingNotePageJS)}"/>
     <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
     <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/>
+    
+    <script type="text/javascript">
+    	var txIds = [];
+        var trialuserMap={};
+    </script>
+    
     <apex:form id="allForm">
         <style>
             table.headTable td   {
@@ -25,468 +31,536 @@
             }
         </style>
         <script type="text/javascript">
-            var heightAjustment = 120;
-            var widthAjustment = 30;
-            var staticResource = JSON.parse('{!staticResource}');
-            
+        var heightAjustment = 120;
+        var widthAjustment = 30;
+        var staticResource = JSON.parse('{!staticResource}');
+        
 
-            // 閫傜敤鎸夐挳
-            function applyJs() {
-                var appliedFlag = true;
-                var selectFlag = true;
-                var isCheckFlag = false;
-                var ShowDemonstration = j$(escapeVfId('allPage:allForm:searchBlock:ShowDemonstration')).val();  // 灞曠ず/婕旂ず
-                var OperationType = j$(escapeVfId('allPage:allForm:searchBlock:OperationType')).val();  // 鏈紡绫诲埆
-                var ConsumStartDate = j$(escapeVfId('allPage:allForm:searchBlock:ConsumStartDate')).val();  // 棰勮浣跨敤鏃�
-                var CaseOrAnimalOrgan = j$(escapeVfId('allPage:allForm:searchBlock:CaseOrAnimalOrgan')).val();  // 鐥呬緥/鍔ㄧ墿鑴忓櫒
-                var TrialUser= j$(escapeVfId('allPage:allForm:searchBlock:TrialUser')).val();  // 璇曠敤鑰�
-                var FollowerUserid = j$(escapeVfId('allPage:allForm:searchBlock:FollowerUser_lkid')).val();  // 璺熷彴鑰匢d
-                var FollowerUsername = j$(escapeVfId('allPage:allForm:searchBlock:FollowerUser_lkold')).val();  // 璺熷彴鑰匩ame
+        // 閫傜敤鎸夐挳
+        function applyJs() {
+            var appliedFlag = true;
+            var selectFlag = true;
+            var isCheckFlag = false;
+            var ShowDemonstration = j$(escapeVfId('allPage:allForm:searchBlock:ShowDemonstration')).val();  // 灞曠ず/婕旂ず
+            var OperationType = j$(escapeVfId('allPage:allForm:searchBlock:OperationType')).val();  // 鏈紡绫诲埆
+            var ConsumStartDate = j$(escapeVfId('allPage:allForm:searchBlock:ConsumStartDate')).val();  // 棰勮浣跨敤鏃�
+            var CaseOrAnimalOrgan = j$(escapeVfId('allPage:allForm:searchBlock:CaseOrAnimalOrgan')).val();  // 鐥呬緥/鍔ㄧ墿鑴忓櫒
+            var TrialUser= j$(escapeVfId('allPage:allForm:searchBlock:TrialUser')).val();  // 璇曠敤鑰�
+            var FollowerUserid = j$(escapeVfId('allPage:allForm:searchBlock:FollowerUser_lkid')).val();  // 璺熷彴鑰匢d
+            var FollowerUsername = j$(escapeVfId('allPage:allForm:searchBlock:FollowerUser_lkold')).val();  // 璺熷彴鑰匩ame
 
-                var ShowDemonstrations = []; // 灞曠ず/婕旂ず
-                j$("td.intf.dataCellBorder1.Show_demonstration__c").each(function() {
-                    ShowDemonstrations.push(j$(this));
-                });
-                var OperationTypes = [];  // 鏈紡绫诲埆
-                j$("td.intf.dataCellBorder1.Operation_Type__c").each(function() {
-                    OperationTypes.push(j$(this));
-                });
-                var ConsumStartDates = [];  // 澶囧搧棰勮浣跨敤鏃�
-                j$("td.intf.dataCellBorder1.Consum_Start_Date__c").each(function() {
-                    ConsumStartDates.push(j$(this));
-                });
-                var CaseOrAnimalOrgans = [];  // 鐥呬緥/鍔ㄧ墿鑴忓櫒
-                j$("td.intf.dataCellBorder1.Case_OR_animal_organ__c").each(function() {
-                    CaseOrAnimalOrgans.push(j$(this));
-                });
+            var ShowDemonstrations = []; // 灞曠ず/婕旂ず
+            j$("td.intf.dataCellBorder1.Show_demonstration__c").each(function() {
+                ShowDemonstrations.push(j$(this));
+            });
+            var OperationTypes = [];  // 鏈紡绫诲埆
+            j$("td.intf.dataCellBorder1.Operation_Type__c").each(function() {
+                OperationTypes.push(j$(this));
+            });
+            var ConsumStartDates = [];  // 澶囧搧棰勮浣跨敤鏃�
+            j$("td.intf.dataCellBorder1.Consum_Start_Date__c").each(function() {
+                ConsumStartDates.push(j$(this));
+            });
+            var CaseOrAnimalOrgans = [];  // 鐥呬緥/鍔ㄧ墿鑴忓櫒
+            j$("td.intf.dataCellBorder1.Case_OR_animal_organ__c").each(function() {
+                CaseOrAnimalOrgans.push(j$(this));
+            });
 
-                var TrialUsers = [];  // 璇曠敤鑰�
-                j$("td.intf.dataCellBorder1.Trial_User__c").each(function() {
-                    TrialUsers.push(j$(this));
-                });
+            var TrialUsers = [];  // 璇曠敤鑰�
+            j$("td.intf.dataCellBorder1.Trial_User__c").each(function() {
+                TrialUsers.push(j$(this));
+            });
 
-                var FollowerUsers = [];  // 璺熷彴鑰�:
-                j$("td.intf.dataCellBorder1.Follower_User__c").each(function() {
-                    FollowerUsers.push(j$(this));
-                });
+            var FollowerUsers = [];  // 璺熷彴鑰�:
+            j$("td.intf.dataCellBorder1.Follower_User__c").each(function() {
+                FollowerUsers.push(j$(this));
+            });
 
-                var currentPageRecordCount = j$(escapeVfId('allPage:allForm:dataBlock:currentPageRecordCnt')).val();
-                for (var i = 0; i < currentPageRecordCount; i++) {
-                    var checkBox = j$(escapeVfId('allPage:allForm:dataBlock:dataline_L:' + i + ':rowCheck'));
-                    if (checkBox.prop('checked') == true) {
-                        isCheckFlag = true;
-                        // 'x'鏃朵笉閫傜敤
-                        if (ShowDemonstration != 'x') {
-                            ShowDemonstrations[i].find("select").val(ShowDemonstration);
-                            appliedFlag = false;
-                        }
-                        if (OperationType != 'x') {
-                            OperationTypes[i].find("select").val(OperationType);
-                            appliedFlag = false;
-                        }
-                        if (ConsumStartDate != null && ConsumStartDate != '' && typeof(ConsumStartDate) != "undefined") {
-                            ConsumStartDates[i].find("input").val(ConsumStartDate);
-                            appliedFlag = false;
-                        }
-                        if (CaseOrAnimalOrgan != 'x') {
-                            CaseOrAnimalOrgans[i].find("select").val(CaseOrAnimalOrgan);
-                            appliedFlag = false;
-                        }
+            var currentPageRecordCount = j$(escapeVfId('allPage:allForm:dataBlock:currentPageRecordCnt')).val();
+            for (var i = 0; i < currentPageRecordCount; i++) {
+                var checkBox = j$(escapeVfId('allPage:allForm:dataBlock:dataline_L:' + i + ':rowCheck'));
+                if (checkBox.prop('checked') == true) {
+                    isCheckFlag = true;
+                    // 'x'鏃朵笉閫傜敤
+                    if (ShowDemonstration != 'x') {
+                        ShowDemonstrations[i].find("select").val(ShowDemonstration);
+                        appliedFlag = false;
+                    }
+                    if (OperationType != 'x') {
+                        OperationTypes[i].find("select").val(OperationType);
+                        appliedFlag = false;
+                    }
+                    if (ConsumStartDate != null && ConsumStartDate != '' && typeof(ConsumStartDate) != "undefined") {
+                        ConsumStartDates[i].find("input").val(ConsumStartDate);
+                        appliedFlag = false;
+                    }
+                    if (CaseOrAnimalOrgan != 'x') {
+                        CaseOrAnimalOrgans[i].find("select").val(CaseOrAnimalOrgan);
+                        appliedFlag = false;
+                    }
 
-                        if (TrialUser != null && TrialUser != '' && typeof(TrialUser) != "undefined") {
-                            TrialUsers[i].find("input").val(TrialUser);
-                            appliedFlag = false;
-                        }
+                    if (TrialUser != null && TrialUser != '' && typeof(TrialUser) != "undefined") {
+                        TrialUsers[i].find("input").val(TrialUser);
+                        appliedFlag = false;
+                    }
 
-                        // if (equipmentTypes[i].find("select").val() != productCategory && productCategory != '') {
-                        if (FollowerUserid != null && parseInt(FollowerUserid) != 0 && typeof(FollowerUserid) != "undefined"
-                            && FollowerUsername != null && FollowerUsername != 'null' && typeof(FollowerUsername) != "undefined") {
-                            // setChangeFlg();
+                    // if (equipmentTypes[i].find("select").val() != productCategory && productCategory != '') {
+                    if (FollowerUserid != null && parseInt(FollowerUserid) != 0 && typeof(FollowerUserid) != "undefined"
+                        && FollowerUsername != null && FollowerUsername != 'null' && typeof(FollowerUsername) != "undefined") {
+                        // setChangeFlg();
 
-                            var inputs = FollowerUsers[i].find("input");
-                            for (var j = 0; j < inputs.length; j++) {
-                                if(inputs[j].name.endsWith('_lkid')) {
-                                    inputs[j].value = FollowerUserid;
-                                }
-                                else if (inputs[j].name.endsWith('_lkold')
-                                    || inputs[j].name.endsWith('inputField')) {
-                                    inputs[j].value = FollowerUsername;
-                                }
+                        var inputs = FollowerUsers[i].find("input");
+                        for (var j = 0; j < inputs.length; j++) {
+                            if(inputs[j].name.endsWith('_lkid')) {
+                                inputs[j].value = FollowerUserid;
                             }
-                            appliedFlag = false;
+                            else if (inputs[j].name.endsWith('_lkold')
+                                || inputs[j].name.endsWith('inputField')) {
+                                inputs[j].value = FollowerUsername;
+                            }
                         }
+                        appliedFlag = false;
                     }
                 }
-                j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(false);
-                // var clearApplyFlag = false;
-                window.setTimeout(function () {
-                    if (ConsumStartDate == null
-                        && TrialUser == null
-                        && (FollowerUserid== null || FollowerUsername == null)) {  // 閫傜敤鍏ュ姏妗嗗叏涓虹┖
-                        // alert('閫傜敤鍖鸿緭鍏ユ涓虹┖锛岃杈撳叆閫傜敤鍊笺��');
-                        var applyMsg = '閫傜敤鍖鸿緭鍏ユ涓虹┖锛岃杈撳叆閫傜敤鍊笺��';
-                        //passApplyMsgToController(applyMsg, 'Fail');
-                        return;
-                    }
-                    if (isCheckFlag == false) {
-                        // alert('鏈嬀閫変换浣曞緟閫傜敤鏁版嵁銆�');
-                        var applyMsg = '鏈嬀閫変换浣曞緟閫傜敤鏁版嵁銆�';
-                        //passApplyMsgToController(applyMsg, 'Fail');
-                        return;
-                    }
+            }
+            j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(false);
+            // var clearApplyFlag = false;
+            window.setTimeout(function () {
+                if (ConsumStartDate == null
+                    && TrialUser == null
+                    && (FollowerUserid== null || FollowerUsername == null)) {  // 閫傜敤鍏ュ姏妗嗗叏涓虹┖
+                    // alert('閫傜敤鍖鸿緭鍏ユ涓虹┖锛岃杈撳叆閫傜敤鍊笺��');
+                    var applyMsg = '閫傜敤鍖鸿緭鍏ユ涓虹┖锛岃杈撳叆閫傜敤鍊笺��';
+                    //passApplyMsgToController(applyMsg, 'Fail');
+                    return;
+                }
+                if (isCheckFlag == false) {
+                    // alert('鏈嬀閫変换浣曞緟閫傜敤鏁版嵁銆�');
+                    var applyMsg = '鏈嬀閫変换浣曞緟閫傜敤鏁版嵁銆�';
+                    //passApplyMsgToController(applyMsg, 'Fail');
+                    return;
+                }
 
-                    if (selectFlag) {
-                        if (!appliedFlag) {
-                            var alertMsg = "閫傜敤瀹屼簡 \r\n";
-                            if (ConsumStartDate != null && typeof(ConsumStartDate) != "undefined") {
-                                var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "澶囧搧棰勮浣跨敤鏃�" + " 閫傜敤涓� " + ConsumStartDate + " \r\n";
-                                alertMsg += alertMsg1;
-                            }
-                            if (TrialUser != null && typeof(TrialUser) != "undefined") {
-                                var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "璇曠敤鑰�" + " 閫傜敤涓� " + TrialUser + " \r\n";
-                                alertMsg += alertMsg1;
-                            }
-                            if (FollowerUserid != null && typeof(FollowerUserid) != "undefined"
-                                && FollowerUsername != null && typeof(FollowerUsername) != "undefined") {
-                                var alertMsg2 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "璺熷彴鑰�:" + " 閫傜敤涓� " + FollowerUsername + " \r\n";
-                                alertMsg += alertMsg2;
-                            }
-                            // alert(alertMsg);
-                            // clearApplyFlag = true;
-                            j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(true);
-                            //passApplyMsgToController(alertMsg, 'Success');
+                if (selectFlag) {
+                    if (!appliedFlag) {
+                        var alertMsg = "閫傜敤瀹屼簡 \r\n";
+                        if (ConsumStartDate != null && typeof(ConsumStartDate) != "undefined") {
+                            var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "澶囧搧棰勮浣跨敤鏃�" + " 閫傜敤涓� " + ConsumStartDate + " \r\n";
+                            alertMsg += alertMsg1;
                         }
+                        if (TrialUser != null && typeof(TrialUser) != "undefined") {
+                            var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "璇曠敤鑰�" + " 閫傜敤涓� " + TrialUser + " \r\n";
+                            alertMsg += alertMsg1;
+                        }
+                        if (FollowerUserid != null && typeof(FollowerUserid) != "undefined"
+                            && FollowerUsername != null && typeof(FollowerUsername) != "undefined") {
+                            var alertMsg2 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "璺熷彴鑰�:" + " 閫傜敤涓� " + FollowerUsername + " \r\n";
+                            alertMsg += alertMsg2;
+                        }
+                        // alert(alertMsg);
+                        // clearApplyFlag = true;
+                        j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(true);
+                        //passApplyMsgToController(alertMsg, 'Success');
+                    }
+                } else {
+                    if (!appliedFlag) {
+                        var alertMsg = "閫傜敤瀹屼簡 \r\n";
+                        if (ConsumStartDate != null && typeof(ConsumStartDate) != "undefined") {
+                            var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "澶囧搧棰勮浣跨敤鏃�" + " 閫傜敤涓� " + ConsumStartDate + " \r\n";
+                            alertMsg += alertMsg1;
+                        }
+                        if (TrialUser != null && typeof(TrialUser) != "undefined") {
+                            var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + " 璇曠敤鑰�" + " 閫傜敤涓� " + TrialUser + " \r\n";
+                            alertMsg += alertMsg1;
+                        }
+                        if (FollowerUserid != null && typeof(FollowerUserid) != "undefined"
+                            && FollowerUsername != null && typeof(FollowerUsername) != "undefined") {
+                            var alertMsg2 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "璺熷彴鑰�:" + " 閫傜敤涓� " + FollowerUsername + " \r\n";
+                            alertMsg += alertMsg2;
+                        }
+                        //passApplyMsgToController(alertMsg, 'Success');
+                        j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(true);
                     } else {
-                        if (!appliedFlag) {
-                            var alertMsg = "閫傜敤瀹屼簡 \r\n";
-                            if (ConsumStartDate != null && typeof(ConsumStartDate) != "undefined") {
-                                var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "澶囧搧棰勮浣跨敤鏃�" + " 閫傜敤涓� " + ConsumStartDate + " \r\n";
-                                alertMsg += alertMsg1;
-                            }
-                            if (TrialUser != null && typeof(TrialUser) != "undefined") {
-                                var alertMsg1 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + " 璇曠敤鑰�" + " 閫傜敤涓� " + TrialUser + " \r\n";
-                                alertMsg += alertMsg1;
-                            }
-                            if (FollowerUserid != null && typeof(FollowerUserid) != "undefined"
-                                && FollowerUsername != null && typeof(FollowerUsername) != "undefined") {
-                                var alertMsg2 = "宸插皢鎵撳嬀鏁版嵁涓殑 " + "璺熷彴鑰�:" + " 閫傜敤涓� " + FollowerUsername + " \r\n";
-                                alertMsg += alertMsg2;
-                            }
-                            //passApplyMsgToController(alertMsg, 'Success');
-                            j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(true);
-                        } else {
-                            var alertMsg = "鍏朵粬閫夐」: " + otherSelectOptionText +"涓棤姝ら�夐」鍊�" + otherSelectOptionValue + "锛屾棤娉曟洿鏂般��";
-                            //passApplyMsgToController(alertMsg, 'Fail');
-                        }
+                        var alertMsg = "鍏朵粬閫夐」: " + otherSelectOptionText +"涓棤姝ら�夐」鍊�" + otherSelectOptionValue + "锛屾棤娉曟洿鏂般��";
+                        //passApplyMsgToController(alertMsg, 'Fail');
                     }
-                }, 5);
-            }
-
-            function clearApplyValue() {
-                var clearApplyValueFlag = j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val();
-                if(clearApplyValueFlag) {
-                    j$(escapeVfId('{!$Component.stockId}')).val('');
-                    j$(escapeVfId('{!$Component.applyEquipmentTypeId}')).val('');
-                    j$(escapeVfId('{!$Component.applyAssetTypeListId}')).val('');
-                    j$(escapeVfId('{!$Component.otherSelectionId}')).val('');
                 }
-                j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(false);
-            }
+            }, 5);
+        }
 
-            function checkSavingJs() {
-                var isSavingSuccess = j$(escapeVfId('isSavingSuccessId')).val();
-                // alert(isSavingSuccess);
-                if (isSavingSuccess != 'false') {
-                    //setSaveSuccessMsg();
+        function clearApplyValue() {
+            var clearApplyValueFlag = j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val();
+            if(clearApplyValueFlag) {
+                j$(escapeVfId('{!$Component.stockId}')).val('');
+                j$(escapeVfId('{!$Component.applyEquipmentTypeId}')).val('');
+                j$(escapeVfId('{!$Component.applyAssetTypeListId}')).val('');
+                j$(escapeVfId('{!$Component.otherSelectionId}')).val('');
+            }
+            j$(escapeVfId('allPage:allForm:pageBlockButton1:clearApplyFlagId')).val(false);
+        }
+
+        function checkSavingJs() {
+            var isSavingSuccess = j$(escapeVfId('isSavingSuccessId')).val();
+            // alert(isSavingSuccess);
+            if (isSavingSuccess != 'false') {
+                //setSaveSuccessMsg();
+            }
+        }
+
+        function resetMove(d, up, len) {
+            var line = j$(escapeVfId(d)).find('input')[0].value;
+            resetMoveUpDown(up, parseInt(line), len);
+        }
+
+        function moveToTop(d, up, len) {
+            var line = j$(escapeVfId(d)).find('input')[0].value;
+            console.log(line);
+            var isSuccessful = true;
+            if (up) {
+                for(var i = parseInt(line) ; i > 1 && isSuccessful; i-- ) {
+                    isSuccessful = resetMoveUpDown(up, i, len);
                 }
             }
-
-            function resetMove(d, up, len) {
-                var line = j$(escapeVfId(d)).find('input')[0].value;
-                resetMoveUpDown(up, parseInt(line), len);
+            else {
+                for(var i = parseInt(line) ; i < len && isSuccessful; i++ ) {
+                    isSuccessful = resetMoveUpDown(up, i, len);
+                }
             }
+            unblockUI();
+        }
 
-            function moveToTop(d, up, len) {
-                var line = j$(escapeVfId(d)).find('input')[0].value;
-                console.log(line);
-                var isSuccessful = true;
-                if (up) {
-                    for(var i = parseInt(line) ; i > 1 && isSuccessful; i-- ) {
-                        isSuccessful = resetMoveUpDown(up, i, len);
+        function resetMoveUpDown(up, line, len) {
+
+            var items = j$(".dataCellBorder2");
+            var item1 = j$("td.intf.dataCellBorder1.Degree_Of_Importance__c");
+            var item2 = j$("td.dataCellBorder1.col_Fixture_Model_No__c");
+            var currentPageRecordCount = j$(escapeVfId('allPage:allForm:dataBlock:currentPageRecordCnt')).val();
+            var isSuccessful = false;
+            // alert(item1);
+            var i = line - 1;
+            var i1 = line + 1;
+            // var tr = j$('#tableData').find('tbody').find('tr:eq(' + (i) + ')');
+            if (up == true){
+                var tr = j$('#tableData').find('tbody').find('tr:eq(' + (i) + ')');
+                var trL = j$('#tableData_L').find('tbody').find('tr:eq(' + (i) + ')');
+                if(line != 1) {
+                    var model1 = j$(item2[i - 1]).find("span").text();
+                    var model2 = j$(item2[i]).find("span").text();
+                    if (model1 != model2) {
+                        unblockUI();
+                        return;
                     }
+
+                    var v1 = j$(item1[i - 1]).find("input").val();
+                    var v2 = j$(item1[i]).find("input").val();
+                    setChangeFlg(i-1);
+                    setChangeFlg(i);
+                    j$(items[i - 1]).children('.ordernocls').val(line);
+                    j$(items[i]).children('.ordernocls').val(line - 1);
+                    j$(item1[i - 1]).find("input").val(v2);
+                    j$(item1[i]).find("input").val(v1);
+
+                    isSuccessful = true;
+                    // j$(item1[i - 1]).children('.ordernocls').val('' + line);
+                    // j$(item1[i]).children('.ordernocls').val('' + i);
                 }
                 else {
-                    for(var i = parseInt(line) ; i < len && isSuccessful; i++ ) {
-                        isSuccessful = resetMoveUpDown(up, i, len);
-                    }
+                    j$(items[i]).children('.ordernocls').val(line);
                 }
-                unblockUI();
+                var tr1 = j$(items[i]).parents("tr");
+                tr.prev().before(tr);
+                trL.prev().before(trL);
             }
-
-            function resetMoveUpDown(up, line, len) {
-
-                var items = j$(".dataCellBorder2");
-                var item1 = j$("td.intf.dataCellBorder1.Degree_Of_Importance__c");
-                var item2 = j$("td.dataCellBorder1.col_Fixture_Model_No__c");
-                var currentPageRecordCount = j$(escapeVfId('allPage:allForm:dataBlock:currentPageRecordCnt')).val();
-                var isSuccessful = false;
-                // alert(item1);
-                var i = line - 1;
-                var i1 = line + 1;
-                // var tr = j$('#tableData').find('tbody').find('tr:eq(' + (i) + ')');
-                if (up == true){
+            else {
+                if(line < currentPageRecordCount) {
+                    var model1 = j$(item2[i]).find("span").text();
+                    var model2 = j$(item2[line]).find("span").text();
+                    if (model1 != model2) {
+                        unblockUI();
+                        return;
+                    }
                     var tr = j$('#tableData').find('tbody').find('tr:eq(' + (i) + ')');
                     var trL = j$('#tableData_L').find('tbody').find('tr:eq(' + (i) + ')');
-                    if(line != 1) {
-                        var model1 = j$(item2[i - 1]).find("span").text();
-                        var model2 = j$(item2[i]).find("span").text();
-                        if (model1 != model2) {
-                            unblockUI();
-                            return;
-                        }
-
-                        var v1 = j$(item1[i - 1]).find("input").val();
-                        var v2 = j$(item1[i]).find("input").val();
-                        setChangeFlg(i-1);
-                        setChangeFlg(i);
-                        j$(items[i - 1]).children('.ordernocls').val(line);
-                        j$(items[i]).children('.ordernocls').val(line - 1);
-                        j$(item1[i - 1]).find("input").val(v2);
-                        j$(item1[i]).find("input").val(v1);
-
-                        isSuccessful = true;
-                        // j$(item1[i - 1]).children('.ordernocls').val('' + line);
-                        // j$(item1[i]).children('.ordernocls').val('' + i);
-                    }
-                    else {
-                        j$(items[i]).children('.ordernocls').val(line);
-                    }
+                    var v1 = j$(item1[i]).find("input").val();
+                    var v2 = j$(item1[i + 1]).find("input").val();
+                    setChangeFlg(i);
+                    setChangeFlg(i + 1);
+                    j$(items[i]).children('.ordernocls').val(line + 1);
+                    j$(items[i + 1]).children('.ordernocls').val(line);
+                    j$(item1[i]).find("input").val(v2);
+                    j$(item1[line]).find("input").val(v1);
                     var tr1 = j$(items[i]).parents("tr");
-                    tr.prev().before(tr);
-                    trL.prev().before(trL);
+                    tr.next().after(tr);
+                    trL.next().after(trL);
+                    isSuccessful = true;
                 }
                 else {
-                    if(line < currentPageRecordCount) {
-                        var model1 = j$(item2[i]).find("span").text();
-                        var model2 = j$(item2[line]).find("span").text();
-                        if (model1 != model2) {
-                            unblockUI();
-                            return;
-                        }
-                        var tr = j$('#tableData').find('tbody').find('tr:eq(' + (i) + ')');
-                        var trL = j$('#tableData_L').find('tbody').find('tr:eq(' + (i) + ')');
-                        var v1 = j$(item1[i]).find("input").val();
-                        var v2 = j$(item1[i + 1]).find("input").val();
-                        setChangeFlg(i);
-                        setChangeFlg(i + 1);
-                        j$(items[i]).children('.ordernocls').val(line + 1);
-                        j$(items[i + 1]).children('.ordernocls').val(line);
-                        j$(item1[i]).find("input").val(v2);
-                        j$(item1[line]).find("input").val(v1);
-                        var tr1 = j$(items[i]).parents("tr");
-                        tr.next().after(tr);
-                        trL.next().after(trL);
-                        isSuccessful = true;
-                    }
-                    else {
-                        j$(items[i]).children('.ordernocls').val(line);
-                    }
+                    j$(items[i]).children('.ordernocls').val(line);
                 }
-                unblockUI();
-                return isSuccessful;
             }
+            unblockUI();
+            return isSuccessful;
+        }
 
-            function refopener() {
-                window.opener.location.href = '/apex/ConsumTrial?id={!parId}';
+        function refopener() {
+            window.opener.location.href = '/apex/ConsumTrial?id={!parId}';
+        }
+
+        if (window.history.pushState) {
+            if (window.location.href.indexOf('&saveType=1') > -1) {
+                refopener();
             }
+            window.history.pushState({}, "", window.location.href.replace('&saveType=1', ''));
+        }
 
-            if (window.history.pushState) {
-                if (window.location.href.indexOf('&saveType=1') > -1) {
-                    refopener();
-                }
-                window.history.pushState({}, "", window.location.href.replace('&saveType=1', ''));
+        //2022 02 24 寮犲崕寤� display PI Data start
+        var rowBList;
+        var TrialUser = {};
+        var ids = [];
+
+        function HasError(){
+            // let e = document.getElementById("allPage:allForm:message");
+
+            // if (!e) {
+            //     return false;
+            // }
+
+            // let divs = j$(e).find("div.message");
+            // for (let i = 0; i < divs.length; i++) {
+            //     for (let j = 0; j < divs[i].classList.length; j++) {
+            //         for(let cls in divs[i].classList){
+            //             console.log('cls = ' + cls);
+            //             if (cls.indexOf('error')>-1) {
+            //                 return true;
+            //             }
+            //         }
+                    
+            //     }
+                
+            // }
+            // return false;
+
+            if(document.getElementById("allPage:allForm:message").children[0] && document.getElementById("allPage:allForm:message").children[0].children[0].className == 'message errorM3'){
+                return true;
             }
+            return false;
+        }
 
-            //2022 02 24 寮犲崕寤� display PI Data start
-            var rowBList;
-            var TrialUser = {};
-            var ids = [];
-
-            queryUser();
-
-            function q1(){
-                var p = new Promise(function(resolve, reject){
-                    rowBList = JSON.parse('{!rowListString}')
-                    var x = 0;
-                    var y = 0;
-                    let searchCallBack = function searchCallBack(result){
-                        let contacts = result.object;
-                        if(contacts == null){
-                            return;
-                        }
-                        let temp = {}
-                        temp.trialUser = contacts.trialUser;
-                        TrialUser[contacts.dataId] = temp;
-                        x++;
-                    };
-                    for(var i=0;i<rowBList.length;i++){
-                        if(rowBList[i].rnd.AWS_Data_Id__c ){
-                            y++;
-                            ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id);
-                            AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token);
-                        }
-                    }
-                    var id = setInterval(function(){
-                        if(x == y){
-                            console.log('success')
-                            resolve('success');
-                            clearInterval(id);
-                        }
-                    },500);  
-                });
-                return p;
+        function isError(){
+            if(HasError()){
+                alert('xxxx');
             }
+        }
 
-            function q2(value){
-                var p = new Promise(function(resolve, reject){ 
-                    console.log('杩涘叆q2'+value)
-                    for(var i=0;i<ids.length;i++){
-                        console.log('i = '+i);
-                        document.getElementById(ids[i]).children[0].children[0].children[0].value = TrialUser[ids[i].substring(0,18)].trialUser;
-                        console.log('i = '+i);
-                    }
-                }); 
-            }
-            
-            function queryUser(){
+
+
+        queryUser();
+
+        function q1(){
+            var p = new Promise(function(resolve, reject){
                 rowBList = JSON.parse('{!rowListString}')
-                console.log('pageB.fixMode = '+'{!pageB.fixMode}')
-                if('{!pageB.fixMode}' == 'true'){
-                    q1().then(function(data){
-                        return q2(data);
-                    })
-                    unblockUI();
-                }else{
-                    blockme();
-                    console.log(rowBList)
-                    let searchCallBack = function searchCallBack(result){
-                        let contacts = result.object;
-                        if(contacts == null){
-                            return;
-                        }
-                        let temp = {}
-                        temp.trialUser = contacts.trialUser;
-                        TrialUser[contacts.dataId] = temp;
-                    };
-                    for(var i=0;i<rowBList.length;i++){
+                var x = 0;
+                var y = 0;
+                let searchCallBack = function searchCallBack(result){
+                    let contacts = result.object;
+                    if(contacts == null){
+                        return;
+                    }
+                    let temp = {}
+                    temp.trialUser = contacts.trialUser;
+                    TrialUser[contacts.dataId] = temp;
+                    x++;
+                };
+                for(var i=0;i<rowBList.length;i++){
+                    if(rowBList[i].rnd.AWS_Data_Id__c ){
+                        y++;
                         ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id);
                         AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token);
                     }
-                    unblockUI();
                 }
-            }
-
-            function showPIDiv(awsDataId){
-                if(awsDataId.length == 0){
-                    return
-                }
-                if(TrialUser[awsDataId.substring(0,18)] == null){
-                    return
-                }
-                console.log('awsDataId Value:'+awsDataId);
-                let parentNode = document.getElementById(awsDataId);
-                let createDiv = document.createElement("div");  
-                createDiv.id = awsDataId+"_PI";  
-                let piInformation = TrialUser[awsDataId.substring(0,18)].trialUser
-                //let piInformation = 'Name:'+contact['943114607025717249'].lastName +'\n' +'Phone:'+contact['943114607025717249'].phone
-                createDiv.innerText = piInformation;
-                let x=window.event.x;
-                let y=window.event.y; 
-                createDiv.style.left=x;  
-                createDiv.style.top=y;  
-                createDiv.style.background="#dddddd";
-                createDiv.style.position = "absolute";
-                parentNode.appendChild(createDiv);  
-                parentNode.style.position = "relative";
-            }
-
-            function hidePIDiv(awsDataId){
-                if(awsDataId.length == 0){
-                    return
-                }
-                if(TrialUser[awsDataId.substring(0,18)] == null){
-                    return
-                }
-                document.getElementById(awsDataId+'_PI').remove();
-            }
-
-            function q3(){
-                var p = new Promise(function(resolve, reject){
-                    console.log('saveRecordJS')
-                   
-                    var a = 0;
-                    var b = 0;
-                    let newCallBack = function newCallBack(result,indexNumber){
-                        
-                        console.log('result = '+JSON.stringify(result))
-                        //璧嬪�糳ataId鍜宼rialUser
-                        document.getElementById('allPage:allForm:dataBlock:dataline_R_aws:'+indexNumber+':EditAWSDataId').value = result.object[0].dataId;
-                        document.getElementById('allPage:allForm:dataBlock:dataline_R:'+indexNumber+':inputField:6:inputField').value = result.object[0].trialUser;
-                        let transParameters = {
-                            txId: result.txId,
-                            isSuccess: 1
-                        };
-                        let confirmCallBack = function confirmCallBack(result){
-                            console.log('confirmCallBack = '+JSON.stringify(result))
-                        }
-                        b++;
-                        AWSService.confirmTrans(staticResource.transactionUrl,JSON.stringify(transParameters),confirmCallBack,staticResource.token)
-                    };
-                    for(var i=0;i<rowBList.length;i++){
-                        if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){
-                            a++;
-                        }
+                var id = setInterval(function(){
+                    if(x == y){
+                        console.log('success')
+                        resolve('success');
+                        clearInterval(id);
                     }
-                    debugger
-                    for(var i=0;i<rowBList.length;i++){
-                        if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){
-                            //鍔犲瘑璇曠敤鑰�
-                            var trialUser = document.getElementById('allPage:allForm:dataBlock:dataline_R:'+i+':inputField:6:j_id86').children[0].children[0].value
-                            let consumApplyPayloadList = [];
-                            let consumApplyPIData = new Object();
-                            consumApplyPIData.trialUser = trialUser;
-                            consumApplyPIData.sfRecordId = '';
-                            consumApplyPayloadList.push(consumApplyPIData);
-                            AWSService.postConsumTrial(staticResource.newUrl,i,JSON.stringify(consumApplyPayloadList),newCallBack,staticResource.token);
-                        }
-                    }
-                    var id = setInterval(function(){
-                        if(a == b){
-                            console.log('a==b success')
-                            resolve('success');
-                            clearInterval(id);
-                        }
-                    },500);  
-                });
-                return p;
-            }
+                },500);  
+            });
+            return p;
+        }
 
-            function q4(){
-                debugger
-                saveRecord();
-            }
-            function saveRecordJS(){
-                if('{!pageB.fixMode}' != 'true'){
-                        return
+        function q2(value){
+            var p = new Promise(function(resolve, reject){ 
+                console.log('杩涘叆q2'+value)
+                for(var i=0;i<ids.length;i++){
+                    console.log('i = '+i);
+                    document.getElementById(ids[i]).children[0].children[0].children[0].value = TrialUser[ids[i].substring(0,18)].trialUser;
+                    console.log('i = '+i);
+                }
+            }); 
+        }
+        
+        function queryUser(){
+            rowBList = JSON.parse('{!rowListString}')
+            console.log('pageB.fixMode = '+'{!pageB.fixMode}')
+            if('{!pageB.fixMode}' == 'true'){
+                q1().then(function(data){
+                    return q2(data);
+                })
+                unblockUI();
+            }else{
+                blockme();
+                console.log(rowBList)
+                let searchCallBack = function searchCallBack(result){
+                    let contacts = result.object;
+                    if(contacts == null){
+                        return;
                     }
-                q3().then(function(data){
-                        return q4(data);
-                    })
+                    let temp = {}
+                    temp.trialUser = contacts.trialUser;
+                    TrialUser[contacts.dataId] = temp;
+                };
+                for(var i=0;i<rowBList.length;i++){
+                    ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id);
+                    AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token);
+                }
                 unblockUI();
             }
-            //2022 02 24 寮犲崕寤� display PI Data end
-        </script>
-        <apex:pageMessages />
+        }
+
+        function showPIDiv(awsDataId){
+            if(awsDataId.length == 0){
+                return
+            }
+            if(TrialUser[awsDataId.substring(0,18)] == null){
+                return
+            }
+            console.log('awsDataId Value:'+awsDataId);
+            let parentNode = document.getElementById(awsDataId);
+            let createDiv = document.createElement("div");  
+            createDiv.id = awsDataId+"_PI";  
+            let piInformation = TrialUser[awsDataId.substring(0,18)].trialUser
+            //let piInformation = 'Name:'+contact['943114607025717249'].lastName +'\n' +'Phone:'+contact['943114607025717249'].phone
+            createDiv.innerText = piInformation;
+            let x=window.event.x;
+            let y=window.event.y; 
+            createDiv.style.left=x;  
+            createDiv.style.top=y;  
+            createDiv.style.background="#dddddd";
+            createDiv.style.position = "absolute";
+            parentNode.appendChild(createDiv);  
+            parentNode.style.position = "relative";
+        }
+
+        function hidePIDiv(awsDataId){
+            if(awsDataId.length == 0){
+                return
+            }
+            if(TrialUser[awsDataId.substring(0,18)] == null){
+                return
+            }
+            document.getElementById(awsDataId+'_PI').remove();
+        }
+
+        
+        function q3(){
+            var p = new Promise(function(resolve, reject){
+                console.log('saveRecordJS')
+                txIds = [];
+                trialuserMap = {};
+                var a = 0;
+                var b = 0;
+                debugger
+                let newCallBack = function newCallBack(result,indexNumber){
+                    //璧嬪�糳ataId鍜宼rialUser
+                    document.getElementById('allPage:allForm:dataBlock:dataline_R_aws:'+indexNumber+':EditAWSDataId').value = result.object[0].dataId;
+                    document.getElementById('allPage:allForm:dataBlock:dataline_R_aws:'+indexNumber+':TrialUserEncrypt').value = result.object[0].trialUserEncrypt;
+                    document.getElementById('allPage:allForm:dataBlock:dataline_R:'+indexNumber+':inputField:6:inputField').value = result.object[0].trialUser;
+                    // let transParameters = {
+                    //     txId: result.txId,
+                    //     isSuccess: 1
+                    // };
+                    // let confirmCallBack = function confirmCallBack(result){
+                    //     console.log('confirmCallBack = '+JSON.stringify(result))
+                    // }
+                    b++;
+                    txIds.push(result.txId)
+                    //AWSService.confirmTrans(staticResource.transactionUrl,JSON.stringify(transParameters),confirmCallBack,staticResource.token)
+                };
+                for(var i=0;i<rowBList.length;i++){
+                    if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){
+                        a++;
+                    }
+                }
+                for(var i=0;i<rowBList.length;i++){
+                    if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){
+                        //鍔犲瘑璇曠敤鑰�
+                        let e = document.getElementById('allPage:allForm:dataBlock:dataline_R:'+i+':inputField:6:j_id86').children[0].children[0];
+                        var trialUser = e.value;
+                        trialuserMap['allPage:allForm:dataBlock:dataline_R:'+i+':inputField:6:j_id86'] = trialUser;
+                        let consumApplyPayloadList = [];
+                        let consumApplyPIData = new Object();
+                        consumApplyPIData.trialUser = trialUser;
+                        consumApplyPIData.sfRecordId = '';
+                        consumApplyPayloadList.push(consumApplyPIData);
+                        AWSService.postConsumTrial(staticResource.newUrl,i,JSON.stringify(consumApplyPayloadList),newCallBack,staticResource.token);
+                    }
+                }
+                var id = setInterval(function(){
+                    if(a == b){
+                        console.log('a==b success')
+                        resolve('success');
+                        clearInterval(id);
+                    }
+                },500);  
+            });
+            return p;
+        }
+
+        function q4(){
+            debugger
+            saveRecord();
+        }
+
+        function Trans(){
+            if(HasError()){
+                unblockUI();
+                for(var e in trialuserMap){
+                    document.getElementById(e).children[0].children[0].value = trialuserMap[e];
+                }
+                return;
+            }
+            var x = 0;
+            let confirmCallBack = function confirmCallBack(result){
+                console.log('confirmCallBack = '+JSON.stringify(result))
+                x++;
+                if(x == txIds.length){
+                    refopener();
+                    unblockUI();
+                    window.location.href='/apex/ConsumTrial?id=' + '{!parId}' + '&canedit=true&saveType=1';
+                }
+            }
+            for(var i=0;i<txIds.length;i++){
+                let transParameters = {
+                        txId: txIds[i],
+                        isSuccess: 1
+                };
+                AWSService.confirmTrans(staticResource.transactionUrl,JSON.stringify(transParameters),confirmCallBack,staticResource.token)
+            }
+        }
+
+        function saveRecordJS(){
+            if('{!pageB.fixMode}' != 'true'){
+                    return
+                }
+            q3().then(function(data){
+                    return q4(data);
+                })
+            unblockUI();
+        }
+        //2022 02 24 寮犲崕寤� display PI Data end
+    </script>
+        <apex:pageMessages id="message"/>
         <!-- oncomplete="clearApplyValue(); return false;" -->
         <apex:actionFunction name="passApplyMsgToController" action="{!showApplyMsg}"  rerender="allForm">
             <apex:param name="applyMsg" value="" />
@@ -495,7 +569,7 @@
         <apex:actionFunction name="sendEmail" action="{!sendEmail}"  rerender="allForm" oncomplete="unblockUI();">
             <apex:param name="emailBody" value="" />
         </apex:actionFunction>
-        <apex:actionFunction name="saveRecord" action="{!saveRecord}" oncomplete="refopener();unblockUI();" rerender="allForm"/>
+        <apex:actionFunction name="saveRecord" action="{!saveRecord}" oncomplete="Trans();" rerender="allForm"/>
         <apex:inputHidden id="clearApplyFlagId" />
         <apex:outputPanel id="pageallPanel">
             <apex:pageBlock id="searchBlock">
@@ -631,6 +705,7 @@
                 </div>
                 <apex:repeat id="dataline_R_aws" value="{!pageB.rowBList}" var="var">
                     <apex:inputHidden value="{!var.rnd.AWS_Data_Id__c}" id="EditAWSDataId"/> 
+                    <apex:inputHidden value="{!var.rnd.Trial_User_Encrypt__c}" id="TrialUserEncrypt"/> 
                 </apex:repeat>
                 <div id="in_Div" style="overflow:auto;">
                     <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableData">
diff --git a/force-app/main/default/pages/FixtureRentalPDF.page b/force-app/main/default/pages/FixtureRentalPDF.page
index 9601497..15e0cf0 100644
--- a/force-app/main/default/pages/FixtureRentalPDF.page
+++ b/force-app/main/default/pages/FixtureRentalPDF.page
@@ -277,9 +277,14 @@
                         <table border="0" width="100%" style="border-collapse: collapse;margin: 0;">
                             <apex:outputPanel layout="none" rendered="{!IF(!IsShowLU , true, false)}">
                                 <tr>
+                                    
                                     <td style="font-size:22px;">
-                                        <apex:outputText value="{!IF(record.isAgencyOrCenter,record.AgencyAddressName,centreAddress)}" />
+                                        <!-- 20220413 ljh 鎶ご鏄剧ず update start -->
+                                        <!-- <apex:outputText value="{!IF(record.isAgencyOrCenter,record.AgencyAddressName,centreAddress)}" /> -->
+                                        <apex:outputText value="{!IF(isAgencyOrCenter,AgencyAddressName,centreAddress)}" />
+                                        <!-- 20220413 ljh 鎶ご鏄剧ず update end -->
                                     </td>
+                                    
                                     <td rowspan="2">
                                         <img style="float: right; width: 55px; height: 55px;padding: 0px;margin-top: 0mm;" src="{!qrcode}"
                                         />
@@ -287,8 +292,12 @@
                                 </tr>
                                 <tr>
                                     <td style="font-size:15px;">
-                                        <c:PDFWbr targetStr="{!IF(record.AgencyOrCenterAddress=='BeiJingCenter','鍖椾含甯傛湞闃冲尯閰掍粰妗ヨ矾10鍙锋亽閫氬晢鍔″洯B12C搴цタ闂�1F 鐢佃瘽:010-59756006-1871',IF(record.AgencyOrCenterAddress=='ShangHaiCenter','涓婃捣甯傛郸涓滄柊鍖哄攼闀囧垱涓氳矾183鍙�2骞�1F 鐢佃瘽:021-60391318-8877',IF(record.AgencyOrCenterAddress=='GuangZhouCenter','骞垮窞甯傜暘绂哄尯涓滅幆琛楃暘绂哄ぇ閬撳寳537鍙风暘灞卞垱涓氫腑蹇�3鍙锋ゼ1F 鐢佃瘽:020-39198888-8876',record.AgencyOrCenterAddress)))}"
+                                        <!-- 20220413 ljh 鎶ご鏄剧ず update start -->
+                                        <!-- <c:PDFWbr targetStr="{!IF(record.AgencyOrCenterAddress=='BeiJingCenter','鍖椾含甯傛湞闃冲尯閰掍粰妗ヨ矾10鍙锋亽閫氬晢鍔″洯B12C搴цタ闂�1F 鐢佃瘽:010-59756006-1871',IF(record.AgencyOrCenterAddress=='ShangHaiCenter','涓婃捣甯傛郸涓滄柊鍖哄攼闀囧垱涓氳矾183鍙�2骞�1F 鐢佃瘽:021-60391318-8877',IF(record.AgencyOrCenterAddress=='GuangZhouCenter','骞垮窞甯傜暘绂哄尯涓滅幆琛楃暘绂哄ぇ閬撳寳537鍙风暘灞卞垱涓氫腑蹇�3鍙锋ゼ1F 鐢佃瘽:020-39198888-8876',record.AgencyOrCenterAddress)))}"
+                                        /> -->
+                                        <c:PDFWbr targetStr="{!IF(AgencyOrCenterAddress=='BeiJingCenter','鍖椾含甯傛湞闃冲尯閰掍粰妗ヨ矾10鍙锋亽閫氬晢鍔″洯B12C搴цタ闂�1F 鐢佃瘽:010-59756006-1871',IF(AgencyOrCenterAddress=='ShangHaiCenter','涓婃捣甯傛郸涓滄柊鍖洪噾鍚夎矾778鍙�3鍙锋ゼ1F 鐢佃瘽:021-60391318-8877',IF(AgencyOrCenterAddress=='GuangZhouCenter','骞垮窞甯傜暘绂哄尯涓滅幆琛楃暘绂哄ぇ閬撳寳537鍙风暘灞卞垱涓氫腑蹇�3鍙锋ゼ1F 鐢佃瘽:020-39198888-8876',AgencyOrCenterAddress)))}"
                                         />
+                                        <!-- 20220413 ljh 鎶ご鏄剧ず update start -->
                                     </td>
                                 </tr>
                             </apex:outputPanel>
diff --git a/force-app/main/default/pages/NewAndEditASEActivity.page b/force-app/main/default/pages/NewAndEditASEActivity.page
index 9f8c918..fca017e 100644
--- a/force-app/main/default/pages/NewAndEditASEActivity.page
+++ b/force-app/main/default/pages/NewAndEditASEActivity.page
@@ -495,7 +495,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -517,8 +517,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!ASEActivity__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!ASEActivity__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!ASEActivity__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!ASEActivity__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -526,18 +530,18 @@
                 </apex:pageBlockSection>
             </apex:repeat>
             <script>
-            	var init_nodes = document.getElementsByClassName("PIBackApi");
-            	var api_id_map={};
-            	for(let ei in init_nodes){
-                	let e = init_nodes[ei];
-            		if(IsFormElement(e)){
-                    	if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
-                        	api_id_map[GetEleApiName(e)] = e.id;
-                    	}
-                	 
-                	}
-            	}
-            	console.log(api_id_map);
+                var init_nodes = document.getElementsByClassName("PIBackApi");
+                var api_id_map={};
+                for(let ei in init_nodes){
+                    let e = init_nodes[ei];
+                    if(IsFormElement(e)){
+                        if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
+                            api_id_map[GetEleApiName(e)] = e.id;
+                        }
+                     
+                    }
+                }
+                console.log(api_id_map);
 
                 
                 sfdcPage.appendToOnloadQueue(function () {
@@ -571,6 +575,9 @@
                     //Replace Vlookup Field
                     replaceSearchContactLookup();
                     document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
+                    
+                    document.getElementById('topButtonRow').style = '';
+                    document.getElementById('bottomButtonRow').style = '';
                     jQuery('a[data-id="OwnerId"]').remove();
                     /*
                     jQuery(".lookupInput").each(function(i,e){
@@ -628,7 +635,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditAddress.page b/force-app/main/default/pages/NewAndEditAddress.page
index 169722e..2de0d1a 100644
--- a/force-app/main/default/pages/NewAndEditAddress.page
+++ b/force-app/main/default/pages/NewAndEditAddress.page
@@ -81,7 +81,7 @@
             if(phone ){
                 if(phone.value){
                     if(!/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){
-                    	error_msg += ';鐢佃瘽鍙风爜閿欒';
+                        error_msg += ';鐢佃瘽鍙风爜閿欒';
                     }
                 }else{
                     if(phone.previousSibling && phone.previousSibling.className.indexOf('requiredBlock')>-1){
@@ -373,7 +373,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">鏀惰揣鍦板潃缂栬緫</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveAddressProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveAddressProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -396,8 +396,12 @@
                     
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Address__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Address__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Address__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Address__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -437,6 +441,8 @@
                     replaceSearchContactLookup();
                     //3. Set Readonly Attribute
                     // document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽 document.getElementById('bottomButtonRow').style = '';
                     /*
                     jQuery(".lookupInput").each(function(i,e){
                         let je =jQuery(e).find('input');
@@ -495,7 +501,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveAddressProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveAddressProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/NewAndEditAgencyContact.page b/force-app/main/default/pages/NewAndEditAgencyContact.page
index 704cfbe..1eb6a14 100644
--- a/force-app/main/default/pages/NewAndEditAgencyContact.page
+++ b/force-app/main/default/pages/NewAndEditAgencyContact.page
@@ -123,7 +123,7 @@
         }
     
         var staticResources = JSON.parse('{!staticResource}');
-    	var staticResourceAWSContact = JSON.parse('{!staticResourceAWSContact}');
+        var staticResourceAWSContact = JSON.parse('{!staticResourceAWSContact}');
     
         var requiredFieldAPIList = JSON.parse('{!requiredFieldAPIListStr}');
         var fieldAPIToLabelMap = JSON.parse('{!fieldAPIToLabelMapStr}');
@@ -132,7 +132,7 @@
         function ProcessPI(sobjJson, payloadForNewPI) {
             blockme();
             if ({!isNewMode} || {!isCloneMode}) {
-            	NewPIToAWS(sobjJson, payloadForNewPI)
+                NewPIToAWS(sobjJson, payloadForNewPI)
             }else {
                 UpdatePIToAWS(sobjJson, payloadForNewPI)
             }
@@ -160,8 +160,8 @@
             }
             return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1;
         }
-    	
-    	function IsFormElement(e){
+        
+        function IsFormElement(e){
             return IsFormTag(e.tagName);
         }
 
@@ -422,7 +422,7 @@
             let dataId = contactsInfo[sfId];
             
             if(dataId){
-            	AWSService.query(staticResourceAWSContact.queryUrl,dataId,function(result){
+                AWSService.query(staticResourceAWSContact.queryUrl,dataId,function(result){
                     if(result.object){
                         document.querySelector("[data-id='Contact__c']").value = result.object.lastName;
                     }
@@ -464,7 +464,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode || isCloneMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode || isCloneMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -486,8 +486,10 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Agency_Contact__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Agency_Contact__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&layoutField.fieldAPI!='RecordTypeId'}"
                             required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Agency_Contact__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&layoutField.fieldAPI=='RecordTypeId'}"
+                        />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -495,7 +497,7 @@
                 </apex:pageBlockSection>
             </apex:repeat>
             <script>
-            	var init_nodes = document.getElementsByClassName("PIBackApi");
+                var init_nodes = document.getElementsByClassName("PIBackApi");
                 var api_id_map={};
                 for(let ei in init_nodes){
                     let e = init_nodes[ei];
@@ -508,7 +510,7 @@
                 }
                 console.log(api_id_map);
                 sfdcPage.appendToOnloadQueue(function () {
-					jQuery('option').each(function(i,e){
+                    jQuery('option').each(function(i,e){
                         if(e.value == '_\x01_'){
                             e.value = '';
                         }
@@ -538,6 +540,8 @@
                     }
                     jQuery('a[data-id="OwnerId"]').remove();
 
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 document.getElementById('bottomButtonRow').style = '';
                     /*
                     jQuery(".lookupInput").each(function(i,e){
                         let je =jQuery(e).find('input');
@@ -606,7 +610,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditCampaignMember.page b/force-app/main/default/pages/NewAndEditCampaignMember.page
index 8f0d120..d338da1 100644
--- a/force-app/main/default/pages/NewAndEditCampaignMember.page
+++ b/force-app/main/default/pages/NewAndEditCampaignMember.page
@@ -114,7 +114,7 @@
         function ProcessPI(sobjJson, payloadForNewPI) {
             blockme();
             if ({!isNewMode}) {
-            	NewPIToAWS(sobjJson, payloadForNewPI)
+                NewPIToAWS(sobjJson, payloadForNewPI)
             }else {
                 UpdatePIToAWS(sobjJson, payloadForNewPI)
             }
@@ -359,7 +359,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -381,8 +381,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!CampaignMember__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!CampaignMember__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!CampaignMember__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!CampaignMember__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -398,6 +402,9 @@
                     if (!{!isNewMode}) {
                         QuerySobjectFromAWS();
                     }   
+                    
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽 聽 document.getElementById('bottomButtonRow').style = '';
                 });
             </script>
             <div class="pbBottomButtons">
@@ -406,7 +413,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditCase.page b/force-app/main/default/pages/NewAndEditCase.page
index 44934f5..6e6c791 100644
--- a/force-app/main/default/pages/NewAndEditCase.page
+++ b/force-app/main/default/pages/NewAndEditCase.page
@@ -395,7 +395,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">CIC缂栬緫</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveCaseProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞跺叧闂�" onclick="saveCaseProcess('SaveAndClose')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveCaseProcess('SaveAndNew')" />
@@ -417,8 +417,10 @@
                 <apex:pageBlockSection title="{!layoutSection.name}" showHeader="{!layoutSection.useHeader}" collapsible="{!layoutSection.allowCollapse}" columns="{!layoutSection.columns}">
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Case[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
-                            required="{!layoutField.isRequired}" />
+                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Case[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" />
+                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Case[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}}" required="{!layoutField.isRequired}" />
+                        <apex:outputField html-data-id="{!layoutField.fieldAPI}" value="{!Case[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}}"  />
+                        
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -432,7 +434,19 @@
                         for (let n = 0; n < layoutSection.length; n++) {
                             let layoutField = layoutSection[n];
                             if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) {
-                                document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField);
+                                let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']");
+                                e.disabled = !(layoutField.editableField);
+                                /*
+                                if (!(layoutField.editableField)) {
+                                    if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') {
+                                        e.parentNode.classList.add("disabledbutton");
+                                    }else if (e.tagName == 'DIV') {
+                                        e.classList.add("disabledbutton");
+                                    }else if (VLookUpFields.indexOf(layoutField.fieldAPI) >= 0) {
+                                        e.parentNode.classList.add("disabledbutton");
+                                    }
+                                }
+                                */
                             }
                         }
                     }
@@ -450,6 +464,9 @@
                     //3. Set Readonly Attribute
                     document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
                     document.querySelector("[data-id='RecordTypeId']").classList.add("disabledbutton");
+                    
+                    document.getElementById('topButtonRow').style = '';
+                    document.getElementById('bottomButtonRow').style = '';
                     //闇�瑕侀殣钘�
                     // document.querySelector("[data-id='SuppliedEmail']").classList.add("displayblock");
                     
@@ -509,7 +526,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButton" id="bottomButtonRow">
+                            <td class="pbButton" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveCaseProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞跺叧闂�" onclick="saveCaseProcess('SaveAndClose')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveCaseProcess('SaveAndNew')" />
diff --git a/force-app/main/default/pages/NewAndEditContact.page b/force-app/main/default/pages/NewAndEditContact.page
index f55f953..8eed654 100644
--- a/force-app/main/default/pages/NewAndEditContact.page
+++ b/force-app/main/default/pages/NewAndEditContact.page
@@ -416,7 +416,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode || isCloneMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode || isCloneMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -438,8 +438,9 @@
                     
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Contact[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
-                                         required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Contact[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Contact[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}" required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Contact[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -487,6 +488,9 @@
                     	oi.value = '{!CurrentUserId}'
                     }
                 }
+                document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽  document.getElementById('bottomButtonRow').style = '';
+                
                 jQuery('a[data-id="OwnerId"]').remove();
 
                 var layoutSections = JSON.parse('{!layoutSectionsStr}');
@@ -508,7 +512,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditInquiryForm.page b/force-app/main/default/pages/NewAndEditInquiryForm.page
index ddbdc8d..6e125ae 100644
--- a/force-app/main/default/pages/NewAndEditInquiryForm.page
+++ b/force-app/main/default/pages/NewAndEditInquiryForm.page
@@ -422,7 +422,7 @@
         function replaceSearchContactLookup() {
             let lookUpNode = htmlToElement(contactHtmlString);
             console.log(lookUpNode);
-            let eleContactValue = document.querySelector("[data-id='Contact_Name__c']").parentNode.parentNode.children[1].value;
+            let eleContactValue = document.querySelector("[data-id='Contact_Name__c']").parentNode.parentNode.children[0].value;
             if (eleContactValue) {
                 if (!{!isNewMode} || (eleContactValue != '000000000000000')) {
                     //1. Query Contact from AWS by AWSDataId
@@ -556,7 +556,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode || isCloneMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode || isCloneMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -578,8 +578,9 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Inquiry_form__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
-                            required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Inquiry_form__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"  required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Inquiry_form__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"  required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Inquiry_form__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"  />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -646,7 +647,8 @@
                     replaceSearchLeadLookup(); 
                     document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
                     // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton");
-                    
+                    document.getElementById('topButtonRow').style = '';
+                    document.getElementById('bottomButtonRow').style = '';
                     jQuery('a[data-id="OwnerId"]').remove();
 
                     //Updated by Li Jun 20220322 Start
@@ -714,7 +716,7 @@
                         JSON.stringify(lookups), lookup_id,
                         function (result, event) {
                             console.log("result = " + result);
-                            if (result != null ){
+                            if (result != null && result != '{}'){
                                 var obj = JSON.parse(result.replaceAll('&'+'quot;','"'));
                                 for (let i = 0; i < lookups.length; i++) {
                                     let lookup = lookups[i];
@@ -737,7 +739,10 @@
                                     }
 
                                 }
-                            }
+                            }else {
+                            	clearVlookup('Department_Class__c');
+                                clearVlookup('Hospital__c');
+                        	}
                         },
                         { escape: true }
                     );
@@ -766,7 +771,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditInspectionReport.page b/force-app/main/default/pages/NewAndEditInspectionReport.page
index 4a0c0a1..788eab5 100644
--- a/force-app/main/default/pages/NewAndEditInspectionReport.page
+++ b/force-app/main/default/pages/NewAndEditInspectionReport.page
@@ -397,7 +397,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -473,11 +473,13 @@
                     }
                     
                     //Replace Contact Vlookup Field
-                    replaceSearchContactLookup();
+                    //replaceSearchContactLookup();
                     //Replace Lead Vlookup Field
-                    replaceSearchLeadLookup(); 
-                    document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
+                    //replaceSearchLeadLookup(); 
+                    //document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
                     // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton");
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
                     
                     jQuery('a[data-id="OwnerId"]').remove();
 
@@ -505,7 +507,7 @@
                     //         clearVlookup('Hospital__c');
                     //     }
                     // });
-
+                    /*
                     jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){
                         setTimeout(() => {
                             console.log(document.getElementById(this.id+'_lkid').value);
@@ -520,7 +522,8 @@
                                 clearVlookup('Hospital__c');
                             }
                         }, 50);
-                    });                   
+                    });   
+                    */
                 });
 
             </script>
@@ -530,7 +533,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditLead.page b/force-app/main/default/pages/NewAndEditLead.page
index 51b78f1..fe2b434 100644
--- a/force-app/main/default/pages/NewAndEditLead.page
+++ b/force-app/main/default/pages/NewAndEditLead.page
@@ -414,7 +414,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">鎰忓悜缂栬緫</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveLeadProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveLeadProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -437,8 +437,9 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Lead[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
-                            required="{!layoutField.isRequired}" />
+                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Lead[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" />
+                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Lead[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&layoutField.fieldAPI!='RecordTypeId'}" required="{!layoutField.isRequired}" />
+                        <apex:outputField html-data-id="{!layoutField.fieldAPI}" value="{!Lead[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&layoutField.fieldAPI=='RecordTypeId'}"   />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -576,6 +577,9 @@
                     
                     unblockUI();
                 }
+                    
+                document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽  document.getElementById('bottomButtonRow').style = '';
                 let previous_value = {};
                     jQuery(".lookupInput input").each(function(i,e){
                         let je =jQuery(e);
@@ -701,7 +705,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButton" id="bottomButtonRow">
+                            <td class="pbButton" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveLeadProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveLeadProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/NewAndEditQIS.page b/force-app/main/default/pages/NewAndEditQIS.page
index 5e63772..12d71be 100644
--- a/force-app/main/default/pages/NewAndEditQIS.page
+++ b/force-app/main/default/pages/NewAndEditQIS.page
@@ -441,7 +441,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -524,6 +524,8 @@
                             oi.value = '{!CurrentUserId}'
                         }
                     }
+                document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽  document.getElementById('bottomButtonRow').style = '';
             });
             </script>
             <div class="pbBottomButtons">
@@ -532,7 +534,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditRepairSubOrder.page b/force-app/main/default/pages/NewAndEditRepairSubOrder.page
index f8204c5..8c44ca7 100644
--- a/force-app/main/default/pages/NewAndEditRepairSubOrder.page
+++ b/force-app/main/default/pages/NewAndEditRepairSubOrder.page
@@ -1,10 +1,3 @@
-<!--
-  @description       : 
-  @author            : ChangeMeIn@UserSettingsUnder.SFDoc
-  @group             : 
-  @last modified on  : 03-23-2022
-  @last modified by  : ChangeMeIn@UserSettingsUnder.SFDoc
--->
 <apex:page standardController="RepairSubOrder__c" extensions="NewAndEditRepairSubOrderController" id="page">
     <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
     <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
@@ -267,6 +260,9 @@
                 } else {
                     result[field_api_name] = ele.value;
                 }
+            }
+            if(api_id_map['AssetType__c']){
+                result.AssetType__c= document.getElementById(api_id_map['AssetType__c']).value!='_\x01_'?document.getElementById(api_id_map['AssetType__c']).value:'';
             }
             return result;
         }
@@ -535,7 +531,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -557,8 +553,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!RepairSubOrder__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!RepairSubOrder__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!RepairSubOrder__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!RepairSubOrder__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -568,16 +568,16 @@
             <script>
                 var init_nodes = document.getElementsByClassName("PIBackApi");
                 var api_id_map={};
-            	for(let ei in init_nodes){
-                	let e = init_nodes[ei];
-            		if(IsFormElement(e)){
-                    	if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
-                        	api_id_map[GetEleApiName(e)] = e.id;
-                    	}
-                	 
-                	}
-            	}
-            	console.log(api_id_map);
+                for(let ei in init_nodes){
+                    let e = init_nodes[ei];
+                    if(IsFormElement(e)){
+                        if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
+                            api_id_map[GetEleApiName(e)] = e.id;
+                        }
+                     
+                    }
+                }
+                console.log(api_id_map);
     
                 sfdcPage.appendToOnloadQueue(function () {
                     var layoutSections = JSON.parse('{!layoutSectionsStr}');
@@ -611,7 +611,8 @@
                     replaceSearchContactLookup();
                     //3. Set Readonly Attribute
                     document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
-                    
+                    document.getElementById('topButtonRow').style = '';
+                    document.getElementById('bottomButtonRow').style = '';
                     jQuery('a[data-id="OwnerId"]').remove();
                     /*
                     jQuery(".lookupInput").each(function(i,e){
@@ -669,7 +670,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewAndEditReport.page b/force-app/main/default/pages/NewAndEditReport.page
index bd565c3..d9e1f19 100644
--- a/force-app/main/default/pages/NewAndEditReport.page
+++ b/force-app/main/default/pages/NewAndEditReport.page
@@ -111,13 +111,22 @@
                 }
             }
             //鎵嬫湳鍒嗙被1
-            result.Technical_Category1__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38').value:'';
-            //鎵嬫湳鍒嗙被2
-            result.Technical_Category2__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38').value:'';
-            //鐩殑2
-            if(document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38')){
-                result.Purpose2__c = document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38').value;
+            if(api_id_map['Technical_Category1__c']){
+                result.Technical_Category1__c = document.getElementById(api_id_map['Technical_Category1__c']).value!='_\x01_'?document.getElementById(api_id_map['Technical_Category1__c']).value:'';
             }
+            //result.Technical_Category1__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:2:j_id38').value:'';
+            //鎵嬫湳鍒嗙被2
+            if(api_id_map['Technical_Category2__c']){
+                result.Technical_Category2__c = document.getElementById(api_id_map['Technical_Category2__c']).value!='_\x01_'?document.getElementById(api_id_map['Technical_Category2__c']).value:'';
+            }
+            //result.Technical_Category2__c = document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38')!=null?document.getElementById('page:form:j_id5:j_id35:4:j_id36:j_id37:4:j_id38').value:'';
+            //鐩殑2
+            if(api_id_map['Purpose2__c']){
+                result.Purpose2__c = document.getElementById(api_id_map['Purpose2__c']).value;
+            }
+            // if(document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38')){
+            //     result.Purpose2__c = document.getElementById('page:form:j_id5:j_id35:2:j_id36:j_id37:1:j_id38').value;
+            // }
             //瀵屾枃鏈璧嬪��
             if(getCKEinstance('Customer_sigh_photo__c')){
                 result.Customer_sigh_photo__c = getCKEinstance('Customer_sigh_photo__c').getData()
@@ -226,6 +235,33 @@
             return blankRequiredFields;
         }
 
+        var GetEleByClass = function(class_name){
+            let eles = document.getElementsByClassName(class_name);
+            if(eles.length > 0) return eles[0];
+            return null;
+        }
+
+        var GetEleApiName = function(ele){
+            for(let ci in ele.classList){
+                let c = ele.classList[ci];
+                if(c.indexOf('{!ApiPrefix}'+'_')>-1){
+                    return c.replace('{!ApiPrefix}'+'_','');
+                }
+            }
+            return '';
+        }
+
+        function IsFormTag(tag_name){
+            if (!tag_name) {
+                return false;
+            }
+            return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1;
+        }
+    	
+    	function IsFormElement(e){
+            return IsFormTag(e.tagName);
+        }
+
         //4.鑾峰彇瑕佸姞瀵嗙殑瀛楁
         function getPIPayload(reportJson) {
             let reportPayloadList = [];
@@ -254,7 +290,7 @@
         //5.鏂板缓鎴栫紪杈�
         function ProcessPI(reportJson, payloadForNewPI) {
             blockme();
-            if ({!isNewMode} || {!isCloneMode}) {
+            if ({!isNewMode} || {!isCloneMode} || !'{!AWSDataId}') {//Add by Li Jun for PIPL 20220413
                 NewPIToAWS(reportJson, payloadForNewPI)
             }else {
                 UpdatePIToAWS(reportJson, payloadForNewPI)
@@ -491,7 +527,7 @@
             payloadJson.age_Encrypted__c = result.object[0].ageEncrypt;
             payloadJson.Medical_History_Encrypted__c = result.object[0].medicalHistoryEncrypt;
             payloadJson.sex_Encrypted__c = result.object[0].sexEncrypt;
-            if (isNewMode || {!isCloneMode}) {
+            if (isNewMode || {!isCloneMode}||!'{!AWSDataId}') {//Add by Li Jun for PIPL 20220413
                 payloadJson.AWS_Data_Id__c = result.object[0].dataId;
                 delete payloadJson.OwnerId;
             } else {
@@ -577,7 +613,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">鎶ュ憡涔︾紪杈�</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveReportProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveReportProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -600,8 +636,9 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-title="{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" styleClass="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
-                            required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}" required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -609,6 +646,18 @@
                 </apex:pageBlockSection>
             </apex:repeat>
             <script>
+                var init_nodes = document.getElementsByClassName("PIBackApi");
+                var api_id_map={};
+                for(let ei in init_nodes){
+                    let e = init_nodes[ei];
+                    if(IsFormElement(e)){
+                        if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
+                            api_id_map[GetEleApiName(e)] = e.id;
+                        }
+                        
+                    }
+                }
+                console.log(api_id_map);
                 sfdcPage.appendToOnloadQueue(function () {
                     //鍒ゆ柇鏄惁涓哄彧璇婚�夐」
                     var layoutSections = JSON.parse('{!layoutSectionsStr}');
@@ -650,7 +699,10 @@
                         document.querySelector("[data-id='Loaner_request_no1__c']").value = '{!no1Name}'
                         document.getElementById(document.querySelector("[data-id='Loaner_request_no1__c']").id + '_lkid').value = '{!no1Id}'
                     }
-
+                    
+					document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
+                    
                     let previous_value = {};
                     jQuery(".lookupInput input").each(function(i,e){
                         let je =jQuery(e);
@@ -706,7 +758,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveReportProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveReportProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/NewAndEditTenderinformation.page b/force-app/main/default/pages/NewAndEditTenderinformation.page
index 12159f0..f61a247 100644
--- a/force-app/main/default/pages/NewAndEditTenderinformation.page
+++ b/force-app/main/default/pages/NewAndEditTenderinformation.page
@@ -389,7 +389,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">{! SobjectLabel}<apex:outputText rendered="{!isNewMode || isCloneMode}">{!$Label.New}</apex:outputText><apex:outputText rendered="{!not(isNewMode || isCloneMode)}">{!$Label.Edit}</apex:outputText></h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess(1)" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
@@ -411,8 +411,9 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Tender_information__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
-                            required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Tender_information__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}" required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Tender_information__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}" required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Tender_information__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}" />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -464,11 +465,13 @@
                         }
                     }  
                     //Replace Contact Vlookup Field
-                    replaceSearchContactLookup();
+                    //replaceSearchContactLookup();
                     //Replace Lead Vlookup Field
-                    replaceSearchLeadLookup(); 
+                    //replaceSearchLeadLookup(); 
                     document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton");
                     // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton");
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
                     
                     jQuery('a[data-id="OwnerId"]').remove();
 
@@ -496,7 +499,7 @@
                     //         clearVlookup('Hospital__c');
                     //     }
                     // });
-
+                    /*
                     jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){
                         setTimeout(() => {
                             console.log(document.getElementById(this.id+'_lkid').value);
@@ -511,7 +514,8 @@
                                 clearVlookup('Hospital__c');
                             }
                         }, 50);
-                    });                   
+                    });  
+                    */
                 });
 
                 
@@ -523,7 +527,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="{!$Label.Save}" onclick="saveSobjectProcess()" />
                                 <input class="btn" type="Button" value="{!$Label.SaveAndNew}" onclick="saveSobjectProcess()" />
                                 <apex:commandButton action="{!cancel}" value="{!$Label.Cancel}" />
diff --git a/force-app/main/default/pages/NewConsumApply.page b/force-app/main/default/pages/NewConsumApply.page
index ca6033e..d052f1c 100644
--- a/force-app/main/default/pages/NewConsumApply.page
+++ b/force-app/main/default/pages/NewConsumApply.page
@@ -381,7 +381,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">鑰楁潗澶囧搧鐢宠缂栬緫</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveConsumApplyProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveConsumApplyProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -402,8 +402,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -456,6 +460,9 @@
                     //Replace Vlookup Field
                     replaceSearchContactLookup();
                     document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+                    
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
 
                     let previous_value = {};
                     jQuery(".lookupInput input").each(function(i,e){
@@ -513,7 +520,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveConsumApplyProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveConsumApplyProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page b/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page
index c4a7688..e58c0d5 100644
--- a/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page
+++ b/force-app/main/default/pages/NewConsumApplyEquipmentSetDetail.page
@@ -246,7 +246,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">鑰楁潗澶囧搧閰嶅涓�瑙堟槑缁嗙紪杈�</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveConsumApplyProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveConsumApplyProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -261,8 +261,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply_Equipment_Set_Detail__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply_Equipment_Set_Detail__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply_Equipment_Set_Detail__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Consum_Apply_Equipment_Set_Detail__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -298,8 +302,10 @@
                         blockme();
                         QueryConsumApplyFromAWS();
                     };
-                    document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
-
+                    //document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+					
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
                     //zhj 2022/04/11 start
                     // jQuery(".lookupInput").each(function(i,e){
                     //     let je =jQuery(e).find('input');
@@ -339,7 +345,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveConsumApplyProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveConsumApplyProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/NewOnCall.page b/force-app/main/default/pages/NewOnCall.page
index 58c29d0..3d06257 100644
--- a/force-app/main/default/pages/NewOnCall.page
+++ b/force-app/main/default/pages/NewOnCall.page
@@ -37,7 +37,7 @@
         var queryBack = function queryBack(data) {
             console.log('data = ' + data);
             //document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").value = data.object.callerPhone;
-            document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:5:j_id37']").value = data.object.callerPhone;    //20220404  By Chen Yanan
+            document.getElementById(api_id_map['Caller_phone__c']).value = data.object.callerPhone;    //20220404  By Chen Yanan
             document.querySelector("[data-id='Responsible_Person_HP__c']").value = data.object.responsiblePersonHP;
             unblockUI();
         };
@@ -54,7 +54,7 @@
             payloadJson.Caller_Phone_Encrypt__c = r.object[0].callerPhoneEncrypt;
             payloadJson.Responsible_PersonHP_Encrypt__c = r.object[0].responsiblePersonHPEncrypt;
             payloadJson.AWS_Data_Id__c = '{!AWSDataId}';
-            if (isNewMode|| {!isCloneMode}) {
+            if (isNewMode|| {!isCloneMode} ||!'{!AWSDataId}') {//Add by Li Jun for PIPL 20220413
                 payloadJson.AWS_Data_Id__c = r.object[0].dataId;
                 delete payloadJson.OwnerId;
             } else {
@@ -67,7 +67,7 @@
         // New Or Edit
         function ProcessPI(onCallJson, payloadForNewPI) {
             blockme();
-            if ({!isNewMode} || {!isCloneMode}) {
+            if ({!isNewMode} || {!isCloneMode} ||!'{!AWSDataId}') {//Add by Li Jun for PIPL 20220413
                 NewPIToAWS(onCallJson, payloadForNewPI)
             }else {
                 UpdatePIToAWS(onCallJson, payloadForNewPI)
@@ -208,6 +208,26 @@
             errorMsgNode.innerText = '';
             errorMsgNode.className = '';
         }
+        var GetEleApiName = function(ele){
+            for(let ci in ele.classList){
+                let c = ele.classList[ci];
+                if(c.indexOf('PIBackApi'+'_')>-1){
+                    return c.replace('PIBackApi'+'_','');
+                }
+            }
+            return '';
+        }
+
+        function IsFormTag(tag_name){
+            if (!tag_name) {
+                return false;
+            }
+            return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1;
+        }
+    	
+    	function IsFormElement(e){
+            return IsFormTag(e.tagName);
+        }
     </script>
     <div class="bPageTitle">
         <div class="ptBody">
@@ -239,7 +259,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">OnCall缂栬緫</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveOnCallProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveOnCallProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -260,8 +280,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!On_Call__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                       <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!On_Call__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!On_Call__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!On_Call__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -269,6 +293,17 @@
                 </apex:pageBlockSection>
             </apex:repeat>
             <script>
+                var init_nodes = document.getElementsByClassName("PIBackApi");
+                var api_id_map={};
+                for(let ei in init_nodes){
+                    let e = init_nodes[ei];
+                    if(IsFormElement(e)){
+                        if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
+                            api_id_map[GetEleApiName(e)] = e.id;
+                        }
+                        
+                    }
+                }
                 //Append Page
                 sfdcPage.appendToOnloadQueue(function () {
                     var layoutSections = JSON.parse('{!layoutSectionsStr}');
@@ -297,6 +332,9 @@
                         QueryOnCallFromAWS();
                     };
                     document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽  document.getElementById('bottomButtonRow').style = '';
 
                     jQuery(".lookupInput").each(function(i,e){
                         let je =jQuery(e).find('input');
@@ -335,7 +373,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveOnCallProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveOnCallProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/NewRentalApply.page b/force-app/main/default/pages/NewRentalApply.page
index 658a126..e974d5d 100644
--- a/force-app/main/default/pages/NewRentalApply.page
+++ b/force-app/main/default/pages/NewRentalApply.page
@@ -42,6 +42,7 @@
             document.querySelector("[data-id='Phone_number__c']").value = data.object.phoneNumber;
             document.querySelector("[data-id='direct_shippment_address__c']").value = data.object.directShippmentAddress;
             unblockUI();
+            enableButtonStatus();//Add by Li Jun 20220418
         };
 
         //Check If Insert Or Update
@@ -65,7 +66,30 @@
             debugger
             return payloadJson;
         }
+        //Add Button status start 20220418
+        function enableButton(obj) {
+            obj.classList.remove("btnDisabled");
+        }
 
+        function disableButton(obj) {
+            obj.classList.add("btnDisabled");
+        }
+
+        function disableButtonStatus() {
+            let btnList = document.getElementsByClassName('btn');
+            for (let i = 0; i < btnList.length; i++) {
+                disableButton(btnList[i]);
+            }
+        }
+
+        function enableButtonStatus() {
+            let btnList = document.getElementsByClassName('btn');
+            for (let i = 0; i < btnList.length; i++) {
+                enableButton(btnList[i]);
+            }
+        }
+        disableButtonStatus();
+        //Add Button status end 20220418 
         // New Or Edit
         function ProcessPI(rentalApplyJson, payloadForNewPI) {
             blockme();
@@ -98,8 +122,8 @@
             }
             return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1;
         }
-    	
-    	function IsFormElement(e){
+        
+        function IsFormElement(e){
             return IsFormTag(e.tagName);
         }
 
@@ -142,15 +166,17 @@
             // }
             // result.HP_received_sign_rich__c = CKEDITOR.instances["page:form:block:j_id34:12:j_id35:j_id36:1:j_id37:textAreaDelegate_HP_received_sign_rich__c"].getData();
             // if(document.querySelector("[aria-describedby = 'cke_71']")){
-            //     result.	Extension_List_RentalApply__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML
+            //     result.  Extension_List_RentalApply__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML
             // }
             for (let index = 0; index < nodelist.length; index++) {
                 if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) {
                     console.log(nodelist[index].id.indexOf('lkwgt'));
                     if (nodelist[index].id.indexOf('lkwgt') == -1) {
                         let vlookUpNodeId = nodelist[index].id + '_lkid';
-                        let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value;
-                        result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue;
+                        if(document.getElementById(vlookUpNodeId)){
+                            let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value;
+                            result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue;
+                        }
                     }
                 } else if (nodelist[index].type == 'checkbox') {
                     result[nodelist[index].getAttribute("data-id")] = nodelist[index].checked;
@@ -178,20 +204,21 @@
                     }
                 }             
             }
-            if(document.querySelector("[id='page:form:block:j_id34:2:j_id35:j_id36:2:j_id37']")!=null){
-                result.demo_purpose2__c = document.querySelector("[id='page:form:block:j_id34:2:j_id35:j_id36:2:j_id37']").value;
+            if(api_id_map['demo_purpose2__c']){
+                result.demo_purpose2__c = document.getElementById(api_id_map['demo_purpose2__c']).value!='_\x01_'?document.getElementById(api_id_map['demo_purpose2__c']).value:'';
             }            
-            if(document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:18:j_id37']")!=null){
-                result.ToAgency__c = document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:18:j_id37']").value;
+            if(api_id_map['ToAgency__c']){
+                result.ToAgency__c = document.getElementById(api_id_map['ToAgency__c']).value!='_\x01_'?document.getElementById(api_id_map['ToAgency__c']).value:'';
             }            
             //document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:18:j_id37']").disabled =true; // Commented By Li Jun 20220304
-            if(document.querySelector("[id='page:form:block:j_id34:13:j_id35:j_id36:1:j_id37']")!=null){
-                result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:13:j_id35:j_id36:1:j_id37']").value;
-            }else{
-                if(document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']")!=null){
-                    result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']").value;
-                }               
+            if(api_id_map['Loaner_cancel_reason__c']){
+                result.Loaner_cancel_reason__c = document.getElementById(api_id_map['Loaner_cancel_reason__c']).value!='_\x01_'?document.getElementById(api_id_map['Loaner_cancel_reason__c']).value:'';
             }
+            // else{
+            //     if(document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']")!=null){
+            //         result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:11:j_id35:j_id36:1:j_id37']").value;
+            //     }               
+            // }
             // //鏍煎紡鍖栨椂闂�
             // if(result.HP_received_sign_day__c){
             //     result.HP_received_sign_day__c = result.HP_received_sign_day__c.replace(/\//g, '-')+':00';
@@ -204,9 +231,13 @@
             if(e){
                     result.Extension_List_RentalApply__c = e.getData();
                 }
-            if(document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:13:j_id37' + '_lkid')!=null){
+            if(document.getElementById(api_id_map['Office_Assistant1__c'] + '_lkid')!=null){
                 // result.ToAgency__c = document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:18:j_id37').value;
-                result.Office_Assistant1__c = document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:13:j_id37' + '_lkid').value;
+                result.Office_Assistant1__c = document.getElementById(api_id_map['Office_Assistant1__c'] + '_lkid').value;
+            }
+            if(document.getElementById(api_id_map['Office_Assistant2__c'] + '_lkid')!=null){
+                // result.ToAgency__c = document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:18:j_id37').value;
+                result.Office_Assistant2__c = document.getElementById(api_id_map['Office_Assistant2__c'] + '_lkid').value;
             }
             console.log(JSON.stringify(result));
             return result;
@@ -392,7 +423,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">澶囧搧鍊熷嚭鐢宠缂栬緫</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveRentalApplyProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRentalApplyProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -413,8 +444,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -430,7 +465,14 @@
                         if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){
                             api_id_map[GetEleApiName(e)] = e.id;
                         }
-                        
+                    }else{
+                        let eid = jQuery(e).find(".lookupInput input").attr("id")
+                        if(eid){
+                            eid += '_lkid';
+                            if(document.getElementById(eid)){
+                                api_id_map[GetEleApiName(e)] = eid;
+                            }
+                        }
                     }
                 }
                 console.log(api_id_map);
@@ -464,7 +506,9 @@
                     var onlyReadFields = ['ExtensionStatus__c','ExtensionApplicationTime_Initial__c','ExtensionApprovalTime_Initial__c','ExtensionApplicationTime_Final__c','ExtensionApprovalTime_Final__c','ExtensionSuccessTimes__c','ZongjianApprovalManager__c','BuchangApprovalManager__c','JingliApprovalManager__c','BuchangApprovalManagerSales__c','SalesManager__c'];
                     console.log(onlyReadFields);
                     for(let i=0;i<onlyReadFields.length;i++){
-                        document.querySelector('[data-id='+onlyReadFields[i]+']').parentNode.remove();
+                        if(document.querySelector('[data-id='+onlyReadFields[i]+']')){
+                        	document.querySelector('[data-id='+onlyReadFields[i]+']').parentNode.remove();
+                        }
                     }
                     
                     //2. Query AWS Data by dataId 
@@ -472,11 +516,16 @@
                     if (!{!isNewMode}) {
                         blockme();
                         QueryRentalApplyFromAWS();
+                    }else{
+                        enableButtonStatus();//Add by Li Jun 20220418
                     };
                     //Replace Vlookup Field
                     replaceSearchContactLookup();
                     document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
-
+                    
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽document.getElementById('bottomButtonRow').style = '';
+                    
                     let previous_value = {};
                     jQuery(".lookupInput input").each(function(i,e){
                         let je =jQuery(e);
@@ -536,7 +585,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveRentalApplyProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRentalApplyProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/NewRepair.page b/force-app/main/default/pages/NewRepair.page
index 585e2c5..642fc66 100644
--- a/force-app/main/default/pages/NewRepair.page
+++ b/force-app/main/default/pages/NewRepair.page
@@ -37,7 +37,7 @@
                    function (result, event) {
                        console.log(result);
                        if(result.message){
-                       	alert(result.message);
+                        alert(result.message);
                        }
                         if (redirectMode == 'Save') {
                             window.open('/' + sfId, '_self');
@@ -224,11 +224,9 @@
             result.Repair_Determine_result_ConfirmationUser__c = e.value;
            }
            //鏈慨鐞嗗綊杩樼悊鐢�
-           //page:form:block:j_id34:17:j_id35:j_id36:2:j_id37
-           //page:form:block:j_id34:17:j_id35:j_id36:2:j_id37
-           if(document.getElementById('page:form:block:j_id34:17:j_id35:j_id36:2:j_id37')){
-               result.Return_Without_Repair_Reason__c = document.getElementById('page:form:block:j_id34:17:j_id35:j_id36:2:j_id37').value=='_\x01_'?'':document.getElementById('page:form:block:j_id34:17:j_id35:j_id36:2:j_id37').value;
-           }
+            if(api_id_map['Return_Without_Repair_Reason__c']){
+                result.Return_Without_Repair_Reason__c = document.getElementById(api_id_map['Return_Without_Repair_Reason__c']).value!='_\x01_'?document.getElementById(api_id_map['Return_Without_Repair_Reason__c']).value:'';
+            }
             console.log(JSON.stringify(result));
             return result;
         }
@@ -366,7 +364,7 @@
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                 <h2 class="mainTitle">淇悊缂栬緫</h2>
                             </td>
-                            <td class="pbButton" id="topButtonRow">
+                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveRepairProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRepairProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
@@ -387,8 +385,12 @@
 
                     <!--Each section has layoutFields, let's iterate them as well-->
                     <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
-                        <apex:inputField html-title="{!layoutField.fieldAPI}" styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                             required="{!layoutField.isRequired}" />
+                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
+                            required="{!layoutField.isRequired}" />
+                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
+                       />
                         <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                         </apex:pageblocksectionitem>
                     </apex:repeat>
@@ -447,7 +449,10 @@
                         unblockUI();
                     };
                     if(document.querySelector("[data-id='OwnerId']") != null)
-                    	document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+                        document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton");
+
+                    document.getElementById('topButtonRow').style = '';
+聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 document.getElementById('bottomButtonRow').style = '';
 
                     let previous_value = {};
                     jQuery(".lookupInput input").each(function(i,e){
@@ -469,7 +474,7 @@
 
                     //缁翠慨涓績
                     if('{!workLocationSelect}' != ''){
-                        let wlNode = document.getElementById('page:form:block:j_id34:1:j_id35:j_id36:18:j_id37');
+                        let wlNode = document.getElementById(api_id_map['work_location_select__c']);
                         if(wlNode){
                            wlNode.removeAttribute("disabled")
                             var o = new Option()
@@ -525,7 +530,7 @@
                         <tr>
                             <td class="pbTitle">
                                 <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
-                            <td class="pbButtonb" id="bottomButtonRow">
+                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                 <input class="btn" type="Button" value="淇濆瓨" onclick="saveRepairProcess('Save')" />
                                 <input class="btn" type="Button" value="淇濆瓨骞舵柊寤�" onclick="saveRepairProcess('SaveAndNew')" />
                                 <apex:commandButton action="{!cancel}" value="鍙栨秷" />
diff --git a/force-app/main/default/pages/XinDailyReport.page b/force-app/main/default/pages/XinDailyReport.page
index 07d4934..82c4800 100644
--- a/force-app/main/default/pages/XinDailyReport.page
+++ b/force-app/main/default/pages/XinDailyReport.page
@@ -62,6 +62,7 @@
             var tempActId = '';
             var tempRecordTypeName = '';
             var tempBtnIdHidden = '';
+            var OPDId = '';
             var tempRedId = '';
             var tempReportId = '';
             var hiddenDivShowFlg = false;
@@ -69,79 +70,79 @@
             sforce.connection.sessionId = '{!$Api.Session_ID}';
             
             //Add By Li Jun 20220225 for PIPL Start
-            AWSService.sfSessionId = '{!GETSESSIONID()}';
-            var staticResources = JSON.parse('{!staticResource}');
-            var contactAWSIds = JSON.parse('{!contactAWSIds}');
-            console.log('contactAWSIds:'+JSON.stringify(contactAWSIds));
-            var sfIdToContactInfo = {};
-            function preparePayloadForSearchContact(){
-                let searchPayload = new Object();
-                searchPayload.dataIds = contactAWSIds;
-                searchPayload.contactName = '';
-                return JSON.stringify(searchPayload);
-            }
+            // AWSService.sfSessionId = '{!GETSESSIONID()}';
+            // var staticResources = JSON.parse('{!staticResource}');
+            // var contactAWSIds = JSON.parse('{!contactAWSIds}');
+            // console.log('contactAWSIds:'+JSON.stringify(contactAWSIds));
+            // var sfIdToContactInfo = {};
+            // function preparePayloadForSearchContact(){
+            //     let searchPayload = new Object();
+            //     searchPayload.dataIds = contactAWSIds;
+            //     searchPayload.contactName = '';
+            //     return JSON.stringify(searchPayload);
+            // }
 
-            function refreshContactAll(){
-                let contactIdsFromSF = [];
-                // let allSizeForAct =document.getElementById('Page:mainForm:idDayEdit:AllSize').value;
-                let allSizeForAct = j$(escapeVfId('idActSize')).value();
-                console.log('allSizeForAct:'+allSizeForAct);
-                for(let i=0;i<allSizeForAct;i++){
-                    for(let j=1;j<6;j++){
-                        let contactIdForVis = document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j+"_IdHidden").value;
-                        contactIdsFromSF.push(contactIdForVis);
-                    }
-                };
-                sforce.connection.sessionId = '{!GETSESSIONID()}';
-                var condition = '';
-                for(var i=0;i<contactIdsFromSF.length;i++){
-                    if(contactIdsFromSF[i] != ''){
-                        condition += "," + "\'"+contactIdsFromSF[i]+"\'";
-                    }
-                }
-                condition = condition.substr(1);
-                console.log('condition = ' + condition);
-                var record = sforce.connection.query("select AWS_Data_Id__c from Contact where id in("+condition+")");
-                var records = record.getArray("records");
-                for(var i =0;i<records.length;i++){
-                    contactAWSIds.push(records[i].AWS_Data_Id__c);
-                }
-                searchContactAll();
-            }
-            function searchContactAll(){
-                let data = preparePayloadForSearchContact();
-                let searchCallBack = function searchCallBack(result){
-                    let contacts = result.object;
-                    if(contacts == null){
-                        return;
-                    }
-                    for(var i=0;i<contacts.length;i++){
-                        let temp = {}
-                        temp.lastName = contacts[i].lastName?contacts[i].lastName:'';                       
-                        if(contacts[i].sfRecordId){
-                            sfIdToContactInfo[contacts[i].sfRecordId] = temp;
-                        }                    
-                    }
-                    console.log('AWS Result:'+JSON.stringify(sfIdToContactInfo));
-                    // let allSizeForAct =document.getElementById('Page:mainForm:idDayEdit:AllSize').value;
-                    let allSizeForAct = j$(escapeVfId('idActSize')).value();
-                    console.log('Act size:'+allSizeForAct);
-                    for(let i=0;i<allSizeForAct;i++){
-                        for(let j=1;j<6;j++){
-                            let contactIdForVis = document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j+"_IdHidden").value;
-                            if(contactIdForVis){
-                                console.log('SFId for Contact:'+contactIdForVis);
-                                if(sfIdToContactInfo.hasOwnProperty(contactIdForVis)){
-                                    document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j).value = sfIdToContactInfo[contactIdForVis].lastName;
-                                }   
-                            }else{
-                                document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j).value = '';
-                            }                     
-                        }
-                    }                                       
-                };
-                AWSService.search(staticResources.searchUrl,data,searchCallBack,staticResources.token);
-            }
+            // function refreshContactAll(){
+            //     let contactIdsFromSF = [];
+            //     // let allSizeForAct =document.getElementById('Page:mainForm:idDayEdit:AllSize').value;
+            //     let allSizeForAct = j$(escapeVfId('idActSize')).value();
+            //     console.log('allSizeForAct:'+allSizeForAct);
+            //     for(let i=0;i<allSizeForAct;i++){
+            //         for(let j=1;j<6;j++){
+            //             let contactIdForVis = document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j+"_IdHidden").value;
+            //             contactIdsFromSF.push(contactIdForVis);
+            //         }
+            //     };
+            //     sforce.connection.sessionId = '{!GETSESSIONID()}';
+            //     var condition = '';
+            //     for(var i=0;i<contactIdsFromSF.length;i++){
+            //         if(contactIdsFromSF[i] != ''){
+            //             condition += "," + "\'"+contactIdsFromSF[i]+"\'";
+            //         }
+            //     }
+            //     condition = condition.substr(1);
+            //     console.log('condition = ' + condition);
+            //     var record = sforce.connection.query("select AWS_Data_Id__c from Contact where id in("+condition+")");
+            //     var records = record.getArray("records");
+            //     for(var i =0;i<records.length;i++){
+            //         contactAWSIds.push(records[i].AWS_Data_Id__c);
+            //     }
+            //     searchContactAll();
+            // }
+            // function searchContactAll(){
+            //     let data = preparePayloadForSearchContact();
+            //     let searchCallBack = function searchCallBack(result){
+            //         let contacts = result.object;
+            //         if(contacts == null){
+            //             return;
+            //         }
+            //         for(var i=0;i<contacts.length;i++){
+            //             let temp = {}
+            //             temp.lastName = contacts[i].lastName?contacts[i].lastName:'';                       
+            //             if(contacts[i].sfRecordId){
+            //                 sfIdToContactInfo[contacts[i].sfRecordId] = temp;
+            //             }                    
+            //         }
+            //         console.log('AWS Result:'+JSON.stringify(sfIdToContactInfo));
+            //         // let allSizeForAct =document.getElementById('Page:mainForm:idDayEdit:AllSize').value;
+            //         let allSizeForAct = j$(escapeVfId('idActSize')).value();
+            //         console.log('Act size:'+allSizeForAct);
+            //         for(let i=0;i<allSizeForAct;i++){
+            //             for(let j=1;j<6;j++){
+            //                 let contactIdForVis = document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j+"_IdHidden").value;
+            //                 if(contactIdForVis){
+            //                     console.log('SFId for Contact:'+contactIdForVis);
+            //                     if(sfIdToContactInfo.hasOwnProperty(contactIdForVis)){
+            //                         document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j).value = sfIdToContactInfo[contactIdForVis].lastName;
+            //                     }   
+            //                 }else{
+            //                     document.getElementById("Page:mainForm:idDayEdit:idActivities:"+i+":idVisitor"+j).value = '';
+            //                 }                     
+            //             }
+            //         }                                       
+            //     };
+            //     AWSService.search(staticResources.searchUrl,data,searchCallBack,staticResources.token);
+            // }
             //Add By Li Jun 20220225 for PIPL End 
             //window.document.onkeydown= onKeyEvent;
             function initSetPage() {
@@ -1157,7 +1158,7 @@
                                         <th>{!$Label.Free_Input}&nbsp;&nbsp;<apex:inputField id="idFree_Input__c" value="{!a.act.Free_Input__c}" onClick="if(vpChack({!a.index})) return false;setVisitorPlaceDisabled();"/>&nbsp;&nbsp;</th>
                                     </tr>                                   
                                     <tr>  
-                                        <th>鎷滆鐩殑</th>
+                                        <th >鎷滆鐩殑</th>
                                         <td></td>
                                         <apex:outputPanel rendered="{!IF(reportOwner.Job_Category__c == '閿�鍞湇鍔�', 'true', 'false')}" layout="none">
                                             <td colspan="3"><span><div class="requiredInput"><div class="requiredBlock"></div><apex:inputField id="idActivityPurposeFSEDiv" value="{!a.act.Activity_PurposeFSE__c}" ></apex:inputField>
@@ -1338,23 +1339,23 @@
                                     <td><input type="button" class="btn" id="idOpds{!a.index}" name="reportBtn" value="鏂板缓OPD璁″垝" style="width:110px" onclick="addOpdNew('{!a.index}', '{!a.act.Id}');"/></td>
                                     <!--SWAG-BUF6R8  20201020 youchang end -->
                                         <td>&nbsp;</td>
-                                        <td><input type="button" class="{!If(a.act.OPD_ID__c != '' || a.act.OPDPlan_Flag__c,'btnRed','btn')}" id="idOPD{!a.index}" name="reportBtn" value="{!$Label.OPD_Taiwan}" style="width:110px;{!If(a.act.OPD_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','OPD','idOPD_IdHidden','idOPD','{!report.id}');"/><apex:inputText id="idOPD_IdHidden" value="{!a.act.OPD_ID__c}" style="display:none" disabled="true"/></td>
+                                        <td><input type="button" class="{!If(a.act.OPD_ID__c != '' || a.act.OPDPlan_Flag__c,'btnRed','btn')}" id="idOPD{!a.index}" name="reportBtn" value="{!$Label.OPD_Taiwan}" style="width:110px;{!If(a.act.OPD_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','OPD','idOPD_IdHidden','idOPD','{!report.id}','{!a.act.Opd_Plan__c}');"/><apex:inputText id="idOPD_IdHidden" value="{!a.act.OPD_ID__c}" style="display:none" disabled="true"/></td>
                 <!--                                     <td><input type="button" class="{!If(a.act.OPD_ID__c != '','btnRed','btn')}" id="idOPD{!a.index}" name="reportBtn" value="{!$Label.OPD_Taiwan}" style="width:110px;{!If(a.act.OPD_ID__c != '','color:red;','color:black;')}" onclick="selectOPDSISReportType('{!a.index}','{!a.act.id}','OPD','idOPD_IdHidden','idOPD','{!report.id}');"/><apex:inputText id="idOPD_IdHidden" value="{!a.act.OPD_ID__c}" style="display:none" disabled="true"/></td> -->
                                         <td>&nbsp;</td>
-                                        <td><input type="button" class="{!If(a.act.NTC_ID__c != '','btnRed','btn')}" id="idNTC{!a.index}" name="reportBtn" value="NTC/CDS鍩硅" style="width:110px;{!If(a.act.NTC_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','NTC','idNTC_IdHidden','idNTC','{!report.id}');"/><apex:inputText id="idNTC_IdHidden" value="{!a.act.NTC_ID__c}" style="display:none" disabled="true"/></td>
+                                        <td><input type="button" class="{!If(a.act.NTC_ID__c != '','btnRed','btn')}" id="idNTC{!a.index}" name="reportBtn" value="NTC/CDS鍩硅" style="width:110px;{!If(a.act.NTC_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','NTC','idNTC_IdHidden','idNTC','{!report.id}','{!a.act.Opd_Plan__c}');"/><apex:inputText id="idNTC_IdHidden" value="{!a.act.NTC_ID__c}" style="display:none" disabled="true"/></td>
                                         <td>&nbsp;</td>
-                                        <td><input type="button" class="{!If(a.act.OnCall_ID__c != '','btnRed','btn')}" id="idONCALL{!a.index}" name="reportBtn" value="ON CALL" style="width:110px;{!If(a.act.OnCall_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','On_Call','idONCALL_IdHidden','idONCALL','{!report.id}');"/><apex:inputText id="idONCALL_IdHidden" value="{!a.act.OnCall_ID__c}" style="display:none" disabled="true"/></td>
+                                        <td><input type="button" class="{!If(a.act.OnCall_ID__c != '','btnRed','btn')}" id="idONCALL{!a.index}" name="reportBtn" value="ON CALL" style="width:110px;{!If(a.act.OnCall_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','On_Call','idONCALL_IdHidden','idONCALL','{!report.id}','{!a.act.Opd_Plan__c}');"/><apex:inputText id="idONCALL_IdHidden" value="{!a.act.OnCall_ID__c}" style="display:none" disabled="true"/></td>
                                         <td>&nbsp;</td>
-                                        <td><input type="button" class="{!If(a.act.ReportAccompanied_ID__c != '','btnRed','btn')}" id="idReportAccompanied{!a.index}" name="reportBtn" value="{!$Label.Report_Accompanied}" style="width:110px;{!If(a.act.ReportAccompanied_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','Visit_With','idReportAccompanied_IdHidden','idReportAccompanied','{!report.id}');"/><apex:inputText id="idReportAccompanied_IdHidden" value="{!a.act.ReportAccompanied_ID__c}" style="display:none" disabled="true"/></td>
+                                        <td><input type="button" class="{!If(a.act.ReportAccompanied_ID__c != '','btnRed','btn')}" id="idReportAccompanied{!a.index}" name="reportBtn" value="{!$Label.Report_Accompanied}" style="width:110px;{!If(a.act.ReportAccompanied_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','Visit_With','idReportAccompanied_IdHidden','idReportAccompanied','{!report.id}','{!a.act.Opd_Plan__c}');"/><apex:inputText id="idReportAccompanied_IdHidden" value="{!a.act.ReportAccompanied_ID__c}" style="display:none" disabled="true"/></td>
                                         <td>&nbsp;</td>
-                                        <td><input type="button" class="{!If(a.act.CityStatus_ID__c != '','btnRed','btn')}" id="idCityStatus{!a.index}" name="reportBtn" value="{!$Label.City_Status_Report}" style="width:110px;{!If(a.act.CityStatus_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','MarketCondition','idCityStatus_IdHidden','idCityStatus','{!report.id}');"/><apex:inputText id="idCityStatus_IdHidden" value="{!a.act.CityStatus_ID__c}" style="display:none" disabled="true"/></td>
+                                        <td><input type="button" class="{!If(a.act.CityStatus_ID__c != '','btnRed','btn')}" id="idCityStatus{!a.index}" name="reportBtn" value="{!$Label.City_Status_Report}" style="width:110px;{!If(a.act.CityStatus_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','MarketCondition','idCityStatus_IdHidden','idCityStatus','{!report.id}','{!a.act.Opd_Plan__c}');"/><apex:inputText id="idCityStatus_IdHidden" value="{!a.act.CityStatus_ID__c}" style="display:none" disabled="true"/></td>
                                         <td>&nbsp;</td>
                                         <!-- <td>
                                             <input type="button" class="{!If(a.act.Claim_ID__c != '','btnRed','btn')}" id="idClaim{!a.index}" name="reportBtn" value="{!$Label.Claim_Input}" style="width:110px;{!If(a.act.Claim_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','Complaint','idClaim_IdHidden','idClaim','{!report.id}');"/>
                                             <apex:inputText id="idClaim_IdHidden" value="{!a.act.Claim_ID__c}" style="display:none" disabled="true"/>
                                         </td> -->
                                         <td>&nbsp;</td>
-                                        <td><input type="button" class="{!If(a.act.Conflict_ID__c != '','btnRed','btn')}" id="idConflict{!a.index}" name="reportBtn" value="{!$Label.Competitor_Information}" style="width:110px;{!If(a.act.Conflict_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','Competitor','idConflict_IdHidden','idConflict','{!report.id}');"/><apex:inputText id="idConflict_IdHidden" value="{!a.act.Conflict_ID__c}" style="display:none" disabled="true"/></td>
+                                        <td><input type="button" class="{!If(a.act.Conflict_ID__c != '','btnRed','btn')}" id="idConflict{!a.index}" name="reportBtn" value="{!$Label.Competitor_Information}" style="width:110px;{!If(a.act.Conflict_ID__c != '','color:red;','color:black;')}" onclick="openPDNew('{!a.index}','{!a.act.id}','Competitor','idConflict_IdHidden','idConflict','{!report.id}','{!a.act.Opd_Plan__c}');"/><apex:inputText id="idConflict_IdHidden" value="{!a.act.Conflict_ID__c}" style="display:none" disabled="true"/></td>
                                     </tr>
                                     <tr>
                                     <td style="text-align:left;"><apex:commandButton styleClass="idSaveComment" value="{!$Label.SaveComment}" onclick="blockme();" style="width:80px" action="{!saveComment}" rerender="dummy" disabled="{!ministerCommentEditFlg && managerCommentEditFlg}"/></td>

--
Gitblit v1.9.1