diff --git a/COSAS_POR_ARREGLAR.md b/COSAS_POR_ARREGLAR.md index b679730..1c90c78 100644 --- a/COSAS_POR_ARREGLAR.md +++ b/COSAS_POR_ARREGLAR.md @@ -1,4 +1,4 @@ -#Cosas que quiero arreglar, pero no podre +#Cosas que quiero arreglar, pero no podre :c ## Validaciones diff --git a/create.sql b/create.sql index 130bc56..9e5c296 100644 --- a/create.sql +++ b/create.sql @@ -38,6 +38,7 @@ drop table if exists boleta; drop table if exists compra; drop table if exists venta; drop table if exists arriendo; +drop table if exists libro_orden_compra; drop table if exists ejemplar_compra; drop table if exists ejemplar_venta; drop table if exists ejemplar_arriendo; @@ -275,22 +276,20 @@ create table trabajador_correo create table factura ( - id int unsigned primary key auto_increment, - folio varchar(255) not null, - precio_neto int not null, - precio_iva int not null, - fecha_compra datetime not null, - inserted_at timestamp default CURRENT_TIMESTAMP + id int unsigned primary key auto_increment, + folio varchar(255) not null, + precio_neto int not null, + fecha_emision datetime not null, + inserted_at timestamp default CURRENT_TIMESTAMP ); create table boleta ( - id int unsigned primary key auto_increment, - folio varchar(255) not null, - precio_neto int not null, - precio_iva int not null, - fecha_venta datetime not null, - inserted_at timestamp default CURRENT_TIMESTAMP + id int unsigned primary key auto_increment, + folio varchar(255) not null, + precio_neto int not null, + fecha_emision datetime not null, + inserted_at timestamp default CURRENT_TIMESTAMP ); create table orden_compra @@ -311,7 +310,7 @@ create table compra distribuidor_id int unsigned not null, inserted_at timestamp default CURRENT_TIMESTAMP, foreign key (factura_id) references factura (id) on delete restrict on update cascade, - foreign key (distribuidor_id) references cliente (id) on delete restrict on update cascade + foreign key (distribuidor_id) references distribuidor (id) on delete restrict on update cascade ); create table venta diff --git a/src/main/java/xyz/danielcortes/controllers/LaunchController.java b/src/main/java/xyz/danielcortes/controllers/LaunchController.java index c903096..b50bbb3 100644 --- a/src/main/java/xyz/danielcortes/controllers/LaunchController.java +++ b/src/main/java/xyz/danielcortes/controllers/LaunchController.java @@ -63,8 +63,10 @@ import xyz.danielcortes.controllers.libro.LibroSearchController; import xyz.danielcortes.controllers.libro.LibroUpdateController; import xyz.danielcortes.controllers.libro.LibroViewController; import xyz.danielcortes.controllers.orden_compra.OrdenCompraAceptarController; +import xyz.danielcortes.controllers.orden_compra.OrdenCompraAsignarController; import xyz.danielcortes.controllers.orden_compra.OrdenCompraCrearController; import xyz.danielcortes.controllers.orden_compra.OrdenCompraSearchController; +import xyz.danielcortes.controllers.orden_compra.OrdenCompraViewAceptedController; import xyz.danielcortes.controllers.orden_compra.OrdenCompraViewController; import xyz.danielcortes.controllers.trabajador.TrabajadorCreateController; import xyz.danielcortes.controllers.trabajador.TrabajadorSearchController; @@ -130,8 +132,10 @@ import xyz.danielcortes.views.libro.LibroSearchPanel; import xyz.danielcortes.views.libro.LibroUpdatePanel; import xyz.danielcortes.views.libro.LibroViewPanel; import xyz.danielcortes.views.orden_compra.OrdenCompraAceptarPanel; +import xyz.danielcortes.views.orden_compra.OrdenCompraAsignarPanel; import xyz.danielcortes.views.orden_compra.OrdenCompraCrearPanel; import xyz.danielcortes.views.orden_compra.OrdenCompraSearchPanel; +import xyz.danielcortes.views.orden_compra.OrdenCompraViewAceptedPanel; import xyz.danielcortes.views.orden_compra.OrdenCompraViewPanel; import xyz.danielcortes.views.telefono.TelefonoCreatePanel; import xyz.danielcortes.views.telefono.TelefonoSearchPanel; @@ -297,7 +301,9 @@ public class LaunchController { this.controllers.put(PanelName.ORDEN_COMPRA_SEARCH, new OrdenCompraSearchController(new OrdenCompraSearchPanel(), this)); this.controllers.put(PanelName.ORDEN_COMPRA_CREAR, new OrdenCompraCrearController(new OrdenCompraCrearPanel(), this)); this.controllers.put(PanelName.ORDEN_COMPRA_VIEW, new OrdenCompraViewController(new OrdenCompraViewPanel(), this)); + this.controllers.put(PanelName.ORDEN_COMPRA_VIEW_ACEPTED, new OrdenCompraViewAceptedController(new OrdenCompraViewAceptedPanel(), this)); this.controllers.put(PanelName.ORDEN_COMPRA_ACEPTAR, new OrdenCompraAceptarController(new OrdenCompraAceptarPanel(), this)); + this.controllers.put(PanelName.ORDEN_COMPRA_ASIGNAR, new OrdenCompraAsignarController(new OrdenCompraAsignarPanel(), this)); for (Entry entry : this.controllers.entrySet()) { this.frame.addCard(entry.getValue().getView().getContentPane(), entry.getKey()); diff --git a/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraAceptarController.java b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraAceptarController.java index 25f6281..6a14e6f 100644 --- a/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraAceptarController.java +++ b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraAceptarController.java @@ -1,28 +1,57 @@ package xyz.danielcortes.controllers.orden_compra; import java.time.LocalDate; +import java.util.List; import xyz.danielcortes.controllers.LaunchController; import xyz.danielcortes.framework.BaseController; import xyz.danielcortes.framework.BasePanel; import xyz.danielcortes.framework.ChangeListener; import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.framework.ValidationResult; +import xyz.danielcortes.models.Compra; +import xyz.danielcortes.models.Ejemplar; +import xyz.danielcortes.models.Factura; import xyz.danielcortes.models.OrdenCompra; +import xyz.danielcortes.repository.CompraRepository; +import xyz.danielcortes.repository.EjemplarRepository; +import xyz.danielcortes.repository.FacturaRepository; +import xyz.danielcortes.repository.OrdenCompraRepository; +import xyz.danielcortes.validator.CompraValidator; +import xyz.danielcortes.validator.EjemplarValidator; +import xyz.danielcortes.validator.FacturaValidator; import xyz.danielcortes.views.orden_compra.OrdenCompraAceptarPanel; public class OrdenCompraAceptarController extends BaseController { private OrdenCompraAceptarPanel view; private OrdenCompra ordenCompra; + private CompraRepository compraRepository; + private CompraValidator compraValidator; + private EjemplarRepository ejemplarRepository; + private EjemplarValidator ejemplarValidator; + private FacturaRepository facturaRepository; + private FacturaValidator facturaValidator; + private OrdenCompraRepository ordenCompraRepository; + public OrdenCompraAceptarController(OrdenCompraAceptarPanel view, LaunchController parent) { super(parent); this.view = view; + this.compraRepository = new CompraRepository(); + this.compraValidator = new CompraValidator(this.compraRepository); + this.ejemplarRepository = new EjemplarRepository(); + this.ejemplarValidator = new EjemplarValidator(this.ejemplarRepository); + this.facturaRepository = new FacturaRepository(); + this.facturaValidator = new FacturaValidator(this.facturaRepository); + this.ordenCompraRepository = new OrdenCompraRepository(); this.setupListeners(); } private void setupListeners() { - this.view.getVolverButton().addActionListener(e -> this.parentController.showCard(PanelName.ORDEN_COMPRA_SEARCH)); this.view.getPrecioNetoField().getDocument().addDocumentListener((ChangeListener) e -> this.calculatePrice()); + this.view.getAsignarButton().addActionListener(e -> this.asignar()); + this.view.getGuardarButton().addActionListener(e -> this.save()); + this.view.getVolverButton().addActionListener(e -> this.volver()); } private void calculatePrice() { @@ -38,6 +67,76 @@ public class OrdenCompraAceptarController extends BaseController { } } + private void asignar() { + OrdenCompraAsignarController controller = (OrdenCompraAsignarController) this.parentController.getCard(PanelName.ORDEN_COMPRA_ASIGNAR); + controller.setOrdenCompra(this.ordenCompra); + this.getParentController().showCard(PanelName.ORDEN_COMPRA_ASIGNAR); + } + + private void save() { + OrdenCompraAsignarController controller = (OrdenCompraAsignarController) this.parentController.getCard(PanelName.ORDEN_COMPRA_ASIGNAR); + List ejemplares = controller.getEjemplares(); + for (Ejemplar ejemplar : ejemplares) { + ValidationResult serieValidation = this.ejemplarValidator.validateSerie(ejemplar, ejemplares); + if (serieValidation.hasError()) { + serieValidation.showErrorDialog(); + return; + } + } + + String folio = this.view.getFolioField().getText(); + ValidationResult folioValidation = this.facturaValidator.validateFolio(folio); + if (folioValidation.hasError()) { + folioValidation.showErrorDialog(); + return; + + } + + String precioNeto = this.view.getPrecioNetoField().getText(); + ValidationResult precioNetoValidation = this.facturaValidator.validatePrecio(precioNeto); + if (precioNetoValidation.hasError()) { + precioNetoValidation.showErrorDialog(); + return; + } + + LocalDate fechaEmision = this.view.getFechaEmisionPicker().getDate(); + ValidationResult fechaEmisionValidation = this.facturaValidator.validateFechaEmision(fechaEmision); + if (fechaEmisionValidation.hasError()) { + fechaEmisionValidation.showErrorDialog(); + return; + } + + Factura factura = new Factura(); + factura.setFechaEmision(fechaEmision); + factura.setFolio(folio); + factura.setPrecioNeto(Integer.parseInt(precioNeto)); + this.facturaRepository.save(factura); + + for (Ejemplar ejemplar : ejemplares) { + this.ejemplarRepository.save(ejemplar); + } + + Compra compra = new Compra(); + compra.setDistribuidor(this.ordenCompra.getDistribuidor()); + compra.getEjemplares().addAll(ejemplares); + compra.setFactura(factura); + this.compraRepository.save(compra); + + this.ordenCompra.setEstado("Aceptada"); + this.ordenCompra.setCompra(compra); + this.ordenCompraRepository.update(this.ordenCompra); + + controller.setEjemplares(null); + this.getParentController().showCard(PanelName.ORDEN_COMPRA_SEARCH); + } + + private void volver() { + OrdenCompraAsignarController controller = (OrdenCompraAsignarController) this.parentController.getCard(PanelName.ORDEN_COMPRA_ASIGNAR); + controller.setEjemplares(null); + + this.parentController.showCard(PanelName.ORDEN_COMPRA_SEARCH); + } + public void setOrdenCompra(OrdenCompra ordenCompra) { this.ordenCompra = ordenCompra; } diff --git a/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraAsignarController.java b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraAsignarController.java new file mode 100644 index 0000000..1bc8a56 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraAsignarController.java @@ -0,0 +1,115 @@ +package xyz.danielcortes.controllers.orden_compra; + +import java.util.ArrayList; +import java.util.List; +import xyz.danielcortes.controllers.LaunchController; +import xyz.danielcortes.framework.BaseController; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.ChangeListener; +import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.models.Ejemplar; +import xyz.danielcortes.models.Estado; +import xyz.danielcortes.models.Libro; +import xyz.danielcortes.models.OrdenCompra; +import xyz.danielcortes.repository.EstadoRepository; +import xyz.danielcortes.views.orden_compra.OrdenCompraAsignarPanel; + +public class OrdenCompraAsignarController extends BaseController { + + private OrdenCompraAsignarPanel view; + private OrdenCompra ordenCompra; + private EstadoRepository estadoRepository; + private List ejemplares; + private int currentIndex; + + public OrdenCompraAsignarController(OrdenCompraAsignarPanel view, LaunchController parent) { + super(parent); + this.view = view; + this.currentIndex = 0; + this.estadoRepository = new EstadoRepository(); + this.setupListeners(); + } + + private void setupListeners() { + this.view.getSiguienteButton().addActionListener(e -> this.siguiente()); + this.view.getAnteriorButton().addActionListener(e -> this.anterior()); + this.view.getGuardarButton().addActionListener(e -> this.save()); + this.view.getSerieField().getDocument().addDocumentListener((ChangeListener) e -> this.saveCurrent()); + } + + private void siguiente() { + if (this.currentIndex + 1 < this.ejemplares.size()) { + this.currentIndex++; + this.actualizar(); + } + } + + private void anterior() { + if (this.currentIndex - 1 >= 0) { + this.currentIndex--; + this.actualizar(); + } + } + + private void save() { + OrdenCompraAceptarController controller = (OrdenCompraAceptarController) this.parentController.getCard(PanelName.ORDEN_COMPRA_ACEPTAR); + controller.setOrdenCompra(this.ordenCompra); + this.parentController.showCard(PanelName.ORDEN_COMPRA_ACEPTAR); + } + + private void saveCurrent() { + String serie = this.view.getSerieField().getText(); + this.ejemplares.get(this.currentIndex).setSerie(serie); + } + + private void actualizar() { + this.view.getLibroField().setText(this.ejemplares.get(this.currentIndex).getLibro().toString()); + this.view.getSerieField().setText(this.ejemplares.get(this.currentIndex).getSerie()); + this.view.getCurrentIndexLabel().setText(String.valueOf(this.currentIndex + 1)); + + this.view.getSiguienteButton().setEnabled(this.currentIndex + 1 < this.ejemplares.size()); + this.view.getAnteriorButton().setEnabled(this.currentIndex > 0); + } + + @Override + public void show() { + if (this.ejemplares == null) { + this.createEjemplaresBase(); + } + + this.view.getSerieField().requestFocus(); + this.view.getTotalIndexLabel().setText(String.valueOf(this.ejemplares.size())); + this.currentIndex = 0; + this.actualizar(); + } + + private void createEjemplaresBase() { + this.ejemplares = new ArrayList<>(); + List libros = this.ordenCompra.getLibros(); + Estado disponible = this.estadoRepository.getByNombre("Disponible"); + + for (Libro libro : libros) { + Ejemplar ejemplar = new Ejemplar(); + ejemplar.setLibro(libro); + ejemplar.setEstado(disponible); + this.ejemplares.add(ejemplar); + } + } + + @Override + public BasePanel getView() { + return this.view; + } + + public void setOrdenCompra(OrdenCompra ordenCompra) { + this.ordenCompra = ordenCompra; + } + + public List getEjemplares() { + return this.ejemplares; + } + + public void setEjemplares(List ejemplares) { + this.ejemplares = ejemplares; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraSearchController.java b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraSearchController.java index 0fe9eea..ca1ddcd 100644 --- a/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraSearchController.java +++ b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraSearchController.java @@ -41,7 +41,15 @@ public class OrdenCompraSearchController extends BaseController { private void view() { OrdenCompra ordenCompra = this.getSelectedOrdenCompra(); - if (ordenCompra != null) { + if (ordenCompra == null) { + return; + } + if (ordenCompra.getEstado().equals("Aceptada")) { + OrdenCompraViewAceptedController controller = (OrdenCompraViewAceptedController) this.getParentController() + .getCard(PanelName.ORDEN_COMPRA_VIEW_ACEPTED); + controller.setOrdenCompra(ordenCompra); + this.getParentController().showCard(PanelName.ORDEN_COMPRA_VIEW_ACEPTED); + } else { OrdenCompraViewController controller = (OrdenCompraViewController) this.getParentController().getCard(PanelName.ORDEN_COMPRA_VIEW); controller.setOrdenCompra(ordenCompra); this.getParentController().showCard(PanelName.ORDEN_COMPRA_VIEW); @@ -156,7 +164,7 @@ public class OrdenCompraSearchController extends BaseController { public void reload() { this.loadComprarTable(); this.view.getSearchField().requestFocus(); - this.view.getTable().setRowSelectionInterval(0, 0); + this.view.getTable().clearSelection(); } private void loadComprarTable() { diff --git a/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraViewAceptedController.java b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraViewAceptedController.java new file mode 100644 index 0000000..00667a9 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/orden_compra/OrdenCompraViewAceptedController.java @@ -0,0 +1,52 @@ +package xyz.danielcortes.controllers.orden_compra; + +import xyz.danielcortes.controllers.LaunchController; +import xyz.danielcortes.framework.BaseController; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.models.OrdenCompra; +import xyz.danielcortes.views.orden_compra.OrdenCompraViewAceptedPanel; + +public class OrdenCompraViewAceptedController extends BaseController { + + private OrdenCompraViewAceptedPanel view; + private OrdenCompra ordenCompra; + + public OrdenCompraViewAceptedController(OrdenCompraViewAceptedPanel view, LaunchController parent) { + super(parent); + this.view = view; + this.setupListeners(); + } + + private void setupListeners() { + this.view.getVolverButton().addActionListener(e -> this.parentController.showCard(PanelName.ORDEN_COMPRA_SEARCH)); + } + + public void setOrdenCompra(OrdenCompra ordenCompra) { + this.ordenCompra = ordenCompra; + } + + @Override + public void show() { + this.view.getDistribuidorField().setText(this.ordenCompra.getDistribuidor().getRut()); + this.view.getFolioField().setText(this.ordenCompra.getCompra().getFactura().getFolio()); + float precioNeto = (float) this.ordenCompra.getCompra().getFactura().getPrecioNeto(); + float iva = precioNeto * .19f; + float precioBruto = precioNeto + iva; + this.view.getPrecioNetoField().setText(String.valueOf(precioNeto)); + this.view.getIvaField().setText(String.valueOf(iva)); + this.view.getPrecioBrutoField().setText(String.valueOf(precioBruto)); + this.fillTable(); + } + + @Override + public BasePanel getView() { + return this.view; + } + + private void fillTable() { + if (this.ordenCompra != null) { + this.view.getEjemplaresTableModel().setRows(this.ordenCompra.getCompra().getEjemplares()); + } + } +} diff --git a/src/main/java/xyz/danielcortes/framework/PanelName.java b/src/main/java/xyz/danielcortes/framework/PanelName.java index dd17e16..ded0214 100644 --- a/src/main/java/xyz/danielcortes/framework/PanelName.java +++ b/src/main/java/xyz/danielcortes/framework/PanelName.java @@ -100,7 +100,9 @@ public enum PanelName { ORDEN_COMPRA_SEARCH, ORDEN_COMPRA_ACEPTAR, ORDEN_COMPRA_VIEW, + ORDEN_COMPRA_VIEW_ACEPTED, ORDEN_COMPRA_CREAR, + ORDEN_COMPRA_ASIGNAR, VENDER_SEARCH, VENDER_VENDER, diff --git a/src/main/java/xyz/danielcortes/models/Boleta.java b/src/main/java/xyz/danielcortes/models/Boleta.java index 5d9be54..ce4eaa7 100644 --- a/src/main/java/xyz/danielcortes/models/Boleta.java +++ b/src/main/java/xyz/danielcortes/models/Boleta.java @@ -26,11 +26,8 @@ public class Boleta { @Column(name = "precio_neto") private Integer precioNeto; - @Column(name = "precio_iva") - private Integer precioIVA; - - @Column(name = "fecha_venta") - private LocalDate fechaVenta; + @Column(name = "fecha_emision") + private LocalDate fechaEmision; @OneToMany(mappedBy = "boleta") private List ventas; @@ -59,22 +56,6 @@ public class Boleta { this.precioNeto = precioNeto; } - public Integer getPrecioIVA() { - return this.precioIVA; - } - - public void setPrecioIVA(Integer precioIVA) { - this.precioIVA = precioIVA; - } - - public LocalDate getFechaVenta() { - return this.fechaVenta; - } - - public void setFechaVenta(LocalDate fechaVenta) { - this.fechaVenta = fechaVenta; - } - public List getVentas() { if (this.ventas == null) this.ventas = new ArrayList<>(); @@ -84,4 +65,12 @@ public class Boleta { public void setVentas(List ventas) { this.ventas = ventas; } + + public LocalDate getFechaEmision() { + return this.fechaEmision; + } + + public void setFechaEmision(LocalDate fechaEmision) { + this.fechaEmision = fechaEmision; + } } diff --git a/src/main/java/xyz/danielcortes/models/Factura.java b/src/main/java/xyz/danielcortes/models/Factura.java index 9f86ef7..b92245e 100644 --- a/src/main/java/xyz/danielcortes/models/Factura.java +++ b/src/main/java/xyz/danielcortes/models/Factura.java @@ -26,11 +26,8 @@ public class Factura { @Column(name = "precio_neto") private Integer precioNeto; - @Column(name = "precio_iva") - private Integer precioIVA; - - @Column(name = "fecha_compra") - private LocalDate fechaVenta; + @Column(name = "fecha_emision") + private LocalDate fechaEmision; @OneToMany(mappedBy = "factura") private List compras; @@ -59,24 +56,12 @@ public class Factura { this.precioNeto = precioNeto; } - public Integer getPrecioIVA() { - return this.precioIVA; + public LocalDate getFechaEmision() { + return this.fechaEmision; } - public void setPrecioIVA(Integer precioIVA) { - this.precioIVA = precioIVA; - } - - public Integer getPrecioBruto() { - return this.precioNeto + this.precioIVA; - } - - public LocalDate getFechaVenta() { - return this.fechaVenta; - } - - public void setFechaVenta(LocalDate fechaVenta) { - this.fechaVenta = fechaVenta; + public void setFechaEmision(LocalDate fechaEmision) { + this.fechaEmision = fechaEmision; } public List getCompras() { diff --git a/src/main/java/xyz/danielcortes/repository/EjemplarRepository.java b/src/main/java/xyz/danielcortes/repository/EjemplarRepository.java index 6759d78..646a74b 100644 --- a/src/main/java/xyz/danielcortes/repository/EjemplarRepository.java +++ b/src/main/java/xyz/danielcortes/repository/EjemplarRepository.java @@ -33,12 +33,4 @@ public class EjemplarRepository extends BaseRepository { query.setParameter("libro_id", libroId); return (Long) query.getResultList().get(0) == 1; } - - public boolean exists(String serie, Integer libroId, Integer id) { - Query query = this.em.createQuery("SELECT count(e) FROM Ejemplar e WHERE id != :id and serie = :serie and libro.id = :libro_id"); - query.setParameter("id", id); - query.setParameter("serie", serie); - query.setParameter("libro_id", libroId); - return (Long) query.getResultList().get(0) == 1; - } } diff --git a/src/main/java/xyz/danielcortes/repository/FacturaRepository.java b/src/main/java/xyz/danielcortes/repository/FacturaRepository.java index 43d4154..ec99ffa 100644 --- a/src/main/java/xyz/danielcortes/repository/FacturaRepository.java +++ b/src/main/java/xyz/danielcortes/repository/FacturaRepository.java @@ -3,6 +3,7 @@ package xyz.danielcortes.repository; import java.util.List; import javax.persistence.Query; import xyz.danielcortes.framework.BaseRepository; +import xyz.danielcortes.models.Distribuidor; import xyz.danielcortes.models.Factura; public class FacturaRepository extends BaseRepository { @@ -21,4 +22,11 @@ public class FacturaRepository extends BaseRepository { return query.getResultList(); } + public boolean exists(String folio, Distribuidor distribuidor) { + Query query = this.em.createQuery("SELECT count(e) FROM Factura e WHERE folio = :folio and distribuidor.id = :distribuidor_id"); + query.setParameter("folio", folio); + query.setParameter("distribuidor_id", distribuidor.getId()); + return (Long) query.getResultList().get(0) == 1; + } + } diff --git a/src/main/java/xyz/danielcortes/validator/EjemplarValidator.java b/src/main/java/xyz/danielcortes/validator/EjemplarValidator.java index 07ae1e8..706b8cd 100644 --- a/src/main/java/xyz/danielcortes/validator/EjemplarValidator.java +++ b/src/main/java/xyz/danielcortes/validator/EjemplarValidator.java @@ -13,18 +13,22 @@ public class EjemplarValidator { this.ejemplarRepository = ejemplarRepository; } - public ValidationResult validateSerie(String serie, Integer libroId, List ejemplares) { - if (serie == null) { - return new ValidationResult("La serie es nula"); + public ValidationResult validateSerie(Ejemplar ejemplar, List ejemplares) { + if (ejemplar.getSerie() == null) { + return new ValidationResult("La serie del libro " + ejemplar.getLibro().toString() + " es nula"); } - if (serie.isEmpty()) { - return new ValidationResult("La serie esta vacia"); + if (ejemplar.getSerie().isEmpty()) { + return new ValidationResult("La serie del libro " + ejemplar.getLibro().toString() + " esta vacia"); } - if (this.ejemplarRepository.exists(serie, libroId)) { - return new ValidationResult("El numero de serie ya existe"); + if (this.ejemplarRepository.exists(ejemplar.getSerie(), ejemplar.getLibro().getId())) { + return new ValidationResult("El numero de serie del libro " + ejemplar.getLibro().toString() + " ya existe"); } - if (ejemplares.stream().anyMatch(ejemplar -> ejemplar.getLibro().getId().equals(libroId) && ejemplar.getSerie().equals(serie))) { - return new ValidationResult("El numero de serie ya existe"); + if (ejemplares.stream().anyMatch(e -> + e != ejemplar && + e.getLibro().getId().equals(ejemplar.getLibro().getId()) && + e.getSerie().equals(ejemplar.getSerie()) + )) { + return new ValidationResult("El numero de serie libro " + ejemplar.getLibro().toString() + " ya existe"); } return ValidationResult.NON_ERROR; diff --git a/src/main/java/xyz/danielcortes/validator/FacturaValidator.java b/src/main/java/xyz/danielcortes/validator/FacturaValidator.java new file mode 100644 index 0000000..2e9df52 --- /dev/null +++ b/src/main/java/xyz/danielcortes/validator/FacturaValidator.java @@ -0,0 +1,48 @@ +package xyz.danielcortes.validator; + +import java.time.LocalDate; +import xyz.danielcortes.framework.ValidationResult; +import xyz.danielcortes.repository.FacturaRepository; + +public class FacturaValidator { + + private FacturaRepository facturaRepository; + + public FacturaValidator(FacturaRepository facturaRepository) { + this.facturaRepository = facturaRepository; + } + + public ValidationResult validateFolio(String folio) { + if (folio == null) { + return new ValidationResult("La folio es nulo"); + } + if (folio.isBlank()) { + return new ValidationResult("La folio esta vacio"); + } + + return ValidationResult.NON_ERROR; + } + + public ValidationResult validatePrecio(String precioNeto) { + if (precioNeto == null) { + return new ValidationResult("El precio neto es nulo"); + } + if (precioNeto.isBlank()) { + return new ValidationResult("El precio neto esta vacio"); + } + try { + float precio = Float.parseFloat(precioNeto); + } catch (NumberFormatException e) { + return new ValidationResult("El precio neto no es un numero"); + } + + return ValidationResult.NON_ERROR; + } + + public ValidationResult validateFechaEmision(LocalDate fechaEmision) { + if (fechaEmision == null) { + return new ValidationResult("La fecha emision es nula"); + } + return ValidationResult.NON_ERROR; + } +} diff --git a/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraAsignarPanel.form b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraAsignarPanel.form new file mode 100644 index 0000000..491a626 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraAsignarPanel.form @@ -0,0 +1,156 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraAsignarPanel.java b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraAsignarPanel.java new file mode 100644 index 0000000..6a4ab82 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraAsignarPanel.java @@ -0,0 +1,167 @@ +package xyz.danielcortes.views.orden_compra; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.framework.BasePanel; + +public class OrdenCompraAsignarPanel extends BasePanel { + + private JPanel contentPane; + private JTextField libroField; + private JButton guardarButton; + private JButton anteriorButton; + private JButton siguienteButton; + private JTextField serieField; + private JLabel currentIndexLabel; + private JLabel totalIndexLabel; + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + this.$$$setupUI$$$(); + } + + @Override + public JPanel getContentPane() { + return this.contentPane; + } + + public JTextField getLibroField() { + return this.libroField; + } + + public JButton getGuardarButton() { + return this.guardarButton; + } + + public JButton getAnteriorButton() { + return this.anteriorButton; + } + + public JButton getSiguienteButton() { + return this.siguienteButton; + } + + public JTextField getSerieField() { + return this.serieField; + } + + public JLabel getCurrentIndexLabel() { + return this.currentIndexLabel; + } + + public JLabel getTotalIndexLabel() { + return this.totalIndexLabel; + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(7, 4, new Insets(20, 20, 20, 20), -1, -1)); + final JLabel label1 = new JLabel(); + label1.setText("Libro:"); + contentPane.add(label1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, + new GridConstraints(6, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, + null, null, 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, + new GridConstraints(6, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, + new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + libroField = new JTextField(); + libroField.setEditable(false); + contentPane.add(libroField, + new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(4, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + guardarButton = new JButton(); + guardarButton.setText("Guardar"); + panel1.add(guardarButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + anteriorButton = new JButton(); + anteriorButton.setText("<<"); + panel1.add(anteriorButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), + null, 0, false)); + siguienteButton = new JButton(); + siguienteButton.setText(">>"); + panel1.add(siguienteButton, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(50, -1), + null, 0, false)); + final Spacer spacer4 = new Spacer(); + panel1.add(spacer4, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final Spacer spacer5 = new Spacer(); + panel1.add(spacer5, + new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + serieField = new JTextField(); + contentPane.add(serieField, + new GridConstraints(3, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Serie:"); + contentPane.add(label2, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel2, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + totalIndexLabel = new JLabel(); + totalIndexLabel.setText("1"); + panel2.add(totalIndexLabel, + new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("de"); + panel2.add(label3, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + currentIndexLabel = new JLabel(); + currentIndexLabel.setText("1"); + panel2.add(currentIndexLabel, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer6 = new Spacer(); + panel2.add(spacer6, + new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final Spacer spacer7 = new Spacer(); + panel2.add(spacer7, + new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraViewAceptedPanel.form b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraViewAceptedPanel.form new file mode 100644 index 0000000..8c10da5 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraViewAceptedPanel.form @@ -0,0 +1,145 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraViewAceptedPanel.java b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraViewAceptedPanel.java new file mode 100644 index 0000000..d2cca29 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/orden_compra/OrdenCompraViewAceptedPanel.java @@ -0,0 +1,183 @@ +package xyz.danielcortes.views.orden_compra; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Ejemplar; + +public class OrdenCompraViewAceptedPanel extends BasePanel { + + private JPanel contentPane; + private JTable ejemplaresTable; + private BaseTableModel ejemplaresTableModel; + private JButton volverButton; + private JTextField distribuidorField; + private JTextField folioField; + private JTextField precioNetoField; + private JTextField ivaField; + private JTextField precioBrutoField; + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + this.$$$setupUI$$$(); + } + + @Override + public JPanel getContentPane() { + return this.contentPane; + } + + public JTable getEjemplaresTable() { + return this.ejemplaresTable; + } + + public BaseTableModel getEjemplaresTableModel() { + return this.ejemplaresTableModel; + } + + public JButton getVolverButton() { + return this.volverButton; + } + + public JTextField getDistribuidorField() { + return this.distribuidorField; + } + + public JTextField getFolioField() { + return this.folioField; + } + + public JTextField getPrecioNetoField() { + return this.precioNetoField; + } + + public JTextField getIvaField() { + return this.ivaField; + } + + public JTextField getPrecioBrutoField() { + return this.precioBrutoField; + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + createUIComponents(); + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(13, 3, new Insets(20, 20, 20, 20), -1, -1)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, + new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, + null, null, 0, false)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(ejemplaresTable); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, + new GridConstraints(12, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, + null, null, null, 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, + new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, + null, null, null, 0, false)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + volverButton = new JButton(); + volverButton.setText("Volver"); + panel1.add(volverButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Distribuidor:"); + contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + distribuidorField = new JTextField(); + distribuidorField.setEditable(false); + contentPane.add(distribuidorField, + new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + folioField = new JTextField(); + contentPane.add(folioField, + new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Folio:"); + contentPane.add(label2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("Precio neto:"); + contentPane.add(label3, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label4 = new JLabel(); + label4.setText("IVA:"); + contentPane.add(label4, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label5 = new JLabel(); + label5.setText("Precio Bruto:"); + contentPane.add(label5, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + precioNetoField = new JTextField(); + contentPane.add(precioNetoField, + new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + ivaField = new JTextField(); + contentPane.add(ivaField, + new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + precioBrutoField = new JTextField(); + contentPane.add(precioBrutoField, + new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + } + + private void createUIComponents() { + + this.ejemplaresTableModel = new BaseTableModel<>( + new String[]{"ISBN", "Serie", "Titulo", "Estado"}, + (rows, rowIndex, colIndex) -> { + switch (colIndex) { + case 0: + return rows.get(rowIndex).getLibro().getIsbn(); + case 1: + return rows.get(rowIndex).getSerie(); + case 2: + return rows.get(rowIndex).getLibro().getTitulo(); + case 3: + return rows.get(rowIndex).getEstado(); + default: + return null; + } + } + ); + this.ejemplaresTable = new JTable(this.ejemplaresTableModel); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +}