PageSourceSearch

https://saycontgt.com/vistas/js/notacredito.js

js saycontgt.com collected 2026-10-04 06:46:34 UTC 32,229 bytes, 713 lines download raw bytes

1$(".FormNotaCredito").on("change", "#serieFactura", function(){
2  BuscaFactura()
3});
4$(".btnNC1").click(function(){
5  var id = $("#idNC").val();
6  window.open("extensiones/tcpdf/pdf/NotaCredito.php?id="+id, "_blank");
7});
8$(".FormNotaCredito").on("change", "#numFactura", function(){
9  BuscaFactura()
10});
11$(".btnFelNoExe").click(function(){
12  $("#alertFacturaFEl").css("display", "block");
13  setTimeout(function(){ BuscaFacturaAutorizarFEL() }, 3300);
14  setTimeout(function(){  $("#alertFacturaFEl").css("display", "none"); BuscaFacturaAutorizarFEL() }, 6000);
15});
16$(".btnNCSFEL").click(function(){
17  $("#alertNCFEl").css("display", "block");
18  setTimeout(function(){ BuscaNCFEL() }, 3300);
19  setTimeout(function(){ $("#alertNCFEl").css("display", "none"); $("#stateContingenciaNC").val(1); BuscaNCFEL() }, 6000);
20});
21$(".btnFelExe").click(function(){
22  $("#alertFacturaFEl").css("display", "block");
23  setTimeout(function(){ BuscaFacturaAutorizarFEL() }, 3300);
24  setTimeout(function(){  $("#alertFacturaFEl").css("display", "none"); BuscaFacturaAutorizarFEL() }, 6000);
25});
26$(".FormNotaCredito").on("change", "#2serieFactura", function(){
27  BuscaFacturaAutorizarFEL()
28});
29$(".FormNotaCredito").on("change", "#2numFactura", function(){
30  BuscaFacturaAutorizarFEL()
31});
32function BuscaFacturaAutorizarFEL() {
33var serie = $("#2serieFactura").val();
34var num = $("#2numFactura").val();
35      if ( (serie == " " || serie == "") || (num == " " || num == "")) {
36      }
37      else {
38            var datos = {
39              'serie':serie,
40              'num':num
41            }
42            $.ajax({
43              url:"ajax/FacturaFEL.ajax.php",
44              type:"POST",
45              data: datos,
46              dataType:"json",
47              success: function(respuesta){
48                                  if (!respuesta) {
49                                        $("#nitCliente").val(" ");
50                                        $("#cliente").val(" ");
51                                        $("#idFactura").val(" ");
52                                        $("#idFacturaExenta").val(" ");
53                                        $("#montoFactura").val("0.00");
54                                        $("#montoFactura").number(true, 2);
55                                        $("#formExento").css("display", "none");
56                                        $("#formNoExento").css("display", "none");
57                                        $("#formFFel").css("display", "none");
58                                        $("#stateFEL").css("background-color", "gray");
59                                        $("#stateFEL").val("- - - - -");
60                                        $(function() {
61                                                const Toast = Swal.mixin({
62                                                  toast: true,
63                                                  position: 'top-end',
64                                                  showConfirmButton: fal
64se,
65                                                  timer: 3000
66                                                });
67                                                Swal.fire({
68                                                  position: 'top-end',
69                                                  icon: 'error',
70                                                  title: 'Serie o Número de factura no existen.',
71                                                  showConfirmButton: false,
72                                                  timer: 1500
73                                                }).then((result)=>{});
74                                          });
75                                  }
76                                  else
77                                  {
78                                    var state = respuesta["estado"];
79                                    $("#nitCliente").val(respuesta["nitCliente"]);
80                                    $("#cliente").val(respuesta["nombre"]);
81                                    $("#idFactura").val(respuesta["idfactura_encabezado"]);
82                                    $("#idFacturaExenta").val(respuesta["idfactura_encabezado"]);
83                                    $("#montoFactura").val(respuesta["total"]);
84                                    $("#montoFactura").number(true, 2);
85                                    if (state == 1) {
86                                      var exento2 = respuesta["exentoIVA"];
87                                          if (exento2 == 1) {$("#formNoExento").css("display", "block"); $("#formExento").css("display", "none");}
88                                          if (exento2 == 0) {$("#formExento").css("display", "block"); $("#formNoExento").css("display", "none");}
89                                      $("#stateFEL").css("background-color", "red");
90                                      $("#stateFEL").val("PENDIENTE");
91                                    }
92                                    if (state == 2) {
93                                      $("#stateFEL").css("background-color", "green");
94                                      $("#stateFEL").val("AUTORIZADO");
95                                      $("#formExento").css("display", "none");
96                                      $("#formNoExento").css("display", "none");
97                                    }
98                                    $("#formFFel").css("display", "block");
99                                  }
100                        }
101            })// FIN AJAX
102      }
103}/*
104$(".btnAurotizarFacturaElec").click(function(){
105  var id = 1;
106  window.open("vistas/modulos/xmlFEL.php&id="+id);
107  //window.open("index.php?ruta=xmlFEL&id="+id, "_blank");
108});*/
109function BuscaFactura() {
110var serie = $("#serieFactura").val();
111var num = $("#numFactura").val();
112      if ( (serie == " " || serie == "") || (num == " " || num == "")) {
113      }
114      else {
115            var datos = {
116              'serie':serie,
117              'num':num
118            }
119            $.ajax({
120              url:"ajax/FacturaNotaCredito.ajax.php",
121              type:"POST",
122              data: datos,
123              dataType:"json",
124              success: function(respuesta){
125                                  if (!respuesta) {
126                                        $("#nitCliente").val(" ");
127                                        $("#cliente").val(" ");
128                                        $("#idCXC").val(" ");
129                                        $("#idCXC").val("0");
130                                        //$("#numCuentaClie").val("");
131                                        //$("#cuentaCliente").val("NOMBRE DEL CLIENTE");
132                                        $("#montoFactura").val("0.00");
133                                        $("#montoFactura").number(true, 2);
134                                        $(function() {
135                                                const Toast = Swal.mixin({
136                                                  toast: true,
137                                                  position: 'top-end',
138                                                  showConfirmButton: fal
138se,
139                                                  timer: 3000
140                                                });
141                                                Swal.fire({
142                                                  position: 'top-end',
143                                                  icon: 'error',
144                                                  title: 'Serie o Número de factura no existen.',
145                                                  showConfirmButton: false,
146                                                  timer: 1500
147                                                }).then((result)=>{});
148                                          });
149                                  }
150                                  else
151                                  {
152                                    $("#nitCliente").val(respuesta["nitCliente"]);
153                                    $("#cliente").val(respuesta["nombre"]);
154                                    $("#idCXC").val(respuesta["idCuentasxCobrar"]);
155                                    $("#gss").val(respuesta["centroCostos"]);
156                                    $("#montoFactura").val(respuesta["saldo"]);
157                                    $("#montoFactura").number(true, 2);
158                                    var exento2 = respuesta["exentoIVA"];
159                                    $("#exentoIVA").val(exento2);
160                                        if (exento2 == 1) {$("#divIVANC").css("display", "block");}
161                                        if (exento2 == 0) {$("#divIVANC").css("display", "none");}
162                                    var nitCliente = $("#nitCliente").val();
163                                    var datos = new FormData();
164                                    datos.append("nitCliente",nitCliente);
165                                    $.ajax({
166                                      url:"ajax/proveedor.ajax.php",
167                                      method:"POST",
168                                      data: datos,
169                                      cache: false,
170                                      contentType: false,
171                                      processData: false,
172                                      dataType:"json",
173                                      success: function(respuesta){
174                                        if (!respuesta) {
175                                                  $("#busquedanombre").val("");
176                                        }else{
177                                          //$("#cuentaCliente").val(respuesta["nombre"]);
178                                          //var idcc = parseInt(respuesta["CuentaContable"]);
179                                          //ajax buscar cuenta contable cliente
180                                          //var idcc = parseInt(respuesta["CuentaContable"]);
181                                                  /*var dts = new FormData();
182                                                  dts.append("idcc", idcc);
183                                                  $.ajax({
184                                                        url:"ajax/findAccounting.ajax.php",
185                                                        method:"POST",
186                                                        data: dts,
187                                                        cache: false,
188                                                        contentType: false,
189                                                        processData: false,
190                                                        dataType:"json",
191                                                        success: function(respCC){
192                                                          $("#idNC").val(respCC["id"]);
193                                                          $("#numCuentaClie").val(respCC["Nomenclatura"]);
194                                                          $("#cuentaCliente").val(respCC["Cuenta"]);
195                                                        }
196                                                  })*///ajax buscar cuenta contable cliente
197                                          ListarCuentaClienteNC()
198                                          //ListarCuentaCliente(
198)
199                                          //ListarIvaPorPagar()
200                                          //ListarCuentaServicios()
201                                        }
202                                                                  }
203                                    })
204
205
206                                  }
207                        }
208            })// FIN AJAX
209      }
210}
211/*=============================================
212        MODIFICAR LA CANTIDAD DE NOTA
213=============================================*/
214/*
215$(".FormNotaCredito").on("change", "#TotalNota", function(){
216  var totNota = Number($("#TotalNota").val());
217  var totFact = Number($("#montoFactura").val());
218  if (totNota > totFact) {
219    $(function() {
220            const Toast = Swal.mixin({
221              toast: true,
222              position: 'top-end',
223              showConfirmButton: false,
224              timer: 3000
225            });
226            Swal.fire({
227              position: 'top-end',
228              icon: 'error',
229              title: 'El total de la nota no puede ser mayor a la factura',
230              showConfirmButton: false,
231              timer: 1500
232            }).then((result)=>{});
233      });
234      //$("#TotalNota").val(respuesta["total"]);
235  }
236});*/
237
238$(".FormNotaCredito").on('click', '.btnAgregarDetalleNC', function(){
239//$(".btnGenerarCotizacion").prop("disabled", true);
240var descServicio = $("#descDetalle").val();
241var cont = 1;
242var cero = 1;
243$("#descDetalle").val("");
244var x = $("#descDetalle").val()
245  if (x == " " || x == "") {
246    $(".btnAgregarDetalleNC").prop("disabled", true);
247  }
248$(".nuevoDetalleNotaCredito").append(
249    '<div class="row">'+
250          '<div class="col-md-6">'+
251              '<div class="input-group">'+
252                   '<span class="input-group-text"> <button type="button" class="btn btn-danger btn-xs quitarDescServicio" idDescServicio="'+cont+'"><i class="fa fa-times"> </i></button> </span>'+
253                   '<textarea type="text" rows="1" style="text-align:center; font-weight: bold" class="form-control nuevaDescServicio" name="nuevaDescServicio" required>'+descServicio+'</textarea>'+
254              '</div>'+
255          '</div>'+
256
257          '<div class="col-sm-2 CantSer">'+
258                '<input type="number" style="text-align:center; font-weight: bold" class="form-control CantServicios" id="CantServicios"  name="CantServicios" min="1" placeholder="0" required>'+
259          '</div>'+
260
261          '<div class="col-sm-2 pServicio">'+
262                '<input type="text" style="text-align:right; font-weight: bold" class="form-control precioServicio" id="precioServicio"  name="precioServicio"  placeholder="0.00" required>'+
263          '</div>'+
264
265          '<div class="col-sm-2 totalSer">'+
266              '<div class="input-group">'+
267                '<input type="text" style="text-align:right; font-weight: bold" class="form-control totalServicios" id="totalServicios" name="totalServicios" placeholder="0.00" disabled>'+
268              '</div>'+
269          '</div>'+
270      '</div>'
271  )
272  $(".precioServicio").number(true, 2);
273  $(".totalServicios").number(true, 2);
274  $(".TotalNota").number(true, 2);
275  listDescripcionNC()
276  SUMATORIADETALLE()
277});
278
279//======================================
280//        DESCRIPCION DE SERVICIO
281//======================================
282$(".FormNotaCredito").on("keyup", "#descDetalle", function(){
283  var x = $(this).val();
284  var y = $("#cliente").val();
285    if ((x == " " || x == "") || (y == " " || y == "")) {
286      $(".btnAgregarDetalleNC").prop("disabled", true);
287    }else {
288      $(".btnAgregarDetalleNC").prop("disabled", false);
289    }
290});
291$(".FormNotaCredito").on("keyup", ".nuevaDescServicio", function(){
292listDescripcionNC()
293}
293);
294$(".FormNotaCredito").on("change", "input.precioServicio", function(){
295  var cant = $(this).parent().parent().children(".CantSer").children(".CantServicios");
296  var totalProducto = $(this).parent().parent().children(".totalSer").children().children(".totalServicios");
297  var cantidad = $(cant).val();
298  var precioFinal =$(this).val()*cant.val();
299  totalProducto.val(precioFinal);
300          // SUMAR TOTAL DE PRECIOS
301          listDescripcionNC()
302          SUMATORIADETALLE()
303});
304//======================================
305//        CUANDO DE CAMBIE CANTIDAD
306//======================================
307$(".FormNotaCredito").on("change", "input.CantServicios", function(){
308  var precio = $(this).parent().parent().children(".pServicio").children(".precioServicio");
309  var totalProducto = $(this).parent().parent().children(".totalSer").children().children(".totalServicios");
310  var precioFinal =$(this).val()*precio.val();
311  totalProducto.val(precioFinal);
312          // SUMAR TOTAL DE PRECIOS
313          listDescripcionNC()
314          SUMATORIADETALLE()
315          //ValidarBotonCredito()
316});
317//======================================
318//        SUMA DE IMPORTE
319//======================================
320function SUMATORIADETALLE(){
321  var sueldoItem = $(".totalServicios");
322  var arraySumaSueldo = [];
323  for(var i = 0; i < sueldoItem.length; i++){
324     arraySumaSueldo.push(Number($(sueldoItem[i]).val()));
325  }
326  function sumaArraySueldos(total, numero){
327    return total + numero;
328  }
329  var sumaTotalSueldo = arraySumaSueldo.reduce(sumaArraySueldos);
330  $("#TotalNota").val(sumaTotalSueldo);
331  $(".TotalNota").number(true, 2);
332  OPERACIONNOTACREDITO()
333  ValidarBotonCredito()
334  ListarCuentaClienteNC()
335  //SALDOPENDIENTE()
336}
337//======================================
338//        LISTAR DETALLE
339//======================================
340function listDescripcionNC(){
341  var listarDescripcionN = [];
342  var nuevaDesc = $(".nuevaDescServicio");
343  var cant = $(".CantServicios");
344  var precio = $(".precioServicio");
345  var subtotal = $(".totalServicios");
346  for(var i = 0; i < nuevaDesc.length; i++){
347    listarDescripcionN.push({ "idDetalle" : $(nuevaDesc[i]).attr("idDescServicio"),
348                "Descripcion" : $(nuevaDesc[i]).val(),
349                "cantidad" : $(cant[i]).val(),
350                "precio" : $(precio[i]).val(),
351                "subtotal" : $(subtotal[i]).val()})
352  }
353  $("#listarNotaCredito").val(JSON.stringify(listarDescripcionN));
354}
355//======================================
356//        VALIDAR QUE TOTAL SEA MAYOR A 0 y MENOR A TOTAL FACTURA
357//======================================
358function ValidarBotonCredito(){
359
360    var total = Number($("#TotalNota").val());
361    var fact = Number($("#montoFactura").val());
362    var sumaDebe = Number($("#sumaDebe").val());
363    var sumaHaber = Number($("#sumaHaber").val());
364    if ((total > 0 && total <= fact ) && (sumaHaber >=1 && sumaDebe >=1) ) {
365          if (sumaHaber == sumaDebe) {
366            $(".btnNotaCredito").prop("disabled", false);
367            $(function() {
368                const Toast = Swal.mixin({
369                  toast: true,
370                  position: 'top-end',
371                  showConfirmButton: false,
372                  timer: 2000
373                });
374                Swal.fire({
375                  position: 'top-end',
376                  icon: 'success',
377                  title: '¡Ya puede realizar la nota de crédito!',
378                  showConfirmButton: false,
379                  timer: 2000
380                }).then((result)=>{
381                    });
382              });
383          }else {
384            $(".btnNotaCredito").prop("disabled", true);
385          }
386    }
387    if (total == 0 ) {
388      $(".btnNotaCredito").prop("disabled", true);
389    }
390    if (total > fact) {
391      $(".btnNotaCredito").prop("disabled", true);
392      $(function() {
393          const Toast = Swal.mixin({
394            toast: true,
395            position: 'top-end',
396            showConfirmButton: false,
397            timer: 3000
398          });
399          Swal.fire({
400            position: 'top-end',
401            icon: 'error',
402            title: 'El valor de la nota de crédito, es mayor al monto de la factura',
403            showConfirmButton: false,
404            timer: 1900
405          }).then((result)=>{
406              });
407        });
408    }
409}
410var idQuitarDescServicio = [];//modiifique esto
411localStorage.removeItem("quitarDescServicio");
412$(".FormNotaCredito").on("click", "button.quitarDescServicio", function(){
413	$(this).parent().parent().parent().parent().remove();
414	var idDescServicio = $(this).attr("idDescServicio");
415	/*=============================================
416	ALMACENAR EN EL LOCALSTORAGE EL ID DEL SERVICIO  A QUITAR
417	=============================================*/
418	if(localStorage.getItem("quitarDescServicio") == null){
419		idQuitarDescServicio = [];
420	}else{
421		idQuitarDescServicio.concat(localStorage.getItem("quitarDescServicio"))
422	}
423	idQuitarDescServicio.push({"idDescServicio":idDescServicio});
424	localStorage.setItem("quitarDescServicio", JSON.stringify(idQuitarDescServicio));
425    if($(".nuevoDetalleNotaCredito").children().length == 0){
426      listDescripcionNC()
427      $("#TotalNota").val(0.00);
428      $("#haberCliente").val(0.00);
429      OPERACIONNOTACREDITO ()
430  }else{
431    listDescripcionNC()
432    OPERACIONNOTACREDITO ()
433  }
434});
435$(".btnAgregarCC").click(function(){
436  var cont = 1;
437  var combo = document.getElementById("ComboCuentaContable");
438  var selected = combo.options[combo.selectedIndex].text;
439  var idcombo =combo.options[combo.selectedIndex].value;
440  var res = selected.split(" -- ");
441  $(".nuevaCuentaContableNC").append(
442      '<div class="row">'+
443            '<div class="col-md-2">'+
444                '<div class="input-group">'+
445                     '<span class="input-group-text"> <button type="button" class="btn btn-danger btn-xs QuitarCuentaNC" idDescServicio="'+cont+'"><i class="fa fa-times"> </i></button> </span>'+
446                     '<input type="text" style="text-align:center; font-weight: bold" class="form-control numCuentaContable"  value="'+res[0]+'" name="numCuentaContable" readonly>'+
447                '</div>'+
448            '</div>'+
449
450            '<div class="col-sm-6">'+
451                  '<textarea rows="1" type="text" style="text-align:left; font-weight: bold" class="form-control cuentaContable" id="cuentaContable"  name="cuentaContable" readonly>'+res[1]+'</textarea>'+
452            '</div>'+
453
454            '<div class="col-sm-2">'+
455                  '<input type="text" style="text-align:right; font-weight: bold" class="form-control debeNC" id="debeNC"  name="debeNC"  value="0.00">'+
456            '</div>'+
457
458            '<div class="col-sm-2">'+
459                '<div class="input-group">'+
460                  '<input type="text" style="text-align:right; font-weight: bold" class="form-control haberCC" id="haberCC" name="haberCC" value="0.00" readonly>'+
461                '</div>'+
462            '</div>'+
463            '<div class="col-sm-1">'+
464                  '<input type="hidden" style="text-align:center; font-weight: bold" class="form-control idCNC" value="'+idcombo+'" id="idCNC"  name="idCNC" readonly>'+
465            '</div>'+
466        '</div>'
467    )
468    $('.debeNC').number(true, 2);
469    $(".haberCC").number(true, 2);
470    ListarCuentaServicioNC()
471});
472/*=============================================
473                  QUITAR DETALLE
474=============================================*/
475var idQuitaCC = [];//modiifique esto
476localStorage.removeItem("QuitarCuentaNC");
477$(".FormNotaCredito").on("click", "button.QuitarCuentaNC", function(){
478	$(this).parent().parent().parent().parent().remove();
479	var idDescServicio = $(this).attr("idDescServicio");
480	/*=============================================
481	ALMACENAR EN EL LOCALSTORAGE EL ID DEL SERVICIO  A QUITAR
482	=============================================*/
483	if(localStorage.getItem("quitarDescServicio") == null){
484		idQuitaCC = [];
485	}else{
486		idQuitaCC.concat(localStorage.getItem("QuitarCuentaNC"))
487	}
488	idQuitaCC.push({"idDescServicio":idDescServicio});
489	localStorage.setItem("QuitarCuentaNC", JSON.stringify(idQuitaCC));
490    if($(".nuevaCuentaContableNC").children().length == 0){
491      ListarCuentaServicioNC()
492      SUMATORIADEBENC()
493      OPERACIONNOTACREDITO()
494      ValidarBotonCredito()
495  }else{
496    ListarCuentaServicioNC()
497    SUMATORIADEBENC()
498    ValidarBotonCredito()
499  }
500});
501function OPERACIONNOTACREDITO()
502{
503  var exentoIVA = $("#exentoIVA").val();
504  if (exentoIVA == 1) {
505    var totalNota = Number($("#TotalNota").val());
506    var precioSinIVA = totalNota / 1.12;
507    var precioConIVA = precioSinIVA * 0.12;
508    $("#haberCliente").val(totalNota);
509    $("#haberCliente").number(true, 2);
510    $("#debeIVA").val(precioConIVA);
511    $("#debeIVA").number(true, 2);
512    $("#sumaDebe").val(precioConIVA);
513    $("#sumaDebe").number(true, 2);
514    $("#sumaHaber").val(totalNota);
515    $("#sumaHaber").number(true, 2);
516    SaldoNotaCredito()
517    ListarCuentaClienteNC()
518    ListarCuentaIVANC()
519  }else {
520    var totalExento = Number($("#TotalNota").val());
521    $("#haberCliente").val(totalExento);
522    $("#haberCliente").number(true, 2);
523    $("#sumaHaber").val(totalExento);
524    $("#sumaHaber").number(true, 2);
525    SaldoNotaCredito()
526    ListarCuentaClienteNC()
527  }//else
528SUMATORIADEBENC()
529}
530$(".FormNotaCredito").on("change", "#debeNC", function(){
531  SUMATORIADEBENC()
532  ValidarBotonCredito()
533});
534function SUMATORIADEBENC()
535{
536    var haberCC = Number($("#debeNC").val());
537    var exento = $("#exentoIVA").val();
538    var iva = parseInt(0);
539        if (exento == 1) {
540            iva = Number($("#debeIVA").val());
541        }
542        var sueldoItem = $(".debeNC");
543        var sumaTotalSueldo = parseFloat(0.00);
544        if (sueldoItem.length >= 1) {
545            var arraySumaSueldo = [];
546            for(var i = 0; i < sueldoItem.length; i++){
547               arraySumaSueldo.push(Number($(sueldoItem[i]).val()));
548            }
549            function sumaArraySueldos(total, numero){
550              return total + numero;
551            }
552            sumaTotalSueldo = arraySumaSueldo.reduce(sumaArraySueldos);
553        }
554
555        var suma  = sumaTotalSueldo + iva;
556    $("#sumaDebe").val(suma);
557    $("#sumaDebe").number(true, 2);
558    SaldoNotaCredito()
559    if (exento == 1) {ListarCuentaIVANC()}
560    ListarCuentaServicioNC()
561}
562function ListarCuentaClienteNC(){
563  var lists = [];
564  var idNC = $(".idNC");
565  var cuenta = $(".numCuentaClie");
566  var descripcion = $(".cuentaCliente");
567  var debe = $(".debeCliente");
568  var haber = $(".haberCliente");
569  for(var i = 0; i < cuenta.length; i++){
570    lists.push({"id" : $(idNC[i]).val(), "cuenta" : $(cuenta[i]).val(),
571                "descripcion" : $(descripcion[i]).val(),
572                "debe" : $(debe[i]).val(),
573                "haber" : $(haber[i]).val()})
574  }
575  $("#ListarCuentaClienteNC").val(JSON.stringify(lists));
576}
577function ListarCuentaIVANC(){
578  var list = [];
579  var idIC = $(".idIC");
580  var cuenta = $(".numCuentaIVA");
581  var descripcion = $(".cuentaIVA");
582  var debe = $(".debeIVA");
583  var haber = $(".haberIVA");
584  for(var i = 0; i < cuenta.length; i++){
585    list.push({"id" : $(idIC[i]).val(), "cuenta" : $(cuenta[i]).val(),
586                "descripcion" : $(descripcion[i]).val(),
587                "debe" : $(debe[i]).val(),
588                "haber" : $(haber[i]).val()})
589  }
590  $("#ListarCuentaIVANC").val(JSON.stringify(list));
591}
592function ListarCuentaServicioNC(){
593  var list = [];
594  var idCNC = $(".idCNC");
595  var cuenta = $(".numCuentaContable");
596  var descripcion = $(".cuentaContable");
597  var debe = $(".debeNC");
598  var haber = $(".haberCC");
599  var gss = $(".gss");
600  for(var i = 0; i < cuenta.length; i++){
601    list.push({"id" : $(idCNC[i]).val(), "cuenta" : $(cuenta[i]).val(),
602                "descripcion" : $(descripcion[i]).val(),
603                "debe" : $(debe[i]).val(),
604                "haber" : $(haber[i]).val(),
605                "gss" : $(gss[i]).val()})
606  }
607  $("#ListarCuentaServNC").val(JSON.stringify(list));
608}
609
610function SaldoNotaCredito()
611{
612  var sumaHaber = Number($("#sumaHaber").val());
613  var sumaDebe = Number($("#sumaDebe").val());
614  var saldoDH = sumaDebe - sumaHaber ;
615  $("#saldoNC").val(saldoDH);
616  $("#saldoNC").number(true, 2);
617}
618
619$(".FormNotaCredito").on("change", "#serieNC", function(){
620  BuscaNCFEL()
621});
622$(".FormNotaCredito").on("change", "#newMontoIVA", function(){
623  var iva1 = $("#newMontoIVA").val();
624  var estado1 = $("#stateContingenciaNC").val();
625  if (estado1 = 1) {
626    $("#iva1").val(iva1);
627  }
628  else {
629    $("#iva1").val(0);
630  }
631
632});
633$(".FormNotaCredito").on("change", "#numNC", function(){
634  BuscaNCFEL()
635});
636function BuscaNCFEL() {
637var serie = $("#serieNC").val();
638var num = $("#numNC").val();
639      if ( (serie == " " || serie == "") || (num == " " || num == "")) {
640      }
641      else {
642            var datos = {
643              'serie':serie,
644              'num':num
645            }
646            $.ajax({
647              url:"ajax/NotaCreditoElectronica.ajax.php",
648              type:"POST",
649              data: datos,
650              dataType:"json",
651              success: function(respuesta){
652                                  if (!respuesta) {
653                                        $("#nitCliente").val(" ");
654                                        $("#cliente").val(" ");
655                                        $("#montoFactura").val("0.00");
656                                        $("#montoFactura").number(true, 2);
657                                        $("#idNC").val("");
658                                        $("#estado1").val("");
659                                        $("#iva1").val("");
660                                        $("#formNCFEL").css("display", "none");
661                                        $("#formNC").css("display", "none");
662                                        $("#stateFEL").css("background-color", "gray");
663                                        $("#stateFEL").val("- - - - -");
664                                        $(function() {
665                                                const Toast = Swal.mixin({
666                                                  toast: true,
667                                                  position: 'top-end',
668                                                  showConfirmButton: fal
668se,
669                                                  timer: 3000
670                                                });
671                                                Swal.fire({
672                                                  position: 'top-end',
673                                                  icon: 'error',
674                                                  title: 'Serie o Número de nota de crédito no existen.',
675                                                  showConfirmButton: false,
676                                                  timer: 1500
677                                                }).then((result)=>{});
678                                          });
679                                  }
680                                  else
681                                  {
682                                      var state = respuesta["estado"];
683                                      $("#nitCliente").val(respuesta["nitCliente"]);
684                                      $("#cliente").val(respuesta["nombre"]);
685                                      $("#idNC").val(respuesta["idNotaCredito"]);
686                                      $("#idNC1").val(respuesta["idNotaCredito"]);
687                                      $("#estado1").val($("#stateContingenciaNC").val());
688                                      $("#iva1").val($("#newMontoIVA").val());
689                                      $("#montoFactura").val(respuesta["Monto"]);
690                                      if (state == 1) {
691                                        $("#formNCFEL").css("display", "block");
692                                        $("#stateFEL").css("background-color", "red");
693                                        $("#stateFEL").val("PENDIENTE");
694                                        $("#newMontoIVA").attr("readonly", false);
695                                        var stateContNC = parseInt($("#stateContingenciaNC").val());
696                                        if (stateContNC == 1) {
697                                          $("#divRechazoNC").css("display", "block");
698                                        }
699                                      }
700                                      if (state == 2) {
701                                        $("#stateFEL").css("background-color", "green");
702                                        $("#stateFEL").val("AUTORIZADO");
703                                        $("#formNCFEL").css("display", "none");
704                                        $("#newMontoIVA").attr("readonly", true);
705                                        $("#divRechazoNC").css("display", "none");
706                                      }
707                                      $("#montoFactura").number(true, 2);
708                                      $("#formNC").css("display", "block");
709                                  }
710                        }
711            })// FIN AJAX
712      }
713}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.