1function OPERACIONFACTURAESPECIAL(){ 2 $("#totalFacturaEspecial").number(true, 2); 3 var total = Number($("#totalFacturaEspecial").val()); 4 var precioSinIVA = total / 1.12; 5 $("#montoSinIVA").val(precioSinIVA); 6 $("#montoSinIVA").number(true, 2); 7 var iva = precioSinIVA * 0.12; 8 $("#IVA").val(iva); 9 $("#IVA").number(true, 2); 10 var retencion = precioSinIVA * 0.05; 11 $("#retencion").val(retencion); 12 $("#retencion").number(true, 2); 13 var liquido = precioSinIVA - retencion; 14 $("#liquido").val(liquido); 15 $("#liquido").number(true, 2); 16 $(".btnFactEspecial").prop("disabled", false); 17 VERIFYFE() 18} 19$(".btnFEIMPFel").click(function(){ 20 var id = $("#idFEFEL").val(); 21 window.open("extensiones/tcpdf/pdf/FacturaEspecial.php?id="+id, "_blank"); 22}); 23$(".btnFEAutFEL").click(function(){ 24 $("#alertFEspFEl").css("display", "block"); 25 setTimeout(function(){ BuscaFacturaEspecialFEL() }, 3400); 26 setTimeout(function(){$("#alertFEspFEl").css("display", "none"); BuscaFacturaEspecialFEL() }, 6000); 27}); 28$(".FormFacturaEspecial").on('click', '.btnAgregarDetalle1', function(){ 29var descServicio = $("#descDetalle1").val(); 30var cont = 1; 31var cero = 1; 32$("#descDetalle1").val(""); 33var x = $("#descDetalle1").val(); 34 if ( x == " " || x == "") { 35 $(".btnAgregarDetalle1").prop("disabled", true); 36 } 37$(".nuevoDetalleFacturaEspecial").append( 38 '<div class="row">'+ 39 '<div class="col-md-5">'+ 40 '<div class="input-group">'+ 41 '<span class="input-group-text"> <button type="button" class="btn btn-danger btn-xs quitarDescEspecial" idDescServicio="'+cont+'"><i class="fa fa-times"> </i></button> </span>'+ 42 '<textarea type="text" rows="1" style="text-align:center; font-weight: bold" class="form-control nuevaDescServicio" name="nuevaDescServicio" required>'+descServicio+'</textarea>'+ 43 '</div>'+ 44 '</div>'+ 45 46 '<div class="col-sm-1">'+ 47 '<input type="text" style="text-align:center; font-weight: bold" class="form-control codigoDetalle" id="codigoDetalle" name="codigoDetalle" required>'+ 48 '</div>'+ 49 50 '<div class="col-sm-1">'+ 51 '<input type="text" style="text-align:center; font-weight: bold" class="form-control UnidadMedida" id="UnidadMedida" name="UnidadMedida" required>'+ 52 '</div>'+ 53 54 '<div class="col-sm-1 CantSer">'+ 55 56 '<input type="number" style="text-align:center; font-weight: bold" class="form-control CantServicios" id="CantServicios" name="CantServicios" min="1" placeholder="0" required>'+ 57 58 '</div>'+ 59 60 '<div class="col-sm-2 pServicio">'+ 61 '<input type="text" style="text-align:right; font-weight: bold" class="form-control precioServicio" id="precioServicio" name="precioServicio" placeholder="0.00" required>'+ 62 '</div>'+ 63 64 '<div class="col-sm-2 totalSer">'+ 65 '<div class="input-group">'+ 66 '<input type="text" style="text-align:right; font-weight: bold" class="form-control totalServicios" id="totalServicios" name="totalServicios" placeholder="0.00" disabled>'+ 67 '</div>'+ 68 '</div>'+ 69 '</div>' 70 ) 71 listarFacturaEspecial() 72 $(".precioServicio").number(true, 2); 73 $(".totalServicios").number(true, 2); 74 $(".totalFacturaEspecial").number(true, 2); 75}); 76$(".FormFacturaEspecial").on("keyup", "#descDetalle1", function(){ 77 var x = $(this).val(); 78 var y = $("#busquedanombre").val(); 79 if (x == " " || x == "" || y == " " || y == "") { 80 $(".btnAgregarDetalle1").prop("disabled", true); 81 }else { 82 $(".btnAgregarDetalle1").prop("disabled", false); 83 } 84}); 85//====================================== 86// CUANDO DE CAMBIE CANTIDAD 87//====================================== 88$(".FormFacturaEspecial").on("change", "input.CantServicios", function(){ 89 var precio = $(this).parent().parent().children(".pServicio").children(".precioServicio"); 90 var totalProducto = $(this).parent().parent().children(".totalSer").children().children(".totalServicios"); 91 var precioFinal =$(this).val()*precio.val(); 92 totalProducto.val(precioFinal); 93 // SUMAR TOTAL DE PRECIOS 94 listarFacturaEspecial() 95 SUMIMPORTEFACTURAESPECIAL() 96 ValidarBoton() 97}); 98//====================================== 99// CUANDO SE INGRESE EL PRECIO DE SERVICIO 100//====================================== 101$(".FormFacturaEspecial").on("change", "input.precioServicio", function(){ 102 var cant = $(this).parent().parent().children(".CantSer").children(".CantServicios"); 103 var totalProducto = $(this).parent().parent().children(".totalSer").children().children(".totalServicios"); 104 var cantidad = $(cant).val(); 105 var precioFinal =$(this).val()*cant.val(); 106 totalProducto.val(precioFinal); 107 // SUMAR TOTAL DE PRECIOS 108 listarFacturaEspecial() 109 SUMIMPORTEFACTURAESPECIAL() 110}); 111//====================================== 112// CUANDO AGREGAMOS CODIGO DETALLE 113//====================================== 114$(".FormFacturaEspecial").on("change", "input.codigoDetalle", function(){ 115 listarFacturaEspecial() 116}); 117//====================================== 118// CUANDO AGREGAMOS MEDIDA DETALLE 119//====================================== 120$(".FormFacturaEspecial").on("change", "input.UnidadMedida", function(){ 121 listarFacturaEspecial() 122}); 123//====================================== 124// SUMA DE IMPORTE 125//====================================== 126function SUMIMPORTEFACTURAESPECIAL(){ 127 var sueldoItem = $(".totalServicios"); 128 var arraySumaSueldo = []; 129 for(var i = 0; i < sueldoItem.length; i++){ 130 arraySumaSueldo.push(Number($(sueldoItem[i]).val())); 131 } 132 function sumaArraySueldos(total, numero){ 133 return total + numero; 134 } 135 var sumaTotalSueldo = arraySumaSueldo.reduce(sumaArraySueldos); 136 $("#totalFacturaEspecial").val(sumaTotalSueldo); 137 $("#totalFacturaEspecial").number(true, 2);
138 OPERACIONFACTURAESPECIAL() 139} 140//====================================== 141// LISTAR DETALLE 142//====================================== 143function listarFacturaEspecial(){ 144 var listarFacturaEspecial = []; 145 var nuevaDesc = $(".nuevaDescServicio"); 146 var unimed = $(".UnidadMedida"); 147 var codigoDetalle = $(".codigoDetalle"); 148 var cant = $(".CantServicios"); 149 var precio = $(".precioServicio"); 150 var subtotal = $(".totalServicios"); 151 for(var i = 0; i < nuevaDesc.length; i++){ 152 listarFacturaEspecial.push({ "idDetalle" : $(nuevaDesc[i]).attr("idDescServicio"), 153 "Descripcion" : $(nuevaDesc[i]).val(), 154 "codigo" : $(codigoDetalle[i]).val(), 155 "unimed" : $(unimed[i]).val(), 156 "cantidad" : $(cant[i]).val(), 157 "precio" : $(precio[i]).val(), 158 "subtotal" : $(subtotal[i]).val()}) 159 } 160 $("#listFacturaEspecial").val(JSON.stringify(listarFacturaEspecial)); 161} 162 163/*============================================= 164 QUITAR DETALLE 165=============================================*/ 166var idquitarDescEspecial = [];//modiifique esto 167localStorage.removeItem("quitarDescEspecial"); 168$(".FormFacturaEspecial").on("click", "button.quitarDescEspecial", function(){ 169 $(this).parent().parent().parent().parent().remove(); 170 var idDescServicio = $(this).attr("idDescServicio"); 171 /*============================================= 172 ALMACENAR EN EL LOCALSTORAGE EL ID DEL SERVICIO A QUITAR 173 =============================================*/ 174 if(localStorage.getItem("quitarDescEspecial") == null){ 175 idquitarDescEspecial = []; 176 }else{ 177 idquitarDescEspecial.concat(localStorage.getItem("quitarDescEspecial")) 178 } 179 idquitarDescEspecial.push({"idDescServicio":idDescServicio}); 180 localStorage.setItem("quitarDescEspecial", JSON.stringify(idQuitarDescServicio)); 181 if($(".nuevoDetalleFacturaEspecial").children().length == 0){ 182 $(".btnFactEspecial").prop("disabled", true); 183 listarFacturaEspecial() 184 $("#totalFacturaEspecial").val(0.00); 185 $("#totalFacturaEspecial").number(true, 2); 186 $("#montoSinIVA").val(0.00); 187 $("#montoSinIVA").number(true, 2); 188 $("#IVA").val(0.00); 189 $("#IVA").number(true, 2); 190 $("#retencion").val(0.00); 191 $("#retencion").number(true, 2); 192 $("#retencion").val(0.00); 193 $("#retencion").number(true, 2); 194 $("#liquido").val(0.00); 195 $("#liquido").number(true, 2); 196 SUMIMPORTEFACTURAESPECIAL() 197 }else{ 198 listarFacturaEspecial() 199 SUMIMPORTEFACTURAESPECIAL() 200 } 201}); 202 203$(".FormFacturaEspecial").on("change", "#serieFEFEL", function(){ 204 BuscaFacturaEspecialFEL() 205}); 206$(".FormFacturaEspecial").on("change", "#numFEFEL", function(){ 207 BuscaFacturaEspecialFEL() 208}); 209function BuscaFacturaEspecialFEL() { 210var serie = $("#serieFEFEL").val(); 211var num = $("#numFEFEL").val(); 212 if ( (serie == " " || serie == "") || (num == " " || num == "")) { 213 } 214 else { 215 var datos = { 216 'serie':serie, 217 'num':num 218 } 219 $.ajax({ 220 url:"ajax/FacturaEspecialFEL.ajax.php", 221 type:"POST", 222 data: datos, 223 dataType:"json", 224 success: function(respuesta){ 225 if (!respuesta) { 226 $("#nitCliente").val(" "); 227 $("#cliente").val(" "); 228 $("#idFEFEL").val(" "); 229 $("#montoFactura").val("0.00"); 230 $("#formFEFel").css("display", "none"); 231 $("#formFactEspe").css("display", "none"); 232 $("#stateFE").css("background-color", "gray"); 233 $("#stateFE").val("- - - - -"); 234 $(function() { 235 const Toast = Swal.mixin({ 236 toast: true, 237 position: 'top-end', 238 showConfirmButton: fal
238se, 239 timer: 3000 240 }); 241 Swal.fire({ 242 position: 'top-end', 243 icon: 'error', 244 title: '¡Serie o Número de factura especial no existen!', 245 showConfirmButton: false, 246 timer: 1500 247 }).then((result)=>{}); 248 }); 249 } 250 else 251 { 252 var state = respuesta["estado"]; 253 $("#nitCliente").val(respuesta["nit"]); 254 $("#cliente").val(respuesta["nombre"]); 255 $("#idFEFEL").val(respuesta["idFacturaEspecial"]); 256 $("#montoFactura").val(respuesta["totalFactura"]); 257 $("#formFEFel").css("display", "block"); 258 if (state == 1) { 259 $("#formFactEspe").css("display", "block"); 260 $("#stateFE").css("background-color", "red"); 261 $("#stateFE").val("PENDIENTE"); 262 } 263 if (state == 2) { 264 $("#stateFE").css("background-color", "green"); 265 $("#stateFE").val("AUTORIZADO"); 266 $("#formFactEspe").css("display", "none"); 267 $("#formFactEspe").css("display", "none"); 268 } 269 } 270 } 271 })// FIN AJAX 272 } 273} 274/*$(".FormFacturaEspecial").on("keyup", "#descGSSCC", function(){ 275 var x = $(this).val(); 276 var y = $("#nombreEspecial").val(); 277 var z = $("#nitEspecial").val(); 278 if (x == " " || x == "" || y == " " || y == ""|| z == " " || z == "") { 279 if (x == " " || x == "") { 280 $(".btnAgregarGSSCC").prop("disabled", true); 281 }else { 282 $(".btnAgregarGSSCC").prop("disabled", false); 283 } 284});*/ 285$(".FormFacturaEspecial").on('click', '.btnAgregarGSSCC', function(){ 286//$(".btnGenerarCotizacion").prop("disabled", true); 287var descServicio = $("#descGSSCC").val(); 288var cont = 1; 289var cero = 1; 290$("#descGSSCC").val(""); 291var x = $("#descGSSCC").val(); 292 if ( x == " " || x == "") { 293 $(".btnAgregarGSSCC").prop("disabled", true); 294 } 295$(".detalleGSSCC").append( 296 '<div class="row">'+ 297 '<div class="col-md-4">'+ 298 '<div class="input-group">'+ 299 '<span class="input-group-text"> <button type="button" class="btn btn-danger btn-xs quitarGSSCC" idGSSCC="'+cont+'"><i class="fa fa-times"> </i></button> </span>'+ 300 '<input type="text" style="text-align:center; font-weight: bold" class="form-control newGSSCC" value="'+descServicio+'" name="newGSSCC" readonly>'+ 301 '</div>'+ 302 '</div>'+ 303 '<div class="col-sm-3 pGSSCC">'+ 304 '<input type="text" style="text-align:right; font-weight: bold" class="form-control precioGSSCC" id="precioGSSCC" name="precioGSSCC" placeholder="0.00" required>'+ 305 '</div>'+ 306 '</div>' 307 ) 308 listGSSCC() 309 $(".precioGSSCC").number(true, 2); 310 $(".MontoGSSCC").number(true, 2); 311}); 312//====================================== 313// CUANDO DE CAMBIE CANTIDAD 314//====================================== 315$(".FormFacturaEspecial").on("change", "#descGSSCC", function(){ 316 var gss = $(this).val(); 317 var y = $("#nombreEspecial").val(); 318 var z = $("#nitEspecial").val(); 319 if (y == " " || y == ""|| z == " " || z == "") { 320 $(".btnAgregarGSSCC").prop("disabled", true); 321 $("#descGSSCC").val(""); 322 $(function() { 323 const Toast = Swal.mixin({ 324 toast: true, 325 position: 'top-end',
326 showConfirmButton: false, 327 timer: 3000 328 }); 329 Swal.fire({ 330 position: 'top-end', 331 icon: 'error', 332 title: '¡CAMPOS INCOMPLETOS!', 333 text: '¡Complete los campos de cliente!', 334 showConfirmButton: false, 335 timer: 2000 336 }).then((result)=>{}); 337 }); 338 }else { 339 var dat = new FormData(); 340 dat.append("cc", gss); 341 $.ajax({ 342 url:"ajax/viewCCGSS.ajax.php", 343 method:"POST", 344 data: dat, 345 cache: false, 346 contentType: false, 347 processData: false, 348 dataType:"json", 349 success: function(res){ 350 if (res.length <1) { 351 $(".btnAgregarGSSCC").prop("disabled", true); 352 $("#descGSSCC").val(""); 353 $(function() { 354 const Toast = Swal.mixin({ 355 toast: true, 356 position: 'top-end', 357 showConfirmButton: false, 358 timer: 3000 359 }); 360 Swal.fire({ 361 position: 'top-end', 362 icon: 'error', 363 title: '¡GSS INCORRECTO!', 364 text: '¡No existe el GSS o Centro de costos!',
365 showConfirmButton: false, 366 timer: 2000 367 }).then((result)=>{}); 368 }); 369 } 370 else{ 371 $(".btnAgregarGSSCC").prop("disabled", false); 372 $(function() { 373 const Toast = Swal.mixin({ 374 toast: true, 375 position: 'top-end', 376 showConfirmButton: false, 377 timer: 3000 378 }); 379 Swal.fire({ 380 position: 'top-end', 381 icon: 'success', 382 title: '¡GSS CORRECTO!', 383 text: '¡Se agregara gastos a centro de costos!', 384 showConfirmButton: false, 385 timer: 2000 386 }).then((result)=>{}); 387 }); 388 } 389 } 390 }) 391 } 392}); 393/*============================================= 394 SUMATORIA DE TOTAL DE GSS 395=============================================*/ 396$(".FormFacturaEspecial").on("change", "input.precioGSSCC", function(){ 397 // SUMAR TOTAL DE PRECIOS 398 listGSSCC() 399 SUMGSSCC() 400}); 401function SUMGSSCC(){ 402 var sueldoItem = $(".precioGSSCC"); 403 var arraySumaSueldo = []; 404 for(var i = 0; i < sueldoItem.length; i++){ 405 arraySumaSueldo.push(Number($(sueldoItem[i]).val())); 406 } 407 function sumaArraySueldos(total, numero){ 408 return total + numero; 409 } 410 var sumaTotalSueldo = arraySumaSueldo.reduce(sumaArraySueldos); 411 $("#MontoGSSCC").val(sumaTotalSueldo); 412 $("#MontoGSSCC").number(true, 2); 413 VERIFYFE() 414} 415function VERIFYFE(){ 416 var montoGSSCC = Number($("#MontoGSSCC").val()); 417 var totalFactura = Number($("#totalFacturaEspecial").val()); 418 if (montoGSSCC >=1 && totalFactura >=1) { 419 if (montoGSSCC == totalFactura) { 420 $(function() { 421 const Toast = Swal.mixin({ 422 toast: true, 423 position: 'top-end',
424 showConfirmButton: false, 425 timer: 3000 426 }); 427 Swal.fire({ 428 position: 'top-end', 429 icon: 'success', 430 title: '¡YA PUEDE REALIZAR FACTURA ESPECIAL!', 431 text: '¡EL MONTO FACTURA Y DE CENTRO DE COSTOS COINCIDEN!', 432 showConfirmButton: false, 433 timer: 2000 434 }).then((result)=>{}); 435 }); 436 $(".btnFactEspecial").prop("disabled", false); 437 } 438 else { 439 $(".btnFactEspecial").prop("disabled", true); 440 } 441 } 442 else { 443 $(".btnFactEspecial").prop("disabled", true); 444 } 445} 446/*============================================= 447 QUITAR DETALLE 448=============================================*/ 449var idQuitarGSSCC = [];//modiifique esto 450localStorage.removeItem("quitarGSSCC"); 451$(".FormFacturaEspecial").on("click", "button.quitarGSSCC", function(){ 452 $(this).parent().parent().parent().parent().remove(); 453 var idGSSCC = $(this).attr("idGSSCC"); 454 /*============================================= 455 ALMACENAR EN EL LOCALSTORAGE EL ID DEL SERVICIO A QUITAR 456 =============================================*/ 457 if(localStorage.getItem("quitarGSSCC") == null){ 458 idQuitarGSSCC = []; 459 }else{ 460 idQuitarGSSCC.concat(localStorage.getItem("quitarGSSCC")) 461 } 462 idQuitarGSSCC.push({"idGSSCC":idGSSCC}); 463 localStorage.setItem("quitarGSSCC", JSON.stringify(idQuitarGSSCC)); 464 if($(".detalleGSSCC").children().length == 0){ 465 listGSSCC() 466 $("#precioGSSCC").val(0.00); 467 $("#MontoGSSCC").val(0.00); 468 $(".precioGSSCC").number(true, 2); 469 $(".MontoGSSCC").number(true, 2); 470 $(".btnFactEspecial").prop("disabled", true); 471 }else{ 472 listGSSCC() 473 SUMGSSCC() 474 } 475}); 476 477function listGSSCC(){ 478 var listGSSCC = []; 479 var newGSSCC = $(".newGSSCC"); 480 var precioGSSCC = $(".precioGSSCC"); 481 for(var i = 0; i < newGSSCC.length; i++){ 482 listGSSCC.push({"gss" : $(newGSSCC[i]).val(), 483 "precioGSSCC" : $(precioGSSCC[i]).val()}) 484 } 485 $("#listGSSCC").val(JSON.stringify(listGSSCC)); 486} 487/* 488function funcionllenarComboFE(){ 489 const arryainputs2 = []; 490 var str2 ="a"; 491 var datos2 = new FormData(); 492 datos2.append("idNIT", str2); 493 var input2 = document.getElementsByName('idCuenta[]'); 494 for (var i = 0; i < input2.length; i++) { 495 496 var a = input2[i]; 497 arryainputs2.push(a.value); 498 } ; 499 console.log(arryainputs2); 500$.ajax({ 501url:"ajax/LlenarSelectCapturaFactura.ajax.php", 502method:"POST", 503data: datos2, 504cache: false, 505contentType: false, 506processData: false, 507dataType:"json", 508success: function(respuesta){ 509 if(respuesta!= null){ 510 $("#ComboCuentaContableFE").empty(); 511 $('#ComboCuentaContableFE').append('<option disabled="disabled" selected>Seleccione una cuenta</option>'); 512 $.each(respuesta, function(index, value) { 513 if(arryainputs2.includes(respuesta[index][0])==true){}else{ 514 $('#ComboCuentaContableFE').append('<option value="'+respuesta[index][0]+'">'+respuesta[index][1]+' -- '+respuesta[index][2]+' </option>'); 515 }; 516 }); 517 arryainputs2.length=0; 518 }; 519 console.log(respuesta); 520} , 521 error: function(error) { 522 alert('errooor'); 523 console.log(error); 524 console.log(datos); 525 } 526}); 527} 528$(".FormFacturaEspecial").ready(function() { 529 $('#ComboCuentaContableFE').select2({theme: "classic"}); 530}); 531$("#ComboCuentaContableFE").change(function(){ 532 $(".btnAgregarCCFE").prop("disabled", false); 533}); 534$(".btnModalCCFE").click(function(){ 535 $(".btnAgregarCCFE").prop("disabled", true); 536 funcionllenarComboFE() 537}); 538$(".btnAgregarCCFE").click(function(){ 539 var cont = 1; 540 var combo = document.getElementById("ComboCuentaContableFE"); 541 var selected = combo.options[combo.selectedIndex].text; 542 var idcombo =combo.options[combo.selectedIndex].value; 543 var res = selected.split(" -- "); 544 $(".nuevaCCFE").append( 545 '<div class="row">'+ 546 '<div class="col-md-2">'+ 547 '<div class="input-group">'+ 548 '<span class="input-group-text"> <button type="button" class="btn btn-danger btn-xs quitarCCFE" idCuentaContable="'+cont+'"><i class="fa fa-times"> </i></button>
548 </span>'+ 549 '<input type="text" style="text-align:center; font-weight: bold" class="form-control numCuentaContable" value="'+res[0]+'" name="numCuentaContable" readonly>'+ 550 '</div>'+ 551 '</div>'+ 552 553 '<div class="col-sm-6">'+ 554 '<input type="text" style="text-align:center; font-weight: bold" class="form-control cuentaContable" value="'+res[1]+'" id="cuentaContable" name="cuentaContable" readonly>'+ 555 '</div>'+ 556 557 '<div class="col-sm-2 DebeFE">'+ 558 '<input type="text" style="text-align:right; font-weight: bold" class="form-control debeFE" id="debeFE" name="debeFE" value="0.00">'+ 559 '</div>'+ 560 561 '<div class="col-sm-2 HaberFE">'+ 562 563 '<input type="text" style="text-align:right; font-weight: bold" class="form-control haberFE" id="haberFE" name="haberFE" value="0.00">'+ 564 565 '</div>'+ 566 '</div>' 567 ) 568 569 $('.debeFE').number(true, 2); 570 $(".haberFE").number(true, 2); 571 ListCCFE() 572});*/ 573//=======================================================SUMATORIAS 574//====================================================================================== 575/*function SUMATORIAHABERFE(){ 576 var sueldoItem = $(".haberFE"); 577 var arraySumaSueldo = []; 578 for(var i = 0; i < sueldoItem.length; i++){ 579 arraySumaSueldo.push(Number($(sueldoItem[i]).val())); 580 } 581 function sumaArraySueldos(total, numero){ 582 return total + numero; 583 } 584 var sumaTotalSueldo = arraySumaSueldo.reduce(sumaArraySueldos); 585 $("#sumaHaber").val(sumaTotalSueldo); 586 $("#sumaHaber").number(true, 2); 587 PendienteFacturaEspecial() 588} 589 590function SUMATORIADEBEFE(){ 591 var sueldoItem = $(".debeFE"); 592 var arraySumaSueldo = []; 593 for(var i = 0; i < sueldoItem.length; i++){ 594 arraySumaSueldo.push(Number($(sueldoItem[i]).val())); 595 } 596 function sumaArraySueldos(total, numero){ 597 return total + numero; 598 } 599 var sumaTotalSueldo = arraySumaSueldo.reduce(sumaArraySueldos); 600 $("#sumaDebe").val(sumaTotalSueldo); 601 $("#sumaDebe").number(true, 2); 602 PendienteFacturaEspecial() 603}*/ 604//***************************************************************************************** 605//======================================SALDO FACTURA ESPECIAL =========================== 606/*function PendienteFacturaEspecial() 607{ 608 var sumaHaber = Number($("#sumaHaber").val()); 609 var sumaDebe = Number($("#sumaDebe").val()); 610 var saldoDH = sumaDebe - sumaHaber ; 611 $("#saldoFE").val(saldoDH); 612 $("#saldoFE").number(true, 2); 613} 614//****************************************************************************************** 615$(".FormFacturaEspecial").on("change", "#haberFE", function(){ 616 SUMATORIAHABERFE() 617 ListCCFE() 618}); 619$(".FormFacturaEspecial").on("change", "#debeFE", function(){ 620 SUMATORIADEBEFE() 621 ListCCFE() 622}); 623 624/*============================================= 625 QUITAR CUENTA CONTABLE 626=============================================*/ 627//var idquitarCCFE = [];//modiifique esto 628/*localStorage.removeItem("quitarCCFE"); 629$(".FormFacturaEspecial").on("click", "button.quitarCCFE", function(){ 630 $(this).parent().parent().parent().parent().remove(); 631 var idCuentaContable = $(this).attr("idCuentaContable"); 632 if(localStorage.getItem("quitarCCFE") == null){ 633 idquitarCCFE = []; 634 }else{ 635 idquitarCCFE.concat(localStorage.getItem("quitarCCFE")) 636 } 637 idquitarCCFE.push({"idCuentaContable":idCuentaContable}); 638 localStorage.setItem("quitarCCFE", JSON.stringify(idquitarCCFE)); 639 if($(".nuevaCCFE").children().length == 0){ 640 $("#sumaDebe").val(0.00); 641 $("#sumaHaber").val(0.00); 642 $("#saldoFE").val(0.00); 643 ListCCFE() 644 }else{ 645 SUMATORIAHABERFE() 646 SUMATORIADEBEFE() 647 ListCCFE() 648 } 649}); 650function ListCCFE(){ 651 var list = []; 652 var cuenta = $(".numCuentaContable"); 653 var descripcion = $(".cuentaContable"); 654 var debe = $(".debeFE"); 655 var haber = $(".haberFE"); 656 for(var i = 0; i < cuenta.length; i++){ 657 list.push({"cuenta" : $(cuenta[i]).val(), 658 "descripcion" : $(descripcion[i]).val(), 659 "debe" : $(debe[i]).val(), 660 "haber" : $(haber[i]).val()}) 661 } 662 $("#ListCCFE").val(JSON.stringify(list)); 663 ValidarBotonFE() 664}*/ 665//====================================== 666// VALIDAR QUE TOTAL SEA MAYOR A 0 667//====================================== 668/*function ValidarBotonFE() { 669 var total = Number($("#totalFacturaEspecial").val()); 670 if (total > 0) { 671 var sumaHaber = Number($("#sumaHaber").val()); 672 var sumaDebe = Number($("#sumaDebe").val()); 673 var totalDet = Number($("#totalFacturaEspecial").val()); 674 Saldofactura1() 675 if (sumaHaber ==0 && sumaDebe ==0) { 676 $(".btnFactEspecial").prop("disabled", true); 677 } 678 if (sumaHaber >=1 && sumaDebe >=1) { 679 if ((sumaHaber == sumaDebe) && (sumaHaber == totalDet) & (sumaDebe == totalDet)) { 680 $(function() { 681 const Toast = Swal.mixin({ 682 toast: true, 683 position: 'top-end',
684 showConfirmButton: false, 685 timer: 2000 686 }); 687 Swal.fire({ 688 position: 'top-end', 689 icon: 'success', 690 title: '¡Ya puede realizar la factura especial!', 691 showConfirmButton: false, 692 timer: 2000 693 }).then((result)=>{ 694 }); 695 }); 696 $(".btnFactEspecial").prop("disabled", false); 697 }else { 698 $(".btnFactEspecial").prop("disabled", true); 699 } 700 } 701 if ((sumaHaber > totalDet)||(sumaDebe > totalDet)) { 702 $(function() { 703 const Toast = Swal.mixin({ 704 toast: true, 705 position: 'top-end', 706 showConfirmButton: false, 707 timer: 2000 708 }); 709 Swal.fire({ 710 position: 'top-end', 711 icon: 'error', 712 title: '¡El monto de la partida contable, es mayor al total de la factura!',
713 showConfirmButton: false, 714 timer: 2000 715 }).then((result)=>{ 716 }); 717 }); 718 } 719 720 } 721 if (total == 0) { 722 $(".btnFactEspecial").prop("disabled", true); 723 } 724}*/
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.