$orderby = "duedate"; } else { if ($orderby == "total") { $orderby = "total"; } else { if ($orderby == "status") { $orderby = "status"; } else { $orderby = "status` DESC,`duedate"; } } } } } $invoice = new WHMCS_Invoice(); $invoices = $invoice->getInvoices("", $client->getID(), $orderby, $sort, $limit); $ca->assign("invoices", $invoices); if ($invoice->getTotalBalance() <= 0) { $ca->assign("nobalance", true); } $ca->assign("totalbalance", $invoice->getTotalBalanceFormatted()); $ca->assign("masspay", $CONFIG['EnableMassPay']); $smartyvalues = array_merge($smartyvalues, clientAreaTablePageNav($numitems)); } else { if ($action == "emails") { checkContactPermission("emails"); $ca->setTemplate("clientareaemails"); $result = select_query("tblemails", "COUNT(*)", array("userid" => $client->getID()), "id", "DESC"); $data = mysql_fetch_array($result); $numitems = $data[0]; list($orderby, $sort, $limit) = clientAreaTableInit("emails", "date", "DESC", $numitems);