From dc3a631a3a38a0786e3daf2fb0d38a10394c24d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Sim=C3=A3o?= Date: Wed, 5 Sep 2007 10:13:22 +0000 Subject: [PATCH] git-svn-id: https://svn.coded.pt/svn/SIPRP@543 bb69d46d-e84e-40c8-a05a-06db0d633741 --- tags/teg/.classpath | 9 + tags/teg/.project | 17 + tags/teg/SIPRPSoft/src/alter3.sql | 32 + tags/teg/SIPRPSoft/src/alter_20060516.sql | 2 + tags/teg/SIPRPSoft/src/alter_20070124.sql | 154 ++ tags/teg/SIPRPSoft/src/alter_20070221.sql | 3 + tags/teg/SIPRPSoft/src/build.xml | 90 + tags/teg/SIPRPSoft/src/jpox_siprp.bat | 7 + tags/teg/SIPRPSoft/src/jpox_siprp.sh | 7 + tags/teg/SIPRPSoft/src/jws/siprp.jnlp | 41 + tags/teg/SIPRPSoft/src/log4j.properties | 3 + tags/teg/SIPRPSoft/src/logo/logo_combo.jpg | Bin 0 -> 15060 bytes tags/teg/SIPRPSoft/src/logo/logo_w400.jpg | Bin 0 -> 27587 bytes tags/teg/SIPRPSoft/src/logo/logo_w400.png | Bin 0 -> 17622 bytes tags/teg/SIPRPSoft/src/logo_combo.jpg | Bin 0 -> 15060 bytes tags/teg/SIPRPSoft/src/logo_evo.jpg | Bin 0 -> 3073 bytes .../src/siprp/CompanyDataLoader.java | 20 + .../src/siprp/FichaDataProvider.java | 698 ++++++++ tags/teg/SIPRPSoft/src/siprp/Main.java | 285 ++++ tags/teg/SIPRPSoft/src/siprp/SHSTLogger.java | 112 ++ .../teg/SIPRPSoft/src/siprp/SIPRPTracker.java | 267 +++ .../src/siprp/SingletonConstants.java | 59 + .../src/siprp/clientes/AvisosPanel.java | 589 +++++++ .../siprp/clientes/ClientesDataProvider.java | 210 +++ .../src/siprp/clientes/ClientesWindow.java | 1435 ++++++++++++++++ .../src/siprp/clientes/ContactoPanel.java | 181 ++ .../src/siprp/clientes/EmpresaPanel.java | 956 +++++++++++ .../siprp/clientes/EstabelecimentoPanel.java | 450 +++++ .../siprp/clientes/EtiquetaChooserDialog.java | 89 + .../src/siprp/clientes/EtiquetaPrinter.java | 200 +++ .../HistoricoEstabelecimentoPanel.java | 276 ++++ .../siprp/clientes/MarcacaoEmpresaPanel.java | 288 ++++ .../src/siprp/clientes/MarcacaoPanel.java | 594 +++++++ .../siprp/clientes/NoticiasDataProvider.java | 96 ++ .../src/siprp/clientes/NoticiasDialog.java | 101 ++ .../siprp/clientes/PerfilProtocoloPanel.java | 153 ++ .../src/siprp/clientes/ProtocoloPanel.java | 111 ++ .../src/siprp/clientes/TrabalhadorPanel.java | 612 +++++++ .../src/siprp/clientes/UserDataProvider.java | 156 ++ .../src/siprp/clientes/UserPanel.java | 232 +++ .../src/siprp/clientes/UserWindow.java | 66 + .../SIPRPSoft/src/siprp/clientes/etiqueta.xsl | 91 + .../src/siprp/clientes/etiquetas.dtd | 16 + .../ClinicaAvenidaDataLoader.java | 91 + .../companydataloaders/IBookDataLoader.java | 105 ++ .../companydataloaders/SIPRPDataLoader.java | 123 ++ .../siprp/data/ActualizacaoSaveHandler.java | 51 + .../src/siprp/data/ActualizacaoSaveable.java | 16 + tags/teg/SIPRPSoft/src/siprp/data/Aviso.java | 186 +++ .../src/siprp/data/AvisoConstants.java | 18 + .../SIPRPSoft/src/siprp/data/AvisoData.java | 68 + .../teg/SIPRPSoft/src/siprp/data/AvisoID.java | 22 + .../SIPRPSoft/src/siprp/data/Contacto.java | 152 ++ .../src/siprp/data/ContactoData.java | 63 + .../SIPRPSoft/src/siprp/data/ContactoID.java | 22 + .../src/siprp/data/DisableDeleteHandler.java | 70 + .../src/siprp/data/DisableDeleteable.java | 16 + .../teg/SIPRPSoft/src/siprp/data/Empresa.java | 747 +++++++++ .../SIPRPSoft/src/siprp/data/EmpresaData.java | 114 ++ .../SIPRPSoft/src/siprp/data/EmpresaID.java | 25 + .../src/siprp/data/Estabelecimento.java | 220 +++ .../src/siprp/data/EstabelecimentoData.java | 69 + .../src/siprp/data/EstabelecimentoID.java | 25 + .../SIPRPSoft/src/siprp/data/Etiqueta.java | 270 +++ .../src/siprp/data/EtiquetaData.java | 74 + .../SIPRPSoft/src/siprp/data/EtiquetaID.java | 25 + tags/teg/SIPRPSoft/src/siprp/data/Exame.java | 322 ++++ .../SIPRPSoft/src/siprp/data/ExameData.java | 78 + .../teg/SIPRPSoft/src/siprp/data/ExameID.java | 22 + .../SIPRPSoft/src/siprp/data/Historico.java | 58 + .../siprp/data/HistoricoEstabelecimento.java | 101 ++ .../data/HistoricoEstabelecimentoData.java | 60 + .../data/HistoricoEstabelecimentoID.java | 22 + .../SIPRPSoft/src/siprp/data/Marcacao.java | 352 ++++ .../src/siprp/data/MarcacaoEmpresa.java | 118 ++ .../src/siprp/data/MarcacaoEmpresaData.java | 61 + .../src/siprp/data/MarcacaoEmpresaID.java | 22 + .../siprp/data/MarcacaoEstabelecimento.java | 186 +++ .../data/MarcacaoEstabelecimentoData.java | 67 + .../siprp/data/MarcacaoEstabelecimentoID.java | 25 + .../src/siprp/data/MarcacaoListLoader.java | 80 + .../data/MarcacaoSaveAndDeleteHandler.java | 258 +++ .../src/siprp/data/MarcacaoTrabalhador.java | 203 +++ .../data/MarcacaoTrabalhadorConstants.java | 17 + .../siprp/data/MarcacaoTrabalhadorData.java | 69 + .../src/siprp/data/MarcacaoTrabalhadorID.java | 25 + tags/teg/SIPRPSoft/src/siprp/data/Medico.java | 100 ++ .../SIPRPSoft/src/siprp/data/MedicoData.java | 61 + .../SIPRPSoft/src/siprp/data/MedicoID.java | 22 + .../src/siprp/data/SearchExecuterFactory.java | 180 ++ .../SIPRPSoft/src/siprp/data/TecnicoHST.java | 134 ++ .../src/siprp/data/TecnicoHSTData.java | 63 + .../src/siprp/data/TecnicoHSTID.java | 25 + .../SIPRPSoft/src/siprp/data/Trabalhador.java | 356 ++++ .../src/siprp/data/TrabalhadorData.java | 82 + .../src/siprp/data/TrabalhadorID.java | 25 + tags/teg/SIPRPSoft/src/siprp/data/package.jdo | 1122 +++++++++++++ .../estatistica/EstatisticaDataProvider.java | 777 +++++++++ .../siprp/estatistica/EstatisticaWindow.java | 1324 +++++++++++++++ .../estatisticas/EstatisticasWindow.java | 36 + .../src/siprp/ficha/EmpresaPanel.java | 492 ++++++ .../SIPRPSoft/src/siprp/ficha/ExamePDF.java | 461 ++++++ .../SIPRPSoft/src/siprp/ficha/ExamePanel.java | 527 ++++++ .../siprp/ficha/FichaAptidaoConstants.java | 74 + .../src/siprp/ficha/FichaAptidaoCreator.java | 102 ++ .../ficha/FichaAptidaoEditorManager.java | 204 +++ .../FichaAptidaoEditorManagerFactory.java | 38 + .../src/siprp/ficha/FichaWindow.java | 860 ++++++++++ .../siprp/ficha/MedicoColumnizedObject.java | 46 + .../src/siprp/ficha/MedicoEditor.java | 270 +++ .../src/siprp/ficha/ObservacoesPanel.java | 101 ++ .../src/siprp/ficha/RecomendacoesPanel.java | 59 + .../src/siprp/ficha/SaveExameListener.java | 19 + .../src/siprp/ficha/TrabalhadorPanel.java | 477 ++++++ .../SIPRPSoft/src/siprp/ficha/UpperPanel.java | 294 ++++ .../src/siprp/ficha/ValuesException.java | 22 + .../src/siprp/ficha/ficha_aptidao.xsl | 323 ++++ .../src/siprp/ficha/svg/char_square_pure.svg | 24 + .../src/siprp/ficha/svg/char_tick_pure.svg | 24 + .../siprp/higiene/HigieneDataProvider.java | 255 +++ .../SIPRPSoft/src/siprp/higiene/alter2.sql | 18 + .../src/siprp/higiene/mapa/DiaLine.java | 62 + .../src/siprp/higiene/mapa/DiaPanel.java | 101 ++ .../src/siprp/higiene/mapa/DiaRenderer.java | 65 + .../siprp/higiene/mapa/MapaHigienePanel.java | 112 ++ .../siprp/higiene/mapa/MapaHigieneWindow.java | 139 ++ .../src/siprp/higiene/mapa/TecnicosPanel.java | 63 + .../marcacoes/CorTecnicoCellRenderer.java | 41 + .../marcacoes/MarcacaoVisitaHSTPanel.java | 307 ++++ .../marcacoes/MarcacaoVisitaHSTPanel.xml | 93 ++ .../marcacoes/MarcacoesHigieneUpperPanel.java | 199 +++ .../marcacoes/MarcacoesHigieneWindow.java | 519 ++++++ .../higiene/marcacoes/TecnicoEditor.java | 317 ++++ .../higiene/marcacoes/TecnicoRenderer.java | 58 + .../src/siprp/importer/DataChooserWindow.java | 190 +++ .../src/siprp/importer/Importer.java | 363 ++++ .../siprp/impressaofichas/FichasPrinter.java | 146 ++ .../ImpressaoFichasDataProvider.java | 217 +++ .../ImpressaoFichasWindow.java | 422 +++++ .../siprp/impressaofichas/lista_fichas.xsl | 74 + .../src/siprp/lembretes/Lembrete.java | 194 +++ .../siprp/lembretes/LembretesConstants.java | 26 + .../lembretes/LembretesDataProvider.java | 245 +++ .../src/siprp/lembretes/LembretesPanel.java | 31 + .../src/siprp/lembretes/LembretesWindow.java | 190 +++ .../src/siprp/lembretes/TipoLembrete.java | 65 + .../remarcacoes/LembretesRemarcacaoPanel.java | 88 + .../remarcacoes/RemarcacoesActionFactory.java | 57 + .../remarcacoes/RemarcacoesDataProvider.java | 124 ++ .../TratarMarcacaoEstabelecimentoAction.java | 42 + .../TratarMarcacaoTrabalhadorAction.java | 88 + .../MarcacaoConsultaExtendedPanel.java | 31 + .../siprp/medicina/MarcacaoConsultaPanel.java | 303 ++++ .../siprp/medicina/MarcacaoConsultaPanel.xml | 100 ++ .../siprp/medicina/MarcacaoExamePanel.java | 262 +++ .../src/siprp/medicina/MarcacaoExamePanel.xml | 78 + .../medicina/MarcacoesMedicinaHandler.java | 93 ++ .../src/siprp/medicina/MedicinaConstants.java | 75 + .../siprp/medicina/MedicinaDataProvider.java | 462 ++++++ .../siprp/medicina/MedicinaUpperPanel.java | 253 +++ .../src/siprp/medicina/MedicinaWindow.java | 686 ++++++++ .../SIPRPSoft/src/siprp/medicina/Test.java | 38 + .../SIPRPSoft/src/siprp/medicina/alter.sql | 159 ++ .../locais_realizacao/FaxPrinter.java | 177 ++ .../LocaisRealizacaoDataProvider.java | 196 +++ .../LocaisRealizacaoWindow.java | 548 ++++++ .../medicina/locais_realizacao/fax_ecds.xsl | 313 ++++ .../locais_realizacao/fax_ecds_teste.xml | 234 +++ .../presencas/DetalhesRealizacaoDialog.java | 103 ++ .../presencas/ImpressaoAuxiliaresWindow.java | 40 + .../siprp/medicina/presencas/Presenca.java | 107 ++ .../presencas/PresencasActionFactory.java | 80 + .../presencas/PresencasDataProvider.java | 191 +++ .../presencas/RegistarPresencasWindow.java | 360 ++++ .../actions/DesmarcadoSHSTAction.java | 58 + .../actions/DesmarcadoTrabalhadorAction.java | 47 + .../presencas/actions/FaltouAction.java | 57 + .../presencas/actions/RealizouAction.java | 107 ++ .../actions/RealizouParcialmenteAction.java | 84 + .../siprp/medicina/presencas/auxiliares.xml | 35 + .../siprp/medicina/presencas/auxiliares.xsl | 110 ++ .../prestadores/PrestadoresDataProvider.java | 237 +++ .../prestadores/PrestadoresWindow.java | 259 +++ .../prestadores/data/Prestadores.java | 236 +++ .../prestadores/data/PrestadoresData.java | 70 + .../prestadores/data/PrestadoresID.java | 25 + .../medicina/prestadores/data/package.jdo | 70 + .../processo/EscolherMotivoDialog.java | 183 +++ .../medicina/processo/ProcessoConstants.java | 30 + .../medicina/processo/ProcessoController.java | 405 +++++ .../processo/ProcessoDataProvider.java | 616 +++++++ .../medicina/processo/ProcessoEvent.java | 74 + .../medicina/processo/ProcessoListener.java | 19 + .../medicina/processo/ProcessoPanel.java | 415 +++++ .../medicina/processo/ProcessoUpperPanel.java | 254 +++ .../medicina/processo/ProcessoWindow.java | 97 ++ .../processo/data/TrabalhadoresConsultas.java | 135 ++ .../data/TrabalhadoresConsultasData.java | 62 + .../data/TrabalhadoresConsultasDatas.java | 101 ++ .../data/TrabalhadoresConsultasDatasData.java | 60 + .../TrabalhadoresConsultasDatasEmails.java | 135 ++ ...TrabalhadoresConsultasDatasEmailsData.java | 62 + .../TrabalhadoresConsultasDatasEmailsID.java | 25 + .../data/TrabalhadoresConsultasDatasID.java | 25 + ...rabalhadoresConsultasDatasObservacoes.java | 83 + ...lhadoresConsultasDatasObservacoesData.java | 59 + ...balhadoresConsultasDatasObservacoesID.java | 25 + .../data/TrabalhadoresConsultasID.java | 25 + .../processo/data/TrabalhadoresEcd.java | 151 ++ .../processo/data/TrabalhadoresEcdData.java | 65 + .../processo/data/TrabalhadoresEcdID.java | 25 + .../processo/data/TrabalhadoresEcds.java | 118 ++ .../processo/data/TrabalhadoresEcdsData.java | 61 + .../processo/data/TrabalhadoresEcdsDatas.java | 101 ++ .../data/TrabalhadoresEcdsDatasData.java | 60 + .../data/TrabalhadoresEcdsDatasEmails.java | 135 ++ .../TrabalhadoresEcdsDatasEmailsData.java | 62 + .../data/TrabalhadoresEcdsDatasEmailsID.java | 25 + .../data/TrabalhadoresEcdsDatasID.java | 25 + .../TrabalhadoresEcdsDatasObservacoes.java | 83 + ...TrabalhadoresEcdsDatasObservacoesData.java | 59 + .../TrabalhadoresEcdsDatasObservacoesID.java | 25 + .../processo/data/TrabalhadoresEcdsID.java | 25 + .../data/TrabalhadoresFichasAptidao.java | 83 + .../data/TrabalhadoresFichasAptidaoData.java | 59 + .../data/TrabalhadoresFichasAptidaoID.java | 25 + .../processo/data/TrabalhadoresProcesso.java | 152 ++ .../data/TrabalhadoresProcessoData.java | 63 + .../data/TrabalhadoresProcessoID.java | 25 + .../siprp/medicina/processo/data/package.jdo | 304 ++++ .../processo/detalhes/ConsultaPanel.java | 360 ++++ .../detalhes/DetalhesProcessoPanel.java | 101 ++ .../medicina/processo/detalhes/ECDsPanel.java | 366 +++++ .../processo/detalhes/EstadoChooser.java | 96 ++ .../processo/detalhes/ObservacoesDialog.java | 116 ++ .../estrutura/ConsultaMutableTreeNode.java | 30 + .../estrutura/DataMutableTreeNode.java | 30 + .../estrutura/ECDsMutableTreeNode.java | 30 + .../EstruturaProcessoMutableTreeNode.java | 79 + .../estrutura/EstruturaProcessoPanel.java | 421 +++++ .../estrutura/EstruturaProcessoRenderer.java | 51 + .../FichaAptidaoMutableTreeNode.java | 30 + .../estrutura/MailMutableTreeNode.java | 30 + .../estrutura/MarcacaoMutableTreeNode.java | 59 + .../estrutura/ObservacoesMutableTreeNode.java | 30 + .../estrutura/ProcessoMutableTreeNode.java | 30 + .../estrutura/TrabalhadorMutableTreeNode.java | 31 + .../processo/estrutura/icons/consulta.png | Bin 0 -> 5017 bytes .../processo/estrutura/icons/data.png | Bin 0 -> 5599 bytes .../processo/estrutura/icons/ecds.png | Bin 0 -> 6286 bytes .../processo/estrutura/icons/fichaaptidao.png | Bin 0 -> 5335 bytes .../processo/estrutura/icons/mail.png | Bin 0 -> 5376 bytes .../processo/estrutura/icons/observacoes.png | Bin 0 -> 4463 bytes .../processo/estrutura/icons/processo.png | Bin 0 -> 5364 bytes .../processo/estrutura/icons/trabalhador.png | Bin 0 -> 5377 bytes .../medicina/processo/icons/consulta.png | Bin 0 -> 5017 bytes .../siprp/medicina/processo/icons/ecds.png | Bin 0 -> 6286 bytes .../medicina/processo/icons/fichaaptidao.png | Bin 0 -> 5335 bytes .../siprp/medicina/processo/icons/lock.png | Bin 0 -> 33413 bytes .../siprp/pesquisas/PesquisasProvider.java | 751 +++++++++ .../src/siprp/pesquisas/PesquisasWindow.java | 578 +++++++ .../SIPRPSoft/src/siprp/update/Update.java | 22 + .../src/siprp/update/UpdateList.java | 106 ++ .../src/siprp/update/UpdateWindow.java | 188 +++ .../siprp/update/updates/V6_1_To_V7_0.java | 68 + .../siprp/update/updates/V7_0_To_V7_2.java | 75 + .../siprp/update/updates/V7_2_To_V7_4.java | 210 +++ .../siprp/update/updates/V7_4_To_V7_5.java | 73 + .../siprp/update/updates/V7_5_To_V7_6.java | 63 + .../siprp/update/updates/V7_6_To_V7_7.java | 71 + .../SIPRPSoft/src/siprp/web/WebUpdater.java | 1210 ++++++++++++++ tags/teg/SIPRPSoft/src/siprp_create.sql | 569 +++++++ tags/teg/SIPRPSoft/src/speedo.properties | 259 +++ tags/teg/SIPRPSoft/src/updtprop.txt | 7 + tags/teg/web/src/META-INF/context.xml | 2 + .../classes/siprp/pagina/GlobalConstants.java | 38 + .../classes/siprp/pagina/MailerServlet.java | 240 +++ .../classes/siprp/pagina/NewsServlet.java | 168 ++ .../classes/siprp/pagina/RecruitServlet.java | 127 ++ .../siprp/pagina/RelatorioServlet.java | 121 ++ .../classes/siprp/pagina/RequestServlet.java | 63 + .../classes/siprp/pagina/ScheduleServlet.java | 142 ++ .../siprp/pagina/doGetListaEmpresas.java | 113 ++ .../pagina/doGetListaEstabelecimentos.java | 105 ++ .../siprp/pagina/doGetListaTrabalhadores.java | 299 ++++ .../doGetListaTrabalhadoresPendentes.java | 879 ++++++++++ .../pagina/doGetListaTrabalhadoresTudo.java | 255 +++ .../siprp/pagina/doGetTrabalhador.java | 324 ++++ .../classes/siprp/pagina/doPostLogin.java | 122 ++ .../classes/siprp/pagina/siprpServlet.java | 648 ++++++++ tags/teg/web/src/WEB-INF/web.xml | 46 + tags/teg/web/src/html/clientes.html | 47 + tags/teg/web/src/html/colaboradores.html | 50 + tags/teg/web/src/html/contactos.html | 52 + .../html/conteudos/colaboradores_text.html | 111 ++ .../src/html/conteudos/contactos_text.html | 105 ++ .../html/conteudos/higiene_foto_equip_BA.html | 29 + .../web/src/html/conteudos/higiene_text.html | 59 + .../html/conteudos/higiene_text_equip.html | 36 + .../web/src/html/conteudos/links_text.html | 104 ++ .../web/src/html/conteudos/medicina_text.html | 32 + .../web/src/html/conteudos/politica_text.html | 69 + .../conteudos/politica_text_20050106.html | 59 + .../html/conteudos/servicos_compl_text.html | 71 + .../servicos_compl_text_20050106.html | 71 + .../web/src/html/conteudos/siprp_text.html | 28 + .../html/conteudos/siprp_text_inovacao.html | 22 + tags/teg/web/src/html/css/funcs.js | 64 + tags/teg/web/src/html/css/style.css | 129 ++ tags/teg/web/src/html/erro.html | 44 + tags/teg/web/src/html/frame_erro.html | 254 +++ tags/teg/web/src/html/higiene.html | 52 + tags/teg/web/src/html/index.html | 229 +++ tags/teg/web/src/html/links.html | 52 + tags/teg/web/src/html/mail/cv_enviado.html | 11 + .../teg/web/src/html/mail/cv_nao_enviado.html | 12 + tags/teg/web/src/html/mail/envio_cv.txt | 7 + .../teg/web/src/html/mail/pedido_enviado.html | 11 + .../web/src/html/mail/pedido_informacao.txt | 5 + .../web/src/html/mail/pedido_nao_enviado.html | 11 + .../web/src/html/marcacao/CalendarPopup.js | 1462 +++++++++++++++++ tags/teg/web/src/html/marcacao/marcacao.html | 14 + .../src/html/marcacao/marcacao_consulta.html | 49 + .../src/html/marcacao/marcacao_enviada.html | 11 + .../web/src/html/marcacao/marcacao_exame.html | 43 + .../web/src/html/marcacao/marcacao_menu.html | 62 + .../html/marcacao/marcacao_nao_enviada.html | 11 + .../marcacao/marcacao_sessao_expirou.html | 11 + tags/teg/web/src/html/medicina.html | 52 + .../src/html/noticias/mostrar_noticias.html | 11 + tags/teg/web/src/html/politica.html | 52 + tags/teg/web/src/html/relatorio/pedido.html | 9 + .../src/html/relatorio/pedido_enviado.html | 11 + .../html/relatorio/pedido_nao_enviado.html | 11 + .../src/html/relatorio/pedido_relatorio.html | 35 + .../html/relatorio/pedido_sessao_expirou.html | 11 + tags/teg/web/src/html/servicos.html | 31 + tags/teg/web/src/html/servicos_compl.html | 52 + tags/teg/web/src/html/siprp.html | 52 + tags/teg/web/src/html/user.html | 396 +++++ tags/teg/web/src/html/user_print.html | 284 ++++ tags/teg/web/src/missing | 4 + 342 files changed, 52298 insertions(+) create mode 100644 tags/teg/.classpath create mode 100644 tags/teg/.project create mode 100644 tags/teg/SIPRPSoft/src/alter3.sql create mode 100644 tags/teg/SIPRPSoft/src/alter_20060516.sql create mode 100644 tags/teg/SIPRPSoft/src/alter_20070124.sql create mode 100644 tags/teg/SIPRPSoft/src/alter_20070221.sql create mode 100644 tags/teg/SIPRPSoft/src/build.xml create mode 100644 tags/teg/SIPRPSoft/src/jpox_siprp.bat create mode 100644 tags/teg/SIPRPSoft/src/jpox_siprp.sh create mode 100644 tags/teg/SIPRPSoft/src/jws/siprp.jnlp create mode 100644 tags/teg/SIPRPSoft/src/log4j.properties create mode 100644 tags/teg/SIPRPSoft/src/logo/logo_combo.jpg create mode 100644 tags/teg/SIPRPSoft/src/logo/logo_w400.jpg create mode 100644 tags/teg/SIPRPSoft/src/logo/logo_w400.png create mode 100644 tags/teg/SIPRPSoft/src/logo_combo.jpg create mode 100644 tags/teg/SIPRPSoft/src/logo_evo.jpg create mode 100644 tags/teg/SIPRPSoft/src/siprp/CompanyDataLoader.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/FichaDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/Main.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/SHSTLogger.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/SIPRPTracker.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/SingletonConstants.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/AvisosPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/ClientesDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/ClientesWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/ContactoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/EmpresaPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/EstabelecimentoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaChooserDialog.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaPrinter.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/HistoricoEstabelecimentoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoEmpresaPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDialog.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/PerfilProtocoloPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/ProtocoloPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/TrabalhadorPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/UserDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/UserPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/UserWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/etiqueta.xsl create mode 100644 tags/teg/SIPRPSoft/src/siprp/clientes/etiquetas.dtd create mode 100644 tags/teg/SIPRPSoft/src/siprp/companydataloaders/ClinicaAvenidaDataLoader.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/companydataloaders/IBookDataLoader.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/companydataloaders/SIPRPDataLoader.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveHandler.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveable.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Aviso.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/AvisoConstants.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/AvisoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/AvisoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Contacto.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/ContactoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/ContactoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteHandler.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteable.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Empresa.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/EmpresaData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/EmpresaID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Estabelecimento.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Etiqueta.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/EtiquetaData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/EtiquetaID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Exame.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/ExameData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/ExameID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Historico.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimento.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Marcacao.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresa.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimento.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoListLoader.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoSaveAndDeleteHandler.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhador.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorConstants.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Medico.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MedicoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/MedicoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/SearchExecuterFactory.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/TecnicoHST.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/Trabalhador.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/data/package.jdo create mode 100644 tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/estatisticas/EstatisticasWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/EmpresaPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/ExamePDF.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/ExamePanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoConstants.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoCreator.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManager.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManagerFactory.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/FichaWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/MedicoColumnizedObject.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/MedicoEditor.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/ObservacoesPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/RecomendacoesPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/SaveExameListener.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/UpperPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/ValuesException.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/ficha_aptidao.xsl create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_square_pure.svg create mode 100644 tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_tick_pure.svg create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/alter2.sql create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/CorTecnicoCellRenderer.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.xml create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneUpperPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoEditor.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoRenderer.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/importer/DataChooserWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/importer/Importer.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/impressaofichas/FichasPrinter.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/impressaofichas/lista_fichas.xsl create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/Lembrete.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesConstants.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/TipoLembrete.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/LembretesRemarcacaoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesActionFactory.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoEstabelecimentoAction.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoTrabalhadorAction.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaExtendedPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.xml create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.xml create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MarcacoesMedicinaHandler.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaConstants.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaUpperPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/Test.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/alter.sql create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/FaxPrinter.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds.xsl create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds_teste.xml create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/DetalhesRealizacaoDialog.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/ImpressaoAuxiliaresWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/Presenca.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasActionFactory.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/RegistarPresencasWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoSHSTAction.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoTrabalhadorAction.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/FaltouAction.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouAction.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouParcialmenteAction.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xml create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xsl create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/Prestadores.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/package.jdo create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/EscolherMotivoDialog.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoConstants.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoController.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoDataProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoEvent.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoListener.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoUpperPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultas.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatas.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmails.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoes.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcd.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcds.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatas.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmails.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoes.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidao.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcesso.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoData.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoID.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/package.jdo create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ConsultaPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/DetalhesProcessoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ECDsPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/EstadoChooser.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ObservacoesDialog.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ConsultaMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/DataMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ECDsMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoPanel.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoRenderer.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/FichaAptidaoMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MailMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MarcacaoMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ObservacoesMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ProcessoMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/TrabalhadorMutableTreeNode.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/consulta.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/data.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/ecds.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/fichaaptidao.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/mail.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/observacoes.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/processo.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/trabalhador.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/consulta.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/ecds.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/fichaaptidao.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/lock.png create mode 100644 tags/teg/SIPRPSoft/src/siprp/pesquisas/PesquisasProvider.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/pesquisas/PesquisasWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/Update.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/UpdateList.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/UpdateWindow.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/updates/V6_1_To_V7_0.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/updates/V7_0_To_V7_2.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/updates/V7_2_To_V7_4.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/updates/V7_4_To_V7_5.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/updates/V7_5_To_V7_6.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/update/updates/V7_6_To_V7_7.java create mode 100644 tags/teg/SIPRPSoft/src/siprp/web/WebUpdater.java create mode 100644 tags/teg/SIPRPSoft/src/siprp_create.sql create mode 100644 tags/teg/SIPRPSoft/src/speedo.properties create mode 100644 tags/teg/SIPRPSoft/src/updtprop.txt create mode 100644 tags/teg/web/src/META-INF/context.xml create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/GlobalConstants.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/MailerServlet.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/NewsServlet.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/RecruitServlet.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/RelatorioServlet.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/RequestServlet.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/ScheduleServlet.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresPendentes.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresTudo.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/doPostLogin.java create mode 100644 tags/teg/web/src/WEB-INF/classes/siprp/pagina/siprpServlet.java create mode 100644 tags/teg/web/src/WEB-INF/web.xml create mode 100644 tags/teg/web/src/html/clientes.html create mode 100644 tags/teg/web/src/html/colaboradores.html create mode 100644 tags/teg/web/src/html/contactos.html create mode 100644 tags/teg/web/src/html/conteudos/colaboradores_text.html create mode 100644 tags/teg/web/src/html/conteudos/contactos_text.html create mode 100644 tags/teg/web/src/html/conteudos/higiene_foto_equip_BA.html create mode 100644 tags/teg/web/src/html/conteudos/higiene_text.html create mode 100644 tags/teg/web/src/html/conteudos/higiene_text_equip.html create mode 100644 tags/teg/web/src/html/conteudos/links_text.html create mode 100644 tags/teg/web/src/html/conteudos/medicina_text.html create mode 100644 tags/teg/web/src/html/conteudos/politica_text.html create mode 100644 tags/teg/web/src/html/conteudos/politica_text_20050106.html create mode 100644 tags/teg/web/src/html/conteudos/servicos_compl_text.html create mode 100644 tags/teg/web/src/html/conteudos/servicos_compl_text_20050106.html create mode 100644 tags/teg/web/src/html/conteudos/siprp_text.html create mode 100644 tags/teg/web/src/html/conteudos/siprp_text_inovacao.html create mode 100644 tags/teg/web/src/html/css/funcs.js create mode 100644 tags/teg/web/src/html/css/style.css create mode 100644 tags/teg/web/src/html/erro.html create mode 100644 tags/teg/web/src/html/frame_erro.html create mode 100644 tags/teg/web/src/html/higiene.html create mode 100644 tags/teg/web/src/html/index.html create mode 100644 tags/teg/web/src/html/links.html create mode 100644 tags/teg/web/src/html/mail/cv_enviado.html create mode 100644 tags/teg/web/src/html/mail/cv_nao_enviado.html create mode 100644 tags/teg/web/src/html/mail/envio_cv.txt create mode 100644 tags/teg/web/src/html/mail/pedido_enviado.html create mode 100644 tags/teg/web/src/html/mail/pedido_informacao.txt create mode 100644 tags/teg/web/src/html/mail/pedido_nao_enviado.html create mode 100644 tags/teg/web/src/html/marcacao/CalendarPopup.js create mode 100644 tags/teg/web/src/html/marcacao/marcacao.html create mode 100644 tags/teg/web/src/html/marcacao/marcacao_consulta.html create mode 100644 tags/teg/web/src/html/marcacao/marcacao_enviada.html create mode 100644 tags/teg/web/src/html/marcacao/marcacao_exame.html create mode 100644 tags/teg/web/src/html/marcacao/marcacao_menu.html create mode 100644 tags/teg/web/src/html/marcacao/marcacao_nao_enviada.html create mode 100644 tags/teg/web/src/html/marcacao/marcacao_sessao_expirou.html create mode 100644 tags/teg/web/src/html/medicina.html create mode 100644 tags/teg/web/src/html/noticias/mostrar_noticias.html create mode 100644 tags/teg/web/src/html/politica.html create mode 100644 tags/teg/web/src/html/relatorio/pedido.html create mode 100644 tags/teg/web/src/html/relatorio/pedido_enviado.html create mode 100644 tags/teg/web/src/html/relatorio/pedido_nao_enviado.html create mode 100644 tags/teg/web/src/html/relatorio/pedido_relatorio.html create mode 100644 tags/teg/web/src/html/relatorio/pedido_sessao_expirou.html create mode 100644 tags/teg/web/src/html/servicos.html create mode 100644 tags/teg/web/src/html/servicos_compl.html create mode 100644 tags/teg/web/src/html/siprp.html create mode 100644 tags/teg/web/src/html/user.html create mode 100644 tags/teg/web/src/html/user_print.html create mode 100644 tags/teg/web/src/missing diff --git a/tags/teg/.classpath b/tags/teg/.classpath new file mode 100644 index 00000000..884a915d --- /dev/null +++ b/tags/teg/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/tags/teg/.project b/tags/teg/.project new file mode 100644 index 00000000..200965fb --- /dev/null +++ b/tags/teg/.project @@ -0,0 +1,17 @@ + + + SIPRP + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/tags/teg/SIPRPSoft/src/alter3.sql b/tags/teg/SIPRPSoft/src/alter3.sql new file mode 100644 index 00000000..4bfea09d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/alter3.sql @@ -0,0 +1,32 @@ +UPDATE trabalhadores SET perfil=1 WHERE perfil IS NULL; +UPDATE marcacoes_trabalhador SET motivo = + ( SELECT tipo FROM exames WHERE exames.trabalhador_id = marcacoes_trabalhador.trabalhador_id AND + exames.data = marcacoes_trabalhador.data ) +WHERE motivo IS NULL AND realizada = 'y'; + +CREATE TABLE etiquetas +( + id serial NOT NULL, + descricao varchar(255) NOT NULL, + descricao_plain varchar, + altura float4, + largura float4, + margem_esquerda float4, + margem_cima float4, + colunas int4, + linhas int4, + continua char(1) NOT NULL DEFAULT 'n'::bpchar, + altura_folha float4, + largura_folha float4, + margem_vertical_folha float4, + margem_horizontal_folha float4, + CONSTRAINT etiquetas_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE etiquetas OWNER TO postgres; + +ALTER TABLE estabelecimentos ADD medico_id int4 REFERENCES medicos( id ); + +insert into etiquetas ( descricao, descricao_plain, altura, largura, margem_esquerda, margem_cima, colunas, linhas, continua, altura_folha, largura_folha, + margem_horizontal_folha, margem_vertical_folha ) + values( 'Etiquetas em folha A4', 'etiquetas em folha a4', 3.7125, 10.5, 0.0, 0.0, 2, 8, 'n', 29.7, 21.0, 0.7, 0.5 ); \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/alter_20060516.sql b/tags/teg/SIPRPSoft/src/alter_20060516.sql new file mode 100644 index 00000000..3e76a52c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/alter_20060516.sql @@ -0,0 +1,2 @@ +alter table empresas add inicio_contrato date; +alter table empresas add duracao int; \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/alter_20070124.sql b/tags/teg/SIPRPSoft/src/alter_20070124.sql new file mode 100644 index 00000000..0f7cfb06 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/alter_20070124.sql @@ -0,0 +1,154 @@ +-- Table: ecd_oficial + +-- DROP TABLE ecd_oficial; + +CREATE TABLE ecd_oficial +( + id serial NOT NULL, + descricao varchar(255), + descricao_plain varchar(255), + ordem int4, + activo char(1), + CONSTRAINT ecd_oficial_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE ecd_oficial OWNER TO postgres; + + +-- Table: prestadores + +-- DROP TABLE prestadores; + +CREATE TABLE prestadores +( + id serial NOT NULL, + nome varchar(255), + nome_plain varchar(255), + morada varchar(2048), + codigo_postal varchar(16), + localidade varchar(255), + localidade_cp varchar(255), + contacto_id int4, + activo char(1), + faz_consultas char(1), + faz_ecds char(1), + CONSTRAINT prestadores_pkey PRIMARY KEY (id), + CONSTRAINT prestadores_contacto_id_fkey FOREIGN KEY (contacto_id) + REFERENCES contactos (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE prestadores OWNER TO postgres; + + +-- Table: prestadores_grupos_protocolo + +-- DROP TABLE prestadores_grupos_protocolo; + +CREATE TABLE prestadores_grupos_protocolo +( + id serial NOT NULL, + prestador_id int4 NOT NULL, + grupo_protocolo_id int4 NOT NULL, + CONSTRAINT prestadores_grupos_protocolo_pkey PRIMARY KEY (id), + CONSTRAINT prestadores_grupos_protocolo_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) + REFERENCES prt_grupos_protocolo (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT prestadores_grupos_protocolo_prestador_id_fkey FOREIGN KEY (prestador_id) + REFERENCES prestadores (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE prestadores_grupos_protocolo OWNER TO postgres; + + + +-- Table: marcacoes_trabalhador_estados + +-- DROP TABLE marcacoes_trabalhador_estados; + +CREATE TABLE marcacoes_trabalhador_estados +( + id serial NOT NULL, + data date, + estado int4, + marcacao_id int4, + CONSTRAINT marcacoes_trabalhador_estados_pkey PRIMARY KEY (id), + CONSTRAINT marcacoes_trabalhador_estados_marcacao_id_fkey FOREIGN KEY (marcacao_id) + REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE marcacoes_trabalhador_estados OWNER TO postgres; + +alter table marcacoes_grupos_realizados add marcacoes_trabalhador_estado_id int4 references marcacoes_trabalhador_estados(id); + +-- Table: lembretes_tipos + +-- DROP TABLE lembretes_tipos; + +CREATE TABLE lembretes_tipos +( + id serial NOT NULL, + codigo varchar(16) NOT NULL, + descricao varchar(255) NOT NULL, + ordem int4 NOT NULL, + activo char(1) NOT NULL DEFAULT 'y'::bpchar, + CONSTRAINT lembretes_tipos_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE lembretes_tipos OWNER TO postgres; + +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'EXTERNO','Avisos Externos', 1, 'y' ); +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'REMARCACOES', 'Remarca\\u00e7\\u00f5es', 3 , 'y' ); +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'MARCACOES', 'Marca\\u00e7\\u00f5es Pendentes', 2, 'y' ); +INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) + VALUES( 'OUTROS','Outros',4,'y' ); + +-- Table: lembretes + +-- DROP TABLE lembretes; + +CREATE TABLE lembretes +( + id serial NOT NULL, + tipo_id int4 NOT NULL, + data date NOT NULL, + descricao varchar(255) NOT NULL, + texto varchar(16384), + empresa_id int4, + estabelecimento_id int4, + trabalhador_id int4, + marcacao_estabelecimento_id int4, + marcacao_trabalhador_id int4, + enviar_email char(1) DEFAULT 'n'::bpchar, + periodicidade_dias int4, + periodicidade_meses int4, + ultimo_envio date, + CONSTRAINT lembretes_pkey PRIMARY KEY (id), + CONSTRAINT lembretes_empresa_id_fkey FOREIGN KEY (empresa_id) + REFERENCES empresas (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) + REFERENCES estabelecimentos (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_marcacao_estabelecimento_id_fkey FOREIGN KEY (marcacao_estabelecimento_id) + REFERENCES marcacoes_estabelecimento (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_marcacao_trabalhador_id_fkey FOREIGN KEY (marcacao_trabalhador_id) + REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_tipo_id_fkey FOREIGN KEY (tipo_id) + REFERENCES lembretes_tipos (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT lembretes_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) + REFERENCES trabalhadores (id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE NO ACTION +) +WITHOUT OIDS; +ALTER TABLE lembretes OWNER TO postgres; + + diff --git a/tags/teg/SIPRPSoft/src/alter_20070221.sql b/tags/teg/SIPRPSoft/src/alter_20070221.sql new file mode 100644 index 00000000..722c7dd1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/alter_20070221.sql @@ -0,0 +1,3 @@ +ALTER TABLE prestadores ADD contribuinte VARCHAR(64); +ALTER TABLE marcacoes_trabalhador ADD prestador_id int4 REFERENCES prestadores( id ); +ALTER TABLE marcacoes_trabalhador_estados ADD prestador_id int4 REFERENCES prestadores( id ); \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/build.xml b/tags/teg/SIPRPSoft/src/build.xml new file mode 100644 index 00000000..d0a1900e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/build.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/jpox_siprp.bat b/tags/teg/SIPRPSoft/src/jpox_siprp.bat new file mode 100644 index 00000000..782060b7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/jpox_siprp.bat @@ -0,0 +1,7 @@ +cd build +cd classes +java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/data/package.jdo +java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/prestadores/data/package.jdo +java -cp .;../../evutils;../../jpox;../../jpox/jpox-1.0.4.jar;../../jpox/jpox-enhancer-1.0.4.jar;../../jars/log4j-1.2.8.jar;../../jdo/jdo.jar;../../jdo;../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/processo/data/package.jdo +cd .. +cd .. \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/jpox_siprp.sh b/tags/teg/SIPRPSoft/src/jpox_siprp.sh new file mode 100644 index 00000000..10724bcc --- /dev/null +++ b/tags/teg/SIPRPSoft/src/jpox_siprp.sh @@ -0,0 +1,7 @@ +cd build +cd classes +java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/data/package.jdo +java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/prestadores/data/package.jdo +java -cp .:../../evutils:../../jpox:../../jpox/jpox-1.0.4.jar:../../jpox/jpox-enhancer-1.0.4.jar:../../jars/log4j-1.2.8.jar:../../jdo/jdo.jar:../../jdo:../../jpox/bcel-5.1.jar org.jpox.enhancer.JPOXEnhancer siprp/medicina/processo/data/package.jdo +cd .. +cd .. \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/jws/siprp.jnlp b/tags/teg/SIPRPSoft/src/jws/siprp.jnlp new file mode 100644 index 00000000..09ba18d2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/jws/siprp.jnlp @@ -0,0 +1,41 @@ + + + + + SIPRP + EVOLUTE 2005 + + SIPRP, v3.2 + SIPRP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/log4j.properties b/tags/teg/SIPRPSoft/src/log4j.properties new file mode 100644 index 00000000..3a9b9feb --- /dev/null +++ b/tags/teg/SIPRPSoft/src/log4j.properties @@ -0,0 +1,3 @@ +log4j.rootCategory=ERROR, dest1 +log4j.appender.dest1=org.apache.log4j.ConsoleAppender +log4j.appender.dest1.layout=org.apache.log4j.PatternLayout diff --git a/tags/teg/SIPRPSoft/src/logo/logo_combo.jpg b/tags/teg/SIPRPSoft/src/logo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Z z!t3P+Y5O<(_Jad`?Y^;q@Tt5$i+mp`4yF*aXN4$w;okm$u?)03|3a0$!Hl$xM3%Qv z3!@5FgIhN5y|fo|i2NjIsXh%26fJpAjWHJGEq-{hsDk~NUDczr;ECk086Sc)8IW7# zG=r+JgI;U6O+i|tHefA5LdKXl3q>09Ip9;3qHWI63p^*AG3(5r;=PcOz2LMu6oO)W zE*+8#{%;oSjgG;cO@igjtTO_R2oJM?z!gtqj|hL$YepLNG|cmvl4YOJLL5Nj@c3b; TG^lu1Ij_!cjmBF;a^L>}hZr89 literal 0 HcmV?d00001 diff --git a/tags/teg/SIPRPSoft/src/logo/logo_w400.png b/tags/teg/SIPRPSoft/src/logo/logo_w400.png new file mode 100644 index 0000000000000000000000000000000000000000..2e9fe4343546958da6ba2dc02578f67872ca77ac GIT binary patch literal 17622 zcmYIPcRbYb|38PrxrdRRy=AWuaVHXyQOI_-hEXK@>=8ne9Yrc+CuQ8(dsITAv-e(i z-1z*i@Avn6{QmH8$9>-S9fZ)|s4^(8?didkSMOp1 zM=5U@{0(gbKp;l8e?L^9{6cQZA8EXFZ|QarwP)?lAy?^lusI>skiSxDo*X-Zf7RqUu&QobC7^IIs_3 z0b?1SlTMyUfRbZgmvxF1GYHkyka{X`(gGj^f`ziO^o}{heO&KH!J$jB@yfx53^# zf!AM_HCZgbsW3mwJ0^0u?3L)1obQ$g&%?p_HCi5>Zu!QX+Dfyn za7BS!qnkIzTs}Qvmm<16l z()b!3DY;TOvcIHGO(&BCEU6^AT`wE_rXb_Nd;sT zWg?*uS$YoaI~sTfLl25OE)GBqPRw;8chlc?EEo%U_LRs(wof;0w>X~pDgX$;L|@?F2|ie|LfUkO+t~3 zRBKCC-KWYFs{s<>@sbsNmrU8)!c5*ASISvXK@*QhO(&ryrCNuPcpMR% zCe1OZ<{OlSD&~G@nWX&hNTW_>e!Y*xL{WK~X+2@rR>SBA6@0%ia0|2i7%w5Jq7hxI zc!ap{6O9@V3?izrmHCr#f@NH9SJbOa+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rVk-WSg&d1DGMKkP z98Da)p${{7npC*N`ZhKrv-P;`15ah5BaUW#2s1%!W=m^twS_He4NRAEKJ?m(gdAhBp&^xRM6GY9ajuF2l$Z z#L$5!IFr)JhHs&6VDC030>Q!2!DSm9>&RZk1DAys~ zm)Q{YHhO-c^%kMtBE)}6o ziaqRJM~J?{;l~0GH&l#Gd7c8jNJ$?~+fl3ctD5!c%{F%u3Aq#<&YLUTRqbKYD|P;O z8zcqH%4;cc(M^10_8swg9y5($19MJ^qSKR$W%l%L8#@wdT3joPSN)ceArXF(al8|T z=_xT;JDQrfQu{^iT}FllX1rjzZ=im<+|^Ur44oO6p1G| z5=gNW8qn)$%Pklv*>tWd5zpHg5)r7xcNyvZOVTsu$N+kz*ObRf2Cr=-dqZx}+|>7G z>xox1tA@_- 0 ) + { + estabelecimentoID = ( Integer )array.get( 0, 0 ); + } + return estabelecimentoID; + } + + public Integer getEmpresaIDForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = new Select( new String[]{ T_ESTABELECIMENTOS }, + new String[]{ EMPRESA_ID }, + new Field( ID ).isEqual( estabelecimentoID ).and( + new Field( INACTIVO ).isDifferent( "y" ) ), + null, null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer empresaID = null; + if( array != null && array.columnLength() > 0 ) + { + empresaID = ( Integer )array.get( 0, 0 ); + } + return empresaID; + } + + public Integer []getAvisosIDByTipoAndDate( Integer tipo, Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos" }, new String[]{ "id", "data_evento" }, + new Field( "tipo" ).isEqual( tipo ).and( + new Field( "data_aviso" ).isLessOrEqual( date )), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = new Integer( ((Number)array.get( n, 0 )).intValue() ); + } + return ids; + } + + public Object [][]getAvisosTrabalhadorByDate( Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos", "trabalhadores" }, + new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao", + "empresas.designacao_social", "estabelecimentos.nome", + "trabalhadores.nome", "data_aviso" }, + new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_TRABALHADOR ) ).and( + new Field( "data_aviso" ).isLessOrEqual( date ) ).and( + new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and( + new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "avisos.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Object [][]getAvisosEstabelecimentoByDate( Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos", "empresas", "estabelecimentos" }, + new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao", + "empresas.designacao_social", "estabelecimentos.nome", "data_aviso" }, + new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ) ).and( + new Field( "data_aviso" ).isLessOrEqual( date ) ).and( + new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and( + new Field( "avisos.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Object [][]getAvisosEmpresaByDate( Date date ) + throws Exception + { + Select select = new Select( new String[]{ "avisos", "empresas" }, + new String[]{ "avisos.id", "avisos.data_evento", "avisos.descricao", + "empresas.designacao_social", "data_aviso" }, + new Field( "tipo" ).isEqual( new Integer( AvisoConstants.TIPO_EMPRESA ) ).and( + new Field( "data_aviso" ).isLessOrEqual( date ) ).and( + new Field( "avisos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ), + new String[]{ "data_evento" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Integer getMarcacaoIDByTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select realizadaSelect = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MAX(data)" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "estado" ).isEqual( new Integer( 2 ) ) ).and( + new Field( "tipo" ).isEqual( new Integer( siprp.data.MarcacaoTrabalhadorData.TIPO_CONSULTA ) ) ) ); + Virtual2DArray realizadaArray = executer.executeQuery( realizadaSelect ); + Date realizada = (Date) realizadaArray.get( 0, 0 ); + Select select; + if( realizada == null ) + { + select = new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MIN(id)" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and( + new Field( "tipo" ).isEqual( new Integer( siprp.data.MarcacaoTrabalhadorData.TIPO_CONSULTA ) ) ) ); + } + else + { + select = new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MIN(id)" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "estado" ).isEqual( new Integer( 0 ) ) ).and( + new Field( "data" ).isGreater( realizada ) ).and( + new Field( "tipo" ).isEqual( new Integer( siprp.data.MarcacaoTrabalhadorData.TIPO_CONSULTA ) ) ) ); + } + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + return new Integer( ( ( Number ) array.get( 0, 0 ) ).intValue() ); + } + + public IDObject[] getAllEmpresasDeleted() + throws Exception + { + Select select = new Select( new String[]{ T_EMPRESAS }, + new String[]{ ID, DESIGNACAO_SOCIAL, "designacao_social_plain" }, + new Field( INACTIVO ).isEqual( "y" ), + new String[]{ "designacao_social_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject empresas[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new MappableObject( id, designacao ); + } + return empresas; + } + + public IDObject []getAllEstabelecimentosDeletedForEmpresa( Integer empresaID ) + throws Exception + { + Select select = new Select( new String[]{ T_ESTABELECIMENTOS }, + new String[]{ ID, NOME, "nome_plain" }, + new Field( EMPRESA_ID ).isEqual( empresaID ).and( + new Field( INACTIVO ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject objects[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < objects.length; n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String desc = (String)array.get( n, 1 ); + objects[ n ] = new MappableObject( id, desc ); + } + return objects; + } + + public IDObject []getAllTrabalhadoresDeletedForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = new Select( new String[]{ T_TRABALHADORES }, + new String[]{ ID, NOME, "nome_plain" }, + new Field( ESTABELECIMENTO_ID ).isEqual( estabelecimentoID ).and( + new Field( INACTIVO ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject objects[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < objects.length; n++ ) + { + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + String desc = (String)array.get( n, 1 ); + objects[ n ] = new MappableObject( id, desc ); + } + return objects; + } + + public Object[] getDadosUltimaMarcacao( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "MAX( data )" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ).or( + new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return new Object[]{ null, null }; + } + Date data = ( Date ) array.get( 0, 0 ); + select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "motivo", "id" }, + new Field( "data" ).isEqual( data ).and( + new Field( "trabalhador_id" ).isEqual( trabalhadorID ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ).or( + new Field( "estado" ).isEqual( new Integer( 2 ) ) ) ), + new String[]{ "id" }, null ); + array = executer.executeQuery( select ); + Integer tipo = ( Integer ) array.get( 0, 0 ); + if( tipo.intValue() == 5 ) + { + tipo = new Integer( 2 ); + } + return new Object[]{ data, tipo }; + } + + public void setMedicoForEstabelecimento( Integer estabelecimentoID, Integer medicoID ) + throws Exception + { + Integer medicoAntigo = ( Integer ) medicosEstabelecimentosHash.get( estabelecimentoID ); + if( !medicoID.equals( medicoAntigo ) ) + { + Update update = + new Update( "estabelecimentos", + new Assignment[]{ + new Assignment( new Field( "medico_id" ), medicoID ) }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + executer.executeQuery( update ); + medicosEstabelecimentosHash.put( estabelecimentoID, medicoID ); + } + } + + public Integer getMedicoForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + if( !medicosEstabelecimentosHash.containsKey( estabelecimentoID ) ) + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "medico_id" }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer medicoID = ( Integer ) array.get( 0, 0 ); + if( medicoID == null ) + { + medicoID = new Integer( -1 ); + } + medicosEstabelecimentosHash.put( estabelecimentoID, medicoID ); + } + return ( Integer ) medicosEstabelecimentosHash.get( estabelecimentoID ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/Main.java b/tags/teg/SIPRPSoft/src/siprp/Main.java new file mode 100644 index 00000000..260302f5 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/Main.java @@ -0,0 +1,285 @@ +package siprp; + +import siprp.companydataloaders.*; +import siprp.data.*; +import siprp.clientes.*; + +import com.evolute.utils.*; +import com.evolute.utils.db.*; +import com.evolute.utils.db.keyretrievers.*; +import com.evolute.utils.error.*; +import com.evolute.utils.jdbc.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.window.*; + +import java.awt.*; +import java.util.*; +import javax.swing.*; +import javax.swing.tree.*; +import siprp.update.UpdateWindow; + +public class Main implements com.evolute.utils.ui.window.Connector +{ + public final static String SHST_VERSION = "7.8"; + + private final static ClassLoader classLoader = new EVUtilsImageLib().getClass().getClassLoader(); + + private static String dbase; + private SIPRPTracker siprpTracker; + + private static AvisosPanel avisos = null; + + static + { + JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EmpresaData.class ); + JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EstabelecimentoData.class ); + JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, TrabalhadorData.class ); + + JDOObject.registerOperationHandlerForClass( ActualizacaoSaveHandler.INSTANCE, EmpresaData.class ); + JDOObject.registerOperationHandlerForClass( ActualizacaoSaveHandler.INSTANCE, EstabelecimentoData.class ); + JDOObject.registerOperationHandlerForClass( ActualizacaoSaveHandler.INSTANCE, TrabalhadorData.class ); + + JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEmpresaData.class ); + JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEstabelecimentoData.class ); + JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoTrabalhadorData.class ); + } + + public static void main( String args[] ) + throws Exception + { +// Singleton.setInstance( SingletonConstants.COMPANY_NAME, "Centro Cl\u00ednico Avenida" ); +// Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" ); +// Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE ); +// Singleton.setInstance( SingletonConstants.DB_NAME, "shst" ); + +// Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais" ); +// Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_combo.jpg" ); +// Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.TRUE ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp" ); + new SIPRPDataLoader().load(); +// new ClinicaAvenidaDataLoader().load(); +// new IBookDataLoader().load(); + + dbase = (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ); +/* Calendar cal = Calendar.getInstance(); + cal.set( 2004, 06, 14 ); + if( cal.before( Calendar.getInstance() ) ) + { + com.evolute.utils.ui.DialogException.showException( new RuntimeException( "Unknown error ocurred." ) ); + } + else + { +*/ Insert.setDefaultKeyRetriever( JDBCAutoKeyRetriever.DEFAULT ); + String server = System.getProperty( "server.address" ); +// if( server == null ) +// { +// server = "ws_fpalma"; +// } +// +// String user = "root"; +// String passwd = "UNIXLuvsU"; +// +// DBManager dbm = new JDBCManager( "jdbc:mysql://" + server + "/" + dbase, +// user, passwd , 10, 8, 8, null ); + + UnicodeChecker.setUseDoubleSlash( true ); +// Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm ); + +// StatementExecuterFactory.initialize( +// new DBStatementExecuter( dbm.getSharedExecuter() ) ); +// } +// FichaWindow window = new FichaWindow(); +/* window.setLogo( new ImageIcon( + new Main().getClass().getClassLoader().getResource( "logo/logo_w400.png" ) + ).getImage() );*/ +// window.show(); + avisos = new AvisosPanel(); + String logoFileName = ( String ) Singleton.getInstance( SingletonConstants.COMPANY_LOGO ); + LoginWindow loginWindow = new LoginWindow( new Main(), /*"logo"+File.separator +*/ logoFileName,//"logo"+File.separator + "logo_w400.jpg", + new String[] { (String) Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) }, + new String[] { "Vers\u00E3o " + SHST_VERSION, "(EVOLUTE 2004-2006)" }, "", + (String)Singleton.getInstance( SingletonConstants.LOCAL_USER ), + (String)Singleton.getInstance( SingletonConstants.LOCAL_PASSWORD ), avisos, false ); + loginWindow.setTitle( (String) Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) ); + JPanel left = loginWindow.getLeftPanel(); + left.setBackground( Color.white ); + GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); + loginWindow.setExtendedState(loginWindow.getExtendedState() | loginWindow.MAXIMIZED_BOTH); + loginWindow.setVisible( true ); + loginWindow.expandAll(); + new UpdateWindow().update(); + } + + public boolean connect( String user, String passwd ) + { + try + { + // run initialization SQL + SQLQuery initQuery[] = new SQLQuery[] {}; + String server = System.getProperty( "server.address" ); + if( server == null ) + { + //server = "192.168.1.191"; + server = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL ); +// server = "ws_fpalma"; + } + String prefix = (String)Singleton.getInstance( SingletonConstants.LOCAL_URL_PREFIX ); + String url = prefix + server + "/" + dbase; +// System.out.println( "url: " + url + " user: " + user + " ps: " + passwd ); + DBManager dbm = new JDBCManager( url, user, passwd , 10, 8, 8, null ); +// UnicodeChecker.setUseDoubleSlash( true ); + Singleton.setInstance( Singleton.DEFAULT_DBMANAGER, dbm ); + + StatementExecuterFactory.initialize( + new DBStatementExecuter( dbm.getSharedExecuter() ) ); + initializeJPOX( url, user, passwd ); + StatementExecuterFactory.initialize( + new DBStatementExecuter( dbm.getSharedExecuter() ) ); + StatementExecuterFactory.initialize( + new DBStatementExecuter( dbm.getSharedExecuter() ) ); + Singleton.setInstance( Singleton.TODAY, new Date() ); + +//cleanData( dbm.getSharedExecuter() ); +//msg( dbm.getSharedExecuter() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "N\u00E3o foi poss\u00EDvel estabelecer" + + " a liga\u00E7\u00E3o \u00E0 base de dados.", false ); + return false; + } + Singleton.setInstance( Singleton.USERNAME, user ); + try + { + ErrorLogger.initializeLogger( new SHSTLogger() ); + } + catch( Exception ex ) + { + } + //Singleton.setInstance( Singleton.USERNAME, user ); + siprpTracker = new SIPRPTracker( avisos ); + + avisos.refresh(); +// new Exception().printStackTrace(); +// try +// { +// Thread.sleep( 1000 ); +// } +// catch( Exception ex ){} +// new Exception().printStackTrace(); + return true; + } + +// public static void reconnectJDO() +// { +// PersistenceManagerFactory pmf = ( PersistenceManagerFactory ) Singleton.getInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY ); +// PersistenceManager pm = pmf.getPersistenceManager(); +// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm ); +// com.evolute.utils.jdo.JDOObject.setPersistentManager( pm ); +// } + + public boolean disconnect() + { + if( siprpTracker.quit() ) + { + siprpTracker = null; + try + { + ( ( DBManager )Singleton.getInstance( + Singleton.DEFAULT_DBMANAGER ) ).close(); + Singleton.clear(); + } + catch( DBException ex ) + { + DialogException.showException( ex ); + } + return true; + } + return false; + } + + public void executeAction( DefaultMutableTreeNode node ) + { + try + { + siprpTracker.openWindow( ( String )node.getUserObject() ); + } + catch( Exception ex ) + { + DialogException.showException( ex ); + } + } + + public void exit() + { + if( siprpTracker == null || siprpTracker.quit() ) + { + System.exit( 0 ); + } + } + + public MutableTreeNode getTree() + { + return siprpTracker.getRoot(); + } + + public void initializeJPOX(String url, String user, String password) + { + Date d = new Date(); +System.out.println( "INIT: " + d ); + + + Properties jpoxProps; + jpoxProps = System.getProperties();//new Properties(); + // Set the PersistenceManagerFactoryClass to the TJDO class. + jpoxProps.setProperty( "javax.jdo.PersistenceManagerFactoryClass", + "org.jpox.PersistenceManagerFactoryImpl" ); + // Set the JDBC driver name. + jpoxProps.setProperty( "javax.jdo.option.ConnectionDriverName", (String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ) ); + jpoxProps.setProperty( "org.jpox.identifier.fullyQualifiedNames", "false" ); + // props.setProperty("com.triactive.jdo.transactionIsolation", + // "read-uncommitted" ); + + // Set the connection URL +// jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", "jdbc:informix-sqli://192.168.0.3:6666" +// + "/apdp_db:informixserver=server" ); + jpoxProps.setProperty( "javax.jdo.option.ConnectionURL", url ); + jpoxProps.setProperty( "javax.jdo.option.ConnectionUserName", user ); + jpoxProps.setProperty( "javax.jdo.option.ConnectionPassword", password ); +// jpoxProps.setProperty( "javax.jdo.option.IgnoreCache", "true" ); +// jpoxProps.setProperty( "javax.jdo.option.NonTransactionalRead", "true" ); + jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" ); + + jpoxProps.setProperty( "org.jpox.autoCreateTables", "false" ); + jpoxProps.setProperty( "org.jpox.autoCreateSchema", "false" ); + jpoxProps.setProperty( "org.jpox.autoCreateConstraints", "false" ); + jpoxProps.setProperty( "org.jpox.validateTables", "false" ); + jpoxProps.setProperty( "org.jpox.validateConstraints", "false" ); + jpoxProps.setProperty( "org.jpox.autoStartMechanismMode", "Ignored" ); + jpoxProps.setProperty( "org.jpox.autoStartMechanism", "None" ); + +// jpoxProps.setProperty( "javax.jdo.option.RetainValues", "true" ); +// jpoxProps.setProperty( "javax.jdo.option.Optimistic", "true" ); + +// jpoxProps.setProperty( "org.jpox.identifier.defaultSchemaName", "informix" ); + jpoxProps.setProperty( "org.jpox.rdbms.CheckExistTablesOrViews", "false" ); + + System.setProperty( "org.jpox.catalogName", (String)Singleton.getInstance( SingletonConstants.LOCAL_DB_NAME ) ); + System.setProperty( "org.jpox.schemaName", "" ); + +// PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory( jpoxProps ); +//// pmf.setOptimistic( true ); +//System.out.print( "Loading PM: " + new Date() ); +// // ( ( PersistenceManagerFactoryImpl )pmf ).setTransactionIsolation( Connection.TRANSACTION_READ_UNCOMMITTED ); +// // Retrieve a PersistenceManager from the PersistenceManagerFactory. +// PersistenceManager pm = pmf.getPersistenceManager(); +// JDOObject.setPersistentManager( pm ); +// Singleton.setInstance( Singleton.DEFAULT_PERSISTENCE_MANAGER_FACTORY, pmf ); +// Singleton.setInstance( SingletonConstants.PERSISTENCE_MANAGER, pm ); + JDOProvider jdoProvider = new JDOProvider( jpoxProps ); + Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, jdoProvider ); +System.out.println( "PM done " + new Date() + "JDO: " + jdoProvider ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/SHSTLogger.java b/tags/teg/SIPRPSoft/src/siprp/SHSTLogger.java new file mode 100644 index 00000000..9330e900 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/SHSTLogger.java @@ -0,0 +1,112 @@ +/* + * SIPRPLogger.java + * + * Created on 15 de Marco de 2005, 15:31 + */ + +package siprp; + +import com.evolute.utils.*; +import com.evolute.utils.db.*; +import com.evolute.utils.error.*; +import com.evolute.utils.sql.*; + +/** + * + * @author lflores + + * MySQL +CREATE TABLE errors +( + id INT NOT NULL AUTO_INCREMENT, + PRIMARY KEY( id ), + date TIMESTAMP NOT NULL DEFAULT 'now()', + type VARCHAR(20), + environment VARCHAR( 255 ), + description TEXT +); + * + *PostgreSQL +CREATE TABLE errors +( + id SERIAL, + PRIMARY KEY( id ), + date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + type VARCHAR(20), + environment VARCHAR( 255 ), + description VARCHAR( 256000 ) +) + + */ +public class SHSTLogger implements Logger +{ + private final String java = System.getProperty( "java.version" ) + + "-" + System.getProperty( "java.vm.version" ); + private final String os = System.getProperty( "os.name" ) + " - " + + System.getProperty( "os.version" ); + private final String user = ( String )Singleton.getInstance( Singleton.USERNAME ); + private final String ENV = "Java: " + java + " \nOS: " + os + " \nUser: " + user + + "\n Software: " + ( String )Singleton.getInstance( SingletonConstants.SOFTWARE_NAME ) + + "\n Version: " + Main.SHST_VERSION; + private final Executer executer; + + /** Creates a new instance of SIPRPLogger */ + public SHSTLogger() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + executer = dbm.getExclusiveExecuter( this ); + } + + public void log( String str ) + { + String mem = "(" + Runtime.getRuntime().freeMemory() + "/" + + Runtime.getRuntime().maxMemory() + ")"; + if( str.length() > 254000 ) + { + str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated."; + } + try + { + executer.executeQuery( new Insert( "errors", new Assignment[] { + new Assignment( new Field( "type" ), "LOG" ), + new Assignment( new Field( "environment" ), ENV + mem ), + new Assignment( new Field( "description" ), str ) + } ), null ); + } + catch( Exception ex ) + { + logException( ex ); + } + } + + public void logException( Throwable ex ) + { + StackTraceElement ste[] = ex.getStackTrace(); + StringBuffer sb = new StringBuffer(); + for( int i = 0; i < ste.length; ++i ) + { + sb.append( ste[ i ].toString() ); + } + String str = "Exception Message: " + ex.getMessage() + "\nStack Trace: " + sb.toString(); + String mem = "(" + Runtime.getRuntime().freeMemory() + "/" + + Runtime.getRuntime().maxMemory() + ")"; + if( str.length() > 254000 ) + { + str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated."; + } + try + { + executer.executeQuery( new Insert( "errors", new Assignment[] { + new Assignment( new Field( "type" ), "ERROR" ), + new Assignment( new Field( "environment" ), ENV + mem ), + new Assignment( new Field( "description" ), str ) + } ), new SQLRetriever() ); + } + catch( Exception ex1 ) + { + ex.printStackTrace(); + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/SIPRPTracker.java b/tags/teg/SIPRPSoft/src/siprp/SIPRPTracker.java new file mode 100644 index 00000000..c33b4f82 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/SIPRPTracker.java @@ -0,0 +1,267 @@ +/* + * SIPRPTracker.java + * + * Created on 18 de Maio de 2004, 19:46 + */ + +package siprp; + +import javax.swing.tree.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.tracker.*; +import siprp.ficha.*; +import siprp.clientes.*; +import siprp.estatistica.*; +import siprp.higiene.mapa.*; +import siprp.higiene.marcacoes.*; +import siprp.impressaofichas.*; +import siprp.lembretes.LembretesWindow; +import siprp.medicina.*; +import siprp.medicina.locais_realizacao.LocaisRealizacaoWindow; +import siprp.medicina.presencas.RegistarPresencasWindow; +import siprp.medicina.prestadores.PrestadoresWindow; +import siprp.medicina.processo.ProcessoWindow; +import siprp.pesquisas.*; +/** + * + * @author fpalma + */ +public class SIPRPTracker extends WindowTracker +{ + public static final String FICHA_APTIDAO = "Ficha de Aptid\u00e3o"; + public static final String CRIACAO_FICHA_APTIDAO = "Cria\u00e7\u00e3o de Fichas de Aptid\u00e3o"; + public static final String GESTAO_CLIENTES = "Gest\u00e3o de Clientes"; + public static final String MEDICINA = "Medicina"; + public static final String MEDICINA_MARCACOES = "Marca\u00e7\u00f5es"; + public static final String MEDICINA_LOCAIS = "Locais de Realiza\u00e7\u00e3o"; + public static final String MEDICINA_PRESENCAS = "Presen\u00e7as"; + public static final String HIGIENE_SEGURANCA = "Higiene e Seguran\u00e7a"; + public static final String RELATORIO_ANUAL = "Relat\u00f3rio Anual"; + public static final String LISTAGENS = "Listagens"; + + private final AvisosPanel avisos; + private ClientesWindow clientesWindow; + private MedicinaWindow medicinaWindow; + private MarcacoesHigieneWindow higieneWindow; + + /** Creates a new instance of SIPRPTracker */ + public SIPRPTracker( AvisosPanel avisosP ) + { + Singleton.setInstance( SingletonConstants.SIPRP_TRACKER, this ); + this.avisos = avisosP; + avisos.setTracker( this ); + Hashtable creators = new Hashtable(); + DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode( + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ) ); + + boolean hasFicha = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_FICHA ) ).booleanValue(); + boolean hasGestao = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_CLIENTES ) ).booleanValue(); + boolean hasRelatorio = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_RELATORIO ) ).booleanValue(); + boolean hasListagens = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_LISTAGENS ) ).booleanValue(); + + if( hasGestao ) + { + try + { + clientesWindow = new ClientesWindow( avisos ); + clientesWindow.setTracker( this ); + medicinaWindow = new MedicinaWindow(); + medicinaWindow.setTracker( this ); + higieneWindow = new MarcacoesHigieneWindow(); + higieneWindow.setTracker( this ); + } + catch( Exception ex ) + { + clientesWindow = null; + medicinaWindow = null; + higieneWindow = null; + ex.printStackTrace(); + } + } + else + { + clientesWindow = null; + medicinaWindow = null; + } + + if( hasFicha ) + { + DefaultMutableTreeNode fichaNode = new DefaultMutableTreeNode( FICHA_APTIDAO ); + + fichaNode.add( new DefaultMutableTreeNode( CRIACAO_FICHA_APTIDAO ) ); + creators.put( CRIACAO_FICHA_APTIDAO, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return FichaWindow.getWindow(); + } + } ); + + fichaNode.add( new DefaultMutableTreeNode( ImpressaoFichasWindow.TITLE ) ); + creators.put( ImpressaoFichasWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new ImpressaoFichasWindow(); + } + } ); + + rootNode.add( fichaNode ); + } + + if( hasGestao ) + { + rootNode.add( new DefaultMutableTreeNode( GESTAO_CLIENTES ) ); + creators.put( GESTAO_CLIENTES, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + if( clientesWindow == null ) + { + clientesWindow = new ClientesWindow( avisos ); + clientesWindow.setTracker( SIPRPTracker.this ); + } + return clientesWindow; + } + } ); + + rootNode.add( new DefaultMutableTreeNode( LembretesWindow.TITLE ) ); + creators.put( LembretesWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new LembretesWindow(); + } + } ); + + DefaultMutableTreeNode medicinaNode = new DefaultMutableTreeNode( MEDICINA ); + + medicinaNode.add( new DefaultMutableTreeNode( ProcessoWindow.TITLE ) ); + creators.put( ProcessoWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new ProcessoWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_MARCACOES ) ); + creators.put( MEDICINA_MARCACOES, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + if( medicinaWindow == null ) + { + medicinaWindow = new MedicinaWindow(); + medicinaWindow.setTracker( SIPRPTracker.this ); + } + return medicinaWindow; + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_LOCAIS ) ); + creators.put( MEDICINA_LOCAIS, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new LocaisRealizacaoWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_PRESENCAS ) ); + creators.put( MEDICINA_PRESENCAS, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new RegistarPresencasWindow(); + } + } ); + + medicinaNode.add( new DefaultMutableTreeNode( PrestadoresWindow.TITLE ) ); + creators.put( PrestadoresWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new PrestadoresWindow(); + } + } ); + + rootNode.add( medicinaNode ); + + DefaultMutableTreeNode higieneNode = new DefaultMutableTreeNode( HIGIENE_SEGURANCA ); + + higieneNode.add( new DefaultMutableTreeNode( MarcacoesHigieneWindow.TITLE ) ); + creators.put( MarcacoesHigieneWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + if( higieneWindow == null ) + { + higieneWindow = new MarcacoesHigieneWindow(); + higieneWindow.setTracker( SIPRPTracker.this ); + } + return higieneWindow; + } + } ); + + higieneNode.add( new DefaultMutableTreeNode( MapaHigieneWindow.TITLE ) ); + creators.put( MapaHigieneWindow.TITLE, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new MapaHigieneWindow(); + } + } ); + + rootNode.add( higieneNode ); + } + + if( hasRelatorio ) + { + rootNode.add( new DefaultMutableTreeNode( RELATORIO_ANUAL ) ); + creators.put( RELATORIO_ANUAL, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new PesquisasWindow(); + } + } ); + } + + if( hasListagens ) + { + rootNode.add( new DefaultMutableTreeNode( LISTAGENS ) ); + creators.put( LISTAGENS, new WindowCreator() { + public TrackableWindow create() + throws Exception + { + return new EstatisticaWindow(); + } + } ); + } + setRoot( rootNode ); + setCreators( creators ); + } + + public ClientesWindow getClientesWindow() + { + return clientesWindow; + } + + public MedicinaWindow getMedicinaWindow() + { + return medicinaWindow; + } + + public MarcacoesHigieneWindow getHigieneWindow() + { + return higieneWindow; + } + + public AvisosPanel getAvisosPanel() + { + return avisos; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/SingletonConstants.java b/tags/teg/SIPRPSoft/src/siprp/SingletonConstants.java new file mode 100644 index 00000000..6f8cdbc1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/SingletonConstants.java @@ -0,0 +1,59 @@ +/* + * SingletonConstants.java + * + * Created on 25 de Maio de 2004, 13:34 + */ + +package siprp; + +/** + * + * @author fpalma + */ +public class SingletonConstants +{ + public static final String PERSISTENCE_MANAGER = "PERSISTENCE_MANAGER"; + public static final String SOFTWARE_NAME = "software_name"; + public static final String COMPANY_NAME = "company_name"; + public static final String COMPANY_LOGO = "company_logo"; + public static final String COMPANY_ACRONYM = "company_acronym"; + public static final String SUBJECT_CONSULTA = "subject_consulta"; + public static final String LETTER_CONSULTA = "letter_consulta"; + public static final String SUBJECT_EXAMES = "subject_exames"; + public static final String LETTER_EXAMES = "letter_exames"; + public static final String SUBJECT_VISITA = "subject_visita"; + public static final String LETTER_VISITA = "letter_visita"; + public static final String USES_HOUR = "uses_hour"; + public static final String CODIGO_EMPRESA_FORMAT = "codigo_empresa_format"; + public static final String FICHA_MARCA_EXAMES = "ficha_marca_exames"; + public static final String EXCEL_FORMAT = "excel_format"; + public static final String EXCEL_FORMAT_DEMISSAO = "excel_format_demissao"; + + public static final String MODULE_FICHA = "module_ficha"; + public static final String MODULE_CLIENTES = "module_clientes"; + public static final String WEB_AWARE = "web_aware"; + public static final String MODULE_RELATORIO = "module_relatorio"; + public static final String MODULE_LISTAGENS = "module_listagens"; + + public static final String WEB_USER = "web_user"; + public static final String WEB_PASSWORD = "web_password"; + public static final String WEB_URL_PREFIX = "web_url_prefix"; + public static final String WEB_URL = "web_url"; + public static final String WEB_DB_NAME = "web_db_name"; + public static final String WEB_DRIVER_NAME = "web_driver_name"; + + public static final String LOCAL_USER = "local_user"; + public static final String LOCAL_PASSWORD = "local_password"; + public static final String LOCAL_URL_PREFIX = "local_url_prefix"; + public static final String LOCAL_URL = "local_url"; + public static final String LOCAL_DB_NAME = "local_db_name"; + public static final String LOCAL_DRIVER_NAME = "local_driver_name"; + + public static final String SIPRP_TRACKER = "SIPRP_TRACKER"; + + /** Creates a new instance of SingletonConstants */ + private SingletonConstants() + { + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/AvisosPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/AvisosPanel.java new file mode 100644 index 00000000..fa73c5d2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/AvisosPanel.java @@ -0,0 +1,589 @@ +/* + * AvisosPanel.java + * + * Created on 21 de Maio de 2004, 13:06 + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import java.text.*; +import java.util.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.ui.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class AvisosPanel extends JPanel + implements ActionListener, ControllableComponent +{ + private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + private JDOProvider JDO; + private FichaDataProvider provider; + private SIPRPTracker tracker; + + private JPanel empresaPanel; + private JPanel estabelecimentosPanel; + private JPanel trabalhadoresPanel; + +// private AvisoData avisos[]; +// private AvisoData avisosEmpresa[]; +// private AvisoData avisosEstabelecimento[]; +// private AvisoData avisosTrabalhador[]; + + private Object avisosEmpresa[][]; + private Object avisosEstabelecimento[][]; + private Object avisosTrabalhador[][]; + + private boolean refreshed = false; + + private Hashtable buttonHash; + private Hashtable buttonTypeHash; + + /** Creates a new instance of AvisosPanel */ + public AvisosPanel(/* AvisoData avisosEmpresa[], AvisoData avisosEstabelecimento[], AvisoData avisosTrabalhador[]*/ ) + throws Exception + { +// this.avisosEmpresa = new AvisoData[ 0 ]; +// this.avisosEstabelecimento = new AvisoData[ 0 ]; +// this.avisosTrabalhador = new AvisoData[ 0 ]; +// setupComponents(); + buttonHash = new Hashtable(); + buttonTypeHash = new Hashtable(); + JDO = (JDOProvider) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); +// System.out.println( "public AvisosPanel() JDO: " + JDO ); + } + + private void setupComponents() + { + empresaPanel = new JPanel(); + empresaPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Empresas" ) ); + empresaPanel.setLayout( new GridLayout( avisosEmpresa.length, 1 ) ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + for( int n = 0; n < avisosEmpresa.length; n++ ) + { + JPanel pan = new JPanel(); + GridBagLayout gridbag = new GridBagLayout(); + pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); +// EmpresaData empresa = (EmpresaData)avisosEmpresa[ n ].get( AvisoData.EMPRESA ); + pan.setLayout( gridbag ); + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridx = 0; + constraints.weightx = 0; + constraints.gridwidth = 1; + JButton tratarButton = new JButton( "Tratar" ); + gridbag.setConstraints( tratarButton, constraints ); + pan.add( tratarButton ); + //buttonHash.put( tratarButton, avisosEmpresa[ n ] ); +// buttonHash.put( tratarButton, new Integer( n ) ); +// buttonHash.put( tratarButton, avisosEmpresa[ n ].get( AvisoData.ID ) ); + buttonHash.put( tratarButton, avisosEmpresa[ n ][ 0 ] ); + buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_EMPRESA ) ); + tratarButton.addActionListener( this ); + + constraints.gridx = 1; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; +// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + JLabel empresaLabel = new JLabel( "" + avisosEmpresa[ n ][ 3 ] ); + gridbag.setConstraints( empresaLabel, constraints ); + pan.add( empresaLabel ); + + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + //JLabel descricaoLabel = new JLabel( (String)avisosEmpresa[ n ].get( AvisoData.DESCRICAO ) ); + JLabel descricaoLabel = criarDescricao( avisosEmpresa[ n ] ); + gridbag.setConstraints( descricaoLabel, constraints ); + pan.add( descricaoLabel ); + + empresaPanel.add( pan ); + } + + estabelecimentosPanel = new JPanel(); + estabelecimentosPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Estabelecimentos" ) ); + estabelecimentosPanel.setLayout( new GridLayout( avisosEstabelecimento.length, 1 ) ); + + for( int n = 0; n < avisosEstabelecimento.length; n++ ) + { + Date dataAviso = ( Date ) avisosEstabelecimento[ n ][ 5 ]; + Date dataEvento = ( Date ) avisosEstabelecimento[ n ][ 1 ]; + Calendar calAviso = Calendar.getInstance(); + calAviso.setTime( dataAviso ); + Calendar calEvento = Calendar.getInstance(); + calEvento.setTime( dataEvento ); + boolean mesmoDia = + ( calAviso.get( Calendar.YEAR ) == calEvento.get( Calendar.YEAR ) ) && + ( calAviso.get( Calendar.MONTH ) == calEvento.get( Calendar.MONTH ) ) && + ( calAviso.get( Calendar.DAY_OF_MONTH ) == calEvento.get( Calendar.DAY_OF_MONTH ) ); + JPanel pan = new JPanel(); + GridBagLayout gridbag = new GridBagLayout(); + pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); +// EstabelecimentoData estabelecimento = (EstabelecimentoData)avisosEstabelecimento[ n ].get( AvisoData.ESTABELECIMENTO ); +// EmpresaData empresa = (EmpresaData)estabelecimento.get( EstabelecimentoData.EMPRESA ); + pan.setLayout( gridbag ); + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridx = 0; + constraints.weightx = 0; + constraints.gridwidth = 1; + JButton tratarButton = new JButton( mesmoDia ? "Confirmar" : "Marcar" ); + gridbag.setConstraints( tratarButton, constraints ); + pan.add( tratarButton ); + //buttonHash.put( tratarButton, avisosEstabelecimento[ n ] ); +// buttonHash.put( tratarButton, new Integer( n + avisosEmpresa.length ) ); +// buttonHash.put( tratarButton, avisosEstabelecimento[ n ].get( AvisoData.ID ) ); + buttonHash.put( tratarButton, avisosEstabelecimento[ n ][ 0 ] ); + buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ) ); + tratarButton.addActionListener( this ); + + constraints.gridx = 1; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; +// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + JLabel empresaLabel = new JLabel( "" + avisosEstabelecimento[ n ][ 3 ] ); + gridbag.setConstraints( empresaLabel, constraints ); + pan.add( empresaLabel ); + +// JLabel estabelecimentoLabel = new JLabel( "" + estabelecimento.get( EstabelecimentoData.NOME ) ); + JLabel estabelecimentoLabel = new JLabel( "" + avisosEstabelecimento[ n ][ 4 ] ); + gridbag.setConstraints( estabelecimentoLabel, constraints ); + pan.add( estabelecimentoLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + //JLabel descricaoLabel = new JLabel( (String)avisosEstabelecimento[ n ].get( AvisoData.DESCRICAO ) ); + JLabel descricaoLabel = criarDescricao( avisosEstabelecimento[ n ] ); + gridbag.setConstraints( descricaoLabel, constraints ); + pan.add( descricaoLabel ); + + estabelecimentosPanel.add( pan ); + } + + trabalhadoresPanel = new JPanel(); + trabalhadoresPanel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createLineBorder( new Color( 0.0f, 0.0f, 0.0f, 0.0f ), 1 ), "Trabalhadores" ) ); + trabalhadoresPanel.setLayout( new GridLayout( avisosTrabalhador.length, 1 ) ); + + for( int n = 0; n < avisosTrabalhador.length; n++ ) + { + Date dataAviso = ( Date ) avisosTrabalhador[ n ][ 6 ]; + Date dataEvento = ( Date ) avisosTrabalhador[ n ][ 1 ]; + Calendar calAviso = Calendar.getInstance(); + calAviso.setTime( dataAviso ); + Calendar calEvento = Calendar.getInstance(); + calEvento.setTime( dataEvento ); + boolean mesmoDia = + ( calAviso.get( Calendar.YEAR ) == calEvento.get( Calendar.YEAR ) ) && + ( calAviso.get( Calendar.MONTH ) == calEvento.get( Calendar.MONTH ) ) && + ( calAviso.get( Calendar.DAY_OF_MONTH ) == calEvento.get( Calendar.DAY_OF_MONTH ) ); + JPanel pan = new JPanel(); + GridBagLayout gridbag = new GridBagLayout(); + pan.setBorder( BorderFactory.createLineBorder( Color.black, 1 ) ); +// TrabalhadorData trabalhador = (TrabalhadorData)avisosTrabalhador[ n ].get( AvisoData.TRABALHADOR ); +// EstabelecimentoData estabelecimento = (EstabelecimentoData)trabalhador.get( TrabalhadorData.ESTABELECIMENTO ); +// EmpresaData empresa = (EmpresaData)estabelecimento.get( EstabelecimentoData.EMPRESA ); + pan.setLayout( gridbag ); + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridx = 0; + constraints.weightx = 0; + constraints.gridwidth = 1; + JButton tratarButton = new JButton( mesmoDia ? "Confirmar" : "Marcar" ); + gridbag.setConstraints( tratarButton, constraints ); + pan.add( tratarButton ); + //buttonHash.put( tratarButton, avisosTrabalhador[ n ] ); +// buttonHash.put( tratarButton, new Integer( n + avisosEmpresa.length + avisosEstabelecimento.length ) ); +// buttonHash.put( tratarButton, avisosTrabalhador[ n ].get( AvisoData.ID ) ); + buttonHash.put( tratarButton, avisosTrabalhador[ n ][ 0 ] ); + buttonTypeHash.put( tratarButton, new Integer( AvisoConstants.TIPO_TRABALHADOR ) ); + tratarButton.addActionListener( this ); + + constraints.gridx = 1; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; +// JLabel empresaLabel = new JLabel( "" + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + JLabel empresaLabel = new JLabel( "" + avisosTrabalhador[ n ][ 3 ] ); + gridbag.setConstraints( empresaLabel, constraints ); + pan.add( empresaLabel ); + +// JLabel estabelecimentoLabel = new JLabel( "" + estabelecimento.get( EstabelecimentoData.NOME ) ); + JLabel estabelecimentoLabel = new JLabel( "" + avisosTrabalhador[ n ][ 4 ] ); + gridbag.setConstraints( estabelecimentoLabel, constraints ); + pan.add( estabelecimentoLabel ); + +// JLabel trabalhadorLabel = new JLabel( "" + trabalhador.get( TrabalhadorData.NOME ) ); + JLabel trabalhadorLabel = new JLabel( "" + avisosTrabalhador[ n ][ 5 ] ); + gridbag.setConstraints( trabalhadorLabel, constraints ); + pan.add( trabalhadorLabel ); + constraints.gridwidth = GridBagConstraints.REMAINDER; + //JLabel descricaoLabel = new JLabel( (String)avisosTrabalhador[ n ].get( AvisoData.DESCRICAO ) ); + JLabel descricaoLabel = criarDescricao( avisosTrabalhador[ n ] ); + gridbag.setConstraints( descricaoLabel, constraints ); + pan.add( descricaoLabel ); + + trabalhadoresPanel.add( pan ); + } + +// Vector v = new Vector( Arrays.asList( avisosEmpresa ) ); +// v.addAll( Arrays.asList( avisosTrabalhador ) ); +// v.addAll( Arrays.asList( avisosEstabelecimento ) ); +// avisos = (AvisoData []) v.toArray( new AvisoData[0] ); + + JScrollPane scp = new JScrollPane(); + setLayout( new GridLayout( 1, 1 ) ); + add( scp ); + JPanel contentPanel = new JPanel(); + scp.setViewportView( contentPanel ); +// contentPanel.setLayout( new BoxLayout( contentPanel, BoxLayout.Y_AXIS ) ); +// contentPanel.setLayout( new FlowLayout() ); + GridBagLayout gridbag = new GridBagLayout(); + contentPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.weighty = 0; + if( avisosEmpresa.length > 0 ) + { + gridbag.setConstraints( empresaPanel, constraints ); + contentPanel.add( empresaPanel ); + } + if( avisosTrabalhador.length > 0 ) + { +// contentPanel.add( new JLabel( " " ) ); + gridbag.setConstraints( trabalhadoresPanel, constraints ); + contentPanel.add( trabalhadoresPanel ); + } + if( avisosEstabelecimento.length > 0 ) + { +// contentPanel.add( new JLabel( " " ) ); + gridbag.setConstraints( estabelecimentosPanel, constraints ); + contentPanel.add( estabelecimentosPanel ); + } + } + + public void refresh() + { + if( refreshed ) + { + return; + } + refreshed = true; + try + { + provider = ( FichaDataProvider ) FichaDataProvider.getProvider(); +// Collection c = AvisoData.load( AvisoData.class, " estabelecimento_id == \"null\" ", +// AvisoData.DATA_EVENTO + " ascending" ); + +// Collection c = AvisoData.load( AvisoData.class, "(tipo == " + AvisoData.TIPO_EMPRESA+")",// + ") && ( data_aviso <= CURRENT_DATE )", +// AvisoData.DATA_EVENTO + " ascending" ); +// Collection c = AvisoData.load( AvisoData.class, new Object[]{ /*new Integer( AvisoData.TIPO_EMPRESA ), */new Date() }, +// new String[]{ /*"tipo", */"data_aviso" }, +// new String[]{ "=="/*, "==" */}, +// new String[]{ AvisoData.DATA_EVENTO + " ascending" } ); + +// if( c == null ) +// { +// avisosEmpresa = new AvisoData[ 0 ]; +// } +// else +// { +// +// avisosEmpresa = ( AvisoData[] )c.toArray( new AvisoData[ c.size() ] ); +// } + +// Integer ids[] = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_EMPRESA ), new Date() ); +// avisosEmpresa = new AvisoData[ ids.length ]; +// if( JDO == null ) +// { +// JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); +// } +//// System.out.println( "JDO: " + JDO ); +// for( int n = 0; n < avisosEmpresa.length; n++ ) +// { +// avisosEmpresa[ n ] = (AvisoData) JDO.load( AvisoData.class, ids[ n ] ); +// } +// +////System.out.println( "EmpresaData " + avisosEmpresa.length ); +//// c = AvisoData.load( AvisoData.class, " tipo == " + AvisoData.TIPO_ESTABELECIMENTO,// + ") && ( data_aviso <= new Date() )", +//// AvisoData.DATA_EVENTO + " ascending" ); +//// c = AvisoData.load( AvisoData.class, "estabelecimento_id != \"null\" " +//// + " && trabalhador_id == \"null\"", AvisoData.DATA_EVENTO + " ascending" ); +//// if( c == null ) +//// { +//// avisosEstabelecimento = new AvisoData[ 0 ]; +//// } +//// else +//// { +//// avisosEstabelecimento = ( AvisoData[] )c.toArray( new AvisoData[ c.size() ] ); +//// } +// +// ids = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_ESTABELECIMENTO ), new Date() ); +// avisosEstabelecimento = new AvisoData[ ids.length ]; +// for( int n = 0; n < avisosEstabelecimento.length; n++ ) +// { +// avisosEstabelecimento[ n ] = (AvisoData) JDO.load( AvisoData.class, new Object[]{ids[ n ]}, new String[]{ "id" } ); +// } +////System.out.println( "EstabelecimentoData " + avisosEstabelecimento.length ); +//// c = AvisoData.load( AvisoData.class, " tipo == " + AvisoData.TIPO_TRABALHADOR,// + ") && ( data_aviso <= new Date() )", +//// AvisoData.DATA_EVENTO + " ascending" ); +//// c = AvisoData.load( AvisoData.class, "trabalhador_id != \"null\"", AvisoData.DATA_EVENTO + " ascending" ); +//// if( c == null ) +//// { +//// avisosTrabalhador = new AvisoData[ 0 ]; +//// } +//// else +//// { +//// avisosTrabalhador = ( AvisoData[] )c.toArray( new AvisoData[ c.size() ] ); +//// } +// ids = provider.getAvisosIDByTipoAndDate( new Integer( AvisoConstants.TIPO_TRABALHADOR ), new Date() ); +// +// avisosTrabalhador = new AvisoData[ ids.length ]; +// for( int n = 0; n < avisosTrabalhador.length; n++ ) +// { +// avisosTrabalhador[ n ] = (AvisoData) JDO.load( AvisoData.class, ids[ n ] ); +// } +//System.out.println( "trabalhador " + avisosTrabalhador.length ); + avisosEmpresa = provider.getAvisosEmpresaByDate( new Date() ); + avisosEstabelecimento = provider.getAvisosEstabelecimentoByDate( new Date() ); + avisosTrabalhador = provider.getAvisosTrabalhadorByDate( new Date() ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + setupComponents(); + setVisible( true ); + repaint(); + } + + private JLabel criarDescricao( Object aviso[] ) + { + Date dataEvento = ( Date )aviso[ 1 ]; + + String descricao = (String)aviso[ 2 ]; + Calendar cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + + if( !hoje.after( dataEvento ) && !hoje.before( dataEvento ) ) + { + descricao += " hoje"; + } + else + { + descricao += " no dia " + DATE_FORMAT.format( dataEvento ); + } + JLabel descricaoLabel = new JLabel( descricao ); + if( hoje.after( dataEvento ) ) + { + descricaoLabel.setForeground( Color.red ); + } + else if( hoje.equals( dataEvento ) ) + { + descricaoLabel.setForeground( Color.green.darker() ); + } + return descricaoLabel; + } + +// private JLabel criarDescricao( AvisoData aviso ) +// { +// Date dataEvento = ( Date )aviso.get( AvisoData.DATA_EVENTO ); +// +// String descricao = (String)aviso.get( AvisoData.DESCRICAO ); +// String descricao2 = (String)aviso.get( AvisoData.DESCRICAO ); +// Calendar cal = Calendar.getInstance(); +// cal.setTime( dataEvento ); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// dataEvento = cal.getTime(); +// +// cal = Calendar.getInstance(); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// Date hoje = cal.getTime(); +// +// if( !hoje.after( dataEvento ) && !hoje.before( dataEvento ) ) +// { +// descricao += " hoje"; +// } +// else +// { +// descricao += " no dia " + DATE_FORMAT.format( dataEvento ); +// } +// JLabel descricaoLabel = new JLabel( descricao ); +// if( hoje.after( dataEvento ) ) +// { +// descricaoLabel.setForeground( Color.red ); +// } +// else if( hoje.equals( dataEvento ) ) +// { +// descricaoLabel.setForeground( Color.green.darker() ); +// } +// return descricaoLabel; +// } + + public void actionPerformed( ActionEvent e ) + { + if( JDO == null ) + { + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + Object source = e.getSource(); + if( source instanceof JButton ) + { +// AvisoData aviso = (AvisoData) buttonHash.get( source ); + try + { + ( (JButton) source ).setEnabled( false ); + Integer id = (Integer)buttonHash.get( source ); + if( id == null ) + { + return; + } + buttonHash.remove( source ); + AvisoData aviso = (AvisoData) JDO.load( AvisoData.class, id ); + if( aviso == null ) + { + JOptionPane.showMessageDialog( null, "Este aviso j\u00e1 foi tratado.", "J\u00e1 tratado", + JOptionPane.WARNING_MESSAGE ); + return; + } + Hashtable dataHash = aviso.getHashData(); + Date dataEvento = (Date)dataHash.get( AvisoData.DATA_EVENTO ); + Calendar cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + if( hoje.before( dataEvento ) ) + { + AvisoData novoAviso = new AvisoData(); + novoAviso.setHashData( dataHash ); + novoAviso.set( AvisoData.DATA_AVISO, dataEvento ); + novoAviso.save(); + } + + Integer tipo = (Integer) aviso.get( AvisoData.TIPO ); + TrabalhadorData trabalhador; + EstabelecimentoData estabelecimento; + EmpresaData empresa; + + switch( tipo.intValue() ) + { + case AvisoConstants.TIPO_TRABALHADOR: + trabalhador = (TrabalhadorData) aviso.get( AvisoData.TRABALHADOR ); + estabelecimento = (EstabelecimentoData) trabalhador.get( TrabalhadorData.ESTABELECIMENTO ); + empresa = (EmpresaData) estabelecimento.get( EstabelecimentoData.EMPRESA ); + aviso.delete(); + tracker.getMedicinaWindow().setVisible( true ); + tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresaData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentoData.ID ), + ( Integer ) trabalhador.get( TrabalhadorData.ID ) ); + break; + + case AvisoConstants.TIPO_ESTABELECIMENTO: + estabelecimento = (EstabelecimentoData) aviso.get( AvisoData.ESTABELECIMENTO ); + empresa = (EmpresaData) estabelecimento.get( EstabelecimentoData.EMPRESA ); + aviso.delete(); + tracker.getHigieneWindow().setVisible( true ); + tracker.getHigieneWindow().setEmpresaAndEstabelecimento( (Integer) empresa.get( EmpresaData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentoData.ID ) ); + break; + + case AvisoConstants.TIPO_EMPRESA: + empresa = (EmpresaData) aviso.get( AvisoData.EMPRESA ); + aviso.delete(); + ClientesWindow clientesWindow = tracker.getClientesWindow(); + clientesWindow.setVisible( true ); + clientesWindow.setJDOObject( empresa ); + break; + } +System.out.println( "delete aviso" ); +// aviso.set( AvisoData.TRABALHADOR, null ); +// aviso.set( AvisoData.ESTABELECIMENTO, null ); +// aviso.set( AvisoData.EMPRESA, null ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a limpar o aviso", true ); + } + } + } + + public void clear() + { + } + + public void fill(Object value) + { + } + + public Object save() + { + return null; + } + + public void setEnabled( boolean enable ) + { + Set buttonSet = buttonHash.keySet(); + JButton buttons[] = (JButton[]) buttonSet.toArray( new JButton[0] ); + for( int n = 0;n < buttons.length; n++ ) + { + buttons[ n ].setEnabled( enable ); + } + } + + public void setEnabled( boolean enable, int type ) + { + Set buttonSet = buttonHash.keySet(); + JButton buttons[] = (JButton[]) buttonSet.toArray( new JButton[0] ); + for( int n = 0;n < buttons.length; n++ ) + { + Integer buttonType = ( Integer ) buttonTypeHash.get( buttons[ n ] ); + if( buttonType.intValue() == type ) + { + buttons[ n ].setEnabled( enable ); + } + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/ClientesDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/clientes/ClientesDataProvider.java new file mode 100644 index 00000000..1ecb612a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/ClientesDataProvider.java @@ -0,0 +1,210 @@ +/* + * ClientesDataProvider.java + * + * Created on January 27, 2006, 12:50 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; + +/** + * + * @author fpalma + */ +public class ClientesDataProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static ClientesDataProvider instance = null; + private final Executer executer; + + private Integer etiquetaID; + + /** Creates a new instance of ClientesDataProvider */ + public ClientesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new ClientesDataProvider(); + } + } + return instance; + } + + public IDObject[] getAllGruposProtocoloReais() + throws Exception + { + return getAllGruposProtocoloPorTipo( true ); + } + + public IDObject[] getAllGruposProtocoloFalsos() + throws Exception + { + return getAllGruposProtocoloPorTipo( false ); + } + + public IDObject[] getAllGruposProtocoloPorTipo( boolean real ) + throws Exception + { + Select select = + new Select( new String[]{ "prt_grupos_protocolo" }, + new String[]{ "id", "descricao", "ordem" }, + new Field( "grupo_real" ).isEqual( real ? "y" : "n" ), + new String[]{ "ordem" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject grupos[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < grupos.length; n++ ) + { + grupos[ n ] = new MappableObject( ( Integer ) array.get( n, 0 ), ( String ) array.get( n, 1 ) ); + } + return grupos; + } + + public Hashtable getAllTiposElementosProtocoloByGrupo() + throws Exception + { + Select select = + new Select( new String[]{ "prt_tipos_elementos_protocolo" }, + new String[]{ "id", "descricao", "ordem", "grupo_protocolo_id" }, + null, + new String[]{ "grupo_protocolo_id", "ordem" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Hashtable tipos = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + IDObject tipo = new MappableObject( ( Integer ) array.get( n, 0 ), ( String ) array.get( n, 1 ) ); + Integer grupoID = ( Integer ) array.get( n, 3 ); + if( !tipos.containsKey( grupoID ) ) + { + tipos.put( grupoID, new Vector() ); + } + Vector tiposGrupo = ( Vector ) tipos.get( grupoID ); + tiposGrupo.add( tipo ); + } + return tipos; + } + + public void setElementosProtocoloForEmpresa( Integer empresaID, Integer elementos[][] ) + throws Exception + { +// executer.executeQuery( Begin.BEGIN ); + try + { + Delete delete = + new Delete( "prt_elementos_protocolo", + new Field( "empresa_id" ).isEqual( empresaID ) ); + executer.executeQuery( delete ); + for( int p = 0; p < elementos.length; p++ ) + { + Integer numeroPerfil = new Integer( p + 1 ); + for( int e = 0; e < elementos[ p ].length; e++ ) + { + Insert insert = + new Insert( "prt_elementos_protocolo", + new Assignment[]{ + new Assignment( new Field( "empresa_id" ), empresaID ), + new Assignment( new Field( "tipo_elemento_protocolo_id" ), elementos[ p ][ e ] ), + new Assignment( new Field( "numero_perfil" ), numeroPerfil ) } ); + executer.executeQuery( insert, null ); + } + } +// executer.executeQuery( Commit.COMMIT ); + } + catch( Exception ex ) + { +// executer.executeQuery( Rollback.ROLLBACK ); + throw ex; + } + } + + public Integer[][] getElementosProtocoloForEmpresa( Integer empresaID, int numeroPerfis ) + throws Exception + { + Select select = + new Select( new String[]{ "prt_elementos_protocolo" }, + new String[]{ "tipo_elemento_protocolo_id", "numero_perfil" }, + new Field( "empresa_id" ).isEqual( empresaID ) , + new String[]{ "numero_perfil" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Vector data[] = new Vector[ numeroPerfis ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + int perfil = ( ( Integer ) array.get( n, 1 ) ).intValue() - 1; + Integer tipo = ( Integer ) array.get( n, 0 ); + if( data[ perfil ] == null ) + { + data[ perfil ] = new Vector(); + } + data[ perfil ].add( tipo ); + } + Integer elementos[][] = new Integer[ numeroPerfis ][]; + for( int n = 0; n < numeroPerfis; n++ ) + { + if( data[ n ] == null ) + { + elementos[ n ] = new Integer[ 0 ]; + } + else + { + elementos[ n ] = ( Integer [] ) data[ n ].toArray( new Integer[ data[ n ].size() ] ); + } + } + return elementos; + } + + public Integer getEtiquetaID() + throws Exception + { + if( etiquetaID == null ) + { + Select select = + new Select( new String[]{ "etiquetas" }, + new String[]{ "max(id)" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + etiquetaID = ( Integer ) array.get( 0, 0 ); + } + return etiquetaID; + } + + public Integer getEmpresaIDByTrabalhadorID( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores", "estabelecimentos" }, + new String[]{ "estabelecimentos.empresa_id" }, + new Field( "trabalhadores.id" ).isEqual( trabalhadorID ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( + new Field( "estabelecimentos.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( Integer ) array.get( 0, 0 ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/ClientesWindow.java b/tags/teg/SIPRPSoft/src/siprp/clientes/ClientesWindow.java new file mode 100644 index 00000000..65f12e84 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/ClientesWindow.java @@ -0,0 +1,1435 @@ +/* + * ClientesWindow.java + * + * Created on 12 de Maio de 2004, 18:11 + */ + +package siprp.clientes; + +import java.awt.*; +import java.io.*; +import java.text.*; +import java.util.*; +import javax.swing.*; +import javax.swing.event.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.date.*; +import com.evolute.utils.fop.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.strings.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.dialog.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.search.*; +import com.evolute.utils.ui.text.*; +import com.evolute.utils.ui.window.*; +import com.evolute.utils.xml.*; + +import siprp.*; +import siprp.data.*; +import siprp.ficha.*; +import siprp.importer.*; + +/** + * + * @author fpalma + */ +public class ClientesWindow extends EditorWindow + implements ListSelectionListener +{ + private static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + public static final Hashtable TR_IMPORT_NAMES_TO_TRAB = new Hashtable(); + public static final Hashtable TR_IMPORT_NAMES_TO_DEMISSOES = new Hashtable(); + + static + { + TR_IMPORT_NAMES_TO_TRAB.put( Importer.NOME, TrabalhadorData.NOME ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.SEXO, TrabalhadorData.SEXO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.NACIONALIDADE, TrabalhadorData.NACIONALIDADE ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.DATA_NASCIMENTO, TrabalhadorData.DATA_NASCIMENTO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.NUMERO_MECANOGRAFICO, TrabalhadorData.NUMERO_MECANOGRAFICO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.DATA_ADMISSAO, TrabalhadorData.DATA_ADMISSAO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.CATEGORIA, TrabalhadorData.CATEGORIA ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.LOCAL_TRABALHO, TrabalhadorData.LOCAL_TRABALHO ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.FUNCAO, TrabalhadorData.FUNCAO_PROPOSTA ); + TR_IMPORT_NAMES_TO_TRAB.put( Importer.DATA_ADMISSAO_FUNCAO, TrabalhadorData.DATA_ADMISSAO_FUNCAO ); + + TR_IMPORT_NAMES_TO_DEMISSOES.put( Importer.NOME, TrabalhadorData.NOME ); + TR_IMPORT_NAMES_TO_DEMISSOES.put( Importer.DATA_DEMISSAO, TrabalhadorData.DATA_DEMISSAO ); + +// JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EmpresaData.class ); +// JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, EstabelecimentoData.class ); +// JDOObject.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, TrabalhadorData.class ); +// +// JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEmpresaData.class ); +// JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoEstabelecimentoData.class ); +// JDOObject.registerOperationHandlerForClass( MarcacaoSaveAndDeleteHandler.INSTANCE, MarcacaoTrabalhadorData.class ); + } + + public static final int INDEX_EMPRESA = 0; + public static final int INDEX_ESTABELECIMENTO = 1; + public static final int INDEX_TRABALHADOR = 2; + + private static int hierarchy[] = new int[]{0,0,1}; + private static int permissions[][] = + new int[][]{ { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, SELECT_BYNAME_INDEX, DELETE_INDEX }, + { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX }, + { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX } }; + + private JDOProvider JDO; + private ClientesDataProvider clientesProvider; + private ControllableComponent panels[] = new ControllableComponent[ 4 ]; + private EmpresaPanel empresaPanel; + private JPanel estabelecimentoOuterPanel; + private JTabbedPane tabbedPane; + private JTextField estabelecimentoText; + private EstabelecimentoPanel estabelecimentoPanel; + private TrabalhadorPanel trabalhadorPanel; + + private SIPRPTracker tracker; + + private EmpresaData empresa; + private Integer elementosProtocolo[][]; + private EstabelecimentoData estabelecimento; + private TrabalhadorData trabalhador; + + private AvisosPanel avisos; + + protected boolean webAware; + +// public static void main( String args[] ) +// throws Exception +// { +// ClientesWindow window = new ClientesWindow(); +// window.show(); +// } + + /** Creates a new instance of ClientesWindow */ + public ClientesWindow( AvisosPanel avisos ) + throws Exception + { + super( permissions ); + this.avisos = avisos; + webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + clientesProvider = ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + setEditorManagerHierarchy( hierarchy ); + setupComponents(); + this.setExtendedState(this.getExtendedState() | this.MAXIMIZED_BOTH); + } + + private void setupComponents() + throws Exception + { + setSize( 1000, 740 ); + setTitle( "Gest\u00e3o de Clientes" ); + + changeGroupName( INDEX_ESTABELECIMENTO, "Estabelecimento" ); + JPanel toolbarEstabelecimento = getToolbarPanel( INDEX_ESTABELECIMENTO ); + + changeGroupName( INDEX_TRABALHADOR, "Trabalhador" ); + JPanel toolbarTrabalhador = getToolbarPanel( INDEX_TRABALHADOR ); + + tabbedPane = new JTabbedPane(); + empresaPanel = new EmpresaPanel(); + empresaPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Empresa/Entidade" ) ); + estabelecimentoText = new JTextField(); + estabelecimentoPanel = new EstabelecimentoPanel( toolbarEstabelecimento, estabelecimentoText, empresaPanel.getEstabelecimentosTable() ); + estabelecimentoOuterPanel = new JPanel(); + estabelecimentoOuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Estabelecimento" ) ); + JLabel estabelecimentoLabel = new JLabel( "Designa\u00e7\u00e3o" ); + + trabalhadorPanel = new TrabalhadorPanel( toolbarTrabalhador, empresaPanel.getEstabelecimentosTable() ); + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + + constraints.weighty = 0.5; + constraints.gridheight = 1; + gridbag.setConstraints( empresaPanel, constraints ); + getContentPane().add( empresaPanel ); + + constraints.weighty = 0.5; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentoOuterPanel, constraints ); + getContentPane().add( estabelecimentoOuterPanel ); + + gridbag = new GridBagLayout(); + estabelecimentoOuterPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + + constraints.weightx = 0; + constraints.gridwidth = 1; + constraints.weighty = 0; + constraints.gridheight = 1; + gridbag.setConstraints( estabelecimentoLabel, constraints ); + estabelecimentoOuterPanel.add( estabelecimentoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentoText, constraints ); + estabelecimentoOuterPanel.add( estabelecimentoText ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( tabbedPane, constraints ); + estabelecimentoOuterPanel.add( tabbedPane ); + + tabbedPane.add( "Dados", estabelecimentoPanel ); + tabbedPane.add( "Trabalhadores", trabalhadorPanel ); + + panels[ INDEX_EMPRESA ] = empresaPanel; + panels[ INDEX_ESTABELECIMENTO ] = estabelecimentoPanel; + panels[ INDEX_TRABALHADOR ] = trabalhadorPanel; + //empresaPanel.addListSelectionListener( estabelecimentoPanel ); + empresaPanel.addListSelectionListener( trabalhadorPanel ); + empresaPanel.addListSelectionListener( this ); + trabalhadorPanel.addListSelectionListener( this ); + + registerAction( new ActionHandler(){ + public void execute() + { + excel(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Importar", + "Importar de Excel", "excel", + 0, true ); + + registerAction( new ActionHandler(){ + public void execute() + { + excelDemissoes(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Demiss\u00f5es", + "Demiss\u00f5es por Excel", null, + 0, true ); + + registerAction( new ActionHandler(){ + public void execute() + { + mudarEstabelecimento(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Mudar Estabelecimento", + "Mudar Estabelecimento", null, + INDEX_TRABALHADOR, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + imprimirFicha(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction ; + } + }, "Imprimir Ficha de Aptid\u00e3o", + "Imprimir Ficha de Aptid\u00e3o", null, + INDEX_TRABALHADOR, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + imprimirEtiquetaTrabalhador(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction ; + } + }, "Imprimir Etiqueta", + "Imprimir Etiqueta de Trabalhador", null, + INDEX_TRABALHADOR, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + imprimirEtiquetaEstabelecimento(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction ; + } + }, "Imprimir Etiqueta", + "Imprimir Etiqueta de Estabelecimento", null, + INDEX_ESTABELECIMENTO, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + restaurarEmpresa(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return true; + } + }, "Restaurar Empresa", + "Restaurar Empresa", null, + INDEX_EMPRESA, false ); + + if( webAware ) + { + registerAction( new ActionHandler(){ + public void execute() + { + utilizadorWeb( false ); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return editAction; + } + }, "Utilizador Web da Empresa", + "Utilizador Web da Empresa", null, + INDEX_EMPRESA, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + utilizadorWeb( true ); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return true; + } + }, "Utilizador Web", + "Utilizador Web", null, + INDEX_EMPRESA, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + noticias(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return true; + } + }, "Not\u00edcias", + "Not\u00edcias", null, + INDEX_EMPRESA, false ); + } + + registerAction( new ActionHandler(){ + public void execute() + { + restaurarEstabelecimento(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return newAction || saveAction; + } + }, "Restaurar Estabelecimento", + "Restaurar Estabelecimento", null, + INDEX_ESTABELECIMENTO, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + restaurarTrabalhador(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return newAction || saveAction; + } + }, "Restaurar Trabalhador", + "Restaurar Trabalhador", null, + INDEX_TRABALHADOR, false ); + + new CopyPasteHandler( estabelecimentoText ); + } + + public boolean searchByName( ) + { + SearchDialog search; + Integer empresaID; +// switch( index ) +// { +// case INDEX_EMPRESA: + search = new SearchDialog( SearchExecuterFactory.getSearchExecuter( EmpresaData.class ), null, false, null, true ); + empresaID = ( Integer )search.getSelected(); + if( empresaID != null ) + { + try + { + empresa = (EmpresaData) JDO.load( EmpresaData.class, empresaID ); + elementosProtocolo = clientesProvider.getElementosProtocoloForEmpresa( empresaID, 2 ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar a empresa", true ); + empresa = null; + } + reload( INDEX_EMPRESA ); + } +// break; +// } + return true; + } + + public boolean newItem( int index ) + { + return true; + } + + public void reload( int index ) + { +//System.out.println( "RELOAD: " + index + " e: " + empresa + " e: " +estabelecimento + " t: " + trabalhador ); + switch( index ) + { + case INDEX_EMPRESA: + empresaPanel.fill( new Object[]{ empresa, elementosProtocolo } ); + estabelecimentoPanel.setEmpresa( empresa ); + break; + + case INDEX_ESTABELECIMENTO: +// trabalhadorPanel.fill( null ); + estabelecimentoPanel.fill( estabelecimento ); + trabalhadorPanel.setEstabelecimento( estabelecimento ); + break; + + case INDEX_TRABALHADOR: + trabalhadorPanel.fill( trabalhador ); +// trabalhadorPanel.reload(); + break; + + } + } + + public boolean save( int index ) + { + boolean isNew = false; + Object object = panels[ index ].save(); + try + { + switch( index ) + { + case INDEX_EMPRESA: + empresa = (EmpresaData) ( ( Object [] )object )[ 0 ]; + if( empresa.get( EmpresaData.ID ) == null ) + { + isNew = true; + } + elementosProtocolo = (Integer [][]) ( ( Object [] )object )[ 1 ]; + // System.out.println( empresa.debug() ); + ContactoData c1 = ( ContactoData )empresa.get( EmpresaData.CONTACTO_1 ); + ContactoData c2 = ( ContactoData )empresa.get( EmpresaData.CONTACTO_2 ); +// empresa.set( EmpresaData.CONTACTO_1, null ); +// empresa.set( EmpresaData.CONTACTO_2, null ); +// empresa.save(); + +// empresa.set( EmpresaData.CONTACTO_1, c1 ); + +// empresa.set( EmpresaData.CONTACTO_2, c2 ); + c1.save(); + c2.save(); + +// empresa.set( EmpresaData.INACTIVO, "n" ); + empresa.set( EmpresaData.DESIGNACAO_SOCIAL_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ) ); + empresa.save(); + clientesProvider.setElementosProtocoloForEmpresa( + ( Integer ) empresa.get( EmpresaData.ID ), elementosProtocolo ); + + if( isNew ) + { + estabelecimentoPanel.setEmpresa( empresa ); + } + ( ( EmpresaPanel )panels[ INDEX_EMPRESA ] ).reloadMarcacoes(); + break; + + case INDEX_ESTABELECIMENTO: + estabelecimento = (EstabelecimentoData) object; + if( estabelecimento.get( EstabelecimentoData.ID ) == null ) + { + isNew = true; + } + ContactoData c = ( ContactoData )estabelecimento.get( EstabelecimentoData.CONTACTO ); + c.save(); + if( estabelecimento.get( EstabelecimentoData.EMPRESA ) == null ) + { + JOptionPane.showMessageDialog( this, "Erro a guardar estabelecimento (NULL).", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return false; + } + estabelecimento.set( EstabelecimentoData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + estabelecimento.get( EstabelecimentoData.NOME ) ) ); + estabelecimento.save(); + estabelecimentoPanel.postSave(); + if( isNew ) + { + trabalhadorPanel.setEstabelecimento( estabelecimento ); + } + break; + + case INDEX_TRABALHADOR: + trabalhador = (TrabalhadorData) object; + trabalhador.set( TrabalhadorData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + trabalhador.get( TrabalhadorData.NOME ) ) ); + trabalhador.save(); + trabalhadorPanel.postSave(); + break; + + default: + ( ( JDOObject )object ).save(); + } +// object.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + //reload( index ); + return true; + } + + public void enableComponents( int index, boolean enable ) + { + panels[ index ].setEnabled( enable ); + avisos.setEnabled( !empresaPanel.isEnabled() && !estabelecimentoPanel.isEnabled() && !trabalhadorPanel.isEnabled(), + AvisoConstants.TIPO_EMPRESA ); + } + + public void clear( int index ) + { + panels[ index ].fill( null ); + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + Integer id; + if( source.equals( empresaPanel ) ) + { + id = empresaPanel.getSelectedEstabelecimento(); + if( id != null ) + { + select( INDEX_ESTABELECIMENTO ); + try + { + estabelecimento = ( EstabelecimentoData ) JDO.load( EstabelecimentoData.class, id ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar o estabelecimento", true ); + estabelecimento = null; + } + + } + else + { + estabelecimento = null; + } + reload( INDEX_ESTABELECIMENTO ); + } + else if( source.equals( trabalhadorPanel ) ) + { + id = trabalhadorPanel.getSelectedTrabalhador(); +//System.out.println( "trabalhadorid: " + id ); + if( id != null ) + { + try + { + trabalhador = (TrabalhadorData) JDO.load( TrabalhadorData.class, id ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar o trabalhador", true ); + trabalhador = null; + } + select( INDEX_TRABALHADOR ); + } + else + { + trabalhador = null; + } + + reload( INDEX_TRABALHADOR ); + } + } + + public boolean delete( int index ) + { + String yes = "Sim"; + String no = "N\u00e3o"; + switch( index ) + { + case INDEX_EMPRESA: + if( empresa == null ) + { + return false; + } + if( JOptionPane.showOptionDialog( + this, "Tem a certeza que quer apagar esta Empresa?", "Apagar Empresa...", + JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, new String[]{ no, yes }, no ) == 1 ) + { + try + { + empresa.delete(); + empresa = null; + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar", true ); + return false; + } + return true; + } + break; + case INDEX_ESTABELECIMENTO: + if( estabelecimento == null ) + { + return false; + } + if( JOptionPane.showOptionDialog( + this, "Tem a certeza que quer apagar este Estabelecimento?", "Apagar Estabelecimento...", + JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, new String[]{ no, yes }, no ) == 1 ) + { + try + { + estabelecimento.delete(); + estabelecimento = null; + reload( INDEX_EMPRESA ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar", true ); + return false; + } + return true; + } + break; + case INDEX_TRABALHADOR: + if( trabalhador == null ) + { + return false; + } + if( JOptionPane.showOptionDialog( + this, "Tem a certeza que quer apagar este Trabalhador?", "Apagar Trabalhador...", + JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, new String[]{ no, yes }, no ) == 1 ) + { + try + { + TrabalhadorData trabalhadorAux = trabalhador; + trabalhador = null; + trabalhadorAux.delete(); + + reload( INDEX_ESTABELECIMENTO ); + try + { + trabalhadorPanel.reloaList(); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar", true ); + return false; + } + return true; + } + break; + } + return false; + } + + private void excel() + { + FileDialog fd = new FileDialog( this, "Escolha um ficheiro Excel:", FileDialog.LOAD ); + fd.setDirectory( System.getProperty( "user.home" ) ); + fd.setFilenameFilter( new FilenameFilter() { + public boolean accept( File dir, String name ) + { + return (name!=null) && (name.indexOf( ".xls" ) != -1); + } + } ); + fd.setVisible( true ); + //String filename = "c:\\test.xls"; + String filename = fd.getFile(); + if( filename != null ) + { + filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( this, filename, true, Importer.TYPE_ADMISSAO ); + Hashtable hash[] = importer.getMultipleData(); + Vector activate = new Vector(); + if( hash != null ) + { + // load all (active) trabalhadores for this company + IDObject trab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllTrabalhadoresForEmpresa( + ( Integer )empresa.get( EmpresaData.ID ) ); + Hashtable trabalhadores = new Hashtable(); + for( int i = 0; i < trab.length; ++i ) + { + trabalhadores.put( trab[ i ].toString().trim().toLowerCase(), trab[ i ].getID() ); + } + // load all active estabelecimentos for this company + IDObject estab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEstabelecimentosForEmpresa( + ( Integer )empresa.get( EmpresaData.ID ) ); + Hashtable estabelecimentos = new Hashtable(); + for( int i = 0; i < estab.length; ++i ) + { + estabelecimentos.put( estab[ i ].toString().trim().toLowerCase(), estab[ i ].getID() ); + } + Hashtable estabCache = new Hashtable(); + for( int i = 0; i < hash.length; ++i ) + { +// if( hash[ i ] == null ) +// { +// continue; +// } + for( int j = 0; j < Importer.NAMES.length; ++j ) + { + if( hash[ i ] == null ) + { + continue; + } + Object value = hash[ i ].remove( Importer.NAMES[ j ] ); + if( Importer.NAMES[ j ].equals( Importer.NOME ) ) + { + if( value != null + && trabalhadores.get( value.toString().trim().toLowerCase() ) == null ) + { + trabalhadores.put( value.toString().trim().toLowerCase(), value ); + + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.NOME ), + value.toString().trim() ); + hash[ i ].put( TrabalhadorData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( value.toString().trim(), false, false ) ); + } + else + { + Integer tID = (Integer) trabalhadores.get( value.toString().trim().toLowerCase() ); + if( tID != null ) + { + activate.add( tID ); + } + hash[ i ] = null; + } + } + else if( Importer.NAMES[ j ].equals( Importer.LOCAL_TRABALHO ) ) + { + if( value == null ) + { + value = "sede"; + } + Integer eid = ( Integer )estabelecimentos.get( value.toString().trim().toLowerCase() ); + EstabelecimentoData esta; + if( eid == null ) + { + // save this estab + esta = new EstabelecimentoData(); + esta.set( EstabelecimentoData.EMPRESA, empresa ); + esta.set( EstabelecimentoData.NOME, value.toString().trim() ); + esta.set( EstabelecimentoData.NOME_PLAIN, com.evolute.utils.strings.StringPlainer.convertString( value.toString().trim(), false, false ) ); + esta.save(); + estabelecimentos.put( value.toString().trim().toLowerCase(), + esta.get( EstabelecimentoData.ID ) ); + + } + else + { + esta = ( EstabelecimentoData )estabCache.get( value ); + if( esta == null ) + { + esta = (EstabelecimentoData) JDO.load( EstabelecimentoData.class, eid ); + estabCache.put( value, esta ); + } + } +//System.out.println( "Put " + i + " esta " + esta.debug() ); + hash[ i ].put( TrabalhadorData.ESTABELECIMENTO, + esta ); + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.LOCAL_TRABALHO ), + value.toString().trim() ); + } + else + { + if( Importer.NAMES[ j ].indexOf( Importer.DATA_PREFIX ) == 0 ) + { + value = DateUtils.guessDate( (String)value ); + if( value != null ) + { + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.NAMES[ j ] ), + value ); + } + } + else + { + if( Importer.NAMES[ j ].equals( Importer.SEXO ) ) + { + if( value == null || ( (String) value ).length() == 0 ) + { + value = "m"; + } + else + { + value = ( (String) value ).substring(0,1).toLowerCase(); + if( !value.equals( "m" ) && !value.equals( "f" ) ) + { + value = "m"; + } + } + } + if( value != null ) + { + hash[ i ].put( TR_IMPORT_NAMES_TO_TRAB.get( Importer.NAMES[ j ] ), + value.toString().trim() ); + } + } + } + } + } + for( int i = 0; i < hash.length; ++i ) + { + if( hash[ i ] == null ) + { + continue; + } + // save trab + TrabalhadorData tr = new TrabalhadorData(); + tr.setHashData( hash[ i ] ); +// o estabelecimento nao faz parte da lista por causa do UI + tr.set( TrabalhadorData.ESTABELECIMENTO, + hash[ i ].get( TrabalhadorData.ESTABELECIMENTO ) ); + tr.set( TrabalhadorData.PERFIL, new Integer( 1 ) ); +// System.out.println( "T: " + i + "\n" + tr.debug() ); + tr.save(); + } + for( int i = 0; i < activate.size(); i++ ) + { + TrabalhadorData trabalhadorR = (TrabalhadorData)JDO.load( TrabalhadorData.class, ( Integer ) activate.elementAt( i ) ); + trabalhadorR.set( TrabalhadorData.INACTIVO, "n" ); + trabalhadorR.save(); + } + } + reload( INDEX_EMPRESA ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( this, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } + + } + + private void excelDemissoes() + { + FileDialog fd = new FileDialog( this, "Escolha um ficheiro Excel:", FileDialog.LOAD ); + fd.setDirectory( System.getProperty( "user.home" ) ); + fd.setFilenameFilter( new FilenameFilter() { + public boolean accept( File dir, String name ) + { + return (name!=null) && (name.indexOf( ".xls" ) != -1); + } + } ); + fd.setVisible( true ); + //String filename = "c:\\test.xls"; + String filename = fd.getFile(); + if( filename != null ) + { + filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( this, filename, true, Importer.TYPE_DEMISSAO ); + Hashtable hash[] = importer.getMultipleData(); + Vector invalidos = new Vector(); + Vector validos = new Vector(); + Vector semData = new Vector(); + if( hash != null ) + { + // load all (active) trabalhadores for this company + IDObject trab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllTrabalhadoresForEmpresa( + ( Integer )empresa.get( EmpresaData.ID ) ); + Hashtable trabalhadores = new Hashtable(); + for( int i = 0; i < trab.length; ++i ) + { + trabalhadores.put( StringPlainer.convertString( + trab[ i ].toString().trim().toLowerCase() ), trab[ i ].getID() ); + } + Hashtable estabCache = new Hashtable(); + for( int i = 0; i < hash.length; ++i ) + { +// if( hash[ i ] == null ) +// { +// continue; +// } + for( int j = 0; j < Importer.NAMES_DEMISSAO.length; ++j ) + { + if( hash[ i ] == null ) + { + continue; + } + Object value = hash[ i ].remove( Importer.NAMES_DEMISSAO[ j ] ); + if( Importer.NAMES_DEMISSAO[ j ].equals( Importer.NOME ) ) + { +System.out.println( "VALUE NOME: " + value ); + if( value != null + && !trabalhadores.containsKey( StringPlainer.convertString( value.toString().trim().toLowerCase() ) ) ) + { + invalidos.add( new String[]{ value.toString().trim(), + StringPlainer.convertString( value.toString().trim(), false, false ) } ); + hash[ i ] = null; + } + else if( value != null ) + { + Integer tID = (Integer) trabalhadores.get( StringPlainer.convertString( value.toString().trim().toLowerCase() ) ); + hash[ i ].put( TrabalhadorData.ID, tID ); + validos.add( new String[]{ value.toString().trim(), + StringPlainer.convertString( value.toString().trim(), false, false ) } ); + } + else + { + hash[ i ] = null; + } + } + else if( Importer.NAMES_DEMISSAO[ j ].equals( Importer.DATA_DEMISSAO ) ) + { + value = DateUtils.guessDate( (String)value ); + if( value != null ) + { + hash[ i ].put( TR_IMPORT_NAMES_TO_DEMISSOES.get( Importer.NAMES_DEMISSAO[ j ] ), + value ); + } + else + { + hash[ i ] = null; + validos.removeElementAt( validos.size() - 1 ); + semData.add( new String[]{ value.toString().trim(), + StringPlainer.convertString( value.toString().trim(), false, false ) } ); + } + } + } + } +//System.out.println( "HASH.LENGTH: " + hash.length ); + for( int i = 0; i < hash.length; ++i ) + { +//System.out.println( "HASH[ " + i + " ]: " + hash[ i ] ); + if( hash[ i ] == null ) + { +//System.out.println( "TRABALHADOR:continue" ); + continue; + } +//System.out.println( "TRABALHADOR:not continue" ); + TrabalhadorData tr = (TrabalhadorData)JDO.load( TrabalhadorData.class, ( Integer ) hash[ i ].get( TrabalhadorData.ID ) ); +//System.out.println( "TRABALHADORID: " + tr.get( TrabalhadorData.ID ) ); + tr.set( TrabalhadorData.DATA_DEMISSAO, hash[ i ].get( TrabalhadorData.DATA_DEMISSAO ) ); +//System.out.println( "TRABALHADORDEMISSAO: " + tr.get( TrabalhadorData.DATA_DEMISSAO ) ); + tr.save(); + } + StringBuffer buff = new StringBuffer( "" ); + buff.append( "Demitidos:\n" ); + for( int i = 0; i < validos.size(); i++ ) + { + buff.append( ( ( String [] ) validos.elementAt( i ) )[ 1 ] + "\n" ); + } + buff.append( "\nSem data ou data inv\u00e1lida:\n" ); + for( int i = 0; i < semData.size(); i++ ) + { + buff.append( ( ( String [] ) semData.elementAt( i ) )[ 1 ] + "\n" ); + } + buff.append( "\nN\u00e3o encontrados na base de dados:\n" ); + for( int i = 0; i < invalidos.size(); i++ ) + { + buff.append( ( ( String [] ) invalidos.elementAt( i ) )[ 1 ] + "\n" ); + } + new LongMessageDialog( this, false, buff.toString(), new Dimension( 600, 500 ) ); + } + reload( INDEX_EMPRESA ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( this, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } + + } + + public void mudarEstabelecimento() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Escolher"; + } + + public boolean executeListAction( int line, Object value ) + { + if( trabalhador == null ) + { + return false; + } + try + { + EstabelecimentoData eatabelecimentoNovo = (EstabelecimentoData)JDO.load( EstabelecimentoData.class, ( (IDObject)value ).getID() ); + trabalhador.set( TrabalhadorData.ESTABELECIMENTO, eatabelecimentoNovo ); + trabalhador.save(); + trabalhador = null; + reload( INDEX_ESTABELECIMENTO ); + trabalhadorPanel.reloaList(); + } + catch( Exception ex ) + { + ex.printStackTrace(); + return false; + } + return true; + } + }; + + try + { + IDObject estab[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEstabelecimentosForEmpresa( + ( Integer )empresa.get( EmpresaData.ID ) ); + ListActionDialog dialog = new ListActionDialog( this, "Escolher Estabelecimento", new String []{ "Designa\u00e7\u00e3o" }, + new Vector( Arrays.asList( estab ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + + public void setJDOObject( JDOObject object ) + { + empresa = null; + estabelecimento = null; + trabalhador = null; + reload(0); + if( object instanceof TrabalhadorData ) + { + tabbedPane.setSelectedIndex( 1 ); + trabalhador = (TrabalhadorData) object; + estabelecimento = (EstabelecimentoData)trabalhador.get( TrabalhadorData.ESTABELECIMENTO ); + empresa = (EmpresaData)estabelecimento.get( EstabelecimentoData.EMPRESA ); + } + else if( object instanceof EstabelecimentoData ) + { + tabbedPane.setSelectedIndex( 0 ); + estabelecimento = (EstabelecimentoData)object; + empresa = (EmpresaData)estabelecimento.get( EstabelecimentoData.EMPRESA ); + } + else if( object instanceof EmpresaData ) + { + empresa = (EmpresaData)object; + } + if( empresa != null ) + { + try + { + elementosProtocolo = + clientesProvider.getElementosProtocoloForEmpresa( + ( Integer ) empresa.get( EmpresaData.ID ), 2 ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados do protocolo.", true ); + elementosProtocolo = new Integer[2][0]; + } + } + reload(0); + if( empresa != null ) + { + select( INDEX_EMPRESA ); + } + if( estabelecimento != null ) + { + empresaPanel.setSelectedEstabelecimento( estabelecimento ); + } + if( trabalhador != null ) + { + trabalhadorPanel.setSelectedTrabalhador( trabalhador ); + } + } + + public void postSetup() + { + } + + public void restaurarEmpresa() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Restaurar"; + } + + public boolean executeListAction( int line, Object value ) + { + try + { + EmpresaData empresaR = (EmpresaData)JDO.load( EmpresaData.class, ( (IDObject)value ).getID() ); + empresaR.set( EmpresaData.INACTIVO, "n" ); + empresaR.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a restaurar a Empresa", true ); + return false; + } + return true; + } + }; + + try + { + IDObject empresas[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEmpresasDeleted(); + ListActionDialog dialog = new ListActionDialog( this, "Restaurar Empresa", new String []{ "Designa\u00e7\u00e3o Social" }, + new Vector( Arrays.asList( empresas ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Empresas", true ); + ex.printStackTrace(); + } + } + + public void restaurarEstabelecimento() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Restaurar"; + } + + public boolean executeListAction( int line, Object value ) + { + try + { + EstabelecimentoData estabelecimentoR = (EstabelecimentoData)JDO.load( EstabelecimentoData.class, ( (IDObject)value ).getID() ); + estabelecimentoR.set( EstabelecimentoData.INACTIVO, "n" ); + estabelecimentoR.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a restaurar o Estabelecimento", true ); + return false; + } + return true; + } + }; + if( empresa == null ) + { + return; + } + try + { + IDObject estabelecimentos[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllEstabelecimentosDeletedForEmpresa( ( Integer ) empresa.get( EmpresaData.ID ) ); + ListActionDialog dialog = new ListActionDialog( this, "Restaurar Estabelecimento", new String []{ "Nome" }, + new Vector( Arrays.asList( estabelecimentos ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Estabelecimentos", true ); + ex.printStackTrace(); + } + } + + public void restaurarTrabalhador() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Restaurar"; + } + + public boolean executeListAction( int line, Object value ) + { + try + { + TrabalhadorData trabalhadorR = (TrabalhadorData)JDO.load( TrabalhadorData.class, ( (IDObject)value ).getID() ); + trabalhadorR.set( TrabalhadorData.INACTIVO, "n" ); + trabalhadorR.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a restaurar o Trabalhador", true ); + return false; + } + return true; + } + }; + if( estabelecimento == null ) + { + return; + } + try + { + IDObject trabalhadores[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllTrabalhadoresDeletedForEstabelecimento( ( Integer ) estabelecimento.get( EstabelecimentoData.ID ) ); + ListActionDialog dialog = new ListActionDialog( this, "Restaurar Trabalhador", new String []{ "Nome" }, + new Vector( Arrays.asList( trabalhadores ) ), lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Trabalhadores", true ); + ex.printStackTrace(); + } + } + + protected void utilizadorWeb( boolean siprp ) + { +// new Exception().printStackTrace(); + if( !siprp && empresa == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher uma empresa", "Erro...", + JOptionPane.ERROR_MESSAGE ); + } + try + { + + UserWindow window = new UserWindow( this, siprp ? null : ( Integer ) empresa.get( EmpresaData.ID ) ); + window.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a estabelecer a liga\u00e7\u00e3o com a p\u00e1gina", true ); + } + } + + public void noticias() + { + try + { + NoticiasDialog dialog = new NoticiasDialog( this ); + dialog.setVisible( true ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar not\u00edcias", true ); + } + } + + public void imprimirFicha() + { + ListAction lAction = new ListAction(){ + public String getListActionName() + { + return "Escolher"; + } + + public boolean executeListAction( int line, Object value ) + { + if( trabalhador == null ) + { + return false; + } + try + { + printFicha(( (IDObject)value ).getID() ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + return false; + } + return true; + } + }; + if( trabalhador == null ) + { + return; + } + Vector linhas; + try + { + IDObject fichas[] = ( ( FichaDataProvider )FichaDataProvider.getProvider() + ).getAllFichasForTrabalhador( ( Integer ) trabalhador.get( TrabalhadorData.ID ) ); + linhas = new Vector( Arrays.asList( fichas ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true ); + return; + } + ListActionDialog dialog = new ListActionDialog( this, "Imprimir Fichas Anteriores", new String[]{ "Data" }, + linhas, lAction ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + + private void printFicha( Integer exameID ) + throws Exception + { +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); + ExameData exame = (ExameData) JDO.load( ExameData.class, exameID ); + byte pdf[] = (byte []) exame.get( ExameData.PDF ); + if( exame == null ) + { + throw new Exception( "N\u00e3o existe exame" ); + } + TrabalhadorData trabalhadorExame = ( TrabalhadorData ) exame.get( ExameData.TRABALHADOR ); + String nomeFicheiro = StringPlainer.convertString( ( String ) trabalhadorExame.get( TrabalhadorData.NOME ) ); + nomeFicheiro.replaceAll( " ", "_" ); + ExamePDF ePDF = new ExamePDF(); + ePDF.print( pdf, nomeFicheiro ); + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + estabelecimentoPanel.setTracker( tracker ); + trabalhadorPanel.setTracker( tracker ); + } + + public void imprimirEtiquetaTrabalhador() + { + if( trabalhador == null ) + { + return; + } + String nomeEmpresa = ( ( String ) empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + String nomeTrabalhador = ( ( String ) trabalhador.get( TrabalhadorData.NOME ) ); + String numeroMecanografico = ( ( String ) trabalhador.get( TrabalhadorData.NUMERO_MECANOGRAFICO ) ); + String sexo = "m".equals( trabalhador.get( TrabalhadorData.SEXO ) ) ? "M" : "F"; + Date data = ( Date ) trabalhador.get( TrabalhadorData.DATA_NASCIMENTO ); + String dataNascimento = data != null ? DF.format( data ) : "--"; + String nacionalidade = ( String ) trabalhador.get( TrabalhadorData.NACIONALIDADE ); + data = ( Date ) trabalhador.get( TrabalhadorData.DATA_ADMISSAO ); + String dataAdmissao = data != null ? DF.format( data ) : "--"; + String categoria = ( String ) trabalhador.get( TrabalhadorData.CATEGORIA ); + String funcao = ( String ) trabalhador.get( TrabalhadorData.FUNCAO_PROPOSTA ); + try + { + Integer id = clientesProvider.getEtiquetaID(); + EtiquetaData etiqueta = ( EtiquetaData ) JDO.load( EtiquetaData.class, id ); + EtiquetaPrinter printer = new EtiquetaPrinter( etiqueta ); + Vector linhas = new Vector(); + linhas.add( new Object[]{ nomeEmpresa, new Double( 1.0 ) } ); + linhas.add( new Object[]{ nomeTrabalhador, new Double( 1.0 ) } ); + linhas.add( new Object[]{ "N\u00ba mec.:" + ( numeroMecanografico != null ? numeroMecanografico.toString() : "" ), new Double( 0.80 ), + "Sexo:" + sexo, new Double( 0.20 ) } ); + linhas.add( new Object[]{ "Data nasc:" + dataNascimento, new Double( 0.4 ), + "Nacionalidade:" + nacionalidade, new Double( 0.85 ) } ); + linhas.add( new Object[]{ "Data adm.:" + dataAdmissao, new Double( 0.4 ), + "Categoria:" + categoria, new Double( 0.6 ) } ); + linhas.add( new Object[]{ "Fun\u00e7\u00e3o:" + funcao, new Double( 1.0 ) } ); + printer.print( linhas ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar etiqueta.", true ); + } + } + + public void imprimirEtiquetaEstabelecimento() + { + if( estabelecimento == null ) + { + return; + } + String nomeEmpresa = ( ( String ) empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + String nomeEstabelecimento = ( ( String ) estabelecimento.get( EstabelecimentoData.NOME ) ); + ContactoData contacto = ( ContactoData )estabelecimento.get( EstabelecimentoData.CONTACTO ); + String nomeContacto = ""; + if( contacto != null ) + { + nomeContacto = ( String )contacto.get( ContactoData.NOME ); + } + String morada = ( ( String ) estabelecimento.get( EstabelecimentoData.MORADA ) ); + String codigoPostal = ( ( String ) estabelecimento.get( EstabelecimentoData.CODIGO_POSTAL ) ); + String local = ( ( String ) estabelecimento.get( EstabelecimentoData.LOCALIDADE ) ); + + try + { + Integer id = clientesProvider.getEtiquetaID(); + EtiquetaData etiqueta = ( EtiquetaData ) JDO.load( EtiquetaData.class, id ); + EtiquetaPrinter printer = new EtiquetaPrinter( etiqueta ); + Vector linhas = new Vector(); + linhas.add( new Object[]{ nomeEmpresa, new Double( 1.0 ) } ); + linhas.add( new Object[]{ nomeContacto, new Double( 1.0 ) } ); + linhas.add( new Object[]{ morada, new Double( 1.0 ) } ); + linhas.add( new Object[]{ codigoPostal + " " + local, new Double( 1.0 ) } ); + printer.print( linhas ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar etiqueta.", true ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/ContactoPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/ContactoPanel.java new file mode 100644 index 00000000..71c5dae3 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/ContactoPanel.java @@ -0,0 +1,181 @@ +/* + * ContactoPanel.java + * + * Created on 14 de Maio de 2004, 15:26 + */ + +package siprp.clientes; + +import java.awt.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.dataui.*; +import com.evolute.utils.ui.text.*; + +import siprp.data.*; +/** + * + * @author fpalma + */ +public class ContactoPanel extends JPanel + implements ControllableComponent +{ + private ContactoData contacto; + private ComponentsHashtable components; + + private JTextField nomeText; + private JTextField cargoText; + private JTextField telefoneText; + private JTextField telemovelText; + private JTextField faxText; + private JTextField emailText; + + /** Creates a new instance of ContactoPanel */ + public ContactoPanel() + { + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + JLabel cargoLabel = new JLabel( "Cargo" ); + cargoText = new JTextField(); + JLabel telefoneLabel = new JLabel( "Telef." ); + telefoneText = new JTextField(); + JLabel telemovelLabel = new JLabel( "Tlm." ); + telemovelText = new JTextField(); + JLabel faxLabel = new JLabel( "Fax" ); + faxText = new JTextField(); + JLabel emailLabel = new JLabel( "Email" ); + emailText = new JTextField(); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( nomeText, constraints ); + add( nomeText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( cargoLabel, constraints ); + add( cargoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( cargoText, constraints ); + add( cargoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( telefoneLabel, constraints ); + add( telefoneLabel ); + + constraints.weightx = .5; + constraints.gridwidth = 1; + gridbag.setConstraints( telefoneText, constraints ); + add( telefoneText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( telemovelLabel, constraints ); + add( telemovelLabel ); + + constraints.weightx = .5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( telemovelText, constraints ); + add( telemovelText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( faxLabel, constraints ); + add( faxLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( faxText, constraints ); + add( faxText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( emailLabel, constraints ); + add( emailLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( emailText, constraints ); + add( emailText ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( cargoText ); + new CopyPasteHandler( telefoneText ); + new CopyPasteHandler( telemovelText ); + new CopyPasteHandler( faxText ); + new CopyPasteHandler( emailText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( ContactoData.NOME, nomeText ); + components.putComponent( ContactoData.CARGO, cargoText ); + components.putComponent( ContactoData.TELEFONE, telefoneText ); + components.putComponent( ContactoData.TELEMOVEL, telemovelText ); + components.putComponent( ContactoData.FAX, faxText ); + components.putComponent( ContactoData.EMAIL, emailText ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + contacto = null; + } + + public void fill(Object value) + { + clear(); + contacto = ( ContactoData ) value; + if( contacto == null ) + { + return; + } + String names[] = contacto.getFieldNames(); + ComponentController.fill( names, contacto.getHashData(), components ); + } + + public Object save() + { + if( contacto == null ) + { + contacto = new ContactoData(); + } + + String names[] = contacto.getFieldNames(); + Hashtable hash = new Hashtable(); + ComponentController.save( names, hash, components ); + contacto.setHashData( hash ); + return contacto; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/EmpresaPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/EmpresaPanel.java new file mode 100644 index 00000000..e71bf0d0 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/EmpresaPanel.java @@ -0,0 +1,956 @@ +/* + * EmpresaPanel.java + * + * Created on 12 de Maio de 2004, 19:08 + */ + +package siprp.clientes; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class EmpresaPanel extends JPanel + implements ControllableComponent, ListSelectionListener +{ + private JDOProvider JDO; + + private FichaDataProvider provider; + private EmpresaData empresa; + private ComponentsHashtable components; + + private Integer id; + + private JTextField designacaoSocialText; + private JTextField moradaText; + private JTextField codigoPostalText; + private JTextField localText; + private JTextField distritoText; + private JTextField concelhoText; + private JTextField codigo1Text; + private JTextField codigo2Text; + private JTextField codigo3Text; +// private JTextField perfil1Text; +// private JTextField perfil2Text; + private JComboBox servicosCombo; + private JTextField precoHigieneText; + private JTextField precoMedicinaText; + private JTextField modalidadePagamentoText; + private ContactoPanel contacto1Panel; + private ContactoPanel contacto2Panel; + private JCalendarPanel envioPropostaPanel; + private JCalendarPanel aceitacaoPropostaPanel; + private JCalendarPanel inicioContratoPanel; + private JTextField duracaoContratoText; + private JCalendarPanel cancelamentoPanel; + private JCalendarPanel envioContratoPanel; + private JCalendarPanel recepcaoContratoPanel; + private JCalendarPanel envioIdictPanel; + private JCalendarPanel relatorioAnualPanel; + private JTextField caeText; + private JTextField actividadeText; + private JTextField contribuinteText; + private JTextField segSocialText; + private JPanel marcacoesPanel; + private JPanel listaMarcacoesPanel; + private BaseTable marcacoesTable; + private MarcacaoEmpresaPanel marcacaoPanel; + private CardLayout marcacoesCardLayout; + private ProtocoloPanel protocoloPanel; +// private UserPanel userPanel; + + private BaseTable estabelecimentosTable; + private VectorTableModel estabelecimentosModel; + + private boolean webAware; + + private Vector listSelectionListeners; + + /** Creates a new instance of EmpresaPanel */ + public EmpresaPanel() + throws Exception + { + webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + listSelectionListeners = new Vector(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + throws Exception + { + String codeFormat = ( String ) Singleton.getInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT ); + String formatElements[] = codeFormat.split( " " ); + int formatFieldLengths[] = new int[ formatElements.length ]; + String fieldSeparators[] = new String[ formatElements.length ]; + int n1 = 0; + int n2 = 0; + for( ; n1 < formatElements.length; n1++ ) + { + try + { + formatFieldLengths[ n2 ] = Integer.parseInt( formatElements[ n1 ] ); + n2++; + } + catch( NumberFormatException ex ) + { + fieldSeparators[ n2 - 1 ] = formatElements[ n1 ]; + } + } + int countFields = n2; + + JLabel designacaoSocialLabel = new JLabel( "Designa\u00e7\u00e3o Social" ); + designacaoSocialText = new StateTextField(); + JLabel codigoLabel = new JLabel( "C\u00f3digo" ); + JPanel codigoPanel = new JPanel(); + codigo1Text = new StateTextField(); + if( countFields > 0 && formatFieldLengths[ 0 ] > 0 ) + { + codigo1Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 0 ] ) ); + } + codigo2Text = new StateTextField(); + if( countFields > 1 && formatFieldLengths[ 1 ] > 0 ) + { + codigo2Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 1 ] ) ); + } + codigo3Text = new StateTextField(); + if( countFields > 2 && formatFieldLengths[ 2 ] > 0 ) + { + codigo3Text.setDocument( new MaximumLengthDocument( formatFieldLengths[ 2 ] ) ); + } +// JLabel perfisLabel = new JLabel( "Perfis (A/B)" ); +// perfil1Text = new JTextField(); +// JLabel perfil2Label = new JLabel( "/" ); +// perfil2Text = new JTextField(); + servicosCombo = new JComboBox(); + servicosCombo.setPreferredSize( new Dimension( 120, 20 ) ); + + JLabel precoLabel = new JLabel( "Pre\u00e7os" ); + JLabel precoHigieneLabel = new JLabel( " Higiene" ); + precoHigieneText = new JTextField(); + precoHigieneText.setDocument( new DoubleDocument( 15, true ) ); + JLabel higieneEuroLabel = new JLabel( "\u20ac" ); + JLabel precoMedicinaLabel = new JLabel( " Medicina" ); + precoMedicinaText = new JTextField(); + precoMedicinaText.setDocument( new DoubleDocument( 15, true ) ); + JLabel medicinaEuroLabel = new JLabel( "\u20ac" ); + JLabel modalidadePagamentoLabel = new JLabel( "Periodicidade" ); + modalidadePagamentoText = new JTextField(); + + JLabel moradaLabel = new JLabel( "Morada" ); + moradaText = new StateTextField(); + JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" ); + codigoPostalText = new StateTextField(); + codigoPostalText.setPreferredSize( new Dimension( 50, 20 ) ); + codigoPostalText.setDocument( new MaximumLengthDocument( 8 ) ); + JLabel localLabel = new JLabel( "Localidade" ); + localText = new StateTextField(); + JLabel distritoLabel = new JLabel( "Distrito" ); + distritoText = new JTextField(); + JLabel concelhoLabel = new JLabel( "Concelho" ); + concelhoText = new JTextField(); + contacto1Panel = new ContactoPanel(); + contacto1Panel.setBorder( BorderFactory.createEtchedBorder() ); + contacto2Panel = new ContactoPanel(); + contacto2Panel.setBorder( BorderFactory.createEtchedBorder() ); + JLabel envioPropostaLabel = new JLabel( "Proposta" ); + envioPropostaPanel = new JCalendarPanel( null ); + JLabel aceitacaoPropostaLabel = new JLabel( "Aceita\u00e7\u00e3o" ); + aceitacaoPropostaPanel = new JCalendarPanel( null ); + JLabel inicioContratoLabel = new JLabel( "In\u00edcio" ); + inicioContratoPanel = new JCalendarPanel( null ); + JLabel duracaoContratoLabel = new JLabel( "Dura\u00e7\u00e3o (meses)" ); + duracaoContratoText = new JTextField(); + duracaoContratoText.setDocument( new IntegerDocument( 5, false ) ); + JLabel cancelamentoLabel = new JLabel( "Cancelamento" ); + cancelamentoPanel = new JCalendarPanel( null ); + JLabel envioContratoLabel = new JLabel( "Envio Contrato" ); + envioContratoPanel = new JCalendarPanel( null ); + JLabel recepcaoContratoLabel = new JLabel( "Recep\u00e7\u00e3o" ); + recepcaoContratoPanel = new JCalendarPanel( null ); + JLabel envioIdictLabel = new JLabel( "Mod. 1360" ); + envioIdictPanel = new JCalendarPanel( null ); + JLabel relatorioAnualLabel = new JLabel( "Relat\u00f3rio Anual" ); + relatorioAnualPanel = new JCalendarPanel( null ); + JTabbedPane tabbedPane = new JTabbedPane(); + JLabel caeLabel = new JLabel( "CAE" ); + caeText = new JTextField(); + JLabel actividadeLabel = new JLabel( " - " ); + actividadeText = new JTextField(); + JLabel contribuinteLabel = new JLabel( "Contribuinte" ); + contribuinteText = new JTextField(); + JLabel segSocialLabel = new JLabel( "Seguran\u00e7a Social" ); + segSocialText = new JTextField(); + JPanel moradaPanel = new JPanel(); + marcacoesPanel = new JPanel(); + protocoloPanel = new ProtocoloPanel(); +// userPanel = new UserPanel(); + + JScrollPane estabelecimentosScroll = new JScrollPane(); + estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosModel = new VectorTableModel( new String[]{ "Estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosScroll.setViewportView( estabelecimentosTable ); + + JPanel dadosEmpresaPanel = new JPanel(); + JPanel contactosPanel = new JPanel(); + JScrollPane contactosScroll = new JScrollPane(); + contactosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + contactosScroll.setViewportView( contactosPanel ); + contactosScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Contactos" ) ); + JPanel formalidadesPanel = new JPanel(); + + JPanel pad; + + JPanel upperPanel = new JPanel(); + GridBagLayout gridbag = new GridBagLayout(); + upperPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( designacaoSocialLabel, constraints ); + upperPanel.add( designacaoSocialLabel ); + + constraints.weightx = 0.9; + constraints.gridwidth = 5; + gridbag.setConstraints( designacaoSocialText, constraints ); + upperPanel.add( designacaoSocialText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( codigoLabel, constraints ); + upperPanel.add( codigoLabel ); + + constraints.weightx = 0.1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( codigoPanel, constraints ); + upperPanel.add( codigoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; +// gridbag.setConstraints( moradaLabel, constraints ); +// upperPanel.add( moradaLabel ); + gridbag.setConstraints( caeLabel, constraints ); + upperPanel.add( caeLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; + gridbag.setConstraints( caeText, constraints ); + upperPanel.add( caeText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; +// gridbag.setConstraints( moradaLabel, constraints ); +// upperPanel.add( moradaLabel ); + gridbag.setConstraints( actividadeLabel, constraints ); + upperPanel.add( actividadeLabel ); + + constraints.weightx = 0.6; + constraints.gridwidth = 1; + gridbag.setConstraints( actividadeText, constraints ); + upperPanel.add( actividadeText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; +// gridbag.setConstraints( codigoPostalLabel, constraints ); +// upperPanel.add( codigoPostalLabel ); + gridbag.setConstraints( contribuinteLabel, constraints ); + upperPanel.add( contribuinteLabel ); + + constraints.weightx = 0.1; + constraints.gridwidth = 1; + gridbag.setConstraints( contribuinteText, constraints ); + upperPanel.add( contribuinteText ); + + constraints.weightx = 0; + constraints.gridwidth = 2; +// gridbag.setConstraints( localLabel, constraints ); +// upperPanel.add( localLabel ); + gridbag.setConstraints( segSocialLabel, constraints ); + upperPanel.add( segSocialLabel ); + + constraints.weightx = 0.1; + constraints.gridwidth = 1; + gridbag.setConstraints( segSocialText, constraints ); + upperPanel.add( segSocialText ); + + + gridbag = new GridBagLayout(); + dadosEmpresaPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + + contactosPanel.setLayout( new GridLayout( 1, 2 ) ); + contactosPanel.add( contacto1Panel ); + contactosPanel.add( contacto2Panel ); + + gridbag = new GridBagLayout(); + formalidadesPanel.setLayout( gridbag ); + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( envioPropostaLabel, constraints ); + formalidadesPanel.add( envioPropostaLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( envioPropostaPanel, constraints ); + formalidadesPanel.add( envioPropostaPanel ); + + constraints.weightx = 0; + gridbag.setConstraints( inicioContratoLabel, constraints ); + formalidadesPanel.add( inicioContratoLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; +// JPanel perfisPanel = new JPanel(); + gridbag.setConstraints( inicioContratoPanel, constraints ); + formalidadesPanel.add( inicioContratoPanel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( precoLabel, constraints ); + formalidadesPanel.add( precoLabel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( aceitacaoPropostaLabel, constraints ); + formalidadesPanel.add( aceitacaoPropostaLabel ); + + constraints.weightx = 0.3; + constraints.gridwidth = 1; + gridbag.setConstraints( aceitacaoPropostaPanel, constraints ); + formalidadesPanel.add( aceitacaoPropostaPanel ); + + constraints.weightx = 0; + gridbag.setConstraints( duracaoContratoLabel, constraints ); + formalidadesPanel.add( duracaoContratoLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; +// JPanel perfisPanel = new JPanel(); + gridbag.setConstraints( duracaoContratoText, constraints ); + formalidadesPanel.add( duracaoContratoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( precoHigieneLabel, constraints ); + formalidadesPanel.add( precoHigieneLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = 1; + gridbag.setConstraints( precoHigieneText, constraints ); + formalidadesPanel.add( precoHigieneText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( higieneEuroLabel, constraints ); + formalidadesPanel.add( higieneEuroLabel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( envioContratoLabel, constraints ); + formalidadesPanel.add( envioContratoLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( envioContratoPanel, constraints ); + formalidadesPanel.add( envioContratoPanel ); + + constraints.weightx = 0; + gridbag.setConstraints( cancelamentoLabel, constraints ); + formalidadesPanel.add( cancelamentoLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; +// JPanel perfisPanel = new JPanel(); + gridbag.setConstraints( cancelamentoPanel, constraints ); + formalidadesPanel.add( cancelamentoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( precoMedicinaLabel, constraints ); + formalidadesPanel.add( precoMedicinaLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = 1; + gridbag.setConstraints( precoMedicinaText, constraints ); + formalidadesPanel.add( precoMedicinaText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( medicinaEuroLabel, constraints ); + formalidadesPanel.add( medicinaEuroLabel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( recepcaoContratoLabel, constraints ); + formalidadesPanel.add( recepcaoContratoLabel ); + + constraints.weightx = 0.3; + constraints.gridwidth = 1; + gridbag.setConstraints( recepcaoContratoPanel, constraints ); + formalidadesPanel.add( recepcaoContratoPanel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 2; + gridbag.setConstraints( servicosCombo, constraints ); + formalidadesPanel.add( servicosCombo ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( modalidadePagamentoLabel, constraints ); + formalidadesPanel.add( modalidadePagamentoLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( modalidadePagamentoText, constraints ); + formalidadesPanel.add( modalidadePagamentoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( envioIdictLabel, constraints ); + formalidadesPanel.add( envioIdictLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( envioIdictPanel, constraints ); + formalidadesPanel.add( envioIdictPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( relatorioAnualLabel, constraints ); + formalidadesPanel.add( relatorioAnualLabel ); + + constraints.weightx = 0.2; + constraints.gridwidth = 1; + gridbag.setConstraints( relatorioAnualPanel, constraints ); + formalidadesPanel.add( relatorioAnualPanel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + formalidadesPanel.add( pad ); + +// constraints.weightx = 0.5; +// constraints.gridwidth = GridBagConstraints.REMAINDER; +// pad = new JPanel(); +// gridbag.setConstraints( pad, constraints ); +// formalidadesPanel.add( pad ); + + setLayout( new BorderLayout() ); + add( upperPanel, BorderLayout.NORTH ); + JPanel lowerPanel = new JPanel(); + add( lowerPanel, BorderLayout.CENTER ); + + gridbag = new GridBagLayout(); + lowerPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.BOTH; + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + constraints.weightx = 0.55; + constraints.gridwidth = 1; +// lowerPanel.setLayout( new BorderLayout() ); + //lowerPanel.add( dadosEmpresaPanel ); + //lowerPanel.add( new JPanel() ); + gridbag.setConstraints( tabbedPane, constraints ); + lowerPanel.add( tabbedPane ); +// lowerPanel.add( tabbedPane, BorderLayout.CENTER ); + tabbedPane.add( "Contactos", contactosPanel ); + tabbedPane.add( "Morada", moradaPanel ); + tabbedPane.add( "Formalidades", formalidadesPanel ); + tabbedPane.add( "Protocolo", protocoloPanel ); + tabbedPane.add( "Tarefas", marcacoesPanel ); + +// if( webAware ) +// { +// tabbedPane.add( "Utilizador da P\u00e1gina", userPanel ); +// } + + constraints.weightx = 0.45; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentosScroll, constraints ); + lowerPanel.add( estabelecimentosScroll ); +// lowerPanel.add( estabelecimentosScroll, BorderLayout.EAST ); + + gridbag = new GridBagLayout(); + codigoPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.insets = new Insets( 1, 0, 1, 2 ); + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + if( countFields > 0 ) + { + constraints.weightx = 0.2; + constraints.gridwidth = 1; + gridbag.setConstraints( codigo1Text, constraints ); + codigoPanel.add( codigo1Text ); + + if( fieldSeparators[ 0 ] != null ) + { + constraints.weightx = 0; + JLabel divLabel = new JLabel( fieldSeparators[ 0 ] ); + gridbag.setConstraints( divLabel, constraints ); + codigoPanel.add( divLabel ); + } + } + + if( countFields > 1 ) + { + constraints.weightx = 0.5; + gridbag.setConstraints( codigo2Text, constraints ); + codigoPanel.add( codigo2Text ); + + if( fieldSeparators[ 1 ] != null ) + { + constraints.weightx = 0; + JLabel divLabel = new JLabel( fieldSeparators[ 1 ] ); + gridbag.setConstraints( divLabel, constraints ); + codigoPanel.add( divLabel ); + } +// constraints.weightx = 0; +// JLabel divLabel = new JLabel( "/" ); +// gridbag.setConstraints( divLabel, constraints ); +// codigoPanel.add( divLabel ); + } + + if( countFields > 2 ) + { + constraints.weightx = 0.2; +// constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( codigo3Text, constraints ); + codigoPanel.add( codigo3Text ); + + if( fieldSeparators[ 2 ] != null ) + { + constraints.weightx = 0; + JLabel divLabel = new JLabel( fieldSeparators[ 2 ] ); + gridbag.setConstraints( divLabel, constraints ); + codigoPanel.add( divLabel ); + } + } + + +// gridbag = new GridBagLayout(); +// perfisPanel.setLayout( gridbag ); +// constraints.fill = GridBagConstraints.HORIZONTAL; +// constraints.insets = new Insets( 1, 0, 1, 2 ); +// constraints.weighty = 1; +// constraints.gridheight = GridBagConstraints.REMAINDER; +// +// constraints.weightx = 0.5; +// constraints.gridwidth = 1; +// gridbag.setConstraints( perfil1Text, constraints ); +// perfisPanel.add( perfil1Text ); +// +// constraints.weightx = 0; +// constraints.gridwidth = 1; +// gridbag.setConstraints( perfil2Label, constraints ); +// perfisPanel.add( perfil2Label ); +// +// constraints.weightx = 0.5; +// //constraints.gridwidth = GridBagConstraints.REMAINDER; +// gridbag.setConstraints( perfil2Text, constraints ); +// perfisPanel.add( perfil2Text ); + + + gridbag = new GridBagLayout(); + moradaPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( moradaLabel, constraints ); + moradaPanel.add( moradaLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( moradaText, constraints ); + moradaPanel.add( moradaText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( codigoPostalLabel, constraints ); + moradaPanel.add( codigoPostalLabel ); + + constraints.weightx = 0.3; + gridbag.setConstraints( codigoPostalText, constraints ); + moradaPanel.add( codigoPostalText ); + + constraints.weightx = 0.7; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + moradaPanel.add( pad ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( localLabel, constraints ); + moradaPanel.add( localLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localText, constraints ); + moradaPanel.add( localText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( distritoLabel, constraints ); + moradaPanel.add( distritoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( distritoText, constraints ); + moradaPanel.add( distritoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( concelhoLabel, constraints ); + moradaPanel.add( concelhoLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( concelhoText, constraints ); + moradaPanel.add( concelhoText ); + + + listaMarcacoesPanel = new JPanel(); + listaMarcacoesPanel.setLayout( new GridLayout( 1, 1 ) ); + VectorTableModel marcacoesModel = new VectorTableModel( new String[]{ "Data", "Realizada", "Texto" } ); + marcacoesTable = new BaseTable( marcacoesModel ); + marcacoesTable.setToolTipColumn( 2 ); + marcacoesTable.fixColumnWidth( 0, 150 ); + marcacoesTable.fixColumnWidth( 1, 80 ); + marcacoesTable.setNonResizableNorReordable(); + JScrollPane marcacoesScp = new JScrollPane( marcacoesTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + listaMarcacoesPanel.add( marcacoesScp ); + + marcacoesCardLayout = new CardLayout(); + marcacaoPanel = new MarcacaoEmpresaPanel( this ); + marcacoesPanel.setLayout( marcacoesCardLayout ); + marcacoesPanel.add( MarcacaoEmpresaPanel.LIST_PANEL, listaMarcacoesPanel ); + marcacoesPanel.add( MarcacaoEmpresaPanel.EDIT_PANEL, marcacaoPanel ); + + marcacoesTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){ + public void valueChanged( ListSelectionEvent e ) + { + int selected = marcacoesTable.getSelectedRow(); + if( selected == -1 || e.getValueIsAdjusting() ) + { + return; + } + Object row = ( (VectorTableModel)marcacoesTable.getModel() ).getRowAt( selected ); + marcacoesTable.clearSelection(); + marcacaoPanel.setEmpresa( empresa ); + if( row != null && row instanceof MarcacaoEmpresaData ) + { + marcacaoPanel.fill( row ); + } + else + { + marcacaoPanel.fill( null ); + } + marcacoesCardLayout.show( marcacoesPanel, MarcacaoEmpresaPanel.EDIT_PANEL ); + } + } ); + + servicosCombo.addItem( new MappableObject( new Integer( 1 ), "SHST" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 2 ), "Medicina do Trabalho" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 3 ), "Higiene e Seguran\u00e7a" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 4 ), "Forma\u00e7\u00e3o" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 5 ), "Estudos Especificos HS" ) ); + servicosCombo.addItem( new MappableObject( new Integer( 6 ), "Sinal\u00e9tica" ) ); + + new CopyPasteHandler( designacaoSocialText ); + new CopyPasteHandler( moradaText ); + new CopyPasteHandler( codigoPostalText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( distritoText ); + new CopyPasteHandler( concelhoText ); + new CopyPasteHandler( codigo1Text ); + new CopyPasteHandler( codigo2Text ); + new CopyPasteHandler( codigo3Text ); +// new CopyPasteHandler( perfil1Text ); +// new CopyPasteHandler( perfil2Text ); + new CopyPasteHandler( precoHigieneText ); + new CopyPasteHandler( precoMedicinaText ); + new CopyPasteHandler( modalidadePagamentoText ); + new CopyPasteHandler( caeText ); + new CopyPasteHandler( actividadeText ); + new CopyPasteHandler( contribuinteText ); + new CopyPasteHandler( segSocialText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( EmpresaData.DESIGNACAO_SOCIAL, designacaoSocialText ); + components.putComponent( EmpresaData.MORADA, moradaText ); + components.putComponent( EmpresaData.CODIGO_POSTAL, codigoPostalText ); + components.putComponent( EmpresaData.LOCALIDADE, localText ); + components.putComponent( EmpresaData.DISTRITO, distritoText ); + components.putComponent( EmpresaData.CONCELHO, concelhoText ); + components.putComponent( EmpresaData.DATA_PROPOSTA, envioPropostaPanel ); + components.putComponent( EmpresaData.DATA_ACEITACAO, aceitacaoPropostaPanel ); + components.putComponent( EmpresaData.INICIO_CONTRATO, inicioContratoPanel ); + components.putComponent( EmpresaData.DURACAO, duracaoContratoText ); + components.putComponent( EmpresaData.DATA_CANCELAMENTO, cancelamentoPanel ); + components.putDummy( EmpresaData.PERFIL_1 ); + components.putDummy( EmpresaData.PERFIL_2); + components.putComponent( EmpresaData.DATA_ENVIO_CONTRATO, envioContratoPanel ); + components.putComponent( EmpresaData.DATA_RECEPCAO_CONTRATO, recepcaoContratoPanel ); + components.putComponent( EmpresaData.DATA_ENVIO_IDICT, envioIdictPanel ); + components.putComponent( EmpresaData.DATA_RELATORIO_ANUAL, relatorioAnualPanel ); + components.putComponent( EmpresaData.CODIGO_1, codigo1Text ); + components.putComponent( EmpresaData.CODIGO_2, codigo2Text ); + components.putComponent( EmpresaData.CODIGO_3, codigo3Text ); + components.putComponent( EmpresaData.CAE, caeText ); + components.putComponent( EmpresaData.ACTIVIDADE, actividadeText ); + components.putComponent( EmpresaData.CONTRIBUINTE, contribuinteText ); + components.putComponent( EmpresaData.SEGURANCA_SOCIAL, segSocialText ); + components.putComponent( EmpresaData.CONTACTO_1, contacto1Panel ); + components.putComponent( EmpresaData.CONTACTO_2, contacto2Panel ); + components.putComponent( EmpresaData.SERVICOS, servicosCombo ); + components.putComponent( EmpresaData.PRECO_HIGIENE, precoHigieneText ); + components.putComponent( EmpresaData.PRECO_MEDICINA, precoMedicinaText ); + components.putComponent( EmpresaData.PERIODICIDADE, modalidadePagamentoText ); + components.putDummy( EmpresaData.SERVICO_SAUDE_TIPO ); + components.putDummy( EmpresaData.SERVICO_SAUDE_DESIGNACAO ); + components.putDummy( EmpresaData.SERVICO_HIGIENE_TIPO ); + components.putDummy( EmpresaData.SERVICO_HIGIENE_DESIGNACAO ); + components.putDummy( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + estabelecimentosModel.clearAll(); + protocoloPanel.clear(); + clearMarcacoes(); + empresa = null; + } + + public void fill(Object value) + { + clear(); + + if( value == null || ( ( Object[] )value )[ 0 ] == null ) + { +// userPanel.setEmpresaID( null ); + return; + } + empresa = ( EmpresaData ) ( ( Object [] )value )[ 0 ]; + Integer elementosProtocolo[][] = ( Integer [][] ) ( ( Object [] )value )[ 1 ]; + + String names[] = ( String[] ) components.keySet().toArray( new String[ components.size() ] ); + ComponentController.fill( names, empresa.getHashData(), components ); + id = (Integer) empresa.get( EmpresaData.ID ); + IDObject estabelecimentos[]; + try + { + estabelecimentos = provider.getAllEstabelecimentosForEmpresa( id ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar a lista de estabelecimentos", true ); + estabelecimentos = new IDObject[0]; + } + reloadMarcacoes(); + Vector v = new Vector( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( v ); + + Vector dadosProtocolo[] = new Vector[]{ new Vector(), new Vector() }; + boolean analisesExamesA[] = new boolean[2]; + analisesExamesA[ 0 ] = "y".equals( empresa.get( EmpresaData.A_CONSULTAS ) ); + analisesExamesA[ 1 ] = "y".equals( empresa.get( EmpresaData.A_EXAMES ) ); + dadosProtocolo[ 0 ].add( analisesExamesA ); + dadosProtocolo[ 0 ].add( elementosProtocolo[ 0 ] ); + boolean analisesExamesB[] = new boolean[2]; + analisesExamesB[ 0 ] = "y".equals( empresa.get( EmpresaData.B_CONSULTAS ) ); + analisesExamesB[ 1 ] = "y".equals( empresa.get( EmpresaData.B_EXAMES ) ); + dadosProtocolo[ 1 ].add( analisesExamesB ); + dadosProtocolo[ 1 ].add( elementosProtocolo[ 1 ] ); + protocoloPanel.fill( dadosProtocolo ); +// if( webAware ) +// { +// userPanel.setEmpresaID( (Integer) empresa.get( EmpresaData.ID ) ); +// userPanel.setEnabled( id != null ); +// } + } + + public Object save() + { + if( empresa == null ) + { + empresa = new EmpresaData(); + } + + String names[] = ( String[] ) components.keySet().toArray( new String[ components.size() ] ); + Hashtable hash = empresa.getHashData(); + ComponentController.save( names, hash, components ); + empresa.setHashData( hash ); + Vector dadosProtocolo[] = ( Vector[] ) protocoloPanel.save(); + boolean analisesExamesA[] = ( boolean [] ) dadosProtocolo[ 0 ].elementAt( 0 ); + empresa.set( EmpresaData.A_CONSULTAS, analisesExamesA[ 0 ] ? "y" : "n" ); + empresa.set( EmpresaData.A_EXAMES, analisesExamesA[ 1 ] ? "y" : "n" ); + boolean analisesExamesB[] = ( boolean [] ) dadosProtocolo[ 1 ].elementAt( 0 ); + empresa.set( EmpresaData.B_CONSULTAS, analisesExamesB[ 0 ] ? "y" : "n" ); + empresa.set( EmpresaData.B_EXAMES, analisesExamesB[ 1 ] ? "y" : "n" ); + Integer elementosProtocolo[][] = + new Integer[][]{ ( Integer [] ) dadosProtocolo[ 0 ].elementAt( 1 ), + ( Integer [] ) dadosProtocolo[ 1 ].elementAt( 1 ) }; + return new Object[] { empresa, elementosProtocolo }; + } + + public void setEnabled( boolean enable ) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + protocoloPanel.setEnabled( enable ); + //estabelecimentosTable.setEnabled( enable ); + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listSelectionListeners.add( listener ); + } + + public void removeListSelectionListener( ListSelectionListener listener ) + { + listSelectionListeners.remove( listener ); + } + + public void valueChanged( ListSelectionEvent e ) + { + for( int n = 0; n < listSelectionListeners.size(); n++ ) + { + ListSelectionEvent newEvent = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( (ListSelectionListener) listSelectionListeners.elementAt( n ) ).valueChanged( newEvent ); + } + } + + public Integer getSelectedEstabelecimento() + { + int selected = estabelecimentosTable.getSelectedRow(); + if( selected == -1 ) + { + return null; + } + return ( (IDObject) estabelecimentosModel.getRowAt( selected ) ).getID(); + } + + public void reload() + { + int selected = estabelecimentosTable.getSelectedRow(); + fill( empresa ); + if( selected != -1 ) + { + estabelecimentosTable.setRowSelectionInterval( selected, selected ); + } + } + + public JTable getEstabelecimentosTable() + { + return estabelecimentosTable; + } + + public void setSelectedEstabelecimento( EstabelecimentoData estab ) + { + IDObject lista[] = (IDObject [])estabelecimentosModel.getValues().toArray( new IDObject[ 0 ] ); + Integer id = (Integer)estab.get( EstabelecimentoData.ID ); + for( int n = 0; n < lista.length; n++ ) + { + if( lista[ n ].getID().equals( id ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + return; + } + } + estabelecimentosTable.clearSelection(); + } + + protected void reloadMarcacoes() + { + try + { + Collection marcacoesCollection = + JDO.listLoad( MarcacaoEmpresa.class, new Object[]{ empresa.get( EmpresaData.ID ) }, + new String []{ "empresa.id" }, new String[]{ "data descending" } ); + Vector marcacoes = new Vector(); + marcacoes.add( new ColumnizedObject(){ + public Object getValue( int col ) + { + switch( col ) + { + case 0: case 1: + return ""; + case 2: + return "NOVA TAREFA..."; + } + return null; + } + } ); + if( marcacoesCollection != null ) + { + marcacoes.addAll( marcacoesCollection ); + } + marcacoesTable.clearSelection(); + ( (VectorTableModel) marcacoesTable.getModel() ).setValues( marcacoes ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as Marca\u00e7\u00f5es", true ); + } + showMarcacoes(); + } + + protected void showMarcacoes() + { + marcacoesCardLayout.show( marcacoesPanel, MarcacaoEmpresaPanel.LIST_PANEL ); + } + + protected void clearMarcacoes() + { + ( (VectorTableModel) marcacoesTable.getModel() ).clearAll(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/EstabelecimentoPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/EstabelecimentoPanel.java new file mode 100644 index 00000000..07d20df7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/EstabelecimentoPanel.java @@ -0,0 +1,450 @@ +/* + * EstabelecimentoPanel.java + * + * Created on 14 de Maio de 2004, 12:21 + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; +/** + * + * @author fpalma + */ +public class EstabelecimentoPanel extends JPanel + implements ControllableComponent, ListSelectionListener, ActionListener +{ + public static int disables = 0; + + private JDOProvider JDO; + + private EstabelecimentoData estabelecimento; + private ComponentsHashtable components; + + private EmpresaData empresa; + + private JTable estabelecimentosTable; + private JPanel toolbarPanel; + + private JTextField designacaoText; + private JTextField moradaText; + private JTextField localText; + private JTextField codigoPostalText; + private ContactoPanel contactoPanel; + private JTextArea historicoText; + private JButton marcacoesButton; + + private JPanel historicoPanel; + private JPanel listaHistoricoPanel; + private BaseTable historicoTable; + private HistoricoEstabelecimentoPanel edicaoHistoricoPanel; + private CardLayout historicoCardLayout; + +// private MarcacaoPanel marcacaoPanel; + private SIPRPTracker tracker; + + private boolean lastEnable = false; + + /** Creates a new instance of EstabelecimentoPanel */ + public EstabelecimentoPanel( JPanel toolbarPanel, JTextField designacaoText, JTable estabelecimentosTable ) + { + this.toolbarPanel = toolbarPanel; + this.designacaoText = designacaoText; + this.estabelecimentosTable = estabelecimentosTable; + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + JPanel dadosEstabelecimentoPanel = new JPanel(); + JLabel designacaoLabel = new JLabel( "Designa\u00e7\u00e3o" ); + //designacaoText = new JTextField(); + JLabel moradaLabel = new JLabel( "Morada" ); + moradaText = new JTextField(); + JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" ); + codigoPostalText = new JTextField(); + codigoPostalText.setDocument( new MaximumLengthDocument( 8 ) ); + JLabel localLabel = new JLabel( "Local" ); + localText = new JTextField(); + contactoPanel = new ContactoPanel(); + contactoPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Contacto" ) ); + marcacoesButton = new JButton( "Marca\u00e7\u00f5es" ); + marcacoesButton.addActionListener( this ); + JPanel pad; + historicoText = new JTextArea(); + new CopyPasteHandler( historicoText ); + historicoText.setLineWrap( true ); + historicoText.setWrapStyleWord( true ); + JScrollPane observacoesScp = new JScrollPane( historicoText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + historicoPanel = new JPanel(); + historicoPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Hist\u00f3rico" ) ); +// marcacaoPanel = new MarcacaoPanel( true, "Realizada", "Relat\u00f3rio", Marcacao.TIPO_MARCACAO_ESTABELECIMENTO ); +// marcacaoPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.LEFT ); +// marcacaoPanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Visita" ) ); + + GridBagLayout gridbag = new GridBagLayout(); + dadosEstabelecimentoPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( toolbarPanel, constraints ); + dadosEstabelecimentoPanel.add( toolbarPanel ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 1; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + dadosEstabelecimentoPanel.add( pad ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( moradaLabel, constraints ); + dadosEstabelecimentoPanel.add( moradaLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( moradaText, constraints ); + dadosEstabelecimentoPanel.add( moradaText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( codigoPostalLabel, constraints ); + dadosEstabelecimentoPanel.add( codigoPostalLabel ); + + constraints.weightx = 0.3; + constraints.gridwidth = 1; + gridbag.setConstraints( codigoPostalText, constraints ); + dadosEstabelecimentoPanel.add( codigoPostalText ); + + constraints.weightx = 0.7; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + dadosEstabelecimentoPanel.add( pad ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( localLabel, constraints ); + dadosEstabelecimentoPanel.add( localLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localText, constraints ); + dadosEstabelecimentoPanel.add( localText ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( marcacoesButton, constraints ); + dadosEstabelecimentoPanel.add( marcacoesButton ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( contactoPanel, constraints ); + + gridbag = new GridBagLayout(); + setLayout( gridbag ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( dadosEstabelecimentoPanel, constraints ); + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( contactoPanel, constraints ); + constraints.weightx = 0.5; + constraints.weighty = 1; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( historicoPanel, constraints ); + constraints.weightx = 0.5; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( observacoesScp, constraints ); + add( dadosEstabelecimentoPanel ); + add( contactoPanel ); + add( historicoPanel ); + add( observacoesScp ); + + listaHistoricoPanel = new JPanel(); + listaHistoricoPanel.setLayout( new GridLayout( 1, 1 ) ); + VectorTableModel marcacoesModel = new VectorTableModel( new String[]{ "Data", "Texto" } ); + historicoTable = new BaseTable( marcacoesModel ); + historicoTable.setToolTipColumn( 1 ); + historicoTable.fixColumnWidth( 0, 150 ); + historicoTable.setNonResizableNorReordable(); + JScrollPane listaHistoricoScp = new JScrollPane( historicoTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + listaHistoricoPanel.add( listaHistoricoScp ); + + historicoCardLayout = new CardLayout(); + edicaoHistoricoPanel = new HistoricoEstabelecimentoPanel( this ); + historicoPanel.setLayout( historicoCardLayout ); + historicoPanel.add( HistoricoEstabelecimentoPanel.LIST_PANEL, listaHistoricoPanel ); + historicoPanel.add( HistoricoEstabelecimentoPanel.EDIT_PANEL, edicaoHistoricoPanel ); + + historicoTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){ + public void valueChanged( ListSelectionEvent e ) + { + int selected = historicoTable.getSelectedRow(); + if( selected == -1 || e.getValueIsAdjusting() ) + { + return; + } + Object row = ( (VectorTableModel)historicoTable.getModel() ).getRowAt( selected ); + historicoTable.clearSelection(); + edicaoHistoricoPanel.setEstabelecimento( estabelecimento ); + if( row != null && row instanceof HistoricoEstabelecimentoData ) + { + edicaoHistoricoPanel.fill( row ); + } + else + { + edicaoHistoricoPanel.fill( null ); + } + historicoCardLayout.show( historicoPanel, HistoricoEstabelecimentoPanel.EDIT_PANEL ); + } + } ); + + new CopyPasteHandler( designacaoText ); + new CopyPasteHandler( moradaText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( codigoPostalText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( EstabelecimentoData.NOME, designacaoText ); + components.putComponent( EstabelecimentoData.MORADA, moradaText ); + components.putComponent( EstabelecimentoData.LOCALIDADE, localText ); + components.putComponent( EstabelecimentoData.CODIGO_POSTAL, codigoPostalText ); + components.putComponent( EstabelecimentoData.CONTACTO, contactoPanel ); +// components.putComponent( EstabelecimentoData.HISTORICO, historicoText ); + components.putComponent( EstabelecimentoData.HISTORICO, historicoText ); + components.putDummy( EstabelecimentoData.EMPRESA ); + components.putDummy( EstabelecimentoData.NOME_PLAIN ); +// components.putDummy( EstabelecimentoData.INACTIVO ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + clearHistorico(); + estabelecimento = null; + } + + public void fill(Object value) + { + clear(); + estabelecimento = ( EstabelecimentoData ) value; +// marcacaoPanel.setEnabled( estabelecimento != null ); +// marcacaoPanel.fill( estabelecimento ); + if( estabelecimento == null ) + { + estabelecimentosTable.clearSelection(); + return; + } + String names[] = estabelecimento.getFieldNames(); + ComponentController.fill( names, estabelecimento.getHashData(), components ); + reloadHistorico(); + } + + public Object save() + { + if( estabelecimento == null ) + { + estabelecimento = new EstabelecimentoData(); + } + + String names[] = estabelecimento.getFieldNames(); + Hashtable hash = new Hashtable(); + ComponentController.save( names, hash, components ); + estabelecimento.setHashData( hash ); + estabelecimento.set( EstabelecimentoData.EMPRESA, empresa ); + return estabelecimento; + } + + public void postSave() + { + int selected = estabelecimentosTable.getSelectedRow(); + if( estabelecimento != null ) + { + IDObject obj = new MappableObject( (Integer) estabelecimento.get( EstabelecimentoData.ID ), estabelecimento.get( EstabelecimentoData.NOME ) ); + VectorTableModel model = (VectorTableModel)estabelecimentosTable.getModel(); + if( selected == -1 ) + { + model.insertRowAt( obj, estabelecimentosTable.getRowCount() ); + estabelecimentosTable.setRowSelectionInterval( estabelecimentosTable.getRowCount() - 1, estabelecimentosTable.getRowCount() - 1 ); + } + else + { + model.removeRowAt( selected ); + model.insertRowAt( obj, selected ); + estabelecimentosTable.setRowSelectionInterval( selected, selected ); + } + } + } + + public void setEnabled( boolean enable ) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + if( enable != lastEnable ) + { + if( enable ) + { + disables++; + } + else + { + disables--; + } + lastEnable = enable; + } + estabelecimentosTable.setEnabled( disables == 0 ); +// if( estabelecimento == null ) +// { +// marcacaoPanel.setEnabled( false ); +// } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source instanceof EmpresaPanel ) + { + Integer id = ( ( EmpresaPanel ) source ).getSelectedEstabelecimento(); + if( id != null ) + { + try + { + EstabelecimentoData estab = ( EstabelecimentoData ) JDO.load( EstabelecimentoData.class, id ); + fill( estab ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar o estabelecimento", true ); + clear(); + } + } + else + { + clear(); + } + } + } + + public void reload() + { + fill( estabelecimento ); + } + + public void setEmpresa( EmpresaData empresa ) + { + this.empresa = empresa; + } + + protected void reloadHistorico() + { + try + { + Collection historicoCollection = + JDO.listLoad( HistoricoEstabelecimento.class, new Object[]{ estabelecimento.get( EstabelecimentoData.ID ) }, + new String []{ "estabelecimento.id" }, new String[]{ "data descending" } ); + Vector historico = new Vector(); + historico.add( new ColumnizedObject(){ + public Object getValue( int col ) + { + switch( col ) + { + case 0: + return ""; + case 1: + return "NOVO EVENTO..."; + } + return null; + } + } ); + if( historicoCollection != null ) + { + historico.addAll( historicoCollection ); + } + historicoTable.clearSelection(); + ( (VectorTableModel) historicoTable.getModel() ).setValues( historico ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as Marca\u00e7\u00f5es", true ); + } + showHistorico(); + } + + protected void showHistorico() + { + historicoCardLayout.show( historicoPanel, HistoricoEstabelecimentoPanel.LIST_PANEL ); + } + + protected void clearHistorico() + { + ( (VectorTableModel) historicoTable.getModel() ).clearAll(); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacoesButton ) ) + { + if( empresa == null || estabelecimento == null ) + { + return; + } + else + { + tracker.getHigieneWindow().setVisible( true ); + tracker.getHigieneWindow().setEmpresaAndEstabelecimento( (Integer) empresa.get( EmpresaData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentoData.ID ) ); + } + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaChooserDialog.java b/tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaChooserDialog.java new file mode 100644 index 00000000..d6324e91 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaChooserDialog.java @@ -0,0 +1,89 @@ +/* + * EtiquetaChooserPanel.java + * + * Created on 27 de Fevereiro de 2006, 11:21 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.ui.*; + +/** + * + * @author Frederico + */ +public class EtiquetaChooserDialog extends CustomJDialog + implements ActionListener +{ + private int rows; + private int cols; + private final Hashtable positionHash = new Hashtable(); + + private int choice[]; + + /** Creates a new instance of EtiquetaChooserPanel */ + public EtiquetaChooserDialog( JFrame owner, int rows, int cols ) + { + super( owner, true ); + this.rows = rows; + this.cols = cols; + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + } + + private void setupComponents() + { + setTitle( "Escolha a posi\u00e7\u00e3o" ); + setSize( cols * 200, rows * 50 ); + setLayout( new GridLayout( rows, cols ) ); + for( int r = 0; r < rows; r++ ) + { + for( int c = 0; c < cols; c++ ) + { + JButton button = new JButton( "( " + ( r + 1 ) + " , " + ( c + 1 ) + " )" ); + add( button ); + positionHash.put( button, new int[]{ r, c } ); + button.addActionListener( this ); + } + } + } + + protected void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public int[] choose() + { + setVisible( true ); + return choice; + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + choice = positionHash.get( ( JButton ) source ); + close(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaPrinter.java b/tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaPrinter.java new file mode 100644 index 00000000..aa868078 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/EtiquetaPrinter.java @@ -0,0 +1,200 @@ +/* + * EtiquetaPrinter.java + * + * Created on 27 de Fevereiro de 2006, 14:41 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.io.*; +import java.text.*; +import java.util.*; + +import com.evolute.utils.fop.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.xml.*; + +import siprp.data.*; + +/** + * + * @author Frederico + */ +public class EtiquetaPrinter +{ + protected static final DecimalFormat N_F = new DecimalFormat(); + + static + { + DecimalFormatSymbols dfs = new DecimalFormatSymbols( new Locale( "pt", "PT" ) ); + dfs.setDecimalSeparator( '.' ); + N_F.setDecimalFormatSymbols( dfs ); + N_F.setMaximumFractionDigits( 4 ); + N_F.setMinimumFractionDigits( 0 ); + } + + protected Double altura; + protected Double largura; + protected Double margemEsquerda; + protected Double margemCima; + protected Integer colunas; + protected Integer linhas; + protected boolean continua; + protected Double alturaFolha; + protected Double larguraFolha; + protected Double margemVerticalFolha; + protected Double margemHorizontalFolha; + + /** Creates a new instance of EtiquetaPrinter */ + public EtiquetaPrinter( EtiquetaData etiqueta ) + { + altura = ( Double ) etiqueta.get( EtiquetaData.ALTURA ); + largura = ( Double ) etiqueta.get( EtiquetaData.LARGURA ); + margemEsquerda = ( Double ) etiqueta.get( EtiquetaData.MARGEM_ESQUERDA ); + margemCima = ( Double ) etiqueta.get( EtiquetaData.MARGEM_CIMA ); + colunas = ( Integer ) etiqueta.get( EtiquetaData.COLUNAS ); + linhas = ( Integer ) etiqueta.get( EtiquetaData.LINHAS ); + continua = "y".equals( etiqueta.get( EtiquetaData.CONTINUA ) ); + alturaFolha = ( Double ) etiqueta.get( EtiquetaData.ALTURA_FOLHA ); + larguraFolha = ( Double ) etiqueta.get( EtiquetaData.LARGURA_FOLHA ); + margemVerticalFolha = ( Double ) etiqueta.get( EtiquetaData.MARGEM_VERTICAL_FOLHA ); + margemHorizontalFolha = ( Double ) etiqueta.get( EtiquetaData.MARGEM_HORIZONTAL_FOLHA ); + } + + public void print( Vector data ) + { + int pos[] = new EtiquetaChooserDialog( null, linhas.intValue(), colunas.intValue() ).choose(); + if( pos == null ) + { + return; + } + int row = pos[ 0 ]; + int col = pos[ 1 ]; + String header = ""; + SimpleXMLElement styleSheet = + new SimpleXMLElement( "xsl:stylesheet" ); + styleSheet.addAttribute( "version", "1.1" ); + styleSheet.addAttribute( "xmlns:xsl", "http://www.w3.org/1999/XSL/Transform" ); + styleSheet.addAttribute( "xmlns:fo", "http://www.w3.org/1999/XSL/Format" ); + styleSheet.addAttribute( "exclude-result-prefixes", "fo" ); + styleSheet.setCompact( false ); + + SimpleXMLElement output = + new SimpleXMLElement( "xsl:output" ); + styleSheet.addElement( output ); + output.addAttribute( "method", "xml" ); + output.addAttribute( "version", "1.0" ); + output.addAttribute( "omit-xml-declaration", "no" ); + output.addAttribute( "indent", "yes" ); + + SimpleXMLElement template = + new SimpleXMLElement( "xsl:template" ); + styleSheet.addElement( template ); + template.addAttribute( "match", "ETIQUETA" ); + + SimpleXMLElement root = + new SimpleXMLElement( "fo:root" ); + template.addElement( root ); + + SimpleXMLElement layoutMasterSet = + new SimpleXMLElement( "fo:layout-master-set" ); + root.addElement( layoutMasterSet ); + + SimpleXMLElement simplePageMaster = + new SimpleXMLElement( "fo:simple-page-master" ); + layoutMasterSet.addElement( simplePageMaster ); + simplePageMaster.addAttribute( "master-name", "simpleA4" ); + simplePageMaster.addAttribute( "page-height", N_F.format( alturaFolha ) + "cm" ); + simplePageMaster.addAttribute( "page-width", N_F.format( larguraFolha ) + "cm" ); + simplePageMaster.addAttribute( "margin-top", N_F.format( ( row == 0 ? margemVerticalFolha : 0.0 ) + row * ( altura + margemCima ) ) + "cm" ); + simplePageMaster.addAttribute( "margin-bottom", "0.5cm" ); + simplePageMaster.addAttribute( "margin-left", N_F.format( ( col == 0 ? margemHorizontalFolha : 0.0 ) + col * ( largura + margemEsquerda ) ) + "cm" ); + simplePageMaster.addAttribute( "margin-right", N_F.format( col == colunas - 1 ? margemHorizontalFolha : 0.0 ) ); + + SimpleXMLElement regionBody = + new SimpleXMLElement( "fo:region-body" ); + simplePageMaster.addElement( regionBody ); + + SimpleXMLElement pageSequence = + new SimpleXMLElement( "fo:page-sequence" ); + root.addElement( pageSequence ); + pageSequence.addAttribute( "master-reference", "simpleA4" ); + + SimpleXMLElement flow = + new SimpleXMLElement( "fo:flow" ); + pageSequence.addElement( flow ); + flow.addAttribute( "flow-name", "xsl-region-body" ); + + for( Object line[] : data ) + { + SimpleXMLElement lineXML = createLine( line, largura - ( col == 0 || col == colunas - 1 ? margemHorizontalFolha : 0.0 ) ); + flow.addElement( lineXML ); + } +//System.out.println( "XSL: " + styleSheet.toString() ); + String xml = ""; + ByteArrayOutputStream out = new ByteArrayOutputStream(); + FOPCreator creator = FOPCreator.getFOPCreator(); + InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() ); + try + { + creator.createFOfromXML( xmlIn, new ByteArrayInputStream( (header+styleSheet).getBytes() ), out ); + ByteArrayInputStream in = new ByteArrayInputStream( out.toString().getBytes() ); + Hashtable printOptions = new Hashtable(); +//System.out.println( "OUT: " + out.toString() ); + FOPPrinter printer = FOPPrinter.getFOPPrinter(); + printer.printFO( in, false, true, printOptions ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir", true ); + } + } + + protected SimpleXMLElement createLine( Object[] line, Double larguraDisponival ) + { + SimpleXMLElement table = + new SimpleXMLElement( "fo:table" ); + table.addAttribute( "table-layout", "fixed" ); + table.addAttribute( "width", N_F.format( larguraDisponival ) + "cm" ); + table.addAttribute( "space-before.optimum", "0pt" ); + table.addAttribute( "space-after.optimum", "0pt" ); + + for( int n = 1; n < line.length; n += 2 ) + { + SimpleXMLElement tableColumn = + new SimpleXMLElement( "fo:table-column" ); + table.addElement( tableColumn ); + tableColumn.addAttribute( "column-width", N_F.format( ( ( Double ) line[ n ] ) * larguraDisponival ) + "cm" ); + } + + SimpleXMLElement tableBody = + new SimpleXMLElement( "fo:table-body" ); + table.addElement( tableBody ); + + SimpleXMLElement tableRow = + new SimpleXMLElement( "fo:table-row" ); + tableBody.addElement( tableRow ); + + for( int n = 0; n < line.length; n += 2 ) + { + SimpleXMLElement tableCell = + new SimpleXMLElement( "fo:table-cell" ); + tableRow.addElement( tableCell ); + + SimpleXMLElement block = + new SimpleXMLElement( "fo:block" ); + tableCell.addElement( block ); + block.addAttribute( "font-size", "10pt" ); + block.addAttribute( "text-align", "left" ); +// block.addAttribute( "wrap-option", "no-wrap" ); +// block.addAttribute( "overflow", "scroll" ); + + block.addTextElement( ( String ) line[ n ] ); + } + + return table; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/HistoricoEstabelecimentoPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/HistoricoEstabelecimentoPanel.java new file mode 100644 index 00000000..275e7a71 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/HistoricoEstabelecimentoPanel.java @@ -0,0 +1,276 @@ +/* + * HistoricoEstabelecimentoPanel.java + * + * Created on 7 de Dezembro de 2004, 15:17 + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.text.*; + +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class HistoricoEstabelecimentoPanel extends JPanel + implements ControllableComponent, DocumentListener, ChangeListener, ActionListener +{ + protected static final String LIST_PANEL = "LIST_PANEL"; + protected static final String FULL_LIST_PANEL = "FULL_LIST_PANEL"; + protected static final String EDIT_PANEL = "EDIT_PANEL"; + + private ComponentsHashtable components; + private EstabelecimentoPanel owner; + + private JCalendarPanel calendarPanel; + private JTextArea text; + private JButton saveButton; + private JButton cancelButton; + + private EstabelecimentoData estabelecimento; + private boolean changed = false; + private boolean filling = false; + + private HistoricoEstabelecimentoData historico; + + public HistoricoEstabelecimentoPanel( EstabelecimentoPanel owner ) + { + this.owner = owner; + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + calendarPanel = new JCalendarPanel( null ); +// calendarPanel.addDocumentListener( this ); + text = new JTextArea(); + new CopyPasteHandler( text ); +// text.getDocument().addDocumentListener( this ); + text.setLineWrap( true ); + text.setWrapStyleWord( true ); + JScrollPane textScp = new JScrollPane( text, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + saveButton = new JButton( "Guardar" ); + saveButton.addActionListener( this ); + cancelButton = new JButton( "Voltar" ); + cancelButton.addActionListener( this ); + + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + + constraints.weightx = 0; + constraints.gridwidth = 1; + constraints.weighty = 0; + constraints.gridheight = 1; + calendarPanel.setPreferredSize( new Dimension( 130, 30 ) ); + gridbag.setConstraints( calendarPanel, constraints ); + add( calendarPanel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JPanel buttonPanel = new JPanel(); + gridbag.setConstraints( buttonPanel, constraints ); + add( buttonPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( textScp, constraints ); + add( textScp ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + initButtons(); + buttonPanel.add( cancelButton ); + buttonPanel.add( saveButton ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( HistoricoEstabelecimentoData.DATA, calendarPanel ); + components.putComponent( HistoricoEstabelecimentoData.TEXTO, text ); + components.putDummy( HistoricoEstabelecimentoData.ESTABELECIMENTO ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + historico = null; + } + + public void fill(Object value) + { + filling = true; + clear(); + initButtons(); + historico = (HistoricoEstabelecimentoData)value; + if( historico == null ) + { + filling = false; + return; + } + String names[] = historico.getFieldNames(); + ComponentController.fill( names, historico.getHashData(), components ); + filling = false; + } + + public Object save() + { + if( historico == null ) + { + historico = new HistoricoEstabelecimentoData(); + } + + String names[] = historico.getFieldNames(); + Hashtable hash = new Hashtable(); + + ComponentController.save( names, hash, components ); + hash.put( HistoricoEstabelecimentoData.ESTABELECIMENTO, estabelecimento ); + historico.setHashData( hash ); + return historico; + } + + public void setEnabled(boolean enable) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + private void startEditedState() + { + if( !filling ) + { + calendarPanel.removeChangeListener( this ); + text.getDocument().removeDocumentListener( this ); + changed = true; + saveButton.setEnabled( true ); + changeButton(); + } + } + + private void initButtons() + { + saveButton.setEnabled( false ); + calendarPanel.addChangeListener( this ); + text.getDocument().addDocumentListener( this ); + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/save_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/save_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/save_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/save_disabled.gif" ) ); + saveButton.setIcon( normal ); + saveButton.setRolloverIcon( rollover ); + saveButton.setPressedIcon( pressed ); + saveButton.setDisabledIcon( disabled ); + saveButton.setText( null ); + saveButton.setBorderPainted( false ); + saveButton.setRequestFocusEnabled( false ); + saveButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + saveButton.setToolTipText( "Gravar" ); + + normal = new ImageIcon( cl.getResource( "buttons/shiftl_normal.gif" ) ); + rollover = new ImageIcon( cl.getResource( "buttons/shiftl_rollover.gif" ) ); + pressed = new ImageIcon( cl.getResource( "buttons/shiftl_pressed.gif" ) ); + disabled = new ImageIcon( cl.getResource( "buttons/shiftl_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setText( null ); + cancelButton.setBorderPainted( false ); + cancelButton.setRequestFocusEnabled( false ); + cancelButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + cancelButton.setToolTipText( "Voltar \u00e0 lista" ); + + } + + private void changeButton() + { + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/cancel_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/cancel_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/cancel_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/cancel_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setToolTipText( "Cancelar" ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( saveButton ) ) + { + if( calendarPanel.getDate() == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher uma data", "Erro...", JOptionPane.ERROR_MESSAGE ); + return; + } + HistoricoEstabelecimentoData hist = ( HistoricoEstabelecimentoData ) save(); + + try + { + hist.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return; + } + owner.reloadHistorico(); + } + else if( source.equals( cancelButton ) ) + { + owner.showHistorico(); + } + + } + + public void setEstabelecimento( EstabelecimentoData estabelecimento ) + { + this.estabelecimento = estabelecimento; + } + + public void stateChanged(ChangeEvent e) + { + startEditedState(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoEmpresaPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoEmpresaPanel.java new file mode 100644 index 00000000..4a271a73 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoEmpresaPanel.java @@ -0,0 +1,288 @@ +/* + * MarcacaoEmpresaPanel.java + * + * Created on 25 de Junho de 2004, 20:32 + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.toolbar.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.text.*; + +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class MarcacaoEmpresaPanel extends JPanel + implements ControllableComponent, DocumentListener, ActionListener, ChangeListener +{ + protected static final String LIST_PANEL = "LIST_PANEL"; + protected static final String EDIT_PANEL = "EDIT_PANEL"; + + private ComponentsHashtable components; + private EmpresaPanel owner; + + private JCalendarPanel calendarPanel; + private JTextArea text; + private JCheckBox realizadaCheck; + private JButton saveButton; + private JButton cancelButton; + + private EmpresaData empresa; + private boolean changed = false; + private boolean filling = false; + + private MarcacaoEmpresaData marcacao; + + /** Creates a new instance of MarcacaoEmpresaPanel */ + public MarcacaoEmpresaPanel( EmpresaPanel owner ) + { + this.owner = owner; + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + calendarPanel = new JCalendarPanel( null ); +// calendarPanel.addDocumentListener( this ); + text = new JTextArea(); + new CopyPasteHandler( text ); +// text.getDocument().addDocumentListener( this ); + text.setLineWrap( true ); + text.setWrapStyleWord( true ); + JScrollPane textScp = new JScrollPane( text, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + realizadaCheck = new JCheckBox( "Realizada" ); + saveButton = new JButton( "Guardar" ); + saveButton.addActionListener( this ); + cancelButton = new JButton( "Voltar" ); + cancelButton.addActionListener( this ); + + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + + constraints.weightx = 0; + constraints.gridwidth = 1; + constraints.weighty = 0; + constraints.gridheight = 1; + calendarPanel.setPreferredSize( new Dimension( 130, 30 ) ); + gridbag.setConstraints( calendarPanel, constraints ); + add( calendarPanel ); + + gridbag.setConstraints( realizadaCheck, constraints ); + add( realizadaCheck ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JPanel buttonPanel = new JPanel(); + gridbag.setConstraints( buttonPanel, constraints ); + add( buttonPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( textScp, constraints ); + add( textScp ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + initButtons(); + buttonPanel.add( cancelButton ); + buttonPanel.add( saveButton ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( MarcacaoEmpresaData.DATA, calendarPanel ); + components.putComponent( MarcacaoEmpresaData.TEXTO, text ); + components.putComponent( MarcacaoEmpresaData.REALIZADA, realizadaCheck ); + components.putDummy( MarcacaoEmpresaData.EMPRESA ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + marcacao = null; + } + + public void fill(Object value) + { + filling = true; + clear(); + initButtons(); + marcacao = (MarcacaoEmpresaData)value; + if( marcacao == null ) + { + filling = false; + return; + } + String names[] = marcacao.getFieldNames(); + ComponentController.fill( names, marcacao.getHashData(), components ); + filling = false; + } + + public Object save() + { + if( marcacao == null ) + { + marcacao = new MarcacaoEmpresaData(); + } + + String names[] = marcacao.getFieldNames(); + Hashtable hash = new Hashtable(); + + ComponentController.save( names, hash, components ); + hash.put( MarcacaoEmpresaData.EMPRESA, empresa ); + marcacao.setHashData( hash ); + System.out.println( "EMPRESA:: " + marcacao.get( MarcacaoEmpresaData.EMPRESA ) ); + return marcacao; + } + + public void setEnabled(boolean enable) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + startEditedState(); + } + + private void startEditedState() + { + if( !filling ) + { + calendarPanel.removeChangeListener( this ); + text.getDocument().removeDocumentListener( this ); + realizadaCheck.removeChangeListener( this ); + changed = true; + saveButton.setEnabled( true ); + changeButton(); + } + } + + private void initButtons() + { + saveButton.setEnabled( false ); + calendarPanel.addChangeListener( this ); + realizadaCheck.addChangeListener( this ); + text.getDocument().addDocumentListener( this ); + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/save_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/save_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/save_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/save_disabled.gif" ) ); + saveButton.setIcon( normal ); + saveButton.setRolloverIcon( rollover ); + saveButton.setPressedIcon( pressed ); + saveButton.setDisabledIcon( disabled ); + saveButton.setText( null ); + saveButton.setBorderPainted( false ); + saveButton.setRequestFocusEnabled( false ); + saveButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + saveButton.setToolTipText( "Gravar" ); + + normal = new ImageIcon( cl.getResource( "buttons/shiftl_normal.gif" ) ); + rollover = new ImageIcon( cl.getResource( "buttons/shiftl_rollover.gif" ) ); + pressed = new ImageIcon( cl.getResource( "buttons/shiftl_pressed.gif" ) ); + disabled = new ImageIcon( cl.getResource( "buttons/shiftl_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setText( null ); + cancelButton.setBorderPainted( false ); + cancelButton.setRequestFocusEnabled( false ); + cancelButton.setMargin( new Insets( 0, 0, 0, 0 ) ); + cancelButton.setToolTipText( "Voltar \u00e0 lista" ); + + } + + private void changeButton() + { + ClassLoader cl = new EVUtilsImageLib().getClass().getClassLoader(); + Icon normal = new ImageIcon( cl.getResource( "buttons/cancel_normal.gif" ) ); + Icon rollover = new ImageIcon( cl.getResource( "buttons/cancel_rollover.gif" ) ); + Icon pressed = new ImageIcon( cl.getResource( "buttons/cancel_pressed.gif" ) ); + Icon disabled = new ImageIcon( cl.getResource( "buttons/cancel_disabled.gif" ) ); + cancelButton.setIcon( normal ); + cancelButton.setRolloverIcon( rollover ); + cancelButton.setPressedIcon( pressed ); + cancelButton.setDisabledIcon( disabled ); + cancelButton.setToolTipText( "Cancelar" ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( saveButton ) ) + { + if( calendarPanel.getDate() == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher uma data", "Erro...", JOptionPane.ERROR_MESSAGE ); + return; + } + MarcacaoEmpresaData marc = ( MarcacaoEmpresaData ) save(); + + try + { + marc.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return; + } + owner.reloadMarcacoes(); + } + else if( source.equals( cancelButton ) ) + { + owner.showMarcacoes(); + } + + } + + public void setEmpresa( EmpresaData empresa ) + { + this.empresa = empresa; + } + + public void stateChanged(javax.swing.event.ChangeEvent changeEvent) + { + startEditedState(); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoPanel.java new file mode 100644 index 00000000..5d1002b7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/MarcacaoPanel.java @@ -0,0 +1,594 @@ +/* + * MarcacaoPanel.java + * + * Created on 14 de Maio de 2004, 15:52 + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.text.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.panel.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class MarcacaoPanel extends JPanel + implements ControllableComponent, ActionListener +{ + private final String COLUMN_NAMES_REL[]; + private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + + private Marcacao marcacoes[]; + private ComponentsHashtable components; + private int tipo; + + private final boolean comRelatorio; + + private Box anteriorPanel; + private JPanel correntePanel; + + private String realizadoLabelText; + private String relatorioLabelText; + + private JLabel dataMarcacaoAnteriorLabel; + private JCheckBox realizadaCheckBox; + private JCalendarPanel dataRelatorioPanel; + private JCalendarPanel dataMarcacaoPanel; + private JButton enviarEmailButton; + private JLabel dataEnvioMailLabel; + private JButton historicoButton; + + private TrabalhadorData trabalhador; + private EstabelecimentoData estabelecimento; + + private MarcacaoListLoader loader; + private Marcacao current; + private Marcacao last; + + private boolean filling = false; + + /** Creates a new instance of MarcacaoPanel */ + public MarcacaoPanel( boolean comRelatorio, String realizadoLabelText, String relatorioLabelText, int tipo ) + { + this.comRelatorio = comRelatorio; + this.realizadoLabelText = realizadoLabelText; + this.relatorioLabelText = relatorioLabelText; + this.tipo = tipo; + COLUMN_NAMES_REL = new String[ comRelatorio ? 3 : 2 ]; + COLUMN_NAMES_REL[ 0 ] = "Data"; + COLUMN_NAMES_REL[ 1 ] = realizadoLabelText; + if( comRelatorio ) + { + COLUMN_NAMES_REL[ 2 ] = relatorioLabelText; + } + loader = new MarcacaoListLoader(); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + anteriorPanel = new Box( BoxLayout.X_AXIS ); + anteriorPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Anterior" ) ); + correntePanel = new JPanel(); +// correntePanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Corrente" ) ); + JPanel dataPanel = new JPanel(); + Box relatorioBox = new Box( BoxLayout.X_AXIS ); + + dataMarcacaoAnteriorLabel = new JLabel( "-" ); + dataEnvioMailLabel = new JLabel( "" ); + realizadaCheckBox = new JCheckBox( realizadoLabelText + " " ); + realizadaCheckBox.addChangeListener( new ChangeListener(){ + public void stateChanged( ChangeEvent e ) + { +System.out.println( "stateChanged" ); + if( last != null && !filling ) + { +System.out.println( "stateChanged2" ); + last.set( Marcacao.REALIZADA, realizadaCheckBox.isSelected() ? "y": "n" ); + try + { + last.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + realizadaCheckBox.setSelected( realizadaCheckBox.isSelected() ); + } + } + } + } ); + JLabel relatorioLabel = new JLabel( relatorioLabelText ); + dataRelatorioPanel = new JCalendarPanel( null ); + dataRelatorioPanel.addChangeListener( new ChangeListener(){ + public void stateChanged(ChangeEvent e) + { + if( !filling ) + { + marcarRelatorio(); + } + } + + private void marcarRelatorio() + { + last.set( Marcacao.DATA_RELATORIO, dataRelatorioPanel.getDate() ); + try + { + last.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + } + } + } ); + + dataMarcacaoPanel = new JCalendarPanel( null ); + dataMarcacaoPanel.addChangeListener( new ChangeListener(){ + public void stateChanged(ChangeEvent e) + { + if( !filling ) + { + marcar(); + } + } + } ); + enviarEmailButton = new JButton( "Enviar Email" ); + enviarEmailButton.addActionListener( this ); + historicoButton = new JButton( "H" ); + historicoButton.addActionListener( this ); + + anteriorPanel.add( dataPanel ); + if( comRelatorio ) + { + anteriorPanel.add( relatorioBox ); + anteriorPanel.add( relatorioLabel ); + anteriorPanel.add( dataRelatorioPanel ); + } + + dataPanel.setLayout( new GridLayout( 1, 2 ) ); + dataPanel.add( dataMarcacaoAnteriorLabel ); + dataPanel.add( realizadaCheckBox ); + + correntePanel.setLayout( new GridLayout( 1, 2 ) ); + correntePanel.add( dataMarcacaoPanel ); + correntePanel.add( enviarEmailButton ); + + //setLayout( new BoxLayout( this, BoxLayout.Y_AXIS ) ); + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0.5; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = 1; + + gridbag.setConstraints( anteriorPanel, constraints ); + add( anteriorPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.gridheight = 2; + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + historicoButton.setPreferredSize( new Dimension( 20, 40 ) ); + gridbag.setConstraints( historicoButton, constraints ); + add( historicoButton ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0.5; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = 1; + constraints.gridx = 0; + gridbag.setConstraints( correntePanel, constraints ); + add( correntePanel ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( Marcacao.DATA, dataMarcacaoPanel ); + components.putComponent( Marcacao.REALIZADA, realizadaCheckBox ); + components.putComponent( Marcacao.DATA_RELATORIO, dataRelatorioPanel ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + dataMarcacaoAnteriorLabel.setText( "" ); + dataEnvioMailLabel.setText( "" ); + marcacoes = null; + trabalhador = null; + estabelecimento = null; + current = null; + last = null; + } + + public void fill( Object value ) + { + filling = true; + clear(); + if( value == null ) + { + setEnabled( false ); + filling = false; + return; + } + switch( tipo ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + if( ! ( value instanceof TrabalhadorData ) ) + { + filling = false; + return ; + } + trabalhador = (TrabalhadorData) value; + try + { + marcacoes = loader.load( tipo, (Integer)trabalhador.get( TrabalhadorData.ID ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as marca\u00e7\u00f5es", true ); + marcacoes = null; + } + break; + + case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO: + if( ! ( value instanceof EstabelecimentoData ) ) + { + filling = false; + return ; + } + estabelecimento = (EstabelecimentoData) value; + try + { + marcacoes = loader.load( tipo, (Integer)estabelecimento.get( EstabelecimentoData.ID ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar as marca\u00e7\u00f5es", true ); + marcacoes = null; + } + break; + } + if( marcacoes == null || marcacoes.length == 0 ) + { + filling = false; + return; + } + Date lastDate = (Date) marcacoes[ 0 ].get( Marcacao.DATA ); + current = null; + last = null; + if( !lastDate.after( new Date() ) ) + { + current = null; + last = marcacoes[ 0 ]; + } + else + { + current = marcacoes[ 0 ]; + if( marcacoes.length > 1 ) + { + last = marcacoes[ 1 ]; + } + } + fillCurrent(); + fillLast(); + filling = false; + } + + private void fillCurrent() + { + if( current != null ) + { + Date dataMarcacao = (Date) current.get( Marcacao.DATA ); + dataMarcacaoPanel.setDate( dataMarcacao ); + Date dataMail = (Date) current.get( Marcacao.DATA_EMAIL ); + if( dataMail == null ) + { + enviarEmailButton.setEnabled( dataMarcacao != null ); + dataEnvioMailLabel.setText( "" ); + } + else + { + enviarEmailButton.setEnabled( false ); + dataEnvioMailLabel.setText( DATE_FORMAT.format( dataMail ) ); + } + } + else + { + enviarEmailButton.setEnabled( false ); + } + } + + private void fillLast() + { + if( last != null ) + { + Date dataMarcacao = (Date) last.get( Marcacao.DATA ); + dataMarcacaoAnteriorLabel.setText( DATE_FORMAT.format( dataMarcacao ) ); + String realizada = (String) last.get( Marcacao.REALIZADA ); + boolean isRealizada = "y".equals( realizada ); + realizadaCheckBox.setSelected( isRealizada ); + realizadaCheckBox.setEnabled( !isRealizada ); + Date dataRelatorio = (Date) last.get( Marcacao.DATA_RELATORIO ); + dataRelatorioPanel.setDate( dataRelatorio ); + } + else + { + realizadaCheckBox.setEnabled( false ); + dataRelatorioPanel.setEnabled( false ); + } + } + + public Object save() + { +// if( marcacoes == null ) +// { +// marcacoes = new Marcacao[ 0 ]; +// } +// if( marcacoes[ marcacoes.length - 1 ] == null ) +// { +// marcacoes[ marcacoes.length - 1 ] = Marcacao.getMarcacao( tipo ); +// } +// if( marcacoes.length > 1 ) +// { +// } + return null; + } + + public void setEnabled( boolean enable ) + { + filling = true; + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + if( !enable ) + { + enviarEmailButton.setEnabled( false ); + } + if( last == null ) + { + realizadaCheckBox.setEnabled( false ); + dataRelatorioPanel.setEnabled( false ); + } + filling = false; + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( enviarEmailButton ) ) + { + Date today = new Date(); + current.set( Marcacao.DATA_EMAIL, today ); + String subject = "."; + String texto = ""; + EstabelecimentoData estab = null; + if( current instanceof MarcacaoTrabalhadorData ) + { + TrabalhadorData trab = ( TrabalhadorData )current.get( MarcacaoTrabalhadorData.TRABALHADOR ); + String nome = ( String )trab.get( TrabalhadorData.NOME ); + String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( ( Date )current.get( MarcacaoTrabalhadorData.DATA ) ); + if( ( ( Number )current.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() == MarcacaoTrabalhadorConstants.TIPO_EXAMES ) + { + subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_EXAMES ); + subject = subject.replaceAll( CompanyDataLoader.NOME, nome ); + texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_EXAMES ); + texto = texto.replaceAll( CompanyDataLoader.DATA, data ); + texto = texto.replaceAll( CompanyDataLoader.NOME, nome ); +// subject = "Marca\u00E7\u00E3o de exame"; +// texto = "Vimos pelo presente informar que '" + nome + "' dever\u00E1 comparecer " +// + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina " +// + "do Trabalho, no dia '" + data + "', pelas 08H30." +// + "%0A%0A" +// + "Relembramos que o colaborador dever\u00E1 comparecer em jejum." +// + "%0A%0A" +// + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " +// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " +//// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 210 21 21 " +// + "ou respondendo ao remetente desta mensagem." +// + "%0A%0A%0A" +// + "Cumprimentos,%0A%0ASIPRP"; +//// + "Cumprimentos,"; + } + else + { + subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_CONSULTA ); + subject = subject.replaceAll( CompanyDataLoader.NOME, nome ); + texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_CONSULTA ); + texto = texto.replaceAll( CompanyDataLoader.DATA, data ); + texto = texto.replaceAll( CompanyDataLoader.NOME, nome ); +// subject = "Marca\u00E7\u00E3o de consulta"; +// texto = "Vimos pelo presente informar que '" + nome + "' dever\u00E1 comparecer " +// + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina " +// + "do Trabalho, no dia '" + data + "', pelas 08H30." +// + "%0A%0A" +// + "%0A%0A" +// + "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e " +// + "dos \u00FAltimos exames complementares realizados." +// + "%0A%0A" +// + "%0A%0A" +// + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " +// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " +//// + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 210 21 21 " +// + "ou respondendo ao remetente desta mensagem." +// + "%0A%0A%0A" +// + "Cumprimentos," +// + "%0A%0ASIPRP" +// + "%0A%0AATRIUM SALDANHA" +// + "%0A%0APra\u00e7a Duque de Saldanha, 1 - 9\u00BAC" +// + "%0A%0A1050-094 Lisboa"; + } + estab = ( EstabelecimentoData )trab.get( TrabalhadorData.ESTABELECIMENTO ); + } + else + { + estab = ( EstabelecimentoData )current.get( MarcacaoEstabelecimentoData.ESTABELECIMENTO ); + String sede = ( String )estab.get( EstabelecimentoData.NOME ); + subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_VISITA ); + subject = subject.replaceAll( CompanyDataLoader.NOME, sede ); + String morada = ( String )estab.get( EstabelecimentoData.MORADA ); + String data = DateFormat.getDateInstance( DateFormat.SHORT ).format( ( Date )current.get( MarcacaoEstabelecimentoData.DATA ) ); + texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_VISITA ); + texto = texto.replaceAll( CompanyDataLoader.DATA, data ); + texto = texto.replaceAll( CompanyDataLoader.NOME, sede ); + texto = texto.replaceAll( CompanyDataLoader.MORADA, morada ); +// texto = "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e " +// + "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + sede + "', no dia '" + data + "'." +// + "%0A%0A" +// + "Agradecemos que nos confirme, pela mesma via, o nome do representante " +// + "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a " +// + "realiza\u00E7\u00E3o da visita na data indicada." +// + "%0A%0A" +// + "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, " +// + "atrav\u00E9s dos telefones 21 350 45 43 (Pedro Vieira), 21 350 45 44 " +// + "(Catarina Leonardo) ou responda ao remetente desta mensagem." +//// + "atrav\u00E9s dos telefones 21 210 21 21 (Colaborador), 21 210 21 21 " +//// + "(Outro Colaborador) ou responda ao remetente desta mensagem." +// + "%0A%0A%0A" +// + "Cumprimentos,%0A%0ASIPRP"; +//// + "Cumprimentos,"; + + + } + ContactoData cont = ( ContactoData )estab.get( EstabelecimentoData.CONTACTO ); + String mail = ""; + if( cont != null ) + { + mail = ( String )cont.get( ContactoData.EMAIL ); + } + try + { + current.save(); + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c start mailto:\"" + mail + + "?subject=" + subject + "&body=" +// + "?subject=" + subject + "&body=" + + texto + ); + } + else + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); +// System.out.println( "mailto:" + mail +// // + "?subject=SIPRP - " + subject + "&body=" +// + "?subject=" + subject + "&body=" +// + texto ); + Process proc = Runtime.getRuntime().exec( new String[]{ "/usr/bin/open", "/Applications/Mail.app", "mailto:" + mail + // + "?subject=SIPRP - " + subject + "&body=" + + "?subject=" + subject + "&body=" + + texto } ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + dataEnvioMailLabel.setText( DATE_FORMAT.format( today ) ); + } + else if( source.equals( historicoButton ) ) + { + Vector v = new Vector(); + if( marcacoes != null ) + { + v.addAll( Arrays.asList( marcacoes ) ); + } + ListActionDialog dialog = + new ListActionDialog( null, "Anteriores", + COLUMN_NAMES_REL, + v, null ); + dialog.show(); + } + } + + public void marcar() + { +System.out.println( "MARCAR" ); + Date data = dataMarcacaoPanel.getDate(); + Vector aux = new Vector(); + if( marcacoes != null ) + { + aux.addAll( Arrays.asList( marcacoes ) ); + } + if( current == null && data != null ) + { + current = Marcacao.getMarcacao( tipo ); + current.set( Marcacao.REALIZADA, "n" ); + + aux.insertElementAt( current, 0 ); + switch( tipo ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + current.set( MarcacaoTrabalhadorData.TRABALHADOR, trabalhador ); + current.set( MarcacaoTrabalhadorData.TIPO, new Integer( tipo ) ); + break; + + case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO: + current.set( MarcacaoEstabelecimentoData.ESTABELECIMENTO, estabelecimento ); + break; + } + marcacoes = ( Marcacao [])aux.toArray( new Marcacao[0] ); +// System.out.println( "INSERI ! !! ! ! !! ! " ); + } + else if( current != null && data == null ) + { + aux.remove( 0 ); + marcacoes = ( Marcacao [])aux.toArray( new Marcacao[0] ); +// System.out.println( "REMOVI ! !! ! ! !! ! " ); + } + current.set( Marcacao.DATA, data ); + + try + { + if( data != null ) + { + current.save(); + enviarEmailButton.setEnabled( true ); + } + else + { + System.out.println( "DELETE DA MARCACAO" ); + current.delete(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + } + } + + public void setCalendarDialogOrientation( int vertical, int horizontal ) + { + dataRelatorioPanel.setOrientation( vertical, horizontal ); + dataMarcacaoPanel.setOrientation( vertical, horizontal ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDataProvider.java new file mode 100644 index 00000000..a678cd7c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDataProvider.java @@ -0,0 +1,96 @@ +/* + * NoticiasDataProvider.java + * + * Created on 24 de Maio de 2005, 15:39 + */ + +package siprp.clientes; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.ui.search.*; +import com.evolute.utils.sql.*; + +import siprp.*; + +/** + * + * @author fpalma + */ +public class NoticiasDataProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static NoticiasDataProvider instance = null; + private final Executer executer; + + /** Creates a new instance of NoticiasDataProvider */ + public NoticiasDataProvider() + throws Exception + { + boolean webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + DBManager dbm; + if( webAware ) + { + String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX ); + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/"; + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/"; + String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER ); + String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD ); + dbm = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + executer = dbm.getSharedExecuter( this ); + } + else + { + dbm = null; + executer = null; + } + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new NoticiasDataProvider(); + } + } + return instance; + } + + public String getNoticias() + throws Exception + { + Select subSelect = + new Select( new String[]{ "not_noticias" }, + new String[]{ "MAX(id)" }, null ); + + Select select = + new Select( new String[]{ "not_noticias" }, + new String[]{ "noticia" }, + new Field( "id" ).isEqual( subSelect ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return ""; + } + return array.get( 0, 0 ).toString().trim(); + } + + public void saveNoticias( String noticias ) + throws Exception + { + + + Insert insert = + new Insert( "not_noticias", + new Assignment[]{ new Assignment( new Field( "utilizador" ), Singleton.getInstance( Singleton.USERNAME ) ), + new Assignment( new Field( "data" ), Singleton.getInstance( Singleton.TODAY ) ), + new Assignment( new Field( "noticia" ), noticias.trim() ) } ); + executer.executeQuery( insert ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDialog.java b/tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDialog.java new file mode 100644 index 00000000..5e432c05 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/NoticiasDialog.java @@ -0,0 +1,101 @@ +/* + * NoticiasPanel.java + * + * Created on 24 de Maio de 2005, 15:12 + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.panel.*; +/** + * + * @author fpalma + */ +public class NoticiasDialog extends CustomJDialog + implements ActionListener +{ + protected HTMLEditorPanel textText; + protected JButton okButton; + protected JButton cancelButton; + + protected NoticiasDataProvider provider; + + /** Creates a new instance of NoticiasPanel */ + public NoticiasDialog( JFrame owner ) + throws Exception + { + super( owner, true ); + provider = (NoticiasDataProvider)NoticiasDataProvider.getProvider(); + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + textText.fill( provider.getNoticias() ); + } + + private void setupComponents() + { + setTitle( "Editar Texto das Not\u00edcias" ); + setSize( 300, 200 ); + + textText = new HTMLEditorPanel( true ); +// textText.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), +// "Texto" ) ); + okButton = new JButton( "OK" ); + okButton.addActionListener( this ); + cancelButton = new JButton( "Cancelar" ); + cancelButton.addActionListener( this ); + + getContentPane().setLayout( new BorderLayout() ); + getContentPane().add( textText, BorderLayout.CENTER ); + JPanel buttonPanel = new JPanel(); + getContentPane().add( buttonPanel, BorderLayout.SOUTH ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( okButton ); + buttonPanel.add( cancelButton ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( okButton ) ) + { + try + { + provider.saveNoticias( (String) textText.save() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar not\u00edcias", true ); + return; + } + close(); + } + else if( source.equals( cancelButton ) ) + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Thread(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/PerfilProtocoloPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/PerfilProtocoloPanel.java new file mode 100644 index 00000000..bfe2a4e8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/PerfilProtocoloPanel.java @@ -0,0 +1,153 @@ +/* + * PerfilProtocoloPanel.java + * + * Created on January 27, 2006, 12:24 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.ui.panel.*; + +/** + * + * @author fpalma + */ +public class PerfilProtocoloPanel extends JPanel + implements ControllableComponent, ItemListener +{ + protected JCheckBox consultasCheck; + protected JCheckBox examesCheck; + protected CheckBoxPanel tiposCheck[]; + + protected IDObject grupos[]; + protected IDObject tipos[][]; + + /** Creates a new instance of PerfilProtocoloPanel */ + public PerfilProtocoloPanel( IDObject grupos[], IDObject tipos[][] ) + { + this.grupos = grupos; + this.tipos = tipos; + setupComponents(); + } + + private void setupComponents() + { + consultasCheck = new JCheckBox( "Consultas" ); + examesCheck = new JCheckBox( "Exames" ); + examesCheck.addItemListener( this ); + tiposCheck = new CheckBoxPanel[ grupos.length ]; + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.weightx = 1; + constraints.gridheight = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( consultasCheck, constraints ); + gridbag.setConstraints( examesCheck, constraints ); + + add( consultasCheck ); + add( examesCheck ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = grupos.length > 0 ? 1.0 / grupos.length : 0.0; + for( int n = 0; n < grupos.length; n++ ) + { + tiposCheck[ n ] = setupComponentsGrupo( n ); + gridbag.setConstraints( tiposCheck[ n ], constraints ); + add( tiposCheck[ n ] ); + tiposCheck[ n ].setEnabled( false ); + } + } + + private CheckBoxPanel setupComponentsGrupo( int indice ) + { + String desc = grupos[ indice ].toString(); + CheckBoxPanel panel = new CheckBoxPanel( tipos[ indice ] ); + panel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), desc ) ); + return panel; + } + + public void fill( Object data ) + { + clear(); + if( data != null ) + { + Vector list = ( Vector ) data; + boolean consultasExames[] = (boolean[]) list.elementAt( 0 ); + Integer tiposEscolhidos[] = ( Integer [] ) list.elementAt( 1 ); + consultasCheck.setSelected( consultasExames[ 0 ] ); + examesCheck.setSelected( consultasExames[ 1 ] ); + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].fill( tiposEscolhidos ); + } + } + } + + public Object save() + { + boolean consultasExames[] = new boolean[ 2 ]; + consultasExames[ 0 ] = consultasCheck.isSelected(); + consultasExames[ 1 ] = examesCheck.isSelected(); + Vector tiposEscolhidos = new Vector(); + if( consultasExames[ 1 ] ) + { + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposEscolhidos.addAll( Arrays.asList( tiposCheck[ n ].getSelected() ) ); + } + } + Vector list = new Vector(); + list.add( consultasExames ); + list.add( tiposEscolhidos.toArray( new Integer[ tiposEscolhidos.size() ] ) ); + return list; + } + + public void setEnabled( boolean enable ) + { + consultasCheck.setEnabled( enable ); + examesCheck.setEnabled( enable ); + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].setEnabled( enable && examesCheck.isSelected() ); + } + } + + public void clear() + { + consultasCheck.setSelected( false ); + examesCheck.setSelected( false ); + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].clear(); + } + } + + public void itemStateChanged( ItemEvent e ) + { + Object source = e.getSource(); + if( source.equals( examesCheck ) ) + { + for( int n = 0; n < tiposCheck.length; n++ ) + { + tiposCheck[ n ].setEnabled( examesCheck.isEnabled() && examesCheck.isSelected() ); + } + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/ProtocoloPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/ProtocoloPanel.java new file mode 100644 index 00000000..af0e2ae0 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/ProtocoloPanel.java @@ -0,0 +1,111 @@ +/* + * ProtocoloPanel.java + * + * Created on January 27, 2006, 12:23 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.clientes; + +import java.awt.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; + +/** + * + * @author fpalma + */ +public class ProtocoloPanel extends JPanel + implements ControllableComponent +{ + protected ClientesDataProvider provider; + + protected IDObject grupos[]; + protected IDObject tipos[][]; + + protected PerfilProtocoloPanel perfisPanels[]; + + /** Creates a new instance of ProtocoloPanel */ + public ProtocoloPanel() + throws Exception + { + provider = ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + IDObject gruposReais[] = provider.getAllGruposProtocoloReais(); + Vector gruposAux = new Vector( Arrays.asList( gruposReais ) ); + gruposAux.add( new MappableObject( new Integer( 0 ), "Outros" ) ); + grupos = ( IDObject[] ) gruposAux.toArray( new IDObject[ gruposReais.length + 1 ] ); + + IDObject gruposFalsos[] = provider.getAllGruposProtocoloFalsos(); + + Hashtable tiposHash = provider.getAllTiposElementosProtocoloByGrupo(); + tipos = new IDObject[ grupos.length ][]; + for( int n = 0; n < gruposReais.length; n++ ) + { + Vector tiposGrupo = ( Vector ) tiposHash.get( gruposReais[ n ].getID() ); + tipos[ n ] = ( IDObject[] ) tiposGrupo.toArray( new IDObject[ tiposGrupo.size() ] ); + } + Vector outros = new Vector(); + for( int n = 0; n < gruposFalsos.length; n++ ) + { + Vector tiposGrupo = ( Vector ) tiposHash.get( gruposFalsos[ n ].getID() ); + outros.addAll( tiposGrupo ); + } + tipos[ gruposReais.length ] = ( IDObject[] ) outros.toArray( new IDObject[ outros.size() ] ); + setupComponents(); + } + + private void setupComponents() + { + perfisPanels = new PerfilProtocoloPanel[ 2 ]; + + setLayout( new GridLayout( 1, 2 ) ); + + perfisPanels[ 0 ] = new PerfilProtocoloPanel( grupos, tipos ); + JScrollPane perfilAScp = + new JScrollPane( perfisPanels[ 0 ], JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + perfilAScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil A" ) ); + add( perfilAScp ); + + perfisPanels[ 1 ] = new PerfilProtocoloPanel( grupos, tipos ); + JScrollPane perfilBScp = + new JScrollPane( perfisPanels[ 1 ], JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + perfilBScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil B" ) ); + add( perfilBScp ); + } + + public void fill( Object data ) + { + Vector lists[] = ( Vector [] ) data; + perfisPanels[ 0 ].fill( lists[ 0 ] ); + perfisPanels[ 1 ].fill( lists[ 1 ] ); + } + + public Object save() + { + Vector lists[] = new Vector[ 2 ]; + lists[ 0 ] = ( Vector ) perfisPanels[ 0 ].save(); + lists[ 1 ] = ( Vector ) perfisPanels[ 1 ].save(); + return lists; + } + + public void setEnabled( boolean enable ) + { + perfisPanels[ 0 ].setEnabled( enable ); + perfisPanels[ 1 ].setEnabled( enable ); + } + + public void clear() + { + perfisPanels[ 0 ].clear(); + perfisPanels[ 1 ].clear(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/TrabalhadorPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/TrabalhadorPanel.java new file mode 100644 index 00000000..4b9f630a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/TrabalhadorPanel.java @@ -0,0 +1,612 @@ +/* + * TrabalhadorPanel.java + * + * Created on 14 de Maio de 2004, 12:29 + */ + +package siprp.clientes; + +import javax.swing.*; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.date.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; +import siprp.importer.*; + +/** + * + * @author fpalma + */ +public class TrabalhadorPanel extends JPanel + implements ControllableComponent, ListSelectionListener, ActionListener +{ + private FichaDataProvider provider; + private TrabalhadorData trabalhador; + private ComponentsHashtable components; + + private EstabelecimentoData estabelecimento; + private JTable estabelecimentosTable; + + private JPanel toolbarPanel; + + private JPanel dadosTrabalhadorPanel; + + private JTextField nomeText; + private RadioButtonFixedPanel sexoPanel; + private JCalendarPanel dataNascimentoPanel; + private JTextField nacionalidadeText; + private JTextField numeroMecanograficoText; + private JCalendarPanel dataAdmissaoPanel; + private JTextField categoriaText; + private JTextField localText; + private JTextField funcaoText; + private JCalendarPanel dataAdmissaoFuncaoPanel; + private JCalendarPanel dataDemissaoPanel; + private JTextField observacoesText; + //private JComboBox perfilCombo; + private RadioButtonFixedPanel perfilPanel; + + private SIPRPTracker tracker; + + private BaseTable trabalhadoresTable; + private VectorTableModel trabalhadoresModel; + + private JButton marcacoesButton; +// private MarcacaoPanel examesPanel; +// private MarcacaoPanel consultaPanel; + + private Vector listeners; + + private boolean lastEnable = false; + + /** Creates a new instance of TrabalhadorPanel */ + public TrabalhadorPanel( JPanel toolbarPanel, JTable estabelecimentosTable ) + throws Exception + { + this.toolbarPanel = toolbarPanel; + this.estabelecimentosTable = estabelecimentosTable; + provider = ( FichaDataProvider )FichaDataProvider.getProvider(); + listeners = new Vector(); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + dadosTrabalhadorPanel = new JPanel(); +// JPanel marcacoesPanel = new JPanel(); + + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + JLabel sexoLabel = new JLabel( "Sexo" ); + sexoPanel = + new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "M" ), + new MappableObject( new Integer( 2 ), "F" ) }, + 1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel dataNascimentoLabel = new JLabel( "Data de Nascimento" ); + dataNascimentoPanel = new JCalendarPanel( null ); + JLabel nacionalidadeLabel = new JLabel( "Nacionalidade" ); + nacionalidadeText = new JTextField(); + JLabel numeroMecanograficoLabel = new JLabel( "N\u00famero Mecanogr\u00e1fico/Outro" ); + numeroMecanograficoText = new JTextField(); + JLabel dataAdmissaoLabel = new JLabel( "Data de Admiss\u00e3o" ); + dataAdmissaoPanel = new JCalendarPanel( null ); + JLabel categoriaLabel = new JLabel( "Categoria Profissional" ); + categoriaText = new JTextField(); + JLabel localLabel = new JLabel( "Local de Trabalho" ); + localText = new JTextField(); + JLabel funcaoLabel = new JLabel( "Fun\u00e7\u00e3o Proposta" ); + funcaoText = new JTextField(); + JLabel dataAdmissaoFuncaoLabel = new JLabel( "Data de Admiss\u00e3o na Fun\u00e7\u00e3o" ); + dataAdmissaoFuncaoPanel = new JCalendarPanel( null ); + JLabel perfilLabel = new JLabel( "Perfil" ); +// perfilCombo = new JComboBox(); +// perfilCombo.addItem( new MappableObject( new Integer( 1 ), "A" ) ); +// perfilCombo.addItem( new MappableObject( new Integer( 2 ), "B" ) ); + perfilPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "A" ), + new MappableObject( new Integer( 2 ), "B" ) }, + 1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel dataDemissaoLabel = new JLabel( "Data de Demiss\u00e3o" ); + dataDemissaoPanel = new JCalendarPanel( null ); + JLabel observacoesLabel = new JLabel( "Observa\u00e7\u00f5es" ); + observacoesText = new JTextField(); + marcacoesButton = new JButton( "Marca\u00e7\u00f5es" ); + marcacoesButton.addActionListener( this ); + + JScrollPane trabalhadoresScroll = new JScrollPane(); + trabalhadoresScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + trabalhadoresScroll.setPreferredSize( new Dimension( 250, 300 ) ); + trabalhadoresModel = new VectorTableModel( new String[]{ "Trabalhadores" } ); + trabalhadoresTable = new BaseTable( trabalhadoresModel ); + trabalhadoresTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + trabalhadoresTable.setNonResizableNorReordable(); + trabalhadoresScroll.setViewportView( trabalhadoresTable ); + + JPanel pad; + + GridBagLayout gridbag = new GridBagLayout(); + dadosTrabalhadorPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.gridwidth = 1; + constraints.weightx = 0; + + gridbag.setConstraints( nomeLabel, constraints ); + dadosTrabalhadorPanel.add( nomeLabel ); + + constraints.weightx = 1; + constraints.gridwidth = 3; + gridbag.setConstraints( nomeText, constraints ); + dadosTrabalhadorPanel.add( nomeText ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( sexoLabel, constraints ); + dadosTrabalhadorPanel.add( sexoLabel ); + + constraints.weightx = 0; + //constraints.gridwidth = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JPanel sexoOuterPanel = new JPanel(); + sexoOuterPanel.setLayout( new GridLayout( 1, 2 ) ); + sexoOuterPanel.add( sexoPanel ); + sexoOuterPanel.add( new JPanel() ); + gridbag.setConstraints( sexoOuterPanel, constraints ); + dadosTrabalhadorPanel.add( sexoOuterPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( nacionalidadeLabel, constraints ); + dadosTrabalhadorPanel.add( nacionalidadeLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( nacionalidadeText, constraints ); + dadosTrabalhadorPanel.add( nacionalidadeText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataNascimentoLabel, constraints ); + dadosTrabalhadorPanel.add( dataNascimentoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataNascimentoPanel, constraints ); + dadosTrabalhadorPanel.add( dataNascimentoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( numeroMecanograficoLabel, constraints ); + dadosTrabalhadorPanel.add( numeroMecanograficoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( numeroMecanograficoText, constraints ); + dadosTrabalhadorPanel.add( numeroMecanograficoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataAdmissaoLabel, constraints ); + dadosTrabalhadorPanel.add( dataAdmissaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataAdmissaoPanel, constraints ); + dadosTrabalhadorPanel.add( dataAdmissaoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( categoriaLabel, constraints ); + dadosTrabalhadorPanel.add( categoriaLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( categoriaText, constraints ); + dadosTrabalhadorPanel.add( categoriaText ); + + constraints.weightx = 0; + gridbag.setConstraints( localLabel, constraints ); + dadosTrabalhadorPanel.add( localLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localText, constraints ); + dadosTrabalhadorPanel.add( localText ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( funcaoLabel, constraints ); + dadosTrabalhadorPanel.add( funcaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( funcaoText, constraints ); + dadosTrabalhadorPanel.add( funcaoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataAdmissaoFuncaoLabel, constraints ); + dadosTrabalhadorPanel.add( dataAdmissaoFuncaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataAdmissaoFuncaoPanel, constraints ); + dadosTrabalhadorPanel.add( dataAdmissaoFuncaoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( perfilLabel, constraints ); + dadosTrabalhadorPanel.add( perfilLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; +// gridbag.setConstraints( perfilCombo, constraints ); +// dadosTrabalhadorPanel.add( perfilCombo ); + gridbag.setConstraints( perfilPanel, constraints ); + dadosTrabalhadorPanel.add( perfilPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataDemissaoLabel, constraints ); + dadosTrabalhadorPanel.add( dataDemissaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataDemissaoPanel, constraints ); + dadosTrabalhadorPanel.add( dataDemissaoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( observacoesLabel, constraints ); + dadosTrabalhadorPanel.add( observacoesLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( observacoesText, constraints ); + dadosTrabalhadorPanel.add( observacoesText ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( marcacoesButton, constraints ); + dadosTrabalhadorPanel.add( marcacoesButton ); + +// examesPanel = new MarcacaoPanel( false, "Realizados", "", Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ); +// examesPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.RIGHT ); +// examesPanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Exames" ) ); +// consultaPanel = new MarcacaoPanel( true, "Realizada", "Ficha de Aptid\u00e3o", Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ); +// consultaPanel.setCalendarDialogOrientation( JCalendarDialog.ABOVE, JCalendarDialog.LEFT ); +// consultaPanel.setBorder( BorderFactory.createTitledBorder( +// BorderFactory.createEtchedBorder(), +// "Consulta" ) ); +// //marcacoesPanel.setLayout( new BoxLayout( marcacoesPanel, BoxLayout.X_AXIS ) ); +// marcacoesPanel.setLayout( new GridLayout( 1, 2 ) ); +// marcacoesPanel.add( examesPanel ); +// marcacoesPanel.add( consultaPanel ); + + JPanel leftPanel = new JPanel(); + leftPanel.setLayout( new BorderLayout() ); + leftPanel.add( toolbarPanel, BorderLayout.NORTH ); + leftPanel.add( trabalhadoresScroll, BorderLayout.CENTER ); + + setLayout( new BorderLayout() ); + add( leftPanel, BorderLayout.WEST ); + add( dadosTrabalhadorPanel, BorderLayout.CENTER ); +// add( marcacoesPanel, BorderLayout.SOUTH ); + + trabalhadoresTable.getSelectionModel().addListSelectionListener( this ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( nacionalidadeText ); + new CopyPasteHandler( numeroMecanograficoText ); + new CopyPasteHandler( categoriaText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( funcaoText ); + new CopyPasteHandler( observacoesText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( TrabalhadorData.NOME, nomeText ); + components.putComponent( TrabalhadorData.SEXO, new ControllableComponent() + { + public void fill( Object value ) + { + if( value != null && value.equals( "f" ) ) + { + sexoPanel.fill( new Integer(2) ); + } + else + { + sexoPanel.fill( new Integer(1) ); + } + } + + public Object save() + { + Integer id = (Integer)sexoPanel.save(); + if( id != null && id.intValue() == 1 ) + { + return "m"; + } + return "f"; + } + + public void clear() + { + sexoPanel.clear(); + } + + public void setEnabled( boolean enable ) + { + sexoPanel.setEnabled( enable ); + } + } ); + components.putComponent( TrabalhadorData.DATA_NASCIMENTO, dataNascimentoPanel ); + components.putComponent( TrabalhadorData.NACIONALIDADE, nacionalidadeText ); + components.putComponent( TrabalhadorData.NUMERO_MECANOGRAFICO, numeroMecanograficoText ); + components.putComponent( TrabalhadorData.DATA_ADMISSAO, dataAdmissaoPanel ); + components.putComponent( TrabalhadorData.CATEGORIA, categoriaText ); + components.putComponent( TrabalhadorData.LOCAL_TRABALHO, localText ); + components.putComponent( TrabalhadorData.FUNCAO_PROPOSTA, funcaoText ); + components.putComponent( TrabalhadorData.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel ); + components.putComponent( TrabalhadorData.DATA_DEMISSAO, dataDemissaoPanel ); + components.putDummy( TrabalhadorData.OBSERVACOES ); + components.putComponent( TrabalhadorData.OBSERVACOES_GESTAO, observacoesText ); + components.putComponent( TrabalhadorData.PERFIL, perfilPanel ); +// components.putDummy( TrabalhadorData.INACTIVO ); + components.putDummy( TrabalhadorData.ESTABELECIMENTO ); + components.putDummy( TrabalhadorData.NOME_PLAIN ); + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + trabalhador = null; + } + + public void fill(Object value) + { + clear(); + trabalhador = ( TrabalhadorData ) value; +// examesPanel.setEnabled( trabalhador != null ); +// examesPanel.fill( trabalhador ); +// consultaPanel.setEnabled( trabalhador != null ); +// consultaPanel.fill( trabalhador ); + if( trabalhador == null ) + { + trabalhadoresTable.clearSelection(); + return; + } + String names[] = trabalhador.getFieldNames(); + ComponentController.fill( names, trabalhador.getHashData(), components ); + } + + public Object save() + { + + if( trabalhador == null ) + { + trabalhador = new TrabalhadorData(); + } + + String names[] = trabalhador.getFieldNames(); + Hashtable hash = new Hashtable(); + ComponentController.save( names, hash, components ); + trabalhador.setHashData( hash ); + trabalhador.set( TrabalhadorData.ESTABELECIMENTO, estabelecimento ); + return trabalhador; + } + + public void setEnabled( boolean enable ) + { + super.setEnabled( enable ); + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + trabalhadoresTable.setEnabled( !enable ); + if( lastEnable != enable ) + { + if( enable ) + { + EstabelecimentoPanel.disables++; + } + else + { + EstabelecimentoPanel.disables--; + } + lastEnable = enable; + } + estabelecimentosTable.setEnabled( EstabelecimentoPanel.disables == 0 ); +// if( trabalhador == null ) +// { +// examesPanel.setEnabled( false ); +// consultaPanel.setEnabled( false ); +// } + } + + public void reloaList() + throws Exception + { + if( estabelecimento == null ) + { + trabalhadoresModel.clearAll(); + } + else + { + Integer id = ( Integer )estabelecimento.get( EstabelecimentoData.ID ); + IDObject []trabalhadores = provider.getAllTrabalhadoresForEstabelecimento( id ); + trabalhadoresModel.setValues( new Vector( Arrays.asList( trabalhadores ) ) ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source instanceof EmpresaPanel ) + { + Integer id = ( ( EmpresaPanel ) source ).getSelectedEstabelecimento(); + if( id != null ) + { + try + { + IDObject []trabalhadores = provider.getAllTrabalhadoresForEstabelecimento( id ); + trabalhadoresModel.setValues( new Vector( Arrays.asList( trabalhadores ) ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os trabalhadores", true ); + clear(); + } + } + else + { + trabalhadoresModel.clearAll(); + clear(); + } + } + else if( source.equals( trabalhadoresTable.getSelectionModel() ) ) + { +// int selected = trabalhadoresTable.getSelectedRow(); +// if( selected == -1 ) +// { +// clear(); +// +// } +// else +// { +// Integer id = ( ( IDObject ) trabalhadoresModel.getRowAt( selected ) ).getID();; +// try +// { +// TrabalhadorData trabalhador = (TrabalhadorData) TrabalhadorData.load( TrabalhadorData.class, id ); +// fill( trabalhador ); +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a carregar o trabalhador", true ); +// clear(); +// } + for( int n = 0; n < listeners.size(); n++ ) + { + ListSelectionEvent newEvent = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( (ListSelectionListener) listeners.elementAt( n ) ).valueChanged( newEvent ); + } +// } + } + } + + public void postSave() + { + int selected = trabalhadoresTable.getSelectedRow(); +//System.out.println( "postSave TRABALHADOR PANEL " + selected + " : " + ( trabalhador == null ) ); + if( trabalhador != null ) + { + IDObject obj = new MappableObject( (Integer) trabalhador.get( TrabalhadorData.ID ), trabalhador.get( TrabalhadorData.NOME ) ); + if( selected == -1 ) + { + trabalhadoresModel.insertRowAt( obj, trabalhadoresTable.getRowCount() ); + trabalhadoresTable.setRowSelectionInterval( trabalhadoresTable.getRowCount() - 1, trabalhadoresTable.getRowCount() - 1 ); + } + else + { + trabalhadoresModel.removeRowAt( selected ); + trabalhadoresModel.insertRowAt( obj, selected ); + trabalhadoresTable.setRowSelectionInterval( selected, selected ); + } + } + } + + public void reload() + { + fill( trabalhador ); + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listeners.add( listener ); + } + + public void removeListSelectionListener( ListSelectionListener listener ) + { + listeners.remove( listener ); + } + + public Integer getSelectedTrabalhador() + { + int selected = trabalhadoresTable.getSelectedRow(); + if( selected == -1 ) + { + return null; + } + return ( (IDObject) trabalhadoresModel.getRowAt( selected ) ).getID(); + } + + public void setEstabelecimento( EstabelecimentoData estabelecimento ) + { + this.estabelecimento = estabelecimento; + } + + public void setSelectedTrabalhador( TrabalhadorData trab ) + { + IDObject lista[] = (IDObject [])trabalhadoresModel.getValues().toArray( new IDObject[ 0 ] ); + Integer id = (Integer)trab.get( TrabalhadorData.ID ); + for( int n = 0; n < lista.length; n++ ) + { + if( lista[ n ].getID().equals( id ) ) + { + trabalhadoresTable.setRowSelectionInterval( n, n ); + return; + } + } + trabalhadoresTable.clearSelection(); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacoesButton ) ) + { + if( trabalhador == null ) + { + return; + } + else + { + EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trabalhador.get( TrabalhadorData.ESTABELECIMENTO ); + EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA ); + tracker.getMedicinaWindow().setVisible( true ); + tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresaData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentoData.ID ), + ( Integer ) trabalhador.get( TrabalhadorData.ID ) ); + } + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/UserDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/clientes/UserDataProvider.java new file mode 100644 index 00000000..1d89bc93 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/UserDataProvider.java @@ -0,0 +1,156 @@ +/* + * UserDataProvider.java + * + * Created on 8 de Novembro de 2004, 18:38 + */ + +package siprp.clientes; + +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.ui.search.*; +import com.evolute.utils.sql.*; + +import siprp.*; +/** + * + * @author fpalma + */ +public class UserDataProvider extends MetaProvider +{ + private static final String RESERVED_ROLES_MANAGER = "manager"; + private static final String RESERVED_ROLES_ADMIN = "admin"; + private static final Object LOCK = new Object(); + private static UserDataProvider instance = null; + private final Executer executer; + + protected final Expression excludeReserved; + + /** Creates a new instance of UserDataProvider */ + public UserDataProvider() + throws Exception + { + boolean webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue(); + DBManager dbm; + if( webAware ) + { + String url = ( String ) Singleton.getInstance( SingletonConstants.WEB_URL_PREFIX ); + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_URL ) + "/"; + url += ( String ) Singleton.getInstance( SingletonConstants.WEB_DB_NAME ) + "/"; + String user = ( String ) Singleton.getInstance( SingletonConstants.WEB_USER ); + String pwd = ( String ) Singleton.getInstance( SingletonConstants.WEB_PASSWORD ); + dbm = new JDBCManager( url, user, pwd, 10, 8, 8, null ); + executer = dbm.getSharedExecuter( this ); + } + else + { + dbm = null; + executer = null; + } + excludeReserved = new Field( "role" ).isDifferent( RESERVED_ROLES_MANAGER ).and( + new Field( "role" ).isDifferent( RESERVED_ROLES_ADMIN ) ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new UserDataProvider(); + } + } + return instance; + } + + public String getUserName( Integer empresaID ) + throws Exception + { +System.out.println( "getUserName( " +empresaID+ " )" ) ; + Select select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + return array.get( 0, 0 ).toString(); + } + + public void saveUser( String userName, String password, Integer empresaID, boolean isNew ) + throws Exception + { + if( isNew ) + { + Insert insert = + new Insert( "roles", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "role" ), empresaID == null ? "siprpuser" : empresaID.toString() ) } ); + executer.executeQuery( insert, null ); + insert = + new Insert( "users", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "password" ), password ) } ); + executer.executeQuery( insert, null ); + } + else + { + Select select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 ) + { + saveUser( userName, password, empresaID, true ); + return; + } + String oldName = array.get( 0, 0 ).toString(); + Update update = + new Update( "roles", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "role" ), empresaID == null ? "siprpuser" : empresaID.toString() ) }, + new Field( "username" ).isEqual( oldName ).and( excludeReserved ) ); + executer.executeQuery( update ); + update = + new Update( "users", + new Assignment[]{ new Assignment( new Field( "username" ), userName ), + new Assignment( new Field( "password" ), password ) }, + new Field( "username" ).isEqual( oldName ) ); + executer.executeQuery( update ); + } + } + + public boolean checkNewName( String name, Integer empresaID ) + throws Exception + { + Select select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isDifferent( empresaID == null ? "siprpuser" : empresaID.toString() ).and( + new Field( "lower( username )" ).isEqual( new Field( "lower( '" + name + "' )" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() != 0 ) + { + if( empresaID != null ) + { + return false; + } + else + { + select = new Select( new String[]{ "roles" }, new String[]{ "username" }, + new Field( "role" ).isEqual( empresaID == null ? "siprpuser" : empresaID.toString() ).and( + new Field( "lower( username )" ).isEqual( new Field( "lower( '" + name + "' )" ) ) ) ); + array = executer.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return false; + } + } + } + + return true; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/UserPanel.java b/tags/teg/SIPRPSoft/src/siprp/clientes/UserPanel.java new file mode 100644 index 00000000..d9a8bf2f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/UserPanel.java @@ -0,0 +1,232 @@ +/* + * UserPanel.java + * + * Created on 8 de Novembro de 2004, 17:03 + */ + +package siprp.clientes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; + +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.text.*; +/** + * + * @author fpalma + */ +public class UserPanel extends JPanel + implements DocumentListener, FocusListener, ActionListener +{ + private UserDataProvider provider; + + private JTextField userNameText; + private JTextField passwordText; + private JButton applyButton; + private JButton cancelButton; + + private boolean passwordEdited = false; + private boolean hasPassword = false; + private boolean error = false; + private Integer empresaID; + +// public static void main( String args[] ) +// { +// JFrame frame = new JFrame(); +// frame.setSize( 300, 200 ); +// frame.getContentPane().setLayout( new GridLayout( 1, 1 ) ); +// frame.getContentPane().add( new UserPanel() ); +// frame.show(); +// } + + /** Creates a new instance of UserPanel */ + public UserPanel() + throws Exception + { + provider = ( UserDataProvider ) UserDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + JLabel userNameLabel = new JLabel( "Utilizador" ); + userNameText = new JTextField(); + JLabel passwordLabel = new JLabel( "Senha" ); + passwordText = new JTextField(); + applyButton = new JButton( "Actualizar" ); + cancelButton = new JButton( "Cancelar" ); + + userNameText.setPreferredSize( new Dimension( 200, 20 ) ); + passwordText.setPreferredSize( new Dimension( 200, 20 ) ); + passwordText.setText( "" ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( userNameLabel, constraints ); + gridbag.setConstraints( passwordLabel, constraints ); + gridbag.setConstraints( userNameText, constraints ); + gridbag.setConstraints( passwordText, constraints ); + JPanel buttonPanel = new JPanel(); + gridbag.setConstraints( buttonPanel, constraints ); + + add( userNameLabel ); + add( userNameText ); + add( passwordLabel ); + add( passwordText ); + add( buttonPanel ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( applyButton ); + buttonPanel.add( cancelButton ); + + passwordText.addFocusListener( this ); + passwordText.getDocument().addDocumentListener( this ); + + applyButton.addActionListener( this ); + cancelButton.addActionListener( this ); + + new CopyPasteHandler( userNameText ); + new CopyPasteHandler( passwordText ); + } + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + passwordEdited = true; + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + passwordEdited = true; + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + passwordEdited = true; + } + + public void focusGained(java.awt.event.FocusEvent focusEvent) + { + if( !passwordEdited ) + { + passwordText.getDocument().removeDocumentListener( this ); + passwordText.setText( "" ); + passwordText.getDocument().addDocumentListener( this ); + } + } + + public void focusLost(java.awt.event.FocusEvent focusEvent) + { + } + + public void actionPerformed(java.awt.event.ActionEvent actionEvent) + { + try + { + Object source = actionEvent.getSource(); + if( applyButton.equals( source ) ) + { + if( save() ) + { + hasPassword = true; + } + refresh(); + } + else if( cancelButton.equals( source ) ) + { + reload(); + refresh(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro na liga\u00e7\u00e3o \u00e0 Base de Dados WEB", true ); + } + } + + private void refresh() + { + passwordText.getDocument().removeDocumentListener( this ); + if( !passwordEdited ) + { + if( hasPassword ) + { + passwordText.setText( "" ); + } + else + { + passwordText.setText( "" ); + } + } + passwordText.getDocument().addDocumentListener( this ); + } + + public void setEmpresaID( Integer empresaID ) + { + try + { + userNameText.setText( "" ); + passwordText.setText( "" ); + passwordEdited = false; + hasPassword = false; + this.empresaID = empresaID; +// if( empresaID == null ) +// { +// return; +// } + reload(); + refresh(); + error = false; + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro na liga\u00e7\u00e3o \u00e0 Base de Dados WEB", true ); + userNameText.setText( "Erro na liga\u00e7\u00e3o" ); + setEnabled( false ); + error = true; + } + } + + private boolean save() + throws Exception + { + if( !provider.checkNewName( userNameText.getText(), empresaID ) ) + { + JOptionPane.showMessageDialog( null, "O Utilizador " + userNameText.getText() + " j\u00e1 est\u00e1 em uso por outra entidade." ); + return false; + } + provider.saveUser( userNameText.getText(), passwordText.getText(), empresaID, !hasPassword ); + passwordEdited = false; + return true; + } + + private boolean reload() + throws Exception + { + String userName = provider.getUserName( empresaID ); + if( userName != null ) + { + userNameText.setText( userName ); + hasPassword = true; + } + passwordEdited = false; + return true; + } + + public void setEnabled( boolean enable ) + { + userNameText.setEnabled( enable && !error ); + passwordText.setEnabled( enable && !error ); + applyButton.setEnabled( enable && !error ); + cancelButton.setEnabled( enable && !error ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/UserWindow.java b/tags/teg/SIPRPSoft/src/siprp/clientes/UserWindow.java new file mode 100644 index 00000000..8ba90d39 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/UserWindow.java @@ -0,0 +1,66 @@ +/* + * UserWindow.java + * + * Created on 15 de Marco de 2005, 11:35 + */ + +package siprp.clientes; + +import java.awt.*; +import javax.swing.*; + +import com.evolute.utils.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.ui.*; + +import siprp.data.*; +/** + * + * @author fpalma + */ +public class UserWindow extends CustomJDialog +{ + protected JDOProvider JDO; +// protected JTextField empresaText; + protected UserPanel userPanel; + protected Integer empresaID; + + /** Creates a new instance of UserWindow */ + public UserWindow( JFrame owner, Integer empresaID ) + throws Exception + { + super( owner, true ); + this.empresaID = empresaID; + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + centerSuper(); + } + + private void setupComponents() + throws Exception + { + setSize( 500, 200 ); + userPanel = new UserPanel(); +// empresaText = new JTextField(); + getContentPane().setLayout( new BorderLayout() ); +// getContentPane().add( empresaText, BorderLayout.NORTH ); + getContentPane().add( userPanel, BorderLayout.CENTER ); + + if( empresaID == null ) + { +// empresaText.setText( "SIPRP" ); + setTitle( "SIPRP" ); + } + else + { + EmpresaData empresa = ( EmpresaData )JDO.load( EmpresaData.class, empresaID ); + if( empresa == null ) + { + return; + } +// empresaText.setText( (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + setTitle( (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + } + userPanel.setEmpresaID( empresaID ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/etiqueta.xsl b/tags/teg/SIPRPSoft/src/siprp/clientes/etiqueta.xsl new file mode 100644 index 00000000..4603a50b --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/etiqueta.xsl @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + Cuidado Prestado + + + + + Código + + + + + Valor + + + + + Benef. + + + + + Entidade + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/clientes/etiquetas.dtd b/tags/teg/SIPRPSoft/src/siprp/clientes/etiquetas.dtd new file mode 100644 index 00000000..69d2b4f1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/clientes/etiquetas.dtd @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/companydataloaders/ClinicaAvenidaDataLoader.java b/tags/teg/SIPRPSoft/src/siprp/companydataloaders/ClinicaAvenidaDataLoader.java new file mode 100644 index 00000000..89dbdca8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/companydataloaders/ClinicaAvenidaDataLoader.java @@ -0,0 +1,91 @@ +/* + * ClinicaAvenidaDtaLoader.java + * + * Created on 25 de Janeiro de 2005, 13:27 + */ + +package siprp.companydataloaders; + +import com.evolute.utils.*; + +import siprp.*; + +/** + * + * @author fpalma + */ +public class ClinicaAvenidaDataLoader implements CompanyDataLoader +{ + + /** Creates a new instance of ClinicaAvenidaDtaLoader */ + public ClinicaAvenidaDataLoader() + { + } + + public void load() + { + Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SHSTSoft" ); + Singleton.setInstance( SingletonConstants.COMPANY_NAME, "Centro Cl\u00ednico Avenida" ); + Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" ); + Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "CCA" ); + Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "Centro Cl\u00ednico da Avenida - Marca\u00e7\u00e3o de consulta m\u00e9dica" ); + Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos por este meio informar que " + NOME + " " + + "dever\u00e1 comparecer no Centro Cl\u00ednico da Avenida para a realiza\u00e7\u00e3o da " + + "consulta de Medicina do Trabalho, no dia " + DATA + ".\n" + + "Caso n\u00e3o seja poss\u00edvel a compar\u00eancia do referido colaborador na " + + "data indicada, agradecemos que nos informem atrav\u00e9s do telefone 214928612 " + + "ou respondendo a esta mensagem.\n\n" + + "Departamento de Seguran\u00e7a e Higiene do Trabalho\n" + + "Centro Cl\u00ednico da Avenida\n" + + "Av. General Humberto Delgado 128 R/C D\n" + + "2700-419 Amadora" ); + Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "Centro Cl\u00ednico da Avenida - Marca\u00e7\u00e3o de exames de Medicina do Trabalho" ); + Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos por este meio informar que " + NOME + " " + + "dever\u00e1 comparecer no Centro Cl\u00ednico da Avenida para a realiza\u00e7\u00e3o " + + "de exames relativos \u00e0 Medicina do Trabalho, no dia " + DATA + ".\n" + + "Caso n\u00e3o seja poss\u00edvel a compar\u00eancia do referido colaborador na " + + "data indicada, agradecemos que nos informem atrav\u00e9s do telefone 214928612 " + + "ou respondendo a esta mensagem.\n\n" + + "Departamento de Seguran\u00e7a e Higiene do Trabalho\n" + + "Centro Cl\u00ednico da Avenida\n" + + "Av. General Humberto Delgado 128 R/C D\n" + + "2700-419 Amadora" ); + Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "Centro Cl\u00ednico da Avenida - Marca\u00e7\u00e3�o da Auditoria de Seguran\u00e7a e Higiene do Trabalho" ); + Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos por este meio informar que pretendemos " + + "realizar a auditoria de Seguran\u00e7a e Higiene do Trabalho \u00e0s vossas " + + "instala��es em " + MORADA + ", no dia " + DATA + ".\n" + + "Agradecemos que confirmem a vossa disponibilidade para a realiza\u00e7\u00e3o " + + "da visita na data indicada, atrav\u00e9s do telefone 214928612 ou " + + "respondendo a esta mensagem.\n\n" + + "Departamento de Seguran\u00e7a e Higiene do Trabalho\n" + + "Centro Cl\u00ednico da Avenida\n" + + "Av. General Humberto Delgado 128 R/C D\n" + + "2700-419 Amadora\n" + + "Tel.: 214928612" ); + Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "15" ); + Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, 4, 5, 6, 9, 7, 8 } ); + + Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.FALSE ); + + Singleton.setInstance( SingletonConstants.WEB_USER, "" ); + Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL, "" ); + Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "" ); + Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "" ); + + Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); + Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL, "localhost" ); + Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "shst" ); + Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/companydataloaders/IBookDataLoader.java b/tags/teg/SIPRPSoft/src/siprp/companydataloaders/IBookDataLoader.java new file mode 100644 index 00000000..1f1d3e4b --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/companydataloaders/IBookDataLoader.java @@ -0,0 +1,105 @@ +/* + * SIPRPDataLoader.java + * + * Created on 25 de Janeiro de 2005, 13:19 + */ + +package siprp.companydataloaders; + +import com.evolute.utils.*; + +import siprp.*; + +/** + * + * @author fpalma + */ +public class IBookDataLoader implements CompanyDataLoader +{ + + /** Creates a new instance of SIPRPDataLoader */ + public IBookDataLoader() + { + } + + public void load() + { + Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SHSTSoft" ); + Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SHST" ); + Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_evo.jpg" ); + Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "SHST" ); + Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "SHST - Marca\u00E7\u00E3o de consulta"); + Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "%0A%0A" + + "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e " + + "dos \u00FAltimos exames complementares realizados." + + "%0A%0A" + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 212 12 12 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos," + + "%0A%0ASHST" ); + Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "SHST - Marca\u00E7\u00E3o de exame"); + Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "Relembramos que o colaborador dever\u00E1 comparecer em jejum." + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 212 12 12 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASHST" ); + Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "SHST - Marca\u00E7\u00E3o de visita de higiene e seguran\u00E7a"); + Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e " + + "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + NOME + "', no dia '" + DATA + "'." + + "%0A%0A" + + "Agradecemos que nos confirme, pela mesma via, o nome do representante " + + "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a " + + "realiza\u00E7\u00E3o da visita na data indicada." + + "%0A%0A" + + "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, " + + "atrav\u00E9s do telefone 21 212 12 12 " + + "ou responda ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASHST" ); + Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "2 6 / 2" ); + Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 } ); + + Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.TRUE ); + + Singleton.setInstance( SingletonConstants.WEB_USER, "" ); + Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "" ); + Singleton.setInstance( SingletonConstants.WEB_URL, "" ); + Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "" ); + Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "192.168.1.1:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + + Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); + Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL, "localhost:5432" ); + Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); + Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/companydataloaders/SIPRPDataLoader.java b/tags/teg/SIPRPSoft/src/siprp/companydataloaders/SIPRPDataLoader.java new file mode 100644 index 00000000..497bb5d6 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/companydataloaders/SIPRPDataLoader.java @@ -0,0 +1,123 @@ +/* + * SIPRPDataLoader.java + * + * Created on 25 de Janeiro de 2005, 13:19 + */ + +package siprp.companydataloaders; + +import com.evolute.utils.*; + +import siprp.*; + +/** + * + * @author fpalma + */ +public class SIPRPDataLoader implements CompanyDataLoader +{ + + /** Creates a new instance of SIPRPDataLoader */ + public SIPRPDataLoader() + { + } + + public void load() + { + Singleton.setInstance( SingletonConstants.SOFTWARE_NAME, "SIPRPSoft" ); + Singleton.setInstance( SingletonConstants.COMPANY_NAME, "SIPRP - Sociedade Ib\u00e9rica de Preven\u00e7\u00e3o de Riscos Profissionais" ); + Singleton.setInstance( SingletonConstants.COMPANY_LOGO, "logo_combo.jpg" ); + Singleton.setInstance( SingletonConstants.COMPANY_ACRONYM, "SIPRP" ); + Singleton.setInstance( SingletonConstants.SUBJECT_CONSULTA, "SIPRP - Marca\u00E7\u00E3o de consulta de '" + NOME + "'"); + Singleton.setInstance( SingletonConstants.LETTER_CONSULTA, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o da consulta de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "%0A%0A" + + "Solicitamos, tamb\u00E9m, que o colaborador seja portador do Boletim de Vacinas e " + + "dos \u00FAltimos exames complementares realizados." + + "%0A%0A" + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos," + + "%0A%0ASIPRP" + + "%0A%0AATRIUM SALDANHA" + + "%0A%0APra\u00e7a Duque de Saldanha, 1 - 9\u00BAG" + + "%0A%0A1050-094 Lisboa" ); + Singleton.setInstance( SingletonConstants.SUBJECT_EXAMES, "SIPRP - Marca\u00E7\u00E3o de exame de '" + NOME + "'"); + Singleton.setInstance( SingletonConstants.LETTER_EXAMES, "Vimos pelo presente informar que '" + NOME + "' dever\u00E1 comparecer " + + "nas nossas instala\u00E7\u00F5es para a realiza\u00E7\u00E3o dos exames de Medicina " + + "do Trabalho, no dia '" + DATA + "', pelas 08H30." + + "%0A%0A" + + "Relembramos que o colaborador dever\u00E1 comparecer em jejum." + + "%0A%0A" + + "Caso n\u00E3o seja poss\u00EDvel a compar\u00EAncia deste colaborador na data " + + "indicada, contacte-nos, por favor, atrav\u00E9s do telefone 21 350 45 40 " + + "ou respondendo ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASIPRP" ); + Singleton.setInstance( SingletonConstants.SUBJECT_VISITA, "SIPRP - Marca\u00E7\u00E3o de visita de higiene e seguran\u00E7a a '" + NOME + "'" ); + Singleton.setInstance( SingletonConstants.LETTER_VISITA, "Vimos pelo presente informar que iremos efectuar a auditoria de Higiene e " + + "Seguran\u00E7a \u00E0s vossas instala\u00E7\u00F5es de '" + NOME + "', no dia '" + DATA + "'." + + "%0A%0A" + + "Agradecemos que nos confirme, pela mesma via, o nome do representante " + + "da empresa que nos ir\u00E1 acompanhar e a vossa disponibilidade para a " + + "realiza\u00E7\u00E3o da visita na data indicada." + + "%0A%0A" + + "Caso necessite de qualquer esclarecimento, contacte-nos, por favor, " + + "atrav\u00E9s dos telefones 21 350 45 43 (Pedro Vieira), 21 350 45 44 " + + "(Catarina Leonardo) ou responda ao remetente desta mensagem." + + "%0A%0A%0A" + + "Cumprimentos,%0A%0ASIPRP" ); + Singleton.setInstance( SingletonConstants.USES_HOUR, Boolean.FALSE ); + Singleton.setInstance( SingletonConstants.CODIGO_EMPRESA_FORMAT, "2 6 / 2" ); + Singleton.setInstance( SingletonConstants.FICHA_MARCA_EXAMES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT, new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 } ); + Singleton.setInstance( SingletonConstants.EXCEL_FORMAT_DEMISSAO, new int[]{ 0, 1 } ); + + Singleton.setInstance( SingletonConstants.MODULE_FICHA, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_CLIENTES, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.WEB_AWARE, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_RELATORIO, Boolean.TRUE ); + Singleton.setInstance( SingletonConstants.MODULE_LISTAGENS, Boolean.TRUE ); + + Singleton.setInstance( SingletonConstants.WEB_USER, "siprp" ); + Singleton.setInstance( SingletonConstants.WEB_PASSWORD, "rg2h-opksiprp" ); + Singleton.setInstance( SingletonConstants.WEB_URL_PREFIX, "jdbc:postgresql://" ); + Singleton.setInstance( SingletonConstants.WEB_URL, "www.evolute.pt:5436" ); + Singleton.setInstance( SingletonConstants.WEB_DB_NAME, "siprp" ); + Singleton.setInstance( SingletonConstants.WEB_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "slony" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "-rg2hevoevo" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "www.evolute.pt:5436" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local_3" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + + Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); + Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); + Singleton.setInstance( SingletonConstants.LOCAL_URL, "10.158.2.3:5432" ); + Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); + Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); +// +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "localhost:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + +// Singleton.setInstance( SingletonConstants.LOCAL_USER, "postgres" ); +// Singleton.setInstance( SingletonConstants.LOCAL_PASSWORD, "Typein" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL_PREFIX, "jdbc:postgresql://" ); +// Singleton.setInstance( SingletonConstants.LOCAL_URL, "192.168.1.1:5432" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DB_NAME, "siprp_local" ); +// Singleton.setInstance( SingletonConstants.LOCAL_DRIVER_NAME, "org.postgresql.Driver" ); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveHandler.java b/tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveHandler.java new file mode 100644 index 00000000..a951e86a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveHandler.java @@ -0,0 +1,51 @@ +/* + * StampSaveHandler.java + * + * Created on 15 de Marco de 2005, 15:00 + */ + +package siprp.data; + +import java.util.*; + +import com.evolute.utils.jdo.*; +/** + * + * @author fpalma + */ +public class ActualizacaoSaveHandler implements JDOOperationHandlerInterface +{ + public static final ActualizacaoSaveHandler INSTANCE = new ActualizacaoSaveHandler(); + + /** Creates a new instance of StampSaveHandler */ + public ActualizacaoSaveHandler() + { + } + + public boolean handle(JDOObject object, int operation, int moment) throws Exception + { + if( !( object instanceof ActualizacaoSaveable ) ) + { + return false; + } + switch( operation ) + { + case OP_SAVE: + return save( object, moment ); + + case OP_DELETE: + return false; + } + return false; + } + + protected boolean save( JDOObject object, int moment ) + { + if( moment != MOMENT_BEFORE ) + { + return false; + } + object.set( ActualizacaoSaveable.ACTUALIZACAO, new Date() ); + return true; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveable.java b/tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveable.java new file mode 100644 index 00000000..87d79372 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/ActualizacaoSaveable.java @@ -0,0 +1,16 @@ +/* + * ActualizacaoSaveable.java + * + * Created on 15 de Marco de 2005, 15:32 + */ + +package siprp.data; + +/** + * + * @author fpalma + */ +public interface ActualizacaoSaveable +{ + public static final String ACTUALIZACAO = "actualizacao"; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Aviso.java b/tags/teg/SIPRPSoft/src/siprp/data/Aviso.java new file mode 100644 index 00000000..791fad87 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Aviso.java @@ -0,0 +1,186 @@ +/* +* Aviso.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class Aviso implements JDOInnerObject +{ + private Integer id; + private Integer tipo; + private Empresa empresa; + private Estabelecimento estabelecimento; + private Trabalhador trabalhador; + private Integer evento_id; + private Date data_aviso; + private Date data_evento; + private String descricao; + + public Aviso() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == AvisoData.ID ) + { + return id; + } + else if( fieldName == AvisoData.TIPO ) + { + return tipo; + } + else if( fieldName == AvisoData.EMPRESA ) + { + return empresa; + } + else if( fieldName == AvisoData.ESTABELECIMENTO ) + { + return estabelecimento; + } + else if( fieldName == AvisoData.TRABALHADOR ) + { + return trabalhador; + } + else if( fieldName == AvisoData.EVENTO_ID ) + { + return evento_id; + } + else if( fieldName == AvisoData.DATA_AVISO ) + { + return data_aviso; + } + else if( fieldName == AvisoData.DATA_EVENTO ) + { + return data_evento; + } + else if( fieldName == AvisoData.DESCRICAO ) + { + return descricao; + } + else if( fieldName.equals( AvisoData.ID ) ) + { + return id; + } + else if( fieldName.equals( AvisoData.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( AvisoData.EMPRESA ) ) + { + return empresa; + } + else if( fieldName.equals( AvisoData.ESTABELECIMENTO ) ) + { + return estabelecimento; + } + else if( fieldName.equals( AvisoData.TRABALHADOR ) ) + { + return trabalhador; + } + else if( fieldName.equals( AvisoData.EVENTO_ID ) ) + { + return evento_id; + } + else if( fieldName.equals( AvisoData.DATA_AVISO ) ) + { + return data_aviso; + } + else if( fieldName.equals( AvisoData.DATA_EVENTO ) ) + { + return data_evento; + } + else if( fieldName.equals( AvisoData.DESCRICAO ) ) + { + return descricao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == AvisoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == AvisoData.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == AvisoData.EMPRESA ) + { + empresa = ( Empresa ) value; + } + else if( fieldName == AvisoData.ESTABELECIMENTO ) + { + estabelecimento = ( Estabelecimento ) value; + } + else if( fieldName == AvisoData.TRABALHADOR ) + { + trabalhador = ( Trabalhador ) value; + } + else if( fieldName == AvisoData.EVENTO_ID ) + { + evento_id = ( Integer ) value; + } + else if( fieldName == AvisoData.DATA_AVISO ) + { + data_aviso = ( Date ) value; + } + else if( fieldName == AvisoData.DATA_EVENTO ) + { + data_evento = ( Date ) value; + } + else if( fieldName == AvisoData.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( AvisoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( AvisoData.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( AvisoData.EMPRESA ) ) + { + empresa = ( Empresa ) value; + } + else if( fieldName.equals( AvisoData.ESTABELECIMENTO ) ) + { + estabelecimento = ( Estabelecimento ) value; + } + else if( fieldName.equals( AvisoData.TRABALHADOR ) ) + { + trabalhador = ( Trabalhador ) value; + } + else if( fieldName.equals( AvisoData.EVENTO_ID ) ) + { + evento_id = ( Integer ) value; + } + else if( fieldName.equals( AvisoData.DATA_AVISO ) ) + { + data_aviso = ( Date ) value; + } + else if( fieldName.equals( AvisoData.DATA_EVENTO ) ) + { + data_evento = ( Date ) value; + } + else if( fieldName.equals( AvisoData.DESCRICAO ) ) + { + descricao = ( String ) value; + } + } + + public Class getOuterClass() + { + return AvisoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/AvisoConstants.java b/tags/teg/SIPRPSoft/src/siprp/data/AvisoConstants.java new file mode 100644 index 00000000..1f8ca61f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/AvisoConstants.java @@ -0,0 +1,18 @@ +/* + * AvisoConstants.java + * + * Created on 11 de Outubro de 2004, 13:03 + */ + +package siprp.data; + +/** + * + * @author fpalma + */ +public interface AvisoConstants +{ + public static final int TIPO_TRABALHADOR = 0; + public static final int TIPO_ESTABELECIMENTO = 1; + public static final int TIPO_EMPRESA = 2; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/AvisoData.java b/tags/teg/SIPRPSoft/src/siprp/data/AvisoData.java new file mode 100644 index 00000000..dace2057 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/AvisoData.java @@ -0,0 +1,68 @@ +/* +* AvisoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class AvisoData extends JDOObject + implements AvisoConstants +{ + public static final String ID = "id"; + public static final String TIPO = "tipo"; + public static final String EMPRESA = "empresa"; + public static final String ESTABELECIMENTO = "estabelecimento"; + public static final String TRABALHADOR = "trabalhador"; + public static final String EVENTO_ID = "evento_id"; + public static final String DATA_AVISO = "data_aviso"; + public static final String DATA_EVENTO = "data_evento"; + public static final String DESCRICAO = "descricao"; + + public static final String FIELD_NAMES[] = new String[]{ + TIPO, EMPRESA, ESTABELECIMENTO, TRABALHADOR, EVENTO_ID, DATA_AVISO, DATA_EVENTO, + DESCRICAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TIPO, EMPRESA, ESTABELECIMENTO, TRABALHADOR, EVENTO_ID, DATA_AVISO, DATA_EVENTO, + DESCRICAO, }; + + private HashMap dataHash; + + public AvisoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Aviso.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/AvisoID.java b/tags/teg/SIPRPSoft/src/siprp/data/AvisoID.java new file mode 100644 index 00000000..9a7cfb3f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/AvisoID.java @@ -0,0 +1,22 @@ +/* +* AvisoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 13/Out/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.jpox.*; + +public final class AvisoID extends IntegerID +{ + public AvisoID() + { + } + + public AvisoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Contacto.java b/tags/teg/SIPRPSoft/src/siprp/data/Contacto.java new file mode 100644 index 00000000..38941701 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Contacto.java @@ -0,0 +1,152 @@ +/* +* Contacto.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class Contacto implements JDOInnerObject +{ + private Integer id; + private String nome; + private String cargo; + private String telefone; + private String telemovel; + private String fax; + private String email; + + public Contacto() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ContactoData.ID ) + { + return id; + } + else if( fieldName == ContactoData.NOME ) + { + return nome; + } + else if( fieldName == ContactoData.CARGO ) + { + return cargo; + } + else if( fieldName == ContactoData.TELEFONE ) + { + return telefone; + } + else if( fieldName == ContactoData.TELEMOVEL ) + { + return telemovel; + } + else if( fieldName == ContactoData.FAX ) + { + return fax; + } + else if( fieldName == ContactoData.EMAIL ) + { + return email; + } + else if( fieldName.equals( ContactoData.ID ) ) + { + return id; + } + else if( fieldName.equals( ContactoData.NOME ) ) + { + return nome; + } + else if( fieldName.equals( ContactoData.CARGO ) ) + { + return cargo; + } + else if( fieldName.equals( ContactoData.TELEFONE ) ) + { + return telefone; + } + else if( fieldName.equals( ContactoData.TELEMOVEL ) ) + { + return telemovel; + } + else if( fieldName.equals( ContactoData.FAX ) ) + { + return fax; + } + else if( fieldName.equals( ContactoData.EMAIL ) ) + { + return email; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ContactoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ContactoData.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == ContactoData.CARGO ) + { + cargo = ( String ) value; + } + else if( fieldName == ContactoData.TELEFONE ) + { + telefone = ( String ) value; + } + else if( fieldName == ContactoData.TELEMOVEL ) + { + telemovel = ( String ) value; + } + else if( fieldName == ContactoData.FAX ) + { + fax = ( String ) value; + } + else if( fieldName == ContactoData.EMAIL ) + { + email = ( String ) value; + } + else if( fieldName.equals( ContactoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ContactoData.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( ContactoData.CARGO ) ) + { + cargo = ( String ) value; + } + else if( fieldName.equals( ContactoData.TELEFONE ) ) + { + telefone = ( String ) value; + } + else if( fieldName.equals( ContactoData.TELEMOVEL ) ) + { + telemovel = ( String ) value; + } + else if( fieldName.equals( ContactoData.FAX ) ) + { + fax = ( String ) value; + } + else if( fieldName.equals( ContactoData.EMAIL ) ) + { + email = ( String ) value; + } + } + + public Class getOuterClass() + { + return ContactoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/ContactoData.java b/tags/teg/SIPRPSoft/src/siprp/data/ContactoData.java new file mode 100644 index 00000000..a3fd1829 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/ContactoData.java @@ -0,0 +1,63 @@ +/* +* ContactoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 13/Out/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class ContactoData extends JDOObject +{ + public static final String ID = "id"; + public static final String NOME = "nome"; + public static final String CARGO = "cargo"; + public static final String TELEFONE = "telefone"; + public static final String TELEMOVEL = "telemovel"; + public static final String FAX = "fax"; + public static final String EMAIL = "email"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, CARGO, TELEFONE, TELEMOVEL, FAX, EMAIL, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, CARGO, TELEFONE, TELEMOVEL, FAX, EMAIL, }; + + private HashMap dataHash; + + public ContactoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Contacto.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/ContactoID.java b/tags/teg/SIPRPSoft/src/siprp/data/ContactoID.java new file mode 100644 index 00000000..a142d5ef --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/ContactoID.java @@ -0,0 +1,22 @@ +/* +* ContactoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 13/Out/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.jpox.*; + +public final class ContactoID extends IntegerID +{ + public ContactoID() + { + } + + public ContactoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteHandler.java b/tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteHandler.java new file mode 100644 index 00000000..d6f2650e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteHandler.java @@ -0,0 +1,70 @@ +/* + * DeleteHandler.java + * + * Created on 11 de Outubro de 2004, 16:04 + */ + +package siprp.data; + +import com.evolute.utils.jdo.*; + +/** + * + * @author fpalma + */ +public class DisableDeleteHandler implements JDOOperationHandlerInterface +{ + public static final DisableDeleteHandler INSTANCE = new DisableDeleteHandler(); + + /** Creates a new instance of DeleteHandler */ + public DisableDeleteHandler() + { + } + + public boolean handle( JDOObject object, int operation, int moment ) + throws Exception + { + if( !( object instanceof DisableDeleteable ) ) + { + return false; + } + switch( operation ) + { + case OP_SAVE: + return save( object, moment ); + + case OP_DELETE: + return delete( object, moment ); + + } + return false; + } + + protected boolean save( JDOObject object, int moment ) + throws Exception + { + if( moment != MOMENT_BEFORE ) + { + return false; + } + String old = (String) object.get( DisableDeleteable.INACTIVO ); + if( old == null ) + { + object.set( DisableDeleteable.INACTIVO, "n" ); + } + return true; + } + + protected boolean delete( JDOObject object, int moment ) + throws Exception + { + if( moment != MOMENT_INSTEAD ) + { + return false; + } + object.set( DisableDeleteable.INACTIVO, "y" ); + object.save(); + return true; + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteable.java b/tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteable.java new file mode 100644 index 00000000..b3ba4e52 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/DisableDeleteable.java @@ -0,0 +1,16 @@ +/* + * DisableDeleteable.java + * + * Created on 11 de Outubro de 2004, 16:09 + */ + +package siprp.data; + +/** + * + * @author fpalma + */ +public interface DisableDeleteable +{ + public static final String INACTIVO = "inactivo"; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Empresa.java b/tags/teg/SIPRPSoft/src/siprp/data/Empresa.java new file mode 100644 index 00000000..7a64f2dc --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Empresa.java @@ -0,0 +1,747 @@ +/* +* Empresa.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 17/Mai/2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class Empresa implements JDOInnerObject +{ + private Integer id; + private String designacao_social; + private String designacao_social_plain; + private Integer servico_saude_tipo; + private String servico_saude_designacao; + private Integer servico_higiene_tipo; + private String servico_higiene_designacao; + private String morada; + private String codigo_postal; + private String localidade; + private String distrito; + private String concelho; + private Date data_proposta; + private Date data_aceitacao; + private Date inicio_contrato; + private Integer duracao; + private Date data_cancelamento; + private String perfil_1; + private String perfil_2; + private Date data_envio_contrato; + private Date data_recepcao_contrato; + private Date data_envio_idict; + private Date data_relatorio_anual; + private String codigo_1; + private String codigo_2; + private String codigo_3; + private String cae; + private String actividade; + private String contribuinte; + private String seguranca_social; + private Double preco_higiene; + private Double preco_medicina; + private String periodicidade; + private Contacto contacto_1; + private Contacto contacto_2; + private Integer servicos; + private String inactivo; + private Date actualizacao; + private String a_consultas; + private String a_exames; + private String b_consultas; + private String b_exames; + + public Empresa() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EmpresaData.ID ) + { + return id; + } + else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL ) + { + return designacao_social; + } + else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL_PLAIN ) + { + return designacao_social_plain; + } + else if( fieldName == EmpresaData.SERVICO_SAUDE_TIPO ) + { + return servico_saude_tipo; + } + else if( fieldName == EmpresaData.SERVICO_SAUDE_DESIGNACAO ) + { + return servico_saude_designacao; + } + else if( fieldName == EmpresaData.SERVICO_HIGIENE_TIPO ) + { + return servico_higiene_tipo; + } + else if( fieldName == EmpresaData.SERVICO_HIGIENE_DESIGNACAO ) + { + return servico_higiene_designacao; + } + else if( fieldName == EmpresaData.MORADA ) + { + return morada; + } + else if( fieldName == EmpresaData.CODIGO_POSTAL ) + { + return codigo_postal; + } + else if( fieldName == EmpresaData.LOCALIDADE ) + { + return localidade; + } + else if( fieldName == EmpresaData.DISTRITO ) + { + return distrito; + } + else if( fieldName == EmpresaData.CONCELHO ) + { + return concelho; + } + else if( fieldName == EmpresaData.DATA_PROPOSTA ) + { + return data_proposta; + } + else if( fieldName == EmpresaData.DATA_ACEITACAO ) + { + return data_aceitacao; + } + else if( fieldName == EmpresaData.INICIO_CONTRATO ) + { + return inicio_contrato; + } + else if( fieldName == EmpresaData.DURACAO ) + { + return duracao; + } + else if( fieldName == EmpresaData.DATA_CANCELAMENTO ) + { + return data_cancelamento; + } + else if( fieldName == EmpresaData.PERFIL_1 ) + { + return perfil_1; + } + else if( fieldName == EmpresaData.PERFIL_2 ) + { + return perfil_2; + } + else if( fieldName == EmpresaData.DATA_ENVIO_CONTRATO ) + { + return data_envio_contrato; + } + else if( fieldName == EmpresaData.DATA_RECEPCAO_CONTRATO ) + { + return data_recepcao_contrato; + } + else if( fieldName == EmpresaData.DATA_ENVIO_IDICT ) + { + return data_envio_idict; + } + else if( fieldName == EmpresaData.DATA_RELATORIO_ANUAL ) + { + return data_relatorio_anual; + } + else if( fieldName == EmpresaData.CODIGO_1 ) + { + return codigo_1; + } + else if( fieldName == EmpresaData.CODIGO_2 ) + { + return codigo_2; + } + else if( fieldName == EmpresaData.CODIGO_3 ) + { + return codigo_3; + } + else if( fieldName == EmpresaData.CAE ) + { + return cae; + } + else if( fieldName == EmpresaData.ACTIVIDADE ) + { + return actividade; + } + else if( fieldName == EmpresaData.CONTRIBUINTE ) + { + return contribuinte; + } + else if( fieldName == EmpresaData.SEGURANCA_SOCIAL ) + { + return seguranca_social; + } + else if( fieldName == EmpresaData.PRECO_HIGIENE ) + { + return preco_higiene; + } + else if( fieldName == EmpresaData.PRECO_MEDICINA ) + { + return preco_medicina; + } + else if( fieldName == EmpresaData.PERIODICIDADE ) + { + return periodicidade; + } + else if( fieldName == EmpresaData.CONTACTO_1 ) + { + return contacto_1; + } + else if( fieldName == EmpresaData.CONTACTO_2 ) + { + return contacto_2; + } + else if( fieldName == EmpresaData.SERVICOS ) + { + return servicos; + } + else if( fieldName == EmpresaData.INACTIVO ) + { + return inactivo; + } + else if( fieldName == EmpresaData.ACTUALIZACAO ) + { + return actualizacao; + } + else if( fieldName == EmpresaData.A_CONSULTAS ) + { + return a_consultas; + } + else if( fieldName == EmpresaData.A_EXAMES ) + { + return a_exames; + } + else if( fieldName == EmpresaData.B_CONSULTAS ) + { + return b_consultas; + } + else if( fieldName == EmpresaData.B_EXAMES ) + { + return b_exames; + } + else if( fieldName.equals( EmpresaData.ID ) ) + { + return id; + } + else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL ) ) + { + return designacao_social; + } + else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ) ) + { + return designacao_social_plain; + } + else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_TIPO ) ) + { + return servico_saude_tipo; + } + else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_DESIGNACAO ) ) + { + return servico_saude_designacao; + } + else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_TIPO ) ) + { + return servico_higiene_tipo; + } + else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_DESIGNACAO ) ) + { + return servico_higiene_designacao; + } + else if( fieldName.equals( EmpresaData.MORADA ) ) + { + return morada; + } + else if( fieldName.equals( EmpresaData.CODIGO_POSTAL ) ) + { + return codigo_postal; + } + else if( fieldName.equals( EmpresaData.LOCALIDADE ) ) + { + return localidade; + } + else if( fieldName.equals( EmpresaData.DISTRITO ) ) + { + return distrito; + } + else if( fieldName.equals( EmpresaData.CONCELHO ) ) + { + return concelho; + } + else if( fieldName.equals( EmpresaData.DATA_PROPOSTA ) ) + { + return data_proposta; + } + else if( fieldName.equals( EmpresaData.DATA_ACEITACAO ) ) + { + return data_aceitacao; + } + else if( fieldName.equals( EmpresaData.INICIO_CONTRATO ) ) + { + return inicio_contrato; + } + else if( fieldName.equals( EmpresaData.DURACAO ) ) + { + return duracao; + } + else if( fieldName.equals( EmpresaData.DATA_CANCELAMENTO ) ) + { + return data_cancelamento; + } + else if( fieldName.equals( EmpresaData.PERFIL_1 ) ) + { + return perfil_1; + } + else if( fieldName.equals( EmpresaData.PERFIL_2 ) ) + { + return perfil_2; + } + else if( fieldName.equals( EmpresaData.DATA_ENVIO_CONTRATO ) ) + { + return data_envio_contrato; + } + else if( fieldName.equals( EmpresaData.DATA_RECEPCAO_CONTRATO ) ) + { + return data_recepcao_contrato; + } + else if( fieldName.equals( EmpresaData.DATA_ENVIO_IDICT ) ) + { + return data_envio_idict; + } + else if( fieldName.equals( EmpresaData.DATA_RELATORIO_ANUAL ) ) + { + return data_relatorio_anual; + } + else if( fieldName.equals( EmpresaData.CODIGO_1 ) ) + { + return codigo_1; + } + else if( fieldName.equals( EmpresaData.CODIGO_2 ) ) + { + return codigo_2; + } + else if( fieldName.equals( EmpresaData.CODIGO_3 ) ) + { + return codigo_3; + } + else if( fieldName.equals( EmpresaData.CAE ) ) + { + return cae; + } + else if( fieldName.equals( EmpresaData.ACTIVIDADE ) ) + { + return actividade; + } + else if( fieldName.equals( EmpresaData.CONTRIBUINTE ) ) + { + return contribuinte; + } + else if( fieldName.equals( EmpresaData.SEGURANCA_SOCIAL ) ) + { + return seguranca_social; + } + else if( fieldName.equals( EmpresaData.PRECO_HIGIENE ) ) + { + return preco_higiene; + } + else if( fieldName.equals( EmpresaData.PRECO_MEDICINA ) ) + { + return preco_medicina; + } + else if( fieldName.equals( EmpresaData.PERIODICIDADE ) ) + { + return periodicidade; + } + else if( fieldName.equals( EmpresaData.CONTACTO_1 ) ) + { + return contacto_1; + } + else if( fieldName.equals( EmpresaData.CONTACTO_2 ) ) + { + return contacto_2; + } + else if( fieldName.equals( EmpresaData.SERVICOS ) ) + { + return servicos; + } + else if( fieldName.equals( EmpresaData.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( EmpresaData.ACTUALIZACAO ) ) + { + return actualizacao; + } + else if( fieldName.equals( EmpresaData.A_CONSULTAS ) ) + { + return a_consultas; + } + else if( fieldName.equals( EmpresaData.A_EXAMES ) ) + { + return a_exames; + } + else if( fieldName.equals( EmpresaData.B_CONSULTAS ) ) + { + return b_consultas; + } + else if( fieldName.equals( EmpresaData.B_EXAMES ) ) + { + return b_exames; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EmpresaData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL ) + { + designacao_social = ( String ) value; + } + else if( fieldName == EmpresaData.DESIGNACAO_SOCIAL_PLAIN ) + { + designacao_social_plain = ( String ) value; + } + else if( fieldName == EmpresaData.SERVICO_SAUDE_TIPO ) + { + servico_saude_tipo = ( Integer ) value; + } + else if( fieldName == EmpresaData.SERVICO_SAUDE_DESIGNACAO ) + { + servico_saude_designacao = ( String ) value; + } + else if( fieldName == EmpresaData.SERVICO_HIGIENE_TIPO ) + { + servico_higiene_tipo = ( Integer ) value; + } + else if( fieldName == EmpresaData.SERVICO_HIGIENE_DESIGNACAO ) + { + servico_higiene_designacao = ( String ) value; + } + else if( fieldName == EmpresaData.MORADA ) + { + morada = ( String ) value; + } + else if( fieldName == EmpresaData.CODIGO_POSTAL ) + { + codigo_postal = ( String ) value; + } + else if( fieldName == EmpresaData.LOCALIDADE ) + { + localidade = ( String ) value; + } + else if( fieldName == EmpresaData.DISTRITO ) + { + distrito = ( String ) value; + } + else if( fieldName == EmpresaData.CONCELHO ) + { + concelho = ( String ) value; + } + else if( fieldName == EmpresaData.DATA_PROPOSTA ) + { + data_proposta = ( Date ) value; + } + else if( fieldName == EmpresaData.DATA_ACEITACAO ) + { + data_aceitacao = ( Date ) value; + } + else if( fieldName == EmpresaData.INICIO_CONTRATO ) + { + inicio_contrato = ( Date ) value; + } + else if( fieldName == EmpresaData.DURACAO ) + { + duracao = ( Integer ) value; + } + else if( fieldName == EmpresaData.DATA_CANCELAMENTO ) + { + data_cancelamento = ( Date ) value; + } + else if( fieldName == EmpresaData.PERFIL_1 ) + { + perfil_1 = ( String ) value; + } + else if( fieldName == EmpresaData.PERFIL_2 ) + { + perfil_2 = ( String ) value; + } + else if( fieldName == EmpresaData.DATA_ENVIO_CONTRATO ) + { + data_envio_contrato = ( Date ) value; + } + else if( fieldName == EmpresaData.DATA_RECEPCAO_CONTRATO ) + { + data_recepcao_contrato = ( Date ) value; + } + else if( fieldName == EmpresaData.DATA_ENVIO_IDICT ) + { + data_envio_idict = ( Date ) value; + } + else if( fieldName == EmpresaData.DATA_RELATORIO_ANUAL ) + { + data_relatorio_anual = ( Date ) value; + } + else if( fieldName == EmpresaData.CODIGO_1 ) + { + codigo_1 = ( String ) value; + } + else if( fieldName == EmpresaData.CODIGO_2 ) + { + codigo_2 = ( String ) value; + } + else if( fieldName == EmpresaData.CODIGO_3 ) + { + codigo_3 = ( String ) value; + } + else if( fieldName == EmpresaData.CAE ) + { + cae = ( String ) value; + } + else if( fieldName == EmpresaData.ACTIVIDADE ) + { + actividade = ( String ) value; + } + else if( fieldName == EmpresaData.CONTRIBUINTE ) + { + contribuinte = ( String ) value; + } + else if( fieldName == EmpresaData.SEGURANCA_SOCIAL ) + { + seguranca_social = ( String ) value; + } + else if( fieldName == EmpresaData.PRECO_HIGIENE ) + { + preco_higiene = ( Double ) value; + } + else if( fieldName == EmpresaData.PRECO_MEDICINA ) + { + preco_medicina = ( Double ) value; + } + else if( fieldName == EmpresaData.PERIODICIDADE ) + { + periodicidade = ( String ) value; + } + else if( fieldName == EmpresaData.CONTACTO_1 ) + { + contacto_1 = ( Contacto ) value; + } + else if( fieldName == EmpresaData.CONTACTO_2 ) + { + contacto_2 = ( Contacto ) value; + } + else if( fieldName == EmpresaData.SERVICOS ) + { + servicos = ( Integer ) value; + } + else if( fieldName == EmpresaData.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == EmpresaData.ACTUALIZACAO ) + { + actualizacao = ( Date ) value; + } + else if( fieldName == EmpresaData.A_CONSULTAS ) + { + a_consultas = ( String ) value; + } + else if( fieldName == EmpresaData.A_EXAMES ) + { + a_exames = ( String ) value; + } + else if( fieldName == EmpresaData.B_CONSULTAS ) + { + b_consultas = ( String ) value; + } + else if( fieldName == EmpresaData.B_EXAMES ) + { + b_exames = ( String ) value; + } + else if( fieldName.equals( EmpresaData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL ) ) + { + designacao_social = ( String ) value; + } + else if( fieldName.equals( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ) ) + { + designacao_social_plain = ( String ) value; + } + else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_TIPO ) ) + { + servico_saude_tipo = ( Integer ) value; + } + else if( fieldName.equals( EmpresaData.SERVICO_SAUDE_DESIGNACAO ) ) + { + servico_saude_designacao = ( String ) value; + } + else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_TIPO ) ) + { + servico_higiene_tipo = ( Integer ) value; + } + else if( fieldName.equals( EmpresaData.SERVICO_HIGIENE_DESIGNACAO ) ) + { + servico_higiene_designacao = ( String ) value; + } + else if( fieldName.equals( EmpresaData.MORADA ) ) + { + morada = ( String ) value; + } + else if( fieldName.equals( EmpresaData.CODIGO_POSTAL ) ) + { + codigo_postal = ( String ) value; + } + else if( fieldName.equals( EmpresaData.LOCALIDADE ) ) + { + localidade = ( String ) value; + } + else if( fieldName.equals( EmpresaData.DISTRITO ) ) + { + distrito = ( String ) value; + } + else if( fieldName.equals( EmpresaData.CONCELHO ) ) + { + concelho = ( String ) value; + } + else if( fieldName.equals( EmpresaData.DATA_PROPOSTA ) ) + { + data_proposta = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.DATA_ACEITACAO ) ) + { + data_aceitacao = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.INICIO_CONTRATO ) ) + { + inicio_contrato = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.DURACAO ) ) + { + duracao = ( Integer ) value; + } + else if( fieldName.equals( EmpresaData.DATA_CANCELAMENTO ) ) + { + data_cancelamento = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.PERFIL_1 ) ) + { + perfil_1 = ( String ) value; + } + else if( fieldName.equals( EmpresaData.PERFIL_2 ) ) + { + perfil_2 = ( String ) value; + } + else if( fieldName.equals( EmpresaData.DATA_ENVIO_CONTRATO ) ) + { + data_envio_contrato = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.DATA_RECEPCAO_CONTRATO ) ) + { + data_recepcao_contrato = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.DATA_ENVIO_IDICT ) ) + { + data_envio_idict = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.DATA_RELATORIO_ANUAL ) ) + { + data_relatorio_anual = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.CODIGO_1 ) ) + { + codigo_1 = ( String ) value; + } + else if( fieldName.equals( EmpresaData.CODIGO_2 ) ) + { + codigo_2 = ( String ) value; + } + else if( fieldName.equals( EmpresaData.CODIGO_3 ) ) + { + codigo_3 = ( String ) value; + } + else if( fieldName.equals( EmpresaData.CAE ) ) + { + cae = ( String ) value; + } + else if( fieldName.equals( EmpresaData.ACTIVIDADE ) ) + { + actividade = ( String ) value; + } + else if( fieldName.equals( EmpresaData.CONTRIBUINTE ) ) + { + contribuinte = ( String ) value; + } + else if( fieldName.equals( EmpresaData.SEGURANCA_SOCIAL ) ) + { + seguranca_social = ( String ) value; + } + else if( fieldName.equals( EmpresaData.PRECO_HIGIENE ) ) + { + preco_higiene = ( Double ) value; + } + else if( fieldName.equals( EmpresaData.PRECO_MEDICINA ) ) + { + preco_medicina = ( Double ) value; + } + else if( fieldName.equals( EmpresaData.PERIODICIDADE ) ) + { + periodicidade = ( String ) value; + } + else if( fieldName.equals( EmpresaData.CONTACTO_1 ) ) + { + contacto_1 = ( Contacto ) value; + } + else if( fieldName.equals( EmpresaData.CONTACTO_2 ) ) + { + contacto_2 = ( Contacto ) value; + } + else if( fieldName.equals( EmpresaData.SERVICOS ) ) + { + servicos = ( Integer ) value; + } + else if( fieldName.equals( EmpresaData.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( EmpresaData.ACTUALIZACAO ) ) + { + actualizacao = ( Date ) value; + } + else if( fieldName.equals( EmpresaData.A_CONSULTAS ) ) + { + a_consultas = ( String ) value; + } + else if( fieldName.equals( EmpresaData.A_EXAMES ) ) + { + a_exames = ( String ) value; + } + else if( fieldName.equals( EmpresaData.B_CONSULTAS ) ) + { + b_consultas = ( String ) value; + } + else if( fieldName.equals( EmpresaData.B_EXAMES ) ) + { + b_exames = ( String ) value; + } + } + + public Class getOuterClass() + { + return EmpresaData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/EmpresaData.java b/tags/teg/SIPRPSoft/src/siprp/data/EmpresaData.java new file mode 100644 index 00000000..437a7f72 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/EmpresaData.java @@ -0,0 +1,114 @@ +/* +* EmpresaData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 17/Mai/2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class EmpresaData extends JDOObject + implements DisableDeleteable, ActualizacaoSaveable +{ + public static final String ID = "id"; + public static final String DESIGNACAO_SOCIAL = "designacao_social"; + public static final String DESIGNACAO_SOCIAL_PLAIN = "designacao_social_plain"; + public static final String SERVICO_SAUDE_TIPO = "servico_saude_tipo"; + public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao"; + public static final String SERVICO_HIGIENE_TIPO = "servico_higiene_tipo"; + public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao"; + public static final String MORADA = "morada"; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String LOCALIDADE = "localidade"; + public static final String DISTRITO = "distrito"; + public static final String CONCELHO = "concelho"; + public static final String DATA_PROPOSTA = "data_proposta"; + public static final String DATA_ACEITACAO = "data_aceitacao"; + public static final String INICIO_CONTRATO = "inicio_contrato"; + public static final String DURACAO = "duracao"; + public static final String DATA_CANCELAMENTO = "data_cancelamento"; + public static final String PERFIL_1 = "perfil_1"; + public static final String PERFIL_2 = "perfil_2"; + public static final String DATA_ENVIO_CONTRATO = "data_envio_contrato"; + public static final String DATA_RECEPCAO_CONTRATO = "data_recepcao_contrato"; + public static final String DATA_ENVIO_IDICT = "data_envio_idict"; + public static final String DATA_RELATORIO_ANUAL = "data_relatorio_anual"; + public static final String CODIGO_1 = "codigo_1"; + public static final String CODIGO_2 = "codigo_2"; + public static final String CODIGO_3 = "codigo_3"; + public static final String CAE = "cae"; + public static final String ACTIVIDADE = "actividade"; + public static final String CONTRIBUINTE = "contribuinte"; + public static final String SEGURANCA_SOCIAL = "seguranca_social"; + public static final String PRECO_HIGIENE = "preco_higiene"; + public static final String PRECO_MEDICINA = "preco_medicina"; + public static final String PERIODICIDADE = "periodicidade"; + public static final String CONTACTO_1 = "contacto_1"; + public static final String CONTACTO_2 = "contacto_2"; + public static final String SERVICOS = "servicos"; + public static final String INACTIVO = "inactivo"; + public static final String ACTUALIZACAO = "actualizacao"; + public static final String A_CONSULTAS = "a_consultas"; + public static final String A_EXAMES = "a_exames"; + public static final String B_CONSULTAS = "b_consultas"; + public static final String B_EXAMES = "b_exames"; + + public static final String FIELD_NAMES[] = new String[]{ + DESIGNACAO_SOCIAL, DESIGNACAO_SOCIAL_PLAIN, SERVICO_SAUDE_TIPO, + SERVICO_SAUDE_DESIGNACAO, SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO, + MORADA, CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, DATA_PROPOSTA, + DATA_ACEITACAO, INICIO_CONTRATO, DURACAO, DATA_CANCELAMENTO, PERFIL_1, PERFIL_2, + DATA_ENVIO_CONTRATO, DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT, + DATA_RELATORIO_ANUAL, CODIGO_1, CODIGO_2, CODIGO_3, CAE, ACTIVIDADE, CONTRIBUINTE, + SEGURANCA_SOCIAL, PRECO_HIGIENE, PRECO_MEDICINA, PERIODICIDADE, CONTACTO_1, + CONTACTO_2, SERVICOS, A_CONSULTAS, A_EXAMES, B_CONSULTAS, B_EXAMES, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESIGNACAO_SOCIAL, DESIGNACAO_SOCIAL_PLAIN, SERVICO_SAUDE_TIPO, + SERVICO_SAUDE_DESIGNACAO, SERVICO_HIGIENE_TIPO, SERVICO_HIGIENE_DESIGNACAO, + MORADA, CODIGO_POSTAL, LOCALIDADE, DISTRITO, CONCELHO, DATA_PROPOSTA, + DATA_ACEITACAO, INICIO_CONTRATO, DURACAO, DATA_CANCELAMENTO, PERFIL_1, PERFIL_2, + DATA_ENVIO_CONTRATO, DATA_RECEPCAO_CONTRATO, DATA_ENVIO_IDICT, + DATA_RELATORIO_ANUAL, CODIGO_1, CODIGO_2, CODIGO_3, CAE, ACTIVIDADE, CONTRIBUINTE, + SEGURANCA_SOCIAL, PRECO_HIGIENE, PRECO_MEDICINA, PERIODICIDADE, CONTACTO_1, + CONTACTO_2, SERVICOS, INACTIVO, ACTUALIZACAO, A_CONSULTAS, A_EXAMES, B_CONSULTAS, + B_EXAMES, }; + + private HashMap dataHash; + + public EmpresaData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Empresa.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/EmpresaID.java b/tags/teg/SIPRPSoft/src/siprp/data/EmpresaID.java new file mode 100644 index 00000000..ddee27c0 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/EmpresaID.java @@ -0,0 +1,25 @@ +/* +* EmpresaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 17/Mai/2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class EmpresaID extends IntegerID + implements Serializable +{ + public EmpresaID() + { + } + + public EmpresaID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Estabelecimento.java b/tags/teg/SIPRPSoft/src/siprp/data/Estabelecimento.java new file mode 100644 index 00000000..e14be8da --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Estabelecimento.java @@ -0,0 +1,220 @@ +/* +* Estabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class Estabelecimento implements JDOInnerObject +{ + private Integer id; + private String nome; + private String nome_plain; + private String morada; + private String codigo_postal; + private String localidade; + private String historico; + private Empresa empresa; + private Contacto contacto; + private String inactivo; + private Date actualizacao; + + public Estabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EstabelecimentoData.ID ) + { + return id; + } + else if( fieldName == EstabelecimentoData.NOME ) + { + return nome; + } + else if( fieldName == EstabelecimentoData.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == EstabelecimentoData.MORADA ) + { + return morada; + } + else if( fieldName == EstabelecimentoData.CODIGO_POSTAL ) + { + return codigo_postal; + } + else if( fieldName == EstabelecimentoData.LOCALIDADE ) + { + return localidade; + } + else if( fieldName == EstabelecimentoData.HISTORICO ) + { + return historico; + } + else if( fieldName == EstabelecimentoData.EMPRESA ) + { + return empresa; + } + else if( fieldName == EstabelecimentoData.CONTACTO ) + { + return contacto; + } + else if( fieldName == EstabelecimentoData.INACTIVO ) + { + return inactivo; + } + else if( fieldName == EstabelecimentoData.ACTUALIZACAO ) + { + return actualizacao; + } + else if( fieldName.equals( EstabelecimentoData.ID ) ) + { + return id; + } + else if( fieldName.equals( EstabelecimentoData.NOME ) ) + { + return nome; + } + else if( fieldName.equals( EstabelecimentoData.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( EstabelecimentoData.MORADA ) ) + { + return morada; + } + else if( fieldName.equals( EstabelecimentoData.CODIGO_POSTAL ) ) + { + return codigo_postal; + } + else if( fieldName.equals( EstabelecimentoData.LOCALIDADE ) ) + { + return localidade; + } + else if( fieldName.equals( EstabelecimentoData.HISTORICO ) ) + { + return historico; + } + else if( fieldName.equals( EstabelecimentoData.EMPRESA ) ) + { + return empresa; + } + else if( fieldName.equals( EstabelecimentoData.CONTACTO ) ) + { + return contacto; + } + else if( fieldName.equals( EstabelecimentoData.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( EstabelecimentoData.ACTUALIZACAO ) ) + { + return actualizacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EstabelecimentoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EstabelecimentoData.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == EstabelecimentoData.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == EstabelecimentoData.MORADA ) + { + morada = ( String ) value; + } + else if( fieldName == EstabelecimentoData.CODIGO_POSTAL ) + { + codigo_postal = ( String ) value; + } + else if( fieldName == EstabelecimentoData.LOCALIDADE ) + { + localidade = ( String ) value; + } + else if( fieldName == EstabelecimentoData.HISTORICO ) + { + historico = ( String ) value; + } + else if( fieldName == EstabelecimentoData.EMPRESA ) + { + empresa = ( Empresa ) value; + } + else if( fieldName == EstabelecimentoData.CONTACTO ) + { + contacto = ( Contacto ) value; + } + else if( fieldName == EstabelecimentoData.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == EstabelecimentoData.ACTUALIZACAO ) + { + actualizacao = ( Date ) value; + } + else if( fieldName.equals( EstabelecimentoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EstabelecimentoData.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( EstabelecimentoData.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( EstabelecimentoData.MORADA ) ) + { + morada = ( String ) value; + } + else if( fieldName.equals( EstabelecimentoData.CODIGO_POSTAL ) ) + { + codigo_postal = ( String ) value; + } + else if( fieldName.equals( EstabelecimentoData.LOCALIDADE ) ) + { + localidade = ( String ) value; + } + else if( fieldName.equals( EstabelecimentoData.HISTORICO ) ) + { + historico = ( String ) value; + } + else if( fieldName.equals( EstabelecimentoData.EMPRESA ) ) + { + empresa = ( Empresa ) value; + } + else if( fieldName.equals( EstabelecimentoData.CONTACTO ) ) + { + contacto = ( Contacto ) value; + } + else if( fieldName.equals( EstabelecimentoData.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( EstabelecimentoData.ACTUALIZACAO ) ) + { + actualizacao = ( Date ) value; + } + } + + public Class getOuterClass() + { + return EstabelecimentoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoData.java b/tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoData.java new file mode 100644 index 00000000..e11cfb6b --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoData.java @@ -0,0 +1,69 @@ +/* +* EstabelecimentoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class EstabelecimentoData extends JDOObject + implements DisableDeleteable, ActualizacaoSaveable +{ + public static final String ID = "id"; + public static final String NOME = "nome"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String MORADA = "morada"; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String LOCALIDADE = "localidade"; + public static final String HISTORICO = "historico"; + public static final String EMPRESA = "empresa"; + public static final String CONTACTO = "contacto"; + public static final String INACTIVO = "inactivo"; + public static final String ACTUALIZACAO = "actualizacao"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, HISTORICO, EMPRESA, CONTACTO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, HISTORICO, EMPRESA, CONTACTO, + INACTIVO, ACTUALIZACAO, }; + + private HashMap dataHash; + + public EstabelecimentoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Estabelecimento.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoID.java b/tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoID.java new file mode 100644 index 00000000..3824759b --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/EstabelecimentoID.java @@ -0,0 +1,25 @@ +/* +* EstabelecimentoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 24/Nov/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class EstabelecimentoID extends IntegerID + implements Serializable +{ + public EstabelecimentoID() + { + } + + public EstabelecimentoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Etiqueta.java b/tags/teg/SIPRPSoft/src/siprp/data/Etiqueta.java new file mode 100644 index 00000000..7a35bb38 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Etiqueta.java @@ -0,0 +1,270 @@ +/* +* Etiqueta.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Fev/2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.*; + +public final class Etiqueta implements JDOInnerObject +{ + private Integer id; + private String descricao; + private String descricao_plain; + private Double altura; + private Double largura; + private Double margem_esquerda; + private Double margem_cima; + private Integer colunas; + private Integer linhas; + private String continua; + private Double altura_folha; + private Double largura_folha; + private Double margem_vertical_folha; + private Double margem_horizontal_folha; + + public Etiqueta() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == EtiquetaData.ID ) + { + return id; + } + else if( fieldName == EtiquetaData.DESCRICAO ) + { + return descricao; + } + else if( fieldName == EtiquetaData.DESCRICAO_PLAIN ) + { + return descricao_plain; + } + else if( fieldName == EtiquetaData.ALTURA ) + { + return altura; + } + else if( fieldName == EtiquetaData.LARGURA ) + { + return largura; + } + else if( fieldName == EtiquetaData.MARGEM_ESQUERDA ) + { + return margem_esquerda; + } + else if( fieldName == EtiquetaData.MARGEM_CIMA ) + { + return margem_cima; + } + else if( fieldName == EtiquetaData.COLUNAS ) + { + return colunas; + } + else if( fieldName == EtiquetaData.LINHAS ) + { + return linhas; + } + else if( fieldName == EtiquetaData.CONTINUA ) + { + return continua; + } + else if( fieldName == EtiquetaData.ALTURA_FOLHA ) + { + return altura_folha; + } + else if( fieldName == EtiquetaData.LARGURA_FOLHA ) + { + return largura_folha; + } + else if( fieldName == EtiquetaData.MARGEM_VERTICAL_FOLHA ) + { + return margem_vertical_folha; + } + else if( fieldName == EtiquetaData.MARGEM_HORIZONTAL_FOLHA ) + { + return margem_horizontal_folha; + } + else if( fieldName.equals( EtiquetaData.ID ) ) + { + return id; + } + else if( fieldName.equals( EtiquetaData.DESCRICAO ) ) + { + return descricao; + } + else if( fieldName.equals( EtiquetaData.DESCRICAO_PLAIN ) ) + { + return descricao_plain; + } + else if( fieldName.equals( EtiquetaData.ALTURA ) ) + { + return altura; + } + else if( fieldName.equals( EtiquetaData.LARGURA ) ) + { + return largura; + } + else if( fieldName.equals( EtiquetaData.MARGEM_ESQUERDA ) ) + { + return margem_esquerda; + } + else if( fieldName.equals( EtiquetaData.MARGEM_CIMA ) ) + { + return margem_cima; + } + else if( fieldName.equals( EtiquetaData.COLUNAS ) ) + { + return colunas; + } + else if( fieldName.equals( EtiquetaData.LINHAS ) ) + { + return linhas; + } + else if( fieldName.equals( EtiquetaData.CONTINUA ) ) + { + return continua; + } + else if( fieldName.equals( EtiquetaData.ALTURA_FOLHA ) ) + { + return altura_folha; + } + else if( fieldName.equals( EtiquetaData.LARGURA_FOLHA ) ) + { + return largura_folha; + } + else if( fieldName.equals( EtiquetaData.MARGEM_VERTICAL_FOLHA ) ) + { + return margem_vertical_folha; + } + else if( fieldName.equals( EtiquetaData.MARGEM_HORIZONTAL_FOLHA ) ) + { + return margem_horizontal_folha; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == EtiquetaData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == EtiquetaData.DESCRICAO ) + { + descricao = ( String ) value; + } + else if( fieldName == EtiquetaData.DESCRICAO_PLAIN ) + { + descricao_plain = ( String ) value; + } + else if( fieldName == EtiquetaData.ALTURA ) + { + altura = ( Double ) value; + } + else if( fieldName == EtiquetaData.LARGURA ) + { + largura = ( Double ) value; + } + else if( fieldName == EtiquetaData.MARGEM_ESQUERDA ) + { + margem_esquerda = ( Double ) value; + } + else if( fieldName == EtiquetaData.MARGEM_CIMA ) + { + margem_cima = ( Double ) value; + } + else if( fieldName == EtiquetaData.COLUNAS ) + { + colunas = ( Integer ) value; + } + else if( fieldName == EtiquetaData.LINHAS ) + { + linhas = ( Integer ) value; + } + else if( fieldName == EtiquetaData.CONTINUA ) + { + continua = ( String ) value; + } + else if( fieldName == EtiquetaData.ALTURA_FOLHA ) + { + altura_folha = ( Double ) value; + } + else if( fieldName == EtiquetaData.LARGURA_FOLHA ) + { + largura_folha = ( Double ) value; + } + else if( fieldName == EtiquetaData.MARGEM_VERTICAL_FOLHA ) + { + margem_vertical_folha = ( Double ) value; + } + else if( fieldName == EtiquetaData.MARGEM_HORIZONTAL_FOLHA ) + { + margem_horizontal_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( EtiquetaData.DESCRICAO ) ) + { + descricao = ( String ) value; + } + else if( fieldName.equals( EtiquetaData.DESCRICAO_PLAIN ) ) + { + descricao_plain = ( String ) value; + } + else if( fieldName.equals( EtiquetaData.ALTURA ) ) + { + altura = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.LARGURA ) ) + { + largura = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.MARGEM_ESQUERDA ) ) + { + margem_esquerda = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.MARGEM_CIMA ) ) + { + margem_cima = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.COLUNAS ) ) + { + colunas = ( Integer ) value; + } + else if( fieldName.equals( EtiquetaData.LINHAS ) ) + { + linhas = ( Integer ) value; + } + else if( fieldName.equals( EtiquetaData.CONTINUA ) ) + { + continua = ( String ) value; + } + else if( fieldName.equals( EtiquetaData.ALTURA_FOLHA ) ) + { + altura_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.LARGURA_FOLHA ) ) + { + largura_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.MARGEM_VERTICAL_FOLHA ) ) + { + margem_vertical_folha = ( Double ) value; + } + else if( fieldName.equals( EtiquetaData.MARGEM_HORIZONTAL_FOLHA ) ) + { + margem_horizontal_folha = ( Double ) value; + } + } + + public Class getOuterClass() + { + return EtiquetaData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/EtiquetaData.java b/tags/teg/SIPRPSoft/src/siprp/data/EtiquetaData.java new file mode 100644 index 00000000..8d244d95 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/EtiquetaData.java @@ -0,0 +1,74 @@ +/* +* EtiquetaData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Fev/2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class EtiquetaData extends JDOObject +{ + public static final String ID = "id"; + public static final String DESCRICAO = "descricao"; + public static final String DESCRICAO_PLAIN = "descricao_plain"; + public static final String ALTURA = "altura"; + public static final String LARGURA = "largura"; + public static final String MARGEM_ESQUERDA = "margem_esquerda"; + public static final String MARGEM_CIMA = "margem_cima"; + public static final String COLUNAS = "colunas"; + public static final String LINHAS = "linhas"; + public static final String CONTINUA = "continua"; + public static final String ALTURA_FOLHA = "altura_folha"; + public static final String LARGURA_FOLHA = "largura_folha"; + public static final String MARGEM_VERTICAL_FOLHA = "margem_vertical_folha"; + public static final String MARGEM_HORIZONTAL_FOLHA = "margem_horizontal_folha"; + + public static final String FIELD_NAMES[] = new String[]{ + DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, COLUNAS, + LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA, + MARGEM_HORIZONTAL_FOLHA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DESCRICAO, DESCRICAO_PLAIN, ALTURA, LARGURA, MARGEM_ESQUERDA, MARGEM_CIMA, + COLUNAS, LINHAS, CONTINUA, ALTURA_FOLHA, LARGURA_FOLHA, MARGEM_VERTICAL_FOLHA, + MARGEM_HORIZONTAL_FOLHA, }; + + private HashMap dataHash; + + public EtiquetaData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Etiqueta.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/EtiquetaID.java b/tags/teg/SIPRPSoft/src/siprp/data/EtiquetaID.java new file mode 100644 index 00000000..d014ef55 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/EtiquetaID.java @@ -0,0 +1,25 @@ +/* +* EtiquetaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 27/Fev/2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class EtiquetaID extends IntegerID + implements Serializable +{ + public EtiquetaID() + { + } + + public EtiquetaID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Exame.java b/tags/teg/SIPRPSoft/src/siprp/data/Exame.java new file mode 100644 index 00000000..58ade49b --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Exame.java @@ -0,0 +1,322 @@ +/* +* Exame.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 28/Jan/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class Exame implements JDOInnerObject +{ + private Integer id; + private Date data; + private Integer tipo; + private Integer ocasional; + private String outro_tipo; + private Integer resultado; + private String outra_funcao_1; + private String outra_funcao_2; + private String outra_funcao_3; + private String outra_funcao_4; + private Date proximo_exame; + private String outras_recomendacoes; + private Trabalhador trabalhador; + private Medico medico; + private byte[] pdf; + private byte[] fo; + private String inactivo; + + public Exame() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == ExameData.ID ) + { + return id; + } + else if( fieldName == ExameData.DATA ) + { + return data; + } + else if( fieldName == ExameData.TIPO ) + { + return tipo; + } + else if( fieldName == ExameData.OCASIONAL ) + { + return ocasional; + } + else if( fieldName == ExameData.OUTRO_TIPO ) + { + return outro_tipo; + } + else if( fieldName == ExameData.RESULTADO ) + { + return resultado; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_1 ) + { + return outra_funcao_1; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_2 ) + { + return outra_funcao_2; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_3 ) + { + return outra_funcao_3; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_4 ) + { + return outra_funcao_4; + } + else if( fieldName == ExameData.PROXIMO_EXAME ) + { + return proximo_exame; + } + else if( fieldName == ExameData.OUTRAS_RECOMENDACOES ) + { + return outras_recomendacoes; + } + else if( fieldName == ExameData.TRABALHADOR ) + { + return trabalhador; + } + else if( fieldName == ExameData.MEDICO ) + { + return medico; + } + else if( fieldName == ExameData.PDF ) + { + return pdf; + } + else if( fieldName == ExameData.FO ) + { + return fo; + } + else if( fieldName == ExameData.INACTIVO ) + { + return inactivo; + } + else if( fieldName.equals( ExameData.ID ) ) + { + return id; + } + else if( fieldName.equals( ExameData.DATA ) ) + { + return data; + } + else if( fieldName.equals( ExameData.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( ExameData.OCASIONAL ) ) + { + return ocasional; + } + else if( fieldName.equals( ExameData.OUTRO_TIPO ) ) + { + return outro_tipo; + } + else if( fieldName.equals( ExameData.RESULTADO ) ) + { + return resultado; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_1 ) ) + { + return outra_funcao_1; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_2 ) ) + { + return outra_funcao_2; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_3 ) ) + { + return outra_funcao_3; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_4 ) ) + { + return outra_funcao_4; + } + else if( fieldName.equals( ExameData.PROXIMO_EXAME ) ) + { + return proximo_exame; + } + else if( fieldName.equals( ExameData.OUTRAS_RECOMENDACOES ) ) + { + return outras_recomendacoes; + } + else if( fieldName.equals( ExameData.TRABALHADOR ) ) + { + return trabalhador; + } + else if( fieldName.equals( ExameData.MEDICO ) ) + { + return medico; + } + else if( fieldName.equals( ExameData.PDF ) ) + { + return pdf; + } + else if( fieldName.equals( ExameData.FO ) ) + { + return fo; + } + else if( fieldName.equals( ExameData.INACTIVO ) ) + { + return inactivo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == ExameData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == ExameData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == ExameData.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == ExameData.OCASIONAL ) + { + ocasional = ( Integer ) value; + } + else if( fieldName == ExameData.OUTRO_TIPO ) + { + outro_tipo = ( String ) value; + } + else if( fieldName == ExameData.RESULTADO ) + { + resultado = ( Integer ) value; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_1 ) + { + outra_funcao_1 = ( String ) value; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_2 ) + { + outra_funcao_2 = ( String ) value; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_3 ) + { + outra_funcao_3 = ( String ) value; + } + else if( fieldName == ExameData.OUTRA_FUNCAO_4 ) + { + outra_funcao_4 = ( String ) value; + } + else if( fieldName == ExameData.PROXIMO_EXAME ) + { + proximo_exame = ( Date ) value; + } + else if( fieldName == ExameData.OUTRAS_RECOMENDACOES ) + { + outras_recomendacoes = ( String ) value; + } + else if( fieldName == ExameData.TRABALHADOR ) + { + trabalhador = ( Trabalhador ) value; + } + else if( fieldName == ExameData.MEDICO ) + { + medico = ( Medico ) value; + } + else if( fieldName == ExameData.PDF ) + { + pdf = ( byte[] ) value; + } + else if( fieldName == ExameData.FO ) + { + fo = ( byte[] ) value; + } + else if( fieldName == ExameData.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( ExameData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( ExameData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( ExameData.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( ExameData.OCASIONAL ) ) + { + ocasional = ( Integer ) value; + } + else if( fieldName.equals( ExameData.OUTRO_TIPO ) ) + { + outro_tipo = ( String ) value; + } + else if( fieldName.equals( ExameData.RESULTADO ) ) + { + resultado = ( Integer ) value; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_1 ) ) + { + outra_funcao_1 = ( String ) value; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_2 ) ) + { + outra_funcao_2 = ( String ) value; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_3 ) ) + { + outra_funcao_3 = ( String ) value; + } + else if( fieldName.equals( ExameData.OUTRA_FUNCAO_4 ) ) + { + outra_funcao_4 = ( String ) value; + } + else if( fieldName.equals( ExameData.PROXIMO_EXAME ) ) + { + proximo_exame = ( Date ) value; + } + else if( fieldName.equals( ExameData.OUTRAS_RECOMENDACOES ) ) + { + outras_recomendacoes = ( String ) value; + } + else if( fieldName.equals( ExameData.TRABALHADOR ) ) + { + trabalhador = ( Trabalhador ) value; + } + else if( fieldName.equals( ExameData.MEDICO ) ) + { + medico = ( Medico ) value; + } + else if( fieldName.equals( ExameData.PDF ) ) + { + pdf = ( byte[] ) value; + } + else if( fieldName.equals( ExameData.FO ) ) + { + fo = ( byte[] ) value; + } + else if( fieldName.equals( ExameData.INACTIVO ) ) + { + inactivo = ( String ) value; + } + } + + public Class getOuterClass() + { + return ExameData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/ExameData.java b/tags/teg/SIPRPSoft/src/siprp/data/ExameData.java new file mode 100644 index 00000000..ffc17877 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/ExameData.java @@ -0,0 +1,78 @@ +/* +* ExameData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 28/Jan/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class ExameData extends JDOObject + implements DisableDeleteable +{ + public static final String ID = "id"; + public static final String DATA = "data"; + public static final String TIPO = "tipo"; + public static final String OCASIONAL = "ocasional"; + public static final String OUTRO_TIPO = "outro_tipo"; + public static final String RESULTADO = "resultado"; + public static final String OUTRA_FUNCAO_1 = "outra_funcao_1"; + public static final String OUTRA_FUNCAO_2 = "outra_funcao_2"; + public static final String OUTRA_FUNCAO_3 = "outra_funcao_3"; + public static final String OUTRA_FUNCAO_4 = "outra_funcao_4"; + public static final String PROXIMO_EXAME = "proximo_exame"; + public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes"; + public static final String TRABALHADOR = "trabalhador"; + public static final String MEDICO = "medico"; + public static final String PDF = "pdf"; + public static final String FO = "fo"; + public static final String INACTIVO = "inactivo"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2, + OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES, + TRABALHADOR, MEDICO, PDF, FO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, TIPO, OCASIONAL, OUTRO_TIPO, RESULTADO, OUTRA_FUNCAO_1, OUTRA_FUNCAO_2, + OUTRA_FUNCAO_3, OUTRA_FUNCAO_4, PROXIMO_EXAME, OUTRAS_RECOMENDACOES, + TRABALHADOR, MEDICO, PDF, FO, INACTIVO, }; + + private HashMap dataHash; + + public ExameData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Exame.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/ExameID.java b/tags/teg/SIPRPSoft/src/siprp/data/ExameID.java new file mode 100644 index 00000000..3fc144de --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/ExameID.java @@ -0,0 +1,22 @@ +/* +* ExameID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 28/Jan/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.jpox.*; + +public final class ExameID extends IntegerID +{ + public ExameID() + { + } + + public ExameID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Historico.java b/tags/teg/SIPRPSoft/src/siprp/data/Historico.java new file mode 100644 index 00000000..3a641ee1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Historico.java @@ -0,0 +1,58 @@ +/* + * Historico.java + * + * Created on 7 de Dezembro de 2004, 16:50 + */ + +package siprp.data; + +import java.text.*; +import java.util.*; + +import com.evolute.utils.jdo.*; +import com.evolute.utils.tables.*; + +import siprp.*; +/** + * + * @author fpalma + */ +public abstract class Historico extends JDOObject + implements ColumnizedObject +{ + protected static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + + public static final String DATA = "data"; + public static final String TEXTO = "texto"; + + /** Creates a new instance of Historico */ + public Historico() + { + } + + public Object getValue(int col) + { + switch( col ) + { + case 0: + Date data = (Date) get( DATA ); + String dataStr = DATE_FORMAT.format( data ); + return dataStr; + + case 1: + String textoStr = (String ) get( TEXTO ); + if( textoStr == null ) + { + textoStr = ""; + } + textoStr = textoStr.trim(); + int index = textoStr.indexOf( "\n" ); + if( index != -1 ) + { + textoStr = textoStr.substring( 0, index ); + } + return textoStr; + } + return null; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimento.java b/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimento.java new file mode 100644 index 00000000..0bd186b8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimento.java @@ -0,0 +1,101 @@ +/* +* HistoricoEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class HistoricoEstabelecimento implements JDOInnerObject +{ + private Integer id; + private Date data; + private String texto; + private Estabelecimento estabelecimento; + + public HistoricoEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == HistoricoEstabelecimentoData.ID ) + { + return id; + } + else if( fieldName == HistoricoEstabelecimentoData.DATA ) + { + return data; + } + else if( fieldName == HistoricoEstabelecimentoData.TEXTO ) + { + return texto; + } + else if( fieldName == HistoricoEstabelecimentoData.ESTABELECIMENTO ) + { + return estabelecimento; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.ID ) ) + { + return id; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.DATA ) ) + { + return data; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.TEXTO ) ) + { + return texto; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.ESTABELECIMENTO ) ) + { + return estabelecimento; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == HistoricoEstabelecimentoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == HistoricoEstabelecimentoData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == HistoricoEstabelecimentoData.TEXTO ) + { + texto = ( String ) value; + } + else if( fieldName == HistoricoEstabelecimentoData.ESTABELECIMENTO ) + { + estabelecimento = ( Estabelecimento ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.TEXTO ) ) + { + texto = ( String ) value; + } + else if( fieldName.equals( HistoricoEstabelecimentoData.ESTABELECIMENTO ) ) + { + estabelecimento = ( Estabelecimento ) value; + } + } + + public Class getOuterClass() + { + return HistoricoEstabelecimentoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoData.java b/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoData.java new file mode 100644 index 00000000..38f82221 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoData.java @@ -0,0 +1,60 @@ +/* +* HistoricoEstabelecimentoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class HistoricoEstabelecimentoData extends Historico +{ + public static final String ID = "id"; + public static final String DATA = "data"; + public static final String TEXTO = "texto"; + public static final String ESTABELECIMENTO = "estabelecimento"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TEXTO, ESTABELECIMENTO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, TEXTO, ESTABELECIMENTO, }; + + private HashMap dataHash; + + public HistoricoEstabelecimentoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return HistoricoEstabelecimento.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoID.java b/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoID.java new file mode 100644 index 00000000..1513d1bc --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/HistoricoEstabelecimentoID.java @@ -0,0 +1,22 @@ +/* +* HistoricoEstabelecimentoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 7/Dez/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.jpox.*; + +public final class HistoricoEstabelecimentoID extends IntegerID +{ + public HistoricoEstabelecimentoID() + { + } + + public HistoricoEstabelecimentoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Marcacao.java b/tags/teg/SIPRPSoft/src/siprp/data/Marcacao.java new file mode 100644 index 00000000..5302e965 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Marcacao.java @@ -0,0 +1,352 @@ +/* + * Marcacao.java + * + * Created on 21 de Maio de 2004, 16:59 + */ + +package siprp.data; + +import java.text.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.tables.*; + +import siprp.*; +/** + * + * @author fpalma + */ +public abstract class Marcacao extends JDOObject + implements ColumnizedObject + //, JDOOperationHandlerInterface +{ + public static final int TIPO_MARCACAO_TRABALHADOR_EXAMES = 0; + public static final int TIPO_MARCACAO_TRABALHADOR_CONSULTA = 1; + public static final int TIPO_MARCACAO_ESTABELECIMENTO = 2; + public static final int TIPO_MARCACAO_EMPRESA = 3; + + public static final int ESTADO_POR_REALIZAR = 0; + public static final int ESTADO_PARCIALMENTE_REALIZADA = 1; + public static final int ESTADO_REALIZADA = 2; + public static final int ESTADO_DESMARCADA_TRABALHADOR = 3; + public static final int ESTADO_DESMARCADA_SHST = 4; + public static final int ESTADO_FALTOU = 5; + + public static final String DATA = "data"; + public static final String REALIZADA = "realizada"; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String ANTECEDENCIA_AVISO = "antecedencia_aviso"; + + protected static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); + protected static JDOProvider JDO; + + + public static Marcacao getMarcacao( int tipo ) + { + switch( tipo ) + { + case TIPO_MARCACAO_TRABALHADOR_EXAMES: case TIPO_MARCACAO_TRABALHADOR_CONSULTA: + return new MarcacaoTrabalhadorData(); + + case TIPO_MARCACAO_ESTABELECIMENTO: + return new MarcacaoEstabelecimentoData(); + + case TIPO_MARCACAO_EMPRESA: + return new MarcacaoEmpresaData(); + } + return null; + } + + public Object getValue( int col ) + { + switch( col ) + { + case 0: + Date data = (Date) get( DATA ); + String dataStr = DATE_FORMAT.format( data ); + return dataStr; + + case 1: + String realizada = (String) get( REALIZADA ); +// if( this instanceof MarcacaoEmpresaData ) +// { +// return new Boolean( "y".equals( realizada ) ); +// } +// else +// { + + realizada = "y".equals( realizada ) ? "Sim" : "N\u00e3o"; + return realizada; +// } + + case 2: + if( this instanceof MarcacaoEmpresaData ) + { + String textoStr = (String ) get( MarcacaoEmpresaData.TEXTO ); + if( textoStr == null ) + { + textoStr = ""; + } + textoStr = textoStr.trim(); + int index = textoStr.indexOf( "\n" ); + if( index != -1 ) + { + textoStr = textoStr.substring( 0, index ); + } + return textoStr; + } + else + { + Date dataRelatorio = (Date) get( DATA_RELATORIO ); + String dataRelatorioStr = ( dataRelatorio != null ? DATE_FORMAT.format( dataRelatorio ) : "" ); + return dataRelatorioStr; + } + + default: + return null; + } + } + + public static void saveMarcacaoConsultaForTrabalhadorID( Integer trabalhadorID, Date date ) + throws Exception + { + if( date != null ) + { + date = (Date)date.clone(); + } + FichaDataProvider provider = (FichaDataProvider) FichaDataProvider.getProvider(); + if( trabalhadorID == null ) + { + return; + } + Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID ); + MarcacaoTrabalhadorData marcacao; + if( marcacaoID == null ) + { + marcacao = null; + } + else + { + if( JDO == null ) + { + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + marcacao = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, marcacaoID ); + } + if( date == null && marcacao != null ) + { + marcacao.delete(); + } + else if( date != null && marcacao != null ) + { + marcacao.set( Marcacao.DATA, date ); + marcacao.save(); + } + else if( date != null && marcacao == null ) + { + marcacao = new MarcacaoTrabalhadorData(); + if( JDO == null ) + { + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + TrabalhadorData trab = (TrabalhadorData)JDO.load( TrabalhadorData.class, trabalhadorID ); + marcacao.set( MarcacaoTrabalhadorData.TRABALHADOR, trab ); + marcacao.set( MarcacaoTrabalhadorData.TIPO, new Integer( MarcacaoTrabalhadorData.TIPO_CONSULTA ) ); + marcacao.set( Marcacao.DATA, date ); + marcacao.set( Marcacao.REALIZADA, "n" ); + marcacao.set( MarcacaoTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_POR_REALIZAR ) ); + marcacao.set( MarcacaoTrabalhadorData.MOTIVO, new Integer( 2 ) ); + marcacao.save(); + } + } +// +// public boolean handle( JDOObject object, int operation, int moment ) +// throws Exception +// { +// switch( operation ) +// { +// case JDOOperationHandlerInterface.OP_SAVE: +// switch( moment ) +// { +// case JDOOperationHandlerInterface.MOMENT_BEFORE: +// return preSave( (Marcacao) object ); +// +// case JDOOperationHandlerInterface.MOMENT_AFTER: +// return postSave( (Marcacao) object ); +// } +// return false; +// +// case JDOOperationHandlerInterface.OP_DELETE: +// switch( moment ) +// { +// case JDOOperationHandlerInterface.MOMENT_BEFORE: +// return preDelete( (Marcacao) object ); +// +// case JDOOperationHandlerInterface.MOMENT_AFTER: +// return postDelete( (Marcacao) object ); +// } +// return false; +// } +// return false; +// } +// +// protected boolean preSave( Marcacao object ) +// throws Exception +// { +// return false; +// } +// +// protected boolean postSave( Marcacao object ) +// throws Exception +// { +// if( object instanceof MarcacaoEmpresaData ) +// { +// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ get( MarcacaoEmpresaData.ID ), new Integer( AvisoData.TIPO_EMPRESA ) }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); +// if( aviso == null ) +// { +// aviso = new AvisoData(); +// } +// aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_EMPRESA ) ); +// EmpresaData empresa = ( EmpresaData ) object.get( MarcacaoEmpresaData.EMPRESA ); +// aviso.set( AvisoData.EMPRESA, empresa ); +// aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEmpresaData.ID ) ); +// Date dataEvento = (Date) object.get( DATA ); +// aviso.set( AvisoData.DATA_EVENTO, dataEvento ); +// aviso.set( AvisoData.DATA_AVISO, dataEvento ); +// String descricao = "Tarefa "; +// aviso.set( AvisoData.DESCRICAO, descricao ); +// aviso.save(); +// } +// else if( object instanceof MarcacaoEstabelecimentoData ) +// { +// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ get( MarcacaoEstabelecimentoData.ID ), new Integer( AvisoData.TIPO_ESTABELECIMENTO ) }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); +// if( aviso == null ) +// { +// aviso = new AvisoData(); +// } +// aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_ESTABELECIMENTO ) ); +// EstabelecimentoData estabelecimento = ( EstabelecimentoData ) object.get( MarcacaoEstabelecimentoData.ESTABELECIMENTO ); +// aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento ); +// EmpresaData empresa = ( EmpresaData )estabelecimento.get( EstabelecimentoData.EMPRESA ); +// aviso.set( AvisoData.EMPRESA, empresa ); +// aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEstabelecimentoData.ID ) ); +// Date dataEvento = (Date) object.get( DATA ); +// Date dataAviso = new Date( dataEvento.getTime() ); +// Calendar cal = Calendar.getInstance(); +// cal.setTime( dataAviso ); +// cal.add( Calendar.DAY_OF_MONTH, -14 ); +// dataAviso = cal.getTime(); +// aviso.set( AvisoData.DATA_AVISO, dataAviso ); +// aviso.set( AvisoData.DATA_EVENTO, dataEvento ); +// String descricao = "Visita "; +// aviso.set( AvisoData.DESCRICAO, descricao ); +// cal = Calendar.getInstance(); +// cal.setTime( dataEvento ); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// dataEvento = cal.getTime(); +// +// cal = Calendar.getInstance(); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// Date hoje = cal.getTime(); +// if( hoje.before( dataEvento ) ) +// { +// aviso.save(); +// } +// } +// if( object instanceof MarcacaoTrabalhadorData ) +// { +// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ object.get( MarcacaoTrabalhadorData.ID ), new Integer( AvisoData.TIPO_TRABALHADOR ) }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); +// if( aviso == null ) +// { +// aviso = new AvisoData(); +// } +// aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_TRABALHADOR ) ); +// TrabalhadorData trab = ( TrabalhadorData ) object.get( MarcacaoTrabalhadorData.TRABALHADOR ); +// aviso.set( AvisoData.TRABALHADOR, trab ); +// EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trab.get( TrabalhadorData.ESTABELECIMENTO ); +// aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento ); +// EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA ); +// aviso.set( AvisoData.EMPRESA, empresa ); +// aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoTrabalhadorData.ID ) ); +// Date dataEvento = (Date) object.get( DATA ); +// Date dataAviso = new Date( dataEvento.getTime() ); +// Calendar cal = Calendar.getInstance(); +// cal.setTime( dataAviso ); +// cal.add( Calendar.DAY_OF_MONTH, -14 ); +// dataAviso = cal.getTime(); +// aviso.set( AvisoData.DATA_AVISO, dataAviso ); +// aviso.set( AvisoData.DATA_EVENTO, dataEvento ); +// String descricao = ""; +// switch( ( ( Integer ) object.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() ) +// { +// case MarcacaoTrabalhadorData.TIPO_EXAMES: +// descricao = "Exames "; +// break; +// +// case MarcacaoTrabalhadorData.TIPO_CONSULTA: +// descricao = "Consulta "; +// break; +// } +// aviso.set( AvisoData.DESCRICAO, descricao ); +// cal = Calendar.getInstance(); +// cal.setTime( dataEvento ); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// dataEvento = cal.getTime(); +// +// cal = Calendar.getInstance(); +// cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); +// cal.set( Calendar.MILLISECOND, 0 ); +// Date hoje = cal.getTime(); +// if( hoje.before( dataEvento ) ) +// { +// aviso.save(); +// } +// } +// else +// { +// return false; +// } +// return true; +// } +// +// protected boolean preDelete( Marcacao object ) +// throws Exception +// { +// return false; +// } +// +// protected boolean postDelete( Marcacao object ) +// throws Exception +// { +// Integer tipo; +// if( object instanceof MarcacaoEmpresaData ) +// { +// tipo = new Integer( AvisoData.TIPO_EMPRESA ); +// } +// else if( object instanceof MarcacaoEstabelecimentoData ) +// { +// tipo = new Integer( AvisoData.TIPO_ESTABELECIMENTO ); +// } +// if( object instanceof MarcacaoTrabalhadorData ) +// { +// tipo = new Integer( AvisoData.TIPO_TRABALHADOR ); +// } +// else +// { +// return false; +// } +// AvisoData aviso = (AvisoData) load( AvisoData.class, new Object[]{ object.get( "id" ), tipo }, new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); +// if( aviso != null ) +// { +// aviso.delete(); +// } +// +// return true; +// } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresa.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresa.java new file mode 100644 index 00000000..1f32cac8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresa.java @@ -0,0 +1,118 @@ +/* +* MarcacaoEmpresa.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class MarcacaoEmpresa implements JDOInnerObject +{ + private Integer id; + private Date data; + private String texto; + private String realizada; + private Empresa empresa; + + public MarcacaoEmpresa() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacaoEmpresaData.ID ) + { + return id; + } + else if( fieldName == MarcacaoEmpresaData.DATA ) + { + return data; + } + else if( fieldName == MarcacaoEmpresaData.TEXTO ) + { + return texto; + } + else if( fieldName == MarcacaoEmpresaData.REALIZADA ) + { + return realizada; + } + else if( fieldName == MarcacaoEmpresaData.EMPRESA ) + { + return empresa; + } + else if( fieldName.equals( MarcacaoEmpresaData.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacaoEmpresaData.DATA ) ) + { + return data; + } + else if( fieldName.equals( MarcacaoEmpresaData.TEXTO ) ) + { + return texto; + } + else if( fieldName.equals( MarcacaoEmpresaData.REALIZADA ) ) + { + return realizada; + } + else if( fieldName.equals( MarcacaoEmpresaData.EMPRESA ) ) + { + return empresa; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacaoEmpresaData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacaoEmpresaData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == MarcacaoEmpresaData.TEXTO ) + { + texto = ( String ) value; + } + else if( fieldName == MarcacaoEmpresaData.REALIZADA ) + { + realizada = ( String ) value; + } + else if( fieldName == MarcacaoEmpresaData.EMPRESA ) + { + empresa = ( Empresa ) value; + } + else if( fieldName.equals( MarcacaoEmpresaData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoEmpresaData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( MarcacaoEmpresaData.TEXTO ) ) + { + texto = ( String ) value; + } + else if( fieldName.equals( MarcacaoEmpresaData.REALIZADA ) ) + { + realizada = ( String ) value; + } + else if( fieldName.equals( MarcacaoEmpresaData.EMPRESA ) ) + { + empresa = ( Empresa ) value; + } + } + + public Class getOuterClass() + { + return MarcacaoEmpresaData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaData.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaData.java new file mode 100644 index 00000000..54921f1f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaData.java @@ -0,0 +1,61 @@ +/* +* MarcacaoEmpresaData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 7/Dez/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class MarcacaoEmpresaData extends Marcacao +{ + public static final String ID = "id"; + public static final String DATA = "data"; + public static final String TEXTO = "texto"; + public static final String REALIZADA = "realizada"; + public static final String EMPRESA = "empresa"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TEXTO, REALIZADA, EMPRESA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, TEXTO, REALIZADA, EMPRESA, }; + + private HashMap dataHash; + + public MarcacaoEmpresaData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacaoEmpresa.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaID.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaID.java new file mode 100644 index 00000000..8b074d13 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEmpresaID.java @@ -0,0 +1,22 @@ +/* +* MarcacaoEmpresaID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 7/Dez/2004 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.jpox.*; + +public final class MarcacaoEmpresaID extends IntegerID +{ + public MarcacaoEmpresaID() + { + } + + public MarcacaoEmpresaID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimento.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimento.java new file mode 100644 index 00000000..16f5fca4 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimento.java @@ -0,0 +1,186 @@ +/* +* MarcacaoEstabelecimento.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class MarcacaoEstabelecimento implements JDOInnerObject +{ + private Integer id; + private Date data; + private String realizada; + private Integer estado; + private Integer tecnico_hst; + private Date data_email; + private Date data_relatorio; + private Estabelecimento estabelecimento; + private String observacoes; + + public MarcacaoEstabelecimento() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacaoEstabelecimentoData.ID ) + { + return id; + } + else if( fieldName == MarcacaoEstabelecimentoData.DATA ) + { + return data; + } + else if( fieldName == MarcacaoEstabelecimentoData.REALIZADA ) + { + return realizada; + } + else if( fieldName == MarcacaoEstabelecimentoData.ESTADO ) + { + return estado; + } + else if( fieldName == MarcacaoEstabelecimentoData.TECNICO_HST ) + { + return tecnico_hst; + } + else if( fieldName == MarcacaoEstabelecimentoData.DATA_EMAIL ) + { + return data_email; + } + else if( fieldName == MarcacaoEstabelecimentoData.DATA_RELATORIO ) + { + return data_relatorio; + } + else if( fieldName == MarcacaoEstabelecimentoData.ESTABELECIMENTO ) + { + return estabelecimento; + } + else if( fieldName == MarcacaoEstabelecimentoData.OBSERVACOES ) + { + return observacoes; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA ) ) + { + return data; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.REALIZADA ) ) + { + return realizada; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.TECNICO_HST ) ) + { + return tecnico_hst; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_EMAIL ) ) + { + return data_email; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_RELATORIO ) ) + { + return data_relatorio; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTABELECIMENTO ) ) + { + return estabelecimento; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.OBSERVACOES ) ) + { + return observacoes; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacaoEstabelecimentoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.REALIZADA ) + { + realizada = ( String ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.TECNICO_HST ) + { + tecnico_hst = ( Integer ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.DATA_EMAIL ) + { + data_email = ( Date ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.DATA_RELATORIO ) + { + data_relatorio = ( Date ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.ESTABELECIMENTO ) + { + estabelecimento = ( Estabelecimento ) value; + } + else if( fieldName == MarcacaoEstabelecimentoData.OBSERVACOES ) + { + observacoes = ( String ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.REALIZADA ) ) + { + realizada = ( String ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.TECNICO_HST ) ) + { + tecnico_hst = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_EMAIL ) ) + { + data_email = ( Date ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.DATA_RELATORIO ) ) + { + data_relatorio = ( Date ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.ESTABELECIMENTO ) ) + { + estabelecimento = ( Estabelecimento ) value; + } + else if( fieldName.equals( MarcacaoEstabelecimentoData.OBSERVACOES ) ) + { + observacoes = ( String ) value; + } + } + + public Class getOuterClass() + { + return MarcacaoEstabelecimentoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoData.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoData.java new file mode 100644 index 00000000..4c8551ca --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoData.java @@ -0,0 +1,67 @@ +/* +* MarcacaoEstabelecimentoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class MarcacaoEstabelecimentoData extends Marcacao +{ + public static final String ID = "id"; + public static final String DATA = "data"; + public static final String REALIZADA = "realizada"; + public static final String ESTADO = "estado"; + public static final String TECNICO_HST = "tecnico_hst"; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String ESTABELECIMENTO = "estabelecimento"; + public static final String OBSERVACOES = "observacoes"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, REALIZADA, ESTADO, TECNICO_HST, DATA_EMAIL, DATA_RELATORIO, ESTABELECIMENTO, + OBSERVACOES, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, REALIZADA, ESTADO, TECNICO_HST, DATA_EMAIL, DATA_RELATORIO, + ESTABELECIMENTO, OBSERVACOES, }; + + private HashMap dataHash; + + public MarcacaoEstabelecimentoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacaoEstabelecimento.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoID.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoID.java new file mode 100644 index 00000000..36240581 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoEstabelecimentoID.java @@ -0,0 +1,25 @@ +/* +* MarcacaoEstabelecimentoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Feb 1, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class MarcacaoEstabelecimentoID extends IntegerID + implements Serializable +{ + public MarcacaoEstabelecimentoID() + { + } + + public MarcacaoEstabelecimentoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoListLoader.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoListLoader.java new file mode 100644 index 00000000..c966c222 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoListLoader.java @@ -0,0 +1,80 @@ +/* + * MarcacaoListLoader.java + * + * Created on 27 de Maio de 2004, 16:18 + */ + +package siprp.data; + +import javax.jdo.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.jdo.*; + +import siprp.*; +/** + * + * @author fpalma + */ +public class MarcacaoListLoader +{ +// private static PersistenceManager MANAGER = null; + private JDOProvider JDO; + + /** Creates a new instance of MarcacaoListLoader */ + public MarcacaoListLoader() + { + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public Marcacao[] load( int tipo, Integer targetID ) + throws Exception + { + Class theClass; + String filterString; + switch( tipo ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + theClass = MarcacaoTrabalhador.class; + filterString = "(trabalhador.id == " + targetID + ") && (tipo == " + tipo + ")"; + break; + + case Marcacao.TIPO_MARCACAO_ESTABELECIMENTO: + theClass = MarcacaoEstabelecimento.class; + filterString = "estabelecimento.id == " + targetID; + break; + + default: + return new Marcacao[ 0 ]; + } +// if( MANAGER == null ) +// { +// MANAGER = (PersistenceManager) Singleton.getInstance( SingletonConstants.PERSISTENCE_MANAGER ); +// } +// Transaction tx = MANAGER.currentTransaction(); + Object sessionID = null; + try + { + sessionID = JDO.begin(); + Query q = JDO.getManager().newQuery( theClass, filterString ); + q.setOrdering( Marcacao.DATA + " descending" ); + Collection c = ( Collection )q.execute(); + JDOInnerObject innerObjects[] = ( JDOInnerObject [] ) c.toArray( new JDOInnerObject[0] ); + JDO.commit( sessionID ); + Marcacao marcacoes[] = new Marcacao[ innerObjects.length ]; + for( int n = 0; n < marcacoes.length; n++ ) + { + marcacoes[ n ] = ( Marcacao ) innerObjects[ n ].getOuterClass().newInstance(); + marcacoes[ n ].setInnerObject( innerObjects[ n ] ); + } + return marcacoes; + } + catch( RuntimeException ex ) + { + JDO.rollback( sessionID ); +// Main.reconnectJDO(); + throw ex; + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoSaveAndDeleteHandler.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoSaveAndDeleteHandler.java new file mode 100644 index 00000000..c8df3dc6 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoSaveAndDeleteHandler.java @@ -0,0 +1,258 @@ +/* +* MarcacaoSaveAndDeleteHandler.java + * + * Created on 13 de Outubro de 2004, 18:31 + */ + +package siprp.data; + +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.jdo.*; + +import siprp.medicina.*; + +/** + * + * @author fpalma + */ +public class MarcacaoSaveAndDeleteHandler + implements JDOOperationHandlerInterface +{ + public static final MarcacaoSaveAndDeleteHandler INSTANCE = new MarcacaoSaveAndDeleteHandler(); + + public JDOProvider JDO; + protected MedicinaDataProvider medicinaProvider; + + /** Creates a new instance of MarcacaoSaveAndDeleteHandler */ + public MarcacaoSaveAndDeleteHandler() + { + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public boolean handle( JDOObject object, int operation, int moment ) + throws Exception + { + if( JDO == null ) + { + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + switch( operation ) + { + case JDOOperationHandlerInterface.OP_SAVE: + switch( moment ) + { + case JDOOperationHandlerInterface.MOMENT_BEFORE: + return preSave( (Marcacao) object ); + + case JDOOperationHandlerInterface.MOMENT_AFTER: + return postSave( (Marcacao) object ); + } + return false; + + case JDOOperationHandlerInterface.OP_DELETE: + switch( moment ) + { + case JDOOperationHandlerInterface.MOMENT_BEFORE: + return preDelete( (Marcacao) object ); + + case JDOOperationHandlerInterface.MOMENT_AFTER: + return postDelete( (Marcacao) object ); + } + return false; + } + return false; + } + + protected boolean preSave( Marcacao object ) + throws Exception + { + return false; + } + + protected boolean postSave( Marcacao object ) + throws Exception + { + if( object instanceof MarcacaoEmpresaData ) + { + AvisoData aviso = (AvisoData) JDO.load( AvisoData.class, + new Object[]{ object.get( MarcacaoEmpresaData.ID ), new Integer( AvisoData.TIPO_EMPRESA ) }, + new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); + if( aviso == null ) + { + aviso = new AvisoData(); + } + aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_EMPRESA ) ); + EmpresaData empresa = ( EmpresaData ) object.get( MarcacaoEmpresaData.EMPRESA ); + aviso.set( AvisoData.EMPRESA, empresa ); + aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEmpresaData.ID ) ); + Date dataEvento = (Date) object.get( Marcacao.DATA ); + aviso.set( AvisoData.DATA_EVENTO, dataEvento ); + aviso.set( AvisoData.DATA_AVISO, dataEvento ); + String descricao = "Tarefa "; + aviso.set( AvisoData.DESCRICAO, descricao ); + aviso.save(); + + empresa.save(); + } + else if( object instanceof MarcacaoEstabelecimentoData ) + { + AvisoData aviso = (AvisoData) JDO.load( AvisoData.class, + new Object[]{ object.get( MarcacaoEstabelecimentoData.ID ), new Integer( AvisoData.TIPO_ESTABELECIMENTO ) }, + new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); + if( aviso == null ) + { + aviso = new AvisoData(); + } + aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_ESTABELECIMENTO ) ); + EstabelecimentoData estabelecimento = ( EstabelecimentoData ) object.get( MarcacaoEstabelecimentoData.ESTABELECIMENTO ); + aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento ); + EmpresaData empresa = ( EmpresaData )estabelecimento.get( EstabelecimentoData.EMPRESA ); + aviso.set( AvisoData.EMPRESA, empresa ); + aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoEstabelecimentoData.ID ) ); + Date dataEvento = (Date) object.get( Marcacao.DATA ); + Date dataAviso = new Date( dataEvento.getTime() ); + Calendar cal = Calendar.getInstance(); + cal.setTime( dataAviso ); + cal.add( Calendar.DAY_OF_MONTH, -14 ); + dataAviso = cal.getTime(); + aviso.set( AvisoData.DATA_AVISO, dataAviso ); + aviso.set( AvisoData.DATA_EVENTO, dataEvento ); + String descricao = "Visita "; + aviso.set( AvisoData.DESCRICAO, descricao ); + cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + if( hoje.before( dataEvento ) ) + { + aviso.save(); + } + + estabelecimento.save(); + } + if( object instanceof MarcacaoTrabalhadorData ) + { + AvisoData aviso = (AvisoData) JDO.load( AvisoData.class, + new Object[]{ object.get( MarcacaoTrabalhadorData.ID ), new Integer( AvisoData.TIPO_TRABALHADOR ) }, + new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); + System.out.println( "AVISO LOADED: " + aviso + " id: " + ( aviso != null ? aviso.get( AvisoData.ID ) : "n/a" ) + + " MT.ID: " + object.get( MarcacaoTrabalhadorData.ID ) + + " AD.TIPO: " + new Integer( AvisoData.TIPO_TRABALHADOR ) ); + if( aviso == null ) + { + System.out.println( "novo aviso" ); + aviso = new AvisoData(); + } + aviso.set( AvisoData.TIPO, new Integer( AvisoData.TIPO_TRABALHADOR ) ); + TrabalhadorData trab = ( TrabalhadorData ) object.get( MarcacaoTrabalhadorData.TRABALHADOR ); + aviso.set( AvisoData.TRABALHADOR, trab ); + EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trab.get( TrabalhadorData.ESTABELECIMENTO ); + aviso.set( AvisoData.ESTABELECIMENTO, estabelecimento ); + EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA ); + aviso.set( AvisoData.EMPRESA, empresa ); + aviso.set( AvisoData.EVENTO_ID, object.get( MarcacaoTrabalhadorData.ID ) ); + Date dataEvento = (Date) object.get( Marcacao.DATA ); + Date dataAviso = new Date( dataEvento.getTime() ); + Calendar cal = Calendar.getInstance(); + cal.setTime( dataAviso ); + cal.add( Calendar.DAY_OF_MONTH, -14 ); + dataAviso = cal.getTime(); + aviso.set( AvisoData.DATA_AVISO, dataAviso ); + aviso.set( AvisoData.DATA_EVENTO, dataEvento.clone() ); + String descricao = ""; + switch( ( ( Integer ) object.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() ) + { + case MarcacaoTrabalhadorData.TIPO_EXAMES: + descricao = "Exames"; + break; + + case MarcacaoTrabalhadorData.TIPO_CONSULTA: + Integer motivo = ( ( Integer ) object.get( MarcacaoTrabalhadorData.MOTIVO ) ); + descricao = "Consulta " + ( motivo == null ? "" : ("(" + MedicinaDataProvider.TIPOS_CONSULTAS[ motivo.intValue() ] + ")" ) ); + break; + } + aviso.set( AvisoData.DESCRICAO, descricao ); + cal = Calendar.getInstance(); + cal.setTime( dataEvento ); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 0, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + dataEvento = cal.getTime(); + + cal = Calendar.getInstance(); + cal.set( cal.get( Calendar.YEAR ), cal.get( Calendar.MONTH ), cal.get( Calendar.DAY_OF_MONTH ), 10, 0, 0 ); + cal.set( Calendar.MILLISECOND, 0 ); + Date hoje = cal.getTime(); + if( hoje.before( dataEvento ) ) + { + if( !hoje.before( dataAviso ) ) + { + aviso.set( AvisoData.DATA_AVISO, dataEvento.clone() ); + } + aviso.save(); + } + + trab.save(); + } + else + { + return false; + } + return true; + } + + protected boolean preDelete( Marcacao object ) + throws Exception + { + if( object instanceof MarcacaoTrabalhadorData && + ( ( Integer ) object.get( MarcacaoTrabalhadorData.TIPO ) ).intValue() == MarcacaoTrabalhadorData.TIPO_EXAMES ) + { + if( medicinaProvider == null ) + { + medicinaProvider = (MedicinaDataProvider)MedicinaDataProvider.getProvider(); + } + medicinaProvider.deleteDetalhesRealizadosForMarcacao( ( Integer ) object.get( MarcacaoTrabalhadorData.ID ) ); + return true; + } + return false; + } + + protected boolean postDelete( Marcacao object ) + throws Exception + { +System.out.println( "!delete!" ); + Integer tipo; + if( object instanceof MarcacaoEmpresaData ) + { + tipo = new Integer( AvisoData.TIPO_EMPRESA ); + } + else if( object instanceof MarcacaoEstabelecimentoData ) + { + tipo = new Integer( AvisoData.TIPO_ESTABELECIMENTO ); + } + if( object instanceof MarcacaoTrabalhadorData ) + { + tipo = new Integer( AvisoData.TIPO_TRABALHADOR ); + } + else + { + return false; + } + AvisoData aviso = (AvisoData) JDO.load( AvisoData.class, + new Object[]{ object.get( "id" ), tipo }, + new String[]{ AvisoData.EVENTO_ID, AvisoData.TIPO } ); + if( aviso != null ) + { + aviso.delete(); + } + + return true; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhador.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhador.java new file mode 100644 index 00000000..a4af4d07 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhador.java @@ -0,0 +1,203 @@ +/* +* MarcacaoTrabalhador.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Jan 28, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class MarcacaoTrabalhador implements JDOInnerObject +{ + private Integer id; + private Date data; + private String realizada; + private Integer estado; + private Integer motivo; + private Date data_email; + private Date data_relatorio; + private Integer tipo; + private Trabalhador trabalhador; + private String observacoes; + + public MarcacaoTrabalhador() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MarcacaoTrabalhadorData.ID ) + { + return id; + } + else if( fieldName == MarcacaoTrabalhadorData.DATA ) + { + return data; + } + else if( fieldName == MarcacaoTrabalhadorData.REALIZADA ) + { + return realizada; + } + else if( fieldName == MarcacaoTrabalhadorData.ESTADO ) + { + return estado; + } + else if( fieldName == MarcacaoTrabalhadorData.MOTIVO ) + { + return motivo; + } + else if( fieldName == MarcacaoTrabalhadorData.DATA_EMAIL ) + { + return data_email; + } + else if( fieldName == MarcacaoTrabalhadorData.DATA_RELATORIO ) + { + return data_relatorio; + } + else if( fieldName == MarcacaoTrabalhadorData.TIPO ) + { + return tipo; + } + else if( fieldName == MarcacaoTrabalhadorData.TRABALHADOR ) + { + return trabalhador; + } + else if( fieldName == MarcacaoTrabalhadorData.OBSERVACOES ) + { + return observacoes; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.ID ) ) + { + return id; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.DATA ) ) + { + return data; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.REALIZADA ) ) + { + return realizada; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.MOTIVO ) ) + { + return motivo; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_EMAIL ) ) + { + return data_email; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_RELATORIO ) ) + { + return data_relatorio; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.TIPO ) ) + { + return tipo; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.TRABALHADOR ) ) + { + return trabalhador; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.OBSERVACOES ) ) + { + return observacoes; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MarcacaoTrabalhadorData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.REALIZADA ) + { + realizada = ( String ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.MOTIVO ) + { + motivo = ( Integer ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.DATA_EMAIL ) + { + data_email = ( Date ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.DATA_RELATORIO ) + { + data_relatorio = ( Date ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.TIPO ) + { + tipo = ( Integer ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.TRABALHADOR ) + { + trabalhador = ( Trabalhador ) value; + } + else if( fieldName == MarcacaoTrabalhadorData.OBSERVACOES ) + { + observacoes = ( String ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.REALIZADA ) ) + { + realizada = ( String ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.MOTIVO ) ) + { + motivo = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_EMAIL ) ) + { + data_email = ( Date ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.DATA_RELATORIO ) ) + { + data_relatorio = ( Date ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.TIPO ) ) + { + tipo = ( Integer ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.TRABALHADOR ) ) + { + trabalhador = ( Trabalhador ) value; + } + else if( fieldName.equals( MarcacaoTrabalhadorData.OBSERVACOES ) ) + { + observacoes = ( String ) value; + } + } + + public Class getOuterClass() + { + return MarcacaoTrabalhadorData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorConstants.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorConstants.java new file mode 100644 index 00000000..e0096a87 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorConstants.java @@ -0,0 +1,17 @@ +/* + * MarcacaoTrabalhadorConstants.java + * + * Created on 11 de Outubro de 2004, 13:18 + */ + +package siprp.data; + +/** + * + * @author fpalma + */ +public interface MarcacaoTrabalhadorConstants +{ + public static final int TIPO_EXAMES = 0; + public static final int TIPO_CONSULTA = 1; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorData.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorData.java new file mode 100644 index 00000000..67273b67 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorData.java @@ -0,0 +1,69 @@ +/* +* MarcacaoTrabalhadorData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Jan 28, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class MarcacaoTrabalhadorData extends Marcacao + implements MarcacaoTrabalhadorConstants +{ + public static final String ID = "id"; + public static final String DATA = "data"; + public static final String REALIZADA = "realizada"; + public static final String ESTADO = "estado"; + public static final String MOTIVO = "motivo"; + public static final String DATA_EMAIL = "data_email"; + public static final String DATA_RELATORIO = "data_relatorio"; + public static final String TIPO = "tipo"; + public static final String TRABALHADOR = "trabalhador"; + public static final String OBSERVACOES = "observacoes"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, REALIZADA, ESTADO, MOTIVO, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR, + OBSERVACOES, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, REALIZADA, ESTADO, MOTIVO, DATA_EMAIL, DATA_RELATORIO, TIPO, TRABALHADOR, + OBSERVACOES, }; + + private HashMap dataHash; + + public MarcacaoTrabalhadorData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return MarcacaoTrabalhador.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorID.java b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorID.java new file mode 100644 index 00000000..7dc15955 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MarcacaoTrabalhadorID.java @@ -0,0 +1,25 @@ +/* +* MarcacaoTrabalhadorID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Jan 28, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class MarcacaoTrabalhadorID extends IntegerID + implements Serializable +{ + public MarcacaoTrabalhadorID() + { + } + + public MarcacaoTrabalhadorID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Medico.java b/tags/teg/SIPRPSoft/src/siprp/data/Medico.java new file mode 100644 index 00000000..a9c4785e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Medico.java @@ -0,0 +1,100 @@ +/* +* Medico.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Jan/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.*; + +public final class Medico implements JDOInnerObject +{ + private Integer id; + private String nome; + private String numero_cedula; + private String inactivo; + + public Medico() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == MedicoData.ID ) + { + return id; + } + else if( fieldName == MedicoData.NOME ) + { + return nome; + } + else if( fieldName == MedicoData.NUMERO_CEDULA ) + { + return numero_cedula; + } + else if( fieldName == MedicoData.INACTIVO ) + { + return inactivo; + } + else if( fieldName.equals( MedicoData.ID ) ) + { + return id; + } + else if( fieldName.equals( MedicoData.NOME ) ) + { + return nome; + } + else if( fieldName.equals( MedicoData.NUMERO_CEDULA ) ) + { + return numero_cedula; + } + else if( fieldName.equals( MedicoData.INACTIVO ) ) + { + return inactivo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == MedicoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == MedicoData.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == MedicoData.NUMERO_CEDULA ) + { + numero_cedula = ( String ) value; + } + else if( fieldName == MedicoData.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( MedicoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( MedicoData.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( MedicoData.NUMERO_CEDULA ) ) + { + numero_cedula = ( String ) value; + } + else if( fieldName.equals( MedicoData.INACTIVO ) ) + { + inactivo = ( String ) value; + } + } + + public Class getOuterClass() + { + return MedicoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MedicoData.java b/tags/teg/SIPRPSoft/src/siprp/data/MedicoData.java new file mode 100644 index 00000000..6e385ce8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MedicoData.java @@ -0,0 +1,61 @@ +/* +* MedicoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 27/Jan/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class MedicoData extends JDOObject + implements DisableDeleteable +{ + public static final String ID = "id"; + public static final String NOME = "nome"; + public static final String NUMERO_CEDULA = "numero_cedula"; + public static final String INACTIVO = "inactivo"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NUMERO_CEDULA, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NUMERO_CEDULA, INACTIVO, }; + + private HashMap dataHash; + + public MedicoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Medico.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/MedicoID.java b/tags/teg/SIPRPSoft/src/siprp/data/MedicoID.java new file mode 100644 index 00000000..8c13efb7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/MedicoID.java @@ -0,0 +1,22 @@ +/* +* MedicoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 27/Jan/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.jpox.*; + +public final class MedicoID extends IntegerID +{ + public MedicoID() + { + } + + public MedicoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/SearchExecuterFactory.java b/tags/teg/SIPRPSoft/src/siprp/data/SearchExecuterFactory.java new file mode 100644 index 00000000..e011144d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/SearchExecuterFactory.java @@ -0,0 +1,180 @@ +/* + * SearchExecuterFactory.java + * + * Created on 24 de Maio de 2004, 19:30 + */ + +package siprp.data; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.ui.search.*; + +/** + * + * @author fpalma + */ +public class SearchExecuterFactory +{ + private static SearchExecuter empresaExecuter; + private static SearchExecuter estabelecimentoExecuter; + private static SearchExecuter trabalhadorExecuter; + + + + /** Creates a new instance of SearchExecuterFactory */ + private SearchExecuterFactory() + { + } + + public static SearchExecuter getSearchExecuter( Class objectClass ) + { + if( objectClass.equals( EmpresaData.class ) ) + { +System.out.println( "Empresa" ); + return getEmpresaSearchExecuter(); + } + else if( objectClass == EstabelecimentoData.class ) + { + return getEstabelecimentoSearchExecuter(); + } + else if( objectClass == TrabalhadorData.class ) + { + return getTrabalhadorSearchExecuter(); + } + return null; + } + + private static SearchExecuter getEmpresaSearchExecuter() + { + if( empresaExecuter == null ) + { + empresaExecuter = new SearchExecuter(){ + + private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + + public Virtual2DArray search( String pattern ) + throws Exception + { + + Executer executer = dbm.getSharedExecuter( this ); + Select select = new Select( new String[]{ "empresas" }, + new String[]{ EmpresaData.ID, EmpresaData.DESIGNACAO_SOCIAL, EmpresaData.DESIGNACAO_SOCIAL_PLAIN }, + new Field( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ).and( + new Field( EmpresaData.INACTIVO ).isDifferent( "y" ) ), + new String[]{ EmpresaData.DESIGNACAO_SOCIAL_PLAIN }, null ); +System.out.println( "SELECT : " + select ); + return executer.executeQuery( select ); + } + + public boolean hasDetails() + { + return false; + } + + public void showDetails( SearchDialog dialog, Object o ) + throws Exception + { + } + + public String getSearchTitle() + { + return "Procurar Empresa"; + } + + public String[] getColumnNames() + { + return new String[]{ "Designa\u00e7\u00e3o Social" }; + } + }; + } + return empresaExecuter; + } + + private static SearchExecuter getEstabelecimentoSearchExecuter() + { + if( estabelecimentoExecuter == null ) + { + estabelecimentoExecuter = new SearchExecuter(){ + private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + + public Virtual2DArray search( String pattern ) + throws Exception + { + Executer executer = dbm.getSharedExecuter( this ); + Select select = new Select( new String[]{ "estabelecimentos" }, + new String[]{ EstabelecimentoData.ID, EstabelecimentoData.NOME, EstabelecimentoData.NOME_PLAIN }, + new Field( EstabelecimentoData.NOME_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ), + new String[]{ EstabelecimentoData.NOME_PLAIN }, null ); + return executer.executeQuery( select ); + } + + public boolean hasDetails() + { + return false; + } + + public void showDetails( SearchDialog dialog, Object o ) + throws Exception + { + } + + public String getSearchTitle() + { + return "Procurar Estabelecimento"; + } + + public String[] getColumnNames() + { + return new String[]{ "Designa\u00e7\u00e3o" }; + } + }; + } + return estabelecimentoExecuter; + } + + + private static SearchExecuter getTrabalhadorSearchExecuter() + { + if( trabalhadorExecuter == null ) + { + trabalhadorExecuter = new SearchExecuter(){ + private final DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + + public Virtual2DArray search( String pattern ) + throws Exception + { + Executer executer = dbm.getSharedExecuter( this ); + Select select = new Select( new String[]{ "trabalhadores" }, + new String[]{ TrabalhadorData.ID, TrabalhadorData.NOME, TrabalhadorData.NOME_PLAIN }, + new Field( TrabalhadorData.NOME_PLAIN ).isLike( "%" + com.evolute.utils.strings.StringPlainer.convertString( pattern, false, false ) + "%" ), + new String[]{ TrabalhadorData.NOME_PLAIN }, null ); + return executer.executeQuery( select ); + } + + public boolean hasDetails() + { + return false; + } + + public void showDetails( SearchDialog dialog, Object o ) + throws Exception + { + } + + public String getSearchTitle() + { + return "Procurar Trablhador"; + } + + public String[] getColumnNames() + { + return new String[]{ "Nome" }; + } + }; + } + return trabalhadorExecuter; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHST.java b/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHST.java new file mode 100644 index 00000000..352d6096 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHST.java @@ -0,0 +1,134 @@ +/* +* TecnicoHST.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import com.evolute.utils.jdo.*; + +public final class TecnicoHST implements JDOInnerObject +{ + private Integer id; + private String nome; + private String nome_plain; + private String iniciais; + private Integer identificador; + private String inactivo; + + public TecnicoHST() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TecnicoHSTData.ID ) + { + return id; + } + else if( fieldName == TecnicoHSTData.NOME ) + { + return nome; + } + else if( fieldName == TecnicoHSTData.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == TecnicoHSTData.INICIAIS ) + { + return iniciais; + } + else if( fieldName == TecnicoHSTData.IDENTIFICADOR ) + { + return identificador; + } + else if( fieldName == TecnicoHSTData.INACTIVO ) + { + return inactivo; + } + else if( fieldName.equals( TecnicoHSTData.ID ) ) + { + return id; + } + else if( fieldName.equals( TecnicoHSTData.NOME ) ) + { + return nome; + } + else if( fieldName.equals( TecnicoHSTData.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( TecnicoHSTData.INICIAIS ) ) + { + return iniciais; + } + else if( fieldName.equals( TecnicoHSTData.IDENTIFICADOR ) ) + { + return identificador; + } + else if( fieldName.equals( TecnicoHSTData.INACTIVO ) ) + { + return inactivo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TecnicoHSTData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TecnicoHSTData.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == TecnicoHSTData.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == TecnicoHSTData.INICIAIS ) + { + iniciais = ( String ) value; + } + else if( fieldName == TecnicoHSTData.IDENTIFICADOR ) + { + identificador = ( Integer ) value; + } + else if( fieldName == TecnicoHSTData.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( TecnicoHSTData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TecnicoHSTData.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( TecnicoHSTData.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( TecnicoHSTData.INICIAIS ) ) + { + iniciais = ( String ) value; + } + else if( fieldName.equals( TecnicoHSTData.IDENTIFICADOR ) ) + { + identificador = ( Integer ) value; + } + else if( fieldName.equals( TecnicoHSTData.INACTIVO ) ) + { + inactivo = ( String ) value; + } + } + + public Class getOuterClass() + { + return TecnicoHSTData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTData.java b/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTData.java new file mode 100644 index 00000000..1d70e935 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTData.java @@ -0,0 +1,63 @@ +/* +* TecnicoHSTData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 1, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TecnicoHSTData extends JDOObject + implements DisableDeleteable +{ + public static final String ID = "id"; + public static final String NOME = "nome"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String INICIAIS = "iniciais"; + public static final String IDENTIFICADOR = "identificador"; + public static final String INACTIVO = "inactivo"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, INICIAIS, IDENTIFICADOR, INACTIVO, }; + + private HashMap dataHash; + + public TecnicoHSTData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TecnicoHST.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTID.java b/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTID.java new file mode 100644 index 00000000..f7f90bd4 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/TecnicoHSTID.java @@ -0,0 +1,25 @@ +/* +* TecnicoHSTID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Feb 1, 2006 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TecnicoHSTID extends IntegerID + implements Serializable +{ + public TecnicoHSTID() + { + } + + public TecnicoHSTID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/Trabalhador.java b/tags/teg/SIPRPSoft/src/siprp/data/Trabalhador.java new file mode 100644 index 00000000..e7da2172 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/Trabalhador.java @@ -0,0 +1,356 @@ +/* +* Trabalhador.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class Trabalhador implements JDOInnerObject +{ + private Integer id; + private String nome; + private String nome_plain; + private String sexo; + private Date data_nascimento; + private String nacionalidade; + private String numero_mecanografico; + private Date data_admissao; + private String categoria; + private String local_trabalho; + private String funcao_proposta; + private Date data_admissao_funcao; + private String observacoes; + private Estabelecimento estabelecimento; + private Date data_demissao; + private String observacoes_gestao; + private Integer perfil; + private String inactivo; + private Date actualizacao; + + public Trabalhador() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadorData.ID ) + { + return id; + } + else if( fieldName == TrabalhadorData.NOME ) + { + return nome; + } + else if( fieldName == TrabalhadorData.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == TrabalhadorData.SEXO ) + { + return sexo; + } + else if( fieldName == TrabalhadorData.DATA_NASCIMENTO ) + { + return data_nascimento; + } + else if( fieldName == TrabalhadorData.NACIONALIDADE ) + { + return nacionalidade; + } + else if( fieldName == TrabalhadorData.NUMERO_MECANOGRAFICO ) + { + return numero_mecanografico; + } + else if( fieldName == TrabalhadorData.DATA_ADMISSAO ) + { + return data_admissao; + } + else if( fieldName == TrabalhadorData.CATEGORIA ) + { + return categoria; + } + else if( fieldName == TrabalhadorData.LOCAL_TRABALHO ) + { + return local_trabalho; + } + else if( fieldName == TrabalhadorData.FUNCAO_PROPOSTA ) + { + return funcao_proposta; + } + else if( fieldName == TrabalhadorData.DATA_ADMISSAO_FUNCAO ) + { + return data_admissao_funcao; + } + else if( fieldName == TrabalhadorData.OBSERVACOES ) + { + return observacoes; + } + else if( fieldName == TrabalhadorData.ESTABELECIMENTO ) + { + return estabelecimento; + } + else if( fieldName == TrabalhadorData.DATA_DEMISSAO ) + { + return data_demissao; + } + else if( fieldName == TrabalhadorData.OBSERVACOES_GESTAO ) + { + return observacoes_gestao; + } + else if( fieldName == TrabalhadorData.PERFIL ) + { + return perfil; + } + else if( fieldName == TrabalhadorData.INACTIVO ) + { + return inactivo; + } + else if( fieldName == TrabalhadorData.ACTUALIZACAO ) + { + return actualizacao; + } + else if( fieldName.equals( TrabalhadorData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadorData.NOME ) ) + { + return nome; + } + else if( fieldName.equals( TrabalhadorData.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( TrabalhadorData.SEXO ) ) + { + return sexo; + } + else if( fieldName.equals( TrabalhadorData.DATA_NASCIMENTO ) ) + { + return data_nascimento; + } + else if( fieldName.equals( TrabalhadorData.NACIONALIDADE ) ) + { + return nacionalidade; + } + else if( fieldName.equals( TrabalhadorData.NUMERO_MECANOGRAFICO ) ) + { + return numero_mecanografico; + } + else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO ) ) + { + return data_admissao; + } + else if( fieldName.equals( TrabalhadorData.CATEGORIA ) ) + { + return categoria; + } + else if( fieldName.equals( TrabalhadorData.LOCAL_TRABALHO ) ) + { + return local_trabalho; + } + else if( fieldName.equals( TrabalhadorData.FUNCAO_PROPOSTA ) ) + { + return funcao_proposta; + } + else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO_FUNCAO ) ) + { + return data_admissao_funcao; + } + else if( fieldName.equals( TrabalhadorData.OBSERVACOES ) ) + { + return observacoes; + } + else if( fieldName.equals( TrabalhadorData.ESTABELECIMENTO ) ) + { + return estabelecimento; + } + else if( fieldName.equals( TrabalhadorData.DATA_DEMISSAO ) ) + { + return data_demissao; + } + else if( fieldName.equals( TrabalhadorData.OBSERVACOES_GESTAO ) ) + { + return observacoes_gestao; + } + else if( fieldName.equals( TrabalhadorData.PERFIL ) ) + { + return perfil; + } + else if( fieldName.equals( TrabalhadorData.INACTIVO ) ) + { + return inactivo; + } + else if( fieldName.equals( TrabalhadorData.ACTUALIZACAO ) ) + { + return actualizacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadorData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadorData.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == TrabalhadorData.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == TrabalhadorData.SEXO ) + { + sexo = ( String ) value; + } + else if( fieldName == TrabalhadorData.DATA_NASCIMENTO ) + { + data_nascimento = ( Date ) value; + } + else if( fieldName == TrabalhadorData.NACIONALIDADE ) + { + nacionalidade = ( String ) value; + } + else if( fieldName == TrabalhadorData.NUMERO_MECANOGRAFICO ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName == TrabalhadorData.DATA_ADMISSAO ) + { + data_admissao = ( Date ) value; + } + else if( fieldName == TrabalhadorData.CATEGORIA ) + { + categoria = ( String ) value; + } + else if( fieldName == TrabalhadorData.LOCAL_TRABALHO ) + { + local_trabalho = ( String ) value; + } + else if( fieldName == TrabalhadorData.FUNCAO_PROPOSTA ) + { + funcao_proposta = ( String ) value; + } + else if( fieldName == TrabalhadorData.DATA_ADMISSAO_FUNCAO ) + { + data_admissao_funcao = ( Date ) value; + } + else if( fieldName == TrabalhadorData.OBSERVACOES ) + { + observacoes = ( String ) value; + } + else if( fieldName == TrabalhadorData.ESTABELECIMENTO ) + { + estabelecimento = ( Estabelecimento ) value; + } + else if( fieldName == TrabalhadorData.DATA_DEMISSAO ) + { + data_demissao = ( Date ) value; + } + else if( fieldName == TrabalhadorData.OBSERVACOES_GESTAO ) + { + observacoes_gestao = ( String ) value; + } + else if( fieldName == TrabalhadorData.PERFIL ) + { + perfil = ( Integer ) value; + } + else if( fieldName == TrabalhadorData.INACTIVO ) + { + inactivo = ( String ) value; + } + else if( fieldName == TrabalhadorData.ACTUALIZACAO ) + { + actualizacao = ( Date ) value; + } + else if( fieldName.equals( TrabalhadorData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadorData.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.SEXO ) ) + { + sexo = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.DATA_NASCIMENTO ) ) + { + data_nascimento = ( Date ) value; + } + else if( fieldName.equals( TrabalhadorData.NACIONALIDADE ) ) + { + nacionalidade = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.NUMERO_MECANOGRAFICO ) ) + { + numero_mecanografico = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO ) ) + { + data_admissao = ( Date ) value; + } + else if( fieldName.equals( TrabalhadorData.CATEGORIA ) ) + { + categoria = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.LOCAL_TRABALHO ) ) + { + local_trabalho = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.FUNCAO_PROPOSTA ) ) + { + funcao_proposta = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.DATA_ADMISSAO_FUNCAO ) ) + { + data_admissao_funcao = ( Date ) value; + } + else if( fieldName.equals( TrabalhadorData.OBSERVACOES ) ) + { + observacoes = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.ESTABELECIMENTO ) ) + { + estabelecimento = ( Estabelecimento ) value; + } + else if( fieldName.equals( TrabalhadorData.DATA_DEMISSAO ) ) + { + data_demissao = ( Date ) value; + } + else if( fieldName.equals( TrabalhadorData.OBSERVACOES_GESTAO ) ) + { + observacoes_gestao = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.PERFIL ) ) + { + perfil = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadorData.INACTIVO ) ) + { + inactivo = ( String ) value; + } + else if( fieldName.equals( TrabalhadorData.ACTUALIZACAO ) ) + { + actualizacao = ( Date ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadorData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorData.java b/tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorData.java new file mode 100644 index 00000000..396b512f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorData.java @@ -0,0 +1,82 @@ +/* +* TrabalhadorData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on 24/Nov/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadorData extends JDOObject + implements DisableDeleteable, ActualizacaoSaveable +{ + public static final String ID = "id"; + public static final String NOME = "nome"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String SEXO = "sexo"; + public static final String DATA_NASCIMENTO = "data_nascimento"; + public static final String NACIONALIDADE = "nacionalidade"; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String DATA_ADMISSAO = "data_admissao"; + public static final String CATEGORIA = "categoria"; + public static final String LOCAL_TRABALHO = "local_trabalho"; + public static final String FUNCAO_PROPOSTA = "funcao_proposta"; + public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao"; + public static final String OBSERVACOES = "observacoes"; + public static final String ESTABELECIMENTO = "estabelecimento"; + public static final String DATA_DEMISSAO = "data_demissao"; + public static final String OBSERVACOES_GESTAO = "observacoes_gestao"; + public static final String PERFIL = "perfil"; + public static final String INACTIVO = "inactivo"; + public static final String ACTUALIZACAO = "actualizacao"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO, + DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA, + DATA_ADMISSAO_FUNCAO, OBSERVACOES, ESTABELECIMENTO, DATA_DEMISSAO, + OBSERVACOES_GESTAO, PERFIL, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, SEXO, DATA_NASCIMENTO, NACIONALIDADE, NUMERO_MECANOGRAFICO, + DATA_ADMISSAO, CATEGORIA, LOCAL_TRABALHO, FUNCAO_PROPOSTA, + DATA_ADMISSAO_FUNCAO, OBSERVACOES, ESTABELECIMENTO, DATA_DEMISSAO, + OBSERVACOES_GESTAO, PERFIL, INACTIVO, ACTUALIZACAO, }; + + private HashMap dataHash; + + public TrabalhadorData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Trabalhador.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorID.java b/tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorID.java new file mode 100644 index 00000000..6f37784d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/TrabalhadorID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadorID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on 24/Nov/2005 +* +* Use but DON'T TOUCH +*/ +package siprp.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadorID extends IntegerID + implements Serializable +{ + public TrabalhadorID() + { + } + + public TrabalhadorID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/data/package.jdo b/tags/teg/SIPRPSoft/src/siprp/data/package.jdo new file mode 100644 index 00000000..6911c812 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/data/package.jdo @@ -0,0 +1,1122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaDataProvider.java new file mode 100644 index 00000000..935afc49 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaDataProvider.java @@ -0,0 +1,777 @@ +/* + * EstatisticaDataProvider.java + * + * Created on 16 de Dezembro de 2004, 12:50 + */ + +package siprp.estatistica; + +import java.text.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.db.keyretrievers.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.sql.expression.*; + +import siprp.data.*; +/** + * + * @author fpalma + */ +public class EstatisticaDataProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static EstatisticaDataProvider instance = null; + private final Executer executer; + + public static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT ); + + /** Creates a new instance of EstatisticaDataProvider */ + public EstatisticaDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new EstatisticaDataProvider(); + } + } + return instance; + } + + public String[][] getMarcacoesPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + String [][]result = null; + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ MarcacaoTrabalhadorData.DATA, + "trabalhador_id", + MarcacaoTrabalhadorData.REALIZADA, + MarcacaoTrabalhadorData.TIPO }, + new Field( "data" ).isGreaterOrEqual( dataInicio ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "data" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + result = new String[ array.columnLength() ][ 5 ]; + for( int n = 0; n < result.length; n++ ) + { + Date data = ( Date ) array.get( n, 0 ); + int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue(); + boolean realizada = "y".equals( array.get( n, 2 ) ); + int tipo = ( ( Number ) array.get( n, 3 ) ).intValue(); + String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID ); + result[ n ][ 0 ] = nomeEstabEmp[ 2 ]; + result[ n ][ 1 ] = nomeEstabEmp[ 0 ]; + result[ n ][ 2 ] = nomeEstabEmp[ 1 ]; + result[ n ][ 3 ] = DF.format( data ); + result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" ); + + } + return result; + } + + public String[] getNomeEstabelecimentoEmpresaForTrabalhador( int trabalhadorID ) + throws Exception + { + String data[] = new String[ 3 ]; + Select select = + new Select( new String[]{ "trabalhadores", "estabelecimentos", "empresas"}, + new String[]{ "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social" }, + new Field( "trabalhadores.id" ).isEqual( new Integer( trabalhadorID ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 1 ) + { + data[ 0 ] = ( String ) array.get( 0, 0 ); + data[ 1 ] = ( String ) array.get( 0, 1 ); + data[ 2 ] = ( String ) array.get( 0, 2 ); + } + return data; + } + + public int countExamesPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "count(*)" }, + new Field( "data" ).isGreaterOrEqual( dataInicio ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countConsultasPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "count(*)" }, + new Field( "data" ).isGreaterOrEqual( dataInicio ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countExamesPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public String[][] getMarcacoesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID ) + throws Exception + { + String [][]result = null; + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ MarcacaoTrabalhadorData.DATA, + "trabalhador_id", + MarcacaoTrabalhadorData.REALIZADA, + MarcacaoTrabalhadorData.TIPO }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "data" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + result = new String[ array.columnLength() ][ 5 ]; + for( int n = 0; n < result.length; n++ ) + { + Date data = ( Date ) array.get( n, 0 ); + int trabalhadorID = ( ( Number ) array.get( n, 1 ) ).intValue(); + boolean realizada = "y".equals( array.get( n, 2 ) ); + int tipo = ( ( Number ) array.get( n, 3 ) ).intValue(); + String nomeEstabEmp[] = getNomeEstabelecimentoEmpresaForTrabalhador( trabalhadorID ); + result[ n ][ 0 ] = nomeEstabEmp[ 2 ]; + result[ n ][ 1 ] = nomeEstabEmp[ 0 ]; + result[ n ][ 2 ] = nomeEstabEmp[ 1 ]; + result[ n ][ 3 ] = DF.format( data ); + result[ n ][ 4 ] = ( tipo == Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ? "(Exame)" : "(Consulta)" ); + + } + return result; + } + + public int countExamesPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public int countConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "count(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + public String[][] getTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { +// Select subSelect = +// new Select( new String[]{ "marcacoes_trabalhador" }, +// new String[]{ "trabalhador_id" }, +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ) ); + Select select = + new Select( new String[]{ "empresas", "estabelecimentos", + "trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON " + + "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = " + + (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ).or( + new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 3 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 3; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + + + public int countTrabalhadoresSemExamesOuConsultas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" }, + new Field( "inactivo" ).isDifferent( "y" ) ); + int totalCount = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + totalCount = n.intValue(); + } + } + +// select = +// new Select( new String[]{ "marcacoes_trabalhador" }, +// new String[]{ "COUNT(*)" }, +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); +// int subCount = 0; +// array = executer.executeQuery( select ); +// if( array.columnLength() > 0 && array.rowLength() > 0 ) +// { +// Number n = (Number) array.get( 0, 0 ); +// if( n != null ) +// { +// subCount = n.intValue(); +// } +// } + + return totalCount - countTrabalhadoresComExamesOuConsultasPeriodo( dataInicio, dataFim, exames ); + } + + public String[][] getTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "trabalhador_id" }, + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ).and( + new Field( "realizada" ).isEqual( "y" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + if( ids.length == 0 ) + { + ids = new Integer[]{ new Integer( -1 ) }; + } + select = + new Select( new String[]{ "estabelecimentos", + "trabalhadores" }, + new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, + new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.id" ).notIn( ids ) ), + new String[]{ "trabalhadores.nome" }, null ); +// Select select = +// new Select( new String[]{ "estabelecimentos", +// "trabalhadores LEFT OUTER JOIN marcacoes_trabalhador ON " +// + "( trabalhadores.id = marcacoes_trabalhador.trabalhador_id AND marcacoes_trabalhador.tipo = " +// + (exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA) + " AND marcacoes_trabalhador.realizada = 'y' )" }, +// new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, +// new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( +// new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( null ).or( +// new Field( "marcacoes_trabalhador.realizada" ).isDifferent( "y" ) ) ).and( +// new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( +// new Field( "data" ).isLessOrEqual( dataFim ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ), +// new String[]{ "trabalhadores.nome" }, null ); + array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 2 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 2; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + public Object[][] getCountTrabalhadoresSemExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = new Object[ array.columnLength() ][ 3 ]; + for( int n = 0; n < data.length; n++ ) + { + data[ n ][ 0 ] = array.get( n, 1 ); + Integer empresaID = (Integer)array.get( n, 0 ); + data[ n ][ 1 ] = new Integer( countTrabalhadoresSemExamesOuConsultasEmpresa( empresaID, dataInicio, dataFim, exames ) ); + data[ n ][ 2 ] = empresaID; + } + return data; + } + + public int countTrabalhadoresSemExamesOuConsultasEmpresa( Integer empresaID, Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores", "estabelecimentos" }, new String[]{ "COUNT(*)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + int totalCount = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + totalCount = n.intValue(); + } + } + +// select = +// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, +// new String[]{ "COUNT(*)" }, +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( +// new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); +// int subCount = 0; +// array = executer.executeQuery( select ); +// if( array.columnLength() > 0 && array.rowLength() > 0 ) +// { +// Number n = (Number) array.get( 0, 0 ); +// if( n != null ) +// { +// subCount = n.intValue(); +// } +// } + return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames ); + } + + public int countTrabalhadoresSemExamesOuConsultasEstabelecimento( Integer estabelecimentoID, Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, new String[]{ "COUNT(*)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + int totalCount = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + totalCount = n.intValue(); + } + } + +// select = +// new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, +// new String[]{ "COUNT(*)" }, +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( +// new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ).and( +// new Field( "realizada" ).isEqual( "y" ) ).and( +// new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); +// int subCount = 0; +// array = executer.executeQuery( select ); +// if( array.columnLength() > 0 && array.rowLength() > 0 ) +// { +// Number n = (Number) array.get( 0, 0 ); +// if( n != null ) +// { +// subCount = n.intValue(); +// } +// } + return totalCount - countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( dataInicio, dataFim, estabelecimentoID, exames ); + } + + public String[][]getTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas", "estabelecimentos", + "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 3 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 3; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + public int countTrabalhadoresComExamesOuConsultasPeriodo( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "COUNT(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ) ); + int count = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + count = n.intValue(); + } + } + return count; + } + + public String[][]getTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos", + "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, + new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "marcacoes_trabalhador.realizada" ).isEqual( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ), + new String[]{ "estabelecimentos.nome", "trabalhadores.nome" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 2 ]; + for( int r = 0; r < array.columnLength(); r++ ) + { + for( int c = 0; c < 2; c++ ) + { + data[ r ][ c ] = (String) array.get( r, c ); + } + } + return data; + } + + public Object[][] getCountTrabalhadoresComExamesOuConsultasPeriodoForAllEmpresas( Date dataInicio, Date dataFim, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = new Object[ array.columnLength() ][ 3 ]; + for( int n = 0; n < data.length; n++ ) + { + data[ n ][ 0 ] = array.get( n, 1 ); + Integer empresaID = (Integer)array.get( n, 0 ); + data[ n ][ 1 ] = new Integer( countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( dataInicio, dataFim, empresaID, exames ) ); + data[ n ][ 2 ] = empresaID; + } + return data; + } + + public int countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( Date dataInicio, Date dataFim, Integer empresaID, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, + new String[]{ "COUNT(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ).and( + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ) ); + int count = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + count = n.intValue(); + } + } + return count; + } + + public int countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( Date dataInicio, Date dataFim, Integer estabelecimentoID, boolean exames ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new String[]{ "COUNT(*)" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "tipo" ).isEqual( new Integer( exames ? Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES : Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "realizada" ).isEqual( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ).and( + new Field( "data" ).isGreaterOrEqual( dataInicio ) ).and( + new Field( "data" ).isLessOrEqual( dataFim ) ) ); + int count = 0; + Virtual2DArray array = executer.executeQuery( select ); + if( array.columnLength() > 0 && array.rowLength() > 0 ) + { + Number n = (Number) array.get( 0, 0 ); + if( n != null ) + { + count = n.intValue(); + } + } + return count; + } + + public String [][]getDadosTrabalhadoresPeriodo( Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "empresas", "estabelecimentos", "trabalhadores" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "trabalhadores.nome", "trabalhadores.id", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain", "trabalhadores.nome_plain" }, null ); + + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 7 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + data[ n ][ 0 ] = ( String ) array.get( n, 0 ); + data[ n ][ 1 ] = ( String ) array.get( n, 1 ); + data[ n ][ 2 ] = ( String ) array.get( n, 2 ); + Integer id = new Integer( ( (Number) array.get( n, 3 ) ).intValue() ); + Select exameSelect = + new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "data", "realizada" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.id" ).isEqual( id ) ).and( + new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray exameArray = executer.executeQuery( exameSelect ); + if( exameArray.columnLength() > 0 ) + { + Date dataExame = ( Date ) exameArray.get( 0, 0 ); + String estado = ( String ) exameArray.get( 0, 1 ); + data[ n ][ 3 ] = DF.format( dataExame ); + data[ n ][ 4 ] = "y".equals( estado ) ? "Realizado" : "Faltou"; + } + else + { + data[ n ][ 3 ] = "--"; + data[ n ][ 4 ] = "--"; + } + + Select consultaSelect = + new Select( new String[]{ "trabalhadores", "marcacoes_trabalhador" }, + new String[]{ "data", "realizada" }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.id" ).isEqual( id ) ).and( + new Field( "marcacoes_trabalhador.data" ).isLessOrEqual( dataFim ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray consultaArray = executer.executeQuery( consultaSelect ); + if( consultaArray.columnLength() > 0 ) + { + Date dataConsulta = ( Date ) consultaArray.get( 0, 0 ); + String estado = ( String ) consultaArray.get( 0, 1 ); + data[ n ][ 5 ] = DF.format( dataConsulta ); + data[ n ][ 6 ] = "y".equals( estado ) ? "Realizada" : "Faltou"; + } + else + { + data[ n ][ 5 ] = "--"; + data[ n ][ 6 ] = "--"; + } + } + return data; + } + + public String[][]getDadosHigieneSeguranca() + throws Exception + { + Select select = + new Select( new String[]{ "empresas", "estabelecimentos" }, + new String[]{ "empresas.designacao_social", "estabelecimentos.nome", "estabelecimentos.id", + "empresas.designacao_social_plain", "estabelecimentos.nome_plain" }, + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ).and( + new Field( "empresas.inactivo" ).isDifferent( "y" ) ).and( + new Field( "estabelecimentos.inactivo" ).isDifferent( "y" ) ), + new String[]{ "empresas.designacao_social_plain", "estabelecimentos.nome_plain" }, null ); + + Virtual2DArray array = executer.executeQuery( select ); + String data[][] = new String[ array.columnLength() ][ 6 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + data[ n ][ 0 ] = ( String ) array.get( n, 0 ); + data[ n ][ 1 ] = ( String ) array.get( n, 1 ); + Integer id = new Integer( ( (Number) array.get( n, 2 ) ).intValue() ); + Select ultimaSelect = + new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "data", "realizada", "data_relatorio" }, + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and( + new Field( "marcacoes_estabelecimento.data" ).isLessOrEqual( new Date() ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray ultimaArray = executer.executeQuery( ultimaSelect ); + if( ultimaArray.columnLength() > 0 ) + { + Date dataAud = ( Date ) ultimaArray.get( 0, 0 ); + String estado = ( String ) ultimaArray.get( 0, 1 ); + Date dataRel = ( Date ) ultimaArray.get( 0, 2 ); + data[ n ][ 2 ] = DF.format( dataAud ); + data[ n ][ 3 ] = "y".equals( estado ) ? "Realizada" : "Não Realizada"; + data[ n ][ 4 ] = dataRel != null ? DF.format( dataRel ) : "--"; + } + else + { + data[ n ][ 2 ] = "--"; + data[ n ][ 3 ] = "--"; + data[ n ][ 4 ] = "--"; + } + + Select proximaSelect = + new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "data" }, + new Field( "marcacoes_estabelecimento.estabelecimento_id" ).isEqual( id ).and( + new Field( "marcacoes_estabelecimento.data" ).isGreaterOrEqual( new Date() ) ), + new String[]{ "data desc" }, null ); + Virtual2DArray proximaArray = executer.executeQuery( proximaSelect ); + if( proximaArray.columnLength() > 0 ) + { + Date dataProx = ( Date ) proximaArray.get( 0, 0 ); + data[ n ][ 5 ] = DF.format( dataProx ); + } + else + { + data[ n ][ 5 ] = "--"; + } + } + return data; + } + + + +} + diff --git a/tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaWindow.java b/tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaWindow.java new file mode 100644 index 00000000..eb4fed2f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/estatistica/EstatisticaWindow.java @@ -0,0 +1,1324 @@ +/* + * EstatisticaWindow.java + * + * Created on 16 de Dezembro de 2004, 13:50 + */ + +package siprp.estatistica; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import javax.swing.*; +import javax.swing.event.*; +import java.text.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.tracker.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.text.*; + +import siprp.data.*; +import siprp.pesquisas.*; +/** + * + * @author fpalma + */ +public class EstatisticaWindow extends JFrame + implements TrackableWindow, ListSelectionListener, ActionListener, ItemListener +{ + public static final DateFormat DF = DateFormat.getDateInstance( DateFormat.SHORT ); + + public static final int NONE = 0; + public static final int LISTAGEM_GERAL_MARCACOES_PERIODO = 1; + public static final int LISTAGEM_MARCACOES_PERIODO_EMPRESA_ESTABELECIMENTO = 2; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_SEM_EXAMES = 3; + public static final int LISTAGEM_TRABALHADORES_SEM_EXAMES_EMPRESA_ESTABELECIMENTO = 4; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_COM_EXAMES_PERIODO = 5; + public static final int LISTAGEM_TRABALHADORES_COM_EXAMES_PERIODO_EMPRESA_ESTABELECIMENTO = 6; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_SEM_CONSULTA = 7; + public static final int LISTAGEM_TRABALHADORES_SEM_CONSULTA_EMPRESA_ESTABELECIMENTO = 8; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_COM_CONSULTA_PERIODO = 9; + public static final int LISTAGEM_TRABALHADORES_COM_CONSULTA_PERIODO_EMPRESA_ESTABELECIMENTO = 10; + public static final int LISTAGEM_GLOBAL_TRABALHADORES_PERIODO = -1; + public static final int LISTAGEM_GLOBAL_HIGIENE_SEGURANCA = 11; + + public static final String ESTATISTICAS[] = + new String[]{ "", + "Marca\u00e7\u00f5es efectuadas e pendentes (geral)", + "Marca\u00e7\u00f5es efectuadas e pendentes (por Empresa e Estabelecimento)", + "Contagem global de trabalhadores que ainda n\u00e3o realizaram exames (por per\u00edodo)", + "Listagem de trabalhadores que ainda n\u00e3o realizaram exames (por per\u00edodo, Empresa e Estabelecimento)", + "Contagem global de trabalhadores que j\u00e1 realizaram exames (por per\u00edodo)", + "Listagem de trabalhadores que j\u00e1 realizaram exames (por per\u00edodo, Empresa e Estabelecimento)", + "Contagem global de trabalhadores que ainda n\u00e3o realizaram consultas (por per\u00edodo)", + "Listagem de trabalhadores que ainda n\u00e3o realizaram consultas (por per\u00edodo, Empresa e Estabelecimento)", + "Contagem global de trabalhadores que j\u00e1 realizaram consultas (por per\u00edodo)", + "Listagem de trabalhadores que j\u00e1 realizaram consultas (por per\u00edodo, Empresa e Estabelecimento)", + //"Listagem global de trabalhadores (por per\u00edodo)", + "Listagem global com os dados de higiene e seguran\u00e7a" }; + + + public static final int OPTION_INTERVALO = 0; + public static final int OPTION_ANO = 1; + public static final int OPTION_EMPRESA = 2; + public static final int OPTION_ESTABELECIMENTO = 0; + + public static final boolean ESTATISTICAS_OPTIONS[][] = + // intervalo, ano, empresa, estabelecimento + new boolean[][]{ { false, false, false, false }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, + { true, false, false, false }, + { true, false, true, true }, +// { true, false, false, false }, + { false, false, false, false } }; + + private JDOProvider JDO; + private EstatisticaDataProvider provider; + private PesquisasProvider pesquisasProvider; + + private JComboBox estatisticaCombo; + private JCalendarPanel dataInicioPanel; + private JCalendarPanel dataFimPanel; + private JTextField anoText; + private BaseTable empresasTable; + private VectorTableModel empresasModel; + private BaseTable estabelecimentosTable; + private VectorTableModel estabelecimentosModel; + private JButton pesquisarButton; + private JButton excelButton; + private JEditorPane resultadoText; + + /** Creates a new instance of EstatisticaWindow */ + public EstatisticaWindow() + throws Exception + { + provider = (EstatisticaDataProvider)EstatisticaDataProvider.getProvider(); + pesquisasProvider = (PesquisasProvider)PesquisasProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + { + setSize( 1000, 700 ); + setTitle( "Listagens" ); + + JLabel estatisticaLabel = new JLabel( "Listagem" ); + estatisticaCombo = new JComboBox(); + for( int n = 0; n < ESTATISTICAS.length; n++ ) + { + estatisticaCombo.addItem( ESTATISTICAS[ n ] ); + } + estatisticaCombo.setSelectedIndex( 0 ); + estatisticaCombo.addItemListener( this ); + estatisticaCombo.setPreferredSize( new Dimension( 700, 20 ) ); + JLabel intervalo1Label = new JLabel( "De" ); + JLabel intervalo2Label = new JLabel( "a" ); + dataInicioPanel = new JCalendarPanel( null ); + dataInicioPanel.setPreferredSize( new Dimension( 200, 20 ) ); + dataFimPanel = new JCalendarPanel( null ); + dataFimPanel.setPreferredSize( new Dimension( 200, 20 ) ); + + JLabel anoLabel = new JLabel( "Ano" ); + anoText = new JTextField(); + anoText.setDocument( new YearDocument() ); + anoText.setPreferredSize( new Dimension( 50, 20 ) ); + new CopyPasteHandler( anoText ); + + empresasModel = new VectorTableModel( new String[]{ "Designa\u00e7\u00e3o Social" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + empresasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane empresasScroll = new JScrollPane(); + empresasScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Empresa" ) ); + empresasScroll.setViewportView( empresasTable ); + empresasScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + empresasScroll.getVerticalScrollBar().setBlockIncrement(20); + + estabelecimentosModel = new VectorTableModel( new String[]{ "Nome" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane estabelecimentosScroll = new JScrollPane(); + estabelecimentosScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Estabelecimento" ) ); + estabelecimentosScroll.setViewportView( estabelecimentosTable ); + estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + pesquisarButton = new JButton( "Pesquisar" ); + pesquisarButton.addActionListener( this ); + excelButton = new JButton( "Exportar" ); + excelButton.addActionListener( this ); + + resultadoText = new JEditorPane( "text/html", "" ); + resultadoText.setEditable( false ); +// resultadoText.setLineWrap( true ); +// resultadoText.setWrapStyleWord( true ); + new CopyPasteHandler( resultadoText ); + JScrollPane resultadoScroll = new JScrollPane(); + resultadoScroll.setViewportView( resultadoText ); + resultadoScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS ); + resultadoScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + JPanel pad; + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 5, 5, 5, 5 ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + + JPanel escolhaEstatisticaPanel = new JPanel(); + escolhaEstatisticaPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + escolhaEstatisticaPanel.add( estatisticaLabel ); + escolhaEstatisticaPanel.add( estatisticaCombo ); + gridbag.setConstraints( escolhaEstatisticaPanel, constraints ); + getContentPane().add( escolhaEstatisticaPanel ); + + JPanel periodoPanel = new JPanel(); + periodoPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + periodoPanel.add( intervalo1Label ); + periodoPanel.add( dataInicioPanel ); + periodoPanel.add( intervalo2Label ); + periodoPanel.add( dataFimPanel ); + gridbag.setConstraints( periodoPanel, constraints ); + getContentPane().add( periodoPanel ); + + JPanel anoPanel = new JPanel(); + anoPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + anoPanel.add( anoLabel ); + anoPanel.add( anoText ); + gridbag.setConstraints( anoPanel, constraints ); + getContentPane().add( anoPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.2; + constraints.gridheight = 2; + constraints.weightx = 0.3; + constraints.gridwidth = 3; + gridbag.setConstraints( empresasScroll, constraints ); + getContentPane().add( empresasScroll ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + getContentPane().add( estabelecimentosScroll ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0; + constraints.gridwidth = 1; + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout( new GridLayout( 1, 1 ) ); + buttonPanel.add( pesquisarButton ); + buttonPanel.add( excelButton ); + gridbag.setConstraints( buttonPanel, constraints ); + getContentPane().add( buttonPanel ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.8; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( resultadoScroll, constraints ); + getContentPane().add( resultadoScroll ); + + processarEscolha(); + } + + public void actionPerformed(java.awt.event.ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( pesquisarButton ) ) + { + int index = estatisticaCombo.getSelectedIndex(); + switch( index ) + { + case LISTAGEM_GERAL_MARCACOES_PERIODO: + listagemGeralMarcacoesPeriodo(); + break; + + case LISTAGEM_MARCACOES_PERIODO_EMPRESA_ESTABELECIMENTO: + listagemMarcacoesPeriodoEmpresaEstabelecimento(); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_SEM_EXAMES: + listagemGeralTrabalhadoresSemExamesOuConsultas( true ); + break; + + case LISTAGEM_TRABALHADORES_SEM_EXAMES_EMPRESA_ESTABELECIMENTO: + listagemTrabalhadoresSemExamesOuConsultasEmpresaEstabelecimento( true ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_COM_EXAMES_PERIODO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodo( true ); + break; + + case LISTAGEM_TRABALHADORES_COM_EXAMES_PERIODO_EMPRESA_ESTABELECIMENTO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodoEmpresaEstabelecimento( true ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_SEM_CONSULTA: + listagemGeralTrabalhadoresSemExamesOuConsultas( false ); + break; + + case LISTAGEM_TRABALHADORES_SEM_CONSULTA_EMPRESA_ESTABELECIMENTO: + listagemTrabalhadoresSemExamesOuConsultasEmpresaEstabelecimento( false ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_COM_CONSULTA_PERIODO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodo( false ); + break; + + case LISTAGEM_TRABALHADORES_COM_CONSULTA_PERIODO_EMPRESA_ESTABELECIMENTO: + listagemGeralTrabalhadoresComExamesOuConsultasPeriodoEmpresaEstabelecimento( false ); + break; + + case LISTAGEM_GLOBAL_TRABALHADORES_PERIODO: + listagemGeralTrabalhadoresPeriodo(); + break; + + case LISTAGEM_GLOBAL_HIGIENE_SEGURANCA: + listagemGlobalHigieneSeguranca(); + break; + } + } + else if( source.equals( excelButton ) ) + { + exportar(); + } + } + + private boolean close() + { + setVisible( false ); + dispose(); + return true; + } + + public boolean closeIfPossible() + { + return close(); + } + + public void open() + { + empresasTable.clearSelection(); + estatisticaCombo.setSelectedIndex( 0 ); + try + { + IDObject empresas[] = pesquisasProvider.getAllEmpresas(); + empresasModel.setValues( new Vector( Arrays.asList( empresas ) ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + } + setVisible( true ); + } + + public void refresh() + { + setVisible( true ); + } + + public void valueChanged(javax.swing.event.ListSelectionEvent e) + { + Object source = e.getSource(); + if( source.equals( empresasTable.getSelectionModel() ) ) + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + if( selected == -1 ) + { + return; + } + IDObject empresa = (IDObject) empresasModel.getRowAt( selected ); + estabelecimentosModel.clearAll(); + IDObject estabelecimentos[]; + try + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( empresa.getID() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos", true ); + return; + } + Vector v = new Vector( Arrays.asList( estabelecimentos ) ); + v.add( new MappableObject( new Integer( -1 ), "TODOS" ) ); + estabelecimentosModel.setValues( v ); + } + } + + public void itemStateChanged(java.awt.event.ItemEvent itemEvent) + { + processarEscolha(); + } + + protected void processarEscolha() + { + int index = estatisticaCombo.getSelectedIndex(); + boolean optionLine[] = ESTATISTICAS_OPTIONS[ index ]; + dataInicioPanel.setEnabled( optionLine[ OPTION_INTERVALO ] ); + dataFimPanel.setEnabled( optionLine[ OPTION_INTERVALO ] ); + anoText.setEnabled( optionLine[ OPTION_ANO ] ); + empresasTable.setEnabled( optionLine[ OPTION_EMPRESA ] ); + estabelecimentosTable.setEnabled( optionLine[ OPTION_ESTABELECIMENTO ] ); + pesquisarButton.setEnabled( index != NONE ); + } + + protected void listagemGeralMarcacoesPeriodo() + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + int exames = provider.countExamesPeriodo( inicio, fim ); + int consultas = provider.countConsultasPeriodo( inicio, fim ); + int total = exames + consultas; + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_GERAL_MARCACOES_PERIODO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "EXAMES:" ); + buffer.append( "" ); + buffer.append( "" + exames + "" ); + buffer.append( "
" ); + buffer.append( "CONSULTAS:" ); + buffer.append( "" ); + buffer.append( "" + consultas + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + ( exames + consultas ) + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getMarcacoesPeriodo( inicio, fim ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "DATA" ); + buffer.append( "" ); + buffer.append( " " ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemMarcacoesPeriodoEmpresaEstabelecimento() + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( inicio == null || fim == null || sEmpresa == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher Empresa e intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresaData empresa = (EmpresaData)JDO.load( EmpresaData.class, idEmpresa ); + String designacao = (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ); + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + int examesEmpresa = provider.countExamesPeriodoForEmpresa( inicio, fim, idEmpresa ); + int consultasEmpresa = provider.countConsultasPeriodoForEmpresa( inicio, fim, idEmpresa ); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_MARCACOES_PERIODO_EMPRESA_ESTABELECIMENTO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "EMPRESA:" ); + buffer.append( "" ); + buffer.append( "" + designacao + "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "EXAMES:" ); + buffer.append( "" ); + buffer.append( "" + examesEmpresa + "" ); + buffer.append( "
" ); + buffer.append( "CONSULTAS:" ); + buffer.append( "" ); + buffer.append( "" + consultasEmpresa + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + ( examesEmpresa + consultasEmpresa ) + "" ); + buffer.append( "
" ); + for( int e = 0; e < estabelecimentos.length; e++ ) + { + EstabelecimentoData estabelecimento = (EstabelecimentoData)JDO.load( EstabelecimentoData.class, estabelecimentos[ e ].getID() ); + String nome = (String)estabelecimento.get( EstabelecimentoData.NOME ); + int exames = provider.countExamesPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID() ); + int consultas = provider.countConsultasPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID() ); + int total = exames + consultas; + buffer.append( "



" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO:" ); + buffer.append( "" ); + buffer.append( "" + nome + "" ); + buffer.append( "
" ); + buffer.append( "EXAMES:" ); + buffer.append( "" ); + buffer.append( "" + exames + "" ); + buffer.append( "
" ); + buffer.append( "CONSULTAS:" ); + buffer.append( "" ); + buffer.append( "" + consultas + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + ( exames + consultas ) + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getMarcacoesPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID() ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 1; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "NOME" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "DATA" ); + buffer.append( "" ); + buffer.append( " " ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + } + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresSemExamesOuConsultas( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + int count = provider.countTrabalhadoresSemExamesOuConsultas( inicio, fim, exames ); + //String data[][] = provider.getTrabalhadoresComExamesOuConsultasPeriodo( inicio, fim, exames ); + Object data[][] = provider.getCountTrabalhadoresSemExamesOuConsultasPeriodoForAllEmpresas( inicio, fim, exames ); + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_GLOBAL_TRABALHADORES_SEM_EXAMES : LISTAGEM_GLOBAL_TRABALHADORES_SEM_CONSULTA ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + count + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "N\u00ba" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ 0 ] + "" ); + buffer.append( "" ); + buffer.append( "" + data[ l ][ 1 ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemTrabalhadoresSemExamesOuConsultasEmpresaEstabelecimento( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( sEmpresa == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher Empresa.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresaData empresa = (EmpresaData)JDO.load( EmpresaData.class, idEmpresa ); + String designacao = (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ); + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + int countEmpresa = provider.countTrabalhadoresSemExamesOuConsultasEmpresa( idEmpresa, inicio, fim, exames ); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_TRABALHADORES_SEM_EXAMES_EMPRESA_ESTABELECIMENTO : LISTAGEM_TRABALHADORES_SEM_CONSULTA_EMPRESA_ESTABELECIMENTO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "EMPRESA:" ); + buffer.append( "" ); + buffer.append( "" + designacao + "" ); + buffer.append( "
" ); + buffer.append( "Nº DE TRABALHADORES:" ); + buffer.append( "" ); + buffer.append( "" + countEmpresa + "" ); + buffer.append( "
" ); + for( int e = 0; e < estabelecimentos.length; e++ ) + { + EstabelecimentoData estabelecimento = (EstabelecimentoData)JDO.load( EstabelecimentoData.class, estabelecimentos[ e ].getID() ); + String nome = (String)estabelecimento.get( EstabelecimentoData.NOME ); + int countEstabelecimento = provider.countTrabalhadoresSemExamesOuConsultasEstabelecimento( estabelecimentos[ e ].getID(), inicio, fim, exames ); + buffer.append( "



" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO:" ); + buffer.append( "" ); + buffer.append( "" + nome + "" ); + buffer.append( "
" ); + buffer.append( "Nº DE TRABALHADORES:" ); + buffer.append( "" ); + buffer.append( "" + countEstabelecimento + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getTrabalhadoresSemExamesOuConsultasEstabelecimento( estabelecimentos[ e ].getID(), inicio, fim, exames ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + } + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresComExamesOuConsultasPeriodo( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + int count = provider.countTrabalhadoresComExamesOuConsultasPeriodo( inicio, fim, exames ); + //String data[][] = provider.getTrabalhadoresComExamesOuConsultasPeriodo( inicio, fim, exames ); + Object data[][] = provider.getCountTrabalhadoresComExamesOuConsultasPeriodoForAllEmpresas( inicio, fim, exames ); + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_GLOBAL_TRABALHADORES_COM_EXAMES_PERIODO : LISTAGEM_GLOBAL_TRABALHADORES_COM_CONSULTA_PERIODO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "TOTAL:" ); + buffer.append( "" ); + buffer.append( "" + count + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "N\u00ba" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ 0 ] + "" ); + buffer.append( "" ); + buffer.append( "" + data[ l ][ 1 ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresComExamesOuConsultasPeriodoEmpresaEstabelecimento( boolean exames ) + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( inicio == null || fim == null || sEmpresa == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher Empresa e intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresaData empresa = (EmpresaData)JDO.load( EmpresaData.class, idEmpresa ); + String designacao = (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ); + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = pesquisasProvider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + int countEmpresa = provider.countTrabalhadoresComExamesOuConsultasPeriodoForEmpresa( inicio, fim, idEmpresa, exames ); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ exames ? LISTAGEM_TRABALHADORES_COM_EXAMES_PERIODO_EMPRESA_ESTABELECIMENTO : LISTAGEM_TRABALHADORES_COM_CONSULTA_PERIODO_EMPRESA_ESTABELECIMENTO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "
" ); + buffer.append( "EMPRESA:" ); + buffer.append( "" ); + buffer.append( "" + designacao + "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + buffer.append( "Nº:" ); + buffer.append( "" ); + buffer.append( "" + countEmpresa + "" ); + buffer.append( "
" ); + for( int e = 0; e < estabelecimentos.length; e++ ) + { + EstabelecimentoData estabelecimento = (EstabelecimentoData)JDO.load( EstabelecimentoData.class, estabelecimentos[ e ].getID() ); + String nome = (String)estabelecimento.get( EstabelecimentoData.NOME ); + int countEstabelecimento = provider.countTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID(), exames ); + buffer.append( "



" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO:" ); + buffer.append( "" ); + buffer.append( "" + nome + "" ); + buffer.append( "
" ); + buffer.append( "Nº:" ); + buffer.append( "" ); + buffer.append( "" + countEstabelecimento + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getTrabalhadoresComExamesOuConsultasPeriodoForEstabelecimento( inicio, fim, estabelecimentos[ e ].getID(), exames ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + } + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGeralTrabalhadoresPeriodo() + { + try + { + Date inicio = dataInicioPanel.getDate(); + Date fim = dataFimPanel.getDate(); + if( inicio == null || fim == null ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher o intervalo de datas.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + if( inicio.after( fim ) ) + { + JOptionPane.showMessageDialog( this, "A data de in\u00edcio tem de ser inferior \u00e0 de fim..", "Erro...", + JOptionPane.ERROR_MESSAGE ); + resultadoText.setText( "ERRO!" ); + return; + } + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_GLOBAL_TRABALHADORES_PERIODO ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "
" ); + buffer.append( "PER\u00cdODO:" ); + buffer.append( "" ); + buffer.append( "" + DF.format( dataInicioPanel.getDate() ) + " a " + + DF.format( dataFimPanel.getDate() ) + "" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getDadosTrabalhadoresPeriodo( inicio, fim ); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "NOME" ); + buffer.append( "" ); + buffer.append( "ÚLTIMO EXAME" ); + buffer.append( "" ); + buffer.append( "ESTADO" ); + buffer.append( "" ); + buffer.append( "ÚLTIMA CONSULTA" ); + buffer.append( "" ); + buffer.append( "ESTADO" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + protected void listagemGlobalHigieneSeguranca() + { + try + { + StringBuffer buffer = new StringBuffer(); + buffer.append( "

" ); + buffer.append( "" + ESTATISTICAS[ LISTAGEM_GLOBAL_HIGIENE_SEGURANCA ] + "" ); + buffer.append( "

" ); + buffer.append( "
" ); + + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + buffer.append( "" ); + String data[][] = provider.getDadosHigieneSeguranca(); + for( int l = 0; l < data.length; l++ ) + { + buffer.append( "" ); + for( int c = 0; c < data[ l ].length; c++ ) + { + buffer.append( "" ); + buffer.append( "" ); + } + buffer.append( "" ); + } + buffer.append( "
" ); + buffer.append( "EMPRESA" ); + buffer.append( "" ); + buffer.append( "ESTABELECIMENTO" ); + buffer.append( "" ); + buffer.append( "ÚLTIMA AUDITORIA" ); + buffer.append( "" ); + buffer.append( "ESTADO" ); + buffer.append( "" ); + buffer.append( "RELATÓRIO" ); + buffer.append( "" ); + buffer.append( "PRÓXIMA AUDITORIA" ); + buffer.append( "
" ); + buffer.append( "" + data[ l ][ c ] + "" ); + buffer.append( "
" ); + resultadoText.setText( buffer.toString() ); + } + catch( Exception ex ) + { + resultadoText.setText( "ERRO a carregar dados!" ); + ex.printStackTrace(); + } + } + + public void exportar() + { + FileDialog dialog = new FileDialog( this, "Ficheiro de destino", FileDialog.SAVE ); + dialog.setDirectory( System.getProperty( "user.home" ) ); + dialog.setVisible( true ); + String fileName; + String dirName; + fileName = dialog.getFile(); + dirName = dialog.getDirectory(); + if( fileName != null ) + { + int index = fileName.indexOf( '.' ); + if( index == -1 ) + { + fileName += ".html"; + } + if( index == fileName.length() - 1 ) + { + fileName += "html"; + } + String fullName = dirName + fileName; + String text = resultadoText.getText(); + String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais"; + String style = ""; + text = text.replace( "", "\n\t\t" + title + "\n" + style ); + text = text.replace( "", "
" ); + text = text.replace( "", "
" ); +// System.out.println( text ); + try + { + FileWriter writer = new FileWriter( new File( fullName ) ); + writer.write( text ); + writer.close(); + } + catch( IOException ex ) + { + DialogException.showException( ex ); + return; + } + } + } +} \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/siprp/estatisticas/EstatisticasWindow.java b/tags/teg/SIPRPSoft/src/siprp/estatisticas/EstatisticasWindow.java new file mode 100644 index 00000000..71e4e844 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/estatisticas/EstatisticasWindow.java @@ -0,0 +1,36 @@ +/* + * EstatisticasWindow.java + * + * Created on 11 de Maio de 2004, 17:57 + */ + +package siprp.estatisticas; + +import javax.swing.*; + +import com.evolute.utils.ui.window.*; + +/** + * + * @author fpalma + */ +public class EstatisticasWindow + extends CustomJFrame +{ + private JPanel filtrosPanel; + private JPanel agrupamentosPanel; + private JPanel buttonPanel; + + private JComboBox filtroEmpresa; + + /** Creates a new instance of EstatisticasWindow */ + public EstatisticasWindow() + { + setupComponents(); + } + + private void setupComponents() + { + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/EmpresaPanel.java b/tags/teg/SIPRPSoft/src/siprp/ficha/EmpresaPanel.java new file mode 100644 index 00000000..bede830c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/EmpresaPanel.java @@ -0,0 +1,492 @@ +/* + * EmpresaPanel.java + * + * Created on 29 de Marco de 2004, 11:53 + */ + +package siprp.ficha; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.button.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class EmpresaPanel extends JPanel + implements ControllableComponent +{ + private JDOProvider JDO; + private JTextField designacaoSocialText; + private JTextField estabelecimentoText; + private JTextField localidadeText; + private RadioButtonFixedPanel servicoSaudeTipoPanel; + private JTextField designacaoServicoSaudeText; + private JButton defaultServicoSaudeButton; + private RadioButtonFixedPanel servicoHigieneTipoPanel; + private JTextField designacaoText; + private JButton defaultServicoHigieneButton; + + private FichaDataProvider provider; + private ComponentsHashtable empresaComponents; + private ComponentsHashtable estabelecimentoComponents; + + private EstabelecimentoData estabelecimento; + private EmpresaData empresa; + + + /** Creates a new instance of EmpresaPanel */ + public EmpresaPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Empresa/Entidade" ) ); + + JLabel designacaoSocialLabel = new JLabel( "Designa\u00e7\u00e3o Social" ); + designacaoSocialText = new JTextField(); +// JPanel servicoSaudePanel = new JPanel(); + JLabel estabelecimentoLabel = new JLabel( "Estabelecimento" ); + estabelecimentoText = new JTextField(); + JLabel localidadeLabel = new JLabel( "Localidade" ); + localidadeText = new JTextField(); + JLabel servicoSaudeLabel = new JLabel( "Servi\u00e7o de Sa\u00fade: Tipo" ); + servicoSaudeTipoPanel = + new RadioButtonFixedPanel( new IDObject[]{ new MappableObject( new Integer(1), "Interno" ), + new MappableObject( new Integer(2), "Interempresas" ), + new MappableObject( new Integer(3), "Externo" ), + new MappableObject( new Integer(4), "Servi\u00e7o Nacional de Sa\u00fade" ) }, + 1, 4, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel designacaoServicoSaudeLabel = new JLabel( "Designa\u00e7\u00e3o" ); + designacaoServicoSaudeText = new JTextField(); + defaultServicoSaudeButton = new JButton("-"); + defaultServicoSaudeButton.addActionListener( new ActionListener(){ + public void actionPerformed( ActionEvent e ) + { + designacaoServicoSaudeText.setText( (String) Singleton.getInstance( SingletonConstants.COMPANY_NAME ) ); + } + } ); + + JLabel servicoHigieneLabel = new JLabel( "Servi\u00e7o de Higiene e Seguran\u00e7a: Tipo" ); + servicoHigieneTipoPanel = + new RadioButtonFixedPanel( new IDObject[]{ new MappableObject( new Integer(1), "Interno" ), + new MappableObject( new Integer(2), "Interempresas" ), + new MappableObject( new Integer(3), "Externo" ), + new MappableObject( new Integer(4), "Outro" ) }, + 1, 4, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel designacaoLabel = new JLabel( "Designa\u00e7\u00e3o" ); + designacaoText = new JTextField(); + defaultServicoHigieneButton = new JButton("-"); + defaultServicoHigieneButton.addActionListener( new ActionListener(){ + public void actionPerformed( ActionEvent e ) + { + designacaoText.setText( (String) Singleton.getInstance( SingletonConstants.COMPANY_NAME ) ); + } + } ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridwidth = 1; + constraints.weightx = 0; + constraints.gridheight = 1; + constraints.weighty = 0; + + gridbag.setConstraints( designacaoSocialLabel, constraints ); + add( designacaoSocialLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoSocialText, constraints ); + add( designacaoSocialText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( estabelecimentoLabel, constraints ); + add( estabelecimentoLabel ); + + constraints.weightx = 0.6; + constraints.gridwidth = 3; + gridbag.setConstraints( estabelecimentoText, constraints ); + add( estabelecimentoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( localidadeLabel, constraints ); + add( localidadeLabel ); + + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localidadeText, constraints ); + add( localidadeText ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( servicoSaudeLabel, constraints ); + add( servicoSaudeLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( servicoSaudeTipoPanel, constraints ); + add( servicoSaudeTipoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( designacaoServicoSaudeLabel, constraints ); + add( designacaoServicoSaudeLabel ); + + JPanel designacaoServicoSaudePanel = new JPanel(); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoServicoSaudePanel, constraints ); + add( designacaoServicoSaudePanel ); + + constraints.weightx = 0; + constraints.gridwidth = 3; + gridbag.setConstraints( servicoHigieneLabel, constraints ); + add( servicoHigieneLabel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( servicoHigieneTipoPanel, constraints ); + add( servicoHigieneTipoPanel ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoLabel, constraints ); + add( designacaoLabel ); + + JPanel designacaoServicoHigienePanel = new JPanel(); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( designacaoServicoHigienePanel, constraints ); + add( designacaoServicoHigienePanel ); + + gridbag = new GridBagLayout(); + designacaoServicoSaudePanel.setLayout( gridbag ); + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridwidth = 1; + constraints.weightx = 1; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + gridbag.setConstraints( designacaoServicoSaudeText, constraints ); + designacaoServicoSaudePanel.add( designacaoServicoSaudeText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( defaultServicoSaudeButton, constraints ); + designacaoServicoSaudePanel.add( defaultServicoSaudeButton ); + + + gridbag = new GridBagLayout(); + designacaoServicoHigienePanel.setLayout( gridbag ); + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridwidth = 1; + constraints.weightx = 1; + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + + gridbag.setConstraints( designacaoText, constraints ); + designacaoServicoHigienePanel.add( designacaoText ); + + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( defaultServicoHigieneButton, constraints ); + designacaoServicoHigienePanel.add( defaultServicoHigieneButton ); + + new CopyPasteHandler( designacaoSocialText ); + new CopyPasteHandler( estabelecimentoText ); + new CopyPasteHandler( localidadeText ); + new CopyPasteHandler( designacaoServicoSaudeText ); + new CopyPasteHandler( designacaoText ); + } + + private void setupComponentsHashtable() + { + empresaComponents = new ComponentsHashtable(); + empresaComponents.putComponent( EmpresaData.DESIGNACAO_SOCIAL, designacaoSocialText ); + empresaComponents.putComponent( EmpresaData.SERVICO_SAUDE_TIPO, servicoSaudeTipoPanel ); + empresaComponents.putComponent( EmpresaData.SERVICO_SAUDE_DESIGNACAO, designacaoServicoSaudeText ); + empresaComponents.putComponent( EmpresaData.SERVICO_HIGIENE_TIPO, servicoHigieneTipoPanel ); + empresaComponents.putComponent( EmpresaData.SERVICO_HIGIENE_DESIGNACAO, designacaoText ); + + empresaComponents.putDummy( EmpresaData.MORADA ); + empresaComponents.putDummy( EmpresaData.CODIGO_POSTAL ); + empresaComponents.putDummy( EmpresaData.LOCALIDADE ); + empresaComponents.putDummy( EmpresaData.DISTRITO ); + empresaComponents.putDummy( EmpresaData.CONCELHO ); + empresaComponents.putDummy( EmpresaData.DATA_PROPOSTA ); + empresaComponents.putDummy( EmpresaData.DATA_ACEITACAO ); + empresaComponents.putDummy( EmpresaData.PERFIL_1 ); + empresaComponents.putDummy( EmpresaData.PERFIL_2 ); + empresaComponents.putDummy( EmpresaData.DATA_ENVIO_CONTRATO ); + empresaComponents.putDummy( EmpresaData.DATA_RECEPCAO_CONTRATO ); + empresaComponents.putDummy( EmpresaData.DATA_ENVIO_IDICT ); + empresaComponents.putDummy( EmpresaData.DATA_RELATORIO_ANUAL ); + empresaComponents.putDummy( EmpresaData.CODIGO_1 ); + empresaComponents.putDummy( EmpresaData.CODIGO_2 ); + empresaComponents.putDummy( EmpresaData.CODIGO_3 ); + empresaComponents.putDummy( EmpresaData.CAE ); + empresaComponents.putDummy( EmpresaData.ACTIVIDADE ); + empresaComponents.putDummy( EmpresaData.CONTRIBUINTE ); + empresaComponents.putDummy( EmpresaData.SEGURANCA_SOCIAL ); + empresaComponents.putDummy( EmpresaData.CONTACTO_1 ); + empresaComponents.putDummy( EmpresaData.CONTACTO_2 ); + empresaComponents.putDummy( EmpresaData.SERVICOS ); + empresaComponents.putDummy( EmpresaData.PRECO_HIGIENE ); + empresaComponents.putDummy( EmpresaData.PRECO_MEDICINA ); + empresaComponents.putDummy( EmpresaData.PERIODICIDADE ); + empresaComponents.putDummy( EmpresaData.DESIGNACAO_SOCIAL_PLAIN ); + empresaComponents.putDummy( EmpresaData.DATA_CANCELAMENTO ); + empresaComponents.putDummy( EmpresaData.A_CONSULTAS ); + empresaComponents.putDummy( EmpresaData.A_EXAMES ); + empresaComponents.putDummy( EmpresaData.B_CONSULTAS ); + empresaComponents.putDummy( EmpresaData.B_EXAMES ); + empresaComponents.putDummy( EmpresaData.INICIO_CONTRATO ); + empresaComponents.putDummy( EmpresaData.DURACAO ); + + estabelecimentoComponents = new ComponentsHashtable(); + estabelecimentoComponents.putComponent( EstabelecimentoData.NOME, estabelecimentoText ); + estabelecimentoComponents.putComponent( EstabelecimentoData.LOCALIDADE, localidadeText ); + estabelecimentoComponents.putDummy( EstabelecimentoData.MORADA ); + estabelecimentoComponents.putDummy( EstabelecimentoData.CODIGO_POSTAL ); + estabelecimentoComponents.putDummy( EstabelecimentoData.CONTACTO ); + estabelecimentoComponents.putDummy( EstabelecimentoData.HISTORICO ); + estabelecimentoComponents.putDummy( EstabelecimentoData.EMPRESA ); + estabelecimentoComponents.putDummy( EstabelecimentoData.NOME_PLAIN ); + +// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.DESIGNACAO_SOCIAL, designacaoSocialText ); +// components.put( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_SAUDE_TIPO, servicoSaudeTipoPanel ); +// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_SAUDE_DESIGNACAO, designacaoServicoSaudeText ); +// components.put( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_HIGIENE_TIPO, servicoHigieneTipoPanel ); +// components.putComponent( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.SERVICO_HIGIENE_DESIGNACAO, designacaoText ); +// +// components.putComponent( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.NOME, estabelecimentoText ); +// components.putComponent( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.LOCALIDADE, localidadeText ); +// +// components.putDummy( FichaDataProvider.T_EMPRESAS + "." + FichaDataProvider.INACTIVO ); +// components.putDummy( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.EMPRESA_ID ); +// components.putDummy( FichaDataProvider.T_ESTABELECIMENTOS + "." + FichaDataProvider.INACTIVO ); + } + + public void fill(Object value) + { + clear(); + empresa = null; + estabelecimento = null; + if( value != null ) + { + Integer empresaID = (Integer)((Object[])value)[0]; + Integer estabelecimentoID = (Integer)((Object[])value)[1]; + if( empresaID != null ) + { + try + { + empresa = (EmpresaData)JDO.load( EmpresaData.class, empresaID ); + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); + ComponentController.fill( names, empresa.getHashData(), empresaComponents ); + + if( estabelecimentoID != null ) + { + estabelecimento = (EstabelecimentoData)JDO.load( EstabelecimentoData.class, estabelecimentoID ); + names = estabelecimento.getFieldNames(); + ComponentController.fill( names, estabelecimento.getHashData(), estabelecimentoComponents ); + } + +// DBField fields[] = provider.EMPRESAS.getInsertFields(); +// String empresaFields[] = new String[ fields.length ]; +// Hashtable data = new Hashtable(); +// for( int i = 0; i < empresaFields.length; ++i ) +// { +// empresaFields[ i ] = fields[ i ].FULL_NAME; +// Object fieldValue = empresa.getProperty( empresaFields[ i ] ); +// if( fieldValue != null ) +// { +// data.put( empresaFields[ i ], fieldValue ); +// } +// } +// ComponentController.fill( empresaFields, data, components ); +// if( estabelecimentoID != null ) +// { +// estabelecimento = provider.load( provider.ESTABELECIMENTOS, new DBKey( estabelecimentoID ) ); +// fields = provider.ESTABELECIMENTOS.getInsertFields(); +// String estabelecimentoFields[] = new String[ fields.length ]; +// for( int i = 0; i < estabelecimentoFields.length; ++i ) +// { +// estabelecimentoFields[ i ] = fields[ i ].FULL_NAME; +// Object fieldValue = estabelecimento.getProperty( estabelecimentoFields[ i ] ); +// if( fieldValue != null ) +// { +// data.put( estabelecimentoFields[ i ], fieldValue ); +// } +// } +// ComponentController.fill( estabelecimentoFields, data, components ); +// } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados da Empresa", true ); + } + } + } + else + { + estabelecimentoText.setText( "Sede" ); + } + } + + public Object save() + { + StringBuffer msg = new StringBuffer(); + boolean hasMsg = false; + try + { + if( estabelecimento == null ) + { +// estabelecimento = provider.createObject( provider.ESTABELECIMENTOS ); + estabelecimento = new EstabelecimentoData(); + } + if( empresa == null ) + { +// empresa = provider.createObject( provider.EMPRESAS ); + empresa = new EmpresaData(); + } +// DBField fields[] = provider.EMPRESAS.getInsertFields(); +// String empresaFields[] = new String[ fields.length ]; +// for( int i = 0; i < empresaFields.length; ++i ) +// { +// empresaFields[ i ] = fields[ i ].FULL_NAME; +// } +// Hashtable hash = new Hashtable(); +// ComponentController.save( empresaFields, hash, components ); +// Enumeration enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// empresa.setProperty( name, hash.get( name ) ); +// } +// fields = provider.ESTABELECIMENTOS.getInsertFields(); +// String estabelecimentoFields[] = new String[ fields.length ]; +// for( int i = 0; i < estabelecimentoFields.length; ++i ) +// { +// estabelecimentoFields[ i ] = fields[ i ].FULL_NAME; +// } +// hash = new Hashtable(); +// ComponentController.save( estabelecimentoFields, hash, components ); +// enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// estabelecimento.setProperty( name, hash.get( name ) ); +// } + + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); +// String names[] = new String[]{ EmpresaData.DESIGNACAO_SOCIAL, EmpresaData.SERVICO_SAUDE_TIPO, +// EmpresaData.SERVICO_SAUDE_DESIGNACAO, EmpresaData.SERVICO_HIGIENE_TIPO, +// EmpresaData.SERVICO_HIGIENE_DESIGNACAO }; + Hashtable hash = empresa.getHashData(); + ComponentController.save( names, hash, empresaComponents ); + empresa.setHashData( hash ); + + names = estabelecimento.getFieldNames(); + hash = estabelecimento.getHashData(); + ComponentController.save( names, hash, estabelecimentoComponents ); + estabelecimento.setHashData( hash ); + estabelecimento.set( EstabelecimentoData.EMPRESA, empresa ); + +// estabelecimento.setProperty( provider.R_ESTABELECIMENTO_EMPRESA, empresa ); + +// if( ((String)empresa.getProperty( provider.DESIGNACAO_SOCIAL )).trim().length() == 0 ) + if( ((String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL )).trim().length() == 0 ) + { + msg.append( "A empresa tem de ter uma design\u00e7\u00e3o social\n" ); + hasMsg = true; + } + else + { + empresa.set( EmpresaData.DESIGNACAO_SOCIAL_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ) ); + } +// if( empresa.getProperty( provider.SERVICO_SAUDE_TIPO ) == null ) + if( empresa.get( EmpresaData.SERVICO_SAUDE_TIPO ) == null ) + { + msg.append( "A empresa tem de ter um tipo de seri\00e7o de sa\u00fade\n" ); + hasMsg = true; + } +// if( empresa.getProperty( provider.SERVICO_HIGIENE_TIPO ) == null ) + if( empresa.get( EmpresaData.SERVICO_HIGIENE_TIPO ) == null ) + { + msg.append( "A empresa tem de ter um tipo de seri\00e7o de higiene\n" ); + hasMsg = true; + } +// if( ((String)estabelecimento.getProperty( provider.NOME )).trim().length() == 0 ) + if( ((String)estabelecimento.get( EstabelecimentoData.NOME )).trim().length() == 0 ) + { + msg.append( "O estabelecimento tem de ter nome\n" ); + hasMsg = true; + } + + } + catch( Exception ex ) + { + ex.printStackTrace(); + return null; + } + if( hasMsg ) + { + throw new ValuesException( msg.toString() ); + } + return estabelecimento; + + } + + public void clear() + { + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); + ComponentController.clear( names, empresaComponents ); + names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] ); + ComponentController.clear( names, estabelecimentoComponents ); + estabelecimentoText.setText( "Sede" ); + empresa = null; + estabelecimento = null; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])empresaComponents.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, empresaComponents ); + names = (String[])estabelecimentoComponents.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, estabelecimentoComponents ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/ExamePDF.java b/tags/teg/SIPRPSoft/src/siprp/ficha/ExamePDF.java new file mode 100644 index 00000000..32b7702e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/ExamePDF.java @@ -0,0 +1,461 @@ +package siprp.ficha; + +import java.awt.Color; +import java.io.*; +import java.util.*; + +import com.lowagie.text.*; +import com.lowagie.text.pdf.*; + +import com.evolute.utils.*; +import siprp.*; + +public class ExamePDF implements FichaAptidaoConstants +{ + private final Font FONT_BOLD = FontFactory.getFont( "Arial", 8, Font.BOLD ); + private final Font FONT_NORMAL = FontFactory.getFont( "Arial", 8, Font.NORMAL ); + private final Font FONT_ZAPFDINGBATS = new Font( Font.ZAPFDINGBATS , 12, Font.NORMAL, new Color( 0, 0, 0 ) ); + + private BaseFont BASE_WINGDINGS; + private Font FONT_WINGDINGS; + +// static +// { +// try +// { +// //BASE_WINGDINGS = BaseFont.createFont("C:\\WINNT\\Fonts\\WINGDING.TTF", BaseFont.CP1252, BaseFont.NOT_EMBEDDED); +// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED); +// InputStream stream = BaseFont.getResourceStream( "WING", ClassLoader loader) +// BASE_WINGDINGS = BaseFont.createFont("WingDings", BaseFont.CP1252, BaseFont.EMBEDDED, +// true, byte[] ttfAfm, null ); +// FONT_WINGDINGS = new Font(BASE_WINGDINGS, 12); +// } +// catch( Exception ex ) +// { +// FONT_WINGDINGS = FONT_NORMAL; +// System.out.println( "NO FONT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ); +// } +// } + + public ExamePDF() + { + FontFactory.registerDirectories(); + String possibleNames[] = new String[]{ "Wingdings", "WingDings", "wingdings", "WINGDINGS" }; + + for( int n = 0; n < 4; n++ ) + { + FONT_WINGDINGS = FontFactory.getFont( possibleNames[ n ] ); + if( FONT_WINGDINGS.getFamilyname().toLowerCase().equals( "wingdings" ) ) + { + break; + } + } + + } + + public static void main( String[] args ) + { + try + { + HashMap ht = new HashMap(); + // designacao_social + // estabelecimentos.nome + // estabelecimentos.localidade + // servico_saude_tipo_interno + // servico_saude_tipo_interempresas + // servico_saude_tipo_externo + // servico_saude_tipo_sns + // servico_saude_designacao + // servico_higiene_tipo_interno + // servico_higiene_tipo_interempresas + // servico_higiene_tipo_externo + // servico_higiene_outro + // servico_higiene_designacao + // trabalhadores.nome + // sexo + // data_nascimento + // nacionalidade + // numero_mecanografico + // data_admissao + // categoria + // local_trabalho + // funcao_proposta + // data_admissao_funcao + // observacoes + // exames.data + // tipo_admissao + // tipo_periodico + // tipo_ocasional + // tipo_apos_doenca + // tipo_apos_acidente + // tipo_pedido_trabalhador + // tipo_pedido_empresa + // tipo_mudanca_funcao + // tipo_trabalho + // tipo_outro + // resultado_apto + // resultado_apto_condicionalmente + // resultado_inapto_temp + // resultado_inapto_def + // outra_funcao_1 + // outra_funcao_2 + // outra_funcao_3 + // outra_funcao_4 + // proximo_exame + // outras_recomendacoes + // medicos.nome + // numero_cedula + + ht.put( TRABALHADORES_NOME, "Trabalhador do com\u00e9rcio" ); + ht.put( SERVICO_SAUDE_DESIGNACAO, "Designacao servico saude" ); + ht.put( SERVICO_SAUDE_TIPO_EXTERNO, "" + Boolean.TRUE ); + ht.put( TIPO_PERIODICO, "" + Boolean.TRUE ); + ht.put( RESULTADO_INAPTO_TEMP, "" + Boolean.TRUE ); + FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + "\\report.pdf" ); + fos.write( new ExamePDF().createPDF( ht ) ); + fos.close(); + System.out.println( "File saved." ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c \"" + System.getProperty( "user.home" ) + "\\report.pdf\"" ); + proc.waitFor(); + new File( System.getProperty( "user.home" ) + "\\report.pdf" ).delete(); + System.out.println( "Done." ); + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + public void print( byte []pdf, String nome ) + throws Exception + { + long time = System.currentTimeMillis(); +// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha" + time + ".pdf" ); + FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" ); + fos.write( pdf ); + fos.close(); + System.out.println( "File saved ( " + nome + "_" + time + " )." ); + Process proc; + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { +//System.out.println( "cmd.exe /c \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha.pdf\"" ); + proc = Runtime.getRuntime().exec( "cmd.exe /c \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf\"" ); + proc.waitFor(); + if( !new File( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" ).delete() ) + { + System.err.println( "File: report_ficha" + time + ".pdf - NOT DELETED" ); + } + } + else + { +//System.out.println( "/usr/bin/open \"" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha.pdf\"" ); + try{ + proc = Runtime.getRuntime().exec( new String[]{"/usr/bin/open", "" + System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf" } ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } +// proc = Runtime.getRuntime().exec( "/usr/bin/open \"/Users/Shared/teste.pdf.pdf\"" ); + } + } + + public void printSilent( byte []pdf, String nome, String printerName ) + throws Exception + { + long time = System.currentTimeMillis(); +// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + System.getProperty( "file.separator" ) + "report_ficha" + time + ".pdf" ); + + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + Process proc; + +// FileOutputStream fos = new FileOutputStream( System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf" ); + FileOutputStream fos = new FileOutputStream( "c:\\temp\\" + nome + "_" + time + ".pdf" ); + fos.write( pdf ); + fos.close(); + + System.out.println( "File saved ( " + nome + "_" + time + " )." ); +//System.out.println("cmd /c \"c:\\temp\\acrord32.lnk /t \"c:" + System.getProperty( "file.separator" ) + "temp" + System.getProperty( "file.separator" ) + nome + "_" + time + ".pdf\" \"" + printerName + "\"\""); +// proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat", +// System.getProperty( "user.home" ) + "\\print_fichas_temp\\" + nome + "_" + time + ".pdf", +// printerName }); + proc = Runtime.getRuntime().exec( new String[]{ System.getProperty( "user.home" ) + "\\print.bat", + "c:\\temp\\" + nome + "_" + time + ".pdf", + printerName }); + proc.waitFor(); +// if( !new File( "c:\\temp\\" + nome + "_" + time + ".pdf" ).delete() ) +// { +// System.err.println( "File: " + nome + "_" + ".pdf - NOT DELETED" ); +// } + } + + } + + public void cleanSilentPrint() + throws Exception + { + Process proc; + proc = Runtime.getRuntime().exec( "cmd /c \"del c:\\temp\\*.pdf\"" ); + proc.waitFor(); + } + + public byte[] createPDF( HashMap values ) + { + Document document = new Document(); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + document.setPageSize( PageSize.A4 ); + + try { + PdfWriter pdfw = PdfWriter.getInstance( document, bos ); + + document.addTitle( "Ficha de Aptid\u00e3o" ); + String acronym = (String) Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ); + document.addAuthor( acronym != null ? acronym: "n/a" ); + document.addCreator( "Evolute" ); + + document.open(); + + Paragraph conteudo = new Paragraph(); + + conteudo.add( new Chunk( "\n\nFICHA DE APTID\u00c3O\n", + FontFactory.getFont( "Arial", 10, Font.BOLD ) ) ); + conteudo.add( new Chunk( "(Portaria n.\u00ba 299/2007, de 16 de Mar\u00e7o)", +// conteudo.add( new Chunk( "(Portaria n\u00ba1031/2002, de 10 de Agosto)", + FontFactory.getFont( "Arial", 7, Font.BOLD ) ) ); + + conteudo.setAlignment( Element.ALIGN_CENTER ); + + document.add( conteudo ); + + Table table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setPadding( 5 ); + table.setOffset( 0 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Empresa/Entidade", FONT_BOLD ) ); + + StringBuilder texto = new StringBuilder(); + Phrase ph = new Phrase( 12f ); + + Cell cell = new Cell(); + texto.append( "DESIGNA\u00c7\u00c3O SOCIAL: " + values.get( DESIGNACAO_SOCIAL ) + "\n" ); + texto.append( "ESTABELECIMENTO: " + values.get( ESTABELECIMENTOS_NOME ) + + " LOCALIDADE: " + values.get( ESTABELECIMENTOS_LOCALIDADE ) + "\n" ); + texto.append( "SERVI\u00c7O DE SA\u00DaDE: Tipo " ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + texto = new StringBuilder( "Interno" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_INTERNO ) ) ); + + texto = new StringBuilder( "Interempresas" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_INTEREMPRESAS ), true ) ); + + texto = new StringBuilder( "Externo" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_EXTERNO ), true ) ); + + texto = new StringBuilder( "Servi\u00e7o Nacional de Sa\u00fade\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_SAUDE_TIPO_SNS ), true ) ); + + texto = new StringBuilder(); + + texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( SERVICO_SAUDE_DESIGNACAO ) + "\n" ); + texto.append( "SERVI\u00c7O DE HIGIENE E SEGURAN\u00c7A: Tipo " ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + texto = new StringBuilder( "Interno" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_INTERNO ) ) ); + + texto = new StringBuilder( "Interempresas" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_INTEREMPRESAS ), true ) ); + + texto = new StringBuilder( "Externo" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_EXTERNO ), true ) ); + + texto = new StringBuilder( "Outro\n" ); + ph.add( doCheckedPhrase( texto.toString(), values.get( SERVICO_HIGIENE_TIPO_OUTRO ), true ) ); + + texto = new StringBuilder(); + + texto.append( "DESIGNA\u00c7\u00c3O: " + values.get( SERVICO_HIGIENE_DESIGNACAO ) + "" ); + + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + cell.addElement( ph ); + table.addCell( cell ); + document.add( table ); + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setPadding( 5 ); + table.setOffset( 0 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Trabalhador", + FONT_BOLD ) ); + + texto = new StringBuilder(); + + texto.append( "NOME: " + values.get( TRABALHADORES_NOME ) + "\n" ); + texto.append( "SEXO: " + values.get( SEXO ) + " DATA DE NASCIMENTO: " + + values.get( DATA_NASCIMENTO ) + " NACIONALIDADE: " + + values.get( NACIONALIDADE ) + "\n" ); + texto.append( "N\u00daMERO MECANOGR\u00c1FICO/OUTRO: " + values.get( NUMERO_MECANOGRAFICO ) + + " DATA DE ADMISS\u00c3O: " + values.get( DATA_ADMISSAO ) + "\n" ); + texto.append( "CATEGORIA PROFISSIONAL: " + values.get( CATEGORIA ) + + " LOCAL DE TRABALHO: " + values.get( LOCAL_TRABALHO ) + "\n" ); + texto.append( "FUN\u00c7\u00c3O PROPOSTA: " + values.get( FUNCAO_PROPOSTA ) + + " DATA DE ADMISS\u00c3O NA FUN\u00c7\u00c3O: " + + values.get( DATA_ADMISSAO_FUNCAO ) + "" ); + + table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Observa\u00e7\u00f5es", + FONT_BOLD ) ); + + texto = new StringBuilder(); + texto.append( values.get( OBSERVACOES ) ); + + table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + + table = new Table( 2 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + cell = new Cell( new Phrase( "Exame M\u00e9dico", + FONT_BOLD ) ); + + cell.setColspan( 2 ); + table.addCell( cell ); + + texto = new StringBuilder(); + ph = new Phrase( 12f ); + texto.append( "DATA DO EXAME: " + values.get( EXAMES_DATA ) + "\n" ); + texto.append( "TIPO\n" ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + ph.add( doCheckedPhrase( "ADMISS\u00c3O\n", values.get( TIPO_ADMISSAO ) ) ); + + ph.add( doCheckedPhrase( "PERI\u00d3DICO\n", values.get( TIPO_PERIODICO ) ) ); + + ph.add( doCheckedPhrase( "OCASIONAL\n", values.get( TIPO_OCASIONAL ) ) ); + + ph.add( doCheckedPhrase( "AP\u00d3S DOEN\u00c7A\n", values.get( TIPO_APOS_DOENCA ), true ) ); + + ph.add( doCheckedPhrase( "AP\u00d3S ACIDENTE\n", values.get( TIPO_APOS_ACIDENTE ), true ) ); + + ph.add( doCheckedPhrase( "A PEDIDO DO TRABALHADOR\n", values.get( TIPO_PEDIDO_TRABALHADOR ), true ) ); + + ph.add( doCheckedPhrase( "A PEDIDO DO SERVI\u00c7O\n", values.get( TIPO_PEDIDO_EMPRESA ), true ) ); + + ph.add( doCheckedPhrase( "POR MUDAN\u00c7A DE FUN\u00c7\u00c3O\n", values.get( TIPO_MUDANCA_FUNCAO ), true ) ); + + ph.add( doCheckedPhrase( "POR ALTERA\u00c7\u00c3O DAS CONDI\u00c7\u00d5ES DE TRABALHO\n", values.get( TIPO_TRABALHO ), true ) ); + + ph.add( doCheckedPhrase( "OUTRO\n", values.get( TIPO_OUTRO ), true ) ); + + texto = new StringBuilder(); + texto.append( " ESPECIFIQUE: " + values.get( TIPO_OUTRO_TEXTO ) ); + + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + + table.addCell( ph ); + + ph = new Phrase( 12f ); + ph.add( new Chunk( "RESULTADO\n", FONT_NORMAL ) ); + ph.add( doCheckedPhrase( "APTO\n", values.get( RESULTADO_APTO ) ) ); + + ph.add( doCheckedPhrase( "APTO CONDICIONALMENTE\n\n", values.get( RESULTADO_APTO_CONDICIONALMENTE ) ) ); + + ph.add( doCheckedPhrase( "INAPTO TEMPORARIAMENTE\n", values.get( RESULTADO_INAPTO_TEMP ) ) ); + + ph.add( doCheckedPhrase( "INAPTO DEFINITIVAMENTE\n\n", values.get( RESULTADO_INAPTO_DEF ) ) ); + + texto = new StringBuilder(); + texto.append( "OUTRAS FUN\u00c7\u00d5ES QUE PODE DESEMPENHAR\n" ); + texto.append( " 1 " + values.get( OUTRA_FUNCAO_1 ) + "\n" ); + texto.append( " 2 " + values.get( OUTRA_FUNCAO_2 ) + "\n" ); + texto.append( " 3 " + values.get( OUTRA_FUNCAO_3 ) + "\n" ); + texto.append( " 4 " + values.get( OUTRA_FUNCAO_4 ) + "\n" ); + ph.add( new Chunk( texto.toString(), FONT_NORMAL ) ); + table.addCell( ph ); + + document.add( table ); + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + table.addCell( new Phrase( "Outras Recomenda\u00e7\u00f5es", + FONT_BOLD ) ); + + texto = new StringBuilder(); + if( ( (Boolean) Singleton.getInstance( SingletonConstants.FICHA_MARCA_EXAMES ) ).booleanValue() ) + { + System.out.println( "ficha marca exames" ); + texto.append( "PR\u00d3XIMO EXAME: " + values.get( PROXIMO_EXAME ) + "\n" ); + } + texto.append( "" + values.get( OUTRAS_RECOMENDACOES ) + "" ); + + table.addCell( new Phrase( 12f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + + + table = new Table( 1 ); + table.setBorderWidth( 1 ); + table.setOffset( 0 ); + table.setPadding( 5 ); + table.setWidth( 100 ); + + texto = new StringBuilder(); + + texto.append( "M\u00c9DICO DO TRABALHO: " + + values.get( MEDICOS_NOME ) + " C.P. " + values.get( NUMERO_CEDULA ) + "\n" ); + texto.append( "ASSINATURA _____________________________________________________________________________________\n\n" ); + texto.append( "TOMEI CONHECIMENTO ___________________________________________________________ DATA:____/____/________\n" ); + texto.append( " O RESPONS\u00c1VEL DOS RECURSOS HUMANOS" ); + + table.addCell( new Phrase( 18f, texto.toString(), FONT_NORMAL ) ); + document.add( table ); + + } + catch( Exception e ) { + e.printStackTrace(); + return null; + } + + document.close(); + return bos.toByteArray(); + } + + private Phrase doCheckedPhrase( String text, String phrase, boolean indent ) + { + boolean checked = CHECKED.equals( phrase ); + Phrase p = new Phrase( 12f ); + //p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 110: 111) + " ", FONT_ZAPFDINGBATS ) ); + //System.out.println( "FAMILY: " + FONT_WINGDINGS.getFamilyname() ); + p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 0xfe: 0xa8), FONT_WINGDINGS ) ); +// p.add( new Chunk( ( indent ? " " : "" ) + ( char )( checked? 'X': '_'), FONT_WINGDINGS ) ); + p.add( new Chunk( text, FONT_NORMAL ) ); + return p; + } + + private Phrase doCheckedPhrase( String text, String phrase ) + { + return doCheckedPhrase( text, phrase, false ); + } +} \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/ExamePanel.java b/tags/teg/SIPRPSoft/src/siprp/ficha/ExamePanel.java new file mode 100644 index 00000000..36853696 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/ExamePanel.java @@ -0,0 +1,527 @@ +/* + * ExamePanel.java + * + * Created on 29 de Marco de 2004, 11:57 + */ + +package siprp.ficha; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.jdo.*; +//import com.evolute.utils.metadb.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.button.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; +/** + * + * @author fpalma + */ +public class ExamePanel extends JPanel + implements ChangeListener, ControllableComponent, ListSelectionListener +{ + static + { + ExameData.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, ExameData.class ); + } + private JDOProvider JDO; + + private JCalendarPanel dataExamePanel; + private BetterButtonGroup tipoGroup; + private JRadioButton admissaoRadio; + private JRadioButton periodicoRadio; + private JRadioButton ocasionalRadio; +// private JRadioButton outroRadio; + private RadioButtonFixedPanel ocasionalPanel; + private JTextField especificarText; + private RadioButtonFixedPanel tipoProximoPanel; + private JCalendarPanel proximoExamePanel; + private RadioButtonFixedPanel resultadoPanel; + private JTextField outrasFuncoesTexts[]; + private JTextArea recomendacoesText; + + private FichaDataProvider provider; + private ComponentsHashtable components; + + private Integer trabalhadorID; + private MarcacaoTrabalhadorData marcacao; + + /** Creates a new instance of ExamePanel */ + public ExamePanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Exame M\u00e9dico" ) ); + + JPanel leftPanel = new JPanel(); + JPanel rightPanel = new JPanel(); + JPanel dataExameOuterPanel = new JPanel(); + JLabel dataExameLabel = new JLabel( "Data do Exame" ); + dataExamePanel = new JCalendarPanel( null ); + JPanel tipoPanel = new JPanel(); + tipoPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Tipo" ) ); + tipoGroup = new BetterButtonGroup( false ); + admissaoRadio = new JRadioButton( "Admiss\u00e3o" ); + tipoGroup.add( admissaoRadio ); + periodicoRadio = new JRadioButton( "Peri\u00f3dico" ); + tipoGroup.add( periodicoRadio ); + ocasionalRadio = new JRadioButton( "Ocasional" ); + tipoGroup.add( ocasionalRadio ); + ocasionalRadio.addChangeListener( this ); +// outroRadio = new JRadioButton( "Outro" ); +// tipoGroup.add( outroRadio ); +// outroRadio.addChangeListener( this ); + ocasionalPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "Ap\u00f3s doen\u00e7a" ), + new MappableObject( new Integer( 2 ), "Ap\u00f3s acidente" ), + new MappableObject( new Integer( 3 ), "A pedido do trabalhador" ), + new MappableObject( new Integer( 4 ), "A pedido do servi\u00e7o" ), + new MappableObject( new Integer( 5 ), "Por mudan\u00e7a de fun\u00e7\u00e3o" ), + new MappableObject( new Integer( 6 ), "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho" ), + new MappableObject( new Integer( 10 ), "Outro" ) }, + false ); + ocasionalPanel.addListSelectionListener( this ); + ocasionalPanel.setEnabled( false ); + especificarText = new JTextField(); + especificarText.setEnabled( false ); + JPanel proximoExameOuterPanel = new JPanel(); + proximoExameOuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Pr\u00f3ximo Exame" ) ); + proximoExamePanel = new JCalendarPanel( null ); + tipoProximoPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 2 ), "Peri\u00f3dico" ), + new MappableObject( new Integer( 3 ), "Ocasional" ) }, + RadioButtonFixedPanel.ORIENTATION_HORIZONTAL, 1, 2, false ); +// JLabel proximoExameLabel = new JLabel( "Pr\u00f3ximo Exame" ); + + JPanel resultadoOuterPanel = new JPanel(); + resultadoOuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Resultado" ) ); + resultadoPanel = new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "Apto" ), + new MappableObject( new Integer( 2 ), "Apto condicionalmente" ), + new MappableObject( new Integer( 3 ), "Inapto temporariamente" ), + new MappableObject( new Integer( 4 ), "Inapto definitivamente" ) }, + false ); + JLabel outrasFuncoesLabel = new JLabel( "Outras fun\u00e7\u00f5es que pode desempenhar", JLabel.CENTER ); + JPanel outrasFuncoesPanel = new JPanel(); + JLabel outrasFuncoesLabels[] = new JLabel[ 4 ]; + outrasFuncoesTexts = new JTextField[ 4 ]; + for( int n = 0; n < 4; n++ ) + { + outrasFuncoesLabels[ n ] = new JLabel( "" + ( n + 1 ) ); + outrasFuncoesTexts[ n ] = new JTextField(); + } + JScrollPane recomendacoesScp = new JScrollPane(); + recomendacoesScp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + recomendacoesScp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + recomendacoesText = new JTextArea(); + recomendacoesText.setLineWrap( true ); + recomendacoesText.setWrapStyleWord( true ); + recomendacoesText.setDocument( new MaximumLengthDocument( 300 ) ); + recomendacoesScp.setViewportView( recomendacoesText ); + recomendacoesScp.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Outras recomenda\u00e7\u00f5es" ) ); + + setLayout( new GridLayout( 1, 2 ) ); + add( leftPanel ); + add( rightPanel ); + + leftPanel.setLayout( new BorderLayout() ); + + dataExameOuterPanel.setLayout( new BorderLayout() ); + dataExameOuterPanel.add( dataExameLabel, BorderLayout.WEST ); + dataExameOuterPanel.add( dataExamePanel, BorderLayout.CENTER ); + leftPanel.add( dataExameOuterPanel, BorderLayout.NORTH ); + leftPanel.add( tipoPanel, BorderLayout.CENTER ); + proximoExameOuterPanel.setLayout( new BorderLayout() ); +// proximoExameOuterPanel.add( proximoExameLabel, BorderLayout.WEST ); + proximoExameOuterPanel.add( proximoExamePanel, BorderLayout.CENTER ); + proximoExameOuterPanel.add( tipoProximoPanel, BorderLayout.SOUTH ); + if( ( ( Boolean ) Singleton.getInstance( SingletonConstants.FICHA_MARCA_EXAMES ) ).booleanValue() ) + { + leftPanel.add( proximoExameOuterPanel, BorderLayout.SOUTH ); + } + + GridBagLayout gridbag = new GridBagLayout(); + tipoPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + + gridbag.setConstraints( admissaoRadio, constraints ); + tipoPanel.add( admissaoRadio ); + + gridbag.setConstraints( periodicoRadio, constraints ); + tipoPanel.add( periodicoRadio ); + + gridbag.setConstraints( ocasionalRadio, constraints ); + tipoPanel.add( ocasionalRadio ); + + constraints.weightx = 0.1; + constraints.gridwidth = 1; + JPanel pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + tipoPanel.add( pad ); + + constraints.weightx = 0.9; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( ocasionalPanel, constraints ); + tipoPanel.add( ocasionalPanel ); + +// constraints.weightx = 0; +// constraints.gridwidth = 1; +// gridbag.setConstraints( outroRadio, constraints ); +// tipoPanel.add( outroRadio ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( especificarText, constraints ); + tipoPanel.add( especificarText ); + + + gridbag = new GridBagLayout(); + rightPanel.setLayout( gridbag ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + gridbag.setConstraints( resultadoOuterPanel, constraints ); + rightPanel.add( resultadoOuterPanel ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + //constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weighty = 1; +// JPanel recomendacoesOuterPanel = new JPanel(); +// recomendacoesOuterPanel.setLayout( new GridLayout( 1, 1 ) ); +// recomendacoesOuterPanel.add( recomendacoesScp ); + gridbag.setConstraints( recomendacoesScp, constraints ); + rightPanel.add( recomendacoesScp ); + + gridbag = new GridBagLayout(); + resultadoOuterPanel.setLayout( gridbag ); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + gridbag.setConstraints( resultadoPanel, constraints ); + resultadoOuterPanel.add( resultadoPanel ); + + gridbag.setConstraints( outrasFuncoesLabel, constraints ); + resultadoOuterPanel.add( outrasFuncoesLabel ); + + gridbag.setConstraints( outrasFuncoesPanel, constraints ); + resultadoOuterPanel.add( outrasFuncoesPanel ); + + for( int n = 0; n < outrasFuncoesTexts.length; n++ ) + { + constraints.weightx = 0.1; + constraints.gridwidth = 1; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + resultadoOuterPanel.add( pad ); + + constraints.weightx = 0; + gridbag.setConstraints( outrasFuncoesLabels[ n ], constraints ); + resultadoOuterPanel.add( outrasFuncoesLabels[ n ] ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( outrasFuncoesTexts[ n ], constraints ); + resultadoOuterPanel.add( outrasFuncoesTexts[ n ] ); + new CopyPasteHandler( outrasFuncoesTexts[ n ] ); + } + + new CopyPasteHandler( especificarText ); + new CopyPasteHandler( recomendacoesText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putDummy( ExameData.TIPO ); + components.putComponent( ExameData.DATA, dataExamePanel ); + components.putComponent( ExameData.OCASIONAL, ocasionalPanel ); + components.putComponent( ExameData.OUTRO_TIPO, especificarText ); + components.putComponent( ExameData.PROXIMO_EXAME, proximoExamePanel ); + components.putComponent( ExameData.RESULTADO, resultadoPanel ); + components.putComponent( ExameData.OUTRA_FUNCAO_1, outrasFuncoesTexts[ 0 ] ); + components.putComponent( ExameData.OUTRA_FUNCAO_2, outrasFuncoesTexts[ 1 ] ); + components.putComponent( ExameData.OUTRA_FUNCAO_3, outrasFuncoesTexts[ 2 ] ); + components.putComponent( ExameData.OUTRA_FUNCAO_4, outrasFuncoesTexts[ 3 ] ); + components.putComponent( ExameData.OUTRAS_RECOMENDACOES, recomendacoesText ); + components.putDummy( ExameData.INACTIVO ); + components.putDummy( ExameData.TRABALHADOR ); + components.putDummy( ExameData.MEDICO ); + components.putDummy( ExameData.PDF ); + components.putDummy( ExameData.FO ); + } + + public void stateChanged( ChangeEvent e ) + { + if( e.getSource().equals( ocasionalRadio ) ) + { + ocasionalPanel.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ) ; + } +// else if( e.getSource().equals( outroRadio ) ) +// { +// especificarText.setEnabled( outroRadio.isSelected() && outroRadio.isEnabled() ); +// } + } + + + public void fill( Object value ) + { + clear(); + trabalhadorID = ( Integer ) value; + if( trabalhadorID == null ) + { + return; + } + try + { + Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID ); + + if( marcacaoID != null ) + { + marcacao = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, marcacaoID ); + proximoExamePanel.setDate( (Date) marcacao.get( Marcacao.DATA ) ); + } + Object dadosMarcacao[] = provider.getDadosUltimaMarcacao( trabalhadorID ); + if( dadosMarcacao != null ) + { + dataExamePanel.setDate( ( Date ) dadosMarcacao[ 0 ] ); + Integer tipo = ( Integer ) dadosMarcacao[ 1 ]; + int tipoValue = tipo != null ? tipo.intValue() : 0; + tipoGroup.setIntSelected( tipoValue > 0 ? tipoValue - 1 : 0 ); + } + + } + catch( Exception ex ) + { + ex.printStackTrace(); + return; + } + +// Integer trabID = (Integer) value; +// if( trabID == null ) +// { +// return; +// } +// try +// { +// Integer id = provider.getLastExameIDForTrabalhador( trabID ); +// if( id == null ) +// { +// return; +// } +// MetaObject exame = provider.load( provider.EXAMES, new DBKey( id ) ); +// byte pdf[] = (byte []) exame.getProperty( provider.PDF ); +// if( pdf != null ) +// { +// FileOutputStream fos = new FileOutputStream( "C:\\teste.pdf" ); +// fos.write( pdf ); +// fos.close(); +// } +// } +// catch( Exception ex ) +// { +// ex.printStackTrace(); +// return; +// } + } + + public Object save() + { + StringBuffer msg = new StringBuffer(); + boolean hasMsg = false; + boolean hasData = false; + ExameData exame; + Date dataExame = dataExamePanel.getDate(); + if( dataExame == null ) + { + dataExame = new Date(); + } + Calendar cal = Calendar.getInstance(); + cal.add( Calendar.DAY_OF_MONTH, 1 ); + if( !cal.getTime().after( dataExame ) ) + { + throw new ValuesException( "N\u00E3o \u00E9 poss\u00EDvel gravar exames com datas futuras." ); + } + try + { + String recomendacoes = recomendacoesText.getText(); + String linhas[] = recomendacoes.split( "\\n" ); + Vector linhasV = new Vector(); + for( int n = 0; n < linhas.length; n++ ) + { + if( linhas[ n ].trim().length() > 0 ) + { + linhasV.add( linhas[ n ] ); + } + } + if( linhasV.size() > 0 ) + { + linhas = ( String[] ) linhasV.toArray( new String[0] ); + boolean compress = false; + if( linhas.length == 2 ) + { + linhas[ 0 ] += " "; + } + recomendacoes = ""; + for( int n = 0; n < linhas.length; n++ ) + { + recomendacoes += linhas[ n ]; + } + } + recomendacoesText.setText( recomendacoes.trim() ); + +// exame = provider.createObject( FichaDataProvider.EXAMES ); + exame = new ExameData(); +// DBField fields[] = FichaDataProvider.EXAMES.getInsertFields(); +// String exameFields[] = new String[ fields.length ]; +// for( int i = 0; i < exameFields.length; ++i ) +// { +// exameFields[ i ] = fields[ i ].FULL_NAME; +// } +// Hashtable hash = new Hashtable(); +// ComponentController.save( exameFields, hash, components ); +// hash.put( FichaDataProvider.T_EXAMES + "." + FichaDataProvider.INACTIVO, "n" ); +// Enumeration enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// exame.setProperty( name, hash.get( name ) ); +// } + String names[] = exame.getFieldNames(); + Hashtable hash = new Hashtable(); + ComponentController.save( names, hash, components ); + exame.setHashData( hash ); + + int tipo = 0; + if( admissaoRadio.isSelected() ) + { + tipo = 1; + } + else if( periodicoRadio.isSelected() ) + { + tipo = 2; + } + else if( ocasionalRadio.isSelected() ) + { + tipo = 3; + } +// else if( outroRadio.isSelected() ) +// { +// tipo = 4; +// } +// exame.setProperty( FichaDataProvider.TIPO, new Integer( tipo ) ); + exame.set( ExameData.TIPO, new Integer( tipo ) ); + if( tipo != 3 ) + { +// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OCASIONAL ).FULL_NAME, null ); + exame.set( ExameData.OCASIONAL, null ); +// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OUTRO_TIPO ).FULL_NAME, "" ); + exame.set( ExameData.OUTRO_TIPO, "" ); + } + else + { + Integer ocasionalID = ( Integer )ocasionalPanel.save(); + if( ocasionalID == null || ocasionalID.intValue() != 10 ) + { +// exame.setProperty( FichaDataProvider.EXAMES.getFieldByName( FichaDataProvider.OUTRO_TIPO ).FULL_NAME, "" ); + exame.set( ExameData.OUTRO_TIPO, "" ); + } + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + return null; + } + if( hasMsg ) + { + throw new ValuesException( msg.toString() ); + } + return exame; + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + tipoGroup.setIntSelected( 0 ); + dataExamePanel.setDate( new Date() ); + tipoProximoPanel.setSelected( new Integer( 2 ) ); + marcacao = null; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + admissaoRadio.setEnabled( enable ); + periodicoRadio.setEnabled( enable ); + ocasionalRadio.setEnabled( enable ); +// outroRadio.setEnabled( enable ); + ocasionalPanel.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ) ; +// especificarText.setEnabled( outroRadio.isSelected() && outroRadio.isEnabled() ); + setEspecificarState(); + } + + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + setEspecificarState(); + } + + public void setEspecificarState() + { + Integer id = ( Integer )ocasionalPanel.save(); + if( id != null && id.intValue() == 10 ) + { + especificarText.setEnabled( ocasionalRadio.isSelected() && ocasionalRadio.isEnabled() ); + } + else + { + especificarText.setEnabled( false ); + } + } + + public Integer getMotivoProximoExame() + { + return tipoProximoPanel.getSelected(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoConstants.java b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoConstants.java new file mode 100644 index 00000000..6fb08f27 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoConstants.java @@ -0,0 +1,74 @@ +/* + * FichaAptidaoConstants.java + * + * Created on May 14, 2007, 5:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.ficha; + +/** + * + * @author lflores + */ +public interface FichaAptidaoConstants +{ + /* unicode + private final String SQUARE = "☐"; + private final String CHECKED = "☑";*/ +/* windows arial circle (full circle) */ + public static final String SQUARE = "○"; + public static final String CHECKED = "●"; + + public static final String PORTARIA = "portaria"; + public static final String DESIGNACAO_SOCIAL = "designacao_social"; + public static final String ESTABELECIMENTOS_NOME = "estabelecimentos.nome"; + public static final String ESTABELECIMENTOS_LOCALIDADE = "estabelecimentos.localidade"; + public static final String SERVICO_SAUDE_TIPO_INTERNO = "servico_saude_tipo_interno"; + public static final String SERVICO_SAUDE_TIPO_INTEREMPRESAS = "servico_saude_tipo_interempresas"; + public static final String SERVICO_SAUDE_TIPO_EXTERNO = "servico_saude_tipo_externo"; + public static final String SERVICO_SAUDE_TIPO_SNS = "servico_saude_tipo_sns"; + public static final String SERVICO_SAUDE_DESIGNACAO = "servico_saude_designacao"; + public static final String SERVICO_HIGIENE_TIPO_INTERNO = "servico_higiene_tipo_interno"; + public static final String SERVICO_HIGIENE_TIPO_INTEREMPRESAS = "servico_higiene_tipo_interempresas"; + public static final String SERVICO_HIGIENE_TIPO_EXTERNO = "servico_higiene_tipo_externo"; + public static final String SERVICO_HIGIENE_TIPO_OUTRO = "servico_higiene_tipo_outro"; + public static final String SERVICO_HIGIENE_DESIGNACAO = "servico_higiene_designacao"; + public static final String TRABALHADORES_NOME = "trabalhadores.nome"; + public static final String SEXO = "sexo"; + public static final String DATA_NASCIMENTO = "data_nascimento"; + public static final String NACIONALIDADE = "nacionalidade"; + public static final String NUMERO_MECANOGRAFICO = "numero_mecanografico"; + public static final String DATA_ADMISSAO = "data_admissao"; + public static final String CATEGORIA = "categoria"; + public static final String LOCAL_TRABALHO = "local_trabalho"; + public static final String FUNCAO_PROPOSTA = "funcao_proposta"; + public static final String DATA_ADMISSAO_FUNCAO = "data_admissao_funcao"; + public static final String OBSERVACOES = "observacoes"; + public static final String EXAMES_DATA = "exames.data"; + public static final String TIPO_ADMISSAO = "tipo_admissao"; + public static final String TIPO_PERIODICO = "tipo_periodico"; + public static final String TIPO_OCASIONAL = "tipo_ocasional"; + public static final String TIPO_APOS_DOENCA = "tipo_apos_doenca"; + public static final String TIPO_APOS_ACIDENTE = "tipo_apos_acidente"; + public static final String TIPO_PEDIDO_TRABALHADOR = "tipo_pedido_trabalhador"; + public static final String TIPO_PEDIDO_EMPRESA = "tipo_pedido_empresa"; + public static final String TIPO_MUDANCA_FUNCAO = "tipo_mudanca_funcao"; + public static final String TIPO_TRABALHO = "tipo_trabalho"; + public static final String TIPO_OUTRO = "tipo_outro"; + public static final String TIPO_OUTRO_TEXTO = "tipo_outro_texto"; + public static final String RESULTADO_APTO = "resultado_apto"; + public static final String RESULTADO_APTO_CONDICIONALMENTE = "resultado_apto_condicionalmente"; + public static final String RESULTADO_INAPTO_TEMP = "resultado_inapto_temp"; + public static final String RESULTADO_INAPTO_DEF = "resultado_inapto_def"; + public static final String OUTRA_FUNCAO_1 = "outra_funcao_1"; + public static final String OUTRA_FUNCAO_2 = "outra_funcao_2"; + public static final String OUTRA_FUNCAO_3 = "outra_funcao_3"; + public static final String OUTRA_FUNCAO_4 = "outra_funcao_4"; + public static final String OUTRAS_RECOMENDACOES = "outras_recomendacoes"; + public static final String PROXIMO_EXAME = "proximo_exame"; + public static final String MEDICOS_NOME = "medicos.nome"; + public static final String NUMERO_CEDULA = "numero_cedula"; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoCreator.java b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoCreator.java new file mode 100644 index 00000000..36e0e272 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoCreator.java @@ -0,0 +1,102 @@ +/* + * FichaAptidaoCreator.java + * + * Created on May 14, 2007, 4:50 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.ficha; + +import com.evolute.utils.fop.FOPCreator; +import com.evolute.utils.fop.FOPPrinter; +import com.evolute.utils.fop.PDFCreator; +import com.evolute.utils.strings.UnicodeChecker; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.util.HashMap; + +/** + * + * @author lflores + */ +public class FichaAptidaoCreator implements FichaAptidaoConstants +{ + private final FOPCreator fopCreator; + private final PDFCreator pdfCreator; + private final FOPPrinter fopPrinter; + + private static FichaAptidaoCreator creator = null; + + /** Creates a new instance of FichaAptidaoCreator */ + private FichaAptidaoCreator() + { + fopCreator = FOPCreator.getFOPCreator(); + pdfCreator = PDFCreator.getPDFCreator(); + fopPrinter = FOPPrinter.getFOPPrinter(); + } + + public static FichaAptidaoCreator getCreator() + { + if( creator == null ) + { + creator = new FichaAptidaoCreator(); + } + return creator; + } + + public void print( byte fo[] ) + throws Exception + { + ByteArrayInputStream in = new ByteArrayInputStream( fo ); + fopPrinter.printFO( in, true, true, null ); +// System.out.println( "DONE" ); + } + + public void printSilent( byte fo[], String printerName ) + throws Exception + { + ByteArrayInputStream in = new ByteArrayInputStream( fo ); + fopPrinter.printFO( in, true, false, null ); + } + + public byte[] createFO( HashMap values ) + throws Exception + { + StringBuilder buff = new StringBuilder( "\n\n" ); + + values.put( PORTARIA, "Portaria n. 299/2007, de 16 de Março" ); + +// ☐ square +// ☑ checked square + + for( String key: values.keySet() ) + { + buff.append( "\t<" + key + ">" ); + String val = values.get( key ); + buff.append( UnicodeChecker.parseToUnicode( "&#x", ";", val, true ) ); + buff.append( "\n" ); + } + buff.append( "" ); + String xml = buff.toString(); + + System.out.println( "XML: " + xml ); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() ); + + InputStream xslStream = getClass().getClassLoader().getResourceAsStream( "siprp/ficha/ficha_aptidao.xsl" ); + fopCreator.createFOfromXML( xmlIn, xslStream, out ); + // System.out.println( "FO created" ); + + return out.toByteArray(); + } + + public byte[] createPDF( byte[] fo ) + throws Exception + { + return pdfCreator.createPdfFromFo( fo ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManager.java b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManager.java new file mode 100644 index 00000000..ce664623 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManager.java @@ -0,0 +1,204 @@ +/* + * FichaAptidaoEditorManager.java + * + * Created on 30 de Marco de 2004, 19:23 + */ + +package siprp.ficha; + +import com.evolute.utils.editormanager.*; + +/** + * + * @author fpalma + */ +public class FichaAptidaoEditorManager extends EditorManager +{ + private static final EditorManagerFactory FACTORY = new FichaAptidaoEditorManagerFactory(); + + public static EditorManagerFactory getEditorManagerFactory() + { + return FACTORY; + } + + /** Creates a new instance of FichaAptidaoEditorManager */ + public FichaAptidaoEditorManager( Editor ed, int i ) + { + super( ed, i ); + } + + /** Creates a new instance of FichaAptidaoEditorManager */ + public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan ) + { + super( ed, i, subMan ); + throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" ); + } + + /** Creates a new instance of FichaAptidaoEditorManager */ + public FichaAptidaoEditorManager( Editor ed, int i, EditorManagerInterface subMan[] ) + { + super( ed, i, subMan ); + throw new RuntimeException( "FichaAptidaoEditorManager cannot have subManagers" ); + } + + public boolean isEditing() + { + if( state != STATE_UNSELECT ) + { + return true; + } + return false; + } + + public void enable() + { +// System.out.println( "EditorManager: enable " + this ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + enabled = true; + } + + public void disable() + { +// System.out.println( "EditorManager: disable " + this ); + editor.clear( index ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, false, false, false, false, false, false ); + enabled = false; + state = STATE_UNSELECT; + } + + public void unlock(boolean direction) + { + editor.enableComponents( index, false ); + if( enabled ) + { + if( state == STATE_UNSELECT ) + { + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + } + else + { + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, false, false, true, true ); + } + } + } + + public void select() + { +// System.out.println( "EditorManager: select " + this ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, true, true, true, true ); + state = STATE_EDIT; + } + + public void unselect() + { +// System.out.println( "EditorManager: select " + this ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + state = STATE_UNSELECT; + } + + public void newItem() + { +// System.out.println( "EditorManager: new " + this ); + editor.enableComponents( index, true ); + // new, edit, cancel, save, delete, select + editor.actions( index, false, false, true, true, true, false ); + state = STATE_NEW; + } + + public void cancelItem() + { +// System.out.println( "EditorManager: cancel " + this ); + if( state == STATE_NEW ) + { + editor.clear( index ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + state = STATE_UNSELECT; + } + else if( state == STATE_EDIT ) + { + editor.reload( index ); + editor.enableComponents( index, true ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, true, true, true, true ); + state = STATE_EDIT; + } + } + + public void saveItem() + { +// System.out.println( "EditorManager: save " + this ); + if( ! editor.save( index ) ) + { + return; + } + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, true, false, false, true, true ); + state = STATE_EDIT; + } + + public void deleteItem() + { +// System.out.println( "EditorManager: delete " + this ); + if( editor.delete( index ) ) + { + editor.clear( index ); + editor.enableComponents( index, false ); + // new, edit, cancel, save, delete, select + editor.actions( index, true, false, false, false, false, true ); + state = STATE_UNSELECT; + } + } + + public void refresh() + { +// System.out.println( "EditorManager: refresh " + this ); + if( !enabled ) + { + disable(); + return; + } + switch( state ) + { + case STATE_NEW: + editItem(); + state = STATE_NEW; + break; + case STATE_EDIT: + editItem(); + break; + case STATE_SELECT: + throw new RuntimeException( "FichaAptidaoEditorManager cannot be in STATE_SELECT" ); + case STATE_UNSELECT: + enable(); + break; + } + } + + public void editItem() + { + state = STATE_EDIT; + editor.actions( index, false, false, true, true, true, false ); + } + + public void lock(boolean direction) + { + throw new RuntimeException( "lock cannot be called on FichaAptidaoEditorManager" ); + } + + public void registerMain(EditorManagerInterface mainMan) + { + throw new RuntimeException( "registerMain cannot be called on FichaAptidaoEditorManager" ); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManagerFactory.java b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManagerFactory.java new file mode 100644 index 00000000..e7d4196f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaAptidaoEditorManagerFactory.java @@ -0,0 +1,38 @@ +/* + * FichaAptidaoEditorManagerFactory.java + * + * Created on 30 de Marco de 2004, 20:48 + */ + +package siprp.ficha; + +import com.evolute.utils.editormanager.*; +/** + * + * @author fpalma + */ +public class FichaAptidaoEditorManagerFactory + implements EditorManagerFactory +{ + + /** Creates a new instance of FichaAptidaoEditorManagerFactory */ + public FichaAptidaoEditorManagerFactory() + { + } + + public EditorManagerInterface createEditorManager(Editor ed, int i) + { + return new FichaAptidaoEditorManager( ed, i ); + } + + public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface[] subMan) + { + return new FichaAptidaoEditorManager( ed, i, subMan ); + } + + public EditorManagerInterface createEditorManager(Editor ed, int i, EditorManagerInterface subMan) + { + return new FichaAptidaoEditorManager( ed, i, subMan ); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/FichaWindow.java b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaWindow.java new file mode 100644 index 00000000..27e45569 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/FichaWindow.java @@ -0,0 +1,860 @@ +/* + * FichaWindow.java + * + * Created on 29 de Marco de 2004, 11:50 + */ + +package siprp.ficha; + +import siprp.*; +import siprp.data.*; +import siprp.importer.*; +import siprp.medicina.*; + +import java.awt.*; +import java.io.*; +import java.util.*; +import javax.swing.*; +import java.text.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.strings.*; +import com.evolute.utils.tracker.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.search.*; +import com.evolute.utils.ui.window.*; + +/** + * + * @author fpalma + */ +public class FichaWindow extends TabbedWindow + implements ListAction, FichaAptidaoConstants +{ + private JDOProvider JDO; + + private UpperPanel upperPanel; + private EmpresaPanel empresaPanel; + private TrabalhadorPanel trabalhadorPanel; + private ObservacoesPanel observacoesPanel; + private ExamePanel examePanel; + + private FichaDataProvider fdpProvider; + private MarcacoesMedicinaHandler marcacoesHandler; + private Integer empresaID; + private Integer estabelecimentoID; + private Integer trabalhadorID; + + private final ExamePDF ePDF = new ExamePDF(); + + private static int permissions[][] = + new int[][]{ { NEW_INDEX, CANCEL_INDEX, SAVE_INDEX } }; + + private static FichaWindow window = null; + + private Integer imposedTrabalhadorID = null; + private SaveExameListener exameListener = null; + + /** Creates a new instance of FichaWindow */ + private FichaWindow() + throws Exception + { + super( new UpperPanel(), new String[]{ "Empresa/Trabalhador", "Exame" }, + createPermissions( permissions ) ); + setEditorManagerFactory( FichaAptidaoEditorManager.getEditorManagerFactory() ); + upperPanel = (UpperPanel) getUpperPanel(); + upperPanel.owner = this; + fdpProvider = ( FichaDataProvider ) FichaDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + marcacoesHandler = new MarcacoesMedicinaHandler(); + setupComponents(); + } + + public static FichaWindow getWindow() + throws Exception + { + if( window == null ) + { + window = new FichaWindow(); + } + return window; + } + + private void setupComponents() + throws Exception + { + setSize( 700, 640 ); + setResizable( false ); + setTitle( "Ficha de Aptid\u00e3o" ); + + JPanel empresaTrabalhadorPanel = getTab( 0 ); + JPanel exameRecomendacoesPanel = getTab( 1 ); + + GridBagLayout gridbag = new GridBagLayout(); + empresaTrabalhadorPanel.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + empresaPanel = new EmpresaPanel(); + empresaPanel.setEnabled( false ); + gridbag.setConstraints( empresaPanel, constraints ); + empresaTrabalhadorPanel.add( empresaPanel ); + + constraints.weighty = 0; + trabalhadorPanel = new TrabalhadorPanel(); + gridbag.setConstraints( trabalhadorPanel, constraints ); + empresaTrabalhadorPanel.add( trabalhadorPanel ); + + constraints.weighty = 1; + observacoesPanel = new ObservacoesPanel(); + gridbag.setConstraints( observacoesPanel, constraints ); + empresaTrabalhadorPanel.add( observacoesPanel ); + + + gridbag = new GridBagLayout(); + exameRecomendacoesPanel.setLayout( gridbag ); + constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.weighty = 1; + examePanel = new ExamePanel(); + gridbag.setConstraints( examePanel, constraints ); + exameRecomendacoesPanel.add( examePanel ); + + registerAction( new ActionHandler(){ + public void execute() + { + print(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return saveAction || editAction; + } + }, "Imprimir", + "Imprimir Ficha", "print", + 0, true ); + + registerAction( new ActionHandler(){ + public void execute() + { + printOld(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return saveAction || editAction; + } + }, "Imprimir Fichas Anteriores", + "Imprimir Fichas Anteriores", null, + 0, false ); + + registerAction( new ActionHandler(){ + public void execute() + { + deleteOld(); + } + + public boolean activate( boolean newAction, boolean editAction, + boolean cancelAction, boolean saveAction, + boolean deleteAction, boolean selectAction ) + { + return saveAction || editAction; + } + }, "Apagar Fichas Anteriores", + "Apagar Fichas Anteriores", null, + 0, false ); + +// registerAction( new ActionHandler(){ +// public void execute() +// { +// excel(); +// } +// +// public boolean activate( boolean newAction, boolean editAction, +// boolean cancelAction, boolean saveAction, +// boolean deleteAction, boolean selectAction ) +// { +// return saveAction; +// } +// }, "Importar", +// "Importar de Excel", "excel", +// 0, true ); + } + + public boolean save( int index ) + { + new ProgressDialog( this, "A gravar...", + new Runnable(){ + public void run() + { + + } + }); + StringBuilder msg = new StringBuilder(); + MedicoData medico; + try + { + medico = (MedicoData)upperPanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + medico = null; + } + EstabelecimentoData estabelecimento; + try + { + estabelecimento = (EstabelecimentoData)empresaPanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + estabelecimento = null; + } + TrabalhadorData trabalhador; + try + { + trabalhador = (TrabalhadorData)trabalhadorPanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + trabalhador = null; + } + ExameData exame; + try + { + exame = (ExameData)examePanel.save(); + } + catch( ValuesException vex ) + { + msg.append( vex.getMessage() ); + exame = null; + } + if( estabelecimento == null || trabalhador == null || exame == null || medico == null ) + { + JOptionPane.showMessageDialog( this, msg.toString(), "Erro...", JOptionPane.ERROR_MESSAGE ); + return false; + } + estabelecimento.set( EstabelecimentoData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + estabelecimento.get( EstabelecimentoData.NOME ) ) ); + +// trabalhador.setProperty( FichaDataProvider.R_TRABALHADOR_ESTABELECIMENTO, estabelecimento ); +// trabalhador.setProperty( FichaDataProvider.OBSERVACOES, observacoesPanel.save() ); + trabalhador.set( TrabalhadorData.ESTABELECIMENTO, estabelecimento ); + trabalhador.set( TrabalhadorData.OBSERVACOES, observacoesPanel.save() ); + trabalhador.set( TrabalhadorData.NOME_PLAIN, + com.evolute.utils.strings.StringPlainer.convertString( ( String ) + trabalhador.get( TrabalhadorData.NOME ) ) ); + + +// exame.setProperty( FichaDataProvider.R_EXAME_MEDICO, medico ); +// exame.setProperty( FichaDataProvider.R_EXAME_TRABALHADOR, trabalhador ); + exame.set( ExameData.MEDICO, medico ); + exame.set( ExameData.TRABALHADOR, trabalhador ); + try + { + // lflores - disable FO for now + byte fo[] = null; //createFO( exame ); + +// System.out.println( "FO sz: " + fo.length ); + exame.set( ExameData.FO, fo ); + exame.set( ExameData.PDF, createPDF( exame ) ); + +// empresa.save(); +// estabelecimento.save(); + + exame.save(); + trabalhador.save(); + try + { + if( medico != null ) + { + fdpProvider.setMedicoForEstabelecimento( ( Integer ) estabelecimento.get( EstabelecimentoData.ID ), + ( Integer ) medico.get( MedicoData.ID ) ); + } + } + catch( Exception mex ) + { + } +// fdpProvider.savePDF( exame ); + +// DBKey key = trabalhador.getPrimaryKeyValue(); +// DBField fields[] = FichaDataProvider.TRABALHADORES.getPrimaryKey(); +// trabalhadorID = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() ); + trabalhadorID = ( Integer ) trabalhador.get( TrabalhadorData.ID ); + try + { + //Marcacao.saveMarcacaoConsultaForTrabalhadorID( trabalhadorID, (Date)exame.get( ExameData.PROXIMO_EXAME ) ); + marcacoesHandler.ajustarMarcacoes( + trabalhadorID, (Integer)exame.get( ExameData.TIPO ), + (Date)exame.get( ExameData.DATA ), + examePanel.getMotivoProximoExame(), (Date)exame.get( ExameData.PROXIMO_EXAME ) ); + } + catch( Exception iex ) + { + iex.printStackTrace(); + } +// createPDF( exame ); +// print(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a guardar", true ); + return false; + } + if( exameListener != null ) + { + exameListener.exameSaved( trabalhadorID, ( Integer )exame.get( ExameData.ID ) ); + exameListener = null; + } + return true; + } + + public boolean newItem( int index ) + { + exameListener = null; + if( imposedTrabalhadorID == null ) + { + fdpProvider.setSearch( FichaDataProvider.SEARCH_EMPRESAS ); + SearchDialog search; + Integer oldID = empresaID; + + search = new SearchDialog( fdpProvider, null, false, null, true ); + empresaID = ( Integer )search.getSelected(); + + if( empresaID == null ) + { + if( search.getIsNew() ) + { + estabelecimentoID = null; + trabalhadorID = null; + clear( 0 ); + return true; + } + else + { + return false; + } + } + + fdpProvider.setSearch( FichaDataProvider.SEARCH_ESTABELECIMENTOS ); + fdpProvider.setSearchID( FichaDataProvider.SEARCH_EMPRESAS, empresaID.intValue() ); + + search = new SearchDialog( fdpProvider, null, false, null, true ); + estabelecimentoID = ( Integer )search.getSelected(); + + if( estabelecimentoID == null ) + { + if( search.getIsNew() ) + { + trabalhadorID = null; + reload(0); + return true; + } + else + { + return false; + } + } + + fdpProvider.setSearch( FichaDataProvider.SEARCH_TRABALHADORES ); + fdpProvider.setSearchID( FichaDataProvider.SEARCH_ESTABELECIMENTOS, estabelecimentoID.intValue() ); + search = new SearchDialog( fdpProvider, null, false, null, true ); + trabalhadorID = ( Integer )search.getSelected(); + if( trabalhadorID == null && search.getIsNew() ) + { + reload(0); + return true; + } + } + else + { + trabalhadorID = imposedTrabalhadorID; + imposedTrabalhadorID = null; + try + { + estabelecimentoID = fdpProvider.getEstabelecimentoIDForTrabalhador( trabalhadorID ); + empresaID = fdpProvider.getEmpresaIDForEstabelecimento( estabelecimentoID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados.", true ); + return false; + } + } + if( trabalhadorID == null ) + { + return false; + } + reload(0); + return true; + } + + public boolean delete( int index ) + { + return true; + } + + public void deleteOld() + { + if( trabalhadorID == null ) + { + return; + } + Vector linhas; + try + { + IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID ); + linhas = new Vector( Arrays.asList( fichas ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true ); + return; + } + ListActionDialog dialog = + new ListActionDialog( this, "Apagar Fichas Anteriores", new String[]{ "Data" }, linhas, + new ListAction(){ + public String getListActionName() + { + return "Apagar"; + } + + public boolean executeListAction( int line, Object value ) + { + if( value == null ) + { + return true; + } + try + { + delete( ( ( IDObject )value ).getID() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a Apagar Ficha", true ); + return false; + } + return true; + } + } ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + + public void reload( int index ) + { + Integer upperData[] = new Integer[]{ empresaID, estabelecimentoID, trabalhadorID }; + upperPanel.fill( upperData ); + Object empresaData[] = new Object[]{ empresaID, estabelecimentoID }; + empresaPanel.fill( empresaData ); + trabalhadorPanel.fill( trabalhadorID ); + observacoesPanel.fill( trabalhadorID ); + examePanel.fill( trabalhadorID ); + } + + public void enableComponents( int index, boolean enable ) + { + upperPanel.setEnabled( enable ); + empresaPanel.setEnabled( enable ); + trabalhadorPanel.setEnabled( enable ); + observacoesPanel.setEnabled( enable ); + examePanel.setEnabled( enable ); + } + + public void clear( int index ) + { + upperPanel.clear(); + empresaPanel.clear(); + trabalhadorPanel.clear(); + observacoesPanel.clear(); + examePanel.clear(); + } + + public void print() + { + try + { + if( trabalhadorID == null ) + { + System.out.println( "no trab" ); + return; + } + + Integer id = fdpProvider.getLastExameIDForTrabalhador( trabalhadorID ); + if( id == null ) + { + System.out.println( "no id" ); + return; + } + print( id ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "N\u00e3o foi poss\u00edvel imprimir", true ); + } + } + + private void print( Integer exameID ) + throws Exception + { +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); + ExameData exame = (ExameData) JDO.load( ExameData.class, exameID ); + if( exame == null ) + { + throw new Exception( "N\u00e3o existe exame" ); + } + + // lflores - ignore FO (for now) + byte fo[] = null; //(byte []) exame.get( ExameData.FO ); + byte pdf[] = (byte []) exame.get( ExameData.PDF ); + + if( fo != null ) + { + FichaAptidaoCreator.getCreator().print( fo ); + } + else + { + TrabalhadorData trabalhadorExame = ( TrabalhadorData ) exame.get( ExameData.TRABALHADOR ); + String nomeFicheiro = StringPlainer.convertString( ( String ) trabalhadorExame.get( TrabalhadorData.NOME ) ); + nomeFicheiro = nomeFicheiro.replaceAll( " ", "_" ); + ePDF.print( pdf, nomeFicheiro ); + } + } + + public byte[] createFO( ExameData exame ) + throws Exception + { + HashMap ht = createMapFromExame(exame); +// ExamePDF ePDF = new ExamePDF(); +// return ePDF.createPDF( ht ); + + return FichaAptidaoCreator.getCreator().createFO( ht ); + } + + public byte[] createPDF( ExameData exame ) + throws Exception + { + // byte fo[] = exame.get( ExameData.FO, fo ); + HashMap ht = createMapFromExame( exame ); + return ePDF.createPDF( ht ); +// return FichaAptidaoCreator.getCreator().createPDF( fo ); + } + + private HashMap createMapFromExame(final ExameData exame) + { + MedicoData medico = (MedicoData)exame.get( ExameData.MEDICO ); + TrabalhadorData trabalhador = (TrabalhadorData) exame.get( ExameData.TRABALHADOR ); + EstabelecimentoData estabelecimento = (EstabelecimentoData) trabalhador.get( TrabalhadorData.ESTABELECIMENTO ); + EmpresaData empresa = (EmpresaData) estabelecimento.get( EstabelecimentoData.EMPRESA ); +// empresa.load( empresa.getPrimaryKeyValue() ); + HashMap ht = new HashMap(); + ht.put( DESIGNACAO_SOCIAL, ( String )empresa.get( EmpresaData.DESIGNACAO_SOCIAL ) ); + ht.put( ESTABELECIMENTOS_NOME, ( String )estabelecimento.get( EstabelecimentoData.NOME ) ); + String aux = (String)estabelecimento.get( EstabelecimentoData.LOCALIDADE ); + ht.put( ESTABELECIMENTOS_LOCALIDADE, aux != null ? aux : "" ); + Integer tipo = (Integer)empresa.get( EmpresaData.SERVICO_SAUDE_TIPO ); + ht.put( SERVICO_SAUDE_TIPO_INTERNO, SQUARE ); + ht.put( SERVICO_SAUDE_TIPO_INTEREMPRESAS, SQUARE ); + ht.put( SERVICO_SAUDE_TIPO_EXTERNO, SQUARE ); + ht.put( SERVICO_SAUDE_TIPO_SNS, SQUARE ); + switch( tipo.intValue() ) + { + case 1: + ht.put( SERVICO_SAUDE_TIPO_INTERNO, CHECKED ); + break; + case 2: + ht.put( SERVICO_SAUDE_TIPO_INTEREMPRESAS, CHECKED ); + break; + case 3: + ht.put( SERVICO_SAUDE_TIPO_EXTERNO, CHECKED ); + break; + case 4: + ht.put( SERVICO_SAUDE_TIPO_SNS, CHECKED ); + break; + } + ht.put( SERVICO_SAUDE_DESIGNACAO, ( String )empresa.get( EmpresaData.SERVICO_SAUDE_DESIGNACAO ) ); + tipo = (Integer)empresa.get( EmpresaData.SERVICO_HIGIENE_TIPO ); + ht.put( SERVICO_HIGIENE_TIPO_INTERNO, SQUARE ); + ht.put( SERVICO_HIGIENE_TIPO_INTEREMPRESAS, SQUARE ); + ht.put( SERVICO_HIGIENE_TIPO_EXTERNO, SQUARE ); + ht.put( SERVICO_HIGIENE_TIPO_OUTRO, SQUARE ); + switch( tipo.intValue() ) + { + case 1: + ht.put( SERVICO_HIGIENE_TIPO_INTERNO, CHECKED ); + break; + case 2: + ht.put( SERVICO_HIGIENE_TIPO_INTEREMPRESAS, CHECKED ); + break; + case 3: + ht.put( SERVICO_HIGIENE_TIPO_EXTERNO, CHECKED ); + break; + case 4: + ht.put( SERVICO_HIGIENE_TIPO_OUTRO, CHECKED ); + break; + } + ht.put( SERVICO_HIGIENE_DESIGNACAO, ( String )empresa.get( EmpresaData.SERVICO_HIGIENE_DESIGNACAO ) ); + ht.put( TRABALHADORES_NOME, ( String )trabalhador.get( TrabalhadorData.NOME ) ); + aux = (String)trabalhador.get( TrabalhadorData.SEXO ); + switch( aux.charAt( 0 ) ) + { + case 'm': + ht.put( SEXO, "Masculino" ); + break; + case 'f': + ht.put( SEXO, "Feminino" ); + break; + } + DateFormat df = DateFormat.getDateInstance( DateFormat.SHORT ); + Date data = ( Date )trabalhador.get( TrabalhadorData.DATA_NASCIMENTO ); + ht.put( DATA_NASCIMENTO, data != null ? df.format( data ) : "" ); + aux = (String)trabalhador.get( TrabalhadorData.NACIONALIDADE ); + ht.put( NACIONALIDADE, aux != null ? aux : "" ); + aux = (String)trabalhador.get( TrabalhadorData.NUMERO_MECANOGRAFICO ); + ht.put( NUMERO_MECANOGRAFICO, aux != null ? aux : "" ); + data = ( Date )trabalhador.get( TrabalhadorData.DATA_ADMISSAO ); + ht.put( DATA_ADMISSAO, data != null ? df.format( data ) : "" ); + aux = (String)trabalhador.get( TrabalhadorData.CATEGORIA ); + ht.put( CATEGORIA, aux != null ? aux : "" ); + aux = (String)trabalhador.get( TrabalhadorData.LOCAL_TRABALHO ); + ht.put( LOCAL_TRABALHO, aux != null ? aux : "" ); + aux = (String)trabalhador.get( TrabalhadorData.FUNCAO_PROPOSTA ); + ht.put( FUNCAO_PROPOSTA, aux != null ? aux : "" ); + data = ( Date )trabalhador.get( TrabalhadorData.DATA_ADMISSAO_FUNCAO ); + ht.put( DATA_ADMISSAO_FUNCAO, data != null ? df.format( data ) : "" ); + aux = (String)trabalhador.get( TrabalhadorData.OBSERVACOES ); + ht.put( OBSERVACOES, aux != null ? aux : "" ); + data = ( Date )exame.get( ExameData.DATA ); + ht.put( EXAMES_DATA, data != null ? df.format( data ) : "" ); + tipo = (Integer)exame.get( ExameData.TIPO ); + ht.put( TIPO_ADMISSAO, SQUARE ); + ht.put( TIPO_PERIODICO, SQUARE ); + ht.put( TIPO_OCASIONAL, SQUARE ); + + ht.put( TIPO_APOS_DOENCA, SQUARE ); + ht.put( TIPO_APOS_ACIDENTE, SQUARE ); + ht.put( TIPO_PEDIDO_TRABALHADOR, SQUARE ); + ht.put( TIPO_PEDIDO_EMPRESA, SQUARE ); + ht.put( TIPO_MUDANCA_FUNCAO, SQUARE ); + ht.put( TIPO_TRABALHO, SQUARE ); + ht.put( TIPO_OUTRO, SQUARE ); + + switch( tipo.intValue() ) + { + case 1: + ht.put( TIPO_ADMISSAO, CHECKED ); + break; + case 2: + ht.put( TIPO_PERIODICO, CHECKED ); + break; + case 3: + ht.put( TIPO_OCASIONAL, CHECKED ); + tipo = (Integer)exame.get( ExameData.OCASIONAL ); + + switch( tipo.intValue() ) + { + case 1: + ht.put( TIPO_APOS_DOENCA, CHECKED ); + break; + case 2: + ht.put( TIPO_APOS_ACIDENTE, CHECKED ); + break; + case 3: + ht.put( TIPO_PEDIDO_TRABALHADOR, CHECKED ); + break; + case 4: + ht.put( TIPO_PEDIDO_EMPRESA, CHECKED ); + break; + case 5: + ht.put( TIPO_MUDANCA_FUNCAO, CHECKED ); + break; + case 6: + ht.put( TIPO_TRABALHO, CHECKED ); + break; + case 10: + ht.put( TIPO_OUTRO, CHECKED ); + break; + } + break; +// case 4: +// aux = (String)exame.get( ExameData.OUTRO_TIPO ); +// ht.put( "tipo_outro", aux != null ? aux : "" ); +// break; + } + aux = (String)exame.get( ExameData.OUTRO_TIPO ); + ht.put( TIPO_OUTRO_TEXTO, aux != null ? aux : "" ); + tipo = (Integer)exame.get( ExameData.RESULTADO ); + ht.put( RESULTADO_APTO, SQUARE ); + ht.put( RESULTADO_APTO_CONDICIONALMENTE, SQUARE ); + ht.put( RESULTADO_INAPTO_TEMP, SQUARE ); + ht.put( RESULTADO_INAPTO_DEF, SQUARE ); + switch( tipo.intValue() ) + { + case 1: + ht.put( RESULTADO_APTO, CHECKED ); + break; + case 2: + ht.put( RESULTADO_APTO_CONDICIONALMENTE, CHECKED ); + break; + case 3: + ht.put( RESULTADO_INAPTO_TEMP, CHECKED ); + break; + case 4: + ht.put( RESULTADO_INAPTO_DEF, CHECKED ); + break; + } + aux = (String)exame.get( ExameData.OUTRA_FUNCAO_1 ); + ht.put( OUTRA_FUNCAO_1, aux != null ? aux : "" ); + aux = (String)exame.get( ExameData.OUTRA_FUNCAO_2 ); + ht.put( OUTRA_FUNCAO_2, aux != null ? aux : "" ); + aux = (String)exame.get( ExameData.OUTRA_FUNCAO_3 ); + ht.put( OUTRA_FUNCAO_3, aux != null ? aux : "" ); + aux = (String)exame.get( ExameData.OUTRA_FUNCAO_4 ); + ht.put( OUTRA_FUNCAO_4, aux != null ? aux : "" ); + aux = (String)exame.get( ExameData.OUTRAS_RECOMENDACOES ); + ht.put( OUTRAS_RECOMENDACOES, aux != null ? aux : "" ); + data = ( Date )exame.get( ExameData.PROXIMO_EXAME ); + ht.put( PROXIMO_EXAME, data != null ? df.format( data ) : "n/d" ); + aux = (String)medico.get( MedicoData.NOME ); + ht.put( MEDICOS_NOME, aux != null ? aux : "" ); + aux = (String)medico.get( MedicoData.NUMERO_CEDULA ); + ht.put( NUMERO_CEDULA, aux != null ? aux : "" ); + return ht; + } + + private void excel() + { + FileDialog fd = new FileDialog( this, "Escolha um ficheiro Excel:", FileDialog.LOAD ); + fd.setDirectory( System.getProperty( "user.home" ) ); + fd.setFilenameFilter( new FilenameFilter() { + public boolean accept( File dir, String name ) + { + return (name!=null) && (name.indexOf( ".xls" ) != -1); + } + } ); + fd.setVisible( true ); + //String filename = "c:\\test.xls"; + String filename = fd.getFile(); + if( filename != null ) + { + filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( this, filename, false, Importer.TYPE_ADMISSAO ); + Hashtable hash = importer.getData(); + if( hash != null ) + { + trabalhadorPanel.setData( hash ); + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( this, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } + + } + + private void printOld() + { + if( trabalhadorID != null ) + { + Vector linhas; + try + { + IDObject fichas[] = fdpProvider.getAllFichasForTrabalhador( trabalhadorID ); + linhas = new Vector( Arrays.asList( fichas ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a criar lista de Fichas anteriores", true ); + return; + } + ListActionDialog dialog = new ListActionDialog( this, "Imprimir Fichas Anteriores", new String[]{ "Data" }, + linhas, this ); + dialog.setSize( 250, 200 ); + dialog.setVisible( true ); + } + } + + public boolean executeListAction( int line, Object value ) + { + if( value != null ) + { + try + { + print( ( ( IDObject )value ).getID() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir Ficha", true ); + return false; + } + } + return true; + } + + public String getListActionName() + { + return "Imprimir"; + } + + private void delete( Integer exameID ) + throws Exception + { +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); + ExameData exame = (ExameData) JDO.load( ExameData.class, exameID ); + if( exame == null ) + { + throw new Exception( "N\u00e3o existe exame" ); + } + if( JOptionPane.showConfirmDialog( this, + "Tem a certeza que quer apagar o exame de " + exame.get( ExameData.DATA ) + "?", + "...", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null ) == 0 ) + { +// exame.set( ExameData.INACTIVO, "y" ); +// exame.save(); + exame.delete(); + } + } + + public void editTrabalhador( Integer trabalhadorID, SaveExameListener listener ) + { +System.out.println( "edit trabalhador: " + trabalhadorID ); + + if( isVisible() ) + { + toFront(); + } + else + { + setVisible( true ); + } + imposedTrabalhadorID = trabalhadorID; + executeAction( NEW_INDEX ); + exameListener = listener; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/MedicoColumnizedObject.java b/tags/teg/SIPRPSoft/src/siprp/ficha/MedicoColumnizedObject.java new file mode 100644 index 00000000..4253604d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/MedicoColumnizedObject.java @@ -0,0 +1,46 @@ +/* + * MedicoColumnizedObject.java + * + * Created on 12 de Abril de 2004, 11:53 + */ + +package siprp.ficha; + +import com.evolute.utils.tables.*; + +/** + * + * @author fpalma + */ +public class MedicoColumnizedObject implements ColumnizedObject +{ + private Integer id; + private String nome; + private String numero; + + /** Creates a new instance of MedicoColumnizedObject */ + public MedicoColumnizedObject( Integer id, String nome, String numero ) + { + this.id = id; + this.nome = nome; + this.numero = numero; + } + + public Object getValue( int col ) + { + switch( col ) + { + case 0: + return nome; + + case 1: + return numero; + } + return null; + } + + public Integer getID() + { + return id; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/MedicoEditor.java b/tags/teg/SIPRPSoft/src/siprp/ficha/MedicoEditor.java new file mode 100644 index 00000000..a6268c29 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/MedicoEditor.java @@ -0,0 +1,270 @@ +/* + * MedicoEditor.java + * + * Created on 10 de Abril de 2004, 20:50 + */ + +package siprp.ficha; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author Administrator + */ +public class MedicoEditor extends CustomJDialog + implements ActionListener, ListSelectionListener +{ + static + { + MedicoData.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, MedicoData.class ); + } + private JDOProvider JDO; + private FichaDataProvider provider; + private BaseTable table; + private VectorTableModel model; + private JButton okButton; + private JButton cancelarButton; + private JButton novoButton; + private JTextField nomeText; + private JTextField numeroText; + private Integer id; + private boolean isNew = false; + + /** Creates a new instance of MedicoEditor */ + public MedicoEditor( JFrame owner ) + throws Exception + { + super( owner, true ); + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + setSize( 600, 300 ); + setResizable( false ); + setTitle( "Criar/Editar M\u00e9dico" ); + centerSuper(); + + model = new VectorTableModel( new String[]{ "Nome", "NC" } ); + table = new BaseTable( model ); + table.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + JScrollPane scp = new JScrollPane(); + scp.setMinimumSize( new Dimension( 300, 200 ) ); + scp.setMaximumSize( new Dimension( 300, 200 ) ); + scp.setPreferredSize( new Dimension( 300, 200 ) ); + scp.setSize( new Dimension( 300, 200 ) ); + scp.setViewportView( table ); + scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + table.fixColumnWidth( 0, 200 ); + table.setNonResizableNorReordable(); + table.getSelectionModel().addListSelectionListener( this ); + Object obj[][] = provider.getAllMedicos(); + Vector medicos = new Vector(); + for( int n = 0; n < obj.length; n++ ) + { + medicos.add( new MedicoColumnizedObject( (Integer)obj[n][0], + (String)obj[n][1], + (String)obj[n][2] ) ); + } + model.setValues( medicos ); + + okButton = new JButton( "OK" ); + cancelarButton = new JButton( "Cancelar" ); + novoButton = new JButton( "Novo" ); + okButton.addActionListener( this ); + cancelarButton.addActionListener( this ); + novoButton.addActionListener( this ); + + nomeText = new JTextField(); + nomeText.setEnabled( false ); + numeroText = new JTextField(); + numeroText.setEnabled( false ); + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JPanel upperPanel = new JPanel(); + upperPanel.setLayout( new GridLayout( 1, 2 ) ); + upperPanel.add( scp ); + JPanel textPanel = new JPanel(); + upperPanel.add( textPanel ); + gridbag.setConstraints( upperPanel, constraints ); + getContentPane().add( upperPanel ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.weightx = 0.3; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER;; + + gridbag.setConstraints( novoButton, constraints ); + getContentPane().add( novoButton ); + + gridbag.setConstraints( okButton, constraints ); + getContentPane().add( okButton ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( cancelarButton, constraints ); + getContentPane().add( cancelarButton ); + + gridbag = new GridBagLayout(); + textPanel.setLayout( gridbag ); + constraints.weighty = 0; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JLabel nomeLabel = new JLabel( "Nome" ); + gridbag.setConstraints( nomeLabel, constraints ); + textPanel.add( nomeLabel ); + + gridbag.setConstraints( nomeText, constraints ); + textPanel.add( nomeText ); + + JLabel numeroLabel = new JLabel( "N\u00famero" ); + gridbag.setConstraints( numeroLabel, constraints ); + textPanel.add( numeroLabel ); + + gridbag.setConstraints( numeroText, constraints ); + textPanel.add( numeroText ); + + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER;; + JPanel pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + textPanel.add( pad ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( numeroText ); + } + + public void actionPerformed( ActionEvent e ) + { + if( e.getSource().equals( okButton ) ) + { + if( save() ) + { + close(); + } + } + else if( e.getSource().equals( cancelarButton ) ) + { + close(); + } + if( e.getSource().equals( novoButton ) ) + { + table.getSelectionModel().removeListSelectionListener( this ); + nomeText.setText( "" ); + numeroText.setText( "" ); + nomeText.setEnabled( true ); + numeroText.setEnabled( true ); + id = null; + isNew = true; + } + } + + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + int selected = table.getSelectedRow(); + if( selected == -1 ) + { + return; + } + MedicoColumnizedObject row = (MedicoColumnizedObject)model.getRowAt( selected ); + id = row.getID(); + String nome = (String) row.getValue( 0 ); + String numero = (String) row.getValue( 1 ); + nomeText.setText( nome ); + numeroText.setText( numero ); + nomeText.setEnabled( true ); + numeroText.setEnabled( true ); + } + + private void close() + { + setVisible( false ); + dispose(); + } + + public boolean getIsNew() + { + return isNew; + } + + public Integer getID() + { + return id; + } + + private boolean save() + { + String nome = nomeText.getText().trim(); + String numero = numeroText.getText().trim(); + if( nome.length() == 0 ) + { + JOptionPane.showMessageDialog( this, "O Nome n\u00e3o pode ser vazio.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return false; + } + try + { + MedicoData medico; + if( id != null ) + { + medico = ( MedicoData ) JDO.load( MedicoData.class, id ); +// medico = provider.load( provider.MEDICOS, new DBKey( id ) ); + } + else + { + medico = new MedicoData(); +// medico = provider.createObject( provider.MEDICOS ); + } +// medico.setProperty( provider.NOME, nome ); +// medico.setProperty( provider.NUMERO_CEDULA, numero ); + medico.set( MedicoData.NOME, nome ); + medico.set( MedicoData.NUMERO_CEDULA, numero ); + medico.save(); + if( id == null ) + { +// DBKey key = medico.getPrimaryKeyValue(); +// DBField fields[] = provider.MEDICOS.getPrimaryKey(); +// id = new Integer( ((Number)key.getFieldValue( fields[ 0 ] )).intValue() ); + id = (Integer)medico.get( MedicoData.ID ); + } + } + catch( Exception ex ) + { +// JOptionPane.showMessageDialog( this, "Erro a gravar...", "Erro...", +// JOptionPane.ERROR_MESSAGE ); + DialogException.showExceptionMessage( ex, "Erro a gravar...", false ); + return false; + } + return true; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/ObservacoesPanel.java b/tags/teg/SIPRPSoft/src/siprp/ficha/ObservacoesPanel.java new file mode 100644 index 00000000..68edd548 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/ObservacoesPanel.java @@ -0,0 +1,101 @@ +/* + * ObservacoesPanel.java + * + * Created on 29 de Marco de 2004, 11:56 + */ + +package siprp.ficha; + +import java.awt.*; +import javax.swing.*; + +import com.evolute.utils.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; +/** + * + * @author fpalma + */ +public class ObservacoesPanel extends JPanel + implements ControllableComponent +{ + private JDOProvider JDO; + + private JTextField observacoesText; + + private FichaDataProvider provider; + + /** Creates a new instance of ObservacoesPanel */ + public ObservacoesPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Observa\u00e7\u00f5es" ) ); + +// JScrollPane scp = new JScrollPane(); +// scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); +// scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + observacoesText = new JTextField(); + observacoesText.setDocument( new MaximumLengthDocument( 150 ) ); +// observacoesText.setLineWrap( true ); +// observacoesText.setWrapStyleWord( true ); +// scp.setViewportView( observacoesText ); + + setLayout( new GridLayout( 1, 1, 0, 0 ) ); + add( observacoesText ); + + new CopyPasteHandler( observacoesText ); + } + + public void fill(Object value) + { + clear(); + Integer trabalhadorID = (Integer)value; + if( trabalhadorID != null ) + { + + try + { + TrabalhadorData trabalhador = (TrabalhadorData)JDO.load( TrabalhadorData.class, trabalhadorID ); + String observacoes = (String) trabalhador.get( TrabalhadorData.OBSERVACOES ); + if( observacoes != null ) + { + observacoesText.setText( observacoes ); + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + } + + public Object save() + { + return observacoesText.getText(); + } + + public void clear() + { + observacoesText.setText( "" ); + } + + public void setEnabled( boolean enable ) + { + observacoesText.setEnabled( enable ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/RecomendacoesPanel.java b/tags/teg/SIPRPSoft/src/siprp/ficha/RecomendacoesPanel.java new file mode 100644 index 00000000..7d74be41 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/RecomendacoesPanel.java @@ -0,0 +1,59 @@ +/* + * RecomendacoesPanel.java + * + * Created on 29 de Marco de 2004, 11:58 + */ + +package siprp.ficha; + +import java.awt.*; +import javax.swing.*; + +import com.evolute.utils.documents.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.text.*; + +/** + * + * @author fpalma + */ +public class RecomendacoesPanel extends JPanel +{ + private JTextArea recomendacoesText; + private JCalendarPanel proximoExamePanel; + /** Creates a new instance of RecomendacoesPanel */ + public RecomendacoesPanel() + { + setupComponents(); + } + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Outras Recomenda\u00e7\u00f5es" ) ); + + JScrollPane scp = new JScrollPane(); + scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + recomendacoesText = new JTextArea(); + recomendacoesText.setLineWrap( true ); + recomendacoesText.setWrapStyleWord( true ); + recomendacoesText.setDocument( new MaximumLengthDocument( 150 ) ); + scp.setViewportView( recomendacoesText ); + JPanel rightPanel = new JPanel(); + JLabel proximoExameLabel = new JLabel( "Pr\u00f3ximo Exame" ); + proximoExamePanel = new JCalendarPanel( null ); + + setLayout( new GridLayout( 1, 2, 0, 0 ) ); + add( scp ); + add( rightPanel ); + + rightPanel.setLayout( new BorderLayout() ); + rightPanel.add( proximoExameLabel, BorderLayout.WEST ); + rightPanel.add( proximoExamePanel, BorderLayout.CENTER ); + + new CopyPasteHandler( recomendacoesText ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/SaveExameListener.java b/tags/teg/SIPRPSoft/src/siprp/ficha/SaveExameListener.java new file mode 100644 index 00000000..ccb16da8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/SaveExameListener.java @@ -0,0 +1,19 @@ +/* + * SaveExameListener.java + * + * Created on May 17, 2007, 12:33 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.ficha; + +/** + * + * @author lflores + */ +public interface SaveExameListener +{ + public void exameSaved( Integer trabalhadorID, Integer exameID ); +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java b/tags/teg/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java new file mode 100644 index 00000000..c44cbc9d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java @@ -0,0 +1,477 @@ +/* + * TrabalhadorPanel.java + * + * Created on 29 de Marco de 2004, 11:55 + */ + +package siprp.ficha; + +import java.awt.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.date.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; +import siprp.importer.*; +/** + * + * @author fpalma + */ +public class TrabalhadorPanel extends JPanel + implements ControllableComponent +{ + private JDOProvider JDO; + private JTextField nomeText; + private RadioButtonFixedPanel sexoPanel; + private JCalendarPanel dataNascimentoPanel; + private JTextField nacionalidadeText; + private JTextField numeroMecanograficoText; + private JCalendarPanel dataAdmissaoPanel; + private JTextField categoriaText; + private JTextField localText; + private JTextField funcaoText; + private JCalendarPanel dataAdmissaoFuncaoPanel; + + private ComponentsHashtable components; + private FichaDataProvider provider; + private TrabalhadorData trabalhador; + + /** Creates a new instance of TrabalhadorPanel */ + + public TrabalhadorPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + setupComponentsHashtable(); + } + + + private void setupComponents() + { + setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), + "Trabalhador" ) ); + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + JLabel sexoLabel = new JLabel( "Sexo" ); + sexoPanel = + new RadioButtonFixedPanel( + new IDObject[]{ new MappableObject( new Integer( 1 ), "M" ), + new MappableObject( new Integer( 2 ), "F" ) }, + 1, 2, RadioButtonPanel.ORIENTATION_HORIZONTAL, false ); + JLabel dataNascimentoLabel = new JLabel( "Data de Nascimento" ); + dataNascimentoPanel = new JCalendarPanel( null ); + JLabel nacionalidadeLabel = new JLabel( "Nacionalidade" ); + nacionalidadeText = new JTextField(); + JLabel numeroMecanograficoLabel = new JLabel( "N\u00famero Mecanogr\u00e1fico/outro" ); + numeroMecanograficoText = new JTextField(); + JLabel dataAdmissaoLabel = new JLabel( "Data de Admiss\u00e3o" ); + dataAdmissaoPanel = new JCalendarPanel( null ); + JLabel categoriaLabel = new JLabel( "Categoria Profissional" ); + categoriaText = new JTextField(); + JLabel localLabel = new JLabel( "Local de Trabalho" ); + localText = new JTextField(); + JLabel funcaoLabel = new JLabel( "Fun\u00e7\u00e3o proposta" ); + funcaoText = new JTextField(); + JLabel dataAdmissaoFuncaoLabel = new JLabel( "Data de Admiss\u00e3o na Fun\u00e7\u00e3o" ); + dataAdmissaoFuncaoPanel = new JCalendarPanel( null ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.gridwidth = 1; + constraints.weightx = 0; + + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + constraints.weightx = 1; + constraints.gridwidth = 3; + gridbag.setConstraints( nomeText, constraints ); + add( nomeText ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( sexoLabel, constraints ); + add( sexoLabel ); + + constraints.weightx = 0; + //constraints.gridwidth = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( sexoPanel, constraints ); + add( sexoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( nacionalidadeLabel, constraints ); + add( nacionalidadeLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( nacionalidadeText, constraints ); + add( nacionalidadeText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataNascimentoLabel, constraints ); + add( dataNascimentoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataNascimentoPanel, constraints ); + add( dataNascimentoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( numeroMecanograficoLabel, constraints ); + add( numeroMecanograficoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( numeroMecanograficoText, constraints ); + add( numeroMecanograficoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataAdmissaoLabel, constraints ); + add( dataAdmissaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataAdmissaoPanel, constraints ); + add( dataAdmissaoPanel ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( categoriaLabel, constraints ); + add( categoriaLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( categoriaText, constraints ); + add( categoriaText ); + + constraints.weightx = 0; + gridbag.setConstraints( localLabel, constraints ); + add( localLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( localText, constraints ); + add( localText ); + + constraints.weightx = 0; + constraints.gridwidth = 2; + gridbag.setConstraints( funcaoLabel, constraints ); + add( funcaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( funcaoText, constraints ); + add( funcaoText ); + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( dataAdmissaoFuncaoLabel, constraints ); + add( dataAdmissaoFuncaoLabel ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( dataAdmissaoFuncaoPanel, constraints ); + add( dataAdmissaoFuncaoPanel ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( nacionalidadeText ); + new CopyPasteHandler( numeroMecanograficoText ); + new CopyPasteHandler( categoriaText ); + new CopyPasteHandler( localText ); + new CopyPasteHandler( funcaoText ); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( TrabalhadorData.NOME, nomeText ); + components.putComponent( TrabalhadorData.SEXO, new ControllableComponent() + { + public void fill( Object value ) + { + if( value != null && value.equals( "f" ) ) + { + sexoPanel.fill( new Integer(2) ); + } + else + { + sexoPanel.fill( new Integer(1) ); + } + } + + public Object save() + { + Integer id = (Integer)sexoPanel.save(); + if( id != null && id.intValue() == 1 ) + { + return "m"; + } + return "f"; + } + + public void clear() + { + sexoPanel.clear(); + } + + public void setEnabled( boolean enable ) + { + sexoPanel.setEnabled( enable ); + } + } ); + components.putComponent( TrabalhadorData.DATA_NASCIMENTO, dataNascimentoPanel ); + components.putComponent( TrabalhadorData.NACIONALIDADE, nacionalidadeText ); + components.putComponent( TrabalhadorData.NUMERO_MECANOGRAFICO, numeroMecanograficoText ); + components.putComponent( TrabalhadorData.DATA_ADMISSAO, dataAdmissaoPanel ); + components.putComponent( TrabalhadorData.CATEGORIA, categoriaText ); + components.putComponent( TrabalhadorData.LOCAL_TRABALHO, localText ); + components.putComponent( TrabalhadorData.FUNCAO_PROPOSTA, funcaoText ); + components.putComponent( TrabalhadorData.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel ); + components.putDummy( TrabalhadorData.DATA_DEMISSAO ); + components.putDummy( TrabalhadorData.OBSERVACOES ); + components.putDummy( TrabalhadorData.OBSERVACOES_GESTAO ); + components.putDummy( TrabalhadorData.PERFIL ); + components.putDummy( TrabalhadorData.ESTABELECIMENTO ); + components.putDummy( TrabalhadorData.NOME_PLAIN ); + +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NOME, nomeText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_NASCIMENTO, dataNascimentoPanel ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NACIONALIDADE, nacionalidadeText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.NUMERO_MECANOGRAFICO, numeroMecanograficoText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_ADMISSAO, dataAdmissaoPanel ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.CATEGORIA, categoriaText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.LOCAL_TRABALHO, localText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.FUNCAO_PROPOSTA, funcaoText ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.DATA_ADMISSAO_FUNCAO, dataAdmissaoFuncaoPanel ); +// components.putDummy( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.ESTABELECIMENTO_ID ); +// components.putDummy( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.OBSERVACOES ); +// components.putComponent( FichaDataProvider.T_TRABALHADORES + "." + FichaDataProvider.SEXO, +// new ControllableComponent() +// { +// public void fill( Object value ) +// { +// if( value != null && value.equals( "f" ) ) +// { +// sexoPanel.fill( new Integer(2) ); +// } +// else +// { +// sexoPanel.fill( new Integer(1) ); +// } +// } +// +// public Object save() +// { +// Integer id = (Integer)sexoPanel.save(); +// if( id != null && id.intValue() == 1 ) +// { +// return "m"; +// } +// return "f"; +// } +// +// public void clear() +// { +// sexoPanel.clear(); +// } +// +// public void setEnabled( boolean enable ) +// { +// sexoPanel.setEnabled( enable ); +// } +// } ); + } + + public void fill(Object value) + { + clear(); + trabalhador = null; + if( value != null ) + { + Integer trabalhadorID = (Integer)value; + if( trabalhadorID != null ) + { + try + { + trabalhador = ( TrabalhadorData ) JDO.load( TrabalhadorData.class, trabalhadorID ); + String names[] = trabalhador.getFieldNames(); + ComponentController.fill( names, trabalhador.getHashData(), components ); +// trabalhador = provider.load( FichaDataProvider.TRABALHADORES, new DBKey( trabalhadorID ) ); +// DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); +// String trabalhadorFields[] = new String[ fields.length ]; +// Hashtable data = new Hashtable(); +// for( int i = 0; i < trabalhadorFields.length; ++i ) +// { +// trabalhadorFields[ i ] = fields[ i ].FULL_NAME; +// Object fieldValue = trabalhador.getProperty( trabalhadorFields[ i ] ); +// if( fieldValue != null ) +// { +// data.put( trabalhadorFields[ i ], fieldValue ); +// } +// } +// ComponentController.fill( trabalhadorFields, data, components ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados do trabalhador", true ); + } + } + } + + } + + public Object save() + { + StringBuffer msg = new StringBuffer(); + boolean hasMsg = false; + try + { + if( trabalhador == null ) + { +// trabalhador = provider.createObject( FichaDataProvider.TRABALHADORES ); + trabalhador = new TrabalhadorData(); + trabalhador.set( TrabalhadorData.PERFIL, new Integer( 1 ) ); + } +// DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); +// String trabalhadorFields[] = new String[ fields.length ]; +// for( int i = 0; i < trabalhadorFields.length; ++i ) +// { +// trabalhadorFields[ i ] = fields[ i ].FULL_NAME; +// } +// Hashtable hash = new Hashtable(); +// ComponentController.save( trabalhadorFields, hash, components ); +// Enumeration enum = hash.keys(); +// while( enum.hasMoreElements() ) +// { +// String name = ( String )enum.nextElement(); +// trabalhador.setProperty( name, hash.get( name ) ); +// } + String names[] = trabalhador.getFieldNames(); + Hashtable hash = trabalhador.getHashData(); + ComponentController.save( names, hash, components ); + trabalhador.setHashData( hash ); +// if( ((String)trabalhador.getProperty( FichaDataProvider.NOME )).trim().length() == 0 ) + if( ((String)trabalhador.get( TrabalhadorData.NOME )).trim().length() == 0 ) + { + msg.append( "O trabalhador tem de ter nome\n" ); + hasMsg = true; + } +// if( trabalhador.getProperty( FichaDataProvider.SEXO ) == null ) + if( trabalhador.get( TrabalhadorData.SEXO ) == null ) + { + msg.append( "O trabalhador tem de ter um sexo definido\n" ); + hasMsg = true; + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + return null; + } + if( hasMsg ) + { + throw new ValuesException( msg.toString() ); + } + return trabalhador; + } + + public void clear() + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + trabalhador = null; + } + + public void setEnabled( boolean enable ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + } + + public void setData( Hashtable data ) + { + String nome = (String)data.get( Importer.NOME ); + if( nome != null && nome.trim().length() > 0 ) + { + nomeText.setText( nome ); + } + String sexo = (String)data.get( Importer.SEXO ); + if( sexo != null && sexo.trim().length() > 0 ) + { + Integer sexoInt; + if( sexo.trim().toLowerCase().charAt(0) == 'f' ) + { + sexoInt = new Integer( 2 ); + } + else + { + sexoInt = new Integer( 1 ); + } + sexoPanel.fill( sexoInt ); + } + String nacionalidade = (String)data.get( Importer.NACIONALIDADE ); + if( nacionalidade != null && nacionalidade.trim().length() > 0 ) + { + nacionalidadeText.setText( nacionalidade ); + } + String dataNascimento = (String)data.get( Importer.DATA_NASCIMENTO ); + if( dataNascimento != null ) + { + dataNascimentoPanel.setDate( DateUtils.guessDate( dataNascimento ) ); + } + String numeroMecanografico = (String)data.get( Importer.NUMERO_MECANOGRAFICO ); + if( numeroMecanografico != null && numeroMecanografico.trim().length() > 0 ) + { + numeroMecanograficoText.setText( numeroMecanografico ); + } + String dataAdmissao = (String)data.get( Importer.DATA_ADMISSAO ); + if( dataAdmissao != null ) + { + dataAdmissaoPanel.setDate( DateUtils.guessDate( dataAdmissao ) ); + } + String categoria = (String)data.get( Importer.CATEGORIA ); + if( categoria != null && categoria.trim().length() > 0 ) + { + categoriaText.setText( categoria ); + } + String localTrabalho = (String)data.get( Importer.LOCAL_TRABALHO ); + if( localTrabalho != null && localTrabalho.trim().length() > 0 ) + { + localText.setText( localTrabalho ); + } + String funcao = (String)data.get( Importer.FUNCAO ); + if( funcao != null && funcao.trim().length() > 0 ) + { + funcaoText.setText( funcao ); + } + String dataAdmissaoFuncao = (String)data.get( Importer.DATA_ADMISSAO_FUNCAO ); + if( dataAdmissaoFuncao != null ) + { + dataAdmissaoFuncaoPanel.setDate( DateUtils.guessDate( dataAdmissaoFuncao ) ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/UpperPanel.java b/tags/teg/SIPRPSoft/src/siprp/ficha/UpperPanel.java new file mode 100644 index 00000000..23b2d7d9 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/UpperPanel.java @@ -0,0 +1,294 @@ +/* + * UpperPanel.java + * + * Created on 29 de Marco de 2004, 17:44 + */ + +package siprp.ficha; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class UpperPanel extends JPanel + implements ControllableComponent, ItemListener +{ + protected JDOProvider JDO; + + protected JFrame owner; + private JTextField empresaText; + private JTextField nomeText; + private JComboBox medicosCombo; + private JTextField cpText; + + private FichaDataProvider provider; + private Hashtable medicosHash; + + /** Creates a new instance of UpperPanel */ + public UpperPanel() + throws Exception + { + provider = (FichaDataProvider)FichaDataProvider.getProvider(); + medicosHash = new Hashtable(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + JLabel empresaLabel = new JLabel( "Empresa/Entidade" ); + empresaText = new JTextField(); + empresaText.setEditable( false ); + JLabel nomeLabel = new JLabel( "Nome" ); + nomeText = new JTextField(); + nomeText.setEditable( false ); + JLabel medicoLabel = new JLabel( "M\u00e9dico" ); + medicosCombo = new JComboBox(); + JLabel cpLabel = new JLabel( "c.p." ); + cpText = new JTextField(); + cpText.setEditable( false ); + fillCombo(); + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 1, 0, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( empresaLabel, constraints ); + add( empresaLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( empresaText, constraints ); + add( empresaText ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + gridbag.setConstraints( nomeText, constraints ); + add( nomeText ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( medicoLabel, constraints ); + add( medicoLabel ); + + constraints.gridwidth = 1; + constraints.weightx = 0.8; + gridbag.setConstraints( medicosCombo, constraints ); + add( medicosCombo ); + + constraints.gridwidth = 1; + constraints.weightx = 0; + gridbag.setConstraints( cpLabel, constraints ); + add( cpLabel ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 0.2; + gridbag.setConstraints( cpText, constraints ); + add( cpText ); + + new CopyPasteHandler( empresaText ); + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( cpText ); + } + + public void fill(Object value) + { + Integer values[] = (Integer[])value; + Integer empresaID = values[0]; + Integer estabelecimentoID = values[1]; + Integer trabalhadorID = values[2]; + clear(); + try + { + TrabalhadorData trabalhador; + EstabelecimentoData estabelecimento; + EmpresaData empresa; + if( trabalhadorID != null ) + { + trabalhador = ( TrabalhadorData ) JDO.load( TrabalhadorData.class, trabalhadorID ); + String nome = (String) trabalhador.get( TrabalhadorData.NOME ); + nomeText.setText( nome ); + } + String nomeEstabelecimento = ""; + if( estabelecimentoID != null ) + { + estabelecimento = ( EstabelecimentoData ) JDO.load( EstabelecimentoData.class, estabelecimentoID ); + nomeEstabelecimento = (String) estabelecimento.get( EstabelecimentoData.NOME ); + try + { + Integer medicoID = provider.getMedicoForEstabelecimento( estabelecimentoID ); + if( medicoID != null && medicoID.intValue() > -1 ) + { + for( int n = 0; n < medicosCombo.getItemCount(); n++ ) + { + IDObject medico = ( IDObject ) medicosCombo.getItemAt( n ); + if( medico.getID().equals( medicoID ) ) + { + medicosCombo.setSelectedIndex( n ); + break; + } + } + } + } + catch( Exception ex ) + { + } + } + if( empresaID != null ) + { + empresa = ( EmpresaData ) JDO.load( EmpresaData.class, empresaID ); + String nomeEmpresa = (String) empresa.get( EmpresaData.DESIGNACAO_SOCIAL ); + empresaText.setText( nomeEmpresa + ( nomeEstabelecimento.length() > 0?" / " + nomeEstabelecimento:"" ) ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados do cabe\u00e7alho...", true ); + } + } + + public Object save() + { + Integer id = ( (IDObject) medicosCombo.getSelectedItem() ).getID(); + if( id != null ) + { + try + { + MedicoData medico = ( MedicoData )JDO.load( MedicoData.class, id ); + return medico; + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + else + { + throw new ValuesException( "A ficha tem de ter um m\u00e9dico associado" ); + } + return null; + } + + public void fillCombo() + throws Exception + { + medicosCombo.removeItemListener( this ); + medicosCombo.removeAllItems(); + medicosHash.clear(); + Object medicos[][] = provider.getAllMedicos(); + for( int n = 0; n < medicos.length; n++ ) + { + Object medico[] = new Object[ 4 ]; + medico[ 0 ] = new Integer( ( (Number)medicos[n][0] ).intValue() ); + medico[ 1 ] = medicos[ n ][ 1 ]; + medico[ 2 ] = medicos[ n ][ 2 ]; + medico[ 3 ] = new Integer( n ); + medicosHash.put( medicos[ n ][ 0 ], medico ); + medicosCombo.addItem( new MappableObject( (Integer) medico[ 0 ], medico[ 1 ] ) ); + } + + if( medicos.length > 0 ) + { + medicosCombo.setSelectedIndex( 0 ); + cpText.setText( medicos[ 0 ][ 2 ] != null?(String)medicos[ 0 ][ 2 ]:"" ); + } + else + { + medicosCombo.addItem( new MappableObject( null, "" ) ); + medicosCombo.setSelectedIndex( 0 ); + cpText.setText( "" ); + } + medicosCombo.addItem( new MappableObject( new Integer( -1 ), "Novo/Editar" ) ); + medicosCombo.addItemListener( this ); + } + + public void itemStateChanged(java.awt.event.ItemEvent itemEvent) + { + int index = medicosCombo.getSelectedIndex(); + if( index == medicosCombo.getItemCount() - 1 ) + { + try + { + MedicoEditor me = new MedicoEditor( owner ); + me.show(); +// boolean isNew = me.getIsNew(); + Integer id = me.getID(); + if( id == null ) + { + medicosCombo.setSelectedIndex( 0 ); + } + else + { + fillCombo(); + if( id != null ) + { + Object[] medico = (Object[])medicosHash.get( id ); + medicosCombo.setSelectedIndex( ((Integer)medico[ 3 ] ).intValue() ); + } + } + + } + catch( Exception ex ) + { + JOptionPane.showMessageDialog( null, "Erro a abrir a janela de edi\u00e7\u00e3o...", "Erro...", + JOptionPane.ERROR_MESSAGE ); + ex.printStackTrace(); + medicosCombo.setSelectedIndex( 0 ); + return; + } + } + else + { + IDObject selected = (IDObject)medicosCombo.getItemAt( index ); + Integer id = selected.getID(); + if( id == null ) + { + cpText.setText( "" ); + } + else + { + Object[] medico = (Object[])medicosHash.get( id ); + cpText.setText( medico[ 2 ] != null?(String)medico[ 2 ]:"" ); + } + } + } + + public void clear() + { + empresaText.setText( "" ); + nomeText.setText( "" ); + medicosCombo.setSelectedIndex( 0 ); + } + + public void setEnabled( boolean enable ) + { + medicosCombo.setEnabled( enable ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/ValuesException.java b/tags/teg/SIPRPSoft/src/siprp/ficha/ValuesException.java new file mode 100644 index 00000000..e5a14882 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/ValuesException.java @@ -0,0 +1,22 @@ +/* + * ValuesException.java + * + * Created on 5 de Abril de 2004, 20:22 + */ + +package siprp.ficha; + +/** + * + * @author fpalma + */ +public class ValuesException extends RuntimeException +{ + + /** Creates a new instance of ValuesException */ + public ValuesException( String msg ) + { + super( msg ); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/ficha_aptidao.xsl b/tags/teg/SIPRPSoft/src/siprp/ficha/ficha_aptidao.xsl new file mode 100644 index 00000000..8a3644de --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/ficha_aptidao.xsl @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + FICHA DE APTIDÃO + + + () + + + + + + + + + + Empresa/Entidade + + + + + + +DESIGNAÇÃO SOCIAL: + + + + + + +ESTABELECIMENTO: + + + + +LOCALIDADE: + + + + + + +SERVIÇO DE SAÚDE: Tipo +      Interno +      Interempresas +      Externo +      Serviço Nacional de Saúde + + +DESIGNAÇÃO: + + +SERVIÇO DE HIGIENE E SEGURANÇA: Tipo +      Interno +      Interempresas +      Externo +      Outro + + +DESIGNAÇÃO: + + + + + + + + + + + + + + + + + + Trabalhador + + + + + + +NOME: + + + + + + +SEXO: + + + + +DATA DE NASCIMENTO: + + + + +NACIONALIDADE: + + + + + + +NÚMERO MECANOGRÁFICO/OUTRO: + + +CATEGORIA PROFISSIONAL: + + +FUNCAO PROPOSTA: + + + + +DATA DE ADMISSÃO: + + +LOCAL DE TRABALHO: + + +DATA DE ADMISSÃO NA FUNÇÃO: + + + + + + + + + + + + + Observações + + + + + + + + + + + + + + + + + + + Exame Médico + + + + + + +DATA DO EXAME: + + +TIPO + + + ADMISSÃO + + + PERIÓDICO + + + OCASIONAL + + + APÓS DOENCA + + + APÓS ACIDENTE + + + A PEDIDO DO TRABALHADOR + + + A PEDIDO DO SERVIÇO + + + POR MUDANCA DE FUNÇÃO + + + POR ALTERAÇÃO DAS CONDIÇÕES DE TRABALHO + + + OUTRO + + +ESPECIFIQUE: + + + + +RESULTADO + + + APTO + + + APTO CONDICIONALMENTE + + +   + + + INAPTO TEMPORARIAMENTE + + + INAPTO DEFINITIVAMENTE + + +   + + +OUTRAS FUNÇÕES QUE PODE DESEMPENHAR + + + 1 + + + 2 + + + 3 + + + 4 + + +   + + + + + + + + + + + + + Outras Recomendações + + + + + + + + + +PRÓXIMO EXAME: + + + + + + + + + + + + +MÉDICO DO TRABALHO: + + + + +C.P. + + + + + + +ASSINATURA _____________________________________________________________________________________________ + + +TOMEI CONHECIMENTO ___________________________________________________________________ DATA: ___/___/______ + + + O RESPONSÁVEL DOS RECURSOS HUMANOS + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_square_pure.svg b/tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_square_pure.svg new file mode 100644 index 00000000..6c17f710 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_square_pure.svg @@ -0,0 +1,24 @@ + + + + + + ☠+ + diff --git a/tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_tick_pure.svg b/tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_tick_pure.svg new file mode 100644 index 00000000..e5e1b808 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/ficha/svg/char_tick_pure.svg @@ -0,0 +1,24 @@ + + + + + + ☑ + + diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java new file mode 100644 index 00000000..60b2074b --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java @@ -0,0 +1,255 @@ +/* + * HigieneDataProvider.java + * + * Created on February 1, 2006, 10:49 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene; + +import java.awt.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; +import com.evolute.utils.tables.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class HigieneDataProvider extends MetaProvider +{ + public static final int ESTADO_POR_REALIZAR = 0; + public static final int ESTADO_REALIZADO = 2; + public static final int ESTADO_DESMARCADO_TRABALHADOR = 3; + public static final int ESTADO_DESMARCADO_EMPRESA = 4; + public static final int ESTADO_FALTOU = 5; + + public static final String ESTADOS_STR[] = + new String[]{ "Por realizar", "", "Realizada", + "Desmarcada empresa", + "Desmarcada " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), + "Faltou" }; + + public static final Color CORES_TECNICOS[] = + new Color[]{ Color.white, Color.red.darker(), Color.blue, + Color.green.darker(), Color.yellow.darker(), + Color.gray, Color.pink.darker() }; + + private static final Object LOCK = new Object(); + private static HigieneDataProvider instance = null; + private final Executer executer; + + /** Creates a new instance of HigieneDataProvider */ + public HigieneDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new HigieneDataProvider(); + } + } + return instance; + } + + public Object[][] getAllTecnicosHST() + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_tecnicos_hst" }, + new String[]{ "id", "nome", "iniciais", "identificador", "nome_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public ColumnizedMappable[] getAllEmpresas() + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "empresa_id" ).isEqual( empresaID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + return estabelecimentos; + } + + public String getEmpresa( Integer empresaID ) + throws Exception + { + String nomes[] = new String[ 2 ]; + Select select = new Select( new String[]{ "empresas" }, + new String[]{ "designacao_social" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( String ) array.get( 0, 0 ); + } + + public Object[][] getVisitasEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "id", "data", "estado" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ), + new String[]{ "data desc" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = array.getObjects(); + for( int n = 0; n < data.length; n++ ) + { + int estado = ( ( Integer ) data[ n ][ 2 ] ).intValue(); + data[ n ][ 2 ] = ESTADOS_STR[ estado ]; + } + return data; + } + + public Vector[][] getMapaAnual( Integer ano ) + throws Exception + { + String deleted = "__DELETED__"; + Select select = + new Select( new String[]{ "marcacoes_tecnicos_hst" }, + new String[]{ "id", "nome", "iniciais", "identificador", "nome_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object tecnicosArr[][] = array.getObjects(); + Hashtable tecnicos = new Hashtable(); + for( int n = 0; n < tecnicosArr.length; n++ ) + { + tecnicos.put( tecnicosArr[ n ][ 0 ], tecnicosArr[ n ] ); + } + Hashtable empresas = new Hashtable(); + Hashtable estabelecimentos = new Hashtable(); + Hashtable empresasEstabelecimentos = new Hashtable(); + Vector data[][] = new Vector[ 31 ][ 12 ]; + select = new Select( new String[]{ "marcacoes_estabelecimento" }, + new String[]{ "data", "estabelecimento_id", "tecnico_hst" }, + new Field( "data" ).between( new Object[]{ ano + "-01-01", ano + "-12-31" } ).and( + new Field( "estado" ).in( new Integer[]{ new Integer( 0 ), new Integer( 2 ) } ) ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Date dataVisita = ( Date ) array.get( n, 0 ); + Integer estabelecimentoID = ( Integer ) array.get( n, 1 ); + Integer tecnicoID = ( Integer ) array.get( n, 2 ); + Integer empresaID = null; + if( !estabelecimentos.containsKey( estabelecimentoID ) ) + { + Select estabelecimentoSelect = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "nome", "empresa_id", "inactivo" }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + Virtual2DArray estabelecimentoArray = executer.executeQuery( estabelecimentoSelect ); + if( "y".equals( estabelecimentoArray.get( 0, 2 ) ) ) + { + estabelecimentos.put( estabelecimentoID, deleted ); + } + else + { + estabelecimentos.put( estabelecimentoID, estabelecimentoArray.get( 0, 0 ) ); + } + empresaID = ( Integer ) estabelecimentoArray.get( 0, 1 ); + empresasEstabelecimentos.put( estabelecimentoID, empresaID ); + if( !empresas.containsKey( empresaID ) ) + { + Select empresaSelect = + new Select( new String[]{ "empresas" }, + new String[]{ "designacao_social", "inactivo" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray empresaArray = executer.executeQuery( empresaSelect ); + if( "y".equals( empresaArray.get( 0, 1 ) ) ) + { + empresas.put( empresaID, deleted ); + } + else + { + empresas.put( empresaID, empresaArray.get( 0, 0 ) ); + } + } + } + String nomeEstabelecimento = ( String ) estabelecimentos.get( estabelecimentoID ); + empresaID = ( Integer ) empresasEstabelecimentos.get( estabelecimentoID ); + String nomeEmpresa = ( String ) empresas.get( empresaID ); + String nomeTecnico = " "; + Integer indiceCor = null; + Color cor = null; + if( tecnicoID != null ) + { + Object tecnico[] = ( Object[] ) tecnicos.get( tecnicoID ); + nomeTecnico = ( String ) tecnico[ 1 ]; + indiceCor = ( Integer ) tecnico[ 3 ]; + cor = CORES_TECNICOS[ indiceCor.intValue() ]; + } + Calendar cal = Calendar.getInstance(); + cal.setTime( dataVisita ); + int dia = cal.get( Calendar.DAY_OF_MONTH ) - 1; + int mes = cal.get( Calendar.MONTH ); + if( data[ dia ][ mes ] == null ) + { + data[ dia ][ mes ] = new Vector(); + data[ dia ][ mes ].add( new Object[]{ new Integer( dia + 1 ) } ); + } + if( nomeEmpresa != deleted && nomeEstabelecimento != deleted ) + { + data[ dia ][ mes ].add( new Object[]{ nomeEmpresa, nomeEstabelecimento, nomeTecnico, cor } ); + } + } + + return data; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/alter2.sql b/tags/teg/SIPRPSoft/src/siprp/higiene/alter2.sql new file mode 100644 index 00000000..6166400d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/alter2.sql @@ -0,0 +1,18 @@ + +CREATE TABLE marcacoes_tecnicos_hst +( + id int4 NOT NULL, + nome varchar(255) NOT NULL, + nome_plain varchar(255) NOT NULL, + iniciais varchar(10) NOT NULL, + identificador int4, + inactivo char(1) DEFAULT 'n' NOT NULL, + CONSTRAINT marcacoes_tecnicos_hst_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE marcacoes_tecnicos_hst OWNER TO postgres; + +ALTER TABLE marcacoes_estabelecimento ADD estado INT; +ALTER TABLE marcacoes_estabelecimento ADD tecnico_hst INT REFERENCES marcacoes_tecnicos_hst(id); +ALTER TABLE marcacoes_estabelecimento ADD observacoes VARCHAR( 2048 ); +UPDATE marcacoes_estabelecimento SET estado = 2 WHERE realizada = 'y'; \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java new file mode 100644 index 00000000..7eb4a647 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java @@ -0,0 +1,62 @@ +/* + * DiaLine.java + * + * Created on 8 de Fevereiro de 2006, 22:43 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.util.*; + +import com.evolute.utils.tables.*; + +/** + * + * @author Frederico + */ +public class DiaLine implements ColumnizedObjectForUpdate +{ + protected Integer day; + protected Vector data[]; + + /** Creates a new instance of DiaLine */ + public DiaLine( int day, Vector data[] ) + { + this.day = new Integer( day ); + this.data = data; + } + + public Object getValue( int col ) + { + switch( col ) + { + case 0: + return day; + + default: + return data[ col - 1 ].toArray( new Object[ 0 ][] ); + } + } + + public int[] getUpdateableColumns() + { + return new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; + } + + public void setValueAt( Object value, int col ) + { +// data[ col - 1 ].clear(); + if( value != null && value instanceof Vector ) + { + data[ col - 1 ].addAll( ( Vector ) value ); + } + } + + public void clear( int col ) + { + data[ col - 1 ].clear(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java new file mode 100644 index 00000000..05c508b4 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java @@ -0,0 +1,101 @@ +/* + * DiaPanel.java + * + * Created on February 1, 2006, 6:42 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +import com.evolute.utils.dataui.*; +/** + * + * @author fpalma + */ +public class DiaPanel extends JPanel + implements ControllableComponent, ActionListener +{ + protected Object data[][]; + protected JButton buttons[]; + + /** Creates a new instance of DiaPanel */ + public DiaPanel() + { + } + + private void setupComponents() + { + } + + public void setEnabled( boolean enable ) + { + } + + public void fill( Object value ) + { + removeAll(); + Object arr[][] = ( Object[][] ) value; + data = arr; + buttons = new JButton[ arr.length ]; + if( arr.length > 0 ) + { + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 0, 0, 0, 0 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weighty = 0; + constraints.gridheight = 1; + Integer dia = ( Integer ) arr[ 0 ][ 0 ]; + JLabel diaLabel = new JLabel( dia.toString(), JLabel.LEFT ); + gridbag.setConstraints( diaLabel, constraints ); + add( diaLabel ); + for( int n = 1; n < arr.length; n++ ) + { + String empresa = ( String ) arr[ n ][ 0 ]; + String estabelecimento = ( String ) arr[ n ][ 1 ]; + String tecnico = ( String ) arr[ n ][ 2 ]; + Color cor = ( Color ) arr[ n ][ 3 ]; + String empresaR = empresa.length() > 10 ? empresa.substring( 0, 10 ) : empresa; + String estabelecimentoR = estabelecimento.length() > 10 ? estabelecimento.substring( 0, 10 ) : estabelecimento; + buttons[ n ] = new JButton( "" + empresaR + "
" + estabelecimentoR + "
" ); + buttons[ n ].setMargin( new Insets( 2, 1, 2, 1 ) ); + buttons[ n ].setBackground( cor ); + buttons[ n ].setToolTipText( "T\u00e9cnico: " + ( tecnico != null ? tecnico : "n.d." ) + + " \nEmpresa: " + empresa + " \nEstabelecimento: " + estabelecimento ); + gridbag.setConstraints( buttons[ n ], constraints ); + add( buttons[ n ] ); + buttons[ n ].addActionListener( this ); + } + JPanel pad = new JPanel(); + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( pad, constraints ); + add( pad ); + } + + } + + public Object save() + { + return data; + } + + public void clear() + { + } + + public void actionPerformed( ActionEvent e ) + { + JButton source = ( JButton ) e.getSource(); + JOptionPane.showMessageDialog( source, source.getToolTipText(), "", JOptionPane.PLAIN_MESSAGE ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java new file mode 100644 index 00000000..40dc967e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java @@ -0,0 +1,65 @@ +/* + * DiaRenderer.java + * + * Created on 8 de Fevereiro de 2006, 21:45 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.awt.*; +import javax.swing.*; +import javax.swing.table.*; +import java.util.*; +/** + * + * @author Frederico + */ +public class DiaRenderer extends DefaultCellEditor + implements TableCellRenderer +{ + protected JLabel diaLabel; + protected DiaPanel diaPanel; + + /** Creates a new instance of DiaRenderer */ + public DiaRenderer() + { + super( new JCheckBox() ); + diaLabel = new JLabel(); + diaPanel = new DiaPanel(); + } + + public Component getTableCellRendererComponent( JTable table, Object value, + boolean isSelected, + boolean hasFocus, + int row, int column ) + { + if( column == 0 ) + { + diaLabel.setText( "" + value ); + return diaLabel; + } + diaPanel.fill( value ); + return diaPanel; + } + + public Component getTableCellEditorComponent( JTable table, Object value, + boolean isSelected, + int row, int column ) + { + if( column == 0 ) + { + diaLabel.setText( "" + value ); + return diaLabel; + } + diaPanel.fill( value ); + return diaPanel; + } + + public Object getCellEditorValue() + { + return diaPanel.save(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java new file mode 100644 index 00000000..05c6d67e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java @@ -0,0 +1,112 @@ +/* + * MapaHigienePanel.java + * + * Created on 9 de Fevereiro de 2006, 0:11 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.awt.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.dataui.*; +import com.evolute.utils.date.*; +import com.evolute.utils.tables.*; +/** + * + * @author Frederico + */ +public class MapaHigienePanel extends JPanel + implements ControllableComponent +{ + protected BaseTable yearTable; + protected VectorTableModel yearModel; + protected JScrollPane yearScroll; + + /** Creates a new instance of MapaHigienePanel */ + public MapaHigienePanel() + throws Exception + { + setupComponents(); + } + + private void setupComponents() + throws Exception + { + String headers[] = new String[ 13 ]; + headers[ 0 ] = " "; + for( int n = 0; n < DateUtils.MONTHS_FULL_PT.length; n++ ) + { + headers[ n + 1 ] = DateUtils.MONTHS_FULL_PT[ n ]; + } + yearModel = new VectorTableModel( headers ); + yearTable = new BaseTable( yearModel ); + yearTable.fixColumnWidth( 0, 20 ); + yearTable.setNonResizableNorReordable(); +// yearTable.setEnabled( true ); + yearModel.setEditable( true ); + yearTable.setTableCellRenderer( new DiaRenderer() ); + yearTable.setTableCellEditor( new DiaRenderer() ); + yearScroll = new JScrollPane( yearTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + Vector values = yearModel.getValues(); + for( int n = 0; n < 31; n++ ) + { + Vector data[] = new Vector[ 12 ]; + for( int m = 0; m < 12; m++ ) + { + data[ m ] = new Vector(); + } + values.add( new DiaLine( n + 1, data ) ); + } + yearModel.setValues( values ); + + setLayout( new GridLayout( 1, 1 ) ); + add( yearScroll ); + } + + public void clear() + { + } + + public void setEnabled( boolean enable ) + { + yearTable.setEnabled( enable ); + } + + public void fill( Object value ) + { +// if( true ) return; + Vector arr[][] = ( Vector[][] )value; + int maxs[] = new int[ arr.length ]; + for( int r = 0; r < arr.length; r++ ) + { + maxs[ r ] = 1; + for( int c = 0; c < arr[ r ].length; c++ ) + { + if( arr[ r ][ c ] != null && arr[ r ][ c ].size() > maxs[ r ] ) + { + maxs[ r ] = arr[ r ][ c ].size(); + } + DiaLine line = ( DiaLine ) yearModel.getRowAt( r ); + line.clear( c + 1 ); + line.setValueAt( arr[ r ][ c ], c + 1 ); + yearModel.removeRowAt( r ); + yearModel.insertRowAt( line, r ); + } + } + for( int r = 0; r < arr.length; r++ ) + { + yearTable.setRowHeight( r, 20 + ( maxs[ r ] - 1 ) * 40 ); + } + } + + public Object save() + { + return null; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java new file mode 100644 index 00000000..26612fc7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java @@ -0,0 +1,139 @@ +/* + * MarcacoesHigieneWindow.java + * + * Created on January 31, 2006, 11:32 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.documents.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.window.*; + +import siprp.higiene.*; + +/** + * + * @author fpalma + */ +public class MapaHigieneWindow extends EditorWindow + implements ActionListener +{ + public final static String TITLE = "Mapa de Higiene e Seguran\u00e7a"; + + private final static int iPermissionArray[][] = + new int[][]{ { } }; + + protected MapaHigienePanel mainPanel; + protected JTextField anoText; + protected JButton actualizarButton; + + protected HigieneDataProvider provider; + + public static void main( String args[] ) + throws Exception + { + + JFrame frm = new MapaHigieneWindow(); + frm.setVisible( true ); + } + + /** Creates a new instance of MarcacoesHigieneWindow */ + public MapaHigieneWindow() + throws Exception + { + super( iPermissionArray ); + provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + setupComponents(); + setExtendedState(getExtendedState() | MAXIMIZED_BOTH); + } + + private void setupComponents() + throws Exception + { + setTitle( TITLE ); + JPanel upperPanel = new JPanel(); + mainPanel = new MapaHigienePanel(); + getContentPane().setLayout( new BorderLayout() ); + getContentPane().add( upperPanel, BorderLayout.NORTH ); + getContentPane().add( mainPanel, BorderLayout.CENTER ); + + upperPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + upperPanel.add( new TecnicosPanel() ); + JLabel anoLabel = new JLabel( "Ano" ); + anoText = new JTextField(); + anoText.setPreferredSize( new Dimension( 50, 20 ) ); + anoText.setDocument( new YearDocument() ); + anoText.addActionListener( this ); + actualizarButton = new JButton( "Actualizar" ); + actualizarButton.addActionListener( this ); + + Calendar cal = Calendar.getInstance(); + anoText.setText( "" + cal.get( Calendar.YEAR ) ); + + JPanel pesquisaPanel = new JPanel(); + upperPanel.add( pesquisaPanel ); + pesquisaPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + pesquisaPanel.add( anoLabel ); + pesquisaPanel.add( anoText ); + pesquisaPanel.add( actualizarButton ); + +// Vector data[][] = new Vector[ 31 ][ 12 ]; +// for( int r = 0; r < 31; r++ ) +// { +// for( int c = 0; c < 12; c++ ) +// { +// data[ r ][ c ] = new Vector(); +// } +// } +//// Vector example = new Vector(); +//// example.add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", "9:30", Color.red } ); +// data[ 20 ][ 10 ].add( new Object[]{ new Integer( 21 ) } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.red } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.green } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.yellow } ); +// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.white } ); +// mainPanel.fill( data ); + } + + public void actualizar() + { + String anoStr = anoText.getText(); + if( anoStr.length() == 0 ) + { + mainPanel.clear(); + } + else + { + Integer ano = new Integer( anoStr ); + try + { + mainPanel.fill( provider.getMapaAnual( ano ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + mainPanel.clear(); + } + } + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( actualizarButton ) || source.equals( anoText ) ) + { + actualizar(); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java new file mode 100644 index 00000000..2cf77ab2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java @@ -0,0 +1,63 @@ +/* + * TecnicosPanel.java + * + * Created on 12 de Fevereiro de 2006, 17:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.mapa; + +import java.awt.*; +import javax.swing.*; + +import siprp.higiene.*; + +/** + * + * @author Frederico + */ +public class TecnicosPanel extends JPanel +{ + protected HigieneDataProvider provider; + + /** Creates a new instance of TecnicosPanel */ + public TecnicosPanel() + throws Exception + { + provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + Object tecnicos[][] = provider.getAllTecnicosHST(); + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.gridheight = 1; + constraints.weighty = 0; + + for( int n = 0; n < tecnicos.length; n++ ) + { + constraints.weightx = 0; + constraints.gridwidth = 1; + JLabel corLabel = new JLabel( " " ); + corLabel.setBackground( HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) tecnicos[ n ][ 3 ] ).intValue() ] ); + corLabel.setOpaque( true ); + gridbag.setConstraints( corLabel, constraints ); + add( corLabel ); + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JLabel nomeLabel = new JLabel( (String)tecnicos[ n ][ 1 ] ); + gridbag.setConstraints( nomeLabel, constraints ); + add( nomeLabel ); + + } + + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/CorTecnicoCellRenderer.java b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/CorTecnicoCellRenderer.java new file mode 100644 index 00000000..13d07aff --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/CorTecnicoCellRenderer.java @@ -0,0 +1,41 @@ +/* + * CorTecnicoCellRenderer.java + * + * Created on February 1, 2006, 11:13 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.*; +import javax.swing.*; + +import siprp.higiene.*; + +/** + * + * @author fpalma + */ +public class CorTecnicoCellRenderer extends JLabel implements ListCellRenderer +{ + + public CorTecnicoCellRenderer() + { + setOpaque(true); + } + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) + { + setText( " " ); + Color color = HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) value ).intValue() ]; + if( cellHasFocus ) + { + color = color.darker().darker(); + } + setBackground( color ); + + return this; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.java b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.java new file mode 100644 index 00000000..9bb3b888 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.java @@ -0,0 +1,307 @@ +package siprp.higiene.marcacoes; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.db.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.text.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import siprp.data.*; + +public class MarcacaoVisitaHSTPanel + extends JPanel + implements ControllableComponent, DataClassAware +{ + private siprp.data.MarcacaoEstabelecimentoData marcacaoEstabelecimentoData; + private final ComponentsHashtable components = new ComponentsHashtable(); + + protected final SQLExecuter EXECUTER; + + private final JLabel dataLabel = new JLabel( "Data da visita", JLabel.RIGHT ); + private final JCalendarPanel dataPanel = new JCalendarPanel( null ); + private final JButton emailButton = new JButton( "Enviar Email" ); + private final JLabel dataFichaLabel = new JLabel( "Data do Relat\u00f3rio", JLabel.RIGHT ); + private final JCalendarPanel dataFichaPanel = new JCalendarPanel( null ); + private final JLabel tecnicoLabel = new JLabel( "T\u00e9cnico", JLabel.RIGHT ); + private final JComboBox tecnicoList = new JComboBox(); + private RadioButtonFixedPanel estadoList; + private final JScrollPane observacoesTextScroll = new JScrollPane(); + private final StateTextArea observacoesText = new StateTextArea(); + + public MarcacaoVisitaHSTPanel() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + if( dbm != null ) + { + EXECUTER = ( SQLExecuter )dbm.getSharedExecuter( this ); + } + else + { + EXECUTER = null; + } + setupComponents(); + setupComponentsHashtable(); + place(); + } + + public void setupComponents() + throws Exception + { + JComponent MarcacaoVisitaHSTPanel = this; + emailButton.setMinimumSize( new Dimension( 300, 20 ) ); + emailButton.setPreferredSize( new Dimension( 200, 20 ) ); + + tecnicoList.addItem( new MappableObject( new Integer( -1 ), "" ) ); + tecnicoList.setSelectedIndex( 0 ); + + IDObject estadoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 0 ), "Por realizar" ), + new MappableObject( new Integer( 2 ), "Realizada" ), + new MappableObject( new Integer( 3 ), "Desmarcada pela empresa" ), + new MappableObject( new Integer( 4 ), "Desmarcada pela SIPRP" ), + }; + estadoList = new RadioButtonFixedPanel( estadoListOptions, 6, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + estadoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Estado" ) ); + + observacoesTextScroll.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + observacoesText.setLineWrap( true ); + observacoesText.setWrapStyleWord( true ); + observacoesText.setRows( 5 ); + + } + + public void place() + { + JPanel MarcacaoVisitaHSTPanel = this; + GridBagConstraints MarcacaoVisitaHSTPanelGBC = new GridBagConstraints(); + MarcacaoVisitaHSTPanelGBC.insets = new Insets( 1, 1, 1, 1 ); + GridBagLayout MarcacaoVisitaHSTPanelLayout = new GridBagLayout(); + MarcacaoVisitaHSTPanel.setLayout( MarcacaoVisitaHSTPanelLayout ); + MarcacaoVisitaHSTPanelGBC.gridx = 0; + MarcacaoVisitaHSTPanelGBC.gridy = 0; + MarcacaoVisitaHSTPanelGBC.gridwidth = 1; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 0.0; + MarcacaoVisitaHSTPanelGBC.weighty = 0.0; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoVisitaHSTPanelLayout.setConstraints( dataLabel, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( dataLabel ); + + MarcacaoVisitaHSTPanelGBC.gridx = 1; + MarcacaoVisitaHSTPanelGBC.gridy = 0; + MarcacaoVisitaHSTPanelGBC.gridwidth = 1; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 0.5; + MarcacaoVisitaHSTPanelGBC.weighty = 0.0; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoVisitaHSTPanelLayout.setConstraints( dataPanel, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( dataPanel ); + + MarcacaoVisitaHSTPanelGBC.gridx = 2; + MarcacaoVisitaHSTPanelGBC.gridy = 0; + MarcacaoVisitaHSTPanelGBC.gridwidth = 1; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 0.5; + MarcacaoVisitaHSTPanelGBC.weighty = 0.0; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.NONE; + MarcacaoVisitaHSTPanelLayout.setConstraints( emailButton, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( emailButton ); + + MarcacaoVisitaHSTPanelGBC.gridx = 0; + MarcacaoVisitaHSTPanelGBC.gridy = 1; + MarcacaoVisitaHSTPanelGBC.gridwidth = 1; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 0.0; + MarcacaoVisitaHSTPanelGBC.weighty = 0.0; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoVisitaHSTPanelLayout.setConstraints( dataFichaLabel, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( dataFichaLabel ); + + MarcacaoVisitaHSTPanelGBC.gridx = 1; + MarcacaoVisitaHSTPanelGBC.gridy = 1; + MarcacaoVisitaHSTPanelGBC.gridwidth = 1; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 0.5; + MarcacaoVisitaHSTPanelGBC.weighty = 0.0; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoVisitaHSTPanelLayout.setConstraints( dataFichaPanel, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( dataFichaPanel ); + + MarcacaoVisitaHSTPanelGBC.gridx = 0; + MarcacaoVisitaHSTPanelGBC.gridy = 2; + MarcacaoVisitaHSTPanelGBC.gridwidth = 1; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 0.0; + MarcacaoVisitaHSTPanelGBC.weighty = 0.0; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoVisitaHSTPanelLayout.setConstraints( tecnicoLabel, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( tecnicoLabel ); + + MarcacaoVisitaHSTPanelGBC.gridx = 1; + MarcacaoVisitaHSTPanelGBC.gridy = 2; + MarcacaoVisitaHSTPanelGBC.gridwidth = 1; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 0.5; + MarcacaoVisitaHSTPanelGBC.weighty = 0.0; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoVisitaHSTPanelLayout.setConstraints( tecnicoList, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( tecnicoList ); + + MarcacaoVisitaHSTPanelGBC.gridx = 0; + MarcacaoVisitaHSTPanelGBC.gridy = 3; + MarcacaoVisitaHSTPanelGBC.gridwidth = 3; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 1.0; + MarcacaoVisitaHSTPanelGBC.weighty = 0.5; + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoVisitaHSTPanelLayout.setConstraints( estadoList, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( estadoList ); + + MarcacaoVisitaHSTPanelGBC.gridx = 0; + MarcacaoVisitaHSTPanelGBC.gridy = 4; + MarcacaoVisitaHSTPanelGBC.gridwidth = 3; + MarcacaoVisitaHSTPanelGBC.gridheight = 1; + MarcacaoVisitaHSTPanelGBC.weightx = 1.0; + MarcacaoVisitaHSTPanelGBC.weighty = 0.5; + observacoesTextScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesTextScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + observacoesTextScroll.setViewportView( observacoesText ); + MarcacaoVisitaHSTPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoVisitaHSTPanelLayout.setConstraints( observacoesTextScroll, MarcacaoVisitaHSTPanelGBC ); + MarcacaoVisitaHSTPanel.add( observacoesTextScroll ); + + } + + private void setupComponentsHashtable() + { + components.putComponent( siprp.data.MarcacaoEstabelecimentoData.DATA, dataPanel ); + components.putComponent( siprp.data.MarcacaoEstabelecimentoData.DATA_RELATORIO, dataFichaPanel ); + components.putComponent( siprp.data.MarcacaoEstabelecimentoData.TECNICO_HST, tecnicoList ); + components.putComponent( siprp.data.MarcacaoEstabelecimentoData.ESTADO, estadoList ); + components.putComponent( siprp.data.MarcacaoEstabelecimentoData.OBSERVACOES, observacoesText ); + } + + public void fill( Object toFill ) + { + clear(); + if( toFill == null || !( toFill instanceof PropertyObject ) ) + { + return; + } + Hashtable data = null; + if( toFill instanceof PropertyObject ) + { + data = ( (PropertyObject) toFill ).getHashData(); + if( toFill instanceof siprp.data.MarcacaoEstabelecimentoData ) + { + marcacaoEstabelecimentoData = (siprp.data.MarcacaoEstabelecimentoData) toFill; + } + } + else if( toFill instanceof Hashtable ) + { + data = (Hashtable) toFill; + } + else + { + return; + } + if( marcacaoEstabelecimentoData == null ) + { + marcacaoEstabelecimentoData = new siprp.data.MarcacaoEstabelecimentoData(); + marcacaoEstabelecimentoData.setHashData( data ); + } + PropertyObject po = (PropertyObject) toFill; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.fill( properties, po.getHashData(), components ); + } + + public Object save() + { + if( marcacaoEstabelecimentoData == null ) + { + marcacaoEstabelecimentoData = new siprp.data.MarcacaoEstabelecimentoData(); + } + Hashtable data = marcacaoEstabelecimentoData.getHashData(); + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.save( properties, data, components ); + if( !( marcacaoEstabelecimentoData instanceof PropertyObject ) ) + { + return data; + } + marcacaoEstabelecimentoData.setHashData( data ); + return marcacaoEstabelecimentoData; + } + + public void clear() + { + marcacaoEstabelecimentoData = null; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.clear( properties, components ); + } + + public void setEnabled( boolean enable ) + { + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.setEnabled( properties, enable, components ); + } + + public Class getDataClass() + { + return siprp.data.MarcacaoEstabelecimentoData.class; + } + + public JLabel getDataFichaLabel() + { + return dataFichaLabel; + } + + public JCalendarPanel getDataFichaPanel() + { + return dataFichaPanel; + } + + public JLabel getDataLabel() + { + return dataLabel; + } + + public JCalendarPanel getDataPanel() + { + return dataPanel; + } + + public JButton getEmailButton() + { + return emailButton; + } + + public RadioButtonFixedPanel getEstadoList() + { + return estadoList; + } + + public StateTextArea getObservacoesText() + { + return observacoesText; + } + + public JLabel getTecnicoLabel() + { + return tecnicoLabel; + } + + public JComboBox getTecnicoList() + { + return tecnicoList; + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.xml b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.xml new file mode 100644 index 00000000..04a78a45 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacaoVisitaHSTPanel.xml @@ -0,0 +1,93 @@ + + + + + + + siprp.data.* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + Estado + + 6 + + + Por realizar + Realizada + Desmarcada pela empresa + Desmarcada pela SIPRP + + + + + + Observa\u00e7\u00f5es + + + 5 + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneUpperPanel.java b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneUpperPanel.java new file mode 100644 index 00000000..1efa12af --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneUpperPanel.java @@ -0,0 +1,199 @@ +/* + * MarcacoesHigieneUpperPanel.java + * + * Created on February 2, 2006, 12:40 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; + +import siprp.higiene.*; + +/** + * + * @author fpalma + */ +public class MarcacoesHigieneUpperPanel extends JPanel + implements ListSelectionListener, ControllableComponent +{ + protected BaseTable empresasTable; + protected VectorTableModel empresasModel; + protected BaseTable estabelecimentosTable; + protected VectorTableModel estabelecimentosModel; + + protected HigieneDataProvider provider; + + protected final Vector listeners; + + /** Creates a new instance of MedicinaUpperPanel */ + public MarcacoesHigieneUpperPanel() + throws Exception + { + provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + listeners = new Vector(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + empresasModel = new VectorTableModel( new String[]{ "empresas" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = + new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = + new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weightx = 0.5; + constraints.weighty = 1; + + gridbag.setConstraints( empresasScroll, constraints ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( estabelecimentosScroll, constraints ); + + add( empresasScroll ); + add( estabelecimentosScroll ); + + ColumnizedMappable empresas[] = provider.getAllEmpresas(); + Vector values = empresasModel.getValues(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + carregarEstabelecimentos(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + notifyListeners( e ); + } + } + + protected void carregarEstabelecimentos() + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + estabelecimentosModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + ColumnizedMappable estabelecimentos[] = provider.getAllEstabelecimentosForEmpresa( empresaID); + Vector values = estabelecimentosModel.getValues(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos.", true ); + estabelecimentosModel.clearAll(); + } + } + } + + protected void notifyListeners( ListSelectionEvent e ) + { + for( int n = 0; n < listeners.size(); n++ ) + { + ListSelectionEvent event = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( ( ListSelectionListener ) listeners.elementAt( n ) ).valueChanged( event ); + } + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listeners.add( listener ); + } + + public void removeSelectionListener( ListSelectionListener listener ) + { + listeners.remove( listener ); + } + + public void clear() + { +// empresasTable.clearSelection(); + } + + public void fill( Object value ) + { + if( value == null ) + { + clear(); + } + Integer ids[] = ( Integer [] ) value; + for( int n = 0; n < empresasTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) empresasModel.getRowAt( n ) ).getID().equals( ids[ 0 ] ) ) + { + empresasTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < estabelecimentosTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( n ) ).getID().equals( ids[ 1 ] ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + break; + } + } + } + + public Object save() + { + int empresaSelected = empresasTable.getSelectedRow(); + int estabelecimentoSelected = estabelecimentosTable.getSelectedRow(); + return new Integer[]{ + empresaSelected == -1 ? null : ( ( ColumnizedMappable ) empresasModel.getRowAt( empresaSelected ) ).getID(), + estabelecimentoSelected == -1 ? null : ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( estabelecimentoSelected ) ).getID() + }; + } + + public void setEnabled( boolean enable ) + { + empresasTable.setEnabled( enable ); + estabelecimentosTable.setEnabled( enable ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneWindow.java b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneWindow.java new file mode 100644 index 00000000..b8643956 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/MarcacoesHigieneWindow.java @@ -0,0 +1,519 @@ +/* + * MarcacoesHigieneWindow.java + * + * Created on January 31, 2006, 11:32 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.text.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.search.*; +import com.evolute.utils.ui.text.*; +import com.evolute.utils.ui.window.*; + +import siprp.*; +import siprp.data.*; +import siprp.higiene.*; + +/** + * + * @author fpalma + */ +public class MarcacoesHigieneWindow extends EditorWindow + implements ItemListener, ActionListener, ListSelectionListener +{ + public final static String TITLE = "Marca\u00e7\u00f5es de Higiene e Seguran\u00e7a"; + + private final static int iPermissionArray[][] = + new int[][]{ {}, { NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX } }; + + private static final int INDEX_MAIN = 0; + private static final int INDEX_VISITA = 1; + + private static final DateFormat DATE_FORMAT = + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "PT", "pt" ) ); + + protected MarcacoesHigieneUpperPanel upperPanel; + protected MarcacaoVisitaHSTPanel marcacaoPanel; + protected TableEditorPanel marcacaoEditorPanel; + + protected HigieneDataProvider provider; + protected JDOProvider JDO; + protected SIPRPTracker tracker; + + private Hashtable tecnicosHash; + + protected Integer empresaID; + protected String empresa; + protected Integer estabelecimentoID; + protected EstabelecimentoData estabelecimento; + + protected boolean editing = false; + + /** Creates a new instance of MarcacoesHigieneWindow */ + public MarcacoesHigieneWindow() + throws Exception + { + super( iPermissionArray ); + provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + tecnicosHash = new Hashtable(); + setupComponents(); + setExtendedState(getExtendedState() | MAXIMIZED_BOTH); + } + + private void setupComponents() + throws Exception + { + setTitle( TITLE ); + upperPanel = new MarcacoesHigieneUpperPanel(); + JPanel panel = new JPanel(); + + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + getContentPane().setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridheight = 1; + + constraints.weighty = 0.2; + gridbag.setConstraints( upperPanel, constraints ); + + constraints.weighty = 0.8; + gridbag.setConstraints( panel, constraints ); + + getContentPane().add( upperPanel ); + getContentPane().add( panel ); + + changeGroupName( INDEX_VISITA, "Visitas" ); + setActionName( INDEX_VISITA, NEW_INDEX, "Nova" ); + setActionTooltip( INDEX_VISITA, NEW_INDEX, "Nova" ); + JPanel toolbar = getToolbarPanel( INDEX_VISITA ); + + gridbag = new GridBagLayout(); +// GridBagConstraints constraints = new GridBagConstraints(); + panel.setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1.0; + constraints.weighty = 0; + + gridbag.setConstraints( toolbar, constraints ); + panel.add( toolbar ); + + constraints.gridheight = 1; + constraints.weighty = 1.0; + try + { + marcacaoEditorPanel = + new TableEditorPanel( new String[]{ "Data", + "Estado" }, + new int[]{0,2}, new int[]{0,0}, + 0.0, 1.0, new Dimension( 350, 100 ) ); + marcacaoPanel = new MarcacaoVisitaHSTPanel(); + new CopyPasteHandler( marcacaoPanel.getObservacoesText() ); + marcacaoEditorPanel.addComponent( marcacaoPanel, + new int[]{0,2}, new int[]{1,2}, + 1.0, 1.0 ); + marcacaoEditorPanel.addListSelectionListener( new ListSelectionListener(){ + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + if( marcacaoEditorPanel.getID() != null ) + { + reload(INDEX_VISITA); + select(INDEX_VISITA); + } + else + { + clear( INDEX_VISITA ); + } + } + }); + }catch( Exception ex ) + { + DialogException.showException( ex ); + return; + } + gridbag.setConstraints( marcacaoEditorPanel, constraints ); + panel.add( marcacaoEditorPanel ); + marcacaoPanel.getEmailButton().addActionListener( this ); + + fillCombo(); + upperPanel.addListSelectionListener( this ); + } + + public void fillCombo() + throws Exception + { + marcacaoPanel.getTecnicoList().removeItemListener( this ); + marcacaoPanel.getTecnicoList().removeAllItems(); + tecnicosHash.clear(); + Object tecnicos[][] = provider.getAllTecnicosHST(); + marcacaoPanel.getTecnicoList().addItem( new MappableObject( new Integer( -2 ), " " ) ); + for( int n = 0; n < tecnicos.length; n++ ) + { + Object tecnico[] = new Object[ 4 ]; + tecnico[ 0 ] = new Integer( ( (Number)tecnicos[n][0] ).intValue() ); + tecnico[ 1 ] = tecnicos[ n ][ 1 ]; + tecnico[ 2 ] = tecnicos[ n ][ 2 ]; + tecnico[ 3 ] = new Integer( n ); + tecnicosHash.put( tecnicos[ n ][ 0 ], tecnico ); + marcacaoPanel.getTecnicoList().addItem( new MappableObject( (Integer) tecnico[ 0 ], tecnico[ 1 ] ) ); + } + marcacaoPanel.getTecnicoList().setSelectedIndex( 0 ); + + marcacaoPanel.getTecnicoList().addItem( new MappableObject( new Integer( -1 ), "Novo/Editar" ) ); + marcacaoPanel.getTecnicoList().addItemListener( this ); + } + + public void itemStateChanged(java.awt.event.ItemEvent itemEvent) + { + int index = marcacaoPanel.getTecnicoList().getSelectedIndex(); + if( index == marcacaoPanel.getTecnicoList().getItemCount() - 1 ) + { + try + { +// marcacaoPanel.getTecnicoList().removeItemListener( this ); + TecnicoEditor te = new TecnicoEditor( this ); + te.setVisible( true ); +// boolean isNew = me.getIsNew(); + Integer id = te.getID(); + if( id == null ) + { + marcacaoPanel.getTecnicoList().setSelectedIndex( 0 ); + } + else + { + fillCombo(); + if( id != null ) + { + Object[] tecnico = (Object[])tecnicosHash.get( id ); + marcacaoPanel.getTecnicoList().setSelectedIndex( ((Integer)tecnico[ 3 ] ).intValue() ); + } + } + + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro na janela de edi\u00e7\u00e3o...", true ); + ex.printStackTrace(); + marcacaoPanel.getTecnicoList().setSelectedIndex( 0 ); + return; + } +// finally +// { +// marcacaoPanel.getTecnicoList().addItemListener( this ); +// } + } + else + { + IDObject selected = (IDObject)marcacaoPanel.getTecnicoList().getItemAt( index ); + Integer id = selected.getID(); + } + } + + public boolean save(int index) + { + switch( index ) + { + case INDEX_VISITA: + MarcacaoEstabelecimentoData visita = ( MarcacaoEstabelecimentoData ) marcacaoPanel.save(); + Date data = ( Date ) visita.get( MarcacaoEstabelecimentoData.DATA ); + if( data == null ) + { + JOptionPane.showMessageDialog( this, "Tem de preencher uma data para a visita.", + "Erro", JOptionPane.ERROR_MESSAGE ); + return false; + } + visita.set( MarcacaoEstabelecimentoData.ESTABELECIMENTO, estabelecimento ); + try + { + visita.set( MarcacaoEstabelecimentoData.REALIZADA, + ( ( Integer )visita.get( MarcacaoEstabelecimentoData.ESTADO ) ).intValue() == + provider.ESTADO_REALIZADO ? "y" : "n" ); + System.out.println( "DATA " + visita.get( MarcacaoEstabelecimentoData.DATA ) ); + Integer tecnico = ( Integer ) visita.get( MarcacaoEstabelecimentoData.TECNICO_HST ); + if( tecnico != null && tecnico.intValue() < 0 ) + { + visita.set( MarcacaoEstabelecimentoData.TECNICO_HST, null ); + } + visita.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + + break; + } + reload( INDEX_MAIN ); + editing = false; + return true; + } + + public boolean delete(int index) + { + int option = JOptionPane.showConfirmDialog( this, "Tem a certeza que quer apagar a marca\u00e7\u00e3o?", + "Apagar", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); + if( option == 0 ) + { + switch( index ) + { + case INDEX_VISITA: + MarcacaoEstabelecimentoData visita = ( MarcacaoEstabelecimentoData ) marcacaoPanel.save(); + try + { + visita.delete(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar.", true ); + return false; + } + break; + } + reload( INDEX_MAIN ); + return true; + } + return false; + } + + public void clear(int index) + { + switch( index ) + { + case INDEX_MAIN: + empresaID = null; + empresa = null; + estabelecimentoID = null; + estabelecimento = null; + upperPanel.clear(); + marcacaoEditorPanel.clear(); + break; + + case INDEX_VISITA: + marcacaoPanel.clear(); + marcacaoPanel.getEmailButton().setText( "Enviar email" ); + break; + } + } + + public void enableComponents(int index, boolean enable) + { + switch( index ) + { + case INDEX_MAIN: + + break; + + case INDEX_VISITA: + marcacaoPanel.setEnabled( enable ); + marcacaoPanel.getEmailButton().setEnabled( enable ); + upperPanel.setEnabled( !enable ); + editing = enable; + break; + } + if( tracker != null ) + { + tracker.getAvisosPanel().setEnabled( !editing, + AvisoConstants.TIPO_ESTABELECIMENTO ); + } + } + + protected void enableSelect( int index, boolean select ) + { + switch( index ) + { + case INDEX_VISITA: + marcacaoEditorPanel.setEnabled( select ); + break; + } + } + + public void reload( int index ) + { + switch( index ) + { + case INDEX_MAIN: + try + { + empresa = provider.getEmpresa( empresaID ); + estabelecimento = ( EstabelecimentoData ) JDO.load( EstabelecimentoData.class, estabelecimentoID ); +// upperPanel.getEmpresaText().setText( empresa ); +// upperPanel.getEstabelecimentoText().setText( estabelecimento ); +// upperPanel.getTrabalhadorText().setText( ( String ) trabalhador.get( TrabalhadorData.NOME ) ); + Object visitas[][] = provider.getVisitasEstabelecimento( estabelecimentoID ); + if( visitas.length > 0 ) + { + marcacaoEditorPanel.setData( new Object2DArray( visitas ) ); + } + else + { + marcacaoEditorPanel.clear(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados.", true ); + } + break; + + case INDEX_VISITA: + Integer visitaID = marcacaoEditorPanel.getID(); + if( visitaID == null ) + { + return; + } + try + { + MarcacaoEstabelecimentoData visita = + ( MarcacaoEstabelecimentoData ) JDO.load( MarcacaoEstabelecimentoData.class, visitaID ); + marcacaoPanel.fill( visita ); + Date dataEmailVisita = ( Date ) visita.get( MarcacaoEstabelecimentoData.DATA_EMAIL ); + if( dataEmailVisita != null ) + { + marcacaoPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( dataEmailVisita ) + ")" ); + } + else + { + marcacaoPanel.getEmailButton().setText( "Enviar email" ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados da visita.", true ); + } + break; + } + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacaoPanel.getEmailButton() ) ) + { + enviarEmailVisita(); + } + } + + protected void enviarEmailVisita() + { + MarcacaoEstabelecimentoData visita = ( MarcacaoEstabelecimentoData ) marcacaoPanel.save(); + + String subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_VISITA ); + String texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_VISITA ); + + Date today = new Date(); + marcacaoPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( today ) + ")" ); + + try + { + enviarEmail( subject, texto, ( Date )visita.get( MarcacaoEstabelecimentoData.DATA ) ); + visita.set( Marcacao.DATA_EMAIL, today ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + } + + protected void enviarEmail( String subject, String texto, Date data ) + throws Exception + { + String sede = ( String )estabelecimento.get( EstabelecimentoData.NOME ); + String dataStr = DATE_FORMAT.format( data ); + subject = subject.replaceAll( CompanyDataLoader.NOME, sede ); + String morada = ( String )estabelecimento.get( EstabelecimentoData.MORADA ); + + texto = texto.replaceAll( CompanyDataLoader.DATA, dataStr ); + texto = texto.replaceAll( CompanyDataLoader.NOME, sede ); + texto = texto.replaceAll( CompanyDataLoader.MORADA, morada ); + + ContactoData contacto = ( ContactoData )estabelecimento.get( EstabelecimentoData.CONTACTO ); + String mail = ""; + if( contacto != null ) + { + mail = ( String )contacto.get( ContactoData.EMAIL ); + } + + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c start mailto:\"" + mail + + "?subject=" + subject + "&body=" + + + texto + ); + } + else + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + + Process proc = Runtime.getRuntime().exec( new String[]{ "/usr/bin/open", "/Applications/Mail.app", "mailto:" + mail + + "?subject=" + subject + "&body=" + + texto } ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source.equals( upperPanel ) ) + { + Integer ids[] = ( Integer [] ) upperPanel.save(); + empresaID = ids[ 0 ]; + estabelecimentoID = ids[ 1 ]; + if( ids[ 1 ] == null ) + { + clear( INDEX_MAIN ); + unselect( INDEX_MAIN ); + } + else + { + reload( INDEX_MAIN ); + select( INDEX_MAIN ); + } + } + } + + public void setEmpresaAndEstabelecimento( Integer empresaID, Integer estabelecimentoID ) + { + if( editing ) + { + JOptionPane.showMessageDialog( this, "Esta janela est\u00e1 em edi\u00e7\u00e3o.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + } + else + { + upperPanel.fill( new Integer[]{ empresaID, estabelecimentoID } ); + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoEditor.java b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoEditor.java new file mode 100644 index 00000000..007c119d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoEditor.java @@ -0,0 +1,317 @@ +/* + * TecnicoEditor.java + * + * Created on February 1, 2006, 10:55 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.button.*; +import com.evolute.utils.ui.text.*; + +import siprp.*; +import siprp.data.*; +import siprp.higiene.*; + +/** + * + * @author fpalma + */ +public class TecnicoEditor extends CustomJDialog + implements ActionListener, ListSelectionListener +// , ItemListener +{ + static + { + TecnicoHSTData.registerOperationHandlerForClass( DisableDeleteHandler.INSTANCE, TecnicoHSTData.class ); + } + + private JDOProvider JDO; + private HigieneDataProvider provider; + private BaseTable table; + private VectorTableModel model; + private JButton okButton; + private JButton cancelarButton; + private JButton novoButton; + private JTextField nomeText; + private JTextField iniciaisText; +// private JComboBox corCombo; + private Integer id; + private boolean isNew = false; + private BetterButtonGroup corGroup; + private JRadioButton cores[]; + + /** Creates a new instance of MedicoEditor */ + public TecnicoEditor( JFrame owner ) + throws Exception + { + super( owner, true ); + provider = (HigieneDataProvider)HigieneDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + setSize( 600, 300 ); + setResizable( false ); + setTitle( "Criar/Editar T\u00e9cnico" ); + centerSuper(); + + model = new VectorTableModel( new String[]{ "Nome", "Iniciais", "Cor" } ); + table = new BaseTable( model ); + table.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + table.setTableCellRenderer( new TecnicoRenderer() ); + JScrollPane scp = new JScrollPane(); + scp.setMinimumSize( new Dimension( 300, 200 ) ); + scp.setMaximumSize( new Dimension( 300, 200 ) ); + scp.setPreferredSize( new Dimension( 300, 200 ) ); + scp.setSize( new Dimension( 300, 200 ) ); + scp.setViewportView( table ); + scp.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + table.fixColumnWidth( 0, 200 ); + table.setNonResizableNorReordable(); + table.getSelectionModel().addListSelectionListener( this ); + Object obj[][] = provider.getAllTecnicosHST(); + Vector tecnicosHST = new Vector(); + for( int n = 0; n < obj.length; n++ ) + { + tecnicosHST.add( new ColumnizedObjectArray( obj[ n ], true ) ); + } + model.setValues( tecnicosHST ); + + okButton = new JButton( "OK" ); + cancelarButton = new JButton( "Cancelar" ); + novoButton = new JButton( "Novo" ); + okButton.addActionListener( this ); + cancelarButton.addActionListener( this ); + novoButton.addActionListener( this ); + + nomeText = new JTextField(); + nomeText.setEnabled( false ); + iniciaisText = new JTextField(); + iniciaisText.setEnabled( false ); + JPanel corPanel = new JPanel(); + corPanel.setLayout( new BoxLayout( corPanel, BoxLayout.Y_AXIS ) ); +// corCombo = new JComboBox(); + corGroup = new BetterButtonGroup( false ); + cores = new JRadioButton[ HigieneDataProvider.CORES_TECNICOS.length ]; + for( int n = 0; n < HigieneDataProvider.CORES_TECNICOS.length; n++ ) + { + cores[ n ] = new JRadioButton( " " ); + cores[ n ].setBackground( HigieneDataProvider.CORES_TECNICOS[ n ] ); + corPanel.add( cores[ n ] ); + corGroup.add( cores[ n ] ); +// corCombo.addItem( new Integer( n ) ); + } + JScrollPane corScroll = + new JScrollPane( corPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); +// corCombo.setRenderer( new CorTecnicoCellRenderer() ); +// corCombo.setEnabled( false ); + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JPanel upperPanel = new JPanel(); + upperPanel.setLayout( new GridLayout( 1, 2 ) ); + upperPanel.add( scp ); + JPanel textPanel = new JPanel(); + upperPanel.add( textPanel ); + gridbag.setConstraints( upperPanel, constraints ); + getContentPane().add( upperPanel ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.weightx = 0.3; + constraints.gridwidth = 1; + constraints.gridheight = GridBagConstraints.REMAINDER;; + + gridbag.setConstraints( novoButton, constraints ); + getContentPane().add( novoButton ); + + gridbag.setConstraints( okButton, constraints ); + getContentPane().add( okButton ); + + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( cancelarButton, constraints ); + getContentPane().add( cancelarButton ); + + gridbag = new GridBagLayout(); + textPanel.setLayout( gridbag ); + constraints.weighty = 0; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = 1; + + JLabel nomeLabel = new JLabel( "Nome" ); + gridbag.setConstraints( nomeLabel, constraints ); + textPanel.add( nomeLabel ); + + gridbag.setConstraints( nomeText, constraints ); + textPanel.add( nomeText ); + + JLabel iniciaisLabel = new JLabel( "Iniciais" ); + gridbag.setConstraints( iniciaisLabel, constraints ); + textPanel.add( iniciaisLabel ); + + gridbag.setConstraints( iniciaisText, constraints ); + textPanel.add( iniciaisText ); + + JLabel corLabel = new JLabel( "Cor" ); + gridbag.setConstraints( corLabel, constraints ); + textPanel.add( corLabel ); + +// gridbag.setConstraints( corCombo, constraints ); +// textPanel.add( corCombo ); +// + constraints.weighty = 1; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.fill = GridBagConstraints.BOTH; +// JPanel pad = new JPanel(); +// gridbag.setConstraints( pad, constraints ); +// textPanel.add( pad ); + gridbag.setConstraints( corScroll, constraints ); + textPanel.add( corScroll ); + + new CopyPasteHandler( nomeText ); + new CopyPasteHandler( iniciaisText ); +// corCombo.addItemListener( this ); + } + + public void actionPerformed( ActionEvent e ) + { + if( e.getSource().equals( okButton ) ) + { + if( save() ) + { + close(); + } + } + else if( e.getSource().equals( cancelarButton ) ) + { + close(); + } + if( e.getSource().equals( novoButton ) ) + { + table.getSelectionModel().removeListSelectionListener( this ); + nomeText.setText( "" ); + iniciaisText.setText( "" ); +// corCombo.setSelectedIndex( 0 ); + corGroup.setIntSelected( 0 ); + nomeText.setEnabled( true ); + iniciaisText.setEnabled( true ); + corGroup.setEnabled( true ); + id = null; + isNew = true; + } + } + + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + int selected = table.getSelectedRow(); + if( selected == -1 ) + { + return; + } + ColumnizedObjectArray row = (ColumnizedObjectArray)model.getRowAt( selected ); + id = row.getID(); + String nome = (String) row.getValue( 0 ); + String iniciais = (String) row.getValue( 1 ); + Integer cor = ( Integer ) row.getValue( 2 ); + nomeText.setText( nome ); + iniciaisText.setText( iniciais ); +// corCombo.setSelectedIndex( cor.intValue() ); + corGroup.setIntSelected( cor.intValue() ); + nomeText.setEnabled( true ); + iniciaisText.setEnabled( true ); +// corCombo.setEnabled( true ); + corGroup.setEnabled( true ); + } + + private void close() + { + setVisible( false ); + dispose(); + } + + public boolean getIsNew() + { + return isNew; + } + + public Integer getID() + { + return id; + } + + private boolean save() + { + String nome = nomeText.getText().trim(); + String nomePlain = com.evolute.utils.strings.StringPlainer.convertString( nome ); + String iniciais = iniciaisText.getText().trim(); + Integer cor = new Integer( corGroup.getIntSelected() ); + if( nome.length() == 0 || iniciais.length() == 0 ) + { + JOptionPane.showMessageDialog( this, "O Nome e as iniciais n\u00e3o podem ser vazios.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return false; + } + try + { + TecnicoHSTData tecnico; + if( id != null ) + { + tecnico = ( TecnicoHSTData ) JDO.load( TecnicoHSTData.class, id ); + } + else + { + tecnico = new TecnicoHSTData(); + } + tecnico.set( TecnicoHSTData.NOME, nome ); + tecnico.set( TecnicoHSTData.NOME_PLAIN, nomePlain ); + tecnico.set( TecnicoHSTData.INICIAIS, iniciais ); + tecnico.set( TecnicoHSTData.IDENTIFICADOR, cor ); + tecnico.save(); + if( id == null ) + { + id = (Integer)tecnico.get( TecnicoHSTData.ID ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar...", false ); + return false; + } + + return true; + } + +// public void itemStateChanged( ItemEvent e ) +// { +// corCombo.getEditor().getEditorComponent().setBackground( HigieneDataProvider.CORES_TECNICOS[ corCombo.getSelectedIndex() ] ); +// } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoRenderer.java b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoRenderer.java new file mode 100644 index 00000000..7ad36ac8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/higiene/marcacoes/TecnicoRenderer.java @@ -0,0 +1,58 @@ +/* + * DiaRenderer.java + * + * Created on 8 de Fevereiro de 2006, 21:45 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.higiene.marcacoes; + +import java.awt.*; +import javax.swing.*; +import javax.swing.table.*; + +import siprp.higiene.*; + +/** + * + * @author Frederico + */ +public class TecnicoRenderer + implements TableCellRenderer +{ + protected JLabel labels[]; + protected Color defaultColor; + + /** Creates a new instance of DiaRenderer */ + public TecnicoRenderer() + { + labels = new JLabel[ 3 ]; + for( int n = 0; n < 3; n++ ) + { + labels[ n ] = new JLabel(); + } + defaultColor = labels[ 0 ].getBackground(); + labels[ 2 ].setOpaque( true ); + } + + public Component getTableCellRendererComponent( JTable table, Object value, + boolean isSelected, + boolean hasFocus, + int row, int column ) + { + switch( column ) + { + case 2: + labels[ 2 ].setText( " " ); + labels[ 2 ].setBackground( value == null ? defaultColor : + HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) value ).intValue() ] ); + break; + default: + labels[ column ].setText( ( String ) value ); + break; + } + return labels[ column ]; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/importer/DataChooserWindow.java b/tags/teg/SIPRPSoft/src/siprp/importer/DataChooserWindow.java new file mode 100644 index 00000000..a341e0b5 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/importer/DataChooserWindow.java @@ -0,0 +1,190 @@ +/* + * DataChooserWindow.java + * + * Created on 29 de Abril de 2004, 16:53 + */ + +package siprp.importer; + +import java.awt.*; +import java.awt.event.*; +import java.util.*; +import javax.swing.*; + +import com.evolute.utils.ui.*; +/** + * + * @author lflores + */ +public class DataChooserWindow extends CustomJDialog +{ + private final String labels[]; + private final Object items[]; + private final Object empty[]; + private final Object allItems[][]; + private final JComboBox combos[]; + private final int preselected[]; + + private boolean canceled = false; + + /** Creates a new instance of DataChooserWindow */ + public DataChooserWindow( JFrame modalFrame, String names[], Object data[][] ) + { + this( modalFrame, names, data, null ); + } + + public DataChooserWindow( JFrame modalFrame, String names[], Object data[][], int selected[] ) + { + super( modalFrame, true ); + labels = names; + items = data[ 0 ]; + empty = new String[ items.length ]; + for( int i = 0; i < empty.length; ++i ) + { + empty[ i ] = ""; + } + allItems = data; + combos = new JComboBox[ labels.length ]; + preselected = selected; + setupComponents(); + if( modalFrame == null ) + { + center(); + } + else + { + centerSuper(); + } + setVisible( true ); + } + + private void setupComponents() + { + setTitle( "Escolha os campos correspondentes:" ); + setSize(450, 120 + 25 * labels.length ); + GridBagLayout gbl = new GridBagLayout(); + GridBagConstraints gbc = new GridBagConstraints(); + gbc.insets = new Insets( 2, 2, 2, 2 ); + gbc.fill = GridBagConstraints.HORIZONTAL; + Container cont = getContentPane(); + cont.setLayout( gbl ); + for( int i = 0; i < labels.length; ++i ) + { + gbc.weightx = 0; + gbc.gridwidth = 1; + JLabel label = new JLabel( labels[ i ] ); + gbl.setConstraints( label, gbc ); + cont.add( label ); +/* gbc.weightx = 1; + JPanel pad = new JPanel(); + gbl.setConstraints( pad, gbc ); + cont.add( pad ); +*/ gbc.weightx = 1; + gbc.gridwidth = GridBagConstraints.REMAINDER; + JComboBox combo = new JComboBox( items ); + int index; + if( preselected == null ) + { + index = Math.min( i, items.length - 1 ); + } + else + { + if( i < preselected.length ) + { + index = Math.min( preselected[ i ], items.length - 1 ); + if( index == -1 ) + { + index = items.length - 1; + } + } + else + { + index = items.length - 1; + } + + } + combo.setSelectedIndex( index ); + combos[ i ] = combo; + gbl.setConstraints( combo, gbc ); + cont.add( combo ); + } + gbc.insets = new Insets( 10, 2, 2, 2 ); + gbc.weightx = 1; + gbc.gridwidth = 2; + JPanel pad = new JPanel(); + gbl.setConstraints( pad, gbc ); + cont.add( pad ); + gbc.weightx = 0; + gbc.gridwidth = 1; + JButton butOK = new JButton( "OK" ); + gbl.setConstraints( butOK, gbc ); + cont.add( butOK ); + gbc.weightx = 0; + gbc.gridwidth = GridBagConstraints.REMAINDER; + JButton butCancel = new JButton( "Cancelar" ); + gbl.setConstraints( butCancel, gbc ); + cont.add( butCancel ); + butOK.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent e ) + { + setVisible( false ); + dispose(); + } + }); + butCancel.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent e ) + { + setVisible( false ); + dispose(); + canceled = true; + } + }); + } + + public Hashtable getData() + { + if( canceled ) + { + return null; + } + Hashtable hash = new Hashtable(); + for( int i = 0; i < labels.length; ++i ) + { + hash.put( labels[ i ], combos[ i ].getSelectedItem() ); + } + return hash; + } + + public Hashtable[] getMultipleData() + { + if( canceled ) + { + return null; + } + Hashtable hash[] = new Hashtable[ allItems.length ]; +//System.out.println( "Hash[] size: " + hash.length ); + for( int j = 0; j < hash.length; ++j ) + { + hash[ j ] = new Hashtable(); + } + for( int i = 0; i < labels.length; ++i ) + { + String sel = combos[ i ].getSelectedItem().toString(); + if( sel.length() > 0 ) + { + for( int j = 0; j < allItems.length; ++j ) + { + hash[ j ].put( labels[ i ], allItems[ j ][ combos[ i ].getSelectedIndex() ] ); + } + } + } + return hash; + } + +/* public static void main( String arg[] ) + { + String names[] = new String[] { "Nome:", "Morada:", "Telefone:" }; + String data[] = new String[] { "Joao Catita", "Damaiasdg sdfg sdf gsdfs hgf h", "nao tem", "so a noite", "" }; + DataChooserWindow dcw = new DataChooserWindow( null, names, data, new int[] { 3, 2 ,1 } ); + }*/ +} diff --git a/tags/teg/SIPRPSoft/src/siprp/importer/Importer.java b/tags/teg/SIPRPSoft/src/siprp/importer/Importer.java new file mode 100644 index 00000000..c9b7efdb --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/importer/Importer.java @@ -0,0 +1,363 @@ +/* + * Importer.java + * + * Created on 7 de Abril de 2004, 10:56 + */ + +package siprp.importer; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.util.*; +import javax.swing.*; +import javax.swing.table.*; + +import jxl.*; + +import siprp.*; + +/** + * + * @author psantos + */ +public class Importer extends CustomJDialog +{ + public static final int TYPE_ADMISSAO = 0; + public static final int TYPE_DEMISSAO = 1; + + public static final String DATA_PREFIX = "Data "; + + public static final String NOME = "Nome do Funcion\u00e1rio"; + public static final String SEXO = "Sexo"; + public static final String NACIONALIDADE = "Nacionalidade"; + public static final String DATA_NASCIMENTO = DATA_PREFIX + "Nascimento"; + public static final String NUMERO_MECANOGRAFICO = "N\u00famero Mecanogr\u00e1fico"; + public static final String DATA_ADMISSAO = DATA_PREFIX + "Admiss\u00e3o"; + public static final String CATEGORIA = "Categoria"; + public static final String LOCAL_TRABALHO = "Local Trabalho"; + public static final String FUNCAO = "Fun\u00e7\u00e3o"; + public static final String DATA_ADMISSAO_FUNCAO = DATA_PREFIX + "Admiss\u00e3o na Fun\u00e7\u00e3o"; + public static final String DATA_DEMISSAO = DATA_PREFIX + "Demiss\u00e3o"; + + private JPanel panel; + private BaseTable table; + private Excel2DArray e2da; + private boolean canceled = false; + private DataChooserWindow dcw; + private Object vals[][]; + private int[] DEFAULT_SELECTION = new int[]{ 0, 2, 3, 1, -1, 4, 5, 7, 6, -1 }; + private int[] DEFAULT_SELECTION_DEMISSAO = new int[]{ 0, 1 }; + + public static final String NAMES[] = new String[]{ + NOME, + SEXO, + NACIONALIDADE, + DATA_NASCIMENTO, + NUMERO_MECANOGRAFICO, + DATA_ADMISSAO, + CATEGORIA, + LOCAL_TRABALHO, + FUNCAO, + DATA_ADMISSAO_FUNCAO + }; + + public static final String NAMES_DEMISSAO[] = new String[]{ + NOME, + DATA_DEMISSAO + }; + private final boolean multipleSelection; + protected final int type; + + /** Creates a new instance of Importer */ + public Importer( JFrame modalFrame, String filename, boolean multiple, int type ) + throws Exception + { + super( modalFrame, true ); + multipleSelection = multiple; + this.type = type; + + int []selection = ( int [] ) Singleton.getInstance( SingletonConstants.EXCEL_FORMAT ); + if( selection != null ) + { + DEFAULT_SELECTION = selection; + } + int []selectionDemissao = ( int [] ) Singleton.getInstance( SingletonConstants.EXCEL_FORMAT_DEMISSAO ); + if( selectionDemissao != null ) + { + DEFAULT_SELECTION_DEMISSAO = selectionDemissao; + } + setupComponents( filename ); + if( modalFrame == null ) + { + center(); + } + else + { + centerSuper(); + } + setVisible( true ); + } + + private void setupComponents( String filename ) + { + setSize( 800, 500 ); + + GridBagLayout gblGridBag = new GridBagLayout(); + GridBagConstraints gbcConstraints = new GridBagConstraints(); + + panel = ( JPanel ) getContentPane(); + + panel.setLayout( gblGridBag ); + + e2da = new Excel2DArray( filename ); + + String colNames[] = new String[ e2da.rowLength() ]; + for( int i = 0; i < colNames.length; i++ ) + { + colNames[ i ] = " "; + } + Virtual2DTableModel tm = new Virtual2DTableModel( colNames, null ); + tm.setValues( e2da ); + table = new BaseTable( tm ); + int col = 0; + switch( type ) + { + case TYPE_ADMISSAO: + col = DEFAULT_SELECTION[ 0 ]; + break; + + case TYPE_DEMISSAO: + col = DEFAULT_SELECTION_DEMISSAO[ 0 ]; + break; + } + table.getColumn( col ).setWidth( 200 ); + if( !multipleSelection ) + { + table.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + } + else + { + table.getSelectionModel().setSelectionMode( ListSelectionModel.SINGLE_INTERVAL_SELECTION ); + } + table.getTableHeader().setResizingAllowed( true ); + table.getTableHeader().setReorderingAllowed( false ); + // table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF ); + + for( int i = 0; i < e2da.rowLength(); i++ ) + { + table.getColumn( i ).setMinWidth( 50 ); + //table.getColumn( i ).setResizable( true ); + } + + JScrollPane sp = new JScrollPane( table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + + gbcConstraints.anchor = GridBagConstraints.CENTER; + gbcConstraints.fill = GridBagConstraints.BOTH; + gbcConstraints.insets = new Insets(5, 5, 5, 5); + gbcConstraints.gridwidth = 3; + gbcConstraints.gridheight = 3; + gbcConstraints.weighty = 3; + gbcConstraints.gridx = 0; + gbcConstraints.gridy = 3; + gblGridBag.setConstraints( sp, gbcConstraints ); + + panel.add( sp ); + + JPanel jpButtons = new JPanel(); + final JButton jbOK = new JButton( "Escolher" ); + jbOK.setEnabled( false ); + jpButtons.add( jbOK ); + JButton jbCancel = new JButton( "Cancelar" ); + jpButtons.add( jbCancel ); + + gbcConstraints.gridheight = 1; + gbcConstraints.weightx = 1; + gbcConstraints.weighty = 0; + gbcConstraints.anchor = GridBagConstraints.SOUTH; + gbcConstraints.fill = GridBagConstraints.BOTH; + gbcConstraints.insets = new Insets( 2, 2, 2, 2 ); + gbcConstraints.gridwidth = 3; + gbcConstraints.gridx = 0; + gbcConstraints.gridy = 6; + gblGridBag.setConstraints( jpButtons, gbcConstraints ); + panel.add( jpButtons ); + + table.addMouseListener( new MouseAdapter() { + public void mouseClicked( MouseEvent e ) { + jbOK.setEnabled( true ); + if( e.getButton() == MouseEvent.BUTTON1 + && e.getClickCount() == 2 + && table.columnAtPoint( e.getPoint() ) != -1 + && table.rowAtPoint( e.getPoint() ) != -1 ) + { + acceptResult(); + } + } + public void mousePressed( MouseEvent e ) { + jbOK.setEnabled( true ); + } + }); + + jbOK.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent a ) { + acceptResult(); + } + }); + + jbCancel.addActionListener( new ActionListener() { + public void actionPerformed( ActionEvent a ) { + setVisible( false ); + dispose(); + canceled = true; + } + }); + + } + + private void acceptResult() + { + if( multipleSelection ) + { + int rows[] = table.getSelectedRows(); + vals = new Object[ rows.length ][]; + for( int i = 0; i < rows.length; ++i ) + { + Vector v = new Vector( Arrays.asList( e2da.getRow( rows[ i ] ) ) ); + v.add( "" ); + vals[ i ] = (Object[]) v.toArray( new Object[ v.size() ] ); + } + } + else + { + Vector v = new Vector( Arrays.asList( e2da.getRow( table.getSelectedRow() ) ) ); + v.add( "" ); + vals = new Object[][] { ( Object[] )v.toArray( new Object[ v.size() ] ) }; + } + +/* + System.out.println( "row: " + table.getSelectedRow() ); + System.out.print( "vals: " ); + for( int i = 0; i < vals.length; i++ ) + { + System.out.print( "[" + vals[ i ] + "]" ); + } + System.out.println(); +*/ + setVisible( false ); + dispose(); + + } + + public Hashtable getData() + { + if( NAMES == null || vals == null ) + { + return null; + } + dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION ); + + if( canceled || ( dcw == null ) ) + { + return null; + } + + return dcw.getData(); + } + + public Hashtable[] getMultipleData() + { + switch( type ) + { + case TYPE_ADMISSAO: + if( NAMES == null || vals == null ) + { + return null; + } + dcw = new DataChooserWindow( null, NAMES, vals, DEFAULT_SELECTION ); + break; + + case TYPE_DEMISSAO: + if( NAMES_DEMISSAO == null || vals == null ) + { + return null; + } + dcw = new DataChooserWindow( null, NAMES_DEMISSAO, vals, DEFAULT_SELECTION_DEMISSAO ); + break; + } + + if( canceled || ( dcw == null ) ) + { + return null; + } + + return dcw.getMultipleData(); + } + + + public static void main( String args[] ) + { +// FileDialog fd = new FileDialog( null, "Escolha um ficheiro Excel:", FileDialog.LOAD ); +// fd.setDirectory( System.getProperty( "user.home" ) ); +// fd.setFilenameFilter( new FilenameFilter() { +// public boolean accept( File dir, String name ) +// { +// return (name!=null) && (name.indexOf( ".xls" ) != -1); +// } +// } ); +// fd.show(); + String filename = "c:\\teste_com_dados.xls"; + //String filename = fd.getFile(); + if( filename != null ) + { + //filename = fd.getDirectory() + File.separator + filename; + try + { + Importer importer = new Importer( null, filename, true, TYPE_ADMISSAO ); + Hashtable hash = importer.getData(); + if( hash != null ) + { + System.out.println( "Data: " + hash ); + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + JOptionPane.showMessageDialog( null, "Erro a importar", "Erro...", JOptionPane.ERROR_MESSAGE ); + } + } +// Importer im = null; +// try +// { +// im = new Importer( null, +// "E:\\test.xls" +// "C:\\Documents and Settings\\psantos\\My Documents\\Devel\\teste.xls" +// "C:\\Documents and Settings\\psantos\\My Documents\\Devel\\Docs\\jexcelapi\\jxlrwtest.xls" +// ); +// +//System.out.println( "Escolhido: " + im.getData() ); +// +// } +// catch( Exception e ) +// { +// e.printStackTrace(); +// } + +// String[][] all = (String[][]) e.getObjects(); +// +// for( int j = 0; j < e.rowLength(); j++ ) +// { +// String[] r = e.getRow( j ); +// for( int i = 0; i < r.length; i++ ) +// { +// System.out.print( "[" + r[ i ] + "]" ); +// } +// System.out.println(); +// } + } +} \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/siprp/impressaofichas/FichasPrinter.java b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/FichasPrinter.java new file mode 100644 index 00000000..1b21e717 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/FichasPrinter.java @@ -0,0 +1,146 @@ +/* + * FichasPrinter.java + * + * Created on 20 de Fevereiro de 2006, 0:43 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.impressaofichas; + +import java.io.*; +import java.text.*; +import java.util.*; +import javax.xml.transform.*; + +import com.evolute.utils.*; +import com.evolute.utils.date.*; +import com.evolute.utils.fop.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.strings.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.xml.*; + +import siprp.data.*; +import siprp.ficha.*; + +/** + * + * @author Frederico + */ +public class FichasPrinter extends Thread +{ + protected static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + protected static final DateFormat D_F_L = DateFormat.getDateInstance( DateFormat.LONG, new Locale( "pt", "PT" ) ); + + private ImpressaoFichasDataProvider provider; + + protected Integer ids[]; + protected String printerName; + protected String listPath; + protected String nomeEmpresa; + protected String nomeEstabelecimento; + + /** Creates a new instance of FichasPrinter */ + public FichasPrinter( Integer ids[], String printerName, String listPath, + String nomeEmpresa, String nomeEstabelecimento ) + { + this.ids = ids; + this.printerName = printerName; + this.listPath = listPath; + this.nomeEmpresa = nomeEmpresa; + this.nomeEstabelecimento = nomeEstabelecimento; + } + + public void run() + { + try + { + SimpleXMLElement root = new SimpleXMLElement( "LISTA_FICHAS" ); + for( int n = 0; n < ids.length; n++ ) + { + print( ids[ n ] ); + Object dados[] = provider.getDadosForExameID( ids[ n ] ); + SimpleXMLElement linha = new SimpleXMLElement( "FICHA" ); + linha.addElement( new SimpleXMLElement( "NOME", ( String ) dados[ 0 ] ) ); + linha.addElement( new SimpleXMLElement( "DATA_EXAME", D_F.format( ( Date ) dados[ 1 ] ) ) ); + linha.addElement( new SimpleXMLElement( "DATA_PROXIMO_EXAME", dados[ 2 ] != null ? D_F.format( ( Date ) dados[ 2 ] ) : "n/d" ) ); + root.addElement( linha ); + + try + { + sleep( (n % 5 == 0 && n > 0) ? 3000 : 2000 ); + } + catch( InterruptedException iex ) + { + } + } + Date today = ( Date ) Singleton.getInstance( Singleton.TODAY ); + Calendar cal = Calendar.getInstance(); + cal.setTime( today ); + SimpleXMLElement data = new SimpleXMLElement( "DATA_EXTENSO", DateUtils.WEEKDAYS_FULL_PT[ cal.get( Calendar.DAY_OF_WEEK ) - Calendar.MONDAY ] + + ", " + D_F_L.format( today ) ); + root.addElement( data ); + TransformerFactory tFactory = TransformerFactory.newInstance(); + String xml = root.toString(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + FOPCreator creator = FOPCreator.getFOPCreator(); + InputStream xmlIn = new ByteArrayInputStream( xml.getBytes() ); + creator.createFOfromXML( xmlIn, + FichasPrinter.class.getClassLoader().getResourceAsStream( + "siprp/impressaofichas/lista_fichas.xsl" ), + out ); + byte toPrint[] = out.toByteArray(); + ByteArrayInputStream in = new ByteArrayInputStream( toPrint ); + Hashtable printOptions = new Hashtable(); +//System.out.println( "OUT: " + out.toString() ); + FOPPrinter.getFOPPrinter().printFO( in, false, true, printOptions ); + byte []pdfData = PDFCreator.getPDFCreator().createPdfFromFo( toPrint ); + File dir = new File( new File( listPath ), StringPlainer.convertString( nomeEmpresa ).replace( ' ', '_' ) ); + if( !dir.exists() ) + { + dir.mkdir(); + } + String fileName = StringPlainer.convertString( nomeEstabelecimento ).replace( ' ', '_' ) + + "_" + DateUtils.plainFormatDate( today ) + ".pdf"; + FileOutputStream fos = new FileOutputStream( new File( dir, fileName ) ); + fos.write( pdfData ); + fos.close(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir", true ); + } + ids = null; + } + + private void print( Integer exameID ) + throws Exception + { + if( provider == null ) + { + provider = ( ImpressaoFichasDataProvider ) ImpressaoFichasDataProvider.getProvider(); + } +// MetaObject exame = fdpProvider.load( fdpProvider.EXAMES, new DBKey( exameID ) ); +// ExameData exame = (ExameData) JDO.load( ExameData.class, exameID ); +// byte pdf[] = (byte []) exame.get( ExameData.PDF ); + byte pdf[] = provider.getPDF( exameID ); + if( pdf == null ) + { + throw new Exception( "N\u00e3o existe exame" ); + } +// TrabalhadorData trabalhadorExame = ( TrabalhadorData ) exame.get( ExameData.TRABALHADOR ); +// String nomeFicheiro = StringPlainer.convertString( ( String ) trabalhadorExame.get( TrabalhadorData.NOME ) ); + String nomeFicheiro = StringPlainer.convertString( provider.getNomeTrabalhadorForExameID( exameID ) ); +// nomeFicheiro.replaceAll( " ", "_" ); + String split[] = nomeFicheiro.split( " " ); + nomeFicheiro = ""; + for( int n = 0; n < split.length; n++ ) + { + nomeFicheiro += split[ n ] + "_"; + } + ExamePDF ePDF = new ExamePDF(); + ePDF.printSilent( pdf, nomeFicheiro, printerName ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasDataProvider.java new file mode 100644 index 00000000..11e0910d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasDataProvider.java @@ -0,0 +1,217 @@ +/* + * HigieneDataProvider.java + * + * Created on February 1, 2006, 10:49 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.impressaofichas; + +import java.text.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; +import com.evolute.utils.tables.*; + +import siprp.*; +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class ImpressaoFichasDataProvider extends MetaProvider +{ + private static final DateFormat DATE_FORMAT = + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "PT", "pt" ) ); + + private static final Object LOCK = new Object(); + private static ImpressaoFichasDataProvider instance = null; + private final Executer executer; + + /** Creates a new instance of HigieneDataProvider */ + public ImpressaoFichasDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new ImpressaoFichasDataProvider(); + } + } + return instance; + } + + public ColumnizedMappable[] getAllEmpresas() + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "empresa_id" ).isEqual( empresaID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + return estabelecimentos; + } + + public Object [][]getAllFichasForEstabelecimentoAndDatas( Integer estabelecimentoID, Date dataInicio, Date dataFim ) + throws Exception + { + Vector fichas = new Vector(); + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + String nomePlain = ( String ) array.get( n, 2 ); + MappableObject fichasTrabalhador[] = getAllFichasForTrabalhadorAndDatas( id, dataInicio, dataFim ); + for( int f = 0; f < fichasTrabalhador.length; f++ ) + { + fichas.add( new Object[]{ fichasTrabalhador[ f ].getID(), nome, fichasTrabalhador[ f ].getValue(), nomePlain } ); + } + } + Object fichasArray[][] = ( Object[][] )fichas.toArray( new Object[ fichas.size() ][] ); + Arrays.sort( fichasArray, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + Object arr1[] = ( Object[] )o1; + Object arr2[] = ( Object[] )o2; + int res = 0; + if( arr1[ 2 ] == null && arr2[ 2 ] == null ) + { + res = 0; + } + else if( arr1[ 2 ] == null ) + { + res = -1; + } + else if( arr2[ 2 ] == null ) + { + res = 1; + } + else + { + res = ( (Date)arr1[ 2 ]).compareTo( (Date)arr2[ 2 ] ); + } + + if( res == 0 ) + { + res = ( (String)arr1[ 3 ]).compareTo( (String)arr2[ 3 ] ); + } + return res; + } + } ); + for( int n = 0; n < fichasArray.length; n++ ) + { + fichasArray[ n ][ 2 ] = fichasArray[ n ][ 2 ] != null? DATE_FORMAT.format( (Date)fichasArray[ n ][ 2 ] ): ""; + } + return fichasArray; + } + + public MappableObject []getAllFichasForTrabalhadorAndDatas( Integer trabalhadorID, Date dataInicio, Date dataFim ) + throws Exception + { + Select select = + new Select( new String[]{ "exames" }, new String[]{ "MAX(id)", "data" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "inactivo" ).isEqual( "n" ) ).and( + new Field( "data" ).between( new Object[]{ dataInicio, dataFim } ) ), + new String[]{ "data DESC" }, new String[]{ "data" } ); + Virtual2DArray array = executer.executeQuery( select ); + MappableObject exames[] = new MappableObject[ array.columnLength() ]; + for( int n = 0; n < exames.length; n++ ) + { + Date date = (Date)array.get( n, 1 ); + Integer id = new Integer( ((Number)array.get( n, 0 )).intValue() ); + exames[ n ] = new MappableObject( id, date ); + } + return exames; + } + + public byte[] getPDF( Integer exameID ) + throws Exception + { + Select select = + new Select( new String[]{ "exames" }, + new String[]{ "pdf" }, + new Field( "id" ).isEqual( exameID ) ); + Virtual2DArray array = executer.executeQuery( select ); + byte pdf[] = ( byte[] ) array.get( 0, 0 ); + return pdf; + } + + public String getNomeTrabalhadorForExameID( Integer exameID ) + throws Exception + { + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "trabalhadores.nome_plain" }, + new Field( "exames.id" ).isEqual( exameID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( String ) array.get( 0, 0 ); + } + + public Object[] getDadosForExameID( Integer exameID ) + throws Exception + { + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "trabalhadores.nome", "exames.data", "exames.proximo_exame" }, + new Field( "exames.id" ).isEqual( exameID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects()[ 0 ]; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasWindow.java b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasWindow.java new file mode 100644 index 00000000..3b29b698 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/ImpressaoFichasWindow.java @@ -0,0 +1,422 @@ +/* + * ImpressaoFichasUpperPanel.java + * + * Created on 19 de Fevereiro de 2006, 19:00 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.impressaofichas; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import javax.print.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.properties.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.window.*; + +/** + * + * @author Frederico + */ +public class ImpressaoFichasWindow extends EditorWindow + implements ListSelectionListener, ActionListener +{ + public final static String TITLE = "Impress\u00e3o de Fichas de Aptid\u00e3o"; + + protected final static String PATH_PROPERTY_SUFFIX = ".path"; + + private final static int iPermissionArray[][] = + new int[][]{ {} }; + + protected JCalendarPanel dataInicioPanel; + protected JCalendarPanel dataFimPanel; + protected VectorTableModel empresasModel; + protected BaseTable empresasTable; + protected VectorTableModel estabelecimentosModel; + protected BaseTable estabelecimentosTable; + protected VectorTableModel fichasModel; + protected BaseTable fichasTable; + protected JButton procurarButton; + protected JTextField pathText; + protected JButton pathButton; + protected JComboBox impressorasCombo; + protected JButton imprimirButton; + protected JButton imprimirTodasButton; + + protected ImpressaoFichasDataProvider provider; + protected PropertyHandler propertyHandler; + + /** Creates a new instance of ImpressaoFichasUpperPanel */ + public ImpressaoFichasWindow() + throws Exception + { + super( iPermissionArray ); + provider = ( ImpressaoFichasDataProvider ) ImpressaoFichasDataProvider.getProvider(); + propertyHandler = new PropertyHandler(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + setTitle( TITLE ); + empresasModel = new VectorTableModel( new String[]{ "empresas" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = + new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = + new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + fichasModel = new VectorTableModel( new String[]{ "trabalhador", "data" } ); + fichasTable = new BaseTable( fichasModel ); + fichasTable.fixColumnWidth( 1, 120 ); + fichasTable.setNonResizableNorReordable(); + fichasTable.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); + fichasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane fichasScroll = new JScrollPane( fichasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + JLabel inicioLabel = new JLabel( "In\u00edcio" ); + dataInicioPanel = new JCalendarPanel( null ); + JLabel fimLabel = new JLabel( "Fim" ); + dataFimPanel = new JCalendarPanel( null ); + procurarButton = new JButton( "Carregar" ); + procurarButton.addActionListener( this ); + procurarButton.setEnabled( false ); + pathText = new JTextField(); + pathText.setEditable( false ); + pathButton = new JButton( "Escolher Direct\u00f3rio" ); + pathButton.addActionListener( this ); + impressorasCombo = new JComboBox(); + PrintService printers[] = PrintServiceLookup.lookupPrintServices( null, null ); + for( int n = 0; n < printers.length; n++ ) + { + impressorasCombo.addItem( printers[ n ].getName() ); + } + imprimirButton = new JButton( "Imprimir escolhidas" ); + imprimirButton.addActionListener( this ); + imprimirButton.setEnabled( false ); + imprimirTodasButton = new JButton( "Imprimir Todas" ); + imprimirTodasButton.addActionListener( this ); + imprimirTodasButton.setEnabled( false ); + JPanel upperPad = new JPanel(); + JPanel lowerPad = new JPanel(); + JPanel upperPanel = new JPanel(); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridheight = 1; + constraints.weighty = 0.35; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( upperPanel, constraints ); + + constraints.gridwidth = 2; + constraints.weightx = 1; + constraints.weighty = 0.65; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( fichasScroll, constraints ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( inicioLabel, constraints ); + gridbag.setConstraints( dataInicioPanel, constraints ); + gridbag.setConstraints( fimLabel, constraints ); + gridbag.setConstraints( dataFimPanel, constraints ); + gridbag.setConstraints( procurarButton, constraints ); + gridbag.setConstraints( pathText, constraints ); + gridbag.setConstraints( pathButton, constraints ); + gridbag.setConstraints( impressorasCombo, constraints ); + gridbag.setConstraints( imprimirButton, constraints ); + gridbag.setConstraints( imprimirTodasButton, constraints ); + + constraints.weighty = 0.32; + gridbag.setConstraints( upperPad, constraints ); + gridbag.setConstraints( lowerPad, constraints ); + + add( upperPanel ); + add( fichasScroll ); + add( upperPad ); + add( inicioLabel ); + add( dataInicioPanel ); + add( fimLabel ); + add( dataFimPanel ); + add( procurarButton ); + add( lowerPad ); + add( pathButton ); + add( pathText ); + add( impressorasCombo ); + add( imprimirButton ); + add( imprimirTodasButton ); + + upperPanel.setLayout( new GridLayout( 1, 2 ) ); + upperPanel.add( empresasScroll ); + upperPanel.add( estabelecimentosScroll ); + ColumnizedMappable empresas[] = provider.getAllEmpresas(); + Vector values = empresasModel.getValues(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + + Properties properties = propertyHandler.load(); +System.out.println( properties ); + String path = (String) properties.get( getClass().getName() + PATH_PROPERTY_SUFFIX ); + if( path == null ) + { + setDirectorio( System.getProperty( "user.home" ) ); + } + else + { + pathText.setText( path ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + carregarEstabelecimentos(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + procurarButton.setEnabled( estabelecimentosTable.getSelectedRow() != -1 ); + } + else if( source.equals( fichasTable.getSelectionModel() ) ) + { + imprimirButton.setEnabled( fichasTable.getSelectedRow() != -1 ); + } + } + + protected void carregarEstabelecimentos() + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + estabelecimentosModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + ColumnizedMappable estabelecimentos[] = provider.getAllEstabelecimentosForEmpresa( empresaID); + Vector values = estabelecimentosModel.getValues(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos.", true ); + estabelecimentosModel.clearAll(); + } + } + } + + public void clear() + { + empresasTable.clearSelection(); + } + + public void fill( Object value ) + { + if( value == null ) + { + clear(); + } + Integer ids[] = ( Integer [] ) value; + for( int n = 0; n < empresasTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) empresasModel.getRowAt( n ) ).getID().equals( ids[ 0 ] ) ) + { + empresasTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < estabelecimentosTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( n ) ).getID().equals( ids[ 1 ] ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + break; + } + } + } + + public Object save() + { + int empresaSelected = empresasTable.getSelectedRow(); + int estabelecimentoSelected = estabelecimentosTable.getSelectedRow(); + return new Integer[]{ + empresaSelected == -1 ? null : ( ( ColumnizedMappable ) empresasModel.getRowAt( empresaSelected ) ).getID(), + estabelecimentoSelected == -1 ? null : ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( estabelecimentoSelected ) ).getID() + }; + } + + public void setEnabled( boolean enable ) + { + empresasTable.setEnabled( enable ); + estabelecimentosTable.setEnabled( enable ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( procurarButton ) ) + { + procurar(); + } + else if( source.equals( imprimirButton ) ) + { + imprimir(); + } + else if( source.equals( imprimirTodasButton ) ) + { + imprimirTodas(); + } + else if( source.equals( pathButton ) ) + { + escolherDirectorio(); + } + } + + public void procurar() + { + int selected = estabelecimentosTable.getSelectedRow(); + Date dataInicio = dataInicioPanel.getDate(); + Date dataFim = dataFimPanel.getDate(); + if( selected == -1 || ( dataInicio == null && dataFim == null ) ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher pelo menos uma data e um estabelecimento.", "Erro", + JOptionPane.ERROR_MESSAGE ); + return; + } + if( dataInicio == null ) + { + dataInicio = dataFim; + } + else if( dataFim == null ) + { + dataFim = dataInicio; + } + fichasModel.clearAll(); + try + { + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selected ) ).getID(); + Object fichas[][] = provider.getAllFichasForEstabelecimentoAndDatas( estabelecimentoID, dataInicio, dataFim ); + Vector values = fichasModel.getValues(); + for( int n = 0; n < fichas.length; n++ ) + { + values.add( new ColumnizedObjectArray( fichas[ n ], true ) ); + } + fichasModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar a lista.", true ); + estabelecimentosModel.clearAll(); + } + imprimirTodasButton.setEnabled( fichasTable.getRowCount() > 0 ); + } + + public void imprimir() + { + imprimirLinhas( fichasTable.getSelectedRows() ); + } + + public void imprimirTodas() + { + int linhas[] = new int[ fichasTable.getRowCount() ]; + for( int n = 0; n < linhas.length; n++ ) + { + linhas[ n ] = n; + } + imprimirLinhas( linhas ); + } + + protected void imprimirLinhas( int linhas[] ) + { + try + { + File file = new File( pathText.getText().trim() ); + if( !file.exists() || !file.isDirectory() ) + { + throw new IOException( "Direct\u00f3rio inexistente ou indispon\u00edvel: " + pathText.getText().trim() ); + } + } + catch( IOException ioex ) + { + JOptionPane.showMessageDialog( this, ioex.getMessage(), "Erro...", + JOptionPane.ERROR_MESSAGE ); + return; + } + String impressora = ( String ) impressorasCombo.getSelectedItem(); + Integer ids[] = new Integer[ linhas.length ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( ( ColumnizedObjectArray )fichasModel.getRowAt( linhas[ n ] ) ).getID(); + } + int option = JOptionPane.showConfirmDialog( this, "Imprimir as " + ids.length + " fichas para a impressora " + impressora + "?", + "Imprimir", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); + if( option == 0 ) + { + System.out.println( "imprimir" ); + new FichasPrinter( ids, impressora, pathText.getText().trim(), + empresasModel.getRowAt( empresasTable.getSelectedRow() ).toString(), + estabelecimentosModel.getRowAt( estabelecimentosTable.getSelectedRow() ).toString() ).start(); + } + } + + protected void escolherDirectorio() + { + JFileChooser chooser = new JFileChooser(); + chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY ); + int returnVal = chooser.showOpenDialog( this ); + if(returnVal == JFileChooser.APPROVE_OPTION) + { + setDirectorio( chooser.getSelectedFile().getAbsolutePath() ); + } + } + + protected void setDirectorio( String path ) + { + if( path != null ) + { + pathText.setText( path ); + Properties properties = propertyHandler.load(); + properties.setProperty( getClass().getName() + PATH_PROPERTY_SUFFIX, path ); + try + { + propertyHandler.save( properties ); + } + catch( IOException ioex ) + { + ioex.printStackTrace(); + } + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/impressaofichas/lista_fichas.xsl b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/lista_fichas.xsl new file mode 100644 index 00000000..46096481 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/impressaofichas/lista_fichas.xsl @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + RELAÇÃO DE FICHAS DE APTIDÃO ENVIADAS + + + + + + + + + + + + NOME + + + + + DATA EXAME + + + + + PRÓXIMO EXAME + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/Lembrete.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/Lembrete.java new file mode 100644 index 00000000..67d73eff --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/Lembrete.java @@ -0,0 +1,194 @@ +/* + * Lembrete.java + * + * Created on 12 de Fevereiro de 2007, 23:18 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import java.util.Date; + +/** + * + * @author Frederico + */ +public class Lembrete +{ + protected Integer id; + protected Integer tipoID; + protected Date data; + protected String descricao; + protected String texto; + protected Integer empresaID; + protected Integer estabelecimentoID; + protected Integer trabalhadorID; + protected Integer marcacaoEstabelecimentoID; + protected Integer marcacaoTrabalhadorID; + protected boolean enviarEmail; + protected Integer periodicidadeDias; + protected Integer periodicidadeMeses; + + /** Creates a new instance of Lembrete */ + public Lembrete( Integer id, + Integer tipoID, + Date data, + String descricao, + String texto, + Integer empresaID, + Integer estabelecimentoID, + Integer trabalhadorID, + Integer marcacaoEstabelecimentoID, + Integer marcacaoTrabalhadorID, + boolean enviarEmail, + Integer periodicidadeDias, + Integer periodicidadeMeses ) + { + setId( id ); + setTipoID( tipoID ); + setData( data ); + setDescricao( descricao ); + setTexto( texto ); + setEmpresaID( empresaID ); + setEstabelecimentoID( estabelecimentoID ); + setTrabalhadorID( trabalhadorID ); + setMarcacaoEstabelecimentoID( marcacaoEstabelecimentoID ); + setMarcacaoTrabalhadorID( marcacaoTrabalhadorID ); + setEnviarEmail( enviarEmail ); + setPeriodicidadeDias( periodicidadeDias ); + setPeriodicidadeMeses( periodicidadeMeses ); + } + + public Integer getTipoID() + { + return tipoID; + } + + public void setTipoID(Integer tipoID) + { + this.tipoID = tipoID; + } + + public Date getData() + { + return data; + } + + public void setData(Date data) + { + this.data = data; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao(String descricao) + { + this.descricao = descricao; + } + + public String getTexto() + { + return texto; + } + + public void setTexto(String texto) + { + this.texto = texto; + } + + public Integer getEmpresaID() + { + return empresaID; + } + + public void setEmpresaID(Integer empresaID) + { + this.empresaID = empresaID; + } + + public Integer getEstabelecimentoID() + { + return estabelecimentoID; + } + + public void setEstabelecimentoID(Integer estabelecimentoID) + { + this.estabelecimentoID = estabelecimentoID; + } + + public Integer getTrabalhadorID() + { + return trabalhadorID; + } + + public void setTrabalhadorID(Integer trabalhadorID) + { + this.trabalhadorID = trabalhadorID; + } + + public Integer getMarcacaoEstabelecimentoID() + { + return marcacaoEstabelecimentoID; + } + + public void setMarcacaoEstabelecimentoID(Integer marcacaoEstabelecimentoID) + { + this.marcacaoEstabelecimentoID = marcacaoEstabelecimentoID; + } + + public Integer getMarcacaoTrabalhadorID() + { + return marcacaoTrabalhadorID; + } + + public void setMarcacaoTrabalhadorID(Integer marcacaoTrabalhadorID) + { + this.marcacaoTrabalhadorID = marcacaoTrabalhadorID; + } + + public boolean isEnviarEmail() + { + return enviarEmail; + } + + public void setEnviarEmail(boolean enviarEmail) + { + this.enviarEmail = enviarEmail; + } + + public Integer getPeriodicidadeDias() + { + return periodicidadeDias; + } + + public void setPeriodicidadeDias(Integer periodicidadeDias) + { + this.periodicidadeDias = periodicidadeDias; + } + + public Integer getPeriodicidadeMeses() + { + return periodicidadeMeses; + } + + public void setPeriodicidadeMeses(Integer periodicidadeMeses) + { + this.periodicidadeMeses = periodicidadeMeses; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer id) + { + this.id = id; + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesConstants.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesConstants.java new file mode 100644 index 00000000..13f576b7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesConstants.java @@ -0,0 +1,26 @@ +/* + * LembretesConstants.java + * + * Created on February 12, 2007, 4:44 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +/** + * + * @author fpalma + */ +public interface LembretesConstants +{ + public static final String CODE_EXTERNO = "EXTERNO"; + public static final String CODE_REMARCACOES = "REMARCACOES"; + public static final String CODE_MARCACOES = "MARCACOES"; + public static final String CODE_OUTROS = "OUTROS"; + + public static final String CODES[] = + new String[]{ CODE_EXTERNO, CODE_REMARCACOES, CODE_MARCACOES, + CODE_OUTROS }; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesDataProvider.java new file mode 100644 index 00000000..9a9d9701 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesDataProvider.java @@ -0,0 +1,245 @@ +/* + * LembretesDataProvider.java + * + * Created on February 5, 2007, 6:09 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Delete; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import java.util.Date; +import java.util.HashMap; + +/** + * + * @author lflores + */ +public class LembretesDataProvider +{ + private static final Object LOCK = new Object(); + private static LembretesDataProvider instance = null; + + private final HashMap TIPOS_LEMBRETES_BY_CODIGO = + new HashMap(); + private final HashMap TIPOS_LEMBRETES_BY_ID = + new HashMap(); + private TipoLembrete tiposLembrete[]; + + private Executer EXECUTER; + + /** Creates a new instance of LembretesDataProvider */ + public LembretesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + } + + public static LembretesDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LembretesDataProvider(); + } + } + return instance; + } + + public TipoLembrete[] getTiposLembrete() + throws Exception + { + if( tiposLembrete == null ) + { + Select select = + new Select( new String[]{ "lembretes_tipos" }, + new String[]{ "id", "codigo", "descricao", "ordem" }, + new Field( "activo" ).isEqual( "y" ), + new String[]{ "ordem" }, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + tiposLembrete = new TipoLembrete[ array.columnLength() ]; + for( int n = 0; n < tiposLembrete.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String codigo = ( String ) array.get( n, 1 ); + String descricao = ( String ) array.get( n, 2 ); + Integer ordem = ( Integer ) array.get( n, 3 ); + tiposLembrete[ n ] = new TipoLembrete( id, codigo, descricao, ordem ); + TIPOS_LEMBRETES_BY_CODIGO.put( codigo, tiposLembrete[ n ] ); + TIPOS_LEMBRETES_BY_ID.put( id, tiposLembrete[ n ] ); + } + } + return tiposLembrete; + } + + public TipoLembrete getTipoLembreteByCodigo( String codigo ) + throws Exception + { + getTiposLembrete(); + return TIPOS_LEMBRETES_BY_CODIGO.get( codigo ); + } + + public TipoLembrete getTipoLembreteByID( Integer id ) + throws Exception + { + getTiposLembrete(); + return TIPOS_LEMBRETES_BY_ID.get( id ); + } + + public void criarLembrete( Integer tipoID, + Date data, + String descricao, + String texto, + Integer empresaID, + Integer estabelecimentoID, + Integer trabalhadorID, + Integer marcacaoEstabelecimentoID, + Integer marcacaoTrabalhadorID, + boolean enviarEmail, + Integer periodicidadeDias, + Integer periodicidadeMeses ) + throws Exception + { + Insert insert = + new Insert( "lembretes", + new Assignment[]{ + new Assignment( new Field( "tipo_id" ), tipoID ), + new Assignment( new Field( "data" ), data ), + new Assignment( new Field( "descricao" ), descricao ), + new Assignment( new Field( "texto" ), texto ), + new Assignment( new Field( "empresa_id" ), empresaID ), + new Assignment( new Field( "estabelecimento_id" ), estabelecimentoID ), + new Assignment( new Field( "trabalhador_id" ), trabalhadorID ), + new Assignment( new Field( "marcacao_estabelecimento_id" ), marcacaoEstabelecimentoID ), + new Assignment( new Field( "marcacao_trabalhador_id" ), marcacaoTrabalhadorID ), + new Assignment( new Field( "enviar_email" ), enviarEmail ? "y" : "n" ), + new Assignment( new Field( "periodicidade_dias" ), periodicidadeDias ), + new Assignment( new Field( "periodicidade_meses" ), periodicidadeMeses ) } ); + EXECUTER.executeQuery( insert ); + } + + public void apagarLembreteByID( Integer id ) + throws Exception + { + Delete delete = + new Delete( "lembretes", + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( delete ); + } + + public void apagarLembreteByMarcacaoTrabalhadorID( Integer marcacaoID ) + throws Exception + { + Delete delete = + new Delete( "lembretes", + new Field( "marcacao_trabalhador_id" ).isEqual( marcacaoID ) ); + EXECUTER.executeQuery( delete ); + } + + public int countLembretesByTipo( Integer tipoID ) + throws Exception + { + Select select = + new Select( new String[]{ "lembretes" }, + new String[]{ "COUNT(*)" }, + new Field( "tipo_id" ).isEqual( tipoID ).and( + new Field( "data" ).isLessOrEqual( new Date() ) ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + else + { + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + + } + + public Lembrete[] getLembretesByTipo( Integer tipoID ) + throws Exception + { + Select select = + new Select( new String[]{ "lembretes" }, + new String[]{ "id", "tipo_id", "data", "descricao", + "texto", "empresa_id", "estabelecimento_id", + "trabalhador_id", "marcacao_estabelecimento_id", + "marcacao_trabalhador_id", "enviar_email", + "periodicidade_dias", "periodicidade_meses" }, + new Field( "tipo_id" ).isEqual( tipoID ).and( + new Field( "data" ).isLessOrEqual( new Date() ) ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Lembrete lembretes[] = new Lembrete[ array.columnLength() ]; + for( int n = 0; n < lembretes.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + Date data = ( Date ) array.get( n, 2 ); + String descricao = ( String ) array.get( n, 3 ); + String texto = ( String ) array.get( n, 4 ); + Integer empresaID = ( Integer ) array.get( n, 5 ); + Integer estabelecimentoID = ( Integer ) array.get( n, 6 ); + Integer trabalhadorID = ( Integer ) array.get( n, 7 ); + Integer marcacaoEstabelecimentoID = ( Integer ) array.get( n, 8 ); + Integer marcacaoTrabalhadorID = ( Integer ) array.get( n, 9 ); + boolean enviarEmail = "y".equals( array.get( n, 10 ) ); + Integer periodicidadeDias = ( Integer ) array.get( n, 11 ); + Integer periodicidadeMeses = ( Integer ) array.get( n, 12 ); + lembretes[ n ] = new Lembrete( id, tipoID, data, descricao, texto, + empresaID, estabelecimentoID, trabalhadorID, + marcacaoEstabelecimentoID, marcacaoTrabalhadorID, + enviarEmail, periodicidadeDias, periodicidadeMeses ); + } + return lembretes; + } + + public Lembrete getLembreteByID( Integer id ) + throws Exception + { + Select select = + new Select( new String[]{ "lembretes" }, + new String[]{ "id", "tipo_id", "data", "descricao", + "texto", "empresa_id", "estabelecimento_id", + "trabalhador_id", "marcacao_estabelecimento_id", + "marcacao_trabalhador_id", "enviar_email", + "periodicidade_dias", "periodicidade_meses" }, + new Field( "id" ).isEqual( id ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + Integer tipoID = ( Integer ) array.get( 0, 1 ); + Date data = ( Date ) array.get( 0, 2 ); + String descricao = ( String ) array.get( 0, 3 ); + String texto = ( String ) array.get( 0, 4 ); + Integer empresaID = ( Integer ) array.get( 0, 5 ); + Integer estabelecimentoID = ( Integer ) array.get( 0, 6 ); + Integer trabalhadorID = ( Integer ) array.get( 0, 7 ); + Integer marcacaoEstabelecimentoID = ( Integer ) array.get( 0, 8 ); + Integer marcacaoTrabalhadorID = ( Integer ) array.get( 0, 9 ); + boolean enviarEmail = "y".equals( array.get( 0, 10 ) ); + Integer periodicidadeDias = ( Integer ) array.get( 0, 11 ); + Integer periodicidadeMeses = ( Integer ) array.get( 0, 12 ); + return new Lembrete( id, tipoID, data, descricao, texto, + empresaID, estabelecimentoID, trabalhadorID, + marcacaoEstabelecimentoID, marcacaoTrabalhadorID, + enviarEmail, periodicidadeDias, periodicidadeMeses ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesPanel.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesPanel.java new file mode 100644 index 00000000..1e7375cf --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesPanel.java @@ -0,0 +1,31 @@ +/* + * LembretesPanel.java + * + * Created on February 6, 2007, 5:14 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import java.awt.*; +import javax.swing.*; + +/** + * + * @author fpalma + */ +public class LembretesPanel extends JPanel +{ + + /** Creates a new instance of LembretesPanel */ + public LembretesPanel() + { + setupComponents(); + } + + private void setupComponents() + { + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesWindow.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesWindow.java new file mode 100644 index 00000000..dfd77b34 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/LembretesWindow.java @@ -0,0 +1,190 @@ +/* + * LembretesWindow.java + * + * Created on 13 de Fevereiro de 2007, 11:11 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import java.awt.*; +import java.awt.event.ActionEvent; +import javax.swing.*; + +import com.evolute.utils.tables.*; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Vector; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import siprp.lembretes.remarcacoes.LembretesRemarcacaoPanel; + +/** + * + * @author Frederico + */ +public class LembretesWindow extends JFrame + implements ActionListener, TrackableWindow, ListSelectionListener, + LembretesConstants +{ + public static final String TITLE = "Lembretes"; + + protected VectorTableModel tiposModel; + protected BaseTable tiposTable; + protected JPanel lembretesPanel; + protected JButton recarregarButton; + + protected LembretesDataProvider provider; + + /** Creates a new instance of LembretesWindow */ + public LembretesWindow() + throws Exception + { + provider = LembretesDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Lembretes" ); + tiposModel = new VectorTableModel( new String[]{ "tipo", "quantidade" } ); + tiposTable = new BaseTable( tiposModel ); + tiposTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + tiposTable.fixColumnWidth( 0, 200 ); + tiposTable.fixColumnWidth( 1, 100 ); + tiposTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane scp = + new JScrollPane( tiposTable, JScrollPane.VERTICAL_SCROLLBAR_NEVER, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + scp.setPreferredSize( new Dimension( 300, 20 ) ); + lembretesPanel = new JPanel(); + lembretesPanel.setLayout( new GridLayout( 1, 1 ) ); + recarregarButton = new JButton( "Recarregar" ); + recarregarButton.addActionListener( this ); + + getContentPane().setLayout( new BorderLayout() ); + getContentPane().add( scp, BorderLayout.WEST ); + getContentPane().add( lembretesPanel, BorderLayout.CENTER ); + getContentPane().add( recarregarButton, BorderLayout.SOUTH ); + + addWindowListener( new WindowAdapter(){ + public void windowClosing( WindowEvent e ) + { + close(); + } + + public void windowOpened( WindowEvent e ) + { +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + setSize( 1024, 700 ); + reloadTotais(); + } + } ); + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + protected void reloadTotais() + { + try + { + Vector values = tiposModel.getValues(); + values.clear(); + TipoLembrete tipos[] = provider.getTiposLembrete(); + for( int n = 0; n < tipos.length; n++ ) + { + int count = provider.countLembretesByTipo( tipos[ n ].getID() ); + values.add( new ColumnizedObjectArray( + new Object[]{ tipos[ n ].getID(), tipos[ n ].getDescricao(), + "" + count }, true ) ); + } + tiposModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar lembretes", true ); + } + } + + protected void reloadLembretes() + { + lembretesPanel.removeAll(); + int selected = tiposTable.getSelectedRow(); + if( selected != -1 ) + { + ColumnizedObjectArray line = ( ColumnizedObjectArray ) tiposModel.getRowAt( selected ); + Integer tipoID = line.getID(); + try + { + TipoLembrete tipo = provider.getTipoLembreteByID( tipoID ); + if( CODE_EXTERNO.equals( tipo.getCodigo() ) ) + { + + } + if( CODE_REMARCACOES.equals( tipo.getCodigo() ) ) + { + lembretesPanel.add( new LembretesRemarcacaoPanel() ); + } + if( CODE_MARCACOES.equals( tipo.getCodigo() ) ) + { + } + if( CODE_OUTROS.equals( tipo.getCodigo() ) ) + { + } + + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar lembretes", true ); + } + } + validate(); + repaint(); + } + + public boolean closeIfPossible() + { + close(); + return true; + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( recarregarButton ) ) + { + reloadTotais(); + } + } + + public void valueChanged(ListSelectionEvent e) + { + if( !e.getValueIsAdjusting() ) + { + reloadLembretes(); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/TipoLembrete.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/TipoLembrete.java new file mode 100644 index 00000000..e5564393 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/TipoLembrete.java @@ -0,0 +1,65 @@ +/* + * TipoLembrete.java + * + * Created on February 5, 2007, 6:28 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes; + +import com.evolute.utils.data.IDObject; + +/** + * + * @author lflores + */ +public class TipoLembrete + implements IDObject, Comparable +{ + protected Integer id; + protected String codigo; + protected String descricao; + protected Integer ordem; + + /** Creates a new instance of TipoLembrete */ + public TipoLembrete( Integer id, String codigo, String descricao, + Integer ordem ) + { + this.id = id; + this.codigo = codigo; + this.descricao = descricao; + this.ordem = ordem; + } + + public Integer getID() + { + return id; + } + + protected String getCodigo() + { + return codigo; + } + + protected String getDescricao() + { + return descricao; + } + + protected Integer getOrdem() + { + return ordem; + } + + public int compareTo( Object other ) + { + if( !( other instanceof TipoLembrete ) ) + { + return 0; + } + TipoLembrete otl = ( TipoLembrete ) other; + return getOrdem().compareTo( otl.getOrdem() ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/LembretesRemarcacaoPanel.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/LembretesRemarcacaoPanel.java new file mode 100644 index 00000000..5638688a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/LembretesRemarcacaoPanel.java @@ -0,0 +1,88 @@ +/* + * LembretesRemarcacaoPanel.java + * + * Created on 13 de Fevereiro de 2007, 23:24 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel; +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.util.List; +import java.util.Vector; +import javax.swing.*; +import siprp.lembretes.Lembrete; +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; + +/** + * + * @author Frederico + */ +public class LembretesRemarcacaoPanel extends JPanel + implements LembretesConstants +{ + protected JScrollPane listTrabalhadoresScroll; + protected JScrollPane listEstabelecimentosScroll; + protected MultipleActionListPanel listTrabalhadoresPanel; + protected MultipleActionListPanel listEstabelecimentosPanel; + + protected RemarcacoesDataProvider provider; + + private JDOProvider JDO; + + /** Creates a new instance of LembretesRemarcacaoPanel */ + public LembretesRemarcacaoPanel() + throws Exception + { + provider = RemarcacoesDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + listTrabalhadoresPanel = + new MultipleActionListPanel( + new RemarcacoesActionFactory[]{ }, + new RemarcacoesActionFactory[]{ new RemarcacoesActionFactory( RemarcacoesActionFactory.TRABALHADOR ) } ); + listTrabalhadoresScroll = + new JScrollPane( listTrabalhadoresPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + listEstabelecimentosPanel = + new MultipleActionListPanel( + new RemarcacoesActionFactory[]{ }, + new RemarcacoesActionFactory[]{ new RemarcacoesActionFactory( RemarcacoesActionFactory.ESTABELECIMENTO ) } ); + listEstabelecimentosScroll = + new JScrollPane( listEstabelecimentosPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + setLayout( new GridLayout( 1, 2 ) ); + JPanel trabalhadoresPanel = new JPanel(); + JPanel estabelecimentosPanel = new JPanel(); + add( trabalhadoresPanel ); + add( estabelecimentosPanel ); + + trabalhadoresPanel.setLayout( new BorderLayout() ); + trabalhadoresPanel.add( new JLabel( "Consultas / ECDs", JLabel.CENTER ), BorderLayout.NORTH ); + trabalhadoresPanel.add( listTrabalhadoresScroll, BorderLayout.CENTER ); + + estabelecimentosPanel.setLayout( new BorderLayout() ); + estabelecimentosPanel.add( new JLabel( "Higiene e Seguran\u00e7a", JLabel.CENTER ), BorderLayout.NORTH ); + estabelecimentosPanel.add( listEstabelecimentosScroll, BorderLayout.CENTER ); + + listTrabalhadoresPanel.showList( provider.getLembretesRemarcacaoTrabalhador() ); +// listEstabelecimentosPanel.showList( estabelecimentos.toArray( new IDObject[ estabelecimentos.size() ] ) ); + } + + protected String criarDetalhesMarcacaoTrabalhador( Integer marcacaoID ) + { + return null; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesActionFactory.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesActionFactory.java new file mode 100644 index 00000000..25b84227 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesActionFactory.java @@ -0,0 +1,57 @@ +/* + * RemarcacoesActionFactory.java + * + * Created on January 31, 2007, 6:37 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.panel.multipleactionlist.ActionFactory; +import javax.swing.Action; +import siprp.lembretes.remarcacoes.actions.TratarMarcacaoEstabelecimentoAction; +import siprp.lembretes.remarcacoes.actions.TratarMarcacaoTrabalhadorAction; + +/** + * + * @author fpalma + */ +public class RemarcacoesActionFactory implements ActionFactory +{ + public static final int TRABALHADOR = 0; + public static final int ESTABELECIMENTO = 1; + + protected final int TIPO; + + /** + * Creates a new instance of RemarcacoesActionFactory + */ + public RemarcacoesActionFactory( int tipo ) + { + TIPO = tipo; + } + + public Action createAction(IDObject[] objects) + { + return null; + } + + public Action createAction(IDObject object) + { + switch( TIPO ) + { + case TRABALHADOR: + return new TratarMarcacaoTrabalhadorAction( object ); + + case ESTABELECIMENTO: + return new TratarMarcacaoEstabelecimentoAction( object ); + + default: + return null; + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesDataProvider.java new file mode 100644 index 00000000..209cccf1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/RemarcacoesDataProvider.java @@ -0,0 +1,124 @@ +/* + * RemarcacoesDataProvider.java + * + * Created on February 14, 2007, 10:56 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import java.text.DateFormat; +import java.util.Date; +import java.util.Locale; +import siprp.data.Marcacao; +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; + +/** + * + * @author lflores + */ +public class RemarcacoesDataProvider +{ + private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + private static final Object LOCK = new Object(); + private static RemarcacoesDataProvider instance = null; + + private Executer EXECUTER; + private LembretesDataProvider lembretesProvider; + + /** Creates a new instance of RemarcacoesDataProvider */ + public RemarcacoesDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + lembretesProvider = LembretesDataProvider.getProvider(); + } + + public static RemarcacoesDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new RemarcacoesDataProvider(); + } + } + return instance; + } + + public IDObject[] getLembretesRemarcacaoTrabalhador() + throws Exception + { + Select select = + new Select2( new String[]{ "lembretes", "marcacoes_trabalhador", "trabalhadores", + "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "lembretes.marcacao_trabalhador_id" ).isEqual( new Field( "marcacoes_trabalhador.id" ) ), + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ), + }, + new String[]{ "lembretes.id", "lembretes.descricao", + "marcacoes_trabalhador.tipo", "marcacoes_trabalhador.data", + "trabalhadores.nome", "estabelecimentos.nome", "empresas.designacao_social", + "trabalhadores.nome_plain" }, + new Field( "lembretes.tipo_id" ).isEqual( + lembretesProvider.getTipoLembreteByCodigo( LembretesConstants.CODE_REMARCACOES ).getID() ).and( + new Field( "lembretes.data" ).isLessOrEqual( new Field( "current_date" ) ) ), + new String[]{ "trabalhadores.nome_plain" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject lembretes[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < lembretes.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String descricao = ( String ) array.get( n, 1 ); + Integer tipoMarcacao = ( Integer ) array.get( n, 2 ); + String tipoMarcacaoStr = ""; + switch( tipoMarcacao.intValue() ) + { + case Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES: + tipoMarcacaoStr = "ECDs"; + break; + + case Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA: + tipoMarcacaoStr = "Consulta"; + break; + } + Date data = ( Date ) array.get( n, 3 ); + String trabalhador = ( String ) array.get( n, 4 ); + String split[] = trabalhador.split( " " ); + trabalhador = split[ 0 ] + " " + ( split.length > 2 ? split[ 1 ].charAt( 0 ) + ". " : " " ) + + ( split.length > 1 ? split[ split.length - 1 ] : "" ); + String estabelecimento = ( String ) array.get( n, 5 ); + String empresa = ( String ) array.get( n, 6 ); + String str = "" + trabalhador + "" + + "
   " + tipoMarcacaoStr + " de " + D_F.format( data ) + + "
   " + descricao + "" + + "
   " + empresa.substring( 0, empresa.length() > 20 ? 20 : empresa.length() ) + + " / " + estabelecimento.substring( 0, estabelecimento.length() > 10 ? 10 : estabelecimento.length() ) + + ""; + lembretes[ n ] = new MappableObject( id, str ); + } + return lembretes; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoEstabelecimentoAction.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoEstabelecimentoAction.java new file mode 100644 index 00000000..58047330 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoEstabelecimentoAction.java @@ -0,0 +1,42 @@ +/* + * tratarMarcacaoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes.actions; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; + +/** + * + * @author fpalma + */ +public class TratarMarcacaoEstabelecimentoAction extends AbstractAction +{ + /** + * Creates a new instance of tratarMarcacaoTrabalhadorAction + */ + public TratarMarcacaoEstabelecimentoAction( IDObject marcacaoID ) + { + super( "Tratar" ); + } + + public void actionPerformed(ActionEvent e) + { + try + { + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoTrabalhadorAction.java b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoTrabalhadorAction.java new file mode 100644 index 00000000..5de7330c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/lembretes/remarcacoes/actions/TratarMarcacaoTrabalhadorAction.java @@ -0,0 +1,88 @@ +/* + * TratarMarcacaoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.lembretes.remarcacoes.actions; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; +import siprp.SIPRPTracker; +import siprp.SingletonConstants; +import siprp.data.EmpresaData; +import siprp.data.EstabelecimentoData; +import siprp.data.MarcacaoTrabalhadorData; +import siprp.data.TrabalhadorData; +import siprp.lembretes.Lembrete; +import siprp.lembretes.LembretesDataProvider; + +/** + * + * @author fpalma + */ +public class TratarMarcacaoTrabalhadorAction extends AbstractAction +{ + private LembretesDataProvider lembretesProvider; + private JDOProvider JDO; + private SIPRPTracker tracker; + + private Integer lembreteID; + + /** + * Creates a new instance of TratarMarcacaoTrabalhadorAction + */ + public TratarMarcacaoTrabalhadorAction( IDObject lembrete ) + { + super( "Tratar" ); + try + { + lembreteID = lembrete.getID(); + lembretesProvider = LembretesDataProvider.getProvider(); + JDO = (JDOProvider) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + + public void actionPerformed(ActionEvent e) + { + try + { + tracker = ( SIPRPTracker ) Singleton.getInstance( SingletonConstants.SIPRP_TRACKER ); + Lembrete lembrete = lembretesProvider.getLembreteByID( lembreteID ); + if( lembrete == null ) + { + JOptionPane.showMessageDialog( null, "Este lembrete j\u00e1 foi tratado.", "J\u00e1 tratado", + JOptionPane.WARNING_MESSAGE ); + return; + } + MarcacaoTrabalhadorData marcacao = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, lembrete.getMarcacaoTrabalhadorID() ); + TrabalhadorData trabalhador = ( TrabalhadorData ) marcacao.get( MarcacaoTrabalhadorData.TRABALHADOR ); + EstabelecimentoData estabelecimento = ( EstabelecimentoData ) trabalhador.get( TrabalhadorData.ESTABELECIMENTO ); + EmpresaData empresa = ( EmpresaData ) estabelecimento.get( EstabelecimentoData.EMPRESA ); + + lembretesProvider.apagarLembreteByID( lembreteID ); + setEnabled( false ); + tracker.getMedicinaWindow().setVisible( true ); + tracker.getMedicinaWindow().setEmpresaAndEstabelecimentoAndTrabalhador( (Integer) empresa.get( EmpresaData.ID ), + ( Integer ) estabelecimento.get( EstabelecimentoData.ID ), + ( Integer ) trabalhador.get( TrabalhadorData.ID ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a tratar", true ); + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaExtendedPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaExtendedPanel.java new file mode 100644 index 00000000..b1cfe077 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaExtendedPanel.java @@ -0,0 +1,31 @@ +/* + * MarcacaoConsultaExtendedPanel.java + * + * Created on 13 de Fevereiro de 2007, 20:36 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import java.awt.*; +import javax.swing.*; + +/** + * + * @author Frederico + */ +public class MarcacaoConsultaExtendedPanel extends JPanel +{ + + /** Creates a new instance of MarcacaoConsultaExtendedPanel */ + public MarcacaoConsultaExtendedPanel() + { + setupComponents(); + } + + private void setupComponents() + { + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.java new file mode 100644 index 00000000..5404688a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.java @@ -0,0 +1,303 @@ +package siprp.medicina; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.db.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.text.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import siprp.data.*; + +public class MarcacaoConsultaPanel + extends JPanel + implements ControllableComponent, DataClassAware +{ + private siprp.data.MarcacaoTrabalhadorData marcacaoTrabalhadorData; + private final ComponentsHashtable components = new ComponentsHashtable(); + + protected final SQLExecuter EXECUTER; + + private final JLabel dataLabel = new JLabel( "Data da consulta", JLabel.RIGHT ); + private final JCalendarPanel dataPanel = new JCalendarPanel( null ); + private final JButton emailButton = new JButton( "Enviar Email" ); + private final JLabel dataFichaLabel = new JLabel( "Data da Ficha de Aptid\u00e3o", JLabel.RIGHT ); + private final JCalendarPanel dataFichaPanel = new JCalendarPanel( null ); + private RadioButtonFixedPanel tipoList; + private RadioButtonFixedPanel estadoList; + private final JScrollPane observacoesTextScroll = new JScrollPane(); + private final StateTextArea observacoesText = new StateTextArea(); + + public MarcacaoConsultaPanel() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + if( dbm != null ) + { + EXECUTER = ( SQLExecuter )dbm.getSharedExecuter( this ); + } + else + { + EXECUTER = null; + } + setupComponents(); + setupComponentsHashtable(); + place(); + } + + public void setupComponents() + throws Exception + { + JComponent MarcacaoConsultaPanel = this; + dataPanel.setMinimumSize( new Dimension( 300, 20 ) ); + dataPanel.setPreferredSize( new Dimension( 100, 20 ) ); + + emailButton.setMinimumSize( new Dimension( 300, 20 ) ); + emailButton.setPreferredSize( new Dimension( 200, 20 ) ); + + dataFichaPanel.setMinimumSize( new Dimension( 300, 20 ) ); + dataFichaPanel.setPreferredSize( new Dimension( 100, 20 ) ); + + IDObject tipoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 1 ), "Admiss\u00e3o" ), + new MappableObject( new Integer( 2 ), "Peri\u00f3dico" ), + new MappableObject( new Integer( 5 ), "Peri\u00f3dico inicial" ), + new MappableObject( new Integer( 3 ), "Ocasional" ), + }; + tipoList = new RadioButtonFixedPanel( tipoListOptions, 4, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + tipoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Tipo" ) ); + + IDObject estadoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 0 ), "Por realizar" ), + new MappableObject( new Integer( 2 ), "Realizada" ), + new MappableObject( new Integer( 3 ), "Desmarcada pelo trabalhador" ), + new MappableObject( new Integer( 4 ), "Desmarcada pela SIPRP" ), + new MappableObject( new Integer( 5 ), "Faltou" ), + }; + estadoList = new RadioButtonFixedPanel( estadoListOptions, 6, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + estadoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Estado" ) ); + + observacoesTextScroll.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + observacoesText.setLineWrap( true ); + observacoesText.setWrapStyleWord( true ); + observacoesText.setRows( 5 ); + + } + + public void place() + { + JPanel MarcacaoConsultaPanel = this; + GridBagConstraints MarcacaoConsultaPanelGBC = new GridBagConstraints(); + MarcacaoConsultaPanelGBC.insets = new Insets( 1, 1, 1, 1 ); + GridBagLayout MarcacaoConsultaPanelLayout = new GridBagLayout(); + MarcacaoConsultaPanel.setLayout( MarcacaoConsultaPanelLayout ); + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 0; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.0; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataLabel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataLabel ); + + MarcacaoConsultaPanelGBC.gridx = 1; + MarcacaoConsultaPanelGBC.gridy = 0; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataPanel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataPanel ); + + MarcacaoConsultaPanelGBC.gridx = 2; + MarcacaoConsultaPanelGBC.gridy = 0; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.NONE; + MarcacaoConsultaPanelLayout.setConstraints( emailButton, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( emailButton ); + + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 1; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.0; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataFichaLabel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataFichaLabel ); + + MarcacaoConsultaPanelGBC.gridx = 1; + MarcacaoConsultaPanelGBC.gridy = 1; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoConsultaPanelLayout.setConstraints( dataFichaPanel, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( dataFichaPanel ); + + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 2; + MarcacaoConsultaPanelGBC.gridwidth = 2; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoConsultaPanelLayout.setConstraints( tipoList, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( tipoList ); + + MarcacaoConsultaPanelGBC.gridx = 2; + MarcacaoConsultaPanelGBC.gridy = 2; + MarcacaoConsultaPanelGBC.gridwidth = 1; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 0.5; + MarcacaoConsultaPanelGBC.weighty = 0.0; + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoConsultaPanelLayout.setConstraints( estadoList, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( estadoList ); + + MarcacaoConsultaPanelGBC.gridx = 0; + MarcacaoConsultaPanelGBC.gridy = 3; + MarcacaoConsultaPanelGBC.gridwidth = 3; + MarcacaoConsultaPanelGBC.gridheight = 1; + MarcacaoConsultaPanelGBC.weightx = 1.0; + MarcacaoConsultaPanelGBC.weighty = 1.0; + observacoesTextScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesTextScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + observacoesTextScroll.setViewportView( observacoesText ); + MarcacaoConsultaPanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoConsultaPanelLayout.setConstraints( observacoesTextScroll, MarcacaoConsultaPanelGBC ); + MarcacaoConsultaPanel.add( observacoesTextScroll ); + + } + + private void setupComponentsHashtable() + { + components.putComponent( siprp.data.MarcacaoTrabalhadorData.DATA, dataPanel ); + components.putComponent( siprp.data.MarcacaoTrabalhadorData.DATA_RELATORIO, dataFichaPanel ); + components.putComponent( siprp.data.MarcacaoTrabalhadorData.MOTIVO, tipoList ); + components.putComponent( siprp.data.MarcacaoTrabalhadorData.ESTADO, estadoList ); + components.putComponent( siprp.data.MarcacaoTrabalhadorData.OBSERVACOES, observacoesText ); + } + + public void fill( Object toFill ) + { + clear(); + if( toFill == null || !( toFill instanceof PropertyObject ) ) + { + return; + } + Hashtable data = null; + if( toFill instanceof PropertyObject ) + { + data = ( (PropertyObject) toFill ).getHashData(); + if( toFill instanceof siprp.data.MarcacaoTrabalhadorData ) + { + marcacaoTrabalhadorData = (siprp.data.MarcacaoTrabalhadorData) toFill; + } + } + else if( toFill instanceof Hashtable ) + { + data = (Hashtable) toFill; + } + else + { + return; + } + if( marcacaoTrabalhadorData == null ) + { + marcacaoTrabalhadorData = new siprp.data.MarcacaoTrabalhadorData(); + marcacaoTrabalhadorData.setHashData( data ); + } + PropertyObject po = (PropertyObject) toFill; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.fill( properties, po.getHashData(), components ); + } + + public Object save() + { + if( marcacaoTrabalhadorData == null ) + { + marcacaoTrabalhadorData = new siprp.data.MarcacaoTrabalhadorData(); + } + Hashtable data = marcacaoTrabalhadorData.getHashData(); + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.save( properties, data, components ); + if( !( marcacaoTrabalhadorData instanceof PropertyObject ) ) + { + return data; + } + marcacaoTrabalhadorData.setHashData( data ); + return marcacaoTrabalhadorData; + } + + public void clear() + { + marcacaoTrabalhadorData = null; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.clear( properties, components ); + } + + public void setEnabled( boolean enable ) + { + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.setEnabled( properties, enable, components ); + } + + public Class getDataClass() + { + return siprp.data.MarcacaoTrabalhadorData.class; + } + + public JLabel getDataFichaLabel() + { + return dataFichaLabel; + } + + public JCalendarPanel getDataFichaPanel() + { + return dataFichaPanel; + } + + public JLabel getDataLabel() + { + return dataLabel; + } + + public JCalendarPanel getDataPanel() + { + return dataPanel; + } + + public JButton getEmailButton() + { + return emailButton; + } + + public RadioButtonFixedPanel getEstadoList() + { + return estadoList; + } + + public StateTextArea getObservacoesText() + { + return observacoesText; + } + + public RadioButtonFixedPanel getTipoList() + { + return tipoList; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.xml b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.xml new file mode 100644 index 00000000..7229c554 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoConsultaPanel.xml @@ -0,0 +1,100 @@ + + + + + + + siprp.data.* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tipo + + 4 + + + Admiss\u00e3o + Peri\u00f3dico + Peri\u00f3dico inicial + Ocasional + + + + + Estado + + 6 + + + Por realizar + Realizada + Desmarcada pelo trabalhador + Desmarcada pela SIPRP + Faltou + + + + + + Observa\u00e7\u00f5es + + + 5 + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.java new file mode 100644 index 00000000..d1f4fd75 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.java @@ -0,0 +1,262 @@ +package siprp.medicina; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.db.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.text.*; +import java.awt.*; +import java.util.*; +import javax.swing.*; +import siprp.data.*; + +public class MarcacaoExamePanel + extends JPanel + implements ControllableComponent, DataClassAware +{ + private siprp.data.MarcacaoTrabalhadorData marcacaoTrabalhadorData; + private final ComponentsHashtable components = new ComponentsHashtable(); + + protected final SQLExecuter EXECUTER; + + private final JLabel dataLabel = new JLabel( "Data dos Exames", JLabel.RIGHT ); + private final JCalendarPanel dataPanel = new JCalendarPanel( null ); + private final JButton emailButton = new JButton( "Enviar Email" ); + private final JPanelControllable detalhesPanel = new JPanelControllable(); + private RadioButtonFixedPanel estadoList; + private final JScrollPane observacoesTextScroll = new JScrollPane(); + private final StateTextArea observacoesText = new StateTextArea(); + + public MarcacaoExamePanel() + throws Exception + { + DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + if( dbm != null ) + { + EXECUTER = ( SQLExecuter )dbm.getSharedExecuter( this ); + } + else + { + EXECUTER = null; + } + setupComponents(); + setupComponentsHashtable(); + place(); + } + + public void setupComponents() + throws Exception + { + JComponent MarcacaoExamePanel = this; + emailButton.setMinimumSize( new Dimension( 300, 20 ) ); + emailButton.setPreferredSize( new Dimension( 200, 20 ) ); + + detalhesPanel.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Detalhes" ) ); + + IDObject estadoListOptions[] = new IDObject[]{ + new MappableObject( new Integer( 0 ), "Por realizar" ), + new MappableObject( new Integer( 1 ), "Parcialmente realizados" ), + new MappableObject( new Integer( 2 ), "Realizados" ), + new MappableObject( new Integer( 3 ), "Desmarcados pelo trabalhador" ), + new MappableObject( new Integer( 4 ), "Desmarcados pela SIPRP" ), + new MappableObject( new Integer( 5 ), "Faltou" ), + }; + estadoList = new RadioButtonFixedPanel( estadoListOptions, 6, 1, RadioButtonFixedPanel.ORIENTATION_VERTICAL, false, null ); + estadoList.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Estado" ) ); + + observacoesTextScroll.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Observa\u00e7\u00f5es" ) ); + observacoesText.setLineWrap( true ); + observacoesText.setWrapStyleWord( true ); + observacoesText.setRows( 5 ); + + } + + public void place() + { + JPanel MarcacaoExamePanel = this; + GridBagConstraints detalhesPanelGBC = new GridBagConstraints(); + detalhesPanelGBC.insets = new Insets( 1, 1, 1, 1 ); + GridBagLayout detalhesPanelLayout = new GridBagLayout(); + detalhesPanel.setLayout( detalhesPanelLayout ); + GridBagConstraints MarcacaoExamePanelGBC = new GridBagConstraints(); + MarcacaoExamePanelGBC.insets = new Insets( 1, 1, 1, 1 ); + GridBagLayout MarcacaoExamePanelLayout = new GridBagLayout(); + MarcacaoExamePanel.setLayout( MarcacaoExamePanelLayout ); + MarcacaoExamePanelGBC.gridx = 0; + MarcacaoExamePanelGBC.gridy = 0; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.0; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoExamePanelLayout.setConstraints( dataLabel, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( dataLabel ); + + MarcacaoExamePanelGBC.gridx = 1; + MarcacaoExamePanelGBC.gridy = 0; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.HORIZONTAL; + MarcacaoExamePanelLayout.setConstraints( dataPanel, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( dataPanel ); + + MarcacaoExamePanelGBC.gridx = 2; + MarcacaoExamePanelGBC.gridy = 0; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.NONE; + MarcacaoExamePanelLayout.setConstraints( emailButton, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( emailButton ); + + MarcacaoExamePanelGBC.gridx = 0; + MarcacaoExamePanelGBC.gridy = 1; + MarcacaoExamePanelGBC.gridwidth = 2; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoExamePanelLayout.setConstraints( detalhesPanel, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( detalhesPanel ); + + MarcacaoExamePanelGBC.gridx = 2; + MarcacaoExamePanelGBC.gridy = 1; + MarcacaoExamePanelGBC.gridwidth = 1; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 0.5; + MarcacaoExamePanelGBC.weighty = 0.0; + MarcacaoExamePanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoExamePanelLayout.setConstraints( estadoList, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( estadoList ); + + MarcacaoExamePanelGBC.gridx = 0; + MarcacaoExamePanelGBC.gridy = 2; + MarcacaoExamePanelGBC.gridwidth = 3; + MarcacaoExamePanelGBC.gridheight = 1; + MarcacaoExamePanelGBC.weightx = 1.0; + MarcacaoExamePanelGBC.weighty = 1.0; + observacoesTextScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + observacoesTextScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + observacoesTextScroll.setViewportView( observacoesText ); + MarcacaoExamePanelGBC.fill = GridBagConstraints.BOTH; + MarcacaoExamePanelLayout.setConstraints( observacoesTextScroll, MarcacaoExamePanelGBC ); + MarcacaoExamePanel.add( observacoesTextScroll ); + + } + + private void setupComponentsHashtable() + { + components.putComponent( siprp.data.MarcacaoTrabalhadorData.DATA, dataPanel ); + components.putComponent( siprp.data.MarcacaoTrabalhadorData.ESTADO, estadoList ); + components.putComponent( siprp.data.MarcacaoTrabalhadorData.OBSERVACOES, observacoesText ); + } + + public void fill( Object toFill ) + { + clear(); + if( toFill == null || !( toFill instanceof PropertyObject ) ) + { + return; + } + Hashtable data = null; + if( toFill instanceof PropertyObject ) + { + data = ( (PropertyObject) toFill ).getHashData(); + if( toFill instanceof siprp.data.MarcacaoTrabalhadorData ) + { + marcacaoTrabalhadorData = (siprp.data.MarcacaoTrabalhadorData) toFill; + } + } + else if( toFill instanceof Hashtable ) + { + data = (Hashtable) toFill; + } + else + { + return; + } + if( marcacaoTrabalhadorData == null ) + { + marcacaoTrabalhadorData = new siprp.data.MarcacaoTrabalhadorData(); + marcacaoTrabalhadorData.setHashData( data ); + } + PropertyObject po = (PropertyObject) toFill; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.fill( properties, po.getHashData(), components ); + } + + public Object save() + { + if( marcacaoTrabalhadorData == null ) + { + marcacaoTrabalhadorData = new siprp.data.MarcacaoTrabalhadorData(); + } + Hashtable data = marcacaoTrabalhadorData.getHashData(); + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.save( properties, data, components ); + if( !( marcacaoTrabalhadorData instanceof PropertyObject ) ) + { + return data; + } + marcacaoTrabalhadorData.setHashData( data ); + return marcacaoTrabalhadorData; + } + + public void clear() + { + marcacaoTrabalhadorData = null; + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.clear( properties, components ); + } + + public void setEnabled( boolean enable ) + { + String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); + ComponentController.setEnabled( properties, enable, components ); + } + + public Class getDataClass() + { + return siprp.data.MarcacaoTrabalhadorData.class; + } + + public JLabel getDataLabel() + { + return dataLabel; + } + + public JCalendarPanel getDataPanel() + { + return dataPanel; + } + + public JPanelControllable getDetalhesPanel() + { + return detalhesPanel; + } + + public JButton getEmailButton() + { + return emailButton; + } + + public RadioButtonFixedPanel getEstadoList() + { + return estadoList; + } + + public StateTextArea getObservacoesText() + { + return observacoesText; + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.xml b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.xml new file mode 100644 index 00000000..bb5e2ab1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacaoExamePanel.xml @@ -0,0 +1,78 @@ + + + + + + + siprp.data.* + + + + + + + + + + + + + + + + + + + + + Detalhes + + + + + + + + + Estado + + 6 + + + Por realizar + Parcialmente realizados + Realizados + Desmarcados pelo trabalhador + Desmarcados pela SIPRP + Faltou + + + + + + Observa\u00e7\u00f5es + + + 5 + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacoesMedicinaHandler.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacoesMedicinaHandler.java new file mode 100644 index 00000000..2ccce75a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MarcacoesMedicinaHandler.java @@ -0,0 +1,93 @@ +/* + * MarcacoesMedicinaHandler.java + * + * Created on 28 de Abril de 2006, 9:56 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.jdo.*; + +import siprp.data.*; + +/** + * Classe auxiliar para tratamento de marcações de Medicina. + * + * @author Frederico + */ +public class MarcacoesMedicinaHandler +{ + /** Creates a new instance of MarcacoesMedicinaHandler */ + public MarcacoesMedicinaHandler() + { + } + + /** + * Ajusta os estado das marações corrente e seguinte para uma trabalhador. + * Este método é usado pelo sistema de marcaç&atild;o de fichas de aptidaão para ajustar + * as marcações existentes às escolhidas na ficha. + * + * @param trabalhadorID um inteiro que representa o trabalhador em questão + * @param motivoCorrente um inteiro que representa o motivo da marcação corrente (admissão/periódico/ocasional) + * @param dataCorrente a data que se pretende para a marcação corrente + * @param motivoSeguinte um inteiro que representa o motivo da marcação seguinte (admissão/periódico/ocasional) + * @param dataSeguinte a data que se pretende para a marcação seguinte + * @throws Exception se houver um erro na comunicação com a Base de Dados + */ + public void ajustarMarcacoes( Integer trabalhadorID, Integer motivoCorrente, Date dataCorrente, + Integer motivoSeguinte, Date dataSeguinte ) + throws Exception + { + Integer idCorrente; + Integer idSeguinte; + MedicinaDataProvider provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + JDOProvider JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + TrabalhadorData trabalhador = (TrabalhadorData)JDO.load( TrabalhadorData.class, trabalhadorID ); + + idCorrente = provider.getConsultaIDByTrabalhadorMotivoAndDate( trabalhadorID, motivoCorrente, dataCorrente ); + MarcacaoTrabalhadorData consultaCorrente; + if( idCorrente == null ) + { + consultaCorrente = new MarcacaoTrabalhadorData(); + consultaCorrente.set( MarcacaoTrabalhadorData.TRABALHADOR, trabalhador ); + consultaCorrente.set( MarcacaoTrabalhadorData.TIPO, new Integer( MarcacaoTrabalhadorData.TIPO_CONSULTA ) ); + consultaCorrente.set( Marcacao.DATA, dataCorrente ); + consultaCorrente.set( MarcacaoTrabalhadorData.MOTIVO, motivoCorrente ); + } + else + { + consultaCorrente = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, idCorrente ); + } + consultaCorrente.set( Marcacao.REALIZADA, "y" ); + consultaCorrente.set( MarcacaoTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_REALIZADO ) ); + consultaCorrente.save(); + + idSeguinte = provider.getConsultaIDByTrabalhadorMotivoAndDate( trabalhadorID, motivoSeguinte, dataSeguinte ); + if( idSeguinte == null ) + { + idSeguinte = provider.getProximaConsultaIDByTrabalhadorMotivoAndDate( trabalhadorID, motivoSeguinte, dataCorrente ); + MarcacaoTrabalhadorData consultaSeguinte; + if( idSeguinte == null ) + { + consultaSeguinte = new MarcacaoTrabalhadorData(); + consultaSeguinte.set( MarcacaoTrabalhadorData.TRABALHADOR, trabalhador ); + consultaSeguinte.set( MarcacaoTrabalhadorData.TIPO, new Integer( MarcacaoTrabalhadorData.TIPO_CONSULTA ) ); + consultaSeguinte.set( MarcacaoTrabalhadorData.MOTIVO, motivoSeguinte ); + consultaSeguinte.set( Marcacao.REALIZADA, "y" ); + consultaSeguinte.set( MarcacaoTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_POR_REALIZAR ) ); + } + else + { + consultaSeguinte = ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, idSeguinte ); + } + consultaSeguinte.set( Marcacao.DATA, dataSeguinte ); + consultaSeguinte.save(); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaConstants.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaConstants.java new file mode 100644 index 00000000..a09a59f8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaConstants.java @@ -0,0 +1,75 @@ +/* + * MedicinaConstants.java + * + * Created on 6 de Julho de 2006, 15:22 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import com.evolute.utils.Singleton; +import siprp.SingletonConstants; + +/** + * + * @author fpalma + */ +public interface MedicinaConstants +{ + public static final int MOTIVO_ADMISSAO = 1; + public static final Integer MOTIVO_ADMISSAO_INTEGER = new Integer( MOTIVO_ADMISSAO ); + public static final String MOTIVO_ADMISSAO_STR = "Admiss\u00e3o"; + public static final int MOTIVO_PERIODICO = 2; + public static final Integer MOTIVO_PERIODICO_INTEGER = new Integer( MOTIVO_PERIODICO ); + public static final String MOTIVO_PERIODICO_STR = "Peri\u00f3dico"; + public static final int MOTIVO_OCASIONAL = 3; + public static final Integer MOTIVO_OCASIONAL_INTEGER = new Integer( MOTIVO_OCASIONAL ); + public static final String MOTIVO_OCASIONAL_STR = "Ocasional"; + public static final int MOTIVO_PERIODICO_INICIAL = 5; + public static final Integer MOTIVO_PERIODICO_INICIAL_INTEGER = new Integer( MOTIVO_PERIODICO_INICIAL ); + public static final String MOTIVO_PERIODICO_INICIAL_STR = "Peri\u00f3dico inicial"; + + public static final int SUB_MOTIVO_APOS_DOENCA = 1; + public static final Integer SUB_MOTIVO_APOS_DOENCA_INTEGER = new Integer( SUB_MOTIVO_APOS_DOENCA ); + public static final String SUB_MOTIVO_APOS_DOENCA_STR = "Ap\u00f3s doen\u00e7a"; + public static final int SUB_MOTIVO_APOS_ACIDENTE = 2; + public static final Integer SUB_MOTIVO_APOS_ACIDENTE_INTEGER = new Integer( SUB_MOTIVO_APOS_ACIDENTE ); + public static final String SUB_MOTIVO_APOS_ACIDENTE_STR = "Ap\u00f3s acidente"; + public static final int SUB_MOTIVO_PEDIDO_TRABALHADOR = 3; + public static final Integer SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER = new Integer( SUB_MOTIVO_PEDIDO_TRABALHADOR ); + public static final String SUB_MOTIVO_PEDIDO_TRABALHADOR_STR = "A pedido do trabalhador"; + public static final int SUB_MOTIVO_PEDIDO_SERVICO = 4; + public static final Integer SUB_MOTIVO_PEDIDO_SERVICO_INTEGER = new Integer( SUB_MOTIVO_PEDIDO_SERVICO ); + public static final String SUB_MOTIVO_PEDIDO_SERVICO_STR = "A pedido do servi\u00e7o"; + public static final int SUB_MOTIVO_MUDANCA_FUNCAO = 5; + public static final Integer SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER = new Integer( SUB_MOTIVO_MUDANCA_FUNCAO ); + public static final String SUB_MOTIVO_MUDANCA_FUNCAO_STR = "Por mudan\u00e7a de fun\u00e7\u00e3o"; + public static final int SUB_MOTIVO_ALTERACAO_CONDICOES = 6; + public static final Integer SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER = new Integer( SUB_MOTIVO_ALTERACAO_CONDICOES ); + public static final String SUB_MOTIVO_ALTERACAO_CONDICOES_STR = "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho"; + public static final int SUB_MOTIVO_OUTRO = 10; + public static final Integer SUB_MOTIVO_OUTRO_INTEGER = new Integer( SUB_MOTIVO_OUTRO ); + public static final String SUB_MOTIVO_OUTRO_STR = "Outro"; + + public static final int ESTADO_POR_REALIZAR = 0; + public static final int ESTADO_PARCIALMENTE_REALIZADO = 1; + public static final int ESTADO_REALIZADO = 2; + public static final int ESTADO_DESMARCADO_TRABALHADOR = 3; + public static final int ESTADO_DESMARCADO_EMPRESA = 4; + public static final int ESTADO_FALTOU = 5; + + public static final String ESTADOS_CONSULTA_STR[] = + new String[]{ "Por Realizar", null, "Realizada", + "Desmarcada pelo Trabalhador", "Desmarcada pela " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), + "Trabalhador Faltou" }; + + public static final String ESTADOS_EXAME_STR[] = + new String[]{ "Por Realizar", "Parcialmente Realizados", "Realizados", + "Desmarcados pelo Trabalhador", "Desmarcados pela " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), + "Trabalhador Faltou" }; + + public static final String ESTADOS_STR[][] = + new String[][]{ ESTADOS_EXAME_STR, ESTADOS_CONSULTA_STR }; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaDataProvider.java new file mode 100644 index 00000000..52c1ce92 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaDataProvider.java @@ -0,0 +1,462 @@ +/* + * MedicinaDataProvider.java + * + * Created on January 29, 2006, 12:27 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.tables.*; + +import siprp.*; +import siprp.data.*; +/** + * + * @author fpalma + */ +public class MedicinaDataProvider extends MetaProvider + implements MedicinaConstants +{ + + + public static final String TIPOS_CONSULTAS[] = + new String[]{ "", MOTIVO_ADMISSAO_STR, MOTIVO_PERIODICO_STR, MOTIVO_OCASIONAL_STR, "", MOTIVO_PERIODICO_INICIAL_STR }; + + public static final HashMap MOTIVOS_BY_ID = + new HashMap(); + + public static final HashMap SUB_MOTIVOS_BY_ID = + new HashMap(); + + public static final HashMap SUB_MOTIVOS_IDS_BY_MOTIVO_ID = + new HashMap(); + +// public static final String ESTADOS_EXAME_STR[] = +// new String[]{ "Por realizar", "Parcialmente realizado", "Realizado", +// "Desmarcado trabalhador", +// "Desmarcado " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), +// "Faltou" }; +// +// public static final String ESTADOS_CONSULTA_STR[] = +// new String[]{ "Por realizar", "Parcialmente realizada", "Realizada", +// "Desmarcada trabalhador", +// "Desmarcada " + Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ), +// "Faltou" }; + + private static final Object LOCK = new Object(); + private static MedicinaDataProvider instance = null; + + static + { + MOTIVOS_BY_ID.put( MOTIVO_ADMISSAO_INTEGER, MOTIVO_ADMISSAO_STR ); + MOTIVOS_BY_ID.put( MOTIVO_PERIODICO_INTEGER, MOTIVO_PERIODICO_STR ); + MOTIVOS_BY_ID.put( MOTIVO_OCASIONAL_INTEGER, MOTIVO_OCASIONAL_STR ); + MOTIVOS_BY_ID.put( MOTIVO_PERIODICO_INICIAL_INTEGER, MOTIVO_PERIODICO_INICIAL_STR ); + + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_APOS_DOENCA_INTEGER, SUB_MOTIVO_APOS_DOENCA_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_APOS_ACIDENTE_INTEGER, SUB_MOTIVO_APOS_ACIDENTE_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER, SUB_MOTIVO_PEDIDO_TRABALHADOR_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_PEDIDO_SERVICO_INTEGER, SUB_MOTIVO_PEDIDO_SERVICO_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER, SUB_MOTIVO_MUDANCA_FUNCAO_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER, SUB_MOTIVO_ALTERACAO_CONDICOES_STR ); + SUB_MOTIVOS_BY_ID.put( SUB_MOTIVO_OUTRO_INTEGER, SUB_MOTIVO_OUTRO_STR ); + + SUB_MOTIVOS_IDS_BY_MOTIVO_ID.put( MOTIVO_OCASIONAL_INTEGER, + new Integer[]{ SUB_MOTIVO_APOS_DOENCA_INTEGER, SUB_MOTIVO_APOS_ACIDENTE_INTEGER, + SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER, SUB_MOTIVO_PEDIDO_SERVICO_INTEGER, + SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER, SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER, + SUB_MOTIVO_OUTRO_INTEGER } ); + } + + private final Executer executer; + + /** Creates a new instance of MedicinaDataProvider */ + public MedicinaDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new MedicinaDataProvider(); + } + } + return instance; + } + + public String []getEmpresaEstabelecimento( Integer empresaID, Integer estabelecimentoID ) + throws Exception + { + String nomes[] = new String[ 2 ]; + Select select = new Select( new String[]{ "empresas" }, + new String[]{ "designacao_social" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray array = executer.executeQuery( select ); + nomes[ 0 ] = ( String ) array.get( 0, 0 ); + + select = new Select( new String[]{ "estabelecimentos" }, + new String[]{ "nome" }, + new Field( "id" ).isEqual( estabelecimentoID ) ); + array = executer.executeQuery( select ); + nomes[ 1 ] = ( String ) array.get( 0, 0 ); + + return nomes; + } + + public IDObject[] getDetalhesValidosTrabalhador( Integer empresaID, Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "perfil" }, + new Field( "id" ).isEqual( trabalhadorID ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer perfil = ( Integer ) array.get( 0, 0 ); + if( perfil == null ) + { + return new IDObject[ 0 ]; + } + select = + new Select( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo", + "prt_grupos_protocolo" }, + new String[]{ "prt_grupos_protocolo.id" , "prt_grupos_protocolo.descricao", + "prt_grupos_protocolo.ordem"}, + new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaID ).and( + new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( + new Field( "prt_tipos_elementos_protocolo.id" ) ) ).and( + new Field( "prt_tipos_elementos_protocolo.grupo_protocolo_id" ).isEqual( + new Field( "prt_grupos_protocolo.id" ) ) ).and( + new Field( "prt_elementos_protocolo.numero_perfil" ).isEqual( perfil ) ), + new String[]{ "prt_grupos_protocolo.ordem" }, + null ); + array = executer.executeQuery( select ); + Vector detalhes = new Vector(); + Integer oldID = null; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + if( id.equals( oldID ) ) + { + continue; + } + oldID = id; + String descricao = ( String ) array.get( n, 1 ); + detalhes.add( new MappableObject( id, descricao ) ); + } + return ( IDObject[] ) detalhes.toArray( new IDObject[ detalhes.size() ] ); + } + + public void setDetalhesRealziadosForMarcacao( Integer marcacaoID, Integer detalhes[] ) + throws Exception + { + Delete delete = + new Delete( "marcacoes_grupos_realizados", + new Field( "marcacao_trabalhador_id" ).isEqual( marcacaoID ) ); + executer.executeQuery( delete ); + Insert insert = + new Insert( "marcacoes_grupos_realizados", + new Assignment[]{ + new Assignment( new Field( "marcacao_trabalhador_id" ), marcacaoID ), + new Assignment( new Field( "grupo_protocolo_id" ), detalhes ) } ); + executer.executeQuery( insert, null ); + } + + public Integer[] getDetalhesRealizadosForMarcacao( Integer marcacaoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_grupos_realizados" }, + new String[]{ "grupo_protocolo_id" }, + new Field( "marcacao_trabalhador_id" ).isEqual( marcacaoID ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public Integer[] getDetalhesRealizadosForEstadosMarcacao( Integer marcacaoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_grupos_realizados", "marcacoes_trabalhador_estados" }, + new String[]{ "grupo_protocolo_id" }, + new Field( "marcacoes_trabalhador_estados.marcacao_id" ).isEqual( marcacaoID ).and( + new Field( "marcacoes_trabalhador_estados.id" ).isEqual( + new Field( "marcacoes_grupos_realizados.marcacoes_trabalhador_estado_id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public void deleteDetalhesRealizadosForMarcacao( Integer marcacaoID ) + throws Exception + { + Delete delete = + new Delete( "marcacoes_grupos_realizados", + new Field( "marcacao_trabalhador_id" ).isEqual( marcacaoID ) ); + executer.executeQuery( delete ); + } + + public Object[][] getExamesTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id", "data", "estado" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ), + new String[]{ "data desc" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = array.getObjects(); + for( int n = 0; n < data.length; n++ ) + { + int estado = ( ( Integer ) data[ n ][ 2 ] ).intValue(); + data[ n ][ 2 ] = ESTADOS_EXAME_STR[ estado ]; + } + return data; + } + + public Object[][] getConsultasTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id", "data", "estado" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ), + new String[]{ "data desc" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Object data[][] = array.getObjects(); + for( int n = 0; n < data.length; n++ ) + { + int estado = ( ( Integer ) data[ n ][ 2 ] ).intValue(); + data[ n ][ 2 ] = ESTADOS_CONSULTA_STR[ estado ]; + } + + return data; + } + + public ColumnizedMappable[] getAllEmpresas() + throws Exception + { + Select select = + new Select( new String[]{ "empresas" }, + new String[]{ "id", "designacao_social", "designacao_social_plain" }, + new Field( "inactivo" ).isDifferent( "y" ), + new String[]{ "designacao_social_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + Select select = + new Select( new String[]{ "estabelecimentos" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "empresa_id" ).isEqual( empresaID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + return estabelecimentos; + } + + public ColumnizedMappable[] getAllTrabalhadoresForEstabelecimento( Integer estabelecimentoID ) + throws Exception + { + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "inactivo" ).isDifferent( "y" ) ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + ColumnizedMappable trabalhadores[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < trabalhadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + trabalhadores[ n ] = new ColumnizedMappable( id, nome ); + } + return trabalhadores; + } + + /** + * Devolve o identificador da consulta de um trabalhador para um dado motivo e dia. + * + * @param trabalhadorID o identificador do trabalhador + * @param motivo o identificador do motivo da marcacao + * @param data a data da marcacao + * @return o identificador da consulta ou null se não houver nenhuma + * @throws Exception se houver um erro na ligaço à Base de Dados + */ + public Integer getConsultaIDByTrabalhadorMotivoAndDate( Integer trabalhadorID, Integer motivo, Date data ) + throws Exception + { + Integer motivos[]; + if( motivo != null && ( motivo.intValue() == MOTIVO_PERIODICO || motivo.intValue() == MOTIVO_PERIODICO_INICIAL ) ) + { + motivos = new Integer[]{ MOTIVO_PERIODICO_INTEGER, MOTIVO_PERIODICO_INICIAL_INTEGER }; + } + else + { + motivos = new Integer[]{ motivo }; + } + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "data" ).isEqual( data ) ).and( + new Field( "motivo" ).in( motivos ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + Integer id; + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + id = null; + } + else + { + id = ( Integer ) array.get( 0, 0 ); + } + return id; + } + + /** + * Devolve o identificador da primeira consulta de um trabalhador n&ão realizada depois de um diapara um dado motivo. + * + * @param trabalhadorID o identificador do trabalhador + * @param motivo o identificador do motivo da marcacao + * @param data a data de início de procura + * @return o identificador da consulta ou null se não houver nenhuma + * @throws Exception se houver um erro na ligaço à Base de Dados + */ + public Integer getProximaConsultaIDByTrabalhadorMotivoAndDate( Integer trabalhadorID, Integer motivo, Date data ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "id", "data" }, + new Field( "trabalhador_id" ).isEqual( trabalhadorID ).and( + new Field( "tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ).and( + new Field( "data" ).isGreater( data ) ).and( + new Field( "motivo" ).isEqual( motivo ) ).and( + new Field( "estado" ).isEqual( new Integer( 0 ) ) ), + new String[]{ "data" }, + null ); + Virtual2DArray array = executer.executeQuery( select ); + Integer id; + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + id = null; + } + else + { + id = ( Integer ) array.get( 0, 0 ); + } + return id; + } + + public Object[][] getListaConsultasByData( Date data ) + throws Exception + { + Select2 select = + new Select2( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) }, + new String[]{ "marcacoes_trabalhador.id", "trabalhadores.nome", "trabalhadores.nome_plain", + "empresas.designacao_social", "marcacoes_trabalhador.tipo", "prestador_id" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "marcacoes_trabalhador.estado" ).isEqual( + new Integer( Marcacao.ESTADO_POR_REALIZAR ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Object[][] getListaECDsByData( Date data ) + throws Exception + { + Select2 select = + new Select2( new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) }, + new String[]{ "marcacoes_trabalhador.id", "trabalhadores.nome", "trabalhadores.nome_plain", + "empresas.designacao_social", "marcacoes_trabalhador.tipo", "prestador_id" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "marcacoes_trabalhador.estado" ).isEqual( + new Integer( Marcacao.ESTADO_POR_REALIZAR ) ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = executer.executeQuery( select ); + return array.getObjects(); + } + + public Integer getTrabalhadorIDByMarcacaoID( Integer marcacaoID ) + throws Exception + { + Select select = + new Select( new String[]{ "marcacoes_trabalhador" }, + new String[]{ "trabalhador_id" }, + new Field( "id" ).isEqual( marcacaoID ) ); + Virtual2DArray array = executer.executeQuery( select ); + return ( Integer ) array.get( 0, 0 ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaUpperPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaUpperPanel.java new file mode 100644 index 00000000..dbdd786d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaUpperPanel.java @@ -0,0 +1,253 @@ +/* + * MedicinaUpperPanel.java + * + * Created on February 1, 2006, 6:48 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; + +/** + * + * @author fpalma + */ +public class MedicinaUpperPanel extends JPanel + implements ListSelectionListener, ControllableComponent +{ + protected BaseTable empresasTable; + protected VectorTableModel empresasModel; + protected BaseTable estabelecimentosTable; + protected VectorTableModel estabelecimentosModel; + protected BaseTable trabalhadoresTable; + protected VectorTableModel trabalhadoresModel; + + protected MedicinaDataProvider provider; + + protected final Vector listeners; + + protected boolean editing = false; + + /** Creates a new instance of MedicinaUpperPanel */ + public MedicinaUpperPanel() + throws Exception + { + provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + listeners = new Vector(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + empresasModel = new VectorTableModel( new String[]{ "empresas" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = + new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = + new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + trabalhadoresModel = new VectorTableModel( new String[]{ "trabalhadores" } ); + trabalhadoresTable = new BaseTable( trabalhadoresModel ); + trabalhadoresTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + trabalhadoresTable.setNonResizableNorReordable(); + JScrollPane trabalhadoresScroll = + new JScrollPane( trabalhadoresTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + trabalhadoresTable.getSelectionModel().addListSelectionListener( this ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = 1; + constraints.gridheight = 1; + constraints.weightx = 0.3; + constraints.weighty = 1; + + gridbag.setConstraints( empresasScroll, constraints ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + + constraints.weightx = 0.4; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( trabalhadoresScroll, constraints ); + + add( empresasScroll ); + add( estabelecimentosScroll ); + add( trabalhadoresScroll ); + + ColumnizedMappable empresas[] = provider.getAllEmpresas(); + Vector values = empresasModel.getValues(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + carregarEstabelecimentos(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + carregarTrabalhadores(); + } + else if( source.equals( trabalhadoresTable.getSelectionModel() ) ) + { + notifyListeners( e ); + } + } + + protected void carregarEstabelecimentos() + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + estabelecimentosModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + ColumnizedMappable estabelecimentos[] = provider.getAllEstabelecimentosForEmpresa( empresaID); + Vector values = estabelecimentosModel.getValues(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos.", true ); + estabelecimentosModel.clearAll(); + } + } + } + + protected void carregarTrabalhadores() + { + trabalhadoresTable.clearSelection(); + int selected = estabelecimentosTable.getSelectedRow(); + trabalhadoresModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selected ) ).getID(); + ColumnizedMappable trabalhadores[] = provider.getAllTrabalhadoresForEstabelecimento( estabelecimentoID ); + Vector values = trabalhadoresModel.getValues(); + values.addAll( Arrays.asList( trabalhadores ) ); + trabalhadoresModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar trabalhadores.", true ); + trabalhadoresModel.clearAll(); + } + } + } + + protected void notifyListeners( ListSelectionEvent e ) + { + for( int n = 0; n < listeners.size(); n++ ) + { + ListSelectionEvent event = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( ( ListSelectionListener ) listeners.elementAt( n ) ).valueChanged( event ); + } + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listeners.add( listener ); + } + + public void removeSelectionListener( ListSelectionListener listener ) + { + listeners.remove( listener ); + } + + public void clear() + { +// empresasTable.clearSelection(); + } + + public void fill( Object value ) + { + if( value == null ) + { + clear(); + } + Integer ids[] = ( Integer [] ) value; + for( int n = 0; n < empresasTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) empresasModel.getRowAt( n ) ).getID().equals( ids[ 0 ] ) ) + { + empresasTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < estabelecimentosTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( n ) ).getID().equals( ids[ 1 ] ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < trabalhadoresTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) trabalhadoresModel.getRowAt( n ) ).getID().equals( ids[ 2 ] ) ) + { + trabalhadoresTable.setRowSelectionInterval( n, n ); + break; + } + } + } + + public Object save() + { + int empresaSelected = empresasTable.getSelectedRow(); + int estabelecimentoSelected = estabelecimentosTable.getSelectedRow(); + int trabalhadorSelected = trabalhadoresTable.getSelectedRow(); + return new Integer[]{ + empresaSelected == -1 ? null : ( ( ColumnizedMappable ) empresasModel.getRowAt( empresaSelected ) ).getID(), + estabelecimentoSelected == -1 ? null : ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( estabelecimentoSelected ) ).getID(), + trabalhadorSelected == -1 ? null : ( ( ColumnizedMappable ) trabalhadoresModel.getRowAt( trabalhadorSelected ) ).getID() + }; + } + + public void setEnabled( boolean enable ) + { + editing = !enable; + empresasTable.setEnabled( enable ); + estabelecimentosTable.setEnabled( enable ); + trabalhadoresTable.setEnabled( enable ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaWindow.java b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaWindow.java new file mode 100644 index 00000000..fa827ed4 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/MedicinaWindow.java @@ -0,0 +1,686 @@ +/* + * MedicinaWindow.java + * + * Created on 17 de Janeiro de 2006, 19:43 + * + * To change this template, choose Tools | Options and locate the template under + * the Source Creation and Management node. Right-click the template and choose + * Open. You can then make changes to the template in the Source Editor. + */ + +package siprp.medicina; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import java.text.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.panel.*; +import com.evolute.utils.ui.search.*; +import com.evolute.utils.ui.text.*; +import com.evolute.utils.ui.window.*; + +import siprp.*; +import siprp.clientes.*; +import siprp.data.*; +/** + * + * @author fpalma + */ +public class MedicinaWindow extends TabbedWindow + implements ActionListener, ListSelectionListener +{ + private static int iPermissionArray[][] = + new int[][]{ {}, + { NEW_INDEX, EDIT_INDEX, SAVE_INDEX, DELETE_INDEX, CANCEL_INDEX }, + { NEW_INDEX, EDIT_INDEX, SAVE_INDEX, DELETE_INDEX, CANCEL_INDEX } }; + + private static final int TAB_CONSULTA = 0; + private static final int TAB_EXAME = 1; + + private static final int INDEX_MAIN = 0; + private static final int INDEX_CONSULTA = 1; + private static final int INDEX_EXAME = 2; + + private static final String tabNames[] = + new String[]{ "Consultas", "Exames" }; + + private static final DateFormat DATE_FORMAT = + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "PT", "pt" ) ); + + protected MedicinaDataProvider provider; + protected FichaDataProvider fichaProvider; + protected JDOProvider JDO; + protected SIPRPTracker tracker; + + protected MedicinaUpperPanel upperPanel; + protected MarcacaoConsultaPanel marcacaoConsultaPanel; + protected TableEditorPanel marcacaoConsultaEditorPanel; + protected MarcacaoExamePanel marcacaoExamePanel; + protected TableEditorPanel marcacaoExameEditorPanel; + protected CheckBoxPanel detalhesExamePanel; + + protected Integer empresaID; + protected String empresa; + protected Integer estabelecimentoID; + protected String estabelecimento; + protected Integer trabalhadorID; + protected TrabalhadorData trabalhador; + protected boolean estado[] = new boolean[]{ false, false }; + + /** Creates a new instance of MedicinaWindow */ + public MedicinaWindow() + throws Exception + { + super( new MedicinaUpperPanel(), tabNames, 0.7, createPermissions( iPermissionArray ) ); + upperPanel = ( MedicinaUpperPanel ) getUpperPanel(); + provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + fichaProvider = ( FichaDataProvider ) FichaDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + maximizeOnNextActivate(); + } + + private void setupComponents() + throws Exception + { + setTitle( "Medicina" ); + setupConsultaComponents(); + setupExameComponents(); + upperPanel.addListSelectionListener( this ); + } + + private void setupConsultaComponents() + { + JPanel panel = getTab( TAB_CONSULTA ); + + panel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Consultas" ) ); + + changeGroupName( INDEX_CONSULTA, "Consultas" ); + setActionName( INDEX_CONSULTA, NEW_INDEX, "Nova" ); + setActionTooltip( INDEX_CONSULTA, NEW_INDEX, "Nova" ); + JPanel toolbar = getToolbarPanel( INDEX_CONSULTA ); + + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + panel.setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1.0; + + gridbag.setConstraints( toolbar, constraints ); + panel.add( toolbar ); + + constraints.gridheight = 1; + constraints.weighty = 1.0; + try + { + marcacaoConsultaEditorPanel = + new TableEditorPanel( new String[]{ "Data", + "Estado" }, + new int[]{0,2}, new int[]{0,0}, + 0.0, 1.0, new Dimension( 350, 100 ) ); + marcacaoConsultaPanel = new MarcacaoConsultaPanel(); + new CopyPasteHandler( marcacaoConsultaPanel.getObservacoesText() ); + marcacaoConsultaEditorPanel.addComponent( marcacaoConsultaPanel, + new int[]{0,2}, new int[]{1,2}, + 1.0, 1.0 ); + marcacaoConsultaEditorPanel.addListSelectionListener( new ListSelectionListener(){ + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + if( marcacaoConsultaEditorPanel.getID() != null ) + { + reload(INDEX_CONSULTA); + select(INDEX_CONSULTA); + } + else + { + clear( INDEX_CONSULTA ); + } + } + }); + }catch( Exception ex ) + { + DialogException.showException( ex ); + return; + } + gridbag.setConstraints( marcacaoConsultaEditorPanel, constraints ); + panel.add( marcacaoConsultaEditorPanel ); + marcacaoConsultaPanel.getEmailButton().addActionListener( this ); + } + + private void setupExameComponents() + { + JPanel panel = getTab( TAB_EXAME ); + + panel.setBorder( + BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Exames" ) ); + + changeGroupName( INDEX_EXAME, "Exames" ); + JPanel toolbar = getToolbarPanel( INDEX_EXAME ); + + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + panel.setLayout( gridbag ); + constraints.insets = new Insets( 2, 2, 2, 2 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.weightx = 1.0; + + gridbag.setConstraints( toolbar, constraints ); + panel.add( toolbar ); + + constraints.gridheight = 1; + constraints.weighty = 1.0; + try + { + marcacaoExameEditorPanel = + new TableEditorPanel( new String[]{ "Data", + "Estado" }, + new int[]{0,2}, new int[]{0,0}, + 0.0, 1.0, new Dimension( 350, 100 ) ); + marcacaoExamePanel = new MarcacaoExamePanel(); + new CopyPasteHandler( marcacaoExamePanel.getObservacoesText() ); + marcacaoExameEditorPanel.addComponent( marcacaoExamePanel, + new int[]{0,2}, new int[]{1,2}, + 1.0, 1.0 ); + marcacaoExameEditorPanel.addListSelectionListener( new ListSelectionListener(){ + public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) + { + if( marcacaoExameEditorPanel.getID() != null ) + { + reload(INDEX_EXAME); + select(INDEX_EXAME); + } + else + { + clear( INDEX_EXAME ); + } + } + }); + }catch( Exception ex ) + { + DialogException.showException( ex ); + return; + } + gridbag.setConstraints( marcacaoExameEditorPanel, constraints ); + panel.add( marcacaoExameEditorPanel ); + marcacaoExamePanel.getEmailButton().addActionListener( this ); + } + + public boolean save(int index) + { + Date data; + switch( index ) + { + case INDEX_EXAME: + MarcacaoTrabalhadorData exame = ( MarcacaoTrabalhadorData ) marcacaoExamePanel.save(); + data = ( Date ) exame.get( MarcacaoTrabalhadorData.DATA ); + if( data == null ) + { + JOptionPane.showMessageDialog( this, "Tem de preencher uma data para os exames.", + "Erro", JOptionPane.ERROR_MESSAGE ); + return false; + } + exame.set( MarcacaoTrabalhadorData.TIPO, + new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES ) ); + exame.set( MarcacaoTrabalhadorData.TRABALHADOR, trabalhador ); + try + { + exame.set( MarcacaoTrabalhadorData.REALIZADA, + ( ( Integer )exame.get( MarcacaoTrabalhadorData.ESTADO ) ).intValue() == + provider.ESTADO_REALIZADO ? "y" : "n" ); + exame.save(); + Integer exameID = ( Integer ) exame.get( MarcacaoTrabalhadorData.ID ); + Integer detalhesRealizados[] = detalhesExamePanel.getSelected(); + provider.setDetalhesRealziadosForMarcacao( exameID, detalhesRealizados ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + + break; + + case INDEX_CONSULTA: + MarcacaoTrabalhadorData consulta = ( MarcacaoTrabalhadorData ) marcacaoConsultaPanel.save(); + data = ( Date ) consulta.get( MarcacaoTrabalhadorData.DATA ); + if( data == null ) + { + JOptionPane.showMessageDialog( this, "Tem de preencher uma data para a consulta.", + "Erro", JOptionPane.ERROR_MESSAGE ); + return false; + } + consulta.set( MarcacaoTrabalhadorData.TIPO, + new Integer( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA ) ); + consulta.set( MarcacaoTrabalhadorData.TRABALHADOR, trabalhador ); + try + { + consulta.set( MarcacaoTrabalhadorData.REALIZADA, + ( ( Integer )consulta.get( MarcacaoTrabalhadorData.ESTADO ) ).intValue() == + provider.ESTADO_REALIZADO ? "y" : "n" ); + consulta.save(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar", true ); + return false; + } + break; + } + reload( INDEX_MAIN ); + return true; + } + + public boolean delete(int index) + { + int option = JOptionPane.showConfirmDialog( this, "Tem a certeza que quer apagar a marca\u00e7\u00e3o?", + "Apagar", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE ); + if( option == 0 ) + { + switch( index ) + { + case INDEX_CONSULTA: + MarcacaoTrabalhadorData consulta = ( MarcacaoTrabalhadorData ) marcacaoConsultaPanel.save(); + try + { + consulta.delete(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar.", true ); + return false; + } + break; + + case INDEX_EXAME: + MarcacaoTrabalhadorData exame = ( MarcacaoTrabalhadorData ) marcacaoExamePanel.save(); + try + { + exame.delete(); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a apagar.", true ); + return false; + } + break; + } + reload( INDEX_MAIN ); + return true; + } + return false; + } + + public void clear(int index) + { + switch( index ) + { + case INDEX_MAIN: + empresaID = null; + empresa = null; + estabelecimentoID = null; + estabelecimento = null; + trabalhadorID = null; + trabalhador = null; + upperPanel.clear(); + marcacaoExameEditorPanel.clear(); + marcacaoConsultaEditorPanel.clear(); +// marcacaoExamePanel.getDetalhesPanel().removeAll(); + detalhesExamePanel = null; + break; + + case INDEX_CONSULTA: + marcacaoConsultaPanel.clear(); + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email" ); + break; + + case INDEX_EXAME: + marcacaoExamePanel.clear(); + marcacaoExamePanel.getEmailButton().setText( "Enviar email" ); + if( detalhesExamePanel != null ) + { + detalhesExamePanel.clear(); + } + break; + } + } + + public void enableComponents(int index, boolean enable) + { + switch( index ) + { + case INDEX_MAIN: + + break; + + case INDEX_EXAME: + marcacaoExamePanel.setEnabled( enable ); + marcacaoExamePanel.getEmailButton().setEnabled( enable ); + if( detalhesExamePanel != null ) + { + detalhesExamePanel.setEnabled( enable ); + } + upperPanel.setEnabled( !enable ); + estado[ 0 ] = enable; + break; + + case INDEX_CONSULTA: + marcacaoConsultaPanel.setEnabled( enable ); + marcacaoConsultaPanel.getEmailButton().setEnabled( enable ); + upperPanel.setEnabled( !enable ); + estado[ 1 ] = enable; + break; + } + if( tracker != null ) + { + tracker.getAvisosPanel().setEnabled( (!estado[ 0 ]) && (!estado[1]), + AvisoConstants.TIPO_TRABALHADOR ); + } + } + +// public boolean searchByName() +// { +// fichaProvider.setSearch( FichaDataProvider.SEARCH_EMPRESAS ); +// SearchDialog search; +// +// search = new SearchDialog( fichaProvider, null, false, null, true ); +// empresaID = ( Integer )search.getSelected(); +// +// if( empresaID == null ) +// { +// return false; +// } +// +// fichaProvider.setSearch( FichaDataProvider.SEARCH_ESTABELECIMENTOS ); +// fichaProvider.setSearchID( FichaDataProvider.SEARCH_EMPRESAS, empresaID.intValue() ); +// +// search = new SearchDialog( fichaProvider, null, false, null, true ); +// estabelecimentoID = ( Integer )search.getSelected(); +// +// if( estabelecimentoID == null ) +// { +// return false; +// } +// +// fichaProvider.setSearch( FichaDataProvider.SEARCH_TRABALHADORES ); +// fichaProvider.setSearchID( FichaDataProvider.SEARCH_ESTABELECIMENTOS, estabelecimentoID.intValue() ); +// search = new SearchDialog( fichaProvider, null, false, null, true ); +// trabalhadorID = ( Integer )search.getSelected(); +// +// if( trabalhadorID == null ) +// { +// return false; +// } +// reload(0); +// return true; +// } + + protected void enableSelect( int index, boolean select ) + { + switch( index ) + { + case INDEX_EXAME: + marcacaoExameEditorPanel.setEnabled( select ); + break; + + case INDEX_CONSULTA: + marcacaoConsultaEditorPanel.setEnabled( select ); + break; + } + } + + public void reload( int index ) + { + switch( index ) + { + case INDEX_MAIN: + try + { + String nomes[] = + provider.getEmpresaEstabelecimento( empresaID, estabelecimentoID ); + empresa = nomes[ 0 ]; + estabelecimento = nomes[ 1 ]; + trabalhador = ( TrabalhadorData ) JDO.load( TrabalhadorData.class, trabalhadorID ); +// upperPanel.getEmpresaText().setText( empresa ); +// upperPanel.getEstabelecimentoText().setText( estabelecimento ); +// upperPanel.getTrabalhadorText().setText( ( String ) trabalhador.get( TrabalhadorData.NOME ) ); + IDObject detalhesExame[] = provider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + detalhesExamePanel = new CheckBoxPanel( detalhesExame ); + JPanel detalhesExameOuterPanel = marcacaoExamePanel.getDetalhesPanel(); + detalhesExameOuterPanel.setLayout( new GridLayout( 1, 1 ) ); + detalhesExameOuterPanel.removeAll(); + detalhesExameOuterPanel.add( detalhesExamePanel ); + detalhesExameOuterPanel.validate(); + Object examesTrabalhador[][] = provider.getExamesTrabalhador( trabalhadorID ); + Object consultasTrabalhador[][] = provider.getConsultasTrabalhador( trabalhadorID ); + if( examesTrabalhador.length > 0 ) + { + marcacaoExameEditorPanel.setData( new Object2DArray( examesTrabalhador ) ); + } + else + { + marcacaoExameEditorPanel.clear(); + } + if( consultasTrabalhador.length > 0 ) + { + marcacaoConsultaEditorPanel.setData( new Object2DArray( consultasTrabalhador ) ); + } + else + { + marcacaoConsultaEditorPanel.clear(); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados.", true ); + } + break; + + case INDEX_EXAME: + Integer exameID = marcacaoExameEditorPanel.getID(); + if( exameID == null ) + { + return; + } + try + { + MarcacaoTrabalhadorData exame = + ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, exameID ); + marcacaoExamePanel.fill( exame ); + Date dataEmailExame = ( Date ) exame.get( MarcacaoTrabalhadorData.DATA_EMAIL ); + if( dataEmailExame != null ) + { + marcacaoExamePanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( dataEmailExame ) + ")" ); + } + else + { + marcacaoExamePanel.getEmailButton().setText( "Enviar email" ); + } + Integer detalhesRealizados[] = provider.getDetalhesRealizadosForMarcacao( exameID ); + detalhesExamePanel.setSelected( detalhesRealizados ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados do exame.", true ); + } + break; + + case INDEX_CONSULTA: + Integer consultaID = marcacaoConsultaEditorPanel.getID(); + if( consultaID == null ) + { + return; + } + try + { + MarcacaoTrabalhadorData consulta = + ( MarcacaoTrabalhadorData ) JDO.load( MarcacaoTrabalhadorData.class, consultaID ); + marcacaoConsultaPanel.fill( consulta ); + Date dataEmailConsulta = ( Date ) consulta.get( MarcacaoTrabalhadorData.DATA_EMAIL ); + if( dataEmailConsulta != null ) + { + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( dataEmailConsulta ) + ")" ); + } + else + { + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email" ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os dados da consulta.", true ); + } + break; + } + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( marcacaoExamePanel.getEmailButton() ) ) + { + enviarEmailExame(); + } + else if( source.equals( marcacaoConsultaPanel.getEmailButton() ) ) + { + enviarEmailConsulta(); + } + } + + protected void enviarEmailConsulta() + { + MarcacaoTrabalhadorData consulta = ( MarcacaoTrabalhadorData ) marcacaoConsultaPanel.save(); + + String subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_CONSULTA ); + String texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_CONSULTA ); + + Date today = new Date(); + marcacaoConsultaPanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( today ) + ")" ); + + try + { + enviarEmail( subject, texto, ( Date )consulta.get( MarcacaoTrabalhadorData.DATA ) ); + consulta.set( Marcacao.DATA_EMAIL, today ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + } + + protected void enviarEmailExame() + { + MarcacaoTrabalhadorData exame = ( MarcacaoTrabalhadorData ) marcacaoExamePanel.save(); + + String subject = ( String ) Singleton.getInstance( SingletonConstants.SUBJECT_EXAMES ); + String texto = ( String ) Singleton.getInstance( SingletonConstants.LETTER_EXAMES ); + + Date today = new Date(); + marcacaoExamePanel.getEmailButton().setText( "Enviar email (" + DATE_FORMAT.format( today ) + ")" ); + + try + { + enviarEmail( subject, texto, ( Date )exame.get( MarcacaoTrabalhadorData.DATA ) ); + exame.set( Marcacao.DATA_EMAIL, today ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a enviar mail", true ); + } + } + + protected void enviarEmail( String subject, String texto, Date data ) + throws Exception + { + String nome = ( String ) trabalhador.get( TrabalhadorData.NOME ); + String dataStr = DATE_FORMAT.format( data ); + + subject = subject.replaceAll( CompanyDataLoader.NOME, nome ); + texto = texto.replaceAll( CompanyDataLoader.DATA, dataStr ); + texto = texto.replaceAll( CompanyDataLoader.NOME, nome ); + + EstabelecimentoData estabelecimento = + ( EstabelecimentoData ) JDO.load( EstabelecimentoData.class, estabelecimentoID ); + ContactoData contacto = ( ContactoData )estabelecimento.get( EstabelecimentoData.CONTACTO ); + String mail = ""; + if( contacto != null ) + { + mail = ( String )contacto.get( ContactoData.EMAIL ); + } + + if( System.getProperty( "os.name" ).startsWith( "Windows" ) ) + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + Process proc = Runtime.getRuntime().exec( "cmd.exe /c start mailto:\"" + mail + + "?subject=" + subject + "&body=" + + + texto + ); + } + else + { + mail = mail.replaceAll( " ", "%20" ); + subject = subject.replaceAll( " ", "%20" ); + texto = texto.replaceAll( " ", "%20" ); + + Process proc = Runtime.getRuntime().exec( new String[]{ "/usr/bin/open", "/Applications/Mail.app", "mailto:" + mail + + "?subject=" + subject + "&body=" + + texto } ); + } + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source.equals( upperPanel ) ) + { + Integer ids[] = ( Integer [] ) upperPanel.save(); + empresaID = ids[ 0 ]; + estabelecimentoID = ids[ 1 ]; + trabalhadorID = ids[ 2 ]; + if( ids[ 2 ] == null ) + { + clear( INDEX_MAIN ); + unselect( INDEX_MAIN ); + } + else + { + reload( INDEX_MAIN ); + select( INDEX_MAIN ); + } + } + } + + public void setEmpresaAndEstabelecimentoAndTrabalhador( Integer empresaID, Integer estabelecimentoID, Integer trabalhadorID ) + { + if( upperPanel.editing ) + { + JOptionPane.showMessageDialog( this, "Esta janela est\u00e1 em edi\u00e7\u00e3o.", "Erro...", + JOptionPane.ERROR_MESSAGE ); + } + else + { + upperPanel.fill( new Integer[]{ empresaID, estabelecimentoID, trabalhadorID } ); + } + } + + public void setTracker( SIPRPTracker tracker ) + { + this.tracker = tracker; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/Test.java b/tags/teg/SIPRPSoft/src/siprp/medicina/Test.java new file mode 100644 index 00000000..8305609e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/Test.java @@ -0,0 +1,38 @@ +/* + * Test.java + * + * Created on 17 de Janeiro de 2006, 18:37 + * + * To change this template, choose Tools | Options and locate the template under + * the Source Creation and Management node. Right-click the template and choose + * Open. You can then make changes to the template in the Source Editor. + */ + +package siprp.medicina; + +import java.awt.*; +import javax.swing.*; +/** + * + * @author fpalma + */ +public class Test +{ + + public static void main( String args[] ) + throws Exception + { + JFrame frm = new MedicinaWindow(); +// frm.getContentPane().setLayout( new GridLayout() ); +// frm.getContentPane().add( new MedicinaUpperPanel() ); +// frm.setSize( new Dimension( 600, 600 ) ); + frm.setVisible( true ); + frm.setExtendedState(frm.getExtendedState() | frm.MAXIMIZED_BOTH); + } + + /** Creates a new instance of Test */ + public Test() + { + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/alter.sql b/tags/teg/SIPRPSoft/src/siprp/medicina/alter.sql new file mode 100644 index 00000000..3549ed22 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/alter.sql @@ -0,0 +1,159 @@ +ALTER TABLE empresas ADD a_consultas char(1); +ALTER TABLE empresas ADD a_exames char(1); +ALTER TABLE empresas ADD b_consultas char(1); +ALTER TABLE empresas ADD b_exames char(1); +ALTER TABLE empresas ADD data_cancelamento DATE; + +ALTER TABLE marcacoes_trabalhador ADD motivo INT; +ALTER TABLE marcacoes_trabalhador ADD estado INT; +ALTER TABLE marcacoes_trabalhador ADD observacoes VARCHAR( 2048 ); +UPDATE marcacoes_trabalhador SET estado = 2 WHERE realizada = 'y'; + + +-- PROTOCOLOS + +CREATE TABLE prt_grupos_protocolo +( + id int4 NOT NULL, + descricao varchar(255) NOT NULL, + descricao_plain varchar(255) NOT NULL, + CONSTRAINT grupos_protocolo_pkey PRIMARY KEY (id) +) +WITHOUT OIDS; +ALTER TABLE prt_grupos_protocolo OWNER TO postgres; + + + +CREATE TABLE prt_tipos_elementos_protocolo +( + id int4 NOT NULL, + descricao_plain varchar(255) NOT NULL, + descricao varchar(255) NOT NULL, + grupo_protocolo_id int4 NOT NULL, + CONSTRAINT prt_tipos_elementos_protocolo_pkey PRIMARY KEY (id), + CONSTRAINT prt_tipos_elementos_protocolo_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) REFERENCES prt_grupos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT +) +WITHOUT OIDS; +ALTER TABLE prt_tipos_elementos_protocolo OWNER TO postgres; + + +CREATE TABLE prt_elementos_protocolo +( + id serial NOT NULL, + tipo_elemento_protocolo_id int4 NOT NULL, + empresa_id int4 NOT NULL, + numero_perfil int4 NOT NULL, + CONSTRAINT prt_elementos_protocolo_pkey PRIMARY KEY (id), + CONSTRAINT prt_elementos_protocolo_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas (id) ON UPDATE RESTRICT ON DELETE RESTRICT, + CONSTRAINT prt_elementos_protocolo_tipo_elemento_protocolo_id_fkey FOREIGN KEY (tipo_elemento_protocolo_id) REFERENCES prt_tipos_elementos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT +) +WITH OIDS; +ALTER TABLE prt_elementos_protocolo OWNER TO postgres; + + +CREATE TABLE marcacoes_grupos_realizados +( + id serial NOT NULL, + marcacao_trabalhador_id int4 NOT NULL, + grupo_protocolo_id int4 NOT NULL, + CONSTRAINT marcacoes_grupos_realizados_pkey PRIMARY KEY (id), + CONSTRAINT marcacoes_grupos_realizados_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) REFERENCES prt_grupos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT, + CONSTRAINT marcacoes_grupos_realizados_marcacao_trabalhador_id_fkey FOREIGN KEY (marcacao_trabalhador_id) REFERENCES marcacoes_trabalhador (id) ON UPDATE RESTRICT ON DELETE RESTRICT +) +WITH OIDS; +ALTER TABLE marcacoes_grupos_realizados OWNER TO postgres; + +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 1, 'Sangue', 'sangue' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 2, 'Urina', 'urina' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 3, 'RX T\\u00f3rax', 'rx torax' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 4, 'Audiograma', 'audiograma' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 5, 'Rastreio Visual', 'rastreio visual' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 6, 'ECG', 'ecg' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 7, 'Espirometria', 'espirometria' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 8, 'Exsudado Nasofar\\u00edngeo', 'exsudado nasofaringeo' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 9, 'Exame Bacteriol\\u00f3gico (Fezes)', 'exame bacteriologico (fezes)' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 10, 'Coprocultura', 'coprocultura' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 11, 'Outros ECDs', 'outros ecds' ); +INSERT INTO prt_grupos_protocolo( id, descricao, descricao_plain ) + VALUES( 12, 'Outras An\\u00e1lises', 'outras analises' ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 1, 'Hemograma', 'hemograma', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 2, 'Plaquetas', 'plaquetas', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 3, 'VS', 'vs', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 4, 'Glicemia', 'glicemia', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 5, 'Creatinina', 'creatinina', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 6, 'Colesterol Total', 'colesterol total', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 7, 'colesterol hdl', 'Colesterol hdl', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 8, 'Colesterol LDL', 'colesterol ldl', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 9, 'Trigliceridos', 'trigliceridos', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 10, 'Transaminases', 'transaminases', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 11, 'Gama GT', 'gama gt', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 12, 'Ureia', 'ureia', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 13, '\\u00c1cido \\u00darico', 'acido urico', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 14, 'MBE (Chumbo)', 'mbe (chumbo)', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 15, 'MBE (Outros)', 'mbe (outros)', 1 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 16, 'Serologias Hepatite', 'serologias hepatite', 1 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 17, 'Urina II', 'urina ii', 2 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 18, 'RX T\\u00f3rax', 'rx torax', 3 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 19, 'Audiometria', 'audiometria', 4 ); + +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 20, 'Rastreio Visual', 'rastreio visual', 5 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 21, 'ECG', 'ecg', 6 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 22, 'Espirometria', 'espirometria', 7 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 23, 'Exsudado Nasofar\\u00edngeo', 'exsudado nasofaringeo', 8 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 24, 'Exame Bacteriol\\u00f3gico (Fezes)', 'exame bacteriologico (fezes)', 9 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 25, 'Coprocultura', 'coprocultura', 10 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 26, 'Outros ECDs', 'outros ecds', 11 ); +INSERT INTO prt_tipos_elementos_protocolo( id, descricao, descricao_plain, grupo_protocolo_id ) + values( 27, 'Outras An\\u00e1lises', 'outras analises', 12 ); + + +ALTER TABLE prt_grupos_protocolo ADD grupo_real char(1); +UPDATE prt_grupos_protocolo SET grupo_real='y' WHERE id <= 4; +UPDATE prt_grupos_protocolo SET grupo_real='n' WHERE id > 4; + +ALTER TABLE prt_grupos_protocolo ADD ordem int4; +UPDATE prt_grupos_protocolo SET ordem=id; + +ALTER TABLE prt_tipos_elementos_protocolo ADD ordem int4; +UPDATE prt_tipos_elementos_protocolo SET ordem=id; \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/FaxPrinter.java b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/FaxPrinter.java new file mode 100644 index 00000000..392f8f25 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/FaxPrinter.java @@ -0,0 +1,177 @@ +/* + * FaxPrinter.java + * + * Created on March 1, 2007, 3:26 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.locais_realizacao; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.ui.CustomJDialog; +import com.evolute.utils.ui.panel.CheckBoxPanel; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; + +/** + * + * @author fpalma + */ +public class FaxPrinter extends CustomJDialog + implements ActionListener +{ + private JTextField deText; + private JTextField deEmailText; + private JTextField deFaxText; + private JTextField deTelefoneText; + private JTextField assuntoText; + private JTextField localText; + private JToggleButton localAutoButton; + private JTextField perfil1Text; + private CheckBoxPanel perfil1Panel; + private JTextField perfil2Text; + private CheckBoxPanel perfil2Panel; + private JTextField horaText; + + private JButton imprimirButton; + private JButton cancelarButton; + + public static void main( String args[] ) + { + FaxPrinter d = new FaxPrinter(); + d.setVisible( true ); + } + + /** Creates a new instance of FaxPrinter */ + public FaxPrinter() + { + super( null, true ); + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Por favor preencha os detalhes do Fax" ); + setSize( 800, 600 ); + + JLabel deLabel = new JLabel( "De" ); + deText = new JTextField(); + JLabel deEmailLabel = new JLabel( "E-mail" ); + deEmailText = new JTextField(); + JLabel deFaxLabel = new JLabel( "Fax" ); + deFaxText = new JTextField(); + JLabel deTelefoneLabel = new JLabel( "N\u00famero de telefone" ); + deTelefoneText = new JTextField(); + JLabel assuntoLabel = new JLabel( "Assunto" ); + assuntoText = new JTextField(); + localAutoButton = new JToggleButton( "Local Autom\u00e1tico" ); + localText = new JTextField(); + JLabel perfil1Label = new JLabel( "Nome" ); + perfil1Text = new JTextField(); + perfil1Panel = new CheckBoxPanel( new IDObject[]{ new MappableObject( new Integer( 1 ), "teste1" ), + new MappableObject( new Integer( 3 ), "teste3" ) } ); + JLabel perfil2Label = new JLabel( "Nome" ); + perfil2Text = new JTextField(); + perfil2Panel = new CheckBoxPanel( new IDObject[]{ new MappableObject( new Integer( 2 ), "teste2" ) } ); + imprimirButton = new JButton( "Imprimir" ); + imprimirButton.addActionListener( this ); + cancelarButton = new JButton( "Cancelar" ); + cancelarButton.addActionListener( this ); + JPanel buttonPanel = new JPanel(); + JPanel perfil1OuterPanel = new JPanel(); + perfil1OuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil 1" ) ); + JPanel perfil2OuterPanel = new JPanel(); + perfil2OuterPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Perfil 2" ) ); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, + TableLayout.FILL, }; + double rows[] = + new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, + TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED }; + + TableLayout tableLayout = new TableLayout( cols,rows ); + setLayout( tableLayout ); + + add( deLabel, new TableLayoutConstraints( 0, 0 ) ); + add( deText, new TableLayoutConstraints( 1, 0 ) ); + add( deEmailLabel, new TableLayoutConstraints( 2, 0 ) ); + add( deEmailText, new TableLayoutConstraints( 3, 0 ) ); + add( deFaxLabel, new TableLayoutConstraints( 0, 1 ) ); + add( deFaxText, new TableLayoutConstraints( 1, 1 ) ); + add( deTelefoneLabel, new TableLayoutConstraints( 2, 1 ) ); + add( deTelefoneText, new TableLayoutConstraints( 3, 1 ) ); + add( assuntoLabel, new TableLayoutConstraints( 0, 2 ) ); + add( assuntoText, new TableLayoutConstraints( 1, 2, 3, 2 ) ); + add( localAutoButton, new TableLayoutConstraints( 0, 3 ) ); + add( localText, new TableLayoutConstraints( 1, 3, 3, 3 ) ); + add( perfil1OuterPanel, new TableLayoutConstraints( 0, 4, 1, 4 ) ); + add( perfil2OuterPanel, new TableLayoutConstraints( 2, 4, 3, 4 ) ); + add( buttonPanel, new TableLayoutConstraints( 0, 5, 3, 5 ) ); + + cols = new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; + rows = new double[]{ TableLayout.PREFERRED, TableLayout.FILL }; + + tableLayout = new TableLayout( cols,rows ); + perfil1OuterPanel.setLayout( tableLayout ); + + perfil1OuterPanel.add( perfil1Label, new TableLayoutConstraints( 0, 0 ) ); + perfil1OuterPanel.add( perfil1Text, new TableLayoutConstraints( 1, 0 ) ); + perfil1OuterPanel.add( perfil1Panel, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + tableLayout = new TableLayout( cols,rows ); + perfil2OuterPanel.setLayout( tableLayout ); + + perfil2OuterPanel.add( perfil2Label, new TableLayoutConstraints( 0, 0 ) ); + perfil2OuterPanel.add( perfil2Text, new TableLayoutConstraints( 1, 0 ) ); + perfil2OuterPanel.add( perfil2Panel, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + buttonPanel.add( imprimirButton ); + buttonPanel.add( cancelarButton ); + + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( imprimirButton ) ) + { + print(); + } + else if( source.equals( cancelarButton ) ) + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public void print() + { + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java new file mode 100644 index 00000000..75a4f86c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoDataProvider.java @@ -0,0 +1,196 @@ +/* + * LocaisRealizacaoDataProvider.java + * + * Created on February 22, 2007, 10:44 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.locais_realizacao; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Update; +import com.evolute.utils.tables.ColumnizedMappable; +import java.util.Date; + +/** + * + * @author fpalma + */ +public class LocaisRealizacaoDataProvider +{ + private static final Object LOCK = new Object(); + private static LocaisRealizacaoDataProvider instance = null; + + private Executer EXECUTER; + + /** Creates a new instance of LocaisRealizacaoDataProvider */ + public LocaisRealizacaoDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + } + + public static LocaisRealizacaoDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new LocaisRealizacaoDataProvider(); + } + } + return instance; + } + + public ColumnizedMappable[] getEmpresasComMarcacoes( Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos", "empresas" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ), + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) }, + new String[]{ "DISTINCT empresas.id", "empresas.designacao_social", "empresas.designacao_social_plain" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ), + new String[]{ "empresas.designacao_social_plain" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String designacao = ( String ) array.get( n, 1 ); + empresas[ n ] = new ColumnizedMappable( id, designacao ); + } + return empresas; + } + + public ColumnizedMappable[] getEstabelecimentosComMarcacoesByEmpresa( Integer empresaID, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "marcacoes_trabalhador", "trabalhadores", "estabelecimentos" }, + new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ), + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) }, + new String[]{ "DISTINCT estabelecimentos.id", "estabelecimentos.nome", "estabelecimentos.nome_plain" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( empresaID ) ), + new String[]{ "estabelecimentos.nome_plain" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; + for( int n = 0; n < estabelecimentos.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); + } + return estabelecimentos; + } + + public int getNumeroMarcacoesByEstabelecimentoAndTipo( Integer estabelecimentoID, int tipo, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "COUNT( * )" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( tipo ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return 0; + } + else + { + return ( ( Number ) array.get( 0, 0 ) ).intValue(); + } + } + + public Integer[] getPrestadoresIDByEstabelecimentoAndTipo( Integer estabelecimentoID, int tipo, Date data ) + throws Exception + { + Select select = + new Select2( + new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "DISTINCT prestador_id" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( tipo ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public void setPrestadorIDForEstabelecimentoAndTipo( Integer estabelecimentoID, int tipo, Date data, Integer prestadorID ) + throws Exception + { + Select select = + new Select2( + new String[]{ "marcacoes_trabalhador", "trabalhadores" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) }, + new String[]{ "marcacoes_trabalhador.id" }, + new Field( "marcacoes_trabalhador.data" ).isEqual( data ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( "marcacoes_trabalhador.tipo" ).isEqual( tipo ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( "prestador_id", prestadorID ) }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java new file mode 100644 index 00000000..0a7e7c89 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/LocaisRealizacaoWindow.java @@ -0,0 +1,548 @@ +/* + * LocaisRealizacaoWindow.java + * + * Created on February 22, 2007, 10:19 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.locais_realizacao; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.tables.BaseTable; +import com.evolute.utils.tables.ColumnizedMappable; +import com.evolute.utils.tables.VectorTableModel; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.Arrays; +import java.util.Date; +import java.util.Vector; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import siprp.data.Marcacao; +import siprp.medicina.prestadores.PrestadoresDataProvider; + +/** + * + * @author fpalma + */ +public class LocaisRealizacaoWindow extends JFrame + implements ActionListener, TrackableWindow, ListSelectionListener +{ + protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 ); + + protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" ); + + protected JCalendarPanel dataPanel; + protected JButton carregarButton; + protected JButton recarregarPrestadoresButton; + protected VectorTableModel empresasModel; + protected BaseTable empresasTable; + protected VectorTableModel estabelecimentosModel; + protected BaseTable estabelecimentosTable; + protected JLabel numeroConsultasLabel; + protected JComboBox prestadoresConsultasCombo; + protected JButton enviarConsultasButton; + protected JButton faxConsultasButton; + protected JLabel numeroECDsLabel; + protected JComboBox prestadoresECDsCombo; + protected JButton enviarECDsButton; + protected JButton faxECDsButton; + + + protected LocaisRealizacaoDataProvider provider; + protected PrestadoresDataProvider prestadoresProvider; + + /** + * Creates a new instance of LocaisRealizacaoWindow + */ + public LocaisRealizacaoWindow() + throws Exception + { + provider = LocaisRealizacaoDataProvider.getProvider(); + prestadoresProvider = PrestadoresDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Locais de Realiza\u00e7\u00e3o" ); + setSize( 1000, 700 ); + JLabel dataLabel = new JLabel( "Data" ); + dataPanel = new JCalendarPanel( this ); + + carregarButton = new JButton( "Carregar" ); + carregarButton.addActionListener( this ); + recarregarPrestadoresButton = new JButton( "Recarregar Prestadores" ); + recarregarPrestadoresButton.addActionListener( this ); + empresasModel = new VectorTableModel( new String[]{ "empresa" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane empresasScp = new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimento" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane estabelecimentosScp = new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + JPanel consultasPanel = new JPanel(); + consultasPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Consultas" ) ); + JLabel consultasLabel = new JLabel( "Quantidade " ); + numeroConsultasLabel = new JLabel( " " ); + numeroConsultasLabel.setForeground( Color.green.darker() ); + prestadoresConsultasCombo = new JComboBox(); + enviarConsultasButton = new JButton( "Atribuir" ); + enviarConsultasButton.addActionListener( this ); + faxConsultasButton = new JButton( "Fax" ); + faxConsultasButton.addActionListener( this ); + JPanel ecdsPanel = new JPanel(); + ecdsPanel.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "ECDs" ) ); + JLabel ecdsLabel = new JLabel( "Quantidade " ); + numeroECDsLabel = new JLabel( " " ); + numeroECDsLabel.setForeground( Color.green.darker() ); + prestadoresECDsCombo = new JComboBox(); + enviarECDsButton = new JButton( "Atribuir" ); + enviarECDsButton.addActionListener( this ); + faxECDsButton = new JButton( "Fax" ); + faxECDsButton.addActionListener( this ); + dataPanel.addChangeListener( new ChangeListener(){ + public void stateChanged(ChangeEvent e) + { + empresasTable.clearSelection(); + Vector values = empresasModel.getValues(); + values.clear(); + empresasModel.setValues( values ); + } + } ); + + getContentPane().setLayout( new BorderLayout( 5, 5 ) ); + JPanel upperPanel = new JPanel(); + getContentPane().add( upperPanel, BorderLayout.NORTH ); + JPanel centerPanel = new JPanel(); + getContentPane().add( centerPanel, BorderLayout.CENTER ); + + upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + upperPanel.add( dataLabel ); + upperPanel.add( dataPanel ); + upperPanel.add( carregarButton ); + upperPanel.add( recarregarPrestadoresButton ); + + centerPanel.setLayout( new GridLayout( 1, 3 ) ); + centerPanel.add( empresasScp ); + centerPanel.add( estabelecimentosScp ); + JPanel detalhesPanel = new JPanel(); + centerPanel.add( detalhesPanel ); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; + double rows[] = + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM }; + + TableLayout tableLayout = new TableLayout( cols,rows ); + consultasPanel.setLayout( tableLayout ); + + consultasPanel.add( consultasLabel, new TableLayoutConstraints( 0, 0 ) ); + consultasPanel.add( numeroConsultasLabel, new TableLayoutConstraints( 1, 0 ) ); + consultasPanel.add( prestadoresConsultasCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + consultasPanel.add( enviarConsultasButton, new TableLayoutConstraints( 0, 2, 1, 2 ) ); +// consultasPanel.add( faxConsultasButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); + + rows = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM }; + + tableLayout = new TableLayout( cols,rows ); + ecdsPanel.setLayout( tableLayout ); + + ecdsPanel.add( ecdsLabel, new TableLayoutConstraints( 0, 0 ) ); + ecdsPanel.add( numeroECDsLabel, new TableLayoutConstraints( 1, 0 ) ); + ecdsPanel.add( prestadoresECDsCombo, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + ecdsPanel.add( enviarECDsButton, new TableLayoutConstraints( 0, 2, 1, 2 ) ); + ecdsPanel.add( faxECDsButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); + + cols = new double[]{ TableLayout.FILL }; + rows = new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }; + + tableLayout = new TableLayout( cols,rows ); + detalhesPanel.setLayout( tableLayout ); + + detalhesPanel.add( consultasPanel, new TableLayoutConstraints( 0, 0 ) ); + detalhesPanel.add( ecdsPanel, new TableLayoutConstraints( 0, 1 ) ); + + setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); + addWindowListener( new WindowAdapter(){ + public void windowClosing( WindowEvent e ) + { + close(); + } + + public void windowOpened( WindowEvent e ) + { +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + + } ); + dataPanel.setDate( new Date() ); + recarregarPrestadores(); + carregar(); + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public boolean closeIfPossible() + { + close(); + return true; + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( carregarButton ) ) + { + carregar(); + } + else if( source.equals( recarregarPrestadoresButton ) ) + { + recarregarPrestadores(); + } + else if( source.equals( enviarConsultasButton ) ) + { + enviarConsultas(); + } + else if( source.equals( faxConsultasButton ) ) + { + faxConsultas(); + } + else if( source.equals( enviarECDsButton ) ) + { + enviarECDs(); + } + else if( source.equals( faxECDsButton ) ) + { + faxECDs(); + } + + } + + public void valueChanged(ListSelectionEvent e) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + mudarEmpresa(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + mudarEstabelecimento(); + } + } + + protected void carregar() + { + empresasTable.clearSelection(); + Date data = dataPanel.getDate(); + if( data == null ) + { + empresasModel.clearAll(); + return; + } + try + { + ColumnizedMappable empresas[] = provider.getEmpresasComMarcacoes( data ); + Vector values = empresasModel.getValues(); + values.clear(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar empresas", true ); + } + } + + protected void mudarEmpresa() + { + estabelecimentosTable.clearSelection(); + Date data = dataPanel.getDate(); + int selected = empresasTable.getSelectedRow(); + if( data == null || selected == -1 ) + { + estabelecimentosModel.clearAll(); + return; + } + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + try + { + ColumnizedMappable estabelecimentos[] = + provider.getEstabelecimentosComMarcacoesByEmpresa( empresaID, data ); + Vector values = estabelecimentosModel.getValues(); + values.clear(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar estabelecimentos", true ); + } + } + + protected void mudarEstabelecimento() + { + Date data = dataPanel.getDate(); + int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); + numeroConsultasLabel.setText( " " ); + numeroECDsLabel.setText( " " ); + enviarConsultasButton.setEnabled( false ); + enviarECDsButton.setEnabled( false ); + if( data == null || selectedEstabelecimento == -1 ) + { + return; + } + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); + try + { + int countConsultas = + provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID, + Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data ); + int countECDs = + provider.getNumeroMarcacoesByEstabelecimentoAndTipo( estabelecimentoID, + Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data ); + if( countConsultas > 0 ) + { + numeroConsultasLabel.setText( "" + countConsultas ); + enviarConsultasButton.setEnabled( true ); + Integer[] escolhidos = + provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID, + Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data ); + if( escolhidos.length == 1 ) + { + numeroConsultasLabel.setForeground( Color.green.darker() ); + } + else + { + numeroConsultasLabel.setForeground( Color.red.darker() ); + } + int e; + for( e = 0; e < escolhidos.length; e++ ) + { + if( escolhidos[ e ] != null ) + { + break; + } + } + if( e == escolhidos.length || escolhidos[ e ] == null ) + { + prestadoresConsultasCombo.setSelectedIndex( 0 ); + } + else + { + for( int p = 0; p < prestadoresConsultasCombo.getItemCount(); p++ ) + { + IDObject prestador = ( IDObject ) prestadoresConsultasCombo.getItemAt( p ); + if( prestador.getID().equals( escolhidos[ e ] ) ) + { + prestadoresConsultasCombo.setSelectedIndex( p ); + } + } + } + } + if( countECDs > 0 ) + { + numeroECDsLabel.setText( "" + countECDs ); + enviarECDsButton.setEnabled( true ); + Integer[] escolhidos = + provider.getPrestadoresIDByEstabelecimentoAndTipo( estabelecimentoID, + Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data ); + if( escolhidos.length == 1 ) + { + numeroECDsLabel.setForeground( Color.green.darker() ); + } + else + { + numeroECDsLabel.setForeground( Color.red.darker() ); + } + int e; + for( e = 0; e < escolhidos.length; e++ ) + { + if( escolhidos[ e ] != null ) + { + break; + } + } + if( e == escolhidos.length || escolhidos[ e ] == null ) + { + prestadoresECDsCombo.setSelectedIndex( 0 ); + } + else + { + for( int p = 0; p < prestadoresECDsCombo.getItemCount(); p++ ) + { + IDObject prestador = ( IDObject ) prestadoresECDsCombo.getItemAt( p ); + if( prestador.getID().equals( escolhidos[ e ] ) ) + { + prestadoresECDsCombo.setSelectedIndex( p ); + } + } + } + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar detalhes", true ); + } + } + + protected void recarregarPrestadores() + { + try + { + IDObject prestadoresConsultas[] = prestadoresProvider.getPrestadoresConsultasActivos(); + IDObject prestadoresECDs[] = prestadoresProvider.getPrestadoresECDsActivos(); + prestadoresConsultasCombo.removeAllItems(); + prestadoresConsultasCombo.addItem( PRESTADOR_SIPRP ); + for( int n = 0; n < prestadoresConsultas.length; n++ ) + { + prestadoresConsultasCombo.addItem( prestadoresConsultas[ n ] ); + } + prestadoresECDsCombo.removeAllItems(); + prestadoresECDsCombo.addItem( PRESTADOR_SIPRP ); + for( int n = 0; n < prestadoresECDs.length; n++ ) + { + prestadoresECDsCombo.addItem( prestadoresECDs[ n ] ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar prestadores", true ); + } + } + + protected void enviarECDs() + { + Date data = dataPanel.getDate(); + int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( data == null || selectedEstabelecimento == -1 ) + { + return; + } + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); + try + { + Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID(); + if( PRESTADOR_ID_SIPRP.equals( prestadorID ) ) + { + prestadorID = null; + } + provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, + Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a atribuir", true ); + } + } + + protected void faxECDs() + { + Date data = dataPanel.getDate(); + int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( data == null || selectedEstabelecimento == -1 ) + { + return; + } + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); + try + { + Integer prestadorID = ( ( IDObject ) prestadoresECDsCombo.getSelectedItem() ).getID(); + if( PRESTADOR_ID_SIPRP.equals( prestadorID ) ) + { + prestadorID = null; + } + provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, + Marcacao.TIPO_MARCACAO_TRABALHADOR_EXAMES, data, prestadorID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a atribuir", true ); + } + } + + protected void enviarConsultas() + { + Date data = dataPanel.getDate(); + int selectedEstabelecimento = estabelecimentosTable.getSelectedRow(); + if( data == null || selectedEstabelecimento == -1 ) + { + return; + } + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selectedEstabelecimento ) ).getID(); + try + { + Integer prestadorID = ( ( IDObject ) prestadoresConsultasCombo.getSelectedItem() ).getID(); + if( PRESTADOR_ID_SIPRP.equals( prestadorID ) ) + { + prestadorID = null; + } + provider.setPrestadorIDForEstabelecimentoAndTipo( estabelecimentoID, + Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA, data, prestadorID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a atribuir", true ); + } + } + + protected void faxConsultas() + { + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds.xsl b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds.xsl new file mode 100644 index 00000000..2559b0c2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds.xsl @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + FAX + + + Nº de Páginas (incluíndo esta) + / Number of pages (including this one): + + + + + + + + + + + + + + Data + / Date: + + + + + + + + + + + + + Para + / To: + + + + + + + + + + + + + Empresa + / Company: + + + + + + + + + + + + + Nº Fax + / Fax number: + + + + + + + + + + + + + De + / From: + + + + + + + + + + E-mail: + + + + + + + + + + + + + Nº Fax + / Fax number: + + + + + + + + + + Nº Tel. + / Phone number: + + + + + + + + + + + + + + + + + + + + + + + + + + Assunto + / Subject: + + + + + + + + + + + + + + + + + + + + Cliente: + + + + + + + + + + Local: + + + + + + + + + + + + + Data: + + + + + + + + + + Hora: + + + + + + + + + + + + + Exmos. Senhores, + + + Informo que os + seguintes + colaboradores + irão + irá + comparecer nas vossas instalações para colheita: + + + + + + + + + + + NOME DO FUNCIONÁRIO + + + + + DATA_NASCIMENTO + + + + + PERFIL + + + + + + + + + + + + + + + + + + + + + + + + + + + + PERFIL + : + + , + + + + + + + + + + + + AGRADEÇO QUE ESTA LISTAGEM NOS SEJA REENVIADA COM INDICAÇÃO DAS + EVENTUAIS FALTAS OCORRIDAS + + + + + + + + Sem outro assunto de momento, aproveitamos para apresentar os nossos melhores cumprimentos, + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds_teste.xml b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds_teste.xml new file mode 100644 index 00000000..8e0366c2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/locais_realizacao/fax_ecds_teste.xml @@ -0,0 +1,234 @@ + + + + + + 24-01-2007 + Pedro Manuel Silva Bento + Laboratorio ao lado da mercearia + 21 351 45 67 + Paula Dias + pdias@siprp.pt + (+351) 21 789 88 32 + (+351) 21 789 88 32 + Marcação de Colheitas para Análise + Evolute + Laboratorio ao lado da mercearia + 28-01-2007 + 08H00 + 1 + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + Frederico Alexandre de Matos Monge Palma + 02-10-1976 + 1 + + + Pedro da Silva Antonio + 02-10-1973 + 2 + + + Joao Pedro Silva + 02-10-1976 + 1 + + + + GENÉRICO + Hemograma + Vel. Sedimentação + Glicemia em Jejum + Creatinina + Colesterol Total + Colesterol HDL + Triglicéridos + Transaminases + Gama GT + Urina II + + + MANIPULADORES + Hemograma + Vel. Sedimentação + Glicemia em Jejum + Creatinina + Colesterol Total + Colesterol HDL + Triglicéridos + Transaminases + Gama GT + Urina II + Quistos + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/DetalhesRealizacaoDialog.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/DetalhesRealizacaoDialog.java new file mode 100644 index 00000000..6b939411 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/DetalhesRealizacaoDialog.java @@ -0,0 +1,103 @@ +/* + * DetalhesRealizacaoDialog.java + * + * Created on February 1, 2007, 11:19 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.CustomJDialog; +import com.evolute.utils.ui.panel.CheckBoxPanel; +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.*; + +/** + * + * @author fpalma + */ +public class DetalhesRealizacaoDialog extends CustomJDialog + implements ActionListener +{ + protected JButton okButton; + protected JButton cancelButton; + protected CheckBoxPanel opcoesPanel; + + protected IDObject opcoes[]; + + protected Integer selected[]; + + /** Creates a new instance of DetalhesRealizacaoDialog */ + public DetalhesRealizacaoDialog( JFrame owner, IDObject opcoes[] ) + { + super( owner, true ); + this.opcoes = opcoes; + setupComponents(); + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + setVisible( true ); + } + + private void setupComponents() + { + setTitle( "Escolha os ECD's realizados" ); + okButton = new JButton( "OK" ); + okButton.addActionListener( this ); + cancelButton = new JButton( "Cancelar" ); + cancelButton.addActionListener( this ); + opcoesPanel = new CheckBoxPanel( opcoes ); + + setLayout( new BorderLayout() ); + add( opcoesPanel, BorderLayout.CENTER ); + JPanel buttonPanel = new JPanel(); + add( buttonPanel, BorderLayout.SOUTH ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( okButton ); + buttonPanel.add( cancelButton ); + + setSize( 250, 300 ); + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( okButton ) ) + { + selected = opcoesPanel.getSelected(); + close(); + } + else if( source.equals( cancelButton ) ) + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public Integer[] getSelected() + { + return selected; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/ImpressaoAuxiliaresWindow.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/ImpressaoAuxiliaresWindow.java new file mode 100644 index 00000000..022449ce --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/ImpressaoAuxiliaresWindow.java @@ -0,0 +1,40 @@ +/* + * ImpressaoAuxiliaresWindow.java + * + * Created on 7 de Dezembro de 2006, 16:13 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import java.awt.*; +import javax.swing.*; + +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.calendar.*; + +/** + * + * @author fpalma + */ +public class ImpressaoAuxiliaresWindow extends JFrame +{ + protected JCalendarPanel calendarPanel; + protected JButton imprimirButton; + + /** Creates a new instance of ImpressaoAuxiliaresWindow */ + public ImpressaoAuxiliaresWindow() + { + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Imprimir" ); + JLabel dataLabel = new JLabel( "Data" ); + calendarPanel = new JCalendarPanel( this ); + imprimirButton = new JButton( "Imprimir" ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/Presenca.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/Presenca.java new file mode 100644 index 00000000..8398bcf9 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/Presenca.java @@ -0,0 +1,107 @@ +/* + * Presenca.java + * + * Created on February 1, 2007, 4:54 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import com.evolute.utils.data.IDObject; +import siprp.data.Marcacao; + +/** + * + * @author fpalma + */ +public class Presenca + implements IDObject, Comparable +{ + protected Integer id; + protected String nome; + protected String nomePlain; + protected String nomeEmpresa; + protected Integer tipo; + + /** Creates a new instance of Presenca */ + public Presenca( Integer id, String nome, String nomePlain, String nomeEmpresa, + Integer tipo ) + { + this.setId(id); + this.setNome(nome); + this.setNomePlain(nomePlain); + this.setNomeEmpresa(nomeEmpresa); + this.setTipo(tipo); + } + + public Integer getID() + { + return getId(); + } + + public int compareTo( Object other ) + { + return getNomePlain().compareTo( ( ( Presenca ) other ).getNomePlain() ); + } + + public String toString() + { + String empresa = getNomeEmpresa(); + return "" + getNome() + "
" + + "    (" + empresa.substring( 0, empresa.length() > 50 ? 50 : empresa.length() ) + + ")" + ""; + } + + public Integer getId() + { + return id; + } + + public void setId(Integer id) + { + this.id = id; + } + + public String getNome() + { + return nome; + } + + public void setNome(String nome) + { + this.nome = nome; + } + + public String getNomePlain() + { + return nomePlain; + } + + public void setNomePlain(String nomePlain) + { + this.nomePlain = nomePlain; + } + + public String getNomeEmpresa() + { + return nomeEmpresa; + } + + public void setNomeEmpresa(String nomeEmpresa) + { + this.nomeEmpresa = nomeEmpresa; + } + + public Integer getTipo() + { + return tipo; + } + + public void setTipo(Integer tipo) + { + this.tipo = tipo; + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasActionFactory.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasActionFactory.java new file mode 100644 index 00000000..a9faca2e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasActionFactory.java @@ -0,0 +1,80 @@ +/* + * PresencasActionFactory.java + * + * Created on January 31, 2007, 6:37 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.panel.multipleactionlist.ActionFactory; +import javax.swing.Action; +import siprp.medicina.presencas.actions.DesmarcadoSHSTAction; +import siprp.medicina.presencas.actions.DesmarcadoTrabalhadorAction; +import siprp.medicina.presencas.actions.FaltouAction; +import siprp.medicina.presencas.actions.RealizouAction; +import siprp.medicina.presencas.actions.RealizouParcialmenteAction; + +/** + * + * @author fpalma + */ +public class PresencasActionFactory implements ActionFactory +{ + public static final int REALIZOU = 0; + public static final int REALIZOU_PARCIALMENTE = 1; + public static final int TRABALHADOR_DESMARCOU = 2; + public static final int SHST_DESMARCOU = 3; + public static final int FALTOU = 4; + + protected final int TIPO; + + /** Creates a new instance of PresencasActionFactory */ + public PresencasActionFactory( int tipo ) + { + TIPO = tipo; + } + + public Action createAction(Presenca[] objects) + { + switch( TIPO ) + { + case SHST_DESMARCOU: + return new DesmarcadoSHSTAction( DesmarcadoSHSTAction.MULTIPLE, objects ); + + case FALTOU: + return new FaltouAction( FaltouAction.MULTIPLE, objects ); + + default: + return null; + } + } + + public Action createAction(Presenca object) + { + switch( TIPO ) + { + case REALIZOU: + return new RealizouAction( object ); + + case REALIZOU_PARCIALMENTE: + return new RealizouParcialmenteAction( object ); + + case TRABALHADOR_DESMARCOU: + return new DesmarcadoTrabalhadorAction( object ); + + case SHST_DESMARCOU: + return new DesmarcadoSHSTAction( DesmarcadoSHSTAction.SINGLE, new Presenca[]{ object } ); + + case FALTOU: + return new FaltouAction( FaltouAction.SINGLE, new Presenca[]{ object } ); + + default: + return null; + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasDataProvider.java new file mode 100644 index 00000000..eb5521b2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/PresencasDataProvider.java @@ -0,0 +1,191 @@ +/* + * PresencasDataProvider.java + * + * Created on February 5, 2007, 5:51 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Update; +import java.util.Date; +import siprp.lembretes.LembretesConstants; +import siprp.lembretes.LembretesDataProvider; +import siprp.medicina.MedicinaConstants; +import siprp.medicina.MedicinaDataProvider; + +/** + * + * @author lflores + */ +public class PresencasDataProvider + implements MedicinaConstants, LembretesConstants +{ + private static final Object LOCK = new Object(); + private static PresencasDataProvider instance = null; + + private MedicinaDataProvider medicinaProvider; + private LembretesDataProvider lembretesProvider; + private Executer EXECUTER; + + /** Creates a new instance of PresencasDataProvider */ + public PresencasDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + medicinaProvider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + lembretesProvider = LembretesDataProvider.getProvider(); + } + + public static PresencasDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PresencasDataProvider(); + } + } + return instance; + } + + protected void apagarDetalhesRealizacao( Integer marcacaoID ) + throws Exception + { + medicinaProvider.deleteDetalhesRealizadosForMarcacao( marcacaoID ); + } + + public void marcarFaltou( Integer id ) + throws Exception + { + apagarDetalhesRealizacao( id ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_FALTOU ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "Trabalhador Faltou", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } + + public void marcarDesmarcadoSHST( Integer id ) + throws Exception + { + apagarDetalhesRealizacao( id ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_DESMARCADO_EMPRESA ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "SIPRP Desmarcou", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } + + public void marcarDesmarcadoTrabalhador( Integer id ) + throws Exception + { + apagarDetalhesRealizacao( id ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_DESMARCADO_TRABALHADOR ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "Trabalhador Desmarcou", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } + + public void marcarRealizado( Integer id, Integer grupos[] ) + throws Exception + { + apagarDetalhesRealizacao( id ); + medicinaProvider.setDetalhesRealziadosForMarcacao( id, grupos ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "y" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_REALIZADO ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + } + + public void marcarParcialmenteRealizado( Integer id, Integer grupos[] ) + throws Exception + { + apagarDetalhesRealizacao( id ); + medicinaProvider.setDetalhesRealziadosForMarcacao( id, grupos ); + Update update = + new Update( "marcacoes_trabalhador", + new Assignment[]{ + new Assignment( new Field( "realizada" ), "n" ), + new Assignment( new Field( "estado" ), new Integer( ESTADO_PARCIALMENTE_REALIZADO ) ) + }, + new Field( "id" ).isEqual( id ) ); + EXECUTER.executeQuery( update ); + lembretesProvider.apagarLembreteByMarcacaoTrabalhadorID( id ); + lembretesProvider.criarLembrete( lembretesProvider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID(), + new Date(), + "ECDs por realizar", + null, + null, + null, + null, + null, + id, + false, + null, + null ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/RegistarPresencasWindow.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/RegistarPresencasWindow.java new file mode 100644 index 00000000..7dab5005 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/RegistarPresencasWindow.java @@ -0,0 +1,360 @@ +/* + * RegistarPresencasWindow.java + * + * Created on January 31, 2007, 3:09 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.fop.FOPCreator; +import com.evolute.utils.fop.FOPPrinter; +import com.evolute.utils.tracker.TrackableWindow; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel; +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.Vector; +import javax.swing.*; +import org.jdom.*; +import org.jdom.output.*; +import siprp.clientes.ClientesDataProvider; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.prestadores.PrestadoresDataProvider; + +/** + * + * @author fpalma + */ +public class RegistarPresencasWindow extends JFrame + implements ActionListener, TrackableWindow +{ + protected static final String PRINT_TEMPLATE = "/siprp/medicina/presencas/auxiliares.xsl"; + protected static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + protected static final Integer PRESTADOR_ID_SIPRP = new Integer( -1 ); + protected static final Integer PRESTADOR_ID_TODOS = new Integer( -2 ); + + protected static final IDObject PRESTADOR_SIPRP = new MappableObject( PRESTADOR_ID_SIPRP, "SIPRP" ); + protected static final IDObject PRESTADOR_TODOS = new MappableObject( PRESTADOR_ID_TODOS, "Todos" ); + + protected JCalendarPanel dataPanel; + protected JButton carregarButton; + protected JComboBox prestadoresCombo; + protected JButton recarregarPrestadoresButton; + protected JButton imprimirAuxiliaresButton; + protected JScrollPane listECDsScroll; + protected JScrollPane listConsultasScroll; + protected MultipleActionListPanel listECDsPanel; + protected MultipleActionListPanel listConsultasPanel; + + protected MedicinaDataProvider provider; + protected PrestadoresDataProvider prestadoresProvider; + + protected Presenca ECDS[]; + + /** Creates a new instance of RegistarPresencasWindow */ + public RegistarPresencasWindow() + throws Exception + { + provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + prestadoresProvider = PrestadoresDataProvider.getProvider(); + setupComponents(); + + } + + private void setupComponents() + { + setTitle( "Presen\u00e7as" ); + setSize( 1000, 700 ); + JLabel dataLabel = new JLabel( "Data" ); + dataPanel = new JCalendarPanel( this ); + carregarButton = new JButton( "Carregar" ); + carregarButton.addActionListener( this ); + JLabel prestadoresLabel = new JLabel( "Prestador" ); + prestadoresCombo = new JComboBox (); + recarregarPrestadoresButton = new JButton( "Recarregar Prestadores" ); + recarregarPrestadoresButton.addActionListener( this ); + imprimirAuxiliaresButton = new JButton( "Imprimir" ); + imprimirAuxiliaresButton.addActionListener( this ); + + PresencasActionFactory realizouFactory = new PresencasActionFactory( PresencasActionFactory.REALIZOU ); + PresencasActionFactory realizouParcialmenteFactory = new PresencasActionFactory( PresencasActionFactory.REALIZOU_PARCIALMENTE ); + PresencasActionFactory trabalhadorDesmarcouFactory = new PresencasActionFactory( PresencasActionFactory.TRABALHADOR_DESMARCOU ); + PresencasActionFactory shstDesmarcouFactory = new PresencasActionFactory( PresencasActionFactory.SHST_DESMARCOU ); + PresencasActionFactory faltouFactory = new PresencasActionFactory( PresencasActionFactory.FALTOU ); + + getContentPane().setLayout( new BorderLayout( 5, 5 ) ); + JPanel upperPanel = new JPanel(); + getContentPane().add( upperPanel, BorderLayout.NORTH ); + JTabbedPane tabbedPane = new JTabbedPane(); + getContentPane().add( tabbedPane, BorderLayout.CENTER ); + + listECDsPanel = + new MultipleActionListPanel( + new PresencasActionFactory[]{ /*shstDesmarcouFactory, faltouFactory*/ }, + new PresencasActionFactory[]{ realizouFactory, realizouParcialmenteFactory, + trabalhadorDesmarcouFactory, shstDesmarcouFactory, + faltouFactory } ); + listECDsScroll = new JScrollPane( listECDsPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + + listConsultasPanel = + new MultipleActionListPanel( + new PresencasActionFactory[]{ /*shstDesmarcouFactory, faltouFactory*/ }, + new PresencasActionFactory[]{ realizouFactory, trabalhadorDesmarcouFactory, + shstDesmarcouFactory, faltouFactory } ); + listConsultasScroll = new JScrollPane( listConsultasPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + + tabbedPane.add( "ECDs", listECDsScroll ); + tabbedPane.add( "Consultas", listConsultasScroll ); + + upperPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); + upperPanel.add( dataLabel ); + upperPanel.add( dataPanel ); + upperPanel.add( carregarButton ); + upperPanel.add( prestadoresLabel ); + upperPanel.add( prestadoresCombo ); + upperPanel.add( recarregarPrestadoresButton ); + upperPanel.add( imprimirAuxiliaresButton ); + + setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); + addWindowListener( new WindowAdapter(){ + public void windowClosing( WindowEvent e ) + { + close(); + } + + public void windowOpened( WindowEvent e ) + { +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + + } ); + dataPanel.setDate( new Date() ); + recarregarPrestadores(); + carregar(); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( carregarButton ) ) + { + carregar(); + } + else if( source.equals( recarregarPrestadoresButton ) ) + { + recarregarPrestadores(); + } + else if( source.equals( imprimirAuxiliaresButton ) ) + { + imprimirAuxiliares(); + } + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public boolean closeIfPossible() + { + close(); + return true; + } + + protected void carregar() + { + ECDS = null; + IDObject prestador = ( IDObject ) prestadoresCombo.getSelectedItem(); + boolean filtrar = true; + Integer prestadorID = null; + if( PRESTADOR_TODOS.equals( prestador ) ) + { + filtrar = false; + } + else if( !PRESTADOR_SIPRP.equals( prestador ) ) + { + prestadorID = prestador.getID(); + } + try + { + Date data = dataPanel.getDate(); + Object ecdsArray[][] = provider.getListaECDsByData( data ); + List ecds = new Vector(); + for( int n = 0; n < ecdsArray.length; n++ ) + { + Integer id = ( Integer ) ecdsArray[ n ][ 0 ]; + String nome = ( String ) ecdsArray[ n ][ 1 ]; + String nomePlain = ( String ) ecdsArray[ n ][ 2 ]; + String empresa = ( String ) ecdsArray[ n ][ 3 ]; + int tipo = ( ( Integer )ecdsArray[ n ][ 4 ] ).intValue(); + Integer prestadorMarcacao = ( Integer )ecdsArray[ n ][ 5 ]; + if( ( !filtrar ) || + ( prestadorID == null ? prestadorMarcacao == null : prestadorID.equals( prestadorMarcacao ) ) ) + { + ecds.add( new Presenca( id, nome, nomePlain, empresa, tipo ) ); + } + } + Collections.sort( ecds ); + ECDS = ecds.toArray( new Presenca[ ecds.size() ] ); + listECDsPanel.showList( ECDS ); + listECDsScroll.setViewportView( listECDsPanel ); + + Object consultasArray[][] = provider.getListaConsultasByData( data ); + List consultas = new Vector(); + for( int n = 0; n < consultasArray.length; n++ ) + { + Integer id = ( Integer ) consultasArray[ n ][ 0 ]; + String nome = ( String ) consultasArray[ n ][ 1 ]; + String nomePlain = ( String ) consultasArray[ n ][ 2 ]; + String empresa = ( String ) consultasArray[ n ][ 3 ]; + int tipo = ( ( Integer )consultasArray[ n ][ 4 ] ).intValue(); + Integer prestadorMarcacao = ( Integer )consultasArray[ n ][ 5 ]; + if( ( !filtrar ) || + ( prestadorID == null ? prestadorMarcacao == null : prestadorID.equals( prestadorMarcacao ) ) ) + { + consultas.add( new Presenca( id, nome, nomePlain, empresa, tipo ) ); + } + } + Collections.sort( consultas ); + listConsultasPanel.showList( consultas.toArray( new Presenca[ ecds.size() ] ) ); + listConsultasScroll.setViewportView( listConsultasPanel ); +// setExtendedState( getExtendedState() | MAXIMIZED_BOTH ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + } + } + + protected void recarregarPrestadores() + { + try + { + IDObject prestadores[] = prestadoresProvider.getPrestadoresActivos(); + prestadoresCombo.removeAllItems(); + prestadoresCombo.addItem( PRESTADOR_SIPRP ); + prestadoresCombo.addItem( PRESTADOR_TODOS ); + for( int n = 0; n < prestadores.length; n++ ) + { + prestadoresCombo.addItem( prestadores[ n ] ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar prestadores", true ); + } + } + + protected void imprimirAuxiliares() + { + try + { + Date data = dataPanel.getDate(); + if( ECDS == null || data == null || ECDS.length == 0 ) + { + return; + } + ClientesDataProvider clientesProvider = + ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + MedicinaDataProvider medicinaProvider = + ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + + String dataStr = D_F.format( data ); + + Element rootElement = new Element( "lista-presencas" ); + + for( int n = 0; n < ECDS.length; n++ ) + { + Element presencaElement = new Element( "presenca" ); + + Element trabalhadorElement = new Element( "trabalhador" ); + trabalhadorElement.setText( ECDS[ n ].getNome() ); + presencaElement.addContent( trabalhadorElement ); + + Element empresaElement = new Element( "empresa" ); + empresaElement.setText( ECDS[ n ].getNomeEmpresa() ); + presencaElement.addContent( empresaElement ); + + Element dataElement = new Element( "data" ); + dataElement.setText( dataStr ); + presencaElement.addContent( dataElement ); + + Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( ECDS[ n ].getID() ); + Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); + Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( ECDS[ n ].getID() ); + Vector realizadosVector = new Vector(); + realizadosVector.addAll( Arrays.asList( realizados ) ); + IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + for( int v = 0; v < validos.length; v++ ) + { + Integer id = validos[ v ].getID(); + if( !realizadosVector.contains( id ) ) + { + Element ecdElement = new Element( "ecd" ); + ecdElement.setText( validos[ v ].toString() ); + presencaElement.addContent( ecdElement ); + } + } + + rootElement.addContent( presencaElement ); + } + + Document doc = new Document( rootElement ); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + //new XMLOutputter().output( doc, System.out ); + new XMLOutputter().output( doc, baos ); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + FOPCreator creator = FOPCreator.getFOPCreator(); + InputStream xmlIn = new ByteArrayInputStream( baos.toByteArray() ); + creator.createFOfromXML( xmlIn, + getClass().getResourceAsStream( PRINT_TEMPLATE ), + out ); + ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() ); + Hashtable printOptions = new Hashtable(); + FOPPrinter.getFOPPrinter().printFO( in, true, true, printOptions ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a imprimir", true ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoSHSTAction.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoSHSTAction.java new file mode 100644 index 00000000..7cf7717a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoSHSTAction.java @@ -0,0 +1,58 @@ +/* + * DesmarcadoSHSTAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +/** + * + * @author fpalma + */ +public class DesmarcadoSHSTAction extends AbstractAction +{ + public static final int SINGLE = 0; + public static final int MULTIPLE = 1; + + protected int cardinality; + protected Presenca presencas[]; + + /** Creates a new instance of DesmarcadoSHSTAction */ + public DesmarcadoSHSTAction( int cardinality, Presenca presencas[] ) + { + super( cardinality == SINGLE ? "SIPRP Desmarcou" : "Marcar restantes como \"SIPRP desmarcou\"" ); + this.cardinality = cardinality; + this.presencas = presencas; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + for( int n = 0; n < presencas.length; n++ ) + { + provider.marcarDesmarcadoSHST( presencas[ n ].getID() ); + } + if( cardinality == SINGLE ) + { + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoTrabalhadorAction.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoTrabalhadorAction.java new file mode 100644 index 00000000..93085547 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/DesmarcadoTrabalhadorAction.java @@ -0,0 +1,47 @@ +/* + * DesmarcadoTrabalhadorAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +/** + * + * @author fpalma + */ +public class DesmarcadoTrabalhadorAction extends AbstractAction +{ + protected Presenca presenca; + + /** Creates a new instance of DesmarcadoTrabalhadorAction */ + public DesmarcadoTrabalhadorAction( Presenca presenca ) + { + super( "Desmarcou" ); + this.presenca = presenca; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + provider.marcarDesmarcadoTrabalhador( presenca.getID() ); + setEnabled( false ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/FaltouAction.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/FaltouAction.java new file mode 100644 index 00000000..035c8dd5 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/FaltouAction.java @@ -0,0 +1,57 @@ +/* + * FaltouAction.java + * + * Created on January 31, 2007, 6:21 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +/** + * + * @author fpalma + */ +public class FaltouAction extends AbstractAction +{ + public static final int SINGLE = 0; + public static final int MULTIPLE = 1; + + protected int cardinality; + protected Presenca presencas[]; + + /** Creates a new instance of FaltouAction */ + public FaltouAction( int cardinality, Presenca presencas[] ) + { + super( cardinality == SINGLE ? "Faltou" : "Marcar restantes como \"Faltou\"" ); + this.cardinality = cardinality; + this.presencas = presencas; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + for( int n = 0; n < presencas.length; n++ ) + { + provider.marcarFaltou( presencas[ n ].getID() ); + } + if( cardinality == SINGLE ) + { + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouAction.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouAction.java new file mode 100644 index 00000000..105b4ac0 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouAction.java @@ -0,0 +1,107 @@ +/* + * RealizouAction.java + * + * Created on January 31, 2007, 6:20 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionEvent; +import java.util.Arrays; +import java.util.Vector; +import javax.swing.AbstractAction; +import siprp.clientes.ClientesDataProvider; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.presencas.DetalhesRealizacaoDialog; +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +/** + * + * @author fpalma + */ +public class RealizouAction extends AbstractAction +{ + protected Presenca presenca; + + /** Creates a new instance of RealizouAction */ + public RealizouAction( Presenca presenca ) + { + super( "Realizou" ); + this.presenca = presenca; + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + ClientesDataProvider clientesProvider = + ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + MedicinaDataProvider medicinaProvider = + ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( presenca.getID() ); + Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); + Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( presenca.getID() ); + Vector realizadosVector = new Vector(); + realizadosVector.addAll( Arrays.asList( realizados ) ); + IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + Vector aRealizar = new Vector(); + for( int n = 0; n < validos.length; n++ ) + { + Integer id = validos[ n ].getID(); + if( !realizadosVector.contains( id ) ) + { + aRealizar.add( validos[ n ] ); + } + } + DetalhesRealizacaoDialog dialog = + new DetalhesRealizacaoDialog( null, ( IDObject[] ) aRealizar.toArray( new IDObject[ aRealizar.size() ] ) ); + Integer escolhidos[] = dialog.getSelected(); + if( escolhidos != null ) + { + provider.marcarParcialmenteRealizado( presenca.getID(), escolhidos ); + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } +// try +// { +// PresencasDataProvider provider = PresencasDataProvider.getProvider(); +// ClientesDataProvider clientesProvider = +// ( ClientesDataProvider ) ClientesDataProvider.getProvider(); +// MedicinaDataProvider medicinaProvider = +// ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); +// Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( presenca.getID() ); +// Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); +// Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( presenca.getID() ); +// Vector realizadosVector = new Vector(); +// realizadosVector.addAll( Arrays.asList( realizados ) ); +// IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); +// Vector aRealizar = new Vector(); +// for( int n = 0; n < validos.length; n++ ) +// { +// Integer id = validos[ n ].getID(); +// if( !realizadosVector.contains( id ) ) +// { +// aRealizar.add( id ); +// } +// } +// provider.marcarRealizado( presenca.getID(), ( Integer[] ) aRealizar.toArray( new Integer[ aRealizar.size() ] ) ); +// setEnabled( false ); +// } +// catch( Exception ex ) +// { +// DialogException.showExceptionMessage( ex, "Erro a marcar", true ); +// } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouParcialmenteAction.java b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouParcialmenteAction.java new file mode 100644 index 00000000..5384d787 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/actions/RealizouParcialmenteAction.java @@ -0,0 +1,84 @@ +/* + * RealizouParcialmenteAction.java + * + * Created on January 31, 2007, 6:20 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.presencas.actions; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; +import java.awt.event.ActionEvent; +import java.util.Arrays; +import java.util.Vector; +import javax.swing.AbstractAction; +import javax.swing.JOptionPane; +import siprp.clientes.ClientesDataProvider; +import siprp.data.Marcacao; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.presencas.DetalhesRealizacaoDialog; +import siprp.medicina.presencas.Presenca; +import siprp.medicina.presencas.PresencasDataProvider; + +/** + * + * @author fpalma + */ +public class RealizouParcialmenteAction extends AbstractAction +{ + protected Presenca presenca; + + /** Creates a new instance of RealizouParcialmenteAction */ + public RealizouParcialmenteAction( Presenca presenca ) + { + super( "Parcialmente" ); + this.presenca = presenca; + if( Marcacao.TIPO_MARCACAO_TRABALHADOR_CONSULTA == presenca.getTipo().intValue() ) + { + setEnabled( false ); + } + } + + public void actionPerformed(ActionEvent e) + { + try + { + PresencasDataProvider provider = PresencasDataProvider.getProvider(); + ClientesDataProvider clientesProvider = + ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + MedicinaDataProvider medicinaProvider = + ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + Integer trabalhadorID = medicinaProvider.getTrabalhadorIDByMarcacaoID( presenca.getID() ); + Integer empresaID = clientesProvider.getEmpresaIDByTrabalhadorID( trabalhadorID ); + Integer realizados[] = medicinaProvider.getDetalhesRealizadosForEstadosMarcacao( presenca.getID() ); + Vector realizadosVector = new Vector(); + realizadosVector.addAll( Arrays.asList( realizados ) ); + IDObject validos[] = medicinaProvider.getDetalhesValidosTrabalhador( empresaID, trabalhadorID ); + Vector aRealizar = new Vector(); + for( int n = 0; n < validos.length; n++ ) + { + Integer id = validos[ n ].getID(); + if( !realizadosVector.contains( id ) ) + { + aRealizar.add( validos[ n ] ); + } + } + DetalhesRealizacaoDialog dialog = + new DetalhesRealizacaoDialog( null, ( IDObject[] ) aRealizar.toArray( new IDObject[ aRealizar.size() ] ) ); + Integer escolhidos[] = dialog.getSelected(); + if( escolhidos != null ) + { + provider.marcarParcialmenteRealizado( presenca.getID(), escolhidos ); + setEnabled( false ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a marcar", true ); + } + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xml b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xml new file mode 100644 index 00000000..f4372ba8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xml @@ -0,0 +1,35 @@ + + + + + + + Frederico Palma + Evolute + 2007/02/21 + RX + ECD + Sangue + Acuidade Visual + + + Luis Flores + Evolute + 2007/02/21 + RX + ECD + Acuidade Visual + + + Smeagol + Evolute + 2007/02/21 + RX + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xsl b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xsl new file mode 100644 index 00000000..ae96ca3c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/presencas/auxiliares.xsl @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Realização de ECDs + + + + + + ( ) + + + data: + + + hora de entrada: __h__m + + + + + + + + + + + ECD + + + + + Rúbrica + + + + + Motivo de não realização + + + + + + + + + + + + + + + + + + + + + + + + + + + hora de saída: __h__m + + + assinatura do trabalhador:________________________________________ + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresDataProvider.java new file mode 100644 index 00000000..2538eeab --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresDataProvider.java @@ -0,0 +1,237 @@ +/* + * PrestadoresDataProvider.java + * + * Created on February 2, 2007, 9:53 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.prestadores; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Object2DArray; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Begin; +import com.evolute.utils.sql.Commit; +import com.evolute.utils.sql.Delete; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Rollback; +import com.evolute.utils.sql.Select; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.search.SearchExecuter; +import siprp.data.ContactoData; +import siprp.medicina.prestadores.data.PrestadoresData; + +/** + * + * @author fpalma + */ +public class PrestadoresDataProvider + implements SearchExecuter +{ + private static final Object LOCK = new Object(); + private static PrestadoresDataProvider instance = null; + + private static final String SEARCH_TITLE = "Procurar prestadores"; + private static final String SEARCH_COLUMNS[] = + new String[]{ "Designa\u00e7\u00e3o", "Servi\u00e7os" }; + + private Executer EXECUTER; + + private JDOProvider JDO; + + /** Creates a new instance of PrestadoresDataProvider */ + public PrestadoresDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public static PrestadoresDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PrestadoresDataProvider(); + } + } + return instance; + } + + public boolean hasDetails() + { + return false; + } + + public String getSearchTitle() + { + return SEARCH_TITLE; + } + + public String[] getColumnNames() + { + return SEARCH_COLUMNS; + } + + public void showDetails(SearchDialog dialog, Object o) throws Exception + { + } + + public Virtual2DArray search(String pattern) throws Exception + { + pattern = pattern.trim().toLowerCase(); + pattern = pattern.replace( ' ', '%' ); + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "faz_consultas", "faz_ecds", "nome_plain" }, + new Field( "nome_plain" ).isLike( "%" + pattern + "%" ), + new String[]{ "nome_plain" }, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Object data[][] = new Object[ array.columnLength() ][ 3 ]; + for( int n = 0; n < data.length; n++ ) + { + data[ n ][ 0 ] = array.get( n, 0 ); + data[ n ][ 1 ] = array.get( n, 1 ); + String str = ""; + if( "y".equals( array.get( n, 2 ) ) ) + { + str += "consultas"; + } + if( "y".equals( array.get( n, 3 ) ) ) + { + str += ( str.length() > 0 ? ", " : "" ) + "ecds"; + } + data[ n ][ 2 ] = str; + } + return new Object2DArray( data ); + } + + public void setGruposProtocoloForPrestador( Integer prestadorID, Integer gruposProtocoloID[] ) + throws Exception + { + EXECUTER.executeQuery( Begin.BEGIN ); + try + { + Delete delete = new Delete( "prestadores_grupos_protocolo", + new Field( "prestador_id" ).isEqual( prestadorID ) ); + EXECUTER.executeQuery( delete ); + Insert insert = + new Insert( "prestadores_grupos_protocolo", + new Assignment[]{ + new Assignment( new Field( "prestador_id" ), prestadorID ), + new Assignment( new Field( "grupo_protocolo_id" ), gruposProtocoloID ) } ); + EXECUTER.executeQuery( insert ); + } + catch( Exception ex ) + { + EXECUTER.executeQuery( Rollback.ROLLBACK ); + } + EXECUTER.executeQuery( Commit.COMMIT ); + } + + public Integer []getGruposProtocoloIDByPrestadorID( Integer prestadorID ) + throws Exception + { + Select select = + new Select( new String[]{ "prestadores_grupos_protocolo" }, + new String[]{ "grupo_protocolo_id" }, + new Field( "prestador_id" ).isEqual( prestadorID ) ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public PrestadoresData getPrestadorByID( Integer id ) + throws Exception + { + return ( PrestadoresData ) JDO.load( PrestadoresData.class, id ); + } + + public void savePrestador( PrestadoresData prestador ) + throws Exception + { + if( prestador.get( PrestadoresData.CONTACTO_ID ) instanceof ContactoData ) + { + ContactoData contacto = ( ContactoData )prestador.get( PrestadoresData.CONTACTO_ID ); + contacto.save(); + prestador.set( PrestadoresData.CONTACTO_ID, contacto.get( ContactoData.ID ) ); + } + prestador.save(); + } + + public IDObject[] getPrestadoresActivos() + throws Exception + { + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "activo" ).isEqual( "y" ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject prestadores[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + prestadores[ n ] = new MappableObject( id, nome ); + } + return prestadores; + } + + public IDObject[] getPrestadoresConsultasActivos() + throws Exception + { + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "activo" ).isEqual( "y" ).and( + new Field( "faz_consultas" ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject prestadores[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + prestadores[ n ] = new MappableObject( id, nome ); + } + return prestadores; + } + + public IDObject[] getPrestadoresECDsActivos() + throws Exception + { + Select select = + new Select( new String[]{ "prestadores" }, + new String[]{ "id", "nome", "nome_plain" }, + new Field( "activo" ).isEqual( "y" ).and( + new Field( "faz_ecds" ).isEqual( "y" ) ), + new String[]{ "nome_plain" }, null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject prestadores[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < prestadores.length; n++ ) + { + Integer id = ( Integer ) array.get( n, 0 ); + String nome = ( String ) array.get( n, 1 ); + prestadores[ n ] = new MappableObject( id, nome ); + } + return prestadores; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresWindow.java b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresWindow.java new file mode 100644 index 00000000..5a2de314 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/PrestadoresWindow.java @@ -0,0 +1,259 @@ +/* + * PrestadoresWindow.java + * + * Created on February 2, 2007, 9:44 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.prestadores; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.dataui.ComponentController; +import com.evolute.utils.dataui.ComponentsHashtable; +import com.evolute.utils.dataui.JDOControllable; +import com.evolute.utils.dataui.JTextComponentPlainFillerSaver; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.panel.CheckBoxPanel; +import com.evolute.utils.ui.search.SearchDialog; +import com.evolute.utils.ui.window.EditorWindow; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; +import java.awt.Dimension; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; +import javax.swing.BorderFactory; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import siprp.clientes.ClientesDataProvider; +import siprp.clientes.ContactoPanel; +import siprp.data.ContactoData; +import siprp.medicina.prestadores.data.PrestadoresData; + +/** + * + * @author fpalma + */ +public class PrestadoresWindow extends EditorWindow +{ + public static final String TITLE = "Prestadores"; + + protected JTextField nomeText; + protected JCheckBox activoCheck; + protected JCheckBox consultasCheck; + protected JCheckBox ecdsCheck; + protected CheckBoxPanel ecdsPanel; + protected JTextArea moradaText; + protected JTextField codigoPostalText; + protected JTextField localidadeCodigoPostalText; + protected JTextField localidadeText; + protected ContactoPanel contactoPanel; + protected JTextField contribuinteText; + + + protected PrestadoresDataProvider provider; + protected ClientesDataProvider clientesProvider; + + protected ComponentsHashtable components; + + protected PrestadoresData prestador; + protected Integer gruposProtocolo[]; + + /** Creates a new instance of PrestadoresWindow */ + public PrestadoresWindow() + throws Exception + { + super( new int[][]{{ NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX, + SELECT_BYNAME_INDEX }} ); + provider = PrestadoresDataProvider.getProvider(); + clientesProvider = ( ClientesDataProvider ) ClientesDataProvider.getProvider(); + setupComponents(); + setupComponentsHashtable(); + } + + private void setupComponents() + throws Exception + { + setTitle( TITLE ); + JLabel nomeLabel = new JLabel( "Designa\u00e7\u00e3o" ); + nomeText = new JTextField(); + nomeText.setPreferredSize( new Dimension( 500, 20 ) ); + activoCheck = new JCheckBox( "Activo (actualmente fornece servi\u00e7os \u00e0 SIPRP)" ); + consultasCheck = new JCheckBox( "Faz consultas" ); + ecdsCheck = new JCheckBox( "Faz ecds" ); + List gruposProtocolo = new Vector(); + IDObject gruposProtocoloReais[] = clientesProvider.getAllGruposProtocoloReais(); + if( gruposProtocoloReais != null && gruposProtocoloReais.length > 0 ) + { + gruposProtocolo.addAll( Arrays.asList( gruposProtocoloReais ) ); + } + IDObject gruposProtocoloFalsos[] = clientesProvider.getAllGruposProtocoloFalsos(); + if( gruposProtocoloFalsos != null && gruposProtocoloFalsos.length > 0 ) + { + gruposProtocolo.addAll( Arrays.asList( gruposProtocoloFalsos ) ); + } + ecdsPanel = new CheckBoxPanel( gruposProtocolo.toArray( new IDObject[ gruposProtocolo.size() ] ) ); + JLabel contactoLabel = new JLabel( "Contacto" ); + contactoPanel = new ContactoPanel(); + contactoPanel.setPreferredSize( new Dimension( 350, 120 ) ); + contactoPanel.setBorder( BorderFactory.createEtchedBorder() ); + JLabel moradaLabel = new JLabel( "Morada" ); + moradaText = new JTextArea(); + moradaText.setLineWrap( true ); + moradaText.setWrapStyleWord( true ); + JScrollPane moradaScroll = new JScrollPane( moradaText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + moradaScroll.setPreferredSize( new Dimension( 500, 50 ) ); + JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" ); + codigoPostalText = new JTextField(); + codigoPostalText.setPreferredSize( new Dimension( 100, 50 ) ); + localidadeCodigoPostalText = new JTextField(); + localidadeCodigoPostalText.setPreferredSize( new Dimension( 150, 50 ) ); + JLabel localidadeLabel = new JLabel( "Localidade" ); + localidadeText = new JTextField(); + JLabel contribuinteLabel = new JLabel( "Contribuinte" ); + contribuinteText = new JTextField(); + contribuinteText.setPreferredSize( new Dimension( 100, 50 ) ); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }; + double rows[] = + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED, + TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM }; + TableLayout tableLayout = new TableLayout( cols,rows ); + getContentPane().setLayout( tableLayout ); + + getContentPane().add( nomeLabel, new TableLayoutConstraints( 0, 0 ) ); + getContentPane().add( nomeText, new TableLayoutConstraints( 1, 0, 3, 0 ) ); + getContentPane().add( activoCheck, new TableLayoutConstraints( 0, 1, 2, 1 ) ); + getContentPane().add( consultasCheck, new TableLayoutConstraints( 0, 2 ) ); + getContentPane().add( ecdsCheck, new TableLayoutConstraints( 0, 3 ) ); + getContentPane().add( ecdsPanel, new TableLayoutConstraints( 1, 3, 2, 3 ) ); + getContentPane().add( contactoLabel, new TableLayoutConstraints( 0, 4 ) ); + getContentPane().add( contactoPanel, new TableLayoutConstraints( 1, 4, 2, 4 ) ); + getContentPane().add( moradaLabel, new TableLayoutConstraints( 0, 5 ) ); + getContentPane().add( moradaScroll, new TableLayoutConstraints( 1, 5, 3, 5 ) ); + getContentPane().add( codigoPostalLabel, new TableLayoutConstraints( 0, 6 ) ); + getContentPane().add( codigoPostalText, new TableLayoutConstraints( 1, 6 ) ); + getContentPane().add( localidadeCodigoPostalText, new TableLayoutConstraints( 2, 6, 3, 6 ) ); + getContentPane().add( localidadeLabel, new TableLayoutConstraints( 0, 7 ) ); + getContentPane().add( localidadeText, new TableLayoutConstraints( 1, 7, 3, 7 ) ); + getContentPane().add( contribuinteLabel, new TableLayoutConstraints( 0, 8 ) ); + getContentPane().add( contribuinteText, new TableLayoutConstraints( 1, 8 ) ); + pack(); + } + + private void setupComponentsHashtable() + { + components = new ComponentsHashtable(); + components.putComponent( PrestadoresData.NOME, nomeText ); + components.putComponent( PrestadoresData.NOME_PLAIN, new JTextComponentPlainFillerSaver( nomeText ) ); + components.putComponent( PrestadoresData.MORADA, moradaText ); + components.putComponent( PrestadoresData.CODIGO_POSTAL, codigoPostalText ); + components.putComponent( PrestadoresData.LOCALIDADE_CP, localidadeCodigoPostalText ); + components.putComponent( PrestadoresData.LOCALIDADE, localidadeText ); + components.putComponent( PrestadoresData.CONTRIBUINTE, contribuinteText ); + components.putComponent( PrestadoresData.ACTIVO, activoCheck ); + components.putComponent( PrestadoresData.FAZ_CONSULTAS, consultasCheck ); + components.putComponent( PrestadoresData.FAZ_ECDS, ecdsCheck ); + components.putComponent( PrestadoresData.CONTACTO_ID, + new JDOControllable( ( JDOProvider )Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ), + ContactoData.class, new String[]{ ContactoData.ID }, + contactoPanel ) ); + } + + + public boolean searchByName() + { + SearchDialog search = new SearchDialog( provider ); + Integer id = ( Integer )search.getSelected(); + if( id == null ) + { + return false; + } + clear( 0 ); + try + { + prestador = provider.getPrestadorByID( id ); + gruposProtocolo = provider.getGruposProtocoloIDByPrestadorID( id ); + reload( 0 ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Ocorreu um erro a carregar o prestador.", true ); + return false; + } + + return true; + } + + public void enableComponents( int index, boolean enable ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.setEnabled( names, enable, components ); + ecdsPanel.setEnabled( enable ); + } + + public void reload( int index ) + { + try + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.fill( names, prestador.getHashData(), components ); + ecdsPanel.setSelected( gruposProtocolo ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + + } + } + + public void clear( int index ) + { + String names[] = (String[])components.keySet().toArray( new String[0] ); + ComponentController.clear( names, components ); + ecdsPanel.clear(); + prestador = null; + gruposProtocolo = null; + } + + public boolean newItem( int index ) + { + return true; + } + + public boolean save( int index ) + { + if( prestador == null ) + { + prestador = new PrestadoresData(); + } + String names[] = (String[])components.keySet().toArray( new String[0] ); + Hashtable data = prestador.getHashData(); + ComponentController.save( names, data, components ); + prestador.setHashData( data ); + gruposProtocolo = ecdsPanel.getSelected(); + try + { + provider.savePrestador( prestador ); + provider.setGruposProtocoloForPrestador( ( Integer ) prestador.get( PrestadoresData.ID ), + gruposProtocolo ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a guardar dados", true ); + return false; + } + return true; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/Prestadores.java b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/Prestadores.java new file mode 100644 index 00000000..196bf5b8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/Prestadores.java @@ -0,0 +1,236 @@ +/* +* Prestadores.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 21, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.prestadores.data; + +import com.evolute.utils.jdo.*; + +public final class Prestadores implements JDOInnerObject +{ + private Integer id; + private String nome; + private String nome_plain; + private String morada; + private String codigo_postal; + private String localidade; + private String localidade_cp; + private Integer contacto_id; + private String activo; + private String faz_consultas; + private String faz_ecds; + private String contribuinte; + + public Prestadores() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == PrestadoresData.ID ) + { + return id; + } + else if( fieldName == PrestadoresData.NOME ) + { + return nome; + } + else if( fieldName == PrestadoresData.NOME_PLAIN ) + { + return nome_plain; + } + else if( fieldName == PrestadoresData.MORADA ) + { + return morada; + } + else if( fieldName == PrestadoresData.CODIGO_POSTAL ) + { + return codigo_postal; + } + else if( fieldName == PrestadoresData.LOCALIDADE ) + { + return localidade; + } + else if( fieldName == PrestadoresData.LOCALIDADE_CP ) + { + return localidade_cp; + } + else if( fieldName == PrestadoresData.CONTACTO_ID ) + { + return contacto_id; + } + else if( fieldName == PrestadoresData.ACTIVO ) + { + return activo; + } + else if( fieldName == PrestadoresData.FAZ_CONSULTAS ) + { + return faz_consultas; + } + else if( fieldName == PrestadoresData.FAZ_ECDS ) + { + return faz_ecds; + } + else if( fieldName == PrestadoresData.CONTRIBUINTE ) + { + return contribuinte; + } + else if( fieldName.equals( PrestadoresData.ID ) ) + { + return id; + } + else if( fieldName.equals( PrestadoresData.NOME ) ) + { + return nome; + } + else if( fieldName.equals( PrestadoresData.NOME_PLAIN ) ) + { + return nome_plain; + } + else if( fieldName.equals( PrestadoresData.MORADA ) ) + { + return morada; + } + else if( fieldName.equals( PrestadoresData.CODIGO_POSTAL ) ) + { + return codigo_postal; + } + else if( fieldName.equals( PrestadoresData.LOCALIDADE ) ) + { + return localidade; + } + else if( fieldName.equals( PrestadoresData.LOCALIDADE_CP ) ) + { + return localidade_cp; + } + else if( fieldName.equals( PrestadoresData.CONTACTO_ID ) ) + { + return contacto_id; + } + else if( fieldName.equals( PrestadoresData.ACTIVO ) ) + { + return activo; + } + else if( fieldName.equals( PrestadoresData.FAZ_CONSULTAS ) ) + { + return faz_consultas; + } + else if( fieldName.equals( PrestadoresData.FAZ_ECDS ) ) + { + return faz_ecds; + } + else if( fieldName.equals( PrestadoresData.CONTRIBUINTE ) ) + { + return contribuinte; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == PrestadoresData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == PrestadoresData.NOME ) + { + nome = ( String ) value; + } + else if( fieldName == PrestadoresData.NOME_PLAIN ) + { + nome_plain = ( String ) value; + } + else if( fieldName == PrestadoresData.MORADA ) + { + morada = ( String ) value; + } + else if( fieldName == PrestadoresData.CODIGO_POSTAL ) + { + codigo_postal = ( String ) value; + } + else if( fieldName == PrestadoresData.LOCALIDADE ) + { + localidade = ( String ) value; + } + else if( fieldName == PrestadoresData.LOCALIDADE_CP ) + { + localidade_cp = ( String ) value; + } + else if( fieldName == PrestadoresData.CONTACTO_ID ) + { + contacto_id = ( Integer ) value; + } + else if( fieldName == PrestadoresData.ACTIVO ) + { + activo = ( String ) value; + } + else if( fieldName == PrestadoresData.FAZ_CONSULTAS ) + { + faz_consultas = ( String ) value; + } + else if( fieldName == PrestadoresData.FAZ_ECDS ) + { + faz_ecds = ( String ) value; + } + else if( fieldName == PrestadoresData.CONTRIBUINTE ) + { + contribuinte = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( PrestadoresData.NOME ) ) + { + nome = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.NOME_PLAIN ) ) + { + nome_plain = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.MORADA ) ) + { + morada = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.CODIGO_POSTAL ) ) + { + codigo_postal = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.LOCALIDADE ) ) + { + localidade = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.LOCALIDADE_CP ) ) + { + localidade_cp = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.CONTACTO_ID ) ) + { + contacto_id = ( Integer ) value; + } + else if( fieldName.equals( PrestadoresData.ACTIVO ) ) + { + activo = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.FAZ_CONSULTAS ) ) + { + faz_consultas = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.FAZ_ECDS ) ) + { + faz_ecds = ( String ) value; + } + else if( fieldName.equals( PrestadoresData.CONTRIBUINTE ) ) + { + contribuinte = ( String ) value; + } + } + + public Class getOuterClass() + { + return PrestadoresData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresData.java new file mode 100644 index 00000000..0afbd770 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresData.java @@ -0,0 +1,70 @@ +/* +* PrestadoresData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on Feb 21, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.prestadores.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class PrestadoresData extends JDOObject +{ + public static final String ID = "id"; + public static final String NOME = "nome"; + public static final String NOME_PLAIN = "nome_plain"; + public static final String MORADA = "morada"; + public static final String CODIGO_POSTAL = "codigo_postal"; + public static final String LOCALIDADE = "localidade"; + public static final String LOCALIDADE_CP = "localidade_cp"; + public static final String CONTACTO_ID = "contacto_id"; + public static final String ACTIVO = "activo"; + public static final String FAZ_CONSULTAS = "faz_consultas"; + public static final String FAZ_ECDS = "faz_ecds"; + public static final String CONTRIBUINTE = "contribuinte"; + + public static final String FIELD_NAMES[] = new String[]{ + NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, LOCALIDADE_CP, CONTACTO_ID, + ACTIVO, FAZ_CONSULTAS, FAZ_ECDS, CONTRIBUINTE, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, NOME, NOME_PLAIN, MORADA, CODIGO_POSTAL, LOCALIDADE, LOCALIDADE_CP, CONTACTO_ID, + ACTIVO, FAZ_CONSULTAS, FAZ_ECDS, CONTRIBUINTE, }; + + private HashMap dataHash; + + public PrestadoresData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return Prestadores.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresID.java new file mode 100644 index 00000000..63ad6666 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/PrestadoresID.java @@ -0,0 +1,25 @@ +/* +* PrestadoresID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on Feb 21, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.prestadores.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class PrestadoresID extends IntegerID + implements Serializable +{ + public PrestadoresID() + { + } + + public PrestadoresID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/package.jdo b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/package.jdo new file mode 100644 index 00000000..a901197b --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/prestadores/data/package.jdo @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/EscolherMotivoDialog.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/EscolherMotivoDialog.java new file mode 100644 index 00000000..1f9f83c5 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/EscolherMotivoDialog.java @@ -0,0 +1,183 @@ +/* + * EscolherMotivoDialog.java + * + * Created on 13 de Maio de 2007, 22:16 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.ui.CustomJDialog; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; +import javax.swing.AbstractButton; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; +import siprp.medicina.MedicinaConstants; + +/** + * + * @author Frederico + */ +public class EscolherMotivoDialog extends CustomJDialog + implements ActionListener, MedicinaConstants +{ + protected IDObject MOTIVOS[] = + new IDObject[]{ + new MappableObject( MOTIVO_ADMISSAO_INTEGER, MOTIVO_ADMISSAO_STR ), + new MappableObject( MOTIVO_PERIODICO_INTEGER, MOTIVO_PERIODICO_STR ), + new MappableObject( MOTIVO_PERIODICO_INICIAL_INTEGER, MOTIVO_PERIODICO_INICIAL_STR ), + new MappableObject( MOTIVO_OCASIONAL_INTEGER, MOTIVO_OCASIONAL_STR ) + }; + + protected IDObject SUB_MOTIVOS[][] = + new IDObject[][]{ + {}, + {}, + {}, + { new MappableObject( SUB_MOTIVO_APOS_DOENCA_INTEGER, SUB_MOTIVO_APOS_DOENCA_STR ), + new MappableObject( SUB_MOTIVO_APOS_ACIDENTE_INTEGER, SUB_MOTIVO_APOS_ACIDENTE_STR ), + new MappableObject( SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER, SUB_MOTIVO_PEDIDO_TRABALHADOR_STR ), + new MappableObject( SUB_MOTIVO_PEDIDO_SERVICO_INTEGER, SUB_MOTIVO_PEDIDO_SERVICO_STR ), + new MappableObject( SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER, SUB_MOTIVO_MUDANCA_FUNCAO_STR ), + new MappableObject( SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER, SUB_MOTIVO_ALTERACAO_CONDICOES_STR ), + new MappableObject( SUB_MOTIVO_OUTRO_INTEGER, SUB_MOTIVO_OUTRO_STR ) + } + }; + + protected AbstractButton motivoButtons[]; + protected HashMap subMotivoButtons; + protected HashMap motivoButtonIDs; + protected HashMap subMotivoButtonIDs; + protected JPanel motivoPanel; + protected JPanel subMotivoPanel; + + protected Integer motivoTemp; + protected Integer motivo; + protected Integer subMotivo; + + /** Creates a new instance of EscolherMotivoDialog */ + public EscolherMotivoDialog( JFrame owner ) + { + super( owner, true ); + setupComponents(); + + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + } + + private void setupComponents() + { + setTitle( "Escolher Motivo" ); + setLayout( new FlowLayout( FlowLayout.LEFT ) ); + motivoButtons = new JToggleButton[ MOTIVOS.length ]; + subMotivoButtons = new HashMap(); + motivoButtonIDs = new HashMap(); + subMotivoButtonIDs = new HashMap(); + for( int m = 0; m < MOTIVOS.length; m++ ) + { + JToggleButton motivoButton = new JToggleButton( MOTIVOS[ m ].toString() ); + motivoButton.addActionListener( this ); + motivoButtonIDs.put( motivoButton, MOTIVOS[ m ].getID() ); + motivoButton.setPreferredSize( new Dimension( 250, 20 ) ); + motivoButtons[ m ] = motivoButton; + if( SUB_MOTIVOS[ m ].length > 0 ) + { + JButton subButtons[] = new JButton[ SUB_MOTIVOS[ m ].length ]; + for( int sm = 0; sm < SUB_MOTIVOS[ m ].length; sm++ ) + { + JButton subButton = new JButton( SUB_MOTIVOS[ m ][ sm ].toString() ); + subMotivoButtonIDs.put( subButton, SUB_MOTIVOS[ m ][ sm ].getID() ); + subButtons[ sm ] = subButton; + subButton.setPreferredSize( new Dimension( 300, 20 ) ); + subButton.addActionListener( this ); + } + subMotivoButtons.put( motivoButton, subButtons ); + } + else + { + subMotivoButtons.put( motivoButton, null ); + } + } + motivoPanel = new JPanel(); + subMotivoPanel = new JPanel(); + + motivoPanel.setLayout( new GridLayout( motivoButtons.length + 1, 1 ) ); + for( int n = 0; n < motivoButtons.length; n++ ) + { + motivoPanel.add( motivoButtons[ n ] ); + } + + add( motivoPanel ); + add( subMotivoPanel ); + + pack(); + } + + public void actionPerformed(ActionEvent e) + { + AbstractButton source = ( AbstractButton ) e.getSource(); + if( motivoButtonIDs.containsKey( source ) ) + { + motivoTemp = motivoButtonIDs.get( source ); + } + else if( subMotivoButtonIDs.containsKey( source ) ) + { + motivo = motivoTemp; + subMotivo = subMotivoButtonIDs.get( source ); + close(); + } + if( subMotivoButtons.containsKey( source ) ) + { + JButton subButtons[] = subMotivoButtons.get( source ); + if( subButtons == null || subButtons.length == 0 ) + { + motivo = motivoTemp; + close(); + } + else + { + subMotivoPanel.removeAll(); + subMotivoPanel.setLayout( new GridLayout( 0, 1 ) ); + for( int n = 0; n < subButtons.length; n++ ) + { + subMotivoPanel.add( subButtons[ n ] ); + } + pack(); + } + } + } + + protected void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public Integer[] getMotivo() + { + return new Integer[]{ motivo, subMotivo }; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoConstants.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoConstants.java new file mode 100644 index 00000000..a915de30 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoConstants.java @@ -0,0 +1,30 @@ +/* + * ProcessoConstants.java + * + * Created on May 14, 2007, 10:08 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +/** + * + * @author fpalma + */ +public interface ProcessoConstants +{ + public static final int TIPO_ECDS = 0; + public static final int TIPO_CONSULTA = 1; + public static final int TIPO_FICHA_APTIDAO = 2; + + public static final String PROCESSO_ABERTO_CODE = "a"; + public static final String PROCESSO_FECHADO_CODE = "f"; + public static final String PROCESSO_CANCELADO_CODE = "c"; + + public static final String PROCESSO_ABERTO_DESCRIPTION = "Aberto"; + public static final String PROCESSO_FECHADO_DESCRIPTION = "Fechado"; + public static final String PROCESSO_CANCELADO_DESCRIPTION = "Cancelado"; + public static final String PROCESSO_POR_ABRIR_DESCRIPTION = "Por Abrir"; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoController.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoController.java new file mode 100644 index 00000000..ee9f22bf --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoController.java @@ -0,0 +1,405 @@ + /* + * ProcessoController.java + * + * Created on 25 de Abril de 2007, 15:10 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.ui.DialogException; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import siprp.data.TrabalhadorData; +import siprp.medicina.processo.detalhes.DetalhesProcessoPanel; +import siprp.medicina.processo.estrutura.EstruturaProcessoPanel; + +/** + * + * @author Frederico + */ +public class ProcessoController + implements ProcessoListener, ListSelectionListener +{ + protected ProcessoUpperPanel processoUpperPanel; + protected EstruturaProcessoPanel estruturaProcessoPanel; + protected ProcessoPanel processoPanel; + protected DetalhesProcessoPanel detalhesProcessoPanel; + protected ProcessoDataProvider provider; + + protected JDOProvider JDO; + + protected Integer idProcesso; + protected Integer idMarcacao; + protected Integer idData; + + /** Creates a new instance of ProcessoController */ + public ProcessoController( ProcessoUpperPanel processoUpperPanel, EstruturaProcessoPanel estruturaProcessoPanel, + ProcessoPanel processoPanel, DetalhesProcessoPanel detalhesProcessoPanel ) + throws Exception + { + this.processoUpperPanel = processoUpperPanel; + this.estruturaProcessoPanel = estruturaProcessoPanel; + this.processoPanel = processoPanel; + this.detalhesProcessoPanel = detalhesProcessoPanel; + processoUpperPanel.addListSelectionListener( this ); + estruturaProcessoPanel.addProcessoListener( this ); + processoPanel.addProcessoListener( this ); + detalhesProcessoPanel.addProcessoListener( this ); + + provider = ProcessoDataProvider.getProvider(); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public void processoStateChanged(ProcessoEvent e) + { + int accao = e.getAccao(); + switch( accao ) + { + case ProcessoEvent.ACCAO_RECARREGAR_TRABALHADOR: + recarregarTrabalhador( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_PROCESSO: + escolherProcesso( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_CONSULTA: + escolherConsulta( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_ECDS: + escolherECDs( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_FA: + escolherFichaAptidao( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_DATA: + escolherData( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_OBSERVACOES: + escolherObservacoes( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_MAIL: + escolherMail( e ); + break; + + case ProcessoEvent.ACCAO_ESCOLHER_MOTIVO: + escolherMotivo( e ); + break; + + case ProcessoEvent.ACCAO_MARCAR_CONSULTA: + marcarConsulta( e ); + break; + + case ProcessoEvent.ACCAO_MARCAR_ECDS: + marcarECDs( e ); + break; + + case ProcessoEvent.ACCAO_EMITIR_FA: + emitirFichaAptidao( e ); + break; + + case ProcessoEvent.ACCAO_FECHAR: + fecharProcesso( e ); + break; + + case ProcessoEvent.ACCAO_MUDAR_ESTADO_MARCACAO: + mudarEstadoMarcacao( e ); + break; + + case ProcessoEvent.ACCAO_MUDAR_DATA_MARCACAO: + mudarDataMarcacao( e ); + break; + + case ProcessoEvent.ACCAO_ESCREVER_OBSERVACOES: + escreverObservacoes( e ); + break; + + case ProcessoEvent.ACCAO_ESCREVER_MAIL: + escreverMail( e ); + break; + + } + } + + public void recarregarTrabalhador( ProcessoEvent e ) + { + idProcesso = null; + estruturaProcessoPanel.reload(); + } + + public void escolherProcesso( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + processoPanel.fill( idProcesso ); + detalhesProcessoPanel.setProcessoID( idProcesso ); + detalhesProcessoPanel.clear(); + } + catch( Exception ex ) + { + } + } + + public void escolherConsulta( ProcessoEvent e ) + { + try + { + Integer idProcessoAntigo = idProcesso; + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + processoPanel.fill( idProcesso ); + detalhesProcessoPanel.setProcessoID( idProcesso ); + idMarcacao = e.getObjecto( ProcessoEvent.TIPO_CONSULTA ); + detalhesProcessoPanel.setConsulta( idMarcacao ); + } + catch( Exception ex ) + { + } + } + + public void escolherECDs( ProcessoEvent e ) + { + try + { + Integer idProcessoAntigo = idProcesso; + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + processoPanel.fill( idProcesso ); + detalhesProcessoPanel.setProcessoID( idProcesso ); + + idMarcacao = e.getObjecto( ProcessoEvent.TIPO_ECDS ); + detalhesProcessoPanel.setECDs( idMarcacao ); + } + catch( Exception ex ) + { + } + } + + public void escolherFichaAptidao( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + Integer idFichaAptidao = e.getObjecto( ProcessoEvent.TIPO_FICHA_APTIDAO ); + } + catch( Exception ex ) + { + } + } + + public void escolherData( ProcessoEvent e ) + { + try + { + Integer idProcessoAntigo = idProcesso; + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + processoPanel.fill( idProcesso ); + detalhesProcessoPanel.setProcessoID( idProcesso ); + Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA ); + Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS ); + Integer idData = e.getObjecto( ProcessoEvent.TIPO_DATA ); + if( idConsulta != null ) + { + idMarcacao = idConsulta; + detalhesProcessoPanel.setConsulta( idConsulta ); + } + else if( idECDs != null ) + { + idMarcacao = idECDs; + detalhesProcessoPanel.setECDs( idECDs ); + } + else + { + idMarcacao = null; + detalhesProcessoPanel.clear(); + } + } + catch( Exception ex ) + { + } + } + + public void escolherObservacoes( ProcessoEvent e ) + { + try + { + escolherData( e ); + Integer idObservacoes = e.getObjecto( ProcessoEvent.TIPO_OBSERVACOES ); + } + catch( Exception ex ) + { + } + } + + public void escolherMail( ProcessoEvent e ) + { + try + { + escolherData( e ); + Integer idMail = e.getObjecto( ProcessoEvent.TIPO_MAIL ); + } + catch( Exception ex ) + { + } + } + + public void escolherMotivo( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + estruturaProcessoPanel.actualizarProcessoEscolhido( idProcesso ); + detalhesProcessoPanel.setProcessoID( idProcesso ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a actualizar dados", true ); + } + } + + public void marcarConsulta( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + detalhesProcessoPanel.setConsulta( null ); + + } + catch( Exception ex ) + { + } + } + + public void marcarECDs( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + detalhesProcessoPanel.setECDs( null ); + } + catch( Exception ex ) + { + } + } + + public void emitirFichaAptidao( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + estruturaProcessoPanel.actualizarProcessoEscolhido( idProcesso ); + } + catch( Exception ex ) + { + } + } + + public void fecharProcesso( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + estruturaProcessoPanel.actualizarProcessoEscolhido( idProcesso ); + } + catch( Exception ex ) + { + } + } + + public void mudarEstadoMarcacao( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA ); + Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS ); + idMarcacao = idConsulta != null ? idConsulta : idECDs; + estruturaProcessoPanel.actualizarMarcacaoEscolhida( idProcesso, idMarcacao ); + } + catch( Exception ex ) + { + } + } + + public void mudarDataMarcacao( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA ); + Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS ); + idMarcacao = idConsulta != null ? idConsulta : idECDs; + estruturaProcessoPanel.actualizarMarcacaoEscolhida( idProcesso, idMarcacao ); + } + catch( Exception ex ) + { + } + } + + public void escreverObservacoes( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA ); + Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS ); + idMarcacao = idConsulta != null ? idConsulta : idECDs; + estruturaProcessoPanel.actualizarMarcacaoEscolhida( idProcesso, idMarcacao ); + } + catch( Exception ex ) + { + } + } + + public void escreverMail( ProcessoEvent e ) + { + try + { + idProcesso = e.getObjecto( ProcessoEvent.TIPO_PROCESSO ); + Integer idConsulta = e.getObjecto( ProcessoEvent.TIPO_CONSULTA ); + Integer idECDs = e.getObjecto( ProcessoEvent.TIPO_ECDS ); + idMarcacao = idConsulta != null ? idConsulta : idECDs; + estruturaProcessoPanel.actualizarMarcacaoEscolhida( idProcesso, idMarcacao ); + } + catch( Exception ex ) + { + } + } + + public void valueChanged(ListSelectionEvent e) + { + try + { + Integer ids[] = ( Integer [] ) processoUpperPanel.save(); + Integer trabalhadorID = ids[ 2 ]; + processoPanel.setTrabalhadorID( trabalhadorID ); + if( trabalhadorID != null ) + { + TrabalhadorData trabalhador = ( TrabalhadorData ) JDO.load( TrabalhadorData.class, trabalhadorID ); + estruturaProcessoPanel.setTrabalhador( new MappableObject( trabalhadorID, trabalhador.get( TrabalhadorData.NOME ) ) ); + } + else + { + estruturaProcessoPanel.clear(); + } + processoPanel.clear(); + detalhesProcessoPanel.clear(); + processoPanel.setTrabalhadorID( trabalhadorID ); + detalhesProcessoPanel.setTrabalhadorID( trabalhadorID ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar trabalhador", true ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoDataProvider.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoDataProvider.java new file mode 100644 index 00000000..75eafc8d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoDataProvider.java @@ -0,0 +1,616 @@ +/* + * ProcessoDataProvider.java + * + * Created on March 20, 2007, 5:14 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import com.evolute.utils.Singleton; +import com.evolute.utils.arrays.Virtual2DArray; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.data.MappableObject; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Expression; +import com.evolute.utils.sql.Field; +import com.evolute.utils.sql.Insert; +import com.evolute.utils.sql.Select; +import com.evolute.utils.sql.Select2; +import com.evolute.utils.sql.Update; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Vector; +import siprp.medicina.MedicinaConstants; +import siprp.medicina.processo.data.TrabalhadoresConsultasData; +import siprp.medicina.processo.data.TrabalhadoresConsultasDatasData; +import siprp.medicina.processo.data.TrabalhadoresEcdsData; +import siprp.medicina.processo.data.TrabalhadoresEcdsDatasData; +import siprp.medicina.processo.data.TrabalhadoresProcessoData; + +/** + * + * @author fpalma + */ +public class ProcessoDataProvider + implements MedicinaConstants, ProcessoConstants +{ + private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + public static final HashMap ESTADO_PROCESSO_BY_CODE = + new HashMap(); + + static + { + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_ABERTO_CODE, PROCESSO_ABERTO_DESCRIPTION ); + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_FECHADO_CODE, PROCESSO_FECHADO_DESCRIPTION ); + ESTADO_PROCESSO_BY_CODE.put( PROCESSO_CANCELADO_CODE, PROCESSO_CANCELADO_DESCRIPTION ); + } + + private static final Object LOCK = new Object(); + private static ProcessoDataProvider instance = null; + private Executer EXECUTER; + private JDOProvider JDO; + + /** Creates a new instance of ProcessoDataProvider */ + public ProcessoDataProvider() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter( this ); + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + } + + public static ProcessoDataProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new ProcessoDataProvider(); + } + } + return instance; + } + + public Integer[] getIDsProcessosByTrabalhador( Integer trabalhadorID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_processo" }, + new Integer[ 0 ], + new Expression[ 0 ], + new String[]{ "id", "data_inicio" }, + new Field( "trabalhadores_processo.trabalhador_id" ).isEqual( trabalhadorID ), + new String[]{ "data_inicio DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public TrabalhadoresProcessoData getProcessoByID( Integer id ) + throws Exception + { + return ( TrabalhadoresProcessoData ) JDO.load( TrabalhadoresProcessoData.class, id ); + } + + public void saveProcesso( TrabalhadoresProcessoData processo ) + throws Exception + { + processo.save(); + } + + public String getDescricaoEstadoProcessoByCodigo( String codigo ) + throws Exception + { + return ESTADO_PROCESSO_BY_CODE.get( codigo ); + } + + public Object[][] getElementosProcesso( Integer processoID ) + throws Exception + { + Vector elementosVector = new Vector(); + + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "estado", "" + TIPO_ECDS }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "data", "id" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + elementosVector.addAll( Arrays.asList( array.getObjects() ) ); + + select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "estado", "" + TIPO_CONSULTA }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "data", "id" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + elementosVector.addAll( Arrays.asList( array.getObjects() ) ); + + select = + new Select2( new String[]{ "trabalhadores_fichas_aptidao", "exames" }, + new Integer[]{ Select2.JOIN_INNER }, + new Expression[]{ new Field( "trabalhadores_fichas_aptidao.exame_id" ).isEqual( new Field( "exames.id" ) ) }, + new String[]{ "exames.id", "exames.data", "resultado", "" + TIPO_FICHA_APTIDAO }, + new Field( "trabalhadores_fichas_aptidao.processo_id" ).isEqual( processoID ).and( + new Field( "exames.inactivo" ).isDifferent( "y" ) ), + new String[]{ "exames.data", "exames.id" }, + null, + null, + null ); + array = EXECUTER.executeQuery( select ); + elementosVector.addAll( Arrays.asList( array.getObjects() ) ); + + Object elementos[][] = elementosVector.toArray( new Object[ elementosVector.size() ][] ); + Arrays.sort( elementos, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + return ( (Date)( ( Object[] ) o1 )[ 1 ] ).compareTo( ( (Date)( ( Object[] ) o2 )[ 1 ] ) ); + } + } ); + return elementos; + } + + public Object[][] getDatasConsulta( Integer consultaID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "estado" }, + new Field( "trabalhadores_consultas_id" ).isEqual( consultaID ), + new String[]{ "data DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.getObjects(); + } + + public Object[][] getDatasECDs( Integer consultaID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "estado" }, + new Field( "consulta_id" ).isEqual( consultaID ), + new String[]{ "data DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.getObjects(); + } + + public IDObject getObservacoesConsultaData( Integer consultaDataID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas_observacoes" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "observacao" }, + new Field( "trabalhadores_consultas_datas_id" ).isEqual( consultaDataID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return new MappableObject( ( Integer ) array.get( 0, 0 ), ( String ) array.get( 0, 1 ) ); + } + } + + public void saveObservacoesConsultaData( Integer consultaDataID, String observacao ) + throws Exception + { + IDObject observacaoAntiga = getObservacoesConsultaData( consultaDataID ); + if( observacaoAntiga != null ) + { + Update update = + new Update( "trabalhadores_consultas_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ) }, + new Field( "id" ).isEqual( observacaoAntiga.getID() ) ); + EXECUTER.executeQuery( update ); + } + else + { + Insert insert = + new Insert( "trabalhadores_consultas_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ), + new Assignment( "trabalhadores_consultas_datas_id", consultaDataID ) } ); + EXECUTER.executeQuery( insert ); + } + } + + public IDObject[] getEmailConsultaData( Integer consultaDataID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas_emails" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "data", "subject" }, + new Field( "trabalhadores_consultas_datas_id" ).isEqual( consultaDataID ), + new String[]{ "data DESC" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + IDObject mails[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < mails.length; n++ ) + { + Date data = ( Date ) array.get( n, 1 ); + String desc = D_F.format( data ) + " : " + array.get( n, 2 ); + mails[ n ] = new MappableObject( ( Integer ) array.get( n, 0 ), desc ); + } + return mails; + } + + public void saveEmailConsultaData( Integer consultaDataID, String destination, + String subject, String body ) + throws Exception + { + Insert insert = + new Insert( "trabalhadores_consultas_datas_emails", + new Assignment[]{ + new Assignment( "destination", destination ), + new Assignment( "subject", subject ), + new Assignment( "body", body ), + new Assignment( "data", new Date() ), + new Assignment( "trabalhadores_consultas_datas_id", consultaDataID ) } ); + EXECUTER.executeQuery( insert ); + } + + public Integer getLastConsultaDataIDForConsulta( Integer consultaID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "MAX( id )" }, + new Field( "trabalhadores_consultas_id" ).isEqual( consultaID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public IDObject getObservacoesECDsData( Integer ecdsDataID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas_observacoes" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "observacao" }, + new Field( "trabalhadores_ecds_datas_id" ).isEqual( ecdsDataID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return new MappableObject( ( Integer ) array.get( 0, 0 ), ( String ) array.get( 0, 1 ) ); + } + } + + public void saveObservacoesECDsData( Integer ecdsDataID, String observacao ) + throws Exception + { + IDObject observacaoAntiga = getObservacoesECDsData( ecdsDataID ); + if( observacaoAntiga != null ) + { + Update update = + new Update( "trabalhadores_ecds_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ) }, + new Field( "id" ).isEqual( observacaoAntiga.getID() ) ); + EXECUTER.executeQuery( update ); + } + else + { + Insert insert = + new Insert( "trabalhadores_ecds_datas_observacoes", + new Assignment[]{ + new Assignment( "observacao", observacao ), + new Assignment( "trabalhadores_ecds_datas_id", ecdsDataID ) } ); + EXECUTER.executeQuery( insert ); + } + } + + public Integer getLastECDsDataIDForECDs( Integer ecdsID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "MAX( id )" }, + new Field( "trabalhadores_ecds_id" ).isEqual( ecdsID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 || array.get( 0, 0 ) == null ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public boolean getProcessoTemConsultasPorRealizar( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "estado" }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "estado" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( array.columnLength() > 0 ) && ( new Integer( ESTADO_POR_REALIZAR ).equals( array.get( 0, 1 ) ) ); + } + + public boolean getProcessoTemECDsPorRealizar( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id", "estado" }, + new Field( "processo_id" ).isEqual( processoID ), + new String[]{ "estado" }, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( array.columnLength() > 0 ) && ( new Integer( ESTADO_POR_REALIZAR ).equals( array.get( 0, 1 ) ) ); + } + + public Integer[] getConsultaIDsForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public Integer[] getECDsIDsForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + Integer ids[] = new Integer[ array.columnLength() ]; + for( int n = 0; n < ids.length; n++ ) + { + ids[ n ] = ( Integer ) array.get( n, 0 ); + } + return ids; + } + + public Integer getConsultaEmAbertoForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_REALIZADO ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public Integer getECDsEmAbertoForProcesso( Integer processoID ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "processo_id" ).isEqual( processoID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + if( array.columnLength() == 0 ) + { + return null; + } + else + { + return ( Integer ) array.get( 0, 0 ); + } + } + + public TrabalhadoresConsultasData getConsultaByID( Integer id ) + throws Exception + { + return ( TrabalhadoresConsultasData ) JDO.load( TrabalhadoresConsultasData.class, id ); + } + + public void saveConsulta( TrabalhadoresConsultasData consulta ) + throws Exception + { + consulta.save(); + } + + public TrabalhadoresConsultasDatasData getConsultaDataByID( Integer id ) + throws Exception + { + return ( TrabalhadoresConsultasDatasData ) JDO.load( TrabalhadoresConsultasDatasData.class, id ); + } + + public void saveConsultaData( TrabalhadoresConsultasDatasData consultaData ) + throws Exception + { + consultaData.save(); + } + + public TrabalhadoresEcdsData getEcdsByID( Integer id ) + throws Exception + { + return ( TrabalhadoresEcdsData ) JDO.load( TrabalhadoresEcdsData.class, id ); + } + + public void saveEcds( TrabalhadoresEcdsData ecds ) + throws Exception + { + ecds.save(); + } + + public TrabalhadoresEcdsDatasData getEcdsDataByID( Integer id ) + throws Exception + { + return ( TrabalhadoresEcdsDatasData ) JDO.load( TrabalhadoresEcdsDatasData.class, id ); + } + + public void saveEcdsData( TrabalhadoresEcdsDatasData EcdsData ) + throws Exception + { + EcdsData.save(); + } + + public boolean verificarDataValidaForConsulta( Integer consultaID, Date data ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_consultas_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "trabalhadores_consultas_id" ).isEqual( consultaID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ).and( + new Field( "data" ).isGreater( data ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.columnLength() == 0; + } + + public boolean verificarDataValidaForECDs( Integer ecdsID, Date data ) + throws Exception + { + Select select = + new Select2( new String[]{ "trabalhadores_ecds_datas" }, + new Integer[]{}, + new Expression[]{}, + new String[]{ "id" }, + new Field( "trabalhadores_ecdss_id" ).isEqual( ecdsID ).and( + new Field( "estado" ).isDifferent( new Integer( ESTADO_POR_REALIZAR ) ) ).and( + new Field( "data" ).isGreater( data ) ), + null, + null, + null, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return array.columnLength() == 0; + } + + public void saveLigacaoProcessoFichaAptidao( Integer processoID, Integer fichaID ) + throws Exception + { + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoEvent.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoEvent.java new file mode 100644 index 00000000..aa7ba004 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoEvent.java @@ -0,0 +1,74 @@ +/* + * ProcessoEvent.java + * + * Created on 25 de Abril de 2007, 10:53 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import java.util.HashMap; + +/** + * + * @author Frederico + */ +public class ProcessoEvent +{ + public static final int ACCAO_RECARREGAR_TRABALHADOR = 0; + public static final int ACCAO_ESCOLHER_PROCESSO = 1; + public static final int ACCAO_ESCOLHER_CONSULTA = 2; + public static final int ACCAO_ESCOLHER_ECDS = 3; + public static final int ACCAO_ESCOLHER_FA = 4; + public static final int ACCAO_ESCOLHER_DATA = 5; + public static final int ACCAO_ESCOLHER_OBSERVACOES = 6; + public static final int ACCAO_ESCOLHER_MAIL = 7; + public static final int ACCAO_ESCOLHER_MOTIVO = 8; + public static final int ACCAO_MARCAR_CONSULTA = 9; + public static final int ACCAO_MARCAR_ECDS = 10; + public static final int ACCAO_EMITIR_FA = 11; + public static final int ACCAO_FECHAR = 12; + public static final int ACCAO_MUDAR_ESTADO_MARCACAO = 13; + public static final int ACCAO_MUDAR_DATA_MARCACAO = 14; + public static final int ACCAO_ESCREVER_OBSERVACOES = 15; + public static final int ACCAO_ESCREVER_MAIL = 16; + + public static final Integer TIPO_ANY = new Integer( 0 ); + public static final Integer TIPO_PROCESSO = new Integer( 1 ); + public static final Integer TIPO_CONSULTA = new Integer( 2 ); + public static final Integer TIPO_ECDS = new Integer( 3 ); + public static final Integer TIPO_DATA = new Integer( 4 ); + public static final Integer TIPO_OBSERVACOES = new Integer( 5 ); + public static final Integer TIPO_MAIL = new Integer( 6 ); + public static final Integer TIPO_FICHA_APTIDAO = new Integer( 7 ); + + protected final Object source; + protected final int accao; + protected final HashMap idsObjectos; + + /** Creates a new instance of ProcessoEvent */ + public ProcessoEvent( Object source, int accao, HashMap idsObjectos ) + { + this.source = source; + this.accao = accao; + this.idsObjectos = idsObjectos; + } + + public Object getSource() + { + return source; + } + + public int getAccao() + { + return accao; + } + + public Integer getObjecto( Integer tipo ) + { + return idsObjectos.get( tipo ); + } + +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoListener.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoListener.java new file mode 100644 index 00000000..db1d821a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoListener.java @@ -0,0 +1,19 @@ +/* + * ProcessoListener.java + * + * Created on 25 de Abril de 2007, 10:55 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +/** + * + * @author Frederico + */ +public interface ProcessoListener +{ + public void processoStateChanged( ProcessoEvent e ); +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoPanel.java new file mode 100644 index 00000000..8da79937 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoPanel.java @@ -0,0 +1,415 @@ +/* + * ProcessoPanel.java + * + * Created on March 21, 2007, 9:11 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import com.evolute.utils.dataui.ControllableComponent; +import com.evolute.utils.images.ImageIconLoader; +import com.evolute.utils.ui.DialogException; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.DateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Vector; +import javax.swing.*; +import siprp.ficha.FichaWindow; +import siprp.ficha.SaveExameListener; +import siprp.medicina.MedicinaConstants; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.processo.data.TrabalhadoresProcessoData; + +/** + * + * @author fpalma + */ +public class ProcessoPanel extends JPanel + implements ActionListener, ControllableComponent, + MedicinaConstants, ProcessoConstants, SaveExameListener +{ + private static final String ECDS_ICON_PATH = "siprp/medicina/processo/icons/ecds.png"; + private static final String CONSULTA_ICON_PATH = "siprp/medicina/processo/icons/consulta.png"; + private static final String FICHA_APTIDAO_ICON_PATH = "siprp/medicina/processo/icons/fichaaptidao.png"; + private static final String FECHAR_ICON_PATH = "siprp/medicina/processo/icons/lock.png"; + + private static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + private JTextField estadoText; + private JTextField inicioText; + private JTextField fimText; + private JButton motivoButton; + private JButton novoECDButton; + private JButton novaConsultaButton; + private JButton emitirFAButton; + private JButton fecharButton; + + protected JFrame owner; + + private final Vector PROCESSO_LISTENERS = new Vector(); + + private ProcessoDataProvider provider; + + private Integer trabalhadorID = null; + private TrabalhadoresProcessoData processo; + + /** Creates a new instance of ProcessoPanel */ + public ProcessoPanel( JFrame owner ) + throws Exception + { + this.owner = owner; + provider = ProcessoDataProvider.getProvider(); + setupComponents(); + enableButtons(); + } + + + private void setupComponents() + { + motivoButton = new JButton( "Motivo" ); + motivoButton.addActionListener( this ); + JLabel estadoLabel = new JLabel( "Estado" ); + estadoText = new JTextField(); + estadoText.setPreferredSize( new Dimension( 120, 20 ) ); + estadoText.setEditable( false ); + JLabel inicioLabel = new JLabel( "In\u00edcio" ); + inicioText = new JTextField(); + inicioText.setPreferredSize( new Dimension( 120, 20 ) ); + inicioText.setEditable( false ); + JLabel fimLabel = new JLabel( "Fim" ); + fimText = new JTextField(); + fimText.setPreferredSize( new Dimension( 120, 20 ) ); + fimText.setEditable( false ); + novoECDButton = new JButton( "Marcar ECDs" ); + novoECDButton.setIcon( getIcon( ECDS_ICON_PATH ) ); + novoECDButton.addActionListener( this ); + novaConsultaButton = new JButton( "Marcar Consulta" ); + novaConsultaButton.setIcon( getIcon( CONSULTA_ICON_PATH ) ); + novaConsultaButton.addActionListener( this ); + emitirFAButton = new JButton( "Ficha de Aptid\u00e3o" ); + emitirFAButton.setIcon( getIcon( FICHA_APTIDAO_ICON_PATH ) ); + emitirFAButton.addActionListener( this ); + fecharButton = new JButton( "Fechar Processo" ); + fecharButton.setIcon( getIcon( FECHAR_ICON_PATH ) ); + fecharButton.addActionListener( this ); + JPanel buttonPanel = new JPanel(); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.FILL }; + double rows[] = + new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED, + TableLayout.PREFERRED, TableLayout.FILL }; + + TableLayout tableLayout = new TableLayout( cols, rows ); + setLayout( tableLayout ); + + add( motivoButton, new TableLayoutConstraints( 0, 0, 2, 0 ) ); + add( estadoLabel, new TableLayoutConstraints( 0, 1 ) ); + add( estadoText, new TableLayoutConstraints( 1, 1 ) ); + add( inicioLabel, new TableLayoutConstraints( 0, 2 ) ); + add( inicioText, new TableLayoutConstraints( 1, 2 ) ); + add( fimLabel, new TableLayoutConstraints( 0, 3 ) ); + add( fimText, new TableLayoutConstraints( 1, 3 ) ); + add( buttonPanel, new TableLayoutConstraints( 2, 1, 2, 3 ) ); + + buttonPanel.setLayout( new GridLayout( 2, 2 ) ); + buttonPanel.add( novoECDButton ); + buttonPanel.add( novaConsultaButton ); + buttonPanel.add( emitirFAButton ); + buttonPanel.add( fecharButton ); + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( motivoButton ) ) + { + escolherMotivo(); + } + else if( source.equals( novoECDButton ) ) + { + novoECD(); + } + else if( source.equals( novaConsultaButton ) ) + { + novaConsulta(); + } + else if( source.equals( emitirFAButton ) ) + { + emitirFA(); + } + else if( source.equals( fecharButton ) ) + { + fecharProcesso(); + } + } + + protected boolean gravarProcesso() + { + if( processo.get( TrabalhadoresProcessoData.ESTADO ) == null ) + { + processo.set( TrabalhadoresProcessoData.ESTADO, PROCESSO_ABERTO_CODE ); + processo.set( TrabalhadoresProcessoData.DATA_INICIO, new Date() ); + } + try + { + provider.saveProcesso( processo ); + + return true; + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar processo", true ); + return false; + } + } + + protected void escolherMotivo() + { + EscolherMotivoDialog dialog = new EscolherMotivoDialog( owner ); + dialog.setVisible( true ); + Integer motivo[] = dialog.getMotivo(); + if( motivo != null && motivo[ 0 ] != null ) + { + processo.set( TrabalhadoresProcessoData.MOTIVO, motivo[ 0 ] ); + processo.set( TrabalhadoresProcessoData.SUB_MOTIVO, motivo[ 1 ] ); + if( gravarProcesso() ) + { + reload(); + HashMap ids = new HashMap(); + ids.put( ProcessoEvent.TIPO_PROCESSO, ( Integer ) processo.get( TrabalhadoresProcessoData.ID ) ); + ProcessoEvent event = new ProcessoEvent( this, ProcessoEvent.ACCAO_ESCOLHER_MOTIVO, ids ); + for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ ) + { + PROCESSO_LISTENERS.get( n ).processoStateChanged( event ); + } + } + } + } + + protected void novoECD() + { + } + + protected void novaConsulta() + { + notifyListeners( ProcessoEvent.ACCAO_MARCAR_CONSULTA ); + } + + protected void emitirFA() + { + if( trabalhadorID != null ) + { + try + { + FichaWindow.getWindow().editTrabalhador( trabalhadorID, this ); + } + catch( Exception ex ) + { + DialogException.showException( ex ); + } + } + } + + protected void fecharProcesso() + { + String options[] = new String[]{ "N\u00e3o", "Sim" }; + int option = JOptionPane.showOptionDialog( owner, + "Tem a certeza que quer fechar o processo sem Ficha de Aptid\u00e3o?", + "Fechar", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, + getIcon( FECHAR_ICON_PATH ), options, options[ 0 ] ); + if( option == 1 ) + { + processo.set( TrabalhadoresProcessoData.ESTADO, PROCESSO_FECHADO_CODE ); + processo.set( TrabalhadoresProcessoData.DATA_FIM, new Date() ); + if( gravarProcesso() ) + { + enableButtons(); + notifyListeners( ProcessoEvent.ACCAO_FECHAR ); + reload(); + } + } + } + + public void clear() + { + processo = null; + estadoText.setText( "" ); + inicioText.setText( "" ); + fimText.setText( "" ); + motivoButton.setText( "Motivo" ); + enableButtons(); + } + + protected void enableButtons() + { + String estado = null; + Integer motivo = null; + boolean consultasPorRealizar = false; + boolean ecdsPorRealizar = false; + if( processo != null ) + { + Integer id = ( Integer ) processo.get( TrabalhadoresProcessoData.ID ); + estado = ( String ) processo.get( TrabalhadoresProcessoData.ESTADO ); + motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO ); + try + { + if( id != null ) + { + consultasPorRealizar = provider.getProcessoTemConsultasPorRealizar( id ); + ecdsPorRealizar = provider.getProcessoTemECDsPorRealizar( id ); + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } +// novoECDButton.setEnabled( processo != null && motivo != null ); + novoECDButton.setEnabled( false ); + novaConsultaButton.setEnabled( processo != null && motivo != null && !consultasPorRealizar ); + emitirFAButton.setEnabled( processo != null && motivo != null ); + fecharButton.setEnabled( processo != null && motivo != null && PROCESSO_ABERTO_CODE.equals( estado ) ); + motivoButton.setEnabled( processo != null ); + } + + public void addProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.add( listener ); + } + + public void removeProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.remove( listener ); + } + + public Icon getIcon( String path ) + { + try + { + return ImageIconLoader.loadImageIcon( getClass(), path ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + return null; + } + } + + public Object save() + { + return null; + } + + public void enableComponents( boolean enable ) + { + + } + + public void fill( Object value ) + { + clear(); + if( trabalhadorID == null ) + { + return; + } + if( value != null ) + { + try + { + processo = provider.getProcessoByID( ( Integer ) value ); + if( processo == null ) + { + processo = new TrabalhadoresProcessoData(); + processo.set( TrabalhadoresProcessoData.TRABALHADOR_ID, trabalhadorID ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados do processo", true ); + } + } + reload(); + } + + public void reload() + { + enableButtons(); + if( processo != null ) + { + String estado = null; + Date dataInicio = ( Date ) processo.get( TrabalhadoresProcessoData.DATA_INICIO ); + if( dataInicio != null ) + { + inicioText.setText( D_F.format( dataInicio ) ); + } + Date dataFim = ( Date ) processo.get( TrabalhadoresProcessoData.DATA_FIM ); + if( dataFim != null ) + { + fimText.setText( D_F.format( dataFim ) ); + } + estado = ( String ) processo.get( TrabalhadoresProcessoData.ESTADO ); + if( estado == null ) + { + estadoText.setText( ProcessoDataProvider.PROCESSO_POR_ABRIR_DESCRIPTION ); + } + else + { + estadoText.setText( ProcessoDataProvider.ESTADO_PROCESSO_BY_CODE.get( estado ) ); + } + Integer motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO ); + Integer subMotivo = ( Integer ) processo.get( TrabalhadoresProcessoData.SUB_MOTIVO ); + String motivoStr = "Motivo"; + if( motivo != null ) + { + motivoStr = MedicinaDataProvider.MOTIVOS_BY_ID.get( motivo ); + if( subMotivo != null ) + { + motivoStr += " > " + MedicinaDataProvider.SUB_MOTIVOS_BY_ID.get( subMotivo ); + } + } + motivoButton.setText( motivoStr ); + } + } + + public void setTrabalhadorID( Integer trabalhadorID ) + { + this.trabalhadorID = trabalhadorID; + } + + public void exameSaved( Integer trabalhadorID, Integer exameID ) + { + if( trabalhadorID.equals( this.trabalhadorID ) ) + { + processo.set( TrabalhadoresProcessoData.ESTADO, PROCESSO_FECHADO_CODE ); + processo.set( TrabalhadoresProcessoData.DATA_FIM, new Date() ); + if( gravarProcesso() ) + { + enableButtons(); + notifyListeners( ProcessoEvent.ACCAO_EMITIR_FA ); + reload(); + } + System.out.println( "NOTIFIED EXAME: " + exameID ); + } + } + + protected void notifyListeners( int accao ) + { + HashMap ids = new HashMap(); + ids.put( ProcessoEvent.TIPO_PROCESSO, ( Integer ) processo.get( TrabalhadoresProcessoData.ID ) ); + ProcessoEvent event = new ProcessoEvent( this, accao, ids ); + for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ ) + { + PROCESSO_LISTENERS.get( n ).processoStateChanged( event ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoUpperPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoUpperPanel.java new file mode 100644 index 00000000..1c08a592 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoUpperPanel.java @@ -0,0 +1,254 @@ +/* + * ProcessoUpperPanel.java + * + * Created on February 1, 2006, 6:48 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; +import com.evolute.utils.dataui.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.ui.*; +import siprp.medicina.MedicinaDataProvider; + +/** + * + * @author fpalma + */ +public class ProcessoUpperPanel extends JPanel + implements ListSelectionListener, ControllableComponent +{ + protected BaseTable empresasTable; + protected VectorTableModel empresasModel; + protected BaseTable estabelecimentosTable; + protected VectorTableModel estabelecimentosModel; + protected BaseTable trabalhadoresTable; + protected VectorTableModel trabalhadoresModel; + + protected MedicinaDataProvider provider; + + protected final Vector listeners; + + protected boolean editing = false; + + /** + * Creates a new instance of ProcessoUpperPanel + */ + public ProcessoUpperPanel() + throws Exception + { + provider = ( MedicinaDataProvider ) MedicinaDataProvider.getProvider(); + listeners = new Vector(); + setupComponents(); + } + + private void setupComponents() + throws Exception + { + empresasModel = new VectorTableModel( new String[]{ "empresas" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + JScrollPane empresasScroll = + new JScrollPane( empresasTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasTable.getSelectionModel().addListSelectionListener( this ); + estabelecimentosModel = new VectorTableModel( new String[]{ "estabelecimentos" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + JScrollPane estabelecimentosScroll = + new JScrollPane( estabelecimentosTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + trabalhadoresModel = new VectorTableModel( new String[]{ "trabalhadores" } ); + trabalhadoresTable = new BaseTable( trabalhadoresModel ); + trabalhadoresTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + trabalhadoresTable.setNonResizableNorReordable(); + JScrollPane trabalhadoresScroll = + new JScrollPane( trabalhadoresTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + trabalhadoresTable.getSelectionModel().addListSelectionListener( this ); + + GridBagLayout gridbag = new GridBagLayout(); + setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); + constraints.fill = GridBagConstraints.BOTH; + constraints.gridwidth = 1; + constraints.gridheight = 1; + constraints.weightx = 0.3; + constraints.weighty = 1; + + gridbag.setConstraints( empresasScroll, constraints ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + + constraints.weightx = 0.4; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints( trabalhadoresScroll, constraints ); + + add( empresasScroll ); + add( estabelecimentosScroll ); + add( trabalhadoresScroll ); + + ColumnizedMappable empresas[] = provider.getAllEmpresas(); + Vector values = empresasModel.getValues(); + values.addAll( Arrays.asList( empresas ) ); + empresasModel.setValues( values ); + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( e.getValueIsAdjusting() ) + { + return; + } + if( source.equals( empresasTable.getSelectionModel() ) ) + { + carregarEstabelecimentos(); + } + else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + carregarTrabalhadores(); + } + else if( source.equals( trabalhadoresTable.getSelectionModel() ) ) + { + notifyListeners( e ); + } + } + + protected void carregarEstabelecimentos() + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + estabelecimentosModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer empresaID = ( ( ColumnizedMappable ) empresasModel.getRowAt( selected ) ).getID(); + ColumnizedMappable estabelecimentos[] = provider.getAllEstabelecimentosForEmpresa( empresaID); + Vector values = estabelecimentosModel.getValues(); + values.addAll( Arrays.asList( estabelecimentos ) ); + estabelecimentosModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos.", true ); + estabelecimentosModel.clearAll(); + } + } + } + + protected void carregarTrabalhadores() + { + trabalhadoresTable.clearSelection(); + int selected = estabelecimentosTable.getSelectedRow(); + trabalhadoresModel.clearAll(); + if( selected > -1 ) + { + try + { + Integer estabelecimentoID = ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( selected ) ).getID(); + ColumnizedMappable trabalhadores[] = provider.getAllTrabalhadoresForEstabelecimento( estabelecimentoID ); + Vector values = trabalhadoresModel.getValues(); + values.addAll( Arrays.asList( trabalhadores ) ); + trabalhadoresModel.setValues( values ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar trabalhadores.", true ); + trabalhadoresModel.clearAll(); + } + } + } + + protected void notifyListeners( ListSelectionEvent e ) + { + for( int n = 0; n < listeners.size(); n++ ) + { + ListSelectionEvent event = + new ListSelectionEvent( this, e.getFirstIndex(), e.getLastIndex(), e.getValueIsAdjusting() ); + ( ( ListSelectionListener ) listeners.elementAt( n ) ).valueChanged( event ); + } + } + + public void addListSelectionListener( ListSelectionListener listener ) + { + listeners.add( listener ); + } + + public void removeSelectionListener( ListSelectionListener listener ) + { + listeners.remove( listener ); + } + + public void clear() + { +// empresasTable.clearSelection(); + } + + public void fill( Object value ) + { + if( value == null ) + { + clear(); + } + Integer ids[] = ( Integer [] ) value; + for( int n = 0; n < empresasTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) empresasModel.getRowAt( n ) ).getID().equals( ids[ 0 ] ) ) + { + empresasTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < estabelecimentosTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( n ) ).getID().equals( ids[ 1 ] ) ) + { + estabelecimentosTable.setRowSelectionInterval( n, n ); + break; + } + } + + for( int n = 0; n < trabalhadoresTable.getRowCount(); n++ ) + { + if( ( ( ColumnizedMappable ) trabalhadoresModel.getRowAt( n ) ).getID().equals( ids[ 2 ] ) ) + { + trabalhadoresTable.setRowSelectionInterval( n, n ); + break; + } + } + } + + public Object save() + { + int empresaSelected = empresasTable.getSelectedRow(); + int estabelecimentoSelected = estabelecimentosTable.getSelectedRow(); + int trabalhadorSelected = trabalhadoresTable.getSelectedRow(); + return new Integer[]{ + empresaSelected == -1 ? null : ( ( ColumnizedMappable ) empresasModel.getRowAt( empresaSelected ) ).getID(), + estabelecimentoSelected == -1 ? null : ( ( ColumnizedMappable ) estabelecimentosModel.getRowAt( estabelecimentoSelected ) ).getID(), + trabalhadorSelected == -1 ? null : ( ( ColumnizedMappable ) trabalhadoresModel.getRowAt( trabalhadorSelected ) ).getID() + }; + } + + public void setEnabled( boolean enable ) + { + editing = !enable; + empresasTable.setEnabled( enable ); + estabelecimentosTable.setEnabled( enable ); + trabalhadoresTable.setEnabled( enable ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoWindow.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoWindow.java new file mode 100644 index 00000000..28f8a52f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/ProcessoWindow.java @@ -0,0 +1,97 @@ +/* + * ProcessoWindow.java + * + * Created on March 21, 2007, 9:06 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo; + +import com.evolute.utils.tracker.TrackableWindow; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; +import java.awt.Dimension; +import javax.swing.BorderFactory; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import siprp.medicina.processo.detalhes.DetalhesProcessoPanel; +import siprp.medicina.processo.estrutura.EstruturaProcessoPanel; + +/** + * + * @author fpalma + */ +public class ProcessoWindow extends JFrame + implements TrackableWindow +{ + public static final String TITLE = "Processos de trabalhadores"; + + private ProcessoUpperPanel upperPanel; + private EstruturaProcessoPanel estruturaPanel; + private ProcessoPanel processoPanel; + private DetalhesProcessoPanel detalhesPanel; + + /** Creates a new instance of ProcessoWindow */ + public ProcessoWindow() + throws Exception + { + setupComponents(); + } + + private void setupComponents() + throws Exception + { + setSize( 1024, 700 ); + setTitle( TITLE ); + + upperPanel = new ProcessoUpperPanel(); + upperPanel.setPreferredSize( new Dimension( 1024, 200 ) ); + estruturaPanel = new EstruturaProcessoPanel(); + processoPanel = new ProcessoPanel( this ); + processoPanel.setBorder( BorderFactory.createEtchedBorder() ); + detalhesPanel = new DetalhesProcessoPanel( this ); + detalhesPanel.setBorder( BorderFactory.createEtchedBorder() ); + double cols[] = + new double[]{ TableLayout.FILL, TableLayout.PREFERRED }; + double rows[] = + new double[]{ TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL }; + + TableLayout tableLayout = new TableLayout( cols, rows ); + setLayout( tableLayout ); + + add( upperPanel, new TableLayoutConstraints( 0, 0, 1, 0 ) ); + add( estruturaPanel, new TableLayoutConstraints( 0, 1, 0, 2 ) ); + add( processoPanel, new TableLayoutConstraints( 1, 1 ) ); + add( detalhesPanel, new TableLayoutConstraints( 1, 2 ) ); + + new ProcessoController( upperPanel, estruturaPanel, processoPanel, detalhesPanel ); + } + + public void refresh() + { + } + + public void open() + { + setVisible( true ); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable() { + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public boolean closeIfPossible() + { + close(); + return true; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultas.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultas.java new file mode 100644 index 00000000..ac08da85 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultas.java @@ -0,0 +1,135 @@ +/* +* TrabalhadoresConsultas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultas implements JDOInnerObject +{ + private Integer id; + private Integer trabalhador_id; + private Date data; + private Integer estado; + private Integer prestador_id; + private Integer processo_id; + + public TrabalhadoresConsultas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasData.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == TrabalhadoresConsultasData.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresConsultasData.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresConsultasData.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName == TrabalhadoresConsultasData.PROCESSO_ID ) + { + return processo_id; + } + else if( fieldName.equals( TrabalhadoresConsultasData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasData.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( TrabalhadoresConsultasData.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresConsultasData.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresConsultasData.PRESTADOR_ID ) ) + { + return prestador_id; + } + else if( fieldName.equals( TrabalhadoresConsultasData.PROCESSO_ID ) ) + { + return processo_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasData.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == TrabalhadoresConsultasData.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasData.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasData.PROCESSO_ID ) + { + processo_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasData.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasData.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasData.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasData.PROCESSO_ID ) ) + { + processo_id = ( Integer ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasData.java new file mode 100644 index 00000000..5b695370 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasData.java @@ -0,0 +1,62 @@ +/* +* TrabalhadoresConsultasData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String DATA = "data"; + public static final String ESTADO = "estado"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String PROCESSO_ID = "processo_id"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, PROCESSO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, PROCESSO_ID, }; + + private HashMap dataHash; + + public TrabalhadoresConsultasData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultas.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatas.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatas.java new file mode 100644 index 00000000..7bdd5e3e --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatas.java @@ -0,0 +1,101 @@ +/* +* TrabalhadoresConsultasDatas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatas implements JDOInnerObject +{ + private Integer id; + private Date data; + private Integer trabalhadores_consultas_id; + private Integer estado; + + public TrabalhadoresConsultasDatas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasDatasData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasDatasData.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresConsultasDatasData.TRABALHADORES_CONSULTAS_ID ) + { + return trabalhadores_consultas_id; + } + else if( fieldName == TrabalhadoresConsultasDatasData.ESTADO ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.TRABALHADORES_CONSULTAS_ID ) ) + { + return trabalhadores_consultas_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.ESTADO ) ) + { + return estado; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasDatasData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasData.TRABALHADORES_CONSULTAS_ID ) + { + trabalhadores_consultas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasData.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.TRABALHADORES_CONSULTAS_ID ) ) + { + trabalhadores_consultas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasData.ESTADO ) ) + { + estado = ( Integer ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasDatasData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasData.java new file mode 100644 index 00000000..c70731d7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasData.java @@ -0,0 +1,60 @@ +/* +* TrabalhadoresConsultasDatasData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatasData extends JDOObject +{ + public static final String ID = "id"; + public static final String DATA = "data"; + public static final String TRABALHADORES_CONSULTAS_ID = "trabalhadores_consultas_id"; + public static final String ESTADO = "estado"; + + public static final String FIELD_NAMES[] = new String[]{ + DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, DATA, TRABALHADORES_CONSULTAS_ID, ESTADO, }; + + private HashMap dataHash; + + public TrabalhadoresConsultasDatasData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultasDatas.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmails.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmails.java new file mode 100644 index 00000000..d510eb27 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmails.java @@ -0,0 +1,135 @@ +/* +* TrabalhadoresConsultasDatasEmails.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatasEmails implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_consultas_datas_id; + private String destination; + private Date data; + private String subject; + private String body; + + public TrabalhadoresConsultasDatasEmails() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasDatasEmailsData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.DESTINATION ) + { + return destination; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.SUBJECT ) + { + return subject; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.BODY ) + { + return body; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.DESTINATION ) ) + { + return destination; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.SUBJECT ) ) + { + return subject; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.BODY ) ) + { + return body; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasDatasEmailsData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.DESTINATION ) + { + destination = ( String ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.SUBJECT ) + { + subject = ( String ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasEmailsData.BODY ) + { + body = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.DESTINATION ) ) + { + destination = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.SUBJECT ) ) + { + subject = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasEmailsData.BODY ) ) + { + body = ( String ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasDatasEmailsData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsData.java new file mode 100644 index 00000000..5bd509c2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsData.java @@ -0,0 +1,62 @@ +/* +* TrabalhadoresConsultasDatasEmailsData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatasEmailsData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String DESTINATION = "destination"; + public static final String DATA = "data"; + public static final String SUBJECT = "subject"; + public static final String BODY = "body"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_CONSULTAS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_CONSULTAS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + private HashMap dataHash; + + public TrabalhadoresConsultasDatasEmailsData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultasDatasEmails.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsID.java new file mode 100644 index 00000000..97f99787 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasEmailsID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresConsultasDatasEmailsID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresConsultasDatasEmailsID extends IntegerID + implements Serializable +{ + public TrabalhadoresConsultasDatasEmailsID() + { + } + + public TrabalhadoresConsultasDatasEmailsID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasID.java new file mode 100644 index 00000000..19881a66 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresConsultasDatasID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresConsultasDatasID extends IntegerID + implements Serializable +{ + public TrabalhadoresConsultasDatasID() + { + } + + public TrabalhadoresConsultasDatasID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoes.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoes.java new file mode 100644 index 00000000..25cc7125 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoes.java @@ -0,0 +1,83 @@ +/* +* TrabalhadoresConsultasDatasObservacoes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatasObservacoes implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_consultas_datas_id; + private String observacao; + + public TrabalhadoresConsultasDatasObservacoes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresConsultasDatasObservacoesData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesData.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesData.OBSERVACAO ) + { + return observacao; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesData.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + return trabalhadores_consultas_datas_id; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesData.OBSERVACAO ) ) + { + return observacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresConsultasDatasObservacoesData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesData.TRABALHADORES_CONSULTAS_DATAS_ID ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresConsultasDatasObservacoesData.OBSERVACAO ) + { + observacao = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesData.TRABALHADORES_CONSULTAS_DATAS_ID ) ) + { + trabalhadores_consultas_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresConsultasDatasObservacoesData.OBSERVACAO ) ) + { + observacao = ( String ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresConsultasDatasObservacoesData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesData.java new file mode 100644 index 00000000..5326c26a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesData.java @@ -0,0 +1,59 @@ +/* +* TrabalhadoresConsultasDatasObservacoesData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresConsultasDatasObservacoesData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADORES_CONSULTAS_DATAS_ID = "trabalhadores_consultas_datas_id"; + public static final String OBSERVACAO = "observacao"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_CONSULTAS_DATAS_ID, OBSERVACAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_CONSULTAS_DATAS_ID, OBSERVACAO, }; + + private HashMap dataHash; + + public TrabalhadoresConsultasDatasObservacoesData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresConsultasDatasObservacoes.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesID.java new file mode 100644 index 00000000..038405bd --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasDatasObservacoesID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresConsultasDatasObservacoesID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresConsultasDatasObservacoesID extends IntegerID + implements Serializable +{ + public TrabalhadoresConsultasDatasObservacoesID() + { + } + + public TrabalhadoresConsultasDatasObservacoesID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasID.java new file mode 100644 index 00000000..9aa31d50 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresConsultasID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresConsultasID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresConsultasID extends IntegerID + implements Serializable +{ + public TrabalhadoresConsultasID() + { + } + + public TrabalhadoresConsultasID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcd.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcd.java new file mode 100644 index 00000000..d20de925 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcd.java @@ -0,0 +1,151 @@ +/* +* TrabalhadoresEcd.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcd implements JDOInnerObject +{ + private Integer id; + private Integer ecd_id; + private Integer ecd_oficial_id; + private Integer prestador_id; + private Integer estado; + private Integer trabalhadores_ecds_id; + private Integer trabalhadores_ecds_datas_id; + + public TrabalhadoresEcd() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdData.ECD_ID ) + { + return ecd_id; + } + else if( fieldName == TrabalhadoresEcdData.ECD_OFICIAL_ID ) + { + return ecd_oficial_id; + } + else if( fieldName == TrabalhadoresEcdData.PRESTADOR_ID ) + { + return prestador_id; + } + else if( fieldName == TrabalhadoresEcdData.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_ID ) + { + return trabalhadores_ecds_id; + } + else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName.equals( TrabalhadoresEcdData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdData.ECD_ID ) ) + { + return ecd_id; + } + else if( fieldName.equals( TrabalhadoresEcdData.ECD_OFICIAL_ID ) ) + { + return ecd_oficial_id; + } + else if( fieldName.equals( TrabalhadoresEcdData.PRESTADOR_ID ) ) + { + return prestador_id; + } + else if( fieldName.equals( TrabalhadoresEcdData.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_ID ) ) + { + return trabalhadores_ecds_id; + } + else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID ) ) + { + return trabalhadores_ecds_datas_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdData.ECD_ID ) + { + ecd_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdData.ECD_OFICIAL_ID ) + { + ecd_oficial_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdData.PRESTADOR_ID ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdData.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_ID ) + { + trabalhadores_ecds_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdData.ECD_ID ) ) + { + ecd_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdData.ECD_OFICIAL_ID ) ) + { + ecd_oficial_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdData.PRESTADOR_ID ) ) + { + prestador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdData.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_ID ) ) + { + trabalhadores_ecds_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdData.TRABALHADORES_ECDS_DATAS_ID ) ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresEcdData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdData.java new file mode 100644 index 00000000..5ad8c4e7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdData.java @@ -0,0 +1,65 @@ +/* +* TrabalhadoresEcdData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdData extends JDOObject +{ + public static final String ID = "id"; + public static final String ECD_ID = "ecd_id"; + public static final String ECD_OFICIAL_ID = "ecd_oficial_id"; + public static final String PRESTADOR_ID = "prestador_id"; + public static final String ESTADO = "estado"; + public static final String TRABALHADORES_ECDS_ID = "trabalhadores_ecds_id"; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + + public static final String FIELD_NAMES[] = new String[]{ + ECD_ID, ECD_OFICIAL_ID, PRESTADOR_ID, ESTADO, TRABALHADORES_ECDS_ID, + TRABALHADORES_ECDS_DATAS_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, ECD_ID, ECD_OFICIAL_ID, PRESTADOR_ID, ESTADO, TRABALHADORES_ECDS_ID, + TRABALHADORES_ECDS_DATAS_ID, }; + + private HashMap dataHash; + + public TrabalhadoresEcdData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcd.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdID.java new file mode 100644 index 00000000..8d47d9d1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresEcdID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresEcdID extends IntegerID + implements Serializable +{ + public TrabalhadoresEcdID() + { + } + + public TrabalhadoresEcdID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcds.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcds.java new file mode 100644 index 00000000..f741cb74 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcds.java @@ -0,0 +1,118 @@ +/* +* TrabalhadoresEcds.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcds implements JDOInnerObject +{ + private Integer id; + private Integer trabalhador_id; + private Integer estado; + private Date data; + private Integer processo_id; + + public TrabalhadoresEcds() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsData.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == TrabalhadoresEcdsData.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresEcdsData.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresEcdsData.PROCESSO_ID ) + { + return processo_id; + } + else if( fieldName.equals( TrabalhadoresEcdsData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsData.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( TrabalhadoresEcdsData.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresEcdsData.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresEcdsData.PROCESSO_ID ) ) + { + return processo_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsData.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsData.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == TrabalhadoresEcdsData.PROCESSO_ID ) + { + processo_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsData.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsData.ESTADO ) ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsData.PROCESSO_ID ) ) + { + processo_id = ( Integer ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsData.java new file mode 100644 index 00000000..7460f772 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsData.java @@ -0,0 +1,61 @@ +/* +* TrabalhadoresEcdsData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String ESTADO = "estado"; + public static final String DATA = "data"; + public static final String PROCESSO_ID = "processo_id"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, }; + + private HashMap dataHash; + + public TrabalhadoresEcdsData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcds.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatas.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatas.java new file mode 100644 index 00000000..6112c215 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatas.java @@ -0,0 +1,101 @@ +/* +* TrabalhadoresEcdsDatas.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatas implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_ecds_id; + private Date data; + private Integer estado; + + public TrabalhadoresEcdsDatas() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsDatasData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsDatasData.TRABALHADORES_ECDS_ID ) + { + return trabalhadores_ecds_id; + } + else if( fieldName == TrabalhadoresEcdsDatasData.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresEcdsDatasData.ESTADO ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.TRABALHADORES_ECDS_ID ) ) + { + return trabalhadores_ecds_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.ESTADO ) ) + { + return estado; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsDatasData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasData.TRABALHADORES_ECDS_ID ) + { + trabalhadores_ecds_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasData.ESTADO ) + { + estado = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.TRABALHADORES_ECDS_ID ) ) + { + trabalhadores_ecds_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasData.ESTADO ) ) + { + estado = ( Integer ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsDatasData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasData.java new file mode 100644 index 00000000..0b0ff21c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasData.java @@ -0,0 +1,60 @@ +/* +* TrabalhadoresEcdsDatasData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatasData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADORES_ECDS_ID = "trabalhadores_ecds_id"; + public static final String DATA = "data"; + public static final String ESTADO = "estado"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_ID, DATA, ESTADO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_ID, DATA, ESTADO, }; + + private HashMap dataHash; + + public TrabalhadoresEcdsDatasData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcdsDatas.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmails.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmails.java new file mode 100644 index 00000000..2dae2f2a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmails.java @@ -0,0 +1,135 @@ +/* +* TrabalhadoresEcdsDatasEmails.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatasEmails implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_ecds_datas_id; + private String destination; + private Date data; + private String subject; + private String body; + + public TrabalhadoresEcdsDatasEmails() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsDatasEmailsData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.TRABALHADORES_ECDS_DATAS_ID ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.DESTINATION ) + { + return destination; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.DATA ) + { + return data; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.SUBJECT ) + { + return subject; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.BODY ) + { + return body; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.TRABALHADORES_ECDS_DATAS_ID ) ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.DESTINATION ) ) + { + return destination; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.DATA ) ) + { + return data; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.SUBJECT ) ) + { + return subject; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.BODY ) ) + { + return body; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsDatasEmailsData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.TRABALHADORES_ECDS_DATAS_ID ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.DESTINATION ) + { + destination = ( String ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.DATA ) + { + data = ( Date ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.SUBJECT ) + { + subject = ( String ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasEmailsData.BODY ) + { + body = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.TRABALHADORES_ECDS_DATAS_ID ) ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.DESTINATION ) ) + { + destination = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.DATA ) ) + { + data = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.SUBJECT ) ) + { + subject = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasEmailsData.BODY ) ) + { + body = ( String ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsDatasEmailsData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsData.java new file mode 100644 index 00000000..7a40d563 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsData.java @@ -0,0 +1,62 @@ +/* +* TrabalhadoresEcdsDatasEmailsData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatasEmailsData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String DESTINATION = "destination"; + public static final String DATA = "data"; + public static final String SUBJECT = "subject"; + public static final String BODY = "body"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_DATAS_ID, DESTINATION, DATA, SUBJECT, BODY, }; + + private HashMap dataHash; + + public TrabalhadoresEcdsDatasEmailsData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcdsDatasEmails.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsID.java new file mode 100644 index 00000000..65da8c7c --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasEmailsID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresEcdsDatasEmailsID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresEcdsDatasEmailsID extends IntegerID + implements Serializable +{ + public TrabalhadoresEcdsDatasEmailsID() + { + } + + public TrabalhadoresEcdsDatasEmailsID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasID.java new file mode 100644 index 00000000..cee0df85 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresEcdsDatasID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresEcdsDatasID extends IntegerID + implements Serializable +{ + public TrabalhadoresEcdsDatasID() + { + } + + public TrabalhadoresEcdsDatasID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoes.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoes.java new file mode 100644 index 00000000..4c18ca74 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoes.java @@ -0,0 +1,83 @@ +/* +* TrabalhadoresEcdsDatasObservacoes.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatasObservacoes implements JDOInnerObject +{ + private Integer id; + private Integer trabalhadores_ecds_datas_id; + private String observacao; + + public TrabalhadoresEcdsDatasObservacoes() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresEcdsDatasObservacoesData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesData.TRABALHADORES_ECDS_DATAS_ID ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesData.OBSERVACAO ) + { + return observacao; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesData.TRABALHADORES_ECDS_DATAS_ID ) ) + { + return trabalhadores_ecds_datas_id; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesData.OBSERVACAO ) ) + { + return observacao; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresEcdsDatasObservacoesData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesData.TRABALHADORES_ECDS_DATAS_ID ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresEcdsDatasObservacoesData.OBSERVACAO ) + { + observacao = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesData.TRABALHADORES_ECDS_DATAS_ID ) ) + { + trabalhadores_ecds_datas_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresEcdsDatasObservacoesData.OBSERVACAO ) ) + { + observacao = ( String ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresEcdsDatasObservacoesData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesData.java new file mode 100644 index 00000000..ff22c3f3 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesData.java @@ -0,0 +1,59 @@ +/* +* TrabalhadoresEcdsDatasObservacoesData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresEcdsDatasObservacoesData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADORES_ECDS_DATAS_ID = "trabalhadores_ecds_datas_id"; + public static final String OBSERVACAO = "observacao"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADORES_ECDS_DATAS_ID, OBSERVACAO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADORES_ECDS_DATAS_ID, OBSERVACAO, }; + + private HashMap dataHash; + + public TrabalhadoresEcdsDatasObservacoesData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresEcdsDatasObservacoes.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesID.java new file mode 100644 index 00000000..6c6e46c3 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsDatasObservacoesID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresEcdsDatasObservacoesID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresEcdsDatasObservacoesID extends IntegerID + implements Serializable +{ + public TrabalhadoresEcdsDatasObservacoesID() + { + } + + public TrabalhadoresEcdsDatasObservacoesID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsID.java new file mode 100644 index 00000000..6f885514 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresEcdsID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresEcdsID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresEcdsID extends IntegerID + implements Serializable +{ + public TrabalhadoresEcdsID() + { + } + + public TrabalhadoresEcdsID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidao.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidao.java new file mode 100644 index 00000000..c1cab253 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidao.java @@ -0,0 +1,83 @@ +/* +* TrabalhadoresFichasAptidao.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresFichasAptidao implements JDOInnerObject +{ + private Integer id; + private Integer processo_id; + private Integer exame_id; + + public TrabalhadoresFichasAptidao() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresFichasAptidaoData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresFichasAptidaoData.PROCESSO_ID ) + { + return processo_id; + } + else if( fieldName == TrabalhadoresFichasAptidaoData.EXAME_ID ) + { + return exame_id; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoData.PROCESSO_ID ) ) + { + return processo_id; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoData.EXAME_ID ) ) + { + return exame_id; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresFichasAptidaoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresFichasAptidaoData.PROCESSO_ID ) + { + processo_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresFichasAptidaoData.EXAME_ID ) + { + exame_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoData.PROCESSO_ID ) ) + { + processo_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresFichasAptidaoData.EXAME_ID ) ) + { + exame_id = ( Integer ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresFichasAptidaoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoData.java new file mode 100644 index 00000000..335c430d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoData.java @@ -0,0 +1,59 @@ +/* +* TrabalhadoresFichasAptidaoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresFichasAptidaoData extends JDOObject +{ + public static final String ID = "id"; + public static final String PROCESSO_ID = "processo_id"; + public static final String EXAME_ID = "exame_id"; + + public static final String FIELD_NAMES[] = new String[]{ + PROCESSO_ID, EXAME_ID, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, PROCESSO_ID, EXAME_ID, }; + + private HashMap dataHash; + + public TrabalhadoresFichasAptidaoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresFichasAptidao.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoID.java new file mode 100644 index 00000000..0ae452ad --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresFichasAptidaoID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresFichasAptidaoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresFichasAptidaoID extends IntegerID + implements Serializable +{ + public TrabalhadoresFichasAptidaoID() + { + } + + public TrabalhadoresFichasAptidaoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcesso.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcesso.java new file mode 100644 index 00000000..2a598679 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcesso.java @@ -0,0 +1,152 @@ +/* +* TrabalhadoresProcesso.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.Date; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresProcesso implements JDOInnerObject +{ + private Integer id; + private Integer trabalhador_id; + private String estado; + private Date data_inicio; + private Date data_fim; + private Integer motivo; + private Integer sub_motivo; + + public TrabalhadoresProcesso() + { + } + + public Object getField( String fieldName ) + { + if( fieldName == TrabalhadoresProcessoData.ID ) + { + return id; + } + else if( fieldName == TrabalhadoresProcessoData.TRABALHADOR_ID ) + { + return trabalhador_id; + } + else if( fieldName == TrabalhadoresProcessoData.ESTADO ) + { + return estado; + } + else if( fieldName == TrabalhadoresProcessoData.DATA_INICIO ) + { + return data_inicio; + } + else if( fieldName == TrabalhadoresProcessoData.DATA_FIM ) + { + return data_fim; + } + else if( fieldName == TrabalhadoresProcessoData.MOTIVO ) + { + return motivo; + } + else if( fieldName == TrabalhadoresProcessoData.SUB_MOTIVO ) + { + return sub_motivo; + } + else if( fieldName.equals( TrabalhadoresProcessoData.ID ) ) + { + return id; + } + else if( fieldName.equals( TrabalhadoresProcessoData.TRABALHADOR_ID ) ) + { + return trabalhador_id; + } + else if( fieldName.equals( TrabalhadoresProcessoData.ESTADO ) ) + { + return estado; + } + else if( fieldName.equals( TrabalhadoresProcessoData.DATA_INICIO ) ) + { + return data_inicio; + } + else if( fieldName.equals( TrabalhadoresProcessoData.DATA_FIM ) ) + { + return data_fim; + } + else if( fieldName.equals( TrabalhadoresProcessoData.MOTIVO ) ) + { + return motivo; + } + else if( fieldName.equals( TrabalhadoresProcessoData.SUB_MOTIVO ) ) + { + return sub_motivo; + } + return null; + } + + public void setField( String fieldName, Object value ) + { + if( fieldName == TrabalhadoresProcessoData.ID ) + { + id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresProcessoData.TRABALHADOR_ID ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName == TrabalhadoresProcessoData.ESTADO ) + { + estado = ( String ) value; + } + else if( fieldName == TrabalhadoresProcessoData.DATA_INICIO ) + { + data_inicio = ( Date ) value; + } + else if( fieldName == TrabalhadoresProcessoData.DATA_FIM ) + { + data_fim = ( Date ) value; + } + else if( fieldName == TrabalhadoresProcessoData.MOTIVO ) + { + motivo = ( Integer ) value; + } + else if( fieldName == TrabalhadoresProcessoData.SUB_MOTIVO ) + { + sub_motivo = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoData.ID ) ) + { + id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoData.TRABALHADOR_ID ) ) + { + trabalhador_id = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoData.ESTADO ) ) + { + estado = ( String ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoData.DATA_INICIO ) ) + { + data_inicio = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoData.DATA_FIM ) ) + { + data_fim = ( Date ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoData.MOTIVO ) ) + { + motivo = ( Integer ) value; + } + else if( fieldName.equals( TrabalhadoresProcessoData.SUB_MOTIVO ) ) + { + sub_motivo = ( Integer ) value; + } + } + + public Class getOuterClass() + { + return TrabalhadoresProcessoData.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoData.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoData.java new file mode 100644 index 00000000..91b89335 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoData.java @@ -0,0 +1,63 @@ +/* +* TrabalhadoresProcessoData.java +* +* Generated by com.evutils.codegen.JDOObjectGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.util.HashMap; +import com.evolute.utils.jdo.*; + +public final class TrabalhadoresProcessoData extends JDOObject +{ + public static final String ID = "id"; + public static final String TRABALHADOR_ID = "trabalhador_id"; + public static final String ESTADO = "estado"; + public static final String DATA_INICIO = "data_inicio"; + public static final String DATA_FIM = "data_fim"; + public static final String MOTIVO = "motivo"; + public static final String SUB_MOTIVO = "sub_motivo"; + + public static final String FIELD_NAMES[] = new String[]{ + TRABALHADOR_ID, ESTADO, DATA_INICIO, DATA_FIM, MOTIVO, SUB_MOTIVO, }; + + + protected static final String ALL_FIELD_NAMES[] = new String[]{ + ID, TRABALHADOR_ID, ESTADO, DATA_INICIO, DATA_FIM, MOTIVO, SUB_MOTIVO, }; + + private HashMap dataHash; + + public TrabalhadoresProcessoData() + { + dataHash = new HashMap(); + } + + protected Object innerGet( String fieldName ) + throws Exception + { + return dataHash.get( fieldName ); + } + + protected void innerSet( String fieldName, Object value ) + throws Exception + { + dataHash.put( fieldName, value ); + } + + public String []getFieldNames() + { + return FIELD_NAMES; + } + + protected String []getAllFieldNames() + { + return ALL_FIELD_NAMES; + } + + public Class getInnerClass() + { + return TrabalhadoresProcesso.class; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoID.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoID.java new file mode 100644 index 00000000..7690a0d9 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/TrabalhadoresProcessoID.java @@ -0,0 +1,25 @@ +/* +* TrabalhadoresProcessoID.java +* +* Generated by com.evolute.codegen.jdo.idclassgenerators.JPOXIDClassGenerator on May 14, 2007 +* +* Use but DON'T TOUCH +*/ +package siprp.medicina.processo.data; + +import java.io.*; + +import com.evolute.utils.jdo.jpox.*; + +public final class TrabalhadoresProcessoID extends IntegerID + implements Serializable +{ + public TrabalhadoresProcessoID() + { + } + + public TrabalhadoresProcessoID( String str ) + { + super( str ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/package.jdo b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/package.jdo new file mode 100644 index 00000000..25ee315f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/data/package.jdo @@ -0,0 +1,304 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ConsultaPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ConsultaPanel.java new file mode 100644 index 00000000..87a6b492 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ConsultaPanel.java @@ -0,0 +1,360 @@ +/* + * ConsultaPanel.java + * + * Created on March 22, 2007, 10:58 AM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.detalhes; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Date; +import java.util.HashMap; +import java.util.Vector; +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import siprp.medicina.MedicinaConstants; +import siprp.medicina.processo.ProcessoConstants; +import siprp.medicina.processo.ProcessoDataProvider; +import siprp.medicina.processo.ProcessoEvent; +import siprp.medicina.processo.ProcessoListener; +import siprp.medicina.processo.data.TrabalhadoresConsultasData; +import siprp.medicina.processo.data.TrabalhadoresConsultasDatasData; + +/** + * + * @author fpalma + */ +public class ConsultaPanel extends JPanel + implements ActionListener, MedicinaConstants, ChangeListener +{ + protected JFrame owner; + protected JCalendarPanel dataConsultaPanel; + protected JButton estadoButton; + protected JButton emailButton; + protected JButton observacoesButton; + protected ObservacoesDialog observacoesDialog; + + protected final Vector PROCESSO_LISTENERS = new Vector(); + protected JDOProvider JDO; + protected ProcessoDataProvider provider; + + protected Integer trabalhadorID; + protected Integer processoID; + protected TrabalhadoresConsultasData consulta; + protected TrabalhadoresConsultasDatasData consultaData; + + /** Creates a new instance of ConsultaPanel */ + public ConsultaPanel( JFrame owner ) + throws Exception + { + this.owner = owner; + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + provider = ProcessoDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + JLabel dataLabel = new JLabel( "Data" ); + dataConsultaPanel = new JCalendarPanel( null ); + dataConsultaPanel.addChangeListener( this ); + estadoButton = new JButton( " " ); + estadoButton.addActionListener( this ); + emailButton = new JButton( "Email" ); + emailButton.addActionListener( this ); + observacoesButton = new JButton( "Coment\u00e1rio" ); + observacoesButton.addActionListener( this ); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; + double rows[] = + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.MINIMUM, TableLayout.MINIMUM }; + + TableLayout tableLayout = new TableLayout( cols, rows ); + tableLayout.setVGap( 5 ); + setLayout( tableLayout ); + + add( dataLabel, new TableLayoutConstraints( 0, 0 ) ); + add( dataConsultaPanel, new TableLayoutConstraints( 1, 0 ) ); + add( estadoButton, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + add( emailButton, new TableLayoutConstraints( 0, 2, 1, 2 ) ); + add( observacoesButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( observacoesButton ) ) + { + editarObservacoes(); + } + else if( source.equals( emailButton ) ) + { + enviarEmail(); + } + else if( source.equals( estadoButton ) ) + { + mudarEstado(); + } + } + + public void stateChanged(ChangeEvent e) + { + Object source = e.getSource(); + + if( source.equals( dataConsultaPanel ) ) + { + Date data = dataConsultaPanel.getDate(); + if( data == null ) + { + return; + } + try + { + boolean nova = false; + if( consulta == null ) + { + nova = true; + Integer consultaID = provider.getConsultaEmAbertoForProcesso( processoID ); + if( consultaID == null ) + { + consulta = new TrabalhadoresConsultasData(); + consulta.set( TrabalhadoresConsultasData.TRABALHADOR_ID, trabalhadorID ); + consulta.set( TrabalhadoresConsultasData.PROCESSO_ID, processoID ); + consulta.set( TrabalhadoresConsultasData.ESTADO, new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ); + } + else + { + consulta = provider.getConsultaByID( consultaID ); + consulta.set( TrabalhadoresConsultasData.ESTADO, new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ); + } + } + consulta.set( TrabalhadoresConsultasData.DATA, data ); + provider.saveConsulta( consulta ); + if( consultaData == null ) + { + Integer consultaID = ( Integer )consulta.get( TrabalhadoresConsultasData.ID ); + Integer consultaDataID = provider.getLastConsultaDataIDForConsulta( consultaID ); + if( consultaDataID == null || nova ) + { + consultaData = new TrabalhadoresConsultasDatasData(); + consultaData.set( TrabalhadoresConsultasDatasData.TRABALHADORES_CONSULTAS_ID, consultaID ); + consultaData.set( TrabalhadoresConsultasDatasData.ESTADO, new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ); + } + else + { + consultaData = provider.getConsultaDataByID( consultaDataID ); + } + } + consultaData.set( TrabalhadoresConsultasDatasData.DATA, data ); + provider.saveConsultaData( consultaData ); + + notifyListeners( ProcessoEvent.ACCAO_MUDAR_DATA_MARCACAO ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar dados da consulta", true ); + return; + } + } + } + + protected void editarObservacoes() + { + if( observacoesDialog == null ) + { + observacoesDialog = new ObservacoesDialog( owner ); + } + String texto = ""; + try + { + Integer dataID = provider.getLastConsultaDataIDForConsulta( ( Integer ) consulta.get( TrabalhadoresConsultasData.ID ) ); + IDObject observacoes = provider.getObservacoesConsultaData( dataID ); + if( observacoes != null ) + { + texto = observacoes.toString(); + } + texto = observacoesDialog.editarObservacao( texto ); + if( texto != null ) + { + provider.saveObservacoesConsultaData( dataID, texto ); + notifyListeners( ProcessoEvent.ACCAO_ESCREVER_OBSERVACOES ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + return; + } + } + + protected void enviarEmail() + { + if( consulta == null ) + { + return; + } + try + { + Integer consultaDataID; + if( consultaData == null ) + { + Integer consultaID = ( Integer )consulta.get( TrabalhadoresConsultasDatasData.ID ); + consultaDataID = provider.getLastConsultaDataIDForConsulta( consultaID ); + consultaData = provider.getConsultaDataByID( consultaDataID ); + } + consultaDataID = ( Integer ) consultaData.get( TrabalhadoresConsultasDatasData.ID ); + provider.saveEmailConsultaData( consultaDataID, "teste@siprp.pt", "Email de teste.", "" ); + notifyListeners( ProcessoEvent.ACCAO_ESCREVER_MAIL ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar dados da consulta", true ); + return; + } + } + + protected void mudarEstado() + { + if( consulta == null ) + { + return; + } + Integer estado = ( Integer ) consulta.get( TrabalhadoresConsultasData.ESTADO ); + EstadoChooser chooser = + new EstadoChooser( owner, ProcessoConstants.TIPO_CONSULTA, + estado != null ? estado.intValue() : MedicinaConstants.ESTADO_POR_REALIZAR ); + chooser.setVisible( true ); + int novoEstado = chooser.getEstado(); + if( estado == null || estado.intValue() != novoEstado ) + { + try + { + consulta.set( TrabalhadoresConsultasData.ESTADO, new Integer( novoEstado ) ); + provider.saveConsulta( consulta ); + if( consultaData == null ) + { + Integer consultaID = ( Integer )consulta.get( TrabalhadoresConsultasDatasData.ID ); + Integer consultaDataID = provider.getLastConsultaDataIDForConsulta( consultaID ); + consultaData = provider.getConsultaDataByID( consultaDataID ); + } + consultaData.set( TrabalhadoresConsultasDatasData.ESTADO, new Integer( novoEstado ) ); + provider.saveConsultaData( consultaData ); + + notifyListeners( ProcessoEvent.ACCAO_MUDAR_ESTADO_MARCACAO ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar dados da consulta", true ); + return; + } + } + } + + public void addProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.add( listener ); + } + + public void removeProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.remove( listener ); + } + + public void clear() + { + dataConsultaPanel.setDate( null ); + estadoButton.setText( " " ); + consulta = null; + consultaData = null; + } + + public void fill( Object value ) + { + clear(); + if( value != null ) + { + try + { + consulta = ( TrabalhadoresConsultasData ) JDO.load( TrabalhadoresConsultasData.class, ( Integer ) value ); + Date data = ( Date ) consulta.get( TrabalhadoresConsultasData.DATA ); + Integer estado = ( Integer ) consulta.get( TrabalhadoresConsultasData.ESTADO ); + dataConsultaPanel.setDate( data ); + if( estado != null ) + { + estadoButton.setText( ESTADOS_CONSULTA_STR[ estado.intValue() ] ); + } + else + { + estadoButton.setText( " " ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados da consulta", true ); + } + } + enableButtons(); + } + + protected void enableButtons() + { + if( consulta != null ) + { + Integer estado = ( Integer ) consulta.get( TrabalhadoresConsultasData.ESTADO ); + dataConsultaPanel.setEnabled( estado == null || estado.intValue() == ESTADO_POR_REALIZAR ); + estadoButton.setEnabled( consulta.get( TrabalhadoresConsultasData.DATA ) != null ); + emailButton.setEnabled( consulta.get( TrabalhadoresConsultasData.DATA ) != null ); + observacoesButton.setEnabled( consulta.get( TrabalhadoresConsultasData.DATA ) != null ); + } + else + { + dataConsultaPanel.setEnabled( true ); + estadoButton.setEnabled( false ); + emailButton.setEnabled( false ); + observacoesButton.setEnabled( false ); + } + } + + public void setTrabalhadorID( Integer trabalhadorID ) + { + this.trabalhadorID = trabalhadorID; + } + + public void setProcessoID( Integer processoID ) + { + this.processoID = processoID; + } + + protected void notifyListeners( int accao ) + { + HashMap ids = new HashMap(); + ids.put( ProcessoEvent.TIPO_PROCESSO, processoID ); + if( consulta != null ) + { + ids.put( ProcessoEvent.TIPO_CONSULTA, ( Integer ) consulta.get( TrabalhadoresConsultasData.ID ) ); + } + if( consultaData != null ) + { + ids.put( ProcessoEvent.TIPO_DATA, ( Integer ) consulta.get( TrabalhadoresConsultasDatasData.ID ) ); + } + ProcessoEvent event = new ProcessoEvent( this, accao, ids ); + for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ ) + { + PROCESSO_LISTENERS.get( n ).processoStateChanged( event ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/DetalhesProcessoPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/DetalhesProcessoPanel.java new file mode 100644 index 00000000..2170f4f9 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/DetalhesProcessoPanel.java @@ -0,0 +1,101 @@ +/* + * DetalhesProcessoPanel.java + * + * Created on 25 de Abril de 2007, 17:34 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.detalhes; + +import java.awt.CardLayout; +import java.util.Vector; +import javax.swing.JFrame; +import javax.swing.JPanel; +import siprp.medicina.processo.*; + +/** + * + * @author Frederico + */ +public class DetalhesProcessoPanel extends JPanel +{ + private final Vector PROCESSO_LISTENERS = new Vector(); + + private static final String CARD_BLANK = ""; + private static final String CARD_CONSULTA = "CONSULTA"; + private static final String CARD_ECDS = "ECDS"; + + protected JFrame owner; + + protected JPanel blankPanel; + protected ConsultaPanel consultaPanel; + protected ECDsPanel ecdsPanel; + + protected CardLayout cardLayout; + + /** + * Creates a new instance of DetalhesProcessoPanel + */ + public DetalhesProcessoPanel( JFrame owner ) + throws Exception + { + this.owner = owner; + setupComponents(); + } + + private void setupComponents() + throws Exception + { + blankPanel = new JPanel(); + consultaPanel = new ConsultaPanel( owner ); + ecdsPanel = new ECDsPanel( owner ); + + cardLayout = new CardLayout(); + setLayout( cardLayout ); + add( blankPanel, CARD_BLANK ); + add( consultaPanel, CARD_CONSULTA ); + add( ecdsPanel, CARD_ECDS ); + } + + public void addProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.add( listener ); + consultaPanel.addProcessoListener( listener ); + ecdsPanel.addProcessoListener( listener ); + } + + public void removeProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.remove( listener ); + consultaPanel.removeProcessoListener( listener ); + ecdsPanel.removeProcessoListener( listener ); + } + + public void clear() + { + cardLayout.first( this ); + } + + public void setTrabalhadorID( Integer trabalhadorID ) + { + consultaPanel.setTrabalhadorID( trabalhadorID ); + } + + public void setProcessoID( Integer processoID ) + { + consultaPanel.setProcessoID( processoID ); + } + + public void setConsulta( Integer consultaID ) + { + cardLayout.show( this, CARD_CONSULTA ); + consultaPanel.fill( consultaID ); + } + + public void setECDs( Integer ecdsID ) + { + cardLayout.show( this, CARD_ECDS ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ECDsPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ECDsPanel.java new file mode 100644 index 00000000..f516aa45 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ECDsPanel.java @@ -0,0 +1,366 @@ +/* + * ECDsPanel.java + * + * Created on 13 de Maio de 2007, 17:07 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.detalhes; + +import com.evolute.utils.Singleton; +import com.evolute.utils.data.IDObject; +import com.evolute.utils.jdo.JDOProvider; +import com.evolute.utils.ui.DialogException; +import com.evolute.utils.ui.calendar.JCalendarPanel; +import info.clearthought.layout.TableLayout; +import info.clearthought.layout.TableLayoutConstraints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Date; +import java.util.HashMap; +import java.util.Vector; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import siprp.medicina.MedicinaConstants; +import siprp.medicina.processo.ProcessoConstants; +import siprp.medicina.processo.ProcessoDataProvider; +import siprp.medicina.processo.ProcessoEvent; +import siprp.medicina.processo.ProcessoListener; +import siprp.medicina.processo.data.TrabalhadoresConsultasData; +import siprp.medicina.processo.data.TrabalhadoresEcdsData; +import siprp.medicina.processo.data.TrabalhadoresEcdsDatasData; + +/** + * + * @author Frederico + */ +public class ECDsPanel extends JPanel + implements ActionListener, MedicinaConstants, ChangeListener +{ + protected JFrame owner; + protected JCalendarPanel dataEcdsPanel; + protected JButton estadoButton; + protected JButton emailButton; + protected JButton observacoesButton; + protected ObservacoesDialog observacoesDialog; + + protected final Vector PROCESSO_LISTENERS = new Vector(); + protected JDOProvider JDO; + protected ProcessoDataProvider provider; + + protected Integer trabalhadorID; + protected Integer processoID; + protected TrabalhadoresEcdsData ecds; + protected TrabalhadoresEcdsDatasData ecdsData; + + /** + * Creates a new instance of ECDsPanel + */ + public ECDsPanel( JFrame owner ) + throws Exception + { + this.owner = owner; + JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + provider = ProcessoDataProvider.getProvider(); + setupComponents(); + } + + private void setupComponents() + { + JLabel dataLabel = new JLabel( "Data" ); + dataConsultaPanel = new JCalendarPanel( null ); + dataConsultaPanel.addChangeListener( this ); + estadoButton = new JButton( " " ); + estadoButton.addActionListener( this ); + emailButton = new JButton( "Email" ); + emailButton.addActionListener( this ); + observacoesButton = new JButton( "Coment\u00e1rio" ); + observacoesButton.addActionListener( this ); + + double cols[] = + new double[]{ TableLayout.MINIMUM, TableLayout.FILL }; + double rows[] = + new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, + TableLayout.MINIMUM, TableLayout.MINIMUM }; + + TableLayout tableLayout = new TableLayout( cols, rows ); + tableLayout.setVGap( 5 ); + setLayout( tableLayout ); + + add( dataLabel, new TableLayoutConstraints( 0, 0 ) ); + add( dataEcdsPanel, new TableLayoutConstraints( 1, 0 ) ); + add( estadoButton, new TableLayoutConstraints( 0, 1, 1, 1 ) ); + add( emailButton, new TableLayoutConstraints( 0, 2, 1, 2 ) ); + add( observacoesButton, new TableLayoutConstraints( 0, 3, 1, 3 ) ); + } + + public void actionPerformed(ActionEvent e) + { + Object source = e.getSource(); + if( source.equals( observacoesButton ) ) + { + editarObservacoes(); + } + else if( source.equals( emailButton ) ) + { + enviarEmail(); + } + else if( source.equals( estadoButton ) ) + { + mudarEstado(); + } + } + + public void stateChanged(ChangeEvent e) + { + Object source = e.getSource(); + + if( source.equals( dataConsultaPanel ) ) + { + Date data = dataConsultaPanel.getDate(); + if( data == null ) + { + return; + } + try + { + boolean nova = false; + if( ecds == null ) + { + nova = true; + Integer ecdsID = provider.getEcdsEmAbertoForProcesso( processoID ); + if( ecdsID == null ) + { + ecds = new TrabalhadoresEcdsData(); + ecds.set( TrabalhadoresEcdsData.TRABALHADOR_ID, trabalhadorID ); + ecds.set( TrabalhadoresEcdsData.PROCESSO_ID, processoID ); + ecds.set( TrabalhadoresEcdsData.ESTADO, new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ); + } + else + { + ecds = provider.getEcdsByID( ecdsID ); + ecds.set( TrabalhadoresEcdsData.ESTADO, new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ); + } + } + ecds.set( TrabalhadoresConsultasData.DATA, data ); + provider.saveEcds( ecds ); + if( ecdsData == null ) + { + Integer ecdsID = ( Integer )ecds.get( TrabalhadoresEcdsData.ID ); + Integer ecdsDataID = provider.getLastEcdsDataIDForEcds( ecdsID ); + if( ecdsDataID == null || nova ) + { + ecdsData = new TrabalhadoresEcdsDatasData(); + ecdsData.set( TrabalhadoresEcdsDatasData.TRABALHADORES_ECDS_ID, ecdsID ); + ecdsData.set( TrabalhadoresEcdssDatasData.ESTADO, new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ) ); + } + else + { + ecdsData = provider.getEcdsDataByID( ecdsDataID ); + } + } + ecdsData.set( TrabalhadoresEcdsDatasData.DATA, data ); + provider.saveEcdsData( ecdsData ); + + notifyListeners( ProcessoEvent.ACCAO_MUDAR_DATA_MARCACAO ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar dados dos ECDs", true ); + return; + } + } + } + + protected void editarObservacoes() + { + if( observacoesDialog == null ) + { + observacoesDialog = new ObservacoesDialog( owner ); + } + String texto = ""; + try + { + Integer dataID = provider.getLastEcdsDataIDForEcds( ( Integer ) ecds.get( TrabalhadoresEcdssData.ID ) ); + IDObject observacoes = provider.getObservacoesEcdsData( dataID ); + if( observacoes != null ) + { + texto = observacoes.toString(); + } + texto = observacoesDialog.editarObservacao( texto ); + if( texto != null ) + { + provider.saveObservacoesEcdsData( dataID, texto ); + notifyListeners( ProcessoEvent.ACCAO_ESCREVER_OBSERVACOES ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + return; + } + } + + protected void enviarEmail() + { + if( ecds == null ) + { + return; + } + try + { + Integer ecdsDataID; + if( ecdsData == null ) + { + Integer ecdsID = ( Integer )ecds.get( TrabalhadoresEcdsData.ID ); + ecdsDataID = provider.getLastEcdsDataIDForEcds( ecdsID ); + ecdsData = provider.getEcdsDataByID( ecdsDataID ); + } + ecdsDataID = ( Integer ) ecdsData.get( TrabalhadoresEcdsDatasData.ID ); + provider.saveEmailEcdsData( ecdsDataID, "teste@siprp.pt", "Email de teste.", "" ); + notifyListeners( ProcessoEvent.ACCAO_ESCREVER_MAIL ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar dados", true ); + return; + } + } + + protected void mudarEstado() + { + if( ecds == null ) + { + return; + } + Integer estado = ( Integer ) ecds.get( TrabalhadoresEcdsData.ESTADO ); + EstadoChooser chooser = + new EstadoChooser( owner, ProcessoConstants.TIPO_ECDS, + estado != null ? estado.intValue() : MedicinaConstants.ESTADO_POR_REALIZAR ); + chooser.setVisible( true ); + int novoEstado = chooser.getEstado(); + if( estado == null || estado.intValue() != novoEstado ) + { + try + { + ecds.set( TrabalhadoresEcdsData.ESTADO, new Integer( novoEstado ) ); + provider.saveEcds( ecds ); + if( ecdsData == null ) + { + Integer ecdsID = ( Integer )ecds.get( TrabalhadoresEcdsData.ID ); + Integer ecdsDataID = provider.getLastEcdsDataIDForEcds( ecdsID ); + ecdsData = provider.getEcdsDataByID( ecdsDataID ); + } + ecdsData.set( TrabalhadoresEcdsDatasData.ESTADO, new Integer( novoEstado ) ); + provider.saveEcdsData( ecdsData ); + + notifyListeners( ProcessoEvent.ACCAO_MUDAR_ESTADO_MARCACAO ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a gravar dados", true ); + return; + } + } + } + + public void addProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.add( listener ); + } + + public void removeProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.remove( listener ); + } + + public void clear() + { + dataConsultaPanel.setDate( null ); + estadoButton.setText( " " ); + ecds = null; + ecdsData = null; + } + + public void fill( Object value ) + { + clear(); + if( value != null ) + { + try + { + ecds = ( TrabalhadoresEcdsData ) JDO.load( TrabalhadoresEcdsData.class, ( Integer ) value ); + Date data = ( Date ) ecds.get( TrabalhadoresEcdsData.DATA ); + Integer estado = ( Integer ) ecds.get( TrabalhadoresEcdsData.ESTADO ); + dataConsultaPanel.setDate( data ); + if( estado != null ) + { + estadoButton.setText( ESTADOS_EXAME_STR[ estado.intValue() ] ); + } + else + { + estadoButton.setText( " " ); + } + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + } + } + enableButtons(); + } + + protected void enableButtons() + { + if( ecds != null ) + { + Integer estado = ( Integer ) ecds.get( TrabalhadoresEcdsData.ESTADO ); + dataEcdsPanel.setEnabled( estado == null || estado.intValue() == ESTADO_POR_REALIZAR ); + estadoButton.setEnabled( ecds.get( TrabalhadoresEcdsData.DATA ) != null ); + emailButton.setEnabled( ecds.get( TrabalhadoresEcdsData.DATA ) != null ); + observacoesButton.setEnabled( ecds.get( TrabalhadoresEcdsData.DATA ) != null ); + } + else + { + dataConsultaPanel.setEnabled( true ); + estadoButton.setEnabled( false ); + emailButton.setEnabled( false ); + observacoesButton.setEnabled( false ); + } + } + + public void setTrabalhadorID( Integer trabalhadorID ) + { + this.trabalhadorID = trabalhadorID; + } + + public void setProcessoID( Integer processoID ) + { + this.processoID = processoID; + } + + protected void notifyListeners( int accao ) + { + HashMap ids = new HashMap(); + ids.put( ProcessoEvent.TIPO_PROCESSO, processoID ); + if( ecds != null ) + { + ids.put( ProcessoEvent.TIPO_CONSULTA, ( Integer ) ecds.get( TrabalhadoresEcdsData.ID ) ); + } + if( ecdsData != null ) + { + ids.put( ProcessoEvent.TIPO_DATA, ( Integer ) ecds.get( TrabalhadoresEcdsData.ID ) ); + } + ProcessoEvent event = new ProcessoEvent( this, accao, ids ); + for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ ) + { + PROCESSO_LISTENERS.get( n ).processoStateChanged( event ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/EstadoChooser.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/EstadoChooser.java new file mode 100644 index 00000000..2816eec1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/EstadoChooser.java @@ -0,0 +1,96 @@ +/* + * EstadoChooser.java + * + * Created on 13 de Maio de 2007, 11:54 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.detalhes; + +import com.evolute.utils.ui.CustomJDialog; +import java.awt.Color; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.HashMap; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import siprp.medicina.MedicinaConstants; + +/** + * + * @author Frederico + */ +public class EstadoChooser extends CustomJDialog + implements MedicinaConstants, ActionListener +{ + protected int tipo; + protected int estado; + protected HashMap buttonMap = new HashMap(); + + /** Creates a new instance of EstadoChooser */ + public EstadoChooser( JFrame owner, int tipo, int estadoActual ) + { + super( owner, true ); + this.tipo = tipo; + estado = estadoActual; + setupComponents(); + + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + } + + private void setupComponents() + { + setTitle( "Escolha o novo estado" ); + setLayout( new GridLayout( ESTADOS_STR[ tipo ].length, 1 ) ); + for( int n = 0; n < ESTADOS_STR[ tipo ].length; n++ ) + { + if( ESTADOS_STR[ tipo ][ n ] == null ) + { + continue; + } + JButton button = new JButton( ESTADOS_STR[ tipo ][ n ] ); + if( n == estado ) + { + button.setForeground( Color.green ); + } + buttonMap.put( button, new Integer( n ) ); + add( button ); + button.addActionListener( this ); + } + pack(); + } + + public void actionPerformed( ActionEvent e ) + { + JButton source = ( JButton ) e.getSource(); + estado = buttonMap.get( source ).intValue(); + close(); + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public int getEstado() + { + return estado; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ObservacoesDialog.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ObservacoesDialog.java new file mode 100644 index 00000000..64e314a9 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/detalhes/ObservacoesDialog.java @@ -0,0 +1,116 @@ +/* + * ObservacoesDialog.java + * + * Created on 13 de Maio de 2007, 13:13 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.detalhes; + +import com.evolute.utils.ui.CustomJDialog; +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +/** + * + * @author Frederico + */ +public class ObservacoesDialog extends CustomJDialog + implements ActionListener +{ + protected JTextArea observacoesText; + protected JButton okButton; + protected JButton cancelButton; + + protected boolean ok = false; + + public static void main( String args[] ) + { + ObservacoesDialog dialog = new ObservacoesDialog( null ); + dialog.editarObservacao( "ISto e a observba" ); + System.exit( 0 ); + } + + /** Creates a new instance of ObservacoesDialog */ + public ObservacoesDialog( JFrame owner ) + { + super( owner, true ); + setupComponents(); + + if( owner != null ) + { + centerSuper(); + } + else + { + center(); + } + } + + private void setupComponents() + { + setTitle( "Coment\u00e1rio" ); + setSize( 400, 200 ); + observacoesText = new JTextArea(); + observacoesText.setLineWrap( true ); + observacoesText.setWrapStyleWord( true ); + JScrollPane scp = new JScrollPane( observacoesText, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + okButton = new JButton( "Ok" ); + okButton.addActionListener( this ); + cancelButton = new JButton( "Cancelar" ); + cancelButton.addActionListener( this ); + JPanel buttonPanel = new JPanel(); + + setLayout( new BorderLayout() ); + add( scp, BorderLayout.CENTER ); + add( buttonPanel, BorderLayout.SOUTH ); + + buttonPanel.setLayout( new GridLayout( 1, 2 ) ); + buttonPanel.add( okButton ); + buttonPanel.add( cancelButton ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( okButton ) ) + { + ok = true; + close(); + } + else + { + ok = false; + close(); + } + } + + public String editarObservacao( String observacao ) + { + observacoesText.setText( observacao ); + setVisible( true ); + return ok ? observacoesText.getText() : null; + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ConsultaMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ConsultaMutableTreeNode.java new file mode 100644 index 00000000..f1f6f0c8 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ConsultaMutableTreeNode.java @@ -0,0 +1,30 @@ +/* + * ConsultaMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:31 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class ConsultaMutableTreeNode extends MarcacaoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/consulta.png"; + + /** Creates a new instance of ConsultaMutableTreeNode */ + public ConsultaMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/DataMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/DataMutableTreeNode.java new file mode 100644 index 00000000..838cc67d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/DataMutableTreeNode.java @@ -0,0 +1,30 @@ +/* + * DataMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class DataMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/data.png"; + + /** Creates a new instance of DataMutableTreeNode */ + public DataMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ECDsMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ECDsMutableTreeNode.java new file mode 100644 index 00000000..331c1c13 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ECDsMutableTreeNode.java @@ -0,0 +1,30 @@ +/* + * ECDsMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:31 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class ECDsMutableTreeNode extends MarcacaoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/ecds.png"; + + /** Creates a new instance of ECDsMutableTreeNode */ + public ECDsMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoMutableTreeNode.java new file mode 100644 index 00000000..2961d479 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoMutableTreeNode.java @@ -0,0 +1,79 @@ +/* + * EstruturaProcessoMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 18:57 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.images.ImageIconLoader; +import javax.swing.Icon; +import javax.swing.tree.DefaultMutableTreeNode; + +/** + * + * @author Frederico + */ +abstract public class EstruturaProcessoMutableTreeNode extends DefaultMutableTreeNode + implements IDObject +{ + protected Icon icon; + protected Integer id; + protected String descricao; + + /** Creates a new instance of EstruturaProcessoMutableTreeNode */ + public EstruturaProcessoMutableTreeNode( Integer id, String descricao ) + { + super( descricao ); + this.id = id; + this.descricao = descricao; + } + + public Integer getID() + { + return id; + } + + public void setID( Integer id ) + { + this.id = id; + } + + public String getDescricao() + { + return descricao; + } + + public void setDescricao( String descricao ) + { + this.descricao = descricao; + setUserObject( descricao ); + } + + abstract protected String getIconPath(); + + public Icon getIcon() + { + loadIcon(); + return icon; + } + + protected void loadIcon() + { + if( icon == null && getIconPath() != null ) + { + try + { + icon = ImageIconLoader.loadImageIcon( getClass(), getIconPath() ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoPanel.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoPanel.java new file mode 100644 index 00000000..a3a291d3 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoPanel.java @@ -0,0 +1,421 @@ +/* + * EstruturaProcessoPanel.java + * + * Created on March 20, 2007, 12:07 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import com.evolute.utils.data.IDObject; +import com.evolute.utils.ui.DialogException; +import java.awt.*; +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Locale; +import java.util.Vector; +import javax.swing.*; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.event.TreeSelectionListener; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import siprp.medicina.MedicinaConstants; +import siprp.medicina.MedicinaDataProvider; +import siprp.medicina.processo.*; +import siprp.medicina.processo.data.TrabalhadoresConsultasData; +import siprp.medicina.processo.data.TrabalhadoresProcessoData; + +/** + * + * @author fpalma + */ +public class EstruturaProcessoPanel extends JPanel + implements TreeSelectionListener +{ + protected static final DateFormat D_F = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ); + + protected JScrollPane mainScroll; + protected TrabalhadorMutableTreeNode rootNode; + protected JTree mainTree; + + protected ProcessoDataProvider provider; + + protected IDObject trabalhador; + protected final HashMap PROCESSOS_POR_ID = + new HashMap(); + + private final Vector PROCESSO_LISTENERS = new Vector(); + + /** Creates a new instance of EstruturaProcessoPanel */ + public EstruturaProcessoPanel() + throws Exception + { + provider = ProcessoDataProvider.getProvider(); + setupComponents(); +// setTrabalhador( new MappableObject( new Integer( 12 ), "Alexandre de Matos Monge" ) ); + } + + private void setupComponents() + { + mainScroll = new JScrollPane(); + mainScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED ); + mainScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED ); +// rootNode = new DefaultMutableTreeNode( new MappableObject( new Integer( 12 ), "Frederico Palma" ) ); + rootNode = new TrabalhadorMutableTreeNode( new Integer( -1 ), "" ); + mainTree = new JTree( rootNode ); + mainTree.addTreeSelectionListener( this ); + mainTree.setCellRenderer( new EstruturaProcessoRenderer() ); + mainScroll.setViewportView( mainTree ); + setLayout( new GridLayout( 1, 1 ) ); + add( mainScroll ); + + } + + public void setTrabalhador( IDObject trabalhador ) + { + clear(); + if( trabalhador == null ) + { + return; + } + this.trabalhador = trabalhador; +// rootNode.removeAllChildren(); +// PROCESSOS_POR_ID.clear(); + rootNode.setID( trabalhador.getID() ); + rootNode.setDescricao( trabalhador.toString() ); + DefaultMutableTreeNode nodes[] = + loadProcessos( trabalhador.getID() ); + rootNode.add( criarProcessoVazio() ); + for( int n = 0; n < nodes.length; n++ ) + { + rootNode.add( nodes[ n ] ); + } + int count = mainTree.getRowCount(); + for( int n = count - 1; n >= 0; n-- ) + { + mainTree.expandRow( n ); + } + } + + protected DefaultMutableTreeNode[] loadProcessos( Integer trabalhadorID ) + { + try + { + Integer ids[] = provider.getIDsProcessosByTrabalhador( trabalhadorID ); + DefaultMutableTreeNode nodes[] = new DefaultMutableTreeNode[ ids.length ]; + for( int n = 0; n < ids.length; n++ ) + { + nodes[ n ] = loadProcesso( ids[ n ], null ); + } +//System.out.println( "nl: " + nodes.length ); + return nodes; + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + return new DefaultMutableTreeNode[ 0 ]; + } + } + + protected ProcessoMutableTreeNode loadProcesso( Integer id, ProcessoMutableTreeNode node ) + throws Exception + { + TrabalhadoresProcessoData processo = provider.getProcessoByID( id ); + Date dataInicio = ( Date ) processo.get( TrabalhadoresProcessoData.DATA_INICIO ); + Date dataFim = ( Date ) processo.get( TrabalhadoresProcessoData.DATA_FIM ); + String codigoEstado = ( String ) processo.get( TrabalhadoresProcessoData.ESTADO ); + String estado = provider.getDescricaoEstadoProcessoByCodigo( codigoEstado ); + String desc = D_F.format( dataInicio ); + Integer motivo = ( Integer ) processo.get( TrabalhadoresProcessoData.MOTIVO ); + desc += ": " + MedicinaDataProvider.MOTIVOS_BY_ID.get( motivo ) + " : " + estado; + PROCESSOS_POR_ID.put( id, processo ); + ProcessoMutableTreeNode processoNode; + if( node == null ) + { + processoNode = new ProcessoMutableTreeNode( id, desc ); + } + else + { + processoNode = node; + processoNode.setID( id ); + processoNode.setDescricao( desc ); + } + processoNode.removeAllChildren(); + MarcacaoMutableTreeNode marcacoes[] = loadMarcacoes( id ); +// processoNode.add( new ECDsMutableTreeNode( new Integer( 35 ), "ECDS de 2006/01/01 : Realizado" ) ); + for( int n = 0; n < marcacoes.length; n++ ) + { + processoNode.add( marcacoes[ n ] ); + } + +// processoNode.add( new FichaAptidaoMutableTreeNode( new Integer( 35 ), "Ficha de Aptid\u00e3o de 2006/01/01 : Apto" ) ); + ( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( processoNode ); + return processoNode; + } + + public MarcacaoMutableTreeNode[] loadMarcacoes( Integer processoID ) + { + try + { + Integer consultaIDs[] = provider.getConsultaIDsForProcesso( processoID ); + Vector nodesVector = new Vector(); + for( int n = 0; n < consultaIDs.length; n++ ) + { + nodesVector.add( loadConsulta( consultaIDs[ n ], null ) ); + } + + MarcacaoMutableTreeNode nodes[] = nodesVector.toArray( new MarcacaoMutableTreeNode[ nodesVector.size() ] ); + Arrays.sort( nodes ); + return nodes; + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + return new MarcacaoMutableTreeNode[ 0 ]; + } + } + + public ConsultaMutableTreeNode loadConsulta( Integer id, ConsultaMutableTreeNode node ) + throws Exception + { + TrabalhadoresConsultasData consulta = provider.getConsultaByID( id ); + Date data = ( Date ) consulta.get( TrabalhadoresConsultasData.DATA ); + Integer estado = ( Integer ) consulta.get( TrabalhadoresConsultasData.ESTADO ); + String estadoStr = MedicinaConstants.ESTADOS_CONSULTA_STR[ estado != null ? estado.intValue() : 0 ]; + + String desc = "Consulta de " + ( data != null ? D_F.format( data ) : "--" ); + desc += ": " + estadoStr; + ConsultaMutableTreeNode consultaNode; + if( node == null ) + { + consultaNode = new ConsultaMutableTreeNode( id, desc ); + consultaNode.setData( data ); + } + else + { + consultaNode = node; + consultaNode.setID( id ); + consultaNode.setDescricao( desc ); + consultaNode.setData( data ); + } + consultaNode.removeAllChildren(); + Object datas[][] = provider.getDatasConsulta( id ); + for( int n = 0; n < datas.length; n++ ) + { + Integer dataID = ( Integer ) datas[ n ][ 0 ]; + Date dataData = ( Date ) datas[ n ][ 1 ]; + Integer dataEstado = ( Integer ) datas[ n ][ 2 ]; + String dataEstadoStr = MedicinaConstants.ESTADOS_CONSULTA_STR[ dataEstado != null ? dataEstado.intValue() : 0 ]; + String dataDesc = D_F.format( dataData ) + ": " + dataEstadoStr; + DataMutableTreeNode dataNode = new DataMutableTreeNode( dataID, dataDesc ); + IDObject observacoes = provider.getObservacoesConsultaData( dataID ); + if( observacoes != null ) + { + ObservacoesMutableTreeNode observacoesNode = new ObservacoesMutableTreeNode( observacoes.getID(), observacoes.toString() ); + dataNode.add( observacoesNode ); + } + IDObject emails[] = provider.getEmailConsultaData( dataID ); + for( int em = 0; em < emails.length; em++ ) + { + MailMutableTreeNode mailNode = new MailMutableTreeNode( emails[ em ].getID(), emails[ em ].toString() ); + dataNode.add( mailNode ); + } + consultaNode.add( dataNode ); + } + + ( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( consultaNode ); + return consultaNode; + } + + public void valueChanged( TreeSelectionEvent e ) + { + Object components[] = e.getPath().getPath(); + int tipo = ProcessoEvent.ACCAO_ESCOLHER_PROCESSO; + if( components == null || components.length == 0 || + components[ components.length - 1 ] instanceof TrabalhadorMutableTreeNode || + components[ components.length - 1 ] instanceof ProcessoMutableTreeNode ) + { + tipo = ProcessoEvent.ACCAO_ESCOLHER_PROCESSO; + } + else if( components[ components.length - 1 ] instanceof ConsultaMutableTreeNode ) + { + tipo = ProcessoEvent.ACCAO_ESCOLHER_CONSULTA; + } + else if( components[ components.length - 1 ] instanceof ECDsMutableTreeNode ) + { + tipo = ProcessoEvent.ACCAO_ESCOLHER_ECDS; + } + else if( components[ components.length - 1 ] instanceof FichaAptidaoMutableTreeNode ) + { + tipo = ProcessoEvent.ACCAO_ESCOLHER_FA; + } + else if( components[ components.length - 1 ] instanceof DataMutableTreeNode ) + { + tipo = ProcessoEvent.ACCAO_ESCOLHER_DATA; + } + else if( components[ components.length - 1 ] instanceof ObservacoesMutableTreeNode ) + { + tipo = ProcessoEvent.ACCAO_ESCOLHER_OBSERVACOES; + } + else if( components[ components.length - 1 ] instanceof MailMutableTreeNode ) + { + tipo = ProcessoEvent.ACCAO_ESCOLHER_MAIL; + } + HashMap ids = new HashMap(); + for( int n = 0; components != null && n < components.length; n++ ) + { + Integer id = ( ( EstruturaProcessoMutableTreeNode ) components[ n ] ).getID(); + if( components[ n ] instanceof ProcessoMutableTreeNode ) + { + ids.put( ProcessoEvent.TIPO_PROCESSO, id ); + } + else if( components[ n ] instanceof ConsultaMutableTreeNode ) + { + ids.put( ProcessoEvent.TIPO_CONSULTA, id ); + } + else if( components[ n ] instanceof ECDsMutableTreeNode ) + { + ids.put( ProcessoEvent.TIPO_ECDS, id ); + } + else if( components[ n ] instanceof FichaAptidaoMutableTreeNode ) + { + ids.put( ProcessoEvent.TIPO_FICHA_APTIDAO, id ); + } + else if( components[ n ] instanceof DataMutableTreeNode ) + { + ids.put( ProcessoEvent.TIPO_DATA, id ); + } + else if( components[ n ] instanceof ObservacoesMutableTreeNode ) + { + ids.put( ProcessoEvent.TIPO_OBSERVACOES, id ); + } + else if( components[ n ] instanceof MailMutableTreeNode ) + { + ids.put( ProcessoEvent.TIPO_MAIL, id ); + } + } + ProcessoEvent event = new ProcessoEvent( this, tipo, ids ); + for( int n = 0; n < PROCESSO_LISTENERS.size(); n++ ) + { + PROCESSO_LISTENERS.get( n ).processoStateChanged( event ); + } + } +// +// public TrabalhadoresProcessoData getProcessoEscolhido() +// { +// TreePath path = mainTree.getSelectionPath(); +// TrabalhadoresProcessoData processo = null; +// if( path != null ) +// { +// EstruturaProcessoMutableTreeNode escolhido = ( EstruturaProcessoMutableTreeNode ) path.getLastPathComponent(); +// if( escolhido != null ) +// { +// processo = PROCESSOS_POR_ID.get( escolhido.getID() ); +// if( processo == null ) +// { +// processo = new TrabalhadoresProcessoData(); +// PROCESSOS_POR_ID.put( escolhido.getID(), processo ); +// } +// } +// } +// +// return processo; +// } + + public void addProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.add( listener ); + } + + public void removeProcessoListener( ProcessoListener listener ) + { + PROCESSO_LISTENERS.remove( listener ); + } + + public IDObject getTrabalhador() + { + return trabalhador; + } + + public void actualizarProcessoEscolhido( Integer id ) + throws Exception + { + TreePath path = mainTree.getSelectionPath(); + Enumeration expandedDescendants = mainTree.getExpandedDescendants( path ); + ProcessoMutableTreeNode processoNode = ( ProcessoMutableTreeNode ) path.getPathComponent( 1 ); + boolean vazio = processoNode.getID().intValue() == -1; + loadProcesso( id, processoNode ); + ( ( DefaultTreeModel ) mainTree.getModel() ).nodeChanged( processoNode ) ; + if( vazio ) + { + ProcessoMutableTreeNode novo = criarProcessoVazio(); + rootNode.insert( novo, 0 ); + ( ( DefaultTreeModel ) mainTree.getModel() ).nodesWereInserted( rootNode, new int[]{ 0 } ) ; + } + mainTree.expandPath( path ); + mainTree.setSelectionPath( path ); +// while( expandedDescendants.hasMoreElements() ) +// { +// mainTree.expandPath( expandedDescendants.nextElement() ); +// } + } + + public void actualizarMarcacaoEscolhida( Integer processoID, Integer marcacaoID ) + throws Exception + { + TreePath path = mainTree.getSelectionPath(); + Enumeration expandedDescendants = mainTree.getExpandedDescendants( path ); + ProcessoMutableTreeNode processoNode = ( ProcessoMutableTreeNode ) path.getPathComponent( 1 ); + int countOld = processoNode.getChildCount(); + actualizarProcessoEscolhido( processoID ); + int count = processoNode.getChildCount(); + if( count > countOld ) + { + ( ( DefaultTreeModel ) mainTree.getModel() ).nodesWereInserted( processoNode, new int[]{ countOld } ) ; + } + mainTree.expandPath( path ); +// mainTree.expandPath( path ); +// while( expandedDescendants.hasMoreElements() ) +// { +// mainTree.expandPath( expandedDescendants.nextElement() ); +// } +// TreePath path = mainTree.getSelectionPath(); +// MarcacaoMutableTreeNode processoNode = ( ProcessoMutableTreeNode ) path.getPathComponent( 1 ); +// boolean vazio = processoNode.getID().intValue() == -1; +// loadProcesso( id, processoNode ); +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodeChanged( processoNode ) ; +// if( vazio ) +// { +// ProcessoMutableTreeNode novo = criarProcessoVazio(); +// rootNode.insert( novo, 0 ); +// ( ( DefaultTreeModel ) mainTree.getModel() ).nodesWereInserted( rootNode, new int[]{ 0 } ) ; +// } + } + + public ProcessoMutableTreeNode criarProcessoVazio() + { + return new ProcessoMutableTreeNode( new Integer( -1 ), "Novo Processo..." ); + } + + public void reload() + { + } + + public void clear() + { + mainTree.clearSelection(); + mainTree.setRootVisible( true ); + this.trabalhador = null; + rootNode.removeAllChildren(); + PROCESSOS_POR_ID.clear(); + rootNode.setID( null ); + rootNode.setDescricao( "" ); + ( ( DefaultTreeModel ) mainTree.getModel() ).nodeStructureChanged( rootNode ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoRenderer.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoRenderer.java new file mode 100644 index 00000000..fcd50509 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/EstruturaProcessoRenderer.java @@ -0,0 +1,51 @@ +/* + * EstruturaProcessoRenderer.java + * + * Created on 29 de Abril de 2007, 18:52 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.awt.Component; +import javax.swing.*; +import javax.swing.tree.*; + +/** + * + * @author Frederico + */ +public class EstruturaProcessoRenderer extends DefaultTreeCellRenderer +{ + + /** Creates a new instance of EstruturaProcessoRenderer */ + public EstruturaProcessoRenderer() + { + } + + public Component getTreeCellRendererComponent( + JTree tree, + Object value, + boolean sel, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) { + + super.getTreeCellRendererComponent( + tree, value, sel, + expanded, leaf, row, + hasFocus); + EstruturaProcessoMutableTreeNode node = ( EstruturaProcessoMutableTreeNode ) value; +//System.out.println( node.getICon() ); + Icon icon = node.getIcon(); + if( icon != null ) + { + setIcon( icon ); + } + + return this; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/FichaAptidaoMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/FichaAptidaoMutableTreeNode.java new file mode 100644 index 00000000..7547aef2 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/FichaAptidaoMutableTreeNode.java @@ -0,0 +1,30 @@ +/* + * FichaAptidaoMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class FichaAptidaoMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/fichaaptidao.png"; + + /** Creates a new instance of FichaAptidaoMutableTreeNode */ + public FichaAptidaoMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MailMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MailMutableTreeNode.java new file mode 100644 index 00000000..a73ee050 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MailMutableTreeNode.java @@ -0,0 +1,30 @@ +/* + * MailMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class MailMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/mail.png"; + + /** Creates a new instance of MailMutableTreeNode */ + public MailMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MarcacaoMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MarcacaoMutableTreeNode.java new file mode 100644 index 00000000..4a7ed64a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/MarcacaoMutableTreeNode.java @@ -0,0 +1,59 @@ +/* + * MarcacaoMutableTreeNode.java + * + * Created on 18 de Maio de 2007, 7:02 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +import java.util.Date; + +/** + * + * @author Frederico + */ +public abstract class MarcacaoMutableTreeNode extends EstruturaProcessoMutableTreeNode + implements Comparable +{ + protected Date data; + + /** Creates a new instance of MarcacaoMutableTreeNode */ + public MarcacaoMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + public void setData( Date data ) + { + this.data = data; + } + + public Date getData() + { + return data; + } + + public int compareTo( Object other ) + { + if( !( other instanceof MarcacaoMutableTreeNode ) ) + { + return 0; + } + MarcacaoMutableTreeNode om = ( MarcacaoMutableTreeNode ) other; + if( data == null ) + { + return 1; + } + else if( om == null || om.getData() == null ) + { + return -1; + } + else + { + return -1 * getData().compareTo( om.getData() ); + } + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ObservacoesMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ObservacoesMutableTreeNode.java new file mode 100644 index 00000000..22b358c5 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ObservacoesMutableTreeNode.java @@ -0,0 +1,30 @@ +/* + * ObservacoesMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:32 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class ObservacoesMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/observacoes.png"; + + /** Creates a new instance of ObservacoesMutableTreeNode */ + public ObservacoesMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ProcessoMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ProcessoMutableTreeNode.java new file mode 100644 index 00000000..a065184d --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/ProcessoMutableTreeNode.java @@ -0,0 +1,30 @@ +/* + * ProcessoMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 19:31 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class ProcessoMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/processo.png"; + + /** Creates a new instance of ProcessoMutableTreeNode */ + public ProcessoMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return ICON_PATH; + } +} \ No newline at end of file diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/TrabalhadorMutableTreeNode.java b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/TrabalhadorMutableTreeNode.java new file mode 100644 index 00000000..2a0342ea --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/TrabalhadorMutableTreeNode.java @@ -0,0 +1,31 @@ +/* + * TrabalhadorMutableTreeNode.java + * + * Created on 29 de Abril de 2007, 23:53 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.medicina.processo.estrutura; + +/** + * + * @author Frederico + */ +public class TrabalhadorMutableTreeNode extends EstruturaProcessoMutableTreeNode +{ + public static final String ICON_PATH = "siprp/medicina/processo/estrutura/icons/trabalhador.png"; + + /** Creates a new instance of TrabalhadorMutableTreeNode */ + public TrabalhadorMutableTreeNode( Integer id, String descricao ) + { + super( id, descricao ); + } + + protected String getIconPath() + { + return null; +// return ICON_PATH; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/consulta.png b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/consulta.png new file mode 100644 index 0000000000000000000000000000000000000000..f07be69bb3b61b9afb20e258a9c88ad965975056 GIT binary patch literal 5017 zcmV;K6K3p*P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|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siprp/medicina/processo/estrutura/icons/data.png new file mode 100644 index 0000000000000000000000000000000000000000..59f184fc7c14650caeb9f3cf27a18354adb712e6 GIT binary patch literal 5599 zcmV<56(H(~P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8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tFy&I<{qy zj74#^NpZDCXX6;DeN!Z-4zPUIMLQQ68k5ZJzl&6VA6*Z+O&{%!LqDtz$#GO+F`Amm`^GO2+bZ=|9~(;At31^zoO-rZI5oO-@+*_i z$=Fn^f9LqvDlr}axpyo}(Sl!xL-K}JNK!5UyC-f&CfBdIF9vLZ!G=36xq$ zr&6V@L(#kW59gClJfYwAbIdKcn_Khh9sBp6JU?IkKqwSGofOp@Yi|2@HkU45J@(~S zMui>AJ};$8oLNs~hNig(&jRHI z>VE3UKfY=uq6^tZx2j)3@+yr`MI~-e`8Jr+@N5 zdS>6jsPENeb@l98%oN49!~DNMfKDf)U!0zvRw_{W{&e`*-nqGXpa9se>qaWoYPeV| z+J!NROgi-ktn?#2H?L30G0ZN8xYO_m;e9(07*qoM6N<$ Ef;2o#-~a#s literal 0 HcmV?d00001 diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/fichaaptidao.png b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/fichaaptidao.png new file mode 100644 index 0000000000000000000000000000000000000000..ce2d52a5c25497556c313c67910a298b28ced799 GIT binary patch literal 5335 zcmV;|6e#P7P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@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<^4sP$je z|6Yv9=(4RT@N6=Ul#|Uqw>8iPQB?NTuWbff*ArMgP9#dfUc8Ep%FoWfVs&!;Yf0hF zhgmddXK%RzXZCuuSDXI;Rdc#g0onZm(9md-m55>0eqFP7J>+E+H$w zJ#O#N(nc>3Wn=5`diQRQEu~3QoM~rgy!>t1q3-Ap>3_}WZ6g!pcOl4^cG}BN zySqPO#wpq3N1Sf#gg+!Pu*xzX6`wL)Z}sNw9bD<}CD{gLhwWXXONld3MS9lY?hJ(? zs{qTq58dL2A-^g2!uP&wTF#xX)*a-?`vuP=l~!p||B(silUwT=X&J9dX+6Yg6&xRv zw1b+p%}r7ExZp$&ve@`SrY4>dumDRJqNbwr%%mq{K7Er@1vec{aRv?47cxDVJtli# zx?g+TlcDjxUBzF$^2DCXZ@Bl}OfoS(LHc05rLBj)&pW8I`FgcSUYnI-*4o@za`Jt7 e7|-!7`gAixEA!pNv*Q~EJkopmpjyW+?Ee6W{lvZi literal 0 HcmV?d00001 diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/processo.png b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/estrutura/icons/processo.png new file mode 100644 index 0000000000000000000000000000000000000000..f8ea33ee0972f578d83af4457ced45dfe88e1bd5 GIT binary patch literal 5364 zcmVKLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA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R2D&$b}-%GzWeI;zxUeZH}*pa f#BuV#-v2!SPPn%4U~8wz00000NkvXXu0mjfQQU)F literal 0 HcmV?d00001 diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/consulta.png b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/consulta.png new file mode 100644 index 0000000000000000000000000000000000000000..f07be69bb3b61b9afb20e258a9c88ad965975056 GIT binary patch literal 5017 zcmV;K6K3p*P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-eP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g- zNs*T^CpQ;Prvs_!=`gjngX6gHu6K5dSs8PO~P-5)$c`grniTq9CGZLD6B8(X=KWPi&iL^96M# zMw@|7Q-}x83zK$84pdTF>P*DrZ*JPS0a-cOXg%A3!GIszw*Cr)<8Z^xH{o1+J92X7 z;LFA@vF4UrP*%DS*>kd1eN?sgop31pkkM!yQC0P_J(|?i{r!Ex^|!5~Ma6}%Sd2(b zap9Hi+p+5(I{{EcM`K_Nxaz8_Q8a%(ZoKgZ%$t{wveI&tm6hG0>)Kqe*Ng1z>?;FQ zbNEPAG%`v6p!2Kqc=+L;;qZ|I(5Z&{;|+)mhme<-54+8dM<06xY3Xiok_f+l5M7;} zuMprY&+~A(T$c@$v}G-4o7Zmn#TGI=9E8v3Lr-592zcaX<>9N&c0Bvcvrv?Al$S4p zEXfE2qfiwEpVidBlaf;J_ISn!At+z82ni*Q##6p2V}B=wZvFB4lf8X?9l@b+Kolh8 z=gvoFS~dp!{g5RY2R=Q3`Y(=SY%GeMyLO?!w+DMa-aFpX-13UeX8XWwHp65z!R2y6 zlH~8NkilSBY%mzW5pKQewtx7CKmHlMlRiBA>t|pv8W4{sU~^dE^EJZdc4IVp7>!>x z1_;k>9SMy<)AS3|I*?-BJRZ-U zo0oS_etrSs@dRX9LSD`o3^-2IGZJ8hl%AntW{LR;2uefgM5+sxa z>OMb;zwi9p!RwYT2M_)(j^hR|#~W7!2tZU6#m5Hx{(tS?w|}yc?Szm`6YpC=T;U*B jvbz7fhkgJ8@ZSLdgw@F#p4gh|00000NkvXXu0mjfS`M3t literal 0 HcmV?d00001 diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/ecds.png b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/ecds.png new file mode 100644 index 0000000000000000000000000000000000000000..4aa424d166f44d67936548370c6faa20b94481b9 GIT binary patch literal 6286 zcmV;97;)!`P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-R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G0ZN8xYO_m;e9(07*qoM6N<$ Ef;2o#-~a#s literal 0 HcmV?d00001 diff --git a/tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/fichaaptidao.png b/tags/teg/SIPRPSoft/src/siprp/medicina/processo/icons/fichaaptidao.png new file mode 100644 index 0000000000000000000000000000000000000000..ce2d52a5c25497556c313c67910a298b28ced799 GIT binary patch literal 5335 zcmV;|6e#P7P)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=b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src/siprp/pesquisas/PesquisasProvider.java new file mode 100644 index 00000000..632d8b18 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/pesquisas/PesquisasProvider.java @@ -0,0 +1,751 @@ +/* + * EstatisticasProvider.java + * + * Created on 3 de Junho de 2004, 18:23 + */ + +package siprp.pesquisas; + +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.db.keyretrievers.*; +import com.evolute.utils.metadb.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.sql.expression.*; + +import siprp.data.*; +/** + * + * @author fpalma + */ +public class PesquisasProvider extends MetaProvider +{ + private static final Object LOCK = new Object(); + private static PesquisasProvider instance = null; + private final Executer executer; + + private static final int TIPOS_OCASIONAL[] = + new int[]{ 5, //mudanca de posto + 6, //mudancas das condicoes + -1, //apos 30 dias + 4, //iniciativa do medico + 3, //pedido do trabalhador + 2, //acidente de trabalho + 1, //Doenca subita + -1, //Cessacao do contrato + 10 //Outras razoes + }; + public static final String DESCRICAO_TIPOS_OCASIONAL[] = + new String[]{ "MUDAN\u00C7A DE POSTO DE TRABALHO", + "ALTERA\u00C7\u00D5ES NO POSTO DE TRABALHO", + "REGRESSO AO TRABALHO AP\u00D3S AUS\u00CANCIA SUPERIOR A 30 DIAS", + "INICIATIVA DO M\u00C9DICO", + "PEDIDO DO TRABALHADOR", + "ACIDENTE DE TRABALHO", + "DOEN\u00C7A S\u00DABITA", + "POR CESSA\u00C7\u00C3O DO CONTRATO DE TRABALHO", + "OUTRAS RAZ\u00D5ES" }; + + private static final int TIPOS_EXAME[] = + new int[]{ 1, //admissao + 2, //periodico + 3 //ocasional + }; + private static final int TIPO_OCASIONAL = 3; + + public static final String DESCRICAO_TIPOS_EXAME[] = + new String[]{ "TOTAL DE EXAMES DE ADMISS\u00C3O", + "TOTAL DE EXAMES PERI\u00D3DICOS", + "TOTAL DE EXAMES OCASIONAIS" }; + + public static final String PAR_ANO = "PAR_ANO"; + public static final String PAR_EMPRESA = "PAR_EMPRESA"; + public static final String PAR_ESTABELECIMENTO = "PAR_ESTABELECIMENTO"; + public static final String PAR_TIPO_EXAME = "PAR_TIPO_EXAME"; + public static final String PAR_RESULTADO = "PAR_RESULTADO"; + public static final String PAR_SEXO = "PAR_SEXO"; + public static final String PAR_GRUPO_ETARIO = "PAR_GRUPO_ETARIO"; + + /** Creates a new instance of EstatisticasProvider */ + public PesquisasProvider() throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); + executer = dbm.getSharedExecuter( this ); + } + + public static MetaProvider getProvider() + throws Exception + { + synchronized( LOCK ) + { + if( instance == null ) + { + instance = new PesquisasProvider(); + } + } + return instance; + } + + public IDObject[] getAllEmpresas() + throws Exception + { + Select select = new Select( new String[]{ "empresas" }, + new String[]{ EmpresaData.ID, EmpresaData.DESIGNACAO_SOCIAL, EmpresaData.DESIGNACAO_SOCIAL_PLAIN }, + new Field( EmpresaData.INACTIVO ).isDifferent( "y" ), + new String[]{ EmpresaData.DESIGNACAO_SOCIAL_PLAIN }, null ); +// Select select = new Select( "SELECT e.id, e.designacao_social FROM empresas e ORDER BY lower( e.designacao_social );" ); + Virtual2DArray array = executer.executeQuery( select ); + IDObject empresas[] = new IDObject[ array.columnLength() ]; + for( int n = 0; n < empresas.length; n++ ) + { + empresas[ n ] = new MappableObject( (Integer)array.get( n, 0 ), array.get( n, 1 ) ); + } + return empresas; + } + + public IDObject []getAllEstabelecimentosForEmpresa( Integer empresaID ) + throws Exception + { + return ( ( siprp.FichaDataProvider )siprp.FichaDataProvider.getProvider() ).getAllEstabelecimentosForEmpresa( empresaID ); + } + + public int[] countTrabalhadoresEstabelecimentoDezembro( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar cal = Calendar.getInstance(); + cal.set( Calendar.YEAR, ano ); + cal.set( Calendar.MONTH, 11 ); + cal.set( Calendar.DAY_OF_MONTH, 30 ); + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "m" ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( cal.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + int contagem[] = new int[ 2 ]; + contagem[ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "f" ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( cal.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + return contagem; + } + + public int[][] countTrabalhadoresEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar eoy = Calendar.getInstance(); + eoy.set( Calendar.YEAR, ano ); + eoy.set( Calendar.MONTH, 11 ); + eoy.set( Calendar.DAY_OF_MONTH, 30 ); + + Calendar today = Calendar.getInstance(); + today.set( Calendar.YEAR, ano ); + today.set( Calendar.MONTH, 11 ); + today.set( Calendar.DAY_OF_MONTH, 31 ); + today.set( Calendar.HOUR_OF_DAY, 23 ); + Calendar age18 = (Calendar) today.clone(); + age18.add( Calendar.YEAR, -18 ); + Calendar age50 = (Calendar) today.clone(); + age50.add( Calendar.YEAR, -50 ); + //0-18 + Select select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "m" ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isGreater( age18.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + int contagem[][] = new int[ 3 ][ 2 ]; + contagem[ 0 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "f" ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isGreater( age18.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 0 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + //18-49 + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "m" ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isLessOrEqual( age18.getTime() ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isGreater( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 1 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "f" ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isLessOrEqual( age18.getTime() ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isGreater( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 1 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + + //50- + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "m" ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isLessOrEqual( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 2 ][ 0 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + select = + new Select( new String[]{ "trabalhadores" }, + new String[]{ "COUNT(" + TrabalhadorData.ID + ")" }, + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ).and( + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( "f" ) ).and( + new Field( TrabalhadorData.DATA_NASCIMENTO ).isLessOrEqual( age50.getTime() ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ).and( + new Par( new Field( TrabalhadorData.DATA_DEMISSAO ).isGreater( eoy.getTime() ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ) ); + array = executer.executeQuery( select ); + contagem[ 2 ][ 1 ] = ( ( Number ) array.get( 0, 0 ) ).intValue(); + + return contagem; + } + + public int[][] countExamesEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar today = Calendar.getInstance(); + today.set( Calendar.YEAR, ano ); + today.set( Calendar.MONTH, 11 ); + today.set( Calendar.DAY_OF_MONTH, 31 ); + today.set( Calendar.HOUR_OF_DAY, 23 ); + Calendar age18 = (Calendar) today.clone(); + age18.add( Calendar.YEAR, -18 ); + Calendar age50 = (Calendar) today.clone(); + age50.add( Calendar.YEAR, -50 ); + Calendar dates[] = new Calendar[]{ null, age18, age50, null }; + String sexos[] = new String[]{ "m", "f" }; + + int contagem[][] = new int[ 4 ][ 6 ]; + for( int t = 0; t < TIPOS_EXAME.length; t++ ) + { + for( int s = 0; s < sexos.length; s++ ) + { + for( int d = 0; d < dates.length - 1; d++ ) + { + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "DISTINCT trabalhadores.id, exames.data" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( sexos[s] ) ).and( + new Field( "YEAR( exames.data )" ).isEqual( new Integer( ano ) ) ).and( + dates[ d ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadorData.DATA_NASCIMENTO ).isLessOrEqual( dates[ d ].getTime() ) ).and( + dates[ d + 1 ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadorData.DATA_NASCIMENTO ).isGreater( dates[ d + 1 ].getTime() ) ).and( + new Field( "exames.tipo" ).isEqual( new Integer( TIPOS_EXAME[ t ] ) ) ).and( + new Field( "exames.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + try + { + Virtual2DArray array = executer.executeQuery( select ); + contagem[ t ][ s * 3 + d ] = array.columnLength(); +//System.out.println( select + ": " + contagem[ t ][ s * 3 + d ] ); + } + catch( Exception ex ) + { + contagem[ t ][ s * 3 + d ] = -1; + } + } + } + } + + return contagem; + } + + public int[][] countExamesOcasionaisEstabelecimentoDezembroPorGrupoEtario( Integer estabelecimentoID, int ano ) + throws Exception + { + Calendar today = Calendar.getInstance(); + today.set( Calendar.YEAR, ano ); + today.set( Calendar.MONTH, 11 ); + today.set( Calendar.DAY_OF_MONTH, 31 ); + today.set( Calendar.HOUR_OF_DAY, 23 ); + Calendar age18 = (Calendar) today.clone(); + age18.add( Calendar.YEAR, -18 ); + Calendar age50 = (Calendar) today.clone(); + age50.add( Calendar.YEAR, -50 ); + Calendar dates[] = new Calendar[]{ null, age18, age50, null }; + String sexos[] = new String[]{ "m", "f" }; + + int contagem[][] = new int[ TIPOS_OCASIONAL.length ][ ( dates.length - 1 ) * sexos.length ]; + for( int t = 0; t < TIPOS_OCASIONAL.length; t++ ) + { + for( int s = 0; s < sexos.length; s++ ) + { + for( int d = 0; d < dates.length - 1; d++ ) + { + if( TIPOS_OCASIONAL[t] == -1 ) + { + contagem[ t ][ s * 3 + d ] = -1; + continue; + } + + Select select = + new Select( new String[]{ "exames", "trabalhadores" }, + new String[]{ "DISTINCT trabalhadores.id, exames.data" }, + new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ).and( + new Field( "exames.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( sexos[s] ) ).and( + new Field( "YEAR( exames.data )" ).isEqual( new Integer( ano ) ) ).and( + dates[ d ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadorData.DATA_NASCIMENTO ).isLessOrEqual( dates[ d ].getTime() ) ).and( + dates[ d + 1 ] == null ? new Field( "exames.id" ).isDifferent( null ) : + new Field( TrabalhadorData.DATA_NASCIMENTO ).isGreater( dates[ d + 1 ].getTime() ) ).and( + new Field( "exames.tipo" ).isEqual( new Integer( 3 ) ) ).and( + new Field( "exames.ocasional" ).isEqual( new Integer( TIPOS_OCASIONAL[ t ] ) ) ).and( + new Field( "exames.inactivo" ).isDifferent( "y" ) ).and( + new Field( "trabalhadores.inactivo" ).isDifferent( "y" ) ) ); + try + { + Virtual2DArray array = executer.executeQuery( select ); + contagem[ t ][ s * 3 + d ] = array.columnLength(); + } + catch( Exception ex ) + { + contagem[ t ][ s * 3 + d ] = -1; + } + } + } + } + + return contagem; + } + + public double[] countNumeroMedioTrabalhadoresEmpresa( Integer empresaID, int ano ) + throws Exception + { + double contagens[] = new double[ 2 ];; + Select select; + String sexos[] = new String[]{ "m", "f" }; + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "COUNT(trabalhadores.id)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLess( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and( + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_DEMISSAO + ")" ).isGreater( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + contagens[ n ] = ( ( Number ) array.get( 0, 0 ) ).doubleValue(); + } + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "SUM( MONTH( data_demissao ) )" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLess( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and( + new Field( "YEAR(" + TrabalhadorData.DATA_DEMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); +System.out.println( "SELECT: " + select ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.get( 0, 0 ) != null ) + { + contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0; + } + } + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "SUM( ( 1 + 12 - MONTH( data_admissao ) ) )" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_DEMISSAO + ")" ).isGreater( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.get( 0, 0 ) != null ) + { + contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0; + } + } + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "SUM( ( 1 + MONTH( data_demissao ) - MONTH( data_admissao ) ) )" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Field( "YEAR(" + TrabalhadorData.DATA_DEMISSAO + ")" ).isEqual( new Integer( ano ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + if( array.get( 0, 0 ) != null ) + { + contagens[ n ] += ( ( Number ) array.get( 0, 0 ) ).doubleValue() / 12.0; + } + } + + return contagens; + } + + public double[] countNumeroTotalTrabalhadoresEmpresa( Integer empresaID, int ano ) + throws Exception + { + double contagens[] = new double[ 2 ];; + Select select; + String sexos[] = new String[]{ "m", "f" }; + + for( int n = 0; n < sexos.length; n++ ) + { + select = + new Select( new String[]{ "estabelecimentos", "trabalhadores" }, + new String[]{ "COUNT(trabalhadores.id)" }, + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ).and( + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_ADMISSAO + ")" ).isLessOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_ADMISSAO ).isEqual( null ) ) ) ).and( + new Par( new Field( "YEAR(" + TrabalhadorData.DATA_DEMISSAO + ")" ).isGreaterOrEqual( new Integer( ano ) ).or( + new Field( TrabalhadorData.DATA_DEMISSAO ).isEqual( null ) ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( TrabalhadorData.SEXO ).isEqual( sexos[ n ] ) ).and( + new Field( "trabalhadores.inactivo" ).isEqual( "n" ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + contagens[ n ] = ( ( Number ) array.get( 0, 0 ) ).doubleValue(); + } + return contagens; + } + + public String []getNomesExames() + throws Exception + { + String nomes[]; + Select select = + new Select( new String[]{ "tipos_exames_comp" }, + new String[]{ "descricao", "ordem" }, + null, + new String[]{ "ordem" }, null ); + Virtual2DArray array = executer.executeQuery( select ); + nomes = new String[ array.columnLength() ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + nomes[ n ] = ( String )array.get( n, 0 ); + } + return nomes; + } + + public int []countExamesComplementaresEmpresa( Integer empresaID, int ano ) + throws Exception + { +// Vector perfis[] = new Vector[ 2 ]; +// Hashtable contagens[] = new Hashtable[ 2 ]; +// Select select; +// Virtual2DArray array; +// +// for( int p = 0; p < 2; p++ ) +// { +// Integer pAux = new Integer( p + 1 ); +// perfis[ p ] = new Vector(); +// select = new Select( new String[]{"estabelecimentos", "trabalhadores", "marcacoes_trabalhador"}, +// new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadorData.PERFIL }, +// new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( +// new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( +// new Field( "empresa_id" ).isEqual( empresaID ) ).and( +// new Field( MarcacaoTrabalhadorData.TIPO ).isEqual( new Integer( MarcacaoTrabalhadorData.TIPO_EXAMES ) ) ).and( +// new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( +// new Field( MarcacaoTrabalhadorData.ESTADO ).in( new Integer[]{ new Integer( 1 ), new Integer( 2 ) } ) ) ).and( +// new Field( "trabalhadores.perfil" ).isEqual( pAux ) ) ); +// array = executer.executeQuery( select ); +// +// select = +// new Select( new String[]{ "prt_elementos_protocolo", "prt_tipos_elementos_protocolo" }, +// new String[]{ "DISTINCT prt_tipos_elementos_protocolo.grupo_protocolo_id" }, +// new Field( "prt_elementos_protocolo.empresa_id" ).isEqual( empresaID ).and( +// new Field( "prt_elementos_protocolo.tipo_elemento_protocolo_id" ).isEqual( new Field( "prt_elementos_protocolo.id" ) ) ).and( +// new Field( "pr_elementos_protocolo.perfil" ).isEqual( new Integer( p + 1 ) ) ) ); +// array = executer.executeQuery( select ); +// for( int ecd = 0; ecd < array.columnLength(); ecd++ ) +// { +// perfis[ p ].add( ( Integer ) array.get( 0, 0 ) ); +// } +// } +// +// +// return contagens; + + + int contagens[]; + Select select; + select = new Select( new String[]{"empresas"}, new String[]{ "perfil_1", "perfil_2" }, + new Field( "id" ).isEqual( empresaID ) ); + Virtual2DArray array = executer.executeQuery( select ); + String p1Str = (String)array.get( 0, 0 ); + String p2Str = (String)array.get( 0, 1 ); + Number perfil1 = ( p1Str != null && p1Str.length() > 0 )?new Integer( p1Str ):null; + Number perfil2 = ( p2Str != null && p2Str.length() > 0 )?new Integer( p2Str ):null; + select = + new Select( new String[]{ "tipos_exames_comp" }, + new String[]{ "id", "ordem" }, + null, + new String[]{ "ordem" }, null ); + array = executer.executeQuery( select ); + contagens = new int[ array.columnLength() ]; + Hashtable idExames = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + idExames.put( ( Number )array.get( n, 0 ), new Integer( n ) ); + } + if( perfil1 == null && perfil2 == null ) + { + return contagens; + } + else if( perfil1 == null ) + { + perfil1 = perfil2; + } + else if( perfil2 == null ) + { + perfil2 = perfil1; + } + select = new Select( new String[]{"estabelecimentos", "trabalhadores", "marcacoes_trabalhador"}, + new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadorData.PERFIL }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( new Field( "estabelecimentos.id" ) ) ).and( + new Field( "empresa_id" ).isEqual( empresaID ) ).and( + new Field( MarcacaoTrabalhadorData.TIPO ).isEqual( new Integer( MarcacaoTrabalhadorData.TIPO_EXAMES ) ) ).and( + new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( + new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ), + new String[]{ TrabalhadorData.PERFIL }, + new String[]{ TrabalhadorData.PERFIL } ); + array = executer.executeQuery( select ); + int numeroExames[] = new int[ 2 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = (Integer)array.get( n, 1 ); + if( perfil == null || perfil.intValue() == 1 ) + { + numeroExames[0] += ( (Number) array.get( n, 0 ) ).intValue(); + } + else if( perfil.intValue() == 2 ) + { + numeroExames[1] += ( (Number) array.get( n, 0 ) ).intValue(); + } + } + + Hashtable hash = new Hashtable(); + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil1 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[0] * multiplicador.intValue(); + } + } + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil2 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[1] * multiplicador.intValue(); + } + } + return contagens; + } + + public int []countExamesComplementaresEstabelecimento( Integer estabelecimentoID, int ano ) + throws Exception + { + int contagens[]; + Select select; + select = new Select( new String[]{"estabelecimentos", "empresas"}, + new String[]{ "empresas.perfil_1", "empresas.perfil_2" }, + new Field( "estabelecimentos.id" ).isEqual( estabelecimentoID ).and( + new Field( "estabelecimentos.empresa_id" ).isEqual( new Field( "empresas.id" ) ) ) ); + Virtual2DArray array = executer.executeQuery( select ); + String p1Str = (String)array.get( 0, 0 ); + String p2Str = (String)array.get( 0, 1 ); + Number perfil1 = ( p1Str != null && p1Str.length() > 0 )?new Integer( p1Str ):null; + Number perfil2 = ( p2Str != null && p2Str.length() > 0 )?new Integer( p2Str ):null; + select = + new Select( new String[]{ "tipos_exames_comp" }, + new String[]{ "id", "ordem" }, + null, + new String[]{ "ordem" }, null ); + array = executer.executeQuery( select ); + contagens = new int[ array.columnLength() ]; + Hashtable idExames = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + idExames.put( ( Number )array.get( n, 0 ), new Integer( n ) ); + } + if( perfil1 == null && perfil2 == null ) + { + return contagens; + } + else if( perfil1 == null ) + { + perfil1 = perfil2; + } + else if( perfil2 == null ) + { + perfil2 = perfil1; + } + select = new Select( new String[]{"trabalhadores", "marcacoes_trabalhador"}, + new String[]{"COUNT(marcacoes_trabalhador.id)", TrabalhadorData.PERFIL }, + new Field( "marcacoes_trabalhador.trabalhador_id" ).isEqual( new Field( "trabalhadores.id" ) ).and( + new Field( "trabalhadores.estabelecimento_id" ).isEqual( estabelecimentoID ) ).and( + new Field( MarcacaoTrabalhadorData.TIPO ).isEqual( new Integer( MarcacaoTrabalhadorData.TIPO_EXAMES ) ) ).and( + new Field( "YEAR( marcacoes_trabalhador.data ) " ).isEqual( new Integer( ano ) ).and( + new Field( Marcacao.REALIZADA ).isEqual( "y" ) ) ), + new String[]{ TrabalhadorData.PERFIL }, + new String[]{ TrabalhadorData.PERFIL } ); + array = executer.executeQuery( select ); + int numeroExames[] = new int[ 2 ]; + for( int n = 0; n < array.columnLength(); n++ ) + { + Integer perfil = (Integer)array.get( n, 1 ); + if( perfil == null || perfil.intValue() == 1 ) + { + numeroExames[0] += ( (Number) array.get( n, 0 ) ).intValue(); + } + else if( perfil.intValue() == 2 ) + { + numeroExames[1] += ( (Number) array.get( n, 0 ) ).intValue(); + } + } + + Hashtable hash = new Hashtable(); + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil1 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[0] * multiplicador.intValue(); + } + } + select = new Select( new String[]{ "exames_perfis" }, + new String[]{ "tipo", "multiplicador" }, + new Field( "perfil" ).isEqual( perfil2 ) ); + array = executer.executeQuery( select ); + for( int n = 0; n < array.columnLength(); n++ ) + { + Number tipo = (Number) array.get( n, 0 ); + if( tipo == null ) + { + continue; + } + Number multiplicador = (Number) array.get( n, 1 ); + if( multiplicador == null ) + { + multiplicador = new Integer( 1 ); + } + if( idExames.containsKey( tipo ) ) + { + int pos = ((Integer)idExames.get( tipo )).intValue(); + contagens[ pos ] += numeroExames[1] * multiplicador.intValue(); + } + } + return contagens; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/pesquisas/PesquisasWindow.java b/tags/teg/SIPRPSoft/src/siprp/pesquisas/PesquisasWindow.java new file mode 100644 index 00000000..c08d21b1 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/pesquisas/PesquisasWindow.java @@ -0,0 +1,578 @@ +/* + * PesquisasWindow.java + * + * Created on 3 de Junho de 2004, 18:13 + */ + +package siprp.pesquisas; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.data.*; +import com.evolute.utils.documents.*; +import com.evolute.utils.jdo.*; +import com.evolute.utils.tables.*; +import com.evolute.utils.tracker.*; +import com.evolute.utils.ui.*; +import com.evolute.utils.ui.text.*; + +import siprp.data.*; + +/** + * + * @author fpalma + */ +public class PesquisasWindow extends JFrame + implements TrackableWindow, ListSelectionListener, ActionListener +{ + private JDOProvider JDO; + private PesquisasProvider provider; + + private JTextField anoText; + private BaseTable empresasTable; + private VectorTableModel empresasModel; + private BaseTable estabelecimentosTable; + private VectorTableModel estabelecimentosModel; + private JButton pesquisarButton; + private JButton exportarButton; + private JEditorPane resultadoText; + +// public static void main( String args[] ) +// throws Exception +// { +// new PesquisasWindow().show(); +// } + + /** Creates a new instance of PesquisasWindow */ + public PesquisasWindow() + throws Exception + { + provider = (PesquisasProvider)PesquisasProvider.getProvider(); + JDO =( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); + setupComponents(); + } + + private void setupComponents() + { + setSize( 1000, 700 ); + setTitle( "Relat\u00f3rio Anual" ); + + JLabel anoLabel = new JLabel( "Ano" ); + anoText = new JTextField(); + anoText.setDocument( new YearDocument() ); + anoText.setPreferredSize( new Dimension( 50, 20 ) ); + new CopyPasteHandler( anoText ); + + empresasModel = new VectorTableModel( new String[]{ "Designa\u00e7\u00e3o Social" } ); + empresasTable = new BaseTable( empresasModel ); + empresasTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + empresasTable.setNonResizableNorReordable(); + empresasTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane empresasScroll = new JScrollPane(); + empresasScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Empresa" ) ); + empresasScroll.setViewportView( empresasTable ); + empresasScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + empresasScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + empresasScroll.getVerticalScrollBar().setBlockIncrement(20); + + estabelecimentosModel = new VectorTableModel( new String[]{ "Nome" } ); + estabelecimentosTable = new BaseTable( estabelecimentosModel ); + estabelecimentosTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); + estabelecimentosTable.setNonResizableNorReordable(); + estabelecimentosTable.getSelectionModel().addListSelectionListener( this ); + JScrollPane estabelecimentosScroll = new JScrollPane(); + estabelecimentosScroll.setBorder( BorderFactory.createTitledBorder( + BorderFactory.createEtchedBorder(), "Estabelecimento" ) ); + estabelecimentosScroll.setViewportView( estabelecimentosTable ); + estabelecimentosScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + estabelecimentosScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + pesquisarButton = new JButton( "Pesquisar" ); + pesquisarButton.addActionListener( this ); + exportarButton = new JButton( "Exportar" ); + exportarButton.addActionListener( this ); + + resultadoText = new JEditorPane( "text/html", "" ); + resultadoText.setEditable( false ); +// resultadoText.setLineWrap( true ); +// resultadoText.setWrapStyleWord( true ); + new CopyPasteHandler( resultadoText ); + JScrollPane resultadoScroll = new JScrollPane(); + resultadoScroll.setViewportView( resultadoText ); + resultadoScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + resultadoScroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); + + JPanel pad; + + GridBagLayout gridbag = new GridBagLayout(); + getContentPane().setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 5, 5, 5, 5 ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + JPanel anoPanel = new JPanel(); + anoPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); + anoPanel.add( anoLabel ); + anoPanel.add( anoText ); + gridbag.setConstraints( anoPanel, constraints ); + getContentPane().add( anoPanel ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.2; + constraints.gridheight = 2; + constraints.weightx = 0.3; + constraints.gridwidth = 3; + gridbag.setConstraints( empresasScroll, constraints ); + getContentPane().add( empresasScroll ); + + gridbag.setConstraints( estabelecimentosScroll, constraints ); + getContentPane().add( estabelecimentosScroll ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.HORIZONTAL; + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0; + constraints.gridwidth = 1; + JPanel buttonPanel = new JPanel(); + buttonPanel.setLayout( new GridLayout( 1, 2 ) ); + buttonPanel.add( pesquisarButton ); + buttonPanel.add( exportarButton ); + gridbag.setConstraints( buttonPanel, constraints ); + getContentPane().add( buttonPanel ); + + constraints.weighty = 0; + constraints.gridheight = 1; + constraints.weightx = 0.4; + constraints.gridwidth = GridBagConstraints.REMAINDER; + pad = new JPanel(); + gridbag.setConstraints( pad, constraints ); + getContentPane().add( pad ); + + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0.8; + constraints.gridheight = GridBagConstraints.REMAINDER; + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( resultadoScroll, constraints ); + getContentPane().add( resultadoScroll ); + } + + private boolean close() + { + setVisible( false ); + dispose(); + return true; + } + + public boolean closeIfPossible() + { + return close(); + } + + public void open() + { + empresasTable.clearSelection(); + try + { + IDObject empresas[] = provider.getAllEmpresas(); + empresasModel.setValues( new Vector( Arrays.asList( empresas ) ) ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + } + setVisible( true ); + } + + public void refresh() + { + } + + public void valueChanged( ListSelectionEvent e ) + { + Object source = e.getSource(); + if( source.equals( empresasTable.getSelectionModel() ) ) + { + estabelecimentosTable.clearSelection(); + int selected = empresasTable.getSelectedRow(); + if( selected == -1 ) + { + return; + } + IDObject empresa = (IDObject) empresasModel.getRowAt( selected ); + estabelecimentosModel.clearAll(); + IDObject estabelecimentos[]; + try + { + estabelecimentos = provider.getAllEstabelecimentosForEmpresa( empresa.getID() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar os estabelecimentos", true ); + return; + } + Vector v = new Vector( Arrays.asList( estabelecimentos ) ); + v.add( new MappableObject( new Integer( -1 ), "TODOS" ) ); + estabelecimentosModel.setValues( v ); + } +/* else if( source.equals( estabelecimentosTable.getSelectionModel() ) ) + { + }*/ + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( pesquisarButton ) ) + { + int sEmpresa = empresasTable.getSelectedRow(); + int sEstabelecimento = estabelecimentosTable.getSelectedRow(); + String anoStr = anoText.getText(); + int ano = ( anoStr.length() != 0 )? Integer.parseInt( anoStr ): -1; + if( sEmpresa == -1 || ano == -1 ) + { + JOptionPane.showMessageDialog( this, "Tem de escolher ano e empresa", "Erro...", + JOptionPane.ERROR_MESSAGE ); + return; + } + StringBuffer buff = new StringBuffer(); + buff.append( "ANO: " ); + buff.append( "" + ano + "
" ); + buff.append( "
EMPRESA
" ); + try + { + Integer idEmpresa = ( (IDObject)empresasModel.getRowAt( sEmpresa ) ).getID(); + EmpresaData empresa = (EmpresaData)JDO.load( EmpresaData.class, idEmpresa ); + buff.append( " DESIGNA\u00C7\u00C3O SOCIAL: " ); + String designacao = (String)empresa.get( EmpresaData.DESIGNACAO_SOCIAL ); + buff.append( "" + ( designacao == null ? "" : designacao.trim() ) + "
" ); + buff.append( " MORADA: " ); + String morada = (String)empresa.get( EmpresaData.MORADA ); + buff.append( "" + ( morada == null ? "" : morada.trim() ) + "
" ); + buff.append( " LOCALIDADE: " ); + String localidade = ( String ) empresa.get( EmpresaData.LOCALIDADE ); + buff.append( "" + ( localidade == null ? "" : localidade.trim() ) + "
" ); + buff.append( " C\u00D3DIGO POSTAL: " ); + String codigoPostal = ( String ) empresa.get( EmpresaData.CODIGO_POSTAL ); + buff.append( "" + ( codigoPostal == null ? "" : codigoPostal.trim() ) + "
" ); + ContactoData contacto = (ContactoData)empresa.get( EmpresaData.CONTACTO_2 ); + if( contacto == null ) + { + buff.append( " TELEFONE:
" ); + buff.append( " FAX:
" ); + } + else + { + buff.append( " TELEFONE: " ); + String telefone = ( String ) contacto.get( ContactoData.TELEFONE ); + buff.append( "" + ( telefone == null ? "" : telefone.trim() ) + "
" ); + buff.append( " FAX: " ); + String fax = ( String ) contacto.get( ContactoData.TELEFONE ); + buff.append( "" + ( fax == null ? "" : fax.trim() ) + "
" ); + } + buff.append( " DISTRITO: " ); + String distrito = ( String ) empresa.get( EmpresaData.DISTRITO ); + buff.append( "" + ( distrito == null ? "" : distrito ) + "
" ); + buff.append( " CONCELHO: " ); + String concelho = ( String ) empresa.get( EmpresaData.CONCELHO ); + buff.append( "" + ( concelho == null ? "" : concelho ) + "
" ); + buff.append( " N\u00DAMERO PESSOA COLECTIVA: " ); + String contribuinte = ( String ) empresa.get( EmpresaData.CONTRIBUINTE ); + buff.append( "" + ( contribuinte == null ? "" : contribuinte ) + "
" ); + buff.append( " N\u00DAMERO SEGURAN\u00C7A SOCIAL: " ); + String segSocial = ( String ) empresa.get( EmpresaData.SEGURANCA_SOCIAL ); + buff.append( "" + ( segSocial == null ? "" : segSocial ) + "
" ); + buff.append( " CAE: " ); + String CAE = ( String ) empresa.get( EmpresaData.CAE ); + buff.append( "" + ( CAE == null ? "" : CAE ) + "
" ); + buff.append( "
 N\u00DAMERO M\u00C9DIO DE TRABALHADORES DURANTE O ANO" ); + double contagemMedia[] = provider.countNumeroMedioTrabalhadoresEmpresa( idEmpresa, ano ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( ""); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "
    TOTAL HOMENS MULHERES
  TOTAL " + (int)( Math.round( contagemMedia[0] ) + Math.round( contagemMedia[1] ) ) + " " + ( (int)Math.round( contagemMedia[0] ) ) + " " + ( (int)Math.round( contagemMedia[1] ) ) + "
" ); + buff.append( "
 N\u00DAMERO TOTAL DE TRABALHADORES DURANTE O ANO" ); + double contagemTotal[] = provider.countNumeroTotalTrabalhadoresEmpresa( idEmpresa, ano ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( ""); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "
    TOTAL HOMENS MULHERES
  TOTAL " + (int)( Math.round( contagemTotal[0] ) + Math.round( contagemTotal[1] ) ) + " " + ( (int)Math.round( contagemTotal[0] ) ) + " " + ( (int)Math.round( contagemTotal[1] ) ) + "
" ); + + IDObject estabelecimentos[]; + if( sEstabelecimento == -1 || ( ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ) ).getID().equals( new Integer( -1 ) ) ) + { + estabelecimentos = provider.getAllEstabelecimentosForEmpresa( idEmpresa ); + } + else + { + estabelecimentos = new IDObject[ 1 ]; + estabelecimentos[ 0 ] = ( IDObject )estabelecimentosModel.getRowAt( sEstabelecimento ); + } + buff.append( "
" ); + buff.append( "
 ESTABELECIMENTOS
" ); + buff.append( "
" ); + for( int n = 0; n < estabelecimentos.length; n++ ) + { + EstabelecimentoData estabelecimento = (EstabelecimentoData)JDO.load( EstabelecimentoData.class, estabelecimentos[ n ].getID() ); + buff.append( "  NOME: " ); + String nome = (String)estabelecimento.get( EstabelecimentoData.NOME ); + buff.append( "" + ( nome == null ? "" : nome.trim() ) + "
" ); + buff.append( "  MORADA: " ); + morada = (String)estabelecimento.get( EstabelecimentoData.MORADA ); + buff.append( "" + ( morada == null ? "" : morada.trim() ) + "
" ); + buff.append( "  LOCALIDADE: " ); + localidade = (String)estabelecimento.get( EstabelecimentoData.LOCALIDADE ); + buff.append( "" + ( localidade == null ? "" : localidade.trim() ) + "
" ); + buff.append( "  C\u00D3DIGO POSTAL: " ); + codigoPostal = (String)estabelecimento.get( EstabelecimentoData.CODIGO_POSTAL ); + buff.append( "" + ( codigoPostal == null ? "" : codigoPostal.trim() ) + "
" ); + contacto = (ContactoData)estabelecimento.get( EstabelecimentoData.CONTACTO ); + if( contacto == null ) + { + buff.append( "  TELEFONE:
" ); + buff.append( "  FAX:
" ); + } + else + { + buff.append( "  TELEFONE: " ); + String telefone = ( String ) contacto.get( ContactoData.TELEFONE ); + buff.append( "" + ( telefone == null ? "" : telefone.trim() ) + "
" ); + buff.append( "  FAX: " ); + String fax = ( String ) contacto.get( ContactoData.TELEFONE ); + buff.append( "" + ( fax == null ? "" : fax.trim() ) + "
" ); + } + int countTrabalhadores[] = provider.countTrabalhadoresEstabelecimentoDezembro( estabelecimentos[ n ].getID(), ano ); + buff.append( "
" ); + buff.append( "  TRABALHADORES A 31 DE DEZEMBRO DE " + ano + ": " ); + buff.append( "
" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + int countTrabalhadoresEtario[][] = provider.countTrabalhadoresEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" + + "" + + "" + + "" ); + buff.append( "" ); + buff.append( "
   TOTALHOMENSMULHERES
  TOTAL " + ( countTrabalhadores[0] + countTrabalhadores[1] ) + " " + ( countTrabalhadores[0] ) + " " + ( countTrabalhadores[1] ) + "
  MENOS DE 18 ANOS " + ( countTrabalhadoresEtario[0][0] + countTrabalhadoresEtario[0][1] ) + " " + ( countTrabalhadoresEtario[0][0] ) + " " + ( countTrabalhadoresEtario[0][1] ) + "
  18 A 49 ANOS " + ( countTrabalhadoresEtario[1][0] + countTrabalhadoresEtario[1][1] ) + " " + ( countTrabalhadoresEtario[1][0] ) + " " + ( countTrabalhadoresEtario[1][1] ) + "
  MAIS DE 50 ANOS " + ( countTrabalhadoresEtario[2][0] + countTrabalhadoresEtario[2][1] ) + " " + ( countTrabalhadoresEtario[2][0] ) + " " + ( countTrabalhadoresEtario[2][1] ) + "
" ); + buff.append( "
" ); + int countExames[][] = provider.countExamesEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano ); + for( int cE = 0; cE < countExames[ countExames.length - 2 ].length; cE++ ) + { + countExames[ countExames.length - 2 ][ cE ] += countExames[ countExames.length - 1 ][ cE ]; + } + int totais[] = new int[ 6 ]; + for( int cE1 = 0; cE1 < totais.length; cE1++ ) + { + for( int cE2 = 0; cE2 < countExames.length; cE2++ ) + { + totais[ cE1 ] += countExames[ cE2 ][ cE1 ]; + } + } + buff.append( "
" ); + buff.append( "  N\u00DAMERO DE EXAMES DE ADMISS\u00C3O, PERI\u00D3DICOS E OCASIONAIS EFECTUADOS" ); + buff.append( "
" ); + buff.append( "" ); + buff.append( "" + + "" ); + buff.append( "" ); + buff.append( "" ); + for( int t = 0; t < 3; t++ ) + { + buff.append( "" ); + } + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + for( int t = 3; t < 6; t++ ) + { + buff.append( "" ); + } + buff.append( "" ); + String sexos[] = new String[]{ "H", "M" }; + for( int t = 0; t < provider.DESCRICAO_TIPOS_EXAME.length; t++ ) + { + buff.append( "" ); + + for( int s = 0; s < 2; s++ ) + { + buff.append( "" ); + buff.append( "" ); + for( int d = 0; d < 3; d++ ) + { + buff.append( "" ); + } + if( s == 0 ) + { + buff.append( "" ); + } + else + { + buff.append( "" ); + } + } + } + int countExamesOcasionais[][] = provider.countExamesOcasionaisEstabelecimentoDezembroPorGrupoEtario( estabelecimentos[ n ].getID(), ano ); + for( int t = 0; t < provider.DESCRICAO_TIPOS_OCASIONAL.length; t++ ) + { + buff.append( "" ); + + for( int s = 0; s < 2; s++ ) + { + buff.append( "" ); + int sum = countExamesOcasionais[t][s*3]+countExamesOcasionais[t][s*3+1]+countExamesOcasionais[t][s*3+2]; + buff.append( "" ); + for( int d = 0; d < 3; d++ ) + { + int val = countExamesOcasionais[t][s*3+d]; + if( val < 0 ) + { + countExamesOcasionais[t][s*3+d] = 0; + } + buff.append( "" ); + } + if( s == 0 ) + { + buff.append( "" ); + } + else + { + buff.append( "" ); + } + } + } + buff.append( "
      TOTAL INFERIOR A 18 ANOS 18 A 49 ANOS 50 E MAIS ANOS 
   TOTAL DE EXAMES H" + ( totais[0] + totais[1] + totais[2] ) + " " + totais[t] + " 
     M" + ( totais[3] + totais[4] + totais[5] ) + " " + totais[t] + " 
    "+provider.DESCRICAO_TIPOS_EXAME[t]+" " + sexos[ s ] + "" + (countExames[t][s*3]+countExames[t][s*3+1]+countExames[t][s*3+2]) + " " + countExames[t][s*3+d] + " 
    
       "+provider.DESCRICAO_TIPOS_OCASIONAL[t]+" " + sexos[ s ] + "" + ( sum < 0 ? "-" : "" + sum ) + " " + ( val < 0 ? "-" : "" + val ) + " 
       
" ); + buff.append( "
" ); + buff.append( "  EXAMES COMPLEMENTARES REALIZADOS" ); + buff.append( "
" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + String nomesExamesComp[] = provider.getNomesExames(); +// int countExamesComp[] = provider.countExamesComplementaresEmpresa( idEmpresa, ano ); + int countExamesComp[] = provider.countExamesComplementaresEstabelecimento( estabelecimentos[ n ].getID(), ano ); + for( int nec = 0; nec < nomesExamesComp.length; nec++ ) + { + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + buff.append( "" ); + } + buff.append( "
   TIPO DE EXAME N\u00BA TOTAL DE EXAMES
   " + nomesExamesComp[nec] + " " + countExamesComp[nec] + "
" ); + buff.append("


"); + } + + resultadoText.setText( buff.toString() ); + } + catch( Exception ex ) + { + DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); + return; + } + } + else if( source.equals( exportarButton ) ) + { + exportar(); + } + } + + public void exportar() + { + FileDialog dialog = new FileDialog( this, "Ficheiro de destino", FileDialog.SAVE ); + dialog.setDirectory( System.getProperty( "user.home" ) ); + dialog.setVisible( true ); + String fileName; + String dirName; + fileName = dialog.getFile(); + dirName = dialog.getDirectory(); + if( fileName != null ) + { + int index = fileName.indexOf( '.' ); + if( index == -1 ) + { + fileName += ".html"; + } + if( index == fileName.length() - 1 ) + { + fileName += "html"; + } + String fullName = dirName + fileName; + String text = resultadoText.getText(); + String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais"; + String style = ""; + text = text.replace( "", "\n\t\t" + title + "\n" + style ); + text = text.replace( "", "
" ); + text = text.replace( "", "
" ); + text = text.replace( "", "\n
Relatório Anual
" ); +// String title = "S.I.P.R.P. - Sociedade Ibérica de Prevenção de Riscos Profissionais"; +// text = text.replace( "", "\n\t\t" + title + "" ); +// System.out.println( text ); + try + { + FileWriter writer = new FileWriter( new File( fullName ) ); + writer.write( text ); + writer.close(); + } + catch( IOException ex ) + { + DialogException.showException( ex ); + return; + } + } + } +} + diff --git a/tags/teg/SIPRPSoft/src/siprp/update/Update.java b/tags/teg/SIPRPSoft/src/siprp/update/Update.java new file mode 100644 index 00000000..a3298852 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/Update.java @@ -0,0 +1,22 @@ +/* + * Update.java + * + * Created on 26 de Setembro de 2006, 12:13 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update; + +/** + * + * @author fpalma + */ +public interface Update +{ + public double getStartVersion(); + public double getEndVersion(); + public String[] listChanges(); + public void doUpdate() throws Exception; +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/UpdateList.java b/tags/teg/SIPRPSoft/src/siprp/update/UpdateList.java new file mode 100644 index 00000000..8556a30f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/UpdateList.java @@ -0,0 +1,106 @@ +/* + * Updater.java + * + * Created on 26 de Setembro de 2006, 11:49 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update; + +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; + + +/** + * + * @author fpalma + */ +public class UpdateList +{ + protected static final Update UPDATE_LIST[] = + new Update[]{ new siprp.update.updates.V6_1_To_V7_0(), new siprp.update.updates.V7_0_To_V7_2(), + new siprp.update.updates.V7_2_To_V7_4(), new siprp.update.updates.V7_4_To_V7_5(), + new siprp.update.updates.V7_5_To_V7_6(), new siprp.update.updates.V7_6_To_V7_7() }; + + protected static Executer EXECUTER; + protected static double version = -1; + + /** Creates a new instance of Updater */ + private UpdateList() + { + } + + public static double getCurrentVersion() + throws Exception + { + if( version < 0 ) + { + version = getVersion(); + } + return version; + } + + public static Update []getUpdates() + throws Exception + { + if( version < 0 ) + { + version = getVersion(); + } + Vector validUpdates = new Vector(); + for( int n = 0; n < UPDATE_LIST.length; n++ ) + { + if( version <= UPDATE_LIST[ n ].getStartVersion() ) + { + validUpdates.add( UPDATE_LIST[ n ] ); + } + } + return ( Update [] ) validUpdates.toArray( new Update[ validUpdates.size() ] ); + } + + protected static double getVersion() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + EXECUTER = dbm.getSharedExecuter(); + try + { + return readVersion(); + } + catch( Exception ex ) + { + createVersionTable(); + } + return readVersion(); + } + + protected static double readVersion() + throws Exception + { + Select select = + new Select( new String[]{ "version" }, + new String[]{ "MAX(current_version)" }, + null ); + Virtual2DArray array = EXECUTER.executeQuery( select ); + return ( ( Number ) array.get( 0, 0 ) ).doubleValue(); + } + + protected static void createVersionTable() + throws Exception + { + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( "CREATE TABLE version( current_version float );" ); + EXECUTER.executeQuery( update ); + Insert insert = + new Insert( "version", + new Assignment[]{ + new Assignment( new Field( "current_version" ), new Double( 0.1 ) ) } ); + EXECUTER.executeQuery( insert ); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/UpdateWindow.java b/tags/teg/SIPRPSoft/src/siprp/update/UpdateWindow.java new file mode 100644 index 00000000..c432a9e7 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/UpdateWindow.java @@ -0,0 +1,188 @@ +/* + * UpdateWindow.java + * + * Created on 26 de Setembro de 2006, 11:54 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import java.util.*; + +import com.evolute.utils.*; +import com.evolute.utils.date.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.ui.*; + + +/** + * + * @author fpalma + */ +public class UpdateWindow extends JFrame + implements ActionListener +{ + protected JTextArea logText; + protected JButton closeButton; + + protected Update updates[]; + protected String filename; + + public static void main( String args[] ) + { + UpdateWindow updateWindow = new UpdateWindow(); + updateWindow.update(); + } + + /** Creates a new instance of UpdateWindow */ + public UpdateWindow() + { + setupComponents(); + } + + private void setupComponents() + { + setTitle( "Actualiza\u00e7\u00e3o do Software" ); + setSize( 800, 600 ); + logText = new JTextArea(); + logText.setLineWrap( true ); + logText.setWrapStyleWord( true ); + logText.setEditable( true ); + JScrollPane scp = + new JScrollPane( logText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); + closeButton = new JButton( "Fechar" ); + + setLayout( new BorderLayout() ); + add( scp, BorderLayout.CENTER ); + add( closeButton, BorderLayout.SOUTH ); + + closeButton.setEnabled( false ); + closeButton.addActionListener( this ); + + setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); + } + + public void actionPerformed( ActionEvent e ) + { + Object source = e.getSource(); + if( source.equals( closeButton ) ) + { + close(); + } + } + + public void close() + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + setVisible( false ); + dispose(); + } + } ); + } + + public void update() + { + log( "A verificar a exist\u00eancia de actualiza\u00e7\u00f5es...\n" ); + try + { + double version = UpdateList.getCurrentVersion(); + log( "Vers\u00e3o actual: " + ( version < 6.1 ? 6.1 : version ) + "\n" ); + updates = UpdateList.getUpdates(); + } + catch( Exception ex ) + { + setVisible( true ); + log( "Erro a verificar actualiza\u00e7\u00f5es!!!" ); + ex.printStackTrace(); + updates = new Update[ 0 ]; + } + if( updates.length > 0 ) + { + setVisible( true ); + log( "Existe " + ( updates.length > 1 ? "m " : " " ) + updates.length + + " actualiza\u00e7" + ( updates.length > 1 ? "\u00f5es... " : "\u00e3o\n" ) ); + boolean ok = doUpdates(); + if( ok ) + { + log( "**** Actualiza\u00e7\u00f5es terminadas ****\n" ); + } + else + { + log( "**** Actualiza\u00e7\u00f5es abortadas ****\n" ); + log( "\nPode favor contacte a EVOLUTE\n" ); + } + + } + closeButton.setEnabled( true ); + } + + protected void log( final String newLog ) + { + SwingUtilities.invokeLater( new Runnable(){ + public void run() + { + logText.append( newLog ); + } + } ); + } + + protected boolean doUpdates() + { + double last = 0.1; + log( "**** A realizar actualiza\u00e7\u00f5es... **** \n" ); + for( int n = 0; n < updates.length; n++ ) + { + last = updates[ n ].getEndVersion(); + String msg = " " + updates[ n ] + "... \n"; + String changes[] = updates[ n ].listChanges(); + for( int c = 0; c < changes.length; c++ ) + { + msg += " " + changes[ c ] + "\n"; + } + log( msg ); + try + { + updates[ n ].doUpdate(); + } + catch( Exception ex ) + { + log( "ERRO ! ! !\nA abortar actualiza\u00e7\u00f5es\n" ); + ex.printStackTrace(); + return false; + } + } + try + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + Executer executer = dbm.getSharedExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( "version", + new Assignment[]{ + new Assignment( new Field( "current_version" ), new Double( last ) ) }, + null ); + executer.executeQuery( update ); + log( "Vers\u00e3o actualizada para: " + last + "\n" ); + return true; + } + catch( Exception ex ) + { + log( "ERRO ! ! !\nA abortar actualiza\u00e7\u00f5es\n" ); + ex.printStackTrace(); + return false; + } + } + + public int getUpdateCount() + { + return updates.length; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/updates/V6_1_To_V7_0.java b/tags/teg/SIPRPSoft/src/siprp/update/updates/V6_1_To_V7_0.java new file mode 100644 index 00000000..b6a7d176 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/updates/V6_1_To_V7_0.java @@ -0,0 +1,68 @@ +/* + * V6_1_To_V7_0.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; + + +/** + * + * @author fpalma + */ +public class V6_1_To_V7_0 + implements siprp.update.Update +{ + + /** + * Creates a new instance of V6_1_To_V7_0 + */ + public V6_1_To_V7_0() + { + } + + public String []listChanges() + { + return new String[]{ "Acrescentar campo de contribuinte nos prestadores", + "Acrescentar campo de prestador nas marca\u00e7\u00f5es", + "Acrescentar campo de prestador no hist\u00f3rico das marca\u00e7\u00f5es"}; + } + + public double getStartVersion() + { + return 6.1; + } + + public double getEndVersion() + { + return 7.0; + } + + public void doUpdate() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + Executer executer = dbm.getSharedExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( "ALTER TABLE prestadores ADD contribuinte VARCHAR(64);" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( "ALTER TABLE marcacoes_trabalhador ADD prestador_id int4 REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( "ALTER TABLE marcacoes_trabalhador_estados ADD prestador_id int4 REFERENCES prestadores( id );" ); + executer.executeQuery( update ); + } + + public String toString() + { + return "v6.1 para v7.0"; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_0_To_V7_2.java b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_0_To_V7_2.java new file mode 100644 index 00000000..19f7986a --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_0_To_V7_2.java @@ -0,0 +1,75 @@ +/* + * V7_0_To_V7_2.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; + + +/** + * + * @author fpalma + */ +public class V7_0_To_V7_2 + implements siprp.update.Update +{ + + /** + * Creates a new instance of V7_0_To_V7_2 + */ + public V7_0_To_V7_2() + { + } + + public String []listChanges() + { + return new String[]{ "Criar tabela dos processos" }; + } + + public double getStartVersion() + { + return 7.0; + } + + public double getEndVersion() + { + return 7.2; + } + + public void doUpdate() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + Executer executer = dbm.getSharedExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE TABLE marcacoes_processo " + + "( " + + "id serial NOT NULL, " + + "trabalhador_id int4 NOT NULL, " + + "estado char(1) NOT NULL DEFAULT 'a'::bpchar, " + + "data_inicio date, " + + "data_fim date, " + + "CONSTRAINT marcacoes_processo_pkey PRIMARY KEY (id), " + + "CONSTRAINT marcacoes_processo_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) " + + "REFERENCES trabalhadores (id) MATCH SIMPLE " + + "ON UPDATE NO ACTION ON DELETE NO ACTION " + + ") " + + "WITHOUT OIDS;" ); + executer.executeQuery( update ); + } + + public String toString() + { + return "v7.0 para v7.2"; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_2_To_V7_4.java b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_2_To_V7_4.java new file mode 100644 index 00000000..02dcc720 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_2_To_V7_4.java @@ -0,0 +1,210 @@ +/* + * V7_2_To_V7_4.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; + + +/** + * + * @author fpalma + */ +public class V7_2_To_V7_4 + implements siprp.update.Update +{ + + /** + * Creates a new instance of V7_2_To_V7_4 + */ + public V7_2_To_V7_4() + { + } + + public String []listChanges() + { + return new String[]{ "Acrescentar campo de motivo ao processo", + "Criar tabelas de suporte aos processos"}; + } + + public double getStartVersion() + { + return 7.2; + } + + public double getEndVersion() + { + return 7.4; + } + + public void doUpdate() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + Executer executer = dbm.getSharedExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE marcacoes_processo RENAME TO trabalhadores_processo;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_processo ADD motivo int4;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas" + +"(" + +" id serial," + +" trabalhador_id int4 NOT NULL," + +" data date," + +" estado int4," + +" prestador_id int4," + +" processo_id int4," + +" CONSTRAINT trabalhadores_consultas_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_prestador_id_fkey FOREIGN KEY (prestador_id) REFERENCES prestadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_consultas_processo_id_fkey FOREIGN KEY (processo_id) REFERENCES trabalhadores_processo (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_consultas_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) REFERENCES trabalhadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas_datas" + +"(" + +" id serial," + +" data date," + +" trabalhadores_consultas_id int4," + +" estado int4," + +" CONSTRAINT trabalhadores_consultas_datas_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_datas_trabalhadores_consultas_id_fkey FOREIGN KEY (trabalhadores_consultas_id) REFERENCES trabalhadores_consultas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas_datas OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas_datas_emails" + +"(" + +" id serial," + +" trabalhadores_consultas_datas_id int4," + +" destination varchar(512)," + +" data date," + +" subject varchar(512)," + +" body varchar(32768)," + +" CONSTRAINT trabalhadores_consultas_datas_emails_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_data_trabalhadores_consultas_data_fkey1 FOREIGN KEY (trabalhadores_consultas_datas_id) REFERENCES trabalhadores_consultas_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas_datas_emails OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_consultas_datas_observacoes" + +"(" + +" id serial," + +" trabalhadores_consultas_datas_id int4," + +" observacao varchar(4096)," + +" CONSTRAINT trabalhadores_consultas_datas_observacoes_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_consultas_datas_trabalhadores_consultas_data_fkey FOREIGN KEY (trabalhadores_consultas_datas_id) REFERENCES trabalhadores_consultas_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_consultas_datas_observacoes OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds" + +"(" + +" id serial," + +" trabalhador_id int4," + +" estado int4," + +" data date," + +" processo_id int4," + +" CONSTRAINT trabalhadores_ecgs_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_processo_id_fkey FOREIGN KEY (processo_id) REFERENCES trabalhadores_processo (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecgs_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) REFERENCES trabalhadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds_datas" + +"(" + +" id serial," + +" trabalhadores_ecds_id int4," + +" data date," + +" estado int4," + +" CONSTRAINT trabalhadores_ecds_datas_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_datas_trabalhadores_ecds_id_fkey FOREIGN KEY (trabalhadores_ecds_id) REFERENCES trabalhadores_ecds (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds_datas OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecd" + +"(" + +" id int4 NOT NULL," + +" ecd_id int4," + +" ecd_oficial_id int4," + +" prestador_id int4," + +" estado int4," + +" trabalhadores_ecds_id int4," + +" trabalhadores_ecds_datas_id int4," + +" CONSTRAINT trabalhadores_ecg_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecd_trabalhadores_ecds_datas_id_fkey FOREIGN KEY (trabalhadores_ecds_datas_id) REFERENCES trabalhadores_ecds_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecd_trabalhadores_ecds_id_fkey FOREIGN KEY (trabalhadores_ecds_id) REFERENCES trabalhadores_ecds (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecg_ecd_id_fkey FOREIGN KEY (ecd_id) REFERENCES prt_tipos_elementos_protocolo (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecg_ecd_oficial_id_fkey FOREIGN KEY (ecd_oficial_id) REFERENCES ecd_oficial (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_ecg_prestador_id_fkey FOREIGN KEY (prestador_id) REFERENCES prestadores (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecd OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds_datas_emails" + +"(" + +" id serial," + +" trabalhadores_ecds_datas_id int4," + +" destination varchar(512)," + +" data date," + +" subject varchar(512)," + +" body varchar(32768)," + +" CONSTRAINT trabalhadores_ecds_datas_emails_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_datas_email_trabalhadores_ecds_datas_id_fkey FOREIGN KEY (trabalhadores_ecds_datas_id) REFERENCES trabalhadores_ecds_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds_datas_emails OWNER TO postgres;" ); + executer.executeQuery( update ); + update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_ecds_datas_observacoes" + +"(" + +" id serial," + +" trabalhadores_ecds_datas_id int4," + +" observacao varchar(4096)," + +" CONSTRAINT trabalhadores_ecds_datas_observacoes_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_ecds_datas_obser_trabalhadores_ecds_datas_id_fkey FOREIGN KEY (trabalhadores_ecds_datas_id) REFERENCES trabalhadores_ecds_datas (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +") " + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_ecds_datas_observacoes OWNER TO postgres;" ); + executer.executeQuery( update ); + + } + + public String toString() + { + return "v7.2 para v7.4"; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_4_To_V7_5.java b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_4_To_V7_5.java new file mode 100644 index 00000000..792157d0 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_4_To_V7_5.java @@ -0,0 +1,73 @@ +/* + * V7_4_To_V7_5.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; + + +/** + * + * @author fpalma + */ +public class V7_4_To_V7_5 + implements siprp.update.Update +{ + + /** + * Creates a new instance of V7_4_To_V7_5 + */ + public V7_4_To_V7_5() + { + } + + public String []listChanges() + { + return new String[]{ "Ligar processo a ficha de aptid\u00e3o" }; + } + + public double getStartVersion() + { + return 7.4; + } + + public double getEndVersion() + { + return 7.5; + } + + public void doUpdate() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + Executer executer = dbm.getSharedExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "CREATE TABLE trabalhadores_fichas_aptidao" + +"(" + +" id serial," + +" processo_id int4," + +" exame_id int4," + +" CONSTRAINT trabalhadores_fichas_aptidao_pkey PRIMARY KEY (id)," + +" CONSTRAINT trabalhadores_fichas_aptidao_exame_id_fkey FOREIGN KEY (exame_id) REFERENCES exames (id) ON UPDATE RESTRICT ON DELETE RESTRICT," + +" CONSTRAINT trabalhadores_fichas_aptidao_processo_id_fkey FOREIGN KEY (processo_id) REFERENCES trabalhadores_processo (id) ON UPDATE RESTRICT ON DELETE RESTRICT" + +")" + +"WITHOUT OIDS;" + +"ALTER TABLE trabalhadores_fichas_aptidao OWNER TO postgres;" ); + executer.executeQuery( update ); + } + + public String toString() + { + return "v7.4 para v7.5"; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_5_To_V7_6.java b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_5_To_V7_6.java new file mode 100644 index 00000000..af850998 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_5_To_V7_6.java @@ -0,0 +1,63 @@ +/* + * V7_5_To_V7_6.java + * + * Created on 26 de Setembro de 2006, 11:48 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; + + +/** + * + * @author fpalma + */ +public class V7_5_To_V7_6 + implements siprp.update.Update +{ + + /** + * Creates a new instance of V7_5_To_V7_6 + */ + public V7_5_To_V7_6() + { + } + + public String []listChanges() + { + return new String[]{ "Alterar tabela dos processos" }; + } + + public double getStartVersion() + { + return 7.5; + } + + public double getEndVersion() + { + return 7.6; + } + + public void doUpdate() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + Executer executer = dbm.getSharedExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE trabalhadores_processo ADD sub_motivo int4;" ); + executer.executeQuery( update ); + } + + public String toString() + { + return "v7.5 para v7.6"; + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_6_To_V7_7.java b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_6_To_V7_7.java new file mode 100644 index 00000000..f393c465 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/update/updates/V7_6_To_V7_7.java @@ -0,0 +1,71 @@ +/* + * V7_6_To_V7_7.java + * + * Created on May 15, 2007, 3:12 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package siprp.update.updates; + +import com.evolute.utils.Singleton; +import com.evolute.utils.db.DBManager; +import com.evolute.utils.db.Executer; +import com.evolute.utils.sql.Assignment; +import com.evolute.utils.sql.Field; + +/** + * + * @author lflores + */ +public class V7_6_To_V7_7 + implements siprp.update.Update +{ + + /** + * Creates a new instance of V7_6_To_V7_7 + */ + public V7_6_To_V7_7() + { + } + + public String []listChanges() + { + return new String[]{ "Alterar tabela dos exames e criar tabela exames_portaria" }; + } + + public double getStartVersion() + { + return 7.6; + } + + public double getEndVersion() + { + return 7.7; + } + + public void doUpdate() + throws Exception + { + DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); + Executer executer = dbm.getSharedExecuter(); + com.evolute.utils.sql.Update update = + new com.evolute.utils.sql.Update( + "ALTER TABLE exames ADD fo BYTEA;" ); + executer.executeQuery( update ); + update = new com.evolute.utils.sql.Update( + "CREATE TABLE exames_portaria ( id SERIAL NOT NULL, portaria VARCHAR(255) NOT NULL, " + + "data_entrada timestamp without time zone NOT NULL DEFAULT now(), PRIMARY KEY( id ) );" ); + executer.executeQuery( update ); + com.evolute.utils.sql.Insert insert = + new com.evolute.utils.sql.Insert( "exames_portaria", + new Assignment[]{ new Assignment( new Field( "portaria" ), "Portaria n. 299/2007, de 16 de Mar\u00e7o" ) } ); + executer.executeQuery( insert ); + } + + public String toString() + { + return "v" + getStartVersion() + " para v" + getEndVersion(); + } +} diff --git a/tags/teg/SIPRPSoft/src/siprp/web/WebUpdater.java b/tags/teg/SIPRPSoft/src/siprp/web/WebUpdater.java new file mode 100644 index 00000000..cf84448f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp/web/WebUpdater.java @@ -0,0 +1,1210 @@ +/* + * WebUpdater.java + * + * Created on 27 de Outubro de 2004, 15:54 + */ + +package siprp.web; + +import java.awt.*; +import java.awt.event.*; +import java.io.*; +import java.sql.*; +import javax.swing.*; +import javax.swing.event.*; +import java.util.*; + +//import siprp.*; +//import siprp.clientes.*; + +/** + * + * @author fpalma + */ +public class WebUpdater extends JFrame + implements ActionListener, Runnable, DocumentListener +{ + private Connection softwareConnection; + private Connection webConnection; + + public static final String GET_ULTIMA_ACTUALIZACAO = "SELECT stamp FROM actualizacao"; + + public static final String GET_EMPRESAS = + "SELECT id, designacao_social, perfil_1, perfil_2, codigo_1, codigo_2, " + + "codigo_3, cae, contribuinte, seguranca_social, actividade, servicos, morada, " + + "localidade, codigo_postal, distrito, concelho, inactivo, contacto_1 " + + "FROM empresas WHERE actualizacao >= "; + + public static final String GET_EMAIL = + "SELECT email FROM contactos WHERE id = "; + + public static final String GET_ESTABELECIMENTOS = + "SELECT id, empresa_id, nome, contacto, morada, localidade, codigo_postal, inactivo " + + "FROM estabelecimentos WHERE actualizacao >= "; + + public static final String GET_TRABALHADORES = + "SELECT id, nome, sexo, data_nascimento, numero_mecanografico, categoria, estabelecimento_id, data_demissao, inactivo " + + "FROM trabalhadores WHERE actualizacao >= "; + + public static final String GET_CONTACTO = + "SELECT nome, telefone, telemovel, fax, email, cargo FROM contactos WHERE id = "; + + public static final String GET_MARCACOES_ESTABELECIMENTO = + "SELECT id, data, realizada, data_relatorio FROM marcacoes_estabelecimento " + + "WHERE estabelecimento_id = "; + + public static final String GET_EXAMES_TRABALHADOR = + "SELECT id, data, realizada, data_relatorio FROM marcacoes_trabalhador " + + "WHERE tipo = 0 and trabalhador_id = ?trabalhador_id " + + "ORDER BY data"; + + public static final String GET_CONSULTAS_TRABALHADOR = + "SELECT id, data, realizada, data_relatorio FROM marcacoes_trabalhador " + + "WHERE tipo = 1 and trabalhador_id = ?trabalhador_id " + + "ORDER BY data"; + + public static final String GET_ID_FICHA_APTIDAO = + "SELECT MAX(id) FROM exames WHERE trabalhador_id = ?trabalhador_id AND inactivo <> 'y'"; + + public static final String GET_DADOS_FICHA_APTIDAO = + "SELECT data, resultado FROM exames WHERE id = ?id"; + + public static final String DELETE_TRABALHADOR = + "DELETE FROM trabalhadores WHERE id = "; + + public static final String DELETE_TRABALHADORES_BY_ESTABELECIMENTO = + "DELETE FROM trabalhadores WHERE estabelecimento_id = "; + + public static final String DELETE_ESTABELECIMENTO = + "DELETE FROM estabelecimentos WHERE id = "; + + public static final String DELETE_ESTABELECIMENTOS_BY_EMPRESA = + "DELETE FROM estabelecimentos WHERE empresa_id = "; + + public static final String DELETE_TRABALHADORES_BY_EMPRESA = + "DELETE FROM trabalhadores WHERE estabelecimento_id IN ( SELECT id FROM estabelecimentos WHERE empresa_id = ?empresa_id )"; + + public static final String DELETE_EMPRESA = + "DELETE FROM empresas WHERE id = "; + + public static final String CREATE_EMPRESA = + "INSERT INTO empresas(id) VALUES( ?id )"; + + public static final String CREATE_ESTABELECIMENTO = + "INSERT INTO estabelecimentos(id) VALUES( ?id )"; + + public static final String CREATE_TRABALHADOR = + "INSERT INTO trabalhadores(id) VALUES( ?id )"; + + public static final String UPDATE_EMPRESA = + "UPDATE empresas SET morada = ?morada, codigo_postal = ?codigo_postal, " + + "localidade = ?localidade, distrito = ?distrito, concelho = ?concelho, " + + "perfil_1 = ?perfil_1, perfil_2 = ?perfil_2, codigo = ?codigo, cae = ?cae, " + + "contribuinte = ?contribuinte, seguranca_social = ?seguranca_social, " + + "actividade = ?actividade, servicos = ?servicos, designacao_social = ?designacao_social, " + + "email = ?email " + + "WHERE id = ?id"; + + public static final String UPDATE_ESTABELECIMENTO = + "UPDATE estabelecimentos SET empresa_id = ?empresa_id, morada = ?morada, " + + "codigo_postal = ?codigo_postal, localidade = ?localidade, " + + "ultima_visita = ?ultima_visita, realizada = ?realizada, " + + "proxima_visita = ?proxima_visita, nome = ?nome " + + "WHERE id = ?id"; + + public static final String UPDATE_TRABALHADOR = + "UPDATE trabalhadores SET sexo = ?sexo, data_nascimento = ?data_nascimento, " + + "numero_mecanografico = ?numero_mecanografico, categoria = ?categoria, " + + "ultimo_exame = ?ultimo_exame, realizado = ?realizado, proximo_exame = ?proximo_exame, " + + "ultima_consulta = ?ultima_consulta, realizada = ?realizada, " + + "proxima_consulta = ?proxima_consulta, nome = ?nome, " + + "resultado = ?resultado, data_ficha = ?data_ficha, " + + "estabelecimento_id = ?estabelecimento_id " + + "WHERE id = ?id"; + + public static final String UPDATE_ACTUALIZACAO = "UPDATE actualizacao SET stamp = "; + + + public static final String PROPERTIES_FILE = "updtprop.txt"; + public static final String PROP_LOCAL = "interno"; + public static final String PROP_LOCAL_U = "iuser"; + public static final String PROP_LOCAL_P = "ipasswd"; + public static final String PROP_REMOTE = "externo"; + public static final String PROP_REMOTE_U = "euser"; + public static final String PROP_REMOTE_P = "epasswd"; + public static final String PROP_INTERVAL = "intervalo"; + + + protected Vector deletes; + protected Vector updates; + + protected Thread updateThread; + + protected JTextField servidorInternoText; + protected JTextField servidorExternoText; + protected JTextField intervaloText; + protected JTextField ultimaActualizacaoText; + protected JTextField proximaActualizacaoText; + protected JButton actionButton; + protected JButton saveButton; + protected JButton cancelButton; + protected JLabel stateLabel; + + protected boolean running; + protected String servidorInterno; + protected String servidorExterno; + protected String internalUser; + protected String internalPassword; + protected String externalUser; + protected String externalPassword; + protected long intervalo; + + /** Creates a new instance of WebUpdater */ + public WebUpdater() + { + deletes = new Vector(); + updates = new Vector(); + running = false; + servidorInterno = "ws_fpalma"; + servidorExterno = "localhost:5436"; + intervalo = 10; + setupComponents(); + } + + protected void setupComponents() + { + setSize( 500, 200 ); + setResizable( false ); + setTitle( "Actualiza\u00e7\u00e3o do Site" ); + JLabel servidorInternoLabel = new JLabel( "Servidor Interno" ); + servidorInternoText = new JTextField(); + servidorInternoText.setPreferredSize( new Dimension( 120, 20 ) ); + servidorInternoText.setForeground( Color.red ); + JLabel servidorExternoLabel = new JLabel( "Servidor Externo" ); + servidorExternoText = new JTextField(); + servidorExternoText.setPreferredSize( new Dimension( 120, 20 ) ); + servidorExternoText.setForeground( Color.red ); + JLabel intervaloLabel = new JLabel( "Intervalo de Actualiza\u00e7\u00e3o (minutos)" ); + intervaloText = new JTextField(); + intervaloText.setPreferredSize( new Dimension( 50, 20 ) ); + JLabel ultimaActualizacaoLabel = new JLabel( "\u00daltima Actualiza\u00e7\u00e3o" ); + ultimaActualizacaoText = new JTextField(); + ultimaActualizacaoText.setPreferredSize( new Dimension( 120, 20 ) ); + ultimaActualizacaoText.setEditable( false ); + JLabel proximaActualizacaoLabel = new JLabel( "Pr\u00f3xima Actualiza\u00e7\u00e3o" ); + proximaActualizacaoText = new JTextField(); + proximaActualizacaoText.setPreferredSize( new Dimension( 120, 20 ) ); + proximaActualizacaoText.setEditable( false ); + actionButton = new JButton( "Executar" ); + saveButton = new JButton( "Guardar Altera\u00e7\u00f5es" ); + saveButton.setEnabled( false ); + cancelButton = new JButton( "Cancelar Altera\u00e7\u00f5es" ); + cancelButton.setEnabled( false ); + stateLabel = new JLabel( " " ); + JPanel buttonPanel = new JPanel(); + JPanel pad = new JPanel(); + pad.setPreferredSize( new Dimension( 120, 20 ) ); + + Container container = getContentPane(); + GridBagLayout gridbag = new GridBagLayout(); + container.setLayout( gridbag ); + GridBagConstraints constraints = new GridBagConstraints(); + constraints.insets = new Insets( 1, 1, 1, 1 ); +// constraints.anchor = GridBagConstraints.EAST; + constraints.fill = GridBagConstraints.BOTH; + constraints.weighty = 0; + constraints.gridheight = 1; + + constraints.weightx = 0; + constraints.gridwidth = 1; + gridbag.setConstraints( servidorInternoLabel, constraints ); + gridbag.setConstraints( servidorExternoLabel, constraints ); + gridbag.setConstraints( intervaloLabel, constraints ); + gridbag.setConstraints( ultimaActualizacaoLabel, constraints ); + gridbag.setConstraints( proximaActualizacaoLabel, constraints ); + + constraints.weightx = 1; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( servidorInternoText, constraints ); + gridbag.setConstraints( servidorExternoText, constraints ); + gridbag.setConstraints( ultimaActualizacaoText, constraints ); + gridbag.setConstraints( proximaActualizacaoText, constraints ); + gridbag.setConstraints( buttonPanel, constraints ); + gridbag.setConstraints( stateLabel, constraints ); + + constraints.weightx = 0.5; + constraints.gridwidth = 1; + gridbag.setConstraints( intervaloText, constraints ); + + constraints.weightx = 0.5; + constraints.gridwidth = GridBagConstraints.REMAINDER; + gridbag.setConstraints( pad, constraints ); + + container.add( servidorInternoLabel ); + container.add( servidorInternoText ); + container.add( servidorExternoLabel ); + container.add( servidorExternoText ); + container.add( intervaloLabel ); + container.add( intervaloText ); + container.add( pad ); + container.add( ultimaActualizacaoLabel ); + container.add( ultimaActualizacaoText ); + container.add( proximaActualizacaoLabel ); + container.add( proximaActualizacaoText ); + container.add( buttonPanel ); + container.add( stateLabel ); + + buttonPanel.setLayout( new FlowLayout( FlowLayout.RIGHT ) ); + buttonPanel.add( saveButton ); + buttonPanel.add( cancelButton ); + buttonPanel.add( actionButton ); + + actionButton.addActionListener( this ); + stateLabel.setText( "Parado" ); + stateLabel.setForeground( Color.red ); + +// servidorInternoText.setText( servidorInterno ); +// servidorExternoText.setText( servidorExterno ); +// intervaloText.setText( "" + intervalo ); + reload(); + + servidorInternoText.getDocument().addDocumentListener( this ); + servidorExternoText.getDocument().addDocumentListener( this ); + intervaloText.getDocument().addDocumentListener( this ); + saveButton.addActionListener( this ); + cancelButton.addActionListener( this ); + } + + public void actionPerformed(java.awt.event.ActionEvent actionEvent) + { + Object source = actionEvent.getSource(); + if( actionButton.equals( source ) ) + { + if( running ) + { + running = false; + updateThread.interrupt(); + actionButton.setText( "Executar" ); + stateLabel.setText( "Parado" ); + stateLabel.setBackground( Color.red ); + } + else + { + updateThread = new Thread( this ); + updateThread.start(); + actionButton.setText( "Parar" ); + } + } + else if( saveButton.equals( source ) ) + { + save(); + saveButton.setEnabled( false ); + cancelButton.setEnabled( false ); + } + else if( cancelButton.equals( source ) ) + { + reload(); + saveButton.setEnabled( false ); + cancelButton.setEnabled( false ); + } + } + + + public void changedUpdate(javax.swing.event.DocumentEvent documentEvent) + { + saveButton.setEnabled( true ); + cancelButton.setEnabled( true ); + } + + public void insertUpdate(javax.swing.event.DocumentEvent documentEvent) + { + saveButton.setEnabled( true ); + cancelButton.setEnabled( true ); + } + + public void removeUpdate(javax.swing.event.DocumentEvent documentEvent) + { + saveButton.setEnabled( true ); + cancelButton.setEnabled( true ); + } + + protected void save() + { + Properties props = new Properties(); + try + { + OutputStream out = new FileOutputStream( PROPERTIES_FILE ); + String auxSI = servidorInternoText.getText(); + String auxSE = servidorExternoText.getText(); + String auxI = intervaloText.getText();; + if( auxSI == null || auxSI.length() == 0 || + auxSE == null || auxSE.length() == 0 || + auxI == null || auxI.length() == 0 ) + { + throw new Exception( "" ); + } + intervalo = Long.parseLong( auxI ); + servidorInterno = auxSI; + servidorExterno = auxSE; + props.setProperty( PROP_LOCAL, servidorInterno ); + props.setProperty( PROP_LOCAL_U, internalUser ); + props.setProperty( PROP_LOCAL_P, internalPassword ); + props.setProperty( PROP_REMOTE, servidorExterno ); + props.setProperty( PROP_REMOTE_U, externalUser ); + props.setProperty( PROP_REMOTE_P, externalPassword ); + props.setProperty( PROP_INTERVAL, "" + intervalo ); + props.store( out, "Configura\u00e7\u00e3o da Ferramenta de Actualiza\u00e7\u00e3o da SIPRP" ); + out.close(); + } + catch( Exception ex ) + { + JOptionPane.showMessageDialog( this, "Erro a gravar altera\u00e7\u00f5es", "Erro", + JOptionPane.ERROR_MESSAGE ); + } + } + + protected void reload() + { + Properties props = new Properties(); + try + { + +System.out.println( new File( PROPERTIES_FILE ) ); + InputStream in = new FileInputStream( PROPERTIES_FILE ); + props.load( in ); + internalUser = props.getProperty( PROP_LOCAL_U ); + internalPassword = props.getProperty( PROP_LOCAL_P ); + externalUser = props.getProperty( PROP_REMOTE_U ); + externalPassword = props.getProperty( PROP_REMOTE_P ); + + String aux; + aux = props.getProperty( PROP_LOCAL ); + if( aux != null && aux.length() > 0 ) + { + servidorInterno = aux; + } + aux = props.getProperty( PROP_REMOTE ); + if( aux != null && aux.length() > 0 ) + { + servidorExterno = aux; + } + aux = props.getProperty( PROP_INTERVAL ); + if( aux != null && aux.length() > 0 ) + { + try + { + intervalo = Long.parseLong( aux ); + } + catch( NumberFormatException nfe ) + { + } + } + + } + catch( Exception ex ) + { + JOptionPane.showMessageDialog( this, "Erro a carregar os dados", "Erro", + JOptionPane.ERROR_MESSAGE ); + } + servidorInternoText.setText( servidorInterno ); + servidorExternoText.setText( servidorExterno ); + intervaloText.setText( "" + intervalo ); + } + + public void run() + { + running = true; + while( true ) + { + boolean erro = false; + if( !running ) + { + return; + } + proximaActualizacaoText.setText( "" ); + try + { + stateLabel.setText( "A Actualizar" ); + stateLabel.setForeground( Color.green ); + doUpdates(); + java.util.Date date = new java.util.Date(); + ultimaActualizacaoText.setText( date.toString() ); + } + catch( Exception ex ) + { + erro = true; + stateLabel.setText( "ERRO A ACTUALIZAR!!!" ); + stateLabel.setForeground( Color.red ); + } + if( !running ) + { + return; + } + try + { + if( !erro ) + { + stateLabel.setText( "Em Intervalo (" + intervalo + " minuto" + ( intervalo > 1 ? "s" : "" ) + ")" ); + stateLabel.setForeground( Color.black ); + } + Calendar cal = Calendar.getInstance(); + cal.add( Calendar.MINUTE, (int)intervalo ); + proximaActualizacaoText.setText( "" + cal.getTime() ); + Thread.sleep( intervalo * 60000 ); + } + catch( InterruptedException iex ) + { + } + } + } + + protected void doUpdates() + throws Exception + { + try + { + connect(); + getData(); + updateData(); + } + catch( Exception ex ) + { + ex.printStackTrace(); + throw ex; + } + + } + + /** + * @param args the command line arguments + */ + public static void main( String[] args ) + throws Exception + { + WebUpdater updater = new WebUpdater(); + updater.show(); + } + + protected void connect() + throws Exception + { + Class.forName( "org.postgresql.Driver" ); + Class.forName( "com.mysql.jdbc.Driver" ); + webConnection = DriverManager.getConnection( "jdbc:postgresql://" + servidorExterno + "/siprp", externalUser, externalPassword ); + webConnection.setAutoCommit( true ); + softwareConnection = DriverManager.getConnection( "jdbc:mysql://" + servidorInterno + "/siprp", internalUser, internalPassword ); +// softwareConnection = DriverManager.getConnection( "jdbc:postgresql://" + servidorInterno + "/siprp", internalUser, internalPassword ); + softwareConnection.setAutoCommit( true ); + } + + protected void getData() + throws Exception + { + Object r[][]; + r = doQuery( webConnection, GET_ULTIMA_ACTUALIZACAO ); + String actualizacao = "'" + r[0][0] + "'"; + Calendar cal = Calendar.getInstance(); + //int hour = cal.get( Calendar.HOUR_OF_DAY ); + //if( hour < 3 && hour > 1 ) + //{ + // actualizacao = "'1970-01-01 00:00:00'"; + //} + doQuery(softwareConnection, "DELETE FROM actualizacao;", true); + doQuery(softwareConnection, "INSERT INTO actualizacao(hora) VALUES(now());", true); + readTrabalhadores( actualizacao ); + readEstabelecimentos( actualizacao ); + readEmpresas( actualizacao ); + } + + protected void updateData() + throws Exception + { + System.out.println( "DELETES" ); + for( int d = 0; d < deletes.size(); d++ ) + { + try + { + System.out.println( deletes.elementAt( d ).toString() ); + doQuery( webConnection, deletes.elementAt( d ).toString(), true ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + System.out.println( "" ); + System.out.println( "UPDATES" ); + for( int u = 0; u < updates.size(); u++ ) + { + String queries[] = ( String[] ) updates.elementAt( u ); + System.out.println( queries[ 0 ] + "\n " + queries[ 1 ] ); + try + { + doQuery( webConnection, queries[ 0 ], true ); + } + catch( Exception ex ) + { + System.out.println( " ERRO DE INSERT" ); + } + try + { + doQuery( webConnection, queries[ 1 ], true ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + } + Object r[][] = doQuery( softwareConnection, "SELECT hora FROM actualizacao;" ); + String actualizacao = "'" + r[0][0] + "'"; + doQuery( webConnection, UPDATE_ACTUALIZACAO + actualizacao, true ); + } + + protected void readTrabalhadores( String actualizacao ) + throws Exception + { + Object trabalhadores[][] = doQuery( softwareConnection, GET_TRABALHADORES + actualizacao ); + for( int t = 0; t < trabalhadores.length; t++ ) + { + for( int c = 0; c < trabalhadores[ t ].length; c++ ) + { + if( trabalhadores[ t ][ c ] instanceof String ) + { + trabalhadores[ t ][ c ] = unicodeToHTML( (String) trabalhadores[ t ][ c ] ); + } + } + int id = ( ( Number ) trabalhadores[t][0] ).intValue(); + boolean inactivo = "y".equals( trabalhadores[ t ][ trabalhadores[ t ].length - 1 ] ) || + trabalhadores[ t ][ trabalhadores[ t ].length - 2 ] != null; + if( inactivo ) + { + deletes.add( DELETE_TRABALHADOR + id ); + continue; + } + String queries[] = new String[ 2 ]; + updates.insertElementAt( queries, 0 ); + queries[ 0 ] = CREATE_TRABALHADOR.replaceFirst( "[?]id", "" + id ); + String update = UPDATE_TRABALHADOR.replaceFirst( "[?]id", "" + id ); + + String nome = "'" + trabalhadores[ t ][ 1 ] + "'"; + update = update.replaceFirst( "[?]nome", nome ); + String sexo = "'" + trabalhadores[ t ][ 2 ] + "'"; + update = update.replaceFirst( "[?]sexo", sexo ); + String dataNasc; + if( trabalhadores[ t ][ 3 ] != null ) + { + dataNasc = "'" + trabalhadores[ t ][ 3 ] + "'"; + } + else + { + dataNasc = "''"; + } + update = update.replaceFirst( "[?]data_nascimento", dataNasc ); + String numeroMecanografico; + if( trabalhadores[ t ][ 4 ] != null ) + { + numeroMecanografico = "'" + trabalhadores[ t ][ 4 ] + "'"; + } + else + { + numeroMecanografico = "''"; + } + update = update.replaceFirst( "[?]numero_mecanografico", numeroMecanografico ); + String categoria; + if( trabalhadores[ t ][ 5 ] != null ) + { + categoria = "'" + trabalhadores[ t ][ 5 ] + "'"; + } + else + { + categoria = "''"; + } + update = update.replaceFirst( "[?]categoria", categoria ); + int estabelecimentoID = ( ( Number ) trabalhadores[t][6] ).intValue(); + update = update.replaceFirst( "[?]estabelecimento_id", "" + estabelecimentoID ); + Object exames[][] = doQuery( softwareConnection, + GET_EXAMES_TRABALHADOR.replaceFirst( "[?]trabalhador_id", ""+id ) ); + + if( exames != null && exames.length > 0 ) + { + java.util.Date dataExame2 = ( java.util.Date ) exames[ exames.length - 1 ] [ 1 ]; + String realizado2 = ( String ) exames[ exames.length - 1 ][ 2 ]; + java.util.Date dataExame1; + String realizado1; + if( exames.length >= 2 ) + { + dataExame1 = ( java.util.Date ) exames[ exames.length - 2 ] [ 1 ]; + realizado1 = ( String ) exames[ exames.length - 2 ][ 2 ]; + } + else + { + dataExame1 = dataExame2; + realizado1 = realizado2; + } + if( "y".equals( realizado2 ) ) + { + update = update.replaceFirst( "[?]ultimo_exame", "'" + dataExame2 + "'" ); + update = update.replaceFirst( "[?]realizado", "'" + realizado2 + "'" ); + update = update.replaceFirst( "[?]proximo_exame", "null" ); + } + else if( new java.util.Date().after( dataExame2 ) ) + { + update = update.replaceFirst( "[?]ultimo_exame", "'" + dataExame2 + "'" ); + update = update.replaceFirst( "[?]realizado", "'" + realizado2 + "'" ); + update = update.replaceFirst( "[?]proximo_exame", "null" ); + } + else + { + update = update.replaceFirst( "[?]proximo_exame", "'" + dataExame2 + "'" ); + if( !dataExame2.equals( dataExame1 ) ) + { + update = update.replaceFirst( "[?]ultimo_exame", "'" + dataExame1 + "'" ); + update = update.replaceFirst( "[?]realizado", "'" + realizado1 + "'" ); + } + else + { + update = update.replaceFirst( "[?]ultimo_exame", "null" ); + update = update.replaceFirst( "[?]realizado", "null" ); + } + } + } + else + { + update = update.replaceFirst( "[?]ultimo_exame", "null" ); + update = update.replaceFirst( "[?]realizado", "null" ); + update = update.replaceFirst( "[?]proximo_exame", "null" ); + } + Object consultas[][] = doQuery( softwareConnection, + GET_CONSULTAS_TRABALHADOR.replaceFirst( "[?]trabalhador_id", ""+id ) ); + + if( consultas != null && consultas.length > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) consultas[ consultas.length - 1 ] [ 1 ]; + String realizada2 = ( String ) consultas[ consultas.length - 1 ][ 2 ]; + java.util.Date dataConsulta1; + java.util.Date dataRelatorio1; + java.util.Date dataRelatorio2 = (java.util.Date) consultas[ consultas.length - 1 ][ 3 ]; + String realizada1; + if( consultas.length >= 2 ) + { + dataConsulta1 = ( java.util.Date ) consultas[ consultas.length - 2 ] [ 1 ]; + realizada1 = ( String ) consultas[ consultas.length - 2 ][ 2 ]; + dataRelatorio1 = (java.util.Date) consultas[ consultas.length - 2 ][ 3 ]; + } + else + { + dataConsulta1 = dataConsulta2; + realizada1 = realizada2; + dataRelatorio1 = dataRelatorio2; + } + if( "y".equals( realizada2 ) ) + { + update = update.replaceFirst( "[?]ultima_consulta", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_consulta", "null" ); + if( dataRelatorio2 != null ) + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataRelatorio2 + "'" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + else if( new java.util.Date().after( dataConsulta2 ) ) + { + update = update.replaceFirst( "[?]ultima_consulta", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_consulta", "null" ); + if( dataRelatorio2 != null ) + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataRelatorio2 + "'" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]proxima_consulta", "'" + dataConsulta2 + "'" ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + update = update.replaceFirst( "[?]ultima_consulta", "'" + dataConsulta1 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada1 + "'" ); + if( dataRelatorio1 != null ) + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataRelatorio1 + "'" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]ultima_consulta", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + } + } + else + { + update = update.replaceFirst( "[?]ultima_consulta", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + update = update.replaceFirst( "[?]proxima_consulta", "null" ); + update = update.replaceFirst( "[?]data_ficha", "null" ); + + } + Object fichas[][] = doQuery( softwareConnection, + GET_ID_FICHA_APTIDAO.replaceFirst( "[?]trabalhador_id", ""+id ) ); + if( fichas != null && fichas.length > 0 && fichas[0].length > 0 && fichas[0][0] != null ) + { + Integer idFicha = (Integer)fichas[0][0]; + fichas = doQuery( softwareConnection, + GET_DADOS_FICHA_APTIDAO.replaceFirst( "[?]id", "" + idFicha ) ); + java.util.Date dataFicha = ( java.util.Date ) fichas[ 0 ][ 0 ]; + /*if( dataFicha != null ) + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + } + else + { + update = update.replaceFirst( "[?]data_ficha", "'" + dataFicha + "'" ); + }*/ + Integer resultadoFicha = (Integer) fichas[ 0 ][ 1 ]; + if( resultadoFicha != null ) + { + switch( resultadoFicha.intValue() ) + { + case 1: + update = update.replaceFirst( "[?]resultado", "'Apto'" ); + break; + case 2: + update = update.replaceFirst( "[?]resultado", "'Apto Condicionalmente'" ); + break; + case 3: + update = update.replaceFirst( "[?]resultado", "'Inapto Temporariamente'" ); + break; + case 4: + update = update.replaceFirst( "[?]resultado", "'Inapto Definitivamente'" ); + break; + default: + update = update.replaceFirst( "[?]resultado", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]resultado", "null" ); + } + } + else + { + update = update.replaceFirst( "[?]data_ficha", "null" ); + update = update.replaceFirst( "[?]resultado", "null" ); + } + + queries[ 1 ] = update; + + } + } + + protected void readEstabelecimentos( String actualizacao ) + throws Exception + { + Object estabelecimentos[][] = doQuery( softwareConnection, GET_ESTABELECIMENTOS + actualizacao ); + //id, empresa_id, nome, contacto, inactivo + for( int t = 0; t < estabelecimentos.length; t++ ) + { + for( int c = 0; c < estabelecimentos[ t ].length; c++ ) + { + if( estabelecimentos[ t ][ c ] instanceof String ) + { + estabelecimentos[ t ][ c ] = unicodeToHTML( (String) estabelecimentos[ t ][ c ] ); + } + } + int id = ( ( Number ) estabelecimentos[t][0] ).intValue(); + boolean inactivo = "y".equals( estabelecimentos[ t ][ estabelecimentos[ t ].length - 1 ] ); + if( inactivo ) + { + deletes.add( DELETE_TRABALHADORES_BY_ESTABELECIMENTO + id ); + deletes.add( DELETE_ESTABELECIMENTO + id ); + continue; + } + String queries[] = new String[ 2 ]; + updates.insertElementAt( queries, 0 ); + queries[ 0 ] = CREATE_ESTABELECIMENTO.replaceFirst( "[?]id", "" + id ); + String update = UPDATE_ESTABELECIMENTO.replaceFirst( "[?]id", "" + id ); + + int empresaID = ( ( Number ) estabelecimentos[t][1] ).intValue(); + update = update.replaceFirst( "[?]empresa_id", "" + empresaID ); + String nome = "'" + estabelecimentos[ t ][ 2 ] + "'"; + update = update.replaceFirst( "[?]nome", nome ); + String morada; + if( estabelecimentos[ t ][ 4 ] != null ) + { + morada = "'" + estabelecimentos[ t ][ 4 ] + "'"; + } + else + { + morada = "''"; + } + update = update.replaceFirst( "[?]morada", morada ); + String localidade; + if( estabelecimentos[ t ][ 5 ] != null ) + { + localidade = "'" + estabelecimentos[ t ][ 5 ] + "'"; + } + else + { + localidade = "''"; + } + update = update.replaceFirst( "[?]localidade", localidade ); + String codigoPostal; + if( estabelecimentos[ t ][ 6 ] != null ) + { + codigoPostal = "'" + estabelecimentos[ t ][ 6 ] + "'"; + } + else + { + codigoPostal = "''"; + } + update = update.replaceFirst( "[?]codigo_postal", codigoPostal ); + + Object marcacoes[][] = doQuery( softwareConnection, + GET_MARCACOES_ESTABELECIMENTO +id ); + + if( marcacoes != null && marcacoes.length > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) marcacoes[ marcacoes.length - 1 ] [ 1 ]; + String realizada2 = ( String ) marcacoes[ marcacoes.length - 1 ][ 2 ]; + java.util.Date dataConsulta1; + String realizada1; + if( marcacoes.length >= 2 ) + { + dataConsulta1 = ( java.util.Date ) marcacoes[ marcacoes.length - 2 ] [ 1 ]; + realizada1 = ( String ) marcacoes[ marcacoes.length - 2 ][ 2 ]; + } + else + { + dataConsulta1 = dataConsulta2; + realizada1 = realizada2; + } + if( "y".equals( realizada2 ) ) + { + update = update.replaceFirst( "[?]ultima_visita", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_visita", "null" ); + } + else if( new java.util.Date().after( dataConsulta2 ) ) + { + update = update.replaceFirst( "[?]ultima_visita", "'" + dataConsulta2 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + update = update.replaceFirst( "[?]proxima_visita", "null" ); + } + else + { + update = update.replaceFirst( "[?]proxima_visita", "'" + dataConsulta2 + "'" ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + update = update.replaceFirst( "[?]ultima_visita", "'" + dataConsulta1 + "'" ); + update = update.replaceFirst( "[?]realizada", "'" + realizada2 + "'" ); + } + else + { + update = update.replaceFirst( "[?]ultima_visita", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + } + } + } + else + { + update = update.replaceFirst( "[?]ultima_visita", "null" ); + update = update.replaceFirst( "[?]realizada", "null" ); + update = update.replaceFirst( "[?]proxima_visita", "null" ); + } + + queries[ 1 ] = update; + } + } + + protected void readEmpresas( String actualizacao ) + throws Exception + { + Object empresas[][] = doQuery( softwareConnection, GET_EMPRESAS + actualizacao ); + //id, empresa_id, nome, contacto, inactivo + for( int t = 0; t < empresas.length; t++ ) + { + for( int c = 0; c < empresas[ t ].length; c++ ) + { + if( empresas[ t ][ c ] instanceof String ) + { + empresas[ t ][ c ] = unicodeToHTML( (String) empresas[ t ][ c ] ); + } + } + int id = ( ( Number ) empresas[t][0] ).intValue(); + boolean inactivo = "y".equals( empresas[ t ][ 17 ] ); + if( inactivo ) + { + String str = DELETE_TRABALHADORES_BY_EMPRESA.replaceFirst( "[?]empresa_id", "" + id ); + deletes.add( str ); + deletes.add( DELETE_ESTABELECIMENTOS_BY_EMPRESA + id ); + deletes.add( DELETE_EMPRESA + id ); + continue; + } + String queries[] = new String[ 2 ]; + updates.insertElementAt( queries, 0 ); + queries[ 0 ] = CREATE_EMPRESA.replaceFirst( "[?]id", "" + id ); + String update = UPDATE_EMPRESA.replaceFirst( "[?]id", "" + id ); + + String designacaoSocial = "'" + empresas[ t ][ 1 ] + "'"; + update = update.replaceFirst( "[?]designacao_social", designacaoSocial ); + String cae; + if( empresas[ t ][ 7 ] != null ) + { + cae = "'" + empresas[ t ][ 7 ] + "'"; + } + else + { + cae = "''"; + } + update = update.replaceFirst( "[?]cae", cae ); + String contribuinte; + if( empresas[ t ][ 8 ] != null ) + { + contribuinte = "'" + empresas[ t ][ 8 ] + "'"; + } + else + { + contribuinte = "''"; + } + update = update.replaceFirst( "[?]contribuinte", contribuinte ); + String segurancaSocial; + if( empresas[ t ][ 9 ] != null ) + { + segurancaSocial = "'" + empresas[ t ][ 9 ] + "'"; + } + else + { + segurancaSocial = "''"; + } + update = update.replaceFirst( "[?]seguranca_social", segurancaSocial ); + String actividade; + if( empresas[ t ][ 10 ] != null ) + { + actividade = "'" + empresas[ t ][ 10 ] + "'"; + } + else + { + actividade = "''"; + } + update = update.replaceFirst( "[?]actividade", actividade ); + String morada; + if( empresas[ t ][ 12 ] != null ) + { + morada = "'" + empresas[ t ][ 12 ] + "'"; + } + else + { + morada = "''"; + } + update = update.replaceFirst( "[?]morada", morada ); + String localidade; + if( empresas[ t ][ 13 ] != null ) + { + localidade = "'" + empresas[ t ][ 13 ] + "'"; + } + else + { + localidade = "''"; + } + update = update.replaceFirst( "[?]localidade", localidade ); + String codigoPostal; + if( empresas[ t ][ 14 ] != null ) + { + codigoPostal = "'" + empresas[ t ][ 14 ] + "'"; + } + else + { + codigoPostal = "''"; + } + update = update.replaceFirst( "[?]codigo_postal", codigoPostal ); + String distrito; + if( empresas[ t ][ 15 ] != null ) + { + distrito = "'" + empresas[ t ][ 15 ] + "'"; + } + else + { + distrito = "''"; + } + update = update.replaceFirst( "[?]distrito", distrito ); + String concelho; + if( empresas[ t ][ 16 ] != null ) + { + concelho = "'" + empresas[ t ][ 16 ] + "'"; + } + else + { + concelho = "''"; + } + update = update.replaceFirst( "[?]concelho", concelho ); + String email = null; + if( empresas[ t ][ 18 ] != null ) + { + try + { + Object em[][] = doQuery( softwareConnection, GET_EMAIL + empresas[ t ][ 18 ] ); + if( em != null && em.length > 0 && em[ 0 ][ 0 ] != null ) + { + email = "'" + (String)em[ 0 ][ 0 ] + "'"; + } + } + catch( Exception ex ) + { + } + } + if( email == null ) + { + email = "''"; + } + update = update.replaceFirst( "[?]email", email ); + + String codigo1 = (String) empresas[ t ][ 4 ]; + String codigo2 = (String) empresas[ t ][ 5 ]; + String codigo3 = (String) empresas[ t ][ 6 ]; + String codigo = "'" + ( codigo1 != null ? codigo1 : "_" ) + "/" + + ( codigo2 != null ? codigo2 : "_" ) + "/" + + ( codigo3 != null ? codigo3 : "_" ) + "'"; + update = update.replaceFirst( "[?]codigo", codigo ); + update = update.replaceFirst( "[?]perfil_1", "null" ); + update = update.replaceFirst( "[?]perfil_2", "null" ); + update = update.replaceFirst( "[?]perfil_3", "null" ); + update = update.replaceFirst( "[?]servicos", "null" ); + + queries[ 1 ] = update; + } + } + + protected Object [][]doQuery( Connection con, String query ) + throws Exception + { + return doQuery( con, query, false ); + } + + protected Object [][]doQuery( Connection con, String query, boolean isUpdate ) + throws Exception + { +// if( con == webConnection ) +// { +// System.out.println( "WEB" ); +// } +// else +// { +// System.out.println( "LOCAL" ); +// } +// if( query.indexOf( "INSERT" ) != -1 || query.indexOf( "UPDATE" ) != -1 ) +// { +//// System.out.println( "AAAAAAAAAAAAAHHHHHHH" + query ); +// return new Object[0][0]; +// } + Statement stm = null; + stm = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, + ResultSet.CONCUR_READ_ONLY ); + if( isUpdate ) + { + stm.executeUpdate( query ); + return null; + } + ResultSet rs = stm.executeQuery( query ); + + if( rs == null ) + { + return null; + } + ResultSetMetaData rsmd = rs.getMetaData(); + int columns = rsmd.getColumnCount(); + rs.last(); + int rows = rs.getRow(); + Object data[][] = new Object[ rows ][ columns ]; + for( int i = 0; i < rows; ++i ) + { + rs.absolute( i + 1 ); + for( int j = 0; j < columns; j++ ) + { + data[ i ][ j ] = rs.getObject( j + 1 ); + } + } + return data; + } + + protected static String unicodeToHTML( String text ) + { + if( text == null || text.length() == 0 ) + { + return ""; + } + + String output = text; + + output = output.replaceAll( "\\\\u0009", " " ); + output = output.replaceAll( "\\\\u000a", "
" ); + + output = output.replaceAll( "\\\\u00a0", " " ); + + output = output.replaceAll( "\\\\u00c0", "À" ); + output = output.replaceAll( "\\\\u00c1", "Á" ); + output = output.replaceAll( "\\\\u00c2", "Â" ); + output = output.replaceAll( "\\\\u00c3", "Ã" ); + output = output.replaceAll( "\\\\u00c7", "Ç" ); + output = output.replaceAll( "\\\\u00c8", "È" ); + output = output.replaceAll( "\\\\u00c9", "É" ); + output = output.replaceAll( "\\\\u00ca", "Ê" ); + output = output.replaceAll( "\\\\u00cc", "Ì" ); + output = output.replaceAll( "\\\\u00cd", "Í" ); + output = output.replaceAll( "\\\\u00ce", "Î" ); + output = output.replaceAll( "\\\\u00d2", "Ò" ); + output = output.replaceAll( "\\\\u00d3", "Ó" ); + output = output.replaceAll( "\\\\u00d4", "Ô" ); + output = output.replaceAll( "\\\\u00d5", "Õ" ); + output = output.replaceAll( "\\\\u00d9", "Ù" ); + output = output.replaceAll( "\\\\u00da", "Ú" ); + output = output.replaceAll( "\\\\u00db", "Û" ); + + output = output.replaceAll( "\\\\u00e0", "à" ); + output = output.replaceAll( "\\\\u00e1", "á" ); + output = output.replaceAll( "\\\\u00e2", "â" ); + output = output.replaceAll( "\\\\u00e3", "ã" ); + output = output.replaceAll( "\\\\u00e7", "ç" ); + output = output.replaceAll( "\\\\u00e8", "è" ); + output = output.replaceAll( "\\\\u00e9", "é" ); + output = output.replaceAll( "\\\\u00ea", "ê" ); + output = output.replaceAll( "\\\\u00ec", "ì" ); + output = output.replaceAll( "\\\\u00ed", "í" ); + output = output.replaceAll( "\\\\u00ee", "î" ); + output = output.replaceAll( "\\\\u00f2", "ò" ); + output = output.replaceAll( "\\\\u00f3", "ó" ); + output = output.replaceAll( "\\\\u00f4", "ô" ); + output = output.replaceAll( "\\\\u00f5", "õ" ); + output = output.replaceAll( "\\\\u00f9", "ù" ); + output = output.replaceAll( "\\\\u00fa", "ú" ); + output = output.replaceAll( "\\\\u00fb", "û" ); + output = output.replaceAll( "\\\\u00aa", "ª" ); + output = output.replaceAll( "\\\\u00ba", "º" ); + + output = output.replaceAll( "\\\\u0153", "œ" ); + + output = output.replaceAll( "\\\\u2013", "-" ); + output = output.replaceAll( "\\\\u2014", "-" ); + output = output.replaceAll( "\\\\u2018|\\\\u2019", "'" ); + output = output.replaceAll( "\\\\u201c|\\\\u201d", "\"" ); + + output = output.replaceAll( "\\\\u2022", "*" ); + output = output.replaceAll( "\\\\u2026", "..." ); + + return output; + } + + +} diff --git a/tags/teg/SIPRPSoft/src/siprp_create.sql b/tags/teg/SIPRPSoft/src/siprp_create.sql new file mode 100644 index 00000000..56b89f27 --- /dev/null +++ b/tags/teg/SIPRPSoft/src/siprp_create.sql @@ -0,0 +1,569 @@ +-- +-- PostgreSQL database dump +-- + +SET client_encoding = 'LATIN1'; +SET check_function_bodies = false; +SET client_min_messages = warning; + + +-- +-- Name: actualizacao; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE actualizacao ( + hora timestamp without time zone, + id serial NOT NULL +); + + +ALTER TABLE public.actualizacao OWNER TO postgres; + +-- +-- Name: avisos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE avisos ( + id integer NOT NULL, + tipo integer DEFAULT 0 NOT NULL, + empresa_id integer, + estabelecimento_id integer, + trabalhador_id integer, + evento_id integer, + data_aviso date NOT NULL, + data_evento date, + descricao character varying(255) +); + + +ALTER TABLE public.avisos OWNER TO postgres; + +-- +-- Name: contactos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE contactos ( + id integer NOT NULL, + nome character varying(255), + telefone character varying(255), + telemovel character varying(255), + fax character varying(255), + email character varying(255), + cargo character varying(255) +); + + +ALTER TABLE public.contactos OWNER TO postgres; + +-- +-- Name: empresas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE empresas ( + id integer NOT NULL, + designacao_social character varying(255) DEFAULT ''::character varying NOT NULL, + servico_saude_tipo integer, + servico_saude_designacao character varying(255) DEFAULT 'Sociedade Ibu00e9rica de Prevenu00e7u00e3o de Riscos Profissionais'::character varying, + servico_higiene_tipo integer, + servico_higiene_designacao character varying(255), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + morada character varying(255), + codigo_postal character varying(8), + localidade character varying(255), + distrito character varying(255), + concelho character varying(255), + numero_trabalhadores integer, + data_proposta date, + data_aceitacao date, + perfil_1 character varying(255), + perfil_2 character varying(255), + data_envio_contrato date, + data_recepcao_contrato date, + data_envio_idict date, + cae character varying(255), + contribuinte character varying(255), + seguranca_social character varying(255), + codigo_1 character varying(255), + codigo_2 character varying(255), + codigo_3 character varying(255), + servicos integer, + contacto_1 integer, + contacto_2 integer, + data_relatorio_anual date, + preco_higiene double precision, + preco_medicina double precision, + periodicidade character varying(255), + actividade character varying(255), + actualizacao timestamp without time zone, + designacao_social_plain character varying(255) +); + + +ALTER TABLE public.empresas OWNER TO postgres; + +-- +-- Name: errors; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE errors ( + id integer NOT NULL, + date timestamp without time zone, + "type" character varying(20), + environment character varying(255), + description character varying(65535) +); + + +ALTER TABLE public.errors OWNER TO postgres; + +-- +-- Name: estabelecimentos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE estabelecimentos ( + id integer NOT NULL, + nome character varying(255) DEFAULT ''::character varying NOT NULL, + localidade character varying(255), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + empresa_id integer DEFAULT 0 NOT NULL, + morada character varying(255), + codigo_postal character varying(255), + contacto character varying(255), + historico character varying(65535), + actualizacao timestamp without time zone, + nome_plain character varying(255) +); + + +ALTER TABLE public.estabelecimentos OWNER TO postgres; + +-- +-- Name: exames; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE exames ( + id integer NOT NULL, + data date, + tipo integer DEFAULT 0 NOT NULL, + ocasional integer, + outro_tipo character varying(255), + resultado integer, + outra_funcao_1 character varying(255), + outra_funcao_2 character varying(255), + outra_funcao_3 character varying(255), + outra_funcao_4 character varying(255), + proximo_exame date, + outras_recomendacoes character varying(65535), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + trabalhador_id integer DEFAULT 0 NOT NULL, + medico_id integer DEFAULT 0 NOT NULL, + pdf bytea +); + + +ALTER TABLE public.exames OWNER TO postgres; + +-- +-- Name: exames_perfis; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE exames_perfis ( + id integer NOT NULL, + perfil integer DEFAULT 0 NOT NULL, + tipo integer DEFAULT 0 NOT NULL, + multiplicador integer DEFAULT 0 NOT NULL +); + + +ALTER TABLE public.exames_perfis OWNER TO postgres; + +-- +-- Name: historico_estabelecimento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE historico_estabelecimento ( + id integer NOT NULL, + estabelecimento_id integer DEFAULT 0 NOT NULL, + data date, + texto character varying(65535) +); + + +ALTER TABLE public.historico_estabelecimento OWNER TO postgres; + +-- +-- Name: ids; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE ids ( + id integer NOT NULL +); + + +ALTER TABLE public.ids OWNER TO postgres; + +-- +-- Name: marcacoes_empresa; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE marcacoes_empresa ( + id integer NOT NULL, + data date NOT NULL, + texto character varying(65535), + empresa_id integer DEFAULT 0 NOT NULL, + realizada character(1) +); + + +ALTER TABLE public.marcacoes_empresa OWNER TO postgres; + +-- +-- Name: marcacoes_estabelecimento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE marcacoes_estabelecimento ( + id integer NOT NULL, + data date NOT NULL, + realizada character(1) DEFAULT 'n'::bpchar NOT NULL, + data_email date, + data_relatorio date, + estabelecimento_id integer DEFAULT 0 NOT NULL +); + + +ALTER TABLE public.marcacoes_estabelecimento OWNER TO postgres; + +-- +-- Name: marcacoes_trabalhador; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE marcacoes_trabalhador ( + id integer NOT NULL, + data date, + realizada character(1) DEFAULT 'n'::bpchar NOT NULL, + data_email date, + data_relatorio date, + tipo integer, + trabalhador_id integer +); + + +ALTER TABLE public.marcacoes_trabalhador OWNER TO postgres; + +-- +-- Name: medicos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE medicos ( + id integer NOT NULL, + nome character varying(255) DEFAULT ''::character varying NOT NULL, + numero_cedula character varying(255) DEFAULT ''::character varying NOT NULL, + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL +); + + +ALTER TABLE public.medicos OWNER TO postgres; + +-- +-- Name: tipos_exames_comp; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE tipos_exames_comp ( + id integer NOT NULL, + ordem integer DEFAULT 0 NOT NULL, + descricao character varying(255) DEFAULT ''::character varying NOT NULL +); + + +ALTER TABLE public.tipos_exames_comp OWNER TO postgres; + +-- +-- Name: trabalhadores; Type: TABLE; Schema: public; Owner: postgres; Tablespace: +-- + +CREATE TABLE trabalhadores ( + id integer NOT NULL, + nome character varying(255) DEFAULT ''::character varying NOT NULL, + sexo character(1), + data_nascimento date, + nacionalidade character varying(255), + numero_mecanografico character varying(255), + data_admissao date, + categoria character varying(255), + local_trabalho character varying(255), + funcao_proposta character varying(255), + data_admissao_funcao date, + observacoes character varying(65535), + inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, + estabelecimento_id integer DEFAULT 0 NOT NULL, + data_demissao date, + observacoes_gestao character varying(65535), + perfil integer, + actualizacao timestamp without time zone, + nome_plain character varying(255) +); + + +ALTER TABLE public.trabalhadores OWNER TO postgres; + +-- +-- Name: actualizacao_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY actualizacao + ADD CONSTRAINT actualizacao_pkey PRIMARY KEY (id); + + +ALTER INDEX public.actualizacao_pkey OWNER TO postgres; + +-- +-- Name: avisos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY avisos + ADD CONSTRAINT avisos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.avisos_pkey OWNER TO postgres; + +-- +-- Name: contactos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY contactos + ADD CONSTRAINT contactos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.contactos_pkey OWNER TO postgres; + +-- +-- Name: empresas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY empresas + ADD CONSTRAINT empresas_pkey PRIMARY KEY (id); + + +ALTER INDEX public.empresas_pkey OWNER TO postgres; + +-- +-- Name: errors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY errors + ADD CONSTRAINT errors_pkey PRIMARY KEY (id); + + +ALTER INDEX public.errors_pkey OWNER TO postgres; + +-- +-- Name: estabelecimentos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY estabelecimentos + ADD CONSTRAINT estabelecimentos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.estabelecimentos_pkey OWNER TO postgres; + +-- +-- Name: exames_perfis_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY exames_perfis + ADD CONSTRAINT exames_perfis_pkey PRIMARY KEY (id); + + +ALTER INDEX public.exames_perfis_pkey OWNER TO postgres; + +-- +-- Name: exames_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY exames + ADD CONSTRAINT exames_pkey PRIMARY KEY (id); + + +ALTER INDEX public.exames_pkey OWNER TO postgres; + +-- +-- Name: historico_estabelecimento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY historico_estabelecimento + ADD CONSTRAINT historico_estabelecimento_pkey PRIMARY KEY (id); + + +ALTER INDEX public.historico_estabelecimento_pkey OWNER TO postgres; + +-- +-- Name: ids_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY ids + ADD CONSTRAINT ids_pk PRIMARY KEY (id); + + +ALTER INDEX public.ids_pk OWNER TO postgres; + +-- +-- Name: marcacoes_empresa_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY marcacoes_empresa + ADD CONSTRAINT marcacoes_empresa_pkey PRIMARY KEY (id); + + +ALTER INDEX public.marcacoes_empresa_pkey OWNER TO postgres; + +-- +-- Name: marcacoes_estabelecimento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY marcacoes_estabelecimento + ADD CONSTRAINT marcacoes_estabelecimento_pkey PRIMARY KEY (id); + + +ALTER INDEX public.marcacoes_estabelecimento_pkey OWNER TO postgres; + +-- +-- Name: marcacoes_trabalhador_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY marcacoes_trabalhador + ADD CONSTRAINT marcacoes_trabalhador_pkey PRIMARY KEY (id); + + +ALTER INDEX public.marcacoes_trabalhador_pkey OWNER TO postgres; + +-- +-- Name: medicos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY medicos + ADD CONSTRAINT medicos_pkey PRIMARY KEY (id); + + +ALTER INDEX public.medicos_pkey OWNER TO postgres; + +-- +-- Name: tipos_exames_comp_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY tipos_exames_comp + ADD CONSTRAINT tipos_exames_comp_pkey PRIMARY KEY (id); + + +ALTER INDEX public.tipos_exames_comp_pkey OWNER TO postgres; + +-- +-- Name: trabalhadores_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: +-- + +ALTER TABLE ONLY trabalhadores + ADD CONSTRAINT trabalhadores_pkey PRIMARY KEY (id); + + +ALTER INDEX public.trabalhadores_pkey OWNER TO postgres; + + +-- +-- Name: avisos_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY avisos + ADD CONSTRAINT avisos_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); + + +-- +-- Name: avisos_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY avisos + ADD CONSTRAINT avisos_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + +-- +-- Name: empresas_contacto_1_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY empresas + ADD CONSTRAINT empresas_contacto_1_fkey FOREIGN KEY (contacto_1) REFERENCES contactos(id); + + +-- +-- Name: empresas_contacto_2_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY empresas + ADD CONSTRAINT empresas_contacto_2_fkey FOREIGN KEY (contacto_2) REFERENCES contactos(id); + + +-- +-- Name: estabelecimentos_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY estabelecimentos + ADD CONSTRAINT estabelecimentos_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); + + +-- +-- Name: exames_medico_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY exames + ADD CONSTRAINT exames_medico_id_fkey FOREIGN KEY (medico_id) REFERENCES medicos(id); + + +-- +-- Name: exames_perfis_tipo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY exames_perfis + ADD CONSTRAINT exames_perfis_tipo_fkey FOREIGN KEY (tipo) REFERENCES tipos_exames_comp(id); + + +-- +-- Name: historico_estabelecimento_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY historico_estabelecimento + ADD CONSTRAINT historico_estabelecimento_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + +-- +-- Name: marcacoes_empresa_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY marcacoes_empresa + ADD CONSTRAINT marcacoes_empresa_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); + + +-- +-- Name: marcacoes_estabelecimento_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY marcacoes_estabelecimento + ADD CONSTRAINT marcacoes_estabelecimento_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + +-- +-- Name: trabalhadores_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY trabalhadores + ADD CONSTRAINT trabalhadores_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); + + + +-- +-- Name: public; Type: ACL; Schema: -; Owner: postgres +-- + +REVOKE ALL ON SCHEMA public FROM PUBLIC; +REVOKE ALL ON SCHEMA public FROM postgres; +GRANT ALL ON SCHEMA public TO postgres; +GRANT ALL ON SCHEMA public TO PUBLIC; + + + diff --git a/tags/teg/SIPRPSoft/src/speedo.properties b/tags/teg/SIPRPSoft/src/speedo.properties new file mode 100644 index 00000000..314b2c4f --- /dev/null +++ b/tags/teg/SIPRPSoft/src/speedo.properties @@ -0,0 +1,259 @@ +############################################################################### +# Speedo: an implementation of JDO compliant personality on top of JORM generic +# I/O sub-system. +# Copyright (C) 2001-2003 France Telecom R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Contact: speedo@objectweb.org (users list) +# or sebastien.chassande-barrioz@rd.francetelecom.com (project chief) +# +############################################################################### +# This file is the configuration file of Speedo. +VendorName ObjectWeb Consortium +VersionNumber 1.0 + + +############################################################################### +# PersistenceManagerFactory # +############################################################################### +# Class implementing the PersistenceManagerFactory interface. +# Note: The real role of this class is to initialize the component architecture +# (http://fractal.objectweb.org) of Speedo with the initial properies specified +# in this file. The PersistenceManagerFactory role is delegated to the real +# implementation (the SpeedoPersistenceManagerFactory class). +# +# This property must not be changed. It is used by the JDOHelper to knwon the +# PersistenceManagerFactory class of the JDO driver. +# +javax.jdo.PersistenceManagerFactoryClass org.objectweb.speedo.Speedo + + +############################################################################### +# Data Access # +############################################################################### +# This section contains the configuration of the access to the data support. +# +# The first property (org.objectweb.speedo.mapperName) MUST be defined for the +# enhancement time and the runtime. It characterizes the data source type. +# +# In a second part of this data access section, you must choose the way for +# Speedo to reach the data support. The first mean is through a JDBC +# driver and the second is through a connection factory. + +#==============================# +# Data source type # +#==============================# +#mapper name corresponding to your data support type +#org.objectweb.speedo.mapperName rdb.postgres +#org.objectweb.speedo.mapperName rdb.oracle +org.objectweb.speedo.mapperName rdb.mysql +#Other possible values: +# rdb.oracle8, rdb.sqlserver, rdb.firebird, rdb.mckoi, rdb.sapdb, rdb.sybase + +#===============================================# +# JDBC Driver directly (local transaction only) # +#===============================================# +#Driver class name +#javax.jdo.option.DriverName org.postgresql.Driver +#javax.jdo.option.DriverName oracle.jdbc.driver.OracleDriver +javax.jdo.option.DriverName com.mysql.jdbc.Driver +#javax.jdo.option.DriverName com.p6spy.engine.spy.P6SpyDriver + +#url of the database +#javax.jdo.option.ConnectionURL jdbc:postgresql:speedoTest +#javax.jdo.option.ConnectionURL jdbc:oracle:thin:@10.194.3.226:1521:test1 +javax.jdo.option.ConnectionURL jdbc\:mysql\://127.0.0.1/siprp + +#user name +javax.jdo.option.ConnectionUserName root + +#password of the user +javax.jdo.option.ConnectionPassword UNIXLuvsU + +# connection pool size +org.objectweb.speedo.connection.pool.min 0 +org.objectweb.speedo.connection.pool.max 20 +# TTL of the unused connection in term of seconds +# 0 => no TTL (default) +org.objectweb.speedo.connection.pool.ttl 300 +#the max time to wait a free connection in millisecond +org.objectweb.speedo.connection.pool.timeout 500 + + +#======================================# +# Connection factory registred in JNDI # +#======================================# + +# This property is the jndi name of a registered connection factory. A +# connection factory must an implementation of one of these interfaces: +# - javax.sql.Datasource +# - javax.resource.cci.ConnectionFactory +# +#javax.jdo.option.ConnectionFactoryName connFacJndiName + +############################################################################### +# Transaction management # +############################################################################### +# Speedo can be used in stand alone mode or integrated into an application +# server. In the first case (stand alone), the user must demarcates transactions +# in its application code. In the second case (into an application server) the +# transaction can be dermacated by the container of Session bean. Then the +# transactions are potentialy distributed and therefore managed by a +# transactional monitor. +# +# To use speedo in an application server with transactions demarcated by the +# EJB container, the transaction manager instance (implements +# javax.transaction.TransactionManager) MUST be registered into JNDI. If no +# name is specified several attempts are done with classical jndi names used +# in some application servers: +# +# ----------------------------------------------------------- +# | Apps Server | JNDI Name of TransactionManager instance | +# |--------------|------------------------------------------| +# | JOnAS | javax.transaction.UserTransaction | +# | JBoss | java:/TransactionManager | +# | WebLogic | javax.transaction.TransactionManager | +# | WebSphere | ??? | +# | Orion | java:comp/UserTransaction | +# ----------------------------------------------------------- +# +# The default value is the one used in JOnAS, our objectweb partners. +# +#org.objectweb.speedo.jca.TMName javax.transaction.UserTransaction + +# Indicates if transaction are optimisitic or pessimitic. In the optimisitic +# case several threads can use a same persistent object. In case of optimistic +# transaction, each persistent object has several state: one for each user +# (thread). The default case is pessimistic (false). +# +#javax.jdo.option.Optimistic true + + +############################################################################### +# Others JDO Options # +############################################################################### +# Indicates if queries and extends must ingore the instance modified in memory +# and not yet committed into the support. The default value is false (the +# modified instance are flushed into the support before queries). +# +javax.jdo.option.IgnoreCache false + + +# Indicates if several threads can manipulate a same PersistenceManager instance +# in same time (concurrency). The default value is false (no additionnal +# synchronization for concurrent access to a PersistentManager instance). +# +#javax.jdo.option.Multithreaded false + +# when a transaction is commit this property specifies if the modified +# persistent object must be kept in the memory cache. The default value is true +# (persistent objects are kept). +#javax.jdo.option.RetainValues false + + +############################################################################### +# Unsupported JDO Options # +############################################################################### +#javax.jdo.option.RestoreValues false +#javax.jdo.option.NontransactionalRead +#javax.jdo.option.NontransactionalWrite + +############################################################################### +# Speedo Tunning # +############################################################################### +# To active the debug mode +#org.objectweb.speedo.debug true + +#Activation of the data prefetching on each query +#default value is 'on' +#org.objectweb.speedo.query.prefetch off + +# This property permits to the user to listen the transaction life cycle in +# implementing the TransactionListener interface provided in Speedo. However +# Speedo provides a simple implementation calculating statistics. To active the +# use of a listener, you simply have to specify the implementation of the +# interface. +#org.objectweb.speedo.txListener org.objectweb.speedo.workingset.lib.WorkingSetStatistic + +#===========================# +# Data structure Management # +#===========================# +# Specify the mapping structure (ex SQL tables) management. The possibles +# values are the following: +# DO_NOTHING : nothing is done. Then the mapping structures already exist at +# the Speedo starting +# CREATE_IF_REQUIRED : The mapping structures are created if they are not +# already present (default). +# FORCE_CREATE: The mapping structures are removed (if they already exist), and +# and created. +# DELETE_DATA: The data present in the mapping structure are removed. Of course +# if the mapping structure do not exist, they are created. +# +#org.objectweb.speedo.mappingStructure CREATE_IF_REQUIRED + +#=========================# +# Memory Cache Management # +#=========================# +# Memory cache size +#org.objectweb.speedo.cache.size noLimit + +# When the cache is full or when the treshold is reached this property indicates +# how many entry must be tried to free. The possible values are absolute +# value (234) or a percent of the maximal cache size (12%). The default +# value is 7%. +#org.objectweb.speedo.cache.autoCleanSize 7% + +# Is the number of entries since the cache must try to evict entries. The number +# of entries to evict is specified by the 'autoCleanSize' property. The possible +# values are absolute value (234) or a percent of the maximal cache size (75%). +# By default there is no threshold, then there is no auto cleaning process. +org.objectweb.speedo.cache.autoCleanThreshold 0 + +# Replacement politic of the cache: LRU, MRU or FIFO +# The default value is LRU +#org.objectweb.speedo.cache.policy LRU + +#========================================# +# PersistenceManager Pools configuration # +#========================================# +# Size of the pool of PersistenceManager instances +#org.objectweb.speedo.persistencemanager.pool.min 0 +#org.objectweb.speedo.persistencemanager.pool.max 20 +#org.objectweb.speedo.persitencemanager.pool.ttl 300 +#the max time to wait a free persistence manager in millisecond +org.objectweb.speedo.persitencemanager.pool.timeout 1000 + +#=================================# +# Compiled query Cache Management # +#=================================# +# Memory cache size in term of number of persistent objects +#org.objectweb.speedo.compiledquery.cache.size nolimit + +# When the cache is full or when the treshold is reached this property indicates +# how many entry must be tried to free. The possible values are absolute +# value (234) or a percent of the maximal cache size (12%). The default +# value is 7%. +#org.objectweb.speedo.compiledquery.cache.autoCleanSize 7% + +# Is the number of entries since the cache must try to evict entries. The number +# of entries to evict is specified by the 'autoCleanSize' property. The possible +# values are absolute value (234) or a percent of the maximal cache size (75%). +# By default there is no threshold, then there is no auto cleaning process. +#org.objectweb.speedo.compiledquery.cache.autoCleanThreshold 80% + +# Replacement politic of the cache: LRU, MRU or FIFO +# The default value is LRU +#org.objectweb.speedo.compiledquery.cache.policy LRU diff --git a/tags/teg/SIPRPSoft/src/updtprop.txt b/tags/teg/SIPRPSoft/src/updtprop.txt new file mode 100644 index 00000000..6153dbeb --- /dev/null +++ b/tags/teg/SIPRPSoft/src/updtprop.txt @@ -0,0 +1,7 @@ +interno=localhost:5432 +iuser=postgres +ipasswd=Typein +externo=www.evolute.pt:5436 +euser=siprp +epasswd=rg2h-opksiprp +intervalo=10 diff --git a/tags/teg/web/src/META-INF/context.xml b/tags/teg/web/src/META-INF/context.xml new file mode 100644 index 00000000..49b2eb8c --- /dev/null +++ b/tags/teg/web/src/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/GlobalConstants.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/GlobalConstants.java new file mode 100644 index 00000000..5f145417 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/GlobalConstants.java @@ -0,0 +1,38 @@ +/* + * GlobalConstant.java + * + * Created on 27 de Abril de 2005, 18:20 + */ + +package siprp.pagina; + +/** + * + * @author fpalma + */ +public interface GlobalConstants +{ + // BD + public static final String bdHost = "127.0.0.1"; + public static final String bdPort = "5436"; + public static final String bdUsername = "siprp"; + public static final String bdPassword = ""; + public static final String bdDriver = "org.postgresql.Driver"; + public static final String bdUrl = "jdbc:postgresql://" + bdHost + ":" + bdPort + "/siprp"; + + public static final String bdLocalHost = "127.0.0.1"; + public static final String bdLocalPort = "5436"; + public static final String bdLocalUsername = "siprp"; + public static final String bdLocalPassword = ""; + public static final String bdLocalDriver = "org.postgresql.Driver"; + public static final String bdLocalUrl = "jdbc:postgresql://" + bdHost + ":" + bdPort + "/siprp_local_3"; + + public static final String DEFAULT_EMAIL = "geral@siprp.pt"; + + public static final int TIPO_MARCACAO_EXAMES = 0; + public static final int TIPO_MARCACAO_CONSULTA = 1; + + public static final Integer ESTADO_POR_REALIZAR = new Integer( 0 ); + public static final Integer ESTADO_PARCIALMENTE_REALIZADO = new Integer( 1 ); + public static final Integer ESTADO_REALIZADO = new Integer( 2 ); +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/MailerServlet.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/MailerServlet.java new file mode 100644 index 00000000..cbb306f1 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/MailerServlet.java @@ -0,0 +1,240 @@ +/* + * ServletAux.java + * + * Created on 10 de Março de 2005, 12:24 + */ + +package siprp.pagina; + +import javax.activation.*; +import java.io.*; +import java.util.*; + +import javax.mail.*; +import javax.mail.internet.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.sql.*; + +import org.apache.commons.mail.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +import com.evolute.utils.arrays.*; +/** + * + * @author psantos + */ +public class MailerServlet extends HttpServlet + implements GlobalConstants +{ + public static final String EMAIL = "email"; + public static final String EMAIL_MARCACAO = "email_marcacao"; + public static final String EMAIL_RECRUTAMENTO = "email_recrutamento"; + + protected static Hashtable PROPERTIES; + + public void init() + { + + try + { + String TEMPLATE_DIR = this.getServletContext().getRealPath( "/" ) + "html/"; + + Properties props = new Properties(); + props.setProperty( "file.resource.loader.path", TEMPLATE_DIR ); + Velocity.init( props ); + if( PROPERTIES == null ) + { + Class.forName(bdDriver); + Connection con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + ResultSet2DArray array = new ResultSet2DArray( + stmt.executeQuery( "Select name, value FROM properties;" ) ); + PROPERTIES = new Hashtable(); + for( int n = 0; n < array.columnLength(); n++ ) + { + PROPERTIES.put( array.get( n, 0 ), array.get( n, 1 ) ); + } + con.close(); + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + protected String createContent( Hashtable parameters, String[] form_fields, String template ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + for( int i = 0; i < form_fields.length; i++ ) + { + context.put( form_fields[ i ], parameters.get( form_fields[ i ] ) ); + } + + Velocity.mergeTemplate( template, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } + + protected String showResultPage( boolean success, String success_template, String fail_template ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + String template; + if( success ) + { + template = success_template; + } + else + { + template = fail_template; + } + try + { + Velocity.mergeTemplate( template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } + + protected boolean sendMail( String from, String destination, String subject, String content, boolean html ) + { + String smtp_server = "localhost"; + String mailer = "Evolute Mailer"; + + Properties props = System.getProperties(); + props.put( "mail.smtp.host", smtp_server ); + + String content_type = ( html ) ? "text/html" : "text/plain"; + + Session session = Session.getInstance( props, null ); + Message msg = new MimeMessage( session ); + try + { + if( from != null ) + { + msg.setFrom( new InternetAddress( from ) ); + } + msg.setRecipients( Message.RecipientType.TO, InternetAddress.parse( destination, true ) ); + msg.setSubject( subject ); + + msg.setContent( content.toString(), content_type ); + + msg.setHeader( "X-Mailer", mailer ); + msg.setSentDate( new java.util.Date() ); + Transport.send( msg ); + + return true; + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return false; + } + + protected boolean sendMail( String from, String destination, String subject, String content, boolean html, + String filename, byte attachment[], String type ) + { + String smtp_server = "localhost"; + String mailer = "Evolute Mailer"; + + Properties props = System.getProperties(); + props.put( "mail.smtp.host", smtp_server ); + + String content_type = ( html ) ? "text/html" : "text/plain"; + + Session session = Session.getInstance( props, null ); + Message msg = new MimeMessage( session ); + try + { + if( from != null ) + { + msg.setFrom( new InternetAddress( from ) ); + } + msg.setRecipients( Message.RecipientType.TO, InternetAddress.parse( destination, true ) ); + msg.setSubject( subject ); + msg.setHeader( "X-Mailer", mailer ); + msg.setSentDate( new java.util.Date() ); + + Multipart multipart = new MimeMultipart(); + BodyPart messageBodyPart = new MimeBodyPart(); + messageBodyPart.setContent( content.toString(), content_type ); + multipart.addBodyPart(messageBodyPart); + + messageBodyPart = new MimeBodyPart(); +// messageBodyPart.setDataHandler( +// new DataHandler( new ByteArrayDataSource( attachment, "/siprpWeb/test.txt" ))); + messageBodyPart.setContent( attachment, content_type ); + DataSource source = new ByteArrayDataSource(attachment, type); + messageBodyPart.setDataHandler( + new DataHandler(source)); + messageBodyPart.setFileName(filename); + + multipart.addBodyPart(messageBodyPart); + msg.setContent(multipart); + + Transport.send( msg ); + + return true; + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return false; + } + + private String checkParameter( String parameter ) + { + if( parameter != null && parameter.trim().length() > 0 ) + { + return parameter.trim(); + } + + return null; + } + + protected Hashtable parseParameters( Hashtable parameters ) + { + Hashtable tmp = new Hashtable(); + String[] element; + String key; + String new_element; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + element = ( String[] ) parameters.get( key ); + if( element != null ) + { + new_element = checkParameter( element[ 0 ] ); + if( new_element != null ) + { + tmp.put( key, new_element ); + } + } + } + + return tmp; + } +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/NewsServlet.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/NewsServlet.java new file mode 100644 index 00000000..5122d6b2 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/NewsServlet.java @@ -0,0 +1,168 @@ +/* + * NewsServlet.java + * + * Created on 20 de Maio de 2005, 17:48 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; +import javax.servlet.*; +import javax.servlet.http.*; +import java.sql.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; + +/** + * + * @author lflores + */ +public class NewsServlet extends HttpServlet + implements GlobalConstants +{ + private static DBManager DBM = null; + + private static final Select SELECT = new Select( new String[]{ "not_noticias" }, + new String[]{"data", "noticia"}, new Field( "id" ).in( + new Field( "( SELECT MAX( id ) FROM not_noticias )" ) ) ); + + private SQLExecuter executer = null; + + private static boolean velocityInit = false; + + public void init() + { + if( !velocityInit ) + { + try + { + String TEMPLATE_DIR = this.getServletContext().getRealPath( "/" ) + "html/"; + + Properties props = new Properties(); + props.setProperty( "file.resource.loader.path", TEMPLATE_DIR ); + Velocity.init( props ); + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + velocityInit = true; + } + + if( DBM != null ) + { + return; + } + + try + { + DBM = new JDBCManager( bdUrl + "?prepareThreshold=1", + bdUsername, bdPassword , 8, 8, 0, new SQLQuery[] {} ); + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + private void close() + { + try + { + DBM.close(); + DBM = null; + } + catch( Exception ex ) + { + // we come here after an error + // so we discard this exception + } + } + + private String getNews() + { +//System.err.println( "NEWS: BEGIN" ); + try + { + if( executer == null ) + { + executer = ( SQLExecuter )DBM.getSharedExecuter(); + } + Virtual2DArray array = executer.executeQuery( SELECT ); + Object o[][] = array.getObjects(); + if( o != null && o.length > 0 ) + { +//System.err.println( "NEWS: " + o[ 0 ][ 0 ].toString() ); + return + //o[ 0 ][ 0 ].toString() + + StringConverter.unicodeToHTML( o[ 0 ][ 1 ].toString() ); + } + } + catch( Exception ex ) + { +//System.err.println( "NEWS: EX" ); + ex.printStackTrace(); + close(); + } +//System.err.println( "NEWS: END" ); + return null; + } + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { +//System.err.println( "NEWS: GET BEGIN" ); + init(); +//System.err.println( "NEWS: AF INIT" ); + ServletOutputStream out = res.getOutputStream(); +// String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + String news = getNews(); + Hashtable parameters = new Hashtable(); + if( news == null ) + { + parameters.put( "noticias", "" ); + } + else + { + parameters.put( "noticias", news ); + } +//System.err.println( "NEWS: BF SHOW" ); + out.println( showPage( "noticias/mostrar_noticias.html", parameters ) ); + } + + private String showPage( String page, Hashtable parameters ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + if( parameters != null ) + { + String key; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + context.put( key, parameters.get( key ) ); + } + } + + Velocity.mergeTemplate( page, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RecruitServlet.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RecruitServlet.java new file mode 100644 index 00000000..e37dfc7d --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RecruitServlet.java @@ -0,0 +1,127 @@ +/* + * RequestServlet.java + * + * Created on 4 de Março de 2005, 18:19 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.commons.fileupload.*; + +/** + * + * @author psantos + */ +public class RecruitServlet extends MailerServlet +{ + private final static String REC_FUNCAO = "rec_funcao"; + private final static String REC_NOME = "rec_nome"; + private final static String REC_MORADA = "rec_morada"; + private final static String REC_TELEFONE = "rec_telefone"; + private final static String REC_EMAIL = "rec_email"; + private final static String REC_CV = "rec_cv"; + + private final static String[] FORM_FIELDS = new String[]{ + REC_FUNCAO, REC_NOME, REC_MORADA, + REC_TELEFONE, REC_EMAIL, REC_CV + }; + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + Hashtable parameters; + String fileName = ""; + String type = ""; + byte file[] = new byte[0]; + boolean isMultipart = FileUpload.isMultipartContent( req ); + + ServletOutputStream out = res.getOutputStream(); + res.setContentType( "text/html" ); + + if( isMultipart ) + { + parameters = new Hashtable(); + DiskFileUpload upload = new DiskFileUpload(); + upload.setSizeThreshold(1000000); + upload.setSizeMax(1000000); + List items; + try + { + items = upload.parseRequest(req); + } + catch( FileUploadException ex ) + { + out.println( showResultPage( false, "mail/pedido_enviado.html", "mail/pedido_nao_enviado.html" ) ); + return; + } + Iterator iter = items.iterator(); + while( iter.hasNext() ) + { + FileItem item = (FileItem) iter.next(); + + if (item.isFormField()) + { + String name = item.getFieldName(); + String value = item.getString(); + parameters.put( name, value ); + } + else + { + String fieldName = item.getFieldName(); + fileName = item.getName(); + file = item.get(); + if( file == null || file.length == 0 ) + { + isMultipart = false; + } + type = item.getContentType(); + } + } + } + else + { + parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + } + String content = createContent( parameters, FORM_FIELDS, "mail/envio_cv.txt" ); + + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL_RECRUTAMENTO ) ) + { + email = ( String ) PROPERTIES.get( EMAIL_RECRUTAMENTO ); + } + String from = email; + String destination = email; + String subject = "Envio de CV através do site www.siprp.pt"; + // manda mail + boolean success; + String nome = ( String ) parameters.get( REC_NOME ); + String telefone = ( String ) parameters.get( REC_TELEFONE ); + String mail = ( String ) parameters.get( REC_EMAIL ); + if( nome == null || nome.trim().length() == 0 || telefone == null || telefone.trim().length() == 0 || + mail == null || mail.trim().length() == 0 || mail.indexOf( '@' ) == -1 ) + { +System.out.println( "nome: " + nome + " teefone: " + telefone + " email : " + email ); + success = false; + } + else if( isMultipart ) + { +System.out.println( "Multipart" ); + success = sendMail( from, destination, subject, content, false, fileName, file, type ); + } + else + { +System.out.println( "Normal" ); + success = sendMail( from, destination, subject, content, false ); + } + + // mostra pagina correspondente + + out.println( showResultPage( success, "mail/cv_enviado.html", "mail/cv_nao_enviado.html" ) ); + } +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RelatorioServlet.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RelatorioServlet.java new file mode 100644 index 00000000..8ed2403f --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RelatorioServlet.java @@ -0,0 +1,121 @@ +/* + * RelatorioServlet.java + * + * Created on 27 de Abril de 2005, 16:16 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; +/** + * + * @author fpalma + */ +public class RelatorioServlet extends MailerServlet +{ + private final static String EMPRESA = "empresa"; + private final static String EMAIL_EMPRESA = "email_empresa"; + private final static String ANO = "ano"; + + private final static String[] FORM_FIELDS = new String[]{ + EMPRESA, ANO, EMAIL_EMPRESA }; + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + Hashtable parameters = new Hashtable(); + + // Ir buscar os parametros à sessão + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "relatorio/pedido_sessao_expirou.html", null ) ); + return; + } + + out.println( showPage( "relatorio/pedido_relatorio.html", parameters ) ); + } + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + // Info de marcacao + // Dados que vem no pedido: marcacao_tipo, data, hora + Hashtable parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + + // Ir buscar o resto dos parametros à sessão + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "relatorio/pedido_sessao_expirou.html", null ) ); + return; + } + + parameters.put( EMPRESA, session.getAttribute( siprpServlet.sessionCompanyName ) ); + String from = ( String ) session.getAttribute( siprpServlet.sessionCompanyEmail ); + + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL ) ) + { + email = ( String ) PROPERTIES.get( EMAIL ); + } + String destination = email; + String subject = "Pedido de envio de relatorio via web"; + if( parameters.get( ANO ) == null ) + { + parameters.put( ANO, "corrente" ); + } + String content = createContent( parameters, FORM_FIELDS, "relatorio/pedido.html" ); + // manda mail + boolean success = sendMail( from, destination, subject, content, true ); + + // mostra pagina correspondente + out.println( showResultPage( success, "relatorio/pedido_enviado.html", "relatorio/pedido_nao_enviado.html" ) ); + } + + private String showPage( String page, Hashtable parameters ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + if( parameters != null ) + { + String key; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + context.put( key, parameters.get( key ) ); + } + } + + Velocity.mergeTemplate( page, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RequestServlet.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RequestServlet.java new file mode 100644 index 00000000..af514f89 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/RequestServlet.java @@ -0,0 +1,63 @@ +/* + * RequestServlet.java + * + * Created on 4 de Março de 2005, 18:19 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +/** + * + * @author psantos + */ +public class RequestServlet extends MailerServlet +{ + private final static String REQUEST_NAME = "request_name"; + private final static String REQUEST_PHONE = "request_phone"; + private final static String REQUEST_EMAIL = "request_email"; + private final static String REQUEST_DETAILS = "request_details"; + + private final static String[] FORM_FIELDS = new String[]{ + REQUEST_NAME, REQUEST_PHONE, + REQUEST_EMAIL, REQUEST_DETAILS + }; + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + res.setContentType( "text/html" ); + + /* + parametros: + request_name + request_phone + request_email + request_details + */ + // recebe info de contacto + Hashtable parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + + String content = createContent( parameters, FORM_FIELDS, "mail/pedido_informacao.txt" ); + + String from = ( String ) parameters.get( REQUEST_EMAIL ); + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL ) ) + { + email = ( String ) PROPERTIES.get( EMAIL ); + } + String destination = email; + String subject = "Pedido de informação através do site www.siprp.pt"; + // manda mail + boolean success = sendMail( from, destination, subject, content, false ); + + // mostra pagina correspondente + out.println( showResultPage( success, "mail/pedido_enviado.html", "mail/pedido_nao_enviado.html" ) ); + } +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/ScheduleServlet.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/ScheduleServlet.java new file mode 100644 index 00000000..51feffb6 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/ScheduleServlet.java @@ -0,0 +1,142 @@ +/* + * ScheduleServlet.java + * + * Created on 10 de Março de 2005, 12:22 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; + +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +/** + * + * @author psantos + */ +public class ScheduleServlet extends MailerServlet +{ + private final static String EMPRESA = "empresa"; + private final static String ESTABELECIMENTO = "estabelecimento"; + private final static String FUNCIONARIO = "funcionario"; + private final static String MARCACAO_TIPO = "marcacao_tipo"; + private final static String DATA = "data"; + private final static String HORA = "hora"; + private final static String EMAIL_EMPRESA = "email_empresa"; + + private final static String[] FORM_FIELDS = new String[]{ + EMPRESA, ESTABELECIMENTO, FUNCIONARIO, + MARCACAO_TIPO, DATA, HORA, EMAIL_EMPRESA + }; + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + Hashtable parameters = new Hashtable(); + + // Ir buscar os parametros à sessão + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "marcacao/marcacao_sessao_expirou.html", null ) ); + return; + } + + parameters.put( EMPRESA, session.getAttribute( siprpServlet.sessionCompanyName ) ); + parameters.put( ESTABELECIMENTO, session.getAttribute( "session_estabelecimento_nome" ) ); + parameters.put( FUNCIONARIO, session.getAttribute( "session_funcionario_nome" ) ); + + String tokens[] = queryString.split( "[?]" ); + if( tokens.length > 0 && tokens[ tokens.length - 1 ].equals( "consulta" ) ) + { + out.println( showPage( "marcacao/marcacao_consulta.html", parameters ) ); + } + else + { + out.println( showPage( "marcacao/marcacao_exame.html", parameters ) ); + } + } + + public void doPost( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String queryString = req.getQueryString(); + res.setContentType( "text/html" ); + + // Info de marcacao + // Dados que vem no pedido: marcacao_tipo, data, hora + Hashtable parameters = parseParameters( new Hashtable( req.getParameterMap() ) ); + + // Ir buscar o resto dos parametros à sessão + HttpSession session = req.getSession( false ); + if( session == null ) + { + // timeout + out.println( showPage( "marcacao/marcacao_sessao_expirou.html", null ) ); + return; + } + + parameters.put( EMPRESA, session.getAttribute( siprpServlet.sessionCompanyName ) ); + parameters.put( ESTABELECIMENTO, session.getAttribute( "session_estabelecimento_nome" ) ); + parameters.put( FUNCIONARIO, session.getAttribute( "session_funcionario_nome" ) ); + //parameters.put( session.getAttribute( "session_funcionario_numero" ) ); + + String from = ( String ) session.getAttribute( siprpServlet.sessionCompanyEmail ); + + String marcacao_tipo = ( String )parameters.get( MARCACAO_TIPO ); + + String email = DEFAULT_EMAIL; + if( PROPERTIES != null && PROPERTIES.containsKey( EMAIL_MARCACAO ) ) + { + email = ( String ) PROPERTIES.get( EMAIL_MARCACAO ); + } + String destination = email; + String subject = "Pedido de marca\u00e7\u00e3o de " + marcacao_tipo + " via web"; + String content = createContent( parameters, FORM_FIELDS, "marcacao/marcacao.html" ); + // manda mail + boolean success = sendMail( from, destination, subject, content, true ); + + // mostra pagina correspondente + out.println( showResultPage( success, "marcacao/marcacao_enviada.html", "marcacao/marcacao_nao_enviada.html" ) ); + } + + private String showPage( String page, Hashtable parameters ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + if( parameters != null ) + { + String key; + for( Enumeration e = parameters.keys(); e.hasMoreElements(); ) + { + key = ( String ) e.nextElement(); + context.put( key, parameters.get( key ) ); + } + } + + Velocity.mergeTemplate( page, Velocity.ENCODING_DEFAULT, context, output ); + + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + + return null; + } +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java new file mode 100644 index 00000000..60303b2f --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEmpresas.java @@ -0,0 +1,113 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetListaEmpresas extends siprpServlet{ + + /** Creates a new instance of doGetListaEmpresas */ + public doGetListaEmpresas(HttpServletRequest req, HttpServletResponse res) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + String userRole="", temp=""; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); +String empresa_nome; + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); +empresa_nome = ( String ) session.getAttribute( sessionCompanyName ); + + if (userRole == null) + { + throw new IllegalStateException(); + } + + if ( userRole.equals ( super.superUserRole ) ) + { +empresa_nome = null; + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT id, designacao_social, designacao_social_plain FROM empresas WHERE inactivo <> 'y' ORDER BY designacao_social_plain" ); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + int index=0; + int max = rs.columnLength(); + + while ( index < max ) + { + String str = (String)rs.get(index,1); + if( str != null && str.trim().length() > 0 ) + { + temp=""+rs.get(index,0); // converter de int para String + dbQuery = new StringBuffer(); + dbQuery.append("/"+super.servletName+"/?"+temp); // contruir url + links.add(dbQuery.toString()); + desc.add((String)rs.get(index,1)); + } + ++index; + } + stmt.close(); + con.close(); + + +session.setAttribute( sessionEstabelecimentoId, null ); + +HashMap hmValues = new HashMap(); +//hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); +hmValues.put( "empresa_nome", empresa_nome ); +hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); +hmValues.put( "estabelecimento_id", session.getAttribute( sessionEstabelecimentoId ) ); +hmValues.put( "userRole", userRole ); +hmValues.put( "userName", session.getAttribute( sessionUser ) ); +hmValues.put( msgTemplate , super.msgListaEmpresas ) ; +hmValues.put( templateUserRole, userRole); +hmValues.put( templateQuery, super.queryStringEmpresas ); +hmValues.put( templateVector1,links); +hmValues.put( templateVector2,desc); +hmValues.put( templateVector3,null); +out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + + + //out.println( mergeTemplate( super.msgListaEmpresas, userRole, super.queryStringEmpresas, links, desc, null, super.authenticatedUserTemplate) ); + + } + else + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + + } + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, super.errorTemplate) ); + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , userRole, super.errorTemplate) ); + } + } + +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java new file mode 100644 index 00000000..4e8b9642 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaEstabelecimentos.java @@ -0,0 +1,105 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetListaEstabelecimentos extends siprpServlet{ + + /** Creates a new instance of doGetListaEstabelecimentos */ + public doGetListaEstabelecimentos(HttpServletRequest req, HttpServletResponse res) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery, sBuffer; + String userRole, empresaId, temp; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + + if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + { + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( " SELECT id, nome, nome_plain FROM estabelecimentos WHERE inactivo <> 'y' AND empresa_id = '"+empresaId+"' order by nome_plain" ); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + int index=0; + int max = rs.columnLength(); + + while ( index < max ) + { + temp=""+rs.get(index,0); // converter de int para String + dbQuery = new StringBuffer(); + dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+temp); // contruir url + links.add(dbQuery.toString()); + desc.add((String)rs.get(index,1)); + ++index; + } + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+""); + +if( userRole.equals( "manager" ) ) +{ + session.setAttribute( sessionCompanyName, nomeEmpresa( con, ( String ) session.getAttribute( sessionEmpresaId ) ) ); +} +else +{ + session.setAttribute( sessionCompanyName, nomeEmpresa( con, userRole ) ); +} + +session.setAttribute( sessionCompanyEmail, emailEmpresa( con, empresaId ) ); + +session.setAttribute( sessionEstabelecimentoId, null ); + +HashMap hmValues = new HashMap(); +hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); +hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); +hmValues.put( "estabelecimento_id", session.getAttribute( sessionEstabelecimentoId ) ); +hmValues.put( "userRole", userRole ); +hmValues.put( "userName", session.getAttribute( sessionUser ) ); +hmValues.put( msgTemplate , sBuffer.toString() ) ; +hmValues.put( templateUserRole, userRole); +hmValues.put( templateQuery, super.queryStringEstabelecimentos ); +hmValues.put( templateVector1,links); +hmValues.put( templateVector2,desc); +hmValues.put( templateVector3,null); +out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringEstabelecimentos, links, desc, null, super.authenticatedUserTemplate) ); + stmt.close(); + con.close(); + } + else + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java new file mode 100644 index 00000000..f7d03c60 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadores.java @@ -0,0 +1,299 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetListaTrabalhadores extends siprpServlet{ + + /** Creates a new instance of doGetListaTrabalhadores */ + public doGetListaTrabalhadores(HttpServletRequest req, HttpServletResponse res, String query) throws IOException + { + boolean print = false; + if( query != null ) + { + print = query.indexOf( "_print" ) != -1; + if( query.indexOf( "trabalhadores_tudo" ) == 0 ) + { + new doGetListaTrabalhadoresTudo( req, res, print ); + return; + } + else if( query.indexOf( "trabalhadores_pendentes" ) == 0 ) + { + new doGetListaTrabalhadoresPendentes( req, res, print ); + return; + } + } + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs, rsTrab; + StringBuffer sBuffer; + String userRole, empresaId, estabelecimentoId, temp; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + Vector descAdicional = new Vector(); + java.util.Date today = new java.util.Date(); + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); + + if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + { + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + if ( super.verificaEstabelecimento(con, empresaId, estabelecimentoId) ) // estabelecimento pertence à empresa ?? + { + //Class.forName(super.bdDriver); + //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); + String dbQuery = "SELECT id, nome, nome_plain FROM trabalhadores WHERE inactivo <> 'y' AND data_demissao IS NULL AND estabelecimento_id = '"+estabelecimentoId+"' ORDER BY nome_plain"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rsTrab = new ResultSet2DArray( stmt.executeQuery( dbQuery ) ); + rsTrab.getObjects(); + stmt.close(); + + final int max = rsTrab.columnLength(); + + for ( int index = 0; index < max; index++ ) + { + Integer id = (Integer)rsTrab.get(index,0); + String link = "/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+id; + links.add(link); + HashMap trabalhador = new HashMap(); + trabalhador.put( "Nome", (String)rsTrab.get(index,1) ); + + + dbQuery = "SELECT id, data, estado FROM marcacoes_trabalhador " + + "WHERE tipo = 1 and trabalhador_id = " + id + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery ) ); + rs.getObjects(); + stmt.close(); + if( rs.columnLength() > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + java.util.Date dataConsulta1; + // java.util.Date dataRelatorio1; + // java.util.Date dataRelatorio2 = (java.util.Date) rs.get( 0, 3 ); + Integer estado1; + String realizada1 = ""; + String realizada2 = ""; + if( rs.columnLength() >= 2 ) + { + dataConsulta1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); + // dataRelatorio1 = (java.util.Date) rs.get( 1, 3 ); + } + else + { + dataConsulta1 = dataConsulta2; + estado1 = estado2; + // dataRelatorio1 = dataRelatorio2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || today.after( dataConsulta2 ) ) + { + trabalhador.put( "ultima_consulta", dataConsulta2 ); + if( estado2.equals( ESTADO_POR_REALIZAR ) ) + { + realizada2 = "não"; + } + else if( estado2.equals( ESTADO_REALIZADO ) ) + { + realizada2 = "sim"; + } + trabalhador.put( "realizada", realizada2 ); + trabalhador.put( "proxima_consulta", "" ); + } + else + { + try + { + for( int c = 1; c < rs.columnLength(); c++ ) + { + java.util.Date dataTemp = ( java.util.Date ) rs.get( c, 1 ); + dataConsulta1 = dataTemp; + estado1 = ( Integer ) rs.get( c, 2 ); + if( dataTemp.after( today ) ) + { + dataConsulta2 = dataTemp; + } + else + { + break; + } + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + trabalhador.put( "proxima_consulta", dataConsulta2 ); + + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + if( estado1.equals( ESTADO_POR_REALIZAR ) ) + { + realizada1 = "não"; + } + else if( estado1.equals( ESTADO_REALIZADO ) ) + { + realizada1 = "sim"; + } + trabalhador.put( "realizada", realizada1 ); + trabalhador.put( "ultima_consulta", dataConsulta1 ); + } + else + { + trabalhador.put( "ultima_consulta", "" ); + trabalhador.put( "realizada", null ); + } + } + } + else + { + trabalhador.put( "ultima_consulta", "" ); + trabalhador.put( "realizada", null ); + trabalhador.put( "proxima_consulta", "" ); + } + + + dbQuery = "SELECT id, data, estado FROM marcacoes_trabalhador " + + "WHERE tipo = 0 and trabalhador_id = " + id + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery ) ); + rs.getObjects(); + stmt.close(); + if( rs.columnLength() > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + Integer estado1; + java.util.Date dataConsulta1; + // java.util.Date dataRelatorio1; + // java.util.Date dataRelatorio2 = (java.util.Date) rs.get( 0, 3 ); + String realizada1 = ""; + String realizada2 = ""; + if( rs.columnLength() >= 2 ) + { + dataConsulta1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); + // dataRelatorio1 = (java.util.Date) rs.get( 1, 3 ); + } + else + { + dataConsulta1 = dataConsulta2; + estado1 = estado2; + // dataRelatorio1 = dataRelatorio2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || today.after( dataConsulta2 ) ) + { + trabalhador.put( "ultimo_exame", dataConsulta2 ); + if( estado2.equals( ESTADO_POR_REALIZAR ) ) + { + realizada2 = "não"; + } + else if( estado2.equals( ESTADO_REALIZADO ) ) + { + realizada2 = "sim"; + } + trabalhador.put( "realizado", realizada2 ); + trabalhador.put( "proximo_exame", "" ); + } + else + { + trabalhador.put( "proximo_exame", dataConsulta2 ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + if( estado1.equals( ESTADO_POR_REALIZAR ) ) + { + realizada1 = "não"; + } + else if( estado1.equals( ESTADO_REALIZADO ) ) + { + realizada1 = "sim"; + } + trabalhador.put( "realizado", realizada1 ); + trabalhador.put( "ultimo_exame", dataConsulta1 ); + } + else + { + trabalhador.put( "ultimo_exame", "" ); + trabalhador.put( "realizado", null ); + } + } + } + else + { + trabalhador.put( "ultimo_exame", "" ); + trabalhador.put( "realizado", null ); + trabalhador.put( "proximo_exame", "" ); + } + + desc.add( trabalhador ); + } + + + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" + +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , sBuffer.toString() ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, super.queryStringTrabalhadores ); + hmValues.put( templateVector1,links); + hmValues.put( templateVector2,desc); + hmValues.put( templateVector3,null); + if( !print ) + { + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); + } +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); + } + else // est não pertence à empresa + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + con.close(); + } + else // Role não permite ver esta informação + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresPendentes.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresPendentes.java new file mode 100644 index 00000000..d6dfde6e --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresPendentes.java @@ -0,0 +1,879 @@ +/* + * doGetListaTrabalhadoresPendentes.java + * + * Created on 22 de Abril de 2005, 15:56 + */ + +package siprp.pagina; + +import java.io.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import java.sql.*; +import java.util.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.data.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; + +/** + * + * @author fpalma + */ +public class doGetListaTrabalhadoresPendentes + extends siprpServlet +{ + private static final long TRES_MESES = 3L * 30L * 24L * 60L * 60L * 1000L; + private static final long CATORZE_DIAS = 14L * 24L * 60L * 60L * 1000L; + + protected static final int ESTADO_NAO_APLICAVEL = 0; + protected static final int ESTADO_PENDENTE = 1; + protected static final int ESTADO_MARCADO = 2; + protected static final int ESTADO_TRATADO = 3; + + protected static int MOTIVO_ADMISSAO = 1; + protected static int MOTIVO_PERIODICA = 2; + protected static int MOTIVO_OCASIONAL = 3; + protected static int MOTIVO_PERIODICA_INICIAL = 5; + + protected static final Hashtable CORES_ESTADOS = new Hashtable(); + protected static final Hashtable TEXTOS_ESTADOS = new Hashtable(); + static + { + CORES_ESTADOS.put( new Integer( ESTADO_NAO_APLICAVEL ), "white" ); + CORES_ESTADOS.put( new Integer( ESTADO_PENDENTE ), "red" ); + CORES_ESTADOS.put( new Integer( ESTADO_MARCADO ), "yellow" ); + CORES_ESTADOS.put( new Integer( ESTADO_TRATADO ), "green" ); + + TEXTOS_ESTADOS.put( new Integer( ESTADO_NAO_APLICAVEL ), "n.a." ); + TEXTOS_ESTADOS.put( new Integer( ESTADO_PENDENTE ), "pendente" ); + TEXTOS_ESTADOS.put( new Integer( ESTADO_MARCADO ), "pendente" ); +// TEXTOS_ESTADOS.put( new Integer( ESTADO_TRATADO ), "green" ); + } + + protected java.sql.Date today; + protected long todayMillis; + + /** Creates a new instance of doGetListaTrabalhadores */ +// public doGetListaTrabalhadoresPendentes(HttpServletRequest req, HttpServletResponse res, boolean print) +// throws IOException +// { +// ServletOutputStream out = res.getOutputStream(); +// Connection con = null ; +// Statement stmt = null ; +// ResultSet2DArray rs; +// StringBuffer dbQuery, sBuffer; +// String userRole, empresaId, estabelecimentoId, temp; +// HttpSession session = req.getSession(false); +// Vector links = new Vector(); +// Vector desc = new Vector(); +// Vector descAdicional = new Vector(); +//// today = new java.util.Date(); +//// todayMillis = today.getTime(); +// +// try +// { +// stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); +// rs = new ResultSet2DArray( stmt.executeQuery( "SELECT CURRENT_DATE" ) ); +// today = ( java.sql.Date ) rs.get( 0, 0 ); +// stmt.close(); +// todayMillis = today.getTime(); +// +// userRole = (String)session.getAttribute(super.sessionUserRole); +// empresaId = (String)session.getAttribute(super.sessionEmpresaId); +// estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); +// +// if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) +// { +// Class.forName(super.bdDriver); +// con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); +// if ( super.verificaEstabelecimento(con, empresaId, estabelecimentoId) ) // estabelecimento pertence à empresa ?? +// { +// //Class.forName(super.bdDriver); +// //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); +// dbQuery = new StringBuffer(); +// dbQuery.append( "SELECT trabalhadores.id, trabalhadores.nome, " +// + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " +// + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo " +// + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id )" +// + "WHERE estabelecimento_id = " + estabelecimentoId +// + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " +// + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " +// + "ORDER BY 6, 3, 4 DESC " ); +// // dbQuery.append( "SELECT id, nome, ( ultima_consulta IS NOT NULL AND realizada = 'y' )," +// // + " ( ultimo_exame IS NOT NULL AND realizado = 'y' )," +// // + " proxima_consulta IS NOT NULL, proximo_exame IS NOT NULL, " +// // + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 ), " +// // + " ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 )" +// // + " FROM trabalhadores " +// // + " WHERE estabelecimento_id = '"+estabelecimentoId+"'" +// // + " AND ( ultima_consulta IS NULL OR realizada = 'n' OR" +// // + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 )" +// // + " OR ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 ) )" +// // + " ORDER BY nome" ); +// stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); +// rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); +// +// int index=0; +// int max = rs.columnLength(); +// +// Integer trabalhadorID = new Integer( -1 ); +// String nomeTrabalhador = ""; +// Vector consultas = new Vector(); +// Vector exames = new Vector(); +// +// for ( index = 0; index <= max; index++ ) +// { +// Integer id = index < max ? ( Integer ) rs.get( index, 0 ) : new Integer( -1 ); +// if( !id.equals( trabalhadorID ) ) +// { +// Object listaConsultas[][] = ( Object[][] ) consultas.toArray( new Object[consultas.size()][3] ); +// Object listaExames[][] = ( Object[][] ) exames.toArray( new Object[exames.size()][3] ); +// if( trabalhadorID.intValue() > -1 && +// verificarTrabalhador( listaConsultas, listaExames ) ) +// { +// temp=""+rs.get(index - 1,0); // converter de int para String +// dbQuery = new StringBuffer(); +// dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+temp); // contruir url +// links.add(dbQuery.toString()); +// desc.add( criarDadosTrabalhador( con, trabalhadorID, nomeTrabalhador, listaConsultas, listaExames ) ); +// } +// exames.clear(); +// consultas.clear(); +// } +// if( index == max ) +// { +// break; +// } +// Integer tipo = ( Integer ) rs.get( index, 2 ); +// +// String nome = ( String ) rs.get( index, 1 ); +// java.util.Date data = ( java.util.Date ) rs.get( index, 3 ); +// Integer estado = ( Integer ) rs.get( index, 4 ); +// Integer motivo = ( Integer ) rs.get( index, 6 ); +// trabalhadorID = id; +// nomeTrabalhador = nome; +// Object marcacao[] = new Object[]{ data, estado, motivo }; +// if( tipo == null ) +// { +// continue; +// } +// switch( tipo.intValue() ) +// { +// case TIPO_MARCACAO_EXAMES: +// exames.add( marcacao ); +// break; +// +// case TIPO_MARCACAO_CONSULTA: +// consultas.add( marcacao ); +// break; +// } +// } +// stmt.close(); +// +// sBuffer = new StringBuffer(); +// sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" +// +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); +// +// HashMap hmValues = new HashMap(); +// hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); +// hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); +// hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); +// hmValues.put( "estabelecimento_id", estabelecimentoId ); +// hmValues.put( "userRole", userRole ); +// hmValues.put( "userName", session.getAttribute( sessionUser ) ); +// hmValues.put( msgTemplate , sBuffer.toString() ) ; +// hmValues.put( templateUserRole, userRole); +// hmValues.put( templateQuery, "trabalhadores_pendentes" ); +// hmValues.put( templateVector1,links); +// hmValues.put( templateVector2,desc); +// hmValues.put( templateVector3,null); +// if( !print ) +// { +// out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); +// } +// else +// { +// out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); +// } +//// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); +// } +// else // est não pertence à empresa +// { +// out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); +// } +// con.close(); +// } +// else // Role não permite ver esta informação +// { +// out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); +// } +// } +// catch ( SQLException e ) +// { +// e.printStackTrace(); +// out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); +// } +// catch ( Exception e ) +// { +// e.printStackTrace(); +// out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); +// } +// } + + public doGetListaTrabalhadoresPendentes(HttpServletRequest req, HttpServletResponse res, boolean print ) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + String userRole, empresaId, estabelecimentoId; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + Vector descAdicional = new Vector(); +// today = new java.util.Date(); +// todayMillis = today.getTime(); + + try + { + Executer executer = getExecuter(); + Virtual2DArray array = executer.executeQuery( new Select( "SELECT CURRENT_DATE" ) ); + today = ( java.sql.Date ) array.get( 0, 0 ); + todayMillis = today.getTime(); + + userRole = (String)session.getAttribute(sessionUserRole); + empresaId = (String)session.getAttribute(sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(sessionEstabelecimentoId); + + if ( userRole.equals ( superUserRole ) || userRole.equals ( empresaId ) ) + { + if ( verificaEstabelecimento(null, empresaId, estabelecimentoId) ) // estabelecimento pertence à empresa ?? + { + //Class.forName(super.bdDriver); + //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); + String query = "( SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data " + + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " + + " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA + + " AND marcacoes_trabalhador.motivo <> " + MOTIVO_OCASIONAL + " )" + + " UNION " + + "( SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data + 90 " + + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " + + " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_EXAMES + " )" + + "ORDER BY 6, 8, 3 DESC "; + array = executer.executeQuery( new Select( query ) ); + + query = "SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain, marcacoes_trabalhador.motivo, marcacoes_trabalhador.data " + + "FROM trabalhadores LEFT JOIN marcacoes_trabalhador ON ( marcacoes_trabalhador.trabalhador_id = trabalhadores.id ) " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + " AND marcacoes_trabalhador.estado NOT IN ( 3, 4, 5) " + + " AND marcacoes_trabalhador.tipo = " + TIPO_MARCACAO_CONSULTA + + " AND marcacoes_trabalhador.motivo = " + MOTIVO_OCASIONAL + + " ORDER BY 6, 8, 3 DESC"; + Virtual2DArray ocasionaisArray = executer.executeQuery( new Select( query ) ); + + query = "SELECT trabalhadores.id, trabalhadores.nome " + + "FROM trabalhadores " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL;"; + Virtual2DArray trabalhadoresArray = executer.executeQuery( new Select( query ) ); + + Hashtable marcacoesPorID = new Hashtable(); + Hashtable ocasionaisPorID = new Hashtable(); + Hashtable nomesPorID = new Hashtable(); + for( int n = 0; n < trabalhadoresArray.columnLength(); n++ ) + { + nomesPorID.put( trabalhadoresArray.get( n, 0 ), trabalhadoresArray.get( n, 1 ) ); + } + + preencherMarcacoes( array, nomesPorID, marcacoesPorID ); + preencherMarcacoes( ocasionaisArray, nomesPorID, ocasionaisPorID ); + + Integer ids[] = ( Integer[] ) nomesPorID.keySet().toArray( new Integer[0] ); + IDObject trabalhadores[] = new IDObject[ ids.length ]; + for( int n = 0; n < ids.length; n++ ) + { + trabalhadores[ n ] = new MappableObject( ids[ n ], nomesPorID.get( ids[ n ] ) ); + } + Arrays.sort( trabalhadores, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + String nome1 = StringPlainer.convertString( o1.toString() ); + String nome2 = StringPlainer.convertString( o2.toString() ); + return nome1.compareTo( nome2 ); + } + } ); + + for( int n = 0; n < trabalhadores.length; n++ ) + { + Object marcacoes[][]; + if( marcacoesPorID.containsKey( trabalhadores[ n ].getID() ) ) + { + marcacoes = ( Object[][] ) ( ( Vector )marcacoesPorID.get( trabalhadores[ n ].getID() ) ).toArray( new Object[ 0 ][] ); + } + else + { + marcacoes = new Object[0][]; + } + Object ocasionais[][]; + if( ocasionaisPorID.containsKey( trabalhadores[ n ].getID() ) ) + { + ocasionais = ( Object[][] ) ( ( Vector )ocasionaisPorID.get( trabalhadores[ n ].getID() ) ).toArray( new Object[ 0 ][] ); + } + else + { + ocasionais = new Object[ 0 ][]; + } + Object agrupadas[][] = agruparMarcacoes( marcacoes, ocasionais ); + acrescentarTrabalhador( empresaId, estabelecimentoId, + trabalhadores[ n ], null, + agrupadas, links, desc, + perfilTemConsultas( trabalhadores[ n ].getID(), new Integer( empresaId ) ), + perfilTemExames( trabalhadores[ n ].getID(), new Integer( empresaId ) ) ); + } + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", nomeEstabelecimento( null, estabelecimentoId ) ); + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , ""+nomeEmpresa(null,empresaId)+"

" + +nomeEstabelecimento(null, estabelecimentoId)+"" ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, "trabalhadores_pendentes" ); + hmValues.put( templateVector1,links); + hmValues.put( templateVector2,desc); + hmValues.put( templateVector3,null); + if( !print ) + { + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); + } +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); + } + else // est não pertence à empresa + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + } + else // Role não permite ver esta informação + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + + protected void preencherMarcacoes( Virtual2DArray array, Hashtable nomesPorID, Hashtable marcacoesPorID ) + { + int max = array.columnLength(); + for( int index = 0; index < max; index++ ) + { + Integer id = index < max ? ( Integer ) array.get( index, 0 ) : new Integer( -1 ); + Integer tipo = ( Integer ) array.get( index, 2 ); + String nome = ( String ) array.get( index, 1 ); + java.util.Date data = ( java.util.Date ) array.get( index, 3 ); + Integer estado = ( Integer ) array.get( index, 4 ); + Integer motivo = ( Integer ) array.get( index, 6 ); + if( !marcacoesPorID.containsKey( id ) ) + { + nomesPorID.put( id, nome ); + marcacoesPorID.put( id, new Vector() ); + } + if( data != null ) + { + Object marcacao[] = new Object[]{ data, estado, motivo, tipo }; + ( ( Vector ) marcacoesPorID.get( id ) ).add( marcacao ); + } + } + } + + protected Object[][] agruparMarcacoes( Object marcacoes[][], Object ocasionais[][] ) + { + long tresMeses = TRES_MESES; + java.util.Date dataExame = null; + Integer estadoExame = null; + java.util.Date dataConsulta = null; + Integer motivoConsulta = null; + Integer estadoConsulta = null; + Object grupo[] = null; + Vector grupos = new Vector(); + + if( marcacoes != null ) + { + for( int n = 0; n < marcacoes.length; n++ ) + { + if( grupo == null ) + { + grupo = new Object[ 5 ]; + dataExame = null; + estadoExame = null; + dataConsulta = null; + motivoConsulta = null; + estadoConsulta = null; + grupos.add( grupo ); + } + + java.util.Date data = ( java.util.Date ) marcacoes[ n ][ 0 ]; + Integer estado = ( Integer ) marcacoes[ n ][ 1 ]; + Integer motivo = ( Integer ) marcacoes[ n ][ 2 ]; + Integer tipo = ( Integer ) marcacoes[ n ][ 3 ]; + switch( tipo.intValue() ) + { + case TIPO_MARCACAO_EXAMES: + if( dataConsulta == null && + ( dataExame == null || estadoExame.intValue() < 2 ) ) + { + dataExame = data; + estadoExame = estado; + } + else if( dataConsulta != null && Math.abs( dataConsulta.getTime() - data.getTime() ) < tresMeses ) + { + dataExame = data; + estadoExame = estado; + } + else + { + grupo = null; + n--; + } + if( grupo != null ) + { + grupo[ 3 ] = dataExame; + grupo[ 4 ] = estadoExame; + } + break; + + case TIPO_MARCACAO_CONSULTA: + if( dataExame == null || Math.abs( dataExame.getTime() - data.getTime() ) < tresMeses ) + { + dataConsulta = data; + estadoConsulta = estado; + motivoConsulta = motivo; + } + else + { + grupo = null; + n--; + } + if( grupo != null ) + { + grupo[ 0 ] = dataConsulta; + grupo[ 1 ] = estadoConsulta; + grupo[ 2 ] = motivoConsulta; + } + break; + } + } + } + if( ocasionais != null ) + { + for( int n = 0; n < ocasionais.length; n++ ) + { + grupo = new Object[ 5 ]; + for( int i = 0; i < 3; i++ ) + { + grupo[ i ] = ocasionais[ n ][ i ]; + } + grupos.add( grupo ); + } + } + + Object agrupadas[][] = ( Object[][] ) grupos.toArray( new Object[ grupos.size() ][] ); + Arrays.sort( agrupadas, new Comparator(){ + public int compare( Object o1, Object o2 ) + { + Object g1[] = ( Object[] ) o1; + Object g2[] = ( Object[] ) o2; + java.util.Date d1 = ( java.util.Date ) ( g1[ 0 ] != null ? g1[ 0 ] : g1[ 3 ] ); + java.util.Date d2 = ( java.util.Date ) ( g2[ 0 ] != null ? g2[ 0 ] : g2[ 3 ] ); + return d2.compareTo( d1 ); + } + } ); + return agrupadas; + } + + protected void acrescentarTrabalhador( String empresaID, String estabelecimentoID, + IDObject trabalhador, java.util.Date dataFicha, + Object marcacoes[][], Vector links, Vector dados, + boolean perfilConsultas, boolean perfilExames ) + { + int estado[] = new int[ 2 ]; + int index = 0; + boolean pendente = false; + if( marcacoes.length == 0 ) + { + estado[ 0 ] = perfilConsultas ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL; + estado[ 1 ] = perfilExames ? ESTADO_PENDENTE : ESTADO_NAO_APLICAVEL; + } + else + { + java.util.Date dataConsulta; + java.util.Date dataExame; + index = -1; + for( ; index + 1 < marcacoes.length; index++ ) + { + int n = index + 1; + dataConsulta = ( java.util.Date ) marcacoes[ n ][ 0 ]; + dataExame = ( java.util.Date ) marcacoes[ n ][ 3 ]; + boolean temConsulta = dataConsulta != null; + boolean consultaAntiga = temConsulta && dataConsulta.before( today ); + boolean temExame = dataExame != null; + boolean exameAntigo = temExame && dataExame.before( today ); + + if( ( temConsulta && consultaAntiga && temExame && exameAntigo ) || + ( temConsulta && consultaAntiga && !temExame && !exameAntigo ) || + ( !temConsulta && !consultaAntiga && temExame && exameAntigo ) ) + { + break; + } + } + if( index == -1 ) + { + index = 0; + } +// else if( index < marcacoes.length - 1 ) +// { +// index = 0; +// } + for( ; index < marcacoes.length; index++ ) + { + dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ]; + dataExame = ( java.util.Date ) marcacoes[ index ][ 3 ]; + boolean temConsulta = dataConsulta != null; + long diffConsulta = temConsulta ? dataConsulta.getTime() - today.getTime() : 0; + boolean temExame = dataExame != null; + long diffExame = temExame ? dataExame.getTime() - today.getTime() : 0; + if( ( temConsulta && diffConsulta < CATORZE_DIAS ) || ( temExame && diffExame < CATORZE_DIAS ) ) + { + break; + } + } + if( index >= marcacoes.length ) + { + index = marcacoes.length - 1; + } + else + { + if( marcacoes.length > 1 ) + { + dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ]; + dataExame = ( java.util.Date ) marcacoes[ index ][ 3 ]; + Calendar calToday = Calendar.getInstance(); + calToday.setTime( today ); + calToday.add( Calendar.YEAR, -2 ); + if( ( dataConsulta != null && dataConsulta.before( calToday.getTime() ) ) + || ( dataConsulta == null && dataExame != null && dataExame.before( calToday.getTime() ) ) ) + { + if( index > 0 ) + { + index--; + } + else + { + pendente = true; + } + } + } + } + dataConsulta = ( java.util.Date ) marcacoes[ index ][ 0 ]; + Integer estadoConsulta = ( Integer ) marcacoes[ index ][ 1 ]; + Integer motivoConsulta = ( Integer ) marcacoes[ index ][ 2 ]; + dataExame = ( java.util.Date ) marcacoes[ index ][ 3 ]; + Integer estadoExame = ( Integer ) marcacoes[ index ][ 4 ]; + if( perfilConsultas ) + { + if( dataConsulta == null || pendente ) + { + estado[ 0 ] = ESTADO_PENDENTE; + } + else if( estadoConsulta == null || estadoConsulta.intValue() != 2 ) + { + estado[ 0 ] = ESTADO_MARCADO; + } + else + { + estado[ 0 ] = ESTADO_TRATADO; + } + } + else + { + estado[ 0 ] = ESTADO_NAO_APLICAVEL; + } + if( perfilExames ) + { + if( dataExame == null || pendente ) + { + if( motivoConsulta != null && motivoConsulta.intValue() != MOTIVO_OCASIONAL ) + { + estado[ 1 ] = ESTADO_PENDENTE; + } + else + { + estado[ 1 ] = ESTADO_NAO_APLICAVEL; + } + } + else if( estadoExame == null || estadoExame.intValue() != 2 ) + { + estado[ 1 ] = ESTADO_MARCADO; + } + else + { + estado[ 1 ] = ESTADO_TRATADO; + } + } + else + { + estado[ 1 ] = ESTADO_NAO_APLICAVEL; + } + } + if( estado[ 0 ] == 1 || estado[ 0 ] == 2 || + estado[ 1 ] == 1 || estado[ 1 ] == 2 ) + { + links.add( "/"+servletName+"/?"+empresaID+"/"+estabelecimentoID+"/"+trabalhador.getID() ); + HashMap dadosTrabalhador = new HashMap(); + dadosTrabalhador.put( "Nome", trabalhador.toString() ); + dadosTrabalhador.put( "Consulta", CORES_ESTADOS.get( new Integer( estado[ 0 ] ) ) ); + Object text = TEXTOS_ESTADOS.get( new Integer( estado[ 0 ] ) ); + dadosTrabalhador.put( "Consulta_estado", text != null ? text : marcacoes[ index ][ 0 ] ); + dadosTrabalhador.put( "Exame", CORES_ESTADOS.get( new Integer( estado[ 1 ] ) ) ); + text = TEXTOS_ESTADOS.get( new Integer( estado[ 1 ] ) ); + dadosTrabalhador.put( "Exame_estado", text != null ? text : marcacoes[ index ][ 3 ] ); + dados.add( dadosTrabalhador ); + } + } + + protected boolean perfilTemConsultas( Integer trabalhadorID, Integer empresaID ) + throws Exception + { + Executer executer = getExecuter(); + String query = "SELECT a_consultas, b_consultas FROM empresas WHERE id = " + empresaID; + Virtual2DArray array = executer.executeQuery( new Select( query ) ); + boolean consultas[] = new boolean[]{ "y".equals( array.get( 0, 0 ) ), "n".equals( array.get( 0, 0 ) ) }; + query = "SELECT perfil FROM trabalhadores WHERE id = " + trabalhadorID; + array = executer.executeQuery( new Select( query ) ); + Integer perfil = ( Integer )array.get( 0, 0 ); + if( perfil != null ) + { + return consultas[ perfil.intValue() - 1 ]; + } + else + { + return false; + } + } + + protected boolean perfilTemExames( Integer trabalhadorID, Integer empresaID ) + throws Exception + { + Executer executer = getExecuter(); + String query = "SELECT a_exames, b_exames FROM empresas WHERE id = " + empresaID; + Virtual2DArray array = executer.executeQuery( new Select( query ) ); + boolean consultas[] = new boolean[]{ "y".equals( array.get( 0, 0 ) ), "n".equals( array.get( 0, 0 ) ) }; + query = "SELECT perfil FROM trabalhadores WHERE id = " + trabalhadorID; + array = executer.executeQuery( new Select( query ) ); + Integer perfil = ( Integer )array.get( 0, 0 ); + if( perfil != null ) + { + return consultas[ perfil.intValue() - 1 ]; + } + else + { + return false; + } + } + +// protected boolean verificarTrabalhador( Object consultas[][], Object exames[][] ) +// { +// boolean estadoConsultas = false; +// boolean estadoExames = ( exames.length == 0 ) || ( ( java.util.Date )exames[ 0 ][ 0 ] ).before(today) || +// ( ( ( ( java.util.Date )exames[ 0 ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); +// if( consultas.length > 0 ) +// { +// int anterior; +// int proxima; +// if( ( (java.util.Date) consultas[ 0 ][ 0 ] ).after( today ) ) +// { +// proxima = 0; +// if( consultas.length >= 2 ) +// { +// anterior = 1; +// } +// else +// { +// anterior = -1; +// } +// } +// else +// { +// proxima = -1; +// anterior = 0; +// } +// estadoConsultas = anterior >= 0 && "y".equals( consultas[ anterior ][ 1 ] ) && +// ( proxima == -1 || ( ( ( java.util.Date )consultas[ proxima ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); +// } +// return !(estadoConsultas && estadoExames); +// } + +// protected HashMap criarDadosTrabalhador( Integer id, String nome, +// Object consultas[][], Object exames[][] ) +// throws Exception +// { +//// dbQuery.append( "SELECT id, nome, ( ultima_consulta IS NOT NULL AND realizada = 'y' )," +//// + " ( ultimo_exame IS NOT NULL AND realizado = 'y' )," +//// + " proxima_consulta IS NOT NULL, proximo_exame IS NOT NULL, " +//// + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 ), " +//// + " ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 )" +//// + " FROM trabalhadores " +//// + " WHERE estabelecimento_id = '"+estabelecimentoId+"'" +//// + " AND ( ultima_consulta IS NULL OR realizada = 'n' OR" +//// + " ( proxima_consulta IS NOT NULL AND proxima_consulta - current_date <= 14 )" +//// + " OR ( proximo_exame IS NOT NULL AND proximo_exame - current_date <= 14 ) )" +//// + " ORDER BY nome" ); +// HashMap trabalhador = new HashMap(); +// trabalhador.put( "Nome", nome ); +// boolean uc = false; +// boolean ue = false; +// boolean pc = false; +// boolean pe = false; +// boolean quase_c = false; +// boolean quase_e = false; +// java.util.Date consultaAnterior = null; +// java.util.Date exameAnterior = null; +// if( consultas.length > 0 ) +// { +// int anterior; +// int proxima; +// if( ( (java.util.Date) consultas[ 0 ][ 0 ] ).after( today ) ) +// { +// proxima = 0; +// if( consultas.length >= 2 ) +// { +// anterior = 1; +// } +// else +// { +// anterior = -1; +// } +// } +// else +// { +// proxima = -1; +// anterior = 0; +// } +// long diff = proxima > -1 ? ( ( ( java.util.Date )consultas[ proxima ][ 0 ] ).getTime() - todayMillis ) / 86400000 : 15; +// uc = anterior > -1 && "y".equals( consultas[ anterior ][ 1 ] ); +// if( uc ) +// { +// consultaAnterior = ( java.util.Date ) consultas[ anterior ][ 0 ]; +// } +// pc = proxima > -1; +// quase_c = pc && diff <= 14; +// } +// +// if( exames.length > 0 ) +// { +// int anterior; +// int proximo; +// if( ( (java.util.Date) exames[ 0 ][ 0 ] ).after( today ) ) +// { +// proximo = 0; +// if( exames.length >= 2 ) +// { +// anterior = 1; +// } +// else +// { +// anterior = -1; +// } +// } +// else +// { +// proximo = -1; +// anterior = 0; +// } +// long diff = proximo > -1 ? ( ( ( java.util.Date )exames[ proximo ][ 0 ] ).getTime() - todayMillis ) / 86400000 : 15; +// ue = anterior > -1 && "y".equals( exames[ anterior ][ 1 ] ); +// if( ue ) +// { +// exameAnterior = ( java.util.Date ) exames[ anterior ][ 0 ]; +// } +// pe = proximo > -1; +// quase_e = pe && diff <= 14; +// } +// +// if( quase_c ) +// { +// trabalhador.put( "Consulta", "yellow" ); +// trabalhador.put( "Consulta_estado", "pendente" ); +// } +// else if( uc ) +// { +// trabalhador.put( "Consulta", "green" ); +// trabalhador.put( "Consulta_estado", consultaAnterior ); +// } +// else if( pc ) +// { +// trabalhador.put( "Consulta", "yellow" ); +// trabalhador.put( "Consulta_estado", "pendente" ); +// } +// else +// { +// trabalhador.put( "Consulta", "red" ); +// trabalhador.put( "Consulta_estado", "pendente" ); +// } +// +// if( quase_e ) +// { +// trabalhador.put( "Exame", "yellow" ); +// trabalhador.put( "Exame_estado", "pendente" ); +// } +// else if( ue ) +// { +// trabalhador.put( "Exame", "green" ); +// trabalhador.put( "Exame_estado", exameAnterior ); +// } +// else if( pe ) +// { +// trabalhador.put( "Exame", "yellow" ); +// trabalhador.put( "Exame_estado", "pendente" ); +// } +// else +// { +// trabalhador.put( "Exame", "red" ); +// trabalhador.put( "Exame_estado", "pendente" ); +// } +// return trabalhador; +// } +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresTudo.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresTudo.java new file mode 100644 index 00000000..2a6d5d28 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetListaTrabalhadoresTudo.java @@ -0,0 +1,255 @@ +/* + * doGetListaTrabalhadoresTudo.java + * + * Created on 21 de Abril de 2005, 17:35 + */ + +package siprp.pagina; + +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; + + +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; +/** + * + * @author fpalma + */ +public class doGetListaTrabalhadoresTudo + extends siprpServlet + implements GlobalConstants +{ + protected java.util.Date today; + protected long todayMillis; + + /** Creates a new instance of doGetListaTrabalhadores */ + public doGetListaTrabalhadoresTudo(HttpServletRequest req, HttpServletResponse res, boolean print) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery, sBuffer; + String userRole, empresaId, estabelecimentoId, temp; + HttpSession session = req.getSession(false); + Vector links = new Vector(); + Vector desc = new Vector(); + Vector descAdicional = new Vector(); + today = new java.util.Date(); + todayMillis = today.getTime(); + + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); + + if ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + { + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + if ( super.verificaEstabelecimento(con, empresaId, estabelecimentoId) ) // estabelecimento pertence à empresa ?? + { + //Class.forName(super.bdDriver); + //con = DriverManager.getConnection( super.bdUrl, super.bdUsername, super.bdPassword ); + dbQuery = new StringBuffer(); +// dbQuery.append( "SELECT id, nome, data_ficha FROM trabalhadores " +// + "WHERE estabelecimento_id = '"+estabelecimentoId+"'" +// + " AND ultima_consulta IS NOT NULL AND realizada = 'y' AND" +// + " ( proxima_consulta IS NULL OR proxima_consulta - current_date > 14 )" +// + " AND ( proximo_exame IS NULL OR proximo_exame - current_date > 14 )" +// + " ORDER BY nome" ); + dbQuery.append( "SELECT trabalhadores.id, trabalhadores.nome, " + + "marcacoes_trabalhador.tipo, marcacoes_trabalhador.data, marcacoes_trabalhador.estado, " + + " trabalhadores.nome_plain " + + "FROM trabalhadores, marcacoes_trabalhador " + + "WHERE estabelecimento_id = " + estabelecimentoId + + " AND marcacoes_trabalhador.trabalhador_id = trabalhadores.id " + + " AND trabalhadores.inactivo <> 'y' AND data_demissao IS NULL " + + "ORDER BY 6, 3, 4 DESC " ); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + int index=0; + int max = rs.columnLength(); + + Integer trabalhadorID = new Integer( -1 ); + String nomeTrabalhador = ""; + Vector consultas = new Vector(); + Vector exames = new Vector(); + + for ( index = 0; index <= max; index++ ) + { + Integer id = index < max ? ( Integer ) rs.get( index, 0 ) : new Integer( -1 ); + if( !id.equals( trabalhadorID ) ) + { + Object listaConsultas[][] = ( Object[][] ) consultas.toArray( new Object[consultas.size()][2] ); + Object listaExames[][] = ( Object[][] ) exames.toArray( new Object[exames.size()][2] ); + if( trabalhadorID.intValue() > -1 && + verificarTrabalhador( listaConsultas, listaExames ) ) + { + temp=""+rs.get(index - 1,0); // converter de int para String + java.util.Date dataUltimaConsulta = null; + for( int c = 0; c < listaConsultas.length; c++ ) + { + if( new Integer( 2 ).equals( listaConsultas[ c ][ 1 ] ) ) + { + dataUltimaConsulta = ( java.util.Date ) listaConsultas[ c ][ 0 ]; + break; + } + } + HashMap dadosTrabalhador = criarDadosTrabalhador( trabalhadorID, nomeTrabalhador, dataUltimaConsulta ); + if( dadosTrabalhador != null ) + { + dbQuery = new StringBuffer(); + dbQuery.append("/"+super.servletName+"/?"+empresaId+"/"+estabelecimentoId+"/"+temp); // construir url + links.add(dbQuery.toString()); + desc.add( dadosTrabalhador ); + } + } + exames.clear(); + consultas.clear(); + } + if( index == max ) + { + break; + } + Integer tipo = ( Integer ) rs.get( index, 2 ); + String nome = ( String ) rs.get( index, 1 ); + java.util.Date data = ( java.util.Date ) rs.get( index, 3 ); + Integer estado = ( Integer ) rs.get( index, 4 ); + trabalhadorID = id; + nomeTrabalhador = nome; + Object marcacao[] = new Object[]{ data, estado }; + switch( tipo.intValue() ) + { + case TIPO_MARCACAO_EXAMES: + exames.add( marcacao ); + break; + + case TIPO_MARCACAO_CONSULTA: + consultas.add( marcacao ); + break; + } + } + stmt.close(); + + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" + +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , sBuffer.toString() ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, "trabalhadores_tudo" ); + hmValues.put( templateVector1,links); + hmValues.put( templateVector2,desc); + hmValues.put( templateVector3,null); + if( !print ) + { + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( hmValues, super.authenticatedUserPrintTemplate)); + } +// out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhadores, links, desc, null, super.authenticatedUserTemplate) ); + } + else // est não pertence à empresa + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + con.close(); + } + else // Role não permite ver esta informação + { + out.println( mergeTemplate( super.msgAcessoNegado , userRole, super.errorTemplate) ); + } + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + } + + protected boolean verificarTrabalhador( Object consultas[][], Object exames[][] ) + { + boolean estadoConsultas = false; + boolean estadoExames = ( exames.length == 0 ) || ( ( java.util.Date )exames[ 0 ][ 0 ] ).before(today) || + ( ( ( ( java.util.Date )exames[ 0 ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); + if( consultas.length > 0 ) + { + int anterior; + int proxima; + if( ( (java.util.Date) consultas[ 0 ][ 0 ] ).after( today ) ) + { + proxima = 0; + if( consultas.length >= 2 ) + { + anterior = 1; + } + else + { + anterior = -1; + } + } + else + { + proxima = -1; + anterior = 0; + } + estadoConsultas = anterior >= 0 && new Integer( 2 ).equals( consultas[ anterior ][ 1 ] ) && + ( proxima == -1 || ( ( ( java.util.Date )consultas[ proxima ][ 0 ] ).getTime() - todayMillis ) / 86400000 > 14 ); + } + return estadoConsultas && estadoExames; + } + + protected HashMap criarDadosTrabalhador( Integer id, String nome, java.util.Date ultimaConsulta ) + throws Exception + { + Executer executer = getExecuter(); + HashMap trabalhador = new HashMap(); + trabalhador.put( "Nome", nome ); + Select select = + new Select( new String[]{ "exames" }, new String[]{ "data" }, + new Field( "trabalhador_id" ).isEqual( id ).and( + new Field( "data" ).isGreaterOrEqual( ultimaConsulta ) ), + new String[]{ "data" }, null ); + +// Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); +// ResultSet2DArray rs = new ResultSet2DArray( stmt.executeQuery( select.toString() ) ); + Virtual2DArray rs = executer.executeQuery( select ); + Object data_ficha = rs.columnLength() > 0 ? rs.get( 0, 0 ) : null; +// stmt.close(); + if( data_ficha == null ) + { + return null; +// data_ficha = ""; + } + trabalhador.put( "Data", data_ficha ); + return trabalhador; + } +} + diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java new file mode 100644 index 00000000..267421e7 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doGetTrabalhador.java @@ -0,0 +1,324 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doGetTrabalhador extends siprpServlet +{ + + /** Creates a new instance of doGetTrabalhador */ + public doGetTrabalhador(HttpServletRequest req, HttpServletResponse res) throws IOException + { + ServletOutputStream out = res.getOutputStream(); + Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery, sBuffer; + String userRole, empresaId, estabelecimentoId, trabalhadorId, temp; + HttpSession session = req.getSession(false); + Vector names = new Vector(); + Vector values = new Vector(); + java.util.Date today = new java.util.Date(); + + try + { + userRole = (String)session.getAttribute(super.sessionUserRole); + empresaId = (String)session.getAttribute(super.sessionEmpresaId); + estabelecimentoId = (String)session.getAttribute(super.sessionEstabelecimentoId); + trabalhadorId = (String)session.getAttribute(super.sessionTrabalhadorId); + + Class.forName(super.bdDriver); + con = DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ); + + if ( ( userRole.equals ( super.superUserRole ) || userRole.equals ( empresaId ) ) + && super.verificaEstabelecimento(con, empresaId, estabelecimentoId) + && super.verificaTrabalhador(con, estabelecimentoId, trabalhadorId) ) + { + + dbQuery = new StringBuffer(); + dbQuery.append( " SELECT sexo, categoria, data_nascimento, nome, numero_mecanografico " + + "FROM trabalhadores where id='"+trabalhadorId+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + // int index=0; + // int max = super.trabalhadorDescFields.length; + + HashMap hmFuncionario = new HashMap(); + if( rs.columnLength() > 0 ) + { + String tmp; + hmFuncionario.put( "sexo", rs.get( 0, "sexo" ) ); + hmFuncionario.put( "categoria", rs.get( 0, "categoria" ) ); + hmFuncionario.put( "data_nascimento", rs.get( 0, "data_nascimento" ) ); + hmFuncionario.put( "nome", rs.get( 0, "nome" ) ); + hmFuncionario.put( "numero", rs.get( 0, "numero_mecanografico" ) ); + stmt.close(); + + String query = "SELECT id, data, estado, data_relatorio FROM marcacoes_trabalhador " + + "WHERE tipo = 0 and trabalhador_id = " + trabalhadorId + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + if( rs.columnLength() > 0 ) + { + java.util.Date dataExame2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado1; + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + java.util.Date dataExame1; + String realizado1 = ""; + String realizado2 = ""; + if( rs.columnLength() > 1 ) + { + dataExame1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); + } + else + { + dataExame1 = dataExame2; + estado1 = estado2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || ESTADO_PARCIALMENTE_REALIZADO.equals( estado2 ) + || today.after( dataExame2 ) ) + { + hmFuncionario.put( "ultimo_exame", dataExame2 ); + if( estado2.equals( ESTADO_REALIZADO ) || estado2.equals( ESTADO_PARCIALMENTE_REALIZADO ) ) + { + realizado2 = "sim"; + } + else + { + realizado2 = "não"; + } + hmFuncionario.put( "realizado", realizado2 ); + hmFuncionario.put( "proximo_exame", null ); + } + else + { + hmFuncionario.put( "proximo_exame", dataExame2 ); + if( !dataExame2.equals( dataExame1 ) ) + { + hmFuncionario.put( "ultimo_exame", dataExame1 ); + if( estado1.equals( ESTADO_REALIZADO ) || estado1.equals( ESTADO_PARCIALMENTE_REALIZADO ) ) + { + realizado1 = "sim"; + } + else + { + realizado1 = "não"; + } + hmFuncionario.put( "realizado", realizado1 ); + } + else + { + hmFuncionario.put( "ultimo_exame", null ); + hmFuncionario.put( "realizado", null ); + } + } + } + else + { + hmFuncionario.put( "ultimo_exame", null ); + hmFuncionario.put( "realizado", null ); + hmFuncionario.put( "proximo_exame", null ); + } + stmt.close(); + + query = "SELECT MAX(id) FROM exames WHERE trabalhador_id = " + trabalhadorId + " AND inactivo <> 'y'"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + Integer fichaId = null; + if( rs.columnLength() > 0 ) + { + fichaId = ( Integer ) rs.get( 0, 0 ); + } + stmt.close(); + + if( fichaId != null ) + { + query = "SELECT data, resultado FROM exames WHERE id = " + fichaId; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + Integer resultadoFicha = (Integer) rs.get( 0, 1 ); + stmt.close(); + if( resultadoFicha != null ) + { + switch( resultadoFicha.intValue() ) + { + case 1: + hmFuncionario.put( "resultado", "Apto" ); + break; + case 2: + hmFuncionario.put( "resultado", "Apto Condicionalmente" ); + break; + case 3: + hmFuncionario.put( "resultado", "Inapto Temporariamente" ); + break; + case 4: + hmFuncionario.put( "resultado", "Inapto Definitivamente" ); + break; + default: + hmFuncionario.put( "resultado", null ); + } + } + else + { + hmFuncionario.put( "resultado", null ); + } + } + else + { + hmFuncionario.put( "resultado", null ); + } + + query = "SELECT id, data, estado FROM marcacoes_trabalhador " + + "WHERE tipo = 1 and trabalhador_id = " + trabalhadorId + + " ORDER BY data DESC"; + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + if( rs.columnLength() > 0 ) + { + java.util.Date dataConsulta2 = ( java.util.Date ) rs.get( 0, 1 ); + Integer estado1; + Integer estado2 = ( Integer ) rs.get( 0, 2 ); + java.util.Date dataConsulta1; +// java.util.Date dataRelatorio1; +// java.util.Date dataRelatorio2 = (java.util.Date) rs.get( 0, 3 ); + String realizada1 = ""; + String realizada2 = ""; + if( rs.columnLength() >= 2 ) + { + dataConsulta1 = ( java.util.Date ) rs.get( 1, 1 ); + estado1 = ( Integer ) rs.get( 1, 2 ); +// dataRelatorio1 = (java.util.Date) rs.get( 1, 3 ); + } + else + { + dataConsulta1 = dataConsulta2; + estado1 = estado2; +// dataRelatorio1 = dataRelatorio2; + } + if( ESTADO_REALIZADO.equals( estado2 ) || today.after( dataConsulta2 ) ) + { + hmFuncionario.put( "ultima_consulta", dataConsulta2 ); + if( estado2.equals( ESTADO_REALIZADO ) ) + { + realizada2 = "sim"; + } + else + { + realizada2 = "não"; + } + hmFuncionario.put( "realizada", realizada2 ); + hmFuncionario.put( "proxima_consulta", null ); + } + else + { + try + { + for( int c = 1; c < rs.columnLength(); c++ ) + { + java.util.Date dataTemp = ( java.util.Date ) rs.get( c, 1 ); + dataConsulta1 = dataTemp; + estado1 = ( Integer ) rs.get( c, 2 ); + if( dataTemp.after( today ) ) + { + dataConsulta2 = dataTemp; + } + else + { + break; + } + } + } + catch( Exception ex ) + { + ex.printStackTrace(); + } + hmFuncionario.put( "proxima_consulta", dataConsulta2 ); + if( !dataConsulta2.equals( dataConsulta1 ) ) + { + if( estado1.equals( ESTADO_REALIZADO ) ) + { + realizada1 = "sim"; + } + else + { + realizada1 = "não"; + } + hmFuncionario.put( "realizada", realizada1 ); + hmFuncionario.put( "ultima_consulta", dataConsulta1 ); + } + else + { + hmFuncionario.put( "ultima_consulta", null ); + hmFuncionario.put( "realizada", null ); + } + } + } + else + { + hmFuncionario.put( "ultima_consulta", null ); + hmFuncionario.put( "realizada", null ); + hmFuncionario.put( "proxima_consulta", null ); + } + stmt.close(); + } + + sBuffer = new StringBuffer(); + sBuffer.append(""+super.nomeEmpresa(con,empresaId)+"

" + +super.nomeEstabelecimento(con, estabelecimentoId)+"" ); + + HashMap hmValues = new HashMap(); + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_nome", super.nomeEstabelecimento( con, estabelecimentoId ) ); + + /*Dados para marcacao de consulta/exame*/ + session.setAttribute( "session_estabelecimento_nome", hmValues.get( "estabelecimento_nome" ) ); + session.setAttribute( "session_funcionario_nome", hmFuncionario.get( "nome" ) ); + session.setAttribute( "session_funcionario_numero", hmFuncionario.get( "numero" ) ); + + hmValues.put( "estabelecimento_id", estabelecimentoId ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", session.getAttribute( sessionUser ) ); + hmValues.put( msgTemplate , sBuffer.toString() ) ; + hmValues.put( templateUserRole, userRole); + hmValues.put( templateQuery, super.queryStringTrabalhador ); + hmValues.put( "funcionario", hmFuncionario ); + //hmValues.put( templateVector1,names); + //hmValues.put( templateVector2,values); + //hmValues.put( templateVector3,null); + out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + + // out.println( mergeTemplate( sBuffer.toString(), userRole, super.queryStringTrabalhador, names, values, null, super.authenticatedUserTemplate) ); + + } + else + { + out.println( mergeTemplate( super.msgLinkFormatError , userRole, super.errorTemplate) ); + } + con.close(); + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgErroBd , super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( super.msgGenericError , super.errorTemplate) ); + } + + } + +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doPostLogin.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doPostLogin.java new file mode 100644 index 00000000..e9c41eec --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/doPostLogin.java @@ -0,0 +1,122 @@ +package siprp.pagina; + +import com.evolute.utils.arrays.*; +import com.evolute.utils.strings.*; +import java.io.*; +import java.util.*; +import java.sql.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +public class doPostLogin extends siprpServlet +{ + + /** Creates a new instance of doPostLogin */ + public doPostLogin(HttpServletRequest req, HttpServletResponse res) throws IOException + { +System.out.println( "doPostLogin()" ); + ServletOutputStream out = res.getOutputStream(); + StringBuffer dbQuery; + ResultSet2DArray rs; + Connection con = null ; + Statement stmt = null ; + String user, userRole, password; + + try + { + user = req.getParameter("user"); + password = req.getParameter("password"); + + if (user.equals("")) + { + out.println( mergeTemplate( msgErroNoUser, errorTemplate) ); + } + else + { + Class.forName(bdDriver); + con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT password FROM users WHERE username = '"+user+"'"); + + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + + + if ( rs.columnLength() > 0 && password.equals((String)rs.get(0,0))) + { + // Obter Role + + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT role FROM roles WHERE username = '"+user+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + userRole = (String)rs.get(0,0); + + // UPDATE HTTP SESSION + HttpSession session = req.getSession(true); + session.setMaxInactiveInterval(sessionTimeout); + + session.setAttribute(sessionUser, user); + session.setAttribute(sessionUserRole, userRole); + session.setAttribute(sessionPassword, password); + + HashMap hmValues = new HashMap(); + session.setAttribute( sessionEmpresaId, userRole ); + if( userRole.equals( "manager" ) ) + { + // session.setAttribute( sessionCompanyName, nomeEmpresa( con, "" + session.getAttribute( sessionEmpresaId ) ) ); + session.setAttribute( sessionCompanyName, null ); + session.setAttribute( sessionEstabelecimentoId, null ); + //hmValues.put( templateQuery, super.queryStringEmpresas ); + new doGetListaEmpresas( req, res ); + } + else + { + session.setAttribute( sessionCompanyName, + nomeEmpresa( DriverManager.getConnection( bdLocalUrl, bdLocalUsername, bdLocalPassword ), + userRole ) ); + session.setAttribute( sessionEstabelecimentoId, "-1" ); + //hmValues.put( templateQuery, super.queryStringEstabelecimentos ); + new doGetListaEstabelecimentos( req, res ); + } + stmt.close(); + con.close(); + + hmValues.put( "empresa_nome", session.getAttribute( sessionCompanyName ) ); + hmValues.put( "empresa_id", session.getAttribute( sessionEmpresaId ) ); + hmValues.put( "estabelecimento_id", session.getAttribute( sessionEstabelecimentoId ) ); + hmValues.put( "userRole", userRole ); + hmValues.put( "userName", user ); + //out.println( mergeTemplate( hmValues, super.authenticatedUserTemplate)); + + //out.println( mergeTemplate( user, userRole, super.authenticatedUserTemplate)); + } + else + { + out.println( mergeTemplate( msgErroAuthFail, super.errorTemplate) ); + } + } + + } + catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgErroBd , super.errorTemplate) ); + } + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, super.errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgGenericError , super.errorTemplate) ); + } + } + +} diff --git a/tags/teg/web/src/WEB-INF/classes/siprp/pagina/siprpServlet.java b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/siprpServlet.java new file mode 100644 index 00000000..3ca42675 --- /dev/null +++ b/tags/teg/web/src/WEB-INF/classes/siprp/pagina/siprpServlet.java @@ -0,0 +1,648 @@ +package siprp.pagina; + +import java.io.*; +import java.lang.reflect.Array; +import javax.servlet.*; +import javax.servlet.http.*; +import java.sql.*; +import java.util.*; + +import org.apache.velocity.*; +import org.apache.velocity.app.*; + +import com.evolute.utils.*; +import com.evolute.utils.arrays.*; +import com.evolute.utils.db.*; +import com.evolute.utils.sql.*; +import com.evolute.utils.strings.*; + +public class siprpServlet extends HttpServlet + implements GlobalConstants +{ + // MSG + public static final String msgErroNoUser = "Tem+de+especificar+um+utilizador."; + public static final String msgErroAuthFail = "Utilizador+inexistente+e/ou+Password+errada."; + public static final String msgErroBd = "Erro+na+ligaç&atiolde;o+à+base+de+dados."; + public static final String msgGenericError = "Erro"; + public static final String msgListaEmpresas = "Empresas"; + public static final String msgAcessoNegado = "Acesso+Negado."; + public static final String msgLinkFormatError ="URL+inválido."; + public static final String msgLogin = "Login"; + public static final String msgNovaPasswordErrada="Erro+ao+criar+a+nova+password,+nova+password+inválida."; + public static final String msgButtonNotSuported = "funcionalidade+ainda+não+suportada."; + public static final String msgSessionTimeout = "Por+razões+de+segurança+o+tempo+da+sua+sessão+expirou
" + + "Por+favor+efectue+novamente+o+seu+login.
"; + + // Templates - Nomes e valores + //public static final String loginTemplate = "login.html"; + + public static final String indexTemplate = "index.html"; + public static final String authenticatedUserTemplate = "user.html"; + public static final String authenticatedUserPrintTemplate = "user_print.html"; + public static final String errorTemplate = "frame_erro.html"; + public static final String innerErrorTemplate = "erro.html"; + + public static final String mainTemplate = "main.html"; + //public static final String criticalErrorTemplate = "critical.html"; + public static final String templateVector1 ="v1"; + public static final String templateVector2 ="v2"; + public static final String templateVector3 ="v3"; + public static final String templateUserRole ="userRole"; + public static final String msgTemplate ="msg"; + public static final String templateQuery ="query"; + public static final String buttonPressedTemplate ="buttonPressed"; + + // Query Strings , usadas para na template do velocity saber o que mostar + public static final String queryStringErro = "erro"; + public static final String queryStringEmpresas = "empresas"; + public static final String queryStringEstabelecimentos="estabelecimentos"; + public static final String queryStringTrabalhadores ="trabalhadores"; + public static final String queryStringTrabalhador ="trabalhador"; + + //Botoes, saber qual o botao escholido, campo value dos forms + public static final String botaoLogin = "Entrar"; + public static final String botaoMarcarProximoExame = "Marcar Exame"; + + // Var da Session + public static final String sessionUser="user"; + public static final String sessionUserRole="userRole"; + public static final String sessionPassword="password"; + public static final String sessionEmpresaId="empresaId"; + public static final String sessionEstabelecimentoId="estabelecimentoId"; + public static final String sessionTrabalhadorId="trabalhadorId"; + public static final String sessionCompanyName = "sessionCompanyName"; + public static final String sessionCompanyEmail = "sessionCompanyEmail"; + public static final int sessionTimeout = 3600; // segundos + + public static final String servletName="siprpWeb"; + public static final String superUserRole="manager"; + +// // BD +// public static final String bdHost = "127.0.0.1"; +// public static final String bdPort = "5436"; +// public static final String bdUsername = "siprp"; +// public static final String bdPassword = ""; +// public static final String bdDriver = "org.postgresql.Driver"; +// public static final String bdUrl = "jdbc:postgresql://" + bdHost + ":" + bdPort + "/siprp"; + + public static final String bdEmpresaIdRef = "id"; // campo que contem id da empresa + public static final String bdEmpresaNomeRef = "designacao_social"; // campo que contem nome da empresa + public static final String bdEstIdRef = "id"; // campo que contem nome do estabelecimento + public static final String bdEstNomeRef = "nome"; // campo que contem nome do estabelecimento + public static final String bdTrabIdRef = "id"; // campo que contem id do trabalhador + public static final String bdTrabNomeRef = "nome"; // campo que contem nome do trabalhador + public static final String bdNullString = ""; // String a mostrar quando o campo lido da BD é null + public static final String bdEmailEmpresa = "email"; // campo que contem email da empresa + + protected static ServletContext CONTEXT; + + // Arrays + public static final String[][] trabalhadorDescFields = new String [][] + { // nome que o user ve, nome do campo na tabela + {"Nome", "nome"}, + {"Nº", "numero_mecanografico",}, + {"\u00DAltimo Exame", "ultimo_exame"}, + {"Realizado", "realizado"}, + {"Pr\u00F3ximo Exame", "proximo_exame"}, + {"\u00DAltima Consulta", "ultima_consulta"}, + {"Realizada", "realizada"}, + {"Pr\u00F3xima Consulta", "proxima_consulta"} + }; + + public void init() + { + + try { + CONTEXT = this.getServletContext(); + String TEMPLATE_DIR = this.getServletContext().getRealPath( "/" ) + "html/"; +System.out.println( "DIR: " + TEMPLATE_DIR ); + Properties props = new Properties(); + props.setProperty( "file.resource.loader.path", TEMPLATE_DIR ); + Velocity.init( props ); + Class.forName(bdDriver); + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + + public void doGet( HttpServletRequest req, HttpServletResponse res ) + throws IOException + { + String queryString = req.getQueryString(); + String backUri = req.getRequestURI(); + ServletOutputStream out = res.getOutputStream(); + res.setContentType( "text/html" ); + try + { +System.out.println( "query: " + queryString ); + HttpSession session = req.getSession(true); + session.setMaxInactiveInterval(sessionTimeout); + + if ( queryString == null ) // Reload, 1º vez, etc ... + { + session.invalidate(); + out.println( mergeTemplate ( msgLogin, indexTemplate ) ) ; + } + else if ( session.isNew() && !( queryString.indexOf(queryStringErro) == 0 ) ) // session timeout + { + session.invalidate(); + out.println( mergeTemplate( msgGenericError , errorTemplate ) ); +// doErro(queryString, out); + } + else if ( queryString.equals(queryStringEmpresas) ) // Listar Empresas + { + new doGetListaEmpresas(req,res); + } + else if ( queryString.indexOf(queryStringErro) == 0 ) // Listar Empresas + { +// System.out.println( "entrou" ); + doErro(queryString, out); + } + else // interpretar query string + { + String empresa = null, estabelecimento=null, trabalhador=null; + String query = null; + int checkInt; + + StringTokenizer sToken = new StringTokenizer(queryString,"/") ; + empresa = sToken.nextToken(); // empresa ID + checkInt = Integer.parseInt(empresa); // check int, NumberFormatException + + if (sToken.hasMoreElements()) + { + estabelecimento = sToken.nextToken(); // estabelecimento ID + checkInt = Integer.parseInt(estabelecimento); // check int, NumberFormatException + if (sToken.hasMoreElements()) + { + trabalhador = sToken.nextToken(); // trabalhador ID + try + { + checkInt = Integer.parseInt(trabalhador); // check int, NumberFormatException + } + catch( NumberFormatException nfex ) + { + query = trabalhador; + if( query.indexOf( "trabalhadores_tudo" ) != 0 && query.indexOf( "trabalhadores_pendentes" ) != 0 && + query.indexOf( "_print" ) == -1 ) + { + throw nfex; + } + } + } + } + + if ( estabelecimento == null ) // empresa query + { + session.setAttribute(sessionEmpresaId, empresa); // update HTTP Session + + new doGetListaEstabelecimentos(req,res); + + //out.println( mergeTemplate ( empresa, loginTemplate ) ) ; + } + else if ( trabalhador == null || query != null ) // estabelecimento query + { + session.setAttribute(sessionEmpresaId, empresa); // update HTTP Session + session.setAttribute(sessionEstabelecimentoId, estabelecimento); + + new doGetListaTrabalhadores(req,res, query); + + //out.println( mergeTemplate ( " chama oGetListaTrabalhadores", loginTemplate ) ) ; + } + else // trabalhador query + { + session.setAttribute(sessionEmpresaId, empresa); // update HTTP Session + session.setAttribute(sessionEstabelecimentoId, estabelecimento); + session.setAttribute(sessionTrabalhadorId, trabalhador); + + new doGetTrabalhador(req,res); + + //out.println( mergeTemplate ( trabalhador, loginTemplate ) ) ; + } + } + } + catch ( NumberFormatException e ) // argumentos invalidos + { + e.printStackTrace(); + out.println( mergeTemplate( msgLinkFormatError, backUri, errorTemplate) ); + } + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); +// out.println( mergeTemplate( msgGenericError , backUri, errorTemplate ) ); + out.println( mergeTemplate( msgGenericError , errorTemplate ) ); + } +// System.out.println( "fim - " + queryString + " bu " + backUri ); + } + + public void doPost(HttpServletRequest req, HttpServletResponse res) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + //StringBuffer dbQuery; + //ResultSet2DArray rs; + //Connection con = null ; + //Statement stmt = null ; + //String user, userRole, password; + String buttonPressed = req.getParameter("form"); + + try + { + if ( buttonPressed.equals(botaoLogin)) + { + new doPostLogin(req,res); + } + else + { + out.println( mergeTemplate( msgButtonNotSuported, errorTemplate) ); + } + } + /*catch ( SQLException e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgErroBd , criticalErrorTemplate) ); + }*/ + catch ( IllegalStateException e ) // session timeout + { + e.printStackTrace(); + out.println( mergeTemplate(msgSessionTimeout, errorTemplate) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + out.println( mergeTemplate( msgGenericError , errorTemplate) ); + } + } + + + public String mergeTemplate( HashMap values, String template ) + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + for( Iterator i = values.keySet().iterator(); i.hasNext(); ) + { + String key = ( String ) i.next(); + context.put ( key, values.get( key ) ) ; + } + + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + + + public String mergeTemplate (String msg, String template ) // #1 + { + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + context.put ( msgTemplate , msg ) ; + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String mergeTemplate (String msg, String userRole, String template ) // #1 + { + + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + context.put ( msgTemplate , msg ) ; + context.put ( templateUserRole, userRole); + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String mergeTemplate ( String msg, String userRole, String querySelected, Vector vector1, Vector vector2, Vector vector3, String template ) // #2 + { + + VelocityContext context = new VelocityContext(); + StringWriter output = new StringWriter(); + + try + { + context.put ( msgTemplate , msg ) ; + context.put ( templateUserRole, userRole); + context.put ( templateQuery, querySelected ); + context.put ( templateVector1,vector1); + context.put ( templateVector2,vector2); + context.put ( templateVector3,vector3); + Velocity.mergeTemplate(template, Velocity.ENCODING_DEFAULT, context, output ); + return output.toString(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public void destroy() + { + } + + public void handleSessionTimeout(HttpServletResponse res, String template) + throws IOException + { + ServletOutputStream out = res.getOutputStream(); + try + { + out.println( mergeTemplate( msgSessionTimeout, template) ); + } + catch ( Exception e ) + { + e.printStackTrace(); + + } + } + + public boolean verificaEstabelecimento(Connection con, java.lang.String empresaId, java.lang.String estabelecimentoId) + // verifica se o establecimento pertence à empresa + { + //Connection con = null ; + Statement stmt = null ; + Virtual2DArray rs; + String query; + try + { + //con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + query = "SELECT empresa_id FROM estabelecimentos where id='"+estabelecimentoId+"'"; + if( con != null ) + { + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + } + else + { + rs = getExecuter().executeQuery( new Select( query ) ); + } + String temp=""+rs.get(0,0); // converter de int para String + if( con != null ) + { + stmt.close(); + } + if ( empresaId.equals(temp) ) // estabelecimento pertence à empresa + { + return true; + } + else + { + return false; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return false; + } + + public boolean verificaTrabalhador(Connection con, java.lang.String estabelecimentoId, java.lang.String trabalhadorId) + // verifica se o trabalhador pertence ao estabelecimento + { + //Connection con = null ; + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + try + { + //con = DriverManager.getConnection( bdUrl, bdUsername, bdPassword ); + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT estabelecimento_id FROM trabalhadores where id='"+trabalhadorId+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + String temp=""+rs.get(0,0); // converter de int para String + stmt.close(); + if ( estabelecimentoId.equals(temp) ) // estabelecimento pertence à empresa + { + return true; + } + else + { + return false; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return false; + } + + public void closeSqlCon(Connection con) + { + try + { + if (con != null ) con.close(); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + + } + + public String emailEmpresa(Connection con, String empresaId) + { + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + String returnString; + + try + { + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT email FROM empresas, contactos " + + "WHERE empresas.id ='"+empresaId+"' AND empresas.contacto_1 = contactos.id"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + stmt.close(); + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String nomeEmpresa(Connection con, String empresaId) + { + Statement stmt = null ; + Virtual2DArray rs; + String returnString; + + try + { + String query = "SELECT designacao_social FROM empresas WHERE id ='"+empresaId+"'"; + if( con != null ) + { + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + } + else + { + rs = getExecuter().executeQuery( new Select( query ) ); + } + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + if( con != null ) + { + stmt.close(); + } + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String nomeEstabelecimento(Connection con, java.lang.String estabelecimentoId) + { + Statement stmt = null ; + Virtual2DArray rs; + StringBuffer dbQuery; + String returnString; + + try + { + String query = "SELECT nome FROM estabelecimentos WHERE id ='"+estabelecimentoId+"'"; + if( con != null ) + { + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( query ) ); + } + else + { + rs = getExecuter().executeQuery( new Select( query ) ); + } + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + if( con != null ) + { + stmt.close(); + } + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public String nomeTrabalhador(Connection con, java.lang.String trabalhadorId) + { + Statement stmt = null ; + ResultSet2DArray rs; + StringBuffer dbQuery; + String returnString; + + try + { + dbQuery = new StringBuffer(); + dbQuery.append( "SELECT nome FROM trabalhadores where id='"+trabalhadorId+"'"); + stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); + rs = new ResultSet2DArray( stmt.executeQuery( dbQuery.toString()) ); + if( rs.columnLength() > 0 ) + { + returnString = (String)rs.get(0,0); + stmt.close(); + return returnString; + } + else + { + return null; + } + } + catch ( Exception e ) + { + e.printStackTrace(); + } + return null; + } + + public void doErro( String queryString, ServletOutputStream out ) + throws Exception + { + String split[] = queryString.split( "=" ); + String err; + if( split.length > 1 ) + { + err = split[ 1 ]; + } + else + { + err = "Erro"; + } + err = err.replace( '+', ' ' ); + out.println( mergeTemplate( err, innerErrorTemplate) ); + } + + protected Executer getExecuter() + throws Exception + { + ServletContext context = CONTEXT; + DBManager dbm = ( DBManager ) context.getAttribute( Singleton.DEFAULT_DBMANAGER ); + if( dbm == null ) + { + dbm = new JDBCManager( bdLocalUrl, bdLocalUsername, bdLocalPassword , 500, 499, 1, null ); + context.setAttribute( Singleton.DEFAULT_DBMANAGER, dbm ); + } + return dbm.getSharedExecuter(); + } +} + diff --git a/tags/teg/web/src/WEB-INF/web.xml b/tags/teg/web/src/WEB-INF/web.xml new file mode 100644 index 00000000..bc00f63f --- /dev/null +++ b/tags/teg/web/src/WEB-INF/web.xml @@ -0,0 +1,46 @@ + + + + + + SIPRP WEB + SIPRP WEB + + SIPRP WEB + siprp.pagina.siprpServlet + + + SIPRP WEB + /index.html + + + + Request + siprp.pagina.RequestServlet + + + Request + /request + + + + Schedule + siprp.pagina.ScheduleServlet + + + Schedule + /schedule + + + + Relatorio + siprp.pagina.RelatorioServlet + + + Relatorio + /relatorio + + + diff --git a/tags/teg/web/src/html/clientes.html b/tags/teg/web/src/html/clientes.html new file mode 100644 index 00000000..75220e84 --- /dev/null +++ b/tags/teg/web/src/html/clientes.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + +
   os +nossos clientes
+ + + + + + + + + + +

+

+
em +desenvolvimento...
+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/colaboradores.html b/tags/teg/web/src/html/colaboradores.html new file mode 100644 index 00000000..4c8488de --- /dev/null +++ b/tags/teg/web/src/html/colaboradores.html @@ -0,0 +1,50 @@ + + + + + SIPRP - Colaboradores + + + + + + + + + + + + + + + +
   colaboradores
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/contactos.html b/tags/teg/web/src/html/contactos.html new file mode 100644 index 00000000..ccd32346 --- /dev/null +++ b/tags/teg/web/src/html/contactos.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Apresentação + + + + + + + + + + + + + + + +
   +contactos
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/conteudos/colaboradores_text.html b/tags/teg/web/src/html/conteudos/colaboradores_text.html new file mode 100644 index 00000000..97bc3572 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/colaboradores_text.html @@ -0,0 +1,111 @@ + + + + + + SIPRP - Apresentação + + +Área reservada a colaboradores da SIPRP.
+Esta página dá acesso a funcionalidades exclusivas e confidenciais.
+
    +
  • + Acesso ao webmail SIPRP +
  • +
  • + Junte-se a Nós
    +
    + +
  • +
+ + diff --git a/tags/teg/web/src/html/conteudos/contactos_text.html b/tags/teg/web/src/html/conteudos/contactos_text.html new file mode 100644 index 00000000..49d25e25 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/contactos_text.html @@ -0,0 +1,105 @@ + + + + + SIPRP - Apresentação + + + + +SIPRP – Sociedade Ibérica de Prevenção de Riscos +Profissionais
+
+Edifício Atrium Saldanha
+Praça Duque de Saldanha, 1 – +9º G
+1050 – 094 Lisboa
+
+Telefone: 21 350 45 40
+Fax: 21 350 45 49
+E-mail: geral@siprp.pt
+
+
+Pedir mais informações
+
+ + + + diff --git a/tags/teg/web/src/html/conteudos/higiene_foto_equip_BA.html b/tags/teg/web/src/html/conteudos/higiene_foto_equip_BA.html new file mode 100644 index 00000000..27998fee --- /dev/null +++ b/tags/teg/web/src/html/conteudos/higiene_foto_equip_BA.html @@ -0,0 +1,29 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + +

+
Bomba de Amostragem de ar
+
voltar +»
+
+
+ + diff --git a/tags/teg/web/src/html/conteudos/higiene_text.html b/tags/teg/web/src/html/conteudos/higiene_text.html new file mode 100644 index 00000000..26d9268a --- /dev/null +++ b/tags/teg/web/src/html/conteudos/higiene_text.html @@ -0,0 +1,59 @@ + + + + + SIPRP - Serviços + + +Para a prestação deste serviço, a SIPRP +colocará à disposição um dos seus +Técnicos Superiores de Higiene e Segurança, que +garantirá o cumprimento das seguintes actividades nas +várias instalações da empresa espalhadas por todo +o país:
+

+ - Identificação e avaliação dos +riscos;
+ - Planeamento da prevenção, integrando-a a todos os +níveis da hierarquia;
+ - Elaboração de um programa de +prevenção de riscos profissionais;
+ - Informação sobre riscos e medidas de +protecção;
+ - Organização de medidas a adoptar em caso de +perigo +grave;
+ - Coordenação das auditorias internas para controlo +da aplicação das medidas a implementar;
+  +- Análise dos acidentes de trabalho e doenças +profissionais;
+  +- Recolha e organização de elementos +estatísticos.
+

+Estas actividades estão englobadas nas várias auditorias, +medições, avaliações e respectivos +relatórios efectuados pelo técnico.
+A SIPRP efectuará, no mínimo, DUAS auditorias por cada +estabelecimento e ano, que originarão os respectivos +relatórios técnicos com o levantamento das +condições verificadas e as recomendações +para a resolução das não conformidades encontradas.
+Com esse relatório será elaborado um Plano de +Actuação que será entregue ao coordenador do +serviço na empresa com as acções a desenvolver, +prazos de implementação e responsabilidades.
+Para além dos serviços incluídos e exigidos pela +legislação, a SIPRP possui capacidade (técnica e +humana) para efectuar avaliações específicas no +âmbito da Higiene e Segurança.
+Desde Estudos de Ruído, Iluminação, Conforto +Térmico, Qualidade do Ar, bem como outros factores relacionados +com outros riscos físicos, químicos ou biológicos.
+Para o cumprimento destes requisitos a SIPRP possui equipamento +técnico próprio, de acordo com as normas nacionais e +internacionais.
+ + diff --git a/tags/teg/web/src/html/conteudos/higiene_text_equip.html b/tags/teg/web/src/html/conteudos/higiene_text_equip.html new file mode 100644 index 00000000..a972d096 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/higiene_text_equip.html @@ -0,0 +1,36 @@ + + + + + SIPRP - Serviços + + +Bombas de Amostragem
+ - Para captação do volume de ar pretendido para a +amostra
+Reguladores de Caudal
+ - Para regulação do caudal de ar pretendido para +amostra
+Monitores de Conforto +Térmico
+ - Para determinação dos parâmetros de +conforto térmico
+Termoanemómetros
+ - Para medição da temperatura, humidade relativa e +velocidade do ar
+Explosivímetros
+ - Para medir a concentração de oxigénio, +CO2, Metano, entre outros
+Luxímetros
+ - Para medição de luminância e +iluminância
+Dosímetros
+ - Para avaliação da exposição pessoal +diária de um trabalhador ao ruído
+Sonómetros +Integradores
+ - Para avaliação dos níveis de ruído +ocupacional ou ambiental
+Outros
+ + diff --git a/tags/teg/web/src/html/conteudos/links_text.html b/tags/teg/web/src/html/conteudos/links_text.html new file mode 100644 index 00000000..6b7c268d --- /dev/null +++ b/tags/teg/web/src/html/conteudos/links_text.html @@ -0,0 +1,104 @@ + + + + + SIPRP - Apresentação + + +

Agência Europeia para a +Segurança +e Saúde do Trabalho – www.agency.osha.eu.int
+American +Institute of Chemical Engineers – www.aiche.org
+American +Industrial Hygiene Association – www.aiha.org
+Associação +Portuguesa de Seguradores – www.apseguradores.pt
+Bureau +of Labour Statistics – www.stats.bls.gov
+Chemical +Abstracts Service – www.info.cas.org
+Cornell +University Ergonomics Web – www.ergo.human.cornell.edu
+Direcção +Geral de Estudos Estatística e Planeamento – +www.deep.msst.gov.pt
+Direcção +Geral de Saúde – www.dgsaude.pt
+Factor +Segurança – www.factor-segur.pt
+Grupo +PREMESER – www.premeser.com
+IDICT +- www.idict.gov.pt
+Industrial +Safety and Health News – www.ishn.com
+Institut +Nacional de Recherche et de Securité – www.inrs.fr
+Institute +for Research in Construction – +www.irc.nrc-cnrc.gc.ca/irccontents.html
+Institute +of Occupational Safety Engineering – +www.turva.me.tut.fi/english/indexeng.html
+Instituto +de Apoio às Pequenas e Médias Empresas e ao +Investimento – www.iapmei.pt
+Instituto +Nacional de Estatística – www.ine.pt
+Instituto +para a Qualidade na Formação – +www.inofor.pt
+International +Labor Organization – www.ilo.org
+International +Organization for Standardization – ISO – +www.iso.org/iso/en/isoonline.frontpage
+International +Society for Respiratory Protection – www.isrp.com.au
+International +Commision on Non-Ionozing Radiation Protection – +www.icirp.de
+Ministério +da Segurança Social e do Trabalho – www.msst.gov.pt
+Mutua +Universal – www.muniversal.net
+National +Electrical Safety Foundation – www.nesf.org
+National +Fire Protection Association – www.nfpa.org
+Occupational +Safety and Health Administration – OSHA – www.osha.gov
+Ordem +dos Enfermeiros – www.ordemenfermeiros.pt
+Ordem +dos Médicos – www.ordemdosmedicos.pt
+PREVLER +Online – www.vol.com.br/prevler
+Revista +Proteção – www.protecao.com.br
+Revista +Segurança – www.revistaseguranca.com
+World +Health Organization (OMS) – www.who.int/en

+ + diff --git a/tags/teg/web/src/html/conteudos/medicina_text.html b/tags/teg/web/src/html/conteudos/medicina_text.html new file mode 100644 index 00000000..cdbeef47 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/medicina_text.html @@ -0,0 +1,32 @@ + + + + + SIPRP - Serviços + + +A SIPRP possui um gabinete médico completamente equipado na sua +sede do Atrium Saldanha, em Lisboa, onde se encontra a sua Directora +Clínica, especialista em Medicina do Trabalho.
+Para além disso, e uma vez que tem a possibilidade de prestar o +serviço em todo o território nacional, possui uma rede de +clínicas, médicos, enfermeiros e laboratórios de +análises clínicas contratados com capacidade de poder +prestar o serviço dentro dos parâmetros de qualidade que +preconiza.
+Por último, tem, também, capacidade para fazer deslocar +Médicos do Trabalho às empresas, desde que estas possuam +gabinete médico próprio com as condições +mínimas exigidas pela legislação portuguesa.
+A Direcção Clínica da SIPRP desenha perfis +médicos adequados aos riscos a que estão expostos os +trabalhadores das suas empresas Clientes, não excluindo, +inclusivamente, a possibilidade de serem efectuados outros exames +complementares de diagnóstico conforme os riscos +específicos de cada actividade, como sejam os trabalhadores +expostos a factores físicos (como ruído, stress +térmico, iluminação, entre outros), +químicos (por exemplo, pessoal de limpeza) ou biológicos +(por exemplo, manipuladores de alimentos).
+ + diff --git a/tags/teg/web/src/html/conteudos/politica_text.html b/tags/teg/web/src/html/conteudos/politica_text.html new file mode 100644 index 00000000..3e52de72 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/politica_text.html @@ -0,0 +1,69 @@ + + + + + SIPRP - Serviços + + + +Porque sabemos que a gestão administrativa do serviço de +SHST é difícil para a empresa, a SIPRP tomará a +seu cargo essas tarefas, simplificando todo o processo.
+Notificações ao ISHST(ex-IDICT) (Mod. 1360)
+ +Relatório Anual de Actividade de SHST
+ +Marcações de Consultas
+ +Informação on line
+ +Informação sobre legislação
+ +Controlos de Qualidade
+ + + diff --git a/tags/teg/web/src/html/conteudos/politica_text_20050106.html b/tags/teg/web/src/html/conteudos/politica_text_20050106.html new file mode 100644 index 00000000..cc78d7ab --- /dev/null +++ b/tags/teg/web/src/html/conteudos/politica_text_20050106.html @@ -0,0 +1,59 @@ + + + + + SIPRP - Serviços + + +Porque sabemos que a gestão administrativa do serviço de +SHST é difícil para a empresa, a SIPRP tomará a +seu cargo essas tarefas, simplificando todo o processo.
+Notificações ao ISHST +(ex-IDICT) (Mod. 1360)
+Elaboração e entrega da Notificação em cada +delegação ou subdelegação do ISHST +(ex-IDICT) onde a empresa tenha estabelecimento. Após a +confirmação da recepção desses documentos +por parte do ISHST, serão enviadas cópias autenticadas +para a empresa.
+Relatório Anual de Actividade +de SHST
+Compilação da informação, +elaboração e entrega dos Relatórios (um por cada +estabelecimento) através de suporte informático pela +Internet. Após a confirmação da +recepção desses documentos por parte dos serviços +competentes, serão enviadas cópias para a empresa.
+Marcações de Consultas
+A SIPRP, através do seu avançado sistema +informático, será responsável pela +marcação dos exames de Medicina do Trabalho +(Admissão, Periódico ou Ocasional) conforme a +periodicidade indicada pela legislação (anualmente para +os trabalhadores com menos de 18 e mais de 50 anos e de dois em dois +anos para os restantes).
+Informação on line
+A SIPRP possibilita à empresa, através deste site, a +visualização do histórico do serviço +(consultas efectuadas, marcações, faltas, data da +próxima consulta, se tem Ficha de Aptidão emitida, entre +outros) durante as 24 horas do dia, todos os dias do ano. Essa +informação será, logicamente, confidencial, +não tendo qualquer dado médico (ao abrigo do sigilo +profissional) e exigirá a introdução de uma +palavra passe previamente remetida à empresa.
+Informação sobre +legislação
+A SIPRP será responsável pelo envio, com periodicidade +acordada, da actualização de toda a +legislação de SHST (portuguesa e europeia) sobre a +actividade específica da empresa Cliente, mantendo-a a par de +todas as obrigações legais inerentes.
+Controlos de Qualidade
+Serão efectuados questionários de controlo de qualidade, +por amostragem, tanto aos funcionários da empresas bem como aos +responsáveis directos pelo serviço, com o objectivo de se +poder aperfeiçoar, melhorar ou intervir rapidamente nalgum +aspecto que não corresponda às expectativas da empresa.
+ + diff --git a/tags/teg/web/src/html/conteudos/servicos_compl_text.html b/tags/teg/web/src/html/conteudos/servicos_compl_text.html new file mode 100644 index 00000000..ce16c605 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/servicos_compl_text.html @@ -0,0 +1,71 @@ + + + + + SIPRP - Serviços + + + +A SIPRP, devido à sua competência técnica e humana, +põe à disposição dos seus Clientes um leque +de serviços muito abrangente, tendo sempre em conta o respeito +pela legislação vigente e pelos princípios de +rigor, transparência e qualidade.
+
+Poderá consultar, seguidamente, alguns dos serviços que +poderemos oferecer:
+
+
+Segurança, Higiene e Saúde do Trabalho
+ +Formação
+ +Ergonomia
+ +Estudos e Análises Técnicas de Agentes Físicos (Iluminação, Ruído, Radiações, Ambiente Térmico e Vibrações)
+ +Estudos e Análises Técnicas de Contaminantes Químicos (Poeiras, Gases e Vapores, Líquidos e Fumos)
+ +Estudos e Análises Técnicas de Contaminantes Biológicos (Vírus, Bactérias, Fungos e Parasitas)
+ +Outros
+ +
+ + diff --git a/tags/teg/web/src/html/conteudos/servicos_compl_text_20050106.html b/tags/teg/web/src/html/conteudos/servicos_compl_text_20050106.html new file mode 100644 index 00000000..94ebe148 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/servicos_compl_text_20050106.html @@ -0,0 +1,71 @@ + + + + + SIPRP - Serviços + + +A SIPRP, devido à sua competência técnica e humana, +põe à disposição dos seus Clientes um leque +de serviços muito abrangente, tendo sempre em conta o respeito +pela legislação vigente e pelos princípios de +rigor, transparência e qualidade.
+
+Poderá consultar, seguidamente, alguns dos serviços que +poderemos oferecer:
+
+

+Segurança, Higiene e Saúde do Trabalho
+ - Serviços à Medida do Cliente ou sua actividade +obedecendo à legislação portuguesa em vigor
+ - Medicina do Trabalho
+ - Levantamento e Avaliação de Riscos
+ - Apoio Administrativo
+Formação
+ - Primeiros Socorros
+ - Acções de Sensibilização em Higiene +e +Segurança e EPI’s
+ - Meios de Combate a Incêndios
+ - Movimentação Mecânica de Cargas +(Empilhadores +e outros)
+ - Manipulação de Cargas
+Ergonomia
+ - Avaliação da Carga Física
+ - Movimentação Manual de Cargas
+ - Prevenção de Lesões +Músculo-Esqueléticas
+ - Análise de Postos de Trabalho
+Estudos e Análises Técnicas de Agentes Físicos +(Iluminação, Ruído, Radiações, +Ambiente Térmico e Vibrações)
+ - Estudos de Luminância e Iluminância
+ - Estudos de Ruído Ocupacional
+ - Estudos de Radiações Ionizantes (i.e. RX) e +Não Ionizantes (i.e. Campos Electromagnéticos dos +Computadores)
+ - Estudos de Conforto e Stress Térmico
+ - Estudos de Vibrações
+Estudos e Análises Técnicas de Contaminantes +Químicos (Poeiras, Gases e Vapores, Líquidos e Fumos)
+ - Estudos de Poeiras (Totais e Respiráveis)
+ - Compostos Orgânicos Voláteis, Formaldaído e +Nicotina
+Estudos e Análises Técnicas de Contaminantes +Biológicos (Vírus, Bactérias, Fungos e Parasitas)
+ - Legionella Pneumóphila
+ - Exames Microbiológicos (i.e. interior de condutas do +sistema AVAC)
+ - Estudos de Microrganismos em Suspensão no Ar
+ Outros
+ - Planos de Emergência / Evacuação
+ - Medicina Curativa
+ - Enfermagem
+ - Análises Clínicas
+ - Exames Complementares de Diagnóstico
+ - Comercialização de Sinalética de +Segurança
+

+ + diff --git a/tags/teg/web/src/html/conteudos/siprp_text.html b/tags/teg/web/src/html/conteudos/siprp_text.html new file mode 100644 index 00000000..7315af20 --- /dev/null +++ b/tags/teg/web/src/html/conteudos/siprp_text.html @@ -0,0 +1,28 @@ + + + + + SIPRP - Apresentação + + +A SIPRP - Sociedade Ibérica de Prevenção de Riscos +Profissionais é uma empresa de origem espanhola pertencente ao +Grupo Premeser (www.premeser.com). Este Grupo foi formado com a +finalidade de optimizar as sinergias entre empresas de sectores e +âmbitos geográficos diferentes, resultando num grupo +sólido e competitivo, capaz de oferecer as respostas adequadas +para uma gestão eficaz dos serviços de Segurança, +Higiene e Saúde do Trabalho (SHST) junto dos seus Clientes.
+
+A SIPRP aposta fortemente na inovação +e pretende ser uma +empresa de referência no sector, assentando a sua +actuação no rigor, seriedade e em compromissos +sólidos com os seus Clientes e suas necessidades.
+
+Porque a prevenção é a base de todo o trabalho +nesta área, na SIPRP temos em conta a especificidade da +actividade de cada empresa, as condições de trabalho dos +seus colaboradores e todos os factores que os rodeiam.
+ + diff --git a/tags/teg/web/src/html/conteudos/siprp_text_inovacao.html b/tags/teg/web/src/html/conteudos/siprp_text_inovacao.html new file mode 100644 index 00000000..a04576ab --- /dev/null +++ b/tags/teg/web/src/html/conteudos/siprp_text_inovacao.html @@ -0,0 +1,22 @@ + + + + + SIPRP - Apresentação + + +Como factores de sucesso na inovação, salientamos:
+
+- Atendimento personalizado, baseado numa sólida plataforma +informática;
+- Informação actualizada on-line;
+- Equipamento técnico de última geração;
+- Instalações modernas e funcionais;
+- Técnicos Superiores qualificados;
+- Acompanhamento permanente das necessidades e exigências dos +Clientes;
+- Diversas opções para prestação dos +serviços (à medida de cada actividade)
+
+ + diff --git a/tags/teg/web/src/html/css/funcs.js b/tags/teg/web/src/html/css/funcs.js new file mode 100644 index 00000000..099f6df4 --- /dev/null +++ b/tags/teg/web/src/html/css/funcs.js @@ -0,0 +1,64 @@ +function showhide( id ) +{ + if( document.getElementById ) + { + obj = document.getElementById( id ); + if ( obj.style.display == "none" ) + { + obj.style.display = ""; + document.getElementById( 'span_' + id ).style.color = "#C13F45"; + } + else + { + obj.style.display = "none"; + document.getElementById( 'span_' + id ).style.color = "#497895"; + } + } +} + +function isValidDate( year, month, day ) +{ + return day > 0 && ( day <= [, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][ month ] || + day == 29 && month == 2 && year % 4 == 0 && ( year % 100 > 0 || year % 400 == 0 ) ); +} + +function isValid( element, type ) +{ + switch( type ) + { + // date + case 0: + if( element.value.search( /^\d\d?\/\d\d?\/\d{1,4}$/ ) != 0 ) + { + alert( "Formato da data incorrecto." ); + window.setTimeout( "document.getElementById( '" + element.name + "').focus()", 1 ); + return false; + } + date_value = element.value.split( "/" ); + if( ! isValidDate( date_value[ 2 ], date_value[ 1 ], date_value[ 0 ] ) ) + { + alert( "Data inválida." ); + window.setTimeout( "document.getElementById( '" + element.name + "').focus()", 1 ); + return false; + } + break; + // integer + case 1: + if( element.value.search( /^\d\d:\d\d$/ ) != 0 ) + { + alert( "Formato da hora incorrecto." ); + window.setTimeout( "document.getElementById( '" + element.name + "' ).focus()", 1 ); + return false; + } + time_value = element.value.split( ":" ); + if( time_value[ 0 ] > 23 || time_value[ 1 ] > 59 ) + { + alert( "Hora inválida." ); + window.setTimeout( "document.getElementById( '" + element.name + "').focus()", 1 ); + return false; + } + break; + } + + return true; +} diff --git a/tags/teg/web/src/html/css/style.css b/tags/teg/web/src/html/css/style.css new file mode 100644 index 00000000..78159917 --- /dev/null +++ b/tags/teg/web/src/html/css/style.css @@ -0,0 +1,129 @@ +body +{ + color: #497895; + font-family: verdana; + margin-top: 0px; +} + +.text +{ + color: #497895; + font-family: verdana; + font-size: 10pt; + text-align: justify; +} + +.noticias +{ + color: #497895; + font-family: verdana; + font-size: 9pt; + text-align: left; +} + +td.asd +{ + border-width: 1px 1px 1px 1px; + border-style: solid; +} + +td.title +{ + color: #ffffff; + font-family: verdana; + font-size: 10pt; + font-weight: bold; +} + +td.noticias +{ + font-size: 9pt; +} + +td.footer +{ + color: #ffffff; + font-family: verdana; + font-size: 8pt; + text-align: right; +} + +a:link, +a:visited, +a:active +{ + color: #497895; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a:hover +{ + color: #C13F45; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a.menu:link, +a.menu:visited, +a.menu:active +{ + color: #FFFFFF; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a.menu:hover +{ + color: #C13F45; + font-family: verdana; + font-size: 10pt; + font-weight: bold; + text-decoration: none; +} + +a.big:link, +a.big:visited, +a.big:active +{ + color: #497895; + font-family: verdana; + font-size: 12pt; + font-weight: bold; + text-decoration: none; +} + +a.big:hover +{ + color: #C13F45; + font-family: verdana; + font-size: 12pt; + font-weight: bold; + text-decoration: none; +} + +a.copy:link, +a.copy:visited, +a.copy:active +{ + color: #FFFFFF; + font-family: verdana; + font-size: 8pt; + font-weight: normal; + text-decoration: underline; +} + +select, +option, +input +{ + color: #497895; + font-family: verdana; + margin-top: 0px; +} diff --git a/tags/teg/web/src/html/erro.html b/tags/teg/web/src/html/erro.html new file mode 100644 index 00000000..ce6f9d47 --- /dev/null +++ b/tags/teg/web/src/html/erro.html @@ -0,0 +1,44 @@ + + + + + SIPRP - Erro + + + + + + + + + + + + + + + +
  erro
+
+ + + + + + + + + + +

+

+
+ $msg +
+

+
+

+
+ + diff --git a/tags/teg/web/src/html/frame_erro.html b/tags/teg/web/src/html/frame_erro.html new file mode 100644 index 00000000..f97eab0b --- /dev/null +++ b/tags/teg/web/src/html/frame_erro.html @@ -0,0 +1,254 @@ + + + + + + SIPRP + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + + +

+

+
a SIPRPserviçoscolaboradorescontactoslinks 
+ + + + + + + + + + + + + + + + +
+ + +
+
+ + + + + + +
+
+ + + + + + + + + + + + + + + +
user
password
+
+
+

+
+ + + + + + + + + + + + + + +
   notícias
+
+ + + + + + + + + + +

+

+
A SIPRP apresenta o +seu novo site em www.siprp.pt.
+
+Além de conteúdos sobre a empresa e o grupo, é +disponibilizado um portal online com funcionalidades para os seus +clientes.

+

+
+

+
+
+
+ + diff --git a/tags/teg/web/src/html/higiene.html b/tags/teg/web/src/html/higiene.html new file mode 100644 index 00000000..1ef5315b --- /dev/null +++ b/tags/teg/web/src/html/higiene.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Higiene + + + + + + + + + + + + + + + +
   +higiene e segurança
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/index.html b/tags/teg/web/src/html/index.html new file mode 100644 index 00000000..32d07d04 --- /dev/null +++ b/tags/teg/web/src/html/index.html @@ -0,0 +1,229 @@ + + + + + + + SIPRP + + + + + + + + + + + +

+
+ + + + + + + + + + + + + + + +

+

+
a SIPRPserviçoscolaboradorescontactoslinks 
+ + + + + + + + + + + + + + +

+
+ + + + + + +
+
+ + + + + + + + + + + + + + + +
user
password
+
+
+
+ + + + + + + + + + + + + +
   notícias
+
+ + + + + + + + + + +

+

+
+ +
+

+
+

+
+
+
+ + diff --git a/tags/teg/web/src/html/links.html b/tags/teg/web/src/html/links.html new file mode 100644 index 00000000..ae2134b2 --- /dev/null +++ b/tags/teg/web/src/html/links.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Links + + + + + + + + + + + + + + + +
   +links úteis
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/mail/cv_enviado.html b/tags/teg/web/src/html/mail/cv_enviado.html new file mode 100644 index 00000000..0bd37216 --- /dev/null +++ b/tags/teg/web/src/html/mail/cv_enviado.html @@ -0,0 +1,11 @@ + + + + + + Enviado + + + A sua informação foi enviada com sucesso. + + diff --git a/tags/teg/web/src/html/mail/cv_nao_enviado.html b/tags/teg/web/src/html/mail/cv_nao_enviado.html new file mode 100644 index 00000000..dd8c1671 --- /dev/null +++ b/tags/teg/web/src/html/mail/cv_nao_enviado.html @@ -0,0 +1,12 @@ + + + + + + Erro a enviar + + + Erro a enviar a sua informação.
+ Verifique que preencheu "Nome Completo", "Telefone" e "E-Mail" com um valor válido. + + diff --git a/tags/teg/web/src/html/mail/envio_cv.txt b/tags/teg/web/src/html/mail/envio_cv.txt new file mode 100644 index 00000000..69a3da74 --- /dev/null +++ b/tags/teg/web/src/html/mail/envio_cv.txt @@ -0,0 +1,7 @@ +Envio de CV + +Função: $rec_funcao +Nome: $rec_nome +Morada: $rec_morada +Telefone: $rec_telefone +E-mail: $rec_email diff --git a/tags/teg/web/src/html/mail/pedido_enviado.html b/tags/teg/web/src/html/mail/pedido_enviado.html new file mode 100644 index 00000000..ec1854c9 --- /dev/null +++ b/tags/teg/web/src/html/mail/pedido_enviado.html @@ -0,0 +1,11 @@ + + + + + + Enviado + + + O seu pedido foi enviado com sucesso + + diff --git a/tags/teg/web/src/html/mail/pedido_informacao.txt b/tags/teg/web/src/html/mail/pedido_informacao.txt new file mode 100644 index 00000000..3178db98 --- /dev/null +++ b/tags/teg/web/src/html/mail/pedido_informacao.txt @@ -0,0 +1,5 @@ +Pedido de informação de: +Nome: $request_name +Telefone: $request_phone +E-mail: $request_email +Assunto: $request_details diff --git a/tags/teg/web/src/html/mail/pedido_nao_enviado.html b/tags/teg/web/src/html/mail/pedido_nao_enviado.html new file mode 100644 index 00000000..4dcb63f4 --- /dev/null +++ b/tags/teg/web/src/html/mail/pedido_nao_enviado.html @@ -0,0 +1,11 @@ + + + + + + Erro a enviar + + + Erro a enviar o seu pedido + + diff --git a/tags/teg/web/src/html/marcacao/CalendarPopup.js b/tags/teg/web/src/html/marcacao/CalendarPopup.js new file mode 100644 index 00000000..03f4daa3 --- /dev/null +++ b/tags/teg/web/src/html/marcacao/CalendarPopup.js @@ -0,0 +1,1462 @@ +// =================================================================== +// Author: Matt Kruse +// WWW: http://www.mattkruse.com/ +// +// NOTICE: You may use this code for any purpose, commercial or +// private, without any further permission from the author. You may +// remove this notice from your final code if you wish, however it is +// appreciated by the author if at least my web site address is kept. +// +// You may *NOT* re-distribute this code in any way except through its +// use. That means, you can include it in your product, or your web +// site, or any other form where the code is actually being used. You +// may not put the plain javascript up on your site for download or +// include it in your javascript libraries for download. +// If you wish to share this code with others, please just point them +// to the URL instead. +// Please DO NOT link directly to my .js files from your site. Copy +// the files to your server and use them there. Thank you. +// =================================================================== + + +/* SOURCE FILE: AnchorPosition.js */ + +/* +AnchorPosition.js +Author: Matt Kruse +Last modified: 10/11/02 + +DESCRIPTION: These functions find the position of an tag in a document, +so other elements can be positioned relative to it. + +COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. + +FUNCTIONS: +getAnchorPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor. Position is relative to the PAGE. + +getAnchorWindowPosition(anchorname) + Returns an Object() having .x and .y properties of the pixel coordinates + of the upper-left corner of the anchor, relative to the WHOLE SCREEN. + +NOTES: + +1) For popping up separate browser windows, use getAnchorWindowPosition. + Otherwise, use getAnchorPosition + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. +*/ + +// getAnchorPosition(anchorname) +// This function returns an object having .x and .y properties which are the coordinates +// of the named anchor, relative to the page. +function getAnchorPosition(anchorname) { + // This function will return an Object with x and y properties + var useWindow=false; + var coordinates=new Object(); + var x=0,y=0; + // Browser capability sniffing + var use_gebi=false, use_css=false, use_layers=false; + if (document.getElementById) { use_gebi=true; } + else if (document.all) { use_css=true; } + else if (document.layers) { use_layers=true; } + // Logic to find position + if (use_gebi && document.all) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_gebi) { + var o=document.getElementById(anchorname); + x=AnchorPosition_getPageOffsetLeft(o); + y=AnchorPosition_getPageOffsetTop(o); + } + else if (use_css) { + x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]); + y=AnchorPosition_getPageOffsetTop(document.all[anchorname]); + } + else if (use_layers) { + var found=0; + for (var i=0; i9?"":"0")+x} + +// ------------------------------------------------------------------ +// isDate ( date_string, format_string ) +// Returns true if date string matches format of format string and +// is a valid date. Else returns false. +// It is recommended that you trim whitespace around the value before +// passing it to this function, as whitespace is NOT ignored! +// ------------------------------------------------------------------ +function isDate(val,format) { + var date=getDateFromFormat(val,format); + if (date==0) { return false; } + return true; + } + +// ------------------------------------------------------------------- +// compareDates(date1,date1format,date2,date2format) +// Compare two date strings to see which is greater. +// Returns: +// 1 if date1 is greater than date2 +// 0 if date2 is greater than date1 of if they are the same +// -1 if either of the dates is in an invalid format +// ------------------------------------------------------------------- +function compareDates(date1,dateformat1,date2,dateformat2) { + var d1=getDateFromFormat(date1,dateformat1); + var d2=getDateFromFormat(date2,dateformat2); + if (d1==0 || d2==0) { + return -1; + } + else if (d1 > d2) { + return 1; + } + return 0; + } + +// ------------------------------------------------------------------ +// formatDate (date_object, format) +// Returns a date in the output format specified. +// The format string uses the same abbreviations as in getDateFromFormat() +// ------------------------------------------------------------------ +function formatDate(date,format) { + format=format+""; + var result=""; + var i_format=0; + var c=""; + var token=""; + var y=date.getYear()+""; + var M=date.getMonth()+1; + var d=date.getDate(); + var E=date.getDay(); + var H=date.getHours(); + var m=date.getMinutes(); + var s=date.getSeconds(); + var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k; + // Convert real date parts into formatted versions + var value=new Object(); + if (y.length < 4) {y=""+(y-0+1900);} + value["y"]=""+y; + value["yyyy"]=y; + value["yy"]=y.substring(2,4); + value["M"]=M; + value["MM"]=LZ(M); + value["MMM"]=MONTH_NAMES[M-1]; + value["NNN"]=MONTH_NAMES[M+11]; + value["d"]=d; + value["dd"]=LZ(d); + value["E"]=DAY_NAMES[E+7]; + value["EE"]=DAY_NAMES[E]; + value["H"]=H; + value["HH"]=LZ(H); + if (H==0){value["h"]=12;} + else if (H>12){value["h"]=H-12;} + else {value["h"]=H;} + value["hh"]=LZ(value["h"]); + if (H>11){value["K"]=H-12;} else {value["K"]=H;} + value["k"]=H+1; + value["KK"]=LZ(value["K"]); + value["kk"]=LZ(value["k"]); + if (H > 11) { value["a"]="PM"; } + else { value["a"]="AM"; } + value["m"]=m; + value["mm"]=LZ(m); + value["s"]=s; + value["ss"]=LZ(s); + while (i_format < format.length) { + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + if (value[token] != null) { result=result + value[token]; } + else { result=result + token; } + } + return result; + } + +// ------------------------------------------------------------------ +// Utility functions for parsing in getDateFromFormat() +// ------------------------------------------------------------------ +function _isInteger(val) { + var digits="1234567890"; + for (var i=0; i < val.length; i++) { + if (digits.indexOf(val.charAt(i))==-1) { return false; } + } + return true; + } +function _getInt(str,i,minlength,maxlength) { + for (var x=maxlength; x>=minlength; x--) { + var token=str.substring(i,i+x); + if (token.length < minlength) { return null; } + if (_isInteger(token)) { return token; } + } + return null; + } + +// ------------------------------------------------------------------ +// getDateFromFormat( date_string , format_string ) +// +// This function takes a date string and a format string. It matches +// If the date string matches the format string, it returns the +// getTime() of the date. If it does not match, it returns 0. +// ------------------------------------------------------------------ +function getDateFromFormat(val,format) { + val=val+""; + format=format+""; + var i_val=0; + var i_format=0; + var c=""; + var token=""; + var token2=""; + var x,y; + var now=new Date(); + var year=now.getYear(); + var month=now.getMonth()+1; + var date=1; + var hh=now.getHours(); + var mm=now.getMinutes(); + var ss=now.getSeconds(); + var ampm=""; + + while (i_format < format.length) { + // Get next token from format string + c=format.charAt(i_format); + token=""; + while ((format.charAt(i_format)==c) && (i_format < format.length)) { + token += format.charAt(i_format++); + } + // Extract contents of value based on format token + if (token=="yyyy" || token=="yy" || token=="y") { + if (token=="yyyy") { x=4;y=4; } + if (token=="yy") { x=2;y=2; } + if (token=="y") { x=2;y=4; } + year=_getInt(val,i_val,x,y); + if (year==null) { return 0; } + i_val += year.length; + if (year.length==2) { + if (year > 70) { year=1900+(year-0); } + else { year=2000+(year-0); } + } + } + else if (token=="MMM"||token=="NNN"){ + month=0; + for (var i=0; i11)) { + month=i+1; + if (month>12) { month -= 12; } + i_val += month_name.length; + break; + } + } + } + if ((month < 1)||(month>12)){return 0;} + } + else if (token=="EE"||token=="E"){ + for (var i=0; i12)){return 0;} + i_val+=month.length;} + else if (token=="dd"||token=="d") { + date=_getInt(val,i_val,token.length,2); + if(date==null||(date<1)||(date>31)){return 0;} + i_val+=date.length;} + else if (token=="hh"||token=="h") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>12)){return 0;} + i_val+=hh.length;} + else if (token=="HH"||token=="H") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>23)){return 0;} + i_val+=hh.length;} + else if (token=="KK"||token=="K") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<0)||(hh>11)){return 0;} + i_val+=hh.length;} + else if (token=="kk"||token=="k") { + hh=_getInt(val,i_val,token.length,2); + if(hh==null||(hh<1)||(hh>24)){return 0;} + i_val+=hh.length;hh--;} + else if (token=="mm"||token=="m") { + mm=_getInt(val,i_val,token.length,2); + if(mm==null||(mm<0)||(mm>59)){return 0;} + i_val+=mm.length;} + else if (token=="ss"||token=="s") { + ss=_getInt(val,i_val,token.length,2); + if(ss==null||(ss<0)||(ss>59)){return 0;} + i_val+=ss.length;} + else if (token=="a") { + if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";} + else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";} + else {return 0;} + i_val+=2;} + else { + if (val.substring(i_val,i_val+token.length)!=token) {return 0;} + else {i_val+=token.length;} + } + } + // If there are any trailing characters left in the value, it doesn't match + if (i_val != val.length) { return 0; } + // Is date valid for month? + if (month==2) { + // Check for leap year + if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year + if (date > 29){ return 0; } + } + else { if (date > 28) { return 0; } } + } + if ((month==4)||(month==6)||(month==9)||(month==11)) { + if (date > 30) { return 0; } + } + // Correct hours value + if (hh<12 && ampm=="PM") { hh=hh-0+12; } + else if (hh>11 && ampm=="AM") { hh-=12; } + var newdate=new Date(year,month-1,date,hh,mm,ss); + return newdate.getTime(); + } + +// ------------------------------------------------------------------ +// parseDate( date_string [, prefer_euro_format] ) +// +// This function takes a date string and tries to match it to a +// number of possible date formats to get the value. It will try to +// match against the following international formats, in this order: +// y-M-d MMM d, y MMM d,y y-MMM-d d-MMM-y MMM d +// M/d/y M-d-y M.d.y MMM-d M/d M-d +// d/M/y d-M-y d.M.y d-MMM d/M d-M +// A second argument may be passed to instruct the method to search +// for formats like d/M/y (european format) before M/d/y (American). +// Returns a Date object or null if no patterns match. +// ------------------------------------------------------------------ +function parseDate(val) { + var preferEuro=(arguments.length==2)?arguments[1]:false; + generalFormats=new Array('y-M-d','MMM d, y','MMM d,y','y-MMM-d','d-MMM-y','MMM d'); + monthFirst=new Array('M/d/y','M-d-y','M.d.y','MMM-d','M/d','M-d'); + dateFirst =new Array('d/M/y','d-M-y','d.M.y','d-MMM','d/M','d-M'); + var checkList=new Array('generalFormats',preferEuro?'dateFirst':'monthFirst',preferEuro?'monthFirst':'dateFirst'); + var d=null; + for (var i=0; i tags may cause errors. + +USAGE: +// Create an object for a WINDOW popup +var win = new PopupWindow(); + +// Create an object for a DIV window using the DIV named 'mydiv' +var win = new PopupWindow('mydiv'); + +// Set the window to automatically hide itself when the user clicks +// anywhere else on the page except the popup +win.autoHide(); + +// Show the window relative to the anchor name passed in +win.showPopup(anchorname); + +// Hide the popup +win.hidePopup(); + +// Set the size of the popup window (only applies to WINDOW popups +win.setSize(width,height); + +// Populate the contents of the popup window that will be shown. If you +// change the contents while it is displayed, you will need to refresh() +win.populate(string); + +// set the URL of the window, rather than populating its contents +// manually +win.setUrl("http://www.site.com/"); + +// Refresh the contents of the popup +win.refresh(); + +// Specify how many pixels to the right of the anchor the popup will appear +win.offsetX = 50; + +// Specify how many pixels below the anchor the popup will appear +win.offsetY = 100; + +NOTES: +1) Requires the functions in AnchorPosition.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a PopupWindow object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a PopupWindow object or + the autoHide() will not work correctly. +*/ + +// Set the position of the popup window based on the anchor +function PopupWindow_getXYPosition(anchorname) { + var coordinates; + if (this.type == "WINDOW") { + coordinates = getAnchorWindowPosition(anchorname); + } + else { + coordinates = getAnchorPosition(anchorname); + } + this.x = coordinates.x; + this.y = coordinates.y; + } +// Set width/height of DIV/popup window +function PopupWindow_setSize(width,height) { + this.width = width; + this.height = height; + } +// Fill the window with contents +function PopupWindow_populate(contents) { + this.contents = contents; + this.populated = false; + } +// Set the URL to go to +function PopupWindow_setUrl(url) { + this.url = url; + } +// Set the window popup properties +function PopupWindow_setWindowProperties(props) { + this.windowProperties = props; + } +// Refresh the displayed contents of the popup +function PopupWindow_refresh() { + if (this.divName != null) { + // refresh the DIV object + if (this.use_gebi) { + document.getElementById(this.divName).innerHTML = this.contents; + } + else if (this.use_css) { + document.all[this.divName].innerHTML = this.contents; + } + else if (this.use_layers) { + var d = document.layers[this.divName]; + d.document.open(); + d.document.writeln(this.contents); + d.document.close(); + } + } + else { + if (this.popupWindow != null && !this.popupWindow.closed) { + if (this.url!="") { + this.popupWindow.location.href=this.url; + } + else { + this.popupWindow.document.open(); + this.popupWindow.document.writeln(this.contents); + this.popupWindow.document.close(); + } + this.popupWindow.focus(); + } + } + } +// Position and show the popup, relative to an anchor object +function PopupWindow_showPopup(anchorname) { + this.getXYPosition(anchorname); + this.x += this.offsetX; + this.y += this.offsetY; + if (!this.populated && (this.contents != "")) { + this.populated = true; + this.refresh(); + } + if (this.divName != null) { + // Show the DIV object + if (this.use_gebi) { + document.getElementById(this.divName).style.left = this.x + "px"; + document.getElementById(this.divName).style.top = this.y + "px"; + document.getElementById(this.divName).style.visibility = "visible"; + } + else if (this.use_css) { + document.all[this.divName].style.left = this.x; + document.all[this.divName].style.top = this.y; + document.all[this.divName].style.visibility = "visible"; + } + else if (this.use_layers) { + document.layers[this.divName].left = this.x; + document.layers[this.divName].top = this.y; + document.layers[this.divName].visibility = "visible"; + } + } + else { + if (this.popupWindow == null || this.popupWindow.closed) { + // If the popup window will go off-screen, move it so it doesn't + if (this.x<0) { this.x=0; } + if (this.y<0) { this.y=0; } + if (screen && screen.availHeight) { + if ((this.y + this.height) > screen.availHeight) { + this.y = screen.availHeight - this.height; + } + } + if (screen && screen.availWidth) { + if ((this.x + this.width) > screen.availWidth) { + this.x = screen.availWidth - this.width; + } + } + var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ); + this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+""); + } + this.refresh(); + } + } +// Hide the popup +function PopupWindow_hidePopup() { + if (this.divName != null) { + if (this.use_gebi) { + document.getElementById(this.divName).style.visibility = "hidden"; + } + else if (this.use_css) { + document.all[this.divName].style.visibility = "hidden"; + } + else if (this.use_layers) { + document.layers[this.divName].visibility = "hidden"; + } + } + else { + if (this.popupWindow && !this.popupWindow.closed) { + this.popupWindow.close(); + this.popupWindow = null; + } + } + } +// Pass an event and return whether or not it was the popup DIV that was clicked +function PopupWindow_isClicked(e) { + if (this.divName != null) { + if (this.use_layers) { + var clickX = e.pageX; + var clickY = e.pageY; + var t = document.layers[this.divName]; + if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) { + return true; + } + else { return false; } + } + else if (document.all) { // Need to hard-code this to trap IE for error-handling + var t = window.event.srcElement; + while (t.parentElement != null) { + if (t.id==this.divName) { + return true; + } + t = t.parentElement; + } + return false; + } + else if (this.use_gebi && e) { + var t = e.originalTarget; + while (t.parentNode != null) { + if (t.id==this.divName) { + return true; + } + t = t.parentNode; + } + return false; + } + return false; + } + return false; + } + +// Check an onMouseDown event to see if we should hide +function PopupWindow_hideIfNotClicked(e) { + if (this.autoHideEnabled && !this.isClicked(e)) { + this.hidePopup(); + } + } +// Call this to make the DIV disable automatically when mouse is clicked outside it +function PopupWindow_autoHide() { + this.autoHideEnabled = true; + } +// This global function checks all PopupWindow objects onmouseup to see if they should be hidden +function PopupWindow_hidePopupWindows(e) { + for (var i=0; i0) { + this.type="DIV"; + this.divName = arguments[0]; + } + else { + this.type="WINDOW"; + } + this.use_gebi = false; + this.use_css = false; + this.use_layers = false; + if (document.getElementById) { this.use_gebi = true; } + else if (document.all) { this.use_css = true; } + else if (document.layers) { this.use_layers = true; } + else { this.type = "WINDOW"; } + this.offsetX = 0; + this.offsetY = 0; + // Method mappings + this.getXYPosition = PopupWindow_getXYPosition; + this.populate = PopupWindow_populate; + this.setUrl = PopupWindow_setUrl; + this.setWindowProperties = PopupWindow_setWindowProperties; + this.refresh = PopupWindow_refresh; + this.showPopup = PopupWindow_showPopup; + this.hidePopup = PopupWindow_hidePopup; + this.setSize = PopupWindow_setSize; + this.isClicked = PopupWindow_isClicked; + this.autoHide = PopupWindow_autoHide; + this.hideIfNotClicked = PopupWindow_hideIfNotClicked; + } + +/* SOURCE FILE: CalendarPopup.js */ + +// HISTORY +// ------------------------------------------------------------------ +// Feb 7, 2005: Fixed a CSS styles to use px unit +// March 29, 2004: Added check in select() method for the form field +// being disabled. If it is, just return and don't do anything. +// March 24, 2004: Fixed bug - when month name and abbreviations were +// changed, date format still used original values. +// January 26, 2004: Added support for drop-down month and year +// navigation (Thanks to Chris Reid for the idea) +// September 22, 2003: Fixed a minor problem in YEAR calendar with +// CSS prefix. +// August 19, 2003: Renamed the function to get styles, and made it +// work correctly without an object reference +// August 18, 2003: Changed showYearNavigation and +// showYearNavigationInput to optionally take an argument of +// true or false +// July 31, 2003: Added text input option for year navigation. +// Added a per-calendar CSS prefix option to optionally use +// different styles for different calendars. +// July 29, 2003: Fixed bug causing the Today link to be clickable +// even though today falls in a disabled date range. +// Changed formatting to use pure CSS, allowing greater control +// over look-and-feel options. +// June 11, 2003: Fixed bug causing the Today link to be unselectable +// under certain cases when some days of week are disabled +// March 14, 2003: Added ability to disable individual dates or date +// ranges, display as light gray and strike-through +// March 14, 2003: Removed dependency on graypixel.gif and instead +/// use table border coloring +// March 12, 2003: Modified showCalendar() function to allow optional +// start-date parameter +// March 11, 2003: Modified select() function to allow optional +// start-date parameter +/* +DESCRIPTION: This object implements a popup calendar to allow the user to +select a date, month, quarter, or year. + +COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small +positioning errors - usually with Window positioning - occur on the +Macintosh platform. +The calendar can be modified to work for any location in the world by +changing which weekday is displayed as the first column, changing the month +names, and changing the column headers for each day. + +USAGE: +// Create a new CalendarPopup object of type WINDOW +var cal = new CalendarPopup(); + +// Create a new CalendarPopup object of type DIV using the DIV named 'mydiv' +var cal = new CalendarPopup('mydiv'); + +// Easy method to link the popup calendar with an input box. +cal.select(inputObject, anchorname, dateFormat); +// Same method, but passing a default date other than the field's current value +cal.select(inputObject, anchorname, dateFormat, '01/02/2000'); +// This is an example call to the popup calendar from a link to populate an +// input box. Note that to use this, date.js must also be included!! +Select + +// Set the type of date select to be used. By default it is 'date'. +cal.setDisplayType(type); + +// When a date, month, quarter, or year is clicked, a function is called and +// passed the details. You must write this function, and tell the calendar +// popup what the function name is. +// Function to be called for 'date' select receives y, m, d +cal.setReturnFunction(functionname); +// Function to be called for 'month' select receives y, m +cal.setReturnMonthFunction(functionname); +// Function to be called for 'quarter' select receives y, q +cal.setReturnQuarterFunction(functionname); +// Function to be called for 'year' select receives y +cal.setReturnYearFunction(functionname); + +// Show the calendar relative to a given anchor +cal.showCalendar(anchorname); + +// Hide the calendar. The calendar is set to autoHide automatically +cal.hideCalendar(); + +// Set the month names to be used. Default are English month names +cal.setMonthNames("January","February","March",...); + +// Set the month abbreviations to be used. Default are English month abbreviations +cal.setMonthAbbreviations("Jan","Feb","Mar",...); + +// Show navigation for changing by the year, not just one month at a time +cal.showYearNavigation(); + +// Show month and year dropdowns, for quicker selection of month of dates +cal.showNavigationDropdowns(); + +// Set the text to be used above each day column. The days start with +// sunday regardless of the value of WeekStartDay +cal.setDayHeaders("S","M","T",...); + +// Set the day for the first column in the calendar grid. By default this +// is Sunday (0) but it may be changed to fit the conventions of other +// countries. +cal.setWeekStartDay(1); // week is Monday - Sunday + +// Set the weekdays which should be disabled in the 'date' select popup. You can +// then allow someone to only select week end dates, or Tuedays, for example +cal.setDisabledWeekDays(0,1); // To disable selecting the 1st or 2nd days of the week + +// Selectively disable individual days or date ranges. Disabled days will not +// be clickable, and show as strike-through text on current browsers. +// Date format is any format recognized by parseDate() in date.js +// Pass a single date to disable: +cal.addDisabledDates("2003-01-01"); +// Pass null as the first parameter to mean "anything up to and including" the +// passed date: +cal.addDisabledDates(null, "01/02/03"); +// Pass null as the second parameter to mean "including the passed date and +// anything after it: +cal.addDisabledDates("Jan 01, 2003", null); +// Pass two dates to disable all dates inbetween and including the two +cal.addDisabledDates("January 01, 2003", "Dec 31, 2003"); + +// When the 'year' select is displayed, set the number of years back from the +// current year to start listing years. Default is 2. +// This is also used for year drop-down, to decide how many years +/- to display +cal.setYearSelectStartOffset(2); + +// Text for the word "Today" appearing on the calendar +cal.setTodayText("Hoje"); + +// The calendar uses CSS classes for formatting. If you want your calendar to +// have unique styles, you can set the prefix that will be added to all the +// classes in the output. +// For example, normal output may have this: +// Today +// But if you set the prefix like this: +cal.setCssPrefix("Test"); +// The output will then look like: +// Today +// And you can define that style somewhere in your page. + +// When using Year navigation, you can make the year be an input box, so +// the user can manually change it and jump to any year +cal.showYearNavigationInput(); + +// Set the calendar offset to be different than the default. By default it +// will appear just below and to the right of the anchorname. So if you have +// a text box where the date will go and and anchor immediately after the +// text box, the calendar will display immediately under the text box. +cal.offsetX = 20; +cal.offsetY = 20; + +NOTES: +1) Requires the functions in AnchorPosition.js and PopupWindow.js + +2) Your anchor tag MUST contain both NAME and ID attributes which are the + same. For example: + + +3) There must be at least a space between for IE5.5 to see the + anchor tag correctly. Do not do with no space. + +4) When a CalendarPopup object is created, a handler for 'onmouseup' is + attached to any event handler you may have already defined. Do NOT define + an event handler for 'onmouseup' after you define a CalendarPopup object + or the autoHide() will not work correctly. + +5) The calendar popup display uses style sheets to make it look nice. + +*/ + +// CONSTRUCTOR for the CalendarPopup Object +function CalendarPopup() { + var c; + if (arguments.length>0) { + c = new PopupWindow(arguments[0]); + } + else { + c = new PopupWindow(); + c.setSize(150,175); + } + c.offsetX = -152; + c.offsetY = 25; + c.autoHide(); + // Calendar-specific properties + c.monthNames = new Array("Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outobro","Novembro","Dezembro"); + c.monthAbbreviations = new Array("Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"); + c.dayHeaders = new Array("D","S","T","Q","Q","S","S"); + c.returnFunction = "CP_tmpReturnFunction"; + c.returnMonthFunction = "CP_tmpReturnMonthFunction"; + c.returnQuarterFunction = "CP_tmpReturnQuarterFunction"; + c.returnYearFunction = "CP_tmpReturnYearFunction"; + c.weekStartDay = 0; + c.isShowYearNavigation = false; + c.displayType = "date"; + c.disabledWeekDays = new Object(); + c.disabledDatesExpression = ""; + c.yearSelectStartOffset = 2; + c.currentDate = null; + c.todayText="Hoje"; + c.cssPrefix=""; + c.isShowNavigationDropdowns=false; + c.isShowYearNavigationInput=false; + window.CP_calendarObject = null; + window.CP_targetInput = null; + window.CP_dateFormat = "dd/MM/yyyy"; + // Method mappings + c.copyMonthNamesToWindow = CP_copyMonthNamesToWindow; + c.setReturnFunction = CP_setReturnFunction; + c.setReturnMonthFunction = CP_setReturnMonthFunction; + c.setReturnQuarterFunction = CP_setReturnQuarterFunction; + c.setReturnYearFunction = CP_setReturnYearFunction; + c.setMonthNames = CP_setMonthNames; + c.setMonthAbbreviations = CP_setMonthAbbreviations; + c.setDayHeaders = CP_setDayHeaders; + c.setWeekStartDay = CP_setWeekStartDay; + c.setDisplayType = CP_setDisplayType; + c.setDisabledWeekDays = CP_setDisabledWeekDays; + c.addDisabledDates = CP_addDisabledDates; + c.setYearSelectStartOffset = CP_setYearSelectStartOffset; + c.setTodayText = CP_setTodayText; + c.showYearNavigation = CP_showYearNavigation; + c.showCalendar = CP_showCalendar; + c.hideCalendar = CP_hideCalendar; + c.getStyles = getCalendarStyles; + c.refreshCalendar = CP_refreshCalendar; + c.getCalendar = CP_getCalendar; + c.select = CP_select; + c.setCssPrefix = CP_setCssPrefix; + c.showNavigationDropdowns = CP_showNavigationDropdowns; + c.showYearNavigationInput = CP_showYearNavigationInput; + c.copyMonthNamesToWindow(); + // Return the object + return c; + } +function CP_copyMonthNamesToWindow() { + // Copy these values over to the date.js + if (typeof(window.MONTH_NAMES)!="undefined" && window.MONTH_NAMES!=null) { + window.MONTH_NAMES = new Array(); + for (var i=0; i\n"; + result += '
\n'; + } + else { + result += '
\n'; + result += '
\n'; + result += '
\n'; + } + // Code for DATE display (default) + // ------------------------------- + if (this.displayType=="date" || this.displayType=="week-end") { + if (this.currentDate==null) { this.currentDate = now; } + if (arguments.length > 0) { var month = arguments[0]; } + else { var month = this.currentDate.getMonth()+1; } + if (arguments.length > 1 && arguments[1]>0 && arguments[1]-0==arguments[1]) { var year = arguments[1]; } + else { var year = this.currentDate.getFullYear(); } + var daysinmonth= new Array(0,31,28,31,30,31,30,31,31,30,31,30,31); + if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) { + daysinmonth[2] = 29; + } + var current_month = new Date(year,month-1,1); + var display_year = year; + var display_month = month; + var display_date = 1; + var weekday= current_month.getDay(); + var offset = 0; + + offset = (weekday >= this.weekStartDay) ? weekday-this.weekStartDay : 7-this.weekStartDay+weekday ; + if (offset > 0) { + display_month--; + if (display_month < 1) { display_month = 12; display_year--; } + display_date = daysinmonth[display_month]-offset+1; + } + var next_month = month+1; + var next_month_year = year; + if (next_month > 12) { next_month=1; next_month_year++; } + var last_month = month-1; + var last_month_year = year; + if (last_month < 1) { last_month=12; last_month_year--; } + var date_class; + if (this.type!="WINDOW") { + result += ""; + } + result += '\n'; + var refresh = windowref+'CP_refreshCalendar'; + var refreshLink = 'javascript:' + refresh; + if (this.isShowNavigationDropdowns) { + result += ''; + result += ''; + + result += ''; + } + else { + if (this.isShowYearNavigation) { + result += ''; + result += ''; + result += ''; + result += ''; + + result += ''; + if (this.isShowYearNavigationInput) { + result += ''; + } + else { + result += ''; + } + result += ''; + } + else { + result += '\n'; + result += '\n'; + result += '\n'; + } + } + result += '
 <'+this.monthNames[month-1]+'> <'+year+'><<'+this.monthNames[month-1]+' '+year+'>>
\n'; + result += '\n'; + result += '\n'; + for (var j=0; j<7; j++) { + + result += '\n'; + } + result += '\n'; + for (var row=1; row<=6; row++) { + result += '\n'; + for (var col=1; col<=7; col++) { + var disabled=false; + if (this.disabledDatesExpression!="") { + var ds=""+display_year+LZ(display_month)+LZ(display_date); + eval("disabled=("+this.disabledDatesExpression+")"); + } + var dateClass = ""; + if ((display_month == this.currentDate.getMonth()+1) && (display_date==this.currentDate.getDate()) && (display_year==this.currentDate.getFullYear())) { + dateClass = "cpCurrentDate"; + } + else if (display_month == month) { + dateClass = "cpCurrentMonthDate"; + } + else { + dateClass = "cpOtherMonthDate"; + } + if (disabled || this.disabledWeekDays[col-1]) { + result += ' \n'; + } + else { + var selected_date = display_date; + var selected_month = display_month; + var selected_year = display_year; + if (this.displayType=="week-end") { + var d = new Date(selected_year,selected_month-1,selected_date,0,0,0,0); + d.setDate(d.getDate() + (7-col)); + selected_year = d.getYear(); + if (selected_year < 1000) { selected_year += 1900; } + selected_month = d.getMonth()+1; + selected_date = d.getDate(); + } + result += ' \n'; + } + display_date++; + if (display_date > daysinmonth[display_month]) { + display_date=1; + display_month++; + } + if (display_month > 12) { + display_month=1; + display_year++; + } + } + result += ''; + } + var current_weekday = now.getDay() - this.weekStartDay; + if (current_weekday < 0) { + current_weekday += 7; + } + result += '\n'; + result += '
'+this.dayHeaders[(this.weekStartDay+j)%7]+'
'+display_date+''+display_date+'
\n'; + if (this.disabledDatesExpression!="") { + var ds=""+now.getFullYear()+LZ(now.getMonth()+1)+LZ(now.getDate()); + eval("disabled=("+this.disabledDatesExpression+")"); + } + if (disabled || this.disabledWeekDays[current_weekday+1]) { + result += ' '+this.todayText+'\n'; + } + else { + result += ' '+this.todayText+'\n'; + } + result += '
\n'; + result += '
\n'; + } + + // Code common for MONTH, QUARTER, YEAR + // ------------------------------------ + if (this.displayType=="month" || this.displayType=="quarter" || this.displayType=="year") { + if (arguments.length > 0) { var year = arguments[0]; } + else { + if (this.displayType=="year") { var year = now.getFullYear()-this.yearSelectStartOffset; } + else { var year = now.getFullYear(); } + } + if (this.displayType!="year" && this.isShowYearNavigation) { + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += ' \n'; + result += '
<<'+year+'>>
\n'; + } + } + + // Code for MONTH display + // ---------------------- + if (this.displayType=="month") { + // If POPUP, write entire HTML document + result += '\n'; + for (var i=0; i<4; i++) { + result += ''; + for (var j=0; j<3; j++) { + var monthindex = ((i*3)+j); + result += ''; + } + result += ''; + } + result += '
'+this.monthAbbreviations[monthindex]+'
\n'; + } + + // Code for QUARTER display + // ------------------------ + if (this.displayType=="quarter") { + result += '
\n'; + for (var i=0; i<2; i++) { + result += ''; + for (var j=0; j<2; j++) { + var quarter = ((i*2)+j+1); + result += ''; + } + result += ''; + } + result += '

Q'+quarter+'

\n'; + } + + // Code for YEAR display + // --------------------- + if (this.displayType=="year") { + var yearColumnSize = 4; + result += ""; + result += '\n'; + result += ' \n'; + result += ' \n'; + result += '
<<>>
\n'; + result += '\n'; + for (var i=0; i'+currentyear+''; + } + result += ''; + } + result += '
\n'; + } + // Common + if (this.type == "WINDOW") { + result += "\n"; + } + return result; + } diff --git a/tags/teg/web/src/html/marcacao/marcacao.html b/tags/teg/web/src/html/marcacao/marcacao.html new file mode 100644 index 00000000..0418a3c1 --- /dev/null +++ b/tags/teg/web/src/html/marcacao/marcacao.html @@ -0,0 +1,14 @@ + + + + + +Empresa: $empresa
+Estabelecimento: $estabelecimento
+Funcionário: $funcionario
+
+Pedido de marcação de $marcacao_tipo + data(s): $data#if( $marcacao_tipo == 'Consulta' ) + Horário: $hora#end.
+ + diff --git a/tags/teg/web/src/html/marcacao/marcacao_consulta.html b/tags/teg/web/src/html/marcacao/marcacao_consulta.html new file mode 100644 index 00000000..96d6b4ea --- /dev/null +++ b/tags/teg/web/src/html/marcacao/marcacao_consulta.html @@ -0,0 +1,49 @@ + + + + + Marcação de consulta + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ Marcação de Consulta para:
+ $funcionario +
Data(s)*:
Horário:
+ Nota: a marcação está sujeita a confirmação via email.
+ * - campo de preenchimento obrigatório +
+ +
+
+ + diff --git a/tags/teg/web/src/html/marcacao/marcacao_enviada.html b/tags/teg/web/src/html/marcacao/marcacao_enviada.html new file mode 100644 index 00000000..481963aa --- /dev/null +++ b/tags/teg/web/src/html/marcacao/marcacao_enviada.html @@ -0,0 +1,11 @@ + + + + + Marcação de consulta / exame + + + + O pedido de marcação foi enviado com sucesso. + + diff --git a/tags/teg/web/src/html/marcacao/marcacao_exame.html b/tags/teg/web/src/html/marcacao/marcacao_exame.html new file mode 100644 index 00000000..3bcddc85 --- /dev/null +++ b/tags/teg/web/src/html/marcacao/marcacao_exame.html @@ -0,0 +1,43 @@ + + + + + Marcação de exames + + + + + +
+ + + + + + + + + + + + + + +
+ Marcação de Exames para:
+ $funcionario +
Data(s)*:
+ Nota: a marcação está sujeita a confirmação via email.
+ * - campo de preenchimento obrigatório +
+ +
+
+ + diff --git a/tags/teg/web/src/html/marcacao/marcacao_menu.html b/tags/teg/web/src/html/marcacao/marcacao_menu.html new file mode 100644 index 00000000..0c605749 --- /dev/null +++ b/tags/teg/web/src/html/marcacao/marcacao_menu.html @@ -0,0 +1,62 @@ + + + + + Marcação de consulta / exame + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ Marcação para:
+ $funcionario +
+ Consulta + Exame +
Data:dd/mm/aaaa
Hora:hh:mm
+ Nota: a marcação está sujeita a confirmação via email. +
+ +
+
+ + diff --git a/tags/teg/web/src/html/marcacao/marcacao_nao_enviada.html b/tags/teg/web/src/html/marcacao/marcacao_nao_enviada.html new file mode 100644 index 00000000..5621b521 --- /dev/null +++ b/tags/teg/web/src/html/marcacao/marcacao_nao_enviada.html @@ -0,0 +1,11 @@ + + + + + Marcação de consulta / exame + + + + Ocorreu um erro a enviar o pedido de marcação. + + diff --git a/tags/teg/web/src/html/marcacao/marcacao_sessao_expirou.html b/tags/teg/web/src/html/marcacao/marcacao_sessao_expirou.html new file mode 100644 index 00000000..3a84b5fc --- /dev/null +++ b/tags/teg/web/src/html/marcacao/marcacao_sessao_expirou.html @@ -0,0 +1,11 @@ + + + + + Sessão expirou + + + + A sua sessão expirou. Para efectuar uma marcação, autentique-se novamente. + + diff --git a/tags/teg/web/src/html/medicina.html b/tags/teg/web/src/html/medicina.html new file mode 100644 index 00000000..d52815fb --- /dev/null +++ b/tags/teg/web/src/html/medicina.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Medicina + + + + + + + + + + + + + + + +
   +medicina do trabalho
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/noticias/mostrar_noticias.html b/tags/teg/web/src/html/noticias/mostrar_noticias.html new file mode 100644 index 00000000..ddea30a6 --- /dev/null +++ b/tags/teg/web/src/html/noticias/mostrar_noticias.html @@ -0,0 +1,11 @@ + + + + + Notícias + + + + $noticias + + diff --git a/tags/teg/web/src/html/politica.html b/tags/teg/web/src/html/politica.html new file mode 100644 index 00000000..3713c26b --- /dev/null +++ b/tags/teg/web/src/html/politica.html @@ -0,0 +1,52 @@ + + + + + SIPRP + + + + + + + + + + + + + + + +
   +política de qualidade e apoio administrativo
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/relatorio/pedido.html b/tags/teg/web/src/html/relatorio/pedido.html new file mode 100644 index 00000000..427733c2 --- /dev/null +++ b/tags/teg/web/src/html/relatorio/pedido.html @@ -0,0 +1,9 @@ + + + + +Empresa: $empresa
+
+Pedido de envio de relatório do ano: $ano
+ + diff --git a/tags/teg/web/src/html/relatorio/pedido_enviado.html b/tags/teg/web/src/html/relatorio/pedido_enviado.html new file mode 100644 index 00000000..9b530aa6 --- /dev/null +++ b/tags/teg/web/src/html/relatorio/pedido_enviado.html @@ -0,0 +1,11 @@ + + + + + Envio de dados do relatório anual + + + + O pedido foi enviado com sucesso. + + diff --git a/tags/teg/web/src/html/relatorio/pedido_nao_enviado.html b/tags/teg/web/src/html/relatorio/pedido_nao_enviado.html new file mode 100644 index 00000000..196da035 --- /dev/null +++ b/tags/teg/web/src/html/relatorio/pedido_nao_enviado.html @@ -0,0 +1,11 @@ + + + + + Envio de dados do relatório anual + + + + Ocorreu um erro a enviar o pedido. + + diff --git a/tags/teg/web/src/html/relatorio/pedido_relatorio.html b/tags/teg/web/src/html/relatorio/pedido_relatorio.html new file mode 100644 index 00000000..5dd5bf9f --- /dev/null +++ b/tags/teg/web/src/html/relatorio/pedido_relatorio.html @@ -0,0 +1,35 @@ + + + + + Pedido de dados do relatório anual + + + + + +
+ + + + + + + + + + +
+ Pedido de dados do relatório anual +
Ano pretendido:
+ +
+
+ + diff --git a/tags/teg/web/src/html/relatorio/pedido_sessao_expirou.html b/tags/teg/web/src/html/relatorio/pedido_sessao_expirou.html new file mode 100644 index 00000000..0311eda3 --- /dev/null +++ b/tags/teg/web/src/html/relatorio/pedido_sessao_expirou.html @@ -0,0 +1,11 @@ + + + + + Sessão expirou + + + + A sua sessão expirou. Para efectuar o pedido, autentique-se novamente. + + diff --git a/tags/teg/web/src/html/servicos.html b/tags/teg/web/src/html/servicos.html new file mode 100644 index 00000000..f4585f4f --- /dev/null +++ b/tags/teg/web/src/html/servicos.html @@ -0,0 +1,31 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + +

+
-Serviços +Complementares
+ -Medicina do +Trabalho
+ -Política de +Qualidade e Apoio Administrativo
+ -Higiene e +Segurança
+ + diff --git a/tags/teg/web/src/html/servicos_compl.html b/tags/teg/web/src/html/servicos_compl.html new file mode 100644 index 00000000..163977df --- /dev/null +++ b/tags/teg/web/src/html/servicos_compl.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Serviços + + + + + + + + + + + + + + + +
   +serviços complementares
+
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/siprp.html b/tags/teg/web/src/html/siprp.html new file mode 100644 index 00000000..37d5babe --- /dev/null +++ b/tags/teg/web/src/html/siprp.html @@ -0,0 +1,52 @@ + + + + + SIPRP - Apresentação + + + + + + + + + + + + + + + +
   +a +siprp
+ + + + + + + + + + +

+

+

+

+

+
+

+
+ + diff --git a/tags/teg/web/src/html/user.html b/tags/teg/web/src/html/user.html new file mode 100644 index 00000000..b3d8a59f --- /dev/null +++ b/tags/teg/web/src/html/user.html @@ -0,0 +1,396 @@ + + + + + SIPRP + + + + + + + + + + + + + +

+ + + + + + + + + + #if( $userRole != "manager" ) + + + #end + + + +
   $userName    pedido de relatório anual...logout »   
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + #if( $query == "empresas" ) + #set( $listaTitle = "empresas" ) + #elseif( $query == "estabelecimentos" ) + #set( $listaTitle = "estabelecimentos" ) + #elseif( $query == "trabalhadores" || $query == "trabalhadores_tudo" || $query == "trabalhadores_pendentes" ) + #set( $listaTitle = "funcionários:" ) + #set( $lista_funcionarios = 1 ) + #else ##( $query == "trabalhador" ) + #set( $listaTitle = "funcionário" ) + #end + + + #if( $lista_funcionarios ) + + + + #end + + + + + + + + + + + + + + +
   acesso restrito
+ + + + + + + + + + + + + + +
+ #if( $userRole == "manager" && $empresa_nome ) + Empresa: $!empresa_nome + #else + Empresa: $!empresa_nome + #end +
+ #if( $estabelecimento_id ) + Estabelecimento: $!estabelecimento_nome + #else + Estabelecimento: + #end +
+ #if( $query == "trabalhador" ) + Funcionário: $!funcionario.nome  - Data de Nascimento: $!funcionario.data_nascimento + #else + Funcionário: + #end + + #if( $query == "trabalhador" ) + + #end +
+ +
+
+ + + + + + + + +
   funcionários:   todos   com ficha de aptidão   com pendências         imprimir
+ #else +
   $listaTitle
+ #if ($query == "trabalhador") + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + + + + + + + + + + + + + + +
Último ECD(*)RealizadoÚltima ConsultaRealizadaResultadoPróximo ECD(*)Próxima Consulta
$!funcionario.ultimo_exame $!funcionario.realizado $!funcionario.ultima_consulta $!funcionario.realizada $!funcionario.resultado $!funcionario.proximo_exame $!funcionario.proxima_consulta 
+ #elseif( $query == "trabalhadores" ) + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + + #end +
  NomeÚltimo ECD(*)Última consultaPróxima consulta
$dados_trabalhador.Nome $dados_trabalhador.ultimo_exame $dados_trabalhador.ultima_consulta $dados_trabalhador.proxima_consulta 
+ #elseif( $query == "trabalhadores_tudo" ) + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + #end +
  NomeData da Ficha de Aptidão
  $dados_trabalhador.Nome$dados_trabalhador.Data  
+ #elseif( $query == "trabalhadores_pendentes" ) + - pendente    + - marcado    + - tratado
+ (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + #end +
  NomeECD(*)Consulta
  $dados_trabalhador.Nome
+ #else + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + $v2.get($counter)
+ #end + #end +
+
+
+ + diff --git a/tags/teg/web/src/html/user_print.html b/tags/teg/web/src/html/user_print.html new file mode 100644 index 00000000..821ac555 --- /dev/null +++ b/tags/teg/web/src/html/user_print.html @@ -0,0 +1,284 @@ + + + + + SIPRP + + + + + + + + + + + +

+ + + + + + +
+ +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + #if( $query == "trabalhadores" ) + #set( $listaTitle = "Todos os Funcionários" ) + #elseif( $query == "trabalhadores_tudo" ) + #set( $listaTitle = "Funcionários com Tudo Resolvido" ) + #elseif( $query == "trabalhadores_pendentes" ) + #set( $listaTitle = "Funcionários com Pendências" ) + #end + + + + + + + + + + + + +
   
+ + + + + + + + + + +
+ Empresa: $!empresa_nome +
+ Estabelecimento: $!estabelecimento_nome +
+ +
+
   $listaTitle
+ #if( $query == "trabalhadores" ) + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + + #end +
  NomeÚltimo ECD(*)Última consultaPróxima consulta
$dados_trabalhador.Nome $dados_trabalhador.ultimo_exame $dados_trabalhador.ultima_consulta $dados_trabalhador.proxima_consulta 
+ + #elseif( $query == "trabalhadores_tudo" ) + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + #end +
  NomeData da Ficha de Aptidão
  $dados_trabalhador.Nome$dados_trabalhador.Data  
+ #elseif( $query == "trabalhadores_pendentes" ) + + (*)ECD - Exames Complementares de Diagnóstico

+ + + + + + + #foreach( $element in $v1 ) + #set ( $counter = $velocityCount - 1 ) + #set ( $dados_trabalhador = $v2.get($counter) ) + + + + + + + #end +
  NomeECD(*)Consulta
  $dados_trabalhador.Nome$dados_trabalhador.Exame_estado$dados_trabalhador.Consulta_estado
+ #end +
+
+
+ + diff --git a/tags/teg/web/src/missing b/tags/teg/web/src/missing new file mode 100644 index 00000000..efd71a22 --- /dev/null +++ b/tags/teg/web/src/missing @@ -0,0 +1,4 @@ +/trunk/html/images/ +/trunk/html/html/conteudos/Images/ +/trunk/html/html/images/ +/trunk/html/conteudos/Images/