Rev 267 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 261 | espaco | 1 | package br.com.ec.controller; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 264 | espaco | 4 | import java.util.List; |
| 261 | espaco | 5 | |
| 6 | import javax.inject.Inject; |
||
| 7 | import javax.inject.Named; |
||
| 8 | |||
| 9 | import org.springframework.context.annotation.Scope; |
||
| 10 | |||
| 11 | import br.com.ec.core.generic.GenericService; |
||
| 268 | espaco | 12 | import br.com.ec.core.util.VerificadorUtil; |
| 264 | espaco | 13 | import br.com.ec.domain.dto.FormaPagamentoDTO; |
| 261 | espaco | 14 | import br.com.ec.domain.dto.consulta.ParametrosConsultaVendasDTO; |
| 15 | import br.com.ec.domain.dto.consulta.ParametrosPeriodoDTO; |
||
| 16 | import br.com.ec.domain.dto.grafico.GraficoBarraDTO; |
||
| 267 | espaco | 17 | import br.com.ec.domain.dto.grafico.GraficoPizzaDTO; |
| 261 | espaco | 18 | import br.com.ec.domain.model.tipos.TipoProduto; |
| 19 | import br.com.ec.domain.service.GraficoService; |
||
| 20 | import br.com.ec.domain.service.VendaService; |
||
| 21 | import br.com.ec.web.generic.AbstractBean; |
||
| 22 | |||
| 23 | @Named |
||
| 24 | @Scope("view") |
||
| 25 | public class RelatorioVendasBean extends AbstractBean<ParametrosConsultaVendasDTO> implements Serializable { |
||
| 26 | |||
| 27 | private static final long serialVersionUID = 1L; |
||
| 28 | |||
| 29 | /* |
||
| 30 | private List<FuncionarioDTO> listaFuncionariosDTO; |
||
| 31 | private Long sequencialFuncionarioSelecionado; |
||
| 32 | private FuncionarioDTO funcionarioSelecionado; |
||
| 33 | |||
| 34 | private FuncionarioService funcionarioService; |
||
| 35 | */ |
||
| 36 | private ParametrosPeriodoDTO parametrosPeriodoDTO; |
||
| 37 | private Boolean graficoConsultado; |
||
| 38 | |||
| 39 | private GraficoBarraDTO graficoVendas; |
||
| 268 | espaco | 40 | private GraficoBarraDTO graficoPercentuaisMeta; |
| 41 | |||
| 267 | espaco | 42 | private GraficoPizzaDTO graficoVendasPorFormasDePagamento; |
| 261 | espaco | 43 | |
| 267 | espaco | 44 | private Boolean comparativo; |
| 45 | private ParametrosConsultaVendasDTO parametrosConsultaComparativo; |
||
| 46 | private GraficoBarraDTO graficoVendasComparativo; |
||
| 47 | |||
| 261 | espaco | 48 | private VendaService vendaService; |
| 49 | private GraficoService graficoService; |
||
| 50 | |||
| 51 | @Inject |
||
| 52 | public RelatorioVendasBean(VendaService vendaService, GraficoService graficoService) { |
||
| 53 | this.vendaService = vendaService; |
||
| 54 | this.graficoService = graficoService; |
||
| 55 | } |
||
| 56 | |||
| 57 | @Override |
||
| 58 | public GenericService<ParametrosConsultaVendasDTO> getService() { |
||
| 59 | return null; |
||
| 60 | } |
||
| 61 | |||
| 62 | @Override |
||
| 63 | public ParametrosConsultaVendasDTO getId() { |
||
| 64 | return null; |
||
| 65 | } |
||
| 66 | |||
| 67 | @Override |
||
| 68 | public void preCarregamento() { |
||
| 69 | limparEntidade(); |
||
| 70 | } |
||
| 71 | |||
| 72 | @Override |
||
| 73 | public void limparEntidade() { |
||
| 74 | setEntidade(new ParametrosConsultaVendasDTO()); |
||
| 75 | setGraficoConsultado(false); |
||
| 267 | espaco | 76 | setComparativo(false); |
| 77 | setParametrosConsultaComparativo(new ParametrosConsultaVendasDTO()); |
||
| 261 | espaco | 78 | } |
| 79 | |||
| 80 | public ParametrosPeriodoDTO getParametrosPeriodoDTO() { |
||
| 81 | return parametrosPeriodoDTO; |
||
| 82 | } |
||
| 83 | public void setParametrosPeriodoDTO(ParametrosPeriodoDTO parametrosPeriodoDTO) { |
||
| 84 | this.parametrosPeriodoDTO = parametrosPeriodoDTO; |
||
| 85 | } |
||
| 86 | |||
| 87 | public TipoProduto[] getTiposProduto() { |
||
| 88 | return TipoProduto.values(); |
||
| 89 | } |
||
| 90 | |||
| 91 | public Boolean getGraficoConsultado() { |
||
| 92 | return graficoConsultado; |
||
| 93 | } |
||
| 94 | public void setGraficoConsultado(Boolean graficoConsultado) { |
||
| 95 | this.graficoConsultado = graficoConsultado; |
||
| 96 | } |
||
| 97 | |||
| 98 | public GraficoBarraDTO getGraficoVendas() { |
||
| 99 | return graficoVendas; |
||
| 100 | } |
||
| 101 | public void setGraficoVendas(GraficoBarraDTO graficoVendas) { |
||
| 102 | this.graficoVendas = graficoVendas; |
||
| 103 | } |
||
| 104 | |||
| 268 | espaco | 105 | public GraficoBarraDTO getGraficoPercentuaisMeta() { |
| 106 | return graficoPercentuaisMeta; |
||
| 107 | } |
||
| 108 | public void setGraficoPercentuaisMeta(GraficoBarraDTO graficoPercentuaisMeta) { |
||
| 109 | this.graficoPercentuaisMeta = graficoPercentuaisMeta; |
||
| 110 | } |
||
| 111 | |||
| 267 | espaco | 112 | public GraficoPizzaDTO getGraficoVendasPorFormasDePagamento() { |
| 113 | return graficoVendasPorFormasDePagamento; |
||
| 114 | } |
||
| 115 | public void setGraficoVendasPorFormasDePagamento(GraficoPizzaDTO graficoVendasPorFormasDePagamento) { |
||
| 116 | this.graficoVendasPorFormasDePagamento = graficoVendasPorFormasDePagamento; |
||
| 117 | } |
||
| 118 | |||
| 119 | public Boolean getComparativo() { |
||
| 120 | return comparativo; |
||
| 121 | } |
||
| 122 | public void setComparativo(Boolean comparativo) { |
||
| 123 | this.comparativo = comparativo; |
||
| 124 | } |
||
| 125 | |||
| 126 | public ParametrosConsultaVendasDTO getParametrosConsultaComparativo() { |
||
| 127 | return parametrosConsultaComparativo; |
||
| 128 | } |
||
| 129 | public void setParametrosConsultaComparativo(ParametrosConsultaVendasDTO parametrosConsultaComparativo) { |
||
| 130 | this.parametrosConsultaComparativo = parametrosConsultaComparativo; |
||
| 131 | } |
||
| 132 | |||
| 133 | public GraficoBarraDTO getGraficoVendasComparativo() { |
||
| 134 | return graficoVendasComparativo; |
||
| 135 | } |
||
| 136 | public void setGraficoVendasComparativo(GraficoBarraDTO graficoVendasComparativo) { |
||
| 137 | this.graficoVendasComparativo = graficoVendasComparativo; |
||
| 138 | } |
||
| 139 | |||
| 261 | espaco | 140 | /**********************************/ |
| 141 | |||
| 264 | espaco | 142 | public List<FormaPagamentoDTO> getFormasDePagamentoDTO() { |
| 143 | return FormaPagamentoDTO.formasDePagamentoSemCupom(); |
||
| 144 | } |
||
| 145 | |||
| 261 | espaco | 146 | public void gerarGraficos() { |
| 147 | setGraficoConsultado(true); |
||
| 148 | setGraficoVendas(new GraficoBarraDTO(getEntidade())); |
||
| 267 | espaco | 149 | if (getComparativo()) { |
| 150 | setGraficoVendas(graficoService.gerarGraficoVendas(getGraficoVendas().getParametrosConsulta(), getParametrosConsultaComparativo())); |
||
| 151 | } else { |
||
| 152 | setGraficoVendas(graficoService.gerarGraficoVendas(getGraficoVendas().getParametrosConsulta(), null)); |
||
| 153 | } |
||
| 268 | espaco | 154 | |
| 155 | if (VerificadorUtil.naoEstaNulo(getEntidade().getVendedorSelecionado())) { |
||
| 156 | setGraficoPercentuaisMeta(graficoService.gerarGraficoPercentuaisMeta(getEntidade())); |
||
| 157 | } else { |
||
| 158 | setGraficoPercentuaisMeta(null); |
||
| 159 | } |
||
| 160 | |||
| 267 | espaco | 161 | // setGraficoVendasPorFormasDePagamento(graficoService.gerarGraficoVendasPorFormasDePagamento(getGraficoVendas().getParametrosConsulta())); |
| 261 | espaco | 162 | /* |
| 163 | BarChartModel graficoComparativoCustosLucro = funcionarioService.consultarGraficoComparativoCustosLucro(getFuncionarioSelecionado().getSequencialFuncionario(), getParametrosPeriodoDTO()); |
||
| 164 | getFuncionarioSelecionado().setGraficoComparativoCustosLucro(graficoComparativoCustosLucro); |
||
| 165 | |||
| 166 | PieChartModel graficoTiposProdutos = funcionarioService.consultarGraficoTiposProdutos(getFuncionarioSelecionado().getSequencialFuncionario(), getParametrosPeriodoDTO(), Arrays.asList(getTiposProduto())); |
||
| 167 | getFuncionarioSelecionado().setGraficoTiposProdutos(graficoTiposProdutos); |
||
| 168 | |||
| 169 | PieChartModel graficoFormasPagamento = funcionarioService.consultarGraficoFormasPagamento(getFuncionarioSelecionado().getSequencialFuncionario(), getParametrosPeriodoDTO()); |
||
| 170 | getFuncionarioSelecionado().setGraficoFormasPagamento(graficoFormasPagamento); |
||
| 171 | */ |
||
| 172 | } |
||
| 173 | |||
| 174 | } |