Rev 112 | Rev 159 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 112 | Rev 114 | ||
|---|---|---|---|
| Line 14... | Line 14... | ||
| 14 | import br.com.ec.domain.dto.FluxoDeCaixaCategoriaDTO; |
14 | import br.com.ec.domain.dto.FluxoDeCaixaCategoriaDTO; |
| 15 | import br.com.ec.domain.dto.FluxoDeCaixaDTO; |
15 | import br.com.ec.domain.dto.FluxoDeCaixaDTO; |
| 16 | import br.com.ec.domain.dto.ParametrosConsultaLancamentosDTO; |
16 | import br.com.ec.domain.dto.ParametrosConsultaLancamentosDTO; |
| 17 | import br.com.ec.domain.dto.ProvisaoCaixaDTO; |
17 | import br.com.ec.domain.dto.ProvisaoCaixaDTO; |
| 18 | import br.com.ec.domain.model.Categoria; |
18 | import br.com.ec.domain.model.Categoria; |
| - | 19 | import br.com.ec.domain.model.Orcamento; |
|
| 19 | import br.com.ec.domain.model.Parcela; |
20 | import br.com.ec.domain.model.Parcela; |
| 20 | import br.com.ec.domain.model.tipos.TipoCategoria; |
21 | import br.com.ec.domain.model.tipos.TipoCategoria; |
| 21 | import br.com.ec.domain.service.acompanhamento.AcompanhamentoService; |
22 | import br.com.ec.domain.service.acompanhamento.AcompanhamentoService; |
| - | 23 | import br.com.ec.domain.service.orcamento.OrcamentoService; |
|
| 22 | import br.com.ec.domain.service.parcela.ParcelaService; |
24 | import br.com.ec.domain.service.parcela.ParcelaService; |
| 23 | import br.edu.cesmac.core.generic.GenericService; |
25 | import br.edu.cesmac.core.generic.GenericService; |
| 24 | import br.edu.cesmac.core.util.DataUtils; |
26 | import br.edu.cesmac.core.util.DataUtils; |
| 25 | import br.edu.cesmac.core.util.VerificadorUtil; |
27 | import br.edu.cesmac.core.util.VerificadorUtil; |
| - | 28 | import br.edu.cesmac.web.exception.VerificadorLancamentoException; |
|
| - | 29 | import br.edu.cesmac.web.exception.VerificadorLancamentoException.CommandBean; |
|
| 26 | import br.edu.cesmac.web.generic.AbstractBean; |
30 | import br.edu.cesmac.web.generic.AbstractBean; |
| - | 31 | import br.edu.cesmac.web.message.LancadorMensagem; |
|
| 27 | 32 | ||
| 28 | @Named |
33 | @Named |
| 29 | @Scope("view") |
34 | @Scope("view") |
| 30 | public class FluxoDeCaixaBean extends AbstractBean<ConsolidadoGestaoDTO> implements Serializable { |
35 | public class FluxoDeCaixaBean extends AbstractBean<ConsolidadoGestaoDTO> implements Serializable { |
| 31 | 36 | ||
| Line 36... | Line 41... | ||
| 36 | private List<FluxoDeCaixaCategoriaDTO> despesas; |
41 | private List<FluxoDeCaixaCategoriaDTO> despesas; |
| 37 | 42 | ||
| 38 | private List<Parcela> parcelas; |
43 | private List<Parcela> parcelas; |
| 39 | private LineChartModel graficoCaixa; |
44 | private LineChartModel graficoCaixa; |
| 40 | private List<DetalhamentoCaixaDTO> provisaoDetalhamentoCaixa; |
45 | private List<DetalhamentoCaixaDTO> provisaoDetalhamentoCaixa; |
| - | 46 | private Orcamento orcamento; |
|
| 41 | 47 | ||
| 42 | private AcompanhamentoService acompanhamentoService; |
48 | private AcompanhamentoService acompanhamentoService; |
| 43 | private ParcelaService parcelaService; |
49 | private ParcelaService parcelaService; |
| - | 50 | private OrcamentoService orcamentoService; |
|
| 44 | 51 | ||
| 45 | @Inject |
52 | @Inject |
| 46 | public FluxoDeCaixaBean(AcompanhamentoService acompanhamentoService, ParcelaService parcelaService) { |
- | |
| - | 53 | public FluxoDeCaixaBean(AcompanhamentoService acompanhamentoService, ParcelaService parcelaService, OrcamentoService orcamentoService) { |
|
| 47 | this.acompanhamentoService = acompanhamentoService; |
54 | this.acompanhamentoService = acompanhamentoService; |
| 48 | this.parcelaService = parcelaService; |
55 | this.parcelaService = parcelaService; |
| - | 56 | this.orcamentoService = orcamentoService; |
|
| 49 | }
|
57 | }
|
| 50 | 58 | ||
| 51 | @Override |
59 | @Override |
| 52 | public void limparEntidade() { |
60 | public void limparEntidade() { |
| 53 | setEntidade(new ConsolidadoGestaoDTO()); |
61 | setEntidade(new ConsolidadoGestaoDTO()); |
| Line 115... | Line 123... | ||
| 115 | public List<DetalhamentoCaixaDTO> getProvisaoDetalhamentoCaixa() { |
123 | public List<DetalhamentoCaixaDTO> getProvisaoDetalhamentoCaixa() { |
| 116 | return provisaoDetalhamentoCaixa; |
124 | return provisaoDetalhamentoCaixa; |
| 117 | }
|
125 | }
|
| 118 | public void setProvisaoDetalhamentoCaixa(List<DetalhamentoCaixaDTO> provisaoDetalhamentoCaixa) { |
126 | public void setProvisaoDetalhamentoCaixa(List<DetalhamentoCaixaDTO> provisaoDetalhamentoCaixa) { |
| 119 | this.provisaoDetalhamentoCaixa = provisaoDetalhamentoCaixa; |
127 | this.provisaoDetalhamentoCaixa = provisaoDetalhamentoCaixa; |
| - | 128 | }
|
|
| - | 129 | ||
| - | 130 | public Orcamento getOrcamento() { |
|
| - | 131 | return orcamento; |
|
| - | 132 | }
|
|
| - | 133 | public void setOrcamento(Orcamento orcamento) { |
|
| - | 134 | this.orcamento = orcamento; |
|
| 120 | }
|
135 | }
|
| 121 | 136 | ||
| 122 | /********************************************************************/
|
137 | /********************************************************************/
|
| 123 | 138 | ||
| 124 | @Override |
139 | @Override |
| Line 199... | Line 214... | ||
| 199 | parcelaConsulta.setMatriz(getFluxoDeCaixa().getMatriz()); |
214 | parcelaConsulta.setMatriz(getFluxoDeCaixa().getMatriz()); |
| 200 | parcelaConsulta.setCategoria(categoria); |
215 | parcelaConsulta.setCategoria(categoria); |
| 201 | parcelaConsulta.setCategoriaPai(categoriaPai); |
216 | parcelaConsulta.setCategoriaPai(categoriaPai); |
| 202 | parcelaConsulta.setTipoBusca(tipoConta); |
217 | parcelaConsulta.setTipoBusca(tipoConta); |
| 203 | return parcelaService.consultarParcelas(parcelaConsulta); |
218 | return parcelaService.consultarParcelas(parcelaConsulta); |
| - | 219 | }
|
|
| - | 220 | ||
| - | 221 | public void prepararGerirOrcado(FluxoDeCaixaDTO fluxo, Categoria categoriaPai, Categoria categoria) { |
|
| - | 222 | setOrcamento(orcamentoService.prepararGerirOrcado(fluxo, categoriaPai, categoria)); |
|
| - | 223 | }
|
|
| - | 224 | ||
| - | 225 | public void cadastrarOrcamento() { |
|
| - | 226 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
|
| - | 227 | public void execute() { |
|
| - | 228 | orcamentoService.atualizarOrcamento(getOrcamento()); |
|
| - | 229 | consultarFluxoDeCaixa(); |
|
| - | 230 | LancadorMensagem.lancarSucesso("ORÇAMENTO ATUALIZADO COM SUCESSO!"); |
|
| - | 231 | }
|
|
| - | 232 | }); |
|
| 204 | }
|
233 | }
|
| 205 | 234 | ||
| 206 | }
|
235 | }
|