Patty Posted June 21, 2010 Share Posted June 21, 2010 I wanted to know how many clients signed up each month so I put together a neat report that shows client ID, client name, status and sign up date. It looks like this: Here's the code. Just save as monthly_clients.php and upload to whmcs/modules/reports: <?php $months = array('January','February','March','April','May','June','July','August','September','October','November','December'); if ($month=="") { $month=date("m"); $year=date("Y"); } $pmonth = str_pad($month, 2, "0", STR_PAD_LEFT); $reportdata["title"] = "New Clients for ".$months[$month-1]." ".$year; $reportdata["description"] = "This report shows all new clients for a given month"; $query = "SELECT id,firstname,lastname,status,datecreated FROM tblclients WHERE datecreated LIKE '$year-$pmonth%' ORDER BY datecreated ASC"; $result = mysql_query($query); $num_rows = mysql_num_rows($result); $reportdata["headertext"] = "Total New Clients: " . $num_rows; $reportdata["tableheadings"] = array("ID","Client Name","Status","Signup Date"); while ($data = mysql_fetch_array($result)) { $id = $data["id"]; $clientname = "<a href=\"clientssummary.php?userid=". $data['id'] ."\" target=\"_blank\"\">" . $data["firstname"]." ".$data["lastname"] . "</a>"; $status = $data["status"]; $datecreated = $data["datecreated"]; $datecreated = fromMySQLDate($datecreated); $colour = "<span style='color:"; switch($status) { case "Active": $colour .= "blue"; break; case "Inactive": $colour .= "lightgrey"; break; case "Closed": $colour .= "red"; break; } $colour .= ";'>"; $reportdata["tablevalues"][] = array($id,$clientname,$colour . $status . "</span>",$datecreated); } $data["footertext"]="<table width=90% align=center><tr><td>"; if ($month=="1") { $data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=12&year=".($year-1)."\"><< December ".($year-1)."</a>"; } else { $data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=".($month-1)."&year=".$year."\"><< ".$months[($month-2)]." $year</a>"; } $data["footertext"].="</td><td align=right>"; if ($month=="12") { $data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=1&year=".($year+1)."\">January ".($year+1)." >></a>"; } else { $data["footertext"].="<a href=\"$PHP_SELF?report=$report&month=".($month+1)."&year=".$year."\">".$months[(($month+1)-1)]." $year >></a>"; } $data["footertext"].="</td></tr></table>"; ?> Enjoy! 0 Quote Link to comment Share on other sites More sharing options...
arhost Posted June 21, 2010 Share Posted June 21, 2010 Thanks for sharing. 0 Quote Link to comment Share on other sites More sharing options...
multisoft Posted June 21, 2010 Share Posted June 21, 2010 Thank you for sharing. 0 Quote Link to comment Share on other sites More sharing options...
edvan.com.br Posted June 22, 2010 Share Posted June 22, 2010 Very good Patty. I made some modications and translations! Available on whmcs.blog.br 0 Quote Link to comment Share on other sites More sharing options...
SteveV Posted June 22, 2010 Share Posted June 22, 2010 Thank you very much. 0 Quote Link to comment Share on other sites More sharing options...
webio Posted June 22, 2010 Share Posted June 22, 2010 Thank you very much. 0 Quote Link to comment Share on other sites More sharing options...
lovecoredesigns Posted June 22, 2010 Share Posted June 22, 2010 Thanks for this, I appreciate it. 0 Quote Link to comment Share on other sites More sharing options...
bullfrog3459 Posted June 23, 2010 Share Posted June 23, 2010 Thank you for this! 0 Quote Link to comment Share on other sites More sharing options...
GNS_Harrison Posted June 28, 2010 Share Posted June 28, 2010 thanks! works well 0 Quote Link to comment Share on other sites More sharing options...
Dedigeeks-Sean Posted July 3, 2010 Share Posted July 3, 2010 This is an excellent addition, I really do like it 0 Quote Link to comment Share on other sites More sharing options...
factor Posted July 21, 2010 Share Posted July 21, 2010 Hi, i have a little request. Currently we offer free trial so we have lots of new clients, but only a few of these pay, is there a way to separate accounts that have free plans form the others? Thanks in advance for your help. Regards, 0 Quote Link to comment Share on other sites More sharing options...
TheHostingHeroes Posted July 26, 2010 Share Posted July 26, 2010 Thanks Good report! 0 Quote Link to comment Share on other sites More sharing options...
Dixiesys Posted July 27, 2010 Share Posted July 27, 2010 Thanks for this, was just about to write one myself and saw yours, saved me several hours of php pain and suffering. 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.