diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java index b1afd3449..c7b9bea09 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java @@ -101,6 +101,7 @@ import com.rjconsultores.ventaboletos.service.PuntoVentaService; import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService; import com.rjconsultores.ventaboletos.service.UsuarioBancarioService; import com.rjconsultores.ventaboletos.service.UsuarioService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.FechamentoParamptovtaListItemRenderer; @@ -307,6 +308,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { private Checkbox ckIsento; private MyTextbox txtNumIEPuntoVenta; private Datebox fecIntegracion; + private boolean integracionTotvs; public static final int INTERVALO_FECHAMENTO_SEMANAL = 7; public static final int INTERVALO_FECHAMENTO_DECENDIAL = 10; @@ -793,52 +795,50 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { } public void onClick$btnIntegracao(Event ev) throws InterruptedException { - + Connection myConn = null; - + try { myConn = dataSource.getConnection(); myConn.setAutoCommit(false); - + Date dateInicio = fecIntegracion.getValue(); - + dateInicio = DateUtil.inicioFecha(dateInicio); Date dateFim = DateUtil.fimFecha(fecIntegracion.getValue()); - - log.info("puntoVentaId="+puntoVenta.getPuntoventaId()+";fecInicio="+dateInicio+";fecFin="+dateFim); - + + log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim); + TotvsService.cadastrarTituloAReceber(puntoVenta.getPuntoventaId(), dateInicio, dateFim, myConn); - + myConn.commit(); } catch (Exception e) { - - if (myConn != null) { + + if (myConn != null) { try { myConn.rollback(); } catch (SQLException e1) { - log.error("Erro rollback",e1); + log.error("Erro rollback", e1); } } - - - if (e instanceof WrongValueException){ - throw (WrongValueException)e; + + if (e instanceof WrongValueException) { + throw (WrongValueException) e; } - + log.error("", e); - - + Messagebox.show( e.getMessage(), Labels.getLabel("editarPuntoVentaController.window.title"), Messagebox.OK, Messagebox.ERROR); - - }finally{ - if (myConn != null){ + + } finally { + if (myConn != null) { try { myConn.close(); } catch (SQLException e) { - log.error("Erro ao fechar a conexão",e); + log.error("Erro ao fechar a conexão", e); } } } @@ -2530,4 +2530,15 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { this.radTotvsErro = radTotvsErro; } + public boolean isIntegracionTotvs() { + integracionTotvs = false; + if (ApplicationProperties.getInstance().integracionTotvs()) { + integracionTotvs = true; + } + return integracionTotvs; + } + + public void setIntegracionTotvs(boolean integracionTotvs) { + this.integracionTotvs = integracionTotvs; + } } diff --git a/web/gui/catalogos/editarPuntoVenta.zul b/web/gui/catalogos/editarPuntoVenta.zul index 56e18a6fe..51d5b79d5 100644 --- a/web/gui/catalogos/editarPuntoVenta.zul +++ b/web/gui/catalogos/editarPuntoVenta.zul @@ -94,9 +94,9 @@ maxlength="10" constraint="no empty" value="@{winEditarPuntoVenta$composer.puntoVenta.numPuntoVenta}" /> - - - + + +