Termine la venta + como siempre, mas cosas .w.

This commit is contained in:
Daniel Cortés
2019-07-04 00:04:16 -04:00
parent 3c3147bc23
commit 5aa83723b7
22 changed files with 513 additions and 162 deletions

View File

@@ -1,3 +1,8 @@
start transaction;
set foreign_key_checks = 0;
set autocommit = 0;
INSERT INTO `autor` INSERT INTO `autor`
VALUES (1, 'Howard Philips', 'Lovecraft', NULL, '2019-06-12 20:18:57'), VALUES (1, 'Howard Philips', 'Lovecraft', NULL, '2019-06-12 20:18:57'),
(2, 'Stephen', 'King', NULL, '2019-06-12 20:18:57'), (2, 'Stephen', 'King', NULL, '2019-06-12 20:18:57'),
@@ -107,3 +112,8 @@ VALUES (4, 1),
INSERT INTO `usuario` INSERT INTO `usuario`
VALUES (2, 'admin', 0x243168097E0BA82B896F348BABCEB600A8DCA30488C6F238F97FD8737BD00B27, VALUES (2, 'admin', 0x243168097E0BA82B896F348BABCEB600A8DCA30488C6F238F97FD8737BD00B27,
0x3564ECCCD85CF0583F9C090602E998B7, 2, '2019-06-13 20:04:53'); 0x3564ECCCD85CF0583F9C090602E998B7, 2, '2019-06-13 20:04:53');
set autocommit = 1;
set foreign_key_checks = 1;
commit;

View File

@@ -89,8 +89,10 @@ import xyz.danielcortes.controllers.trabajador.usuario.UsuarioUpdateController;
import xyz.danielcortes.controllers.trabajador.usuario.UsuarioViewController; import xyz.danielcortes.controllers.trabajador.usuario.UsuarioViewController;
import xyz.danielcortes.controllers.vender.VenderSearchController; import xyz.danielcortes.controllers.vender.VenderSearchController;
import xyz.danielcortes.controllers.vender.VenderVenderController; import xyz.danielcortes.controllers.vender.VenderVenderController;
import xyz.danielcortes.controllers.vender.VenderVerController;
import xyz.danielcortes.framework.BaseController; import xyz.danielcortes.framework.BaseController;
import xyz.danielcortes.framework.PanelName; import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Trabajador;
import xyz.danielcortes.models.Usuario; import xyz.danielcortes.models.Usuario;
import xyz.danielcortes.views.LaunchFrame; import xyz.danielcortes.views.LaunchFrame;
import xyz.danielcortes.views.autor.AutorCreatePanel; import xyz.danielcortes.views.autor.AutorCreatePanel;
@@ -152,6 +154,7 @@ import xyz.danielcortes.views.usuario.UsuarioUpdatePanel;
import xyz.danielcortes.views.usuario.UsuarioViewPanel; import xyz.danielcortes.views.usuario.UsuarioViewPanel;
import xyz.danielcortes.views.vender.VenderSearchPanel; import xyz.danielcortes.views.vender.VenderSearchPanel;
import xyz.danielcortes.views.vender.VenderVenderPanel; import xyz.danielcortes.views.vender.VenderVenderPanel;
import xyz.danielcortes.views.vender.VenderVerPanel;
/** /**
* Controlador principal de la aplicacion * Controlador principal de la aplicacion
@@ -311,6 +314,7 @@ public class LaunchController {
this.controllers.put(PanelName.VENDER_SEARCH, new VenderSearchController(new VenderSearchPanel(), this)); this.controllers.put(PanelName.VENDER_SEARCH, new VenderSearchController(new VenderSearchPanel(), this));
this.controllers.put(PanelName.VENDER_VENDER, new VenderVenderController(new VenderVenderPanel(), this)); this.controllers.put(PanelName.VENDER_VENDER, new VenderVenderController(new VenderVenderPanel(), this));
this.controllers.put(PanelName.VENDER_VER, new VenderVerController(new VenderVerPanel(), this));
for (Entry<PanelName, BaseController> entry : this.controllers.entrySet()) { for (Entry<PanelName, BaseController> entry : this.controllers.entrySet()) {
this.frame.addCard(entry.getValue().getView().getContentPane(), entry.getKey()); this.frame.addCard(entry.getValue().getView().getContentPane(), entry.getKey());
@@ -405,4 +409,8 @@ public class LaunchController {
this.controllers.get(name).show(); this.controllers.get(name).show();
} }
public Trabajador getTrabajador() {
return this.user.getTrabajador();
}
} }

View File

@@ -112,13 +112,11 @@ public class OrdenCompraAceptarController extends BaseController {
factura.setPrecioNeto(Integer.parseInt(precioNeto)); factura.setPrecioNeto(Integer.parseInt(precioNeto));
this.facturaRepository.save(factura); this.facturaRepository.save(factura);
for (Ejemplar ejemplar : ejemplares) { this.ejemplarRepository.save(ejemplares);
this.ejemplarRepository.save(ejemplar);
}
Compra compra = new Compra(); Compra compra = new Compra();
compra.setDistribuidor(this.ordenCompra.getDistribuidor()); compra.setDistribuidor(this.ordenCompra.getDistribuidor());
compra.getEjemplares().addAll(ejemplares); compra.setEjemplares(ejemplares);
compra.setFactura(factura); compra.setFactura(factura);
this.compraRepository.save(compra); this.compraRepository.save(compra);

View File

@@ -114,10 +114,10 @@ public class OrdenCompraSearchController extends BaseController {
JOptionPane.ERROR_MESSAGE JOptionPane.ERROR_MESSAGE
); );
return; return;
} else if (ordenCompra.getEstado().equals("Aceptada")) { } else if (ordenCompra.getEstado().equals("Recibida")) {
JOptionPane.showMessageDialog( JOptionPane.showMessageDialog(
null, null,
"La orden ya fue aceptada", "La orden ya fue recibida",
"Error", "Error",
JOptionPane.ERROR_MESSAGE JOptionPane.ERROR_MESSAGE
); );

View File

@@ -1,23 +1,24 @@
package xyz.danielcortes.controllers.vender; package xyz.danielcortes.controllers.vender;
import java.util.List; import java.util.List;
import javax.swing.JOptionPane;
import xyz.danielcortes.controllers.LaunchController; import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.BaseController; import xyz.danielcortes.framework.BaseController;
import xyz.danielcortes.framework.BasePanel; import xyz.danielcortes.framework.BasePanel;
import xyz.danielcortes.framework.PanelName; import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Venta; import xyz.danielcortes.models.Venta;
import xyz.danielcortes.repository.VenderRepository; import xyz.danielcortes.repository.VentaRepository;
import xyz.danielcortes.views.vender.VenderSearchPanel; import xyz.danielcortes.views.vender.VenderSearchPanel;
public class VenderSearchController extends BaseController { public class VenderSearchController extends BaseController {
private VenderSearchPanel view; private VenderSearchPanel view;
private VenderRepository repository; private VentaRepository repository;
public VenderSearchController(VenderSearchPanel view, LaunchController parent) { public VenderSearchController(VenderSearchPanel view, LaunchController parent) {
super(parent); super(parent);
this.view = view; this.view = view;
this.repository = new VenderRepository(); this.repository = new VentaRepository();
this.setupListeners(); this.setupListeners();
} }
@@ -29,6 +30,9 @@ public class VenderSearchController extends BaseController {
} }
private void search() { private void search() {
String term = this.view.getBuscarField().getText();
List<Venta> ventas = this.repository.search(term);
this.loadTable(ventas);
} }
private void vender() { private void vender() {
@@ -36,6 +40,32 @@ public class VenderSearchController extends BaseController {
} }
private void ver() { private void ver() {
Venta venta = this.getSelectedVenta();
if (venta == null)
return;
VenderVerController controller = (VenderVerController) this.parentController.getCard(PanelName.VENDER_VER);
controller.setVenta(venta);
this.parentController.showCard(PanelName.VENDER_VER);
}
private void loadTable(List<Venta> ventas) {
this.view.getVentaTableModel().setRows(ventas);
}
private Venta getSelectedVenta() {
int selectedRow = this.view.getVentasTable().getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(
null,
"No hay ninguna venta seleccionada",
"Error",
JOptionPane.ERROR_MESSAGE
);
return null;
}
return this.view.getVentaTableModel().getRow(selectedRow);
} }
@Override @Override
@@ -47,7 +77,7 @@ public class VenderSearchController extends BaseController {
private void loadTable() { private void loadTable() {
List<Venta> ventas = this.repository.getAll(); List<Venta> ventas = this.repository.getAll();
this.view.getVentaTableModel().setRows(ventas); this.loadTable(ventas);
} }
@Override @Override

View File

@@ -1,38 +1,171 @@
package xyz.danielcortes.controllers.vender; package xyz.danielcortes.controllers.vender;
import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.UUID;
import javax.swing.JOptionPane;
import xyz.danielcortes.controllers.LaunchController; import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.BaseController; import xyz.danielcortes.framework.BaseController;
import xyz.danielcortes.framework.BasePanel; import xyz.danielcortes.framework.BasePanel;
import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.framework.ValidationResult;
import xyz.danielcortes.models.Boleta;
import xyz.danielcortes.models.Cliente; import xyz.danielcortes.models.Cliente;
import xyz.danielcortes.models.Ejemplar; import xyz.danielcortes.models.Ejemplar;
import xyz.danielcortes.models.Estado;
import xyz.danielcortes.models.Trabajador;
import xyz.danielcortes.models.Venta;
import xyz.danielcortes.repository.BoletaRepository;
import xyz.danielcortes.repository.ClienteRepository; import xyz.danielcortes.repository.ClienteRepository;
import xyz.danielcortes.repository.EjemplarRepository; import xyz.danielcortes.repository.EjemplarRepository;
import xyz.danielcortes.repository.VenderRepository; import xyz.danielcortes.repository.EstadoRepository;
import xyz.danielcortes.repository.VentaRepository;
import xyz.danielcortes.validator.VentaValidator;
import xyz.danielcortes.views.vender.VenderVenderPanel; import xyz.danielcortes.views.vender.VenderVenderPanel;
public class VenderVenderController extends BaseController { public class VenderVenderController extends BaseController {
private VenderVenderPanel view; private VenderVenderPanel view;
private VenderRepository venderRepository; private VentaRepository ventaRepository;
private VentaValidator ventaValidator;
private ClienteRepository clienteRepository; private ClienteRepository clienteRepository;
private EjemplarRepository ejemplarRepository; private EjemplarRepository ejemplarRepository;
private EstadoRepository estadoRepository;
private BoletaRepository boletaRepository;
private float precioNeto;
public VenderVenderController(VenderVenderPanel view, LaunchController parentController) { public VenderVenderController(VenderVenderPanel view, LaunchController parentController) {
super(parentController); super(parentController);
this.view = view; this.view = view;
this.venderRepository = new VenderRepository(); this.ventaRepository = new VentaRepository();
this.ventaValidator = new VentaValidator();
this.clienteRepository = new ClienteRepository(); this.clienteRepository = new ClienteRepository();
this.ejemplarRepository = new EjemplarRepository(); this.ejemplarRepository = new EjemplarRepository();
this.estadoRepository = new EstadoRepository();
this.boletaRepository = new BoletaRepository();
this.setupListeners(); this.setupListeners();
} }
private void setupListeners() { private void setupListeners() {
this.view.getAgregarButton().addActionListener(e -> this.agregar()); this.view.getAgregarButton().addActionListener(e -> this.agregar());
this.view.getRemoverButton().addActionListener(e -> this.remover());
this.view.getCancelarButton().addActionListener(e -> this.parentController.showCard(PanelName.VENDER_SEARCH));
this.view.getVenderButton().addActionListener(e -> this.vender());
} }
private void agregar() { private void agregar() {
if (this.view.getEjemplaresComboModel().getSize() == 0) {
JOptionPane.showMessageDialog(
null,
"No hay ningun ejemplar que agregar",
"Error",
JOptionPane.ERROR_MESSAGE
);
return;
}
Ejemplar ejemplar = (Ejemplar) this.view.getEjemplaresCombo().getSelectedItem();
if (ejemplar == null) {
JOptionPane.showMessageDialog(
null,
"El ejemplar seleccionado es nulo, NO DEBERIA PASAR!!",
"Error",
JOptionPane.ERROR_MESSAGE
);
return;
}
this.view.getEjemplaresCombo().removeItem(ejemplar);
this.view.getEjemplaresTableModel().addRow(ejemplar);
this.updatePrice();
}
private void remover() {
if (this.view.getEjemplaresTableModel().getRowCount() == 0) {
JOptionPane.showMessageDialog(
null,
"No hay ningun ejemplar que remover",
"Error",
JOptionPane.ERROR_MESSAGE
);
return;
}
Ejemplar ejemplar = this.getSelectedEjemplar();
if (ejemplar == null)
return;
this.view.getEjemplaresCombo().addItem(ejemplar);
this.view.getEjemplaresTableModel().removeRow(ejemplar);
this.updatePrice();
}
private void vender() {
Cliente cliente = (Cliente) this.view.getClienteCombo().getSelectedItem();
ValidationResult clienteValidation = this.ventaValidator.validateCliente(cliente);
if (clienteValidation.hasError()) {
clienteValidation.showErrorDialog();
return;
}
Trabajador trabajador = this.getParentController().getTrabajador();
ValidationResult trabajadorValidation = this.ventaValidator.validateTrabajador(trabajador);
if (trabajadorValidation.hasError()) {
clienteValidation.showErrorDialog();
return;
}
List<Ejemplar> ejemplares = this.view.getEjemplaresTableModel().getRows();
ValidationResult ejemplaresValidation = this.ventaValidator.validateEjemplares(ejemplares);
if (ejemplaresValidation.hasError()) {
ejemplaresValidation.showErrorDialog();
return;
}
Boleta boleta = new Boleta();
boleta.setFolio(UUID.randomUUID().toString());
boleta.setPrecioNeto((int) this.precioNeto);
boleta.setFechaEmision(LocalDate.now());
this.boletaRepository.save(boleta);
Venta venta = new Venta();
venta.setCliente(cliente);
venta.setEjemplares(ejemplares);
venta.setTrabajador(trabajador);
venta.setBoleta(boleta);
this.ventaRepository.save(venta);
Estado vendido = this.estadoRepository.getByNombre("Vendido");
ejemplares.forEach(ejemplar -> ejemplar.setEstado(vendido));
this.ejemplarRepository.update(ejemplares);
this.parentController.showCard(PanelName.VENDER_SEARCH);
}
private void updatePrice() {
this.precioNeto = (float) this.view.getEjemplaresTableModel().getRows().stream()
.mapToInt(ejemplar -> ejemplar.getLibro().getPrecioReferencia())
.reduce((i, j) -> i + j).orElse(0);
float iva = this.precioNeto * .19f;
float precioBruto = this.precioNeto + iva;
this.view.getPrecioNetoField().setText(String.valueOf(this.precioNeto));
this.view.getIvaField().setText(String.valueOf(iva));
this.view.getPrecioBrutoField().setText(String.valueOf(precioBruto));
}
private Ejemplar getSelectedEjemplar() {
int selectedRow = this.view.getEjemplaresTable().getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(
null,
"No hay ningun ejemplar seleccionado",
"Error",
JOptionPane.ERROR_MESSAGE
);
return null;
}
return this.view.getEjemplaresTableModel().getRow(selectedRow);
} }
@Override @Override
@@ -40,18 +173,25 @@ public class VenderVenderController extends BaseController {
this.fillCliente(); this.fillCliente();
this.fillEjemplares(); this.fillEjemplares();
this.view.getEjemplaresTableModel().removeRows(); this.view.getEjemplaresTableModel().removeRows();
this.view.getPrecioNetoField().setText("0");
this.view.getIvaField().setText("0");
this.view.getPrecioBrutoField().setText("0");
this.precioNeto = 0;
} }
private void fillCliente() { private void fillCliente() {
List<Cliente> cliente = this.clienteRepository.getAll(); List<Cliente> cliente = this.clienteRepository.getAll();
this.view.getClienteComboModel().removeAllElements(); this.view.getClienteComboModel().removeAllElements();
this.view.getClienteComboModel().addAll(cliente); this.view.getClienteComboModel().addAll(cliente);
this.view.getClienteCombo().setSelectedIndex(0);
} }
private void fillEjemplares() { private void fillEjemplares() {
List<Ejemplar> ejemplares = this.ejemplarRepository.getAll(); Estado disponible = this.estadoRepository.getByNombre("Disponible");
List<Ejemplar> ejemplares = this.ejemplarRepository.getByEstado(disponible);
this.view.getEjemplaresComboModel().removeAllElements(); this.view.getEjemplaresComboModel().removeAllElements();
this.view.getEjemplaresComboModel().addAll(ejemplares); this.view.getEjemplaresComboModel().addAll(ejemplares);
this.view.getEjemplaresCombo().setSelectedIndex(0);
} }
@Override @Override

View File

@@ -3,21 +3,49 @@ package xyz.danielcortes.controllers.vender;
import xyz.danielcortes.controllers.LaunchController; import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.BaseController; import xyz.danielcortes.framework.BaseController;
import xyz.danielcortes.framework.BasePanel; import xyz.danielcortes.framework.BasePanel;
import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Venta;
import xyz.danielcortes.views.vender.VenderVerPanel;
public class VenderVerController extends BaseController { public class VenderVerController extends BaseController {
private VenderVerPanel view;
private Venta venta;
public VenderVerController(LaunchController parentController) { public VenderVerController(VenderVerPanel view, LaunchController parentController) {
super(parentController); super(parentController);
this.view = view;
this.setupListener();
}
private void setupListener() {
this.view.getVolverButton().addActionListener(e -> this.parentController.showCard(PanelName.VENDER_SEARCH));
} }
@Override @Override
public void show() { public void show() {
if (this.venta != null) {
this.view.getEjemplaresTableModel().setRows(this.venta.getEjemplares());
this.view.getClienteField().setText(this.venta.getCliente().getRut());
this.view.getTrabajadorField().setText(this.venta.getTrabajador().getRut());
this.view.getFolioField().setText(this.venta.getBoleta().getFolio());
float precioNeto = this.venta.getBoleta().getPrecioNeto();
float iva = precioNeto * .19f;
float precioTotal = precioNeto + iva;
this.view.getPrecioNetoField().setText(String.valueOf(precioNeto));
this.view.getIvaField().setText(String.valueOf(precioNeto));
this.view.getPrecioTotalField().setText(String.valueOf(precioTotal));
}
} }
@Override @Override
public BasePanel getView() { public BasePanel getView() {
return null; return this.view;
}
public void setVenta(Venta venta) {
this.venta = venta;
} }
} }

View File

@@ -35,6 +35,19 @@ public abstract class BaseRepository<E> {
this.em.getTransaction().commit(); this.em.getTransaction().commit();
} }
public void save(List<E> entities) {
this.em.getTransaction().begin();
try {
entities.forEach(entity -> this.em.persist(entity));
} catch (PersistenceException e) {
e.printStackTrace();
this.em.getTransaction().rollback();
}
this.em.getTransaction().commit();
}
public void update(E entity) { public void update(E entity) {
this.em.getTransaction().begin(); this.em.getTransaction().begin();
@@ -48,6 +61,19 @@ public abstract class BaseRepository<E> {
this.em.getTransaction().commit(); this.em.getTransaction().commit();
} }
public void update(List<E> entities) {
this.em.getTransaction().begin();
try {
entities.forEach(entity -> this.em.merge(entity));
} catch (PersistenceException e) {
e.printStackTrace();
this.em.getTransaction().rollback();
}
this.em.getTransaction().commit();
}
public void delete(E entity) { public void delete(E entity) {
this.em.getTransaction().begin(); this.em.getTransaction().begin();
@@ -61,6 +87,19 @@ public abstract class BaseRepository<E> {
this.em.getTransaction().commit(); this.em.getTransaction().commit();
} }
public void delete(List<E> entities) {
this.em.getTransaction().begin();
try {
entities.forEach(entity -> this.em.remove(entity));
} catch (PersistenceException e) {
e.printStackTrace();
this.em.getTransaction().rollback();
}
this.em.getTransaction().commit();
}
public void delete(Collection<E> entities) { public void delete(Collection<E> entities) {
this.em.getTransaction().begin(); this.em.getTransaction().begin();

View File

@@ -68,13 +68,14 @@ public class BaseTableModel<T> extends AbstractTableModel {
public void removeRow(T t) { public void removeRow(T t) {
int removed = this.rows.indexOf(t); int removed = this.rows.indexOf(t);
this.rows.remove(removed); if (removed != -1) {
this.fireTableRowsDeleted(removed, removed); this.rows.remove(removed);
this.fireTableRowsDeleted(removed, removed);
}
} }
public T getRow(int row) { public T getRow(int row) {
if (row > -1 || row < this.getRowCount()) { if (row > -1 && row < this.getRowCount()) {
return this.rows.get(row); return this.rows.get(row);
} else { } else {
return null; return null;

View File

@@ -106,6 +106,7 @@ public enum PanelName {
VENDER_SEARCH, VENDER_SEARCH,
VENDER_VENDER, VENDER_VENDER,
VENDER_VER,
ARRENDAR_SEARCH, ARRENDAR_SEARCH,
ARRENDAR_ARRENDAR, ARRENDAR_ARRENDAR,

View File

@@ -135,4 +135,13 @@ public class Cliente {
public void setVentas(List<Venta> ventas) { public void setVentas(List<Venta> ventas) {
this.ventas = ventas; this.ventas = ventas;
} }
@Override
public String toString() {
return this.rut + " - " + this.getNombreCompleto();
}
public String getNombreCompleto() {
return this.nombre + " " + this.apellidoPaterno + " " + this.apellidoMaterno;
}
} }

View File

@@ -106,6 +106,6 @@ public class Ejemplar {
@Override @Override
public String toString() { public String toString() {
return this.serie + " " + this.estado.getNombre(); return this.serie + " " + this.libro.getIsbn() + " " + this.libro.getTitulo();
} }
} }

View File

@@ -0,0 +1,11 @@
package xyz.danielcortes.repository;
import xyz.danielcortes.framework.BaseRepository;
import xyz.danielcortes.models.Boleta;
public class BoletaRepository extends BaseRepository<Boleta> {
public BoletaRepository() {
super(Boleta.class);
}
}

View File

@@ -2,11 +2,13 @@ package xyz.danielcortes.repository;
import java.util.List; import java.util.List;
import javax.persistence.Query; import javax.persistence.Query;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import xyz.danielcortes.framework.BaseRepository; import xyz.danielcortes.framework.BaseRepository;
import xyz.danielcortes.models.Ejemplar; import xyz.danielcortes.models.Ejemplar;
import xyz.danielcortes.models.Estado;
public class EjemplarRepository extends BaseRepository<Ejemplar> { public class EjemplarRepository extends BaseRepository<Ejemplar> {
@@ -33,4 +35,10 @@ public class EjemplarRepository extends BaseRepository<Ejemplar> {
query.setParameter("libro_id", libroId); query.setParameter("libro_id", libroId);
return (Long) query.getResultList().get(0) == 1; return (Long) query.getResultList().get(0) == 1;
} }
public List<Ejemplar> getByEstado(Estado estado) {
TypedQuery<Ejemplar> query = this.em.createQuery("SELECT e FROM Ejemplar e WHERE e.estado.id = :estado_id", Ejemplar.class);
query.setParameter("estado_id", estado.getId());
return query.getResultList();
}
} }

View File

@@ -1,13 +0,0 @@
package xyz.danielcortes.repository;
import xyz.danielcortes.framework.BaseRepository;
import xyz.danielcortes.models.Venta;
public class VenderRepository extends BaseRepository<Venta> {
public VenderRepository() {
super(Venta.class);
}
}

View File

@@ -0,0 +1,26 @@
package xyz.danielcortes.repository;
import java.util.List;
import javax.persistence.TypedQuery;
import xyz.danielcortes.framework.BaseRepository;
import xyz.danielcortes.models.Venta;
public class VentaRepository extends BaseRepository<Venta> {
public VentaRepository() {
super(Venta.class);
}
public List<Venta> search(String term) {
TypedQuery<Venta> query = this.em.createQuery(
"SELECT o FROM Venta o WHERE"
+ " CONCAT(o.boleta.fechaEmision, '') LIKE :term OR"
+ " LOWER(o.boleta.folio) LIKE :term OR "
+ " CONCAT(o.ejemplares.size, '') LIKE :term OR "
+ " LOWER(o.trabajador.rut) LIKE :term OR "
+ " LOWER(o.cliente.rut) LIKE :term",
Venta.class);
query.setParameter("term", "%" + term.toLowerCase() + "%");
return query.getResultList();
}
}

View File

@@ -0,0 +1,40 @@
package xyz.danielcortes.validator;
import java.util.List;
import xyz.danielcortes.framework.ValidationResult;
import xyz.danielcortes.models.Cliente;
import xyz.danielcortes.models.Ejemplar;
import xyz.danielcortes.models.Trabajador;
public class VentaValidator {
public ValidationResult validateCliente(Cliente cliente) {
if (cliente == null) {
return new ValidationResult("No hay cliente");
}
return ValidationResult.NON_ERROR;
}
public ValidationResult validateTrabajador(Trabajador trabajador) {
if (trabajador == null) {
return new ValidationResult("No hay trabajador, no deberia pasar!!!");
}
return ValidationResult.NON_ERROR;
}
public ValidationResult validateEjemplares(List<Ejemplar> ejemplares) {
if (ejemplares == null) {
return new ValidationResult("No hay ejemplares, no deberia pasar!!!");
}
if (ejemplares.size() == 0) {
return new ValidationResult("No hay ejemplares");
}
if (ejemplares.stream().anyMatch(ejemplar -> !ejemplar.getEstado().getNombre().equals("Disponible"))) {
return new ValidationResult("Por alguna razon hay un ejemplar no disponible, NO DEBERIA PASAR TAMPOCO!");
}
return ValidationResult.NON_ERROR;
}
}

View File

@@ -139,7 +139,7 @@ public class LibroSearchPanel extends BasePanel {
case 0: return rows.get(rowIndex).getIsbn(); case 0: return rows.get(rowIndex).getIsbn();
case 1: return rows.get(rowIndex).getTitulo(); case 1: return rows.get(rowIndex).getTitulo();
case 2: return rows.get(rowIndex).getPrecioReferencia(); case 2: return rows.get(rowIndex).getPrecioReferencia();
case 3: return rows.get(rowIndex).getEjemplares().size(); case 3: return rows.get(rowIndex).getEjemplares().stream().filter(ejemplar -> ejemplar.getEstado().getNombre().equals("Disponible")).count();
default: return null; default: return null;
} }
} }

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.vender.VenderVenderPanel"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.vender.VenderVenderPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="14" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="12" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/> <margin top="20" left="20" bottom="20" right="20"/>
<constraints> <constraints>
<xy x="20" y="20" width="490" height="536"/> <xy x="20" y="20" width="490" height="536"/>
@@ -11,7 +11,7 @@
<grid id="11a46" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="11a46" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="10" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties/> <properties/>
<border type="none"/> <border type="none"/>
@@ -40,17 +40,17 @@
</grid> </grid>
<vspacer id="83ea6"> <vspacer id="83ea6">
<constraints> <constraints>
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <grid row="11" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> </vspacer>
<hspacer id="832a4"> <hspacer id="832a4">
<constraints> <constraints>
<grid row="13" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="11" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</hspacer> </hspacer>
<hspacer id="7d130"> <hspacer id="7d130">
<constraints> <constraints>
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="11" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</hspacer> </hspacer>
<component id="10dc0" class="javax.swing.JLabel"> <component id="10dc0" class="javax.swing.JLabel">
@@ -74,7 +74,7 @@
</component> </component>
</children> </children>
</scrollpane> </scrollpane>
<grid id="58392" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="58392" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -106,6 +106,16 @@
<text value="+"/> <text value="+"/>
</properties> </properties>
</component> </component>
<component id="49afa" class="javax.swing.JButton" binding="removerButton">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="30" height="-1"/>
</grid>
</constraints>
<properties>
<text value="-"/>
</properties>
</component>
</children> </children>
</grid> </grid>
<component id="350ea" class="javax.swing.JComboBox" binding="clienteCombo" custom-create="true"> <component id="350ea" class="javax.swing.JComboBox" binding="clienteCombo" custom-create="true">
@@ -117,50 +127,14 @@
<properties/> <properties/>
</component> </component>
<component id="184ff" class="javax.swing.JLabel"> <component id="184ff" class="javax.swing.JLabel">
<constraints>
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Precio Total:"/>
</properties>
</component>
<component id="441d9" class="javax.swing.JTextField" binding="precioTotalField">
<constraints>
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
<component id="c72e8" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="IVA:"/> <text value="Precio Bruto:"/>
</properties> </properties>
</component> </component>
<component id="195f" class="javax.swing.JLabel"> <component id="441d9" class="javax.swing.JTextField" binding="precioBrutoField">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Precio Neto:"/>
</properties>
</component>
<component id="89a07" class="javax.swing.JTextField" binding="precioNetoField">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
<component id="1d61e" class="javax.swing.JTextField" binding="ivaField">
<constraints> <constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/> <preferred-size width="400" height="-1"/>
@@ -170,15 +144,23 @@
<editable value="false"/> <editable value="false"/>
</properties> </properties>
</component> </component>
<component id="89829" class="javax.swing.JLabel"> <component id="c72e8" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="IVA:"/>
</properties>
</component>
<component id="195f" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="Folio:"/> <text value="Precio Neto:"/>
</properties> </properties>
</component> </component>
<component id="f03bc" class="javax.swing.JTextField" binding="folioField"> <component id="89a07" class="javax.swing.JTextField" binding="precioNetoField">
<constraints> <constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/> <preferred-size width="400" height="-1"/>
@@ -188,6 +170,16 @@
<editable value="false"/> <editable value="false"/>
</properties> </properties>
</component> </component>
<component id="1d61e" class="javax.swing.JTextField" binding="ivaField">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
</children> </children>
</grid> </grid>
</form> </form>

View File

@@ -32,10 +32,10 @@ public class VenderVenderPanel extends BasePanel {
private JComboBox<Ejemplar> ejemplaresCombo; private JComboBox<Ejemplar> ejemplaresCombo;
private DefaultComboBoxModel<Ejemplar> ejemplaresComboModel; private DefaultComboBoxModel<Ejemplar> ejemplaresComboModel;
private JButton agregarButton; private JButton agregarButton;
private JTextField precioTotalField; private JTextField precioBrutoField;
private JTextField precioNetoField; private JTextField precioNetoField;
private JTextField ivaField; private JTextField ivaField;
private JTextField folioField; private JButton removerButton;
{ {
// GUI initializer generated by IntelliJ IDEA GUI Designer // GUI initializer generated by IntelliJ IDEA GUI Designer
@@ -61,11 +61,11 @@ public class VenderVenderPanel extends BasePanel {
return this.ejemplaresTable; return this.ejemplaresTable;
} }
public JComboBox getClienteCombo() { public JComboBox<Cliente> getClienteCombo() {
return this.clienteCombo; return this.clienteCombo;
} }
public JComboBox getEjemplaresCombo() { public JComboBox<Ejemplar> getEjemplaresCombo() {
return this.ejemplaresCombo; return this.ejemplaresCombo;
} }
@@ -73,8 +73,8 @@ public class VenderVenderPanel extends BasePanel {
return this.agregarButton; return this.agregarButton;
} }
public JTextField getPrecioTotalField() { public JTextField getPrecioBrutoField() {
return this.precioTotalField; return this.precioBrutoField;
} }
public JTextField getPrecioNetoField() { public JTextField getPrecioNetoField() {
@@ -85,8 +85,8 @@ public class VenderVenderPanel extends BasePanel {
return this.ivaField; return this.ivaField;
} }
public JTextField getFolioField() { public JButton getRemoverButton() {
return this.folioField; return this.removerButton;
} }
public BaseTableModel<Ejemplar> getEjemplaresTableModel() { public BaseTableModel<Ejemplar> getEjemplaresTableModel() {
@@ -109,10 +109,10 @@ public class VenderVenderPanel extends BasePanel {
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
createUIComponents(); createUIComponents();
contentPane = new JPanel(); contentPane = new JPanel();
contentPane.setLayout(new GridLayoutManager(14, 3, new Insets(20, 20, 20, 20), -1, -1)); contentPane.setLayout(new GridLayoutManager(12, 3, new Insets(20, 20, 20, 20), -1, -1));
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, contentPane.add(panel1, new GridConstraints(10, 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,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
venderButton = new JButton(); venderButton = new JButton();
@@ -127,15 +127,15 @@ public class VenderVenderPanel extends BasePanel {
null, 0, false)); null, 0, false));
final Spacer spacer1 = new Spacer(); final Spacer spacer1 = new Spacer();
contentPane.add(spacer1, contentPane.add(spacer1,
new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
null, null, 0, false)); null, null, 0, false));
final Spacer spacer2 = new Spacer(); final Spacer spacer2 = new Spacer();
contentPane.add(spacer2, contentPane.add(spacer2,
new GridConstraints(13, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, new GridConstraints(11, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
null, null, null, 0, false)); null, null, null, 0, false));
final Spacer spacer3 = new Spacer(); final Spacer spacer3 = new Spacer();
contentPane.add(spacer3, contentPane.add(spacer3,
new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, new GridConstraints(11, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
null, null, null, 0, false)); null, null, null, 0, false));
final JLabel label1 = new JLabel(); final JLabel label1 = new JLabel();
label1.setText("Cliente:"); label1.setText("Cliente:");
@@ -147,7 +147,7 @@ public class VenderVenderPanel extends BasePanel {
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane1.setViewportView(ejemplaresTable); scrollPane1.setViewportView(ejemplaresTable);
final JPanel panel2 = new JPanel(); final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1)); panel2.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, contentPane.add(panel2, new GridConstraints(2, 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,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
@@ -163,44 +163,40 @@ public class VenderVenderPanel extends BasePanel {
panel2.add(agregarButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, panel2.add(agregarButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(30, -1), GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(30, -1),
null, 0, false)); null, 0, false));
removerButton = new JButton();
removerButton.setText("-");
panel2.add(removerButton, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(30, -1),
null, 0, false));
contentPane.add(clienteCombo, contentPane.add(clienteCombo,
new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
final JLabel label3 = new JLabel(); final JLabel label3 = new JLabel();
label3.setText("Precio Total:"); label3.setText("Precio Bruto:");
contentPane.add(label3, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, contentPane.add(label3, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
precioTotalField = new JTextField(); precioBrutoField = new JTextField();
precioTotalField.setEditable(false); precioBrutoField.setEditable(false);
contentPane.add(precioTotalField, contentPane.add(precioBrutoField,
new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
final JLabel label4 = new JLabel(); final JLabel label4 = new JLabel();
label4.setText("IVA:"); label4.setText("IVA:");
contentPane.add(label4, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, 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)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label5 = new JLabel(); final JLabel label5 = new JLabel();
label5.setText("Precio Neto:"); label5.setText("Precio Neto:");
contentPane.add(label5, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, contentPane.add(label5, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
precioNetoField = new JTextField(); precioNetoField = new JTextField();
precioNetoField.setEditable(false); precioNetoField.setEditable(false);
contentPane.add(precioNetoField, contentPane.add(precioNetoField,
new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
ivaField = new JTextField(); ivaField = new JTextField();
ivaField.setEditable(false); ivaField.setEditable(false);
contentPane.add(ivaField, contentPane.add(ivaField,
new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
final JLabel label6 = new JLabel();
label6.setText("Folio:");
contentPane.add(label6, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
folioField = new JTextField();
folioField.setEditable(false);
contentPane.add(folioField,
new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
} }
@@ -213,12 +209,13 @@ public class VenderVenderPanel extends BasePanel {
// @formatter:off // @formatter:off
this.ejemplaresTableModel = new BaseTableModel<>( this.ejemplaresTableModel = new BaseTableModel<>(
new String[]{"ISBN", "Serie", "Titulo"}, new String[]{"ISBN", "Serie", "Titulo", "Precio"},
(row, rowIndex, colIndex) -> { (row, rowIndex, colIndex) -> {
switch (colIndex) { switch (colIndex) {
case 0: return row.get(rowIndex).getLibro().getIsbn(); case 0: return row.get(rowIndex).getLibro().getIsbn();
case 1: return row.get(rowIndex).getSerie(); case 1: return row.get(rowIndex).getSerie();
case 2: return row.get(rowIndex).getLibro().getTitulo(); case 2: return row.get(rowIndex).getLibro().getTitulo();
case 3: return row.get(rowIndex).getLibro().getPrecioReferencia();
default: return null; default: return null;
} }
} }

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.vender.VenderVerPanel"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.vender.VenderVerPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="14" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="16" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/> <margin top="20" left="20" bottom="20" right="20"/>
<constraints> <constraints>
<xy x="20" y="20" width="490" height="536"/> <xy x="20" y="20" width="490" height="536"/>
@@ -11,7 +11,7 @@
<grid id="11a46" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="11a46" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/> <margin top="0" left="0" bottom="0" right="0"/>
<constraints> <constraints>
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="14" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties/> <properties/>
<border type="none"/> <border type="none"/>
@@ -30,17 +30,17 @@
</grid> </grid>
<vspacer id="83ea6"> <vspacer id="83ea6">
<constraints> <constraints>
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <grid row="15" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> </vspacer>
<hspacer id="832a4"> <hspacer id="832a4">
<constraints> <constraints>
<grid row="13" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="15" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</hspacer> </hspacer>
<hspacer id="7d130"> <hspacer id="7d130">
<constraints> <constraints>
<grid row="13" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="15" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</hspacer> </hspacer>
<component id="10dc0" class="javax.swing.JLabel"> <component id="10dc0" class="javax.swing.JLabel">
@@ -53,7 +53,7 @@
</component> </component>
<scrollpane id="40e17"> <scrollpane id="40e17">
<constraints> <constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/> <grid row="5" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties/> <properties/>
<border type="none"/> <border type="none"/>
@@ -66,7 +66,7 @@
</scrollpane> </scrollpane>
<component id="184ff" class="javax.swing.JLabel"> <component id="184ff" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="12" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="Precio Total:"/> <text value="Precio Total:"/>
@@ -74,7 +74,7 @@
</component> </component>
<component id="441d9" class="javax.swing.JTextField" binding="precioTotalField"> <component id="441d9" class="javax.swing.JTextField" binding="precioTotalField">
<constraints> <constraints>
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <grid row="13" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/> <preferred-size width="400" height="-1"/>
</grid> </grid>
</constraints> </constraints>
@@ -84,7 +84,7 @@
</component> </component>
<component id="c72e8" class="javax.swing.JLabel"> <component id="c72e8" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="IVA:"/> <text value="IVA:"/>
@@ -92,23 +92,13 @@
</component> </component>
<component id="195f" class="javax.swing.JLabel"> <component id="195f" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="Precio Neto:"/> <text value="Precio Neto:"/>
</properties> </properties>
</component> </component>
<component id="89a07" class="javax.swing.JTextField" binding="precioNetoField"> <component id="89a07" class="javax.swing.JTextField" binding="precioNetoField">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
<component id="1d61e" class="javax.swing.JTextField" binding="ivaField">
<constraints> <constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/> <preferred-size width="400" height="-1"/>
@@ -118,9 +108,19 @@
<editable value="false"/> <editable value="false"/>
</properties> </properties>
</component> </component>
<component id="1d61e" class="javax.swing.JTextField" binding="ivaField">
<constraints>
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
<component id="89829" class="javax.swing.JLabel"> <component id="89829" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="Folio:"/> <text value="Folio:"/>
@@ -128,7 +128,7 @@
</component> </component>
<component id="f03bc" class="javax.swing.JTextField" binding="folioField"> <component id="f03bc" class="javax.swing.JTextField" binding="folioField">
<constraints> <constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"> <grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/> <preferred-size width="400" height="-1"/>
</grid> </grid>
</constraints> </constraints>
@@ -138,7 +138,7 @@
</component> </component>
<component id="92e07" class="javax.swing.JLabel"> <component id="92e07" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<text value="Ejemplares:"/> <text value="Ejemplares:"/>
@@ -152,6 +152,24 @@
</constraints> </constraints>
<properties/> <properties/>
</component> </component>
<component id="f12bb" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Trabajador:"/>
</properties>
</component>
<component id="ab6e7" class="javax.swing.JTextField" binding="trabajadorField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
</children> </children>
</grid> </grid>
</form> </form>

View File

@@ -20,16 +20,15 @@ import xyz.danielcortes.models.Ejemplar;
public class VenderVerPanel extends BasePanel { public class VenderVerPanel extends BasePanel {
private JPanel contentPane; private JPanel contentPane;
private JButton venderButton;
private JButton volverButton; private JButton volverButton;
private JTable ejemplaresTable; private JTable ejemplaresTable;
private BaseTableModel<Ejemplar> ejemplaresTableModel; private BaseTableModel<Ejemplar> ejemplaresTableModel;
private JButton agregarButton;
private JTextField precioTotalField; private JTextField precioTotalField;
private JTextField precioNetoField; private JTextField precioNetoField;
private JTextField ivaField; private JTextField ivaField;
private JTextField folioField; private JTextField folioField;
private JTextField clienteField; private JTextField clienteField;
private JTextField trabajadorField;
{ {
// GUI initializer generated by IntelliJ IDEA GUI Designer // GUI initializer generated by IntelliJ IDEA GUI Designer
@@ -43,10 +42,6 @@ public class VenderVerPanel extends BasePanel {
return this.contentPane; return this.contentPane;
} }
public JButton getVenderButton() {
return this.venderButton;
}
public JButton getVolverButton() { public JButton getVolverButton() {
return this.volverButton; return this.volverButton;
} }
@@ -55,8 +50,8 @@ public class VenderVerPanel extends BasePanel {
return this.ejemplaresTable; return this.ejemplaresTable;
} }
public JButton getAgregarButton() { public BaseTableModel<Ejemplar> getEjemplaresTableModel() {
return this.agregarButton; return this.ejemplaresTableModel;
} }
public JTextField getPrecioTotalField() { public JTextField getPrecioTotalField() {
@@ -79,6 +74,10 @@ public class VenderVerPanel extends BasePanel {
return this.clienteField; return this.clienteField;
} }
public JTextField getTrabajadorField() {
return this.trabajadorField;
}
/** /**
* Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code! * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code!
* *
@@ -87,10 +86,10 @@ public class VenderVerPanel extends BasePanel {
private void $$$setupUI$$$() { private void $$$setupUI$$$() {
createUIComponents(); createUIComponents();
contentPane = new JPanel(); contentPane = new JPanel();
contentPane.setLayout(new GridLayoutManager(14, 3, new Insets(20, 20, 20, 20), -1, -1)); contentPane.setLayout(new GridLayoutManager(16, 3, new Insets(20, 20, 20, 20), -1, -1));
final JPanel panel1 = new JPanel(); final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, contentPane.add(panel1, new GridConstraints(14, 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,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
volverButton = new JButton(); volverButton = new JButton();
@@ -100,69 +99,78 @@ public class VenderVerPanel extends BasePanel {
null, 0, false)); null, 0, false));
final Spacer spacer1 = new Spacer(); final Spacer spacer1 = new Spacer();
contentPane.add(spacer1, contentPane.add(spacer1,
new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new GridConstraints(15, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null,
null, null, 0, false)); null, null, 0, false));
final Spacer spacer2 = new Spacer(); final Spacer spacer2 = new Spacer();
contentPane.add(spacer2, contentPane.add(spacer2,
new GridConstraints(13, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, new GridConstraints(15, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
null, null, null, 0, false)); null, null, null, 0, false));
final Spacer spacer3 = new Spacer(); final Spacer spacer3 = new Spacer();
contentPane.add(spacer3, contentPane.add(spacer3,
new GridConstraints(13, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, new GridConstraints(15, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
null, null, null, 0, false)); null, null, null, 0, false));
final JLabel label1 = new JLabel(); final JLabel label1 = new JLabel();
label1.setText("Cliente:"); label1.setText("Cliente:");
contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, 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)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JScrollPane scrollPane1 = new JScrollPane(); final JScrollPane scrollPane1 = new JScrollPane();
contentPane.add(scrollPane1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, contentPane.add(scrollPane1, new GridConstraints(5, 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,
GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
scrollPane1.setViewportView(ejemplaresTable); scrollPane1.setViewportView(ejemplaresTable);
final JLabel label2 = new JLabel(); final JLabel label2 = new JLabel();
label2.setText("Precio Total:"); label2.setText("Precio Total:");
contentPane.add(label2, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, contentPane.add(label2, new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
precioTotalField = new JTextField(); precioTotalField = new JTextField();
precioTotalField.setEditable(false); precioTotalField.setEditable(false);
contentPane.add(precioTotalField, contentPane.add(precioTotalField,
new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
final JLabel label3 = new JLabel(); final JLabel label3 = new JLabel();
label3.setText("IVA:"); label3.setText("IVA:");
contentPane.add(label3, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, contentPane.add(label3, new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label4 = new JLabel(); final JLabel label4 = new JLabel();
label4.setText("Precio Neto:"); label4.setText("Precio Neto:");
contentPane.add(label4, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, contentPane.add(label4, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
precioNetoField = new JTextField(); precioNetoField = new JTextField();
precioNetoField.setEditable(false); precioNetoField.setEditable(false);
contentPane.add(precioNetoField, contentPane.add(precioNetoField,
new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
ivaField = new JTextField(); ivaField = new JTextField();
ivaField.setEditable(false); ivaField.setEditable(false);
contentPane.add(ivaField, contentPane.add(ivaField,
new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
final JLabel label5 = new JLabel(); final JLabel label5 = new JLabel();
label5.setText("Folio:"); label5.setText("Folio:");
contentPane.add(label5, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, contentPane.add(label5, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
folioField = new JTextField(); folioField = new JTextField();
folioField.setEditable(false); folioField.setEditable(false);
contentPane.add(folioField, contentPane.add(folioField,
new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
final JLabel label6 = new JLabel(); final JLabel label6 = new JLabel();
label6.setText("Ejemplares:"); label6.setText("Ejemplares:");
contentPane.add(label6, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, contentPane.add(label6, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
clienteField = new JTextField(); clienteField = new JTextField();
contentPane.add(clienteField, contentPane.add(clienteField,
new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
final JLabel label7 = new JLabel();
label7.setText("Trabajador:");
contentPane.add(label7, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
trabajadorField = new JTextField();
trabajadorField.setEditable(false);
contentPane.add(trabajadorField,
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));
} }
private void createUIComponents() { private void createUIComponents() {