It is very common that the "next due date" on the hosting accounts is past than the "todays date" this can be because:
A) The invoice hasn't been paid
or
B) there is an error on the next due date.
for the second case (B) If you have many clients this is a problem because you might be loosing money when the invoice is not being automactly created.
So on the great code Sparky gave us I did a modification to color the "TDs" that are Past today.
So your administrative staff can have a detailed look on those accounts.
I hope it helps:
<!-- START ADMIN UPCOMING HOSTING RENEWALS -->
<h3 align="center">Próximas Renovaciones de Hosting (10 días)</h3>
<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>
{php}
global $currency;$i=1; $range = "<= 10";
$result = mysql_query("SELECT * FROM `tblhosting` WHERE DATEDIFF(`nextduedate`, Now()) $range AND (`domainstatus` = 'Active' OR `domainstatus` = 'Suspended') AND `server` > 0 ORDER BY `nextduedate` ASC");
while ($data = @mysql_fetch_array ($result)) {
$currency=getCurrency($data['userid']);
$laduedate = $data['nextduedate'];
$todays_date = date("Y-m-d");
$hoytoday = strtotime($todays_date);
$proximopagodate = strtotime($laduedate);
if ($proximopagodate < $hoytoday) {
$colorear = "#FFFF99";
} else {
$colorear = "#FFFFFF";
}
echo '<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 bgcolor="'.$colorear.'">'.fromMySQLDate($data['nextduedate']).'</td><td>'.formatCurrency($data['amount']).'</td></tr>'; $i=0;
}
if($i) echo '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">No upcoming hosting renewals</td></tr>';
{/php}
</table>
<br />
<!-- END UPCOMING HOSTING RENEWALS -->