caisc Posted August 29, 2015 Share Posted August 29, 2015 Hey Guys, I have created the widget to show you Upcoming Hosting Renewals in 30 Days on Admin home page of WHMCS, it is updated using Sparky's Code. This widget is fully tested on latest WHMCS v6 ! Installation Method - Just create a new php file in modules/widgets and paste this code in. Then head over to Setup > Staff Management > Administrator Roles > Edit and scroll down to Widgets and then tick yours (in this example it's called "Upcoming Hosting Renewals in 30 Days". <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_hosting_expiring() { $content = '<table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>Domain</td><td>Billing Cycle</td><td>Payment Method</td><td>Next Due Date</td><td>Amount</td></tr>'; $i=1; $range = "<= 30"; $result = mysql_query("SELECT * FROM `tblhosting` WHERE DATEDIFF(`nextduedate`, Now()) $range AND `server` > 0 ORDER BY `nextduedate` ASC"); while ($data = @mysql_fetch_array ($result)) { $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['billingcycle'].'</td><td>'.$data['paymentmethod'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; } if($i) $content = '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No upcoming hosting renewals</td></tr>'; $content .= '</table>'; return array( 'title' => 'Upcoming Hosting Renewals in 30 Days', 'content' => $content ); } add_hook("AdminHomeWidgets",1,"widget_hosting_expiring"); ?> If you have any suggestions, do post it here. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 29, 2015 Share Posted August 29, 2015 I was going to post this in the existing Sparky thread or start a new one - but seeing as you've started this thread and posted your version for hosting solely, i'll post it here. my widget is more advanced than the above code, because not only does it include Products (e.g Hosting), but also Product Addons and Domains. there is an "invoice date" column which tells me when WHMCS should auto-generate the invoice - and I can then use that to check that the invoice was generated correctly. for the Products table, it tells me the product name too; for Domains, it gives me the registrar, years, due date, expiry date, invoice date, payment method, amount and whether the client has disabled auto-renewal. if you find there is too much information in a table, then either reduce the font size and/or remove unnecessary columns. this widget is coded to work in both v5.3 and v6 - where I can, i've used existing Language values, but there is the odd bit of English in there which you may need to translate to another language. there is only one variable that you will need to edit in the file and that is the number of days you want the widget to show. $numberofdays = '30'; you only have to set it once, and all the tables will use that value. so follow the same installation method as above, perhaps call it "upcoming_renewals" and paste the code in... <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_upcoming_renewals($vars) { global $_ADMINLANG,$CONFIG,$currency; $title = "Upcoming Renewals"; $numberofdays = '30'; $dateformat = str_replace("y","Y",strtolower(preg_replace("/(.)\\1+/", "$1", $CONFIG["DateFormat"]))); $hostinginvdays = $CONFIG["CreateInvoiceDaysBefore"]; if ($CONFIG["CreateDomainInvoiceDaysBefore"]) { $domaininvdays = $CONFIG["CreateDomainInvoiceDaysBefore"]; } else { $domaininvdays = $CONFIG["CreateInvoiceDaysBefore"]; } $content .= '<h3 align="center">'.$_ADMINLANG['services']['title'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['product'].'</td><td>'.$_ADMINLANG['fields']['billingcycle'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhosting.*, tblpaymentgateways.*, tblproducts.name FROM tblhosting INNER JOIN tblpaymentgateways ON tblhosting.paymentmethod = tblpaymentgateways.gateway INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhosting.nextduedate, NOW()) <= $numberofdays AND tblhosting.server > 0 AND tblhosting.domainstatus = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhosting.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['name'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No Upcoming '.$_ADMINLANG['services']['title'].'</td></tr>'; $content .= '</table><br />'; $content = $content .= '<h3 align="center">'.$_ADMINLANG['addons']['productaddons'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['product'].'</td><td>'.$_ADMINLANG['fields']['billingcycle'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhosting.*, tblpaymentgateways.*, tblproducts.name FROM tblhosting INNER JOIN tblpaymentgateways ON tblhosting.paymentmethod = tblpaymentgateways.gateway INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhosting.nextduedate, NOW()) <= $numberofdays AND tblhosting.server = 0 AND tblhosting.domainstatus = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhosting.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['name'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No Upcoming '.$_ADMINLANG['addons']['productaddons'].'</td></tr>'; $content .= '</table><br />'; $content .= '<h3 align="center">'.$_ADMINLANG['domains']['title'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['registrar'].'</td><td>'.$_ADMINLANG['domains']['years'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['expirydate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td><td>'.$_ADMINLANG['domains']['renew'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tbldomains.*, tblpaymentgateways.* FROM tbldomains INNER JOIN tblpaymentgateways ON tbldomains.paymentmethod = tblpaymentgateways.gateway WHERE DATEDIFF(tbldomains.expirydate, NOW()) <= $numberofdays AND tbldomains.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tbldomains.expirydate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$domaininvdays.' days')); if ($data['donotrenew']=="1" OR $data['donotrenew']=="on") { $renewdomain = $_ADMINLANG['global']['no']; } else { $renewdomain = $_ADMINLANG['global']['yes']; } $currency=getCurrency($data['userid']); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientsdomains.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.ucwords($data['registrar']).'</td><td>'.$data['registrationperiod'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.fromMySQLDate($data['expirydate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['recurringamount']).'</td><td>'.$renewdomain.'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="9">No Upcoming '.$_ADMINLANG['domains']['title'].'</td></tr>'; $content .= '</table><br />'; return array('title'=>$title,'content'=>$content); } add_hook("AdminHomeWidgets",1,"widget_upcoming_renewals"); ?> 0 Quote Link to comment Share on other sites More sharing options...
caisc Posted August 31, 2015 Author Share Posted August 31, 2015 @brian Thanks for sharing your version also Also i wish to increase the width of the widget, right now with limited width it is not able to display all info properly on admin page. My idea is somehow increase the width of widget and place it at the bottom of admin page, that will be better displayed. Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 31, 2015 Share Posted August 31, 2015 Also i wish to increase the width of the widget, right now with limited width it is not able to display all info properly on admin page. My idea is somehow increase the width of widget and place it at the bottom of admin page, that will be better displayed you can't define the width of a widget in the widget code - so if you want to do this, you'd have to modify the style.css and the admin homepage.tpl template. something along the lines of adding the following to style.css - the width should be changed to suit your needs (perhaps defined in px instead). .homewidgetwide { width: 200%; margin: 5px 0 10px; padding: 0; border: 1px solid #efefef; border-top: 3px solid #efefef; border-bottom: 2px solid #efefef; -moz-border-radius: 4px; -webkit-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; } and then modify the widget foreach loop in homepage.tpl {foreach from=$widgets item=widget} {if $widget.name eq "upcoming_renewals"}<div class="homewidgetwide"{else}<div class="homewidget"{/if} id="{$widget.name}"> <div class="widget-header">{$widget.title}</div> <div class="widget-content">{$widget.content}</div> </div> {/foreach} this basically tells the upcoming widget to be double size, the rest remain at their standard widget size - however, I think for this to work, the upcoming renewals widget might have to be first and top left, with all the other widgets below it on the left. personally, as I previously suggested, I think it would be easier to just reduce the font size and/or remove columns - these css and template changes could be overwritten each time you update WHMCS. 0 Quote Link to comment Share on other sites More sharing options...
Gazza Posted September 5, 2015 Share Posted September 5, 2015 thanks for sharing, most appreciated everything works fine except the product addons is not showing any due addons and I know I have some due just shows No Upcoming Product Addons any ideas what to look for why its not working, running version 6.02 thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 5, 2015 Share Posted September 5, 2015 (edited) any ideas what to look for why its not working, running version 6.02 yes, I can see where the issue is. Edited September 5, 2015 by brian! 0 Quote Link to comment Share on other sites More sharing options...
Gazza Posted September 5, 2015 Share Posted September 5, 2015 no rush thanks for the reply 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 5, 2015 Share Posted September 5, 2015 try the following and see if that fixes the Addons issue... <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_upcoming_renewals($vars) { global $_ADMINLANG,$CONFIG,$currency; $title = "Upcoming Renewals"; $numberofdays = '90'; $dateformat = str_replace("y","Y",strtolower(preg_replace("/(.)\\1+/", "$1", $CONFIG["DateFormat"]))); $hostinginvdays = $CONFIG["CreateInvoiceDaysBefore"]; if ($CONFIG["CreateDomainInvoiceDaysBefore"]) { $domaininvdays = $CONFIG["CreateDomainInvoiceDaysBefore"]; } else { $domaininvdays = $CONFIG["CreateInvoiceDaysBefore"]; } $content .= '<h3 align="center">'.$_ADMINLANG['services']['title'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['product'].'</td><td>'.$_ADMINLANG['fields']['billingcycle'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhosting.*, tblpaymentgateways.*, tblproducts.name FROM tblhosting INNER JOIN tblpaymentgateways ON tblhosting.paymentmethod = tblpaymentgateways.gateway INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhosting.nextduedate, NOW()) <= $numberofdays AND tblhosting.domainstatus = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhosting.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['name'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No Upcoming '.$_ADMINLANG['services']['title'].'</td></tr>'; $content .= '</table><br />'; $content = $content .= '<h3 align="center">'.$_ADMINLANG['addons']['productaddons'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['product'].'</td><td>'.$_ADMINLANG['fields']['addon'].'</td><td>'.$_ADMINLANG['fields']['billingcycle'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhostingaddons.*, tblpaymentgateways.*, tblhosting.domain, tblproducts.name as productname, tbladdons.name as addonname FROM tblhostingaddons INNER JOIN tblpaymentgateways ON tblhostingaddons.paymentmethod = tblpaymentgateways.gateway INNER JOIN tbladdons ON tblhostingaddons.addonid = tbladdons.id INNER JOIN tblhosting ON tblhostingaddons.hostingid = tblhosting.id INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhostingaddons.nextduedate, NOW()) <= $numberofdays AND tblhostingaddons.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhostingaddons.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['productname'].'</td><td>'.$data['addonname'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No Upcoming '.$_ADMINLANG['addons']['productaddons'].'</td></tr>'; $content .= '</table><br />'; $content .= '<h3 align="center">'.$_ADMINLANG['domains']['title'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['registrar'].'</td><td>'.$_ADMINLANG['domains']['years'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['expirydate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td><td>'.$_ADMINLANG['domains']['renew'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tbldomains.*, tblpaymentgateways.* FROM tbldomains INNER JOIN tblpaymentgateways ON tbldomains.paymentmethod = tblpaymentgateways.gateway WHERE DATEDIFF(tbldomains.expirydate, NOW()) <= $numberofdays AND tbldomains.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tbldomains.expirydate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$domaininvdays.' days')); if ($data['donotrenew']=="1" OR $data['donotrenew']=="on") { $renewdomain = $_ADMINLANG['global']['no']; } else { $renewdomain = $_ADMINLANG['global']['yes']; } $currency=getCurrency($data['userid']); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientsdomains.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.ucwords($data['registrar']).'</td><td>'.$data['registrationperiod'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.fromMySQLDate($data['expirydate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['recurringamount']).'</td><td>'.$renewdomain.'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="9">No Upcoming '.$_ADMINLANG['domains']['title'].'</td></tr>'; $content .= '</table><br />'; return array('title'=>$title,'content'=>$content); } add_hook("AdminHomeWidgets",1,"widget_upcoming_renewals"); ?> 0 Quote Link to comment Share on other sites More sharing options...
Gazza Posted September 5, 2015 Share Posted September 5, 2015 try the following and see if that fixes the Addons issue... That's fixed it, all working now thank you once again 0 Quote Link to comment Share on other sites More sharing options...
Gazza Posted September 5, 2015 Share Posted September 5, 2015 just noticed something else in product addons , in the amount it is showing 0.00 and not the correct amount. also when you click the domain name it does not go to the domain product/name it directed to a page with an error Service ID Not Found 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 6, 2015 Share Posted September 6, 2015 (edited) Hi Gazza, just noticed something else in product addons , in the amount it is showing 0.00 and not the correct amount. also when you click the domain name it does not go to the domain product/name it directed to a page withan error Service ID Not Found here's v1.4 - I think everything is working correctly now. <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_upcoming_renewals($vars) { global $_ADMINLANG,$CONFIG,$currency; $title = "Upcoming Renewals"; $numberofdays = '90'; $dateformat = str_replace("y","Y",strtolower(preg_replace("/(.)\\1+/", "$1", $CONFIG["DateFormat"]))); $hostinginvdays = $CONFIG["CreateInvoiceDaysBefore"]; if ($CONFIG["CreateDomainInvoiceDaysBefore"]) { $domaininvdays = $CONFIG["CreateDomainInvoiceDaysBefore"]; } else { $domaininvdays = $CONFIG["CreateInvoiceDaysBefore"]; } $content .= '<h3 align="center">'.$_ADMINLANG['services']['title'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['product'].'</td><td>'.$_ADMINLANG['fields']['billingcycle'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhosting.*, tblpaymentgateways.*, tblproducts.name FROM tblhosting INNER JOIN tblpaymentgateways ON tblhosting.paymentmethod = tblpaymentgateways.gateway INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhosting.nextduedate, NOW()) <= $numberofdays AND tblhosting.domainstatus = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhosting.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['name'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No Upcoming '.$_ADMINLANG['services']['title'].'</td></tr>'; $content .= '</table><br />'; $content = $content .= '<h3 align="center">'.$_ADMINLANG['addons']['productaddons'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['product'].'</td><td>'.$_ADMINLANG['fields']['addon'].'</td><td>'.$_ADMINLANG['fields']['billingcycle'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhostingaddons.*, tblpaymentgateways.*, tblhosting.domain, tblhosting.userid, tblproducts.name as productname, tbladdons.name as addonname FROM tblhostingaddons INNER JOIN tblpaymentgateways ON tblhostingaddons.paymentmethod = tblpaymentgateways.gateway INNER JOIN tbladdons ON tblhostingaddons.addonid = tbladdons.id INNER JOIN tblhosting ON tblhostingaddons.hostingid = tblhosting.id INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhostingaddons.nextduedate, NOW()) <= $numberofdays AND tblhostingaddons.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhostingaddons.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['hostingid'].'">'.$data['domain'].'</a></td><td>'.$data['productname'].'</td><td>'.$data['addonname'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['recurring']).'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="8">No Upcoming '.$_ADMINLANG['addons']['productaddons'].'</td></tr>'; $content .= '</table><br />'; $content .= '<h3 align="center">'.$_ADMINLANG['domains']['title'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['registrar'].'</td><td>'.$_ADMINLANG['domains']['years'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['expirydate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td><td>'.$_ADMINLANG['domains']['renew'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tbldomains.*, tblpaymentgateways.* FROM tbldomains INNER JOIN tblpaymentgateways ON tbldomains.paymentmethod = tblpaymentgateways.gateway WHERE DATEDIFF(tbldomains.expirydate, NOW()) <= $numberofdays AND tbldomains.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tbldomains.expirydate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$domaininvdays.' days')); if ($data['donotrenew']=="1" OR $data['donotrenew']=="on") { $renewdomain = $_ADMINLANG['global']['no']; } else { $renewdomain = $_ADMINLANG['global']['yes']; } $currency=getCurrency($data['userid']); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientsdomains.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.ucwords($data['registrar']).'</td><td>'.$data['registrationperiod'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.fromMySQLDate($data['expirydate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['recurringamount']).'</td><td>'.$renewdomain.'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="9">No Upcoming '.$_ADMINLANG['domains']['title'].'</td></tr>'; $content .= '</table><br />'; return array('title'=>$title,'content'=>$content); } add_hook("AdminHomeWidgets",1,"widget_upcoming_renewals"); ?> Edited September 6, 2015 by brian! 1 Quote Link to comment Share on other sites More sharing options...
Gazza Posted September 6, 2015 Share Posted September 6, 2015 I can confirm all working ok thanks again for your time 0 Quote Link to comment Share on other sites More sharing options...
iLikeHosting Posted October 26, 2015 Share Posted October 26, 2015 Thank you both for this, I am using this on my site 0 Quote Link to comment Share on other sites More sharing options...
blakeh Posted December 13, 2015 Share Posted December 13, 2015 I like this widget update, came across it looking for the update to the expiring domains widget, but since I've got a lot of monthly services, and even at 30 days it seems like the widget will always be a long list due to how many monthly services, I've got a couple of questions: Is there an easy way to exclude monthly services from the widget? Is there an easy way to just scale this back to domains only? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 14, 2015 Share Posted December 14, 2015 Is there an easy way to exclude monthly services from the widget? you could modify the line below and add an IF statement to it to check the billingcycle value - so change... $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['name'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; to... if ($data['billingcycle'] !='Monthly') $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.$data['name'].'</td><td>'.$data['billingcycle'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0; Is there an easy way to just scale this back to domains only? you would just need to remove the services and addons sections of the widget... <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_upcoming_renewals($vars) { global $_ADMINLANG,$CONFIG,$currency; $title = "Upcoming Domain Renewals"; $numberofdays = '90'; $dateformat = str_replace("y","Y",strtolower(preg_replace("/(.)\\1+/", "$1", $CONFIG["DateFormat"]))); $hostinginvdays = $CONFIG["CreateInvoiceDaysBefore"]; if ($CONFIG["CreateDomainInvoiceDaysBefore"]) { $domaininvdays = $CONFIG["CreateDomainInvoiceDaysBefore"]; } else { $domaininvdays = $CONFIG["CreateInvoiceDaysBefore"]; } $content .= '<h3 align="center">'.$_ADMINLANG['domains']['title'].' (Next '.$numberofdays.' Days)</h3> <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;font-size:12px;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"><td>'.$_ADMINLANG['fields']['domain'].'</td><td>'.$_ADMINLANG['fields']['registrar'].'</td><td>'.$_ADMINLANG['domains']['years'].'</td><td>'.$_ADMINLANG['fields']['nextduedate'].'</td><td>'.$_ADMINLANG['fields']['expirydate'].'</td><td>'.$_ADMINLANG['fields']['invoicedate'].'</td><td>'.$_ADMINLANG['fields']['paymentmethod'].'</td><td>'.$_ADMINLANG['fields']['amount'].'</td><td>'.$_ADMINLANG['domains']['renew'].'</td></tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tbldomains.*, tblpaymentgateways.* FROM tbldomains INNER JOIN tblpaymentgateways ON tbldomains.paymentmethod = tblpaymentgateways.gateway WHERE DATEDIFF(tbldomains.expirydate, NOW()) <= $numberofdays AND tbldomains.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tbldomains.expirydate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$domaininvdays.' days')); if ($data['donotrenew']=="1" OR $data['donotrenew']=="on") { $renewdomain = $_ADMINLANG['global']['no']; } else { $renewdomain = $_ADMINLANG['global']['yes']; } $currency=getCurrency($data['userid']); $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientsdomains.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td><td>'.ucwords($data['registrar']).'</td><td>'.$data['registrationperiod'].'</td><td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.fromMySQLDate($data['expirydate']).'</td><td>'.$invoicedate.'</td><td>'.$data['value'].'</td><td>'.formatCurrency($data['recurringamount']).'</td><td>'.$renewdomain.'</td></tr>'; $i=0; } if($i) $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="9">No Upcoming '.$_ADMINLANG['domains']['title'].'</td></tr>'; $content .= '</table><br />'; return array('title'=>$title,'content'=>$content); } add_hook("AdminHomeWidgets",1,"widget_upcoming_renewals"); ?> 0 Quote Link to comment Share on other sites More sharing options...
oscarch Posted February 1, 2016 Share Posted February 1, 2016 Hi everyone, Very nice widget! I'd like to contribute to this post with my customized one... <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_upcoming_renewals($vars) { global $_ADMINLANG,$CONFIG,$currency; $numberofdays = '30'; $title = "Upcoming Renewals <span style='font-size:0.8em;'>(Next ".$numberofdays." Days)</span>"; $dateformat = str_replace("y","Y",strtolower(preg_replace("/(.)\\1+/", "$1", $CONFIG["DateFormat"]))); $hostinginvdays = $CONFIG["CreateInvoiceDaysBefore"]; if ($CONFIG["CreateDomainInvoiceDaysBefore"]) { $domaininvdays = $CONFIG["CreateDomainInvoiceDaysBefore"]; } else { $domaininvdays = $CONFIG["CreateInvoiceDaysBefore"]; } $content .= ' <div id="upcoming-renewals"> <ul id="tabs" class="nav nav-tabs" data-tabs="tabs"> <li class="active"><a href="#services" data-toggle="tab">'.$_ADMINLANG['services']['title'].'</a></li> <li><a href="#domains" data-toggle="tab">'.$_ADMINLANG['domains']['title'].'</a></li> <li><a href="#addons" data-toggle="tab">'.$_ADMINLANG['addons']['productaddons'].'</a></li> </ul> <div class="tab-content" style="padding-top:5px;"> <div class="tab-pane active" id="services"> <table class="table table-condensed" style="font-size:0.9em;"> <tr bgcolor="#efefef" style="text-align:left;font-weight:bold;"> <td>'.$_ADMINLANG['fields']['domain'].'</td> <td>'.$_ADMINLANG['fields']['product'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['nextduedate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['amount'].'</td> </tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhosting.*, tblpaymentgateways.*, tblproducts.name FROM tblhosting INNER JOIN tblpaymentgateways ON tblhosting.paymentmethod = tblpaymentgateways.gateway INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhosting.nextduedate, NOW()) <= $numberofdays AND tblhosting.domainstatus = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhosting.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $currency=getCurrency($data['userid']); $content .= ' <tr> <td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td> <td>'.$data['name'].'</td> <td style="text-align:right;">'.fromMySQLDate($data['nextduedate']).'</td> <td style="text-align:right;">'.formatCurrency($data['amount']).'</td> </tr>'; $i=0; } if($i) $content .= ' <tr style="text-align:center;"> <td colspan="4">No Upcoming '.$_ADMINLANG['services']['title'].'</td> </tr>'; $content .= ' </table> </div> <div class="tab-pane" id="domains">'; $content .= ' <table class="table table-condensed" style="font-size:0.9em;"> <tr bgcolor="#efefef" style="text-align:left;font-weight:bold;"> <td>'.$_ADMINLANG['fields']['domain'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['nextduedate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['expirydate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['amount'].'</td> </tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tbldomains.*, tblpaymentgateways.* FROM tbldomains INNER JOIN tblpaymentgateways ON tbldomains.paymentmethod = tblpaymentgateways.gateway WHERE DATEDIFF(tbldomains.expirydate, NOW()) <= $numberofdays AND tbldomains.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tbldomains.expirydate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$domaininvdays.' days')); if ($data['donotrenew']=="1" OR $data['donotrenew']=="on") { $renewdomain = $_ADMINLANG['global']['no']; } else { $renewdomain = $_ADMINLANG['global']['yes']; } $currency=getCurrency($data['userid']); $content .= ' <tr> <td><a href="clientsdomains.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td> <td style="text-align:right;">'.fromMySQLDate($data['nextduedate']).'</td> <td style="text-align:right;">'.fromMySQLDate($data['expirydate']).'</td> <td style="text-align:right;">'.formatCurrency($data['recurringamount']).'</td> </tr>'; $i=0; } if($i) $content .= ' <tr style="text-align:center;"> <td colspan="4">No Upcoming '.$_ADMINLANG['domains']['title'].'</td> </tr>'; $content .= ' </table> </div> <div class="tab-pane" id="addons">'; $content .= ' <table class="table table-condensed" style="font-size:0.9em;"> <tr bgcolor="#efefef" style="text-align:left;font-weight:bold;"> <td>'.$_ADMINLANG['fields']['domain'].'</td> <td>'.$_ADMINLANG['fields']['product'].'</td> <td>'.$_ADMINLANG['fields']['addon'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['nextduedate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['amount'].'</td> </tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhostingaddons.*, tblpaymentgateways.*, tblhosting.domain, tblhosting.userid, tblproducts.name as productname, tbladdons.name as addonname FROM tblhostingaddons INNER JOIN tblpaymentgateways ON tblhostingaddons.paymentmethod = tblpaymentgateways.gateway INNER JOIN tbladdons ON tblhostingaddons.addonid = tbladdons.id INNER JOIN tblhosting ON tblhostingaddons.hostingid = tblhosting.id INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhostingaddons.nextduedate, NOW()) <= $numberofdays AND tblhostingaddons.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhostingaddons.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= ' <tr> <td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['hostingid'].'">'.$data['domain'].'</a></td> <td>'.$data['productname'].'</td> <td>'.$data['addonname'].'</td> <td style="text-align:right;">'.fromMySQLDate($data['nextduedate']).'</td> <td style="text-align:right;">'.formatCurrency($data['recurring']).'</td> </tr>'; $i=0; } if($i) $content .= ' <tr style="text-align:center;"> <td colspan="5">No Upcoming '.$_ADMINLANG['addons']['productaddons'].'</td> </tr>'; $content .= ' </table> </div> </div> </div>'; return array('title'=>$title,'content'=>$content); } add_hook("AdminHomeWidgets",1,"widget_upcoming_renewals"); ?> Thanks for the widget 1 Quote Link to comment Share on other sites More sharing options...
Reza Mousavi Posted May 9, 2018 Share Posted May 9, 2018 This is updated version of caisc widget. <?php add_hook('AdminHomeWidgets', 2, function() { return new Widget3(); }); /** * Widget3 Widget. */ class Widget3 extends \WHMCS\Module\AbstractWidget { protected $title = 'Upcoming Renew'; protected $description = 'Upcoming Renew'; protected $weight = 40; protected $cache = false; protected $requiredPermission = ''; public function getData() { $i=1; $range = "<= 7"; $result = mysql_query("SELECT * FROM `tblhosting` WHERE DATEDIFF(`nextduedate`, Now()) $range ORDER BY `nextduedate` ASC"); while ($data = @mysql_fetch_array ($result)) { $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="clientssummary.php?userid='.$data['userid'].'">Plan</a></td><td>'.$data['billingcycle'].'</td>'.'<td>'.fromMySQLDate($data['nextduedate']).'</td><td>'.formatCurrency($data['amount']).'</td> <td>'.$data['domainstatus'].'</td></tr>'; $i=0; } return array( 'rowsdata' => $content, ); } public function generateOutput($data) { $rowsdata=$data['rowsdata']; return <<<EOF <table bgcolor="#cccccc" align="center" style="margin-bottom:5px;width:100%;" cellspacing="1"> <tr bgcolor="#efefef" style="text-align:center;font-weight:bold;"> <td>Service</td><td>Billing Cycle</td><td>Next Due Date</td><td>Amount</td><td>Status</td> </tr> $rowsdata </table> EOF; } } It works on the latest version 7.5.1 0 Quote Link to comment Share on other sites More sharing options...
mwchetan Posted November 20, 2018 Share Posted November 20, 2018 We tried to upload all the codes mentioned here but it doesn't show on homepage. We are using WHMCS 7.4.1 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 21, 2018 Share Posted November 21, 2018 On 20/11/2018 at 13:41, mwchetan said: We tried to upload all the codes mentioned here but it doesn't show on homepage. We are using WHMCS 7.4.1 because these were all written for v6, you may need to go to setup -> staff management -> *choose your admin role* ... and then enable the widget from the checkboxes available... once enabled, the widget should work... ultimately, this will need to be rewritten for v7 (if only to improve the display), but i'll leave that until v7.7 is released. 1 Quote Link to comment Share on other sites More sharing options...
northfork Posted February 16, 2019 Share Posted February 16, 2019 Hi @brian! and @oscarch - this widget is great. How can I make it span two widget columns (like the system overview widget)? Also any updates for v7.7? Thanks in advance! 0 Quote Link to comment Share on other sites More sharing options...
shivahost Posted February 24, 2019 Share Posted February 24, 2019 everything is fine on 7.7.1 but i changed this id='.$data['id'] to this id='.$data[0] 0 Quote Link to comment Share on other sites More sharing options...
northfork Posted February 24, 2019 Share Posted February 24, 2019 Hi @shivahost thank you. I made that change and all works. Any idea how to get it to span two widget columns? 0 Quote Link to comment Share on other sites More sharing options...
caisc Posted March 19, 2019 Author Share Posted March 19, 2019 On 2/1/2016 at 1:49 PM, oscarch said: Hi everyone, Very nice widget! I'd like to contribute to this post with my customized one... <?php if (!defined("WHMCS")) die("This file cannot be accessed directly"); function widget_upcoming_renewals($vars) { global $_ADMINLANG,$CONFIG,$currency; $numberofdays = '30'; $title = "Upcoming Renewals <span style='font-size:0.8em;'>(Next ".$numberofdays." Days)</span>"; $dateformat = str_replace("y","Y",strtolower(preg_replace("/(.)\\1+/", "$1", $CONFIG["DateFormat"]))); $hostinginvdays = $CONFIG["CreateInvoiceDaysBefore"]; if ($CONFIG["CreateDomainInvoiceDaysBefore"]) { $domaininvdays = $CONFIG["CreateDomainInvoiceDaysBefore"]; } else { $domaininvdays = $CONFIG["CreateInvoiceDaysBefore"]; } $content .= ' <div id="upcoming-renewals"> <ul id="tabs" class="nav nav-tabs" data-tabs="tabs"> <li class="active"><a href="#services" data-toggle="tab">'.$_ADMINLANG['services']['title'].'</a></li> <li><a href="#domains" data-toggle="tab">'.$_ADMINLANG['domains']['title'].'</a></li> <li><a href="#addons" data-toggle="tab">'.$_ADMINLANG['addons']['productaddons'].'</a></li> </ul> <div class="tab-content" style="padding-top:5px;"> <div class="tab-pane active" id="services"> <table class="table table-condensed" style="font-size:0.9em;"> <tr bgcolor="#efefef" style="text-align:left;font-weight:bold;"> <td>'.$_ADMINLANG['fields']['domain'].'</td> <td>'.$_ADMINLANG['fields']['product'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['nextduedate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['amount'].'</td> </tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhosting.*, tblpaymentgateways.*, tblproducts.name FROM tblhosting INNER JOIN tblpaymentgateways ON tblhosting.paymentmethod = tblpaymentgateways.gateway INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhosting.nextduedate, NOW()) <= $numberofdays AND tblhosting.domainstatus = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhosting.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $currency=getCurrency($data['userid']); $content .= ' <tr> <td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td> <td>'.$data['name'].'</td> <td style="text-align:right;">'.fromMySQLDate($data['nextduedate']).'</td> <td style="text-align:right;">'.formatCurrency($data['amount']).'</td> </tr>'; $i=0; } if($i) $content .= ' <tr style="text-align:center;"> <td colspan="4">No Upcoming '.$_ADMINLANG['services']['title'].'</td> </tr>'; $content .= ' </table> </div> <div class="tab-pane" id="domains">'; $content .= ' <table class="table table-condensed" style="font-size:0.9em;"> <tr bgcolor="#efefef" style="text-align:left;font-weight:bold;"> <td>'.$_ADMINLANG['fields']['domain'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['nextduedate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['expirydate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['amount'].'</td> </tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tbldomains.*, tblpaymentgateways.* FROM tbldomains INNER JOIN tblpaymentgateways ON tbldomains.paymentmethod = tblpaymentgateways.gateway WHERE DATEDIFF(tbldomains.expirydate, NOW()) <= $numberofdays AND tbldomains.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tbldomains.expirydate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$domaininvdays.' days')); if ($data['donotrenew']=="1" OR $data['donotrenew']=="on") { $renewdomain = $_ADMINLANG['global']['no']; } else { $renewdomain = $_ADMINLANG['global']['yes']; } $currency=getCurrency($data['userid']); $content .= ' <tr> <td><a href="clientsdomains.php?userid='.$data['userid'].'&id='.$data['id'].'">'.$data['domain'].'</a></td> <td style="text-align:right;">'.fromMySQLDate($data['nextduedate']).'</td> <td style="text-align:right;">'.fromMySQLDate($data['expirydate']).'</td> <td style="text-align:right;">'.formatCurrency($data['recurringamount']).'</td> </tr>'; $i=0; } if($i) $content .= ' <tr style="text-align:center;"> <td colspan="4">No Upcoming '.$_ADMINLANG['domains']['title'].'</td> </tr>'; $content .= ' </table> </div> <div class="tab-pane" id="addons">'; $content .= ' <table class="table table-condensed" style="font-size:0.9em;"> <tr bgcolor="#efefef" style="text-align:left;font-weight:bold;"> <td>'.$_ADMINLANG['fields']['domain'].'</td> <td>'.$_ADMINLANG['fields']['product'].'</td> <td>'.$_ADMINLANG['fields']['addon'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['nextduedate'].'</td> <td style="text-align:right;">'.$_ADMINLANG['fields']['amount'].'</td> </tr>'; $i=1; $range = "<= ".$numberofdays; $result = mysql_query("SELECT tblhostingaddons.*, tblpaymentgateways.*, tblhosting.domain, tblhosting.userid, tblproducts.name as productname, tbladdons.name as addonname FROM tblhostingaddons INNER JOIN tblpaymentgateways ON tblhostingaddons.paymentmethod = tblpaymentgateways.gateway INNER JOIN tbladdons ON tblhostingaddons.addonid = tbladdons.id INNER JOIN tblhosting ON tblhostingaddons.hostingid = tblhosting.id INNER JOIN tblproducts ON tblhosting.packageid = tblproducts.id WHERE DATEDIFF(tblhostingaddons.nextduedate, NOW()) <= $numberofdays AND tblhostingaddons.status = 'Active' AND tblpaymentgateways.setting = 'name' ORDER BY tblhostingaddons.nextduedate"); while ($data = @mysql_fetch_array ($result)) { $invoicedate=date($dateformat,strtotime($data['nextduedate'].'-'.$hostinginvdays.' days')); $content .= ' <tr> <td><a href="clientshosting.php?userid='.$data['userid'].'&id='.$data['hostingid'].'">'.$data['domain'].'</a></td> <td>'.$data['productname'].'</td> <td>'.$data['addonname'].'</td> <td style="text-align:right;">'.fromMySQLDate($data['nextduedate']).'</td> <td style="text-align:right;">'.formatCurrency($data['recurring']).'</td> </tr>'; $i=0; } if($i) $content .= ' <tr style="text-align:center;"> <td colspan="5">No Upcoming '.$_ADMINLANG['addons']['productaddons'].'</td> </tr>'; $content .= ' </table> </div> </div> </div>'; return array('title'=>$title,'content'=>$content); } add_hook("AdminHomeWidgets",1,"widget_upcoming_renewals"); ?> Thanks for the widget Hello Oscarch and Brian, can you please confirm that this code hyperlinks work fine in ver 7.7.1 widgets works perfectly fine, but the hyperlinks populated in the table have wrong user id/prod id Let me know how it works with version 7.7.1 at your end. Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 19, 2019 Share Posted March 19, 2019 21 minutes ago, caisc said: Hello Oscarch and Brian, can you please confirm that this code hyperlinks work fine in ver 7.7.1 widgets works perfectly fine, but the hyperlinks populated in the table have wrong user id/prod id Let me know how it works with version 7.7.1 at your end. it looks like the SQL queries needed tweaking - i'll attach the updated file rather than posting the entire code, but basically i've just changed the three references of... tblpaymentgateways.* to... tblpaymentgateways.value .. and it's still on my list of things to do to update this widget properly for v7.7+ 📅 admin.php 3 Quote Link to comment Share on other sites More sharing options...
caisc Posted March 20, 2019 Author Share Posted March 20, 2019 Thanks working perfectly now. 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.