leonardo 2017-08-03 13:43:44 +00:00
parent c93256ff27
commit 6842879d0d
2 changed files with 29 additions and 2 deletions

View File

@ -1158,7 +1158,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
GeradorTitulosAG gerador = new GeradorTitulosAG(myConn, dateInicio, dateFim); GeradorTitulosAG gerador = new GeradorTitulosAG(myConn, dateInicio, dateFim);
log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim); log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim);
gerador.send(checkAdiantamentoAG.isChecked(), checkBoletoAG.isChecked(), checkCartaoAG.isChecked(), checkDepositoAG.isChecked()); gerador.send(checkAdiantamentoAG.isChecked(), checkBoletoAG.isChecked(), checkCartaoAG.isChecked(), checkDepositoAG.isChecked(), false);
gerador.mostraResultado(); gerador.mostraResultado();
@ -1200,7 +1200,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
GeradorTitulosAG gerador = new GeradorTitulosAG(myConn, dateInicio, dateFim); GeradorTitulosAG gerador = new GeradorTitulosAG(myConn, dateInicio, dateFim);
log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim); log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim);
gerador.execute(checkTodosPuntosVentaAG.isChecked() ? null : puntoVenta.getPuntoventaId(), checkAdiantamentoAG.isChecked(), checkBoletoAG.isChecked(), checkCartaoAG.isChecked(), checkDepositoAG.isChecked()); gerador.execute(checkTodosPuntosVentaAG.isChecked() ? null : puntoVenta.getPuntoventaId(), checkAdiantamentoAG.isChecked(), checkBoletoAG.isChecked(), checkCartaoAG.isChecked(), checkDepositoAG.isChecked(), false);
} catch (Exception e) { } catch (Exception e) {
log.error("Erro ao integrar", e); log.error("Erro ao integrar", e);

View File

@ -1,5 +1,6 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.comissao; package com.rjconsultores.ventaboletos.web.gui.controladores.comissao;
import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -23,6 +24,7 @@ import org.zkoss.zul.Combobox;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox; import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Constante;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.exception.ComissaoException; import com.rjconsultores.ventaboletos.exception.ComissaoException;
@ -31,6 +33,7 @@ import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioReciboComissao;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio;
import com.rjconsultores.ventaboletos.service.CalculoComissaoService; import com.rjconsultores.ventaboletos.service.CalculoComissaoService;
import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -39,6 +42,7 @@ import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo;
import com.rjconsultores.ventaboletos.web.utilerias.MaskUtil; import com.rjconsultores.ventaboletos.web.utilerias.MaskUtil;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.wsag.GeradorTitulosAG;
@Scope("prototype") @Scope("prototype")
@Controller("busquedaCalculoComissaoController") @Controller("busquedaCalculoComissaoController")
@ -56,6 +60,12 @@ public class BusquedaCalculoComissaoController extends MyGenericForwardComposer
@Autowired @Autowired
private DataSource dataSourceRead; private DataSource dataSourceRead;
@Autowired
private DataSource dataSource;
@Autowired
private ConstanteService constanteService;
private Combobox cmbEmpresa; private Combobox cmbEmpresa;
private List<Empresa> lsEmpresas; private List<Empresa> lsEmpresas;
private List<PuntoVenta> lsPuntoVenta; private List<PuntoVenta> lsPuntoVenta;
@ -187,6 +197,23 @@ public class BusquedaCalculoComissaoController extends MyGenericForwardComposer
} else { } else {
calculoComissaoService.registrarCalculoComissao(empresa, periodo, chkIgnorarGerados.isChecked()); calculoComissaoService.registrarCalculoComissao(empresa, periodo, chkIgnorarGerados.isChecked());
} }
Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG");
if (empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(empresa.getEmpresaId().toString())) {
log.debug("iniciando integração com AG");
Connection myConn = dataSource.getConnection();
Date dateAtual = new Date();
Date dateInicio = DateUtil.inicioFecha(periodo);
Date dateFim = DateUtil.fimFecha(dateAtual);
GeradorTitulosAG gerador = new GeradorTitulosAG(myConn, dateInicio, dateFim);
gerador.execute(puntoVenta.getPuntoventaId(), false, false, false, false, true);
gerador.send(false, false, false, false, true);
log.debug("fim da integração com AG");
}
Messagebox.show( Messagebox.show(
Labels.getLabel("busquedaCalculoComissaoController.registro.comissao.msg"), Labels.getLabel("busquedaCalculoComissaoController.registro.comissao.msg"),
Labels.getLabel("busquedaCalculoComissaoController.window.title"), Labels.getLabel("busquedaCalculoComissaoController.window.title"),