Jump to content

WHMCS Overview - Easily read your stats within your homepage


Recommended Posts

Hello, this is something i put together, nothing fancy but it allows you to see a better aspect within your homepage on how your company is doing and what things need to be done. I modified a few things within the original code from WHMCS. Then added my own and revamped it to make it a whole lot better.

 

This widget is free, i will keep it updated as long as i can, i have also created a github to be able to contribute if you wish.

 

Screenshot:

 

whmcsoverview.JPG

Install Instructions:

 

Copy whmcs_overview.php to /modules/widgets/

Navigate to your WHMCS Admin area

Go to Setup > Administrator Roles > Admin Name > Edit

Scroll towards the bottom and set the permission to allow the widget to show up Now you done!

 

Release Notes:

v0.1 Beta

 

Download:

https://github.com/stuntnmore/whmcsoverview (Latest)

Link to comment
Share on other sites

  • 2 weeks later...
Hey,

 

i don't think so.

 

Curency view : /http://prntscr.com/3e4q0i

Widget view : /http://prntscr.com/3e4qhp

 

Here look at this video,

m.youtube.com/watch?v=RPygz_LlBaQ

 

it shows you how to set default currency within admin area, that should fix your problem

Link to comment
Share on other sites

i've just installed this in our test setup, and I found a number of issues with it.

 

1. the widget was causing a horizontal scrollbar to appear in it's box - this was fixed by modifying the css...

 

.row{margin-left:-15px;margin-right:-15px}

was changed to...

 

.row{margin-left:-5px;margin-right:-5px}

 

2. the "Active Clients" box - the first figure is the total number of clients, and the second figure is a percentage of those that are active - wouldn't it make more sense to either add a % to the output of $clientsactive, or just use the $activeclients value ? similarly, I see that $servicesactive is also a percentage - although this variable is never used in the widget output.

 

i've tweaked the widget to show active clients first, then the total number of clients...

 

<span class="value"><span class="stat1">'.$activeclients.'</span> / <span class="stat1">'.$totalclients.'</span></span>

 

in our test setup, we only have 10 clients - with 9 active and 1 inactive - so by default it was showing 10 / 90 - which looked a little weird! I could live with 10 / 90%, but have changed it to show 9 / 10 - as that makes more sense to me as it then follows the same layout used for "Active Services".

 

3. should the "Monthly Income" value be exactly the same as the "This Month" value ? if so, then it isn't for me - it's telling me that it's zero and that's incorrect.

 

looking at the code, it seems to be from the income forecast report - so this figure is a forecast of income from recurring services for the month and doesn't include new orders received?

 

if so, then the value of zero is correct, but logically shouldn't it also include new sales for the month? otherwise, you might as well just call it "Income Forecast".

 

I think you could add new monthly income to it by using some code I modified from one of the other reports...

 

    $date = date('Y-m-d');
   $year = date("Y",strtotime($date));
   $month = date("m",strtotime($date));

for ( $counter = 1; $counter <= 31; $counter += 1) {
   $counter = str_pad($counter, 2, "0", STR_PAD_LEFT);  
   $query = "SELECT SUM(amountin),SUM(fees),SUM(amountout) FROM tblaccounts INNER JOIN tblclients ON tblclients.id=tblaccounts.userid WHERE date LIKE '".db_make_safe_date("$year-$month-$counter")."%' AND tblclients.currency=1";
   $result = full_query($query);
   $data = mysql_fetch_array($result);
   $amountin = $data[0];
   $fees = $data[1];
   $amountout = $data[2];
   $dailybalance = $amountin-$fees-$amountout;
   $overallbalance += $dailybalance;

}

   $monthlyforecast = formatCurrency(ah_formatstat2('Monthly','sum') + $overallbalance);

   $neworders = get_query_val("tblaccounts","COUNT(id)","date > '$year-$month'");
   $monthlycount = ah_formatstat2('Monthly','sum') + $neworders ;

   $monthlydisplay =  '<span class="stat1" style="padding-right:2px;">'.$monthlyforecast.' </span><span class="label">'.$monthlycount.'</span>';

 

and then use the following to display it...

 

<span class="value">'.$monthlydisplay.'</span>

 

I know that it's not great coding on my part, but I just wanted to quickly hack something together... as I only use one currency on the test setup, i've used it in the code. we'll see what happens on Thursday when the month changes and the monthly forecast value will be different (according to the income forecast report)...

 

also, if anyone wanted to make a cosmetic change and replace "Monthly Income" with "*Month* Income", you could use the following...

 

<span class="title">'.date("F",strtotime($date)).' Income</span>

 

4. Due Invoices - there is a dollar sign hard-coded into the display, which is fine for those who have a currency that uses $, but possibly confusing for those that don't..

 

<span class="value"><span class="stat1">'.$dueinvoices.'</span><span class="label"> $'.$overdueinvoicesbal.'</span></span>

 

I think this would work better...

 

<span class="value"><span class="stat1">'.$dueinvoices.'</span><span class="label">'.formatCurrency($overdueinvoicesbal).'</span></span>

 

for me, with no invoices due, it is now showing £0.00 in the silver box rather than just $ - I assume for those with dollar as their default currency, it would show $0.00.

 

thanks for sharing the widget - hopefully some of my dodgy code can be tidied up and added to your next update. :)

Edited by brian!
Link to comment
Share on other sites

i've just installed this in our test setup, and I found a number of issues with it.

 

1. the widget was causing a horizontal scrollbar to appear in it's box - this was fixed by modifying the css...

 

.row{margin-left:-15px;margin-right:-15px}

was changed to...

 

.row{margin-left:-5px;margin-right:-5px}

 

2. the "Active Clients" box - the first figure is the total number of clients, and the second figure is a percentage of those that are active - wouldn't it make more sense to either add a % to the output of $clientsactive, or just use the $activeclients value ? similarly, I see that $servicesactive is also a percentage - although this variable is never used in the widget output.

 

i've tweaked the widget to show active clients first, then the total number of clients...

 

<span class="value"><span class="stat1">'.$activeclients.'</span> / <span class="stat1">'.$totalclients.'</span></span>

 

in our test setup, we only have 10 clients - with 9 active and 1 inactive - so by default it was showing 10 / 90 - which looked a little weird! I could live with 10 / 90%, but have changed it to show 9 / 10 - as that makes more sense to me as it then follows the same layout used for "Active Services".

 

3. should the "Monthly Income" value be exactly the same as the "This Month" value ? if so, then it isn't for me - it's telling me that it's zero and that's incorrect.

 

looking at the code, it seems to be from the income forecast report - so this figure is a forecast of income from recurring services for the month and doesn't include new orders received?

 

if so, then the value of zero is correct, but logically shouldn't it also include new sales for the month? otherwise, you might as well just call it "Income Forecast".

 

I think you could add new monthly income to it by using some code I modified from one of the other reports...

 

    $date = date('Y-m-d');
   $year = date("Y",strtotime($date));
   $month = date("m",strtotime($date));

for ( $counter = 1; $counter <= 31; $counter += 1) {
   $counter = str_pad($counter, 2, "0", STR_PAD_LEFT);  
   $query = "SELECT SUM(amountin),SUM(fees),SUM(amountout) FROM tblaccounts INNER JOIN tblclients ON tblclients.id=tblaccounts.userid WHERE date LIKE '".db_make_safe_date("$year-$month-$counter")."%' AND tblclients.currency=1";
   $result = full_query($query);
   $data = mysql_fetch_array($result);
   $amountin = $data[0];
   $fees = $data[1];
   $amountout = $data[2];
   $dailybalance = $amountin-$fees-$amountout;
   $overallbalance += $dailybalance;

}

   $monthlyforecast = formatCurrency(ah_formatstat2('Monthly','sum') + $overallbalance);

   $neworders = get_query_val("tblaccounts","COUNT(id)","date > '$year-$month'");
   $monthlycount = ah_formatstat2('Monthly','sum') + $neworders ;

   $monthlydisplay =  '<span class="stat1" style="padding-right:2px;">'.$monthlyforecast.' </span><span class="label">'.$monthlycount.'</span>';

 

and then use the following to display it...

 

<span class="value">'.$monthlydisplay.'</span>

 

I know that it's not great coding on my part, but I just wanted to quickly hack something together... as I only use one currency on the test setup, i've used it in the code. we'll see what happens on Thursday when the month changes and the monthly forecast value will be different (according to the income forecast report)...

 

also, if anyone wanted to make a cosmetic change and replace "Monthly Income" with "*Month* Income", you could use the following...

 

<span class="title">'.date("F",strtotime($date)).' Income</span>

 

4. Due Invoices - there is a dollar sign hard-coded into the display, which is fine for those who have a currency that uses $, but possibly confusing for those that don't..

 

<span class="value"><span class="stat1">'.$dueinvoices.'</span><span class="label"> $'.$overdueinvoicesbal.'</span></span>

 

I think this would work better...

 

<span class="value"><span class="stat1">'.$dueinvoices.'</span><span class="label">'.formatCurrency($overdueinvoicesbal).'</span></span>

 

for me, with no invoices due, it is now showing £0.00 in the silver box rather than just $ - I assume for those with dollar as their default currency, it would show $0.00.

 

thanks for sharing the widget - hopefully some of my dodgy code can be tidied up and added to your next update. :)

Thank you for your input, i will most likely release this feature via the next update, if you would like to contribute, i have a github setup. Thank you!

 

- - - Updated - - -

 

I have updated the code to match the default currency set by WHMCS, and updated the css to better fit the default WHMCS layout, thanks to brian!.

 

Version:

v0.15 Beta

 

Download:

https://github.com/stuntnmore/whmcsoverview (Latest)

Link to comment
Share on other sites

  • 1 month later...
I'd really love to mod this to show the monthly income to be the est. annual amount divided by 12. Tried the code above but the number it came up with didn't really relate to anything I could calculate.

Any suggestions?

you could take a look at the code for the "Income Forecast" widget (not the report) in the same directory as this "System Overview" widget... this widget already shows, if activated, your annual income forecast on the home page.

 

to be honest, it would probably quicker to edit this widget to show average forecast monthly income... e.g., modify (or duplicate) the line below (though remember to change the text to show Monthly Average rather than Annual Forecast)... if you do this, you might also need to rename the file to ensure that you don't overwrite it during a future whmcs update.

 

<span class=\"textgreen\"><b>".$_ADMINLANG['billing']['annualestimate'].": ".formatCurrency($currencytotal)."</b></span></div>";

to

<span class=\"textgreen\"><b>".$_ADMINLANG['billing']['annualestimate'].": ".formatCurrency($currencytotal/12)."</b></span></div>";

if you wanted to get it working in the system overview widget, then you'd also have to copy the sql queries used in the income forecast widget and integrate them into the output.

Link to comment
Share on other sites

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.

×
×
  • 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