/** * Show invoicing dashboard * * @param void * @return null */ function index() { $per_page = 30; $page = (int) $this->request->get('page'); if ($page < 1) { $page = 1; } // if $status = $this->request->get('status') ? $this->request->get('status') : 'issued'; if ($status == 'issued') { $invoice_status = INVOICE_STATUS_ISSUED; } else { if ($status == 'billed') { $invoice_status = INVOICE_STATUS_BILLED; } else { if ($status == 'drafts') { $invoice_status = INVOICE_STATUS_DRAFT; } else { if ($status == 'canceled') { $invoice_status = INVOICE_STATUS_CANCELED; } } } } // if list($invoices, $pagination) = Invoices::paginateAll(array($invoice_status), $page, $per_page, 'due_on ASC, created_on DESC'); $this->smarty->assign(array('invoices' => $invoices, 'pagination' => $pagination, 'status' => $status)); }