Rev 693 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 1 | package br.com.ec.controller.managedbean; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | import java.util.List; |
||
| 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.controller.managedbean.datamodel.ParcelaDataModel; |
||
| 195 | espaco | 12 | import br.com.ec.core.consulta.ParametrosConsulta; |
| 13 | import br.com.ec.core.exception.NegocioException; |
||
| 14 | import br.com.ec.core.generic.GenericService; |
||
| 15 | import br.com.ec.core.util.VerificadorUtil; |
||
| 106 | espaco | 16 | import br.com.ec.domain.dto.ParametrosVendaDTO; |
| 17 | import br.com.ec.domain.model.BandeiraCartao; |
||
| 18 | import br.com.ec.domain.model.Cliente; |
||
| 19 | import br.com.ec.domain.model.Conta; |
||
| 20 | import br.com.ec.domain.model.Cupom; |
||
| 305 | espaco | 21 | import br.com.ec.domain.model.Estampa; |
| 106 | espaco | 22 | import br.com.ec.domain.model.FormaPagamento; |
| 23 | import br.com.ec.domain.model.Lancamento; |
||
| 24 | import br.com.ec.domain.model.Loja; |
||
| 25 | import br.com.ec.domain.model.Modelo; |
||
| 26 | import br.com.ec.domain.model.NotaFiscal; |
||
| 27 | import br.com.ec.domain.model.Pedido; |
||
| 28 | import br.com.ec.domain.model.PedidoProduto; |
||
| 29 | import br.com.ec.domain.model.Produto; |
||
| 30 | import br.com.ec.domain.model.Venda; |
||
| 31 | import br.com.ec.domain.model.VendaFormaPagamento; |
||
| 32 | import br.com.ec.domain.model.Vendedor; |
||
| 33 | import br.com.ec.domain.model.tipos.TipoCupom; |
||
| 34 | import br.com.ec.domain.model.tipos.TipoFrete; |
||
| 305 | espaco | 35 | import br.com.ec.domain.model.tipos.TipoPersonalizacao; |
| 106 | espaco | 36 | import br.com.ec.domain.model.tipos.TipoSituacaoPedido; |
| 37 | import br.com.ec.domain.service.bandeiracartao.BandeiraCartaoService; |
||
| 686 | blopes | 38 | import br.com.ec.domain.service.cashback.CashbackService; |
| 106 | espaco | 39 | import br.com.ec.domain.service.cliente.ClienteService; |
| 40 | import br.com.ec.domain.service.conta.ContaService; |
||
| 41 | import br.com.ec.domain.service.cupom.CupomService; |
||
| 42 | import br.com.ec.domain.service.email.impl.GerenciadorEmailImpl; |
||
| 305 | espaco | 43 | import br.com.ec.domain.service.estampa.EstampaService; |
| 106 | espaco | 44 | import br.com.ec.domain.service.formapagamento.FormaPagamentoService; |
| 45 | import br.com.ec.domain.service.lancamento.LancamentoService; |
||
| 46 | import br.com.ec.domain.service.loja.LojaService; |
||
| 47 | import br.com.ec.domain.service.modelo.ModeloService; |
||
| 48 | import br.com.ec.domain.service.notafiscal.NotaFiscalService; |
||
| 49 | import br.com.ec.domain.service.parcela.ParcelaService; |
||
| 50 | import br.com.ec.domain.service.pedido.PedidoService; |
||
| 51 | import br.com.ec.domain.service.produto.ProdutoService; |
||
| 52 | import br.com.ec.domain.service.produtodaloja.ProdutoLojaService; |
||
| 53 | import br.com.ec.domain.service.seguranca.ContextoSeguranca; |
||
| 54 | import br.com.ec.domain.service.venda.VendaService; |
||
| 55 | import br.com.ec.domain.service.vendaformapagamento.VendaFormaPagamentoService; |
||
| 56 | import br.com.ec.domain.service.vendedor.VendedorService; |
||
| 57 | import br.com.ec.domain.shared.ConstantesSEC; |
||
| 195 | espaco | 58 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 59 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
||
| 60 | import br.com.ec.web.generic.AbstractBean; |
||
| 61 | import br.com.ec.web.message.LancadorMensagem; |
||
| 106 | espaco | 62 | import net.sf.jasperreports.engine.JasperExportManager; |
| 63 | import net.sf.jasperreports.engine.JasperPrint; |
||
| 64 | |||
| 65 | @Named |
||
| 66 | @Scope("view") |
||
| 67 | public class VendaBean extends AbstractBean<Venda> implements Serializable { |
||
| 68 | |||
| 69 | private static final long serialVersionUID = 1L; |
||
| 70 | |||
| 71 | private LojaService lojaService; |
||
| 72 | private VendaService vendaService; |
||
| 73 | private ProdutoService produtoService; |
||
| 74 | private ProdutoLojaService produtoLojaService; |
||
| 75 | private VendedorService vendedorService; |
||
| 76 | private FormaPagamentoService formaPagamentoService; |
||
| 77 | private VendaFormaPagamentoService vendaFormaPagamentoService; |
||
| 78 | private BandeiraCartaoService bandeiraCartaoService; |
||
| 79 | private ParcelaService parcelaService; |
||
| 80 | private ContaService contaAReceberService; |
||
| 81 | private ClienteService clienteService; |
||
| 82 | private ModeloService modeloService; |
||
| 83 | private NotaFiscalService notaFiscalService; |
||
| 84 | private CupomService cupomService; |
||
| 85 | private LancamentoService lancamentoService; |
||
| 86 | private PedidoService pedidoService; |
||
| 305 | espaco | 87 | private EstampaService estampaService; |
| 686 | blopes | 88 | private CashbackService cashbackService; |
| 106 | espaco | 89 | private ContextoSeguranca contextoSeguranca; |
| 90 | |||
| 91 | private String codigoProduto; |
||
| 92 | private String codigoPedido; |
||
| 93 | private Lancamento lancamento; |
||
| 94 | private String localizacaoNova; |
||
| 95 | private String cpfCnpjCliente; |
||
| 96 | private ParametrosVendaDTO parametrosVenda; |
||
| 97 | private Venda vendaSelecionada; |
||
| 98 | private String observacaoExclusao; |
||
| 99 | private Cupom cupomSelecionado; |
||
| 100 | private Lancamento lancamentoSelecionado; |
||
| 101 | |||
| 102 | private FormaPagamento formaPagamento; |
||
| 103 | private BandeiraCartao bandeiraCartao; |
||
| 104 | private Double valorPagamento; |
||
| 105 | |||
| 106 | private List<FormaPagamento> formasDePagamentoDeCredito; |
||
| 107 | private List<BandeiraCartao> bandeirasDeDebito; |
||
| 108 | private List<BandeiraCartao> bandeirasDeCredito; |
||
| 109 | |||
| 110 | private ParcelaDataModel parcelas; |
||
| 111 | private Boolean emitirCupom = false; |
||
| 112 | private String emailParaEnvio; |
||
| 113 | |||
| 114 | private List<Vendedor> vendedoresColaboradores; |
||
| 115 | private List<Vendedor> vendedoresColaboradoresAtivos; |
||
| 116 | private List<Vendedor> vendedoresExternos; |
||
| 117 | |||
| 305 | espaco | 118 | private List<Estampa> estampas; |
| 119 | |||
| 106 | espaco | 120 | @Inject |
| 121 | public VendaBean(LojaService lojaService, VendaService vendaService, ProdutoService produtoService, ProdutoLojaService produtoLojaService, |
||
| 122 | VendedorService vendedorService, FormaPagamentoService formaPagamentoService, VendaFormaPagamentoService vendaFormaPagamentoService, |
||
| 123 | BandeiraCartaoService bandeiraCartaoService, ParcelaService parcelaService, |
||
| 124 | ContaService contaAReceberService, ClienteService clienteService, ModeloService modeloService, |
||
| 125 | NotaFiscalService notaFiscalService, CupomService cupomService, LancamentoService lancamentoService, PedidoService pedidoService, |
||
| 686 | blopes | 126 | EstampaService estampaService, CashbackService cashbackService, ContextoSeguranca contextoSeguranca) { |
| 106 | espaco | 127 | this.lojaService = lojaService; |
| 128 | this.vendaService = vendaService; |
||
| 129 | this.produtoService = produtoService; |
||
| 130 | this.produtoLojaService = produtoLojaService; |
||
| 131 | this.vendedorService = vendedorService; |
||
| 132 | this.formaPagamentoService = formaPagamentoService; |
||
| 133 | this.vendaFormaPagamentoService = vendaFormaPagamentoService; |
||
| 134 | this.bandeiraCartaoService = bandeiraCartaoService; |
||
| 135 | this.parcelaService = parcelaService; |
||
| 136 | this.contaAReceberService = contaAReceberService; |
||
| 137 | this.clienteService = clienteService; |
||
| 138 | this.modeloService = modeloService; |
||
| 139 | this.notaFiscalService = notaFiscalService; |
||
| 140 | this.cupomService = cupomService; |
||
| 141 | this.lancamentoService = lancamentoService; |
||
| 142 | this.pedidoService = pedidoService; |
||
| 305 | espaco | 143 | this.estampaService = estampaService; |
| 686 | blopes | 144 | this.cashbackService = cashbackService; |
| 106 | espaco | 145 | this.contextoSeguranca = contextoSeguranca; |
| 146 | } |
||
| 147 | |||
| 148 | @Override |
||
| 149 | public void preCarregamento() { |
||
| 150 | limparEntidade(); |
||
| 151 | } |
||
| 152 | |||
| 153 | private void setarParametrosDaLoja() { |
||
| 154 | parametrosVenda = new ParametrosVendaDTO(); |
||
| 155 | if (VerificadorUtil.naoEstaNulo(getParametro("sequencialLoja"))) { |
||
| 156 | Loja loja = new Loja(); |
||
| 157 | loja.setSequencial(new Long(getParametro("sequencialLoja").toString())); |
||
| 158 | parametrosVenda.setLoja(lojaService.consultarPorId(loja)); |
||
| 159 | parametrosVenda.setMaquineta(parametrosVenda.getLoja().getMaquineta()); |
||
| 160 | } |
||
| 161 | parametrosVenda.setUsuario(contextoSeguranca.obterUsuario()); |
||
| 162 | } |
||
| 163 | |||
| 164 | @Override |
||
| 165 | public void preDetalhar(Venda venda) { |
||
| 166 | setEntidade(vendaService.detalharVendaCompleta(venda)); |
||
| 167 | } |
||
| 168 | |||
| 169 | @Override |
||
| 170 | public void limparEntidade() { |
||
| 171 | entidade = new Venda(); |
||
| 172 | parametrosConsulta = new ParametrosConsulta<Venda>(); |
||
| 173 | parametrosConsulta.setEntidade(entidade); |
||
| 174 | |||
| 175 | setLancamento(new Lancamento()); |
||
| 176 | setarParametrosDaLoja(); |
||
| 177 | setParcelas(new ParcelaDataModel()); |
||
| 178 | } |
||
| 179 | |||
| 180 | @Override |
||
| 181 | public GenericService<Venda> getService() { |
||
| 182 | return vendaService; |
||
| 183 | } |
||
| 184 | |||
| 185 | @Override |
||
| 186 | public Venda getEntidade() { |
||
| 187 | return entidade; |
||
| 188 | } |
||
| 189 | |||
| 190 | @Override |
||
| 191 | public Venda getId() { |
||
| 192 | return getEntidade(); |
||
| 193 | } |
||
| 194 | |||
| 195 | public String getCodigoProduto() { |
||
| 196 | return codigoProduto; |
||
| 197 | } |
||
| 198 | public void setCodigoProduto(String codigoProduto) { |
||
| 199 | this.codigoProduto = codigoProduto; |
||
| 200 | } |
||
| 201 | |||
| 202 | public String getCodigoPedido() { |
||
| 203 | return codigoPedido; |
||
| 204 | } |
||
| 205 | public void setCodigoPedido(String codigoPedido) { |
||
| 206 | this.codigoPedido = codigoPedido; |
||
| 207 | } |
||
| 208 | |||
| 209 | public Lancamento getLancamento() { |
||
| 210 | return lancamento; |
||
| 211 | } |
||
| 212 | public void setLancamento(Lancamento lancamento) { |
||
| 213 | this.lancamento = lancamento; |
||
| 214 | } |
||
| 215 | |||
| 216 | public String getLocalizacaoNova() { |
||
| 217 | return localizacaoNova; |
||
| 218 | } |
||
| 219 | public void setLocalizacaoNova(String localizacaoNova) { |
||
| 220 | this.localizacaoNova = localizacaoNova; |
||
| 221 | } |
||
| 222 | |||
| 223 | public String getCpfCnpjCliente() { |
||
| 224 | return VerificadorUtil.naoEstaNulo(cpfCnpjCliente)? cpfCnpjCliente.replace(".", "").replace("-", "") : cpfCnpjCliente; |
||
| 225 | } |
||
| 226 | public void setCpfCnpjCliente(String cpfCnpjCliente) { |
||
| 227 | this.cpfCnpjCliente = cpfCnpjCliente; |
||
| 228 | } |
||
| 229 | |||
| 230 | public ParametrosVendaDTO getParametrosVenda() { |
||
| 231 | return parametrosVenda; |
||
| 232 | } |
||
| 233 | public void setParametrosVenda(ParametrosVendaDTO parametrosVenda) { |
||
| 234 | this.parametrosVenda = parametrosVenda; |
||
| 235 | } |
||
| 236 | |||
| 237 | public Venda getVendaSelecionada() { |
||
| 238 | return vendaSelecionada; |
||
| 239 | } |
||
| 240 | public void setVendaSelecionada(Venda vendaSelecionada) { |
||
| 241 | this.vendaSelecionada = vendaSelecionada; |
||
| 242 | } |
||
| 243 | |||
| 244 | public String getObservacaoExclusao() { |
||
| 245 | return observacaoExclusao; |
||
| 246 | } |
||
| 247 | public void setObservacaoExclusao(String observacaoExclusao) { |
||
| 248 | this.observacaoExclusao = observacaoExclusao; |
||
| 249 | } |
||
| 250 | |||
| 251 | public Cupom getCupomSelecionado() { |
||
| 252 | return cupomSelecionado; |
||
| 253 | } |
||
| 254 | public void setCupomSelecionado(Cupom cupomSelecionado) { |
||
| 255 | this.cupomSelecionado = cupomSelecionado; |
||
| 256 | } |
||
| 257 | |||
| 258 | public Lancamento getLancamentoSelecionado() { |
||
| 259 | return lancamentoSelecionado; |
||
| 260 | } |
||
| 261 | public void setLancamentoSelecionado(Lancamento lancamentoSelecionado) { |
||
| 262 | this.lancamentoSelecionado = lancamentoSelecionado; |
||
| 263 | } |
||
| 264 | |||
| 265 | public FormaPagamento getFormaPagamento() { |
||
| 266 | return formaPagamento; |
||
| 267 | } |
||
| 268 | public void setFormaPagamento(FormaPagamento formaPagamento) { |
||
| 269 | this.formaPagamento = formaPagamento; |
||
| 270 | } |
||
| 271 | |||
| 272 | public BandeiraCartao getBandeiraCartao() { |
||
| 273 | return bandeiraCartao; |
||
| 274 | } |
||
| 275 | public void setBandeiraCartao(BandeiraCartao bandeiraCartao) { |
||
| 276 | this.bandeiraCartao = bandeiraCartao; |
||
| 277 | } |
||
| 278 | |||
| 279 | public Double getValorPagamento() { |
||
| 280 | return valorPagamento; |
||
| 281 | } |
||
| 282 | public void setValorPagamento(Double valorPagamento) { |
||
| 283 | this.valorPagamento = valorPagamento; |
||
| 284 | } |
||
| 285 | |||
| 286 | public List<FormaPagamento> getFormasDePagamentoDeCredito() { |
||
| 287 | if (VerificadorUtil.estaNulo(formasDePagamentoDeCredito)) { |
||
| 288 | setFormasDePagamentoDeCredito(formaPagamentoService.consultarFormasDePagamentoDeCredito()); |
||
| 289 | } |
||
| 290 | return formasDePagamentoDeCredito; |
||
| 291 | } |
||
| 292 | public void setFormasDePagamentoDeCredito(List<FormaPagamento> formasDePagamentoDeCredito) { |
||
| 293 | this.formasDePagamentoDeCredito = formasDePagamentoDeCredito; |
||
| 294 | } |
||
| 295 | |||
| 296 | public List<BandeiraCartao> getBandeirasDeDebito() { |
||
| 297 | if (VerificadorUtil.estaNulo(bandeirasDeDebito)) { |
||
| 298 | setBandeirasDeDebito(bandeiraCartaoService.consultarBandeiraCartoesDeDebito()); |
||
| 299 | } |
||
| 300 | return bandeirasDeDebito; |
||
| 301 | } |
||
| 302 | public void setBandeirasDeDebito(List<BandeiraCartao> bandeirasDeDebito) { |
||
| 303 | this.bandeirasDeDebito = bandeirasDeDebito; |
||
| 304 | } |
||
| 305 | |||
| 306 | public List<BandeiraCartao> getBandeirasDeCredito() { |
||
| 307 | if (VerificadorUtil.estaNulo(bandeirasDeCredito)) { |
||
| 308 | setBandeirasDeCredito(bandeiraCartaoService.consultarBandeiraCartoesDeCredito()); |
||
| 309 | } |
||
| 310 | return bandeirasDeCredito; |
||
| 311 | } |
||
| 312 | public void setBandeirasDeCredito(List<BandeiraCartao> bandeirasDeCredito) { |
||
| 313 | this.bandeirasDeCredito = bandeirasDeCredito; |
||
| 314 | } |
||
| 315 | |||
| 316 | public List<Venda> getConsultarTodas() { |
||
| 317 | return vendaService.consultarTodos(new Venda()); |
||
| 318 | } |
||
| 319 | |||
| 320 | public ParcelaDataModel getParcelas() { |
||
| 321 | atualizarParcelas(getParametrosVenda().getVenda()); |
||
| 322 | return parcelas; |
||
| 323 | } |
||
| 324 | public void setParcelas(ParcelaDataModel parcelas) { |
||
| 325 | this.parcelas = parcelas; |
||
| 326 | } |
||
| 327 | public void atualizarParcelas(Venda venda) { |
||
| 328 | if (VerificadorUtil.naoEstaNulo(venda)) { |
||
| 329 | setParcelas(new ParcelaDataModel(parcelaService.consultarParcelasDaVenda(getParametrosVenda().getVenda().getSequencial()))); |
||
| 330 | } |
||
| 331 | } |
||
| 332 | |||
| 333 | public Boolean getEmitirCupom() { |
||
| 334 | return emitirCupom; |
||
| 335 | } |
||
| 336 | public void setEmitirCupom(Boolean emitirCupom) { |
||
| 337 | this.emitirCupom = emitirCupom; |
||
| 338 | } |
||
| 339 | |||
| 340 | public String getEmailParaEnvio() { |
||
| 341 | return emailParaEnvio; |
||
| 342 | } |
||
| 343 | public void setEmailParaEnvio(String emailParaEnvio) { |
||
| 344 | this.emailParaEnvio = emailParaEnvio; |
||
| 345 | } |
||
| 346 | |||
| 347 | public List<Vendedor> getVendedoresColaboradores() { |
||
| 348 | if (VerificadorUtil.estaNulo(vendedoresColaboradores)) { |
||
| 349 | setVendedoresColaboradores(vendedorService.consultarVendedoresColaboradores()); |
||
| 350 | } |
||
| 351 | return vendedoresColaboradores; |
||
| 352 | } |
||
| 353 | public void setVendedoresColaboradores(List<Vendedor> vendedoresColaboradores) { |
||
| 354 | this.vendedoresColaboradores = vendedoresColaboradores; |
||
| 355 | } |
||
| 356 | |||
| 357 | public List<Vendedor> getVendedoresColaboradoresAtivos() { |
||
| 358 | if (VerificadorUtil.estaNulo(vendedoresColaboradoresAtivos)) { |
||
| 359 | setVendedoresColaboradoresAtivos(vendedorService.consultarVendedoresColaboradoresAtivos(null)); |
||
| 360 | } |
||
| 361 | return vendedoresColaboradoresAtivos; |
||
| 362 | } |
||
| 363 | public void setVendedoresColaboradoresAtivos(List<Vendedor> vendedoresColaboradoresAtivos) { |
||
| 364 | this.vendedoresColaboradoresAtivos = vendedoresColaboradoresAtivos; |
||
| 365 | } |
||
| 366 | |||
| 367 | public List<Vendedor> getVendedoresExternos() { |
||
| 368 | if (VerificadorUtil.estaNulo(vendedoresExternos)) { |
||
| 369 | setVendedoresExternos(vendedorService.consultarVendedoresExternosAtivos()); |
||
| 370 | } |
||
| 371 | return vendedoresExternos; |
||
| 372 | } |
||
| 373 | public void setVendedoresExternos(List<Vendedor> vendedoresExternos) { |
||
| 374 | this.vendedoresExternos = vendedoresExternos; |
||
| 375 | } |
||
| 376 | |||
| 305 | espaco | 377 | public List<Estampa> getEstampas() { |
| 378 | if (VerificadorUtil.estaNulo(estampas)) { |
||
| 379 | setEstampas(estampaService.consultarEstampas(null)); |
||
| 380 | } |
||
| 381 | return estampas; |
||
| 382 | } |
||
| 383 | public void setEstampas(List<Estampa> estampas) { |
||
| 384 | this.estampas = estampas; |
||
| 385 | } |
||
| 386 | |||
| 106 | espaco | 387 | public TipoFrete[] getTiposFrete() { |
| 388 | return TipoFrete.values(); |
||
| 389 | } |
||
| 305 | espaco | 390 | |
| 391 | public TipoPersonalizacao[] getTiposPersonalizacao() { |
||
| 392 | return TipoPersonalizacao.values(); |
||
| 393 | } |
||
| 106 | espaco | 394 | |
| 395 | /***************************************************************/ |
||
| 396 | |||
| 397 | public void selecionarCodigoProduto(String codigoProduto) { |
||
| 398 | setCodigoProduto(codigoProduto); |
||
| 399 | } |
||
| 400 | |||
| 401 | public void prepararParaAlterarVenda(final Venda venda) { |
||
| 402 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 403 | public void execute() { |
||
| 404 | parametrosVenda = new ParametrosVendaDTO(venda); |
||
| 405 | } |
||
| 406 | }); |
||
| 407 | } |
||
| 408 | |||
| 409 | public void prepararParaAlterarVendaFinanceiro(final Venda venda) { |
||
| 410 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 411 | public void execute() { |
||
| 412 | parametrosVenda = new ParametrosVendaDTO(venda); |
||
| 413 | setParcelas(new ParcelaDataModel(parcelaService.consultarParcelasDaVenda(venda.getSequencial()))); |
||
| 414 | } |
||
| 415 | }); |
||
| 416 | } |
||
| 417 | |||
| 418 | public void prepararParaExcluirVenda(final Venda venda) { |
||
| 419 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 420 | public void execute() { |
||
| 421 | setVendaSelecionada(venda); |
||
| 422 | List<NotaFiscal> notasFiscais = notaFiscalService.consultarNotasFiscais(venda); |
||
| 423 | if (!notasFiscais.isEmpty()) { |
||
| 424 | String observacao = ""; |
||
| 425 | for (NotaFiscal notaFiscal : notasFiscais) { |
||
| 426 | observacao = notaFiscal.getNumeroNotaFiscal() + "; "; |
||
| 427 | } |
||
| 428 | setObservacaoExclusao("OBS.: NOTAS FISCAIS VINCULADAS: " + observacao); |
||
| 429 | } else { |
||
| 430 | setObservacaoExclusao(""); |
||
| 431 | } |
||
| 432 | } |
||
| 433 | }); |
||
| 434 | } |
||
| 435 | |||
| 436 | public void consultarProduto() { |
||
| 437 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 438 | public void execute() { |
||
| 439 | Produto produtoSelecionado = produtoService.consultarProdutoPorCodigoOuCodigoEAN(getCodigoProduto()); |
||
| 440 | if (VerificadorUtil.naoEstaNulo(produtoSelecionado)) { |
||
| 441 | getLancamento().preencher(produtoSelecionado); |
||
| 442 | } |
||
| 443 | getLancamento().setVenda(getEntidade()); |
||
| 444 | getLancamento().setAtivo(true); |
||
| 445 | } |
||
| 446 | }); |
||
| 447 | } |
||
| 448 | |||
| 449 | public void consultarProdutoPrecoPopular() { |
||
| 450 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 451 | public void execute() { |
||
| 452 | Produto produtoSelecionado = produtoService.consultarProdutoPorCodigoOuCodigoEAN(getCodigoProduto()); |
||
| 453 | if (VerificadorUtil.naoEstaNulo(produtoSelecionado)) { |
||
| 454 | getLancamento().preencherComPrecoPopular(produtoSelecionado); |
||
| 455 | } |
||
| 456 | getLancamento().setVenda(getEntidade()); |
||
| 457 | getLancamento().setAtivo(true); |
||
| 458 | } |
||
| 459 | }); |
||
| 460 | } |
||
| 461 | |||
| 462 | public void consultarProdutoPrecoAtacado() { |
||
| 463 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 464 | public void execute() { |
||
| 465 | Produto produtoSelecionado = produtoService.consultarProdutoPorCodigoOuCodigoEAN(getCodigoProduto()); |
||
| 466 | if (VerificadorUtil.naoEstaNulo(produtoSelecionado)) { |
||
| 467 | getLancamento().preencherComPrecoAtacado(produtoSelecionado); |
||
| 468 | } |
||
| 469 | getLancamento().setVenda(getEntidade()); |
||
| 470 | getLancamento().setAtivo(true); |
||
| 471 | } |
||
| 472 | }); |
||
| 473 | } |
||
| 474 | |||
| 475 | public void consultarProdutoFarma() { |
||
| 476 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 477 | public void execute() { |
||
| 478 | Produto produtoSelecionado = produtoService.consultarProdutoPorCodigoRapidoOuCodigoEAN(getCodigoProduto()); |
||
| 479 | if (VerificadorUtil.naoEstaNulo(produtoSelecionado)) { |
||
| 480 | getLancamento().preencher(produtoSelecionado); |
||
| 481 | } |
||
| 482 | getLancamento().setVenda(getEntidade()); |
||
| 483 | getLancamento().setAtivo(true); |
||
| 484 | } |
||
| 485 | }); |
||
| 486 | } |
||
| 487 | |||
| 488 | public void adicionarLancamento() { |
||
| 489 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 490 | public void execute() { |
||
| 491 | if (VerificadorUtil.estaNulo(getLancamento().getValorVenda())) { |
||
| 492 | getLancamento().setValorVenda(new Double(0.0)); |
||
| 493 | } |
||
| 494 | for (int i = 1; i <= getLancamento().getQuantidadeLancamento(); i++) { |
||
| 495 | try { |
||
| 496 | getLancamento().setObservacaoNotaFiscal(getLancamento().getObservacaoIMEI1() + " " + getLancamento().getObservacaoIMEI2()); |
||
| 497 | getLancamento().getObservacaoNotaFiscal().trim(); |
||
| 498 | getParametrosVenda().getLancamentos().add((Lancamento)getLancamento().clone()); |
||
| 499 | } catch (CloneNotSupportedException e) { |
||
| 500 | e.printStackTrace(); |
||
| 501 | } |
||
| 502 | } |
||
| 503 | // atualizarValorVendaSeForLojaFarmaciaEProdutoSemValorVenda(getLancamento()); |
||
| 504 | limparLancamento(); |
||
| 505 | LancadorMensagem.lancarSucesso("PRODUTO ADICIONADO COM SUCESSO"); |
||
| 506 | } |
||
| 507 | }); |
||
| 508 | } |
||
| 509 | |||
| 510 | public void adicionarLancamentoRestaurante() { |
||
| 511 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 512 | public void execute() { |
||
| 513 | if (VerificadorUtil.estaNulo(getLancamento().getValorVenda())) { |
||
| 514 | getLancamento().setValorVenda(new Double(0.0)); |
||
| 515 | } |
||
| 516 | for (int i = 1; i <= getLancamento().getQuantidadeLancamento(); i++) { |
||
| 517 | try { |
||
| 518 | String opcoes = ""; |
||
| 519 | for (String opcao : getLancamento().getOpcoesRestaurante()) { |
||
| 520 | opcoes = opcoes + opcao + " - "; |
||
| 521 | } |
||
| 522 | String observacoes = ""; |
||
| 523 | if (VerificadorUtil.naoEstaNuloOuVazio(opcoes)) { |
||
| 524 | observacoes = observacoes + opcoes; |
||
| 525 | } |
||
| 526 | if (VerificadorUtil.naoEstaNuloOuVazio(getLancamento().getOpcaoRestaurante())) { |
||
| 527 | observacoes = observacoes + getLancamento().getOpcaoRestaurante(); |
||
| 528 | } |
||
| 529 | if (VerificadorUtil.naoEstaNuloOuVazio(getLancamento().getObservacaoRestaurante())) { |
||
| 530 | observacoes = observacoes + " (" + getLancamento().getObservacaoRestaurante() + ")"; |
||
| 531 | } |
||
| 532 | getLancamento().setObservacao(observacoes); |
||
| 533 | getParametrosVenda().getLancamentos().add((Lancamento)getLancamento().clone()); |
||
| 534 | } catch (CloneNotSupportedException e) { |
||
| 535 | e.printStackTrace(); |
||
| 536 | } |
||
| 537 | } |
||
| 538 | limparLancamento(); |
||
| 539 | LancadorMensagem.lancarSucesso("PRODUTO ADICIONADO COM SUCESSO"); |
||
| 540 | } |
||
| 541 | }); |
||
| 542 | } |
||
| 543 | |||
| 544 | /* |
||
| 545 | * MÉTODO DA FARMÁCIA |
||
| 546 | *//* |
||
| 547 | protected void atualizarValorVendaSeForLojaFarmaciaEProdutoSemValorVenda(Lancamento lancamento) { |
||
| 548 | if (getParametrosVenda().getLoja().getSequencial().equals(ConstantesSEC.SEQUENCIAL_LOJA_FARMACIA_7)) { |
||
| 549 | if (lancamento.getProduto().tipoProdutoEhRemedioOuOutros()) { |
||
| 550 | Produto produto = produtoService.consultarProdutoPorCodigo(lancamento.getProduto().getCodigo()); |
||
| 551 | if (VerificadorUtil.estaNuloOuVazio(produto.getValorVarejo())) { |
||
| 552 | produto.setValorVarejo(lancamento.getValorVenda()); |
||
| 553 | produtoService.alterar(produto); |
||
| 554 | } |
||
| 555 | } |
||
| 556 | } |
||
| 557 | }*/ |
||
| 558 | |||
| 559 | public void removerLancamento(final Lancamento lancamento) { |
||
| 560 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 561 | public void execute() { |
||
| 562 | getParametrosVenda().getLancamentos().remove(lancamento); |
||
| 563 | LancadorMensagem.lancarSucesso("PRODUTO REMOVIDO COM SUCESSO"); |
||
| 564 | } |
||
| 565 | }); |
||
| 566 | } |
||
| 567 | |||
| 568 | public void limparLancamento() { |
||
| 569 | setLancamento(new Lancamento()); |
||
| 570 | setCodigoProduto(""); |
||
| 571 | } |
||
| 572 | |||
| 573 | public void limparPagamento() { |
||
| 574 | setBandeiraCartao(null); |
||
| 575 | setValorPagamento(null); |
||
| 576 | } |
||
| 577 | |||
| 578 | public void prepararPagamento() { |
||
| 579 | limparPagamento(); |
||
| 580 | Double subtotal = getParametrosVenda().valorTotalLancamentos() /*+ getParametrosVenda().getValorFrete() */ - getParametrosVenda().valorTotalPago(); |
||
| 581 | if (subtotal > 0) { |
||
| 582 | setValorPagamento(subtotal); |
||
| 583 | } |
||
| 584 | } |
||
| 585 | |||
| 586 | public void prepararPagamentoComCupom() { |
||
| 587 | prepararPagamento(); |
||
| 588 | setCupomSelecionado(new Cupom()); |
||
| 589 | } |
||
| 590 | |||
| 688 | blopes | 591 | public void prepararPagamentoComCashback() { |
| 592 | limparPagamento(); |
||
| 593 | Double subtotalPago = getParametrosVenda().valorTotalLancamentos() - getParametrosVenda().valorTotalPago(); |
||
| 594 | Double subtotal = getParametrosVenda().getCliente().getValorCashbackDisponivel(); |
||
| 595 | if (subtotal > 0) { |
||
| 596 | if (subtotal > subtotalPago) { |
||
| 597 | setValorPagamento(subtotalPago); |
||
| 598 | } else { |
||
| 599 | setValorPagamento(subtotal); |
||
| 600 | } |
||
| 601 | } |
||
| 602 | } |
||
| 603 | |||
| 106 | espaco | 604 | public void adicionarPagamentoEmDinheiro() { |
| 605 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 606 | public void execute() { |
||
| 607 | adicionarPagamento(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DINHEIRO)); |
||
| 608 | } |
||
| 609 | }); |
||
| 610 | } |
||
| 611 | |||
| 612 | public void adicionarPagamentoEmPix() { |
||
| 613 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 614 | public void execute() { |
||
| 615 | adicionarPagamento(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_PIX)); |
||
| 616 | } |
||
| 617 | }); |
||
| 618 | } |
||
| 619 | |||
| 344 | espaco | 620 | public void adicionarPagamentoEmTransferencia() { |
| 621 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 622 | public void execute() { |
||
| 623 | adicionarPagamento(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_TRANSFERENCIA)); |
||
| 624 | } |
||
| 625 | }); |
||
| 626 | } |
||
| 627 | |||
| 106 | espaco | 628 | public void adicionarPagamentoComOutros() { |
| 629 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 630 | public void execute() { |
||
| 631 | adicionarPagamento(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_OUTROS)); |
||
| 632 | } |
||
| 633 | }); |
||
| 634 | } |
||
| 635 | |||
| 636 | private void adicionarPagamento(FormaPagamento formaPagamento) { |
||
| 637 | VendaFormaPagamento vendaFormaPagamento = new VendaFormaPagamento(getEntidade(), formaPagamentoService.consultarPorId(formaPagamento)); |
||
| 638 | vendaFormaPagamento.setValorPagamento(getValorPagamento()); |
||
| 639 | adicionarPagamento(vendaFormaPagamento); |
||
| 640 | } |
||
| 641 | |||
| 642 | public void adicionarPagamentoEmDebito() { |
||
| 643 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 644 | public void execute() { |
||
| 645 | FormaPagamento formaPagamento = formaPagamentoService.consultarPorId(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO)); |
||
| 646 | VendaFormaPagamento vendaFormaPagamento = new VendaFormaPagamento(getEntidade(), formaPagamento, getBandeiraCartao()); |
||
| 647 | vendaFormaPagamento.setValorPagamento(getValorPagamento()); |
||
| 648 | verificarPagamentoNoCartao(formaPagamento); |
||
| 649 | adicionarPagamento(vendaFormaPagamento); |
||
| 650 | } |
||
| 651 | }); |
||
| 652 | } |
||
| 653 | |||
| 654 | public void adicionarPagamentoEmCredito() { |
||
| 655 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 656 | public void execute() { |
||
| 657 | VendaFormaPagamento vendaFormaPagamento = new VendaFormaPagamento(getEntidade(), getFormaPagamento(), getBandeiraCartao()); |
||
| 658 | vendaFormaPagamento.setValorPagamento(getValorPagamento()); |
||
| 659 | verificarPagamentoNoCartao(getFormaPagamento()); |
||
| 660 | adicionarPagamento(vendaFormaPagamento); |
||
| 661 | } |
||
| 662 | }); |
||
| 663 | } |
||
| 664 | |||
| 665 | public void adicionarPagamentoComCupom() { |
||
| 666 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 667 | public void execute() { |
||
| 668 | FormaPagamento formaPagamento = formaPagamentoService.consultarPorId(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_CUPOM)); |
||
| 669 | VendaFormaPagamento vendaFormaPagamento = new VendaFormaPagamento(getEntidade(), formaPagamento); |
||
| 670 | vendaFormaPagamento.setValorPagamento(getValorPagamento()); |
||
| 671 | vendaFormaPagamento.setCupom(getCupomSelecionado()); |
||
| 672 | adicionarPagamento(vendaFormaPagamento); |
||
| 673 | } |
||
| 674 | }); |
||
| 675 | } |
||
| 676 | |||
| 686 | blopes | 677 | public void adicionarPagamentoComCashback() { |
| 678 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 710 | blopes | 679 | public void execute() { |
| 680 | for (VendaFormaPagamento pagamento : getParametrosVenda().getLancamentosPagamentos()) { |
||
| 681 | if (pagamento.getFormaPagamento().formaPagamentoEhCashback()) { |
||
| 682 | throw new NegocioException("SÓ É PERMITIDO APENAS UM CASHBACK NA VENDA"); |
||
| 683 | } |
||
| 684 | } |
||
| 685 | |||
| 689 | blopes | 686 | Double valorCashback = new Double(getValorPagamento()); |
| 687 | Double valorCashbackDisponivel = new Double(getParametrosVenda().getCliente().getValorCashbackDisponivel()); |
||
| 688 | if (VerificadorUtil.naoEstaNuloOuVazio(valorCashback)) { |
||
| 689 | if (VerificadorUtil.naoEstaNuloOuVazio(valorCashbackDisponivel)) { |
||
| 690 | if (valorCashbackDisponivel < valorCashback) { |
||
| 691 | throw new NegocioException("VALOR DE CASHBACK MAIOR QUE O PERMITIDO"); |
||
| 692 | } |
||
| 693 | } |
||
| 694 | } |
||
| 695 | |||
| 686 | blopes | 696 | FormaPagamento formaPagamento = formaPagamentoService.consultarPorId(new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_CASHBACK_28)); |
| 697 | VendaFormaPagamento vendaFormaPagamento = new VendaFormaPagamento(getEntidade(), formaPagamento); |
||
| 698 | vendaFormaPagamento.setValorPagamento(getValorPagamento()); |
||
| 699 | adicionarPagamento(vendaFormaPagamento); |
||
| 710 | blopes | 700 | retirarCashbackCliente(valorCashback); |
| 686 | blopes | 701 | } |
| 702 | |||
| 688 | blopes | 703 | private void retirarCashbackCliente(Double valor) { |
| 704 | getParametrosVenda().getCliente().setValorCashbackDisponivel(getParametrosVenda().getCliente().getValorCashbackDisponivel() - valor); |
||
| 686 | blopes | 705 | } |
| 706 | }); |
||
| 707 | } |
||
| 710 | blopes | 708 | public void retirarPagamentosCashback() { |
| 709 | for (VendaFormaPagamento pagamento : getParametrosVenda().getLancamentosPagamentos()) { |
||
| 710 | if (pagamento.getFormaPagamento().formaPagamentoEhCashback()) { |
||
| 711 | throw new NegocioException("RETIRE O CASHBACK DA VENDA PARA PROSSEGUIR"); |
||
| 712 | } |
||
| 713 | } |
||
| 714 | } |
||
| 686 | blopes | 715 | |
| 710 | blopes | 716 | public void retirarPagamentoComCashback(final VendaFormaPagamento pagamento) { |
| 717 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 718 | public void execute() { |
||
| 719 | if (pagamento.getFormaPagamento().formaPagamentoEhCashback()) { |
||
| 720 | if (VerificadorUtil.naoEstaNulo(getParametrosVenda().getCliente().getValorCashbackDisponivel())) { |
||
| 721 | getParametrosVenda().getCliente().setValorCashbackDisponivel(getParametrosVenda().getCliente().getValorCashbackDisponivel() + pagamento.getValorPagamento()); |
||
| 722 | } |
||
| 723 | } |
||
| 724 | } |
||
| 725 | }); |
||
| 726 | } |
||
| 727 | |||
| 106 | espaco | 728 | public void adicionarPagamento(final VendaFormaPagamento vendaFormaPagamento) { |
| 729 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 730 | public void execute() { |
||
| 731 | verificarPagamento(vendaFormaPagamento); |
||
| 280 | espaco | 732 | // seParcelaAcima12xAlterarMaquineta(getFormaPagamento()); |
| 106 | espaco | 733 | getParametrosVenda().getLancamentosPagamentos().add(vendaFormaPagamento); |
| 734 | setFormaPagamento(null); |
||
| 735 | setValorPagamento(null); |
||
| 736 | setCupomSelecionado(null); |
||
| 737 | LancadorMensagem.lancarSucesso("PAGAMENTO ADICIONADO COM SUCESSO"); |
||
| 738 | } |
||
| 739 | |||
| 740 | private void verificarPagamento(VendaFormaPagamento vendaFormaPagamento) { |
||
| 741 | if (VerificadorUtil.estaNulo(getValorPagamento())) { |
||
| 742 | throw new NegocioException("VALOR DE PAGAMENTO INCORRETO"); |
||
| 743 | } |
||
| 744 | if (getValorPagamento().equals(new Double(0))) { |
||
| 745 | throw new NegocioException("VALOR DE PAGAMENTO INCORRETO"); |
||
| 746 | } |
||
| 747 | /* |
||
| 748 | for (VendaFormaPagamento pagamento : getParametrosVenda().getLancamentosPagamentos()) { |
||
| 749 | if (pagamento.getCodigoDaFormaPagamento().equals(vendaFormaPagamento.getCodigoDaFormaPagamento())) { |
||
| 750 | throw new NegocioException("FORMA DE PAGAMENTO JÁ EXISTE"); |
||
| 751 | } |
||
| 752 | } |
||
| 753 | */ |
||
| 754 | } |
||
| 277 | espaco | 755 | |
| 756 | private void seParcelaAcima12xAlterarMaquineta(FormaPagamento formaPagamento) { |
||
| 757 | if (formaPagamento.formaPagamentoEhCreditoAcima12x()) { |
||
| 758 | getParametrosVenda().setMaquineta(null); |
||
| 759 | } |
||
| 760 | } |
||
| 106 | espaco | 761 | }); |
| 762 | } |
||
| 763 | |||
| 764 | protected void verificarPagamentoNoCartao(FormaPagamento formaPagamento) { |
||
| 765 | if (VerificadorUtil.estaNulo(getBandeiraCartao())) { |
||
| 766 | throw new RuntimeException("É OBRIGATÓRIO INFORMAR A BANDEIRA"); |
||
| 767 | } |
||
| 768 | if (VerificadorUtil.estaNulo(formaPagamento)) { |
||
| 769 | throw new RuntimeException("É OBRIGATÓRIO INFORMAR A BANDEIRA"); |
||
| 770 | } |
||
| 771 | } |
||
| 772 | |||
| 773 | public void removerPagamento(final VendaFormaPagamento pagamento) { |
||
| 774 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 775 | public void execute() { |
||
| 776 | getParametrosVenda().getLancamentosPagamentos().remove(pagamento); |
||
| 710 | blopes | 777 | retirarPagamentoComCashback(pagamento); |
| 106 | espaco | 778 | LancadorMensagem.lancarSucesso("PRODUTO REMOVIDO COM SUCESSO"); |
| 779 | } |
||
| 780 | }); |
||
| 781 | } |
||
| 782 | |||
| 783 | public void selecionarCliente(final Cliente cliente) { |
||
| 784 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 785 | public void execute() { |
||
| 786 | cliente.setAtivo(true); |
||
| 787 | clienteService.alterar(cliente); |
||
| 788 | getParametrosVenda().setCliente(clienteService.consultarClientePorCpfCnpj(cliente.getCpfCnpj())); |
||
| 789 | setCpfCnpjCliente(null); |
||
| 790 | adicionandoParametroArgsConfirmandoAcao(true); |
||
| 791 | } |
||
| 792 | }); |
||
| 793 | } |
||
| 794 | |||
| 795 | public void retirarCliente() { |
||
| 710 | blopes | 796 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 797 | public void execute() { |
||
| 798 | retirarPagamentosCashback(); |
||
| 799 | getParametrosVenda().setCliente(null); |
||
| 800 | } |
||
| 801 | }); |
||
| 106 | espaco | 802 | } |
| 803 | |||
| 804 | public List<Vendedor> consultarVendedoresColaboradores() { |
||
| 805 | return vendedorService.consultarVendedoresColaboradores(); |
||
| 806 | } |
||
| 807 | |||
| 808 | public List<Vendedor> consultarVendedoresColaboradoresAtivos() { |
||
| 809 | return vendedorService.consultarVendedoresColaboradoresAtivos(null); |
||
| 810 | } |
||
| 811 | |||
| 812 | public List<Vendedor> consultarVendedoresExternos() { |
||
| 813 | return vendedorService.consultarVendedoresExternosAtivos(); |
||
| 814 | } |
||
| 815 | |||
| 816 | public void iniciarNovaVenda() { |
||
| 817 | Loja lojaSelecionada = getParametrosVenda().getLoja(); |
||
| 818 | setParametrosVenda(new ParametrosVendaDTO()); |
||
| 819 | getParametrosVenda().setLoja(lojaSelecionada); |
||
| 820 | getParametrosVenda().setMaquineta(lojaSelecionada.getMaquineta()); |
||
| 821 | getParametrosVenda().setUsuario(contextoSeguranca.obterUsuario()); |
||
| 822 | } |
||
| 823 | |||
| 824 | public void iniciarVenda() { |
||
| 825 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 826 | public void execute() { |
||
| 827 | LancadorMensagem.lancarSucessoRedirecionandoTela("VENDA REALIZADA COM SUCESSO!", "/sistema/pdv.xhtml?sequencialLoja=" + getParametrosVenda().getLoja().getSequencial()); |
||
| 828 | } |
||
| 829 | }); |
||
| 830 | } |
||
| 831 | |||
| 832 | public void cadastrarVendaSemCupom() { |
||
| 833 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 834 | public void execute() { |
||
| 305 | espaco | 835 | Venda vendaCadastrada = vendaService.cadastrarVendaPeloPDV(getParametrosVenda()); |
| 836 | Long sequencialNovoPedido = pedidoService.cadastrarPedidoVendaPersonalizada(vendaCadastrada, getParametrosVenda()); |
||
| 837 | if (VerificadorUtil.naoEstaNulo(sequencialNovoPedido)) { |
||
| 838 | LancadorMensagem.lancarSucesso("Nº PERSONALIZAÇÃO: " + sequencialNovoPedido); |
||
| 839 | } |
||
| 106 | espaco | 840 | iniciarNovaVenda(); |
| 311 | espaco | 841 | LancadorMensagem.lancarSucesso("VENDA REALIZADA COM SUCESSO"); |
| 106 | espaco | 842 | } |
| 843 | }); |
||
| 844 | } |
||
| 845 | |||
| 846 | public void cadastrarVendaComCupom() { |
||
| 847 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 848 | public void execute() { |
||
| 849 | setVendaSelecionada(vendaService.cadastrarVendaPeloPDV(getParametrosVenda())); |
||
| 305 | espaco | 850 | Long sequencialNovoPedido = pedidoService.cadastrarPedidoVendaPersonalizada(getVendaSelecionada(), getParametrosVenda()); |
| 851 | if (VerificadorUtil.naoEstaNulo(sequencialNovoPedido)) { |
||
| 852 | LancadorMensagem.lancarSucesso("Nº PERSONALIZAÇÃO: " + sequencialNovoPedido); |
||
| 853 | } |
||
| 106 | espaco | 854 | preCarregamento(); |
| 855 | getParametrosVenda().setLoja(getVendaSelecionada().getLoja()); |
||
| 280 | espaco | 856 | getParametrosVenda().setMaquineta(getVendaSelecionada().getLoja().getMaquineta()); |
| 106 | espaco | 857 | setEmitirCupom(true); |
| 311 | espaco | 858 | LancadorMensagem.lancarSucesso("VENDA REALIZADA COM SUCESSO"); |
| 106 | espaco | 859 | } |
| 860 | }); |
||
| 861 | } |
||
| 862 | |||
| 863 | public void cadastrarVendaFarma() { |
||
| 864 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 865 | public void execute() { |
||
| 866 | vendaService.cadastrarVendaPeloPDV(getParametrosVenda()); |
||
| 867 | LancadorMensagem.lancarSucessoRedirecionandoTela("VENDA REALIZADA COM SUCESSO!", "/sistema/pdv.xhtml?sequencialLoja=" + getParametrosVenda().getLoja().getSequencial()); |
||
| 868 | } |
||
| 869 | }); |
||
| 870 | } |
||
| 871 | |||
| 872 | public void cadastrarVendaRestaurante() { |
||
| 873 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 874 | public void execute() { |
||
| 875 | setVendaSelecionada(vendaService.cadastrarVendaPeloPDV(getParametrosVenda())); |
||
| 876 | preCarregamento(); |
||
| 877 | getParametrosVenda().setLoja(getVendaSelecionada().getLoja()); |
||
| 280 | espaco | 878 | getParametrosVenda().setMaquineta(getVendaSelecionada().getLoja().getMaquineta()); |
| 106 | espaco | 879 | getVendaSelecionada().setEmitirComanda(true); |
| 880 | setEmitirCupom(true); |
||
| 881 | LancadorMensagem.lancarSucesso("VENDA REALIZADA COM SUCESSO"); |
||
| 882 | } |
||
| 883 | }); |
||
| 884 | } |
||
| 885 | |||
| 886 | public void alterarVenda(final Boolean verificarJustificativa) { |
||
| 887 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 888 | public void execute() { |
||
| 889 | if (verificarJustificativa) { |
||
| 890 | if (VerificadorUtil.estaNuloOuVazio(getParametrosVenda().getVenda().getJustificativaParaExcluir())) { |
||
| 891 | throw new NegocioException("JUSTIFICATIVA OBRIGATÓRIA"); |
||
| 892 | } |
||
| 893 | } |
||
| 894 | vendaService.alterarVenda(getParametrosVenda(), contextoSeguranca.obterUsuario(), verificarJustificativa); |
||
| 895 | adicionandoParametroArgsConfirmandoAcao(true); |
||
| 896 | LancadorMensagem.lancarSucesso("VENDA ALTERADA COM SUCESSO"); |
||
| 897 | } |
||
| 898 | }); |
||
| 899 | } |
||
| 900 | |||
| 901 | public void excluirVendaSelecionada() { |
||
| 902 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 903 | public void execute() { |
||
| 904 | if (VerificadorUtil.estaNuloOuVazio(getVendaSelecionada().getJustificativaParaExcluir())) { |
||
| 905 | throw new RuntimeException("É OBRIGATÓRIO JUSTIFICAR"); |
||
| 906 | } |
||
| 907 | vendaService.excluirVenda(getVendaSelecionada(), contextoSeguranca.obterUsuario()); |
||
| 908 | adicionandoParametroArgsConfirmandoAcao(true); |
||
| 909 | LancadorMensagem.lancarSucesso("VENDA EXCLUÍDA COM SUCESSO"); |
||
| 910 | } |
||
| 911 | }); |
||
| 912 | } |
||
| 913 | |||
| 914 | public void excluirVenda(final Venda venda) { |
||
| 915 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 916 | public void execute() { |
||
| 917 | vendaService.excluirVenda(venda, contextoSeguranca.obterUsuario()); |
||
| 918 | adicionandoParametroArgsConfirmandoAcao(true); |
||
| 919 | LancadorMensagem.lancarSucesso("VENDA EXCLUÍDA COM SUCESSO"); |
||
| 920 | } |
||
| 921 | }); |
||
| 922 | } |
||
| 923 | |||
| 924 | public String verificarFinanceiro(Venda venda) { |
||
| 925 | Conta contaAReceber = new Conta(); |
||
| 926 | contaAReceber.setVenda(venda); |
||
| 927 | contaAReceber.setIndicadorAtivo(true); |
||
| 928 | if (contaAReceberService.obterQuantidadeDeRegistrosPassandoEntidade(contaAReceber) == 0) { |
||
| 929 | return "NENHUMA"; |
||
| 930 | } |
||
| 931 | return parcelaService.verificarPossuiParcelaAberta(venda) ? "PENDENTE" : "QUITADO"; |
||
| 932 | } |
||
| 933 | |||
| 934 | public void prepararEnvioCupomEmail() { |
||
| 935 | setEmailParaEnvio(getVendaSelecionada().getEmailDoCliente()); |
||
| 936 | } |
||
| 937 | |||
| 938 | public void enviarCupomPorEmail() { |
||
| 939 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 940 | public void execute() { |
||
| 941 | lancarExcecaoCasoEmailNaoInformado(); |
||
| 942 | try { |
||
| 943 | JasperPrint relatorio = notaFiscalService.retornarRelatorio(getVendaSelecionada()); |
||
| 944 | byte[] arquivo = JasperExportManager.exportReportToPdf(relatorio); |
||
| 945 | new GerenciadorEmailImpl() |
||
| 946 | .comEmailsDestino(getEmailParaEnvio()) |
||
| 947 | .comAssunto("CUPOM EMITIDO POR ESPAÇO CASE") |
||
| 948 | .comConteudoHtml("OBRIGADO PELA PREFERÊNCIA!") |
||
| 949 | .adicionarAnexo("CUPOM.pdf", arquivo, "pdf") |
||
| 950 | .enviar(); |
||
| 951 | LancadorMensagem.lancarSucesso("Cupom enviado por email."); |
||
| 952 | } catch (Exception e) { |
||
| 953 | e.printStackTrace(); |
||
| 954 | } |
||
| 955 | } |
||
| 956 | |||
| 957 | private void lancarExcecaoCasoEmailNaoInformado() { |
||
| 958 | if (VerificadorUtil.estaNuloOuVazio(getEmailParaEnvio())) { |
||
| 959 | throw new NegocioException("Obrigatório informar o email de destino"); |
||
| 960 | } |
||
| 961 | } |
||
| 962 | }); |
||
| 963 | } |
||
| 964 | |||
| 965 | /*************************************************/ |
||
| 966 | |||
| 967 | public void informarEtico() { |
||
| 968 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 969 | public void execute() { |
||
| 970 | alterarCategoria(new Long(343), "ÉTICO"); |
||
| 971 | } |
||
| 972 | }); |
||
| 973 | } |
||
| 974 | |||
| 975 | public void informarGenerico() { |
||
| 976 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 977 | public void execute() { |
||
| 978 | alterarCategoria(new Long(340), "GENÉRICO"); |
||
| 979 | } |
||
| 980 | }); |
||
| 981 | } |
||
| 982 | |||
| 983 | public void informarSimilar() { |
||
| 984 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 985 | public void execute() { |
||
| 986 | alterarCategoria(new Long(338), "SIMILAR"); |
||
| 987 | } |
||
| 988 | }); |
||
| 989 | } |
||
| 990 | |||
| 991 | public void informarOutros() { |
||
| 992 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 993 | public void execute() { |
||
| 994 | alterarCategoria(new Long(339), "OUTROS"); |
||
| 995 | } |
||
| 996 | }); |
||
| 997 | } |
||
| 998 | |||
| 999 | public void alterarCategoria(final Long sequencialModelo, final String modelo) { |
||
| 1000 | Modelo modeloNovo = new Modelo(); |
||
| 1001 | modeloNovo.setSequencial(sequencialModelo); |
||
| 1002 | modeloService.consultarPorId(modeloNovo); |
||
| 1003 | getLancamento().getProduto().setModelo(modeloNovo); |
||
| 1004 | produtoService.alterar(getLancamento().getProduto()); |
||
| 1005 | setCodigoProduto(""); |
||
| 1006 | LancadorMensagem.lancarSucesso("CATEGORIA ALTERADA PARA " + modelo); |
||
| 1007 | } |
||
| 1008 | |||
| 1009 | public void informarLocalizacao() { |
||
| 1010 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 1011 | public void execute() { |
||
| 1012 | produtoLojaService.alterarLocalizacao(getLocalizacaoNova(), getLancamento().getProduto(), getParametrosVenda().getLoja()); |
||
| 1013 | LancadorMensagem.lancarSucesso("LOCALIZAÇÃO ALTERADA PARA " + getLocalizacaoNova()); |
||
| 1014 | setCodigoProduto(""); |
||
| 1015 | setLocalizacaoNova(""); |
||
| 1016 | } |
||
| 1017 | }); |
||
| 1018 | } |
||
| 1019 | |||
| 1020 | public void prepararAdicionarCupom(Lancamento lancamento) { |
||
| 1021 | setLancamentoSelecionado(lancamento); |
||
| 1022 | setCupomSelecionado(new Cupom()); |
||
| 1023 | } |
||
| 1024 | |||
| 1025 | public void consultarCupom(final String tipoCupom) { |
||
| 1026 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 1027 | public void execute() { |
||
| 1028 | setCupomSelecionado(cupomService.consultarCupomPorCodigo(getCupomSelecionado().getCodigo())); |
||
| 1029 | verificarCupomValido(); |
||
| 1030 | verificarInclusaoDoCupom(getCupomSelecionado(), tipoCupom); |
||
| 1031 | getCupomSelecionado().setLancamento(getLancamentoSelecionado()); |
||
| 1032 | |||
| 1033 | if (VerificadorUtil.naoEstaNulo(getCupomSelecionado().getValor())) { |
||
| 1034 | setValorPagamento(getCupomSelecionado().getValor()); |
||
| 1035 | } else if (VerificadorUtil.naoEstaNulo(getCupomSelecionado().getPercentual())) { |
||
| 1036 | setValorPagamento(getCupomSelecionado().getLancamento().getValorVenda() * getCupomSelecionado().getPercentual() / 100); |
||
| 1037 | } |
||
| 1038 | } |
||
| 1039 | |||
| 1040 | private void verificarCupomValido() { |
||
| 1041 | if (VerificadorUtil.estaNulo(getCupomSelecionado())) { |
||
| 1042 | setCupomSelecionado(new Cupom()); |
||
| 1043 | throw new NegocioException("CUPOM NÃO LOCALIZADO"); |
||
| 1044 | } else { |
||
| 1045 | if (!getCupomSelecionado().valido() || !getCupomSelecionado().getAtivo()) { |
||
| 1046 | setCupomSelecionado(new Cupom()); |
||
| 1047 | throw new NegocioException("CUPOM INVÁLIDO"); |
||
| 1048 | } |
||
| 1049 | if (getCupomSelecionado().getLimiteUtilizacao()) { |
||
| 1050 | Integer vendasComCupom = lancamentoService.obterQuantidadeVendasComCupom(getCupomSelecionado()); |
||
| 1051 | vendasComCupom += vendaFormaPagamentoService.obterQuantidadePagamentosComCupom(getCupomSelecionado()); |
||
| 1052 | if (vendasComCupom > 0) { |
||
| 1053 | setCupomSelecionado(new Cupom()); |
||
| 1054 | throw new NegocioException("CUPOM JÁ UTILIZADO ANTERIORMENTE"); |
||
| 1055 | } |
||
| 1056 | } |
||
| 1057 | } |
||
| 1058 | } |
||
| 1059 | |||
| 1060 | private void verificarInclusaoDoCupom(Cupom cupom, String tipoCupom) { |
||
| 1061 | if (TipoCupom.PROMOCIONAL.getValor().equals(tipoCupom)) { |
||
| 1062 | if (!cupom.getTipoCupom().equals(TipoCupom.PROMOCIONAL.getValor())) { |
||
| 1063 | setCupomSelecionado(new Cupom()); |
||
| 1064 | throw new NegocioException("PERMITIDO APENAS PARA CUPONS PROMOCIONAIS"); |
||
| 1065 | } |
||
| 1066 | if (getLancamentoSelecionado().getProduto().getProdutoEmPromocao()) { |
||
| 1067 | setCupomSelecionado(new Cupom()); |
||
| 1068 | throw new NegocioException("AÇÃO NÃO PERMITIDA: PRODUTO JÁ EM PROMOÇÃO"); |
||
| 1069 | } |
||
| 1070 | } else if (TipoCupom.REEMBOLSO.getValor().equals(tipoCupom)) { |
||
| 1071 | if (!cupom.getTipoCupom().equals(TipoCupom.REEMBOLSO.getValor())) { |
||
| 1072 | setCupomSelecionado(new Cupom()); |
||
| 1073 | throw new NegocioException("PERMITIDO APENAS PARA CUPONS DE REEMBOLSO"); |
||
| 1074 | } |
||
| 1075 | } |
||
| 1076 | } |
||
| 1077 | }); |
||
| 1078 | } |
||
| 1079 | |||
| 1080 | public void adicionarCupom() { |
||
| 1081 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 1082 | public void execute() { |
||
| 693 | blopes | 1083 | validarRegraCupom(getParametrosVenda(), getCupomSelecionado()); |
| 106 | espaco | 1084 | verificarSeValorMaiorDesconto(getValorPagamento()); |
| 1085 | verificarSeCupomJaFoiAdicionado(getCupomSelecionado(), getParametrosVenda().getLancamentos()); |
||
| 1086 | for (Lancamento lancamento : getParametrosVenda().getLancamentos()) { |
||
| 1087 | if (lancamento.equals(getCupomSelecionado().getLancamento())) { |
||
| 1088 | lancamento.setCupom(getCupomSelecionado()); |
||
| 1089 | lancamento.setValorVarejo(lancamento.getValorVarejo() - getValorPagamento()); |
||
| 1090 | lancamento.setValorVenda(lancamento.getValorVenda() - getValorPagamento()); |
||
| 1091 | break; |
||
| 1092 | } |
||
| 1093 | } |
||
| 1094 | LancadorMensagem.lancarSucesso("CUPOM ADICIONADO COM SUCESSO"); |
||
| 1095 | } |
||
| 1096 | |||
| 693 | blopes | 1097 | private void validarRegraCupom(ParametrosVendaDTO parametrosVenda, Cupom cupomSelecionado) { |
| 1098 | cupomService.validarRegrasCupom(getParametrosVenda(), getCupomSelecionado()); |
||
| 1099 | } |
||
| 1100 | |||
| 106 | espaco | 1101 | private void verificarSeCupomJaFoiAdicionado(Cupom cupomSelecionado, List<Lancamento> lancamentos) { |
| 1102 | if (cupomSelecionado.getLimiteUtilizacao()) { |
||
| 1103 | for (Lancamento lancamento : getParametrosVenda().getLancamentos()) { |
||
| 1104 | if (VerificadorUtil.naoEstaNulo(lancamento.getCupom())) { |
||
| 1105 | if (lancamento.getCupom().equals(cupomSelecionado)) { |
||
| 1106 | throw new RuntimeException("CUPOM JÁ FOI UTILIZADO"); |
||
| 1107 | } |
||
| 1108 | } |
||
| 1109 | } |
||
| 1110 | } |
||
| 1111 | } |
||
| 1112 | |||
| 1113 | private void verificarSeValorMaiorDesconto(Double valorPagamento) { |
||
| 1114 | if (VerificadorUtil.naoEstaNulo(getCupomSelecionado().getValor())) { |
||
| 1115 | if (valorPagamento > getCupomSelecionado().getValor()) { |
||
| 1116 | throw new RuntimeException("VALOR DO DESCONTO ACIMA DO PERMITIDO"); |
||
| 1117 | } |
||
| 1118 | } else if (VerificadorUtil.naoEstaNulo(getCupomSelecionado().getPercentual())) { |
||
| 1119 | if (valorPagamento > getCupomSelecionado().getLancamento().getValorVenda() * getCupomSelecionado().getPercentual() / 100) { |
||
| 1120 | throw new RuntimeException("VALOR DO DESCONTO ACIMA DO PERMITIDO"); |
||
| 1121 | } |
||
| 1122 | } |
||
| 1123 | } |
||
| 1124 | }); |
||
| 1125 | } |
||
| 1126 | |||
| 1127 | public void removerCupom(Lancamento lancamento) { |
||
| 1128 | for (Lancamento lancamentoVendas : getParametrosVenda().getLancamentos()) { |
||
| 1129 | if (lancamentoVendas.equals(lancamento)) { |
||
| 1130 | lancamentoVendas.setCupom(null); |
||
| 1131 | lancamentoVendas.setValorVarejo(lancamento.getValorVarejo() + getValorPagamento()); |
||
| 1132 | lancamentoVendas.setValorVenda(lancamento.getValorVenda() + getValorPagamento()); |
||
| 1133 | break; |
||
| 1134 | } |
||
| 1135 | } |
||
| 1136 | LancadorMensagem.lancarSucesso("CUPOM REMOVIDO COM SUCESSO"); |
||
| 1137 | } |
||
| 1138 | |||
| 1139 | public void vincularPedido() { |
||
| 1140 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 1141 | public void execute() { |
||
| 1142 | Pedido pedido = new Pedido(); |
||
| 1143 | pedido.setSequencial(new Long(getCodigoPedido())); |
||
| 1144 | getParametrosVenda().setPedidoVinculado(pedidoService.consultarPedidoCompleto(pedido)); |
||
| 1145 | if (VerificadorUtil.naoEstaNulo(getParametrosVenda().getPedidoVinculado())) { |
||
| 330 | espaco | 1146 | verificarSePedidoEhValido(getParametrosVenda().getPedidoVinculado()); |
| 106 | espaco | 1147 | getParametrosVenda().setObservacao("PEDIDO VINCULADO: " + getParametrosVenda().getPedidoVinculado().getSequencial() + ". " + getParametrosVenda().getObservacao()); |
| 1148 | Vendedor vendedorPedido = vendedorService.consultarVendedorPorPessoa(getParametrosVenda().getPedidoVinculado().getUsuarioPedido().getPessoa()); |
||
| 1149 | if (VerificadorUtil.naoEstaNulo(vendedorPedido)) { |
||
| 1150 | getParametrosVenda().setVendedor(vendedorPedido); |
||
| 1151 | } |
||
| 1152 | |||
| 1153 | for (PedidoProduto pedidoProduto : getParametrosVenda().getPedidoVinculado().getProdutos()) { |
||
| 1154 | Integer quantidadeProduto = 1; |
||
| 1155 | while (quantidadeProduto <= pedidoProduto.getQuantidade()) { |
||
| 1156 | Lancamento lancamento = new Lancamento(); |
||
| 1157 | lancamento.preencher(pedidoProduto.getProduto()); |
||
| 1158 | lancamento.setValorVenda(pedidoProduto.getValor()); |
||
| 1159 | lancamento.setObservacao(pedidoProduto.getObservacao()); |
||
| 1160 | getParametrosVenda().getLancamentos().add(lancamento); |
||
| 1161 | quantidadeProduto++; |
||
| 1162 | } |
||
| 1163 | } |
||
| 1164 | |||
| 1165 | if (VerificadorUtil.naoEstaNulo(getParametrosVenda().getPedidoVinculado().getCliente())) { |
||
| 1166 | getParametrosVenda().setCliente(getParametrosVenda().getPedidoVinculado().getCliente()); |
||
| 1167 | } |
||
| 1168 | setCodigoPedido(""); |
||
| 1169 | LancadorMensagem.lancarSucesso("PEDIDO " + getParametrosVenda().getPedidoVinculado().getSequencial() + " VINCULADO"); |
||
| 1170 | } else { |
||
| 1171 | LancadorMensagem.lancarErro("PEDIDO NÃO ENCONTRADO"); |
||
| 1172 | } |
||
| 1173 | } |
||
| 330 | espaco | 1174 | |
| 1175 | private void verificarSePedidoEhValido(Pedido pedidoVinculado) { |
||
| 1176 | if (getParametrosVenda().getPedidoVinculado().getTipoSituacao().equals(TipoSituacaoPedido.FINALIZADO.getValor()) || |
||
| 1177 | getParametrosVenda().getPedidoVinculado().getTipoSituacao().equals(TipoSituacaoPedido.FINALIZADO_COM_VENDAS.getValor())) { |
||
| 1178 | throw new NegocioException("VÍNCULO NÃO REALIZADO: PEDIDO JÁ FINALIZADO"); |
||
| 1179 | } |
||
| 1180 | if (getParametrosVenda().getPedidoVinculado().getTipoSituacao().equals(TipoSituacaoPedido.INVALIDO.getValor())) { |
||
| 1181 | throw new NegocioException("VÍNCULO NÃO REALIZADO: PEDIDO INVÁLIDO"); |
||
| 1182 | } |
||
| 1183 | } |
||
| 106 | espaco | 1184 | }); |
| 1185 | } |
||
| 1186 | |||
| 710 | blopes | 1187 | public void verificarCashback() { |
| 1188 | if (VerificadorUtil.naoEstaNulo(getParametrosVenda().getCliente())) { |
||
| 1189 | getParametrosVenda().getCliente().setValorCashbackDisponivel(cashbackService.consultarSaldoCliente(getParametrosVenda().getCliente().getSequencial())); |
||
| 1190 | } |
||
| 1191 | } |
||
| 1192 | |||
| 106 | espaco | 1193 | } |