Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | package br.com.ec.domain.dto; |
| 2 | |||
| 3 | import java.beans.Transient; |
||
| 4 | |||
| 5 | import br.com.ec.domain.model.AvaliacaoFuncionario; |
||
| 6 | import br.com.ec.domain.model.Funcionario; |
||
| 7 | import br.com.ec.domain.model.Vendedor; |
||
| 8 | import br.edu.cesmac.core.util.DataUtils; |
||
| 9 | import br.edu.cesmac.core.util.VerificadorUtil; |
||
| 10 | |||
| 11 | public class RankingVendedorDTO implements Comparable<RankingVendedorDTO> { |
||
| 12 | |||
| 13 | private AvaliacaoFuncionario avaliacaoFuncionario; |
||
| 14 | private Vendedor vendedor; |
||
| 15 | private Funcionario funcionario; |
||
| 16 | private Double quantidadeBancoHoras; |
||
| 17 | private Double valorTotalVendidoDoDia; |
||
| 18 | private Double valorTotalVendido; |
||
| 19 | private Integer quantidadeTotalProdutosVendidos; |
||
| 20 | private Double valorTotalVendidoVivo; |
||
| 21 | private Double valorTotalDescontos; |
||
| 22 | private Double percentualDescontos; |
||
| 23 | private Integer quantidadePedidos; |
||
| 24 | private Integer quantidadeVendas; |
||
| 25 | private Integer quantidadeContagens; |
||
| 26 | private Integer quantidadeAtendimentos; |
||
| 27 | private Double percentualMetaDiaria; |
||
| 28 | private Double percentualMetaMensal; |
||
| 29 | private Double percentualMetaMensalVivo; |
||
| 30 | private Double comissao; |
||
| 31 | private Double comissaoVivo; |
||
| 32 | |||
| 33 | public AvaliacaoFuncionario getAvaliacaoFuncionario() { |
||
| 34 | return avaliacaoFuncionario; |
||
| 35 | } |
||
| 36 | public void setAvaliacaoFuncionario(AvaliacaoFuncionario avaliacaoFuncionario) { |
||
| 37 | this.avaliacaoFuncionario = avaliacaoFuncionario; |
||
| 38 | } |
||
| 39 | |||
| 40 | public Vendedor getVendedor() { |
||
| 41 | return vendedor; |
||
| 42 | } |
||
| 43 | public void setVendedor(Vendedor vendedor) { |
||
| 44 | this.vendedor = vendedor; |
||
| 45 | } |
||
| 46 | |||
| 47 | public Funcionario getFuncionario() { |
||
| 48 | return funcionario; |
||
| 49 | } |
||
| 50 | public void setFuncionario(Funcionario funcionario) { |
||
| 51 | this.funcionario = funcionario; |
||
| 52 | } |
||
| 53 | |||
| 54 | public Double getQuantidadeBancoHoras() { |
||
| 55 | return quantidadeBancoHoras; |
||
| 56 | } |
||
| 57 | public void setQuantidadeBancoHoras(Double quantidadeBancoHoras) { |
||
| 58 | this.quantidadeBancoHoras = quantidadeBancoHoras; |
||
| 59 | } |
||
| 60 | |||
| 61 | public Double getValorTotalVendidoDoDia() { |
||
| 62 | return valorTotalVendidoDoDia; |
||
| 63 | } |
||
| 64 | public void setValorTotalVendidoDoDia(Double valorTotalVendidoDoDia) { |
||
| 65 | this.valorTotalVendidoDoDia = valorTotalVendidoDoDia; |
||
| 66 | } |
||
| 67 | |||
| 68 | public Double getValorTotalVendido() { |
||
| 69 | return valorTotalVendido; |
||
| 70 | } |
||
| 71 | public void setValorTotalVendido(Double valorTotalVendido) { |
||
| 72 | this.valorTotalVendido = valorTotalVendido; |
||
| 73 | } |
||
| 74 | |||
| 75 | public Integer getQuantidadeTotalProdutosVendidos() { |
||
| 76 | return quantidadeTotalProdutosVendidos; |
||
| 77 | } |
||
| 78 | public void setQuantidadeTotalProdutosVendidos(Integer quantidadeTotalProdutosVendidos) { |
||
| 79 | this.quantidadeTotalProdutosVendidos = quantidadeTotalProdutosVendidos; |
||
| 80 | } |
||
| 81 | |||
| 82 | public Double getValorTotalVendidoVivo() { |
||
| 83 | return valorTotalVendidoVivo; |
||
| 84 | } |
||
| 85 | public void setValorTotalVendidoVivo(Double valorTotalVendidoVivo) { |
||
| 86 | this.valorTotalVendidoVivo = valorTotalVendidoVivo; |
||
| 87 | } |
||
| 88 | |||
| 89 | public Double getValorTotalDescontos() { |
||
| 90 | return valorTotalDescontos; |
||
| 91 | } |
||
| 92 | public void setValorTotalDescontos(Double valorTotalDescontos) { |
||
| 93 | this.valorTotalDescontos = valorTotalDescontos; |
||
| 94 | } |
||
| 95 | |||
| 96 | public Double getPercentualDescontos() { |
||
| 97 | return percentualDescontos; |
||
| 98 | } |
||
| 99 | public void setPercentualDescontos(Double percentualDescontos) { |
||
| 100 | this.percentualDescontos = percentualDescontos; |
||
| 101 | } |
||
| 102 | |||
| 103 | public Integer getQuantidadePedidos() { |
||
| 104 | return quantidadePedidos; |
||
| 105 | } |
||
| 106 | public void setQuantidadePedidos(Integer quantidadePedidos) { |
||
| 107 | this.quantidadePedidos = quantidadePedidos; |
||
| 108 | } |
||
| 109 | |||
| 110 | public Integer getQuantidadeVendas() { |
||
| 111 | return quantidadeVendas; |
||
| 112 | } |
||
| 113 | public void setQuantidadeVendas(Integer quantidadeVendas) { |
||
| 114 | this.quantidadeVendas = quantidadeVendas; |
||
| 115 | } |
||
| 116 | |||
| 117 | public Integer getQuantidadeContagens() { |
||
| 118 | return quantidadeContagens; |
||
| 119 | } |
||
| 120 | public void setQuantidadeContagens(Integer quantidadeContagens) { |
||
| 121 | this.quantidadeContagens = quantidadeContagens; |
||
| 122 | } |
||
| 123 | |||
| 124 | public Integer getQuantidadeAtendimentos() { |
||
| 125 | return quantidadeAtendimentos; |
||
| 126 | } |
||
| 127 | public void setQuantidadeAtendimentos(Integer quantidadeAtendimentos) { |
||
| 128 | this.quantidadeAtendimentos = quantidadeAtendimentos; |
||
| 129 | } |
||
| 130 | |||
| 131 | public Double getPercentualMetaDiaria() { |
||
| 132 | return percentualMetaDiaria; |
||
| 133 | } |
||
| 134 | public void setPercentualMetaDiaria(Double percentualMetaDiaria) { |
||
| 135 | this.percentualMetaDiaria = percentualMetaDiaria; |
||
| 136 | } |
||
| 137 | |||
| 138 | public Double getPercentualMetaMensal() { |
||
| 139 | return percentualMetaMensal; |
||
| 140 | } |
||
| 141 | public void setPercentualMetaMensal(Double percentualMetaMensal) { |
||
| 142 | this.percentualMetaMensal = percentualMetaMensal; |
||
| 143 | } |
||
| 144 | |||
| 145 | public Double getPercentualMetaMensalVivo() { |
||
| 146 | return percentualMetaMensalVivo; |
||
| 147 | } |
||
| 148 | public void setPercentualMetaMensalVivo(Double percentualMetaMensalVivo) { |
||
| 149 | this.percentualMetaMensalVivo = percentualMetaMensalVivo; |
||
| 150 | } |
||
| 151 | |||
| 152 | public Double getComissao() { |
||
| 153 | return comissao; |
||
| 154 | } |
||
| 155 | public void setComissao(Double comissao) { |
||
| 156 | this.comissao = comissao; |
||
| 157 | } |
||
| 158 | |||
| 159 | public Double getComissaoVivo() { |
||
| 160 | return comissaoVivo; |
||
| 161 | } |
||
| 162 | public void setComissaoVivo(Double comissaoVivo) { |
||
| 163 | this.comissaoVivo = comissaoVivo; |
||
| 164 | } |
||
| 165 | |||
| 166 | @SuppressWarnings("deprecation") |
||
| 167 | public Double getPercentualPercorridoMesAtual() { |
||
| 168 | Integer ultimoDiaDoMes = DataUtils.getUltimoDiaDoMesAtual().getDate(); |
||
| 169 | Integer diaAtual = DataUtils.getDataAtual().getDate(); |
||
| 170 | return new Double(100*diaAtual/ultimoDiaDoMes); |
||
| 171 | } |
||
| 172 | |||
| 173 | @Override |
||
| 174 | public int compareTo(RankingVendedorDTO rankingVendedorDTO) { |
||
| 175 | return rankingVendedorDTO.getValorTotalVendido().compareTo(this.valorTotalVendido); |
||
| 176 | } |
||
| 177 | |||
| 178 | public Double getTicketMedio() { |
||
| 179 | if (VerificadorUtil.naoEstaNulo(getValorTotalVendido()) |
||
| 180 | && VerificadorUtil.naoEstaNulo(getQuantidadeVendas())) { |
||
| 181 | if (getValorTotalVendido() > 0 && getQuantidadeVendas() > 0) { |
||
| 182 | return getValorTotalVendido()/getQuantidadeVendas(); |
||
| 183 | } |
||
| 184 | } |
||
| 185 | return 0.0; |
||
| 186 | } |
||
| 187 | |||
| 188 | @Transient |
||
| 189 | public Double retornarFaixaComissao() { |
||
| 190 | if (VerificadorUtil.naoEstaNulo(getAvaliacaoFuncionario())) { |
||
| 191 | if (VerificadorUtil.naoEstaNulo(getAvaliacaoFuncionario().getPorcentagemComissao())) { |
||
| 192 | return getAvaliacaoFuncionario().getPorcentagemComissao(); |
||
| 193 | } |
||
| 194 | return getAvaliacaoFuncionario().retornarFaixaComissao(getValorTotalVendido(), getFuncionario().getTipoComissionamento()); |
||
| 195 | } |
||
| 196 | return 0.0; |
||
| 197 | } |
||
| 198 | |||
| 199 | @Transient |
||
| 200 | public String corSobreMeta() { |
||
| 201 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal())) { |
||
| 202 | if (getPercentualMetaMensal() > 0.99) return "green"; |
||
| 203 | if (getPercentualMetaMensal() > 0.74) return "orange"; |
||
| 204 | return "red"; |
||
| 205 | } |
||
| 206 | return "black"; |
||
| 207 | } |
||
| 208 | |||
| 209 | @Transient |
||
| 210 | public String corSobreMetaCorrente(Double percentualPercorridoMesAtual) { |
||
| 211 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal()) && VerificadorUtil.naoEstaNulo(percentualPercorridoMesAtual)) { |
||
| 212 | Double diferenca = getPercentualMetaMensal() - (percentualPercorridoMesAtual/100); |
||
| 213 | Double diferencaSetentaCinco = percentualPercorridoMesAtual * 25 / 100; |
||
| 214 | if (diferenca > 0.24) { |
||
| 215 | return "blue"; |
||
| 216 | } else if (diferenca > 0) { |
||
| 217 | return "green"; |
||
| 218 | } else if (diferenca > (diferencaSetentaCinco * -1 / 100)) { |
||
| 219 | return "orange"; |
||
| 220 | } else { |
||
| 221 | return "red"; |
||
| 222 | } |
||
| 223 | } |
||
| 224 | return "black"; |
||
| 225 | } |
||
| 226 | |||
| 227 | @Transient |
||
| 228 | public Boolean percentualDescontosPertoDoLimite() { |
||
| 229 | if (VerificadorUtil.naoEstaNulo(getPercentualDescontos())) { |
||
| 230 | if (getPercentualDescontos() > 0.06 && getPercentualDescontos() < 0.07) { |
||
| 231 | return true; |
||
| 232 | } |
||
| 233 | } |
||
| 234 | return false; |
||
| 235 | } |
||
| 236 | |||
| 237 | @Transient |
||
| 238 | public Boolean percentualDescontosSuperiorAoLimite() { |
||
| 239 | if (VerificadorUtil.naoEstaNulo(getPercentualDescontos())) { |
||
| 240 | if (getPercentualDescontos() > 0.07) { |
||
| 241 | return true; |
||
| 242 | } |
||
| 243 | } |
||
| 244 | return false; |
||
| 245 | } |
||
| 246 | |||
| 247 | } |