function buscarClien(b, a){
  const parametros = new FormData();
  parametros.append("txtNom", document.formClien.txtNom.value);
  parametros.append("txtNit", document.formClien.txtNit.value);

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

      tblClear("tblClien");
      jsonJS.clien.forEach(function(i){
        addRowClien(i.cli_nit, i.cli_nom);
      });

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

      $("#tblClien tbody #btnSelecClien").click(function() {
        selectClien(a, $(this).parents("tr"));
      });

      alClose();
    }
  });
}

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

function selectClien(a, tr) {
  $("#pills-"+a+"-tab").click();
  /*if (inputClien == "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());
    $("#"+inputClien).trigger("change");
  //}

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