Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 227 | espaco | 1 | package br.com.ec.domain.service.impl; |
| 2 | |||
| 3 | import org.springframework.beans.factory.annotation.Autowired; |
||
| 4 | import org.springframework.stereotype.Service; |
||
| 5 | |||
| 6 | import br.com.ec.core.generic.AbstractService; |
||
| 7 | import br.com.ec.core.generic.GenericRepository; |
||
| 8 | import br.com.ec.core.validador.Validador; |
||
| 9 | import br.com.ec.domain.dto.DashboardDTO; |
||
| 10 | import br.com.ec.domain.service.DashboardService; |
||
| 11 | import br.com.ec.repository.DashboardRepository; |
||
| 12 | |||
| 13 | @Service |
||
| 14 | public class DashboardServiceImpl extends AbstractService<DashboardDTO> implements DashboardService { |
||
| 15 | |||
| 16 | private DashboardRepository dashboardRepository; |
||
| 17 | |||
| 18 | @Autowired |
||
| 19 | public DashboardServiceImpl(Validador validador, DashboardRepository dashboardRepository) { |
||
| 20 | super(validador); |
||
| 21 | this.dashboardRepository = dashboardRepository; |
||
| 22 | } |
||
| 23 | |||
| 24 | @Override |
||
| 25 | protected GenericRepository<DashboardDTO> getRepository() { |
||
| 26 | return dashboardRepository; |
||
| 27 | } |
||
| 28 | |||
| 29 | @Override |
||
| 30 | public DashboardDTO consultarDashboardDoDia() { |
||
| 31 | // TODO Auto-generated method stub |
||
| 32 | return null; |
||
| 33 | } |
||
| 34 | |||
| 35 | } |
||
| 36 | |||
| 37 | /* |
||
| 38 | @Override |
||
| 39 | public AcompanhamentoDTO consultarConsolidacaoDoDia() { |
||
| 40 | AcompanhamentoDTO consolidado = new AcompanhamentoDTO(); |
||
| 41 | List<ConsolidadoVendasLojaDTO> listaLojaDoDiaDTO = new ArrayList<ConsolidadoVendasLojaDTO>(); |
||
| 42 | List<Loja> lojas = lojaService.listarLojasAtivas(); |
||
| 43 | |||
| 44 | for (Loja loja : lojas) { |
||
| 45 | ConsolidadoVendasLojaDTO consolidadoVendasLoja = new ConsolidadoVendasLojaDTO(); |
||
| 46 | consolidadoVendasLoja.setLoja(loja); |
||
| 47 | Venda venda = new Venda(loja, null); |
||
| 48 | Integer quantidadeVendas = vendaService.obterQuantidadeDeVendasPorLojaEePeriodo(venda, DataUtils.getDataAtual(), DataUtils.getDataAtual()); |
||
| 49 | consolidado.adicionarQuantidadeVendas(quantidadeVendas); |
||
| 50 | consolidadoVendasLoja.setQuantidadeTotalVendas(quantidadeVendas); |
||
| 51 | |||
| 52 | Double valorVendas = vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(loja, DataUtils.getDataAtual(), DataUtils.getDataAtual()); |
||
| 53 | ParametrosConsultaVendasDTO parametrosConsultaVendas = new ParametrosConsultaVendasDTO(); |
||
| 54 | parametrosConsultaVendas.setLoja(loja); |
||
| 55 | parametrosConsultaVendas.setDataInicial(DataUtils.getDataAtual()); |
||
| 56 | parametrosConsultaVendas.setDataFinal(DataUtils.getDataAtual()); |
||
| 57 | valorVendas = valorVendas - vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodoServicos(parametrosConsultaVendas); |
||
| 58 | consolidado.adicionarValorVendas(valorVendas); |
||
| 59 | consolidadoVendasLoja.setValorTotalVendas(valorVendas); |
||
| 60 | |||
| 61 | parametrosConsultaVendas.setDataInicial(DataUtils.getDataComHorarioMinimo(DataUtils.getPrimeiroDiaDoMesAtual())); |
||
| 62 | parametrosConsultaVendas.setDataFinal(DataUtils.getDataComHorarioMaximo(DataUtils.acrescentarDias(DataUtils.getDataAtual(), -1))); |
||
| 63 | Double totalVendasAnterioresDoMesAtual = vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(parametrosConsultaVendas); |
||
| 64 | totalVendasAnterioresDoMesAtual = totalVendasAnterioresDoMesAtual - vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodoServicos(parametrosConsultaVendas); |
||
| 65 | consolidadoVendasLoja.setValorTotalVendasAnterioresDoMesAtual(totalVendasAnterioresDoMesAtual); |
||
| 66 | |||
| 67 | Double valorMetaMensalLoja = consultarMetaMensal(loja); |
||
| 68 | consolidadoVendasLoja.setValorMetaMensal(valorMetaMensalLoja); |
||
| 69 | consolidado.adicionarValorMeta(valorMetaMensalLoja); |
||
| 70 | |||
| 71 | consolidadoVendasLoja.setIndicadorLojaAberta(aberturaLojaService.consultarAberturaLoja(DataUtils.getDataAtual(), loja) != null); |
||
| 72 | venda.setTipoSituacao(TipoSituacaoVenda.NOVO.getValor()); |
||
| 73 | consolidadoVendasLoja.setIndicadorVendasNovas(vendaService.obterQuantidadeDeVendasPorLojaEePeriodo(venda, DataUtils.getDataAtual(), DataUtils.getDataAtual()) > 0); |
||
| 74 | |||
| 75 | listaLojaDoDiaDTO.add(consolidadoVendasLoja); |
||
| 76 | } |
||
| 77 | |||
| 78 | ConsolidadoVendasLojaDTO consolidadoVendasLojaAssistencia = new ConsolidadoVendasLojaDTO(); |
||
| 79 | Loja lojaAssistencia = new Loja(); |
||
| 80 | lojaAssistencia.setDescricao("ASSISTÊNCIA"); |
||
| 81 | consolidadoVendasLojaAssistencia.setLoja(lojaAssistencia); |
||
| 82 | ParametrosConsultaVendasDTO parametrosConsultaVendas = new ParametrosConsultaVendasDTO(); |
||
| 83 | parametrosConsultaVendas.setDataInicial(DataUtils.getDataAtual()); |
||
| 84 | parametrosConsultaVendas.setDataFinal(DataUtils.getDataAtual()); |
||
| 85 | consolidadoVendasLojaAssistencia.setValorTotalVendas(vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodoServicos(parametrosConsultaVendas)); |
||
| 86 | consolidadoVendasLojaAssistencia.setIndicadorLojaAberta(true); |
||
| 87 | listaLojaDoDiaDTO.add(consolidadoVendasLojaAssistencia); |
||
| 88 | |||
| 89 | consolidado.setListaLojaDoDiaDTO(new ArrayList<ConsolidadoVendasLojaDTO>(ordenador.ordenar(listaLojaDoDiaDTO))); |
||
| 90 | consolidado.setValorTotalVendasMes(vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(null, DataUtils.getPrimeiroDiaDoMesAtual(), DataUtils.getUltimoDiaDoMesAtual())); |
||
| 91 | consolidado.setQuantidadeTotalPagamentos(pagamentoService.quantidadePagamentosEmAberto(null)); |
||
| 92 | consolidado.setQuantidadeTotalPendencias(pendenciaService.quantidadePendenciasNaoFinalizadas(null)); |
||
| 93 | |||
| 94 | Date diaDoMesPassado = DataUtils.acrescentarMeses(DataUtils.getDataAtual(), -1); |
||
| 95 | consolidado.setValorTotalVendasDoDiaMesPassado(vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(null, diaDoMesPassado, diaDoMesPassado)); |
||
| 96 | consolidado.setValorTotalVendasMesPassado(vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(null, DataUtils.getPrimeiroDiaDoMesAnterior(), diaDoMesPassado)); |
||
| 97 | |||
| 98 | return consolidado; |
||
| 99 | } |
||
| 100 | |||
| 101 | @Override |
||
| 102 | public ConsolidadoGestaoDTO consultarConsolidadoGestaoDTO() { |
||
| 103 | ConsolidadoGestaoDTO consolidado = new ConsolidadoGestaoDTO(); |
||
| 104 | consolidado.setQuantidadeTotalVendas(vendaService.obterQuantidadeDeVendasPorLojaEePeriodo(null, DataUtils.getDataAtual(), DataUtils.getDataAtual())); |
||
| 105 | consolidado.setValorTotalVendasMes(vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(null, DataUtils.getPrimeiroDiaDoMesAtual(), DataUtils.getUltimoDiaDoMesAtual())); |
||
| 106 | consolidado.setQuantidadeTotalEstoque(produtoService.quantidadeTotalEstoque(null)); |
||
| 107 | consolidado.setValorTotalEstoque(produtoService.valorTotalEstoque(null, null)); |
||
| 108 | return consolidado; |
||
| 109 | } |
||
| 110 | |||
| 111 | @Override |
||
| 112 | public LineChartModel consultarGrafico(Date primeiroMes, Date segundoMes) { |
||
| 113 | LineChartModel graficoAcumulado = new LineChartModel(); |
||
| 114 | String mesAtual = "" + (DataUtils.obterCalendario(primeiroMes).get(Calendar.MONTH)+1); |
||
| 115 | String anoAtual = "" + DataUtils.obterCalendario(primeiroMes).get(Calendar.YEAR); |
||
| 116 | String anoAnterior = "" + DataUtils.obterCalendario(segundoMes).get(Calendar.YEAR); |
||
| 117 | String mesAnterior = "" + (DataUtils.obterCalendario(segundoMes).get(Calendar.MONTH)+1); |
||
| 118 | if (mesAnterior.equals("0")) { |
||
| 119 | mesAnterior = "12"; |
||
| 120 | anoAnterior = "" + (DataUtils.obterCalendario(DataUtils.getDataAtual()).get(Calendar.YEAR)-1); |
||
| 121 | } |
||
| 122 | if (mesAtual.length()==1) { |
||
| 123 | mesAtual = "0" + mesAtual; |
||
| 124 | } |
||
| 125 | if (mesAnterior.length()==1) { |
||
| 126 | mesAnterior = "0" + mesAnterior; |
||
| 127 | } |
||
| 128 | |||
| 129 | GraficoAcumuladoDTO graficoAtual = vendaService.consultarGrafico(mesAtual, anoAtual); |
||
| 130 | LineChartSeries series1 = preencherLinhaAcumulando(graficoAtual, mesAtual, anoAtual); |
||
| 131 | series1.setLabel("ATUAL"); |
||
| 132 | |||
| 133 | GraficoAcumuladoDTO graficoAnterior = vendaService.consultarGrafico(mesAnterior, anoAnterior); |
||
| 134 | LineChartSeries series2 = preencherLinhaAcumulando(graficoAnterior, mesAtual, anoAtual); |
||
| 135 | series2.setLabel("ANTERIOR"); |
||
| 136 | |||
| 137 | graficoAcumulado.addSeries(series1); |
||
| 138 | graficoAcumulado.addSeries(series2); |
||
| 139 | |||
| 140 | graficoAcumulado.setTitle(""); |
||
| 141 | graficoAcumulado.setZoom(true); |
||
| 142 | graficoAcumulado.setShowPointLabels(true); |
||
| 143 | graficoAcumulado.getAxis(AxisType.Y).setLabel("VALORES R$"); |
||
| 144 | DateAxis axis = new DateAxis("DATAS"); |
||
| 145 | axis.setTickAngle(-50); |
||
| 146 | axis.setMin(anoAtual + "-" + mesAtual + "-" + "01"); |
||
| 147 | axis.setMax(anoAtual + "-" + mesAtual + "-" + "31"); |
||
| 148 | axis.setTickFormat("%b %#d, 20%y"); |
||
| 149 | graficoAcumulado.getAxes().put(AxisType.X, axis); |
||
| 150 | return graficoAcumulado; |
||
| 151 | } |
||
| 152 | |||
| 153 | private LineChartSeries preencherLinhaAcumulando(GraficoAcumuladoDTO graficoLinha, String mes, String ano) { |
||
| 154 | LineChartSeries linha = new LineChartSeries(); |
||
| 155 | Double valorAcumulado = new Double(0.0); |
||
| 156 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_01(); |
||
| 157 | linha.set(ano + "-" + mes + "-" + "01", valorAcumulado); |
||
| 158 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_02(); |
||
| 159 | linha.set(ano + "-" + mes + "-" + "02", valorAcumulado); |
||
| 160 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_03(); |
||
| 161 | linha.set(ano + "-" + mes + "-" + "03", valorAcumulado); |
||
| 162 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_04(); |
||
| 163 | linha.set(ano + "-" + mes + "-" + "04", valorAcumulado); |
||
| 164 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_05(); |
||
| 165 | linha.set(ano + "-" + mes + "-" + "05", valorAcumulado); |
||
| 166 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_06(); |
||
| 167 | linha.set(ano + "-" + mes + "-" + "06", valorAcumulado); |
||
| 168 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_07(); |
||
| 169 | linha.set(ano + "-" + mes + "-" + "07", valorAcumulado); |
||
| 170 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_08(); |
||
| 171 | linha.set(ano + "-" + mes + "-" + "08", valorAcumulado); |
||
| 172 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_09(); |
||
| 173 | linha.set(ano + "-" + mes + "-" + "09", valorAcumulado); |
||
| 174 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_10(); |
||
| 175 | linha.set(ano + "-" + mes + "-" + "10", valorAcumulado); |
||
| 176 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_11(); |
||
| 177 | linha.set(ano + "-" + mes + "-" + "11", valorAcumulado); |
||
| 178 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_12(); |
||
| 179 | linha.set(ano + "-" + mes + "-" + "12", valorAcumulado); |
||
| 180 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_13(); |
||
| 181 | linha.set(ano + "-" + mes + "-" + "13", valorAcumulado); |
||
| 182 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_14(); |
||
| 183 | linha.set(ano + "-" + mes + "-" + "14", valorAcumulado); |
||
| 184 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_15(); |
||
| 185 | linha.set(ano + "-" + mes + "-" + "15", valorAcumulado); |
||
| 186 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_16(); |
||
| 187 | linha.set(ano + "-" + mes + "-" + "16", valorAcumulado); |
||
| 188 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_17(); |
||
| 189 | linha.set(ano + "-" + mes + "-" + "17", valorAcumulado); |
||
| 190 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_18(); |
||
| 191 | linha.set(ano + "-" + mes + "-" + "18", valorAcumulado); |
||
| 192 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_19(); |
||
| 193 | linha.set(ano + "-" + mes + "-" + "19", valorAcumulado); |
||
| 194 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_20(); |
||
| 195 | linha.set(ano + "-" + mes + "-" + "20", valorAcumulado); |
||
| 196 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_21(); |
||
| 197 | linha.set(ano + "-" + mes + "-" + "21", valorAcumulado); |
||
| 198 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_22(); |
||
| 199 | linha.set(ano + "-" + mes + "-" + "22", valorAcumulado); |
||
| 200 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_23(); |
||
| 201 | linha.set(ano + "-" + mes + "-" + "23", valorAcumulado); |
||
| 202 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_24(); |
||
| 203 | linha.set(ano + "-" + mes + "-" + "24", valorAcumulado); |
||
| 204 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_25(); |
||
| 205 | linha.set(ano + "-" + mes + "-" + "25", valorAcumulado); |
||
| 206 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_26(); |
||
| 207 | linha.set(ano + "-" + mes + "-" + "26", valorAcumulado); |
||
| 208 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_27(); |
||
| 209 | linha.set(ano + "-" + mes + "-" + "27", valorAcumulado); |
||
| 210 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_28(); |
||
| 211 | linha.set(ano + "-" + mes + "-" + "28", valorAcumulado); |
||
| 212 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_29(); |
||
| 213 | linha.set(ano + "-" + mes + "-" + "29", valorAcumulado); |
||
| 214 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_30(); |
||
| 215 | linha.set(ano + "-" + mes + "-" + "30", valorAcumulado); |
||
| 216 | valorAcumulado = valorAcumulado + graficoLinha.getDIA_31(); |
||
| 217 | linha.set(ano + "-" + mes + "-" + "31", valorAcumulado); |
||
| 218 | return linha; |
||
| 219 | } |
||
| 220 | |||
| 221 | @Override |
||
| 222 | public ProvisaoCaixaDTO consultarGraficoCaixa(Date dataInicial, Date dataFinal) { |
||
| 223 | LineChartModel graficoAcumulado = new LineChartModel(); |
||
| 224 | String mes = "" + (DataUtils.obterCalendario(dataInicial).get(Calendar.MONTH)+1); |
||
| 225 | String ano = "" + DataUtils.obterCalendario(dataInicial).get(Calendar.YEAR); |
||
| 226 | if (mes.length()==1) { |
||
| 227 | mes = "0" + mes; |
||
| 228 | } |
||
| 229 | |||
| 230 | Double caixa = contaBancariaService.consultarSaldo(null); |
||
| 231 | List<DetalhamentoCaixaDTO> graficoAtual = fluxoDeCaixaService.consultarGraficoCaixa(caixa, dataInicial, dataFinal); |
||
| 232 | LineChartSeries series1 = preencherLinha(graficoAtual, mes, ano); |
||
| 233 | series1.setLabel("ATUAL"); |
||
| 234 | |||
| 235 | graficoAcumulado.addSeries(series1); |
||
| 236 | |||
| 237 | graficoAcumulado.setTitle(""); |
||
| 238 | graficoAcumulado.setZoom(true); |
||
| 239 | graficoAcumulado.setShowPointLabels(true); |
||
| 240 | graficoAcumulado.getAxis(AxisType.Y).setLabel("VALORES R$"); |
||
| 241 | DateAxis axis = new DateAxis("DATAS"); |
||
| 242 | axis.setTickAngle(-50); |
||
| 243 | axis.setMin(DataUtils.converterDataParaStringNoFormato(dataInicial, "yyyy - MM - dd")); |
||
| 244 | axis.setMax(DataUtils.converterDataParaStringNoFormato(dataFinal, "yyyy - MM - dd")); |
||
| 245 | // axis.setMin(ano + "-" + mes + "-" + "01"); |
||
| 246 | // axis.setMax(ano + "-" + mes + "-" + graficoAtual.size()); |
||
| 247 | axis.setTickFormat("%b %#d"); |
||
| 248 | graficoAcumulado.getAxes().put(AxisType.X, axis); |
||
| 249 | |||
| 250 | ProvisaoCaixaDTO provisao = new ProvisaoCaixaDTO(); |
||
| 251 | provisao.setGrafico(graficoAcumulado); |
||
| 252 | provisao.setDetalhamentos(graficoAtual); |
||
| 253 | return provisao; |
||
| 254 | } |
||
| 255 | |||
| 256 | private LineChartSeries preencherLinha(List<DetalhamentoCaixaDTO> detalhamentos, String mes, String ano) { |
||
| 257 | LineChartSeries linha = new LineChartSeries(); |
||
| 258 | // Integer indice = 1; |
||
| 259 | // String dia = ""; |
||
| 260 | for (DetalhamentoCaixaDTO detalhamento : detalhamentos) { |
||
| 261 | // if (indice < 10) { |
||
| 262 | // dia = "0" + indice; |
||
| 263 | // } else { |
||
| 264 | // dia = "" + indice; |
||
| 265 | // } |
||
| 266 | // indice++; |
||
| 267 | // linha.set(ano + "-" + mes + "-" + dia, detalhamento.getSaldo()); |
||
| 268 | linha.set(detalhamento.dataFormatada(), detalhamento.getSaldo()); |
||
| 269 | } |
||
| 270 | return linha; |
||
| 271 | } |
||
| 272 | |||
| 273 | @Override |
||
| 274 | public FluxoDeCaixaDTO consultarFluxoDeCaixa(FluxoDeCaixaDTO fluxoDeCaixa) { |
||
| 275 | return fluxoDeCaixaService.consultarFluxoDeCaixa(fluxoDeCaixa); |
||
| 276 | } |
||
| 277 | |||
| 278 | @Override |
||
| 279 | public List<FluxoDeCaixaCategoriaDTO> consultarFluxoDeCaixaPorCategoria(FluxoDeCaixaDTO fluxoDeCaixa, String tipoCategoria) { |
||
| 280 | return fluxoDeCaixaService.consultarFluxoDeCaixaPorCategoria(fluxoDeCaixa, tipoCategoria); |
||
| 281 | } |
||
| 282 | |||
| 283 | @Override |
||
| 284 | public ReceitaDTO consultarReceita(ReceitaDTO receita) { |
||
| 285 | ParametrosConsultaVendasDTO parametrosConsultaVendas = new ParametrosConsultaVendasDTO(); |
||
| 286 | parametrosConsultaVendas.setDataInicial(receita.getDataInicial()); |
||
| 287 | parametrosConsultaVendas.setDataFinal(receita.getDataFinal()); |
||
| 288 | parametrosConsultaVendas.setLoja(receita.getLoja()); |
||
| 289 | parametrosConsultaVendas.setVendedor(receita.getVendedor()); |
||
| 290 | parametrosConsultaVendas.setIndicacao(receita.getIndicacao()); |
||
| 291 | |||
| 292 | receita.setValorTotalBruto(vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(parametrosConsultaVendas)); |
||
| 293 | receita.setValorTotalLiquido(vendaService.obterValorTotalLiquidoDeVendasPorLojaEePeriodo(parametrosConsultaVendas)); |
||
| 294 | receita.setValorTotalBrutoPorFormasDePagamento(vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodoEeFormasDePagamento(parametrosConsultaVendas, verificarSelecoesFormasPagamento(receita))); |
||
| 295 | receita.setQuantidadeTotalEstoque(produtoService.quantidadeTotalEstoque(receita.getLoja())); |
||
| 296 | receita.setValorTotalEstoque(produtoService.valorTotalEstoque(receita.getLoja(), null)); |
||
| 297 | receita.setQuantidadeProdutosVendidos(vendaService.obterQuantidadeProdutosVendidosPorLojaEePeriodoNaoVivo(parametrosConsultaVendas)); |
||
| 298 | receita.setValorProdutosUtilizados(vendaService.obterValorProdutosUtilizadosEmVendasPorLojaEePeriodo(parametrosConsultaVendas)); |
||
| 299 | receita.setProcessado(true); |
||
| 300 | return receita; |
||
| 301 | } |
||
| 302 | |||
| 303 | private List<FormaPagamento> verificarSelecoesFormasPagamento(ReceitaDTO receita) { |
||
| 304 | List<FormaPagamento> formas = new ArrayList<FormaPagamento>(); |
||
| 305 | List<FormaPagamento> formasSelecionadas = Arrays.asList(receita.getFormasDePagamento()); |
||
| 306 | if (VerificadorUtil.naoEstaNulo(receita.getFormasDePagamento())) { |
||
| 307 | for (FormaPagamento forma : formasSelecionadas) { |
||
| 308 | if (VerificadorUtil.naoEstaNulo(forma)) { |
||
| 309 | formas.add(forma); |
||
| 310 | } |
||
| 311 | } |
||
| 312 | } |
||
| 313 | return formas; |
||
| 314 | } |
||
| 315 | |||
| 316 | @Override |
||
| 317 | public DreDTO consultarDRE(DreDTO dre) { |
||
| 318 | ParametrosConsultaVendasDTO parametrosConsultaVendas = new ParametrosConsultaVendasDTO(); |
||
| 319 | parametrosConsultaVendas.setDataInicial(dre.getDataInicial()); |
||
| 320 | parametrosConsultaVendas.setDataFinal(dre.getDataFinal()); |
||
| 321 | parametrosConsultaVendas.setLojas(dre.getLojasSelecionadas()); |
||
| 322 | |||
| 323 | List<DreItemDTO> itens = new ArrayList<DreItemDTO>(); |
||
| 324 | DreItemDTO itemDRE = new DreItemDTO("RECEITA OPERACIONAL BRUTA"); //VENDAS DE PRODUTOS, MERCADORIAS E SERVIÇOS |
||
| 325 | Double valor = new Double(0.0); |
||
| 326 | vendaService.obterValorTotalBrutoDeVendasPorLojaEePeriodo(parametrosConsultaVendas); |
||
| 327 | |||
| 328 | itemDRE.setValor(valor); |
||
| 329 | itens.add(itemDRE); |
||
| 330 | dre.setItens(itens); |
||
| 331 | return dre; |
||
| 332 | } |
||
| 333 | |||
| 334 | private Double consultarMetaMensal(Loja loja) { |
||
| 335 | return avaliacaoLojaService.consultarValorMetaMensalLojaPelaData(loja.getSequencial(), DataUtils.getDataAtual()); |
||
| 336 | } |
||
| 337 | |||
| 338 | */ |