• Mikey Boosh
  • NEWBIE
  • 20 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 4
    Replies
Hi there,

I need some help writing a test class for the following wrapper class.

Any thoughts? Thanks!
 
public class CustomerStatementTableEmailController {

    public Id recId {get;set;}
    
    public List<Delivery_Note__c> notes {
        get {
            RETURN recId != NULL ? [
            SELECT id,name,Balance__c,Transaction_Amount__c,Transaction_Date__c,Transaction_Number__c,Transaction_Type__c,
                Transaction_Balance__c,ABM_Invoice_Amount__c,ABM_Credit_Note_Amount__c,zTransactionBalanceForStatement__c
            FROM Delivery_Note__c
            WHERE order__r.AccountId = :recId
            AND (Transaction_Balance__c != 0.00 OR Transaction_Date__c = LAST_MONTH)
            ] : new List<Delivery_Note__c>();
        } 
        private set;
    }
    
    public List<Remittance_Advice__c> remittances {
        get {
            RETURN recId != NULL ? [
            SELECT id,Name,Account__r.id,Date__c,Remittance_Total_Credit__c,Remittance_Total_Debit__c
            FROM Remittance_Advice__c
            WHERE Account__r.id = :recId
            AND Date__c = LAST_MONTH
            ] : new List<Remittance_Advice__c>();
        } 
        private set;
    }
    
    public list<Delivery_Note__c> notDue {
        get {
            RETURN recId != NULL ? [
                SELECT id,Invoice_Total_Amount_Including_GST__c,Balance__c,recordType.Name,Transaction_Balance__c FROM Delivery_Note__c
                WHERE zAgeTrialBalance__c = 'Current'
                AND recordType.Name = 'Delivery Note / Invoice'
                AND order__r.Accountid = :recId] : new List<Delivery_Note__c>();
        }
        set;
    }
    
    public list<Delivery_Note__c> notDueC {
        get {
            RETURN recId != NULL ? [
                SELECT id,Credit_Note_Total_Including_GST__c,Balance__c,Transaction_Balance__c FROM Delivery_Note__c
                WHERE zAgeTrialBalanceCredit__c = 'Current'
                AND recordType.Name = 'Credit Note'
                AND order__r.Accountid = :recId] : new List<Delivery_Note__c>();
        }
        set;
    }
    

    public Wrapper[] wrappers {
        get{
            wrappers = new List<Wrapper>(); 
            for (Delivery_Note__c note: notes){
                wrappers.add(new Wrapper(note));
            }
            for (Remittance_Advice__c remittance: remittances){
                wrappers.add(new Wrapper(remittance));
            }
            wrappers.sort();
            return wrappers;
        } 
        private set;
    }


    
    public class Wrapper implements Comparable {
    
        public Delivery_Note__c note {get; private set;}
        public Remittance_Advice__c remittance {get; private set;}
        public String dataType {get;private set;}
        public Date calculatedDate {get;private set;}
        public String calculatedNumber {get;private set;}
        public String calculatedType {get;private set;}
        public Decimal calculatedAmount {get;private set;}
        public Decimal calculatedPaid {get;private set;}
        public Decimal calculatedBalance {get;private set;}
        public Id calculatedId {get;private set;}
        
        public Wrapper(Delivery_Note__c n) {
            note = n;
            dataType = 'note';
            calculatedDate = note.Transaction_Date__c;
            calculatedNumber = note.Transaction_Number__c;
            calculatedAmount = note.Transaction_Amount__c;
            calculatedPaid = 0.00;
            calculatedBalance = note.zTransactionBalanceForStatement__c;
            calculatedType = note.Transaction_Type__c;
            calculatedId = note.id;
        }

        public Wrapper(Remittance_Advice__c r) {
            remittance = r;
            dataType = 'remittance';
            calculatedDate = remittance.Date__c;
            calculatedNumber = remittance.name;
            calculatedAmount = remittance.Remittance_Total_Credit__c;
            calculatedPaid = remittance.Remittance_Total_Credit__c;
            calculatedBalance = 0.00;
            calculatedType = 'Receipt';
            calculatedId = remittance.id;
        }
        
        public Integer compareTo(Object instance){
            Wrapper that = (Wrapper)instance;
            if (this.calculatedDate > that.calculatedDate) return 1;
            if (this.calculatedDate < that.calculatedDate) return -1;
            return 0;
        }
    }
}

 
Hi there

A common issue with Survey Force...

I have created a survey, posted it's link to a public user, and when the "Submit Survey" button is pressed it takes you to the standard "Unauthorized" Visualforce Page.

I have setup the package as per instructions (and triple checked).

For the Public User settings:
  • My Acounts and Contacts have read access
  • The Survey Objects (4) have the correct Access
  • The Visualforce pages are present
  • The Apex Classes are present
The sharing rules for Accounts and Contacts are Public.

I dont know what else to check...any thoughts?

Thanks

Mike

Hi there

I have two different knowledge base sites setup, one with access to all article types, the other limited to just a few.

They both have the same access to the article record types, however i thought the security also ran through data/article category group settings.

Does anyone have any ideas where to refine what the lmited user can access?

Many thanks

Mike

Hello Community...

 

I have 2 users, both using the Outlook to Salesforce plugin. Both users recieve the same email in Outlook

 

Person A attaches an email to salesforce, and can see that email against a contact in the right hand (SF) pane in Outlook.

 

Person B's Salesforce pane in Outlook does not indicate the common email has been attached to the contact, and attaches the email as well.

 

The result is a duplicate email in Salesforce.

 

My question is, can the Salesforce pane in Outlook be updated to indicate an email has been attached? (albeit by someone else).

 

 

Many thanks!

 

Mike

 

 

I have inside my "Account"object a rich text field to store images. When I tried to set size to the image I'm not able to do that. But if I add text content within it the styling is working perfectly with my text content. Only my image is not responding to the style given for it. I have given my code below.Can anyone figure out what's wrong with the code?

     <html> 
     <head> 
     <style type="text/css"> 
     myDiv 
     { 
      border:0px; 
      height:50px; 
      width:10px; 
     } 
     </style> 
     </head> 
     <body> 
     <div id="myDiv">Picture {!Picture__c}</div> 
     </body>
     </html>

Thanks
Aruna Vasahan
 
Hi there

A common issue with Survey Force...

I have created a survey, posted it's link to a public user, and when the "Submit Survey" button is pressed it takes you to the standard "Unauthorized" Visualforce Page.

I have setup the package as per instructions (and triple checked).

For the Public User settings:
  • My Acounts and Contacts have read access
  • The Survey Objects (4) have the correct Access
  • The Visualforce pages are present
  • The Apex Classes are present
The sharing rules for Accounts and Contacts are Public.

I dont know what else to check...any thoughts?

Thanks

Mike

Hi there

I have two different knowledge base sites setup, one with access to all article types, the other limited to just a few.

They both have the same access to the article record types, however i thought the security also ran through data/article category group settings.

Does anyone have any ideas where to refine what the lmited user can access?

Many thanks

Mike

Hello Community...

 

I have 2 users, both using the Outlook to Salesforce plugin. Both users recieve the same email in Outlook

 

Person A attaches an email to salesforce, and can see that email against a contact in the right hand (SF) pane in Outlook.

 

Person B's Salesforce pane in Outlook does not indicate the common email has been attached to the contact, and attaches the email as well.

 

The result is a duplicate email in Salesforce.

 

My question is, can the Salesforce pane in Outlook be updated to indicate an email has been attached? (albeit by someone else).

 

 

Many thanks!

 

Mike