• Asma Erum
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies

I have the following SOQL query: 

Select Id, IsDeleted, MasterRecordId, Name, LastName, FirstName, Salutation, Type, RecordTypeId, ParentId, 

FROM Account 
LIMIT 10

 

The parentId references the Account Entity as well as we have 3 types of Account. I need to get the Name of the Parent Account. I'm not sure how to retreive this value. 

I am trying to write a custom report using Apex and visual force that would list all the opportunities and their monthly revenue based on the Opportunity's Start Date, End Date and Total Revenue, and Business_Days (all 3 are custom fields). 

Esentially I would need to calcualte the Buisness Days (excluding weekends) between the start and end date and then divide total revenue by this to get the per day revenue. 

Can anyone guide me as to how this can be done via Apex class. I'm fairly new to using Apex. An extrmely small sample code would help. 

Here is what I have so far, but I don't know if I'm on the write direction: 

public class revenueAggregationByMonth {
    
    public static void GettOpps(Date StartDate, Date EndDate){
  
    List<Opportunity> allopps = [SELECT Account.Name, Name, Business_Days__c, Start_Date__c, End_Date__c, Estimated_Production_Revenue_Won__c
                FROM Opportunity
                WHERE Start_Date__c >= StartDate AND End_Date__c <= EndDate];
     
        for(Opportunity o: allopps)
        {
            decimal Revenue_Per_Day = 0.00;
            if (o.Estimated_Production_Revenue_Won__c > 0 && o.Business_Days__c > 0)
            {
                Revenue_Per_Day = o.Estimated_Production_Revenue_Won__c/o.Business_Days__c;
                System.debug('Account Name: '+ o.Account.Name + ' Opporunity Name: '+ o.Name + 'Revenue Per Day: '+ Revenue_per_Day);
            }
        }
    }
}

I currently only have a standard developer edition for sanbox and not the developer pro. I would like to refresh the sandbox and import the data from production for testing purposes. What is the best way to do this? Should I use Talend? create the mapping and the rules. Can I potentially use the weekly scheduled and the current job I create and change the mapping to naother file later on and the file/folder with the cvs of Salesforce objects backup will be updated weekly? Or should I use Data loader ot do this? I know validations need to be turned off, is there a way this can be done without turning the validations off (perhaps through talend). 
I currently only have a standard developer edition for sanbox and not the developer pro. I would like to refresh the sandbox and import the data from production for testing purposes. What is the best way to do this? Should I use Talend? create the mapping and the rules. Can I potentially use the weekly scheduled and the current job I create and change the mapping to naother file later on and the file/folder with the cvs of Salesforce objects backup will be updated weekly? Or should I use Data loader ot do this? I know validations need to be turned off, is there a way this can be done without turning the validations off (perhaps through talend). 

I have the following SOQL query: 

Select Id, IsDeleted, MasterRecordId, Name, LastName, FirstName, Salutation, Type, RecordTypeId, ParentId, 

FROM Account 
LIMIT 10

 

The parentId references the Account Entity as well as we have 3 types of Account. I need to get the Name of the Parent Account. I'm not sure how to retreive this value. 

I currently only have a standard developer edition for sanbox and not the developer pro. I would like to refresh the sandbox and import the data from production for testing purposes. What is the best way to do this? Should I use Talend? create the mapping and the rules. Can I potentially use the weekly scheduled and the current job I create and change the mapping to naother file later on and the file/folder with the cvs of Salesforce objects backup will be updated weekly? Or should I use Data loader ot do this? I know validations need to be turned off, is there a way this can be done without turning the validations off (perhaps through talend). 

Greetings All,

 

Long time user, first time post. Looking for some help with customization of revenue schedule formulas… The default divides the $ by # of months. I need the actual monthly amount - even if there's only 1 day remaining in the month an ad starts.

 

Scenario: Advertising Sales co. – Opptys/products to display the amount of revenue, by month, for the Ad term. In other words: actual “ad run” $ amount, per month. Also, the number of days/months an ad will run vary. Can be 1-day to 26-months...

 

Here is a simple example:

  • Amount Closed $12,000.00
  • Ad start date 8/15/2010
  • Ad end date 10/20/2010
  • Total of 65 days @ 184.62 per day

# of days the ad will run in each month is:

• 16 days, first month (8/15/2010 -8/31/2010). 16*184.62= What I need displayed is: 2,953.85 August.

• 30 days, second month (9/1/2010-9/30/2010)30*184.62= "    "  5,538.46 September.

• 19 days, third month (10/1/2010-10/20/2010). 19*184.62= "    " 3,507.78 October.

 

ANY help is greatly appreciated! I’ve spent countless hours on the discussion boards and developer pages looking for this solution... no luck (found similar postings; not resolved).  

 

Thank you!

Karen