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

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

      tblClear("tblTipomaq");
      jsonJS.tipomaquina.forEach(function(i){
        addRowTipomaq(i.tm_cod, i.tm_nom);
      });

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

      $("#tblTipomaq tbody #btnSelecTipomaq").click(function() {
        selectTipomaq(a, $(this).parents("tr"));
      });

      alClose();
    }
  });
}

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

function selectTipomaq(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 {*/
    $("#"+inputTipomaq).val(tr.find("td:eq(0)").text());
    $("#"+inputTipomaq).trigger("change");
  //}

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