Jump to content

Income Forecast Report - Modification


apex

Recommended Posts

I noticed the Income Forecast report in 4.1.1 doesn't take into account Product Addons. I added some code to the existing report which incorporates all active Addons into the Income Forecast.

 

Add this code to /modules/reports/income_forecast.php:

 

$resultz = select_query("tblhostingaddons","",array("status"=>"Active"));
while ($data2 = mysql_fetch_array($resultz)) {
   $recurringamount2 = $data2["recurring"];
   $nextduedate2 = $data2["nextduedate"]; 
   $billingcycle2 = $data2["billingcycle"];
   $nextduedate2 = explode("-",$nextduedate2);
   $year2 = $nextduedate2[0];
   $month2 = $nextduedate2[1];
   if ($billingcycle2=="Monthly") {
       $recurrence2 = 1;
   } elseif ($billingcycle2=="Quarterly") {
       $recurrence2 = 3;
   } elseif ($billingcycle2=="Semi-Annually") {
       $recurrence2 = 6;
   } elseif ($billingcycle2=="Annually") {
       $recurrence2 = 12;
   } elseif ($billingcycle2=="Biennially") {
       $recurrence2 = 24;
   } else {
       $recurrence2 = 24;
   }
   $recurrences2 = 24/$recurrence2;
   for ($i=0;$i<=24;$i+=$recurrence2) {
       $new_time2 = mktime(0,0,0,$month2+$i,1,$year2);
       $totals[date("Y",$new_time2)][date("m",$new_time2)][$recurrence2] += $recurringamount2;
   }
}

 

Below this existing code which ends on line 43:

    $recurrences = 24/$recurrence;
   for ($i=0;$i<=24;$i+=$recurrence) {
       $new_time = mktime(0,0,0,$month+$i,1,$year);
       $totals[date("Y",$new_time)][date("m",$new_time)][$recurrence] += $recurringamount;
   }
}

 

That's it! :)

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated