• Christopher Gosline
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies
Hello,

I am curious if there is a way to make report charts dependent on the specific object they exist on. I know you can filter charts, and even have them automatically filter by the layout's object ID they are dragged into, however my ask is a bit different. I would like to create a chart that changes with the object it is on.

For example:

Customer A has various sales revenue for each month of the year
Customer B has various sales revenue for each month of the year

I want to make one report/chart that can be dragged into the Customer object's layout that changes as you look into each record. So when one is viewing Customer A they see Customer A's sales data on a bar chart. Then when one is viewing Custome B they see Customer B's sales data isntead. I do not want to have to create a new report for every customer onboarded, this seems redundant and time consuming. 

Is this possible? Could Visual Force Charting be a solution? I'd rather not dive right into VisualForce as this is an immediate need. If anyone can come up with an answer it would be greatly appreciated.
Hello,

I am curious if there is a way to make report charts dependent on the specific object they exist on. I know you can filter charts, and even have them automatically filter by the layout's object ID they are dragged into, however my ask is a bit different. I would like to create a chart that changes with the object it is on.

For example:

Customer A has various sales revenue for each month of the year
Customer B has various sales revenue for each month of the year

I want to make one report/chart that can be dragged into the Customer object's layout that changes as you look into each record. So when one is viewing Customer A they see Customer A's sales data on a bar chart. Then when one is viewing Custome B they see Customer B's sales data isntead. I do not want to have to create a new report for every customer onboarded, this seems redundant and time consuming. 

Is this possible? Could Visual Force Charting be a solution? I'd rather not dive right into VisualForce as this is an immediate need. If anyone can come up with an answer it would be greatly appreciated.

 
Hi all,

I am currently struggling to develop a test class that will provide enough coverage to enable my VisualForce page and Controller to deploy to production.

The VisualForce page has 15 textual inputs , which then upon clicking the commandbutton runs the "month" inputs throught the "calculator" controller to multiply each month's input by specific fieldswithin a separate customer object - "Utilty NMC Tariffs". Then returns the summation of these products as a result displayed at the bottom of the page.

Visual Force Page:
 
<apex:page controller="Calculator">
<apex:form >

<b>
<p>Enter the Current Month:</p>
<p><apex:inputText value="{!CurrentMonth}"/></p>

<p>Enter Utility*:</p>
<p><apex:inputText value="{!Utility}"/></p>

<p>Enter Project Class*:</p>
<p><apex:inputText value="{!Pclass}"/></p>


<p>Enter consumption per month in kWh:</p>
<p> Month 1  <apex:inputText value="{!Month1}"/></p>
<p> Month 2  <apex:inputText value="{!Month2}"/></p>
<p> Month 3  <apex:inputText value="{!Month3}"/></p>
<p> Month 4  <apex:inputText value="{!Month4}"/></p>
<p> Month 5  <apex:inputText value="{!Month5}"/></p>
<p> Month 6  <apex:inputText value="{!Month6}"/></p>
<p> Month 7  <apex:inputText value="{!Month7}"/></p>
<p> Month 8  <apex:inputText value="{!Month8}"/></p>
<p> Month 9  <apex:inputText value="{!Month9}"/></p>
<p> Month 10  <apex:inputText value="{!Month10}"/></p>
<p> Month 11  <apex:inputText value="{!Month11}"/></p>
<p> Month 12  <apex:inputText value="{!Month12}"/></p>
</b>

<apex:commandButton action="{!Calculation}" value="Show Result" styleClass="buttonStyle" style="background:LightBlue;width:150px;"/>

<p>The Estimated Total Annual Cost of Electricity is:</p>
<b><p> $ <apex:outputText value="{!result}"/></p></b> 

*If you need to change the Current Month, Utility, or Project Class Refresh Page then Change

</apex:form>
</apex:page>
Controller (Calculator):
public class Calculator{

public String Utility { get; set; }
public String Calculation { get; set; }
public string CurrentMonth{get;set;}
public double result{get;set;}
public string Pclass{get;set;}


public integer Month1{get;set;}
public integer Month2{get;set;}
public integer Month3{get;set;}
public integer Month4{get;set;}
public integer Month5{get;set;}
public integer Month6{get;set;}
public integer Month7{get;set;}
public integer Month8{get;set;}
public integer Month9{get;set;}
public integer Month10{get;set;}
public integer Month11{get;set;}
public integer Month12{get;set;}

list<decimal> NMClist1 = new list<decimal>();
list<decimal> NMClist2 = new list<decimal>();
list<decimal> NMClist3 = new list<decimal>();
list<decimal> NMClist4 = new list<decimal>();
list<decimal> NMClist5 = new list<decimal>();
list<decimal> NMClist6 = new list<decimal>();
list<decimal> NMClist7 = new list<decimal>();
list<decimal> NMClist8 = new list<decimal>();
list<decimal> NMClist9 = new list<decimal>();
list<decimal> NMClist10 = new list<decimal>();
list<decimal> NMClist11 = new list<decimal>();
list<decimal> NMClist12 = new list<decimal>();
list<decimal> NMClist13 = new list<decimal>();
list<decimal> NMClist14 = new list<decimal>();
list<decimal> NMClist15 = new list<decimal>();
list<decimal> NMClist16 = new list<decimal>();
list<decimal> NMClist17 = new list<decimal>();
list<decimal> NMClist18 = new list<decimal>();
list<decimal> NMClist19 = new list<decimal>();
list<decimal> NMClist20 = new list<decimal>();
list<decimal> NMClist21 = new list<decimal>();
list<decimal> NMClist22 = new list<decimal>();
list<decimal> NMClist23 = new list<decimal>();
list<decimal> NMClist24 = new list<decimal>();

public void calculation()
{

for(utility_nmc_tariff__c NMCquery : [ SELECT January_previous_year__c, january__c,February_previous_year__c,February__c, March_previous_year__c,March__c,April_previous_year__c,April__c,May_previous_year__c, May__c, june_previous_year__c, june__c, july_previous_year__c, july__c, august_previous_year__c, august__c, september_previous_year__c, september__c, october_previous_year__c, october__c, november_previous_year__c, november__c, december_previous_year__c, december__c FROM utility_nmc_tariff__c WHERE Utility__c = : Utility AND Class__c = : pclass ])
{
    NMClist1.add(NMCquery.January_previous_year__c);
    
    NMClist2.add(NMCquery.January__c);
    
    NMClist3.add(NMCquery.february_previous_year__c);
    
    NMClist4.add(NMCquery.february__c);
    
    NMClist5.add(NMCquery.march_previous_year__c);
    
    NMClist6.add(NMCquery.march__c);
    
    NMClist7.add(NMCquery.april_previous_year__c);
    
    NMClist8.add(NMCquery.april__c);
   
    NMClist9.add(NMCquery.may_previous_year__c);
    
    NMClist10.add(NMCquery.may__c);
    
    NMClist11.add(NMCquery.June_previous_year__c);
    
    NMClist12.add(NMCquery.June__c);
    
    NMClist13.add(NMCquery.July_previous_year__c);
    
    NMClist14.add(NMCquery.July__c);
    
    NMClist15.add(NMCquery.August_previous_year__c);
    
    NMClist16.add(NMCquery.August__c);
    
    NMClist17.add(NMCquery.September_previous_year__c);
    
    NMClist18.add(NMCquery.September__c);
    
    NMClist19.add(NMCquery.October_previous_year__c);
    
    NMClist20.add(NMCquery.October__c);
    
    NMClist21.add(NMCquery.November_previous_year__c);
    
    NMClist22.add(NMCquery.November__c);
    
    NMClist23.add(NMCquery.December_previous_year__c);
    
    NMClist24.add(NMCquery.December__c);
    
    }
    
 


decimal j1 = NMCList1.get(0);
decimal j2 = NMCList2.get(0);
decimal f1 = NMCList3.get(0);
decimal f2 = NMCList4.get(0);
decimal m1 = NMCList5.get(0);
decimal m2 = NMCList6.get(0);
decimal a1 = NMCList7.get(0);
decimal a2 = NMCList8.get(0);
decimal my1 = NMCList9.get(0);
decimal my2 = NMCList10.get(0);
decimal june1 = NMCList11.get(0);
decimal june2 = NMCList12.get(0);
decimal july1 = NMCList13.get(0);
decimal july2 = NMCList14.get(0);
decimal aug1 = NMCList15.get(0);
decimal aug2 = NMCList16.get(0);
decimal sep1 = NMCList17.get(0);
decimal sep2 = NMCList18.get(0);
decimal oct1 = NMCList19.get(0);
decimal oct2 = NMCList20.get(0);
decimal nov1 = NMCList21.get(0);
decimal nov2 = NMCList22.get(0);
decimal dec1 = NMCList23.get(0);
decimal dec2 = NMCList24.get(0);


if(CurrentMonth == 'January'){
result= 
month1 * j1 +
month2 * f1 +
month3 * m1 +
month4 * a1 +
month5 * my1 +
month6 * june1 +
month7 * july1 +
month8 * aug1 +
month9 * sep1 +
month10 * oct1 +
month11 * nov1 +
month12 * dec1;
}
if(CurrentMonth == 'February'){
result= 
month1 * f1 +
month2 * m1 +
month3 * a1 +
month4 * my1 +
month5 * june1 +
month6 * july1 +
month7 * aug1 +
month8 * sep1 +
month9 * oct1 +
month10 * nov1 +
month11 * dec1 +
month12 * j2;
}
if(CurrentMonth == 'March'){
result= 
month1 * m1 +
month2 * a1 +
month3 * my1 +
month4 * june1 +
month5 * july1 +
month6 * aug1 +
month7 * sep1 +
month8 * oct1 +
month9 * nov1 +
month10 * dec1 +
month11 * j2 +
month12 * f2;
}
if(CurrentMonth == 'April'){
result= 
month1 * a1 +
month2 * my1 +
month3 * june1 +
month4 * july1 +
month5 * aug1 +
month6 * sep1 +
month7 * oct1 +
month8 * nov1 +
month9 * dec1 +
month10 * j2 +
month11 * f2 +
month12 * m2;
}

if(CurrentMonth == 'May'){
result= 
month1 * my1 +
month2 * june1 +
month3 * july1 +
month4 * aug1 +
month5 * sep1 +
month6 * oct1 +
month7 * nov1 +
month8 * dec1 +
month9 * j2 +
month10 * f2 +
month11 * m2 +
month12 * a2;
}
if(CurrentMonth == 'June'){

result= 
month1 * june1 +
month2 * july1 +
month3 * aug1 +
month4 * sep1 +
month5 * oct1 +
month6 * nov1 +
month7 * dec1 +
month8 * j2 +
month9 * f2 +
month10 * m2 +
month12 * a2+
month12 * my2 ;
}
if(CurrentMonth == 'July'){

result= 
month1 * july1 +
month2 * aug1 +
month3 * sep1 +
month4 * oct1 +
month5 * nov1 +
month6 * dec1 +
month7 * j2 +
month8 * f2 +
month9 * m2 +
month10 * a2+
month11 * my2 +
month12 * june2 ;
}
if(CurrentMonth == 'August'){
result= 
month1 * aug1 +
month2 * sep1 +
month3 * oct1 +
month4 * nov1 +
month5 * dec1 +
month6 * j2 +
month7 * f2 +
month8 * m2 +
month9 * a2+
month10 * my2 +
month11 * june2 +
month12 * july2;

}

if(CurrentMonth == 'September'){
result= 
month1 * sep1 +
month2 * oct1 +
month3 * nov1 +
month4 * dec1 +
month5 * j2 +
month6 * f2 +
month7 * m2 +
month8 * a2+
month9 * my2 +
month10 * june2 +
month11 * july2 +
month12 * aug2;
}

if(CurrentMonth == 'October'){
result= 

month1 * oct1 +
month2 * nov1 +
month3 * dec1 +
month4 * j2 +
month5 * f2 +
month6 * m2 +
month7 * a2+
month8 * my2 +
month9 * june2 +
month10 * july2 +
month11 * aug2 +
month12 * sep2;
}
if(CurrentMonth == 'November'){
result= 
month1 * nov1 +
month2 * dec1 +
month3 * j2 +
month4 * f2 +
month5 * m2 +
month6 * a2+
month7 * my2 +
month8 * june2 +
month9 * july2 +
month10 * aug2 +
month11 * sep2 +
month12 * oct2;
}

if(CurrentMonth == 'December'){
result= 
month1 * dec1 +
month2 * j2 +
month3 * f2 +
month4 * m2 +
month5 * a2+
month6 * my2 +
month7 * june2 +
month8 * july2 +
month9 * aug2 +
month10 * sep2 +
month11 * oct2 +
month12 * nov2;

}




}
}

The calculation is simple and I have it working in the Sandbox. I just have to deploy it. My test class is as follows, it achieves 15% coverage. I am truly unsure how to construct this. I have authored APEX Trigger Test Classes multiple times; however this is a bit different. Keep in mind I coud be way off base on this Test class. 
 
@isTest

Public class CalculatorTest{

private static string utility = 'National Grid';
private static string pclass = 'Class 2';
private static string currentMonth = 'January';

Utility_NMC_Tariff__c NMCtariff = new Utility_NMC_Tariff__c(december__c = 1, november__c = 1, october__c = 1, september__c = 1, august__c = 1, july__c = 1, june__c = 1, may__c = 1, april__c = 1, march__c = 1, february__c = 1, january__c = 1, name = 'National Grid NEMA Class 2', utility__c = 'National Grid', class__c = 'Class 2', january_previous_year__c = 1, february_previous_year__c = 1, march_previous_year__c = 1, april_previous_year__c = 1, may_previous_year__c = 1, june_previous_year__c = 1, july_previous_year__c = 1, august_previous_year__c = 1, september_previous_year__c = 1, october_previous_year__c = 1,november_previous_year__c = 1, december_previous_year__c = 1);   

Public Static testMethod void testCalculator(){
PageReference pageRef = new PageReference('/apex/Annual_Electricity_Cost_Calculator');
Test.setCurrentPage(pageRef);


calculator newCalc = new calculator();

newCalc.Utility = 'National Grid';
newCalc.pclass = 'Class 2';
newCalc.currentMonth = 'January';
newCalc.month1 = 1;
newCalc.month2 = 1;
newCalc.month3 = 1;
newCalc.month4 = 1;
newCalc.month5 = 1;
newCalc.month6 = 1;
newCalc.month7 = 1;
newCalc.month8 = 1;
newCalc.month9 = 1;
newCalc.month10 = 1;
newCalc.month11= 1;
newCalc.month12 = 1;

string nextPage = system.currentPageReference().getUrl();

System.assertEquals('/apex/Annual_Electricity_Cost_Calculator', nextPage);

}
}



Any help would be greatly appreciated.

Also, if you noticed at the end of the VF page I have a note that instructs the user to refresh the page if they input a month or utility click the command button and then want to change this variable. Currently, if you do so the controller holds on to the old variables and doesn not react to the new ones. Any suggestions. This problem is minor. 

Thank you.
 
Hello,

I have been using Process Builder for a few weeks now. Its main purpose for me has been in its ability to update records in my database without having to click "edit" and "save". I have certain triggers firing off foreign field values, which are therefore only updating when I enter into their object and click the mentioned buttons. Process builder has enabled me to fix this problem. All has been working swell - that is until just recently.

Currently every time I build a new process, an old one stops working; it does not deactivate, it simply ceases to operate successfully. I understand there are governor limits etc, however I do not fully understand these. From my comprehension, after doing a bit of reading, my APEX coding and Processes are hardly close to these limitations. 

I am curious if anybody knows of a solution. These processes are very important to the operations of my database. I would appreciate any sort of help.

To be clear, it is the actions within the processes which stop working. For example, I have a process that updates a custom object upon the change of a field in the opportunity object. This change should update two separate objects - obj1 and obj2. I therefore create two processes and activate them. They are however failing to work simultaneously. When I deactivate one, the other works - vice versa. When I bring the two actions into one process the top-most action is the only one which works. 

Thank you for your time in reading this. Enjoy your day.

All the best,
Cole
Hi all,

I am currently struggling to develop a test class that will provide enough coverage to enable my VisualForce page and Controller to deploy to production.

The VisualForce page has 15 textual inputs , which then upon clicking the commandbutton runs the "month" inputs throught the "calculator" controller to multiply each month's input by specific fieldswithin a separate customer object - "Utilty NMC Tariffs". Then returns the summation of these products as a result displayed at the bottom of the page.

Visual Force Page:
 
<apex:page controller="Calculator">
<apex:form >

<b>
<p>Enter the Current Month:</p>
<p><apex:inputText value="{!CurrentMonth}"/></p>

<p>Enter Utility*:</p>
<p><apex:inputText value="{!Utility}"/></p>

<p>Enter Project Class*:</p>
<p><apex:inputText value="{!Pclass}"/></p>


<p>Enter consumption per month in kWh:</p>
<p> Month 1  <apex:inputText value="{!Month1}"/></p>
<p> Month 2  <apex:inputText value="{!Month2}"/></p>
<p> Month 3  <apex:inputText value="{!Month3}"/></p>
<p> Month 4  <apex:inputText value="{!Month4}"/></p>
<p> Month 5  <apex:inputText value="{!Month5}"/></p>
<p> Month 6  <apex:inputText value="{!Month6}"/></p>
<p> Month 7  <apex:inputText value="{!Month7}"/></p>
<p> Month 8  <apex:inputText value="{!Month8}"/></p>
<p> Month 9  <apex:inputText value="{!Month9}"/></p>
<p> Month 10  <apex:inputText value="{!Month10}"/></p>
<p> Month 11  <apex:inputText value="{!Month11}"/></p>
<p> Month 12  <apex:inputText value="{!Month12}"/></p>
</b>

<apex:commandButton action="{!Calculation}" value="Show Result" styleClass="buttonStyle" style="background:LightBlue;width:150px;"/>

<p>The Estimated Total Annual Cost of Electricity is:</p>
<b><p> $ <apex:outputText value="{!result}"/></p></b> 

*If you need to change the Current Month, Utility, or Project Class Refresh Page then Change

</apex:form>
</apex:page>
Controller (Calculator):
public class Calculator{

public String Utility { get; set; }
public String Calculation { get; set; }
public string CurrentMonth{get;set;}
public double result{get;set;}
public string Pclass{get;set;}


public integer Month1{get;set;}
public integer Month2{get;set;}
public integer Month3{get;set;}
public integer Month4{get;set;}
public integer Month5{get;set;}
public integer Month6{get;set;}
public integer Month7{get;set;}
public integer Month8{get;set;}
public integer Month9{get;set;}
public integer Month10{get;set;}
public integer Month11{get;set;}
public integer Month12{get;set;}

list<decimal> NMClist1 = new list<decimal>();
list<decimal> NMClist2 = new list<decimal>();
list<decimal> NMClist3 = new list<decimal>();
list<decimal> NMClist4 = new list<decimal>();
list<decimal> NMClist5 = new list<decimal>();
list<decimal> NMClist6 = new list<decimal>();
list<decimal> NMClist7 = new list<decimal>();
list<decimal> NMClist8 = new list<decimal>();
list<decimal> NMClist9 = new list<decimal>();
list<decimal> NMClist10 = new list<decimal>();
list<decimal> NMClist11 = new list<decimal>();
list<decimal> NMClist12 = new list<decimal>();
list<decimal> NMClist13 = new list<decimal>();
list<decimal> NMClist14 = new list<decimal>();
list<decimal> NMClist15 = new list<decimal>();
list<decimal> NMClist16 = new list<decimal>();
list<decimal> NMClist17 = new list<decimal>();
list<decimal> NMClist18 = new list<decimal>();
list<decimal> NMClist19 = new list<decimal>();
list<decimal> NMClist20 = new list<decimal>();
list<decimal> NMClist21 = new list<decimal>();
list<decimal> NMClist22 = new list<decimal>();
list<decimal> NMClist23 = new list<decimal>();
list<decimal> NMClist24 = new list<decimal>();

public void calculation()
{

for(utility_nmc_tariff__c NMCquery : [ SELECT January_previous_year__c, january__c,February_previous_year__c,February__c, March_previous_year__c,March__c,April_previous_year__c,April__c,May_previous_year__c, May__c, june_previous_year__c, june__c, july_previous_year__c, july__c, august_previous_year__c, august__c, september_previous_year__c, september__c, october_previous_year__c, october__c, november_previous_year__c, november__c, december_previous_year__c, december__c FROM utility_nmc_tariff__c WHERE Utility__c = : Utility AND Class__c = : pclass ])
{
    NMClist1.add(NMCquery.January_previous_year__c);
    
    NMClist2.add(NMCquery.January__c);
    
    NMClist3.add(NMCquery.february_previous_year__c);
    
    NMClist4.add(NMCquery.february__c);
    
    NMClist5.add(NMCquery.march_previous_year__c);
    
    NMClist6.add(NMCquery.march__c);
    
    NMClist7.add(NMCquery.april_previous_year__c);
    
    NMClist8.add(NMCquery.april__c);
   
    NMClist9.add(NMCquery.may_previous_year__c);
    
    NMClist10.add(NMCquery.may__c);
    
    NMClist11.add(NMCquery.June_previous_year__c);
    
    NMClist12.add(NMCquery.June__c);
    
    NMClist13.add(NMCquery.July_previous_year__c);
    
    NMClist14.add(NMCquery.July__c);
    
    NMClist15.add(NMCquery.August_previous_year__c);
    
    NMClist16.add(NMCquery.August__c);
    
    NMClist17.add(NMCquery.September_previous_year__c);
    
    NMClist18.add(NMCquery.September__c);
    
    NMClist19.add(NMCquery.October_previous_year__c);
    
    NMClist20.add(NMCquery.October__c);
    
    NMClist21.add(NMCquery.November_previous_year__c);
    
    NMClist22.add(NMCquery.November__c);
    
    NMClist23.add(NMCquery.December_previous_year__c);
    
    NMClist24.add(NMCquery.December__c);
    
    }
    
 


decimal j1 = NMCList1.get(0);
decimal j2 = NMCList2.get(0);
decimal f1 = NMCList3.get(0);
decimal f2 = NMCList4.get(0);
decimal m1 = NMCList5.get(0);
decimal m2 = NMCList6.get(0);
decimal a1 = NMCList7.get(0);
decimal a2 = NMCList8.get(0);
decimal my1 = NMCList9.get(0);
decimal my2 = NMCList10.get(0);
decimal june1 = NMCList11.get(0);
decimal june2 = NMCList12.get(0);
decimal july1 = NMCList13.get(0);
decimal july2 = NMCList14.get(0);
decimal aug1 = NMCList15.get(0);
decimal aug2 = NMCList16.get(0);
decimal sep1 = NMCList17.get(0);
decimal sep2 = NMCList18.get(0);
decimal oct1 = NMCList19.get(0);
decimal oct2 = NMCList20.get(0);
decimal nov1 = NMCList21.get(0);
decimal nov2 = NMCList22.get(0);
decimal dec1 = NMCList23.get(0);
decimal dec2 = NMCList24.get(0);


if(CurrentMonth == 'January'){
result= 
month1 * j1 +
month2 * f1 +
month3 * m1 +
month4 * a1 +
month5 * my1 +
month6 * june1 +
month7 * july1 +
month8 * aug1 +
month9 * sep1 +
month10 * oct1 +
month11 * nov1 +
month12 * dec1;
}
if(CurrentMonth == 'February'){
result= 
month1 * f1 +
month2 * m1 +
month3 * a1 +
month4 * my1 +
month5 * june1 +
month6 * july1 +
month7 * aug1 +
month8 * sep1 +
month9 * oct1 +
month10 * nov1 +
month11 * dec1 +
month12 * j2;
}
if(CurrentMonth == 'March'){
result= 
month1 * m1 +
month2 * a1 +
month3 * my1 +
month4 * june1 +
month5 * july1 +
month6 * aug1 +
month7 * sep1 +
month8 * oct1 +
month9 * nov1 +
month10 * dec1 +
month11 * j2 +
month12 * f2;
}
if(CurrentMonth == 'April'){
result= 
month1 * a1 +
month2 * my1 +
month3 * june1 +
month4 * july1 +
month5 * aug1 +
month6 * sep1 +
month7 * oct1 +
month8 * nov1 +
month9 * dec1 +
month10 * j2 +
month11 * f2 +
month12 * m2;
}

if(CurrentMonth == 'May'){
result= 
month1 * my1 +
month2 * june1 +
month3 * july1 +
month4 * aug1 +
month5 * sep1 +
month6 * oct1 +
month7 * nov1 +
month8 * dec1 +
month9 * j2 +
month10 * f2 +
month11 * m2 +
month12 * a2;
}
if(CurrentMonth == 'June'){

result= 
month1 * june1 +
month2 * july1 +
month3 * aug1 +
month4 * sep1 +
month5 * oct1 +
month6 * nov1 +
month7 * dec1 +
month8 * j2 +
month9 * f2 +
month10 * m2 +
month12 * a2+
month12 * my2 ;
}
if(CurrentMonth == 'July'){

result= 
month1 * july1 +
month2 * aug1 +
month3 * sep1 +
month4 * oct1 +
month5 * nov1 +
month6 * dec1 +
month7 * j2 +
month8 * f2 +
month9 * m2 +
month10 * a2+
month11 * my2 +
month12 * june2 ;
}
if(CurrentMonth == 'August'){
result= 
month1 * aug1 +
month2 * sep1 +
month3 * oct1 +
month4 * nov1 +
month5 * dec1 +
month6 * j2 +
month7 * f2 +
month8 * m2 +
month9 * a2+
month10 * my2 +
month11 * june2 +
month12 * july2;

}

if(CurrentMonth == 'September'){
result= 
month1 * sep1 +
month2 * oct1 +
month3 * nov1 +
month4 * dec1 +
month5 * j2 +
month6 * f2 +
month7 * m2 +
month8 * a2+
month9 * my2 +
month10 * june2 +
month11 * july2 +
month12 * aug2;
}

if(CurrentMonth == 'October'){
result= 

month1 * oct1 +
month2 * nov1 +
month3 * dec1 +
month4 * j2 +
month5 * f2 +
month6 * m2 +
month7 * a2+
month8 * my2 +
month9 * june2 +
month10 * july2 +
month11 * aug2 +
month12 * sep2;
}
if(CurrentMonth == 'November'){
result= 
month1 * nov1 +
month2 * dec1 +
month3 * j2 +
month4 * f2 +
month5 * m2 +
month6 * a2+
month7 * my2 +
month8 * june2 +
month9 * july2 +
month10 * aug2 +
month11 * sep2 +
month12 * oct2;
}

if(CurrentMonth == 'December'){
result= 
month1 * dec1 +
month2 * j2 +
month3 * f2 +
month4 * m2 +
month5 * a2+
month6 * my2 +
month7 * june2 +
month8 * july2 +
month9 * aug2 +
month10 * sep2 +
month11 * oct2 +
month12 * nov2;

}




}
}

The calculation is simple and I have it working in the Sandbox. I just have to deploy it. My test class is as follows, it achieves 15% coverage. I am truly unsure how to construct this. I have authored APEX Trigger Test Classes multiple times; however this is a bit different. Keep in mind I coud be way off base on this Test class. 
 
@isTest

Public class CalculatorTest{

private static string utility = 'National Grid';
private static string pclass = 'Class 2';
private static string currentMonth = 'January';

Utility_NMC_Tariff__c NMCtariff = new Utility_NMC_Tariff__c(december__c = 1, november__c = 1, october__c = 1, september__c = 1, august__c = 1, july__c = 1, june__c = 1, may__c = 1, april__c = 1, march__c = 1, february__c = 1, january__c = 1, name = 'National Grid NEMA Class 2', utility__c = 'National Grid', class__c = 'Class 2', january_previous_year__c = 1, february_previous_year__c = 1, march_previous_year__c = 1, april_previous_year__c = 1, may_previous_year__c = 1, june_previous_year__c = 1, july_previous_year__c = 1, august_previous_year__c = 1, september_previous_year__c = 1, october_previous_year__c = 1,november_previous_year__c = 1, december_previous_year__c = 1);   

Public Static testMethod void testCalculator(){
PageReference pageRef = new PageReference('/apex/Annual_Electricity_Cost_Calculator');
Test.setCurrentPage(pageRef);


calculator newCalc = new calculator();

newCalc.Utility = 'National Grid';
newCalc.pclass = 'Class 2';
newCalc.currentMonth = 'January';
newCalc.month1 = 1;
newCalc.month2 = 1;
newCalc.month3 = 1;
newCalc.month4 = 1;
newCalc.month5 = 1;
newCalc.month6 = 1;
newCalc.month7 = 1;
newCalc.month8 = 1;
newCalc.month9 = 1;
newCalc.month10 = 1;
newCalc.month11= 1;
newCalc.month12 = 1;

string nextPage = system.currentPageReference().getUrl();

System.assertEquals('/apex/Annual_Electricity_Cost_Calculator', nextPage);

}
}



Any help would be greatly appreciated.

Also, if you noticed at the end of the VF page I have a note that instructs the user to refresh the page if they input a month or utility click the command button and then want to change this variable. Currently, if you do so the controller holds on to the old variables and doesn not react to the new ones. Any suggestions. This problem is minor. 

Thank you.