TO MUCH THINGS

Pero ya esta casi casi, estoy haciendo la eliminacion de cosas de las
tarjetas de credito, luego empiezo a utilizar la linea de sobregiro y
esta done done <3
This commit is contained in:
Daniel Cortés
2019-07-22 05:04:58 -04:00
parent c21919db55
commit bd70170c32
50 changed files with 2156 additions and 1517 deletions

View File

@@ -35,7 +35,7 @@ public class ClienteFacade extends AbstractFacade<Cliente> implements ClienteFac
@Override @Override
public Cliente findByRut(String rut) { public Cliente findByRut(String rut) {
TypedQuery<Cliente> query = em.createNamedQuery("Cliente.findByRut", Cliente.class); TypedQuery<Cliente> query = em.createQuery("SELECT c FROM Cliente c WHERE c.rut = :rut ", Cliente.class);
query.setParameter("rut", rut); query.setParameter("rut", rut);
try { try {
return query.getSingleResult(); return query.getSingleResult();

View File

@@ -34,7 +34,7 @@ public class UsuarioFacade extends AbstractFacade<Usuario> implements UsuarioFac
@Override @Override
public Usuario findByNombre(String name) { public Usuario findByNombre(String name) {
TypedQuery<Usuario> query = em.createNamedQuery("Usuario.findByNombre", Usuario.class); TypedQuery<Usuario> query = em.createQuery("SELECT u FROM Usuario u WHERE u.nombre = :nombre", Usuario.class);
query.setParameter("nombre", name); query.setParameter("nombre", name);
try{ try{
return query.getSingleResult(); return query.getSingleResult();

View File

@@ -1,88 +1,59 @@
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "cliente") @Table(name = "cliente")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c")
, @NamedQuery(name = "Cliente.findById", query = "SELECT c FROM Cliente c WHERE c.id = :id")
, @NamedQuery(name = "Cliente.findByRut", query = "SELECT c FROM Cliente c WHERE c.rut = :rut")
, @NamedQuery(name = "Cliente.findByNombre", query = "SELECT c FROM Cliente c WHERE c.nombre = :nombre")
, @NamedQuery(name = "Cliente.findByCiudad", query = "SELECT c FROM Cliente c WHERE c.ciudad = :ciudad")
, @NamedQuery(name = "Cliente.findByInsertedAt", query = "SELECT c FROM Cliente c WHERE c.insertedAt = :insertedAt")})
public class Cliente implements Serializable { public class Cliente implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "rut") @Column(name = "rut")
private String rut; private String rut;
@Basic(optional = false)
@Column(name = "nombre") @Column(name = "nombre")
private String nombre; private String nombre;
@Basic(optional = false)
@Column(name = "ciudad") @Column(name = "ciudad")
private String ciudad; private String ciudad;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente") @OneToOne
private List<CuentaCorriente> cuentaCorrienteList; @JoinColumn(name = "cuenta_corriente")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente") private CuentaCorriente cuentaCorriente;
private List<TarjetaDebito> tarjetaDebitoList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente") @OneToOne
private List<TarjetaCredito> tarjetaCreditoList; @JoinColumn(name = "tarjeta_debito")
@JoinColumn(name = "linea_sobregiro", referencedColumnName = "id") private TarjetaDebito tarjetaDebito;
@OneToOne(optional = true)
private LineaSobregiro lineaSobregiro; @OneToOne
@JoinColumn(name = "usuario", referencedColumnName = "id") @JoinColumn(name = "tarjeta_credito")
@OneToOne(optional = false) private TarjetaCredito tarjetaCredito;
@OneToOne
@JoinColumn(name = "usuario")
private Usuario usuario; private Usuario usuario;
public Cliente() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public Cliente(Integer id) {
this.id = id;
}
public Cliente(Integer id, String rut, String nombre, String ciudad, Date insertedAt) {
this.id = id;
this.rut = rut;
this.nombre = nombre;
this.ciudad = ciudad;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -117,53 +88,42 @@ public class Cliente implements Serializable {
this.ciudad = ciudad; this.ciudad = ciudad;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@XmlTransient public CuentaCorriente getCuentaCorriente() {
public List<CuentaCorriente> getCuentaCorrienteList() { return cuentaCorriente;
if (cuentaCorrienteList == null)
cuentaCorrienteList = new ArrayList<>();
return cuentaCorrienteList;
} }
public void setCuentaCorrienteList(List<CuentaCorriente> cuentaCorrienteList) { public void setCuentaCorriente(CuentaCorriente cuentaCorriente) {
this.cuentaCorrienteList = cuentaCorrienteList; this.cuentaCorriente = cuentaCorriente;
if(this.cuentaCorriente.getCliente() != this)
this.cuentaCorriente.setCliente(this);
} }
@XmlTransient public TarjetaDebito getTarjetaDebito() {
public List<TarjetaDebito> getTarjetaDebitoList() { return tarjetaDebito;
return tarjetaDebitoList;
} }
public void setTarjetaDebitoList(List<TarjetaDebito> tarjetaDebitoList) { public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
if (tarjetaDebitoList == null) this.tarjetaDebito = tarjetaDebito;
tarjetaDebitoList = new ArrayList<>(); if(this.tarjetaDebito.getCliente() != this)
this.tarjetaDebitoList = tarjetaDebitoList; this.tarjetaDebito.setCliente(this);
} }
@XmlTransient public TarjetaCredito getTarjetaCredito() {
public List<TarjetaCredito> getTarjetaCreditoList() { return tarjetaCredito;
return tarjetaCreditoList;
} }
public void setTarjetaCreditoList(List<TarjetaCredito> tarjetaCreditoList) { public void setTarjetaCredito(TarjetaCredito tarjetaCredito) {
if (tarjetaCreditoList == null) this.tarjetaCredito = tarjetaCredito;
tarjetaCreditoList = new ArrayList<>(); if(this.tarjetaCredito.getCliente() != this)
this.tarjetaCreditoList = tarjetaCreditoList; this.tarjetaCredito.setCliente(this);
}
public LineaSobregiro getLineaSobregiro() {
return lineaSobregiro;
}
public void setLineaSobregiro(LineaSobregiro lineaSobregiro) {
this.lineaSobregiro = lineaSobregiro;
} }
public Usuario getUsuario() { public Usuario getUsuario() {
@@ -172,6 +132,8 @@ public class Cliente implements Serializable {
public void setUsuario(Usuario usuario) { public void setUsuario(Usuario usuario) {
this.usuario = usuario; this.usuario = usuario;
if(this.usuario.getCliente() != this)
this.usuario.setCliente(this);
} }
@Override @Override
@@ -188,14 +150,11 @@ public class Cliente implements Serializable {
return false; return false;
} }
Cliente other = (Cliente) object; Cliente other = (Cliente) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "entities.Cliente[ id=" + id + " ]"; return "entities.Cliente[ id=" + id + " ]";
} }
} }

View File

@@ -1,13 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.time.LocalDateTime;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -15,58 +9,39 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.PrePersist;
import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "compra_tarjeta_credito") @Table(name = "compra_tarjeta_credito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "CompraTarjetaCredito.findAll", query = "SELECT c FROM CompraTarjetaCredito c")
, @NamedQuery(name = "CompraTarjetaCredito.findById", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.id = :id")
, @NamedQuery(name = "CompraTarjetaCredito.findByMonto", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.monto = :monto")
, @NamedQuery(name = "CompraTarjetaCredito.findByComentario", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.comentario = :comentario")
, @NamedQuery(name = "CompraTarjetaCredito.findByInsertedAt", query = "SELECT c FROM CompraTarjetaCredito c WHERE c.insertedAt = :insertedAt")})
public class CompraTarjetaCredito implements Serializable { public class CompraTarjetaCredito implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "tipo")
private String tipo;
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "tarjeta_credito", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "tarjeta_credito")
private TarjetaCredito tarjetaCredito; private TarjetaCredito tarjetaCredito;
public CompraTarjetaCredito() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public CompraTarjetaCredito(Integer id) {
this.id = id;
}
public CompraTarjetaCredito(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -93,11 +68,20 @@ public class CompraTarjetaCredito implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public String getTipo() {
return tipo;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -107,6 +91,8 @@ public class CompraTarjetaCredito implements Serializable {
public void setTarjetaCredito(TarjetaCredito tarjetaCredito) { public void setTarjetaCredito(TarjetaCredito tarjetaCredito) {
this.tarjetaCredito = tarjetaCredito; this.tarjetaCredito = tarjetaCredito;
if(!this.tarjetaCredito.getCompraList().contains(this))
this.tarjetaCredito.getCompraList().add(this);
} }
@Override @Override
@@ -123,9 +109,7 @@ public class CompraTarjetaCredito implements Serializable {
return false; return false;
} }
CompraTarjetaCredito other = (CompraTarjetaCredito) object; CompraTarjetaCredito other = (CompraTarjetaCredito) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,11 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
@@ -17,56 +13,38 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "compra_tarjeta_debito") @Table(name = "compra_tarjeta_debito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "CompraTarjetaDebito.findAll", query = "SELECT c FROM CompraTarjetaDebito c")
, @NamedQuery(name = "CompraTarjetaDebito.findById", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.id = :id")
, @NamedQuery(name = "CompraTarjetaDebito.findByMonto", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.monto = :monto")
, @NamedQuery(name = "CompraTarjetaDebito.findByComentario", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.comentario = :comentario")
, @NamedQuery(name = "CompraTarjetaDebito.findByInsertedAt", query = "SELECT c FROM CompraTarjetaDebito c WHERE c.insertedAt = :insertedAt")})
public class CompraTarjetaDebito implements Serializable { public class CompraTarjetaDebito implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "tarjeta_debito", referencedColumnName = "id") @ManyToOne
@ManyToOne(optional = false) @JoinColumn(name = "tarjeta_debito")
private TarjetaDebito tarjetaDebito; private TarjetaDebito tarjetaDebito;
public CompraTarjetaDebito() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public CompraTarjetaDebito(Integer id) {
this.id = id;
}
public CompraTarjetaDebito(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -93,11 +71,11 @@ public class CompraTarjetaDebito implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -107,6 +85,8 @@ public class CompraTarjetaDebito implements Serializable {
public void setTarjetaDebito(TarjetaDebito tarjetaDebito) { public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
this.tarjetaDebito = tarjetaDebito; this.tarjetaDebito = tarjetaDebito;
if(!this.tarjetaDebito.getCompraList().contains(this))
this.tarjetaDebito.getCompraList().add(this);
} }
@Override @Override
@@ -123,9 +103,7 @@ public class CompraTarjetaDebito implements Serializable {
return false; return false;
} }
CompraTarjetaDebito other = (CompraTarjetaDebito) object; CompraTarjetaDebito other = (CompraTarjetaDebito) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,80 +1,60 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "cuenta_corriente") @Table(name = "cuenta_corriente")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "CuentaCorriente.findAll", query = "SELECT c FROM CuentaCorriente c")
, @NamedQuery(name = "CuentaCorriente.findById", query = "SELECT c FROM CuentaCorriente c WHERE c.id = :id")
, @NamedQuery(name = "CuentaCorriente.findBySaldo", query = "SELECT c FROM CuentaCorriente c WHERE c.saldo = :saldo")
, @NamedQuery(name = "CuentaCorriente.findByInsertedAt", query = "SELECT c FROM CuentaCorriente c WHERE c.insertedAt = :insertedAt")})
public class CuentaCorriente implements Serializable { public class CuentaCorriente implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "saldo") @Column(name = "saldo")
private int saldo; private int saldo;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "cliente", referencedColumnName = "id") @OneToOne
@ManyToOne(optional = false) @JoinColumn(name = "linea_sobregiro")
private LineaSobregiro lineaSobregiro;
@OneToOne(mappedBy = "cuentaCorriente")
private Cliente cliente; private Cliente cliente;
@OneToMany(mappedBy = "cuentaCorriente") @OneToMany(mappedBy = "cuentaCorriente")
private List<DepositoCuentaCorriente> depositoList; private List<DepositoCuentaCorriente> depositoList;
@OneToMany(mappedBy = "cuentaCorrienteFrom") @OneToMany(mappedBy = "cuentaCorrienteFrom")
private List<TransferenciaCuentaCorriente> transferenciaFromList; private List<TransferenciaCuentaCorriente> transferenciaFromList;
@OneToMany(mappedBy = "cuentaCorrienteTo") @OneToMany(mappedBy = "cuentaCorrienteTo")
private List<TransferenciaCuentaCorriente> transferenciaToList; private List<TransferenciaCuentaCorriente> transferenciaToList;
@OneToMany(mappedBy = "cuentaCorriente") @OneToMany(mappedBy = "cuentaCorriente")
private List<GiroCuentaCorriente> giroList; private List<GiroCuentaCorriente> giroList;
public CuentaCorriente() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public CuentaCorriente(Integer id) { this.saldo = 0;
this.id = id;
}
public CuentaCorriente(Integer id, int saldo, Date insertedAt) {
this.id = id;
this.saldo = saldo;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -93,20 +73,32 @@ public class CuentaCorriente implements Serializable {
this.saldo = saldo; this.saldo = saldo;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
public LineaSobregiro getLineaSobregiro() {
return lineaSobregiro;
}
public void setLineaSobregiro(LineaSobregiro lineaSobregiro) {
this.lineaSobregiro = lineaSobregiro;
if (!this.lineaSobregiro.getCuentaCorrienteList().contains(this))
this.lineaSobregiro.getCuentaCorrienteList().add(this);
}
public Cliente getCliente() { public Cliente getCliente() {
return cliente; return cliente;
} }
public void setCliente(Cliente cliente) { public void setCliente(Cliente cliente) {
this.cliente = cliente; this.cliente = cliente;
if(this.cliente.getCuentaCorriente() != this)
this.cliente.setCuentaCorriente(this);
} }
@XmlTransient @XmlTransient
@@ -118,6 +110,12 @@ public class CuentaCorriente implements Serializable {
this.depositoList = depositoList; this.depositoList = depositoList;
} }
public void addDeposito(DepositoCuentaCorriente deposito) {
this.depositoList.add(deposito);
if (deposito.getCuentaCorriente() != this)
deposito.setCuentaCorriente(this);
}
@XmlTransient @XmlTransient
public List<TransferenciaCuentaCorriente> getTransferenciaFromList() { public List<TransferenciaCuentaCorriente> getTransferenciaFromList() {
return transferenciaFromList; return transferenciaFromList;
@@ -127,6 +125,12 @@ public class CuentaCorriente implements Serializable {
this.transferenciaFromList = transferenciaFromList; this.transferenciaFromList = transferenciaFromList;
} }
public void addTransferenciaFrom(TransferenciaCuentaCorriente transferenciaFrom) {
this.transferenciaFromList.add(transferenciaFrom);
if (transferenciaFrom.getCuentaCorrienteFrom() != this)
transferenciaFrom.setCuentaCorrienteFrom(this);
}
@XmlTransient @XmlTransient
public List<TransferenciaCuentaCorriente> getTransferenciaToList() { public List<TransferenciaCuentaCorriente> getTransferenciaToList() {
return transferenciaToList; return transferenciaToList;
@@ -136,6 +140,12 @@ public class CuentaCorriente implements Serializable {
this.transferenciaToList = transferenciaToList; this.transferenciaToList = transferenciaToList;
} }
public void addTransferenciaTo(TransferenciaCuentaCorriente transferenciaTo) {
this.transferenciaFromList.add(transferenciaTo);
if (transferenciaTo.getCuentaCorrienteTo() != this)
transferenciaTo.setCuentaCorrienteTo(this);
}
@XmlTransient @XmlTransient
public List<GiroCuentaCorriente> getGiroList() { public List<GiroCuentaCorriente> getGiroList() {
return giroList; return giroList;
@@ -145,6 +155,12 @@ public class CuentaCorriente implements Serializable {
this.giroList = giroList; this.giroList = giroList;
} }
public void addGiro(GiroCuentaCorriente giro) {
this.giroList.add(giro);
if (giro.getCuentaCorriente() != this)
giro.setCuentaCorriente(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;

View File

@@ -1,11 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
@@ -17,59 +13,42 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "deposito_cuenta_corriente") @Table(name = "deposito_cuenta_corriente")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "DepositoCuentaCorriente.findAll", query = "SELECT d FROM DepositoCuentaCorriente d")
, @NamedQuery(name = "DepositoCuentaCorriente.findById", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.id = :id")
, @NamedQuery(name = "DepositoCuentaCorriente.findByMonto", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.monto = :monto")
, @NamedQuery(name = "DepositoCuentaCorriente.findByComentario", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.comentario = :comentario")
, @NamedQuery(name = "DepositoCuentaCorriente.findByInsertedAt", query = "SELECT d FROM DepositoCuentaCorriente d WHERE d.insertedAt = :insertedAt")})
public class DepositoCuentaCorriente implements Serializable { public class DepositoCuentaCorriente implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "metodo", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "metodo")
private Metodo metodo; private Metodo metodo;
@JoinColumn(name = "cuenta_corriente", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "cuenta_corriente")
private CuentaCorriente cuentaCorriente; private CuentaCorriente cuentaCorriente;
public DepositoCuentaCorriente() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public DepositoCuentaCorriente(Integer id) {
this.id = id;
}
public DepositoCuentaCorriente(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -96,11 +75,11 @@ public class DepositoCuentaCorriente implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -110,6 +89,8 @@ public class DepositoCuentaCorriente implements Serializable {
public void setMetodo(Metodo metodo) { public void setMetodo(Metodo metodo) {
this.metodo = metodo; this.metodo = metodo;
if(!metodo.getDepositoCuentaCorrienteList().contains(this))
metodo.getDepositoCuentaCorrienteList().add(this);
} }
public CuentaCorriente getCuentaCorriente() { public CuentaCorriente getCuentaCorriente() {
@@ -118,6 +99,8 @@ public class DepositoCuentaCorriente implements Serializable {
public void setCuentaCorriente(CuentaCorriente cuentaCorriente) { public void setCuentaCorriente(CuentaCorriente cuentaCorriente) {
this.cuentaCorriente = cuentaCorriente; this.cuentaCorriente = cuentaCorriente;
if(!this.cuentaCorriente.getDepositoList().contains(this))
this.cuentaCorriente.getDepositoList().add(this);
} }
@Override @Override
@@ -134,9 +117,7 @@ public class DepositoCuentaCorriente implements Serializable {
return false; return false;
} }
DepositoCuentaCorriente other = (DepositoCuentaCorriente) object; DepositoCuentaCorriente other = (DepositoCuentaCorriente) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,13 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.time.LocalDateTime;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -15,61 +9,40 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.PrePersist;
import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "deposito_tarjeta_debito") @Table(name = "deposito_tarjeta_debito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "DepositoTarjetaDebito.findAll", query = "SELECT d FROM DepositoTarjetaDebito d")
, @NamedQuery(name = "DepositoTarjetaDebito.findById", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.id = :id")
, @NamedQuery(name = "DepositoTarjetaDebito.findByMonto", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.monto = :monto")
, @NamedQuery(name = "DepositoTarjetaDebito.findByComentario", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.comentario = :comentario")
, @NamedQuery(name = "DepositoTarjetaDebito.findByInsertedAt", query = "SELECT d FROM DepositoTarjetaDebito d WHERE d.insertedAt = :insertedAt")})
public class DepositoTarjetaDebito implements Serializable { public class DepositoTarjetaDebito implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "metodo", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "metodo")
private Metodo metodo; private Metodo metodo;
@JoinColumn(name = "tarjeta_debito", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "tarjeta_debito")
private TarjetaDebito tarjetaDebito; private TarjetaDebito tarjetaDebito;
public DepositoTarjetaDebito() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public DepositoTarjetaDebito(Integer id) {
this.id = id;
}
public DepositoTarjetaDebito(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -96,11 +69,11 @@ public class DepositoTarjetaDebito implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -110,6 +83,8 @@ public class DepositoTarjetaDebito implements Serializable {
public void setMetodo(Metodo metodo) { public void setMetodo(Metodo metodo) {
this.metodo = metodo; this.metodo = metodo;
if(!this.metodo.getDepositoTarjetaDebitoList().contains(this))
this.metodo.getDepositoTarjetaDebitoList().add(this);
} }
public TarjetaDebito getTarjetaDebito() { public TarjetaDebito getTarjetaDebito() {
@@ -118,6 +93,8 @@ public class DepositoTarjetaDebito implements Serializable {
public void setTarjetaDebito(TarjetaDebito tarjetaDebito) { public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
this.tarjetaDebito = tarjetaDebito; this.tarjetaDebito = tarjetaDebito;
if(!this.tarjetaDebito.getDepositoList().contains(this))
this.tarjetaDebito.getDepositoList().add(this);
} }
@Override @Override

View File

@@ -1,13 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.time.LocalDateTime;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -15,62 +9,41 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.PrePersist;
import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "giro_cuenta_corriente") @Table(name = "giro_cuenta_corriente")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "GiroCuentaCorriente.findAll", query = "SELECT g FROM GiroCuentaCorriente g")
, @NamedQuery(name = "GiroCuentaCorriente.findById", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.id = :id")
, @NamedQuery(name = "GiroCuentaCorriente.findByMonto", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.monto = :monto")
, @NamedQuery(name = "GiroCuentaCorriente.findByComentario", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.comentario = :comentario")
, @NamedQuery(name = "GiroCuentaCorriente.findByInsertedAt", query = "SELECT g FROM GiroCuentaCorriente g WHERE g.insertedAt = :insertedAt")})
public class GiroCuentaCorriente implements Serializable { public class GiroCuentaCorriente implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "metodo", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "metodo")
private Metodo metodo; private Metodo metodo;
@JoinColumn(name = "cuenta_corriente", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "cuenta_corriente")
private CuentaCorriente cuentaCorriente; private CuentaCorriente cuentaCorriente;
public GiroCuentaCorriente() { @PrePersist
public void onPersist() {
this.insertedAt = LocalDateTime.now();
} }
public GiroCuentaCorriente(Integer id) {
this.id = id;
}
public GiroCuentaCorriente(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
}
public Integer getId() { public Integer getId() {
return id; return id;
@@ -96,11 +69,11 @@ public class GiroCuentaCorriente implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -110,6 +83,8 @@ public class GiroCuentaCorriente implements Serializable {
public void setMetodo(Metodo metodo) { public void setMetodo(Metodo metodo) {
this.metodo = metodo; this.metodo = metodo;
if(!this.metodo.getGiroCuentaCorrienteList().contains(this))
this.metodo.getGiroCuentaCorrienteList().add(this);
} }
public CuentaCorriente getCuentaCorriente() { public CuentaCorriente getCuentaCorriente() {
@@ -118,6 +93,8 @@ public class GiroCuentaCorriente implements Serializable {
public void setCuentaCorriente(CuentaCorriente cuentaCorriente) { public void setCuentaCorriente(CuentaCorriente cuentaCorriente) {
this.cuentaCorriente = cuentaCorriente; this.cuentaCorriente = cuentaCorriente;
if(!this.cuentaCorriente.getGiroList().contains(this))
this.cuentaCorriente.getGiroList().add(this);
} }
@Override @Override
@@ -134,9 +111,7 @@ public class GiroCuentaCorriente implements Serializable {
return false; return false;
} }
GiroCuentaCorriente other = (GiroCuentaCorriente) object; GiroCuentaCorriente other = (GiroCuentaCorriente) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,11 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
@@ -17,61 +13,43 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "giro_tarjeta_debito") @Table(name = "giro_tarjeta_debito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "GiroTarjetaDebito.findAll", query = "SELECT g FROM GiroTarjetaDebito g")
, @NamedQuery(name = "GiroTarjetaDebito.findById", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.id = :id")
, @NamedQuery(name = "GiroTarjetaDebito.findByMonto", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.monto = :monto")
, @NamedQuery(name = "GiroTarjetaDebito.findByComentario", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.comentario = :comentario")
, @NamedQuery(name = "GiroTarjetaDebito.findByInsertedAt", query = "SELECT g FROM GiroTarjetaDebito g WHERE g.insertedAt = :insertedAt")})
public class GiroTarjetaDebito implements Serializable { public class GiroTarjetaDebito implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "tarjeta_debito", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "tarjeta_debito")
private TarjetaDebito tarjetaDebito; private TarjetaDebito tarjetaDebito;
@JoinColumn(name = "metodo", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "metodo")
private Metodo metodo; private Metodo metodo;
public GiroTarjetaDebito() { @PrePersist
public void onPersis() {
this.insertedAt = LocalDateTime.now();
} }
public GiroTarjetaDebito(Integer id) {
this.id = id;
}
public GiroTarjetaDebito(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
}
public Integer getId() { public Integer getId() {
return id; return id;
} }
@@ -96,11 +74,11 @@ public class GiroTarjetaDebito implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -110,6 +88,8 @@ public class GiroTarjetaDebito implements Serializable {
public void setTarjetaDebito(TarjetaDebito tarjetaDebito) { public void setTarjetaDebito(TarjetaDebito tarjetaDebito) {
this.tarjetaDebito = tarjetaDebito; this.tarjetaDebito = tarjetaDebito;
if(!this.tarjetaDebito.getGiroList().contains(this))
this.tarjetaDebito.getGiroList().add(this);
} }
public Metodo getMetodo() { public Metodo getMetodo() {
@@ -118,6 +98,8 @@ public class GiroTarjetaDebito implements Serializable {
public void setMetodo(Metodo metodo) { public void setMetodo(Metodo metodo) {
this.metodo = metodo; this.metodo = metodo;
if(!this.metodo.getGiroTarjetaDebitoList().contains(this))
this.metodo.getGiroTarjetaDebitoList().add(this);
} }
@Override @Override
@@ -134,9 +116,7 @@ public class GiroTarjetaDebito implements Serializable {
return false; return false;
} }
GiroTarjetaDebito other = (GiroTarjetaDebito) object; GiroTarjetaDebito other = (GiroTarjetaDebito) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,73 +1,48 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.time.LocalDateTime;
import javax.persistence.Basic; import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.NamedQueries; import javax.persistence.JoinColumn;
import javax.persistence.NamedQuery; import javax.persistence.ManyToOne;
import javax.persistence.OneToOne; import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "linea_sobregiro") @Table(name = "linea_sobregiro")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "LineaSobregiro.findAll", query = "SELECT l FROM LineaSobregiro l")
, @NamedQuery(name = "LineaSobregiro.findById", query = "SELECT l FROM LineaSobregiro l WHERE l.id = :id")
, @NamedQuery(name = "LineaSobregiro.findBySobregiro", query = "SELECT l FROM LineaSobregiro l WHERE l.sobregiro = :sobregiro")
, @NamedQuery(name = "LineaSobregiro.findByLimite", query = "SELECT l FROM LineaSobregiro l WHERE l.limite = :limite")
, @NamedQuery(name = "LineaSobregiro.findByInsertedAt", query = "SELECT l FROM LineaSobregiro l WHERE l.insertedAt = :insertedAt")})
public class LineaSobregiro implements Serializable { public class LineaSobregiro implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "sobregiro") @Column(name = "sobregiro", nullable = false)
private int sobregiro; private int sobregiro;
@Basic(optional = false)
@Column(name = "limite") @Column(name = "limite", nullable = false)
private int limite; private int limite;
@Basic(optional = false)
@Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP)
private Date insertedAt;
@OneToOne(cascade = CascadeType.ALL, mappedBy = "lineaSobregiro")
private Cliente cliente;
public LineaSobregiro() { @Column(name = "inserted_at", nullable = false)
} private LocalDateTime insertedAt;
public LineaSobregiro(Integer id) { @OneToMany(mappedBy = "lineaSobregiro")
this.id = id; private List<CuentaCorriente> cuentaCorrienteList;
}
public LineaSobregiro(Integer id, int sobregiro, int limite, Date insertedAt) { @OneToMany(mappedBy = "lineaSobregiro")
this.id = id; private List<TarjetaCredito> tarjetaCreditoList;
this.sobregiro = sobregiro;
this.limite = limite; @PrePersist
this.insertedAt = insertedAt; public void onPersist() {
this.insertedAt = LocalDateTime.now();
} }
public Integer getId() { public Integer getId() {
@@ -94,22 +69,42 @@ public class LineaSobregiro implements Serializable {
this.limite = limite; this.limite = limite;
} }
public Date getInsertedAt() { public List<CuentaCorriente> getCuentaCorrienteList() {
return cuentaCorrienteList;
}
public void setCuentaCorrienteList(List<CuentaCorriente> cuentaCorrienteList) {
this.cuentaCorrienteList = cuentaCorrienteList;
}
public void addCuentaCorriente(CuentaCorriente cuentaCorriente){
this.cuentaCorrienteList.add(cuentaCorriente);
if(cuentaCorriente.getLineaSobregiro() != this)
cuentaCorriente.setLineaSobregiro(this);
}
public List<TarjetaCredito> getTarjetaCreditoList() {
return tarjetaCreditoList;
}
public void setTarjetaCreditoList(List<TarjetaCredito> tarjetaCreditoList) {
this.tarjetaCreditoList = tarjetaCreditoList;
}
public void addTarjetaCredito(TarjetaCredito tarjetaCredito){
this.tarjetaCreditoList.add(tarjetaCredito);
if(tarjetaCredito.getLineaSobregiro() != this)
tarjetaCredito.setLineaSobregiro(this);
}
public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
@@ -119,14 +114,11 @@ public class LineaSobregiro implements Serializable {
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof LineaSobregiro)) { if (!(object instanceof LineaSobregiro)) {
return false; return false;
} }
LineaSobregiro other = (LineaSobregiro) object; LineaSobregiro other = (LineaSobregiro) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,75 +1,51 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "metodo") @Table(name = "metodo")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "Metodo.findAll", query = "SELECT m FROM Metodo m")
, @NamedQuery(name = "Metodo.findById", query = "SELECT m FROM Metodo m WHERE m.id = :id")
, @NamedQuery(name = "Metodo.findByNombre", query = "SELECT m FROM Metodo m WHERE m.nombre = :nombre")
, @NamedQuery(name = "Metodo.findByInsertedAt", query = "SELECT m FROM Metodo m WHERE m.insertedAt = :insertedAt")})
public class Metodo implements Serializable { public class Metodo implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "nombre") @Column(name = "nombre")
private String nombre; private String nombre;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@OneToMany(mappedBy = "metodo")
private List<DepositoCuentaCorriente> depositoCuentaCorrienteList;
@OneToMany(mappedBy = "metodo")
private List<DepositoTarjetaDebito> depositoTarjetaDebitoList;
@OneToMany(mappedBy = "metodo")
private List<GiroTarjetaDebito> giroTarjetaDebitoList;
@OneToMany(mappedBy = "metodo") @OneToMany(mappedBy = "metodo")
private List<GiroCuentaCorriente> giroCuentaCorrienteList; private List<GiroCuentaCorriente> giroCuentaCorrienteList;
public Metodo() { @OneToMany(mappedBy = "metodo")
} private List<DepositoCuentaCorriente> depositoCuentaCorrienteList;
public Metodo(Integer id) { @OneToMany(mappedBy = "metodo")
this.id = id; private List<DepositoTarjetaDebito> depositoTarjetaDebitoList;
}
public Metodo(Integer id, String nombre, Date insertedAt) { @OneToMany(mappedBy = "metodo")
this.id = id; private List<GiroTarjetaDebito> giroTarjetaDebitoList;
this.nombre = nombre;
this.insertedAt = insertedAt; @PrePersist
public void onPersist() {
this.insertedAt = LocalDateTime.now();
} }
public Integer getId() { public Integer getId() {
@@ -88,11 +64,11 @@ public class Metodo implements Serializable {
this.nombre = nombre; this.nombre = nombre;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -105,6 +81,12 @@ public class Metodo implements Serializable {
this.depositoCuentaCorrienteList = depositoCuentaCorrienteList; this.depositoCuentaCorrienteList = depositoCuentaCorrienteList;
} }
public void addDepositoCuentaCorriente(DepositoCuentaCorriente depositoCuentaCorriente) {
this.depositoCuentaCorrienteList.add(depositoCuentaCorriente);
if (depositoCuentaCorriente.getMetodo() != this)
depositoCuentaCorriente.setMetodo(this);
}
@XmlTransient @XmlTransient
public List<DepositoTarjetaDebito> getDepositoTarjetaDebitoList() { public List<DepositoTarjetaDebito> getDepositoTarjetaDebitoList() {
return depositoTarjetaDebitoList; return depositoTarjetaDebitoList;
@@ -114,6 +96,13 @@ public class Metodo implements Serializable {
this.depositoTarjetaDebitoList = depositoTarjetaDebitoList; this.depositoTarjetaDebitoList = depositoTarjetaDebitoList;
} }
public void addDepositoTarjetaDebito(DepositoTarjetaDebito depositoTarjetaDebito) {
this.depositoTarjetaDebitoList.add(depositoTarjetaDebito);
if (depositoTarjetaDebito.getMetodo() != this) {
depositoTarjetaDebito.setMetodo(this);
}
}
@XmlTransient @XmlTransient
public List<GiroTarjetaDebito> getGiroTarjetaDebitoList() { public List<GiroTarjetaDebito> getGiroTarjetaDebitoList() {
return giroTarjetaDebitoList; return giroTarjetaDebitoList;
@@ -123,6 +112,12 @@ public class Metodo implements Serializable {
this.giroTarjetaDebitoList = giroTarjetaDebitoList; this.giroTarjetaDebitoList = giroTarjetaDebitoList;
} }
public void addGiroTarjetaDebito(GiroTarjetaDebito giroTarjetaDebito) {
this.giroTarjetaDebitoList.add(giroTarjetaDebito);
if (giroTarjetaDebito.getMetodo() != this)
giroTarjetaDebito.setMetodo(this);
}
@XmlTransient @XmlTransient
public List<GiroCuentaCorriente> getGiroCuentaCorrienteList() { public List<GiroCuentaCorriente> getGiroCuentaCorrienteList() {
return giroCuentaCorrienteList; return giroCuentaCorrienteList;
@@ -132,6 +127,13 @@ public class Metodo implements Serializable {
this.giroCuentaCorrienteList = giroCuentaCorrienteList; this.giroCuentaCorrienteList = giroCuentaCorrienteList;
} }
public void addGiroCuentaCorriente(GiroCuentaCorriente giroCuentaCorriente) {
this.giroCuentaCorrienteList.add(giroCuentaCorriente);
if (giroCuentaCorriente.getMetodo() != this) {
giroCuentaCorriente.setMetodo(this);
}
}
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
@@ -146,9 +148,7 @@ public class Metodo implements Serializable {
return false; return false;
} }
Metodo other = (Metodo) object; Metodo other = (Metodo) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,13 +1,8 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -15,58 +10,39 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.PrePersist;
import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "pago_tarjeta_credito") @Table(name = "pago_tarjeta_credito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "PagoTarjetaCredito.findAll", query = "SELECT p FROM PagoTarjetaCredito p")
, @NamedQuery(name = "PagoTarjetaCredito.findById", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.id = :id")
, @NamedQuery(name = "PagoTarjetaCredito.findByMonto", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.monto = :monto")
, @NamedQuery(name = "PagoTarjetaCredito.findByComentario", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.comentario = :comentario")
, @NamedQuery(name = "PagoTarjetaCredito.findByInsertedAt", query = "SELECT p FROM PagoTarjetaCredito p WHERE p.insertedAt = :insertedAt")})
public class PagoTarjetaCredito implements Serializable { public class PagoTarjetaCredito implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "tipo")
private String tipo;
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "tarjeta_credito", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "tarjeta_credito", referencedColumnName = "id")
private TarjetaCredito tarjetaCredito; private TarjetaCredito tarjetaCredito;
public PagoTarjetaCredito() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public PagoTarjetaCredito(Integer id) {
this.id = id;
}
public PagoTarjetaCredito(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -93,20 +69,32 @@ public class PagoTarjetaCredito implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public String getTipo() {
return tipo;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
public TarjetaCredito getTarjetaCredito() { public TarjetaCredito getTarjetaCredito() {
return tarjetaCredito; return tarjetaCredito;
} }
public void setTarjetaCredito(TarjetaCredito tarjetaCredito) { public void setTarjetaCredito(TarjetaCredito tarjetaCredito) {
this.tarjetaCredito = tarjetaCredito; this.tarjetaCredito = tarjetaCredito;
if(!this.tarjetaCredito.getPagoList().contains(this))
this.tarjetaCredito.getPagoList().add(this);
} }
@Override @Override
@@ -123,9 +111,7 @@ public class PagoTarjetaCredito implements Serializable {
return false; return false;
} }
PagoTarjetaCredito other = (PagoTarjetaCredito) object; PagoTarjetaCredito other = (PagoTarjetaCredito) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,14 +1,8 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -16,72 +10,56 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "tarjeta_credito") @Table(name = "tarjeta_credito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "TarjetaCredito.findAll", query = "SELECT t FROM TarjetaCredito t")
, @NamedQuery(name = "TarjetaCredito.findById", query = "SELECT t FROM TarjetaCredito t WHERE t.id = :id")
, @NamedQuery(name = "TarjetaCredito.findByLimiteNacional", query = "SELECT t FROM TarjetaCredito t WHERE t.limiteNacional = :limiteNacional")
, @NamedQuery(name = "TarjetaCredito.findByLimiteInternacional", query = "SELECT t FROM TarjetaCredito t WHERE t.limiteInternacional = :limiteInternacional")
, @NamedQuery(name = "TarjetaCredito.findByInsertedAt", query = "SELECT t FROM TarjetaCredito t WHERE t.insertedAt = :insertedAt")})
public class TarjetaCredito implements Serializable { public class TarjetaCredito implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "limite_nacional") @Column(name = "limite_nacional", nullable = false)
private int limiteNacional; private int limiteNacional;
@Basic(optional = false)
@Column(name = "limite_internacional") @Column(name = "limite_internacional", nullable = false)
private int limiteInternacional; private int limiteInternacional;
@Basic(optional = false)
@Column(name = "deuda_nacional") @Column(name = "deuda_nacional")
private int deudaNacional; private int deudaNacional;
@Basic(optional = false)
@Column(name = "deuda_internacional") @Column(name = "deuda_internacional")
private int deudaInternacional; private int deudaInternacional;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "cliente", referencedColumnName = "id") @OneToOne
@ManyToOne(optional = false) @JoinColumn(name = "linea_sobregiro")
private LineaSobregiro lineaSobregiro;
@OneToOne(mappedBy = "tarjetaCredito")
private Cliente cliente; private Cliente cliente;
@OneToMany(mappedBy = "tarjetaCredito") @OneToMany(mappedBy = "tarjetaCredito")
private List<PagoTarjetaCredito> pagoList; private List<PagoTarjetaCredito> pagoList;
@OneToMany(mappedBy = "tarjetaCredito") @OneToMany(mappedBy = "tarjetaCredito")
private List<CompraTarjetaCredito> compraList; private List<CompraTarjetaCredito> compraList;
public TarjetaCredito() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public TarjetaCredito(Integer id) { this.deudaNacional = 0;
this.id = id; this.deudaInternacional = 0;
}
public TarjetaCredito(Integer id, int limiteNacional, int limiteInternacional, Date insertedAt) {
this.id = id;
this.limiteNacional = limiteNacional;
this.limiteInternacional = limiteInternacional;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -116,11 +94,11 @@ public class TarjetaCredito implements Serializable {
return deudaInternacional; return deudaInternacional;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -130,6 +108,8 @@ public class TarjetaCredito implements Serializable {
public void setCliente(Cliente cliente) { public void setCliente(Cliente cliente) {
this.cliente = cliente; this.cliente = cliente;
if(this.cliente.getTarjetaCredito() != this)
this.cliente.setTarjetaCredito(this);
} }
@XmlTransient @XmlTransient
@@ -141,6 +121,12 @@ public class TarjetaCredito implements Serializable {
this.pagoList = pagoList; this.pagoList = pagoList;
} }
public void addPago(PagoTarjetaCredito pago) {
this.pagoList.add(pago);
if(pago.getTarjetaCredito() != this)
pago.setTarjetaCredito(this);
}
@XmlTransient @XmlTransient
public List<CompraTarjetaCredito> getCompraList() { public List<CompraTarjetaCredito> getCompraList() {
return compraList; return compraList;
@@ -150,6 +136,12 @@ public class TarjetaCredito implements Serializable {
this.compraList = compraList; this.compraList = compraList;
} }
public void addCompra(CompraTarjetaCredito compra) {
this.compraList.add(compra);
if(compra.getTarjetaCredito() != this)
compra.setTarjetaCredito(this);
}
public void setDeudaNacional(int deudaNacional) { public void setDeudaNacional(int deudaNacional) {
this.deudaNacional = deudaNacional; this.deudaNacional = deudaNacional;
} }
@@ -158,6 +150,15 @@ public class TarjetaCredito implements Serializable {
this.deudaInternacional = deudaInternacional; this.deudaInternacional = deudaInternacional;
} }
public LineaSobregiro getLineaSobregiro() {
return lineaSobregiro;
}
public void setLineaSobregiro(LineaSobregiro lineaSobregiro) {
this.lineaSobregiro = lineaSobregiro;
if(!lineaSobregiro.getTarjetaCreditoList().contains(this))
lineaSobregiro.getTarjetaCreditoList().add(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
@@ -173,9 +174,7 @@ public class TarjetaCredito implements Serializable {
return false; return false;
} }
TarjetaCredito other = (TarjetaCredito) object; TarjetaCredito other = (TarjetaCredito) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,15 +1,8 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -17,68 +10,51 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "tarjeta_debito") @Table(name = "tarjeta_debito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "TarjetaDebito.findAll", query = "SELECT t FROM TarjetaDebito t")
, @NamedQuery(name = "TarjetaDebito.findById", query = "SELECT t FROM TarjetaDebito t WHERE t.id = :id")
, @NamedQuery(name = "TarjetaDebito.findBySaldo", query = "SELECT t FROM TarjetaDebito t WHERE t.saldo = :saldo")
, @NamedQuery(name = "TarjetaDebito.findByInsertedAt", query = "SELECT t FROM TarjetaDebito t WHERE t.insertedAt = :insertedAt")})
public class TarjetaDebito implements Serializable { public class TarjetaDebito implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "tarjetaDebito")
private List<CompraTarjetaDebito> compraList;
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "saldo") @Column(name = "saldo")
private int saldo; private int saldo;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "cliente", referencedColumnName = "id") @OneToOne(mappedBy = "tarjetaDebito")
@ManyToOne(optional = false)
private Cliente cliente; private Cliente cliente;
@OneToMany(mappedBy = "tarjetaDebitoFrom") @OneToMany(mappedBy = "tarjetaDebitoFrom")
private List<TransferenciaTarjetaDebito> transferenciaFromList; private List<TransferenciaTarjetaDebito> transferenciaFromList;
@OneToMany(mappedBy = "tarjetaDebitoTo") @OneToMany(mappedBy = "tarjetaDebitoTo")
private List<TransferenciaTarjetaDebito> transferenciaToList; private List<TransferenciaTarjetaDebito> transferenciaToList;
@OneToMany(mappedBy = "tarjetaDebito") @OneToMany(mappedBy = "tarjetaDebito")
private List<DepositoTarjetaDebito> depositoList; private List<DepositoTarjetaDebito> depositoList;
@OneToMany(mappedBy = "tarjetaDebito") @OneToMany(mappedBy = "tarjetaDebito")
private List<GiroTarjetaDebito> giroList; private List<GiroTarjetaDebito> giroList;
public TarjetaDebito() { @OneToMany(mappedBy = "tarjetaDebito")
} private List<CompraTarjetaDebito> compraList;
public TarjetaDebito(Integer id) { @PrePersist
this.id = id; public void onPersist() {
} this.insertedAt = LocalDateTime.now();
this.saldo = 0;
public TarjetaDebito(Integer id, int saldo, Date insertedAt) {
this.id = id;
this.saldo = saldo;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -97,11 +73,11 @@ public class TarjetaDebito implements Serializable {
this.saldo = saldo; this.saldo = saldo;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -111,24 +87,8 @@ public class TarjetaDebito implements Serializable {
public void setCliente(Cliente cliente) { public void setCliente(Cliente cliente) {
this.cliente = cliente; this.cliente = cliente;
} if(this.cliente.getTarjetaDebito() != this)
this.cliente.setTarjetaDebito(this);
@XmlTransient
public List<TransferenciaTarjetaDebito> getTransferenciaFromList() {
return transferenciaFromList;
}
public void setTransferenciaFromList(List<TransferenciaTarjetaDebito> transferenciaFromList) {
this.transferenciaFromList = transferenciaFromList;
}
@XmlTransient
public List<TransferenciaTarjetaDebito> getTransferenciaToList() {
return transferenciaToList;
}
public void setTransferenciaToList(List<TransferenciaTarjetaDebito> transferenciaToList) {
this.transferenciaToList = transferenciaToList;
} }
@XmlTransient @XmlTransient
@@ -140,6 +100,42 @@ public class TarjetaDebito implements Serializable {
this.depositoList = depositoList; this.depositoList = depositoList;
} }
public void addDeposito(DepositoTarjetaDebito deposito) {
this.depositoList.add(deposito);
if (deposito.getTarjetaDebito()!= this)
deposito.setTarjetaDebito(this);
}
@XmlTransient
public List<TransferenciaTarjetaDebito> getTransferenciaFromList() {
return transferenciaFromList;
}
public void setTransferenciaFromList(List<TransferenciaTarjetaDebito> transferenciaFromList) {
this.transferenciaFromList = transferenciaFromList;
}
public void addTransferenciaFrom(TransferenciaTarjetaDebito transferenciaFrom) {
this.transferenciaFromList.add(transferenciaFrom);
if (transferenciaFrom.getTarjetaDebitoFrom()!= this)
transferenciaFrom.setTarjetaDebitoFrom(this);
}
@XmlTransient
public List<TransferenciaTarjetaDebito> getTransferenciaToList() {
return transferenciaToList;
}
public void setTransferenciaToList(List<TransferenciaTarjetaDebito> transferenciaToList) {
this.transferenciaToList = transferenciaToList;
}
public void addTransferenciaTo(TransferenciaTarjetaDebito transferenciaTo) {
this.transferenciaFromList.add(transferenciaTo);
if (transferenciaTo.getTarjetaDebitoTo() != this)
transferenciaTo.setTarjetaDebitoTo(this);
}
@XmlTransient @XmlTransient
public List<GiroTarjetaDebito> getGiroList() { public List<GiroTarjetaDebito> getGiroList() {
return giroList; return giroList;
@@ -149,6 +145,27 @@ public class TarjetaDebito implements Serializable {
this.giroList = giroList; this.giroList = giroList;
} }
public void addGiro(GiroTarjetaDebito giro) {
this.giroList.add(giro);
if (giro.getTarjetaDebito()!= this)
giro.setTarjetaDebito(this);
}
@XmlTransient
public List<CompraTarjetaDebito> getCompraList() {
return compraList;
}
public void setCompraList(List<CompraTarjetaDebito> compraList) {
this.compraList = compraList;
}
public void addCompra(CompraTarjetaDebito compra) {
this.compraList.add(compra);
if(compra.getTarjetaDebito() != this)
compra.setTarjetaDebito(this);
}
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
@@ -163,23 +180,11 @@ public class TarjetaDebito implements Serializable {
return false; return false;
} }
TarjetaDebito other = (TarjetaDebito) object; TarjetaDebito other = (TarjetaDebito) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override
public String toString() { public String toString() {
return "entities.TarjetaDebito[ id=" + id + " ]"; return "entities.TarjetaDebito[ id=" + id + " ]";
} }
@XmlTransient
public List<CompraTarjetaDebito> getCompraList() {
return compraList;
}
public void setCompraList(List<CompraTarjetaDebito> compraList) {
this.compraList = compraList;
}
} }

View File

@@ -1,11 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
@@ -17,59 +13,42 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "transferencia_cuenta_corriente") @Table(name = "transferencia_cuenta_corriente")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "TransferenciaCuentaCorriente.findAll", query = "SELECT t FROM TransferenciaCuentaCorriente t")
, @NamedQuery(name = "TransferenciaCuentaCorriente.findById", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.id = :id")
, @NamedQuery(name = "TransferenciaCuentaCorriente.findByMonto", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.monto = :monto")
, @NamedQuery(name = "TransferenciaCuentaCorriente.findByComentario", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.comentario = :comentario")
, @NamedQuery(name = "TransferenciaCuentaCorriente.findByInsertedAt", query = "SELECT t FROM TransferenciaCuentaCorriente t WHERE t.insertedAt = :insertedAt")})
public class TransferenciaCuentaCorriente implements Serializable { public class TransferenciaCuentaCorriente implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "cuenta_corriente_from", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "cuenta_corriente_from")
private CuentaCorriente cuentaCorrienteFrom; private CuentaCorriente cuentaCorrienteFrom;
@JoinColumn(name = "cuenta_corriente_to", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "cuenta_corriente_to")
private CuentaCorriente cuentaCorrienteTo; private CuentaCorriente cuentaCorrienteTo;
public TransferenciaCuentaCorriente() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public TransferenciaCuentaCorriente(Integer id) {
this.id = id;
}
public TransferenciaCuentaCorriente(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -96,20 +75,23 @@ public class TransferenciaCuentaCorriente implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
public CuentaCorriente getCuentaCorrienteFrom() { public CuentaCorriente getCuentaCorrienteFrom() {
return cuentaCorrienteFrom; return cuentaCorrienteFrom;
} }
public void setCuentaCorrienteFrom(CuentaCorriente cuentaCorrienteFrom) { public void setCuentaCorrienteFrom(CuentaCorriente cuentaCorrienteFrom) {
this.cuentaCorrienteFrom = cuentaCorrienteFrom; this.cuentaCorrienteFrom = cuentaCorrienteFrom;
if(!this.cuentaCorrienteFrom.getTransferenciaFromList().contains(this))
this.cuentaCorrienteFrom.getTransferenciaFromList().add(this);
} }
public CuentaCorriente getCuentaCorrienteTo() { public CuentaCorriente getCuentaCorrienteTo() {
@@ -118,6 +100,8 @@ public class TransferenciaCuentaCorriente implements Serializable {
public void setCuentaCorrienteTo(CuentaCorriente cuentaCorrienteTo) { public void setCuentaCorrienteTo(CuentaCorriente cuentaCorrienteTo) {
this.cuentaCorrienteTo = cuentaCorrienteTo; this.cuentaCorrienteTo = cuentaCorrienteTo;
if(!this.cuentaCorrienteTo.getTransferenciaToList().contains(this))
this.cuentaCorrienteTo.getTransferenciaToList().add(this);
} }
@Override @Override
@@ -134,9 +118,7 @@ public class TransferenciaCuentaCorriente implements Serializable {
return false; return false;
} }
TransferenciaCuentaCorriente other = (TransferenciaCuentaCorriente) object; TransferenciaCuentaCorriente other = (TransferenciaCuentaCorriente) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,11 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.Column; import javax.persistence.Column;
@@ -17,59 +13,42 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries; import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "transferencia_tarjeta_debito") @Table(name = "transferencia_tarjeta_debito")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "TransferenciaTarjetaDebito.findAll", query = "SELECT t FROM TransferenciaTarjetaDebito t")
, @NamedQuery(name = "TransferenciaTarjetaDebito.findById", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.id = :id")
, @NamedQuery(name = "TransferenciaTarjetaDebito.findByMonto", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.monto = :monto")
, @NamedQuery(name = "TransferenciaTarjetaDebito.findByComentario", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.comentario = :comentario")
, @NamedQuery(name = "TransferenciaTarjetaDebito.findByInsertedAt", query = "SELECT t FROM TransferenciaTarjetaDebito t WHERE t.insertedAt = :insertedAt")})
public class TransferenciaTarjetaDebito implements Serializable { public class TransferenciaTarjetaDebito implements Serializable {
private static final long serialVersionUID = 1L;
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id") @Column(name = "id")
private Integer id; private Integer id;
@Basic(optional = false)
@Column(name = "monto") @Column(name = "monto")
private int monto; private int monto;
@Column(name = "comentario") @Column(name = "comentario")
private String comentario; private String comentario;
@Basic(optional = false)
@Column(name = "inserted_at") @Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP) private LocalDateTime insertedAt;
private Date insertedAt;
@JoinColumn(name = "tarjeta_debito_from", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "tarjeta_debito_from")
private TarjetaDebito tarjetaDebitoFrom; private TarjetaDebito tarjetaDebitoFrom;
@JoinColumn(name = "tarjeta_debito_to", referencedColumnName = "id")
@ManyToOne @ManyToOne
@JoinColumn(name = "tarjeta_debito_to")
private TarjetaDebito tarjetaDebitoTo; private TarjetaDebito tarjetaDebitoTo;
public TransferenciaTarjetaDebito() { @PrePersist
} public void onPersis() {
this.insertedAt = LocalDateTime.now();
public TransferenciaTarjetaDebito(Integer id) {
this.id = id;
}
public TransferenciaTarjetaDebito(Integer id, int monto, Date insertedAt) {
this.id = id;
this.monto = monto;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -96,11 +75,11 @@ public class TransferenciaTarjetaDebito implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -110,6 +89,8 @@ public class TransferenciaTarjetaDebito implements Serializable {
public void setTarjetaDebitoFrom(TarjetaDebito tarjetaDebitoFrom) { public void setTarjetaDebitoFrom(TarjetaDebito tarjetaDebitoFrom) {
this.tarjetaDebitoFrom = tarjetaDebitoFrom; this.tarjetaDebitoFrom = tarjetaDebitoFrom;
if (!this.tarjetaDebitoFrom.getTransferenciaFromList().contains(this))
this.tarjetaDebitoFrom.getTransferenciaFromList().add(this);
} }
public TarjetaDebito getTarjetaDebitoTo() { public TarjetaDebito getTarjetaDebitoTo() {
@@ -118,6 +99,8 @@ public class TransferenciaTarjetaDebito implements Serializable {
public void setTarjetaDebitoTo(TarjetaDebito tarjetaDebitoTo) { public void setTarjetaDebitoTo(TarjetaDebito tarjetaDebitoTo) {
this.tarjetaDebitoTo = tarjetaDebitoTo; this.tarjetaDebitoTo = tarjetaDebitoTo;
if (!this.tarjetaDebitoTo.getTransferenciaToList().contains(this))
this.tarjetaDebitoTo.getTransferenciaToList().add(this);
} }
@Override @Override
@@ -134,9 +117,7 @@ public class TransferenciaTarjetaDebito implements Serializable {
return false; return false;
} }
TransferenciaTarjetaDebito other = (TransferenciaTarjetaDebito) object; TransferenciaTarjetaDebito other = (TransferenciaTarjetaDebito) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override

View File

@@ -1,11 +1,7 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package entities; package entities;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import javax.persistence.Basic; import javax.persistence.Basic;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
@@ -15,74 +11,49 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author ryuuji
*/
@Entity @Entity
@Table(name = "usuario") @Table(name = "usuario")
@XmlRootElement @XmlRootElement
@NamedQueries({
@NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u")
, @NamedQuery(name = "Usuario.findById", query = "SELECT u FROM Usuario u WHERE u.id = :id")
, @NamedQuery(name = "Usuario.findByNombre", query = "SELECT u FROM Usuario u WHERE u.nombre = :nombre")
, @NamedQuery(name = "Usuario.findByRole", query = "SELECT u FROM Usuario u WHERE u.role = :role")
, @NamedQuery(name = "Usuario.findByInsertedAt", query = "SELECT u FROM Usuario u WHERE u.insertedAt = :insertedAt")})
public class Usuario implements Serializable { public class Usuario implements Serializable {
@Basic(optional = false) @Id
@Lob @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "nombre")
private String nombre;
@Column(name = "password") @Column(name = "password")
private byte[] password; private byte[] password;
@Basic(optional = false)
@Lob
@Column(name = "salt") @Column(name = "salt")
private byte[] salt; private byte[] salt;
private static final long serialVersionUID = 1L; @Column(name = "rol")
@Id private String rol;
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false) @OneToOne(mappedBy = "usuario")
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "nombre")
private String nombre;
@Basic(optional = false)
@Column(name = "role")
private String role;
@Basic(optional = false)
@Column(name = "inserted_at")
@Temporal(TemporalType.TIMESTAMP)
private Date insertedAt;
@OneToOne(cascade = CascadeType.ALL, mappedBy = "usuario")
private Cliente cliente; private Cliente cliente;
@Column(name = "inserted_at")
private LocalDateTime insertedAt;
@Transient @Transient
private String transientPassword; private String transientPassword;
public Usuario() { @PrePersist
} public void onPersist() {
this.insertedAt = LocalDateTime.now();
public Usuario(Integer id) { this.rol = "Cliente";
this.id = id;
}
public Usuario(Integer id, String nombre, byte[] password, byte[] salt, String role, Date insertedAt) {
this.id = id;
this.nombre = nombre;
this.password = password;
this.salt = salt;
this.role = role;
this.insertedAt = insertedAt;
} }
public Integer getId() { public Integer getId() {
@@ -101,20 +72,19 @@ public class Usuario implements Serializable {
this.nombre = nombre; this.nombre = nombre;
} }
public String getRol() {
public String getRole() { return rol;
return role;
} }
public void setRole(String role) { public void setRol(String rol) {
this.role = role; this.rol = rol;
} }
public Date getInsertedAt() { public LocalDateTime getInsertedAt() {
return insertedAt; return insertedAt;
} }
public void setInsertedAt(Date insertedAt) { public void setInsertedAt(LocalDateTime insertedAt) {
this.insertedAt = insertedAt; this.insertedAt = insertedAt;
} }
@@ -124,6 +94,24 @@ public class Usuario implements Serializable {
public void setCliente(Cliente cliente) { public void setCliente(Cliente cliente) {
this.cliente = cliente; this.cliente = cliente;
if(this.cliente.getUsuario() != this)
this.cliente.setUsuario(this);
}
public byte[] getPassword() {
return password;
}
public void setPassword(byte[] password) {
this.password = password;
}
public byte[] getSalt() {
return salt;
}
public void setSalt(byte[] salt) {
this.salt = salt;
} }
public String getTransientPassword() { public String getTransientPassword() {
@@ -148,9 +136,7 @@ public class Usuario implements Serializable {
return false; return false;
} }
Usuario other = (Usuario) object; Usuario other = (Usuario) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) return !((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id)));
return false;
return true;
} }
@Override @Override
@@ -158,20 +144,4 @@ public class Usuario implements Serializable {
return "entities.Usuario[ id=" + id + " ]"; return "entities.Usuario[ id=" + id + " ]";
} }
public byte[] getPassword() {
return password;
}
public void setPassword(byte[] password) {
this.password = password;
}
public byte[] getSalt() {
return salt;
}
public void setSalt(byte[] salt) {
this.salt = salt;
}
} }

View File

@@ -1,6 +1,7 @@
package bean; package bean;
import beans.ClienteFacadeLocal; import beans.ClienteFacadeLocal;
import beans.CuentaCorrienteFacadeLocal;
import beans.UsuarioFacadeLocal; import beans.UsuarioFacadeLocal;
import entities.Cliente; import entities.Cliente;
import entities.CuentaCorriente; import entities.CuentaCorriente;
@@ -24,6 +25,8 @@ public class ClienteBean implements Serializable {
@EJB @EJB
private ClienteFacadeLocal clienteFacade; private ClienteFacadeLocal clienteFacade;
@EJB @EJB
private CuentaCorrienteFacadeLocal cuentaCorrienteFacade;
@EJB
private UsuarioFacadeLocal usuarioFacade; private UsuarioFacadeLocal usuarioFacade;
private List<Cliente> clienteList; private List<Cliente> clienteList;
@@ -43,7 +46,7 @@ public class ClienteBean implements Serializable {
} }
public String gotoCreate() { public String gotoCreate() {
this.resetInnerCliente(); this.resetInput();
return "admin_cliente_create"; return "admin_cliente_create";
} }
@@ -54,23 +57,19 @@ public class ClienteBean implements Serializable {
usuario.setNombre(cliente.getRut()); usuario.setNombre(cliente.getRut());
usuario.setPassword(hash); usuario.setPassword(hash);
usuario.setSalt(salt); usuario.setSalt(salt);
usuario.setRole("Cliente");
CuentaCorriente cc = new CuentaCorriente();
cc.setSaldo(0);
cc.setCliente(cliente);
cc.setInsertedAt(new Date());
cliente.getCuentaCorrienteList().add(cc);
cliente.setUsuario(usuario);
usuario.setCliente(cliente);
usuarioFacade.create(usuario); usuarioFacade.create(usuario);
CuentaCorriente cc = new CuentaCorriente();
cuentaCorrienteFacade.create(cc);
cliente.setCuentaCorriente(cc);
cliente.setUsuario(usuario);
clienteFacade.create(cliente);
this.clienteList.add(cliente); this.clienteList.add(cliente);
resetInnerCliente(); resetInput();
return "admin_main"; return "admin_main";
} }
@@ -94,7 +93,7 @@ public class ClienteBean implements Serializable {
usuarioFacade.edit(usuario); usuarioFacade.edit(usuario);
clienteFacade.edit(cliente); clienteFacade.edit(cliente);
this.resetInnerCliente(); this.resetInput();
return "admin_main"; return "admin_main";
} }
@@ -108,7 +107,7 @@ public class ClienteBean implements Serializable {
usuarioFacade.remove(cliente.getUsuario()); usuarioFacade.remove(cliente.getUsuario());
this.resetInnerCliente(); this.resetInput();
return "admin_main"; return "admin_main";
} }
@@ -134,48 +133,56 @@ public class ClienteBean implements Serializable {
return "admin_tarjeta_debito_contratar"; return "admin_tarjeta_debito_contratar";
} }
public String gotoEditTarjetaCredito(TarjetaCredito tarjetaCredito) { public String gotoEditTarjetaCredito() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
TarjetaCreditoBean tcb = context.getApplication().evaluateExpressionGet(context, "#{tarjetaCreditoBean}", TarjetaCreditoBean.class); TarjetaCreditoBean tcb = context.getApplication().evaluateExpressionGet(context, "#{tarjetaCreditoBean}", TarjetaCreditoBean.class);
tcb.setCliente(cliente); tcb.setCliente(cliente);
tcb.setTarjetaCredito(tarjetaCredito); tcb.setTarjetaCredito(cliente.getTarjetaCredito());
return "admin_tarjeta_credito_edit"; return "admin_tarjeta_credito_edit";
} }
public String gotoViewCuentaCorriente(CuentaCorriente cuentaCorriente) { public String gotoViewCuentaCorriente() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
CuentaCorrienteBean ccb = context.getApplication().evaluateExpressionGet(context, "#{cuentaCorrienteBean}", CuentaCorrienteBean.class); CuentaCorrienteBean ccb = context.getApplication().evaluateExpressionGet(context, "#{cuentaCorrienteBean}", CuentaCorrienteBean.class);
ccb.setCliente(cliente); ccb.setCliente(cliente);
ccb.setCuentaCorriente(cuentaCorriente); ccb.setCuentaCorriente(cliente.getCuentaCorriente());
return "cliente_cuenta_corriente_view"; return "cliente_cuenta_corriente_view";
} }
public String gotoViewTarjetaDebito(TarjetaDebito tarjetaDebito) { public String gotoViewTarjetaDebito() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
TarjetaDebitoBean tdb = context.getApplication().evaluateExpressionGet(context, "#{tarjetaDebitoBean}", TarjetaDebitoBean.class); TarjetaDebitoBean tdb = context.getApplication().evaluateExpressionGet(context, "#{tarjetaDebitoBean}", TarjetaDebitoBean.class);
tdb.setCliente(cliente); tdb.setCliente(cliente);
tdb.setTarjetaDebito(tarjetaDebito); tdb.setTarjetaDebito(cliente.getTarjetaDebito());
return "cliente_tarjeta_debito_view"; return "cliente_tarjeta_debito_view";
} }
public String gotoViewTarjetaCredito(TarjetaCredito tarjetaCredito) { public String gotoViewTarjetaCredito() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
TarjetaCreditoBean tcb = context.getApplication().evaluateExpressionGet(context, "#{tarjetaCreditoBean}", TarjetaCreditoBean.class); TarjetaCreditoBean tcb = context.getApplication().evaluateExpressionGet(context, "#{tarjetaCreditoBean}", TarjetaCreditoBean.class);
tcb.setCliente(cliente); tcb.setCliente(cliente);
tcb.setTarjetaCredito(tarjetaCredito); tcb.setTarjetaCredito(cliente.getTarjetaCredito());
return "cliente_tarjeta_credito_view"; return "cliente_tarjeta_credito_view";
} }
public String gotoAdminViewCuentaCorriente(CuentaCorriente cuentaCorriente) { public String gotoAdminViewCuentaCorriente() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
CuentaCorrienteBean ccb = context.getApplication().evaluateExpressionGet(context, "#{cuentaCorrienteBean}", CuentaCorrienteBean.class); CuentaCorrienteBean ccb = context.getApplication().evaluateExpressionGet(context, "#{cuentaCorrienteBean}", CuentaCorrienteBean.class);
ccb.setCliente(cliente); ccb.setCliente(cliente);
ccb.setCuentaCorriente(cuentaCorriente); ccb.setCuentaCorriente(cliente.getCuentaCorriente());
return "admin_cuenta_corriente_view"; return "admin_cuenta_corriente_view";
} }
public String gotoAdminViewTarjetaDebito() {
FacesContext context = FacesContext.getCurrentInstance();
TarjetaDebitoBean tdb = context.getApplication().evaluateExpressionGet(context, "#{tarjetaDebitoBean}", TarjetaDebitoBean.class);
tdb.setCliente(cliente);
tdb.setTarjetaDebito(cliente.getTarjetaDebito());
return "admin_tarjeta_debito_view";
}
private void resetInnerCliente() {
private void resetInput() {
this.cliente = new Cliente(); this.cliente = new Cliente();
this.usuario = new Usuario(); this.usuario = new Usuario();
} }

View File

@@ -32,9 +32,12 @@ public class CompraBean implements Serializable {
private TarjetaDebito tarjetaDebito; private TarjetaDebito tarjetaDebito;
private TarjetaCredito tarjetaCredito; private TarjetaCredito tarjetaCredito;
private CompraTarjetaDebito compraTarjetaDebito;
private CompraTarjetaCredito compraTarjetaCredito;
private int monto; private int monto;
private String comentario; private String comentario;
private String clase; private String tipo;
public String comprar() { public String comprar() {
if (tarjetaDebito != null) { if (tarjetaDebito != null) {
@@ -46,22 +49,21 @@ public class CompraBean implements Serializable {
} }
public String comprarTarjetaDebito() { public String comprarTarjetaDebito() {
CompraTarjetaDebito compra = new CompraTarjetaDebito();
compra.setMonto(monto);
compra.setComentario(comentario);
compra.setInsertedAt(new Date());
compra.setTarjetaDebito(tarjetaDebito);
if (tarjetaDebito.getSaldo() - monto < 0) { if (tarjetaDebito.getSaldo() - monto < 0) {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("La compra sobrepasa el saldo de su tarjeta de debito")); context.addMessage(null, new FacesMessage("La compra sobrepasa el saldo de su tarjeta de debito"));
context.validationFailed(); context.validationFailed();
return "cliente_tarjeta_debito_compra"; return "cliente_tarjeta_debito_compra";
} }
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() - monto);
tarjetaDebito.getCompraList().add(compra);
compraTarjetaDebitoFacade.edit(compra); CompraTarjetaDebito compra = new CompraTarjetaDebito();
compra.setMonto(monto);
compra.setComentario(comentario);
compra.setTarjetaDebito(tarjetaDebito);
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() - monto);
compraTarjetaDebitoFacade.create(compra);
tarjetaDebitoFacade.edit(tarjetaDebito); tarjetaDebitoFacade.edit(tarjetaDebito);
this.resetInput(); this.resetInput();
@@ -69,40 +71,70 @@ public class CompraBean implements Serializable {
} }
public String comprarTarjetaCredito() { public String comprarTarjetaCredito() {
CompraTarjetaCredito compra = new CompraTarjetaCredito(); if (tipo.equals("Nacional")) {
compra.setMonto(monto);
compra.setComentario(comentario);
compra.setInsertedAt(new Date());
compra.setTarjetaCredito(tarjetaCredito);
if (clase.equals("Nacional")) {
if (tarjetaCredito.getDeudaNacional() + monto > tarjetaCredito.getLimiteNacional()) { if (tarjetaCredito.getDeudaNacional() + monto > tarjetaCredito.getLimiteNacional()) {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("La compra sobrepasa el limite nacional de su cuenta")); context.addMessage(null, new FacesMessage("La compra sobrepasa el limite nacional de su cuenta"));
context.validationFailed(); context.validationFailed();
return "cliente_tarjeta_credito_compra"; return "cliente_tarjeta_credito_compra";
} }
} else if (tipo.equals("Internacional")) {
tarjetaCredito.setDeudaNacional(tarjetaCredito.getDeudaNacional() + monto); if (tarjetaCredito.getDeudaInternacional() + monto > tarjetaCredito.getLimiteInternacional()) {
} else if (clase.equals("Internacional")) {
if (tarjetaCredito.getDeudaInternacional()+ monto > tarjetaCredito.getLimiteInternacional()) {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("La compra sobrepasa el limite internacional de su cuenta")); context.addMessage(null, new FacesMessage("La compra sobrepasa el limite internacional de su cuenta"));
context.validationFailed(); context.validationFailed();
return "cliente_tarjeta_credito_compra"; return "cliente_tarjeta_credito_compra";
} }
tarjetaCredito.setDeudaInternacional(tarjetaCredito.getDeudaInternacional() + monto);
} }
tarjetaCredito.getCompraList().add(compra); CompraTarjetaCredito compra = new CompraTarjetaCredito();
compra.setMonto(monto);
compra.setComentario(comentario);
compra.setTipo(tipo);
compra.setTarjetaCredito(tarjetaCredito);
compraTarjetaCreditoFacade.edit(compra); switch (tipo) {
case "Nacional":
tarjetaCredito.setDeudaNacional(tarjetaCredito.getDeudaNacional() + monto);
break;
case "Internacional":
tarjetaCredito.setDeudaInternacional(tarjetaCredito.getDeudaInternacional() + monto);
break;
}
compraTarjetaCreditoFacade.create(compra);
tarjetaCreditoFacade.edit(tarjetaCredito); tarjetaCreditoFacade.edit(tarjetaCredito);
this.resetInput(); this.resetInput();
return "cliente_tarjeta_credito_view"; return "cliente_tarjeta_credito_view";
} }
public String deleteCompraTarjetaDebito() {
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() + compraTarjetaDebito.getMonto());
tarjetaDebito.getCompraList().remove(compraTarjetaDebito);
compraTarjetaDebitoFacade.remove(compraTarjetaDebito);
tarjetaDebitoFacade.edit(tarjetaDebito);
return "admin_tarjeta_debito_view";
}
public String deleteCompraTarjetaCredito() {
switch (compraTarjetaCredito.getTipo()) {
case "Nacional":
tarjetaCredito.setDeudaNacional(tarjetaCredito.getDeudaNacional() + compraTarjetaCredito.getMonto());
break;
case "Internacional":
tarjetaCredito.setDeudaInternacional(tarjetaCredito.getDeudaInternacional() + compraTarjetaCredito.getMonto());
break;
}
tarjetaCredito.getCompraList().remove(compraTarjetaCredito);
compraTarjetaCreditoFacade.remove(compraTarjetaCredito);
tarjetaCreditoFacade.edit(tarjetaCredito);
return "admin_tarjeta_credito_view";
}
private void resetInput() { private void resetInput() {
this.monto = 0; this.monto = 0;
this.tarjetaCredito = null; this.tarjetaCredito = null;
@@ -142,14 +174,28 @@ public class CompraBean implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public String getClase() { public String getTipo() {
return clase; return tipo;
} }
public void setClase(String clase) { public void setTipo(String tipo) {
this.clase = clase; this.tipo = tipo;
} }
public CompraTarjetaDebito getCompraTarjetaDebito() {
return compraTarjetaDebito;
}
public void setCompraTarjetaDebito(CompraTarjetaDebito compraTarjetaDebito) {
this.compraTarjetaDebito = compraTarjetaDebito;
}
public CompraTarjetaCredito getCompraTarjetaCredito() {
return compraTarjetaCredito;
}
public void setCompraTarjetaCredito(CompraTarjetaCredito compraTarjetaCredito) {
this.compraTarjetaCredito = compraTarjetaCredito;
}
} }

View File

@@ -5,8 +5,9 @@ import beans.CuentaCorrienteFacadeLocal;
import entities.Cliente; import entities.Cliente;
import entities.CuentaCorriente; import entities.CuentaCorriente;
import entities.DepositoCuentaCorriente; import entities.DepositoCuentaCorriente;
import entities.GiroCuentaCorriente;
import entities.TransferenciaCuentaCorriente;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped; import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
@@ -23,18 +24,6 @@ public class CuentaCorrienteBean implements Serializable{
private CuentaCorriente cuentaCorriente; private CuentaCorriente cuentaCorriente;
private Cliente cliente; private Cliente cliente;
public String contratar() {
CuentaCorriente cc = new CuentaCorriente();
cc.setSaldo(0);
cc.setCliente(cliente);
cc.setInsertedAt(new Date());
cliente.getCuentaCorrienteList().add(cc);
clienteFacade.edit(cliente);
return "admin_cliente_view";
}
public String edit() { public String edit() {
return "admin_cliente_view"; return "admin_cliente_view";
} }
@@ -54,6 +43,7 @@ public class CuentaCorrienteBean implements Serializable{
return "admin_cuenta_corriente_delete_deposito"; return "admin_cuenta_corriente_delete_deposito";
} }
public String gotoGirar() { public String gotoGirar() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
GiroBean gb = context.getApplication().evaluateExpressionGet(context, "#{giroBean}", GiroBean.class); GiroBean gb = context.getApplication().evaluateExpressionGet(context, "#{giroBean}", GiroBean.class);
@@ -61,6 +51,13 @@ public class CuentaCorrienteBean implements Serializable{
return "cliente_cuenta_corriente_girar"; return "cliente_cuenta_corriente_girar";
} }
public String gotoDeleteGiro(GiroCuentaCorriente giro) {
FacesContext context = FacesContext.getCurrentInstance();
GiroBean gb = context.getApplication().evaluateExpressionGet(context, "#{giroBean}", GiroBean.class);
gb.setCuentaCorriente(cuentaCorriente);
gb.setGiroCuentaCorriente(giro);
return "admin_cuenta_corriente_delete_giro";
}
public String gotoTransferir() { public String gotoTransferir() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
TransferenciaBean tb = context.getApplication().evaluateExpressionGet(context, "#{transferenciaBean}", TransferenciaBean.class); TransferenciaBean tb = context.getApplication().evaluateExpressionGet(context, "#{transferenciaBean}", TransferenciaBean.class);
@@ -68,6 +65,13 @@ public class CuentaCorrienteBean implements Serializable{
return "cliente_cuenta_corriente_transferir"; return "cliente_cuenta_corriente_transferir";
} }
public String gotoDeleteTransferencia(TransferenciaCuentaCorriente transferencia) {
FacesContext context = FacesContext.getCurrentInstance();
TransferenciaBean tb = context.getApplication().evaluateExpressionGet(context, "#{transferenciaBean}", TransferenciaBean.class);
tb.setCuentaCorriente(cuentaCorriente);
tb.setTransferenciaCuentaCorriente(transferencia);
return "admin_cuenta_corriente_delete_transferencia";
}
public CuentaCorriente getCuentaCorriente() { public CuentaCorriente getCuentaCorriente() {
return cuentaCorriente; return cuentaCorriente;

View File

@@ -17,6 +17,8 @@ import java.util.List;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped; import javax.enterprise.context.SessionScoped;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Named; import javax.inject.Named;
@Named(value = "depositoBean") @Named(value = "depositoBean")
@@ -62,10 +64,8 @@ public class DepositoBean implements Serializable {
deposito.setComentario(comentario); deposito.setComentario(comentario);
deposito.setMonto(monto); deposito.setMonto(monto);
deposito.setMetodo(metodo); deposito.setMetodo(metodo);
deposito.setInsertedAt(new Date());
deposito.setCuentaCorriente(cuentaCorriente); deposito.setCuentaCorriente(cuentaCorriente);
cuentaCorriente.getDepositoList().add(deposito);
cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() + monto); cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() + monto);
depositoCCFacade.create(deposito); depositoCCFacade.create(deposito);
@@ -80,10 +80,8 @@ public class DepositoBean implements Serializable {
deposito.setComentario(comentario); deposito.setComentario(comentario);
deposito.setMonto(monto); deposito.setMonto(monto);
deposito.setMetodo(metodo); deposito.setMetodo(metodo);
deposito.setInsertedAt(new Date());
deposito.setTarjetaDebito(tarjetaDebito); deposito.setTarjetaDebito(tarjetaDebito);
tarjetaDebito.getDepositoList().add(deposito);
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() + monto); tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() + monto);
depositoTDFacade.create(deposito); depositoTDFacade.create(deposito);
@@ -93,21 +91,44 @@ public class DepositoBean implements Serializable {
return "cliente_tarjeta_debito_view"; return "cliente_tarjeta_debito_view";
} }
public String delete() { public String deleteDepositoCuentaCorriente() {
if(cuentaCorriente != null) { int monto = depositoCuentaCorriente.getMonto();
return deleteDepositoCuentaCorriente(); CuentaCorriente cuentaCorriente = depositoCuentaCorriente.getCuentaCorriente();
}else if (depositoTarjetaDebito != null) {
return deleteDepositoTarjetaDebito(); if(cuentaCorriente.getSaldo() - monto < 0){
} FacesContext facesContext = FacesContext.getCurrentInstance();
return "error/505"; facesContext.addMessage(null, new FacesMessage("Eliminar el deposito dejaria la cuenta en negativo"));
facesContext.validationFailed();
return "admin_cuenta_corriente_delete_deposito";
} }
public String deleteDepositoCuentaCorriente() { cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() - monto);
return ""; cuentaCorriente.getDepositoList().remove(depositoCuentaCorriente);
depositoCCFacade.remove(depositoCuentaCorriente);
cuentaCorrienteFacade.edit(cuentaCorriente);
return "admin_cuenta_corriente_view";
} }
public String deleteDepositoTarjetaDebito() { public String deleteDepositoTarjetaDebito() {
return ""; int monto = depositoTarjetaDebito.getMonto();
TarjetaDebito tarjetaDebito = depositoTarjetaDebito.getTarjetaDebito();
if(tarjetaDebito.getSaldo() - monto < 0){
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage(null, new FacesMessage("Eliminar el deposito dejaria la cuenta en negativo"));
facesContext.validationFailed();
return "admin_tarjeta_debito_delete_deposito";
}
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() - monto);
tarjetaDebito.getDepositoList().remove(depositoTarjetaDebito);
depositoTDFacade.remove(depositoTarjetaDebito);
tarjetaDebitoFacade.edit(tarjetaDebito);
return "admin_cuenta_corriente_view";
} }
private void resetInput() { private void resetInput() {
@@ -181,4 +202,22 @@ public class DepositoBean implements Serializable {
public void setDepositoTarjetaDebito(DepositoTarjetaDebito depositoTarjetaDebito) { public void setDepositoTarjetaDebito(DepositoTarjetaDebito depositoTarjetaDebito) {
this.depositoTarjetaDebito = depositoTarjetaDebito; this.depositoTarjetaDebito = depositoTarjetaDebito;
} }
public DepositoCuentaCorrienteFacadeLocal getDepositoCCFacade() {
return depositoCCFacade;
}
public void setDepositoCCFacade(DepositoCuentaCorrienteFacadeLocal depositoCCFacade) {
this.depositoCCFacade = depositoCCFacade;
}
public DepositoTarjetaDebitoFacadeLocal getDepositoTDFacade() {
return depositoTDFacade;
}
public void setDepositoTDFacade(DepositoTarjetaDebitoFacadeLocal depositoTDFacade) {
this.depositoTDFacade = depositoTDFacade;
}
} }

View File

@@ -1,8 +1,8 @@
package bean; package bean;
import beans.CuentaCorrienteFacade; import beans.CuentaCorrienteFacade;
import beans.CuentaCorrienteFacadeLocal; import beans.CuentaCorrienteFacadeLocal;
import beans.GiroCuentaCorrienteFacade;
import beans.GiroCuentaCorrienteFacadeLocal; import beans.GiroCuentaCorrienteFacadeLocal;
import beans.GiroTarjetaDebitoFacadeLocal; import beans.GiroTarjetaDebitoFacadeLocal;
import beans.MetodoFacadeLocal; import beans.MetodoFacadeLocal;
@@ -25,6 +25,7 @@ import javax.inject.Named;
@Named(value = "giroBean") @Named(value = "giroBean")
@SessionScoped @SessionScoped
public class GiroBean implements Serializable { public class GiroBean implements Serializable {
@EJB @EJB
private GiroCuentaCorrienteFacadeLocal giroCCFacade; private GiroCuentaCorrienteFacadeLocal giroCCFacade;
@EJB @EJB
@@ -36,6 +37,8 @@ public class GiroBean implements Serializable {
@EJB @EJB
private TarjetaDebitoFacadeLocal tarjetaDebitoFacade; private TarjetaDebitoFacadeLocal tarjetaDebitoFacade;
private GiroCuentaCorriente giroCuentaCorriente;
private GiroTarjetaDebito giroTarjetaDebito;
private int monto; private int monto;
private String comentario; private String comentario;
private Metodo metodo; private Metodo metodo;
@@ -44,22 +47,22 @@ public class GiroBean implements Serializable {
private TarjetaDebito tarjetaDebito; private TarjetaDebito tarjetaDebito;
@PostConstruct @PostConstruct
private void init(){ private void init() {
this.metodoList = metodoFacade.findAll(); this.metodoList = metodoFacade.findAll();
} }
public String girar() { public String girar() {
if(cuentaCorriente != null){ if (cuentaCorriente != null) {
return girarEnCuentaCorriente(); return girarEnCuentaCorriente();
}else if(tarjetaDebito != null){ } else if (tarjetaDebito != null) {
return girarEnTarjetaDebito(); return girarEnTarjetaDebito();
}else{ } else {
return null; return null;
} }
} }
public String girarEnCuentaCorriente() { public String girarEnCuentaCorriente() {
if(cuentaCorriente.getSaldo() - monto < 0 ){ if (cuentaCorriente.getSaldo() - monto < 0) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("El monto sobrepasa el saldo de la cuenta corriente")); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("El monto sobrepasa el saldo de la cuenta corriente"));
FacesContext.getCurrentInstance().validationFailed(); FacesContext.getCurrentInstance().validationFailed();
return "cliente_cuenta_corriente_girar"; return "cliente_cuenta_corriente_girar";
@@ -69,10 +72,8 @@ public class GiroBean implements Serializable {
giro.setComentario(comentario); giro.setComentario(comentario);
giro.setMonto(monto); giro.setMonto(monto);
giro.setMetodo(metodo); giro.setMetodo(metodo);
giro.setInsertedAt(new Date());
giro.setCuentaCorriente(cuentaCorriente); giro.setCuentaCorriente(cuentaCorriente);
cuentaCorriente.getGiroList().add(giro);
cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() - monto); cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() - monto);
giroCCFacade.create(giro); giroCCFacade.create(giro);
@@ -83,7 +84,7 @@ public class GiroBean implements Serializable {
} }
public String girarEnTarjetaDebito() { public String girarEnTarjetaDebito() {
if(tarjetaDebito.getSaldo() - monto < 0 ){ if (tarjetaDebito.getSaldo() - monto < 0) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("El monto sobrepasa el saldo de la tarjeta de debito")); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("El monto sobrepasa el saldo de la tarjeta de debito"));
FacesContext.getCurrentInstance().validationFailed(); FacesContext.getCurrentInstance().validationFailed();
return "cliente_tarjeta_debito_girar"; return "cliente_tarjeta_debito_girar";
@@ -93,10 +94,8 @@ public class GiroBean implements Serializable {
giro.setComentario(comentario); giro.setComentario(comentario);
giro.setMonto(monto); giro.setMonto(monto);
giro.setMetodo(metodo); giro.setMetodo(metodo);
giro.setInsertedAt(new Date());
giro.setTarjetaDebito(tarjetaDebito); giro.setTarjetaDebito(tarjetaDebito);
tarjetaDebito.getGiroList().add(giro);
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() - monto); tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() - monto);
giroTDFacade.create(giro); giroTDFacade.create(giro);
@@ -106,6 +105,21 @@ public class GiroBean implements Serializable {
return "cliente_tarjeta_debito_view"; return "cliente_tarjeta_debito_view";
} }
public String deleteGiroEnCuentaCorriente() {
cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() + giroCuentaCorriente.getMonto());
cuentaCorriente.getGiroList().remove(giroCuentaCorriente);
giroCCFacade.remove(giroCuentaCorriente);
cuentaCorrienteFacade.edit(cuentaCorriente);
return "admin_cuenta_corriente_view";
}
public String deleteGiroEnTarjetaDebito() {
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() + giroTarjetaDebito.getMonto());
tarjetaDebito.getGiroList().remove(giroTarjetaDebito);
giroTDFacade.remove(giroTarjetaDebito);
tarjetaDebitoFacade.edit(tarjetaDebito);
return "admin_tarjeta_debito_view";
}
private void resetInput() { private void resetInput() {
this.cuentaCorriente = null; this.cuentaCorriente = null;
@@ -162,4 +176,23 @@ public class GiroBean implements Serializable {
public void setMetodoList(List<Metodo> metodoList) { public void setMetodoList(List<Metodo> metodoList) {
this.metodoList = metodoList; this.metodoList = metodoList;
} }
public GiroCuentaCorriente getGiroCuentaCorriente() {
return giroCuentaCorriente;
}
public void setGiroCuentaCorriente(GiroCuentaCorriente giroCuentaCorriente) {
this.giroCuentaCorriente = giroCuentaCorriente;
}
public GiroTarjetaDebito getGiroTarjetaDebito() {
return giroTarjetaDebito;
}
public void setGiroTarjetaDebito(GiroTarjetaDebito giroTarjetaDebito) {
this.giroTarjetaDebito = giroTarjetaDebito;
}
} }

View File

@@ -24,10 +24,10 @@ public class PagoBean implements Serializable {
private int monto; private int monto;
private String comentario; private String comentario;
private String clase; private String tipo;
public String pagar() { public String pagar() {
if (clase.equals("Nacional")) { if (tipo.equals("Nacional")) {
if (tarjetaCredito.getDeudaNacional() == 0) { if (tarjetaCredito.getDeudaNacional() == 0) {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("No hay ninguna deuda nacional que pagar")); context.addMessage(null, new FacesMessage("No hay ninguna deuda nacional que pagar"));
@@ -40,21 +40,9 @@ public class PagoBean implements Serializable {
context.validationFailed(); context.validationFailed();
return "cliente_tarjeta_credito_pagar"; return "cliente_tarjeta_credito_pagar";
} }
PagoTarjetaCredito pago = new PagoTarjetaCredito();
pago.setComentario(comentario);
pago.setMonto(monto);
pago.setTarjetaCredito(tarjetaCredito);
tarjetaCredito.setDeudaNacional(tarjetaCredito.getDeudaNacional() - monto);
tarjetaCreditoFacade.edit(tarjetaCredito);
pagoTarjetaCreditoFacade.create(pago);
this.resetInput();
return "cliente_tarjeta_credito_view";
} }
if (clase.equals("Internacional")) { if (tipo.equals("Internacional")) {
if (tarjetaCredito.getDeudaInternacional() == 0) { if (tarjetaCredito.getDeudaInternacional() == 0) {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("No hay ninguna deuda internacional que pagar")); context.addMessage(null, new FacesMessage("No hay ninguna deuda internacional que pagar"));
@@ -67,29 +55,34 @@ public class PagoBean implements Serializable {
context.validationFailed(); context.validationFailed();
return "cliente_tarjeta_credito_pagar"; return "cliente_tarjeta_credito_pagar";
} }
}
PagoTarjetaCredito pago = new PagoTarjetaCredito(); PagoTarjetaCredito pago = new PagoTarjetaCredito();
pago.setComentario(comentario); pago.setComentario(comentario);
pago.setMonto(monto); pago.setMonto(monto);
pago.setTipo(tipo);
pago.setTarjetaCredito(tarjetaCredito); pago.setTarjetaCredito(tarjetaCredito);
tarjetaCredito.setDeudaInternacional(tarjetaCredito.getDeudaInternacional() - monto); switch(tipo){
tarjetaCredito.getPagoList().add(pago); case "Nacional":
tarjetaCredito.setDeudaNacional(tarjetaCredito.getDeudaNacional() - monto);
tarjetaCreditoFacade.edit(tarjetaCredito); break;
pagoTarjetaCreditoFacade.create(pago); case "Internacional":
tarjetaCredito.setDeudaInternacional(tarjetaCredito.getDeudaInternacional()- monto);
this.resetInput(); break;
return "cliente_tarjeta_credito_view";
} }
pagoTarjetaCreditoFacade.create(pago);
tarjetaCreditoFacade.edit(tarjetaCredito);
this.resetInput();
return "cliente_tarjeta_credito_view"; return "cliente_tarjeta_credito_view";
} }
public void resetInput() { public void resetInput() {
this.monto = 0; this.monto = 0;
this.comentario = null; this.comentario = null;
this.clase = null; this.tipo = null;
} }
public TarjetaCredito getTarjetaCredito() { public TarjetaCredito getTarjetaCredito() {
@@ -116,12 +109,12 @@ public class PagoBean implements Serializable {
this.comentario = comentario; this.comentario = comentario;
} }
public String getClase() { public String getTipo() {
return clase; return tipo;
} }
public void setClase(String clase) { public void setTipo(String tipo) {
this.clase = clase; this.tipo = tipo;
} }
} }

View File

@@ -32,9 +32,8 @@ public class TarjetaCreditoBean implements Serializable {
public String contratar() { public String contratar() {
tarjetaCredito.setCliente(cliente); tarjetaCredito.setCliente(cliente);
tarjetaCredito.setInsertedAt(new Date());
cliente.getTarjetaCreditoList().add(tarjetaCredito); tarjetaCreditoFacade.create(tarjetaCredito);
clienteFacade.edit(cliente); clienteFacade.edit(cliente);
this.resetClases(); this.resetClases();

View File

@@ -3,7 +3,14 @@ package bean;
import beans.ClienteFacadeLocal; import beans.ClienteFacadeLocal;
import beans.TarjetaDebitoFacadeLocal; import beans.TarjetaDebitoFacadeLocal;
import entities.Cliente; import entities.Cliente;
import entities.CompraTarjetaDebito;
import entities.DepositoCuentaCorriente;
import entities.DepositoTarjetaDebito;
import entities.GiroCuentaCorriente;
import entities.GiroTarjetaDebito;
import entities.TarjetaDebito; import entities.TarjetaDebito;
import entities.TransferenciaCuentaCorriente;
import entities.TransferenciaTarjetaDebito;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@@ -32,9 +39,8 @@ public class TarjetaDebitoBean implements Serializable {
public String contratar() { public String contratar() {
tarjetaDebito.setCliente(cliente); tarjetaDebito.setCliente(cliente);
tarjetaDebito.setInsertedAt(new Date());
cliente.getTarjetaDebitoList().add(tarjetaDebito); tarjetaDebitoFacade.create(tarjetaDebito);
clienteFacade.edit(cliente); clienteFacade.edit(cliente);
this.resetInput(); this.resetInput();
@@ -48,6 +54,14 @@ public class TarjetaDebitoBean implements Serializable {
return "cliente_tarjeta_debito_depositar"; return "cliente_tarjeta_debito_depositar";
} }
public String gotoDeleteDeposito(DepositoTarjetaDebito deposito) {
FacesContext context = FacesContext.getCurrentInstance();
DepositoBean db = context.getApplication().evaluateExpressionGet(context, "#{depositoBean}", DepositoBean.class);
db.setTarjetaDebito(tarjetaDebito);
db.setDepositoTarjetaDebito(deposito);
return "admin_tarjeta_debito_delete_deposito";
}
public String gotoGirar() { public String gotoGirar() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
GiroBean gb = context.getApplication().evaluateExpressionGet(context, "#{giroBean}", GiroBean.class); GiroBean gb = context.getApplication().evaluateExpressionGet(context, "#{giroBean}", GiroBean.class);
@@ -55,6 +69,14 @@ public class TarjetaDebitoBean implements Serializable {
return "cliente_tarjeta_debito_girar"; return "cliente_tarjeta_debito_girar";
} }
public String gotoDeleteGiro(GiroTarjetaDebito giro) {
FacesContext context = FacesContext.getCurrentInstance();
GiroBean gb = context.getApplication().evaluateExpressionGet(context, "#{giroBean}", GiroBean.class);
gb.setTarjetaDebito(tarjetaDebito);
gb.setGiroTarjetaDebito(giro);
return "admin_tarjeta_debito_delete_giro";
}
public String gotoTransferir() { public String gotoTransferir() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
TransferenciaBean tb = context.getApplication().evaluateExpressionGet(context, "#{transferenciaBean}", TransferenciaBean.class); TransferenciaBean tb = context.getApplication().evaluateExpressionGet(context, "#{transferenciaBean}", TransferenciaBean.class);
@@ -62,6 +84,14 @@ public class TarjetaDebitoBean implements Serializable {
return "cliente_tarjeta_debito_transferir"; return "cliente_tarjeta_debito_transferir";
} }
public String gotoDeleteTransferencia(TransferenciaTarjetaDebito transferencia) {
FacesContext context = FacesContext.getCurrentInstance();
TransferenciaBean tb = context.getApplication().evaluateExpressionGet(context, "#{transferenciaBean}", TransferenciaBean.class);
tb.setTarjetaDebito(tarjetaDebito);
tb.setTransferenciaTarjetaDebito(transferencia);
return "admin_tarjeta_debito_delete_transferencia";
}
public String gotoComprar() { public String gotoComprar() {
FacesContext context = FacesContext.getCurrentInstance(); FacesContext context = FacesContext.getCurrentInstance();
CompraBean cb = context.getApplication().evaluateExpressionGet(context, "#{compraBean}", CompraBean.class); CompraBean cb = context.getApplication().evaluateExpressionGet(context, "#{compraBean}", CompraBean.class);
@@ -69,6 +99,13 @@ public class TarjetaDebitoBean implements Serializable {
return "cliente_tarjeta_debito_comprar"; return "cliente_tarjeta_debito_comprar";
} }
public String gotoDeleteCompra(CompraTarjetaDebito compra) {
FacesContext context = FacesContext.getCurrentInstance();
CompraBean cb = context.getApplication().evaluateExpressionGet(context, "#{compraBean}", CompraBean.class);
cb.setTarjetaDebito(tarjetaDebito);
cb.setCompraTarjetaDebito(compra);
return "admin_tarjeta_debito_delete_compra";
}
private void resetInput() { private void resetInput() {
this.cliente = new Cliente(); this.cliente = new Cliente();

View File

@@ -34,6 +34,8 @@ public class TransferenciaBean implements Serializable {
private String comentario; private String comentario;
private CuentaCorriente cuentaCorriente; private CuentaCorriente cuentaCorriente;
private TarjetaDebito tarjetaDebito; private TarjetaDebito tarjetaDebito;
private TransferenciaCuentaCorriente transferenciaCuentaCorriente;
private TransferenciaTarjetaDebito transferenciaTarjetaDebito;
public String transferir() { public String transferir() {
if (cuentaCorriente != null) { if (cuentaCorriente != null) {
@@ -46,7 +48,7 @@ public class TransferenciaBean implements Serializable {
} }
public String transferirEnCuentaCorriente() { public String transferirEnCuentaCorriente() {
if(this.destinatario_id == this.cuentaCorriente.getId()){ if (this.destinatario_id == this.cuentaCorriente.getId()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("No se puede transferir hacia si mismo")); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("No se puede transferir hacia si mismo"));
FacesContext.getCurrentInstance().validationFailed(); FacesContext.getCurrentInstance().validationFailed();
return "cliente_cuenta_corriente_transferir"; return "cliente_cuenta_corriente_transferir";
@@ -68,13 +70,9 @@ public class TransferenciaBean implements Serializable {
TransferenciaCuentaCorriente transferencia = new TransferenciaCuentaCorriente(); TransferenciaCuentaCorriente transferencia = new TransferenciaCuentaCorriente();
transferencia.setComentario(comentario); transferencia.setComentario(comentario);
transferencia.setMonto(monto); transferencia.setMonto(monto);
transferencia.setInsertedAt(new Date());
transferencia.setCuentaCorrienteFrom(cuentaCorriente); transferencia.setCuentaCorrienteFrom(cuentaCorriente);
transferencia.setCuentaCorrienteTo(destinatario); transferencia.setCuentaCorrienteTo(destinatario);
cuentaCorriente.getTransferenciaFromList().add(transferencia);
destinatario.getTransferenciaToList().add(transferencia);
cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() - monto); cuentaCorriente.setSaldo(cuentaCorriente.getSaldo() - monto);
destinatario.setSaldo(destinatario.getSaldo() + monto); destinatario.setSaldo(destinatario.getSaldo() + monto);
@@ -87,7 +85,7 @@ public class TransferenciaBean implements Serializable {
} }
public String transferirEnTarjetaDebito() { public String transferirEnTarjetaDebito() {
if(this.destinatario_id == this.tarjetaDebito.getId()){ if (this.destinatario_id == this.tarjetaDebito.getId()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("No se puede transferir hacia si mismo")); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("No se puede transferir hacia si mismo"));
FacesContext.getCurrentInstance().validationFailed(); FacesContext.getCurrentInstance().validationFailed();
return "cliente_tarjeta_debito_transferir"; return "cliente_tarjeta_debito_transferir";
@@ -109,13 +107,9 @@ public class TransferenciaBean implements Serializable {
TransferenciaTarjetaDebito transferencia = new TransferenciaTarjetaDebito(); TransferenciaTarjetaDebito transferencia = new TransferenciaTarjetaDebito();
transferencia.setComentario(comentario); transferencia.setComentario(comentario);
transferencia.setMonto(monto); transferencia.setMonto(monto);
transferencia.setInsertedAt(new Date());
transferencia.setTarjetaDebitoFrom(tarjetaDebito); transferencia.setTarjetaDebitoFrom(tarjetaDebito);
transferencia.setTarjetaDebitoTo(destinatario); transferencia.setTarjetaDebitoTo(destinatario);
tarjetaDebito.getTransferenciaFromList().add(transferencia);
destinatario.getTransferenciaToList().add(transferencia);
tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() - monto); tarjetaDebito.setSaldo(tarjetaDebito.getSaldo() - monto);
destinatario.setSaldo(destinatario.getSaldo() + monto); destinatario.setSaldo(destinatario.getSaldo() + monto);
@@ -127,6 +121,55 @@ public class TransferenciaBean implements Serializable {
return "cliente_tarjeta_debito_view"; return "cliente_tarjeta_debito_view";
} }
public String eliminarTransferenciaEnCuentaCorriente() {
CuentaCorriente ccFrom = transferenciaCuentaCorriente.getCuentaCorrienteFrom();
CuentaCorriente ccTo = transferenciaCuentaCorriente.getCuentaCorrienteTo();
if (ccTo.getSaldo() - transferenciaCuentaCorriente.getMonto() < 0) {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage(null, new FacesMessage("Eliminar la transferencia dejaria la cuenta del destinatario en negativo"));
facesContext.validationFailed();
return "admin_cuenta_corriente_delete_transferencia";
}
ccFrom.setSaldo(ccFrom.getSaldo() + transferenciaCuentaCorriente.getMonto());
ccTo.setSaldo(ccTo.getSaldo() - transferenciaCuentaCorriente.getMonto());
ccFrom.getTransferenciaFromList().remove(transferenciaCuentaCorriente);
ccTo.getTransferenciaToList().remove(transferenciaCuentaCorriente);
transferenciaCCFacade.remove(transferenciaCuentaCorriente);
cuentaCorrienteFacade.edit(ccFrom);
cuentaCorrienteFacade.edit(ccTo);
return "admin_cuenta_corriente_view";
}
public String eliminarTransferenciaEnTarjetaDebito() {
TarjetaDebito tdFrom = transferenciaTarjetaDebito.getTarjetaDebitoFrom();
TarjetaDebito tdTo = transferenciaTarjetaDebito.getTarjetaDebitoTo();
if (tdTo.getSaldo() - transferenciaTarjetaDebito.getMonto() < 0) {
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage(null, new FacesMessage("Eliminar la transferencia dejaria la cuenta del destinatario en negativo"));
facesContext.validationFailed();
return "admin_tarjeta_debito_delete_transferencia";
}
tdFrom.setSaldo(tdFrom.getSaldo() + transferenciaTarjetaDebito.getMonto());
tdTo.setSaldo(tdTo.getSaldo() - transferenciaTarjetaDebito.getMonto());
tdFrom.getTransferenciaFromList().remove(transferenciaTarjetaDebito);
tdTo.getTransferenciaToList().remove(transferenciaTarjetaDebito);
transferenciaTDFacade.remove(transferenciaTarjetaDebito);
tarjetaDebitoFacade.edit(tdFrom);
tarjetaDebitoFacade.edit(tdTo);
return "admin_tarjeta_debito_view";
}
private void resetInput() { private void resetInput() {
this.cuentaCorriente = null; this.cuentaCorriente = null;
this.tarjetaDebito = null; this.tarjetaDebito = null;
@@ -175,5 +218,21 @@ public class TransferenciaBean implements Serializable {
this.destinatario_id = destinatario_id; this.destinatario_id = destinatario_id;
} }
public TransferenciaCuentaCorriente getTransferenciaCuentaCorriente() {
return transferenciaCuentaCorriente;
}
public void setTransferenciaCuentaCorriente(TransferenciaCuentaCorriente transferenciaCuentaCorriente) {
this.transferenciaCuentaCorriente = transferenciaCuentaCorriente;
}
public TransferenciaTarjetaDebito getTransferenciaTarjetaDebito() {
return transferenciaTarjetaDebito;
}
public void setTransferenciaTarjetaDebito(TransferenciaTarjetaDebito transferenciaTarjetaDebito) {
this.transferenciaTarjetaDebito = transferenciaTarjetaDebito;
}
} }

View File

@@ -59,7 +59,7 @@ public class UsuarioBean implements Serializable {
u.setNombre(nombre); u.setNombre(nombre);
u.setPassword(hash); u.setPassword(hash);
u.setSalt(salt); u.setSalt(salt);
u.setRole("Admin"); u.setRol("Admin");
usuarioFacade.create(u); usuarioFacade.create(u);
@@ -76,11 +76,11 @@ public class UsuarioBean implements Serializable {
} }
public boolean isAdmin() { public boolean isAdmin() {
return this.getUsuario().getRole().equals("Admin"); return this.getUsuario().getRol().equals("Admin");
} }
public boolean isClient() { public boolean isClient() {
return this.getUsuario().getRole().equals("Cliente"); return this.getUsuario().getRol().equals("Cliente");
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@@ -42,12 +42,12 @@
</h:inputSecret> </h:inputSecret>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 dib white bg-blue" action="#{clienteBean.create()}"> <h:commandLink class="f5 tc link dim br2 ph3 pv2 mb2 dib white bg-blue" action="#{clienteBean.create()}" style="width: 200px">
<li class="fas fa-plus-circle"></li> Crear <li class="fas fa-plus-circle"></li> Crear
</h:commandLink> </h:commandLink>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" immediate="true" action="admin_main"> <h:commandLink class="f5 tc link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="admin_main" style="width: 200px">
<li class="fas fa-arrow-left"></li> Volver <li class="fas fa-arrow-left"></li> Volver
</h:commandLink> </h:commandLink>
</div> </div>

View File

@@ -17,79 +17,80 @@
</h:head> </h:head>
<body class="black-70 pa4"> <body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}"> <h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between"> <h1 class="f1 tc">Cliente</h1>
<h1 class="f1">Cliente</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_main" style="margin-top: auto; margin-bottom: auto"> <div class="mv3 cf">
<h:commandLink class="f5 fl tc link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="#{userBean.logout()}" style="width: 200px">
<li class="fas fa-sign-out-alt"></li> Cerrar sesion
</h:commandLink>
<h:commandLink class="f5 fr tc link dim br2 ph3 pv2 mb2 dib white bg-blue" immediate="true" action="admin_main" style="width: 200px">
<li class="fas fa-arrow-left"></li> Volver <li class="fas fa-arrow-left"></li> Volver
</h:commandLink> </h:commandLink>
</div> </div>
<h:messages class="f4 w-40 list white bg-red pa4" />
<!-- <!--
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
///////////////////////////Datos del cliente//////////////////////// ///////////////////////////Datos del cliente////////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
--> -->
<div class="mv3 pa2 fl w-33"> <div class="mv3">
<h:outputLabel class="db fw4 lh-copy f6" for="rut" value="Rut:"/> <div class="mt3 tc">
<h:inputText class="pa2 input-reset ba b--black-20 w-100" id="rut" value="#{clienteBean.cliente.rut}" readonly="true"/> <h:outputLabel class="db lh-copy f6" value="Rut:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.rut}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" for="nombre" value="Nombre:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="nombre" value="#{clienteBean.cliente.nombre}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" for="ciudad" value="Ciudad:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="ciudad" value="#{clienteBean.cliente.ciudad}" readonly="true"/>
</div>
</div> </div>
<div class="mv3 pa2 fl w-33"> <hr/>
<h:outputLabel class="db fw4 lh-copy f6" for="nombre" value="Nombre:"/>
<h:inputText class="pa2 input-reset ba b--black-20 w-100" id="nombre" value="#{clienteBean.cliente.nombre}" readonly="true"/>
</div>
<div class="mv3 pa2 fl w-33"> <h2 class="f2 tc">Productos</h2>
<h:outputLabel class="db fw4 lh-copy f6" for="ciudad" value="Ciudad:"/>
<h:inputText class="pa2 input-reset ba b--black-20 w-100" id="ciudad" value="#{clienteBean.cliente.ciudad}" readonly="true"/>
</div>
<h2 class="f2">Servicios</h2>
<!-- <!--
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
///////////////////////////Cuentas Corrientes/////////////////////// ///////////////////////////Cuentas Corrientes///////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
--> -->
<h:panelGroup layout="block" class="mv3 w-100" rendered="#{clienteBean.cliente.cuentaCorriente != null}">
<h3 class="f3 tc">Cuenta Corriente</h3>
<div class="flex justify-between"> <div class="mt3 tc">
<h3 class="f3 dib">Cuentas Corrientes</h3> <h:outputLabel class="db lh-copy f6" value="Id:"/>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="#{clienteBean.gotoContratarCuentaCorriente()}" style="margin-top: auto; margin-bottom: auto"> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.cuentaCorriente.id}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Saldo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.cuentaCorriente.saldo}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.cuentaCorriente.insertedAt}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f6 link dim br2 ph3 pv2 mb2 dib white bg-green tc" action="#{clienteBean.gotoAdminViewCuentaCorriente()}" style="width: 200px">
<li class="fas fa-eye"></li> Ver
</h:commandLink>
</div>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{clienteBean.cliente.cuentaCorriente == null}">
<h3 class="f3 tc">Cuenta Corriente</h3>
<p class="f6 tc">Sin contratar</p>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="#{clienteBean.gotoContratarCuentaCorriente()}" style="width: 200px">
<li class="fas fa-wallet"></li> Contratar <li class="fas fa-wallet"></li> Contratar
</h:commandLink> </h:commandLink>
</div> </div>
</h:panelGroup>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3" value="#{clienteBean.cliente.cuentaCorrienteList}" var="cuentaCorriente"> <hr/>
<h:column>
<f:facet name="header">
<h:outputLabel value="Id"/>
</f:facet>
<h:outputLabel value="#{cuentaCorriente.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Saldo"/>
</f:facet>
<h:outputLabel value="#{cuentaCorriente.saldo}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha creacion"/>
</f:facet>
<h:outputLabel value="#{cuentaCorriente.insertedAt}">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mb2 dib white bg-green" action="#{clienteBean.gotoAdminViewCuentaCorriente(cuentaCorriente)}">
<li class="fas fa-eye"></li>
</h:commandLink>
</h:column>
</h:dataTable>
<!-- <!--
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@@ -97,40 +98,40 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
--> -->
<div class="flex justify-between"> <h:panelGroup layout="block" class="mv3 w-100" rendered="#{clienteBean.cliente.tarjetaDebito != null}">
<h3 class="f3 dib">Tarjetas de Debito</h3> <h3 class="f3 tc">Tarjeta Debito</h3>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="#{clienteBean.gotoContratarTarjetaDebito()}" style="margin-top: auto; margin-bottom: auto">
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Id:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaDebito.id}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" value="Saldo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaDebito.saldo}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaDebito.insertedAt}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-green" action="#{clienteBean.gotoAdminViewTarjetaDebito()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-eye"></li> Ver
</h:commandLink>
</div>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{clienteBean.cliente.tarjetaDebito == null}">
<h3 class="f3 tc">Tarjeta Debito</h3>
<p class="f6 tc">Sin contratar</p>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="#{clienteBean.gotoContratarTarjetaDebito()}" style="width: 200px">
<li class="fas fa-money-check"></li> Contratar <li class="fas fa-money-check"></li> Contratar
</h:commandLink> </h:commandLink>
</div> </div>
</h:panelGroup>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3" value="#{clienteBean.cliente.tarjetaDebitoList}" var="tarjetaDebito"> <hr/>
<h:column>
<f:facet name="header">
<h:outputLabel value="Id"/>
</f:facet>
<h:outputLabel value="#{tarjetaDebito.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Saldo"/>
</f:facet>
<h:outputLabel value="#{tarjetaDebito.saldo}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha creacion"/>
</f:facet>
<h:outputLabel value="#{tarjetaDebito.insertedAt}">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 dib white bg-green">
<li class="fas fa-eye"></li>
</h:commandLink>
</h:column>
</h:dataTable>
<!-- <!--
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@@ -138,61 +139,55 @@
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
--> -->
<div class="flex justify-between"> <h:panelGroup layout="block" class="mv3 w-100" rendered="#{clienteBean.cliente.tarjetaCredito != null}">
<h3 class="f3 dib">Tarjetas de Credito</h3> <h3 class="f3 tc">Tarjeta Credito</h3>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="#{clienteBean.gotoContratarTarjetaCredito()}" style="margin-top: auto; margin-bottom: auto">
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Id:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.id}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Limite Nacional:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.limiteNacional}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Deuda Nacional:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.deudaNacional}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Limite Internacional:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.limiteInternacional}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Deuda Internacional:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.deudaInternacional}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.insertedAt}" readonly="true"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-green" action="#{clienteBean.gotoAdminViewCuentaCorriente()}" style="width: 200px">
<li class="fas fa-eye"></li> Ver
</h:commandLink>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" action="#{clienteBean.gotoEditTarjetaCredito()}" style="width: 200px">
<li class="fas fa-edit"></li> Editar
</h:commandLink>
</div>
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{clienteBean.cliente.tarjetaCredito == null}">
<h3 class="f3 tc">Tarjeta Credito</h3>
<p class="f6 tc">Sin contratar</p>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="#{clienteBean.gotoContratarTarjetaCredito()}" style="width: 200px">
<li class="fas fa-credit-card"></li> Contratar <li class="fas fa-credit-card"></li> Contratar
</h:commandLink> </h:commandLink>
</div> </div>
</h:panelGroup>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3" value="#{clienteBean.cliente.tarjetaCreditoList}" var="tarjetaCredito">
<h:column>
<f:facet name="header">
<h:outputLabel value="Id"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Limite Nacional"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.limiteNacional}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Deuda Nacional"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.deudaNacional}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Limite Internacional"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.limiteInternacional}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Deuda Internacional"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.deudaInternacional}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha creacion"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.insertedAt}">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 dib white bg-green">
<li class="fas fa-eye"></li>
</h:commandLink>
<h:commandLink class="f6 link dim br2 ph3 pv2 ml2 dib white bg-blue" action="#{clienteBean.gotoEditTarjetaCredito(tarjetaCredito)}">
<li class="fas fa-edit"></li>
</h:commandLink>
</h:column>
</h:dataTable>
</h:form> </h:form>
<h:form rendered="#{!userBean.isLogged()}"> <h:form rendered="#{!userBean.isLogged()}">

View File

@@ -0,0 +1,58 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Eliminar Deposito</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_cuenta_corriente_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<h:messages class="f4 w-40 list tc center white bg-red pa4 "/>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="monto" value="Monto:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="monto" value="#{depositoBean.depositoCuentaCorriente.monto}" readonly="true" label="Monto"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="comentario" value="Comentario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="comentario" value="#{depositoBean.depositoCuentaCorriente.comentario}" readonly="true" label="Comentario"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="metodo" value="Metodo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="metodo" value="#{depositoBean.depositoCuentaCorriente.metodo.nombre}" readonly="true" label="Metodo"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" action="#{depositoBean.deleteDepositoCuentaCorriente()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-trash"></li> Eliminar
</h:commandLink>
</div>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -0,0 +1,58 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Eliminar Giro</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_cuenta_corriente_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<h:messages class="f4 w-40 list tc center white bg-red pa4 "/>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="monto" value="Monto:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="monto" value="#{giroBean.giroCuentaCorriente.monto}" readonly="true" label="Monto"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="comentario" value="Comentario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="comentario" value="#{giroBean.giroCuentaCorriente.comentario}" readonly="true" label="Comentario"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="metodo" value="Metodo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="metodo" value="#{giroBean.giroCuentaCorriente.metodo.nombre}" readonly="true" label="Metodo"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" action="#{giroBean.deleteGiroEnCuentaCorriente()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-trash"></li> Eliminar
</h:commandLink>
</div>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -0,0 +1,62 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Eliminar Transferencia</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_cuenta_corriente_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<h:messages class="f4 w-40 list tc center white bg-red pa4 "/>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="monto" value="Monto:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="monto" value="#{transferenciaBean.transferenciaCuentaCorriente.monto}" readonly="true" label="Monto"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="comentario" value="Comentario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="comentario" value="#{transferenciaBean.transferenciaCuentaCorriente.comentario}" readonly="true" label="Comentario"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="emisor" value="Cuenta Emisor:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="emisor" value="#{transferenciaBean.transferenciaCuentaCorriente.cuentaCorrienteFrom.id}" readonly="true" label="Cuenta Emisor"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="destinatario" value="Cuenta Destinatario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="destinatario" value="#{transferenciaBean.transferenciaCuentaCorriente.cuentaCorrienteTo.id}" readonly="true" label="Cuenta Destinatario"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" action="#{transferenciaBean.eliminarTransferenciaEnCuentaCorriente()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-trash"></li> Eliminar
</h:commandLink>
</div>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -20,7 +20,7 @@
<div class="flex justify-between"> <div class="flex justify-between">
<h1 class="f1">Cuenta Corriente</h1> <h1 class="f1">Cuenta Corriente</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_main" style="margin-top: auto; margin-bottom: auto"> <h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_cliente_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver <li class="fas fa-arrow-left"></li> Volver
</h:commandLink> </h:commandLink>
</div> </div>
@@ -35,9 +35,7 @@
</div> </div>
<div class="mv4 ph2 fl w-33"> <div class="mv4 ph2 fl w-33">
<h:outputLabel class="db fw4 lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/> <h:outputLabel class="db fw4 lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100" id="fecha_creacion" value="#{cuentaCorrienteBean.cuentaCorriente.insertedAt}" readonly="true" label="Fecha Creacion:"> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100" id="fecha_creacion" value="#{cuentaCorrienteBean.cuentaCorriente.insertedAt}" readonly="true" label="Fecha Creacion:"/>
<f:convertDateTime pattern="dd/MM/yyyy"/>
</h:inputText>
</div> </div>
<h1 class="f2 ">Depositos</h1> <h1 class="f2 ">Depositos</h1>
@@ -46,9 +44,7 @@
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{deposito.insertedAt}"> <h:outputLabel value="#{deposito.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -62,6 +58,11 @@
</f:facet> </f:facet>
<h:outputLabel value="#{deposito.monto}"/> <h:outputLabel value="#{deposito.monto}"/>
</h:column> </h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{cuentaCorrienteBean.gotoDeleteDeposito(deposito)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable> </h:dataTable>
<h1 class="f2">Giros</h1> <h1 class="f2">Giros</h1>
@@ -70,9 +71,7 @@
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{giro.insertedAt}"> <h:outputLabel value="#{giro.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -86,6 +85,11 @@
</f:facet> </f:facet>
<h:outputLabel value="#{giro.monto}"/> <h:outputLabel value="#{giro.monto}"/>
</h:column> </h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{cuentaCorrienteBean.gotoDeleteGiro(giro)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable> </h:dataTable>
<h1 class="f2">Transferencias Hechas</h1> <h1 class="f2">Transferencias Hechas</h1>
@@ -94,9 +98,7 @@
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"> <h:outputLabel value="#{transferencia.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column><h:column> </h:column><h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Destinatario"/> <h:outputLabel value="Destinatario"/>
@@ -115,6 +117,11 @@
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.monto}"/> <h:outputLabel value="#{transferencia.monto}"/>
</h:column> </h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{cuentaCorrienteBean.gotoDeleteTransferencia(transferencia)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable> </h:dataTable>
<h1 class="f2">Transferencias Recibidas</h1> <h1 class="f2">Transferencias Recibidas</h1>
@@ -123,9 +130,7 @@
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"> <h:outputLabel value="#{transferencia.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column><h:column> </h:column><h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Emisor"/> <h:outputLabel value="Emisor"/>
@@ -144,6 +149,11 @@
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.monto}"/> <h:outputLabel value="#{transferencia.monto}"/>
</h:column> </h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{cuentaCorrienteBean.gotoDeleteTransferencia(transferencia)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable> </h:dataTable>
</h:form> </h:form>

View File

@@ -17,12 +17,13 @@
</h:head> </h:head>
<body class="black-70 pa4"> <body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}"> <h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<h1 class="f1 w-100 dib tc">Administracion</h1> <h1 class="f1 tc">Administracion</h1>
<div>
<h:commandLink class="f5 fr link dim br2 ph3 pv2 mb2 dib white bg-blue" action="#{clienteBean.gotoCreate()}"> <div class="mt3 cf">
<h:commandLink class="f5 fr tc link dim br2 ph3 pv2 mb2 dib white bg-blue" action="#{clienteBean.gotoCreate()}" style="width: 200px">
<li class="fas fa-plus-circle"></li> Crear Cliente <li class="fas fa-plus-circle"></li> Crear Cliente
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 fl link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="#{userBean.logout()}"> <h:commandLink class="f5 fl tc link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="#{userBean.logout()}" style="width: 200px">
<li class="fas fa-sign-out-alt"></li> Cerrar sesion <li class="fas fa-sign-out-alt"></li> Cerrar sesion
</h:commandLink> </h:commandLink>
</div> </div>

View File

@@ -0,0 +1,54 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Eliminar Compra</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_tarjeta_debito_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<h:messages class="f4 w-40 list tc center white bg-red pa4 "/>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="monto" value="Monto:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="monto" value="#{compraBean.compraTarjetaDebito.monto}" readonly="true" label="Monto"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="comentario" value="Comentario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="comentario" value="#{compraBean.compraTarjetaDebito.comentario}" readonly="true" label="Comentario"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" action="#{compraBean.deleteCompraTarjetaDebito()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-trash"></li> Eliminar
</h:commandLink>
</div>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -0,0 +1,58 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Eliminar Deposito</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_tarjeta_debito_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<h:messages class="f4 w-40 list tc center white bg-red pa4 "/>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="monto" value="Monto:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="monto" value="#{depositoBean.depositoTarjetaDebito.monto}" readonly="true" label="Monto"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="comentario" value="Comentario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="comentario" value="#{depositoBean.depositoTarjetaDebito.comentario}" readonly="true" label="Comentario"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="metodo" value="Metodo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="metodo" value="#{depositoBean.depositoTarjetaDebito.metodo.nombre}" readonly="true" label="Metodo"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" action="#{depositoBean.deleteDepositoTarjetaDebito()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-trash"></li> Eliminar
</h:commandLink>
</div>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -0,0 +1,58 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Eliminar Giro</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_tarjeta_debito_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<h:messages class="f4 w-40 list tc center white bg-red pa4 "/>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="monto" value="Monto:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="monto" value="#{giroBean.giroTarjetaDebito.monto}" readonly="true" label="Monto"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="comentario" value="Comentario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="comentario" value="#{giroBean.giroTarjetaDebito.comentario}" readonly="true" label="Comentario"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="metodo" value="Metodo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="metodo" value="#{giroBean.giroTarjetaDebito.metodo.nombre}" readonly="true" label="Metodo"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" action="#{giroBean.deleteGiroEnTarjetaDebito()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-trash"></li> Eliminar
</h:commandLink>
</div>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -0,0 +1,62 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Eliminar Transferencia</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_tarjeta_debito_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<h:messages class="f4 w-40 list tc center white bg-red pa4 "/>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="monto" value="Monto:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="monto" value="#{transferenciaBean.transferenciaTarjetaDebito.monto}" readonly="true" label="Monto"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="comentario" value="Comentario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="comentario" value="#{transferenciaBean.transferenciaTarjetaDebito.comentario}" readonly="true" label="Comentario"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="emisor" value="Cuenta Emisor:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="emisor" value="#{transferenciaBean.transferenciaTarjetaDebito.tarjetaDebitoFrom.id}" readonly="true" label="Cuenta Emisor"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="destinatario" value="Cuenta Destinatario:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="destinatario" value="#{transferenciaBean.transferenciaTarjetaDebito.tarjetaDebitoTo.id}" readonly="true" label="Cuenta Destinatario"/>
</div>
<div class="mt3 tc">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" action="#{transferenciaBean.eliminarTransferenciaEnTarjetaDebito()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-trash"></li> Eliminar
</h:commandLink>
</div>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -0,0 +1,196 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/>
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"/>
<h:outputStylesheet library="css" name="all.css"/>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
</style>
</h:head>
<body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isAdmin()}">
<div class="flex justify-between">
<h1 class="f1">Tarjeta Debito</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="admin_cliente_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver
</h:commandLink>
</div>
<div class="mv4 ph2 fl w-33">
<h:outputLabel class="db fw4 lh-copy f6" for="id" value="Id:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100" id="id" value="#{tarjetaDebitoBean.tarjetaDebito.id}" readonly="true" label="Id:"/>
</div>
<div class="mv4 ph2 fl w-33">
<h:outputLabel class="db fw4 lh-copy f6" for="saldo" value="Saldo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100" id="saldo" value="#{tarjetaDebitoBean.tarjetaDebito.saldo}" readonly="true" label="Saldo:"/>
</div>
<div class="mv4 ph2 fl w-33">
<h:outputLabel class="db fw4 lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100" id="fecha_creacion" value="#{tarjetaDebitoBean.tarjetaDebito.insertedAt}" readonly="true" label="Fecha Creacion:"/>
</div>
<h1 class="f2 ">Depositos</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.depositoList}" var="deposito">
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha"/>
</f:facet>
<h:outputLabel value="#{deposito.insertedAt}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Comentario"/>
</f:facet>
<h:outputLabel value="#{deposito.comentario}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Monto"/>
</f:facet>
<h:outputLabel value="#{deposito.monto}"/>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{tarjetaDebitoBean.gotoDeleteDeposito(deposito)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable>
<h1 class="f2">Giros</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.giroList}" var="giro">
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha"/>
</f:facet>
<h:outputLabel value="#{giro.insertedAt}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Comentario"/>
</f:facet>
<h:outputLabel value="#{giro.comentario}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Monto"/>
</f:facet>
<h:outputLabel value="#{giro.monto}"/>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{tarjetaDebitoBean.gotoDeleteGiro(giro)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable>
<h1 class="f2">Transferencias Hechas</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.transferenciaFromList}" var="transferencia">
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha"/>
</f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"/>
</h:column><h:column>
<f:facet name="header">
<h:outputLabel value="Destinatario"/>
</f:facet>
<h:outputLabel value="#{transferencia.tarjetaDebitoTo.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Comentario"/>
</f:facet>
<h:outputLabel value="#{transferencia.comentario}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Monto"/>
</f:facet>
<h:outputLabel value="#{transferencia.monto}"/>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{tarjetaDebitoBean.gotoDeleteTransferencia(transferencia)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable>
<h1 class="f2">Transferencias Recibidas</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.transferenciaToList}" var="transferencia">
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha"/>
</f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"/>
</h:column><h:column>
<f:facet name="header">
<h:outputLabel value="Emisor"/>
</f:facet>
<h:outputLabel value="#{transferencia.tarjetaDebitoFrom.id}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Comentario"/>
</f:facet>
<h:outputLabel value="#{transferencia.comentario}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Monto"/>
</f:facet>
<h:outputLabel value="#{transferencia.monto}"/>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{tarjetaDebitoBean.gotoDeleteTransferencia(transferencia)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable>
<hr/>
<h1 class="f2">Compras</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.compraList}" var="compra">
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha"/>
</f:facet>
<h:outputLabel value="#{compra.insertedAt}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Comentario"/>
</f:facet>
<h:outputLabel value="#{compra.comentario}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Monto"/>
</f:facet>
<h:outputLabel value="#{compra.monto}"/>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mr2 dib white bg-red tc" action="#{tarjetaDebitoBean.gotoDeleteCompra(compra)}">
<li class="fas fa-trash"></li>
</h:commandLink>
</h:column>
</h:dataTable>
</h:form>
<h:form rendered="#{!userBean.isLogged()}">
<div class="tc">
<h1 class="f1 tc">Acceso no autorizado</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" value="Ir al index" action="index"/>
</div>
</h:form>
</body>
</html>

View File

@@ -20,7 +20,7 @@
<div class="flex justify-between"> <div class="flex justify-between">
<h1 class="f1">Cuenta Corriente - Depositar</h1> <h1 class="f1">Cuenta Corriente - Depositar</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" immediate="true" action="cliente_main" style="margin-top: auto; margin-bottom: auto"> <h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" immediate="true" action="cliente_cuenta_corriente_view" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver <li class="fas fa-arrow-left"></li> Volver
</h:commandLink> </h:commandLink>
</div> </div>

View File

@@ -17,50 +17,50 @@
</h:head> </h:head>
<body class="black-70 pa4"> <body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isClient()}"> <h:form rendered="#{userBean.isLogged() and userBean.isClient()}">
<div class="flex justify-between"> <h1 class="f1 tc">Cuenta Corriente</h1>
<h1 class="f1">Cuenta Corriente</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="cliente_main" style="margin-top: auto; margin-bottom: auto"> <div class="mv3 cf">
<h:commandLink class="f5 fl tc link dim br2 ph3 pv2 mb2 dib white bg-blue" immediate="true" action="cliente_main" style="width: 200px">
<li class="fas fa-arrow-left"></li> Volver <li class="fas fa-arrow-left"></li> Volver
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 fr tc link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="#{userBean.logout()}" style="width: 200px">
<li class="fas fa-sign-out-alt"></li> Cerrar sesion
</h:commandLink>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" for="id" value="Id:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="id" value="#{cuentaCorrienteBean.cuentaCorriente.id}" readonly="true" label="Id:"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" for="saldo" value="Saldo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="saldo" value="#{cuentaCorrienteBean.cuentaCorriente.saldo}" readonly="true" label="Saldo:"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="fecha_creacion" value="#{cuentaCorrienteBean.cuentaCorriente.insertedAt}" readonly="true" label="Fecha Creacion:"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="id" value="Id:"/> <h:commandLink class="f6 link dim br2 ph3 pv2 ma2 dib white bg-green tc" action="#{cuentaCorrienteBean.gotoDepositar()}" style="width: 200px">
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="id" value="#{cuentaCorrienteBean.cuentaCorriente.id}" readonly="true" label="Id:"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="saldo" value="Saldo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="saldo" value="#{cuentaCorrienteBean.cuentaCorriente.saldo}" readonly="true" label="Saldo:"/>
</div>
<div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="fecha_creacion" value="#{cuentaCorrienteBean.cuentaCorriente.insertedAt}" readonly="true" label="Fecha Creacion:">
<f:convertDateTime pattern="dd/MM/yyyy"/>
</h:inputText>
</div>
<div class="flex mt3 justify-center">
<h:commandLink class="f5 tc link dim br2 ph3 pv2 w-20 dib white bg-green" action="#{cuentaCorrienteBean.gotoDepositar()}">
<li class="fas fa-piggy-bank"></li> Depositar <li class="fas fa-piggy-bank"></li> Depositar
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 tc link dim br2 ph3 pv2 ml2 w-20 dib white bg-red" action="#{cuentaCorrienteBean.gotoGirar()}"> <h:commandLink class="f6 link dim br2 ph3 pv2 ma2 dib white bg-gold tc" action="#{cuentaCorrienteBean.gotoGirar()}" style="width: 200px">
<li class="fas fa-hand-holding-usd"></li> Girar <li class="fas fa-hand-holding-usd"></li> Girar
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 tc link dim br2 ph3 pv2 ml2 dib w-20 white bg-blue" action="#{cuentaCorrienteBean.gotoTransferir()}"> <h:commandLink class="f6 link dim br2 ph3 pv2 ma2 dib white bg-blue tc" action="#{cuentaCorrienteBean.gotoTransferir()}" style="width: 200px">
<li class="fas fa-comments-dollar"></li> Transferir <li class="fas fa-comments-dollar"></li> Transferir
</h:commandLink> </h:commandLink>
</div> </div>
<h1 class="f1">Depositos</h1> <h1 class="f3">Depositos</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.depositoList}" var="deposito"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.depositoList}" var="deposito">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{deposito.insertedAt}"> <h:outputLabel value="#{deposito.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -68,6 +68,12 @@
</f:facet> </f:facet>
<h:outputLabel value="#{deposito.comentario}"/> <h:outputLabel value="#{deposito.comentario}"/>
</h:column> </h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Metodo"/>
</f:facet>
<h:outputLabel value="#{deposito.metodo.nombre}"/>
</h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Monto"/> <h:outputLabel value="Monto"/>
@@ -75,16 +81,15 @@
<h:outputLabel value="#{deposito.monto}"/> <h:outputLabel value="#{deposito.monto}"/>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<hr/>
<h1 class="f1">Giros</h1> <h1 class="f3">Giros</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.giroList}" var="giro"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.giroList}" var="giro">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{giro.insertedAt}"> <h:outputLabel value="#{giro.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -92,6 +97,12 @@
</f:facet> </f:facet>
<h:outputLabel value="#{giro.comentario}"/> <h:outputLabel value="#{giro.comentario}"/>
</h:column> </h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Metodo"/>
</f:facet>
<h:outputLabel value="#{giro.metodo.nombre}"/>
</h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Monto"/> <h:outputLabel value="Monto"/>
@@ -99,16 +110,15 @@
<h:outputLabel value="#{giro.monto}"/> <h:outputLabel value="#{giro.monto}"/>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<hr/>
<h1 class="f1">Transferencias Hechas</h1> <h1 class="f3">Transferencias Hechas</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.transferenciaFromList}" var="transferencia"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.transferenciaFromList}" var="transferencia">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"> <h:outputLabel value="#{transferencia.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column><h:column> </h:column><h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Destinatario"/> <h:outputLabel value="Destinatario"/>
@@ -128,17 +138,17 @@
<h:outputLabel value="#{transferencia.monto}"/> <h:outputLabel value="#{transferencia.monto}"/>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<hr/>
<h1 class="f1">Transferencias Recibidas</h1> <h1 class="f3">Transferencias Recibidas</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.transferenciaToList}" var="transferencia"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{cuentaCorrienteBean.cuentaCorriente.transferenciaToList}" var="transferencia">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"> <h:outputLabel value="#{transferencia.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/> </h:column>
</h:outputLabel> <h:column>
</h:column><h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Emisor"/> <h:outputLabel value="Emisor"/>
</f:facet> </f:facet>

View File

@@ -17,139 +17,127 @@
</h:head> </h:head>
<body class="black-70 pa4"> <body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isClient()}"> <h:form rendered="#{userBean.isLogged() and userBean.isClient()}">
<h1 class="f1 tc">¡Bienvenido #{clienteBean.cliente.nombre}!</h1>
<div class="flex justify-between"> <div class="mv3 cf">
<h1 class="f1 w-100 dib">¡Bienvenido #{clienteBean.cliente.nombre}!</h1> <h:commandLink class="f5 fr tc link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="#{userBean.logout()}" style="width: 200px">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-red" immediate="true" action="#{userBean.logout()}" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-sign-out-alt"></li> Cerrar sesion <li class="fas fa-sign-out-alt"></li> Cerrar sesion
</h:commandLink> </h:commandLink>
</div> </div>
<h2 class="f2">Productos</h2> <h2 class="f2 tc">Productos</h2>
<!-- <!--
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
///////////////////////////Cuentas Corrientes/////////////////////// ///////////////////////////Cuenta Corriente///////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
--> -->
<h3 class="f3">Cuentas Corrientes</h3> <h:panelGroup layout="block" class="mv3 w-100" rendered="#{clienteBean.cliente.cuentaCorriente != null}">
<h3 class="f3 tc">Cuenta Corriente</h3>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3" value="#{clienteBean.cliente.cuentaCorrienteList}" var="cuentaCorriente"> <div class="mt3 tc">
<h:column> <h:outputLabel class="db lh-copy f6" value="Id:"/>
<f:facet name="header"> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.cuentaCorriente.id}" readonly="true"/>
<h:outputLabel value="Id"/> </div>
</f:facet> <div class="mt3 tc">
<h:outputLabel value="#{cuentaCorriente.id}"/> <h:outputLabel class="db lh-copy f6" value="Saldo:"/>
</h:column> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.cuentaCorriente.saldo}" readonly="true"/>
<h:column> </div>
<f:facet name="header"> <div class="mt3 tc">
<h:outputLabel value="Saldo"/> <h:outputLabel class="db lh-copy f6" value="Fecha Creacion:"/>
</f:facet> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.cuentaCorriente.insertedAt}" readonly="true"/>
<h:outputLabel value="#{cuentaCorriente.saldo}"/> </div>
</h:column> <div class="mt3 tc">
<h:column> <h:commandLink class="f6 link dim br2 ph3 pv2 mb2 dib white bg-green tc" action="#{clienteBean.gotoViewCuentaCorriente()}" style="width: 200px">
<f:facet name="header"> <li class="fas fa-eye"></li> Ver
<h:outputLabel value="Fecha creacion"/>
</f:facet>
<h:outputLabel value="#{cuentaCorriente.insertedAt}">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mb2 dib white bg-green tc" action="#{clienteBean.gotoViewCuentaCorriente(cuentaCorriente)}">
<li class="fas fa-eye"></li>
</h:commandLink> </h:commandLink>
</h:column> </div>
</h:dataTable> </h:panelGroup>
<h:panelGroup layout="block" rendered="#{clienteBean.cliente.cuentaCorriente == null}">
<h3 class="f3 tc">Cuenta Corriente</h3>
<p class="f6 tc">Sin contratar</p>
</h:panelGroup>
<hr/>
<!-- <!--
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
///////////////////////////Tarjetas de Debito/////////////////////// ///////////////////////////Tarjetas de Debito///////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
--> -->
<h3 class="f3">Tarjetas de Debito</h3>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3" value="#{clienteBean.cliente.tarjetaDebitoList}" var="tarjetaDebito"> <h:panelGroup layout="block" class="mv3 w-100" rendered="#{clienteBean.cliente.tarjetaDebito != null}">
<h:column> <h3 class="f3 tc">Tarjeta Debito</h3>
<f:facet name="header">
<h:outputLabel value="Id"/> <div class="mt3 tc">
</f:facet> <h:outputLabel class="db lh-copy f6" value="Id:"/>
<h:outputLabel value="#{tarjetaDebito.id}"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaDebito.id}" readonly="true"/>
</h:column> </div>
<h:column> <div class="mt3 tc">
<f:facet name="header"> <h:outputLabel class="db fw4 lh-copy f6" value="Saldo:"/>
<h:outputLabel value="Saldo"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaDebito.saldo}" readonly="true"/>
</f:facet> </div>
<h:outputLabel value="#{tarjetaDebito.saldo}"/> <div class="mt3 tc">
</h:column> <h:outputLabel class="db fw4 lh-copy f6" value="Fecha Creacion:"/>
<h:column> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaDebito.insertedAt}" readonly="true"/>
<f:facet name="header"> </div>
<h:outputLabel value="Fecha creacion"/> <div class="mt3 tc">
</f:facet> <h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-green" action="#{clienteBean.gotoViewTarjetaDebito()}" style="width: 200px">
<h:outputLabel value="#{tarjetaDebito.insertedAt}"> <li class="fas fa-eye"></li> Ver
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mb2 dib white bg-green tc" action="#{clienteBean.gotoViewTarjetaDebito(tarjetaDebito)}">
<li class="fas fa-eye"></li>
</h:commandLink> </h:commandLink>
</h:column> </div>
</h:dataTable> </h:panelGroup>
<h:panelGroup layout="block" rendered="#{clienteBean.cliente.tarjetaDebito == null}">
<h3 class="f3 tc">Tarjeta Debito</h3>
<p class="f6 tc">Sin contratar</p>
</h:panelGroup>
<hr/>
<!-- <!--
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
///////////////////////////Tarjetas de Credito////////////////////// ///////////////////////////Tarjetas de Credito//////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
--> -->
<h3 class="f3">Tarjetas de Credito</h3> <h:panelGroup layout="block" class="mv3 w-100" rendered="#{clienteBean.cliente.tarjetaCredito != null}">
<h3 class="f3 tc">Tarjeta Credito</h3>
<div class="mt3 tc">
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3" value="#{clienteBean.cliente.tarjetaCreditoList}" var="tarjetaCredito"> <h:outputLabel class="db lh-copy f6" value="Id:"/>
<h:column> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.id}" readonly="true"/>
<f:facet name="header"> </div>
<h:outputLabel value="Id"/> <div class="mt3 tc">
</f:facet> <h:outputLabel class="db lh-copy f6" value="Limite Nacional:"/>
<h:outputLabel value="#{tarjetaCredito.id}"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.limiteNacional}" readonly="true"/>
</h:column> </div>
<h:column> <div class="mt3 tc">
<f:facet name="header"> <h:outputLabel class="db lh-copy f6" value="Deuda Nacional:"/>
<h:outputLabel value="Limite Nacional"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.deudaNacional}" readonly="true"/>
</f:facet> </div>
<h:outputLabel value="#{tarjetaCredito.limiteNacional}"/> <div class="mt3 tc">
</h:column> <h:outputLabel class="db lh-copy f6" value="Limite Internacional:"/>
<h:column> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.limiteInternacional}" readonly="true"/>
<f:facet name="header"> </div>
<h:outputLabel value="Deuda Nacional"/> <div class="mt3 tc">
</f:facet> <h:outputLabel class="db lh-copy f6" value="Deuda Internacional:"/>
<h:outputLabel value="#{tarjetaCredito.deudaNacional}"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.deudaInternacional}" readonly="true"/>
</h:column> </div>
<h:column> <div class="mt3 tc">
<f:facet name="header"> <h:outputLabel class="db lh-copy f6" value="Fecha Creacion:"/>
<h:outputLabel value="Limite Internacional"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" value="#{clienteBean.cliente.tarjetaCredito.insertedAt}" readonly="true"/>
</f:facet> </div>
<h:outputLabel value="#{tarjetaCredito.limiteInternacional}"/> <div class="mt3 tc">
</h:column> <h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-green" action="#{clienteBean.gotoViewTarjetaCredito()}" style="width: 200px">
<h:column> <li class="fas fa-eye"></li> Ver
<f:facet name="header">
<h:outputLabel value="Deuda Internacional"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.deudaInternacional}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Fecha creacion"/>
</f:facet>
<h:outputLabel value="#{tarjetaCredito.insertedAt}">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column>
<h:column class="tr">
<h:commandLink class="f6 link dim br2 ph3 pv2 mb2 dib white bg-green tc" action="#{clienteBean.gotoViewTarjetaCredito(tarjetaCredito)}">
<li class="fas fa-eye"></li>
</h:commandLink> </h:commandLink>
</h:column> </div>
</h:dataTable> </h:panelGroup>
<h:panelGroup layout="block" rendered="#{clienteBean.cliente.tarjetaCredito == null}">
<h3 class="f3 tc">Tarjeta Credito</h3>
<p class="f6 tc">Sin contratar</p>
</h:panelGroup>
</h:form> </h:form>

View File

@@ -41,7 +41,7 @@
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="tipo" value="Tipo:"/> <h:outputLabel class="db fw4 lh-copy f6" for="tipo" value="Tipo:"/>
<h:selectOneMenu class="pa2 ba b--black-20 bg-transparent w-100 measure" id="tipo" value="#{compraBean.clase}" required="true" label="Tipo"> <h:selectOneMenu class="pa2 ba b--black-20 bg-transparent w-100 measure" id="tipo" value="#{compraBean.tipo}" required="true" label="Tipo">
<f:selectItem itemValue="Nacional"/> <f:selectItem itemValue="Nacional"/>
<f:selectItem itemValue="Internacional"/> <f:selectItem itemValue="Internacional"/>
</h:selectOneMenu> </h:selectOneMenu>

View File

@@ -41,7 +41,7 @@
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="tipo" value="Tipo:"/> <h:outputLabel class="db fw4 lh-copy f6" for="tipo" value="Tipo:"/>
<h:selectOneMenu class="pa2 ba b--black-20 bg-transparent w-100 measure" id="tipo" value="#{pagoBean.clase}" required="true" label="Tipo"> <h:selectOneMenu class="pa2 ba b--black-20 bg-transparent w-100 measure" id="tipo" value="#{pagoBean.tipo}" required="true" label="Tipo">
<f:selectItem itemValue="Nacional"/> <f:selectItem itemValue="Nacional"/>
<f:selectItem itemValue="Internacional"/> <f:selectItem itemValue="Internacional"/>
</h:selectOneMenu> </h:selectOneMenu>

View File

@@ -17,59 +17,57 @@
</h:head> </h:head>
<body class="black-70 pa4"> <body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isClient()}"> <h:form rendered="#{userBean.isLogged() and userBean.isClient()}">
<div class="flex justify-between"> <h1 class="f1 tc">Tarjeta Credito</h1>
<h1 class="f1">Tarjeta Credito</h1> <div class="mv3 cf">
<h:commandLink class="f5 fl tc link dim br2 ph3 pv2 mb2 dib white bg-blue" immediate="true" action="cliente_main" style="width: 200px">
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="cliente_main" style="margin-top: auto; margin-bottom: auto">
<li class="fas fa-arrow-left"></li> Volver <li class="fas fa-arrow-left"></li> Volver
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 fr tc link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="#{userBean.logout()}" style="width: 200px">
<li class="fas fa-sign-out-alt"></li> Cerrar sesion
</h:commandLink>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="id" value="Id:"/> <h:outputLabel class="db lh-copy f6" value="Id:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="id" value="#{tarjetaCreditoBean.tarjetaCredito.id}" readonly="true" label="Id:"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="id" value="#{tarjetaCreditoBean.tarjetaCredito.id}" readonly="true"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="limite_nacional" value="Limite Nacional: "/> <h:outputLabel class="db lh-copy f6" value="Limite Nacional: "/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="limite_nacional" value="#{tarjetaCreditoBean.tarjetaCredito.limiteNacional}" readonly="true" label="Limite Nacional:"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="limite_nacional" value="#{tarjetaCreditoBean.tarjetaCredito.limiteNacional}" readonly="true"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="deuda_nacional" value="Deuda Nacional: "/> <h:outputLabel class="db lh-copy f6" value="Deuda Nacional: "/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="deuda_nacional" value="#{tarjetaCreditoBean.tarjetaCredito.deudaNacional}" readonly="true" label="Deuda Nacional"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="deuda_nacional" value="#{tarjetaCreditoBean.tarjetaCredito.deudaNacional}" readonly="true"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="limite_internacional" value="Limite Internacional: "/> <h:outputLabel class="db lh-copy f6" value="Limite Internacional: "/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="limite_internacional" value="#{tarjetaCreditoBean.tarjetaCredito.limiteInternacional}" readonly="true" label="Limite Internacional: "/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="limite_internacional" value="#{tarjetaCreditoBean.tarjetaCredito.limiteInternacional}" readonly="true"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="deuda_internacional" value="Deuda Internacional"/> <h:outputLabel class="db lh-copy f6" value="Deuda Internacional"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="deuda_internacional" value="#{tarjetaCreditoBean.tarjetaCredito.deudaInternacional}" readonly="true" label="Deuda Internacional: "/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="deuda_internacional" value="#{tarjetaCreditoBean.tarjetaCredito.deudaInternacional}" readonly="true"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/> <h:outputLabel class="db lh-copy f6" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="fecha_creacion" value="#{tarjetaCreditoBean.tarjetaCredito.insertedAt}" readonly="true" label="Fecha Creacion:"> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="fecha_creacion" value="#{tarjetaCreditoBean.tarjetaCredito.insertedAt}" readonly="true"/>
<f:convertDateTime pattern="dd/MM/yyyy"/>
</h:inputText>
</div> </div>
<div class="flex mt3 justify-center"> <div class="mt3 tc">
<h:commandLink class="f5 tc link dim br2 ph3 pv2 w-30 dib white bg-green" action="#{tarjetaCreditoBean.gotoComprar()}"> <h:commandLink class="f5 tc link dim br2 ph3 pv2 ma2 dib white bg-green" action="#{tarjetaCreditoBean.gotoComprar()}" style="width: 200px">
<li class="fas fa-shopping-basket"></li> Comprar <li class="fas fa-shopping-basket"></li> Comprar
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 tc link dim br2 ph3 pv2 ml2 w-30 dib white bg-red" action="#{tarjetaCreditoBean.gotoPagar()}"> <h:commandLink class="f5 tc link dim br2 ph3 pv2 ma2 dib white bg-gold" action="#{tarjetaCreditoBean.gotoPagar()}" style="width: 200px">
<li class="fas fa-money-bill"></li> Pagar <li class="fas fa-money-bill"></li> Pagar
</h:commandLink> </h:commandLink>
</div> </div>
<h1 class="f1">Compras</h1> <h1 class="f3">Compras</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaCreditoBean.tarjetaCredito.compraList}" var="compra"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaCreditoBean.tarjetaCredito.compraList}" var="compra">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{compra.insertedAt}"> <h:outputLabel value="#{compra.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -77,6 +75,12 @@
</f:facet> </f:facet>
<h:outputLabel value="#{compra.comentario}"/> <h:outputLabel value="#{compra.comentario}"/>
</h:column> </h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Tipo de Compra"/>
</f:facet>
<h:outputLabel value="#{compra.tipo}"/>
</h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Monto"/> <h:outputLabel value="Monto"/>
@@ -84,16 +88,15 @@
<h:outputLabel value="#{compra.monto}"/> <h:outputLabel value="#{compra.monto}"/>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<hr/>
<h1 class="f1">Pagos</h1> <h1 class="f3">Pagos</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaCreditoBean.tarjetaCredito.pagoList}" var="pago"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaCreditoBean.tarjetaCredito.pagoList}" var="pago">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{pago.insertedAt}"> <h:outputLabel value="#{pago.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -101,6 +104,12 @@
</f:facet> </f:facet>
<h:outputLabel value="#{pago.comentario}"/> <h:outputLabel value="#{pago.comentario}"/>
</h:column> </h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Tipo de Pago"/>
</f:facet>
<h:outputLabel value="#{pago.tipo}"/>
</h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Monto"/> <h:outputLabel value="Monto"/>

View File

@@ -17,53 +17,53 @@
</h:head> </h:head>
<body class="black-70 pa4"> <body class="black-70 pa4">
<h:form rendered="#{userBean.isLogged() and userBean.isClient()}"> <h:form rendered="#{userBean.isLogged() and userBean.isClient()}">
<div class="flex justify-between"> <h1 class="f1 tc">Tarjeta Debito</h1>
<h1 class="f1">Tarjeta Debito</h1>
<h:commandLink class="f5 tc link w-20 dim br2 ph3 pv2 mb1 mr2 dib white bg-blue" immediate="true" action="cliente_main" style="margin-top: auto; margin-bottom: auto"> <div class="mv3 cf">
<h:commandLink class="f5 fl tc link dim br2 ph3 pv2 mb2 dib white bg-blue" immediate="true" action="cliente_main" style="width: 200px">
<li class="fas fa-arrow-left"></li> Volver <li class="fas fa-arrow-left"></li> Volver
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 fr tc link dim br2 ph3 pv2 mb2 dib white bg-red" immediate="true" action="#{userBean.logout()}" style="width: 200px">
<li class="fas fa-sign-out-alt"></li> Cerrar sesion
</h:commandLink>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="id" value="Id:"/> <h:outputLabel class="db lh-copy f6" for="id" value="Id:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="id" value="#{tarjetaDebitoBean.tarjetaDebito.id}" readonly="true" label="Id:"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="id" value="#{tarjetaDebitoBean.tarjetaDebito.id}" readonly="true" label="Id:"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="saldo" value="Saldo:"/> <h:outputLabel class="db lh-copy f6" for="saldo" value="Saldo:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="saldo" value="#{tarjetaDebitoBean.tarjetaDebito.saldo}" readonly="true" label="Saldo:"/> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="saldo" value="#{tarjetaDebitoBean.tarjetaDebito.saldo}" readonly="true" label="Saldo:"/>
</div> </div>
<div class="mt3 tc"> <div class="mt3 tc">
<h:outputLabel class="db fw4 lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/> <h:outputLabel class="db lh-copy f6" for="fecha_creacion" value="Fecha Creacion:"/>
<h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-60" id="fecha_creacion" value="#{tarjetaDebitoBean.tarjetaDebito.insertedAt}" readonly="true" label="Fecha Creacion:"> <h:inputText class="pa2 input-reset ba b--black-20 bg-transparent w-100 measure" id="fecha_creacion" value="#{tarjetaDebitoBean.tarjetaDebito.insertedAt}" readonly="true" label="Fecha Creacion:"/>
<f:convertDateTime pattern="dd/MM/yyyy"/>
</h:inputText>
</div> </div>
<div class="flex mt3 justify-center"> <div class="flex mt3 justify-center">
<h:commandLink class="f5 tc link dim br2 ph3 pv2 w-20 dib white bg-green" action="#{tarjetaDebitoBean.gotoDepositar()}"> <h:commandLink class="f5 fr tc link dim br2 ph3 pv2 ma2 dib white bg-green" action="#{tarjetaDebitoBean.gotoDepositar()}" style="width: 200px">
<li class="fas fa-piggy-bank"></li> Depositar <li class="fas fa-piggy-bank"></li> Depositar
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 tc link dim br2 ph3 pv2 ml2 w-20 dib white bg-red" action="#{tarjetaDebitoBean.gotoGirar()}"> <h:commandLink class="f5 fr tc link dim br2 ph3 pv2 ma2 dib white bg-gold" action="#{tarjetaDebitoBean.gotoGirar()}" style="width: 200px">
<li class="fas fa-hand-holding-usd"></li> Girar <li class="fas fa-hand-holding-usd"></li> Girar
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 tc link dim br2 ph3 pv2 ml2 dib w-20 white bg-blue" action="#{tarjetaDebitoBean.gotoTransferir()}"> <h:commandLink class="f5 fr tc link dim br2 ph3 pv2 ma2 dib white bg-blue" action="#{tarjetaDebitoBean.gotoTransferir()}" style="width: 200px">
<li class="fas fa-comments-dollar"></li> Transferir <li class="fas fa-comments-dollar"></li> Transferir
</h:commandLink> </h:commandLink>
<h:commandLink class="f5 tc link dim br2 ph3 pv2 ml2 dib w-20 white bg-purple" action="#{tarjetaDebitoBean.gotoComprar()}"> <h:commandLink class="f5 fr tc link dim br2 ph3 pv2 ma2 dib white bg-purple" action="#{tarjetaDebitoBean.gotoComprar()}" style="width: 200px">
<li class="fas fa-shopping-basket"></li> Comprar <li class="fas fa-shopping-basket"></li> Comprar
</h:commandLink> </h:commandLink>
</div> </div>
<h1 class="f1">Depositos</h1>
<h1 class="f3">Depositos</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.depositoList}" var="deposito"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.depositoList}" var="deposito">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{deposito.insertedAt}"> <h:outputLabel value="#{deposito.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -71,6 +71,12 @@
</f:facet> </f:facet>
<h:outputLabel value="#{deposito.comentario}"/> <h:outputLabel value="#{deposito.comentario}"/>
</h:column> </h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Metodo"/>
</f:facet>
<h:outputLabel value="#{deposito.metodo.nombre}"/>
</h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Monto"/> <h:outputLabel value="Monto"/>
@@ -78,16 +84,15 @@
<h:outputLabel value="#{deposito.monto}"/> <h:outputLabel value="#{deposito.monto}"/>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<hr/>
<h1 class="f1">Giros</h1> <h1 class="f3">Giros</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.giroList}" var="giro"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.giroList}" var="giro">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{giro.insertedAt}"> <h:outputLabel value="#{giro.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
@@ -95,6 +100,12 @@
</f:facet> </f:facet>
<h:outputLabel value="#{giro.comentario}"/> <h:outputLabel value="#{giro.comentario}"/>
</h:column> </h:column>
<h:column>
<f:facet name="header">
<h:outputLabel value="Metodo"/>
</f:facet>
<h:outputLabel value="#{giro.metodo.nombre}"/>
</h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Monto"/> <h:outputLabel value="Monto"/>
@@ -103,16 +114,17 @@
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<h1 class="f1">Transferencias Hechas</h1> <hr/>
<h1 class="f3">Transferencias Hechas</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.transferenciaFromList}" var="transferencia"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.transferenciaFromList}" var="transferencia">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"> <h:outputLabel value="#{transferencia.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/> </h:column>
</h:outputLabel> <h:column>
</h:column><h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Destinatario"/> <h:outputLabel value="Destinatario"/>
</f:facet> </f:facet>
@@ -132,16 +144,17 @@
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<h1 class="f1">Transferencias Recibidas</h1> <hr/>
<h1 class="f3">Transferencias Recibidas</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.transferenciaToList}" var="transferencia"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.transferenciaToList}" var="transferencia">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{transferencia.insertedAt}"> <h:outputLabel value="#{transferencia.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/> </h:column>
</h:outputLabel> <h:column>
</h:column><h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Emisor"/> <h:outputLabel value="Emisor"/>
</f:facet> </f:facet>
@@ -162,15 +175,15 @@
</h:dataTable> </h:dataTable>
</h:form> </h:form>
<h1 class="f1">Compras</h1> <hr/>
<h1 class="f3">Compras</h1>
<h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.compraList}" var="compra"> <h:dataTable class="w-100 pv3" headerClass="fw6 bb b--black-20 tl pb2 pr3 bg-white" value="#{tarjetaDebitoBean.tarjetaDebito.compraList}" var="compra">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputLabel value="Fecha"/> <h:outputLabel value="Fecha"/>
</f:facet> </f:facet>
<h:outputLabel value="#{compra.insertedAt}"> <h:outputLabel value="#{compra.insertedAt}"/>
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"/>
</h:outputLabel>
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">

248
bank.sql
View File

@@ -2,147 +2,171 @@ DROP DATABASE bank;
CREATE DATABASE bank; CREATE DATABASE bank;
USE bank; USE bank;
CREATE TABLE linea_sobregiro (
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
sobregiro int(10) NOT NULL,
limite int(10) NOT NULL,
inserted_at timestamp DEFAULT current_timestamp()
);
CREATE TABLE tarjeta_credito (
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
limite_nacional int(10) NOT NULL,
limite_internacional int(10) NOT NULL,
deuda_nacional int(10) DEFAULT 0,
deuda_internacional int(10) DEFAULT 0,
linea_sobregiro int(10) UNIQUE,
inserted_at timestamp DEFAULT current_timestamp(),
foreign key (linea_sobregiro) references linea_sobregiro (id) ON DELETE CASCADE
);
CREATE TABLE cuenta_corriente (
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
saldo int(10) DEFAULT 0,
linea_sobregiro int(10) UNIQUE,
inserted_at timestamp DEFAULT current_timestamp(),
foreign key (linea_sobregiro) references linea_sobregiro (id) ON DELETE CASCADE
);
CREATE TABLE tarjeta_debito (
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
saldo int(10) DEFAULT 0,
inserted_at timestamp DEFAULT current_timestamp()
);
CREATE TABLE usuario ( CREATE TABLE usuario (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
nombre varchar(255) NOT NULL, nombre varchar(255) NOT NULL,
password binary(32) NOT NULL, password binary(32) NOT NULL,
salt binary(16) NOT NULL, salt binary(16) NOT NULL,
role varchar(255) DEFAULT 'Cliente' NOT NULL, rol varchar(255) DEFAULT 'Cliente',
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, inserted_at timestamp DEFAULT current_timestamp()
PRIMARY KEY (id)) CHARACTER SET UTF8; );
CREATE TABLE cliente ( CREATE TABLE cliente (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
rut varchar(255) NOT NULL, rut varchar(255) NOT NULL,
nombre varchar(255) NOT NULL, nombre varchar(255) NOT NULL,
ciudad varchar(255) NOT NULL, ciudad varchar(255) NOT NULL,
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, cuenta_corriente int(10) UNIQUE,
linea_sobregiro int(10) UNIQUE, tarjeta_credito int(10) UNIQUE,
tarjeta_debito int(10) UNIQUE,
usuario int(10) NOT NULL UNIQUE, usuario int(10) NOT NULL UNIQUE,
PRIMARY KEY (id)) CHARACTER SET UTF8; inserted_at timestamp DEFAULT current_timestamp(),
CREATE TABLE linea_sobregiro ( foreign key (cuenta_corriente) references cuenta_corriente (id) ON DELETE CASCADE,
id int(10) NOT NULL AUTO_INCREMENT, foreign key (tarjeta_credito) references tarjeta_credito (id) ON DELETE CASCADE,
sobregiro int(10) NOT NULL, foreign key (tarjeta_debito) references tarjeta_debito (id) ON DELETE CASCADE,
limite int(10) NOT NULL, foreign key (usuario) references usuario (id) ON DELETE CASCADE
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, );
PRIMARY KEY (id)) CHARACTER SET UTF8;
CREATE TABLE tarjeta_credito ( CREATE TABLE metodo (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
limite_nacional int(10) NOT NULL, nombre varchar(255) NOT NULL,
limite_internacional int(10) NOT NULL, inserted_at timestamp DEFAULT current_timestamp()
deuda_nacional int(10) DEFAULT 0 NOT NULL, );
deuda_internacional int(10) DEFAULT 0 NOT NULL,
inserted_at timestamp DEFAULT current_timestamp() NOT NULL,
cliente int(10) NOT NULL,
PRIMARY KEY (id)) CHARACTER SET UTF8;
CREATE TABLE tarjeta_debito (
id int(10) NOT NULL AUTO_INCREMENT,
saldo int(10) DEFAULT 0 NOT NULL,
inserted_at timestamp DEFAULT current_timestamp() NOT NULL,
cliente int(10) NOT NULL,
PRIMARY KEY (id)) CHARACTER SET UTF8;
CREATE TABLE cuenta_corriente (
id int(10) NOT NULL AUTO_INCREMENT,
saldo int(10) DEFAULT 0 NOT NULL,
inserted_at timestamp DEFAULT current_timestamp() NOT NULL,
cliente int(10) NOT NULL,
PRIMARY KEY (id)) CHARACTER SET UTF8;
CREATE TABLE compra_tarjeta_credito ( CREATE TABLE compra_tarjeta_credito (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL, monto int(10) NOT NULL,
comentario varchar(255), comentario varchar(255),
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, tipo varchar(255),
tarjeta_credito int(10), tarjeta_credito int(10),
PRIMARY KEY (id)) CHARACTER SET UTF8; inserted_at timestamp DEFAULT current_timestamp(),
foreign key (tarjeta_credito) references tarjeta_credito (id) ON DELETE SET NULL
);
CREATE TABLE pago_tarjeta_credito (
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL,
comentario varchar(255),
tipo varchar(255),
tarjeta_credito int(10),
inserted_at timestamp DEFAULT current_timestamp(),
foreign key (tarjeta_credito) references tarjeta_credito (id) ON DELETE SET NULL
);
CREATE TABLE giro_cuenta_corriente ( CREATE TABLE giro_cuenta_corriente (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL, monto int(10) NOT NULL,
comentario varchar(255), comentario varchar(255),
metodo int(10),
cuenta_corriente int(10), cuenta_corriente int(10),
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, metodo int(10) NOT NULL,
PRIMARY KEY (id)) CHARACTER SET UTF8; inserted_at timestamp DEFAULT current_timestamp(),
foreign key (metodo) references metodo (id),
foreign key (cuenta_corriente) references cuenta_corriente (id) ON DELETE SET NULL
);
CREATE TABLE deposito_cuenta_corriente ( CREATE TABLE deposito_cuenta_corriente (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL, monto int(10) NOT NULL,
comentario varchar(255), comentario varchar(255),
metodo int(10), metodo int(10) NOT NULL,
cuenta_corriente int(10), cuenta_corriente int(10),
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, inserted_at timestamp DEFAULT current_timestamp(),
PRIMARY KEY (id)) CHARACTER SET UTF8; foreign key (metodo) references metodo (id),
foreign key (cuenta_corriente) references cuenta_corriente (id) ON DELETE SET NULL
);
CREATE TABLE transferencia_cuenta_corriente ( CREATE TABLE transferencia_cuenta_corriente (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL, monto int(10) NOT NULL,
comentario varchar(255), comentario varchar(255),
cuenta_corriente_to int(10), cuenta_corriente_to int(10),
cuenta_corriente_from int(10), cuenta_corriente_from int(10),
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, inserted_at timestamp DEFAULT current_timestamp(),
PRIMARY KEY (id)) CHARACTER SET UTF8; foreign key (cuenta_corriente_to) references cuenta_corriente (id) ON DELETE SET NULL,
CREATE TABLE metodo ( foreign key (cuenta_corriente_from) references cuenta_corriente (id) ON DELETE SET NULL
id int(10) NOT NULL AUTO_INCREMENT, );
nombre varchar(255) NOT NULL,
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, CREATE TABLE deposito_tarjeta_debito (
PRIMARY KEY (id)) CHARACTER SET UTF8; id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL,
comentario varchar(255),
metodo int(10) NOT NULL,
tarjeta_debito int(10),
inserted_at timestamp DEFAULT current_timestamp(),
foreign key (metodo) references metodo (id),
foreign key (tarjeta_debito) references tarjeta_debito (id) ON DELETE SET NULL
);
CREATE TABLE giro_tarjeta_debito (
id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL,
comentario varchar(255),
metodo int(10) NOT NULL,
tarjeta_debito int(10),
inserted_at timestamp DEFAULT current_timestamp(),
foreign key (metodo) references metodo (id),
foreign key (tarjeta_debito) references tarjeta_debito (id) ON DELETE SET NULL
);
CREATE TABLE transferencia_tarjeta_debito ( CREATE TABLE transferencia_tarjeta_debito (
id int(10) NOT NULL AUTO_INCREMENT, id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
monto int(10) NOT NULL, monto int(10) NOT NULL,
comentario varchar(255), comentario varchar(255),
tarjeta_debito_to int(10), tarjeta_debito_to int(10),
tarjeta_debito_from int(10), tarjeta_debito_from int(10),
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, inserted_at timestamp DEFAULT current_timestamp(),
PRIMARY KEY (id)) CHARACTER SET UTF8; foreign key (tarjeta_debito_to) references tarjeta_debito (id) ON DELETE SET NULL,
CREATE TABLE deposito_tarjeta_debito ( foreign key (tarjeta_debito_from) references tarjeta_debito (id) ON DELETE SET NULL
id int(10) NOT NULL AUTO_INCREMENT, );
monto int(10) NOT NULL,
comentario varchar(255), CREATE TABLE compra_tarjeta_debito (
metodo int(10), id int(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
tarjeta_debito int(10), monto int(10) NOT NULL,
inserted_at timestamp DEFAULT current_timestamp() NOT NULL, comentario varchar(255),
PRIMARY KEY (id)) CHARACTER SET UTF8; tarjeta_debito int(10),
CREATE TABLE giro_tarjeta_debito ( inserted_at timestamp DEFAULT current_timestamp(),
id int(10) NOT NULL AUTO_INCREMENT, foreign key (tarjeta_debito) references tarjeta_debito (id) ON DELETE SET NULL
monto int(10) NOT NULL, );
comentario varchar(255),
metodo int(10), INSERT INTO usuario(id, nombre, password, salt, rol, inserted_at) VALUES
tarjeta_debito int(10), (1, 'ryuuji', 0xEC65288218545FB29831D2025CEE99704C900B4B8E0B7DB35A610E2D1673BF35, 0x6260AD9369D01E48EC34F0315FAD3565, 'Admin', current_timestamp());
inserted_at timestamp DEFAULT current_timestamp() NOT NULL,
PRIMARY KEY (id)) CHARACTER SET UTF8; INSERT INTO metodo (id, nombre) VALUES
CREATE TABLE pago_tarjeta_credito ( (1, 'Cheque'),
id int(10) NOT NULL AUTO_INCREMENT, (2, 'Vale Vista'),
monto int(10) NOT NULL, (3, 'Efectivo'),
comentario varchar(255), (4, 'Caja');
inserted_at timestamp DEFAULT current_timestamp() NOT NULL,
tarjeta_credito int(10),
PRIMARY KEY (id)) CHARACTER SET UTF8;
CREATE TABLE compra_tarjeta_debito (
id int(10) NOT NULL AUTO_INCREMENT,
monto int(10) NOT NULL,
comentario varchar(255),
tarjeta_debito int(10) NOT NULL,
inserted_at timestamp DEFAULT current_timestamp() NOT NULL,
PRIMARY KEY (id)) CHARACTER SET UTF8;
ALTER TABLE cliente ADD CONSTRAINT FKcliente571606 FOREIGN KEY (linea_sobregiro) REFERENCES linea_sobregiro (id) ON DELETE Cascade;
ALTER TABLE tarjeta_credito ADD CONSTRAINT FKtarjeta_cr81196 FOREIGN KEY (cliente) REFERENCES cliente (id) ON DELETE Cascade;
ALTER TABLE cuenta_corriente ADD CONSTRAINT FKcuenta_cor278524 FOREIGN KEY (cliente) REFERENCES cliente (id) ON DELETE Cascade;
ALTER TABLE tarjeta_debito ADD CONSTRAINT FKtarjeta_de160614 FOREIGN KEY (cliente) REFERENCES cliente (id) ON DELETE Cascade;
ALTER TABLE cliente ADD CONSTRAINT FKcliente901955 FOREIGN KEY (usuario) REFERENCES usuario (id) ON DELETE Cascade;
ALTER TABLE deposito_cuenta_corriente ADD CONSTRAINT FKdeposito_c403217 FOREIGN KEY (metodo) REFERENCES metodo (id);
ALTER TABLE giro_cuenta_corriente ADD CONSTRAINT FKgiro_cuent832803 FOREIGN KEY (metodo) REFERENCES metodo (id);
ALTER TABLE deposito_tarjeta_debito ADD CONSTRAINT FKdeposito_t164090 FOREIGN KEY (metodo) REFERENCES metodo (id);
ALTER TABLE giro_tarjeta_debito ADD CONSTRAINT FKgiro_tarje519906 FOREIGN KEY (metodo) REFERENCES metodo (id);
ALTER TABLE compra_tarjeta_credito ADD CONSTRAINT FKcompra_tar218956 FOREIGN KEY (tarjeta_credito) REFERENCES tarjeta_credito (id) ON DELETE Set null;
ALTER TABLE pago_tarjeta_credito ADD CONSTRAINT FKpago_tarje245778 FOREIGN KEY (tarjeta_credito) REFERENCES tarjeta_credito (id) ON DELETE Set null;
ALTER TABLE transferencia_cuenta_corriente ADD CONSTRAINT FKtransferen788163 FOREIGN KEY (cuenta_corriente_to) REFERENCES cuenta_corriente (id) ON DELETE Set null;
ALTER TABLE deposito_cuenta_corriente ADD CONSTRAINT FKdeposito_c722018 FOREIGN KEY (cuenta_corriente) REFERENCES cuenta_corriente (id) ON DELETE Set null;
ALTER TABLE giro_cuenta_corriente ADD CONSTRAINT FKgiro_cuent986448 FOREIGN KEY (cuenta_corriente) REFERENCES cuenta_corriente (id) ON DELETE Set null;
ALTER TABLE transferencia_tarjeta_debito ADD CONSTRAINT FKtransferen939970 FOREIGN KEY (tarjeta_debito_to) REFERENCES tarjeta_debito (id) ON DELETE Set null;
ALTER TABLE deposito_tarjeta_debito ADD CONSTRAINT FKdeposito_t747169 FOREIGN KEY (tarjeta_debito) REFERENCES tarjeta_debito (id) ON DELETE Set null;
ALTER TABLE giro_tarjeta_debito ADD CONSTRAINT FKgiro_tarje431166 FOREIGN KEY (tarjeta_debito) REFERENCES tarjeta_debito (id) ON DELETE Set null;
ALTER TABLE transferencia_cuenta_corriente ADD CONSTRAINT FKtransferen295143 FOREIGN KEY (cuenta_corriente_from) REFERENCES cuenta_corriente (id) ON DELETE Set null;
ALTER TABLE transferencia_tarjeta_debito ADD CONSTRAINT FKtransferen713576 FOREIGN KEY (tarjeta_debito_from) REFERENCES tarjeta_debito (id) ON DELETE Set null;
ALTER TABLE compra_tarjeta_debito ADD CONSTRAINT FKcompra_tar267191 FOREIGN KEY (tarjeta_debito) REFERENCES tarjeta_debito (id);
INSERT INTO usuario(id, nombre, password, salt, role, inserted_at) VALUES (1, 'ryuuji', 0xEC65288218545FB29831D2025CEE99704C900B4B8E0B7DB35A610E2D1673BF35, 0x6260AD9369D01E48EC34F0315FAD3565, 'Admin', current_timestamp());
INSERT INTO metodo(id, nombre) VALUES (1, 'Cheque');
INSERT INTO metodo(id, nombre) VALUES (2, 'Vale Vista');
INSERT INTO metodo(id, nombre) VALUES (3, 'Efectivo');
INSERT INTO metodo(id, nombre) VALUES (4, 'Caja');

BIN
bank.vpp

Binary file not shown.

View File

@@ -37,4 +37,5 @@ project.bank-war=bank-war
reference.bank-ejb.dist-ear=${project.bank-ejb}/dist/bank-ejb.jar reference.bank-ejb.dist-ear=${project.bank-ejb}/dist/bank-ejb.jar
reference.bank-war.dist-ear=${project.bank-war}/dist/bank-war.war reference.bank-war.dist-ear=${project.bank-war}/dist/bank-war.war
resource.dir=setup resource.dir=setup
run.classpath=
source.root=. source.root=.