Exemple #1
0
    checkPermission("Delete Invoice");
    delete_query("tblinvoices", array("id" => $invoiceid));
    logActivity("Deleted Invoice - Invoice ID: " . $invoiceid);
    $filters->redir();
}
ob_start();
if ($action == "") {
    $aInt->deleteJSConfirm("doDelete", "invoices", "delete", $_SERVER['PHP_SELF'] . "?status=" . $status . "&delete=true&invoiceid=");
    $name = "invoices";
    $orderby = "duedate";
    $sort = "DESC";
    $pageObj = new WHMCS_Pagination($name, $orderby, $sort);
    $pageObj->digestCookieData();
    $tbl = new WHMCS_ListTable($pageObj);
    $tbl->setColumns(array("checkall", array("id", $aInt->lang("fields", "invoicenum")), array("clientname", $aInt->lang("fields", "clientname")), array("date", $aInt->lang("fields", "invoicedate")), array("duedate", $aInt->lang("fields", "duedate")), array("total", $aInt->lang("fields", "total")), array("paymentmethod", $aInt->lang("fields", "paymentmethod")), array("status", $aInt->lang("fields", "status")), "", ""));
    $invoicesModel = new WHMCS_Invoices($pageObj);
    if (checkPermission("View Income Totals", true)) {
        $invoicetotals = $invoicesModel->getInvoiceTotals();
        if (count($invoicetotals)) {
            echo "<div class=\"contentbox\" style=\"font-size:18px;\">";
            foreach ($invoicetotals as $vals) {
                echo "<b>" . $vals['currencycode'] . "</b> " . $aInt->lang("status", "paid") . ": <span class=\"textgreen\"><b>" . $vals['paid'] . "</b></span> " . $aInt->lang("status", "unpaid") . ": <span class=\"textred\"><b>" . $vals['unpaid'] . "</b></span> " . $aInt->lang("status", "overdue") . ": <span class=\"textblack\"><b>" . $vals['overdue'] . "</b></span><br />";
            }
            echo "</div><br />";
        }
    }
    echo $aInt->Tabs(array($aInt->lang("global", "searchfilter")), true);
    $clientid = $filters->get("clientid");
    $invoicenum = $filters->get("invoicenum");
    echo "\n<div id=\"tab0box\" class=\"tabbox\">\n  <div id=\"tab_content\">\n\n<!-- Filter -->\n<form action=\"";
    echo $PHP_SELF;
Exemple #2
0
 public function getOrders($criteria = array())
 {
     global $aInt;
     global $currency;
     $query = "FROM tblorders INNER JOIN tblclients ON tblclients.id=tblorders.userid";
     if ($criteria['paymentstatus']) {
         $query .= " INNER JOIN tblinvoices ON tblinvoices.id=tblorders.invoiceid";
     }
     $filters = $this->buildCriteria($criteria);
     if (count($filters)) {
         $query .= " WHERE " . implode(" AND ", $filters);
     }
     $result = full_query("SELECT COUNT(tblorders.id) " . $query);
     $data = mysql_fetch_array($result);
     $this->getPageObj()->setNumResults($data[0]);
     $query .= " ORDER BY tblorders." . $this->getPageObj()->getOrderBy() . " " . $this->getPageObj()->getSortDirection();
     $gateways = new WHMCS_Gateways();
     $invoices = new WHMCS_Invoices();
     $orders = array();
     $query = "SELECT tblorders.id,tblorders.ordernum,tblorders.userid,tblorders.date,tblorders.amount,tblorders.paymentmethod,tblorders.status,tblorders.invoiceid,tblorders.ipaddress,tblclients.firstname,tblclients.lastname,tblclients.companyname,tblclients.groupid,tblclients.currency,(SELECT status FROM tblinvoices WHERE id=tblorders.invoiceid) AS invoicestatus " . $query . " LIMIT " . $this->getQueryLimit();
     $result = full_query($query);
     while ($data = mysql_fetch_array($result)) {
         $id = $data['id'];
         $ordernum = $data['ordernum'];
         $userid = $data['userid'];
         $date = $data['date'];
         $amount = $data['amount'];
         $gateway = $data['paymentmethod'];
         $status = $data['status'];
         $invoiceid = $data['invoiceid'];
         $firstname = $data['firstname'];
         $lastname = $data['lastname'];
         $companyname = $data['companyname'];
         $groupid = $data['groupid'];
         $currency = $data['currency'];
         $ipaddress = $data['ipaddress'];
         $invoicestatus = $data['invoicestatus'];
         $date = fromMySQLDate($date, 1);
         $paymentmethod = $gateways->getDisplayName($gateway);
         $statusformatted = $this->formatStatus($status);
         if ($invoiceid == "0") {
             $paymentstatus = "<span class=\"textgreen\">" . $aInt->lang("orders", "noinvoicedue") . "</span>";
         } else {
             if (!$invoicestatus) {
                 $paymentstatus = "<span class=\"textred\">Invoice Deleted</span>";
             } else {
                 if ($invoicestatus == "Paid") {
                     $paymentstatus = "<span class=\"textgreen\">" . $aInt->lang("status", "complete") . "</span>";
                 } else {
                     if ($invoicestatus == "Unpaid") {
                         $paymentstatus = "<span class=\"textred\">" . $aInt->lang("status", "incomplete") . "</span>";
                     } else {
                         $paymentstatus = $invoices->formatStatus($invoicestatus);
                     }
                 }
             }
         }
         $currency = getCurrency("", $currency);
         $amount = formatCurrency($amount);
         $clientname = $aInt->outputClientLink($userid, $firstname, $lastname, $companyname, $groupid);
         $orders[] = array("id" => $id, "ordernum" => $ordernum, "date" => $date, "clientname" => $clientname, "gateway" => $gateway, "paymentmethod" => $paymentmethod, "amount" => $amount, "paymentstatus" => strip_tags($paymentstatus), "paymentstatusformatted" => $paymentstatus, "status" => $status, "statusformatted" => $statusformatted);
     }
     return $orders;
 }