public function editAction()
 {
     $cdcompany = $this->_request->getParam("cdcompany");
     if (!isset($cdcompany)) {
         $cdcompany = 0;
     }
     $laboratoryModel = new LaboratoryModel();
     $this->view->branchData = $laboratoryModel->fetchAll($laboratoryModel->getBranch($cdcompany));
     $this->view->companyData = $laboratoryModel->fetchRow($laboratoryModel->getCompany($cdcompany));
 }
 public function companydataAction()
 {
     $this->_helper->layout->disableLayout();
     $page = $this->_request->getParam("page", 1);
     $limit = $this->_request->getParam("rows");
     $sidx = $this->_request->getParam("sidx", 1);
     $sord = $this->_request->getParam("sord");
     $cdcompany = $this->_request->getParam("cdcompany");
     $responce = new stdClass();
     $responce->page = $page;
     $responce->total = 10;
     $responce->records = 100;
     $laboratoryModel = new LaboratoryModel();
     if (isset($cdcompany)) {
         $laboratory = $laboratoryModel->fetchAll($laboratoryModel->getBranch($cdcompany));
     } else {
         $laboratory = $laboratoryModel->fetchAll($laboratoryModel->getallCompany());
     }
     $i = 0;
     foreach ($laboratory as $row) {
         switch ($row->fgactive) {
             case '1':
                 $fgactive = 'Ativo';
                 break;
             case '2':
                 $fgactive = 'Inativo';
                 break;
             case 'null':
                 $fgactive = 'Sem estatus';
                 break;
         }
         $responce->rows[$i]['id'] = $row->cdcompany;
         $responce->rows[$i]['cell'] = array($row->nmcompany, $fgactive, $row->cdcompany, $row->nmfantasyname, $row->idcnpj, $row->cdcompanyparent);
         $fgactive = '';
         $i++;
     }
     $this->view->laboratory = $responce;
 }