/** * Show company invoices * * @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') : 'active'; if ($status == 'active') { $invoice_status = INVOICE_STATUS_ISSUED; } else { if ($status == 'paid') { $invoice_status = INVOICE_STATUS_BILLED; } else { if ($status == 'canceled') { $invoice_status = INVOICE_STATUS_CANCELED; } } } // if list($invoices, $pagination) = Invoices::paginateByCompany($this->active_company, array($invoice_status), $page, $per_page, 'due_on ASC, created_on DESC'); $this->smarty->assign(array('invoices' => $invoices, 'pagination' => $pagination, 'status' => $status)); }