function popularCampoData(data){ var myStr = data; var strArray = myStr.split("/"); return strArray[2]+'-'+strArray[1]+'-'+strArray[0]; } function pupularModal(id,valor_pgto,num_parcela){ // Exibindo data no input ao iniciar tarefa var d = new Date(); dataHora = (d.toLocaleString()); document.getElementById('id_parcela_baixa_modal').value = id; document.getElementById('vl_receber_modal').value = valor_pgto; document.getElementById('vl_recebido_modal_aux').value = valor_pgto; document.getElementById('vl_recebido_modal').value = valor_pgto; document.getElementById('num_parcela_modal').value = num_parcela; document.getElementById('data_vencimento_modal').value = $('#tr_'+id+'').find('.dt_vencimento').html(); document.getElementById('dt_pagamento_modal').value = dataHora; //document.getElementById('juros_modal').value = calcula($('#tr_'+id+'').find('.dt_vencimento').html());; $("#alertModalsuccess_baixa").addClass('d-none'); $("#alertModaldanger_baixa").addClass('d-none'); } /* function calcula(){ vencimento = document.getElementById("datavenc").value; pagamento = document.getElementById("datapag").value; if(document.getElementById("datavenc").type !== "date"){ // para o Firefox que não suporta type="date" venc_array = vencimento.split("/"); pagt_array = pagamento.split("/"); vencimento = venc_array[2] + "-" + venc_array[1] + "-" + venc_array[0]; pagamento = pagt_array[2] + "-" + pagt_array[1] + "-" + pagt_array[0]; } d1 = new Date(vencimento); d2 = new Date(pagamento); dias_atraso = parseInt((d2 - d1) / (24 * 3600 * 1000)); valortit = parseFloat(document.getElementById("valortitulo").value); outrasdesp = document.getElementById("despesas").value; outrasdesp = (outrasdesp == "") ? 0 : parseFloat(outrasdesp); juros = ((valortit * .05) / 30) * (dias_atraso); if (!isNaN(dias_atraso) && !isNaN(juros)) { document.getElementById("diasematraso").value = dias_atraso; document.getElementById("juros").value = juros.toFixed(2).replace(".", ","); document.getElementById("valortotal").value = (valortit + juros + outrasdesp).toFixed(2).replace(".", ","); } } */ function pupularModalEdita(id,valor_pgto,num_parcela){ // Exibindo data no input ao iniciar tarefa var d = new Date(); dataHora = (d.toLocaleString()); document.getElementById('id_parcela_edit').value = id; document.getElementById('vl_receber_edit').value = valor_pgto; document.getElementById('num_parcela_edit').value = num_parcela; document.getElementById('data_vencimento_edit').value = popularCampoData($('#tr_'+id+'').find('.dt_vencimento').html()); //document.getElementById('dt_pagamento_modal').value = dataHora; //$("#alertModalsuccess_baixa").addClass('d-none'); //$("#alertModaldanger_baixa").addClass('d-none'); } function bt_edt(id){ document.getElementById('id_cliente_etd').value = id; document.getElementById('observacao_agenda_edt').value = $('#tr_ag_'+id+'').find('#ag_obs').find('#tx_obs').html(); document.getElementById('dt_retorno_agenda_edt').value = popularCampoData($('#tr_ag_'+id+'').find('.ag_dt_retorno').html()); } function bt_Fin(id){ document.getElementById('id_cliente_fin').value = id; } function pupularModalDep(id){ document.getElementById('id_dep_modal').value = id; document.getElementById('nome_modal').value = $('#tr_dp_'+id+'').find('.dep_id').html(); document.getElementById('dep_contrato_add').value = $('#tr_dp_'+id+'').find('.dep_contrato').html(); document.getElementById('dt_nasc_modal').value = popularCampoData($('#tr_dp_'+id+'').find('.dep_dt_nas').html()); document.getElementById('dt_obito_modal').value = popularCampoData($('#tr_dp_'+id+'').find('.dep_dt_obt').html()); document.getElementById('dt_carencia_modal').value = popularCampoData($('#tr_dp_'+id+'').find('.dep_dt_car').html()); document.getElementById('btn-save').value = "Up"; document.getElementById('liberacadastro').value = "true"; $("#btn-save").html("Editar Dependente"); } function editar_dependentes_todos(qtd_dependentes){ for (var $i = 1; $i <= qtd_dependentes; $i++) { if (document.getElementById('id_dependente_'+$i).value > 0 ){ document.getElementById('id_dep_modal_edit_'+$i).value = document.getElementById('id_dependente_'+$i).value; document.getElementById('nome_modal_edit_'+$i).value = $('#tr_dp_'+$i+'').find('.dep_id_'+$i+'').html(); document.getElementById('n_contrato_dep_edit_'+$i).value = $('#tr_dp_'+$i+'').find('.dep_contrato_'+$i+'').html(); document.getElementById('dt_nasc_modal_edit_'+$i).value = popularCampoData($('#tr_dp_'+$i+'').find('.dep_dt_nas_'+$i+'').html()); document.getElementById('dt_obito_modal_edit_'+$i).value = popularCampoData($('#tr_dp_'+$i+'').find('.dep_dt_obt_'+$i+'').html()); document.getElementById('dt_carencia_modal_edit_'+$i).value = popularCampoData($('#tr_dp_'+$i+'').find('.dep_dt_car_'+$i+'').html()); $('#n_contrato_dep_edit_'+$i).attr('disabled',false); $('#nome_modal_edit_'+$i).attr('disabled',false); $('#dt_nasc_modal_edit_'+$i).attr('disabled',false); $('#dt_obito_modal_edit_'+$i).attr('disabled',false); $('#dt_carencia_modal_edit_'+$i).attr('disabled',false); } } /* document.getElementById('btn-save').value = "Up"; document.getElementById('liberacadastro').value = "true"; $("#btn-save").html("Editar Dependente");*/ } function pupularModalContEdt(id){ document.getElementById('n_contrato_edit_modal').value = id; document.getElementById('n_contrato_edit_modal_aux').value = id; document.getElementById('dt_emissao_contrato_edit_modal').value = $('#tr_ctr_'+id+'').find('.ctr_dt_emi').html(); document.getElementById('dt_carencia_edit_contrato_modal').value = $('#tr_ctr_'+id+'').find('.ctr_dt_car').html(); document.getElementById('dt_encerramento_edit_contrato_modal').value = $('#tr_ctr_'+id+'').find('.ctr_dt_enc').html(); document.getElementById('qtd_parcelas_edit_taxa_modal').value = $('#tr_ctr_'+id+'').find('.ctr_tx_venc').html(); document.getElementById('resp_contrato_edit_modal').value = $('#tr_ctr_'+id+'').find('.ctr_nome_r').html(); var id_resp = $('#tr_ctr_'+id+'').find('.ctr_id_r').html(); set_responsavel(id_resp); } function pupularModalImp(id){ document.getElementById('id_guia_imp').value = id; document.getElementById('nome_guia_modal').value = $('#tr_guia_'+id+'').find('.imp_utilizador').html(); var ref = $('#tr_guia_'+id+'').find('.arquivo_cons').html(); //CAMINHO DA GUIA $('#a_imprime_guia').attr("href",'{{URL::to("guia") }}/'+id); //CAMINHO SE EXISTIR O GUIA DA CONSULTA if(ref ==""){ $('#a_imprime_consulta').attr("style","display: none;"); }else{ $('#a_imprime_consulta').attr("style","display: block;"); $('#a_imprime_consulta').attr("href",'{{ URL::to("/upload/impressoesConsulta") }}/'+ref); } } function ImprimirCarteirinha(){ var link = document.getElementById('sl_contrato_imp').value; var tam_fon = document.getElementById('size_font_dep_imp').value; //CAMINHO DA GUIA $('#a_imp_carteirinha').attr("href",'{{URL::to("carteirinhaCliente?id=") }}'+link+'&size='+tam_fon); } function ImprimirEnvelope(){ var link = document.getElementById('sl_contrato_imp_env').value; //CAMINHO DA GUIA $('#a_imp_envelope').attr("href",'{{URL::to("relatorios/RelCliente_5") }}/'+link); } function pupularModalgerarCp(id){ document.getElementById('nr_guia').value = id; document.getElementById('nr_guia_aux').value = id; document.getElementById('vl_repasse_modal').value = $('#tr_guia_'+id+'').find('.vl_repasse_modal').html(); document.getElementById('nr_guia_id_conveniado').value = $('#tr_guia_'+id+'').find('.id_conveniado_modal').html(); document.getElementById('guia_nome_conveniado').value = $('#tr_guia_'+id+'').find('.nome_conveniado_modal').html(); } function pupularModalImpConsulta(id){ document.getElementById('id_convprev_modal').value = id; } function desfazerbaixa(id){ document.getElementById('inp_desfazer').value = $('#tr_'+id+'').find('#id_parcela').val(); $('#inp_desfazer').click(); } function excluirParcela(id,origem){ if(origem == 1){ document.getElementById('inp_excluir').value = $('#tr_'+id+'').find('#id_parcela').val(); $('#inp_excluir').click(); }else{ document.getElementById('inp_excluir').value = $('#tr_'+id+'').find('#id_comissao').val(); $('#inp_excluir').click(); } } function excluirBoleto(id){ document.getElementById('inp_excluir_boleto').value = id; $('#inp_excluir_boleto').click(); } function excluirmovimentacao(id){ document.getElementById('inp_excluir_mov').value = $('#tr_'+id+'').find('#id_movimentacao').val(); $('#inp_excluir_mov').click(); } function numberToReal(numero) { if(numero == '' || numero == null){ numero = 0; } var numero = numero.toFixed(2).split('.'); numero[0] = numero[0].split(/(?=(?:...)*$)/).join('.'); return numero.join(','); } function numberToReal2(numero) { if(numero == '' || numero == null){ numero = 0; } var numero = parseFloat(numero).toFixed(2).split('.'); numero[0] = numero[0].split(/(?=(?:...)*$)/).join('.'); return numero.join(','); } function limita_str(str,limite) { if(str != null){ if(str !="ND"){ txt=""; for(i=0;i