function buscarTipoc(b, a){
  const parametros = new FormData();
  parametros.append("txtNom", document.formTipoc.txtNom.value);

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

      tblClear("tblTipoc");
      jsonJS.tipoc.forEach(function(i){
        addRowTipoc(i.tc_cod, i.tc_nom);
      });

      $("#tblTipoc tbody tr").dblclick(function() {
        selectTipoc(a, $(this));
      });

      $("#tblTipoc tbody #btnSelecTipoc").click(function() {
        selectTipoc(a, $(this).parents("tr"));
      });

      alClose();
    }
  });
}

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

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

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