Grupo Serval - EC - Espaço do Colaborador (2023)

Grupo Serval - EC - Espaço do Colaborador (1)

Entre com seus dados de acesso.

Não possui acesso? Clique aqui.
Esqueceu sua senha? Clique aqui.
Ajuda

Grupo Serval - Copyright © 2022 Todos os direitos reservados.


Grupo Serval - EC - Espaço do Colaborador (2)

Grupo Serval - EC - Espaço do Colaborador (3)

\n" + "

\n" + "

\n" + "Nome *\n" + "

\n" + "\n" + "


\n" + "

\n" + "Ativo\n" + "

\n" + "\n" + "\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { nome = $('#form_list_nome').val(); ativo = $('#form_list_ativo').val(); if (nome.length <= 0) { bootbox.alert('

Nome não informado!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setListPosto', table: table, id: id, nome: nome, ativo: ativo, }, success: function (res) { if (res.sucesso === 1) { bootbox.alert({ message: "
Registro gravado com sucesso!", callback: function () { getListAjax('getListPosto', '/tela/uteis/ajax-action.php', list_name, 'table', table, 1, 0); } }); } else { bootbox.alert('Erro' + res.erro); } } }); } } }); return false; } function setTurnos(id) { var nome = ''; var ativo = 1; if (id > 0) { nome = document.getElementById('turnos-nome-' + id).innerHTML; ativo = (document.getElementById('turnos-ativo-' + id).innerHTML === 'Ativo' ? 1 : 0); } bootbox.confirm({ message: "
" + "

\n" + (id === 0 ? 'Novo(a) - ' : 'Alterar - ') + "Turno

\n" + "

\n" + "

\n" + "Nome *\n" + "

\n" + "\n" + "


\n" + "

\n" + "Ativo\n" + "

\n" + "\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { nome = $('#form_list_nome').val(); ativo = $('#form_list_ativo').is(":checked") ? 1 : 0; if (nome.length <= 0) { bootbox.alert('

Nome não informado!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setListPosto', table: 'turnos', id: id, nome: nome, ativo: ativo, }, success: function (res) { if (res.sucesso === 1) { bootbox.alert({ message: "
Registro gravado com sucesso!", callback: function () { window.location.href = "/tela/cadastros/index.php?a=5"; } }); } else { bootbox.alert('Erro' + res.erro); } } }); } } }); return false; } function setListSaveGradeSupervisor(id) { var nome = ''; var estado = ''; var email = ''; var ativo = 1; if (id > 0) { nome = document.getElementById('supervisores-nome-' + id).innerHTML; estado = document.getElementById('supervisores-estado-' + id).innerHTML; email = document.getElementById('supervisores-email-' + id).innerHTML; ativo = (document.getElementById('supervisores-ativo-' + id).innerHTML === 'Ativo' ? 1 : 0); } var estados = [ 'AC', 'AL', 'AM', 'AP', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MG', 'MS', 'MT', 'PA', 'PB', 'PE', 'PI', 'PR', 'RJ', 'RN', 'RO', 'RR', 'RS', 'SC', 'SE', 'SP', 'TO', 'XX' ]; var estados_options = ''; estados.forEach(function (item, indice, array) { estados_options += ''; }); bootbox.confirm({ message: "
" + "

\n" + (id === 0 ? 'Novo(a) - ' : 'Alterar - ') + "Supervisor

\n" + "

\n" + "

\n" + "Nome *\n" + "

\n" + "\n" + "


\n" + "

\n" + "

\n" + "Email *\n" + "

\n" + "\n" + "

(Video) 3 PERGUNTAS QUE TE REPROVAM NAS ENTREVISTAS DE EMPREGO E PROCESSOS SELETIVOS!

\n" + "

\n" + "

\n" + "Estado *\n" + "

\n" + "\n" + "


\n" + "

\n" + "Ativo\n" + "

\n" + "\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { nome = $('#form_list_nome').val(); email = $('#form_list_email').val(); estado = $('#form_list_estado').val(); ativo = $('#form_list_ativo').is(":checked") ? 1 : 0; if (nome.length <= 0 || email.length <= 0 || estado.length <= 0) { bootbox.alert('

Nome, Email ou Estado não informados!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setListPosto', table: 'supervisores', id: id, nome: nome, email: email, estado: estado, ativo: ativo, }, success: function (res) { if (res.sucesso === 1) { bootbox.alert({ message: "
Registro gravado com sucesso!", callback: function () { window.location.href = "/tela/cadastros/index.php?a=1"; } }); } else { bootbox.alert('Erro' + res.erro); } } }); } } }); return false; } function setFrequencias(id) { var nome = ''; var ativo = 1; if (id > 0) { nome = document.getElementById('frequencias-nome-' + id).innerHTML; ativo = (document.getElementById('frequencias-ativo-' + id).innerHTML === 'Ativo' ? 1 : 0); } bootbox.confirm({ message: "
" + "

\n" + (id === 0 ? 'Novo(a) - ' : 'Alterar - ') + "Frequência

\n" + "

\n" + "

\n" + "Nome *\n" + "

\n" + "\n" + "


\n" + "

\n" + "Ativo\n" + "

\n" + "\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { nome = $('#form_list_nome').val(); ativo = $('#form_list_ativo').is(":checked") ? 1 : 0; if (nome.length <= 0) { bootbox.alert('

Nome não informado!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setListPosto', table: 'frequencias', id: id, nome: nome, ativo: ativo, }, success: function (res) { if (res.sucesso === 1) { bootbox.alert({ message: "
Registro gravado com sucesso!", callback: function () { window.location.href = "/tela/cadastros/index.php?a=4"; } }); } else { bootbox.alert('Erro' + res.erro); } } }); } } }); return false; } function seMaskDate(v, campo) { //Remove tudo o que não é dígito v = v.replace(/[^\d]+/g, ''); if (v.length <= 14) { //CPF //Coloca uma barra no dia... v = v.replace(/(\d{2})(\d)/, "$1/$2"); //Coloca uma barra no mês... v = v.replace(/(\d{4})(\d)/, "$1/$2"); //Coloca uma barra no ano... v = v.replace(/(\d{6})(\d)/, "$1/$2"); } document.getElementById(campo).value = v; } function seMaskCpf(v, campo) { //Remove tudo o que não é dígito v = v.replace(/[^\d]+/g, ''); if (v.length <= 14) { //CPF //Coloca um ponto entre o terceiro e o quarto dígitos v = v.replace(/(\d{3})(\d)/, "$1.$2"); //Coloca um ponto entre o terceiro e o quarto dígitos //de novo (para o segundo bloco de números) v = v.replace(/(\d{3})(\d)/, "$1.$2"); //Coloca um hífen entre o terceiro e o quarto dígitos v = v.replace(/(\d{3})(\d{1,2})$/, "$1-$2"); } document.getElementById(campo).value = v; } function TestaCPF(cpf) { var strCPF = cpf.replace(/[^\d]+/g, ''); var Soma; var Resto; Soma = 0; if (strCPF == '00000000000' || strCPF == '11111111111' || strCPF == '22222222222' || strCPF == '33333333333' || strCPF == '44444444444' || strCPF == '55555555555' || strCPF == '66666666666' || strCPF == '77777777777' || strCPF == '88888888888' || strCPF == '99999999999') { bootbox.alert('

ErroCPF inválido, verifique.

'); return false; } for (i = 1; i <= 9; i++) Soma = Soma + parseInt(strCPF.substring(i - 1, i)) * (11 - i); Resto = (Soma * 10) % 11; if ((Resto == 10) || (Resto == 11)) Resto = 0; if (Resto != parseInt(strCPF.substring(9, 10))) { bootbox.alert('

ErroCPF inválido, verifique.

'); return false; } Soma = 0; for (i = 1; i <= 10; i++) Soma = Soma + parseInt(strCPF.substring(i - 1, i)) * (12 - i); Resto = (Soma * 10) % 11; if ((Resto == 10) || (Resto == 11)) Resto = 0; if (Resto != parseInt(strCPF.substring(10, 11))) { bootbox.alert('

ErroCPF inválido, verifique.

'); return false; } return true; } function redirection(destination) { window.location.href = destination; } function setFoto(form) { $('#modalAlterarFoto').hide(); var formData = new FormData(form); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: formData, contentType: false, cache: false, processData: false, success: function (result) { bootbox.alert({ message: result, callback: function () { location.reload(true); } }); } }); return false; } function setDeleteRepositoryFile(id, path) { if (id.length <= 0 || path.length <= 0) { return false; } bootbox.confirm({ message: "
Confirma exclusão definitiva do anexo?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: {acao: 'setDeleteRepositoryFile', id: id, path: path}, success: function (result) { bootbox.alert({ message: result, callback: function () { location.reload(true); } }); } }); } } }); } function setAba(aba) { if (document.getElementById('aba') != null) { document.getElementById('aba').value = aba; } return false; } function setEnableDisable(status, componente) { if (status != null) { document.getElementById(componente).disabled = (status.value <= 0); if ($('#' + componente).hasClass('selectpicker')) { $('#' + componente).selectpicker('refresh'); $('#' + componente).selectpicker('refresh'); $('#' + componente).selectpicker('refresh'); $('#' + componente).selectpicker('refresh'); $('#' + componente).selectpicker('refresh'); } } return false; } // ----------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------- function setDeleteRegistro(module, id) { if (module <= 0 || id <= 0) { bootbox.alert('

ErroParâmetros incorretos para exclusão do registro.

'); return false; } bootbox.confirm({ message: "
Confirma exclusão definitiva do registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=setDeleteRegistro&module=" + module + "&id=" + id, success: function (res) { bootbox.alert({ message: res.mensagem, callback: function () { if (res.erro === 0) { location.reload(true); } } }); } }); } } }); } function setDeleteRegistroCurso(id) { if (id <= 0) { bootbox.alert('

ErroParâmetros incorretos para exclusão do registro.

'); return false; } bootbox.confirm({ message: "
Confirma exclusão definitiva do registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=setDeleteRegistroCurso&id=" + id, success: function (res) { bootbox.alert({ message: res.mensagem, callback: function () { if (res.erro === 0) { location.reload(true); } } }); } }); } } }); } function setDeleteRegistroCursoTurma(id) { if (id <= 0) { bootbox.alert('

ErroParâmetros incorretos para exclusão do registro.

'); return false; } bootbox.confirm({ message: "
Confirma exclusão definitiva do registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=setDeleteRegistroCursoTurma&id=" + id, success: function (res) { bootbox.alert({ message: res.mensagem, callback: function () { if (res.erro === 0) { location.reload(true); } } }); } }); } } }); } function setCalendarioDel(id) { if (id <= 0) { bootbox.alert('

ErroParâmetros incorretos para exclusão do registro.

'); return false; } bootbox.confirm({ message: "
Confirma exclusão definitiva do registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=setCalendarioDel&id=" + id, success: function (res) { bootbox.alert({ message: res.mensagem, callback: function () { if (res.erro === 0) { location.reload(true); } } }); } }); } } }); } function getSupervisoresList(frequencia_id, selected_id) { $('#posto_id').html(""); $('#posto_id').selectpicker('refresh'); $('#supervisor_id').html(""); if (frequencia_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: {acao: 'getSupervisoresList', frequencia_id: frequencia_id, selected_id: selected_id}, success: function (result) { $('#supervisor_id').html(result); if ($('#supervisor_id').hasClass('selectpicker')) { $('#supervisor_id').selectpicker('refresh'); $('#supervisor_id').selectpicker('refresh'); $('#supervisor_id').selectpicker({size: 12}); } } }); return false; } function getPostosList(supervisor_id, selected_id) { $('#posto_id').html(""); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); } var selectobject = document.getElementById("supervisor_id"); supervisor_id = '0'; for (var i = 0; i < selectobject.length; i++) { if (selectobject.options[i].selected) { supervisor_id = (supervisor_id + ',' + selectobject.options[i].value); } } if (supervisor_id === '0') { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: {acao: 'getPostosList', supervisor_id: supervisor_id, selected_id: selected_id}, success: function (result) { $('#posto_id').html(result); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker({size: 12}); } } }); return false; } function getPostosPorSecaoList(selected_id, extra) { var cliente_id = 0; var secao_id = 0; if (document.getElementById("contrato_id") != null) { cliente_id = document.getElementById('contrato_id').value.split(';')[1] !== undefined ? document.getElementById('contrato_id').value.split(';')[1] : 0; } if (document.getElementById("cliente_id") != null) { cliente_id = document.getElementById('cliente_id').value !== undefined ? document.getElementById('cliente_id').value : 0; } if (document.getElementById("secao_id") != null) { secao_id = document.getElementById('secao_id').value !== undefined ? document.getElementById('secao_id').value : 0; } $('#posto_id').html(""); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); } if (cliente_id === 0 || cliente_id === '' || secao_id === 0 || secao_id === '') { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getPostosPorSecaoList', cliente_id: cliente_id, secao_id: secao_id, extra: extra, selected_id: selected_id }, success: function (result) { $('#posto_id').html(result); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker({size: 12}); } } }); return false; } function getPostosPorTipoList(ativo, tipo_id, selected_id) { $('#posto_id').html(""); if (tipo_id.length <= 0 || ativo.length <= 0) { return false; } if (ativo === -1) { ativo = (document.getElementById('demitidos').checked ? 0 : 1); } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: {acao: 'getPostosList', tipo_id: tipo_id, selected_id: selected_id, ativo: ativo}, success: function (result) { $('#posto_id').html(result); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker({size: 12}); } } }); return false; } function getPostoDetalhes(id, detalhes) { $('#' + detalhes).html(""); if (id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getPostoDatalhes&id=" + id, success: function (result) { $('#' + detalhes).html(result); } }); return false; } function getAlocacoesHistorico(codcoligada, matricula, id, detalhes) { $('#' + detalhes).html(""); if (codcoligada.length <= 0 || matricula.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: "json", data: "acao=getAlocacoesHistorico&codcoligada=" + codcoligada + "&matricula=" + matricula + "&id=" + id, success: function (result) { $('#' + detalhes).html(result[1]); if (result[0] !== '0') { var id = document.getElementById('id').value; if (id <= 0) { document.getElementById('data_inicio').value = result[0]; } } } }); return false; } function getAlocacaoPorMatricula(tipo, campo_data, campo_nome, campo_matricula, campo_planejamento, matricula, data_entrada, data_saida, data_definicao, cobertura) { var data = tipo == 1 ? document.getElementById(campo_data).value : ''; if (document.getElementById(campo_nome)) { document.getElementById(campo_nome).innerHTML = ''; } if (document.getElementById(campo_matricula)) { document.getElementById(campo_matricula).value = ''; } if (document.getElementById(campo_planejamento)) { document.getElementById(campo_planejamento).value = 0; } if (document.getElementById(data_entrada)) { document.getElementById(data_entrada).value = ''; } if (document.getElementById(data_saida)) { document.getElementById(data_saida).value = ''; } if (document.getElementById(data_definicao)) { document.getElementById(data_definicao).value = ''; } if (cobertura === 0) { document.getElementById('planejamento_posto_ec1N').value = ''; } if (matricula.length <= 0) { return false; } if (cobertura === 1 && document.getElementById('planejamento_posto_ec1N').value == 1) { if (document.getElementById(campo_nome)) { document.getElementById(campo_nome).innerHTML = 'Chapa acima não pode receber cobertura, pois é usada apenas para fornecer cobertura.'; } return false; } if (document.getElementById('posto_id_full')) { document.getElementById('posto_id_full').innerHTML = $('#posto_id option:selected').text(); } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getAlocacaoPorMatricula&matricula=" + matricula + "&data=" + data + "&cobertura=" + cobertura, dataType: "json", success: function (result) { if (document.getElementById(campo_nome)) { document.getElementById(campo_nome).innerHTML = result.nome; } if (tipo === 1) { if (document.getElementById(campo_matricula)) { document.getElementById(campo_matricula).value = result.matricula; } if (document.getElementById(campo_planejamento)) { document.getElementById(campo_planejamento).value = result.planejamento_id; } if (document.getElementById(data_entrada)) { document.getElementById(data_entrada).value = result.entrada; } if (document.getElementById(data_saida)) { document.getElementById(data_saida).value = result.saida; } if (document.getElementById(data_definicao)) { document.getElementById(data_definicao).value = result.data_definicao; } if (cobertura === 0) { document.getElementById('planejamento_posto_ec1N').value = result.posto_ec; } } } }); return false; } function getAlocacoesPorPostoList(codcoligada, posto_id, matricula, componente) { $('#' + componente).html(""); if (codcoligada.length <= 0 || posto_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getAlocacoesPorPostoList&codcoligada=" + codcoligada + "&posto_id=" + posto_id + "&matricula=" + matricula, success: function (result) { $('#' + componente).html(result); if ($('#' + select).hasClass('selectpicker')) { $('#' + select).selectpicker('refresh'); $('#' + select).selectpicker('refresh'); $('#' + select).selectpicker('refresh'); $('#' + select).selectpicker('refresh'); $('#' + select).selectpicker('refresh'); } } }); return false; } function setOcorrenciasMotivos(id) { var nome = ''; var evento = ''; var cobertura = 0; if (id > 0) { nome = document.getElementById('ocorrencias-motivos-nome-' + id).innerHTML; evento = document.getElementById('ocorrencias-motivos-evento-' + id).innerHTML; cobertura = (document.getElementById('ocorrencias-motivos-cobertura-' + id).innerHTML === 'SIM' ? 1 : 0); } bootbox.confirm({ message: "
" + "

\n" + (id === 0 ? 'Novo(a) - ' : 'Alterar - ') + "Ocorrências Motivo

\n" + "

\n" + "

\n" + "Nome *\n" + "

\n" + "\n" + "


\n" + "

\n" + "

\n" + "Evento Gerencial\n" + "

\n" + "\n" + "


\n" + "

\n" + "Cobertura\n" + "

\n" + "\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { nome = $('#form_list_nome').val(); evento = document.getElementById('form_list_evento').value.length <= 0 ? '0' : document.getElementById('form_list_evento').value; cobertura = $('#form_list_cobertura').is(":checked") ? 1 : 0; if (nome.length <= 0) { bootbox.alert('

Nome não informado!

(Video) As 3 coisas que fazem você crescer rápido em qualquer empresa

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setOcorrenciasMotivo', id: id, nome: nome, evento: evento, cobertura: cobertura, }, success: function (res) { if (res.sucesso === 1) { bootbox.alert({ message: "
Registro gravado com sucesso!", callback: function () { window.location.href = "/tela/cadastros/index.php?a=7"; } }); } else { bootbox.alert('Erro' + res.erro); } } }); } } }); return false; } function getColaboradoresDifPagList(acao, action, select, codcoligada, find, matricula) { if (find.length <= 2) { return false; } $('#' + select).html(""); $.ajax({ url: action, type: "post", data: "acao=" + acao + "&codcoligada" + "=" + codcoligada + "&find=" + find + "&matricula=" + matricula, success: function (result) { $('#' + select).html(result); if ($('#' + select).hasClass('selectpicker')) { $('#' + select).selectpicker('refresh'); $('#' + select).selectpicker('refresh'); } } }); return false; } function getColaboradoresOcorrenciasListSubs(acao, action, select) { var codcoligada = 0; var matricula = document.getElementById("planejamento_matricula") != null ? document.getElementById('planejamento_matricula').value : ''; var data = document.getElementById("planejamento_data") != null ? document.getElementById('planejamento_data').value : ''; var data_replicar = document.getElementById("data_replicar") != null ? document.getElementById('data_replicar').value : ''; var data_motivo = document.getElementById("data_motivo") != null ? document.getElementById('data_motivo').value : ''; var motivo = data_motivo.split(';')[0]; var cobertura = data_motivo.split(';')[1]; var hentrada = document.getElementById("data_entrada") != null ? document.getElementById('data_entrada').value : ''; var hsaida = document.getElementById("data_saida") != null ? document.getElementById('data_saida').value : ''; var matricula_find = document.getElementById("matricula_oc_find") != null ? document.getElementById('matricula_oc_find').value : ''; if (motivo.length <= 0 || hentrada.length <= 0 || hsaida.length <= 0 || matricula_find.length <= 0) { return false; } document.getElementById(select).disabled = false; document.getElementById('btn_oc_save').disabled = true; $('#' + select).html(""); $.ajax({ url: action, type: "post", data: { acao: acao, codcoligada: codcoligada, cobertura: cobertura, matricula: matricula, data: data, data_replicar: data_replicar, hentrada: hentrada, hsaida: hsaida, matricula_find: matricula_find }, success: function (result) { $('#' + select).html(result); if ($('#' + select).hasClass('selectpicker')) { $('#' + select).selectpicker('refresh'); $('#' + select).selectpicker({size: 6}); $('#' + select).selectpicker('refresh'); } document.getElementById('btn_oc_save').disabled = false; } }); return false; } function setOcorrenciaShow(planejamento_id, data, matricula) { if (planejamento_id.length <= 0) { bootbox.alert('

Código de linha não informado para geração da ocorrência!

'); return false; } document.getElementById('planejamento_div').innerHTML = ''; document.getElementById('planejamento_id').value = ''; document.getElementById('planejamento_data').value = ''; document.getElementById('planejamento_data_definicao').value = ''; document.getElementById('planejamento_matricula').value = ''; document.getElementById('data_motivo').innerHTML = ''; document.getElementById('oc_matricula').innerHTML = ''; document.getElementById('matricula_oc_find').value = ''; $('#oc_matricula').selectpicker('refresh'); document.getElementById('data_entrada').value = ''; document.getElementById('data_saida').value = ''; $('#data_extra').prop('checked', false); document.getElementById('data_replicar').value = ''; $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=setOcorrenciaShow&planejamento_id=" + planejamento_id, dataType: 'JSON', success: function (result) { document.getElementById('planejamento_div').innerHTML = result.planejamento; document.getElementById('planejamento_id').value = planejamento_id; document.getElementById('planejamento_data').value = data; document.getElementById('planejamento_data_definicao').value = result.data_definicao; document.getElementById('planejamento_matricula').value = matricula; document.getElementById('data_motivo').innerHTML = result.motivos; document.getElementById('oc_matricula').innerHTML = ''; $('#oc_matricula').selectpicker('refresh'); document.getElementById('data_entrada').value = result.horario1; document.getElementById('data_saida').value = result.horario2; $('#data_extra').prop('checked', false); document.getElementById('data_replicar').value = ''; $('#modalOcorrencia').modal('toggle'); setTimeout(function () { document.getElementById("matricula_oc_find").onblur(); $('#oc_matricula').selectpicker({size: 8}); }, 300); } }); return false; } function setOcorrenciaSave() { var planejamento_id = document.getElementById('planejamento_id').value; var data = document.getElementById('planejamento_data').value; var matricula = document.getElementById('planejamento_matricula').value; var data_motivo = document.getElementById("data_motivo") != null ? document.getElementById('data_motivo').value : ''; var motivo = data_motivo.split(';')[0]; var cobertura = data_motivo.split(';')[1]; var oc_matricula = document.getElementById('oc_matricula').value; var data_entrada = document.getElementById('data_entrada').value; var data_saida = document.getElementById('data_saida').value; var data_extra = document.getElementById('data_extra').checked ? 1 : 0; var data_replicar = document.getElementById('data_replicar').value <= 0 ? '' : document.getElementById('data_replicar').value; var info_antecipada = document.getElementById("info_antecipada") != null ? document.getElementById('info_antecipada').value : 0; var obs = document.getElementById("oc_obs") != null ? document.getElementById('oc_obs').value : ''; if (planejamento_id.length <= 0 || motivo.length <= 0 || data_entrada.length <= 0 || data_saida.length <= 0 || oc_matricula.length <= 0) { bootbox.alert('

Campos obrigatórios não informados para a ocorrência

'); return false; } //Validação de horário entra dentro do horário de planejamento var data_definicao = document.getElementById('planejamento_data_definicao').value; var plan_hsaida = document.getElementById("pla_horario_saida") != null ? document.getElementById('pla_horario_saida').value : ''; if (data_definicao === 1 && cobertura <= 0 && data_entrada <= plan_hsaida) { bootbox.alert('

Horário precisa ser diferente do planejado padrão!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'json', data: { acao: "setOcorrenciaSave", planejamento_id: planejamento_id, data: data, matricula: matricula, data_motivo: motivo, oc_matricula: oc_matricula, data_entrada: data_entrada, data_saida: data_saida, data_extra: data_extra, data_replicar: data_replicar, info_antecipada: info_antecipada, obs: obs }, success: function (result) { var res = result; bootbox.alert({ message: res.mensagem, callback: function () { if (res.erro === 0) { if (matricula.substring(0, 1) !== 'P') { document.getElementById("matricula_find").value = matricula; document.getElementById("matricula_find").onblur(); } setTimeout(function () { if (document.getElementById("matricula").value.length > 0 || document.getElementById("posto_id").value.length > 0) { document.frmPesquisar.submit(); } }, 300); } } }) } }); return false; } function setOcorrenciaDel(ocorrencia_id) { if (ocorrencia_id.length <= 0) { bootbox.alert('

Código de linha não informado para exclusão da ocorrência!

'); return false; } bootbox.confirm({ message: "
Confirma exclusão da ocorrência selecionada?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'setOcorrenciaDel', ocorrencia_id: ocorrencia_id }, dataType: 'json', success: function (result) { var res = result; bootbox.alert({ message: result.mensagem, callback: function () { if (res.erro === 0) { if ((document.getElementById("matricula") && document.getElementById("matricula").value.length > 0) || (document.getElementById("data") && document.getElementById("data").value.length > 0)) { document.frmPesquisar.submit(); } } } }) } }); } } }); return false; } function setGerarPlanejamentoShow(planejamento_id, data, matricula) { $('#plan_data1').val(""); $('#plan_data2').val(""); $('#plan_posto_id').html(""); if ($('#plan_posto_id').hasClass('selectpicker')) { $('#plan_posto_id').selectpicker({size: 6}); $('#plan_posto_id').selectpicker('refresh'); } $('#plan_matricula').html(""); if ($('#plan_matricula').hasClass('selectpicker')) { $('#plan_matricula').selectpicker({size: 6}); $('#plan_matricula').selectpicker('refresh'); } // Busca a lista de Postos... $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getAlocacoesPostoList&codcoligada=" + 0, success: function (result) { $('#plan_posto_id').html(result); if ($('#plan_posto_id').hasClass('selectpicker')) { $('#plan_posto_id').selectpicker({size: 6}); $('#plan_posto_id').selectpicker('refresh'); } // Busca a lista de Colaboradores... $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getAlocacoesList&codcoligada=" + 0, success: function (result) { $('#plan_matricula').html(result); if ($('#plan_matricula').hasClass('selectpicker')) { $('#plan_matricula').selectpicker({size: 6}); $('#plan_matricula').selectpicker('refresh'); } } }); } }); return false; } function setGerarPlanejamentoSave() { var plan_matricula = document.getElementById('matricula').value; if (plan_matricula.length <= 0) { bootbox.alert('

Selecione o colaborador para geração do planejamento!

'); return false; } var text = '
Confirma geração do planejamento?

    ' + '
  • Só será possível se essa Alocação ainda não possuir Ocorrências;
  • ' + '
  • De acordo com a Data Inicial informada ou Data de Início da Alocação;
  • ' + '
  • Deixe o campo abaixo em branco para usar a Data de Início da Alocação como padrão para geração.

' + 'Data Inicial: '; bootbox.confirm({ message: text, buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { var plan_data1 = document.getElementById('plan_data1').value; $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'json', data: { acao: 'setGerarPlanejamento', plan_matricula: plan_matricula, plan_data1: plan_data1 }, success: function (result) { var res = result; bootbox.alert({ message: result.mensagem, callback: function () { if (res.erro === 0) { document.frmPesquisar.submit(); } } }) } }); } } }); return false; } function setGerarPlanejamentoPeriodo(matricula_line) { var plan_matricula = (matricula_line.length <= 0 ? document.getElementById('matricula').value : matricula_line); var body = ''; if (plan_matricula[0] !== 'P') { body = 'Informe o período para geração do planejamento

'; body += '
a '; body += ''; } else { body = '

Confirma geração do planejamento de acordo com as regras do Posto?

'; } bootbox.confirm({ message: body, buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { var plan_data1 = document.getElementById('plan_data1') != null ? document.getElementById('plan_data1').value : ''; var plan_data2 = document.getElementById('plan_data2') != null ? document.getElementById('plan_data2').value : ''; $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'json', data: { acao: 'setGerarPlanejamento', plan_matricula: plan_matricula, plan_data1: plan_data1, plan_data2: plan_data2 }, success: function (result) { bootbox.alert(result.mensagem); } }); } } }); return false; } function setClonaPosto(action, id) { if (id <= 0) { bootbox.alert('

ErroParâmetros incorretos enviados.

'); return false; } bootbox.confirm({ message: "
Confirma geração de uma cópia do posto atual?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: action, type: "post", data: "acao=setClonaPosto&posto_id=" + id, success: function (res) { bootbox.alert({ message: res, callback: function () { location.reload(true); } }); } }); } } }); } function setClonaPostoExtra(action, tipo, posto_id) { if (id <= 0) { bootbox.alert('

ErroParâmetros incorretos enviados.

'); return false; } var tipo_id = 0; if (tipo === 'Extra') { tipo_id = 1; } else if (tipo === 'Cortesia') { tipo_id = 2; } else if (tipo === 'Treinamento') { tipo_id = 3; } else if (tipo === 'Apoio') { tipo_id = 4; } bootbox.confirm({ message: "
Confirma geração de um posto " + tipo + " com base no posto atual?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: action, type: "post", data: { acao: 'setClonaPostoExtra', posto_id: posto_id, tipo_id: tipo_id }, success: function (res) { bootbox.alert({ message: res, callback: function () { location.reload(true); } }); } }); } } }); } function setBDOClonaPostoExtra() { var tipo_id = 0; var posto_id = 0; var limite_funcionarios = 0; var data = ''; if (document.getElementById('extra3').checked) { tipo_id = 3; } if (document.getElementById('extra4').checked) { tipo_id = 4; } posto_id = (document.getElementById('posto_origem') ? document.getElementById('posto_origem').value : 0); limite_funcionarios = (document.getElementById('limite_funcionarios') ? document.getElementById('limite_funcionarios').value : ''); data = (document.getElementById('dataP') ? document.getElementById('dataP').value : ''); if (tipo_id <= 0 || posto_id.length <= 0 || limite_funcionarios <= 0) { bootbox.alert('

ErroParâmetros não informados para gravação.

'); return false; } $('#modalClonaPosto').modal('toggle'); bootbox.confirm({ message: "
Confirma geração de um posto [" + (tipo_id === 3 ? 'Treinamento' : 'Apoio') + "] com base no posto atual?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '../uteis/ajax-action.php', type: "post", data: { acao: 'setClonaPostoExtra', posto_id: posto_id, tipo_id: tipo_id, limite_funcionarios: limite_funcionarios, data: data }, success: function (res) { bootbox.alert(res); document.getElementById("supervisor_id").onchange(); } }); } } }); } function getLocalizacoForce() { //Obter a localização if (document.getElementById("evento_latitude") != null) { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function (position) { document.getElementById("evento_latitude").value = position.coords.latitude; document.getElementById("evento_longitude").value = position.coords.longitude; }, function () { document.getElementById("evento_latitude").value = '0'; document.getElementById("evento_longitude").value = '0'; }); } else { // Não suporta document.getElementById("evento_latitude").value = '0'; document.getElementById("evento_longitude").value = '0'; } } } function setOcorrenciaHorariosShow(matricula, planejamento_id, data) { if (planejamento_id.length <= 0) { bootbox.alert('

Código de linha não informado para exibição dos horários!

'); return false; } document.getElementById('horarios_matricula').value = matricula; document.getElementById('horarios_planejamento_id').value = planejamento_id; document.getElementById('horarios_data').value = data; document.getElementById('evento1').checked = false; document.getElementById('evento2').checked = false; document.getElementById('evento3').checked = false; document.getElementById('evento4').checked = false; document.getElementById('evento1_time').value = '00:00'; document.getElementById('evento2_time').value = '00:00'; document.getElementById('evento3_time').value = '00:00'; document.getElementById('evento4_time').value = '00:00'; $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getOcorrenciasEventosValida&planejamento_id=" + planejamento_id, dataType: 'JSON', success: function (result) { if (result.erro) { bootbox.alert(result.mensagem); } else { if (result.evento_1 === 1) { document.getElementById('evento1_time').value = result.evento_time_1; document.getElementById('latitude1').value = result.latitude1; document.getElementById('longitude1').value = result.longitude1; } if (result.evento_2 === 1) { document.getElementById('evento2_time').value = result.evento_time_2; document.getElementById('latitude2').value = result.latitude2; document.getElementById('longitude2').value = result.longitude2; } if (result.evento_3 === 1) { document.getElementById('evento3_time').value = result.evento_time_3; document.getElementById('latitude3').value = result.latitude3; document.getElementById('longitude3').value = result.longitude3; } if (result.evento_4 === 1) { document.getElementById('evento4_time').value = result.evento_time_4; document.getElementById('latitude4').value = result.latitude4; document.getElementById('longitude4').value = result.longitude4; } $('#modalEventos').modal('toggle'); } } }); return false; } function setOcorrenciasEventos() { var matricula = document.getElementById('horarios_matricula').value; var planejamento_id = document.getElementById('horarios_planejamento_id').value; var data = document.getElementById('horarios_data').value; var evento1 = 0; if (document.getElementById("evento1").checked) { evento1 = document.getElementById('evento1').value; } var evento2 = 0; if (document.getElementById("evento2").checked) { evento2 = document.getElementById('evento2').value; } var evento3 = 0; if (document.getElementById("evento3").checked) { evento3 = document.getElementById('evento3').value; } var evento4 = 0; if (document.getElementById("evento4").checked) { evento4 = document.getElementById('evento4').value; } var hora1 = document.getElementById('evento1_time').value; var hora2 = document.getElementById('evento2_time').value; var hora3 = document.getElementById('evento3_time').value; var hora4 = document.getElementById('evento4_time').value; var evento = [evento1, evento2, evento3, evento4]; var hora = [hora1, hora2, hora3, hora4]; if (matricula.length <= 0 || planejamento_id.length <= 0 || (evento[0] === 0 && evento[1] && 0 || evento[1] && 0 || evento[2] && 0)) { bootbox.alert('

Campos obrigatórios não informados para registro dos horários!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: "setOcorrenciasEventos", matricula: matricula, planejamento_id: planejamento_id, evento: evento, data: data, hora: hora }, success: function (result) { bootbox.alert(result); } }); return false; } function getGoogleMapsCoords() { var latitude = document.getElementById('latitude').value; var longitude = document.getElementById('longitude').value; var url = 'https://www.google.com/maps/place/'; url += latitude; url += longitude; var win = window.open(url, '_blank'); win.focus(); return false; } function getGoogleMaps(evento) { var url = 'https://www.google.com/maps/place/'; var latitude = $('#latitude' + evento).val(); var longitude = $('#longitude' + evento).val(); url += latitude; url += longitude; var win = window.open(url, '_blank'); win.focus(); return false; } function setModallAddEvento(sindicato_id) { if (sindicato_id.length <= 0) { bootbox.alert('

Erro na coleta dos eventos para o sindicato selecionado!

'); return false; } document.getElementById('eventoadnot').value = ''; document.getElementById('eventohnotred').value = ''; document.getElementById('eventointra').value = ''; document.getElementById('eventosusp').value = ''; document.getElementById('eventohe').value = ''; document.getElementById('eventohesdf').value = ''; document.getElementById('eventofalta').value = ''; document.getElementById('eventodsrfalta').value = ''; $('#eventoadnot').selectpicker('refresh'); $('#eventohnotred').selectpicker('refresh'); $('#eventointra').selectpicker('refresh'); $('#eventosusp').selectpicker('refresh'); $('#eventohe').selectpicker('refresh'); $('#eventohesdf').selectpicker('refresh'); $('#eventofalta').selectpicker('refresh'); $('#eventodsrfalta').selectpicker('refresh'); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: "getSindicatosEventosList", sindicato_id: sindicato_id }, success: function (result) { if (result.erro) { bootbox.alert(result.mensagem); } else { document.getElementById('modal_sindicato_nome').innerHTML = document.getElementById('sindicato_nome_' + sindicato_id).innerHTML; document.getElementById('modal_sindicato_id').value = sindicato_id; document.getElementById('eventoadnot').value = result.eventoadnot + ';' + result.eventoadnot_tipo; document.getElementById('eventohnotred').value = result.eventohnotred + ';' + result.eventohnotred_tipo; document.getElementById('eventointra').value = result.eventointra + ';' + result.eventointra_tipo; document.getElementById('eventosusp').value = result.eventosusp + ';' + result.eventosusp_tipo; document.getElementById('eventohe').value = result.eventohe + ';' + result.eventohe_tipo; document.getElementById('eventohesdf').value = result.eventohesdf + ';' + result.eventohesdf_tipo; document.getElementById('eventofalta').value = result.eventofalta + ';' + result.eventofalta_tipo; document.getElementById('eventodsrfalta').value = result.eventodsrfalta + ';' + result.eventodsrfalta_tipo; $('#eventoadnot').selectpicker({size: 6}); $('#eventohnotred').selectpicker({size: 6}); $('#eventointra').selectpicker({size: 6}); $('#eventosusp').selectpicker({size: 6}); $('#eventohe').selectpicker({size: 6}); $('#eventohesdf').selectpicker({size: 6}); $('#eventofalta').selectpicker({size: 6}); $('#eventodsrfalta').selectpicker({size: 6}); $('#eventoadnot').selectpicker('refresh'); $('#eventohnotred').selectpicker('refresh'); $('#eventointra').selectpicker('refresh'); $('#eventosusp').selectpicker('refresh'); $('#eventohe').selectpicker('refresh'); $('#eventohesdf').selectpicker('refresh'); $('#eventofalta').selectpicker('refresh'); $('#eventodsrfalta').selectpicker('refresh'); $('#modalAddEvento').modal('toggle'); } } }); return false; } function setModallAddEventoSave() { var sindicato_id = document.getElementById('modal_sindicato_id').value; var eventoadnot = document.getElementById('eventoadnot').value ?? 0; var eventohnotred = document.getElementById('eventohnotred').value ?? 0; var eventointra = document.getElementById('eventointra').value ?? 0; var eventosusp = document.getElementById('eventosusp').value ?? 0; var eventohe = document.getElementById('eventohe').value ?? 0; var eventohesdf = document.getElementById('eventohesdf').value ?? 0; var eventofalta = document.getElementById('eventofalta').value ?? 0; var eventodsrfalta = document.getElementById('eventodsrfalta').value ?? 0; if (sindicato_id.length <= 0) { bootbox.alert('

Erro na definição do sindicato para gravação dos dados!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: "setSindicatosEventosSave", sindicato_id: sindicato_id, eventoadnot: eventoadnot, eventohnotred: eventohnotred, eventosusp: eventosusp, eventointra: eventointra, eventohe: eventohe, eventohesdf: eventohesdf, eventofalta: eventofalta, eventodsrfalta: eventodsrfalta }, success: function (result) { bootbox.alert(result.mensagem); } }); return false; } function setModallAddEventoPadraoSave() { var evento = document.getElementById('evento_codigo'); var evento_codigo = evento.value; var evento_nome = evento.options[evento.selectedIndex].text; evento_nome = evento_nome.substring(7, evento_nome.length); if (evento_codigo.length <= 0) { bootbox.alert('

Selecione um evento da lista para inclusão!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: "setEventosPadraoSave", codigo: evento_codigo, nome: evento_nome }, success: function (result) { bootbox.alert({ message: result.mensagem, callback: function () { if (!result.erro) { location.reload(true); } } }); } }); return false; } function checkAll(o) { var boxes = document.getElementsByTagName("input"); for (var x = 0; x < boxes.length; x++) { var obj = boxes[x]; if (obj.type === "checkbox" && obj.id === 'emlote') { if (obj.disabled === false) { if (obj.name !== "check") obj.checked = o.checked; } } } } function checkAllPart(o) { var boxes = document.getElementsByTagName("input"); for (var x = 0; x < boxes.length; x++) { var obj = boxes[x]; if (obj.type === "checkbox" && obj.name === 'matricula[]') { if (obj.disabled === false) { if (obj.name !== "check") obj.checked = o.checked; } } } } function checkAllPlans(o) { var boxes = document.getElementsByTagName("input"); for (var x = 0; x < boxes.length; x++) { var obj = boxes[x]; if (obj.type === "checkbox" && obj.name === 'planilha_id[]') { if (obj.disabled === false) { if (obj.name !== "check") obj.checked = o.checked; } } } } function unCheckAllPlans(valor) { if (!valor) { document.getElementById('cc').checked = valor; } } function replyHorarios() { var entrada = document.getElementsByName("entrada[]"); var intervalo1 = document.getElementsByName("intervalo1[]"); var intervalo2 = document.getElementsByName("intervalo2[]"); var saida = document.getElementsByName("saida[]"); for (var i = 1; i < entrada.length; i++) { entrada[i].value = entrada[0].value; intervalo1[i].value = intervalo1[0].value; intervalo2[i].value = intervalo2[0].value; saida[i].value = saida[0].value; } } function getHorariosPorTurno(select, posto_id, horario_id) { if (select.length <= 0 || posto_id.length <= 0 || horario_id.length <= 0) { return false; } $('#' + select).html(""); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getHorariosPorTurno', posto_id: posto_id, horario_id: horario_id }, success: function (result) { $('#' + select).html(result); if ($('#' + select).hasClass('selectpicker')) { $('#' + select).selectpicker('refresh'); $('#' + select).selectpicker('refresh'); } } }); return false; } function setLimpaPlanejamentoPorAlocacao(alocacao_id, data_inicio) { if (alocacao_id.length <= 0 || data_inicio.length <= 0) { return false; } bootbox.confirm({ message: "
Excluir planejamento da alocação atual.\n" + "

* Serão excluídos apenas planejamentos com base na data de início dessa alocação para frente;

\n" + "

* Caso haja ocorrências já registradas, acessar o módulo e efetuar a exclusão das mesmas antes de executar esse processo.

\n" + "

Continuar?

\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'setLimpaPlanejamentoPorAlocacao', alocacao_id: alocacao_id, data_inicio: data_inicio }, success: function (result) { bootbox.alert(result); } }); } } }); return false; } function setLimpaPlanejamentoPor() { var matricula = document.getElementById('matricula').value ?? 0; var posto_id = document.getElementById('posto_id').value ?? 0; var data1 = document.getElementById('data1').value; var data2 = document.getElementById('data2').value; if (data1.length <= 0 || data2.length <= 0) { return false; } bootbox.confirm({ message: "
Excluir planejamentos.\n" + "

* Serão excluídos apenas planejamentos do mês atual e futuros.

\n" + "

* Se Colaborador selecionado, serão excluídos apenas planejamentos do mesmo.

\n" + "

* Se Posto selecionado, serão excluídos apenas planejamentos do mesmo.

\n" + "

* Se nenhum dos dois selecionados, serão excluídos todos os planejamentos.

\n" + "

* Caso haja ocorrências já registradas, acessar o módulo e efetuar a exclusão das mesmas antes de rodar esse processo.

\n" + "

Continuar?

\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'setLimpaPlanejamentoPor', matricula: matricula, posto_id: posto_id, data1: data1, data2: data2 }, success: function (result) { bootbox.alert({ message: result, callback: function () { location.reload(true); } }); } }); } } }); return false; } function setDifPagamentoEventoLegenda(evento_tipo) { var et = evento_tipo.split(":"); if (et[1] === 'D' || et[1] === 'R') { document.getElementById('evento_valor_title').innerHTML = 'Dias/Ref *'; document.getElementById('evento_valor').type = 'number'; $('#evento_valor').mask('#'); } else if (et[1] === 'V') { document.getElementById('evento_valor_title').innerHTML = 'Valor R$ *'; document.getElementById('evento_valor').type = 'text'; $('#evento_valor').mask("#.##0,00", {reverse: true}); } else { document.getElementById('evento_valor_title').innerHTML = 'Horas *'; document.getElementById('evento_valor').type = 'text'; $('#evento_valor').mask("##0:00", {reverse: true}); } } function setDifPagamento(id) { if (id.length <= 0) { return false; } bootbox.confirm({ message: "
Confirma exclusão do registro selecionado?", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=setDifPagamento&id=" + id, success: function (res) { if (res.erro === '0') { location.reload(true); return true; } else { bootbox.alert(res.mensagem); } } }); } } }); return false; } function setGerarTxtArquivoFolha1() { var data1 = document.getElementById('data1a').value; var data2 = document.getElementById('data2a').value; var va = 0; if (data1.length <= 0 || data2.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setGerarTxtArquivoFolha1', data1: data1, data2: data2, va: va }, success: function (res) { bootbox.alert(res.mensagem); } }); return false; } function getUsuariosProcessos(processo, painel) { if (processo.length <= 0) { return false; } $('#grade_processos_folha').html(''); $('#' + painel).html(''); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'getUsuariosProcessos', processo: processo }, success: function (res) { $('#' + painel).html(res.painel); if (painel === 'painel1') { $('#grade_processos_folha').html(res.grade); } } }); return false; } function getPostoValidaEvento() { var insalubridade = document.getElementById('insalubridade').checked ? document.getElementById('insalubridade').value : 0; var periculosidade = document.getElementById('periculosidade').checked ? document.getElementById('periculosidade').value : 0; var codigo_evento = document.getElementById('codigo_evento').value; var ajuda_custo_grat = document.getElementById('ajuda_custo_grat').value; var ajuda_custo_grat_evento = document.getElementById('ajuda_custo_grat_evento').value; if (((insalubridade > 0 || periculosidade > 0) && codigo_evento <= 0) || (ajuda_custo_grat.length > 0 && parseFloat(ajuda_custo_grat.replace(',', '.')) > 0 && ajuda_custo_grat_evento.length <= 0)) { bootbox.alert('

ErroInforme o Evento para registro de:
* Gratificação ou Insalubridade/Periculosidade.

'); return false; } else { return true; } } function setM7UploadFile(file_name, file_path) { $.ajax({ url: '/tela/dp/m7consignado/upload-action.php', type: "post", dataType: 'JSON', data: {file_name: file_name, file_path: file_path}, success: function (result) { bootbox.alert(result.msg); } }); return false; } function getOcorrenciasPorMatricula(matricula, data) { $('#ocorrencias_futuras').html(""); if (matricula.length <= 0 || data.length <= 0 || data.length < 10) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getOcorrenciasPorMatricula&matricula=" + matricula + "&data=" + data, success: function (result) { $('#ocorrencias_futuras').html(result); } }); return false; } function setEquipamentosForm(id_form) { document.getElementById("equipamento_id").style.display = (id_form == 1 ? "block" : "none;"); document.getElementById("equipamento_id_leg").style.display = (id_form == 1 ? "block" : "none"); document.getElementById("equipamentos").style.display = (id_form == 1 ? "block" : "none;"); document.getElementById("equipamentos_leg").style.display = (id_form == 1 ? "block" : "none"); document.getElementById("status").style.display = (id_form == 1 ? "block" : "none;"); document.getElementById("status_leg").style.display = (id_form == 1 ? "block" : "none"); } function setEquipamentosFormValida() { var equipamento = document.getElementById("equipamento_id").value; var conteudo = document.getElementById("equipamentos").value; if (equipamento.length <= 0 || conteudo.length <= 0) { bootbox.alert('

Ops!

Informe o equipamento e demais detalhes para prosseguir.

'); return false; } else { return true; } } function setAlocacaoPostoVago() { var data_fim = document.getElementById("data_fim").value; var matricula = document.getElementById("matricula_un").value; if (data_fim.length > 0 && matricula[0] !== 'P') { document.getElementById('posto_vago').value = 1; document.getElementById("frmCadastrar").submit(); return true; } else { return true; } } function getTreinamentosCursosColaboresElegiveis(turma_id) { $('#participante_id').html(""); if (turma_id <= 0) { return false; } var curso_id = document.getElementById('curso_id').value; var funcao_id_selecteds = []; for (var option of document.getElementById('funcao_id').options) { if (option.selected) { funcao_id_selecteds.push(option.value); } } var cliente_id = document.getElementById('cliente_id').value; var secao_id = document.getElementById('secao_id').value; $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getTreinamentosCursosColaboresElegiveis', curso_id: curso_id, turma_id: turma_id, funcao_id: funcao_id_selecteds, cliente_id: cliente_id, secao_id: secao_id }, success: function (result) { $('#participante_id').html(result); setDataTable('tab_participante_id', 500); } }); return false; } function getTreinamentosCursosColaboresElegiveisGeral(matriculas, turma_id) { $('#participante_id').html(""); if (matriculas <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getTreinamentosCursosColaboresElegiveisGeral', matriculas: matriculas, turma_id: turma_id }, success: function (result) { $('#participante_id').html(result); setDataTable('tab_participante_id', 500); } }); return false; } function setPrintEtiquetasFolhaPonto() { var frequencia_id = document.getElementById('frequencia_id').value; var supervisor_id = document.getElementById('supervisor_id').value; var posto_id = document.getElementById('posto_id').value; var matricula = document.getElementById('matricula').value; //Pelo menos 3 níveis de seleção... if (supervisor_id.length <= 0 && posto_id.length <= 0 && matricula.length <= 0) { bootbox.alert('

Informe pelo menos 2 parâmetros de pesquisa!

'); return false; } if (frequencia_id.length <= 0) { return false; } else { return true; } } function setGerarArquivoRM(form) { bootbox.confirm({ message: '

Confirma atualização para o RM TOTVS?

', buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { document.getElementById(form).submit(); } } }); return false; } function setDataTable(tabela_id, pageLength = 25) { $('#' + tabela_id).DataTable({ dom: 'Bfrtip', colReorder: false, buttons: [ { extend: 'excel', text: 'Exportar', className: "btn-sm btn-outline-blue-grey", } ], responsive: true, "lengthChange": false, "pageLength": pageLength, "ordering": true, "language": { "sEmptyTable": "Nenhum registro encontrado", "sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros", "sInfoEmpty": "Mostrando 0 até 0 de 0 registros", "sInfoFiltered": "(Filtrados de _MAX_ registros)", "sInfoPostFix": "", "sInfoThousands": ".", "sLengthMenu": "_MENU_ Por página", "sLoadingRecords": "Carregando...", "sProcessing": "Processando...", "sZeroRecords": "Nenhum registro encontrado", "sSearch": "Pesquisar", "oPaginate": { "sNext": " > ", "sPrevious": " < ", "sFirst": " << ", "sLast": " >> " }, "oAria": { "sSortAscending": ": Ordenar colunas de forma ascendente", "sSortDescending": ": Ordenar colunas de forma descendente" } } }); } function setmodalDesalocarLoteSave() { var matriculas = $('#matriculas').val().split('\n'); var matriculas_data = document.getElementById('matriculas_data').value; if (matriculas.length <= 0 || matriculas_data.length <= 0) { bootbox.alert('

Informe os campos para execução!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: "setDesalocarLoteSave", matriculas: matriculas, matriculas_data: matriculas_data }, success: function (result) { bootbox.alert({ message: result.mensagem, callback: function () { if (!result.erro) { location.reload(true); } } }); } }); return false; } function setRetomarProcessSole(processo) { if (processo.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: "setRetomarProcessSole", processo: processo }, success: function (result) { bootbox.alert(result.mensagem); } }); return false; } function setRmpfuncValorExtras(id) { var tipo = ''; var codigo = ''; var evento = ''; var valor1 = ''; var valor2 = ''; if (id > 0) { tipo = document.getElementById('rmpfunc_valor_extras-tipo-' + id).innerHTML; codigo = document.getElementById('rmpfunc_valor_extras-codigo-' + id).innerHTML; evento = document.getElementById('rmpfunc_valor_extras-evento-' + id).innerHTML; valor1 = document.getElementById('rmpfunc_valor_extras-valor1-' + id).innerHTML; valor2 = document.getElementById('rmpfunc_valor_extras-valor2-' + id).innerHTML; } bootbox.confirm({ message: "
" + "

\n" + (id === 0 ? 'Novo(a) - ' : 'Alterar - ') + "Valor de Horas Extras

\n" + "

\n" + "

\n" + "Tipo *\n" + "

(Video) Chasing Nightmares | Critical Role | Campaign 3, Episode 11

\n" + "\n" + "


\n" + "

\n" + "

\n" + "Código da função *\n" + "

\n" + "\n" + "


\n" + "

\n" + "

\n" + "Código do evento *\n" + "

\n" + "\n" + "


\n" + "

\n" + "

\n" + "" + (tipo == 0 ? 'Valor Diurno *' : 'Valor Seg a Sab *') + "\n" + "

\n" + "\n" + "


\n" + "

\n" + "

\n" + "" + (tipo == 0 ? 'Valor Noturno *' : 'Valor Dom e Fer *') + "\n" + "

\n" + "\n" + "


\n", buttons: { confirm: { label: 'Confirma', className: 'btn-success' }, cancel: { label: 'Cancela', className: 'btn-danger' } }, callback: function (result) { if (result) { tipo = $('#form_list_tipo').val(); codigo = $('#form_list_codigo').val(); evento = $('#form_list_evento').val() ?? '0'; valor1 = $('#form_list_valor1').val(); valor2 = $('#form_list_valor2').val(); if (tipo.length <= 0 || codigo.length <= 0 || valor1.length <= 0 || valor2.length <= 0) { bootbox.alert('

Informe os campos para salvar!

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setRmpfuncValorExtras', table: 'rmpfunc_valor_extras', id: id, tipo: tipo, codigo: codigo, evento: evento, valor1: valor1, valor2: valor2 }, success: function (res) { if (res.sucesso === 1) { bootbox.alert({ message: "
Registro gravado com sucesso!", callback: function () { window.location.href = "/tela/cadastros/index.php?a=10"; } }); } else { bootbox.alert('Erro' + res.erro); } } }); } } }); return false; } function getTreinamentosMatrizRegistrosList() { var cliente_id = document.getElementById('cliente_id').value; var secao_id = document.getElementById('secao_id').value; var posto_id = document.getElementById('posto_id').value; $('#grade_cursos').html(""); if (posto_id.length <= 0 && secao_id.length <= 0 && cliente_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getTreinamentosMatrizRegistrosList&cliente_id=" + cliente_id + "&secao_id=" + secao_id + "&posto_id=" + posto_id, success: function (result) { $('#grade_cursos').html(result); } }); return false; } function getSecaoList(cliente_id, secao_id) { $('#secao_id').html(""); if (cliente_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getSecaoList&filter_name" + "=" + cliente_id + "&selected_id=" + secao_id, success: function (result) { $('#secao_id').html(result); if ($('#secao_id').hasClass('selectpicker')) { $('#secao_id').selectpicker('refresh'); $('#secao_id').selectpicker('refresh'); $('#secao_id').selectpicker({size: 12}); } } }); return false; } function getSecaoListGroup(contrato_id, secao_id) { $('#secao_id').html(""); if (contrato_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getSecaoListGroup', cliente_id: contrato_id.split(";")[1], secao_id: secao_id }, success: function (result) { $('#secao_id').html(result); if ($('#secao_id').hasClass('selectpicker')) { $('#secao_id').selectpicker('refresh'); $('#secao_id').selectpicker('refresh'); $('#secao_id').selectpicker({size: 12}); } } }); return false; } function getContratosListaMaterialList() { $('#material_id').html(""); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getContratosListaMaterialList' }, success: function (result) { $('#material_id').html(result); if ($('#material_id').hasClass('selectpicker')) { $('#material_id').selectpicker('refresh'); $('#material_id').selectpicker({size: 12}); } } }); return false; } function getContratoMateriaisList(cabecalho_id, item_id) { $('.nav-tabs a[href="#lancamentos"]').tab('show'); setContratoMateriaisEdit(0); $('#grade_materiais').html(''); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getContratoMateriaisList', cabecalho_id: cabecalho_id, item_id: item_id, }, success: function (result) { $('#grade_materiais').html(result); setDataTable('tab_datatable1', 30); } }); return false; } function getContratoMateriaisListRequisicao(cabecalho_id, requisicao_id) { $('#grade_materiais').html(""); if (cabecalho_id.length <= 0) { return; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getContratoMateriaisListRequisicao', cliente_id: cabecalho_id.split(";")[0], secao_id: cabecalho_id.split(";")[1], cabecalho_id: cabecalho_id.split(";")[3], requisicao_id: requisicao_id }, success: function (result) { $('#grade_materiais').html(result); setDataTable('tab_datatable_epi', 60); setDataTable('tab_datatable_mat', 60); setDataTable('tab_datatable_equ', 60); } }); return false; } function getContratoMateriaisRequisicaoValidaSave() { var material_id = document.getElementsByName('material_id[]'); var campo = ''; var qtd = 0; var qtd_zeros = 0; for (i = 0; i < material_id.length; i++) { campo = 'solicitar_' + material_id[i].value.toString(); qtd = document.getElementById(campo).value; if (qtd > 0) { qtd_zeros++; } } if (qtd_zeros <= 0) { bootbox.alert('
Ops!Informe a Quantidade solicitada de pelo menos 1 item da lista.'); return false; } else { return true; } } function setContratoMateriaisDel(id) { var cabecalho_id = document.getElementById('id').value; bootbox.confirm({ message: "
Confirma exclusão definitiva do material/produto para o contrato/cliente?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: {acao: 'setContratoMateriaisDel', id: id}, success: function (result) { if (result.sucesso === 0) { bootbox.alert('

Ops!

' + result.erro + '

'); } else { getContratoMateriaisList(cabecalho_id); } } }); } } }); return false; } function setContratoMateriaisEdit(id) { document.getElementById('item_id').value = ''; document.getElementById('periodicidade_id').value = ''; document.getElementById('material_id').value = ''; $('#material_id').selectpicker('refresh'); document.getElementById('tipo_id').value = ''; document.getElementById('unidade_id').value = ''; document.getElementById('quantidade').value = ''; document.getElementById('preco').value = ''; if (id <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'getContratoMateriaisPorItemId', id: id }, success: function (result) { if (result.erro != null && result.erro === '1') { bootbox.alert('

Ops!

' + result.mensagem + '

'); } else { document.getElementById('item_id').value = result.id; document.getElementById('periodicidade_id').value = result.periodicidade_id; document.getElementById('material_id').value = result.material_id + ';' + result.unidade_id; $('#material_id').selectpicker('refresh'); document.getElementById('tipo_id').value = result.tipo_id; document.getElementById('unidade_id').value = result.unidade_id; document.getElementById('quantidade').value = result.quantidade; document.getElementById('preco').value = result.preco; $('.nav-tabs a[href="#novo_lancamento"]').tab('show'); } } }); return false; } function setContratoMateriaisUnidadePadrao(material_unidade_id) { var unidade_id = document.getElementById('unidade_id'); var tamanho = document.getElementById('unidade_id').length; for (var i = 0; i < tamanho; i++) { unidade_id[i].selected = (unidade_id[i].value === material_unidade_id.split(";")[1]); } return false; } function setLimparSelecaoSelect(componente) { var elements = document.getElementById(componente).options; for (var i = 0; i < elements.length; i++) { elements[i].selected = false; } if ($('#' + componente).hasClass('selectpicker')) { $('#' + componente).selectpicker('refresh'); } return false; } function setEstadoComponente(acao, componente) { if (acao.length <= 0 || acao === '0') { document.getElementById(componente).disabled = true; document.getElementById(componente).enabled = false; } else { document.getElementById(componente).disabled = false; document.getElementById(componente).enabled = true; } return false; } function setPeriodoFeriasDel(id) { bootbox.confirm({ message: "
Atenção!Confirma exclusão do registro e as ocorrências geradas para as matrículas envolvidas?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: {acao: 'setPeriodoFeriasDel', id: id}, success: function (result) { if (result.sucesso === 0) { bootbox.alert('
'); } else { document.frmPesquisar.submit(); } } }); } } }); return false; } function setDatatableClearSearch(tabela) { var table = $('#' + tabela).DataTable(); table.search("").draw(); return true; } function setTreinamentosTurmaMatriculasLoteShow() { document.getElementById("matriculas_lote").value = ''; $('#modalSelecionarLote').modal('toggle'); return false; } function setTreinamentosTurmaMatriculasLoteSelect() { var matriculas = document.getElementsByName('matricula[]'); var turma_id = document.getElementById('id').value; var textArea = document.getElementById("matriculas_lote"); var arrayOfLines = textArea.value.split("\n"); var matricula_in = "\'9999999\'"; var matricula = ''; var erros = ''; for (var i = 0; i < arrayOfLines.length; i++) { if (arrayOfLines[i].length > 0) { matricula_in += ',\'' + ("0000000" + arrayOfLines[i].trim()).slice(-7) + '\''; } } getTreinamentosCursosColaboresElegiveisGeral(matricula_in, turma_id); setTimeout(function () { for (var i = 0; i < arrayOfLines.length; i++) { if (arrayOfLines[i].length > 0) { matricula = ("0000000" + arrayOfLines[i].trim()).slice(-7); var matricula_false = false; for (var m = 0; m < matriculas.length; m++) { if (matriculas[m].value === matricula) { matriculas[m].checked = true; matricula_false = true; } } if (!matricula_false) { erros += (erros.length > 0 ? ', ' + matricula : matricula); } } } // Mostra aviso das não localizadas if (erros.length > 0) { bootbox.alert({ message: "
Atenção! Matrículas não localizadas na lista de seleção,
" + erros + '
', callback: function () { document.frmCadastrar.submit(); } }); } }, 900); } function setTreinamentosTurmaMatriculasLoteSelectGeral() { var matriculas = document.getElementsByName('matricula[]'); var turma_id = document.getElementById('id').value; var textArea = document.getElementById("matriculas_lote"); var arrayOfLines = textArea.value.split("\n"); var matricula_in = "\'9999999\'"; var matricula = ''; var erros = ''; for (var i = 0; i < arrayOfLines.length; i++) { if (arrayOfLines[i].length > 0) { matricula_in += ',\'' + ("0000000" + arrayOfLines[i].trim()).slice(-7) + '\''; } } getTreinamentosCursosColaboresElegiveisGeral(matricula_in, turma_id); setTimeout(function () { for (var i = 0; i < arrayOfLines.length; i++) { if (arrayOfLines[i].length > 0) { matricula = ("0000000" + arrayOfLines[i].trim()).slice(-7); var matricula_false = false; for (var m = 0; m < matriculas.length; m++) { if (matriculas[m].value === matricula) { matriculas[m].checked = true; matricula_false = true; } } if (!matricula_false) { erros += (erros.length > 0 ? ', ' + matricula : matricula); } } } }, 900); } function getUltimaAlocacaoPorMatricula(campo, matricula) { document.getElementById(campo).innerHTML = ''; if (matricula.length <= 0 || matricula === '0') { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: {acao: 'getUltimaAlocacaoPorMatricula', matricula: matricula}, success: function (result) { document.getElementById(campo).innerHTML = result; } }); return false; } function getContratoMateriaisListCombo(cliente_id) { $('#material_id').html(""); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getContratoMateriaisListCombo', cliente_id: cliente_id }, success: function (result) { $('#material_id').html(result); if ($('#material_id').hasClass('selectpicker')) { $('#material_id').selectpicker('refresh'); $('#material_id').selectpicker({size: 12}); } } }); return false; } function getHorariosDsPorId(horario_id) { $('#horarios_ds').html(""); if (horario_id <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getHorariosDsPorId', horario_id: horario_id }, success: function (result) { $('#horarios_ds').html(result); } }); return false; } function setRestartSole() { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: {acao: 'setRestartSole'}, success: function (result) { bootbox.alert(result); } }); return true; } function setDashDisplay(dash) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: {acao: 'setDashDisplay', dash: dash}, success: function (result) { return true; } }); return true; } function setHorasTipo(tipo) { document.getElementById('form_list_evento').disabled = (tipo === '1'); document.getElementById('label_form_list_valor1').innerHTML = (tipo === '0' ? 'Valor da hora 1 R$ *' : 'Meio de semana *'); document.getElementById('label_form_list_valor2').innerHTML = (tipo === '0' ? 'Valor da hora 2 R$ *' : 'Final de semana e feriados *'); } function getPostosApelido(posto_id) { document.getElementById('posto_apelido').value = ''; if (posto_id <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getPostosApelido', posto_id: posto_id }, success: function (result) { document.getElementById('posto_apelido').value = result; } }); return false; } function setCamposRMTXT() { var cache1 = document.getElementById('cache1').checked; document.getElementById('div_colaborador').style.display = (cache1 ? 'none' : 'block'); document.getElementById('div_periodo').style.display = (cache1 ? 'none' : 'block'); } function setPageTitle(texto) { if (texto <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'setPageTitle', texto: texto }, success: function (result) { console.log(texto); } }); return false; } function setLimparSelecaoCheck(componente) { var comps = document.getElementsByName(componente); for (var i = 0; i < comps.length; i++) { comps[i].checked = false; } return false; } function setContratoRequisicaoValidaQtd(material_id) { var qtd = document.getElementById('solicitar_' + material_id.toString()).value; var max = document.getElementById('solicitar_max_' + material_id.toString()).value; var atu = document.getElementById('solicitar_in_' + material_id.toString()).value; if (parseInt(qtd) > parseInt(max)) { bootbox.alert('

Ops!

Quantidade solicitada ultrapassa o máximo para a Periodicidade.

'); document.getElementById('solicitar_' + material_id.toString()).value = atu; return false; } return true; } function getTreinamentosCursosTurmasList(curso_id, turma_id) { $('#turma_id').html(""); if (curso_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: "json", data: "acao=getTreinamentosCursosTurmasList&curso_id=" + curso_id + "&turma_id=" + turma_id, success: function (result) { if (result.erro === '1') { bootbox.alert('

' + result.mensagem + '

'); } else { $('#turma_id').html(result.mensagem); if ($('#turma_id').hasClass('selectpicker')) { $('#turma_id').selectpicker('refresh'); } } } }); return false; } function getTreinamentosMatrizPostosList(secao_id, posto_id) { $('#posto_id').html(""); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); } if (cliente_id.length <= 0 || secao_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: "json", data: "acao=getTreinamentosMatrizPostosList&secao_id=" + secao_id + "&posto_id=" + posto_id, success: function (result) { if (result.erro === '1') { bootbox.alert('

' + result.mensagem + '

'); } else { $('#posto_id').html(result.mensagem); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker('refresh'); } } } }); return false; } function setRequisicaoMaterialDelete(id) { if (id.length <= 0) { return false; } bootbox.confirm({ message: "
Atenção!* Se já integrada com RM TOTVS, elimina o movimento e reabre a Requisição para alterações;
* Se não integrada, realiza a exclusão definitiva da Requisição.

Confirma?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (res) { if (res) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=setRequisicaoMaterialDelete&id=" + id, success: function (result) { bootbox.alert({ message: result, callback: function () { location.reload(true); } }); } }); } } }); } function setOSDelete(id) { if (id.length <= 0) { return false; } bootbox.confirm({ message: "
Atenção!

* Se já integrada com RM TOTVS, elimina a pré-nota e reabre a OS para alterações;
* Se não integrada, realiza a exclusão definitiva da OS.

Confirma?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (res) { if (res) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=setOSDelete&id=" + id, success: function (result) { bootbox.alert({ message: result, callback: function () { location.reload(true); } }); } }); } } }); } function setOSTipoQtd(tipo) { if (parseInt(tipo) === 1) { $('#qtde').attr('type', 'time'); $('#qtde').val(''); $('#valor').val(''); $('#valor_total').val(''); } else { $('#qtde').attr('type', 'text'); $('#qtde').val(''); $('#valor').val(''); $('#valor_total').val(''); } } function getOSValorTotal() { var tipo = $('#qtde').attr('type'); var pessoas = 0; var valor = 0; var total = 0; if (tipo === 'time') { // Por horas var pessoas = document.getElementById('qtde_pessoas').value; var horas = document.getElementById('qtde').value.split(':')[0]; var minutos = parseFloat(document.getElementById('qtde').value.split(':')[1]) / 60.0; valor = document.getElementById('valor').value; valor = valor.toString().replace('.', ''); valor = valor.toString().replace(',', '.'); total = valor > 0 ? (parseFloat(pessoas) * (parseFloat(horas) + parseFloat(minutos)) * valor) : 0; } else { // Por diárias var pessoas = document.getElementById('qtde_pessoas').value; var qtde = document.getElementById('qtde').value; qtde = parseFloat(qtde.toString().replace(',', '.')); valor = document.getElementById('valor').value; valor = parseFloat(valor.toString().replace(',', '.')); total = valor > 0 ? (pessoas * (qtde * valor)) : 0; } document.getElementById('valor_total').value = total.toLocaleString('pt-br', {maximumFractionDigits: 2}); } function setCkEditor(componente) { if (document.getElementById(componente) != null) { CKEDITOR.replace(componente, { height: 360, //toolbar : 'Basic', /* this does the magic */ uiColor: '#e0e0e0', toolbar: [ ['Styles', 'Format', 'Font', 'FontSize'], ['Bold', 'Italic', 'Underline', 'StrikeThrough', '-', 'Undo', 'Redo', '-', 'Cut', 'Copy', 'Paste', 'Find', 'Replace', '-', 'Outdent', 'Indent'], ['NumberedList', 'BulletedList', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], ['Image', 'Table', '-', 'Link', 'Smiley', 'TextColor', 'BGColor', 'Source'] ] }); } } function setPlanilhaDadosPostos() { var posto_id = document.getElementById('posto_id').value; if (posto_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=getPostoDadosLinha&id=" + posto_id, success: function (dados) { if (dados !== undefined) { var comp_posto_id = document.getElementsByName('comp_posto_id[]'); var ja_tem = 0; for (var i = 0; i < comp_posto_id.length; i++) { if (comp_posto_id[i].value === posto_id) { ja_tem = 1; } } if (ja_tem === 0) { var table = document.getElementById("dados_postos"); var row = table.insertRow(-1); row.id = table.childElementCount - 1; var cell0 = row.insertCell(0); cell0.style.padding = "0.3rem"; cell0.style.fontSize = "78%"; var cell1 = row.insertCell(1); cell1.style.padding = "0.3rem"; cell1.style.fontSize = "78%"; var cell2 = row.insertCell(2); cell2.style.padding = "0.3rem"; cell2.style.fontSize = "78%"; var cell3 = row.insertCell(3); cell3.style.padding = "0.3rem"; cell3.style.fontSize = "78%"; var cell4 = row.insertCell(4); cell4.style.padding = "0.3rem"; cell4.style.fontSize = "78%"; var cell5 = row.insertCell(5); cell5.style.padding = "0.3rem"; cell5.style.fontSize = "78%"; cell0.innerHTML = ''; cell1.innerHTML = '' + dados.id; cell2.innerHTML = dados.nome; cell3.innerHTML = dados.supervisor_nome; cell4.innerHTML = dados.escala_nome; cell5.innerHTML = dados.turno_nome; } else { bootbox.alert('

Ops! Posto já adicionado na lista.

'); } } } }); } function setRedirectionPlanilhasTemplate(host) { var titulo_id = document.getElementById('template').value.length > 0 ? document.getElementById('template').value : 1; var destination = host + '/comercial/contratos-planilhas-template.php?titulo_id=' + titulo_id.toString(); redirection(destination); } function getContratoDadosIndexListTable() { var cliente_id = document.getElementById('contrato_id').value.split(';')[1] !== undefined ? document.getElementById('contrato_id').value.split(';')[1] : ''; var secao_id = document.getElementById('secao_id').value; var apelido = document.getElementById('apelido_planilha').value; var titulo_id = 1; $('#planilha_dados').html(""); if (cliente_id.length <= 0 || titulo_id <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getContratoDadosIndexListTable', titulo_id: titulo_id, apelido: apelido, cliente_id: cliente_id, secao_id: secao_id }, success: function (result) { $('#planilha_dados').html(result); } }); return false; } function getPlanilhaDadosPostos(planilha_id) { $('#dados_postos').html(""); if (planilha_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'getPlanilhaDadosPostos', planilha_id: planilha_id }, success: function (dados) { $('#dados_postos').html(dados); } }); return false; } function setTableLinhaDel(linha_id) { $("#" + linha_id).remove(); return false; } function setDeletePlanilhaDados(id) { if (id <= 0) { bootbox.alert('

ErroParâmetros incorretos para exclusão do registro.

(Video) Como Motivar a sua Equipe | Gestão de Bares e Restaurantes | Matheus Lessa

'); return false; } bootbox.confirm({ message: "
Confirma exclusão definitiva do registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=setDeletePlanilhaDados&id=" + id, success: function (res) { bootbox.alert({ message: res.mensagem, callback: function () { if (res.erro === 0) { location.reload(true); } } }); } }); } } }); } function setClonePlanilhaDados(id) { if (id <= 0) { bootbox.alert('

ErroParâmetros incorretos para clonar registro.

'); return false; } bootbox.confirm({ message: "
Confirma clonagem do registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: "acao=setDeletePlanilhaDados&id=" + id, success: function (res) { bootbox.alert({ message: res.mensagem, callback: function () { if (res.erro === 0) { location.reload(true); } } }); } }); } } }); } function setPlanilhaDadosCalcula(campo, formula) { if (formula.length <= 0) { return false; } var formula = formula.split(','); if (formula.length > 1) { $('#' + campo).val($('#' + formula[0]).val()) } else { $('#' + campo).val($('#' + formula[0]).val()) } return false; } function setReciboDelete(id) { if (id.length <= 0) { return false; } bootbox.confirm({ message: "
Atenção!* Se já integrado com RM TOTVS, elimina a pré-nota e reabre o Demonstrativo para alterações;
* Se não integrada, realiza a exclusão definitiva do Demonstrativo de Faturamento.

Confirma?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (res) { if (res) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=setReciboDelete&id=" + id, success: function (result) { bootbox.alert({ message: result, callback: function () { location.reload(true); } }); } }); } } }); } function getRecibosPlanilhasCompetencia(recibo_id) { var contrato_id = document.getElementById('contrato_id').value.split(';')[0] !== undefined ? document.getElementById('contrato_id').value.split(';')[0] : ''; var competencia_id = document.getElementById('competencia_id').value; $('#tab_planilha_id').html(''); if (contrato_id.length <= 0 || competencia_id.length <= 0) { return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'getRecibosPlanilhasCompetencia', contrato_id: contrato_id, competencia_id: competencia_id, recibo_id: recibo_id }, success: function (result) { $('#tab_planilha_id').html(result.mensagem); } }); return false; } function setReciboRefresh(confirmacao) { var tipo_id = document.getElementById('tipo_id').value; var checkboxes = document.getElementsByName('planilha_id[]'); var planilha_ids = '{"planilha_id":0'; var planilha_count = 0; // {"planilha_id":1,"planilha_id":2,"planilha_id":3} for (var i = 0, n = checkboxes.length; i < n; i++) { if (checkboxes[i].checked) { planilha_ids += (',"planilha_id":' + checkboxes[i].value.toString()); planilha_count++; } } planilha_ids += '}'; if (planilha_count <= 0 || tipo_id.length <= 0) { return false; } if (confirmacao) { bootbox.confirm({ message: "

Atenção!

Caso já exista valores nos campos, os mesmos serão substituídos por novos de acordo com a análise das planilhas seleciondas.

Continuar?

", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (res) { if (res) { $('#tab_recibo_valores').html(''); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setReciboRefresh', tipo_id: tipo_id, planilha_ids: planilha_ids }, success: function (result) { if (result.erro === '1') { bootbox.alert(result.mensagem); } else { $('#tab_recibo_valores').html(result.mensagem); } } }); } } }); } else { $('#tab_recibo_valores').html(''); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setReciboRefresh', tipo_id: tipo_id, planilha_ids: planilha_ids }, success: function (result) { if (result.erro === '1') { bootbox.alert(result.mensagem); } else { $('#tab_recibo_valores').html(result.mensagem); } } }); } } function setReciboRefreshTotalFaturar() { Number.prototype.formatMoney = function (places, symbol, thousand, decimal) { places = !isNaN(places = Math.abs(places)) ? places : 2; symbol = symbol !== undefined ? symbol : "$"; thousand = thousand || ","; decimal = decimal || "."; var number = this, negative = number < 0 ? "-" : "", i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "", j = (j = i.length) > 3 ? j % 3 : 0; return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : ""); }; var valor_contratual = document.getElementById('valor_contratual') !== undefined ? document.getElementById('valor_contratual').value : '0.0'; var desconto_faltas = document.getElementById('desconto_faltas') !== undefined ? document.getElementById('desconto_faltas').value : '0.0'; var desconto_plano_saude = document.getElementById('desconto_plano_saude') !== undefined ? document.getElementById('desconto_plano_saude').value : '0.0'; var desconto_vt = document.getElementById('desconto_vt') !== undefined ? document.getElementById('desconto_vt').value : '0.0'; var desconto_fardamento = document.getElementById('desconto_fardamento') !== undefined ? document.getElementById('desconto_fardamento').value : '0.0'; var desconto_material = document.getElementById('desconto_material') !== undefined ? document.getElementById('desconto_material').value : '0.0'; var desconto_qualidade = document.getElementById('desconto_qualidade') !== undefined ? document.getElementById('desconto_qualidade').value : '0.0'; var desconto_sinistro = document.getElementById('desconto_sinistro') !== undefined ? document.getElementById('desconto_sinistro').value : '0.0'; var desconto_outros = document.getElementById('desconto_outros') !== undefined ? document.getElementById('desconto_outros').value : '0.0'; valor_contratual = valor_contratual.replace('.', ''); valor_contratual = valor_contratual.replace(',', '.'); valor_contratual = parseFloat(valor_contratual); desconto_faltas = desconto_faltas.replace('.', ''); desconto_faltas = desconto_faltas.replace(',', '.'); desconto_faltas = parseFloat(desconto_faltas); desconto_plano_saude = desconto_plano_saude.replace('.', ''); desconto_plano_saude = desconto_plano_saude.replace(',', '.'); desconto_plano_saude = parseFloat(desconto_plano_saude); desconto_vt = desconto_vt.replace('.', ''); desconto_vt = desconto_vt.replace(',', '.'); desconto_vt = parseFloat(desconto_vt); desconto_fardamento = desconto_fardamento.replace('.', ''); desconto_fardamento = desconto_fardamento.replace(',', '.'); desconto_fardamento = parseFloat(desconto_fardamento); desconto_material = desconto_material.replace('.', ''); desconto_material = desconto_material.replace(',', '.'); desconto_material = parseFloat(desconto_material); desconto_qualidade = desconto_qualidade.replace('.', ''); desconto_qualidade = desconto_qualidade.replace(',', '.'); desconto_qualidade = parseFloat(desconto_qualidade); desconto_sinistro = desconto_sinistro.replace('.', ''); desconto_sinistro = desconto_sinistro.replace(',', '.'); desconto_sinistro = parseFloat(desconto_sinistro); desconto_outros = desconto_outros.replace('.', ''); desconto_outros = desconto_outros.replace(',', '.'); desconto_outros = parseFloat(desconto_outros); var total_faturar = parseFloat( valor_contratual - ( desconto_faltas + desconto_plano_saude + desconto_vt + desconto_outros + desconto_fardamento + desconto_material + desconto_qualidade + desconto_sinistro ) ).formatMoney(2, "", ".", ","); document.getElementById('total_faturar').value = total_faturar; setReciboRefreshBaseRetencoes(); setReciboRefreshValorLiquido(); } function setReciboRefreshBaseRetencoes() { Number.prototype.formatMoney = function (places, symbol, thousand, decimal) { places = !isNaN(places = Math.abs(places)) ? places : 2; symbol = symbol !== undefined ? symbol : "$"; thousand = thousand || ","; decimal = decimal || "."; var number = this, negative = number < 0 ? "-" : "", i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "", j = (j = i.length) > 3 ? j % 3 : 0; return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : ""); }; var total_faturar = document.getElementById('total_faturar') !== undefined ? document.getElementById('total_faturar').value : '0.0'; var valor_vt = document.getElementById('valor_vt') !== undefined ? document.getElementById('valor_vt').value : '0.0'; var valor_va = document.getElementById('valor_va') !== undefined ? document.getElementById('valor_va').value : '0.0'; var valor_fardamento = document.getElementById('valor_fardamento') !== undefined ? document.getElementById('valor_fardamento').value : '0.0'; total_faturar = total_faturar.replace('.', ''); total_faturar = total_faturar.replace(',', '.'); total_faturar = parseFloat(total_faturar); valor_vt = valor_vt.replace('.', ''); valor_vt = valor_vt.replace(',', '.'); valor_vt = parseFloat(valor_vt); valor_va = valor_va.replace('.', ''); valor_va = valor_va.replace(',', '.'); valor_va = parseFloat(valor_va); valor_fardamento = valor_fardamento.replace('.', ''); valor_fardamento = valor_fardamento.replace(',', '.'); valor_fardamento = parseFloat(valor_fardamento); var valor_base_inss = parseFloat(total_faturar - (valor_vt + valor_va + valor_fardamento)); var retencao_inss = parseFloat(valor_base_inss * 0.11); var retencao_irpj = parseFloat(total_faturar * 0.048); var retencao_csll = parseFloat(total_faturar * 0.01); var retencao_pis = parseFloat(total_faturar * 0.065); var retencao_cofins = parseFloat(total_faturar * 0.03); var retencao_iss = parseFloat(total_faturar * 0.02); document.getElementById('valor_base_inss').value = valor_base_inss.formatMoney(2, "", ".", ","); document.getElementById('retencao_inss').value = retencao_inss.formatMoney(2, "", ".", ","); document.getElementById('retencao_irpj').value = retencao_irpj.formatMoney(2, "", ".", ","); document.getElementById('retencao_csll').value = retencao_csll.formatMoney(2, "", ".", ","); document.getElementById('retencao_pis').value = retencao_pis.formatMoney(2, "", ".", ","); document.getElementById('retencao_cofins').value = retencao_cofins.formatMoney(2, "", ".", ","); document.getElementById('retencao_iss').value = retencao_iss.formatMoney(2, "", ".", ","); setReciboRefreshValorLiquido(); } function setReciboRefreshValorLiquido() { Number.prototype.formatMoney = function (places, symbol, thousand, decimal) { places = !isNaN(places = Math.abs(places)) ? places : 2; symbol = symbol !== undefined ? symbol : "$"; thousand = thousand || ","; decimal = decimal || "."; var number = this, negative = number < 0 ? "-" : "", i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "", j = (j = i.length) > 3 ? j % 3 : 0; return symbol + negative + (j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + (places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : ""); }; var total_faturar = document.getElementById('total_faturar') !== undefined ? document.getElementById('total_faturar').value : '0.0'; var retencao_inss = document.getElementById('retencao_inss') !== undefined ? document.getElementById('retencao_inss').value : '0.0'; var retencao_irpj = document.getElementById('retencao_irpj') !== undefined ? document.getElementById('retencao_irpj').value : '0.0'; var retencao_csll = document.getElementById('retencao_csll') !== undefined ? document.getElementById('retencao_csll').value : '0.0'; var retencao_pis = document.getElementById('retencao_pis') !== undefined ? document.getElementById('retencao_pis').value : '0.0'; var retencao_cofins = document.getElementById('retencao_cofins') !== undefined ? document.getElementById('retencao_cofins').value : '0.0'; var retencao_iss = document.getElementById('retencao_iss') !== undefined ? document.getElementById('retencao_iss').value : '0.0'; total_faturar = total_faturar.replace('.', ''); total_faturar = total_faturar.replace(',', '.'); total_faturar = parseFloat(total_faturar); retencao_inss = retencao_inss.replace('.', ''); retencao_inss = retencao_inss.replace(',', '.'); retencao_inss = parseFloat(retencao_inss); retencao_irpj = retencao_irpj.replace('.', ''); retencao_irpj = retencao_irpj.replace(',', '.'); retencao_irpj = parseFloat(retencao_irpj); retencao_csll = retencao_csll.replace('.', ''); retencao_csll = retencao_csll.replace(',', '.'); retencao_csll = parseFloat(retencao_csll); retencao_pis = retencao_pis.replace('.', ''); retencao_pis = retencao_pis.replace(',', '.'); retencao_pis = parseFloat(retencao_pis); retencao_cofins = retencao_cofins.replace('.', ''); retencao_cofins = retencao_cofins.replace(',', '.'); retencao_cofins = parseFloat(retencao_cofins); retencao_iss = retencao_iss.replace('.', ''); retencao_iss = retencao_iss.replace(',', '.'); retencao_iss = parseFloat(retencao_iss); var valor_liquido = parseFloat( total_faturar - (retencao_inss + retencao_irpj + retencao_csll + retencao_pis + retencao_cofins + retencao_iss) ).formatMoney(2, "", ".", ","); document.getElementById('valor_liquido').value = valor_liquido; } function setCamposSequenciaOrder(campo) { var campos = document.getElementsByName(campo); var seq = 1; for (i = 0; i < campos.length; i++) { var id = parseInt(campos[i].value) < 0 ? parseInt(campos[i].value) : parseInt(campos[i].value) * -1; document.getElementById('sequencia' + id.toString()).value = seq; seq++; } } function setAlteraCorCampo(campo, valor, invertido = false) { var cores = null; if (invertido) { cores = ['', '#dc3545', '#ffc107', '#28a745']; } else { cores = ['', '#28a745', '#ffc107', '#dc3545']; } document.getElementById(campo).style.color = cores[valor]; } function setAtendimentoEncerra() { if (document.getElementById('encerrar').checked) { bootbox.alert('

Atenção!

Ao encerrar o atendimento, o texto da resposta será enviado para o solicitante.'); } } function setAtendimentoEncerraCheck(acao) { if (acao > 0) { document.getElementById('encerrar').checked = false; } document.getElementById('encerrar').disabled = acao; } function setContratoDadosIndexReplicarFormula(id) { var sequencia = document.getElementById('sequencia-' + id.toString()).value; var nome = document.getElementById('nome-' + id.toString()).value; var nivel = document.getElementById('nivel-' + id.toString()).value; var tipo1 = document.getElementById('tipo1-' + id.toString()).value; var tipo2 = document.getElementById('tipo2-' + id.toString()).value; var colunas = document.getElementById('colunas-' + id.toString()).value; var formula = document.getElementById('formula-' + id.toString()).value; var lista = document.getElementById('lista-' + id.toString()).value; var totalizador = document.getElementById('totalizador-' + id.toString()).value; var index_id = document.getElementById('index_id-' + id.toString()).value; var empresas = $('#coligada_id-' + id.toString()).val(); if (index_id.length <= 0 || empresas.length <= 0 || nome.length <= 0) { bootbox.alert("

Atenção

Selecione uma linha com informações para que seja possível replicar e marque as empresas de destino.

") return false; } bootbox.confirm({ message: "

Atenção!

Caso já exista valores nas fórmulas das empresas selecionadas, as mesmas serão substituídas.

Continuar?

", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (res) { if (res) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: { acao: 'setContratoDadosIndexReplicarFormula', index_id: index_id, empresas: empresas, sequencia: sequencia, nome: nome, nivel: nivel, tipo1: tipo1, tipo2: tipo2, colunas: colunas, formula: formula, lista: lista, totalizador: totalizador }, success: function (result) { bootbox.alert(result.mensagem); } }); } } }); } function setAtendimentoModal(atendimento_id) { $('#modalEcAtendimentoBody').html(''); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getAtendimentosRegistroPorId&atendimento_id=" + atendimento_id, dataType: 'JSON', success: function (result) { if (result.erro === 1) { bootbox.alert(result.dados); } else { $('#modalEcAtendimentoBody').html(result.dados); document.getElementById("tipo_id").onchange(); $('#modalEcAtendimento').modal('toggle'); } } }); } function getAtendimentosTiposPorId(id) { $('#tipo_id_extras').html(''); if (id.length <= 0) { return false; } var tipo_id = id.split(';')[0]; var tipo_tipo_id = id.split(';')[2]; $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getAtendimentosTiposPorId&tipo_id=" + tipo_id, dataType: 'JSON', success: function (result) { if (result.erro === 1) { bootbox.alert(result.dados); } else { $('#tipo_id_extras').html(result.dados); document.getElementById("div_agendado_data").style.display = (tipo_tipo_id >= 1 ? "block" : "none"); } } }); return false; } function setAtendimentoModalSave() { //Validações if (document.getElementById('tipo_id').value.length <= 0 || document.getElementById('descricao').value.length <= 0) { bootbox.alert('

Ops! Campos obrigatórios não informados!

') return false; } // Serialize the entire form: var data = new FormData(document.getElementById('frmAtendimento')); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'JSON', data: data, contentType: false, processData: false, success: function (result) { $('#modalEcAtendimento').modal('hide'); bootbox.alert(result.mensagem); } }); return false; } function setECValidaEndereco() { var rua_in = document.getElementById('rua_in').value; var numero_in = document.getElementById('numero_in').value; var complemento_in = document.getElementById('complemento_in').value; var bairro_in = document.getElementById('bairro_in').value; var cidade_in = document.getElementById('cidade_in').value; var estado_in = document.getElementById('estado_in').value; var cep_in = document.getElementById('cep_in').value; var pais_in = document.getElementById('pais_in').value; var anexo_in = document.getElementById('anexo_in').value; var rua = document.getElementById('rua').value; var numero = document.getElementById('numero').value; var complemento = document.getElementById('complemento').value; var bairro = document.getElementById('bairro').value; var cidade = document.getElementById('cidade').value; var estado = document.getElementById('estado').value; var cep = document.getElementById('cep').value; var pais = document.getElementById('pais').value; if ((rua_in !== rua || numero_in !== numero || complemento_in !== complemento || bairro_in !== bairro || cidade_in !== cidade || estado_in !== estado || cep_in !== cep || pais_in !== pais) && anexo_in.length <= 0 ) { document.getElementById('anexo').setAttribute('required', ''); } } function getAtendimentosDadosSolicitante(pessoa_id) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getAtendimentosDadosSolicitante&pessoa_id=" + pessoa_id, dataType: 'JSON', success: function (result) { $('#modalSolicitanteBody').html(result.dados); $('#modalSolicitante').modal('toggle'); } }); return false; } function getEcRmCidades(CODETDMUNICIPIO, cidade) { $('#cidade').html(''); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getEcRmCidades&CODETDMUNICIPIO=" + CODETDMUNICIPIO + "&cidade=" + cidade, dataType: 'JSON', success: function (result) { $('#cidade').html(result.dados); if ($('#cidade').hasClass('selectpicker')) { $('#cidade').selectpicker('refresh'); $('#cidade').selectpicker('refresh'); } } }); return false; } function setEcPessoasAtualizaCadastro(pessoa_id) { bootbox.confirm({ message: "
Confirma reenvio da solicitação para atualização de dados?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=setEcPessoasAtualizaCadastro&pessoa_id=" + pessoa_id, dataType: 'JSON', success: function (result) { bootbox.alert(result.dados); $('#modalSolicitante').modal('toggle'); document.getElementById('resposta').value = 'Solicitação para nova atualização enviada ao colaborador.'; document.getElementById('encerrar').checked = true; } }); } } }); } function setEcPessoasAtualizaRM(pessoa_id) { bootbox.confirm({ message: "
Confirma atualização do endereço no RM/TOTVS?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=setEcPessoasAtualizaRM&pessoa_id=" + pessoa_id, dataType: 'JSON', success: function (result) { bootbox.alert(result.dados); $('#modalSolicitante').modal('toggle'); document.getElementById('resposta').value = 'Atualização de dados efetuada com sucesso.'; document.getElementById('encerrar').checked = true; } }); } } }); } function getPostosListPorOcorrencias(data, posto_id, pv) { $('#posto_id').html(''); if (data.length <= 0) { return; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getPostosListPorOcorrencias&data=" + data + "&posto_id=" + posto_id + "&pv=" + pv, dataType: 'JSON', success: function (result) { if (result.erro === 1) { bootbox.alert(result.dados); } else { $('#posto_id').html(result.dados); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); $('#posto_id').selectpicker('refresh'); } } } }); } function getPlanejamentosPorDataPVs() { $('#posto_id').html(''); $('#posto_id_full').html(''); var supervisor_id = document.getElementById('supervisor_id').value; var data = document.getElementById('dataP').value; if (supervisor_id.length <= 0 && data.length <= 0) { return; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getPlanejamentosPorDataPVs&supervisor_id=" + supervisor_id + "&data=" + data, dataType: 'JSON', success: function (result) { if (result.erro === 1) { bootbox.alert(result.dados); } else { $('#posto_id').html(result.dados); if ($('#posto_id').hasClass('selectpicker')) { $('#posto_id').selectpicker('refresh'); } } } }); } function getPostosBDOList() { $('#posto_origem').html(''); document.getElementById('extra3').checked = false; document.getElementById('extra4').checked = false; $('#limite_funcionarios').val(''); var supervisor_id = document.getElementById('supervisor_id') ? document.getElementById('supervisor_id').value : ''; if (supervisor_id.length <= 0) { bootbox.alert('

Selecione um Supervisor para efetuar a operação.

'); return; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=getPostosBDOList&supervisor_id=" + supervisor_id, dataType: 'JSON', success: function (result) { if (result.erro === 1) { bootbox.alert(result.dados); } else { $('#posto_origem').html(result.dados); $('#modalClonaPosto').modal('toggle'); } } }); } function setComponenteDel(id) { $("#" + id).remove(); } function setModelosAddCampoOpcao(bloco_id, id) { var campo_opcao_nome = 'campo_id_' + id.toString() + '_opcao'; var filhos = document.getElementsByName(campo_opcao_nome + '[]'); if (filhos.length <= 0) { filhos = 1; } else { filhos = filhos.length + 1; } // var conteudo_atual = document.getElementById(bloco_id).outerHTML; var campo_id_opcao = '

'; campo_id_opcao += '

'; campo_id_opcao += ''; campo_id_opcao += ''; campo_id_opcao += '

'; campo_id_opcao += '

'; document.getElementById(bloco_id).insertAdjacentHTML('beforeend', campo_id_opcao); } function setModelosAddCampo() { var table = document.getElementById("tab_campos"); var row = table.insertRow(-1); row.id = table.childElementCount - 1; var cell0 = row.insertCell(0); var cell1 = row.insertCell(1); var cell2 = row.insertCell(2); var cell3 = row.insertCell(3); var cell4 = row.insertCell(4); var cell5 = row.insertCell(5); var cell6 = row.insertCell(6); var cell7 = row.insertCell(7); var cell8 = row.insertCell(8); var cell9 = row.insertCell(9); var cell10 = row.insertCell(10); cell10.id = 'campo_seq_' + row.id.toString() + '_opcoes'; var cell11 = row.insertCell(11); var campo_seq = ''; var campo_id = ''; var campo_ativo = '

'; campo_ativo += ''; campo_ativo += ''; campo_ativo += '

'; var campo_nome = ''; var campo_tipo_id = ''; var campo_ordem = ''; var campo_colunas = ''; var campo_tam_max = ''; var campo_explicacao = ''; var campo_tipo_opcoes = ''; var campo_opcoes_sql = ''; cell0.innerHTML = campo_seq + campo_id + ''; cell1.innerHTML = campo_ativo; cell2.innerHTML = campo_nome; cell3.innerHTML = campo_tipo_id; cell4.innerHTML = campo_ordem; cell5.innerHTML = campo_colunas; cell6.innerHTML = campo_tam_max; cell7.innerHTML = campo_explicacao; cell8.innerHTML = campo_tipo_opcoes; cell9.innerHTML = campo_opcoes_sql; cell10.innerHTML = ''; cell11.innerHTML = ''; } function setDeleteFormRegistro(registro_id) { bootbox.confirm({ message: "Confirma exclusão definitiva do registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: "acao=setDeleteFormRegistro&registro_id=" + registro_id, success: function (res) { bootbox.alert({ message: res, callback: function () { location.reload(true); } }); } }); } } }); } function getRegistrosFormsRespostasFiltros(form_id, respostas_sel) { $('#resposta_id').html(''); $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'json', data: { acao: 'getRegistrosFormsRespostasFiltros', form_id: form_id, respostas_sel: respostas_sel }, success: function (res) { if (res.sucesso === '0') { bootbox.alert(res.mensagem) } else { $('#resposta_id').html(res.mensagem); if ($('#resposta_id').hasClass('selectpicker')) { $('#resposta_id').selectpicker('refresh'); $('#resposta_id').selectpicker('refresh'); } } } }); } function getAtendimentosSenhas() { var atual = document.getElementById('atual').innerHTML; var updated_at_time = document.getElementById('updated_at_time').value; $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'json', data: { acao: 'getAtendimentosSenhas' }, success: function (res) { if (res.sucesso === 0) { bootbox.alert(res.dados) } else { $('#pessoa_nome').html(res.dados[0].pessoa_nome); $('#atual').html(res.dados[0].senha); $('#antes_1').html(res.dados[1].senha); $('#antes_2').html(res.dados[2].senha); $('#antes_3').html(res.dados[3].senha); $('#antes_4').html(res.dados[4].senha); document.getElementById('updated_at_time').value = res.dados[0].updated_at_time; if (atual.length > 0 && res.dados[0].senha.length > 0 && atual !== res.dados[0].senha && updated_at_time !== res.dados[0].updated_at_time ) { const audio = new Audio("https://www.soundjay.com/buttons/beep-02.mp3"); audio.play(); setTimeout(function () { audio.play(); }, 1000); } } } }); } function setAtendimentosRegistroSenha(atendimento_id, preferencial_id, departamento_id) { bootbox.confirm({ message: "Confirma geração de Senha para o registro?", buttons: { confirm: { label: 'Sim', className: 'btn-success' }, cancel: { label: 'Não', className: 'btn-danger' } }, callback: function (result) { if (result) { $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'json', data: { acao: 'setAtendimentosRegistroSenha', atendimento_id: atendimento_id, preferencial_id: preferencial_id, departamento_id: departamento_id }, success: function (res) { bootbox.alert({ message: res.dados, callback: function () { if (res.erro === 0) { location.reload(true); } } }); } }); } } }); return false; } function setAtendimentosSenhaChamar(atendimento_id) { var guiche = document.getElementById('guiche_id').value; if (guiche.length <= 0) { bootbox.alert('

Selecione uma Sala/Guichê para informar chamada no painel de senhas.

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'setAtendimentosSenhaChamar', atendimento_id: atendimento_id, guiche: guiche }, success: function (result) { bootbox.alert(result); } }); return false; } function setAddPPessoa() { var add_pessoa_nome = document.getElementById('add_pessoa_nome').value; var add_pessoa_cpf = document.getElementById('add_pessoa_cpf').value; var add_pessoa_email = document.getElementById('add_pessoa_email').value; var add_pessoa_telefone = document.getElementById('add_pessoa_telefone').value; if (add_pessoa_nome.length <= 0 || add_pessoa_cpf.length <= 0) { bootbox.alert('

Ops! Campos Nome e CPF são obrigatórios.

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", data: { acao: 'setAddPPessoa', nome: add_pessoa_nome, cpf: add_pessoa_cpf, email: add_pessoa_email, telefone: add_pessoa_telefone }, success: function (res) { bootbox.alert({ message: res, callback: function () { location.reload(true); } }); } }); return false; } function setAddDiaristaShow() { document.getElementById('add_diarista_nome').value = ''; document.getElementById('add_diarista_cpf').value = ''; document.getElementById('add_diarista_telefone1').value = ''; document.getElementById('add_diarista_banco').value = ''; document.getElementById('add_diarista_agencia').value = ''; document.getElementById('add_diarista_operacao').value = ''; document.getElementById('add_diarista_conta').value = ''; document.getElementById('add_diarista_estado').value = ''; document.getElementById('add_diarista_cidade').value = ''; $('#modalAddDiarista').modal('toggle'); return false; } function setAddDiaristaSave() { var nome = document.getElementById('add_diarista_nome').value; var cpf = document.getElementById('add_diarista_cpf').value; var telefone1 = document.getElementById('add_diarista_telefone1').value; var banco = document.getElementById('add_diarista_banco').value; var agencia = document.getElementById('add_diarista_agencia').value; var operacao = document.getElementById('add_diarista_operacao').value; var conta = document.getElementById('add_diarista_conta').value; var estado = document.getElementById('add_diarista_estado').value; var cidade = document.getElementById('add_diarista_cidade').value; if (nome.length <= 0 || cpf.length <= 0 || telefone1.length <= 0 || banco.length <= 0 || agencia.length <= 0 || conta.length <= 0 || estado.length <= 0 || cidade.length <= 0) { bootbox.alert('

Ops! Campos obrigatórios não informados.

'); return false; } $.ajax({ url: '/tela/uteis/ajax-action.php', type: "post", dataType: 'json', data: { acao: 'setAddDiaristaSave', nome: nome, cpf: cpf, telefone1: telefone1, banco: banco, agencia: agencia, operacao: operacao, conta: conta, estado: estado, cidade: cidade }, success: function (res) { bootbox.alert({ message: res.dados, callback: function () { if (res.sucesso == 1) { location.reload(true); } } }); } }); return false; }

Videos

1. Como Ser um Líder de Sucesso mesmo sendo Iniciante
(Murilo Manzano)
2. Leandro Karnal fala sobre ética em ambientes profissionais
(Tribunal Superior do Trabalho)
3. Como Conviver Com As Diferenças? - Mario Sergio Cortella
(Canal do Cortella)
4. Webinar das Cidades Digitais do Sul do Mato Grosso do Sul
(Rede Cidade Digital)
5. Exandria Unlimited: Calamity Wrap-Up
(Critical Role)
6. Sobrevivi 100 Dias NO APOCALIPSE ZUMBI Em Um BLOCO - O FILME
(CarlinDoPlay)
Top Articles
Latest Posts
Article information

Author: Roderick King

Last Updated: 01/11/2023

Views: 5247

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Roderick King

Birthday: 1997-10-09

Address: 3782 Madge Knoll, East Dudley, MA 63913

Phone: +2521695290067

Job: Customer Sales Coordinator

Hobby: Gunsmithing, Embroidery, Parkour, Kitesurfing, Rock climbing, Sand art, Beekeeping

Introduction: My name is Roderick King, I am a cute, splendid, excited, perfect, gentle, funny, vivacious person who loves writing and wants to share my knowledge and understanding with you.