• chiranjib rout
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 14
    Replies
List<Messaging.SingleEmailMessage> mails =  new List<Messaging.SingleEmailMessage>();
        for(ccrz__E_Order__c order : [Select Name,SAP_Order_Number__c,ccrz__TotalAmount__c,Id,ccrz__OriginatedCart__r.Name,ccrz__User__r.Name from ccrz__E_Order__c where id in: orderLst]){
             Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
             List<String> sendTo = new List<String>();
             List<String> orderItem = new List<String>();
             for(ccrz__E_OrderItem__c line:orderItemMap.get(order.Id)){
                 orderItem.add(line.Name);
               }
             //sendTo.add(order.ccrz__Contact__r.email);
             sendTo.add('test1@test.com');
             mail.setToAddresses(sendTo);
             mail.setReplyTo('test1@test.com');
             mail.setSenderDisplayName('test');
             mail.setSubject('Order Failed :'+ order.SAP_Order_Number__c);
             String body = 'Hi Team, <br/><br/> Order has been failed. Please find the below Order Detail : <br/> <br/>' +
                            'Order Number :' + order.SAP_Order_Number__c +
                            '<br/> Cart ID : '+ order.ccrz__OriginatedCart__r.Name +
                            '<br/> Total Amount  : '+ order.ccrz__TotalAmount__c +
                            '<br/> Registered User  : '+ order.ccrz__User__r.Name+
                            '<br/> Order Line Items  : '+ orderItem ;
                            
              
                           
             mail.setHtmlBody(body);
             mails.add(mail);
        }
unable to coverage the code for above test class ,Kindly help me on this
 
public class OrderSimulate_Res_Parser {

    public class ET_ITEMLIST {
        public String ITM_NUMBER;
        public String MATERIAL;
        public String REQ_QTY;
        public String AVL_QTY;
        public String ABS_DISCOUNT;
        public String PERC_DISCOUNT;
    }

    public Row row;

    public class Row {
        public String TAX_AMOUNT_HD;
        public String EX_EXCEPTION;
        public String EV_SALES_ORDER;
        public String ET_MESSAGES;
        public String EX_CR_BLOCK;
        public String IV_ORDER_DISCOUNT;
        public List<ET_FREIGHT_OPTIONLIST> ET_FREIGHT_OPTIONLIST;
        public List<ET_ITEMLIST> ET_ITEMLIST;
    }

    public class ET_FREIGHT_OPTIONLIST {
        public String SHIP_DESC;
        public String FREIGHT_VAL;
        public String REQ_DATE;
        public String SHIP_COND;
    }

    
    public static SCP_OrderSimulate_Res_Parser parse(String json) {
        return (SCP_OrderSimulate_Res_Parser) System.JSON.deserialize(json, SCP_OrderSimulate_Res_Parser.class);
    }
}

As i am new to this can anyone please help me to write a test class for the above class;
Thanks in Advance
I have 3 objects appointment,invoice and revenue.Invoice is having look up to appointment. There are some appointments which is having invoice and some appointments does not have invoice.There is a common field in both objects that is ecode. So here my requirement is in the revenue object i will put the ecode.If the ecode is present in the invoice then the revenue calculation should happen from invoice object.If the ecode does not present in the invoice then the calculation will happen from appointment. I have written the trigger also. So when i am performing the action manually the trigger is working fine.But when i am uploading through data loader since i have taken invoicelist.size the size is coming more than zero and the calculation is going to the second loop.
trigger Revenue_calculations on Revenue__c (before insert, before update) {

Map<id,String>reids=new Map<id,String>();   
set<string>ecode=new set<string>();
set<integer>Bmonth=new set<integer>(); 
List<Revenue__c> revlist=new List<Revenue__c>();
List<Invoice__c>invlist=new List<Invoice__c>();

List<Appointment__c >apps= new List<Appointment__c>();
List<Appointment__c >apps2= new List<Appointment__c>();

Decimal InvoiceFinalamount;   
String clientname;
String talentname;


Decimal amount;

for(Revenue__c re:trigger.new){

    ecode.add(re.ECode__c);

    }

    apps= [select Contact_Talent__r.name,DOJ__c,Last_Working_Date__c,Employer__r.name, ECode__c  from Appointment__c where ECode__c IN:ecode];

    system.debug('***ecode**'+ecode);
    system.debug('&&Bmonth&&'+Bmonth);
    invlist=[select id,name,Emp_Code__c,Sub_Total__c,Status_of_Invoice__c,T from Invoice__c where Emp_Code__c IN:ecode AND CALENDAR_MONTH(Billing_Month__c) IN:Bmonth ];

    system.debug('%%%invlist%%'+invlist);

    system.debug('invlist.size()'+invlist.size());



    if(invlist.size()==0 ){

    apps2=[select HR_Initial_BillRate__c,Initial_Billable_Hours_Days__c,ECode__c from Appointment__c where ECode__c IN:ecode ];
    system.debug('apps2***'+apps2);
    for(Revenue__c re:trigger.new){

    amount=0;
    for(Appointment__c ap:apps2){

       if(ap.ECode__c ==re.ECode__c){

         system.debug('inside new loop'+re.ECode__c);

             amount= ap.HR_Initial_BillRate__c*66;



          re.Revenue_Without_ST__c=amount;
          re.invoice_exist__c =false;


         }

         }}}






    if( invlist.size()!=0)
{
    for(Revenue__c re:trigger.new){   
    ecode.add(re.ECode__c);
    Bmonth.add(re.Salary_Processed_Month__c.month());                
    integer count=0;
    InvoiceFinalamount=0;

     Integer count1=0;


     system.debug('++invlist size++'+invlist.size());
    for(Invoice__c Inv:invlist){
     system.debug('^^Inv.Emp_Code__c^^'+Inv.Emp_Code__c);
     system.debug('22Inv.Type_of_Invoices__c22'+Inv.Type_of_Invoices__c);
     system.debug('$$re.Invoice_Type__c$$'+Inv.Billing_Month__c);


     if(re.Invoice_Type__c==Inv.Type_of_Invoices__c ) {



       if(re.ECode__c==Inv.Emp_Code__c && re.Salary_Processed_Month__c.month()==Inv.Billing_Month__c.month()&& re.Salary_Processed_Month__c.year()==Inv.Billing_Month__c.year() ){
        count=count+1;
        SYSTEM.DEBUG('Inv.Sub_Total__c+++++ '+Inv.Sub_Total__c);


       InvoiceFinalamount+= Inv.Sub_Total__c*72;

       }


      }

      system.debug('CCCcountCCC'+count);
      system.debug('$$InvoiceFinalamount$$'+InvoiceFinalamount);
    }




   for(Appointment__c ap :apps){  
    if(re.ECode__c == ap.ECode__c ){
  re.Talent_Name__c=ap.Contact_Talent__r.name;

  re.Client_Name__c=ap.Employer__r.name;
  re.DOJ__c=ap.DOJ__c;
  re.Last_Working_Date__c=ap.Last_Working_Date__c;
  re.Actual_PO_value__c =ap.HR_Initial_BillRate__c;
  re.Rate_pattern__c=ap.HR_Rate_Pattern__c;
  re.Currency_Type__c=ap.Currency_Type__c;



   }
  }


  re.invoice_exist__c =true;
  re.Revenue_Without_ST__c=InvoiceFinalamount;

  }
  } 
}

 
hii here i have written on apex class ,i am new to test class,please suggest test class for it, 

 public PageReference attachedTalentsToJobs()
    {
        try
        {
            
            List<Contact> cand = new List<Contact>();
            SCSCHAMPS__Job__c jobRec = new SCSCHAMPS__Job__c();
            jobRec = [SELECT SCSCHAMPS__Account_Manager__c,SCSCHAMPS__Account__c,SCSCHAMPS__Date_of_Posting__c,
                       SCSCHAMPS__Desired_Skills__c,SCSCHAMPS__Expected_Start_Date__c,SCSCHAMPS__Hiring_Manager_Name__c,SCSCHAMPS__Hiring_Manager__c,Id,
                       SCSCHAMPS__Job_Title__c,Name,SCSCHAMPS__Recruiter__c,SCSCHAMPS__Skill_Matched__c,SCSCHAMPS__Stage__c,SCSCHAMPS__Talent_Search__c,SCSCHAMPS__Travel_Per__c  
                       FROM SCSCHAMPS__Job__c where id=:jobId];
            List<SCSCHAMPS__Job_Applicant__c> jobApplicants = new List<SCSCHAMPS__Job_Applicant__c>();
            System.debug('###########################################Contact List :'+ selectedTalents);
            System.debug('*********test1 :'+counterMap);
            for(Contact ca : selectedTalents)
            {
                if(ca.id!=null){
                    cand.add(ca);
                    SCSCHAMPS__Job_Applicant__c ja = new SCSCHAMPS__Job_Applicant__c();
                    ja.SCSCHAMPS__Contact_Talent__c = ca.id;
                    for(Id id: counterMap.keySet()){
                        if(id==ca.Id ){         
                           ja.SCSCHAMPS__Rating__c=counterMap.get(id);
                        }   
                    }
                    ja.SCSCHAMPS__Account__c = jobRec.SCSCHAMPS__Account__c;
                    ja.SCSCHAMPS__Account_Manager__c = jobRec.SCSCHAMPS__Account_Manager__c;
                    ja.SCSCHAMPS__Job_Recruiter__c = UserInfo.getUserId();
                    ja.SCSCHAMPS__Hiring_Manager__c = jobRec.SCSCHAMPS__Hiring_Manager__c;
                    ja.SCSCHAMPS__Job__c = jobId;
                    //ja.SCSCHAMPS__Search_Criteria_Long__c = 'Keywords = ' + searchTalent + '; Additional Criteria = ';
                    //ja.SCSCHAMPS__Search_By__c = UserInfo.getUserId();
                    jobApplicants.add(ja);
                    
                }
            }
            System.debug('TalentSearchforJob Before : '+jobApplicants);
            insert jobApplicants;
            System.debug('TalentSearchforJob After : '+jobApplicants);

            PageReference curPage = ApexPages.currentPage();
            curPage.getParameters().put('success','true');
            curPage.getParameters().put('id',Apexpages.currentPage().getParameters().get('id'));
            curPage.setRedirect(true);
            return curPage;

        }
        catch(Exception e)
        {
            ApexPages.addMessages(e);
        }

 
here is the vf page code :
    <apex:page controller="importDataFromCSVController" >
    <apex:form >
        <apex:pagemessages />
        <apex:pageBlock >
            <apex:pageBlockSection columns="48" > 
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}"/>
                  <apex:commandButton value="Import Timesheet" action="{!importCSVFile}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock >
           <apex:pageblocktable value="{!applist}" var="app">
              <apex:column value="{!app.Avvas_id__c}" />
              <apex:column value="{!app.Total_Number_of_Hours_worked__c}" />
              <apex:column value="{!app.Total_Cleint_Holidays__c}" />
              <apex:column value="{!app.Total_Number_of_Days_worked__c}" />
              <apex:column value="{!app.Total_billable_days__c }" />
       
        </apex:pageblocktable>
     </apex:pageBlock>
   </apex:form>
</apex:page>

controller:

public class importDataFromCSVController {
public Blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvFileLines{get;set;}

public List<appointment__c> applist{get;set;}
  public importDataFromCSVController(){
    csvFileLines = new String[]{};
    applist = New List<appointment__c>(); 
  }
  
  public void importCSVFile(){
       try{
           csvAsString = csvFileBody.toString();
           csvFileLines = csvAsString.split('\n'); 
            
           for(Integer i=1;i<csvFileLines.size();i++){
               appointment__c appObj = new appointment__c () ;
               string[] csvRecordData = csvFileLines[i].split(',');
               appObj.Avvas_id__c = csvRecordData[0] ;             
               appObj.Total_Number_of_Hours_worked__c = Decimal.Valueof(csvRecordData[1]);
               appObj.Total_Cleint_Holidays__c = Decimal.Valueof(csvRecordData[2]);
               appObj.Total_Number_of_Days_worked__c = Decimal.Valueof(csvRecordData[3]);                                                                            
               applist.add(appObj);   
           }
        //insert acclist;
        }
        catch (Exception e)
        {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importin data Please make sure input csv file is correct');
            ApexPages.addMessage(errorMessage);
        }  
  }
}
   
User-added image


In this csv file i want to capture specific data like  ID =A-006,
Total_Number_of_Hours_worked= 60
Total_Cleint_Holidays= 1
Total_Number_of_Days_worked= 18
hii everyone, please suggest me how to capture client location from google  using java script and bootstrap.my requirement is  in a visual page i have  two fields longitude and lattitude, under longitutde and lattitue there is one button get location. whenever i press the get location botton the longitude and lattitude automatic capture the client location from google.
please suggest me something about offline geolocation. My requirement is like if any sales person is going to any rural area and network is not there so how can i be able to come across my location later.I am not supposed to take pictures and get to know about my location.any suggestions...
everyboby. i have facing problem with the wrapper class controller of the following visualforce page? the work flow is whenever i will enter the jobid in the box and click on enter it will search inside interview object and corresponding candidate Names(who has the same jobid) will appear under the name label but it won't showing anything . please suggest wapper class controller for this vf page`<apex:page controller="Client_Feedback" showHeader="false" sidebar="false" standardStylesheets="true">
<apex:Pagemessages id="msg"/>
<apex:form >
<CENTER><apex:image url="{!$Resource.LOGO}" width="200" height="130"/></CENTER>
<CENTER><p><b>Client Login Page</b><br /></p></CENTER>
<CENTER>
<apex:panelGrid columns="3" style="margin-top:1em;">
<p>
<b>JOB ID:</b><br />
<apex:inputText required="true" id="ID" value="{!var}"/>
<!--<apex:inputField required="true" value="{!intList.SCSCHAMPS__Job__c}" styleclass="arrange"/>-->

<apex:commandButton action="{!search}" value="enter" id="enter"/>
  </p> 
</apex:panelGrid>
</CENTER>
<apex:pageBlock >
<apex:pageBlockTable value="{!intList}" var="il" id="intList">
<apex:column >
 <apex:facet name="header">SL No</apex:facet>
 <apex:variable value="{!0}" var="count"/>
 <apex:variable value="{!count+1}" var="count"/>
 </apex:column>
  
 <!--<apex:column > 
 <apex:facet name="header">Interview ID</apex:facet>
 <apex:outputField value="{!il.Interview ID}"/> 
</apex:column> -->

<apex:column >
<apex:facet name="header">Name</apex:facet>
 <apex:outputField value="SCSCHAMPS__Interview__c">{!il.SCSCHAMPS__Talent__c}</apex:outputField> 
</apex:column>           
<apex:column >
<apex:facet name="header">Feedback</apex:facet>
 <apex:inputField value="{!il.SCSCHAMPS__Interview_Feedback__c}"/> 
</apex:column>

          
</apex:pageBlockTable>

<apex:pageBlockButtons location="bottom"/><center>
<apex:commandButton value="UPDATE"  action="{!saveInformation}"/></center>
</apex:pageBlock>
</apex:form>
</apex:page>`

 **controller:**
`public with sharing class Client_Feedback {
public List < SCSCHAMPS__Interview__c > intList {get;set;}
SCSCHAMPS__Interview__c intr;
//public List<SCSCHAMPS__Interview__c> getint()
//public List<WrapData> wd{set; get; }
 public String ID {get;set;}
 public string var{set;get;}
 public string Name{set;get;}
 public string Feedback{set;get;}
public void search()
{
 if(intList == null) {
intList = new List<SCSCHAMPS__Interview__c>();
for(List <SCSCHAMPS__Interview__c > intList= [select id,SCSCHAMPS__Talent__c,SCSCHAMPS__Job__c,SCSCHAMPS__Interview_Feedback__c
                                                         from SCSCHAMPS__Interview__c where SCSCHAMPS__Job__c=:ID 
                                                           limit 1])
                 { Name= intr. SCSCHAMPS__Talent__c ; }                                   
                                                           
  
                                                 
}

}
public Pagereference saveInformation(){
PageReference ref=null; 
//Adding the Records to inner class and to get the values for page block table.
        if(intList == null){
            intList = new List<SCSCHAMPS__Interview__c>();
            List < SCSCHAMPS__Interview__c > intList= [select id,SCSCHAMPS__Talent__c,SCSCHAMPS__Job__c,SCSCHAMPS__Interview_Feedback__c
                                                         from SCSCHAMPS__Interview__c where SCSCHAMPS__Job__c=:ID 
                                                           limit 1];
                                                         
            
}
return ref;      
}       
}`User-added image
here when i will give any jobid which is available in interview object then after pressing the enter button 1 new page(Feedback_JobID) will open and if the jobid is not available inside the interview object then 1 error message will come. But whenever i am trying to do that here for every value it is showing the error message.The flow is not going to if loop i think. Can anybody give me the idea what is wrong here..
VF Page:
<apex:page controller="Client_Feedback" showHeader="false" sidebar="false" standardStylesheets="true">
<apex:Pagemessages id="msg"/>
<apex:form >
<CENTER><apex:image url="{!$Resource.LOGO}" width="200" height="130"/></CENTER>
<CENTER><p><b>Client Login Page</b><br /></p></CENTER>
<CENTER>
<apex:panelGrid columns="3" style="margin-top:1em;">
<p><b>JOB ID:</b><br />
<apex:inputText required="true" id="ID" value="{!var}"/>

<apex:commandButton action="{!search}" value="enter" id="enter"/>
  </p> 
</apex:panelGrid>
</CENTER>
</apex:form>
</apex:page>
 
CONTROLLER:
public class Client_Feedback {        
        public String ID {get;set;}
        public string var{set;get;}
        public List < SCSCHAMPS__Interview__c > intList {get;set;}
        //public Freelancer__c fre {get;set;}
        public PageReference search()
         {
            {
                
                //this.intList.clear();
                List<SCSCHAMPS__Interview__c> intList = [SELECT id,SCSCHAMPS__Job__c
                                                     FROM SCSCHAMPS__Interview__c 
                                                     WHERE SCSCHAMPS__Job__c= :ID  limit 1 ]; 
                 pageReference ref;                                    
                 if(!intList.isEmpty()) 
                 { 
                     
                     ref= page.Feedback_JobID;
                    ref.setRedirect(true);
                    return ref;
                  
                 }
                 else {
                   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'TRY AGAIN... .')); 
                    
                }
                return null;
                 
                 }                                               
            }
        }

 
hii friends please suggest me  test class for this  below. i have also written one test class but showing error
Trigger RevenueWithoutST on Revenue__c (before insert,Before Update) {

    List<SCSCHAMPS__Appointment__c> appList;
    List<Revenue__c> revlist = new List<Revenue__c>();
    string eCode;
    date salaryDate;
    string category;
    string type;
    Integer month;
    Integer year;
    
    for(Revenue__c rev:Trigger.new)
    {
        eCode=rev.ECode__c;
        salaryDate=rev.Salary_Processed_Month__c;
        month=rev.Salary_Processed_Month__c.month();
        year=rev.Salary_Processed_Month__c.year();
        category=rev.InvoiceCategory__c;
        type=rev.Invoice_Type__c;      
        if(eCode!=null)
        {
           appList =[select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c=: ecode] ;
            
            for(SCSCHAMPS__Appointment__c app : appList)
            {
               rev.Talent_Name__c= app.Name_of_the_Candidate__c;
               rev.Client_Name__c=app.Client_Name__c;
               rev.DOJ__c=app.Date_of_Onboarding__c;
               rev.Last_Working_Date__c=app.Last_Working_Date__c;
               rev.Location__c=app.Location__c;
            }
        }

        if((eCode!=null) && (category=='individual') &&(salaryDate!=NULL) )
        {
            List<Invoice__c> InvList;                                                                              
            InvList=[select id,Name,Emp_Code__c,Invoice_Category__c,Sub_Total__c,Invoice_Date__c from Invoice__c where Emp_Code__c=: ecode
                    AND CALENDAR_MONTH(Invoice_Date__c)=:month AND CALENDAR_YEAR(Invoice_Date__c)=:year ];
              System.debug('+++invoice'+InvList);
              
              
                FOR(Invoice__c inc : InvList)
                {
                  
                  rev.Revenue_Without_ST__c=inc.Sub_Total__c;
                }

        }

        else if(eCode!=null && category=='consolidated')
        {

            List<Invoice_Line_Item__c> ILineList;
         // Invoice_Line_Item__c iline=new Invoice_Line_Item__c();
            ILineList=[select id,Name,Employee_Code__c,Total__c,Invoice_Date__c from Invoice_Line_Item__c where Employee_Code__c=:ecode
                        AND CALENDAR_MONTH(Invoice_Date__c)=:month AND CALENDAR_YEAR(Invoice_Date__c)=:year ];
            for(Invoice_Line_Item__c IL : ILineList)
            {
              rev.Revenue_Without_ST__c=IL.Total__c;
            }
        }
           
    }
 
    }
Here is my  test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }

Here is my  test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }
 
hii friends please suggest me  test class for this  below. i have also written one test class but showing error
trigger subtotal on Revenue__c (after insert, before update) {


    List<Revenue__c> revlist = new List<Revenue__c>(); //initialize list


    Set<String> eCodeSet = new Set<String>();
    for(Revenue__c rev:Trigger.new)
    {
        if(rev.ECode__c!=null){
            eCodeSet.add(rev.ECode__c);
        }
    }


    //get all the SCSCHAMPS__Appointment__c records
    Map<String,SCSCHAMPS__Appointment__c> appMap = new Map<String,SCSCHAMPS__Appointment__c>();
    Map<String,Invoice__c> invoiceMap = new Map<String,Invoice__c>();
    Map<String,Invoice_Line_Item__c> invoiceLineItemMap = new Map<String,Invoice_Line_Item__c>();
    for(SCSCHAMPS__Appointment__c appointment : [select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,

                    Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c in : eCodeSet])
    {
        appMap.put(appointment.AvvasECode__c,appointment);
    }

    //get all invoice records
    for(Invoice__c invoice : [select id,Name,Emp_Code__c,Invoice_Category__c,createddate,

                     Sub_Total__c from Invoice__c  where Emp_Code__c in : eCodeSet])
    {
        invoiceMap.put(invoice.Emp_Code__c,invoice);
        
        System.debug('++++invoice'+invoiceMap);
    }

    //get all invoice lineitem records
    for(Invoice_Line_Item__c lineItem : [Select id,Name,Employee_Code__c,Total__c

                       from Invoice_Line_Item__c where Employee_Code__c =: eCodeSet])
    {
        invoiceLineItemMap.put(lineItem.Employee_Code__c,lineItem);
    }



    for(Revenue__c rev:Trigger.new)

    {


        if(rev.ECode__c!=null && appMap.containsKey(rev.ECode__c))
        {
                    rev.Talent_Name__c=  appMap.get(rev.ECode__c).Name_of_the_Candidate__c;
                    rev.DOJ__c= appMap.get(rev.ECode__c).Date_of_Onboarding__c;
                    rev.Client_Name__c = appMap.get(rev.ECode__c).Client_Name__c;
                    rev.Location__c= appMap.get(rev.ECode__c).Location__c;
                    rev.Last_Working_Date__c=appMap.get(rev.ECode__c).Last_Working_Date__c;
        }

        if(rev.ECode__c!=null && rev.InvoiceCategory__c=='individual' && invoiceMap.containsKey(rev.ECode__c))
        {
                  rev.Revenue_Without_ST__c=invoiceMap.get(rev.ECode__c).Sub_Total__c;
        }

        else if(rev.ECode__c!=null && rev.InvoiceCategory__c=='consolidated'&& invoiceLineItemMap.containsKey(rev.ECode__c))

        {
              rev.Revenue_Without_ST__c=invoiceLineItemMap.get(rev.ECode__c).Total__c;

        }

    }

}


Here is my  test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }

 
hii friends please suggest me  test class for this  below
trigger trigger subtotal on Revenue__c (after insert, before update) {

  List<Revenue__c> revlist = new List<Revenue__c>(); //initialize list


    Set<String> eCodeSet = new Set<String>();
    for(Revenue__c rev:Trigger.new)
    {
        if(rev.ECode__c!=null){
            eCodeSet.add(rev.ECode__c);
        }
    }


    //get all the SCSCHAMPS__Appointment__c records
    Map<String,SCSCHAMPS__Appointment__c> appMap = new Map<String,SCSCHAMPS__Appointment__c>();
    Map<String,Invoice__c> invoiceMap = new Map<String,Invoice__c>();
    Map<String,Invoice_Line_Item__c> invoiceLineItemMap = new Map<String,Invoice_Line_Item__c>();
    for(SCSCHAMPS__Appointment__c appointment : [select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,

                    Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c in : eCodeSet])
    {
        appMap.put(appointment.AvvasECode__c,appointment);
    }

    //get all invoice records
    for(Invoice__c invoice : [select id,Name,Emp_Code__c,Invoice_Category__c,createddate,

                     Sub_Total__c from Invoice__c  where Emp_Code__c in : eCodeSet])
    {
        invoiceMap.put(invoice.Emp_Code__c,invoice);
        
        System.debug('++++invoice'+invoiceMap);
    }

    //get all invoice lineitem records
    for(Invoice_Line_Item__c lineItem : [Select id,Name,Employee_Code__c,Total__c

                       from Invoice_Line_Item__c where Employee_Code__c =: eCodeSet])
    {
        invoiceLineItemMap.put(lineItem.Employee_Code__c,lineItem);
    }



    for(Revenue__c rev:Trigger.new)

    {


        if(rev.ECode__c!=null && appMap.containsKey(rev.ECode__c))
        {
                    rev.Talent_Name__c=  appMap.get(rev.ECode__c).Name_of_the_Candidate__c;
                    rev.DOJ__c= appMap.get(rev.ECode__c).Date_of_Onboarding__c;
                    rev.Client_Name__c = appMap.get(rev.ECode__c).Client_Name__c;
                    rev.Location__c= appMap.get(rev.ECode__c).Location__c;
                    rev.Last_Working_Date__c=appMap.get(rev.ECode__c).Last_Working_Date__c;
        }

        if(rev.ECode__c!=null && rev.InvoiceCategory__c=='individual' && invoiceMap.containsKey(rev.ECode__c))
        {
                  rev.Revenue_Without_ST__c=invoiceMap.get(rev.ECode__c).Sub_Total__c;
        }

        else if(rev.ECode__c!=null && rev.InvoiceCategory__c=='consolidated'&& invoiceLineItemMap.containsKey(rev.ECode__c))

        {
              rev.Revenue_Without_ST__c=invoiceLineItemMap.get(rev.ECode__c).Total__c;

        }

    }

}


I have also written one test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }
hi Friends in this trigger "Variable does not exist: list at line 53 column 9" error is showing.please help with this. and another thing if i want to fetch the date from createdBy field then what will be the syntax for SOQL & if i want to fetch picklist into a text field then what will be thye soql syntax.



trigger RevenueWithoutST on Revenue__c (after insert, before update) {
    List<SCSCHAMPS__Appointment__c> appList;
    List<Revenue__c> revlist;
    Revenue__c r= new Revenue__c();
    string eCode;
    date salaryDate;
    string category;
    string type;
    for(Revenue__c rev:Trigger.new)
    {
        eCode=rev.ECode__c;
        salaryDate=rev.Salary_Processed_Month__c;
        category=rev.InvoiceCategory__c;
        type=rev.Invoice_Type__c;
        
        if(eCode!=null)
        {
           appList =[select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,
                    Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c=: rev.ECode__c] ;
            
            for(SCSCHAMPS__Appointment__c app : appList)
            {
                r.Talent_Name__c= app.Name_of_the_Candidate__c;
                
            }
            
        }
        if(eCode!=null && category=='individual' && salaryDate!=null && type=='Time& Material' )
        {
            List<Invoice__c> InvList;
            Invoice__c inv= new Invoice__c();
            InvList=[select id,Name,Emp_Code__c,Invoice_Category__c,
                     Sub_Total__c from Invoice__c where Emp_Code__c=: rev.ECode__c
                       ];
                FOR(Invoice__c inc : InvList)
                {
                    r.Revenue_Without_ST__c=inc.Sub_Total__c;
                }
                
        }
        else if(eCode!=null && category=='consolidated')
        {
            List<Invoice_Line_Item__c> ILineList;
            Invoice_Line_Item__c iline=new Invoice_Line_Item__c();
            ILineList=[select id,Name,Employee_Code__c,Total__c
                       from Invoice_Line_Item__c where Employee_Code__c=:rev.ECode__c ];
            for(Invoice_Line_Item__c IL : ILineList)
            {
              r.Revenue_Without_ST__c=IL.Total__c;  
            }
        }
        
        list.add(rev);
        
        
    }
    update revlist;

}
hii friends please help me in this trigger i want to set relation between three objects (Appointment,Invoice & Revenue). Here  Invoice &  Appointment are in lookup and ID appointment Emp code =Invoice Empcode but i want to set Revenue objects Ecode= Empcode of Invoice.
hi guys,
I am trying to work on this trigger but unable to find the error. there are 2 objects invoice & revenue.if revenue object fields(salary=regular,salary processed=today & invoice type=time & material) and invoice object fields(categlory=individual, billing calendar=today & type= time& material) & both the objects ecode & emp codeare equal then RevenueWithoutST(REVENUE OBJECT) = subtotal(invoice object).

trigger subtotal on Revenue__c (after insert,before update ) {
    List<Revenue__c> Revenue__c = New List<Revenue__c>();
    Set<Id>ECode = New Set<Id>();
    For(Revenue__c Rev : Trigger.New)
     Revenue__c.ECode__c == Invoice__c.Emp_Code__c   
    }

    List<Revenue__c> RevList = [Select Id,Salary_Processed_month__c,Invoice_Type__c from Revenue__c where id =: ECode];
{Revenue__c r = new Revenue__c();
 Invoice__c inv =new Invoice__c();
        For(r.Salary_Type__c=='Regular'&&inv.Invoice_Category__c== 'Individual')
        
            If(inv.Billing_Calendar__c== system.today()&& inv.Type_of_Invoices__c=='Time & Material' && r.Salary_Processed_month__c==system.today()
               && r.Invoice_Type__c=='Time & Material')           
            {
                r.Revenue_without_ST__c =inv.Sub_Total__c;
            }
             else
            {
                r.Revenue_without_ST__c =11;
            }
 
                
          
Update RevList;
              
            }
           
        
    

           
    


 
hi frnds here i have written one class whats is the test class for this apexclass

public class divisionWiseGradeReport {

 public Map<String,Division__c > selectDivision;
 public String selDivision {set;get;}
 public Map<String,SubDivision__c> selectsubDivision;
 public String selsubDivision {set;get;}
 public Date fromDate{set;get;}
 public Date toDate{set;get;}

 
 public divisionWiseGradeReport(){
  selectDivision = Division__c.getAll();
  selectsubDivision = SubDivision__c.getAll();
 }

 public List<SelectOption> getDivision(){
     List<SelectOption> Division= new List<SelectOption>();
     for(Division__c d : selectDivision.values()){
      Division.add(new SelectOption(d.Name,d.Name));   
     }
    
     return Division;
    }
  public List<SelectOption> getsubDivision(){
     List<SelectOption> subDivision= new List<SelectOption>();
     for(SubDivision__c sd : selectsubDivision.values()){
      subDivision.add(new SelectOption(sd.Name,sd.Name));   
     }
    
     return subDivision;
    }
 public PageReference gradeReport(){
 
 PageReference ref;
 ref = Page.gradeResults;
 ref.getParameters().put('selDivision ',String.valueOf(selDivision));
 ref.getParameters().put('selsubDivision',String.valueOf(selsubDivision));
 ref.getParameters().put('fromDate',String.valueOf(fromDate));
 ref.getParameters().put('toDate',string.valueOf(toDate));
 System.debug('+++'+selDivision +selsubDivision);
 return ref;
 
 }
}
 here  divison field and sub division field are picklist where division picklist values are btechand BE, and sub division values are Mtech and Btech
i have created one vf page freelance login credential(username,Password) to valid username & password i have created a record named freelance. to valid login credential if any one login in the vf page then he/her username and password should match to the freelance username & password. if sucessfully login then it automatic links to a new vf page. i have written this code but showing error                                                                 public class ValidUI {
    public String UserName {get; set;}
    public String Password {get; set;}
    public Freelancer__c fre{get; set;}
    public PageReference login(){
    if(UserName!=null && Password!=null )
    {
        fre= [select User_Name__c,Password__c from Freelancer__c ]
        if(UserName==fre.User_Name__c && Password==fre.Password__c)
        {
          pagereference ref = new pagereference('https://c.ap1.visual.force.com/apex/ApplicationForm');
               ref.setredirect(true);
        }
         else{
    
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'TRY AGAIN... .'));
        return null ;

     
    }
        
    
    }
}
Hii friends, how do I add 6 months to a date field in a formula? There are two  Date fields date of joining(DOJ_c) and  a formulafield  (Conformation_Date_c) ,if i put any date in date of joining (DOJ_c) field then in the conformation date =(date of joining + 6 month). kindly provide the formula for  conformation Date?? For the above question i have wrote the below formula=

DATE( IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c)) ,
IF( MONTH(DOJ__c)+6 > 12, (MONTH(DOJ__c)+6)-12, MONTH(DOJ__c)+6) ,
IF(OR(DAY(DOJ__c) = 31,DAY(DOJ__c) = 29,DAY(DOJ__c) = 28),
CASE(IF( MONTH(DOJ__c)+6 > 12, (MONTH(DOJ__c)+6)-12, MONTH(DOJ__c)+6), 1, 31,

2, IF(OR(MOD(IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c )),400)=0,AND(MOD(IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c )),4)=0,MOD(IF(MONTH(DOJ__c )>6, YEAR(DOJ__c ) + 1 , YEAR(DOJ__c )),100)<>0)),
29, 28),
3,31,4,30,5,31,6,31,7,30,8,31,9,30,10,31,11,30,12,31,0)
, DAY(DOJ__c)) )


The  Formula code is working but when i am trying  the date like 28,29,31 December its showing error plz suggest
i have wrote this formula but it added 1 year to conformation date field so plz suggest
DATE(
year( DOJ__c )
+ floor((month(DOJ__c) + 6)/12) + if(and(month(DOJ__c)=12,6>=12),-1,0)
,
if( mod( month(DOJ__c) + 6, 12 ) = 0, 12 , mod( month(DOJ__c) + 6, 12 ))
,
min(
day(DOJ__c),
case(
max( mod( month(DOJ__c) + 6, 12 ) , 1),
9,30,
4,30,
6,30,
11,30,
2,if(mod((year(DOJ__c)
+ floor((month(DOJ__c) + 6)/12) + if(and(month(DOJ__c)=12,6>=12),-1,0)),4)=0,29,28),
31
)
)
)
hii everyone, how do I add 6 months to a date field in a formula? There are two  Date fields date of joining(DOJ_c) and  a formulafield  (Conformation_Date_c) ,if i put any date in date of joining (DOJ_c) field then in the conformation date =(date of joining + 6 month). kindly provide the formula for  conformation Date.
 
hii friends please suggest me  test class for this  below. i have also written one test class but showing error
Trigger RevenueWithoutST on Revenue__c (before insert,Before Update) {

    List<SCSCHAMPS__Appointment__c> appList;
    List<Revenue__c> revlist = new List<Revenue__c>();
    string eCode;
    date salaryDate;
    string category;
    string type;
    Integer month;
    Integer year;
    
    for(Revenue__c rev:Trigger.new)
    {
        eCode=rev.ECode__c;
        salaryDate=rev.Salary_Processed_Month__c;
        month=rev.Salary_Processed_Month__c.month();
        year=rev.Salary_Processed_Month__c.year();
        category=rev.InvoiceCategory__c;
        type=rev.Invoice_Type__c;      
        if(eCode!=null)
        {
           appList =[select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c=: ecode] ;
            
            for(SCSCHAMPS__Appointment__c app : appList)
            {
               rev.Talent_Name__c= app.Name_of_the_Candidate__c;
               rev.Client_Name__c=app.Client_Name__c;
               rev.DOJ__c=app.Date_of_Onboarding__c;
               rev.Last_Working_Date__c=app.Last_Working_Date__c;
               rev.Location__c=app.Location__c;
            }
        }

        if((eCode!=null) && (category=='individual') &&(salaryDate!=NULL) )
        {
            List<Invoice__c> InvList;                                                                              
            InvList=[select id,Name,Emp_Code__c,Invoice_Category__c,Sub_Total__c,Invoice_Date__c from Invoice__c where Emp_Code__c=: ecode
                    AND CALENDAR_MONTH(Invoice_Date__c)=:month AND CALENDAR_YEAR(Invoice_Date__c)=:year ];
              System.debug('+++invoice'+InvList);
              
              
                FOR(Invoice__c inc : InvList)
                {
                  
                  rev.Revenue_Without_ST__c=inc.Sub_Total__c;
                }

        }

        else if(eCode!=null && category=='consolidated')
        {

            List<Invoice_Line_Item__c> ILineList;
         // Invoice_Line_Item__c iline=new Invoice_Line_Item__c();
            ILineList=[select id,Name,Employee_Code__c,Total__c,Invoice_Date__c from Invoice_Line_Item__c where Employee_Code__c=:ecode
                        AND CALENDAR_MONTH(Invoice_Date__c)=:month AND CALENDAR_YEAR(Invoice_Date__c)=:year ];
            for(Invoice_Line_Item__c IL : ILineList)
            {
              rev.Revenue_Without_ST__c=IL.Total__c;
            }
        }
           
    }
 
    }
Here is my  test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }

Here is my  test class but showing error and not executing properly
@isTest
public class testRevenue {
        static testMethod void testMethod1()  {
 InvoiceCategory__c InvC = newInvoiceCategory__c(name = 'Test1');    
                  insert InvC;                      
Invoice_Type__c InvT = new Invoice_Type__c(name = 'Test2');                   
  insert  InvT;
Salary_Type__c SalT = new ISalary_Type__c(name = 'Test2');                   
  insert  SalT
       
            Test.StartTest();               
                Revenue__c rev= new Revenue__c();
                rev.ECode__c='Test0';
                InvoiceCategory__c invC = new InvoiceCategory__c
                List<SelectOption> listInvCt = rev.InvoiceCategory__c();
                List<SelectOption> listInvTy = rev.Invoice_Type__c();
                List<SelectOption> listSalTy = rev.Salary_Type__c();
                rev.SelInvoiceCategory__c ='Test1';
                rev.SelInvoice_Type__c ='Test2';
                rev.SelSalary_Type__c ='Test3';
                rev.Salary_Processed_Month__c=system.today();
Test.StopTest();
        }
    }
 
hi Friends in this trigger "Variable does not exist: list at line 53 column 9" error is showing.please help with this. and another thing if i want to fetch the date from createdBy field then what will be the syntax for SOQL & if i want to fetch picklist into a text field then what will be thye soql syntax.



trigger RevenueWithoutST on Revenue__c (after insert, before update) {
    List<SCSCHAMPS__Appointment__c> appList;
    List<Revenue__c> revlist;
    Revenue__c r= new Revenue__c();
    string eCode;
    date salaryDate;
    string category;
    string type;
    for(Revenue__c rev:Trigger.new)
    {
        eCode=rev.ECode__c;
        salaryDate=rev.Salary_Processed_Month__c;
        category=rev.InvoiceCategory__c;
        type=rev.Invoice_Type__c;
        
        if(eCode!=null)
        {
           appList =[select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,
                    Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c=: rev.ECode__c] ;
            
            for(SCSCHAMPS__Appointment__c app : appList)
            {
                r.Talent_Name__c= app.Name_of_the_Candidate__c;
                
            }
            
        }
        if(eCode!=null && category=='individual' && salaryDate!=null && type=='Time& Material' )
        {
            List<Invoice__c> InvList;
            Invoice__c inv= new Invoice__c();
            InvList=[select id,Name,Emp_Code__c,Invoice_Category__c,
                     Sub_Total__c from Invoice__c where Emp_Code__c=: rev.ECode__c
                       ];
                FOR(Invoice__c inc : InvList)
                {
                    r.Revenue_Without_ST__c=inc.Sub_Total__c;
                }
                
        }
        else if(eCode!=null && category=='consolidated')
        {
            List<Invoice_Line_Item__c> ILineList;
            Invoice_Line_Item__c iline=new Invoice_Line_Item__c();
            ILineList=[select id,Name,Employee_Code__c,Total__c
                       from Invoice_Line_Item__c where Employee_Code__c=:rev.ECode__c ];
            for(Invoice_Line_Item__c IL : ILineList)
            {
              r.Revenue_Without_ST__c=IL.Total__c;  
            }
        }
        
        list.add(rev);
        
        
    }
    update revlist;

}
here is the vf page code :
    <apex:page controller="importDataFromCSVController" >
    <apex:form >
        <apex:pagemessages />
        <apex:pageBlock >
            <apex:pageBlockSection columns="48" > 
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}"/>
                  <apex:commandButton value="Import Timesheet" action="{!importCSVFile}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock >
           <apex:pageblocktable value="{!applist}" var="app">
              <apex:column value="{!app.Avvas_id__c}" />
              <apex:column value="{!app.Total_Number_of_Hours_worked__c}" />
              <apex:column value="{!app.Total_Cleint_Holidays__c}" />
              <apex:column value="{!app.Total_Number_of_Days_worked__c}" />
              <apex:column value="{!app.Total_billable_days__c }" />
       
        </apex:pageblocktable>
     </apex:pageBlock>
   </apex:form>
</apex:page>

controller:

public class importDataFromCSVController {
public Blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvFileLines{get;set;}

public List<appointment__c> applist{get;set;}
  public importDataFromCSVController(){
    csvFileLines = new String[]{};
    applist = New List<appointment__c>(); 
  }
  
  public void importCSVFile(){
       try{
           csvAsString = csvFileBody.toString();
           csvFileLines = csvAsString.split('\n'); 
            
           for(Integer i=1;i<csvFileLines.size();i++){
               appointment__c appObj = new appointment__c () ;
               string[] csvRecordData = csvFileLines[i].split(',');
               appObj.Avvas_id__c = csvRecordData[0] ;             
               appObj.Total_Number_of_Hours_worked__c = Decimal.Valueof(csvRecordData[1]);
               appObj.Total_Cleint_Holidays__c = Decimal.Valueof(csvRecordData[2]);
               appObj.Total_Number_of_Days_worked__c = Decimal.Valueof(csvRecordData[3]);                                                                            
               applist.add(appObj);   
           }
        //insert acclist;
        }
        catch (Exception e)
        {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importin data Please make sure input csv file is correct');
            ApexPages.addMessage(errorMessage);
        }  
  }
}
   
User-added image


In this csv file i want to capture specific data like  ID =A-006,
Total_Number_of_Hours_worked= 60
Total_Cleint_Holidays= 1
Total_Number_of_Days_worked= 18
here when i will give any jobid which is available in interview object then after pressing the enter button 1 new page(Feedback_JobID) will open and if the jobid is not available inside the interview object then 1 error message will come. But whenever i am trying to do that here for every value it is showing the error message.The flow is not going to if loop i think. Can anybody give me the idea what is wrong here..
VF Page:
<apex:page controller="Client_Feedback" showHeader="false" sidebar="false" standardStylesheets="true">
<apex:Pagemessages id="msg"/>
<apex:form >
<CENTER><apex:image url="{!$Resource.LOGO}" width="200" height="130"/></CENTER>
<CENTER><p><b>Client Login Page</b><br /></p></CENTER>
<CENTER>
<apex:panelGrid columns="3" style="margin-top:1em;">
<p><b>JOB ID:</b><br />
<apex:inputText required="true" id="ID" value="{!var}"/>

<apex:commandButton action="{!search}" value="enter" id="enter"/>
  </p> 
</apex:panelGrid>
</CENTER>
</apex:form>
</apex:page>
 
CONTROLLER:
public class Client_Feedback {        
        public String ID {get;set;}
        public string var{set;get;}
        public List < SCSCHAMPS__Interview__c > intList {get;set;}
        //public Freelancer__c fre {get;set;}
        public PageReference search()
         {
            {
                
                //this.intList.clear();
                List<SCSCHAMPS__Interview__c> intList = [SELECT id,SCSCHAMPS__Job__c
                                                     FROM SCSCHAMPS__Interview__c 
                                                     WHERE SCSCHAMPS__Job__c= :ID  limit 1 ]; 
                 pageReference ref;                                    
                 if(!intList.isEmpty()) 
                 { 
                     
                     ref= page.Feedback_JobID;
                    ref.setRedirect(true);
                    return ref;
                  
                 }
                 else {
                   ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'TRY AGAIN... .')); 
                    
                }
                return null;
                 
                 }                                               
            }
        }

 
hi Friends in this trigger "Variable does not exist: list at line 53 column 9" error is showing.please help with this. and another thing if i want to fetch the date from createdBy field then what will be the syntax for SOQL & if i want to fetch picklist into a text field then what will be thye soql syntax.



trigger RevenueWithoutST on Revenue__c (after insert, before update) {
    List<SCSCHAMPS__Appointment__c> appList;
    List<Revenue__c> revlist;
    Revenue__c r= new Revenue__c();
    string eCode;
    date salaryDate;
    string category;
    string type;
    for(Revenue__c rev:Trigger.new)
    {
        eCode=rev.ECode__c;
        salaryDate=rev.Salary_Processed_Month__c;
        category=rev.InvoiceCategory__c;
        type=rev.Invoice_Type__c;
        
        if(eCode!=null)
        {
           appList =[select AvvasECode__c,Name_of_the_Candidate__c,Client_Name__c,Date_of_Onboarding__c,
                    Last_Working_Date__c,Location__c from SCSCHAMPS__Appointment__c where AvvasECode__c=: rev.ECode__c] ;
            
            for(SCSCHAMPS__Appointment__c app : appList)
            {
                r.Talent_Name__c= app.Name_of_the_Candidate__c;
                
            }
            
        }
        if(eCode!=null && category=='individual' && salaryDate!=null && type=='Time& Material' )
        {
            List<Invoice__c> InvList;
            Invoice__c inv= new Invoice__c();
            InvList=[select id,Name,Emp_Code__c,Invoice_Category__c,
                     Sub_Total__c from Invoice__c where Emp_Code__c=: rev.ECode__c
                       ];
                FOR(Invoice__c inc : InvList)
                {
                    r.Revenue_Without_ST__c=inc.Sub_Total__c;
                }
                
        }
        else if(eCode!=null && category=='consolidated')
        {
            List<Invoice_Line_Item__c> ILineList;
            Invoice_Line_Item__c iline=new Invoice_Line_Item__c();
            ILineList=[select id,Name,Employee_Code__c,Total__c
                       from Invoice_Line_Item__c where Employee_Code__c=:rev.ECode__c ];
            for(Invoice_Line_Item__c IL : ILineList)
            {
              r.Revenue_Without_ST__c=IL.Total__c;  
            }
        }
        
        list.add(rev);
        
        
    }
    update revlist;

}
hi guys,
I am trying to work on this trigger but unable to find the error. there are 2 objects invoice & revenue.if revenue object fields(salary=regular,salary processed=today & invoice type=time & material) and invoice object fields(categlory=individual, billing calendar=today & type= time& material) & both the objects ecode & emp codeare equal then RevenueWithoutST(REVENUE OBJECT) = subtotal(invoice object).

trigger subtotal on Revenue__c (after insert,before update ) {
    List<Revenue__c> Revenue__c = New List<Revenue__c>();
    Set<Id>ECode = New Set<Id>();
    For(Revenue__c Rev : Trigger.New)
     Revenue__c.ECode__c == Invoice__c.Emp_Code__c   
    }

    List<Revenue__c> RevList = [Select Id,Salary_Processed_month__c,Invoice_Type__c from Revenue__c where id =: ECode];
{Revenue__c r = new Revenue__c();
 Invoice__c inv =new Invoice__c();
        For(r.Salary_Type__c=='Regular'&&inv.Invoice_Category__c== 'Individual')
        
            If(inv.Billing_Calendar__c== system.today()&& inv.Type_of_Invoices__c=='Time & Material' && r.Salary_Processed_month__c==system.today()
               && r.Invoice_Type__c=='Time & Material')           
            {
                r.Revenue_without_ST__c =inv.Sub_Total__c;
            }
             else
            {
                r.Revenue_without_ST__c =11;
            }
 
                
          
Update RevList;
              
            }
           
        
    

           
    


 
hi frnds here i have written one class whats is the test class for this apexclass

public class divisionWiseGradeReport {

 public Map<String,Division__c > selectDivision;
 public String selDivision {set;get;}
 public Map<String,SubDivision__c> selectsubDivision;
 public String selsubDivision {set;get;}
 public Date fromDate{set;get;}
 public Date toDate{set;get;}

 
 public divisionWiseGradeReport(){
  selectDivision = Division__c.getAll();
  selectsubDivision = SubDivision__c.getAll();
 }

 public List<SelectOption> getDivision(){
     List<SelectOption> Division= new List<SelectOption>();
     for(Division__c d : selectDivision.values()){
      Division.add(new SelectOption(d.Name,d.Name));   
     }
    
     return Division;
    }
  public List<SelectOption> getsubDivision(){
     List<SelectOption> subDivision= new List<SelectOption>();
     for(SubDivision__c sd : selectsubDivision.values()){
      subDivision.add(new SelectOption(sd.Name,sd.Name));   
     }
    
     return subDivision;
    }
 public PageReference gradeReport(){
 
 PageReference ref;
 ref = Page.gradeResults;
 ref.getParameters().put('selDivision ',String.valueOf(selDivision));
 ref.getParameters().put('selsubDivision',String.valueOf(selsubDivision));
 ref.getParameters().put('fromDate',String.valueOf(fromDate));
 ref.getParameters().put('toDate',string.valueOf(toDate));
 System.debug('+++'+selDivision +selsubDivision);
 return ref;
 
 }
}
 here  divison field and sub division field are picklist where division picklist values are btechand BE, and sub division values are Mtech and Btech
i have wrote this formula but it added 1 year to conformation date field so plz suggest
DATE(
year( DOJ__c )
+ floor((month(DOJ__c) + 6)/12) + if(and(month(DOJ__c)=12,6>=12),-1,0)
,
if( mod( month(DOJ__c) + 6, 12 ) = 0, 12 , mod( month(DOJ__c) + 6, 12 ))
,
min(
day(DOJ__c),
case(
max( mod( month(DOJ__c) + 6, 12 ) , 1),
9,30,
4,30,
6,30,
11,30,
2,if(mod((year(DOJ__c)
+ floor((month(DOJ__c) + 6)/12) + if(and(month(DOJ__c)=12,6>=12),-1,0)),4)=0,29,28),
31
)
)
)
hii everyone, how do I add 6 months to a date field in a formula? There are two  Date fields date of joining(DOJ_c) and  a formulafield  (Conformation_Date_c) ,if i put any date in date of joining (DOJ_c) field then in the conformation date =(date of joining + 6 month). kindly provide the formula for  conformation Date.
 
trigger CTC_Update on Appraisal__c (after insert,before update ) {     List<appointment__c> AppList = New List<appointment__c>();     Set<Id> AppointIds = New Set<Id>();     For(Appraisal__c A : Trigger.New)     {         AppointIds.Add(A.ApplicantName__c);     }     List<appointment__c> AppointList = [Select Id,Current_CTC__c from appointment__c where id =: AppointIds];     For(Appraisal__c Aps : Trigger.New)     {         appointment__c A = new appointment__c();         For(appointment__c App : AppointList)         {             IF(Aps.ApplicantName__c == App.ID)             {                 A.Id = App.Id;                 IF(Aps.amount_of_Increment__c != 0 && Aps.amount_of_Increment__c != NULL)                 {                     A.Current_CTC__c = App.Current_CTC__c + Aps.amount_of_Increment__c ;                 }                 IF(Aps.Increment_Percentage__c != 0 && Aps.Increment_Percentage__c != NULL)                 {                     A.Current_CTC__c = App.Current_CTC__c + (App.Current_CTC__c * Aps.Increment_Percentage__c/100);                 }             }             AppList.Add(A);         }     }     IF(AppList != NULL)     {         Update AppList;     } }
trigger ctcupdate on appointment__c (after insert,after update) {
     appointment__c app;
         Appraisal__c aps;   
    if (aps.amount_of_Increment__c !=0 ||aps.amount_of_Increment__c  !=null){
    app.Current_CTC__c=app.Current_CTC__c +  aps.amount_of_Increment__c ;
        update app;
    }
     if (aps.Increment_Percentage__c !=0 ||aps.Increment_Percentage__c  !=null){  
      app.Current_CTC__c= app.Current_CTC__c + (app.Current_CTC__c * aps.Increment_Percentage__c);
          update app ;
              }
}