stuntnmore Posted April 12, 2014 Share Posted April 12, 2014 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: 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) 0 Quote Link to comment Share on other sites More sharing options...
apignard Posted April 14, 2014 Share Posted April 14, 2014 nice widgets thanks 0 Quote Link to comment Share on other sites More sharing options...
Oxi-Network Posted April 23, 2014 Share Posted April 23, 2014 Hey, Thanks for your addons. Possible to change the currency to ours ? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
stuntnmore Posted April 24, 2014 Author Share Posted April 24, 2014 (edited) Hey, Thanks for your addons. Possible to change the currency to ours ? Thanks. It should already detect the default currency you set within WHMCS, and will output whatever you set. Edited April 24, 2014 by stuntnmore 0 Quote Link to comment Share on other sites More sharing options...
Oxi-Network Posted April 27, 2014 Share Posted April 27, 2014 No, he's not. Our Default currency is CAD, but he show USD, with USD value. 0 Quote Link to comment Share on other sites More sharing options...
mlew2 Posted April 27, 2014 Share Posted April 27, 2014 No, he's not. Our Default currency is CAD, but he show USD, with USD value. My default is CAD and that is what it is showing for me. Maybe you have things set up wrong? 0 Quote Link to comment Share on other sites More sharing options...
Oxi-Network Posted April 28, 2014 Share Posted April 28, 2014 Hey, i don't think so. Curency view : /http://prntscr.com/3e4q0i Widget view : /http://prntscr.com/3e4qhp 0 Quote Link to comment Share on other sites More sharing options...
mlew2 Posted April 28, 2014 Share Posted April 28, 2014 Hey, i don't think so. Curency view : /http://prntscr.com/3e4q0i Widget view : /http://prntscr.com/3e4qhp Got me beat sorry, I installed mine and worked correctly rightaway 0 Quote Link to comment Share on other sites More sharing options...
stuntnmore Posted April 28, 2014 Author Share Posted April 28, 2014 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 0 Quote Link to comment Share on other sites More sharing options...
Oxi-Network Posted April 29, 2014 Share Posted April 29, 2014 Yes, our currency are setup correctly. /http://prntscr.com/3e4q0i We want to put CAD instead of USD 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 29, 2014 Share Posted April 29, 2014 (edited) 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 April 29, 2014 by brian! 1 Quote Link to comment Share on other sites More sharing options...
stuntnmore Posted May 7, 2014 Author Share Posted May 7, 2014 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) 0 Quote Link to comment Share on other sites More sharing options...
blakeh Posted June 29, 2014 Share Posted June 29, 2014 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? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 30, 2014 Share Posted June 30, 2014 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. 0 Quote Link to comment Share on other sites More sharing options...
blakeh Posted July 6, 2014 Share Posted July 6, 2014 I'd like it to show something like this Est. Annual $5000.00 USD ($416.67) I'm not php savvy enough to hack this stuff too much. Thanks. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 7, 2014 Share Posted July 7, 2014 in the income forecast widget, use... <span class=\"textgreen\"><b>".$_ADMINLANG['billing']['annualestimate'].": ".formatCurrency($currencytotal)." (".formatCurrency($currencytotal/12).")</b></span></div>"; 0 Quote Link to comment Share on other sites More sharing options...
blakeh Posted July 7, 2014 Share Posted July 7, 2014 that's awesome, exactly what I was looking for! Thank you much!! bh 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.