function buscarProvcp(b, a, nomTF=false){
  const parametros = new FormData();
  parametros.append("txtNom", document.formProvcp.txtNom.value);
  parametros.append("txtNit", document.formProvcp.txtNit.value);

  $.ajax({
    data:  parametros,
    url:   "busProvcp/data.php",
    type:  "post",
    contentType: false,
    processData: false,
    beforeSend: function () {
      alLoad("Consultando...")
    },
    success: function (jsonPhp) {
      const jsonJS = JSON.parse(jsonPhp);

      tblClear("tblProvcp");
      jsonJS.provcp.forEach(function(i){
        addRowProvcp(i.pro_cod, i.pro_nom, i.pro_nit);
      });

      $("#tblProvcp tbody tr").dblclick(function() {
        selectProvcp(a, $(this), nomTF);
      });

      $("#tblProvcp tbody #btnSelecProvcp").click(function() {
        selectProvcp(a, $(this).parents("tr"), nomTF);
      });

      alClose();
    }
  });
}

function addRowProvcp(cod, nom, nit) {
  const markup =  "<tr>"
                    +"<td>"+cod+"</td>"
                    +"<td>"+nom+"</td>"
                    +"<td>"+nit+"</td>"
                    +"<td><button class='btn btn-sm btn-warning badge' id='btnSelecProvcp'>"+textBtnSelec+"</button></td>"
                  +"</tr>";
  $("#tblProvcp tbody").append(markup);
}

function selectProvcp(a, tr, nomTF) {
  $("#pills-"+a+"-tab").click();
  /*if (inputProvcp == "txtNit") {
    document.thisform.txtNit.value = tr.find("td:eq(0)").text();
    $("form[name='thisform'] #txtNit").trigger("change");
  } else {*/
    $("#"+inputProvcp).val(tr.find("td:eq(0)").text());
    if (!nomTF) {
      $("#"+inputProvcp).trigger("change");
    } else {
      $("#"+inputProvcp+"Nom").val(tr.find("td:eq(1)").text());
    }
  //}

  //$('html, body').animate( { scrollTop : 0 }, 500 );
  tblClear("tblProvcp");
}