Rev 252 | Rev 337 | 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; |
||
| 252 | espaco | 23 | private Integer quantidadeProdutosPromocaoInterna; |
| 24 | private Integer quantidadeTpuSoftNormal; |
||
| 25 | private Integer quantidadeTpuSoftCamera; |
||
| 106 | espaco | 26 | private Integer quantidadePedidos; |
| 27 | private Integer quantidadePedidosInvalidos; |
||
| 28 | private Integer quantidadeVendas; |
||
| 29 | private Integer quantidadeContagens; |
||
| 30 | private Integer quantidadeAtendimentos; |
||
| 31 | private Double percentualMetaDiaria; |
||
| 32 | private Double percentualMetaMensal; |
||
| 33 | private Double percentualMetaMensalVivo; |
||
| 333 | espaco | 34 | private Double percentualMetaTicketMedio; |
| 106 | espaco | 35 | private Double comissao; |
| 36 | private Double comissaoVivo; |
||
| 37 | |||
| 38 | public AvaliacaoFuncionario getAvaliacaoFuncionario() { |
||
| 39 | return avaliacaoFuncionario; |
||
| 40 | } |
||
| 41 | public void setAvaliacaoFuncionario(AvaliacaoFuncionario avaliacaoFuncionario) { |
||
| 42 | this.avaliacaoFuncionario = avaliacaoFuncionario; |
||
| 43 | } |
||
| 44 | |||
| 45 | public Vendedor getVendedor() { |
||
| 46 | return vendedor; |
||
| 47 | } |
||
| 48 | public void setVendedor(Vendedor vendedor) { |
||
| 49 | this.vendedor = vendedor; |
||
| 50 | } |
||
| 51 | |||
| 52 | public Funcionario getFuncionario() { |
||
| 53 | return funcionario; |
||
| 54 | } |
||
| 55 | public void setFuncionario(Funcionario funcionario) { |
||
| 56 | this.funcionario = funcionario; |
||
| 57 | } |
||
| 58 | |||
| 59 | public Double getQuantidadeBancoHoras() { |
||
| 60 | return quantidadeBancoHoras; |
||
| 61 | } |
||
| 62 | public void setQuantidadeBancoHoras(Double quantidadeBancoHoras) { |
||
| 63 | this.quantidadeBancoHoras = quantidadeBancoHoras; |
||
| 64 | } |
||
| 65 | |||
| 66 | public Double getValorTotalVendidoDoDia() { |
||
| 67 | return valorTotalVendidoDoDia; |
||
| 68 | } |
||
| 69 | public void setValorTotalVendidoDoDia(Double valorTotalVendidoDoDia) { |
||
| 70 | this.valorTotalVendidoDoDia = valorTotalVendidoDoDia; |
||
| 71 | } |
||
| 72 | |||
| 73 | public Double getValorTotalVendido() { |
||
| 74 | return valorTotalVendido; |
||
| 75 | } |
||
| 76 | public void setValorTotalVendido(Double valorTotalVendido) { |
||
| 77 | this.valorTotalVendido = valorTotalVendido; |
||
| 78 | } |
||
| 79 | |||
| 80 | public Integer getQuantidadeTotalProdutosVendidos() { |
||
| 81 | return quantidadeTotalProdutosVendidos; |
||
| 82 | } |
||
| 83 | public void setQuantidadeTotalProdutosVendidos(Integer quantidadeTotalProdutosVendidos) { |
||
| 84 | this.quantidadeTotalProdutosVendidos = quantidadeTotalProdutosVendidos; |
||
| 85 | } |
||
| 86 | |||
| 87 | public Double getValorTotalVendidoVivo() { |
||
| 88 | return valorTotalVendidoVivo; |
||
| 89 | } |
||
| 90 | public void setValorTotalVendidoVivo(Double valorTotalVendidoVivo) { |
||
| 91 | this.valorTotalVendidoVivo = valorTotalVendidoVivo; |
||
| 92 | } |
||
| 93 | |||
| 94 | public Double getValorTotalDescontos() { |
||
| 95 | return valorTotalDescontos; |
||
| 96 | } |
||
| 97 | public void setValorTotalDescontos(Double valorTotalDescontos) { |
||
| 98 | this.valorTotalDescontos = valorTotalDescontos; |
||
| 99 | } |
||
| 100 | |||
| 101 | public Double getPercentualDescontos() { |
||
| 102 | return percentualDescontos; |
||
| 103 | } |
||
| 104 | public void setPercentualDescontos(Double percentualDescontos) { |
||
| 105 | this.percentualDescontos = percentualDescontos; |
||
| 106 | } |
||
| 107 | |||
| 252 | espaco | 108 | public Integer getQuantidadeProdutosPromocaoInterna() { |
| 109 | return quantidadeProdutosPromocaoInterna; |
||
| 110 | } |
||
| 111 | public void setQuantidadeProdutosPromocaoInterna(Integer quantidadeProdutosPromocaoInterna) { |
||
| 112 | this.quantidadeProdutosPromocaoInterna = quantidadeProdutosPromocaoInterna; |
||
| 113 | } |
||
| 114 | |||
| 115 | public Integer getQuantidadeTpuSoftNormal() { |
||
| 116 | return quantidadeTpuSoftNormal; |
||
| 117 | } |
||
| 118 | public void setQuantidadeTpuSoftNormal(Integer quantidadeTpuSoftNormal) { |
||
| 119 | this.quantidadeTpuSoftNormal = quantidadeTpuSoftNormal; |
||
| 120 | } |
||
| 121 | |||
| 122 | public Integer getQuantidadeTpuSoftCamera() { |
||
| 123 | return quantidadeTpuSoftCamera; |
||
| 124 | } |
||
| 125 | public void setQuantidadeTpuSoftCamera(Integer quantidadeTpuSoftCamera) { |
||
| 126 | this.quantidadeTpuSoftCamera = quantidadeTpuSoftCamera; |
||
| 127 | } |
||
| 128 | |||
| 106 | espaco | 129 | public Integer getQuantidadePedidos() { |
| 130 | return quantidadePedidos; |
||
| 131 | } |
||
| 132 | public void setQuantidadePedidos(Integer quantidadePedidos) { |
||
| 133 | this.quantidadePedidos = quantidadePedidos; |
||
| 134 | } |
||
| 135 | |||
| 136 | public Integer getQuantidadePedidosInvalidos() { |
||
| 137 | return quantidadePedidosInvalidos; |
||
| 138 | } |
||
| 139 | public void setQuantidadePedidosInvalidos(Integer quantidadePedidosInvalidos) { |
||
| 140 | this.quantidadePedidosInvalidos = quantidadePedidosInvalidos; |
||
| 141 | } |
||
| 142 | |||
| 143 | public Integer getQuantidadeVendas() { |
||
| 144 | return quantidadeVendas; |
||
| 145 | } |
||
| 146 | public void setQuantidadeVendas(Integer quantidadeVendas) { |
||
| 147 | this.quantidadeVendas = quantidadeVendas; |
||
| 148 | } |
||
| 149 | |||
| 150 | public Integer getQuantidadeContagens() { |
||
| 151 | return quantidadeContagens; |
||
| 152 | } |
||
| 153 | public void setQuantidadeContagens(Integer quantidadeContagens) { |
||
| 154 | this.quantidadeContagens = quantidadeContagens; |
||
| 155 | } |
||
| 156 | |||
| 157 | public Integer getQuantidadeAtendimentos() { |
||
| 158 | return quantidadeAtendimentos; |
||
| 159 | } |
||
| 160 | public void setQuantidadeAtendimentos(Integer quantidadeAtendimentos) { |
||
| 161 | this.quantidadeAtendimentos = quantidadeAtendimentos; |
||
| 162 | } |
||
| 163 | |||
| 164 | public Double getPercentualMetaDiaria() { |
||
| 165 | return percentualMetaDiaria; |
||
| 166 | } |
||
| 167 | public void setPercentualMetaDiaria(Double percentualMetaDiaria) { |
||
| 168 | this.percentualMetaDiaria = percentualMetaDiaria; |
||
| 169 | } |
||
| 170 | |||
| 171 | public Double getPercentualMetaMensal() { |
||
| 172 | return percentualMetaMensal; |
||
| 173 | } |
||
| 174 | public void setPercentualMetaMensal(Double percentualMetaMensal) { |
||
| 175 | this.percentualMetaMensal = percentualMetaMensal; |
||
| 176 | } |
||
| 177 | |||
| 178 | public Double getPercentualMetaMensalVivo() { |
||
| 179 | return percentualMetaMensalVivo; |
||
| 180 | } |
||
| 181 | public void setPercentualMetaMensalVivo(Double percentualMetaMensalVivo) { |
||
| 182 | this.percentualMetaMensalVivo = percentualMetaMensalVivo; |
||
| 183 | } |
||
| 184 | |||
| 333 | espaco | 185 | public Double getPercentualMetaTicketMedio() { |
| 186 | return percentualMetaTicketMedio; |
||
| 187 | } |
||
| 188 | public void setPercentualMetaTicketMedio(Double percentualMetaTicketMedio) { |
||
| 189 | this.percentualMetaTicketMedio = percentualMetaTicketMedio; |
||
| 190 | } |
||
| 191 | |||
| 106 | espaco | 192 | public Double getComissao() { |
| 193 | return comissao; |
||
| 194 | } |
||
| 195 | public void setComissao(Double comissao) { |
||
| 196 | this.comissao = comissao; |
||
| 197 | } |
||
| 198 | |||
| 199 | public Double getComissaoVivo() { |
||
| 200 | return comissaoVivo; |
||
| 201 | } |
||
| 202 | public void setComissaoVivo(Double comissaoVivo) { |
||
| 203 | this.comissaoVivo = comissaoVivo; |
||
| 204 | } |
||
| 205 | |||
| 206 | @SuppressWarnings("deprecation") |
||
| 207 | public Double getPercentualPercorridoMesAtual() { |
||
| 208 | Integer ultimoDiaDoMes = DataUtils.getUltimoDiaDoMesAtual().getDate(); |
||
| 209 | Integer diaAtual = DataUtils.getDataAtual().getDate(); |
||
| 210 | return new Double(100*diaAtual/ultimoDiaDoMes); |
||
| 211 | } |
||
| 212 | |||
| 213 | @Override |
||
| 214 | public int compareTo(RankingVendedorDTO rankingVendedorDTO) { |
||
| 215 | return rankingVendedorDTO.getValorTotalVendido().compareTo(this.valorTotalVendido); |
||
| 216 | } |
||
| 217 | |||
| 218 | public Double getTicketMedio() { |
||
| 219 | if (VerificadorUtil.naoEstaNulo(getValorTotalVendido()) |
||
| 220 | && VerificadorUtil.naoEstaNulo(getQuantidadeVendas())) { |
||
| 221 | if (getValorTotalVendido() > 0 && getQuantidadeVendas() > 0) { |
||
| 222 | return getValorTotalVendido()/getQuantidadeVendas(); |
||
| 223 | } |
||
| 224 | } |
||
| 225 | return 0.0; |
||
| 226 | } |
||
| 227 | |||
| 228 | @Transient |
||
| 229 | public Double retornarFaixaComissao() { |
||
| 230 | if (VerificadorUtil.naoEstaNulo(getAvaliacaoFuncionario())) { |
||
| 231 | if (VerificadorUtil.naoEstaNulo(getAvaliacaoFuncionario().getPorcentagemComissao())) { |
||
| 232 | return getAvaliacaoFuncionario().getPorcentagemComissao(); |
||
| 233 | } |
||
| 234 | return getAvaliacaoFuncionario().retornarFaixaComissao(getValorTotalVendido(), getFuncionario().getTipoComissionamento()); |
||
| 235 | } |
||
| 236 | return 0.0; |
||
| 237 | } |
||
| 238 | |||
| 239 | @Transient |
||
| 240 | public String corSobreMeta() { |
||
| 241 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal())) { |
||
| 242 | if (getPercentualMetaMensal() > 0.99) return "green"; |
||
| 243 | if (getPercentualMetaMensal() > 0.74) return "orange"; |
||
| 244 | return "red"; |
||
| 245 | } |
||
| 246 | return "black"; |
||
| 247 | } |
||
| 248 | |||
| 249 | @Transient |
||
| 333 | espaco | 250 | public String corSobreMetaTicketMedio() { |
| 251 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaTicketMedio())) { |
||
| 252 | if (getPercentualMetaTicketMedio() > 0.99) return "green"; |
||
| 253 | // if (getPercentualMetaTicketMedio() > 0.74) return "orange"; |
||
| 254 | return "red"; |
||
| 255 | } |
||
| 256 | return "black"; |
||
| 257 | } |
||
| 258 | |||
| 259 | @Transient |
||
| 106 | espaco | 260 | public String corSobreMetaCorrente(Double percentualPercorridoMesAtual) { |
| 261 | if (VerificadorUtil.naoEstaNulo(getPercentualMetaMensal()) && VerificadorUtil.naoEstaNulo(percentualPercorridoMesAtual)) { |
||
| 262 | Double diferenca = getPercentualMetaMensal() - (percentualPercorridoMesAtual/100); |
||
| 263 | Double diferencaSetentaCinco = percentualPercorridoMesAtual * 25 / 100; |
||
| 264 | if (diferenca > 0.24) { |
||
| 265 | return "blue"; |
||
| 266 | } else if (diferenca > 0) { |
||
| 267 | return "green"; |
||
| 268 | } else if (diferenca > (diferencaSetentaCinco * -1 / 100)) { |
||
| 269 | return "orange"; |
||
| 270 | } else { |
||
| 271 | return "red"; |
||
| 272 | } |
||
| 273 | } |
||
| 274 | return "black"; |
||
| 275 | } |
||
| 276 | |||
| 277 | @Transient |
||
| 278 | public Boolean percentualDescontosPertoDoLimite() { |
||
| 279 | if (VerificadorUtil.naoEstaNulo(getPercentualDescontos())) { |
||
| 280 | if (getPercentualDescontos() > 0.06 && getPercentualDescontos() < 0.07) { |
||
| 281 | return true; |
||
| 282 | } |
||
| 283 | } |
||
| 284 | return false; |
||
| 285 | } |
||
| 286 | |||
| 287 | @Transient |
||
| 288 | public Boolean percentualDescontosSuperiorAoLimite() { |
||
| 289 | if (VerificadorUtil.naoEstaNulo(getPercentualDescontos())) { |
||
| 290 | if (getPercentualDescontos() > 0.07) { |
||
| 291 | return true; |
||
| 292 | } |
||
| 293 | } |
||
| 294 | return false; |
||
| 295 | } |
||
| 296 | |||
| 297 | } |