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