preenche ( Sessao::read('arPlanos') ); $obLista->setMostraPaginacao(false); $obLista->setRecordset( $rsPlanos ); $obLista->setTitulo ( 'Lista de Planos de Saúde' ); $obLista->addCabecalho(); $obLista->ultimoCabecalho->addConteudo(" "); $obLista->ultimoCabecalho->setWidth( 5 ); $obLista->commitCabecalho(); $obLista->addCabecalho(); $obLista->ultimoCabecalho->addConteudo("Fornecedor"); $obLista->ultimoCabecalho->setWidth( 15 ); $obLista->commitCabecalho(); $obLista->addCabecalho(); $obLista->ultimoCabecalho->addConteudo("Evento"); $obLista->ultimoCabecalho->setWidth( 15 ); $obLista->commitCabecalho(); $obLista->addCabecalho(); $obLista->ultimoCabecalho->addConteudo("Ação"); $obLista->ultimoCabecalho->setWidth( 5 ); $obLista->commitCabecalho(); $obLista->addDado(); $obLista->ultimoDado->setCampo( "[numcgm] - [nom_cgm]" ); $obLista->ultimoDado->setAlinhamento( 'ESQUERDA' ); $obLista->commitDado(); $obLista->addDado(); $obLista->ultimoDado->setCampo( "[codigo] - [descricao]" ); $obLista->ultimoDado->setAlinhamento( 'ESQUERDA' ); $obLista->commitDado(); $obLista->addAcao(); $obLista->ultimaAcao->setAcao( "EXCLUIR" ); $obLista->ultimaAcao->setFuncao( true ); $obLista->ultimaAcao->setLink( "javascript: executaFuncaoAjax('delPlano');" ); $obLista->ultimaAcao->addCampo("","&numcgm=[numcgm]&codigo=[codigo]"); $obLista->commitAcao(); $obLista->montaHTML(); $html = $obLista->getHTML(); $html = str_replace("\n","",$html); $html = str_replace(" ","",$html); $html = str_replace("'","\\'",$html); $stJs .= "d.getElementById('spnLista').innerHTML = '';\n"; $stJs .= "d.getElementById('spnLista').innerHTML = '".$html."';\n"; $stJs .= "d.getElementById('inCGMFornecedor').value = '';\n"; $stJs .= "d.getElementById('stCGMFornecedor').innerHTML = ' ';\n"; $stJs .= "d.getElementById('inCodigoEventoSaude').value = '';\n"; $stJs .= "d.getElementById('stEventoSaude').innerHTML = ' ';\n"; return $stJs; } function carregaPlanos() { } $arPlanos = Sessao::read('arPlanos'); $stJs = ''; switch ($stCtrl) { case 'incluirPlano': $stMensagem = ''; if(is_array($arPlanos)) { foreach($arPlanos as $registro) { if($registro['codigo'] == $_REQUEST['inCodigoEventoSaude']) { $stMensagem = 'Este evento já foi inserido'; } } } if ($stMensagem == '') { $obTCGM = new TCGM(); $obTCGM->setDado('numcgm', $_REQUEST['inCGMFornecedor']); $obTCGM->recuperaPorChave($rsCgm); $obTFolhaPagamentoEvento = new TFolhaPagamentoEvento(); $obTFolhaPagamentoEvento->recuperaEventos($rsEvento, " AND FPE.codigo = '".$_REQUEST['inCodigoEventoSaude']."'"); $arRegistro['numcgm'] = $rsCgm->getCampo('numcgm'); $arRegistro['nom_cgm' ] = $rsCgm->getCampo('nom_cgm'); $arRegistro['codigo'] = $rsEvento->getCampo('codigo'); $arRegistro['descricao'] = $rsEvento->getCampo('descricao'); $arPlanos[] = $arRegistro ; Sessao::write('arPlanos', $arPlanos); $stJs = listaPlanos(); } else { $stJs.= "alertaAviso('$stMensagem','form','erro','".Sessao::getId()."');\n"; } break; case 'carregaPlanos': $rsPlanos = new RecordSet; $arPlanos = array(); $arRegistro = array(); $rsRegistro = new RecordSet; include_once CAM_GRH_FOL_MAPEAMENTO."TFolhaPagamentoBeneficioEvento.class.php"; $obTFolhaPagamentoBeneficioEvento = new TFolhaPagamentoBeneficioEvento; $obTFolhaPagamentoBeneficioEvento->recuperaRelacionamento($rsBeneficioEvento); include_once CAM_GRH_FOL_MAPEAMENTO."TFolhaPagamentoConfiguracaoBeneficioFornecedor.class.php"; $obTFolhaPagamentoConfiguracaoBeneficioFornecedor = new TFolhaPagamentoConfiguracaoBeneficioFornecedor; if ($rsBeneficioEvento->getNumLinhas() > 0) { $obTFolhaPagamentoConfiguracaoBeneficioFornecedor->recuperaRelacionamento($rsRegistro, " AND configuracao_beneficio.timestamp = '".$rsBeneficioEvento->getCampo('timestamp')."'"); } while (!$rsRegistro->eof()) { $registro['numcgm'] = $rsRegistro->getCampo ( 'numcgm' ); $registro['nom_cgm'] = $rsRegistro->getCampo ( 'nom_cgm' ); $registro['codigo'] = $rsRegistro->getCampo ( 'codigo' ); $registro['descricao'] = $rsRegistro->getCampo ( 'descricao' ); $arPlanos[] = $registro ; $rsRegistro->proximo(); } Sessao::write('arPlanos', $arPlanos); $stJs = listaPlanos(); break; case 'delPlano': foreach ($arPlanos as $registro) { if ($registro['numcgm'].$registro['codigo'] != $_GET['numcgm'].$_GET['codigo']) { $arTempPlano[] = $registro; } } Sessao::write('arPlanos', $arTempPlano); $stJs = listaPlanos(); break; } if ($stJs) { echo $stJs; }