public function dependentesAction()
 {
     $beneficiarioCardio = new Application_Model_DbTable_Unibeneficiario();
     $beneficiario = new Application_Model_DbTable_Beneficiario();
     $endereco = new Application_Model_DbTable_Endereco();
     $lotacao = new Application_Model_DbTable_Lotacao();
     $telefone = new Application_Model_DbTable_Telefone();
     $user = Zend_Registry::get('zend_auth_user');
     if ($user == null or @$user->contrato == null) {
         exit;
     }
     $pegaUser = $this->getRequest();
     $userId = $pegaUser->getParam('id');
     $this->view->id = $this->getRequest()->getParam('id');
     $this->view->familia = $this->getRequest()->getParam('familia');
     $this->view->nome = $this->getRequest()->getParam('nome');
     $contrato = $user->contrato;
     $select = $telefone->select();
     $select->where('idBeneficiario = ?', $userId)->order('idTelefone desc')->limit(1);
     $this->view->dadosTel = $telefone->fetchAll($select);
     //EXIBE OS DADOS DO BENEFICIARIO, PESSOA E ENDERECOPESSOA DIRETO DA UNIMED
     $select = $endereco->select();
     $select->where('idBeneficiario = ?', $userId);
     $resultado = $endereco->fetchAll($select);
     /* SE NAO RETONAR NADA DO ENDERECO NO NOSSO BANCO, PEGA NO BANCO DA UNIMED */
     if ($resultado->count() > 0) {
         $this->view->dadosEndereco = $resultado;
     } else {
         $this->view->dadosEndereco = $this->carregaEnderecoBenef($userId);
     }
     /* SELECT PARA PEGAR A LOTACAO DO TITULAR */
     $select = $beneficiarioCardio->select();
     $select->where('familia = ?', $this->getRequest()->getParam('familia'))->where('contrato = ?', $contrato)->where('RDP = 0');
     $lotacaoDepe = $beneficiarioCardio->fetchAll($select)->current();
     /* SE NAO ACHAR NO BANCO DA UNIMED PROCURA NO DA SEASON */
     if ($lotacaoDepe['AutoId'] != null) {
         $tab = new Application_Model_DbTable_Unibeneficiario();
         $select = $tab->select();
         $select->setIntegrityCheck(false);
         $select->from(array('l' => 'LotacaoBeneficiario'), array('InicioVigencia', 'FimVigencia', 'AutoId'))->joinLeft(array('c' => 'LotacaoContrato'), 'l.Lotacao = c.AutoId', array('Nome', 'Codigo'))->where('l.beneficiario = ?', $lotacaoDepe['AutoId']);
         $this->view->dadosLotacao = $tab->fetchAll($select)->current();
     } else {
         $select = $beneficiario->select();
         $select->setIntegrityCheck(false);
         $select->from(array('b' => 'beneficiario'), array())->join(array('l' => 'lotacao'), 'b.idbeneficiario=l.idbeneficiario', array('*'))->where('familia = ?', $this->getRequest()->getParam('familia'))->where('contrato = ?', $contrato)->where('RDP = 0');
         $this->view->dadosLotacao = $beneficiario->fetchAll($select)->current();
     }
     $this->view->rdp = $this->vRdp;
     //$this->carregaLotacaoContrato($user->contrato);
     $this->carregaLocalAtendimentoContrato($user->contrato);
     $this->view->dadosModulo = $this->carregaModuloContrato($user->contrato);
     $this->view->dadosLocalAtendimento = $this->carregaLocalAtendimentoContrato($user->contrato);
 }