lohia wrapper class

 public class EC_ReportController {

    Public String myDate{get;set;}

    Public string soldtoName{get;set;}

    public string  dateoferection{get;set;}

    public string dateStr{get;set;}

    public string floorCondition {get;set;}

    public string createdDate{get;set;}

    public string cusVstId{get;set;}

    public string machineInstalledLCL {get;set;}

    public string layout {get;set;}

    public String detailOfChangeLayout {get;set;}

    public String positionOfWasteCollectionBox {get;set;}

    public String powerSupplyArrangement {get;set;}

    public String powerSupplyVoltageRange {get;set;}

    public String upsInstalled {get;set;}

    public String upsMake {get;set;}

    public String upsRating {get;set;}

    public String voltageFluctuation {get;set;}

    public String voltageStabilizerInstalled {get;set;}

    public string voltageStabilizerMake {get;set;}

    public string voltageStabilizerRating {get;set;}

    public String earthingResistance {get;set;}

    public String compressorInstalled {get;set;}

    public string compressorMake {get;set;}

    public string compressorRating {get;set;}

    public Boolean airDryerInstalled {get;set;}

    public string airDryerMake {get;set;}

    public string airDryerRating {get;set;}

    public Boolean waterSofteningPlantInstalled {get;set;}

    public string waterSofteningPlantMake {get;set;}

    public string waterSofteningPlantRating {get;set;}

    public Boolean chillingPlantInstalled {get;set;}

    public string chillingPlantMake {get;set;}

    public string chillingPlantRating {get;set;}

    public string airConditionerAvailability {get;set;}

    public String acAvailabiltyTentativeDate {get;set;}

    public string Designation{get;set;}

    Public String todayDate{get;set;}

    public Decimal totalCountOfWorkingDays{get;set;}

    public String ecReportId;

    public ecReportWrapper ecReportObj{get;set;}

    public List<Visit_Spare_Parts_Order_Collected__c> VisitSparePartsOrdCollList{get;set;}

    public List<Technical_Issues__c> visitTechnicalIssuesList{get;set;}

    public Map<String,List<String>> modelWithMachine{get;set;}

    public List<Actions_to_be_taken__c> actionToBeTakenLclList{get;set;}

    public List<Actions_to_be_taken__c> actionToBeTakenCusList{get;set;}

    public List<Visit_Delay_Reason__c> visitDelayReasonList{get;set;}

    public List<Visit_Training_Provided__c> visitTrainingProvided{get;set;}

    public List<Visit_Additional_Points__c> visitAdditionalPointsList{get;set;}

    public List<Visit_Customer_Representative__c > visitCustomerRepList{get;set;}

    public List<customer_visit__c > customerVisitList{get;set;}

    Public customer_visit__c cstVstObj{get;set;}

    public string cusName{get;set;}

    public Visit_Customer_Representative__c vstCusRepObj{get;set;}

    public List<ecReportWrapper>  serEnginNameAndVisitDaysList{get;set;}

 

    public EC_ReportController(ApexPages.StandardController stdController) {     

        totalCountOfWorkingDays = 0;

        todayDate = Date.today().format();

        ecReportObj = new ecReportWrapper();

   

        ecReportId = stdController.getId();

        System.debug('@@'+ecReportId);

        //customerVisitList = getCustomerVisit('a459D000000D1H2QAK');

        visitTechnicalIssuesList = getVisitTechnicalIssues(ecReportId);

        modelWithMachine=new Map<String,List<String>>();

        visitCustomerRepList = getvisitCustomerRep(ecReportId);

        

        List<Visit_Customer_Representative__c> visitCustomerRep=[SELECT Name,Customer_Representative__r.name,Primary_Customer_Representative__c,Customer_Representative_Name__c, Designation__c, Contact_No__c, Id, Customer_Visit__c FROM Visit_Customer_Representative__c where Customer_Visit__c =:ecReportId AND Primary_Customer_Representative__c=True LIMIT 1];

        if(!visitCustomerRep.isEmpty()){

        Designation=String.isNotBlank(visitCustomerRep[0].Designation__c)?visitCustomerRep[0].Designation__c:'-';

               cusName=String.isNotBlank(visitCustomerRep[0].Customer_Representative__r.name)?visitCustomerRep[0].Customer_Representative__r.name:'-';

        }

    

        modelWithMachine=getHiracallyData(ecReportId);

        visitDelayReasonList=getVisitDelayReason(ecReportId);

        visitTrainingProvided=getVisitProviderData(ecReportId);

        actionToBeTakenLclList = getActionToBeTakenByLCL(ecReportId);

        actionToBeTakenCusList = getActionToBeTakenByCustomer(ecReportId);

        visitAdditionalPointsList=getVisitAdditionalPoints(ecReportId);

        VisitSparePartsOrdCollList = getVisitSparePartsOrdColl(ecReportId);

        getTotalCountOfWorkingDays();

        //Visit_Customer_Representative__c vstCusRepObj = [SELECT Id, Date_of_Erection_Commissioning__c FROM Commissioning_Detail__c where Customer_Visit__c = 'a459D0000005yasQAA'];

        Customer_Visit__c ecReport = [SELECT Id,Customer_Name__r.name,Name,CreatedDate, Sold_To__r.name, Ship_To_Address__c,UPS_installed__c,UPS_Make__c,UPS_Rating__c,Voltage_Fluctuation_V__c,Voltage_stabilizer_installed__c,Voltage_stabilizer_make__c,Voltage_stabilizer_rating__c,Water_Softening_Plant_Installed__c,Water_Softening_Plant_Make__c,Water_Softening_Plant_Rating__c,Date_of_Erection_Commissioning__c FROM Customer_Visit__c where Id =:ecReportId]; 

        

        getCustomerVisit();

        //cusName = ecReport.Sold_To__r.name;

       // cusName=String.isNotBlank(ecReport.Sold_To__r.name)?ecReport.Sold_To__r.name:'-';


        ecReportObj.shipToAddress = String.isNotBlank(ecReport.Ship_To_Address__c) ? ecReport.Ship_To_Address__c:'-';  

       // ecReportWrapper.dateoferection = (ecReport.Date_of_Erection_Commissioning__c != Null) ? string.valueOf(ecReport.Date_of_Erection_Commissioning__c):'-';  

        

        serEnginNameAndVisitDaysList=getSrvEngNameAndVisitDays(ecReportId);

    }

    

    

    public class ecReportWrapper{

        public string customerName {get;set;}

      // public string dateoferection {get;set;}// new

        public string shipToAddress {get;set;}

        public string model {get;set;}

        public string machineNumber {get;set;}

        public string lclEngineer {get;set;}

        public string name {get;set;}

        public string designation {get;set;}

        public string dateofCommissioning {get;set;}

        public decimal warrantyStatus {get;set;}

        public String phone {get;set;}

        public string  department {get;set;}

        public String mobile {get;set;}

        public String visitStartDate {get;set;}

        public String visitEndDate {get;set;}

        public String erection {get;set;}

        public String commissioning {get;set;}

        //public string floorCondition {get;set;}

        public string machineInstalledLCL {get;set;}

        public string layout {get;set;}

        public string detailOfChangeLayout {get;set;}

        public String positionOfWasteCollectionBox {get;set;}

        public String powerSupplyArrangement {get;set;}

        public String powerSupplyVoltageRange {get;set;}

        public Boolean upsInstalled {get;set;}

        public String upsMake {get;set;}

        public String upsRating {get;set;}

        public String voltageFluctuation {get;set;}

        public String voltageStabilizerInstalled {get;set;}

        public string voltageStabilizerMake {get;set;}

        public string voltageStabilizerRating {get;set;}

        public string earthingResistance {get;set;}

        public Boolean compressorInstalled {get;set;}

        public string compressorMake {get;set;}

        public string compressorRating {get;set;}

        public Boolean airDryerInstalled {get;set;}

        public string airDryerMake {get;set;}

        public string airDryerRating {get;set;}

        public Boolean waterSofteningPlantInstalled {get;set;}

        public string waterSofteningPlantMake {get;set;}

        public string waterSofteningPlantRating {get;set;}

        public Boolean chillingPlantInstalled {get;set;}

        public string chillingPlantMake {get;set;}

        public string chillingPlantRating {get;set;}

        public string airConditionerAvailability {get;set;}

        public string acAvailabiltyTentativeDate {get;set;}

        public string serviceHeadRemark {get;set;}

        public string natureOfProblem {get;set;}

        public string partnumber {get;set;}

        public string partName {get;set;}

        public Decimal quantity {get;set;}

        public string partSerialNumberBatchNumber {get;set;}

        public string observationFinding {get;set;}

        public string actionTakenSite {get;set;}

        public string actionToBeTaken {get;set;}

        public string actionStatus {get;set;}

        public Boolean serviceReportRelevant {get;set;}

        public string visitDay {get;set;}

        public string serviceEngineerName {get;set;}

        public string workingDays{get;set;}

        public ecReportWrapper(){}

    }

    

    public static List<ecReportWrapper>  getSrvEngNameAndVisitDays(string CustomerVisitId){

        map<string,List<TimeSheetEntry>> mapOfSerEngNameAndTimeSheetEntr=new map<string,List<TimeSheetEntry>>();

        List<TimeSheet> timeSheetList=[Select Id,ServiceResource.Name,(SELECT Id,Is_Working_Day__c FROM TimeSheetEntries) From TimeSheet Where Customer_Visit_ID__c =:CustomerVisitId];

        for(TimeSheet ts:timeSheetList){

            if(ts.TimeSheetEntries.size()>0){

                if(!mapOfSerEngNameAndTimeSheetEntr.containskey(ts.ServiceResource.Name)){

                 List<TimeSheetEntry>  timeSheetEntriesList= new List<TimeSheetEntry>();

                     for(TimeSheetEntry tsEntries:ts.TimeSheetEntries){

                        timeSheetEntriesList.add(tsEntries);

                    }

                    mapOfSerEngNameAndTimeSheetEntr.put(ts.ServiceResource.Name,timeSheetEntriesList);

                }else{

                    for(TimeSheetEntry tsEntries:ts.TimeSheetEntries){

                    mapOfSerEngNameAndTimeSheetEntr.get(ts.ServiceResource.Name).add(tsEntries);

                    }

                }

            }

        }

        

        List<ecReportWrapper>  serEnginNameAndVisitDaysList=new  List<ecReportWrapper>();

        if(!mapOfSerEngNameAndTimeSheetEntr.keySet().isEmpty()){

            for(string  serviceEngName:mapOfSerEngNameAndTimeSheetEntr.keySet()){

                List<TimeSheetEntry> timesheetEntries=mapOfSerEngNameAndTimeSheetEntr.get(serviceEngName);

                integer workingDays=0;

                for(TimeSheetEntry tsEntry:timesheetEntries){

                    if(tsEntry.Is_Working_Day__c == 'Yes'){

                        workingDays = workingDays+1;

                    } 

                }

                ecReportWrapper ecRepObj=new ecReportWrapper();

                ecRepObj.serviceEngineerName=serviceEngName;

                ecRepObj.visitDay= string.valueOf(timesheetEntries.size()); 

                ecRepObj.workingDays = string.valueOf(workingDays);

                serEnginNameAndVisitDaysList.add(ecRepObj);

            }

        }

        return serEnginNameAndVisitDaysList;

    }

    

    public static Map<String,List<String>> getHiracallyData(string CustomerVisitId){

        Map<String,List<String>> modelWithMachine=new Map<String,List<String>>();

        List<TimeSheet> timeSheetList=[Select Id From TimeSheet Where Customer_Visit_ID__c =:CustomerVisitId];

        Set<Id> timeSheeetsId=new Set<Id>();

        if(!timeSheetList.isEmpty()){

            for(TimeSheet tmId : timeSheetList){

                timeSheeetsId.add(tmId.Id);

            }

            System.debug(timeSheeetsId);

            if(!timeSheeetsId.isEmpty()){

                List<TimeSheetEntry> TimeSheetEntryList=[Select Id,Service_Appointment__c From TimeSheetEntry Where TimeSheetId In :timeSheeetsId];

                System.debug(TimeSheetEntryList);

                Set<Id> serviceAppointmentIds=new Set<Id>();

                if(!TimeSheetEntryList.isEmpty()){

                    for(TimeSheetEntry tmShtEntry : TimeSheetEntryList){

                        if(String.isNotBlank(tmShtEntry.Service_Appointment__c)){

                            serviceAppointmentIds.add(tmShtEntry.Service_Appointment__c);

                        }                      

                    }

                    System.debug(serviceAppointmentIds);

                    set<Id> parentIds = new set<Id>();

                    if(!serviceAppointmentIds.isEmpty()){

                        List<ServiceAppointment> serviceAppointList=[Select Id,ParentRecordId From ServiceAppointment Where Id In :serviceAppointmentIds]; 

                        System.debug(serviceAppointList);

                        if(!serviceAppointList.isEmpty()){

                            for(ServiceAppointment serviceAppointment : serviceAppointList){

                                parentIds.add(serviceAppointment.ParentRecordId);

                            }

                        }

                    }

                    System.debug(parentIds);

                    set<Id> workOrderIds = new set<Id>();

                    if(!parentIds.isEmpty()){

                        List<WorkOrder> workOrderList = [SELECT id from WorkOrder where Id In :parentIds];

                        System.debug(workOrderList);

                        if(!workOrderList.isEmpty()){

                            for(WorkOrder order : workOrderList){

                                workOrderIds.add(order.Id);

                            }

                        }

                    }

                    System.debug(workOrderIds);

                    set<Id> assetIds = new set<Id>();

                    if(!workOrderIds.isEmpty()){

                        List<WorkOrderLineItem> WorkOrderLineItemList = [select id,WorkOrderId,AssetId from WorkOrderLineItem where WorkOrderId In: workOrderIds];

                        System.debug(WorkOrderLineItemList);

                        if(!WorkOrderLineItemList.isEmpty()){

                            For(WorkOrderLineItem workOrderLine : WorkOrderLineItemList){

                                assetIds.add(workOrderLine.AssetId);

                            }

                        }

                    }

                    System.debug(assetIds);

                    List<Asset> assetsList =[SELECT id,Model__c,Machine_No__c,Warranty_End_Date__c, Warranty_Start_Date__c,Quantity FROM asset Where Id In :assetIds];

                    System.debug(assetsList);

                    if(!assetsList.isEmpty()){

                        //return null;

                        modelWithMachine=getAssetDataList(assetsList);

                        System.debug('modelWithMachine'+modelWithMachine);

                        return modelWithMachine;

                    }  

                }

            }

        }   

        return null;     

    }

    public void getTotalCountOfWorkingDays() {       

        //String CustomerVisitId = 'a459D0000006DjsQAE';

        List<TimeSheet> timeSheetList=[Select Id,Total_Chargeable_Fixed_Days__c, Total_Chargeable_Service_Days__c From TimeSheet Where Customer_Visit_ID__c =:ecReportId];

        System.debug('timeSheetList : '+ timeSheetList);

        for(TimeSheet tmId : timeSheetList){

            Decimal firstValue = tmId.Total_Chargeable_Fixed_Days__c == Null ? 0 : tmId.Total_Chargeable_Fixed_Days__c;

            Decimal secondValue = tmId.Total_Chargeable_Service_Days__c == Null ? 0 : tmId.Total_Chargeable_Service_Days__c;

            System.debug('firstValue : '+ firstValue + 'secondValue : ' +secondValue);

            totalCountOfWorkingDays = firstValue + secondValue;

        }

        System.debug('totalCountOfWorkingDays : '+ totalCountOfWorkingDays);

        //return totalCountOfWorkingDays;

    }

    /*public static List<Commissioning_Detail__c > getvisitComDetail(String customerVisitId){

List<Visit_Customer_Representative__c > visitComDetailList=[SELECT Name, Designation__c, Contact_No__c, Id, Customer_Visit__c FROM Visit_Customer_Representative__c where Customer_Visit__c =:customerVisitId];

return visitCustomerRepList;

}*/

    public static List<Actions_to_be_taken__c> getActionToBeTakenByLCL(String customerVistId){

        List<Actions_to_be_taken__c> actionToBeTakenLclList = [SELECT Name, Action_By__c, Action__c, Customer_Visit__c FROM Actions_to_be_taken__c WHERE Customer_Visit__c =:customerVistId AND Action_By__c LIKE :'LCL'];

        return actionToBeTakenLclList;

    }

    public static List<Actions_to_be_taken__c> getActionToBeTakenByCustomer(String customerVistId){

        List<Actions_to_be_taken__c> actionToBeTakenCusList = [SELECT Name, Action_By__c, Action__c, Customer_Visit__c FROM Actions_to_be_taken__c WHERE Customer_Visit__c =:customerVistId AND Action_By__c LIKE :'Customer'];

        return actionToBeTakenCusList;

    }

    public static List<Visit_Spare_Parts_Order_Collected__c> getVisitSparePartsOrdColl(String customerVistId){

        List<Visit_Spare_Parts_Order_Collected__c> VisitSparePartsOrdCollList=[Select Description__c,Part_No__c, Quantity__c FROM Visit_Spare_Parts_Order_Collected__c WHERE Customer_Visit__c =:customerVistId];

        return VisitSparePartsOrdCollList;

    }

    public static List<Visit_Customer_Representative__c > getvisitCustomerRep(String customerVisitId){

        List<Visit_Customer_Representative__c > visitCustomerRepList=[SELECT Name,Customer_Representative_Name__c, Designation__c, Contact_No__c, Id, Customer_Visit__c FROM Visit_Customer_Representative__c where Customer_Visit__c =:customerVisitId];

         return visitCustomerRepList;

    } 

    public static List<Technical_Issues__c> getVisitTechnicalIssues(String customerVistId){

        List<Technical_Issues__c> visitTechnicalIssuesList = [SELECT Id, Nature_of_Problem__c, Model__c, Observation_Finding__c, Action_to_be_taken__c FROM Technical_Issues__c WHERE Customer_Visit__c =:customerVistId];

        //System.debug('visitCustomerRepresentativeList : '+ visitCustomerRepresentativeList);

        return visitTechnicalIssuesList;

    }

    public void getCustomerVisit(){

        //String customerVisitId = 'a459D000000D1H2QAK';

        List<customer_visit__c> customerVisitList=[SELECT Name, CreatedDate, Date_of_Erection_Commissioning__c, Power_Supply_Voltage_Range_V__c, Id, Floor_Condition__c, 

                                                   Detail_of_Changes_in_Layout__c, Machine_installed_as_per_layout_provided__c, Position_of_Waste_Collection_Box__c, UPS_Installed__c, 

                                                   Voltage_Stabilizer_Rating__c, Earthing_Resistance_ohm__c, Compressor_Make__c, Air_Dryer_Make__c, Air_Dryer_Rating__c, Air_Dryer_Installed__c,

                                                   UPS_Make__c, UPS_Rating__c, Compressor_Rating__c, Voltage_Stabilizer_Make__c, Water_Softening_Plant_Make__c, Water_Softening_Plant_Rating__c, Water_Softening_Plant_Installed__c,

                                                   Chiilling_Plant_Rating__c, Chiilling_Plant_Make__c, Power_Supply_Arrangement__c, AC_Availabilty_Tentative_Date__c, Air_Conditioner_Availability__c, Voltage_Stabilizer_Installed__c,

                                                   Voltage_Fluctuation_V__c, Chilling_Plant_Installed__c, Compressor_Installed__c,Sold_To__r.name FROM Customer_Visit__c where id =: ecReportId];

        for(customer_visit__c cstVstObj : customerVisitList){

            cusVstId = cstVstObj.name;

            dateTime createdDate1 = cstVstObj.CreatedDate;

            

            

           // myDate = createdDate1.format('dd/mm/yyyy');

            

             dateStr = createdDate1.day() + '/' + createdDate1.month() + '/' + createdDate1.year();

            dateoferection = (cstVstObj.Date_of_Erection_Commissioning__c != Null) ? string.valueOf(cstVstObj.Date_of_Erection_Commissioning__c):'-'; 

            soldtoName = String.isNotBlank(cstVstObj.Sold_To__r.name) ? cstVstObj.Sold_To__r.name : '';

            //myDate = date.valueOf(createdDate);

            floorCondition = cstVstObj.Floor_Condition__c == null ? '' : cstVstObj.Floor_Condition__c;

            layout = cstVstObj.Detail_of_Changes_in_Layout__c == null ? '' : cstVstObj.Detail_of_Changes_in_Layout__c;

            //detailOfChangeLayout = cstVstObj.Machine_installed_as_per_layout_provided__c;// == null ? '' : cstVstObj.Machine_installed_as_per_layout_provided__c ;

            detailOfChangeLayout = (cstVstObj.Machine_installed_as_per_layout_provided__c != null) ? cstVstObj.Machine_installed_as_per_layout_provided__c == true ? 'Y' : 'N' : null;

            positionOfWasteCollectionBox = cstVstObj.Position_of_Waste_Collection_Box__c == null ? '' : cstVstObj.Position_of_Waste_Collection_Box__c ;

            powerSupplyArrangement = cstVstObj.Power_Supply_Arrangement__c == null ? '' : cstVstObj.Power_Supply_Arrangement__c ;

            powerSupplyVoltageRange = cstVstObj.Power_Supply_Voltage_Range_V__c == Null ? '' : cstVstObj.Power_Supply_Voltage_Range_V__c;

            //upsInstalled = cstVstObj.UPS_installed__c;// != Null ? cstVstObj.UPS_installed__c : '';

            upsInstalled = (cstVstObj.UPS_installed__c != null) ? cstVstObj.UPS_installed__c == true ? 'Y' : 'N' : null;

            upsMake = (cstVstObj.UPS_Make__c != Null) ? cstVstObj.UPS_Make__c:'N/A';

            upsRating = (cstVstObj.UPS_Rating__c != Null) ? cstVstObj.UPS_Rating__c:'N/A'; 

            airDryerMake = (cstVstObj.Air_Dryer_Make__c != Null) ? cstVstObj.Air_Dryer_Make__c : 'N/A';

            airDryerRating = (cstVstObj.Air_Dryer_Rating__c != Null) ? cstVstObj.Air_Dryer_Rating__c : 'N/A';

            voltageFluctuation = (cstVstObj.Voltage_Fluctuation_V__c != Null) ? cstVstObj.Voltage_Fluctuation_V__c:'';

            //voltageStabilizerInstalled = cstVstObj.Voltage_stabilizer_installed__c;// != Null) ? cstVstObj.Voltage_stabilizer_installed__c:'';

            voltageStabilizerInstalled = (cstVstObj.Voltage_stabilizer_installed__c != null) ? cstVstObj.Voltage_stabilizer_installed__c == true ? 'Y' : 'N' : null;

            voltageStabilizerMake = (cstVstObj.Voltage_stabilizer_make__c != Null) ? cstVstObj.Voltage_stabilizer_make__c:'N/A';

            voltageStabilizerRating = (cstVstObj.Voltage_stabilizer_rating__c != Null) ? cstVstObj.Voltage_stabilizer_rating__c:'N/A';

            earthingResistance = cstVstObj.Earthing_Resistance_ohm__c != Null ? String.valueOf( cstVstObj.Earthing_resistance_ohm__c ) : 'N/A';

            //compressorInstalled = cstVstObj.Compressor_Installed__c;// != Null ? cstVstObj.Compressor_Installed__c: 0;

            

            compressorInstalled = (cstVstObj.Compressor_Installed__c != Null) ? cstVstObj.Compressor_Installed__c == true ? 'Y' : 'N' : null;

            compressorMake = (cstVstObj.Compressor_Make__c != Null) ? cstVstObj.Compressor_Make__c:'N/A';

            compressorRating = (cstVstObj.Compressor_rating__c != Null) ? cstVstObj.Compressor_rating__c:'N/A';

            waterSofteningPlantInstalled = cstVstObj.Water_Softening_Plant_Installed__c;// != Null) ? cstVstObj.Water_Softening_Plant_Installed__c:'';

            waterSofteningPlantMake = (cstVstObj.Water_Softening_Plant_Make__c != Null) ? cstVstObj.Water_Softening_Plant_Make__c:'N/A';

            waterSofteningPlantRating = (cstVstObj.Water_Softening_Plant_Rating__c != Null) ? cstVstObj.Water_Softening_Plant_Rating__c:'N/A';

            chillingPlantInstalled = cstVstObj.Chilling_Plant_Installed__c;// != Null) ? cstVstObj.Chilling_Plant_Installed__c:'';

            chillingPlantMake = (cstVstObj.Chiilling_Plant_Make__c != Null) ? cstVstObj.Chiilling_Plant_Make__c:'N/A';

            chillingPlantRating = (cstVstObj.Chiilling_Plant_Rating__c != Null) ? cstVstObj.Chiilling_Plant_Rating__c:'N/A';

            airConditionerAvailability = (cstVstObj.Air_Conditioner_Availability__c != Null) ? cstVstObj.Air_Conditioner_Availability__c:'';

            //Date d = (cstVstObj.AC_Availabilty_Tentative_Date__c!=null)?cstVstObj.AC_Availabilty_Tentative_Date__c:null;

            //acAvailabiltyTentativeDate = d.day()+ '/' + d.month() + '/' + d.year();

            //System.debug('acAvailabiltyTentativeDate : '+ acAvailabiltyTentativeDate); 

        }

        //return customerVisitList;

    }

    public static List<Visit_Delay_Reason__c> getVisitDelayReason(String customerVisitId){

        List<Visit_Delay_Reason__c> visitDelayReasonList=[Select Name,Reason__c,Delay_Hours__c,Category__c FROM Visit_Delay_Reason__c Where Customer_Visit__c =:customerVisitId];

        return visitDelayReasonList;

    }

    public static List<Visit_Training_Provided__c> getVisitProviderData(String customerVisitId){

        List<Visit_Training_Provided__c> visitTrainingProvided=[SELECT Name,Subject__c,Person__r.name,Designation__c FROM Visit_Training_Provided__c Where Customer_Visit__c =:customerVisitId];

        return visitTrainingProvided; 

    } 

    

    public static List<Visit_Additional_Points__c> getVisitAdditionalPoints(String customerVisitId){

        List<Visit_Additional_Points__c> visitAdditionalPointsList=[Select Name,Description__c From Visit_Additional_Points__c Where Customer_Visit__c =:customerVisitId ]; 

        System.debug('visitAdditionalPointsList : '+ visitAdditionalPointsList);

        return  visitAdditionalPointsList;

    } 

    

    public static Map<String,List<String>> getAssetDataList(List<Asset> assetsList){

        Map<String,List<String>> modelWithMachine=new Map<String,List<String>>();

        System.debug(assetsList);

        Map<String,List<String>> newTempMAp=new Map<String,List<String>>();

        for(Asset assetObj : assetsList){

            List<String> strUnderWarrList=new List<String>();

            List<String> strOutWarrList=new List<String>();

            

            String strMachine=(String.isNotBlank(assetObj.Machine_No__c))?assetObj.Machine_No__c:'-';     

            strUnderWarrList.add(strMachine+' ');       

            if(!newTempMAp.containsKey(assetObj.Model__c+' ')){

                newTempMAp.put(assetObj.Model__c+' ',strUnderWarrList);

            }else{

                newTempMAp.get(assetObj.Model__c+' ').add(assetObj.Machine_No__c+' '); 

            }

        }

        if(!newTempMAp.isEmpty()){

            return newTempMAp;

        }else{

            return null;

        }

    }

Comments

Popular posts from this blog

Custom List View Button In Salesforce

Get Record Id RecordId in LWC

PDF LWC (Link for pdf liabrary)