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