function buscarClienccCod(b, a, nomTF=false){
  const parametros = new FormData();
  parametros.append("txtNom", document.formClienccCod.txtNom.value);
  parametros.append("txtCod", document.formClienccCod.txtCod.value);

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

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

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

      $("#tblClienccCod tbody #btnSelecClienccCod").click(function() {
        selectClienccCod(a, $(this).parents("tr"), nomTF);
      });

      alClose();
    }
  });
}

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

function selectClienccCod(a, tr, nomTF) {
  $("#pills-"+a+"-tab").click();
  $("#"+inputClienccCod).val(tr.find("td:eq(0)").text());
  if (!nomTF) {
    $("#"+inputClienccCod).trigger("change");
  } else {
    $("#"+inputClienccCod+"Nom").val(tr.find("td:eq(1)").text());
  }

  tblClear("tblClienccCod");
}