├── workflow
└── scripts
│ ├── SV-SolicitaçãoDeViagem.intermediateconditional149.js
│ ├── CTe.beforeTaskSave.js
│ ├── SOL-TI.onNotify.js
│ ├── SMD.beforeTaskSave.js
│ ├── SOL-TI.beforeTaskSave.js
│ ├── CTe.getTipoPedido.js
│ ├── RDV.aprovDir.js
│ ├── LNF.afterTaskCreate.js
│ ├── SSM.beforeTaskSave.js
│ ├── SV-SolicitaçãoDeViagem.afterTaskCreate.js
│ ├── Sub-RNC.afterTaskCreate.js
│ ├── SNF.beforeTaskSave.js
│ ├── SSM.afterTaskCreate.js
│ ├── CTe.afterTaskComplete.js
│ ├── IRSC.afterStateEntry.js
│ ├── SOL-TI.afterTaskCreate.js
│ ├── SMC - Solicitação de melhoria continua.afterStateEntry.js
│ ├── SAC - 0800.afterStateEntry.js
│ ├── FP-FichaDePendencia.afterStateEntry.js
│ ├── SV-SolicitaçãoDeViagem.beforeStateEntry.js
│ ├── RDV.afterStateEntry.js
│ ├── FP-FichaDePendencia.intermediateconditional9.js
│ ├── SMC - Solicitação de melhoria continua.intermediateconditional14.js
│ ├── RNC.intermediateconditional10.js
│ ├── RNC.intermediateconditional16.js
│ ├── CTe.beforeStateLeave.js
│ ├── RNC.beforeCancelProcess.js
│ ├── RDV.beforeTaskSave.js
│ └── RNC.afterStateEntry.js
├── forms
├── 298 - RNC - Formulario de Não Conformidadde
│ ├── espinhapeixe.jpg
│ └── events
│ │ └── displayFields.js
├── 169 - 0800 - Cadastro de Servicos
│ ├── events
│ │ ├── validateform.js
│ │ └── displayFields.js
│ └── cadastro_de_servicos.html
├── 171 - 0800 - Cadastro de Origens
│ ├── events
│ │ ├── validateform.js
│ │ └── displayFields.js
│ └── cadastro_de_origens.html
├── 20 - ti - classificacaodechamados
│ ├── events
│ │ ├── validateform.js
│ │ └── displayfields.js
│ └── classe_de_chamados.html
├── 26 - ti - criticidadedechamados
│ ├── events
│ │ ├── validateform.js
│ │ └── displayfields.js
│ └── criticidade_de_chamados.html
├── 166 - 0800 - Cadastro de Produtos
│ ├── events
│ │ ├── validateForm.js
│ │ └── displayFields.js
│ └── cadastro_de_produtos.html
├── 173 - 0800 - Cadastro de Unidade de Negocio
│ ├── events
│ │ ├── validateform.js
│ │ └── displayFields.js
│ └── cadastro_de_uni_negocio.html
├── 1184 - IR - Informe de reclamação _ Sugestão do Cliente
│ ├── IRSC-informe_de_reclamacao.html
│ └── events
│ │ └── displayFields.js
├── 297 - RNC - Sub Atividades da RNC
│ ├── events
│ │ └── displayFields.js
│ └── Formulario_de_Atividades_RNC.js
├── 176 - SAC - Formulario de Registro 0800
│ └── events
│ │ └── displayFields.js
├── 2239 - RIDV - Relatório Individual de Despesas de Viagem
│ └── events
│ │ ├── displayFields.js
│ │ └── validateForm.js
├── 1386 - FP - Ficha de Pendencia
│ └── events
│ │ └── displayFields.js
├── 1387 - FP - Ficha de Pendencia - Subfluxo
│ ├── events
│ │ └── displayFields.js
│ ├── FP-subfluxo.js
│ └── FP-subfluxo.html
├── 1650 - SMC - Solicitação de Melhoria Continua
│ └── events
│ │ └── displayFields.js
├── 10894 - CTe - Conhecimento de Frete
│ └── events
│ │ └── displayFields.js
├── 1683 - SV - Solicitação de Viagem
│ └── events
│ │ └── displayFields.js
├── 20797 - SNF - Solicitação de Nota Fiscal
│ └── events
│ │ └── displayFields.js
├── 28562 - CLT - Check List Para Transporte
│ └── events
│ │ └── displayFields.js
├── 32734 - LNF - Lançamento de Notas Fiscais
│ └── events
│ │ ├── displayFields.js
│ │ └── validateForm.js
├── 15160 - SMD - Solicitação de Material Direto
│ └── events
│ │ ├── displayFields.js
│ │ └── validateForm.js
├── 17583 - SSM - Solicitação de Serviço de Manutenção
│ └── events
│ │ └── displayFields.js
├── 14 - TI - Formulario de registro de atendimento na TI
│ └── events
│ │ ├── displayFields.js
│ │ └── validateForm.js
├── 22 - ti - tipodechamados
│ └── events
│ │ └── displayfields.js
├── 1645 - SMC - Cadastro de Ganhos
│ └── tipos_ganhos.html
└── 1648 - SMC - Cadastro de Origens
│ └── cadastro_de_origens.html
├── .gitignore
├── mechanisms
├── papeis0800.js
├── AprovImedExecAtual.js
├── AprovCampoMatricula_User.js
└── AprovadorImediato.js
├── .settings
├── .jsdtscope
└── org.eclipse.core.resources.prefs
├── .project
├── datasets
├── TSSConsultaDocumento.js
├── consultaCEP.js
├── bancosWebservice.js
├── classificacaodechamados.js
├── cadastro_ganhos_smc.js
├── cadastro_origens_smc.js
├── cadastro_origens.js
├── cadastro_produtos.js
├── unidades_de_negocio.js
├── criticidade.js
├── ncmIBPT.js
├── cadastro_servicos.js
├── mod_falha.js
├── aprovadores.js
├── TOTVSCentroDeCusto.js
├── TOTVSFamilias.js
├── TOTVSCidadeEstado.js
├── TOTVSEmbalagem.js
├── TOTVSColaboradores.js
├── tipodechamado.js
├── TOTVSclassFiscal.js
├── TSSConsultaContribuinte.js
├── TOTVSStatusColaborador.js
├── TOTVSPedidosCliente.js
├── TOTVSRepresentantes.js
├── TOTVSNaturOper.js
├── TOTVSAniversariantes.js
└── TOTVSTransportador.js
└── exemplo_dataset_direto_banco_ecm.js
/workflow/scripts/SV-SolicitaçãoDeViagem.intermediateconditional149.js:
--------------------------------------------------------------------------------
1 | function intermediateconditional149() {
2 | return true;
3 |
4 | }
--------------------------------------------------------------------------------
/forms/298 - RNC - Formulario de Não Conformidadde/espinhapeixe.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rbaselio/Fluig---ECM/HEAD/forms/298 - RNC - Formulario de Não Conformidadde/espinhapeixe.jpg
--------------------------------------------------------------------------------
/forms/169 - 0800 - Cadastro de Servicos/events/validateform.js:
--------------------------------------------------------------------------------
1 | function validateForm(form){
2 | if(form.getFormMode() == "ADD"){
3 | throw "Não é posivel gerar novas fichas desse formulário."
4 | }
5 | }
--------------------------------------------------------------------------------
/forms/171 - 0800 - Cadastro de Origens/events/validateform.js:
--------------------------------------------------------------------------------
1 | function validateForm(form){
2 | if(form.getFormMode() == "ADD"){
3 | throw "Não é posivel gerar novas fichas desse formulário."
4 | }
5 | }
--------------------------------------------------------------------------------
/forms/20 - ti - classificacaodechamados/events/validateform.js:
--------------------------------------------------------------------------------
1 | function validateForm(form){
2 | if(form.getFormMode() == "ADD"){
3 | throw "Não é posivel gerar novas fichas desse formulário."
4 | }
5 | }
--------------------------------------------------------------------------------
/forms/26 - ti - criticidadedechamados/events/validateform.js:
--------------------------------------------------------------------------------
1 | function validateForm(form){
2 | if(form.getFormMode() == "ADD"){
3 | throw "Não é posivel gerar novas fichas desse formulário."
4 | }
5 | }
--------------------------------------------------------------------------------
/forms/166 - 0800 - Cadastro de Produtos/events/validateForm.js:
--------------------------------------------------------------------------------
1 | function validateForm(form) {
2 |
3 | if (form.getFormMode() == "ADD") {
4 | throw "Não é posivel gerar novas fichas desse formulário."
5 | }
6 |
7 | }
--------------------------------------------------------------------------------
/forms/173 - 0800 - Cadastro de Unidade de Negocio/events/validateform.js:
--------------------------------------------------------------------------------
1 | function validateForm(form) {
2 | if (form.getFormMode() == "ADD") {
3 | throw "Não é posivel gerar novas fichas desse formulário."
4 | }
5 | }
--------------------------------------------------------------------------------
/forms/1184 - IR - Informe de reclamação _ Sugestão do Cliente/IRSC-informe_de_reclamacao.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rbaselio/Fluig---ECM/HEAD/forms/1184 - IR - Informe de reclamação _ Sugestão do Cliente/IRSC-informe_de_reclamacao.html
--------------------------------------------------------------------------------
/workflow/scripts/CTe.beforeTaskSave.js:
--------------------------------------------------------------------------------
1 | function beforeTaskSave(colleagueId, nextSequenceId, userList) {
2 | if (hAPI.listAttachments().size() < 2) {
3 | throw " É necessario incluir os arquivos XML e PDF!";
4 | }
5 |
6 | }
--------------------------------------------------------------------------------
/workflow/scripts/SOL-TI.onNotify.js:
--------------------------------------------------------------------------------
1 | function onNotify(subject, receivers, template, params) {
2 |
3 | if (template.match("TPLNEW_TASK") != null) {
4 | params.put("WDK_TaskComments", new String(hAPI.getCardValue("desc_chamado")).replace(new RegExp("\r?\n", "g"), "
"));
5 | }
6 |
7 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | desktop.ini
2 | .resources
3 | .resources/
4 | .metadata
5 | .classpath
6 | .project
7 | .settings/
8 | target/
9 | *.class
10 | *.iml
11 | .idea/
12 | bin/
13 | .metadata/
14 | bower_components/
15 | node_modules/
16 | .metadata
17 | *.versionsBackup
18 | *.log
19 | tokens.js
20 |
21 |
--------------------------------------------------------------------------------
/forms/297 - RNC - Sub Atividades da RNC/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 | form.setHidePrintLink(false);
4 |
5 | customHTML.append("");
8 |
9 | }
--------------------------------------------------------------------------------
/workflow/scripts/SMD.beforeTaskSave.js:
--------------------------------------------------------------------------------
1 | function beforeTaskSave(colleagueId,nextSequenceId,userList){
2 |
3 | hAPI.setCardValue('num_processo', getValue("WKNumProces"));
4 |
5 | if (nextSequenceId = 52){
6 | if (hAPI.listAttachments().size() < 1) {
7 | throw "
ATENÇÃO:
É obrigatorio a inclusão de uma cotação inicial
.";
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/forms/176 - SAC - Formulario de Registro 0800/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 | customHTML.append("");
7 |
8 | }
--------------------------------------------------------------------------------
/forms/2239 - RIDV - Relatório Individual de Despesas de Viagem/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
8 |
9 | }
--------------------------------------------------------------------------------
/forms/1386 - FP - Ficha de Pendencia/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
8 |
9 | }
--------------------------------------------------------------------------------
/mechanisms/papeis0800.js:
--------------------------------------------------------------------------------
1 | function resolve(process,colleague){
2 |
3 | var userList = new java.util.ArrayList();
4 |
5 | userList.add('Pool:Role:ATE-MTG-Inc');
6 | userList.add('Pool:Role:ATE-MTG-Corte');
7 | userList.add('Pool:Role:ATE-MTG-Armaz');
8 | userList.add('Pool:Role:lpa');
9 | userList.add('Pool:Role:la');
10 | userList.add('Pool:Role:ep');
11 | userList.add('Pool:Role:SGQ');
12 |
13 | return userList;
14 |
15 | }
--------------------------------------------------------------------------------
/forms/298 - RNC - Formulario de Não Conformidadde/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 | //form.setHidePrintLink(false);
4 |
5 | customHTML.append("");
8 |
9 | }
--------------------------------------------------------------------------------
/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
ATENÇÃO:
É obrigatorio incluir um print, video ou relatorio evidenciando o problema
.";
8 | }
9 | }*/
10 |
11 |
12 |
13 | }
--------------------------------------------------------------------------------
/workflow/scripts/CTe.getTipoPedido.js:
--------------------------------------------------------------------------------
1 | function getTipoPedido(){
2 |
3 | log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>teste");
4 |
5 | var cardData = new java.util.HashMap();
6 | cardData = hAPI.getCardData(getValue("WKNumProces"));
7 | var keys = cardData.keySet().toArray();
8 | for ( var key in keys) {
9 | var field = keys[key];
10 | if (field.indexOf("tipoPedido___") > -1) {
11 | log.warn(hAPI.getCardValue(field));
12 | return hAPI.getCardValue(field)
13 | }
14 | }
15 | return "";
16 | }
--------------------------------------------------------------------------------
/forms/10894 - CTe - Conhecimento de Frete/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/forms/1683 - SV - Solicitação de Viagem/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/forms/20797 - SNF - Solicitação de Nota Fiscal/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/forms/28562 - CLT - Check List Para Transporte/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/forms/32734 - LNF - Lançamento de Notas Fiscais/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/forms/15160 - SMD - Solicitação de Material Direto/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/forms/17583 - SSM - Solicitação de Serviço de Manutenção/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/mechanisms/AprovImedExecAtual.js:
--------------------------------------------------------------------------------
1 | function resolve(process,colleague){
2 |
3 | var user = colleague.colleaguePK.colleagueId;
4 | var userList = new java.util.ArrayList();
5 | userList.add(null);
6 |
7 | var c1 = DatasetFactory.createConstraint("USER_CODE", user, user, ConstraintType.MUST);
8 | var constraints = new Array(c1);
9 | var dataset = DatasetFactory.getDataset("aprovadores", null, constraints, null);
10 |
11 | for(var i = 0; i < dataset.rowsCount; i++) {
12 | userList.add(dataset.getValue(i, "DATA_VALUE"));
13 | }
14 | return userList;
15 | }
--------------------------------------------------------------------------------
/forms/14 - TI - Formulario de registro de atendimento na TI/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 | form.setShowDisabledFields(true);
3 |
4 |
5 | customHTML.append("");
13 |
14 | }
--------------------------------------------------------------------------------
/workflow/scripts/RDV.aprovDir.js:
--------------------------------------------------------------------------------
1 | function aprovDir(){
2 |
3 | var limite = 1500;
4 |
5 | var vl_adiant = parseFloat(hAPI.getCardValue("vl_prestacao").replace(".","").replace(",","."));
6 | if (isNaN(vl_adiant)) vl_adiant = 0;
7 | var tot_desp = parseFloat(hAPI.getCardValue("vl_tot_geral").replace(".","").replace(",","."));
8 | if (isNaN(tot_desp)) tot_desp = 0;
9 |
10 | if (vl_adiant >= limite || tot_desp >= limite) return "1";
11 |
12 | hAPI.setCardValue("desc_aprov_dir_fin", "Aprovação não necessária para movimentações no referido valor");
13 | return "0"
14 |
15 | }
--------------------------------------------------------------------------------
/forms/22 - ti - tipodechamados/events/displayfields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form,customHTML){
2 | form.setShowDisabledFields(true);
3 | form.setHidePrintLink(false);
4 |
5 | if(form.getFormMode() == "MOD"){
6 | var filter = new java.util.HashMap();
7 | filter.put("colleaguePK.colleagueId",getValue("WKUser"));
8 | var colaborador = getDatasetValues('colleague',filter).get(0).get("colleagueName");
9 |
10 | var dtNow = new java.util.Date();
11 | var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
12 | var today = sdf.format(dtNow);
13 |
14 | form.setValue('usuario', colaborador);
15 | form.setValue('data_mod', today);
16 | }
17 | }
--------------------------------------------------------------------------------
/forms/20 - ti - classificacaodechamados/events/displayfields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form,customHTML){
2 | form.setShowDisabledFields(true);
3 | form.setHidePrintLink(false);
4 |
5 | if(form.getFormMode() == "MOD"){
6 | var filter = new java.util.HashMap();
7 | filter.put("colleaguePK.colleagueId",getValue("WKUser"));
8 | var colaborador = getDatasetValues('colleague',filter).get(0).get("colleagueName");
9 |
10 | var dtNow = new java.util.Date();
11 | var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
12 | var today = sdf.format(dtNow);
13 |
14 | form.setValue('usuario', colaborador);
15 | form.setValue('data_mod', today);
16 | }
17 | }
--------------------------------------------------------------------------------
/forms/26 - ti - criticidadedechamados/events/displayfields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form,customHTML){
2 | form.setShowDisabledFields(true);
3 | form.setHidePrintLink(false);
4 |
5 | if(form.getFormMode() == "MOD"){
6 | var filter = new java.util.HashMap();
7 | filter.put("colleaguePK.colleagueId",getValue("WKUser"));
8 | var colaborador = getDatasetValues('colleague',filter).get(0).get("colleagueName");
9 |
10 | var dtNow = new java.util.Date();
11 | var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
12 | var today = sdf.format(dtNow);
13 |
14 | form.setValue('usuario', colaborador);
15 | form.setValue('data_mod', today);
16 | }
17 | }
--------------------------------------------------------------------------------
/forms/166 - 0800 - Cadastro de Produtos/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form, customHTML) {
2 |
3 | form.setShowDisabledFields(true);
4 | form.setHidePrintLink(true);
5 |
6 | if (form.getFormMode() == "MOD") {
7 | var filter = new java.util.HashMap();
8 | filter.put("colleaguePK.colleagueId", getValue("WKUser"));
9 | var colaborador = getDatasetValues('colleague', filter).get(0).get(
10 | "colleagueName");
11 |
12 | var dtNow = new java.util.Date();
13 | var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
14 | var today = sdf.format(dtNow);
15 |
16 | form.setValue('user', colaborador);
17 | form.setValue('data_mod', today);
18 | }
19 | }
--------------------------------------------------------------------------------
/forms/169 - 0800 - Cadastro de Servicos/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form,customHTML){
2 | form.setShowDisabledFields(true);
3 | form.setHidePrintLink(false);
4 |
5 | if(form.getFormMode() == "MOD" || form.getFormMode() == "ADD"){
6 | var filter = new java.util.HashMap();
7 | filter.put("colleaguePK.colleagueId",getValue("WKUser"));
8 | var colaborador = getDatasetValues('colleague',filter).get(0).get("colleagueName");
9 |
10 | var dtNow = new java.util.Date();
11 | var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
12 | var today = sdf.format(dtNow);
13 |
14 | form.setValue('user', colaborador);
15 | form.setValue('data_mod', today);
16 | }
17 | }
--------------------------------------------------------------------------------
/forms/171 - 0800 - Cadastro de Origens/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form,customHTML){
2 | form.setShowDisabledFields(true);
3 | form.setHidePrintLink(false);
4 |
5 | if(form.getFormMode() == "MOD" || form.getFormMode() == "ADD"){
6 | var filter = new java.util.HashMap();
7 | filter.put("colleaguePK.colleagueId",getValue("WKUser"));
8 | var colaborador = getDatasetValues('colleague',filter).get(0).get("colleagueName");
9 |
10 | var dtNow = new java.util.Date();
11 | var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
12 | var today = sdf.format(dtNow);
13 |
14 | form.setValue('user', colaborador);
15 | form.setValue('data_mod', today);
16 | }
17 | }
--------------------------------------------------------------------------------
/forms/173 - 0800 - Cadastro de Unidade de Negocio/events/displayFields.js:
--------------------------------------------------------------------------------
1 | function displayFields(form,customHTML){
2 | form.setShowDisabledFields(true);
3 | form.setHidePrintLink(false);
4 |
5 | if(form.getFormMode() == "MOD" || form.getFormMode() == "ADD"){
6 | var filter = new java.util.HashMap();
7 | filter.put("colleaguePK.colleagueId",getValue("WKUser"));
8 | var colaborador = getDatasetValues('colleague',filter).get(0).get("colleagueName");
9 |
10 | var dtNow = new java.util.Date();
11 | var sdf = new java.text.SimpleDateFormat("dd/MM/yyyy");
12 | var today = sdf.format(dtNow);
13 |
14 | form.setValue('user', colaborador);
15 | form.setValue('data_mod', today);
16 | }
17 | }
--------------------------------------------------------------------------------
/mechanisms/AprovCampoMatricula_User.js:
--------------------------------------------------------------------------------
1 | function resolve(process,colleague){
2 |
3 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>USUARIO");
4 |
5 |
6 | var user = hAPI.getCardValue("matricula_user");
7 | /*var user = 4599;*/
8 | //log.warn(user);
9 | var userList = new java.util.ArrayList();
10 | userList.add(null);
11 |
12 | var c1 = DatasetFactory.createConstraint("USER_CODE", user, user, ConstraintType.MUST);
13 | var constraints = new Array(c1);
14 | var dataset = DatasetFactory.getDataset("aprovadores", null, constraints, null);
15 |
16 | for(var i = 0; i < dataset.rowsCount; i++) {
17 | //log.warn(dataset.getValue(i, "DATA_VALUE"));
18 | userList.add(dataset.getValue(i, "DATA_VALUE"));
19 | }
20 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>USUARIO");
21 | return userList;
22 | }
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
Este usuario não pode enviar atividades para avaliação" +
9 | "
Selecione a opção Definição do Responsável!";
10 | }
11 |
12 |
13 | }
--------------------------------------------------------------------------------
/workflow/scripts/SV-SolicitaçãoDeViagem.afterTaskCreate.js:
--------------------------------------------------------------------------------
1 | function afterTaskCreate(colleagueId) {
2 | var atividade = getValue('WKCurrentState');
3 |
4 | if (atividade == 71) {
5 | // Recuperando a data informada no campo do formulário
6 | var dataStr = hAPI.getCardValue("data_retirada").split("/");
7 | if (dataStr != undefined && dataStr != '') {
8 |
9 | var data = new Date();
10 | data.setDate(dataStr[0]);
11 | data.setMonth(dataStr[1] - 1);
12 | data.setFullYear(dataStr[2]);
13 |
14 | var numEmpresa = getValue("WKCompany");
15 | var numeroDaSolicitacao = getValue('WKNumProces');
16 | var threadDaSolicitacao = hAPI.getActualThread(numEmpresa, numeroDaSolicitacao, atividade);
17 |
18 | // Altera o prazo de conclusão
19 | hAPI.setDueDate(numeroDaSolicitacao, threadDaSolicitacao, colleagueId, data, 28800);
20 | }
21 |
22 | }
23 | }
--------------------------------------------------------------------------------
/workflow/scripts/Sub-RNC.afterTaskCreate.js:
--------------------------------------------------------------------------------
1 | function afterTaskCreate(colleagueId){
2 |
3 | var numEmpresa = getValue("WKCompany");
4 | var numeroDaSolicitacao = getValue("WKNumProces");
5 | var nrProxAtividade = getValue("WKNextState");
6 | var numAtividade = getValue('WKCurrentState');
7 | var threadDaSolicitacao = hAPI.getActualThread(numEmpresa, numeroDaSolicitacao, numAtividade);
8 |
9 | if (numAtividade == 5) {
10 | var prazoFormulario = hAPI.getCardValue('prazo_conclusao');
11 | if (prazoFormulario != undefined && prazoFormulario != '') {
12 | var dataStr = hAPI.getCardValue("prazo_conclusao").split("/");
13 | if (dataStr != undefined && dataStr != '') {
14 | var data = new Date();
15 | data.setDate(dataStr[0]);
16 | data.setMonth(dataStr[1] - 1);
17 | data.setFullYear(dataStr[2]);
18 |
19 | hAPI.setDueDate(numeroDaSolicitacao, threadDaSolicitacao, colleagueId, data, 61200);
20 |
21 | }
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/workflow/scripts/SNF.beforeTaskSave.js:
--------------------------------------------------------------------------------
1 | function beforeTaskSave(colleagueId,nextSequenceId,userList){
2 |
3 | hAPI.setCardValue('num_processo', getValue("WKNumProces"));
4 |
5 | if (nextSequenceId = 2 && hAPI.getCardValue('espNota') == "devolucao"){
6 |
7 | var token = DatasetFactory.getDataset('tokens', null, null, null).getValue(0, "tokenTOTVSDatasul");
8 |
9 | var co1 = DatasetFactory.createConstraint('nat_oper', hAPI.getCardValue("natOper_emitente"), hAPI.getCardValue("natOper_emitente"), ConstraintType.MUST);
10 | var co2 = DatasetFactory.createConstraint('token', token, token, ConstraintType.MUST);
11 | var datasetTOTVSNaturOper = DatasetFactory.getDataset('TOTVSNaturOper', null, new Array(co1, co2), null);
12 |
13 | if (hAPI.listAttachments().size() < 1 && datasetTOTVSNaturOper.getValue(0, "nat_operacao") == 'Saída') {
14 | throw "
ATENÇÃO:
É obrigatorio incluir um scan da nota de referência
.";
15 | }
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/forms/32734 - LNF - Lançamento de Notas Fiscais/events/validateForm.js:
--------------------------------------------------------------------------------
1 | function validateForm(form){
2 |
3 | var numState = getValue("WKNumState");
4 | var process = getValue("WKNumProces");
5 | var message = "";
6 |
7 | if (numState == 0 || numState == 1){
8 | if (form.getValue("vlDisp") == "") message += "
- Informe o valor disponível;";
9 | if (form.getValue("nrPedCli") == "") message += "
- Informe numero do pedido;";
10 | if (form.getValue("codCliente") == "") message += "
- Informe o codigo do cliente;";
11 | if (form.getValue("nomeCliente") == "") message += "
- Informe o nome do cliente;";
12 | if (form.getValue("unid_negocio") == "") message += "
- Informe a unidade de negócio;";
13 | if (form.getValue("vlDocto") == "") message += "
- Informe o valor do documento;";
14 |
15 | }
16 |
17 | if (numState == 2){
18 | if (form.getValue("pagto") == "") message += "
- Informe pagamento;";
19 | if (form.getValue("pagto") == "sim"){
20 | if (form.getValue("data_pagto") == "") message += "
- Informe a data de pagamento;";
21 | }
22 | }
23 |
24 | if (message != "") throw "
Os campos abaixo são de preencimento obrigatório:
" + message;
25 |
26 |
27 | }
--------------------------------------------------------------------------------
/workflow/scripts/SSM.afterTaskCreate.js:
--------------------------------------------------------------------------------
1 | function afterTaskCreate(colleagueId) {
2 | var atividade = getValue('WKCurrentState');
3 |
4 | if (atividade == 20) {
5 | // Recuperando a data informada no campo do formulário
6 | var prazoFormulario = hAPI.getCardValue('dias_manut');
7 | if (prazoFormulario != undefined && prazoFormulario != '') {
8 | var numeroDaSolicitacao = getValue('WKNumProces');
9 | var threadDaSolicitacao = 0; // Normalmente 0, quando não for atividade paralela
10 | var responsavelPelaTarefa = colleagueId;
11 |
12 | var data = new Date();
13 | var dataStr = hAPI.getCardValue("data_sol").split("/");
14 | if (dataStr != undefined && dataStr != '') {
15 | data.setDate(dataStr[0]);
16 | data.setMonth(dataStr[1] - 1);
17 | data.setFullYear(dataStr[2]);
18 | }
19 |
20 | var obj = hAPI.calculateDeadLineHours(data, 28800, prazoFormulario * 8, "Default");
21 | var dt = obj[0];
22 | var segundos = obj[1];
23 | //log.warn("-----------------------NOVA DATA: " + dt);
24 | //log.warn("------------------------SEGUNDOS: " + segundos);
25 |
26 | // Altera o prazo de conclusão
27 | hAPI.setDueDate(numeroDaSolicitacao, threadDaSolicitacao, responsavelPelaTarefa, dt, segundos);
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/workflow/scripts/CTe.afterTaskComplete.js:
--------------------------------------------------------------------------------
1 | function afterTaskComplete(colleagueId,nextSequenceId,userList){
2 |
3 | var sequenceId = getValue("WKNumState");
4 | var numEmpresa = getValue("WKCompany");
5 | var numProcesso = getValue("WKNumProces");
6 | var numThread = hAPI.getActualThread(numEmpresa, numProcesso, sequenceId);
7 | var colleagueId = getValue("WKUser");
8 |
9 | if (sequenceId == 3) hAPI.setTaskComments(colleagueId, numProcesso, numThread, hAPI.getCardValue("desc_analista").replace("\n", "
"));
10 |
11 | if (sequenceId == 11) hAPI.setTaskComments(colleagueId, numProcesso, numThread, hAPI.getCardValue("desc_contratante").replace("\n", "
"));
12 |
13 | if (sequenceId == 38) hAPI.setTaskComments(colleagueId, numProcesso, numThread, hAPI.getCardValue("desc_cancelamento").replace("\n", "
"));
14 |
15 | if (sequenceId == 48) hAPI.setTaskComments(colleagueId, numProcesso, numThread, hAPI.getCardValue("desc_checkDados").replace("\n", "
"));
16 |
17 | if (sequenceId == 52) hAPI.setTaskComments(colleagueId, numProcesso, numThread, hAPI.getCardValue("desc_aprov_checkDados").replace("\n", "
"));
18 |
19 | if (sequenceId == 59) hAPI.setTaskComments(colleagueId, numProcesso, numThread, hAPI.getCardValue("desc_aprov_final").replace("\n", "
"));
20 |
21 | if (sequenceId == 29) hAPI.setTaskComments(colleagueId, numProcesso, numThread, hAPI.getCardValue("desc_lancDatasul").replace("\n", "
"));
22 |
23 |
24 | }
--------------------------------------------------------------------------------
/workflow/scripts/IRSC.afterStateEntry.js:
--------------------------------------------------------------------------------
1 | function afterStateEntry(sequenceId) {
2 |
3 | //log.warn("----------------------AFTER STATE ENTRY-------------------------------");
4 |
5 | var numEmpresa = getValue("WKCompany");
6 | var numProcesso = getValue("WKNumProces");
7 | var nrProxAtividade = getValue("WKNextState");
8 | var numAtividade = sequenceId;
9 | var numThread = hAPI.getActualThread(numEmpresa, numProcesso, numAtividade);
10 | var colleagueId = getValue("WKUser");
11 |
12 | //log.warn("----------------------numEmpresa: " + numEmpresa);
13 | //log.warn("---------------------numProcesso: " + numProcesso);
14 | //log.warn("-----------------nrProxAtividade: " + nrProxAtividade);
15 | //log.warn("-----------------------numThread: " + numThread);
16 | //log.warn("--------------------numAtividade: " + numAtividade);
17 | //log.warn("---------------------colleagueId: " + colleagueId);
18 |
19 | if (numAtividade == 7) {
20 | var responsavel = hAPI.getCardValue("matricula_resp");
21 |
22 | if (responsavel != ""){
23 |
24 | var dataStr = hAPI.getCardValue("prazo").split("/");
25 | var data = new Date();
26 |
27 | data.setDate(dataStr[0]);
28 | data.setMonth(dataStr[1] - 1);
29 | data.setFullYear(dataStr[2]);
30 |
31 | try {
32 | hAPI.setDueDate(numProcesso, numThread, responsavel, data,
33 | 61200);
34 | } catch (e) {
35 | //log.error("----------------Erro ao alterar a data de execução:");
36 | //log.error(e);
37 | }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding//forms/14\ -\ TI\ -\ Formulario\ de\ registro\ de\ atendimento\ na\ TI/fluxo-atendimento-ti.html=UTF-8
3 | encoding//forms/1645\ -\ SMC\ -\ Cadastro\ de\ Ganhos/tipos_ganhos.html=UTF-8
4 | encoding//forms/1648\ -\ SMC\ -\ Cadastro\ de\ Origens/cadastro_de_origens.html=UTF-8
5 | encoding//forms/166\ -\ 0800\ -\ Cadastro\ de\ \ Produtos/cadastro_de_produtos.html=UTF-8
6 | encoding//forms/1683\ -\ SV\ -\ Solicita\u00E7\u00E3o\ de\ Viagem/solicitacao_viagem.html=UTF-8
7 | encoding//forms/169\ -\ 0800\ -\ Cadastro\ de\ Servicos/cadastro_de_servicos.html=UTF-8
8 | encoding//forms/171\ -\ 0800\ -\ Cadastro\ de\ Origens/cadastro_de_origens.html=UTF-8
9 | encoding//forms/173\ -\ 0800\ -\ Cadastro\ de\ Unidade\ de\ Negocio/cadastro_de_uni_negocio.html=UTF-8
10 | encoding//forms/176\ -\ SAC\ -\ Formulario\ de\ Registro\ 0800/formulario_0800.html=UTF-8
11 | encoding//forms/20\ -\ ti\ -\ classificacaodechamados/classe_de_chamados.html=UTF-8
12 | encoding//forms/20797\ -\ SNF\ -\ Solicita\u00E7\u00E3o\ de\ Nota\ Fiscal/SolicitacaoDeNotaFiscal.html=UTF-8
13 | encoding//forms/22\ -\ ti\ -\ tipodechamados/tipo_de_chamados.html=UTF-8
14 | encoding//forms/2239\ -\ RIDV\ -\ Relat\u00F3rio\ Individual\ de\ Despesas\ de\ Viagem/Relatorio_Individual_Despesas_Viagem.html=UTF-8
15 | encoding//forms/26\ -\ ti\ -\ criticidadedechamados/criticidade_de_chamados.html=UTF-8
16 | encoding//forms/298\ -\ RNC\ -\ Formulario\ de\ N\u00E3o\ Conformidadde/Formulario_de_Nao_Conformidadde.html=UTF-8
17 |
--------------------------------------------------------------------------------
/workflow/scripts/SOL-TI.afterTaskCreate.js:
--------------------------------------------------------------------------------
1 | function afterTaskCreate(colleagueId) {
2 | var atividade = getValue('WKCurrentState');
3 |
4 | log.warn(">>>>>>>>>>>>>>>>>>>> atividade " + atividade);
5 |
6 | if (atividade == 2) {
7 | // Recuperando a data informada no campo do formulário
8 | var prazoFormulario = hAPI.getCardValue('criticidade');
9 | if (prazoFormulario != undefined && prazoFormulario != '') {
10 | var numEmpresa = getValue("WKCompany");
11 | var numeroDaSolicitacao = getValue('WKNumProces');
12 | var threadDaSolicitacao = hAPI.getActualThread(numEmpresa, numeroDaSolicitacao, atividade);
13 | var responsavelPelaTarefa = colleagueId;
14 |
15 | log.warn(">>>>>>>>>>>>>>>>>>>> responsavelPelaTarefa " + responsavelPelaTarefa);
16 | log.warn(">>>>>>>>>>>>>>>>>>>> prazoFormulario " + prazoFormulario);
17 |
18 | var data = new Date();
19 |
20 | var segundos = (data - new Date().setHours(0,0,0,0)) / 1000;
21 |
22 | log.warn(">>>>>>>>>>>>>>>>>>>> segundos " + segundos);
23 |
24 | var obj = hAPI.calculateDeadLineHours(data, segundos, prazoFormulario, "Default");
25 | var dt = obj[0];
26 | segundos = obj[1];
27 | log.warn("-----------------------NOVA DATA: " + dt);
28 | log.warn("------------------------SEGUNDOS: " + segundos);
29 |
30 | // Altera o prazo de conclusão
31 | hAPI.setDueDate(numeroDaSolicitacao, threadDaSolicitacao, responsavelPelaTarefa, dt, segundos);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/mechanisms/AprovadorImediato.js:
--------------------------------------------------------------------------------
1 | function resolve(process,colleague){
2 |
3 | var user = colleague.colleaguePK.colleagueId;
4 | var userList = new java.util.ArrayList();
5 | userList.add(null);
6 |
7 | var processc1 = DatasetFactory.createConstraint("workflowProcessPK.companyId", process.workflowProcessPK.companyId, process.workflowProcessPK.companyId, ConstraintType.MUST);
8 | var processc2 = DatasetFactory.createConstraint("workflowProcessPK.processInstanceId", process.workflowProcessPK.processInstanceId, process.workflowProcessPK.processInstanceId, ConstraintType.MUST);
9 | var processConstraints = new Array(processc1, processc2);
10 | var processDataset = DatasetFactory.getDataset("workflowProcess", null, processConstraints, null);
11 | for(var i = 0; i < processDataset.rowsCount; i++) {
12 | /*//log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>processo");
13 | //log.warn(process.workflowProcessPK.companyId);
14 | //log.warn(process.workflowProcessPK.processInstanceId);
15 | //log.warn(processDataset.getValue(i, "requesterId"));
16 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>processo");*/
17 | user = processDataset.getValue(i, "requesterId");
18 | }
19 |
20 |
21 | /*//log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>USUARIO");
22 | //log.warn(user);
23 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>USUARIO");*/
24 |
25 | var c1 = DatasetFactory.createConstraint("USER_CODE", user, user, ConstraintType.MUST);
26 | var constraints = new Array(c1);
27 | var dataset = DatasetFactory.getDataset("aprovadores", null, constraints, null);
28 |
29 | for(var i = 0; i < dataset.rowsCount; i++) {
30 | userList.add(dataset.getValue(i, "DATA_VALUE"));
31 | }
32 | return userList;
33 | }
--------------------------------------------------------------------------------
/workflow/scripts/SMC - Solicitação de melhoria continua.afterStateEntry.js:
--------------------------------------------------------------------------------
1 | function afterStateEntry(sequenceId) {
2 |
3 | //log.warn("SMC AFTER STATE ENTRY-------------------" + sequenceId);
4 |
5 | var process = getValue("WKNumProces");
6 |
7 | var resposta;
8 | var row;
9 |
10 | var cardData = new java.util.HashMap();
11 | cardData = hAPI.getCardData(process);
12 | var keys = cardData.keySet().toArray();
13 |
14 | if (sequenceId == 14) {
15 |
16 | var cardData = new java.util.HashMap();
17 | cardData = hAPI.getCardData(process);
18 | var keys = cardData.keySet().toArray();
19 | for ( var key in keys) {
20 | var field = keys[key];
21 | if (field.indexOf("mat_acoes___") > -1) {
22 |
23 | row = field.replace("mat_acoes___", "");
24 |
25 | if (hAPI.getCardValue("fluxo_acoes___" + row) == ""){
26 | var userList = new java.util.ArrayList();
27 | userList.add(hAPI.getCardValue("mat_acoes___" + row));
28 |
29 | var hpForm = new java.util.HashMap();
30 | hpForm.put("process_pai", "" + process);
31 | hpForm.put("prazo_conclusao", "" + hAPI.getCardValue("dtprazoativ_acoes___" + row));
32 | hpForm.put("descAtividade", "" + hAPI.getCardValue("descAtividade_acoes___" + row));
33 | hpForm.put("responsavel", "" + hAPI.getCardValue("mat_acoes___" + row));
34 |
35 | resposta = hAPI.startProcess("Sub-RNC", 0, userList, hAPI.getCardValue("descAtividade_acoes___" + row), true, hpForm, false);
36 | hAPI.setCardValue("fluxo_acoes___" + row, resposta.get("iProcess"));
37 | hAPI.setCardValue("status_acoes___" + row,"Iniciado");
38 |
39 | }
40 | }
41 | }
42 |
43 | }
44 | //log.warn("FIM AFTER STATE ENTRY-------------------" + sequenceId);
45 | }
--------------------------------------------------------------------------------
/forms/14 - TI - Formulario de registro de atendimento na TI/events/validateForm.js:
--------------------------------------------------------------------------------
1 | function validateForm(form){
2 | loading.setMessage("Validando campos de formulário");
3 |
4 | var numState = getValue("WKNumState");
5 | var message = "";
6 | if (numState == 0 || numState == 1){
7 | if (form.getValue("ramal") == "") message += "
- Ramal ou telefone para contato;";
8 | if (form.getValue("tipo") == "") message += "
- Tipo do Chamado";
9 | if (form.getValue("tipo") == "sistema" && form.getValue("sistema") == "") message += "
- Tipo do Chamado";
10 |
11 | if (form.getValue("criticidade") == "") message += "
- Criticidade do Chamado;";
12 | if (form.getValue("desc_chamado") == "") message += "
- Descrição do Chamado;";
13 |
14 | }
15 | if (numState == 2){
16 | var indexes = form.getChildrenIndexes("tb_interacao");
17 | if (form.getValue("desc_interacao___" + indexes[indexes.length - 1]) == "") message += "
- Descreva o atendimento prestado";
18 | }
19 |
20 | if (numState == 4){
21 | var indexes = form.getChildrenIndexes("tb_interacao");
22 | if (form.getValue("desc_interacao___" + indexes[indexes.length - 1]) == "") message += "
- Descreva o atendimento recebido";
23 |
24 | if (form.getValue("conclusao") == "") message += "
- Informe se o atendimento foi concluido;";
25 | if (form.getValue("conclusao") == "sim"){
26 | if (form.getValue("nota") == "") message += "
- Avalie o chamado;";
27 | if (form.getValue("nota") == "3" || form.getValue("nota") == "4" ){
28 | if (form.getValue("comentarios") == "") message += "
- Justifique sua avaliação;";
29 |
30 |
31 | }
32 |
33 |
34 | }
35 |
36 |
37 | }
38 |
39 | if (message != "") throw "
Os campos abaixo são de preencimento obrigatório:
" + message;
40 |
41 |
42 |
43 | }
--------------------------------------------------------------------------------
/datasets/TSSConsultaDocumento.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 | var chaveeletronica ;
3 | if (constraints != null) {
4 | for (var i = 0; i < constraints.length; i++) {
5 | if (constraints[i].fieldName == 'chaveeletronica' ) chaveeletronica = constraints[i].initialValue;
6 | }
7 | }
8 | if (chaveeletronica == null){
9 | var chaveeletronica = "35170203658600000130570010000350591750350595";
10 | }
11 |
12 | //log.warn("------------------------------------------------------------------------------------------------------------");
13 |
14 | // Cria o dataset
15 | var dataset = DatasetBuilder.newDataset();
16 | dataset.addColumn("STATUS");
17 | dataset.addColumn("DATA CONSULTA");
18 | dataset.addColumn("CHAVE");
19 | dataset.addColumn("MENSAGEM");
20 | dataset.addColumn("PROTOCOLO");
21 | dataset.addColumn("RECEBIMENTO");
22 |
23 |
24 |
25 | // Conecta o servico e busca os livros
26 | var periodicService = ServiceManager.getService('TSS');
27 | var serviceHelper = periodicService.getBean();
28 | var serviceLocator = periodicService.instantiate('br.com.totvs.webservices.nfsebra_apw.NFESBRALocator');
29 | var service = serviceLocator.getNFESBRASOAP();
30 |
31 | //
32 | try{
33 | var sm = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
34 | var result = service.CONSULTACHAVENFE("TOTVS", "000001", chaveeletronica);
35 |
36 | dataset.addRow(new Array( "OK",
37 | sm.format(new Date()),
38 | result.ID,
39 | result.MSGRETNFE,
40 | result.PROTOCOLO,
41 | sm.format(result.RECBTO)
42 | ));
43 |
44 | } catch (erro) {
45 | dataset.addRow(new Array("ERRO", erro.toString()));
46 | }
47 |
48 | return dataset;
49 |
50 | }
--------------------------------------------------------------------------------
/workflow/scripts/SAC - 0800.afterStateEntry.js:
--------------------------------------------------------------------------------
1 | function afterStateEntry(sequenceId){
var numEmpresa = getValue("WKCompany");
var numProcesso = getValue("WKNumProces");
var numAtividade = sequenceId;
var numThread = hAPI.getActualThread(numEmpresa, numProcesso, numAtividade);
var colleagueId = getValue("WKUser");
//log.warn("----------------------AFTER STATE ENTRY-------------------------------")
//log.warn("----------------------numEmpresa: " + numEmpresa);
//log.warn("----------------------numProcesso: " + numProcesso);
//log.warn("----------------------numThread: " + numThread);
//log.warn("----------------------numAtividade: " + numAtividade);
//log.warn("----------------------colleagueId: " + colleagueId);
if(numAtividade == 5){ //implementar plano e ação
var colleagueId = hAPI.getCardValue("matricula_resp2");
//log.warn("----------------------colleagueId: " + colleagueId);
var data = new Date();
var prazo = hAPI.getCardValue("prazo");
var dt_planejada;
if (prazo.indexOf("-") > 0){
dt_planejada = new java.lang.String(prazo).split("-");
//log.warn("----------------------DIA: " + dt_planejada[2]);
//log.warn("----------------------MES: " + (dt_planejada[1] - 1));
//log.warn("----------------------ANO: " + dt_planejada[0]);
//seta o dia, mês (Janeiro é 0) e ano
data.setDate(dt_planejada[2]);
data.setMonth(dt_planejada[1] - 1);
data.setFullYear(dt_planejada[0]);
//log.warn("----------------------DATA: " + data);
} else{
dt_planejada = new java.lang.String(prazo).split("/");
//log.warn("----------------------DIA: " + dt_planejada[0]);
//log.warn("----------------------MES: " + (dt_planejada[1] - 1));
//log.warn("----------------------ANO: " + dt_planejada[2]);
//seta o dia, mês (Janeiro é 0) e ano
data.setDate(dt_planejada[0]);
data.setMonth(dt_planejada[1] - 1);
data.setFullYear(dt_planejada[2]);
//log.warn("----------------------DATA: " + data);
}
try {
hAPI.setDueDate(numProcesso, numThread, colleagueId, data, 28800);
}catch (e) {
//log.error("Erro ao alterar a data de execução:\n" + e);
}
}
}
--------------------------------------------------------------------------------
/datasets/consultaCEP.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | var cep;
4 | if (constraints != null) {
5 | for (var i = 0; i < constraints.length; i++) {
6 | if (constraints[i].fieldName == 'cep' ) cep = String(constraints[i].initialValue);
7 | }
8 | }
9 | if (cep == null){
10 | cep = "13904904";
11 | }
12 |
13 | //log.warn("--------------------CONSULTA CEP----------------------------------------------------------------------");
14 |
15 | var dataset = DatasetBuilder.newDataset();
16 | dataset.addColumn('STATUS');
17 | dataset.addColumn('message');
18 | dataset.addColumn('retorno');
19 |
20 | try{
21 | var clientService = fluigAPI.getAuthorizeClientService();
22 | var data = {
23 | companyId : getValue("WKCompany") + '',
24 | serviceCode : 'viaCEP',
25 | endpoint : '/ws/' + cep.replace(/\D/g, '') + '/json/',
26 | method : 'get'
27 | }
28 |
29 | var vo = clientService.invoke(JSON.stringify(data));
30 | var result = vo.getResult();
31 |
32 | if(result== null || result.isEmpty()){
33 | dataset.addRow(new Array("NOK", "Erro ao comunicar ao consultar o CEP", data));
34 | //log.warn("NOT FOUND: " + data);
35 | }else{
36 | try{
37 | var objdata = JSON.parse(result);
38 | for (var obj in objdata){
39 | dataset.addColumn(obj.toString());
40 | };
41 | var array = new Array();
42 | array[0] = "OK";
43 | array[1] = "Consulta OK";
44 | array[2] = result;
45 | //log.warn("RETORNO: " + result);
46 | var i = 3;
47 | for (var obj in objdata){
48 | //log.warn(obj + " - " + objdata[obj]);
49 | array[i] = objdata[obj].toString();
50 | i++;
51 | };
52 |
53 | dataset.addRow(array);
54 | } catch (e) {
55 | dataset.addRow(new Array("NOK", e.toString(), result));
56 | //log.warn("JSON PARSE: " + result);
57 | }
58 |
59 | }
60 | } catch (e) {
61 | dataset.addRow(new Array("NOK", e.toString(), vo));
62 | //log.warn("Client Service: " + vo);
63 | }
64 | return dataset;
65 |
66 |
67 |
68 | }
--------------------------------------------------------------------------------
/workflow/scripts/FP-FichaDePendencia.afterStateEntry.js:
--------------------------------------------------------------------------------
1 | function afterStateEntry(sequenceId){
2 |
3 | //log.warn("Entrei-------------------" + sequenceId);
4 |
5 |
6 | var process = getValue("WKNumProces");
7 |
8 | var resposta;
9 | var row;
10 |
11 | var cardData = new java.util.HashMap();
12 | cardData = hAPI.getCardData(process);
13 | var keys = cardData.keySet().toArray();
14 |
15 | if (sequenceId == 9) {
16 | hAPI.setCardValue("num_processo", process);
17 |
18 | var cardData = new java.util.HashMap();
19 | cardData = hAPI.getCardData(process);
20 |
21 | var keys = cardData.keySet().toArray();
22 | for ( var key in keys) {
23 | var field = keys[key];
24 | if (field.indexOf("nr_item___") > -1) {
25 |
26 | row = field.replace("nr_item___", "");
27 |
28 | if (hAPI.getCardValue("fluxo_fp___" + row) == ""){
29 | hAPI.setCardValue("nr_item___" + row, process + hAPI.getCardValue("nr_item___" + row));
30 |
31 |
32 | var userList = new java.util.ArrayList();
33 | userList.add(hAPI.getCardValue("mat_fp___" + row));
34 |
35 | var hpForm = new java.util.HashMap();
36 | hpForm.put("process_pai", "" + process);
37 | hpForm.put("fp_pai", "" + hAPI.getCardValue("nr_item___" + row));
38 | hpForm.put("data_pai", "" + hAPI.getCardValue("data_sol"));
39 | hpForm.put("cliente", "" + hAPI.getCardValue("cliente"));
40 | hpForm.put("desc_mat", "" + hAPI.getCardValue("desc_mat___" + row));
41 | hpForm.put("it_nr_serie", "" + hAPI.getCardValue("it_nr_serie___" + row));
42 | hpForm.put("def_inf", "" + hAPI.getCardValue("def_inf___" + row));
43 | hpForm.put("matricula_emissor", "" + hAPI.getCardValue("mat_fp___" + row));
44 |
45 | resposta = hAPI.startProcess("FP-subprocesso", 0, userList, hAPI.getCardValue("nr_item___" + row), true, hpForm, false);
46 | hAPI.setCardValue("fluxo_fp___" + row, resposta.get("iProcess"));
47 | hAPI.setCardValue("status_fp___" + row,"Iniciado");
48 | }
49 | }
50 | }
51 | }
52 |
53 |
54 |
55 | }
--------------------------------------------------------------------------------
/datasets/bancosWebservice.js:
--------------------------------------------------------------------------------
1 | function defineStructure() {
2 | addColumn("Cod_banco");
3 | addColumn("Nome_est");
4 | addColumn("Banco");
5 | addColumn("chave_pesquisa");
6 | setKey([ "Cod_banco", "Banco"]);
7 | addIndex([ "Cod_banco" ]);
8 | addIndex([ "chave_pesquisa"]);
9 | }
10 |
11 | function onSync(lastSyncDate) {
12 |
13 | var dataset = DatasetBuilder.newDataset();
14 | var datasetBancos = DatasetFactory.getDataset('bancos', null, null, null);
15 | for (var i = 0; i < datasetBancos.rowsCount; i++) {
16 | dataset.addOrUpdateRow([datasetBancos.getValue(i, "Cod_banco"),
17 | datasetBancos.getValue(i, "Nome_ext"),
18 | datasetBancos.getValue(i, "Banco"),
19 | datasetBancos.getValue(i, "Cod_banco") + datasetBancos.getValue(i, "Banco")
20 |
21 | ]);
22 | }
23 | return dataset;
24 | }
25 |
26 |
27 | /*function defineStructure() {
28 | addColumn("Cod_banco");
29 | addColumn("Banco");
30 | setKey([ "Cod_banco", "Banco"]);
31 | addIndex([ "Cod_banco" ]);
32 | addIndex([ "Cod_banco", "Banco"]);
33 | }
34 |
35 | function onSync(lastSyncDate) {
36 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO1");
37 | var myApiConsumer = oauthUtil.getGenericConsumer("","", "", "");
38 | var result = myApiConsumer.get("https://www.pagueveloz.com.br/api/v1/Bancos");
39 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO2");
40 | //log.warn(result);
41 |
42 | var dataset = DatasetBuilder.newDataset();
43 | if(result== null || result.isEmpty()){
44 | dataset.addOrUpdateRow(["NOK", "Erro ao comunicar ao consultar o BANCOS"]);
45 | //log.warn("NOT FOUND: " + data);
46 | }else{
47 | try{
48 | var objdata = JSON.parse(result);
49 | for (var obj in objdata){
50 | //log.warn(objdata[obj].Codigo);
51 | //log.warn(objdata[obj].Nome);
52 | dataset.addOrUpdateRow([String(objdata[obj].Codigo), objdata[obj].Nome]);
53 | };
54 | } catch (e) {
55 | dataset.addOrUpdateRow(["NOK", e.toString()]);
56 | //log.warn("JSON PARSE: " + result);
57 | }
58 | }
59 | return dataset;
60 | }
61 | */
--------------------------------------------------------------------------------
/datasets/classificacaodechamados.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | //Cria as colunas
4 | var dataset = DatasetBuilder.newDataset();
5 | dataset.addColumn("Classe");
6 |
7 | //Cria a constraint para buscar os formulários ativos
8 | var cst = DatasetFactory.createConstraint("metadata#active", true, true, ConstraintType.MUST);
9 | var constraints = new Array(cst);
10 |
11 | var datasetPrincipal = DatasetFactory.getDataset("classe_de_chamados", null, constraints, null);
12 | var filhos = new Array();
13 | var count = 0;
14 |
15 |
16 |
17 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
18 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
19 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
20 |
21 | //Cria as constraints para buscar os campos filhos, passando o tablename, número da formulário e versão
22 | var c1 = DatasetFactory.createConstraint("tablename", "tb_classe" ,"tb_classe", ConstraintType.MUST);
23 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId, documentId, ConstraintType.MUST);
24 | var c3 = DatasetFactory.createConstraint("metadata#version", documentVersion, documentVersion, ConstraintType.MUST);
25 | var constraintsFilhos = new Array(c1, c2, c3);
26 |
27 | //Busca o dataset
28 | var datasetFilhos = DatasetFactory.getDataset("classe_de_chamados", null, constraintsFilhos, null);
29 |
30 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
31 | filhos[count] = {Classe: datasetFilhos.getValue(j, "classe")};
32 | count++;
33 |
34 | }
35 | }
36 |
37 | //Faz a ordenação
38 | filhos.sort(compare);
39 |
40 | //Depois de realizar a ordenação, adicionar os registros no dataset para serem apresentados
41 | filhos.forEach(function(filho) {
42 | //log.warn(filho.Classe);
43 | dataset.addRow( new Array(filho.Classe));
44 | });
45 |
46 | return dataset;
47 | }
48 |
49 | function compare(a,b) {
50 | if (a.Classe < b.Classe) return -1;
51 | if (a.Classe > b.Classe) return 1;
52 | return 0;
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/datasets/cadastro_ganhos_smc.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | //Cria as colunas do dataset
4 | var dataset = DatasetBuilder.newDataset();
5 | dataset.addColumn("Ganhos");
6 |
7 | //nome do dataset do Formulario
8 | var datasetDoFormulario = "cadastro_de_ganhos_smc";
9 |
10 | //nome da tabela do formulario
11 | var tablename = "tb_origem";
12 |
13 | //Cria a constraint para buscar os formulários ativos
14 | var cst = DatasetFactory.createConstraint("metadata#active", true, true, ConstraintType.MUST);
15 | var constraints = new Array(cst);
16 |
17 | var datasetPrincipal = DatasetFactory.getDataset(datasetDoFormulario, null, constraints, null);
18 |
19 | var filhos = new Array();
20 | var count = 0;
21 |
22 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
23 |
24 | //encontrar documento e versão atual
25 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
26 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
27 |
28 | //Cria as constraints para buscar os campos filhos, passando o tablename, número da formulário e versão
29 | var c1 = DatasetFactory.createConstraint("tablename", tablename ,tablename, ConstraintType.MUST);
30 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId, documentId, ConstraintType.MUST);
31 | var c3 = DatasetFactory.createConstraint("metadata#version", documentVersion, documentVersion, ConstraintType.MUST);
32 | var constraintsFilhos = new Array(c1, c2, c3);
33 |
34 | var datasetFilhos = DatasetFactory.getDataset(datasetDoFormulario, null, constraintsFilhos, new Array("origem"));
35 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
36 | filhos[count] = {Origem: datasetFilhos.getValue(j, "ganhos")};
37 | count++;
38 |
39 | }
40 | }
41 | //Faz a ordenação
42 | filhos.sort(compare);
43 |
44 | //Depois de realizar a ordenação, adicionar os registros no dataset para serem apresentados
45 | filhos.forEach(function(filho) {
46 | dataset.addRow( new Array(filho.Origem));
47 | });
48 |
49 | return dataset;
50 | }
51 |
52 | function compare(a,b) {
53 | if (a.Origem < b.Origem) return -1;
54 | if (a.Origem > b.Origem) return 1;
55 | return 0;
56 | }
--------------------------------------------------------------------------------
/datasets/cadastro_origens_smc.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | //Cria as colunas do dataset
4 | var dataset = DatasetBuilder.newDataset();
5 | dataset.addColumn("Origem");
6 |
7 | //nome do dataset do Formulario
8 | var datasetDoFormulario = "cadastro_de_origens_smc";
9 |
10 | //nome da tabela do formulario
11 | var tablename = "tb_origem";
12 |
13 | //Cria a constraint para buscar os formulários ativos
14 | var cst = DatasetFactory.createConstraint("metadata#active", true, true, ConstraintType.MUST);
15 | var constraints = new Array(cst);
16 |
17 | var datasetPrincipal = DatasetFactory.getDataset(datasetDoFormulario, null, constraints, null);
18 |
19 | var filhos = new Array();
20 | var count = 0;
21 |
22 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
23 |
24 | //encontrar documento e versão atual
25 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
26 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
27 |
28 | //Cria as constraints para buscar os campos filhos, passando o tablename, número da formulário e versão
29 | var c1 = DatasetFactory.createConstraint("tablename", tablename ,tablename, ConstraintType.MUST);
30 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId, documentId, ConstraintType.MUST);
31 | var c3 = DatasetFactory.createConstraint("metadata#version", documentVersion, documentVersion, ConstraintType.MUST);
32 | var constraintsFilhos = new Array(c1, c2, c3);
33 |
34 | var datasetFilhos = DatasetFactory.getDataset(datasetDoFormulario, null, constraintsFilhos, new Array("origem"));
35 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
36 | filhos[count] = {Origem: datasetFilhos.getValue(j, "origem")};
37 | count++;
38 |
39 | }
40 | }
41 | //Faz a ordenação
42 | filhos.sort(compare);
43 |
44 | //Depois de realizar a ordenação, adicionar os registros no dataset para serem apresentados
45 | filhos.forEach(function(filho) {
46 | dataset.addRow( new Array(filho.Origem));
47 | });
48 |
49 | return dataset;
50 | }
51 |
52 | function compare(a,b) {
53 | if (a.Origem < b.Origem) return -1;
54 | if (a.Origem > b.Origem) return 1;
55 | return 0;
56 | }
--------------------------------------------------------------------------------
/datasets/cadastro_origens.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | //Cria as colunas do dataset
4 | var dataset = DatasetBuilder.newDataset();
5 | dataset.addColumn("Origem");
6 |
7 | //nome do dataset do Formulario
8 | var datasetDoFormulario = "cadastro_de_origens";
9 |
10 | //nome da tabela do formulario
11 | var tablename = "tb_origem";
12 |
13 | //Cria a constraint para buscar os formulários ativos
14 | var cst = DatasetFactory.createConstraint("metadata#active", true, true, ConstraintType.MUST);
15 | var constraints = new Array(cst);
16 |
17 | var datasetPrincipal = DatasetFactory.getDataset(datasetDoFormulario, null, constraints, null);
18 |
19 | var filhos = new Array();
20 | var count = 0;
21 |
22 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
23 |
24 | //encontrar documento e versão atual
25 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
26 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
27 |
28 | //Cria as constraints para buscar os campos filhos, passando o tablename, número da formulário e versão
29 | var c1 = DatasetFactory.createConstraint("tablename", tablename ,tablename, ConstraintType.MUST);
30 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId, documentId, ConstraintType.MUST);
31 | var c3 = DatasetFactory.createConstraint("metadata#version", documentVersion, documentVersion, ConstraintType.MUST);
32 | var constraintsFilhos = new Array(c1, c2, c3);
33 |
34 | var datasetFilhos = DatasetFactory.getDataset(datasetDoFormulario, null, constraintsFilhos, new Array("origem"));
35 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
36 | filhos[count] = {Origem: datasetFilhos.getValue(j, "origem")};
37 | count++;
38 |
39 | }
40 | }
41 | //Faz a ordenação
42 | filhos.sort(compare);
43 |
44 | //Depois de realizar a ordenação, adicionar os registros no dataset para serem apresentados
45 | filhos.forEach(function(filho) {
46 | dataset.addRow( new Array(filho.Origem));
47 | //log.warn("================filho.Origem: " + filho.Origem);
48 | });
49 |
50 | return dataset;
51 | }
52 |
53 | function compare(a,b) {
54 | if (a.Origem < b.Origem) return -1;
55 | if (a.Origem > b.Origem) return 1;
56 | return 0;
57 | }
--------------------------------------------------------------------------------
/workflow/scripts/SV-SolicitaçãoDeViagem.beforeStateEntry.js:
--------------------------------------------------------------------------------
1 | function beforeStateEntry(sequenceId){
2 |
3 | var numEmpresa = getValue("WKCompany");
4 | var numProcesso = getValue("WKNumProces");
5 | var numAtividade = sequenceId;
6 | var numThread = hAPI.getActualThread(numEmpresa, numProcesso, numAtividade);
7 | var colleagueId = getValue("WKUser");
8 |
9 | //log.warn("----------------------BEFORE STATE ENTRY 2 update-------------------------------")
10 | //log.warn("----------------------numEmpresa: " + numEmpresa);
11 | //log.warn("----------------------numProcesso: " + numProcesso);
12 | //log.warn("----------------------numThread: " + numThread);
13 | //log.warn("----------------------numAtividade: " + numAtividade);
14 | //log.warn("----------------------colleagueId: " + colleagueId);
15 |
16 | if(numAtividade == 26 && hAPI.getCardValue("nec_adiant") == "sim" ){
17 | var userList = new java.util.ArrayList();
18 | userList.add(hAPI.getCardValue("matricula_user"));
19 |
20 | var hpForm = new java.util.HashMap();
21 |
22 | hpForm.put("data_prazo", hAPI.getCardValue("dtprazoativ_retorno"));
23 | hpForm.put("origem_desp", "sol_viagem");
24 | hpForm.put("moeda", hAPI.getCardValue("moeda"));
25 | hpForm.put("vl_prestacao", hAPI.getCardValue("vl_fornec"));
26 | hpForm.put("prenchimento", "resp");
27 |
28 | hpForm.put("matricula_user", hAPI.getCardValue("matricula_user"));
29 | hpForm.put("nome_resp", hAPI.getCardValue("solicitante"));
30 |
31 | hpForm.put("matricula_solic", hAPI.getCardValue("matricula_user"));
32 | hpForm.put("user_solic", hAPI.getCardValue("solicitante"));
33 |
34 | hpForm.put("desc_emissao", "RDV iniciado automaticamente pela Solicitação de Viagem nr.: " + numProcesso);
35 |
36 | hpForm.put("cpf_cnpj", hAPI.getCardValue("cpf_cnpj"));
37 | hpForm.put("banco", hAPI.getCardValue("banco"));
38 | hpForm.put("agencia", hAPI.getCardValue("agencia"));
39 | hpForm.put("conta_cor", hAPI.getCardValue("conta_cor"));
40 |
41 | var resposta = hAPI.startProcess("RDV", 75, userList, "Iniciado pela solicitação de viagem nr.: " + numProcesso, false, hpForm, true);
42 | hAPI.setCardValue("desc_entregue", hAPI.getCardValue("desc_entregue") + "\n\nIniciado processo de RDV nr.: " + resposta.get("iProcess"));
43 | }
44 |
45 |
46 | }
--------------------------------------------------------------------------------
/workflow/scripts/RDV.afterStateEntry.js:
--------------------------------------------------------------------------------
1 | function afterStateEntry(sequenceId){
2 |
3 | var numEmpresa = getValue("WKCompany");
4 | var numProcesso = getValue("WKNumProces");
5 | var numAtividade = sequenceId;
6 | var numThread = hAPI.getActualThread(numEmpresa, numProcesso, numAtividade);
7 | var colleagueId = getValue("WKUser");
8 |
9 | log.info("----------------------AFTER STATE ENTRY 2 update-------------------------------")
10 | log.info("----------------------numEmpresa: " + numEmpresa);
11 | log.info("----------------------numProcesso: " + numProcesso);
12 | log.info("----------------------numThread: " + numThread);
13 | log.info("----------------------numAtividade: " + numAtividade);
14 | log.info("----------------------colleagueId: " + colleagueId);
15 |
16 |
17 | if(numAtividade == 5){ //implementar plano e ação
18 | var data = new Date();
19 |
20 | var prazo = hAPI.getCardValue("data_prazo");
21 |
22 | if (prazo != ''){
23 | var dt_planejada;
24 | if (prazo.indexOf("-") > 0){
25 | dt_planejada = new java.lang.String(prazo).split("-");
26 | log.info("----------------------DIA: " + dt_planejada[2]);
27 | log.info("----------------------MES: " + (dt_planejada[1] - 1));
28 | log.info("----------------------ANO: " + dt_planejada[0]);
29 | //seta o dia, mês (Janeiro é 0) e ano
30 | data.setDate(dt_planejada[2]);
31 | data.setMonth(dt_planejada[1] - 1);
32 | data.setFullYear(dt_planejada[0]);
33 | log.info("----------------------DATA: " + data);
34 | } else{
35 | dt_planejada = new java.lang.String(prazo).split("/");
36 | log.info("----------------------DIA: " + dt_planejada[0]);
37 | log.info("----------------------MES: " + (dt_planejada[1] - 1));
38 | log.info("----------------------ANO: " + dt_planejada[2]);
39 | //seta o dia, mês (Janeiro é 0) e ano
40 | data.setDate(dt_planejada[0]);
41 | data.setMonth(dt_planejada[1] - 1);
42 | data.setFullYear(dt_planejada[2]);
43 | log.info("----------------------DATA: " + data);
44 | }
45 |
46 | var obj = hAPI.calculateDeadLineTime(data, 28800, 960, "Default");
47 | var dt = obj[0];
48 | var segundos = obj[1];
49 |
50 | hAPI.setDueDate(numProcesso, numThread, colleagueId, dt, 28800);
51 |
52 |
53 |
54 | }
55 | }
56 | }
--------------------------------------------------------------------------------
/datasets/cadastro_produtos.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | //Cria as colunas do dataset
4 | var dataset = DatasetBuilder.newDataset();
5 | dataset.addColumn("produtos");
6 |
7 | //nome do dataset do Formulario
8 | var datasetDoFormulario = "cadastro_de_produtos";
9 |
10 | //nome da tabela do formulario
11 | var tablename = "tb_produtos";
12 |
13 | //Cria a constraint para buscar os formulários ativos
14 | var cst = DatasetFactory.createConstraint("metadata#active", true, true, ConstraintType.MUST);
15 | var constraints = new Array(cst);
16 |
17 | var datasetPrincipal = DatasetFactory.getDataset(datasetDoFormulario, null, constraints, null);
18 |
19 | var filhos = new Array();
20 | var count = 0;
21 |
22 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
23 |
24 | //encontrar documento e versão atual
25 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
26 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
27 |
28 | //Cria as constraints para buscar os campos filhos, passando o tablename, número da formulário e versão
29 | var c1 = DatasetFactory.createConstraint("tablename", tablename ,tablename, ConstraintType.MUST);
30 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId, documentId, ConstraintType.MUST);
31 | var c3 = DatasetFactory.createConstraint("metadata#version", documentVersion, documentVersion, ConstraintType.MUST);
32 | var constraintsFilhos = new Array(c1, c2, c3);
33 |
34 | var datasetFilhos = DatasetFactory.getDataset(datasetDoFormulario, null, constraintsFilhos, new Array("produtos"));
35 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
36 | filhos[count] = {Produto: datasetFilhos.getValue(j, "produtos")};
37 | count++;
38 | }
39 | }
40 |
41 |
42 | //Faz a ordenação
43 | filhos.sort(compare);
44 |
45 | //Depois de realizar a ordenação, adicionar os registros no dataset para serem apresentados
46 | filhos.forEach(function(filho) {
47 | dataset.addRow( new Array(filho.Produto));
48 | //log.warn("================filho.Produto: " + filho.Produto);
49 | });
50 |
51 |
52 |
53 | return dataset;
54 | }
55 |
56 | function compare(a,b) {
57 | if (a.Produto < b.Produto) return -1;
58 | if (a.Produto > b.Produto) return 1;
59 | return 0;
60 | }
--------------------------------------------------------------------------------
/datasets/unidades_de_negocio.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | //Cria as colunas do dataset
4 | var dataset = DatasetBuilder.newDataset();
5 | dataset.addColumn("Unidade_de_negocio");
6 |
7 | //nome do dataset do Formulario
8 | var datasetDoFormulario = "cadastro_de_uni_negocio";
9 |
10 | //nome da tabela do formulario
11 | var tablename = "tb_uni-negocio";
12 |
13 | //Cria a constraint para buscar os formulários ativos
14 | var cst = DatasetFactory.createConstraint("metadata#active", true, true, ConstraintType.MUST);
15 | var constraints = new Array(cst);
16 |
17 | var datasetPrincipal = DatasetFactory.getDataset(datasetDoFormulario, null, constraints, null);
18 |
19 | var filhos = new Array();
20 | var count = 0;
21 |
22 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
23 |
24 | //encontrar documento e versão atual
25 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
26 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
27 |
28 | //Cria as constraints para buscar os campos filhos, passando o tablename, número da formulário e versão
29 | var c1 = DatasetFactory.createConstraint("tablename", tablename ,tablename, ConstraintType.MUST);
30 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId, documentId, ConstraintType.MUST);
31 | var c3 = DatasetFactory.createConstraint("metadata#version", documentVersion, documentVersion, ConstraintType.MUST);
32 | var constraintsFilhos = new Array(c1, c2, c3);
33 |
34 | var datasetFilhos = DatasetFactory.getDataset(datasetDoFormulario, null, constraintsFilhos, new Array("uni_negocio"));
35 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
36 |
37 | filhos[count] = {uni_negocio: datasetFilhos.getValue(j, "uni_negocio")};
38 | count++;
39 |
40 | }
41 | }
42 |
43 | //Faz a ordenação
44 | filhos.sort(compare);
45 |
46 | //Depois de realizar a ordenação, adicionar os registros no dataset para serem apresentados
47 | filhos.forEach(function(filho) {
48 | dataset.addRow( new Array(filho.uni_negocio));
49 | //log.warn("================filho.uni_negocio: " + filho.uni_negocio);
50 | });
51 |
52 | return dataset;
53 |
54 | }
55 |
56 | function compare(a,b) {
57 | if (a.uni_negocio < b.uni_negocio) return -1;
58 | if (a.uni_negocio > b.uni_negocio) return 1;
59 | return 0;
60 | }
--------------------------------------------------------------------------------
/forms/1387 - FP - Ficha de Pendencia - Subfluxo/FP-subfluxo.js:
--------------------------------------------------------------------------------
1 | var row;
2 |
3 | $(function(ready){
4 |
5 | $("#vl_conserto").number( true, 2, ',' ,'.', 'R$ ')
6 |
7 |
8 |
9 | });
10 |
11 | //prencimento e ativação dos campos
12 | function ativaPreencheCampos(modeView, numState, matricula, WKNumProces, documentId) {
13 |
14 | blockAll();
15 |
16 | if(modeView == "ADD" || modeView == "MOD"){
17 |
18 | var filter = new Object();
19 | filter["colleaguePK.colleagueId"] = matricula;
20 | var colaborador = getDatasetValues('colleague', filter);
21 |
22 | var usuario = colaborador[0].colleagueName;
23 | var ramal = colaborador[0].extensionNr;
24 |
25 | var data = getData();
26 | var hora = getHora();
27 |
28 |
29 |
30 | if (numState == 5){
31 | $("#num_processo").val(WKNumProces);
32 | $("#data_sol").val(data);
33 | $("#hora_sol").val(hora);
34 |
35 | $("#matricula_emissor").val(matricula);
36 | $("#user_emissor").val(usuario);
37 | $("#data_emissor").val(data);
38 |
39 |
40 | $("#def_inf").css('pointer-events', 'all');
41 | $("#def_const").css('pointer-events', 'all');
42 | $("#serv_envio").css('pointer-events', 'all');
43 | $("#vl_conserto").css('pointer-events', 'all');
44 |
45 | }
46 |
47 |
48 | }
49 | }
50 |
51 | //bloquear todas os campos
52 | function blockAll(){
53 | $('.panel').each(function(i) {
54 | if ($(this).attr('id') != null){
55 | $(this).css('pointer-events', 'none');
56 | }
57 | });
58 | }
59 |
60 |
61 |
62 | //validação dos campos
63 | var beforeSendValidate = function(numState){
64 | var message = "";
65 |
66 | if($("#process_pai").val() == "") throw("Este processo só pode ser iniciado automaticamente por uma Ficha de Pendencia");
67 |
68 | if (numState == 5){
69 | if ($("#def_inf").val() == "") message += "Defeito informado";
70 | if ($("#def_const").val() == "") message += "Defeito constatado";
71 | if ($("#serv_envio").val() == "") message += "Serviço executado";
72 | if ($("#vl_conserto").val() == "") message += "Valor do conserto";
73 | }
74 |
75 |
76 | if (message != ""){
77 | message = "Os campos abaixo são de preencimento obrigatorio:" + message;
78 | throw(message);
79 | }
80 |
81 | }
82 | var beforeMovementOptions = beforeSendValidate;
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/workflow/scripts/FP-FichaDePendencia.intermediateconditional9.js:
--------------------------------------------------------------------------------
1 | function intermediateconditional9() {
2 |
3 | var process = getValue("WKNumProces");
4 |
5 | //log.warn("----------------------STATUS DE PROCESSOS-------------------------------")
6 | //log.warn("----------------------numProcesso: " + process);
7 |
8 |
9 | var status = true;
10 |
11 | var cardData = new java.util.HashMap();
12 | cardData = hAPI.getCardData(process);
13 | var keys = cardData.keySet().toArray();
14 | //log.warn("Verificando status dos subprocessos do processo: " + process);
15 | for ( var key in keys) {
16 | var field = keys[key];
17 | if (field.indexOf("nr_item___") > -1) {
18 |
19 | var row = field.replace("nr_item___", "");
20 | var processo = hAPI.getCardValue("fluxo_fp___" + row);
21 |
22 | var c1 = DatasetFactory.createConstraint("processTaskPK.processInstanceId", processo, processo, ConstraintType.MUST);
23 | var c2 = DatasetFactory.createConstraint("processTaskPK.companyId", getValue("WKCompany"), getValue("WKCompany"), ConstraintType.MUST);
24 | var constraints = new Array(c1, c2);
25 |
26 | var sortingFields = new Array("processTaskPK.movementSequence");
27 |
28 | var datasetPrincipal = DatasetFactory.getDataset("processTask", null, constraints, sortingFields);
29 |
30 | var i = datasetPrincipal.rowsCount - 1;
31 |
32 | if (datasetPrincipal.getValue(i, "active") == true){
33 | var childCardData = hAPI.getCardData(processo);
34 | hAPI.setCardValue("status_fp___" + row, "Em andamento");
35 | status = false;
36 |
37 | } else if(datasetPrincipal.getValue(i, "status") == 4){
38 | hAPI.setCardValue("status_fp___" + row, "Cancelado");
39 | //log.warn("O Processo " + processo + " foi cancelado");
40 | } else {
41 | var cardDataFilho = hAPI.getCardData(processo);
42 |
43 | hAPI.setCardValue("vl_conserto___" + row, cardDataFilho.get("vl_conserto"));
44 | hAPI.setCardValue("def_inf___" + row, cardDataFilho.get("def_inf"));
45 | hAPI.setCardValue("def_const___" + row, cardDataFilho.get("def_const"));
46 | hAPI.setCardValue("serv_envio___" + row, cardDataFilho.get("serv_envio"));
47 | hAPI.setCardValue("status_fp___" + row, datasetPrincipal.getValue(i, "taskCompletionDate"));
48 | //log.warn("O Processo " + processo + " foi concluído");
49 | }
50 | }
51 | }
52 |
53 | return status;
54 |
55 | }
--------------------------------------------------------------------------------
/datasets/criticidade.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | // Cria as colunas do dataset
4 | var dataset = DatasetBuilder.newDataset();
5 | dataset.addColumn("Criticidade");
6 | dataset.addColumn("Prazo");
7 |
8 | // nome do dataset do Formulario
9 | var datasetDoFormulario = "criticidade_de_chamados";
10 |
11 | // nome da tabela do formulario
12 | var tablename = "tb_classe";
13 |
14 | // Cria a constraint para buscar os formulários ativos
15 | var cst = DatasetFactory.createConstraint("metadata#active", true, true,
16 | ConstraintType.MUST);
17 | var constraints = new Array(cst);
18 |
19 | var datasetPrincipal = DatasetFactory.getDataset(datasetDoFormulario, null,
20 | constraints, null);
21 |
22 | var filhos = new Array();
23 | var count = 0;
24 |
25 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
26 |
27 | // encontrar documento e versão atual
28 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
29 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
30 |
31 | // Cria as constraints para buscar os campos filhos, passando o
32 | // tablename, número da formulário e versão
33 | var c1 = DatasetFactory.createConstraint("tablename", tablename,
34 | tablename, ConstraintType.MUST);
35 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId,
36 | documentId, ConstraintType.MUST);
37 | var c3 = DatasetFactory.createConstraint("metadata#version",
38 | documentVersion, documentVersion, ConstraintType.MUST);
39 | var constraintsFilhos = new Array(c1, c2, c3);
40 |
41 | var datasetFilhos = DatasetFactory.getDataset(datasetDoFormulario,
42 | null, constraintsFilhos, new Array("tipo", "classe"));
43 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
44 | filhos[count] = {
45 | criticidade : datasetFilhos.getValue(j, "criticidade"),
46 | prazo : datasetFilhos.getValue(j, "prazo")
47 | };
48 | count++;
49 |
50 | }
51 | }
52 |
53 | // Faz a ordenação
54 | filhos.sort(compare);
55 |
56 | // Depois de realizar a ordenação, adicionar os registros no dataset para
57 | // serem apresentados
58 | filhos.forEach(function(filho) {
59 | //log.warn(filho.Classe);
60 | dataset.addRow(new Array(filho.criticidade, filho.prazo));
61 | });
62 |
63 | return dataset;
64 | }
65 |
66 | function compare(a, b) {
67 |
68 | if (a.criticidade < b.criticidade)
69 | return -1;
70 | if (a.criticidade > b.criticidade)
71 | return 1;
72 |
73 | return 0;
74 | }
--------------------------------------------------------------------------------
/workflow/scripts/SMC - Solicitação de melhoria continua.intermediateconditional14.js:
--------------------------------------------------------------------------------
1 | function intermediateconditional14() {
2 |
3 |
4 | var process = getValue("WKNumProces");
5 |
6 | //log.warn("----------------------STATUS DE PROCESSOS-------------------------------")
7 | //log.warn("----------------------numProcesso: " + process);
8 |
9 |
10 | var status = true;
11 |
12 | var cardData = new java.util.HashMap();
13 | cardData = hAPI.getCardData(process);
14 | var keys = cardData.keySet().toArray();
15 | //log.warn("Verificando status dos subprocessos do processo: " + process);
16 | for ( var key in keys) {
17 | var field = keys[key];
18 | if (field.indexOf("fluxo_acoes___") > -1) {
19 |
20 | var row = field.replace("fluxo_acoes___", "");
21 | var processo = hAPI.getCardValue("fluxo_acoes___" + row);
22 |
23 | var c1 = DatasetFactory.createConstraint("processTaskPK.processInstanceId", processo, processo, ConstraintType.MUST);
24 | var c2 = DatasetFactory.createConstraint("processTaskPK.companyId", getValue("WKCompany"), getValue("WKCompany"), ConstraintType.MUST);
25 | var constraints = new Array(c1, c2);
26 |
27 | var sortingFields = new Array("processTaskPK.movementSequence");
28 |
29 | var datasetPrincipal = DatasetFactory.getDataset("processTask", null, constraints, sortingFields);
30 |
31 | var i = datasetPrincipal.rowsCount - 1;
32 |
33 | if (datasetPrincipal.getValue(i, "active") == true){
34 |
35 | var childCardData = hAPI.getCardData(processo);
36 | hAPI.setCardValue("dtprazoativ_acoes___" + row, childCardData.get("prazo_conclusao"));
37 |
38 | var dataStr = hAPI.getCardValue("dtprazoativ_acoes___" + row).split("/");
39 | var dataPrevista = new Date();
40 | dataPrevista.setDate(dataStr[0]);
41 | dataPrevista.setMonth(dataStr[1] - 1);
42 | dataPrevista.setFullYear(dataStr[2]);
43 |
44 | if (new Date() > dataPrevista) {
45 | hAPI.setCardValue("status_acoes___" + row, "Em atraso");
46 | //log.warn("O Processo " + processo + " ainda esta em atraso");
47 | }
48 | else {
49 | hAPI.setCardValue("status_acoes___" + row, "Em andamento");
50 | //log.warn("O Processo " + processo + " ainda esta em aberto");
51 | }
52 | status = false;
53 |
54 | } else if(datasetPrincipal.getValue(i, "status") == 4){
55 | hAPI.setCardValue("status_acoes___" + row, "Cancelado");
56 | //log.warn("O Processo " + processo + " foi cancelado");
57 | } else {
58 | hAPI.setCardValue("status_acoes___" + row, datasetPrincipal.getValue(i, "taskCompletionDate"));
59 | //log.warn("O Processo " + processo + " foi concluído");
60 | }
61 | }
62 | }
63 |
64 | return status;
65 |
66 |
67 |
68 | }
--------------------------------------------------------------------------------
/exemplo_dataset_direto_banco_ecm.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | var newDataset = DatasetBuilder.newDataset();
4 |
5 | var minhaQuery = "select * from PROCES_WORKFLOW";
6 | //log.warn("QUERY: " + minhaQuery);
7 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>PASSO 01");
8 | var dataSource = "/jdbc/FluigDS";
9 | var ic = new javax.naming.InitialContext();
10 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>PASSO 02");
11 | //log.warn("ic: " + ic);
12 | var ds = ic.lookup(dataSource);
13 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>PASSO 03");
14 | //log.warn("ds: " + ds);
15 | var created = false;
16 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>PASSO 04");
17 | try {
18 | var conn = ds.getConnection();
19 | //log.warn("conn: " + conn);
20 | var stmt = conn.createStatement();
21 | //log.warn("stmt: " + stmt);
22 | var rs = stmt.executeQuery(minhaQuery);
23 | var columnCount = rs.getMetaData().getColumnCount();
24 | while (rs.next()) {
25 | if (!created) {
26 | for (var i = 1; i <= columnCount; i++) {
27 | newDataset.addColumn(rs.getMetaData().getColumnName(i));
28 | }
29 | created = true;
30 | }
31 | var Arr = new Array();
32 | for (var i = 1; i <= columnCount; i++) {
33 | var obj = rs.getObject(rs.getMetaData().getColumnName(i));
34 | if (null != obj) {
35 | Arr[i - 1] = rs.getObject(rs.getMetaData().getColumnName(i)).toString();
36 | //log.warn(rs.getObject(rs.getMetaData().getColumnName(i)).toString());
37 | } else {
38 | Arr[i - 1] = "null";
39 | }
40 | }
41 | newDataset.addRow(Arr);
42 | }
43 | } catch (e) {
44 | //log.error("DATASET_SQL_ERRO==============> " + e.message);
45 | } finally {
46 | if (stmt != null)
47 | stmt.close();
48 | if (conn != null)
49 | conn.close();
50 | }
51 |
52 | if (constraints != null) {
53 | for (var i = 0; i < constraints.length; i++) {
54 |
55 | newDataset = newDataset.getSubDataset(constraints[i].fieldName, constraints[i].initialValue);
56 |
57 | }
58 | }
59 |
60 | return newDataset;
61 |
62 | }
--------------------------------------------------------------------------------
/datasets/ncmIBPT.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | var ncm, uf;
4 | if (constraints != null) {
5 | for (var i = 0; i < constraints.length; i++) {
6 | if (constraints[i].fieldName == 'ncm' ) ncm = String(constraints[i].initialValue);
7 | if (constraints[i].fieldName == 'uf' ) uf = String(constraints[i].initialValue);
8 |
9 | }
10 | }
11 | if (ncm == null){
12 | ncm = "84369100";
13 | uf = "RJ"
14 | }
15 |
16 | //log.warn("--------------------fasfasdfas----------------------------------------------------------------------------------------");
17 |
18 |
19 | var dadosValidacao = DatasetFactory.getDataset('tokens', null, null, null);
20 |
21 | var url = "/api/deolhonoimposto/Produtos?" +
22 | "token=" + dadosValidacao.getValue(0, "tokenIBPT") +
23 | "&cnpj=" + dadosValidacao.getValue(0, "cnpjCASP") +
24 | "&codigo=" + ncm +
25 | "&uf=" + uf +
26 | "&ex=0";
27 |
28 | //log.warn("--------------------CONSULTA NCM---------------------------------------------------------------");
29 |
30 | var dataset = DatasetBuilder.newDataset();
31 | dataset.addColumn('STATUS');
32 | dataset.addColumn('message');
33 | dataset.addColumn('retorno');
34 |
35 | //log.warn("urL: " + url);
36 |
37 | try{
38 | var clientService = fluigAPI.getAuthorizeClientService();
39 | var data = {
40 | serviceCode : 'IBPT',
41 | endpoint : url,
42 | method : 'get'
43 | }
44 |
45 | var vo = clientService.invoke(JSON.stringify(data));
46 | var result = vo.getResult();
47 |
48 |
49 |
50 | if(result == null || result.isEmpty()){
51 | dataset.addRow(new Array("NOK", "Erro ao comunicar ao consultar o IBPT", data));
52 | //log.warn("NOT FOUND: " + data);
53 | }else if (result.indexOf("Produto não encontrado") !=-1){
54 | dataset.addRow(new Array("NOK", "Produto não encontrado", result));
55 | //log.warn("Não Encontrado: " + result);
56 | }else{
57 | try{
58 | var objdata = JSON.parse(result);
59 | for (var obj in objdata){
60 | dataset.addColumn(obj.toString());
61 | };
62 | var array = new Array();
63 | array[0] = "OK";
64 | array[1] = "Consulta OK";
65 | array[2] = result;
66 | var i = 3;
67 | for (var obj in objdata){
68 | //log.warn(obj + " - " + objdata[obj]);
69 | array[i] = objdata[obj].toString();
70 | i++;
71 | };
72 | dataset.addRow(array);
73 | } catch (e) {
74 | dataset.addRow(new Array("NOK", e.toString(), result));
75 | //log.warn("JSON PARSE: " + result);
76 | }
77 | }
78 | } catch (e) {
79 | dataset.addRow(new Array("NOK", e.toString(), vo));
80 | //log.warn("Client Service: " + vo);
81 | }
82 |
83 |
84 | return dataset;
85 |
86 | }
--------------------------------------------------------------------------------
/workflow/scripts/RNC.intermediateconditional10.js:
--------------------------------------------------------------------------------
1 | function intermediateconditional10() {
2 |
3 | var process = getValue("WKNumProces");
4 |
5 | //log.warn("----------------------STATUS DE PROCESSOS-------------------------------")
6 | //log.warn("----------------------numProcesso: " + process);
7 |
8 |
9 | var status = true;
10 |
11 | try {
12 | var cardData = new java.util.HashMap();
13 | cardData = hAPI.getCardData(process);
14 | var keys = cardData.keySet().toArray();
15 | //log.warn("Verificando status dos subprocessos do processo: " + process);
16 | for ( var key in keys) {
17 | var field = keys[key];
18 | if (field.indexOf("fluxo_emer___") > -1) {
19 |
20 | var row = field.replace("fluxo_emer___", "");
21 | var processo = hAPI.getCardValue("fluxo_emer___" + row);
22 |
23 | var c1 = DatasetFactory.createConstraint("processTaskPK.processInstanceId", processo, processo, ConstraintType.MUST);
24 | var c2 = DatasetFactory.createConstraint("processTaskPK.companyId", getValue("WKCompany"), getValue("WKCompany"), ConstraintType.MUST);
25 | var constraints = new Array(c1, c2);
26 |
27 | var sortingFields = new Array("processTaskPK.movementSequence");
28 |
29 | var datasetPrincipal = DatasetFactory.getDataset("processTask", null, constraints, sortingFields);
30 |
31 | var i = datasetPrincipal.rowsCount - 1;
32 |
33 | if (datasetPrincipal.getValue(i, "active") == true){
34 |
35 | var childCardData = hAPI.getCardData(processo);
36 | hAPI.setCardValue("dtprazoativ_emer___" + row, childCardData.get("prazo_conclusao"));
37 |
38 | var dataStr = hAPI.getCardValue("dtprazoativ_emer___" + row).split("/");
39 | var dataPrevista = new Date();
40 | dataPrevista.setDate(dataStr[0]);
41 | dataPrevista.setMonth(dataStr[1] - 1);
42 | dataPrevista.setFullYear(dataStr[2]);
43 |
44 | if (new Date() > dataPrevista) {
45 | hAPI.setCardValue("status_emer___" + row, "Em atraso");
46 | //log.warn("O Processo " + processo + " ainda esta em atraso");
47 | }
48 | else {
49 | hAPI.setCardValue("status_emer___" + row, "Em andamento");
50 | //log.warn("O Processo " + processo + " ainda esta em aberto");
51 | }
52 | status = false;
53 |
54 | } else if(datasetPrincipal.getValue(i, "status") == 4){
55 | hAPI.setCardValue("status_emer___" + row, "Cancelado");
56 | //log.warn("O Processo " + processo + " foi cancelado");
57 | } else {
58 | hAPI.setCardValue("status_emer___" + row, datasetPrincipal.getValue(i, "taskCompletionDate"));
59 | //log.warn("O Processo " + processo + " foi concluído");
60 | }
61 | }
62 | }
63 |
64 | } catch (e) {
65 | //log.error("----------------ERRO:");
66 | //log.error(e);
67 | }
68 | return status;
69 | }
--------------------------------------------------------------------------------
/workflow/scripts/RNC.intermediateconditional16.js:
--------------------------------------------------------------------------------
1 | function intermediateconditional16() {
2 |
3 | var process = getValue("WKNumProces");
4 |
5 | //log.warn("----------------------STATUS DE PROCESSOS-------------------------------")
6 | //log.warn("----------------------numProcesso: " + process);
7 |
8 |
9 | var status = true;
10 |
11 | try {
12 | var cardData = new java.util.HashMap();
13 | cardData = hAPI.getCardData(process);
14 | var keys = cardData.keySet().toArray();
15 | //log.warn("Verificando status dos subprocessos do processo: " + process);
16 | for ( var key in keys) {
17 | var field = keys[key];
18 | if (field.indexOf("fluxo_corr___") > -1) {
19 |
20 | var row = field.replace("fluxo_corr___", "");
21 | var processo = hAPI.getCardValue("fluxo_corr___" + row);
22 |
23 | var c1 = DatasetFactory.createConstraint("processTaskPK.processInstanceId", processo, processo, ConstraintType.MUST);
24 | var c2 = DatasetFactory.createConstraint("processTaskPK.companyId", getValue("WKCompany"), getValue("WKCompany"), ConstraintType.MUST);
25 | var constraints = new Array(c1, c2);
26 |
27 | var sortingFields = new Array("processTaskPK.movementSequence");
28 |
29 | var datasetPrincipal = DatasetFactory.getDataset("processTask", null, constraints, sortingFields);
30 |
31 | var i = datasetPrincipal.rowsCount - 1;
32 |
33 | if (datasetPrincipal.getValue(i, "active") == true){
34 |
35 | var childCardData = hAPI.getCardData(processo);
36 | hAPI.setCardValue("dtprazoativ_corr___" + row, childCardData.get("prazo_conclusao"));
37 |
38 | var dataStr = hAPI.getCardValue("dtprazoativ_corr___" + row).split("/");
39 | var dataPrevista = new Date();
40 | dataPrevista.setDate(dataStr[0]);
41 | dataPrevista.setMonth(dataStr[1] - 1);
42 | dataPrevista.setFullYear(dataStr[2]);
43 |
44 | if (new Date() > dataPrevista) {
45 | hAPI.setCardValue("status_corr___" + row, "Em atraso");
46 | //log.warn("O Processo " + processo + " ainda esta em atraso");
47 | }
48 | else {
49 | hAPI.setCardValue("status_corr___" + row, "Em andamento");
50 | //log.warn("O Processo " + processo + " ainda esta em aberto");
51 | }
52 | status = false;
53 |
54 | } else if(datasetPrincipal.getValue(i, "status") == 4){
55 | hAPI.setCardValue("status_corr___" + row, "Cancelado");
56 | //log.warn("O Processo " + processo + " foi cancelado");
57 | } else {
58 | hAPI.setCardValue("status_corr___" + row, datasetPrincipal.getValue(i, "taskCompletionDate"));
59 | //log.warn("O Processo " + processo + " foi concluído");
60 | }
61 | }
62 | }
63 |
64 | } catch (e) {
65 | //log.error("----------------ERRO:");
66 | //log.error(e);
67 | }
68 | return status;
69 |
70 | }
--------------------------------------------------------------------------------
/datasets/cadastro_servicos.js:
--------------------------------------------------------------------------------
1 | function createDataset(fields, constraints, sortFields) {
2 |
3 | //Cria as colunas do dataset
4 | var dataset = DatasetBuilder.newDataset();
5 | var datasetDoFormulario = "cadastro_de_servicos";
6 | var tablename = "tb_servicos";
7 | var created = false;
8 |
9 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO1");
10 |
11 | var datasetPrincipal = DatasetFactory.getDataset(datasetDoFormulario, null, [DatasetFactory.createConstraint("metadata#active", true, true, ConstraintType.MUST)], null);
12 | for (var i = 0; i < datasetPrincipal.rowsCount; i++) {
13 | //encontrar documento e versão atual
14 | var documentId = datasetPrincipal.getValue(i, "metadata#id");
15 | var documentVersion = datasetPrincipal.getValue(i, "metadata#version");
16 |
17 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO2");
18 | //Cria as constraints para buscar os campos filhos, passando o tablename, número da formulário e versão
19 | var c1 = DatasetFactory.createConstraint("tablename", tablename ,tablename, ConstraintType.MUST);
20 | var c2 = DatasetFactory.createConstraint("metadata#id", documentId, documentId, ConstraintType.MUST);
21 | var c3 = DatasetFactory.createConstraint("metadata#version", documentVersion, documentVersion, ConstraintType.MUST);
22 | var constraintFilho = [c1, c2, c3];
23 |
24 | var datasetFilhos = DatasetFactory.getDataset(datasetDoFormulario, null, constraintFilho, null);
25 |
26 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO4");
27 | for (var j = 0; j < datasetFilhos.rowsCount; j++) {
28 | var filtro = false;
29 | for (constr in constraints){
30 | if (constraints[constr].fieldName == "sqlLimit") continue;
31 | var ini = constraints[constr].initialValue;
32 | var fim = constraints[constr].finalValue;
33 | var aux = datasetFilhos.getValue(j, '' + constraints[constr].fieldName);
34 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO4 " + ini);
35 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO4 " + fim);
36 | //log.warn(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>PASSO4 " + aux);
37 | if (aux < ini || aux > fim){
38 | filtro = true;
39 | continue ;
40 | }
41 | }
42 | if (filtro) continue ;
43 | var array = [];
44 | if (fields == null)
45 | for(var k = 0; k < datasetFilhos.getColumnsCount();k++){
46 | if (!created) dataset.addColumn(datasetFilhos.getColumnName(k));
47 | array[k] = datasetFilhos.getValue(j,k);
48 | }
49 | else for (field in fields){
50 | if (!created) dataset.addColumn(fields[field]);
51 | array[field] = datasetFilhos.getValue(j, fields[field]);
52 | }
53 | created = true;
54 | dataset.addRow(array);
55 | }
56 | }
57 |
58 | return dataset;
59 |
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/forms/1645 - SMC - Cadastro de Ganhos/tipos_ganhos.html:
--------------------------------------------------------------------------------
1 |
2 |