|
447 | 447 | <button type="button" class="btn btn-xs btn-default disabled" id="modifica_iva_righe" onclick="modificaIvaRighe(getSelectData());"> |
448 | 448 | <i class="fa fa-percent"></i> '.tr('Modifica IVA').' |
449 | 449 | </button> |
| 450 | +
|
| 451 | + <button type="button" class="btn btn-xs btn-default disabled" id="stampa_barcode_righe" onclick="stampaBarcodeDDT(getSelectData());"> |
| 452 | + <i class="fa fa-barcode"></i> '.tr('Stampa barcode').' |
| 453 | + </button> |
450 | 454 | </div>'; |
451 | 455 | } |
452 | 456 | echo ' |
@@ -589,6 +593,48 @@ function duplicaRiga(id) { |
589 | 593 | }).catch(swal.noop); |
590 | 594 | } |
591 | 595 |
|
| 596 | +function stampaBarcodeDDT(id) { |
| 597 | + if (id.length === 0) { |
| 598 | + swal({ |
| 599 | + title: "'.tr('Nessuna riga selezionata').'", |
| 600 | + text: "'.tr('Seleziona almeno una riga articolo per stampare i barcode').'", |
| 601 | + type: "warning" |
| 602 | + }); |
| 603 | + return; |
| 604 | + } |
| 605 | +
|
| 606 | + swal({ |
| 607 | + title: "'.tr('Stampare i barcode delle righe selezionate?').'", |
| 608 | + html: "'.tr('Verranno stampate le etichette barcode per ogni articolo selezionato, nella quantità presente nel DDT').'", |
| 609 | + type: "warning", |
| 610 | + showCancelButton: true, |
| 611 | + confirmButtonText: "'.tr('Stampa').'" |
| 612 | + }).then(function () { |
| 613 | + // Salva le righe selezionate in sessione e reindirizza alla stampa |
| 614 | + $.ajax({ |
| 615 | + url: globals.rootdir + "/actions.php", |
| 616 | + type: "POST", |
| 617 | + data: { |
| 618 | + id_module: globals.id_module, |
| 619 | + id_record: globals.id_record, |
| 620 | + op: "print_barcode_righe", |
| 621 | + righe: id, |
| 622 | + }, |
| 623 | + success: function (response) { |
| 624 | + // Apri la stampa in una nuova finestra |
| 625 | + window.open(response, "_blank"); |
| 626 | + }, |
| 627 | + error: function() { |
| 628 | + swal({ |
| 629 | + title: "'.tr('Errore').'", |
| 630 | + text: "'.tr('Errore durante la preparazione della stampa').'", |
| 631 | + type: "error" |
| 632 | + }); |
| 633 | + } |
| 634 | + }); |
| 635 | + }).catch(swal.noop); |
| 636 | +} |
| 637 | +
|
592 | 638 | function modificaSeriali(button) { |
593 | 639 | let riga = $(button).closest("tr"); |
594 | 640 | let id = riga.data("id"); |
@@ -652,13 +698,15 @@ function modificaIvaRighe(righe) { |
652 | 698 | $("#confronta_righe").removeClass("disabled"); |
653 | 699 | $("#aggiorna_righe").removeClass("disabled"); |
654 | 700 | $("#modifica_iva_righe").removeClass("disabled"); |
| 701 | + $("#stampa_barcode_righe").removeClass("disabled"); |
655 | 702 | $("#elimina").addClass("disabled"); |
656 | 703 | } else { |
657 | 704 | $("#elimina_righe").addClass("disabled"); |
658 | 705 | $("#duplica_righe").addClass("disabled"); |
659 | 706 | $("#confronta_righe").addClass("disabled"); |
660 | 707 | $("#aggiorna_righe").addClass("disabled"); |
661 | 708 | $("#modifica_iva_righe").addClass("disabled"); |
| 709 | + $("#stampa_barcode_righe").addClass("disabled"); |
662 | 710 | $("#elimina").removeClass("disabled"); |
663 | 711 | } |
664 | 712 | }); |
|
0 commit comments