diff --git a/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java b/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java new file mode 100644 index 000000000..a5c6043bf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.constantes; + +public interface ConstantesTipoDesconto { + int DESCONTO_POR_NUMERO_DOCUMENTO = 1, + DESCONTO_POR_QUANTIDADE = 2, + TIPO_DESCONTO_NAO_INFORMADO = 0; +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/Convenio.java b/src/com/rjconsultores/ventaboletos/entidad/Convenio.java index b6dff8310..c45c1ee52 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Convenio.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Convenio.java @@ -8,6 +8,7 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.List; + import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -16,6 +17,7 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; @@ -77,6 +79,12 @@ public class Convenio implements Serializable { @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) private List convenioPuntoVentaList; + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioEmpresaList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioRutaList; + @Column(name = "FECVENTAINI") @Temporal(TemporalType.TIMESTAMP) private Date fecVentaInicial; @@ -94,9 +102,21 @@ public class Convenio implements Serializable { private Date fecViajeFinal; @Column(name = "INDDESCUENTONORMAL") - private Boolean indDescuentoNormal; + private Integer indDescuentoNormal; - public Convenio() { + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + private Cliente cliente; + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + + public Convenio() { } public Convenio(Integer convenioId) { @@ -230,6 +250,42 @@ public class Convenio implements Serializable { this.convenioPuntoVentaList = convenioPuntoVentaList; } + public List getConvenioEmpresaList() { + List tempList = new ArrayList(); + + if (convenioEmpresaList != null) { + for (ConvenioEmpresa convenioEmpresa : this.convenioEmpresaList) { + if (convenioEmpresa.getActivo()) { + tempList.add(convenioEmpresa); + } + } + } + + return tempList; + } + + public List getConvenioRutaList() { + List tempList = new ArrayList(); + + if (convenioRutaList != null) { + for (ConvenioRuta convenioRuta : this.convenioRutaList) { + if (convenioRuta.getActivo()) { + tempList.add(convenioRuta); + } + } + } + + return tempList; + } + + public void setConvenioRutaList(List convenioRutaList) { + this.convenioRutaList = convenioRutaList; + } + + public void setConvenioEmpresaList(List convenioEmpresaList) { + this.convenioEmpresaList = convenioEmpresaList; + } + public void setConvenioUsuarioList(List convenioUsuarioList) { this.convenioUsuarioList = convenioUsuarioList; } @@ -270,11 +326,11 @@ public class Convenio implements Serializable { this.fecViajeFinal = fecViajeFinal; } - public Boolean getIndDescuentoNormal() { + public Integer getIndDescuentoNormal() { return indDescuentoNormal; } - public void setIndDescuentoNormal(Boolean indDescuentoNormal) { + public void setIndDescuentoNormal(Integer indDescuentoNormal) { this.indDescuentoNormal = indDescuentoNormal; } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java index 1fe052bc3..ca90859e1 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java @@ -33,8 +33,16 @@ public class ConvenioDet implements Serializable { @Basic(optional = false) @Column(name = "CONVENIODET_ID") private Integer conveniodetId; - @Column(name = "PORCDESCUENTO") + + @Column(name = "PORCDESCUENTO") /* Refere-se ao desconto na tarifa */ private BigDecimal porcdescuento; + @Column(name = "PORCDESCUENTOTAXAEMBARQUE") + private BigDecimal porcDescuentoTaxaEmbarque; + @Column(name = "PORCDESCUENTOPEDAGIO") + private BigDecimal porcDescuentoPedagio; + @Column(name = "PORCDESCUENTOSEGURO") + private BigDecimal porcDescuentoSeguro; + @Column(name = "ACTIVO") private Boolean activo; @Column(name = "FECMODIF") @@ -46,6 +54,8 @@ public class ConvenioDet implements Serializable { private Long numfolioinicial; @Column(name = "NUMFOLIOFINAL") private Long numfoliofinal; + @Column(name = "QUANTIDADE") + private Long quantidade; public ConvenioDet() { } @@ -110,7 +120,39 @@ public class ConvenioDet implements Serializable { this.numfoliofinal = numfoliofinal; } - @Override + public BigDecimal getPorcDescuentoTaxaEmbarque() { + return porcDescuentoTaxaEmbarque; + } + + public void setPorcDescuentoTaxaEmbarque(BigDecimal porcDescuentoTaxaEmbarque) { + this.porcDescuentoTaxaEmbarque = porcDescuentoTaxaEmbarque; + } + + public BigDecimal getPorcDescuentoPedagio() { + return porcDescuentoPedagio; + } + + public void setPorcDescuentoPedagio(BigDecimal porcDescuentoPedagio) { + this.porcDescuentoPedagio = porcDescuentoPedagio; + } + + public BigDecimal getPorcDescuentoSeguro() { + return porcDescuentoSeguro; + } + + public void setPorcDescuentoSeguro(BigDecimal porcDescuentoSeguro) { + this.porcDescuentoSeguro = porcDescuentoSeguro; + } + + public Long getQuantidade() { + return quantidade; + } + + public void setQuantidade(Long quantidade) { + this.quantidade = quantidade; + } + + @Override public int hashCode() { int hash = 0; hash += (conveniodetId != null ? conveniodetId.hashCode() : 0); @@ -123,10 +165,12 @@ public class ConvenioDet implements Serializable { if (!(object instanceof ConvenioDet)) { return false; } + ConvenioDet other = (ConvenioDet) object; if ((this.conveniodetId == null && other.conveniodetId != null) || (this.conveniodetId != null && !this.conveniodetId.equals(other.conveniodetId))) { return false; } + return true; } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java new file mode 100644 index 000000000..675ce5a87 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_EMPRESA_SEQ", sequenceName="CONVENIO_EMPRESA_SEQ", allocationSize=1) +@Table(name="CONVENIO_EMPRESA") +public class ConvenioEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_EMPRESA_SEQ") + @Column(name = "CONVENIOEMPRESA_ID") + private Integer convenioEmpresaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public Integer getConvenioEmpresaId() { + return convenioEmpresaId; + } + public void setConvenioEmpresaId(Integer convenioEmpresaId) { + this.convenioEmpresaId = convenioEmpresaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Convenio getConvenio() { + return convenio; + } + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioEmpresaId != null ? convenioEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioEmpresa)) { + return false; + } + ConvenioEmpresa other = (ConvenioEmpresa) object; + if ((this.convenioEmpresaId == null && other.convenioEmpresaId != null) || (this.convenioEmpresaId != null && !this.convenioEmpresaId.equals(other.convenioEmpresaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioEmpresa[convenioEmpresaId=" + convenioEmpresaId + "]"; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java new file mode 100644 index 000000000..5a93bc136 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_RUTA_SEQ", sequenceName="CONVENIO_RUTA_SEQ", allocationSize=1) +@Table(name="CONVENIO_RUTA") +public class ConvenioRuta implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_RUTA_SEQ") + @Column(name = "CONVENIORUTA_ID") + private Integer convenioRutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + public Integer getConvenioRutaId() { + return convenioRutaId; + } + public void setConvenioRutaId(Integer convenioRutaId) { + this.convenioRutaId = convenioRutaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Convenio getConvenio() { + return convenio; + } + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioRutaId != null ? convenioRutaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioRuta)) { + return false; + } + ConvenioRuta other = (ConvenioRuta) object; + if ((this.convenioRutaId == null && other.convenioRutaId != null) || (this.convenioRutaId != null && !this.convenioRutaId.equals(other.convenioRutaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioRuta[convenioRutaId=" + convenioRutaId + "]"; + } +} \ No newline at end of file