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

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

      tblClear("tblCliencc");
      jsonJS.cliencc.forEach(function(i){
        addRowCliencc(i.cli_cod, i.cli_nom, i.cli_nit);
      });

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

      $("#tblCliencc tbody #btnSelecCliencc").click(function() {
        selectCliencc(a, $(this).parents("tr"), nomTF);
      });

      alClose();
    }
  });
}

function addRowCliencc(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='btnSelecCliencc'>"+textBtnSelec+"</button></td>"
                  +"</tr>";
  $("#tblCliencc tbody").append(markup);
}

function selectCliencc(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 {*/
    $("#"+inputClien).val(tr.find("td:eq(0)").text());
    if (!nomTF) {
      $("#"+inputClien).trigger("change");
    } else {
      $("#"+inputClien+"Nom").val(tr.find("td:eq(1)").text());
    }
  //}

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