public function dadossupplyexaminationmaterialAction() { $this->_helper->layout->disableLayout(); $page = $this->_request->getParam("page", 1); $limit = $this->_request->getParam("rows"); $cdexaminationmaterial = $this->_request->getParam("cdexaminationmaterial"); $supplyMaterialModel = new SupplyexaminationmaterialModel(); $supplyexaminationData = $supplyMaterialModel->fetchAll($supplyMaterialModel->getSupplyExaminationByExaminationMaterial($cdexaminationmaterial)); $count = count($supplyexaminationData); if ($count > 0 && $limit != 0) { $total_pages = ceil($count / $limit); } else { $total_pages = 0; } if ($page > $total_pages) { $page = $total_pages; } // $examinationData = $examinationModel->fetchAll(null, "$sidx $sord", $limit, ($page*$limit-$limit)); $responce = new stdClass(); $responce->page = $page; $responce->total = $total_pages; $responce->records = $count; $i = 0; foreach ($supplyexaminationData as $row) { $row->fgbilling == 1 ? $billingtext = 'Sim' : ($billingtext = 'Não'); $responce->rows[$i]['id'] = $i + 1; $responce->rows[$i]['cell'] = array($row->cdsupply, $row->nmsupply, $row->nmmeasurementunit, $row->nrquantity, $row->cdsupplycentre, $row->idsupplycentre, $billingtext); $i++; } $this->view->dadossupplymaterial = $responce; }