apex Posted October 16, 2009 Share Posted October 16, 2009 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! 0 Quote Link to comment Share on other sites More sharing options...
redrat Posted October 16, 2009 Share Posted October 16, 2009 Good stuff apex! Thanks. 0 Quote Link to comment Share on other sites More sharing options...
mfiendd Posted January 16, 2010 Share Posted January 16, 2010 Great catch and thank you for letting the masses know. Cheers, MFiendD 0 Quote Link to comment Share on other sites More sharing options...
Speedy059 Posted January 16, 2010 Share Posted January 16, 2010 Be nice if someone made a real forecaster that involved business statistic formulas like linear, exponential, quadratic, cubic equations. Hard to predict with averages... 0 Quote Link to comment Share on other sites More sharing options...
Jan Posted February 11, 2010 Share Posted February 11, 2010 Hi, Thank you very much for sharing this. Very useful. Best regards Jan 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.