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 pupularModalDep(id){ document.getElementById('id_dep_modal').value = id; document.getElementById('nome_modal').value = $('#tr_dp_'+id+'').find('.dep_id').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 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",'