/** * Show billed / canceled company invoices * * @param void * @return null */ function company() { $status = $this->request->get('status') ? $this->request->get('status') : 'billed'; $company = null; $company_id = $this->request->getId('company_id'); if ($company_id) { $company = Companies::findById($company_id); } // if if (instance_of($company, 'Company')) { $this->wireframe->addBreadCrumb($company->getName(), assemble_url('company_invoices', array('company_id' => $company->getId()))); } else { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if ($status == 'canceled') { $invoices = group_invoices_by_currency(Invoices::findByCompany($company, array(INVOICE_STATUS_CANCELED), 'closed_on DESC')); } else { $invoices = group_invoices_by_currency(Invoices::findByCompany($company, array(INVOICE_STATUS_BILLED), 'closed_on DESC')); } // if $this->smarty->assign(array('company' => $company, 'invoices' => $invoices, 'status' => $status)); }