edgar 2016-07-05 17:23:59 +00:00
parent 110f605363
commit 67723fcd13
5 changed files with 268 additions and 232 deletions

View File

@ -13,6 +13,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
@ -50,6 +51,7 @@ import org.zkoss.zul.Button;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Constraint;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Doublebox;
import org.zkoss.zul.Filedownload;
@ -119,6 +121,8 @@ 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;
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintEmailOrEmpty;
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintNoEmpty;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -361,9 +365,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
private Checkbox checkDom;
private String logFileSelected;
private static final int TAMANHO_BUFFER = 4096; // 4kb
@Autowired
private DataSource dataSource;
@ -378,22 +382,21 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void aplicarMascara() {
Clients.evalJavaScript(
"jQuery('#" + txtNumFax.getUuid() + "').mask('(999)9999-9999?9');" +
"jQuery('#" + numtelefonodos.getUuid() + "').mask('(999)9999-9999?9');" +
"jQuery('#" + numtelefonouno.getUuid() + "').mask('(999)9999-9999?9');")
;
"jQuery('#" + numtelefonodos.getUuid() + "').mask('(999)9999-9999?9');" +
"jQuery('#" + numtelefonouno.getUuid() + "').mask('(999)9999-9999?9');");
}
private List<String> getLogFiles(){
private List<String> getLogFiles() {
List<String> files = new ArrayList<String>();
File logDir = new File(System.getProperty("jboss.server.log.dir"));
for (String str : logDir.list()){
if (str.contains("ws") && !str.contains("zip")){
File logDir = new File(System.getProperty("jboss.server.log.dir"));
for (String str : logDir.list()) {
if (str.contains("ws") && !str.contains("zip")) {
files.add(str);
}
}
return files;
}
@Override
public void doAfterCompose(Component comp) throws Exception {
lsCategoriaBloquear = categoriaService.obtenerTodasCategoriasVisibles();
@ -403,27 +406,27 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
lsBanco = ptovtaBancoService.obtenerTodos();
lsColonia = new ArrayList<Colonia>();
/*lsNodos = nodoService.obtenerTodos();*/
lsFormaPago = formaPagoService.obtenerTodos();
lsEmpresasFormapago = new ArrayList<Empresa>();
lsEmpresasFormapago.add(empresaService.obtenerID(-1));
lsEmpresasFormapago.addAll(UsuarioLogado.getUsuarioLogado().getEmpresa());
lsTipoPuntoVenta = tipoPuntoVentaService.obtenerTodosExceto(TipoPuntoVenta.TODOS);
lsUsuarioBancario = usuarioBancarioService.obtenerTodos();
lsLogFiles = getLogFiles();
lsLogFiles = getLogFiles();
puntoVenta = (PuntoVenta) Executions.getCurrent().getArg().get("puntoVenta");
super.doAfterCompose(comp);
cmbBanco.addEventListener("onAfterRender", new org.zkoss.zk.ui.event.EventListener(){
public void onEvent(Event event) throws Exception{
cmbBanco.setSelectedIndex(lsBanco.indexOf(puntoVenta.getAgenciaId().getInstiFinanceiraId()));
}
cmbBanco.addEventListener("onAfterRender", new org.zkoss.zk.ui.event.EventListener() {
public void onEvent(Event event) throws Exception {
cmbBanco.setSelectedIndex(lsBanco.indexOf(puntoVenta.getAgenciaId().getInstiFinanceiraId()));
}
});
aplicarMascara();
popularCombobox(cmbTipoConta, cmbPessoa, cmbForm, cmbLote, cmbPosicao, cmbReceita, cmbEmpresas, cmbCategorias);
ptovtaEmpresasBloqueadasList.setItemRenderer(new RenderEmpresaBloquear());
@ -441,7 +444,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
});
try {
fechamentoParamptovtaList.setItemRenderer(new FechamentoParamptovtaListItemRenderer());
if (puntoVenta.getPuntoventaId() != null) {
@ -485,7 +488,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
txtRazonSocial.setValue(puntoVenta.getRazonSocial());
}
List<FechamentoParamptovta> params = fechamentoParamptovtaService.buscaParametrosPorPuntoventa(puntoVenta);
fechamentoParamptovtaList.setData(params);
}
@ -505,7 +507,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
if (puntoVenta.getPuntoventaId() != null) {
if (puntoVenta.getAgenciaId() != null) {
if (puntoVenta.getAgenciaId().getInstiFinanceiraId() != null) {
if (puntoVenta.getAgenciaId().getInstiFinanceiraId() != null) {
txtNomeBanco.setText(puntoVenta.getAgenciaId().getInstiFinanceiraId().getCodigo());
}
@ -717,52 +719,52 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
Labels.getLabel("editarEmpresaController.window.title"),
Messagebox.OK, Messagebox.ERROR);
}
txtNome.focus();
if(puntoVenta.getValidaTempoParaImpressao() != null) {
if (puntoVenta.getValidaTempoParaImpressao() != null) {
txtTempoParaImpressao.setDisabled(!puntoVenta.getValidaTempoParaImpressao());
}
}
public void onClick$btnDownload(Event event) {
String fileName = System.getProperty("jboss.server.log.dir") + "/" + cmbLogFiles.getSelectedItem().getValue().toString();
String fileZip = System.getProperty("jboss.server.log.dir") + "/" + cmbLogFiles.getSelectedItem().getValue().toString().replace("log", "zip");
FileInputStream inputStream;
try {
excluirArquivosZip();
compactarArquivo(fileZip, fileName);
File file = new File(fileZip);
if (file.exists()) {
inputStream = new FileInputStream(file);
Filedownload.save(inputStream, new MimetypesFileTypeMap().getContentType(file), file.getName());
}
file.delete();
public void onClick$btnDownload(Event event) {
String fileName = System.getProperty("jboss.server.log.dir") + "/" + cmbLogFiles.getSelectedItem().getValue().toString();
String fileZip = System.getProperty("jboss.server.log.dir") + "/" + cmbLogFiles.getSelectedItem().getValue().toString().replace("log", "zip");
FileInputStream inputStream;
try {
excluirArquivosZip();
compactarArquivo(fileZip, fileName);
File file = new File(fileZip);
if (file.exists()) {
inputStream = new FileInputStream(file);
Filedownload.save(inputStream, new MimetypesFileTypeMap().getContentType(file), file.getName());
}
file.delete();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private String readFile(String fileName) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
}
private String readFile(String fileName) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(fileName));
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append("\n");
line = br.readLine();
}
return sb.toString();
} finally {
br.close();
}
}
while (line != null) {
sb.append(line);
sb.append("\n");
line = br.readLine();
}
return sb.toString();
} finally {
br.close();
}
}
@Transactional
public boolean validaFuncionTipoBoletoBloqueado() {
List<String> listClavesPermisos = new ArrayList<String>();
@ -856,18 +858,18 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
InstiFinanceira banco = (InstiFinanceira) cmbBanco.getSelectedItem().getValue();
txtNomeBanco.setValue(banco.getCodigo());
}
public void onSelect$cmbEmpresaPtoVta() {
Empresa empresa = (Empresa) cmbEmpresaPtoVta.getSelectedItem().getValue();
lsEmpresaContaBancarias = ptovtaBancoService.buscarContasBancariasPorIdEmpresa(empresa.getEmpresaId());
if(lsEmpresaContaBancarias != null && !lsEmpresaContaBancarias.isEmpty()) {
cmbEmpresasContaBancarias.setModel(new BindingListModelList(lsEmpresaContaBancarias, true));
lsEmpresaContaBancarias = ptovtaBancoService.buscarContasBancariasPorIdEmpresa(empresa.getEmpresaId());
if (lsEmpresaContaBancarias != null && !lsEmpresaContaBancarias.isEmpty()) {
cmbEmpresasContaBancarias.setModel(new BindingListModelList(lsEmpresaContaBancarias, true));
} else {
cmbEmpresasContaBancarias.setModel(new BindingListModelList(new ArrayList(), true));
cmbEmpresasContaBancarias.setSelectedItem(null);
}
}
}
public void onClick$ckIsento(Event ev) {
@ -899,8 +901,8 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
if (cmbColonia.getSelectedItem() == null) {
return;
} else {
// Colonia col = (Colonia) cmbColonia.getSelectedItem().getValue();
// txtCP.setValue(col.getCodpostal());
// Colonia col = (Colonia) cmbColonia.getSelectedItem().getValue();
// txtCP.setValue(col.getCodpostal());
}
}
@ -913,10 +915,10 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
return getString;
}
public void onClick$btnGeraTitulos(Event ev) throws InterruptedException {
Connection myConn = null;
GeradorTitulosIntegracion gerador;
GeradorTitulosIntegracion gerador;
try {
myConn = dataSource.getConnection();
Date dateInicio = fecIntegracion.getValue();
@ -926,13 +928,12 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim);
gerador = new GeradorTitulosIntegracion(myConn, puntoVenta.getPuntoventaId(), dateInicio,
dateFim,checkTodosPuntosVenta.isChecked());
gerador = new GeradorTitulosIntegracion(myConn, puntoVenta.getPuntoventaId(), dateInicio,
dateFim, checkTodosPuntosVenta.isChecked());
gerador.execute();
} catch (Exception e) {
log.error("Erro ao integrar",e);
log.error("Erro ao integrar", e);
if (e instanceof WrongValueException) {
throw (WrongValueException) e;
@ -951,7 +952,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void onClick$btnIntegracao(Event ev) throws InterruptedException {
Connection myConn = null;
GeradorTitulosIntegracion gerador;
GeradorTitulosIntegracion gerador;
try {
myConn = dataSource.getConnection();
Date dateInicio = fecIntegracion.getValue();
@ -960,14 +961,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
Date dateFim = DateUtil.fimFecha(fecIntegracion.getValue());
log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim);
GerenciadorEnvioTitulosWS gerenciadorWS = new GerenciadorEnvioTitulosWS(myConn, checkDinheiro.isChecked(),
checkCredito.isChecked(), checkDebito.isChecked(), checkTF.isChecked(), checkBOL.isChecked(),
checkCredito.isChecked(), checkDebito.isChecked(), checkTF.isChecked(), checkBOL.isChecked(),
checkSimulaIntegracion.isChecked(), dateInicio, dateFim);
gerenciadorWS.execute();
} catch (Exception e) {
log.error("Erro ao integrar",e);
log.error("Erro ao integrar", e);
if (e instanceof WrongValueException) {
throw (WrongValueException) e;
@ -980,14 +981,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.OK, Messagebox.ERROR);
}finally {
// if (myConn != null) {
// try {
// myConn.close();
// } catch (SQLException e) {
// log.error("Erro ao fechar a conexão", e);
// }
// }
} finally {
// if (myConn != null) {
// try {
// myConn.close();
// } catch (SQLException e) {
// log.error("Erro ao fechar a conexão", e);
// }
// }
}
}
@ -1064,10 +1065,11 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void onClick$btnAdicionarPtoVtaSeguro(Event ev) {
if (cmbEmpresaSeguro.getSelectedItem() != null &&
(radIndvendsegopcionalSi.isChecked() || radIndvendsegopcionalNo.isChecked() ||
radIndestansegopcionalSi.isChecked() || radIndestansegopcionalNo.isChecked()) &&
(radIndPermisoTasaEmbarqueSi.isChecked() || radIndPermisoTasaEmbarqueNo.isChecked() ||
radIndEstanTasaEmbarqueSi.isChecked() || radIndEstanTasaEmbarqueNo.isChecked())) {
(radIndvendsegopcionalSi.isChecked() || radIndvendsegopcionalNo.isChecked() ||
radIndestansegopcionalSi.isChecked() || radIndestansegopcionalNo.isChecked())
&&
(radIndPermisoTasaEmbarqueSi.isChecked() || radIndPermisoTasaEmbarqueNo.isChecked() ||
radIndEstanTasaEmbarqueSi.isChecked() || radIndEstanTasaEmbarqueNo.isChecked())) {
Empresa empresa = (Empresa) cmbEmpresaSeguro.getSelectedItem().getValue();
@ -1149,7 +1151,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
}
public void onClick$btnSalvar(Event ev) throws InterruptedException {
txtMaxCancelacion.getValue();
txtNome.getValue();
txtNumPtoVta.getValue();
@ -1157,20 +1158,11 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
txtCompl.getValue();
txtNumAg.getValue();
txtConta.getValue();
txtDigito.getValue();
txtBilhetes.getValue();
txtCarga.getValue();
txtTitularNome.getValue();
txtTitularCpf.getValue();
txtTitularRg.getValue();
txtTitularEmissor.getValue();
txtAntecipRetem.getValue();
txtAntecipPercentual.getValue();
txtResponAluguel.getValue();
txtResponTel.getValue();
txtResponEnergia.getValue();
cmbEmpresa.getValue();
cmbParada.getValue();
cmbPtoVtaCheckinParada.getValue();
@ -1183,7 +1175,23 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
cmbBanco.getValue();
cmbPessoa.getValue();
cmbTipoConta.getValue();
cmbPosicao.getValue();
if (!txtTitularNome.getValue().isEmpty()
|| !txtTitularNome.getValue().isEmpty()
|| !txtTitularRg.getValue().isEmpty()
|| !txtTitularEmissor.getValue().isEmpty()
|| img.getContent() != null) {
txtTitularCpf.setConstraint(new ConstraintNoEmpty());
txtTitularCpf.getValue();
puntoVenta.getTitularId().setActivo(Boolean.TRUE);
puntoVenta.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
puntoVenta.getTitularId().setFecmodif(Calendar.getInstance().getTime());
} else {
puntoVenta.setTitularId(null);
}
validarDiversos();
String numagencia = txtNumAg.getValue() + (StringUtils.isBlank(txtDigitoAg.getValue()) ? "" : "-" + txtDigitoAg.getValue());
puntoVenta.getAgenciaId().setNumagencia(numagencia);
@ -1216,9 +1224,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
return;
}
}
if(ckValidarTempoParaImpressao.isChecked() && txtTempoParaImpressao.getValue() == null) {
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.informarTempoMinimo.value"), Labels.getLabel("editarPuntoVentaController.window.title"),
if (ckValidarTempoParaImpressao.isChecked() && txtTempoParaImpressao.getValue() == null) {
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.informarTempoMinimo.value"), Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
txtTempoParaImpressao.focus();
return;
@ -1226,7 +1234,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
try {
if (puntoVenta.getEmpresa() == null) {
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.empresa"), Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.empresa"), Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
} else if (puntoVenta.getTipoPuntoVenta() == null) {
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.punto"), Labels.getLabel("editarPuntoVentaController.window.title"),
@ -1235,7 +1243,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.moneda"), Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
/*} else if (puntoVenta.getNodo() == null) {
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.nodo"), Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.nodo"), Labels.getLabel("editarPuntoVentaController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);*/
} else if (lsFormaPagoDet.isEmpty()) {
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.formaDePago"), Labels.getLabel("editarPuntoVentaController.window.title"),
@ -1309,34 +1317,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
puntoVenta.getAgenciaId().setFecmodif(Calendar.getInstance().getTime());
}
if (txtTitularCpf.getValue().equals("")) {
puntoVenta.setTitularId(null);
} else {
puntoVenta.getTitularId().setActivo(Boolean.TRUE);
puntoVenta.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
puntoVenta.getTitularId().setFecmodif(Calendar.getInstance().getTime());
}
if ((txtResponAluguel.getValue().equals("") && (txtResponTel.getValue().equals("")))) {
puntoVenta.setDiversosId(null);
} else {
puntoVenta.getDiversosId().setBilheteInfo(checkBilheteInfo.isChecked());
puntoVenta.getDiversosId().setInformatizada(checkInformatizada.isChecked());
puntoVenta.getDiversosId().setVendaInternet(checkVendaInternet.isChecked());
puntoVenta.getDiversosId().setTeleEntrega(checkTeleEntrega.isChecked());
puntoVenta.getDiversosId().setDigitacaoSeq(checkDigitacao.isChecked());
puntoVenta.getDiversosId().setTrabalhaBilhete(checkBilhete.isChecked());
puntoVenta.getDiversosId().setOfpsPropria(checkOfpsPropria.isChecked());
puntoVenta.getDiversosId().setOfpsTerceiros(checkOfpsTerceiros.isChecked());
puntoVenta.getDiversosId().setActivo(Boolean.TRUE);
puntoVenta.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
puntoVenta.getDiversosId().setFecmodif(Calendar.getInstance().getTime());
if (cmbPosicao.getSelectedItem() != null) {
puntoVenta.getDiversosId().setPosicao((String) cmbPosicao.getSelectedItem().getValue());
}
}
List<PtovtaEmpresa> lsPto = new ArrayList<PtovtaEmpresa>();
for (PtovtaEmpresa pto : lsPtovtaEmpresa) {
if (!pto.getActivo()) {
@ -1413,7 +1393,33 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
Messagebox.OK, Messagebox.ERROR);
}
}
private void validarDiversos() {
if ( !txtResponEnergia.getValue().isEmpty()
|| cmbPosicao.getSelectedItem() != null
|| checkInformatizada.isChecked()
|| checkBilheteInfo.isChecked()
|| checkVendaInternet.isChecked()
|| checkTeleEntrega.isChecked()
|| checkDigitacao.isChecked()
|| checkBilhete.isChecked()
|| checkOfpsPropria.isChecked()
|| checkOfpsTerceiros.isChecked()) {
txtResponAluguel.setConstraint(new ConstraintNoEmpty());
txtResponAluguel.getValue();
txtResponTel.setConstraint(new ConstraintNoEmpty());
txtResponTel.getValue();
puntoVenta.getDiversosId().setActivo(Boolean.TRUE);
puntoVenta.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
puntoVenta.getDiversosId().setFecmodif(Calendar.getInstance().getTime());
} else {
puntoVenta.setDiversosId(null);
}
}
public void onClick$btnApagar(Event ev) {
try {
int resp = Messagebox.show(
@ -1520,15 +1526,15 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
timeboxFim.getValue();
try {
PtovtaHorario horario = new PtovtaHorario();
horario.setInddomingo(checkDom.isChecked());
horario.setIndjueves(checkJue.isChecked());
horario.setIndlunes(checkLun.isChecked());
horario.setIndmartes(checkMar.isChecked());
horario.setIndmiercoles(checkMie.isChecked());
horario.setIndsabado(checkSab.isChecked());
horario.setIndviernes(checkVie.isChecked());
horario.setIndviernes(checkVie.isChecked());
horario.setInicio(timeboxInicio.getValue());
horario.setFim(timeboxFim.getValue());
horario.setPuntoventaId(puntoVenta);
@ -1632,15 +1638,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
}
if (!achou) {
FormaPagoDet fpd = new FormaPagoDet();
/*
* Mantis #6874
* fpd.setCargosextras(new BigDecimal(txtCargosExtras.getValue()));
/*
* Mantis #6874 fpd.setCargosextras(new BigDecimal(txtCargosExtras.getValue()));
*/
fpd.setCargosextras(BigDecimal.ZERO);
fpd.setFormaPago(formaPago);
fpd.setPuntoVenta(puntoVenta);
if(cmbEmpresaFormaPago.getSelectedItem() != null) {
if (cmbEmpresaFormaPago.getSelectedItem() != null) {
fpd.setEmpresa(empresa);
}
@ -1754,7 +1759,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
ptovtaEmpresa.setEmpresa((Empresa) cmbEmpresaPtoVta.getSelectedItem().getValue());
for (PtovtaEmpresa fpd : lsPtovtaEmpresa) {
if (fpd.getEmpresa().equals(ptovtaEmpresa.getEmpresa())&& fpd.getActivo()) {
if (fpd.getEmpresa().equals(ptovtaEmpresa.getEmpresa()) && fpd.getActivo()) {
achou = Boolean.TRUE;
}
}
@ -1768,8 +1773,8 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
ptovtaEmpresa.setIndBloqueada(checkPtoVtaEmpresaIndBloqueada.isChecked());
ptovtaEmpresa.setIndMostrarCaja(checkPtoVtaEmpresaIndMostrarCaja.isChecked());
ptovtaEmpresa.setNumeroSitef(txtNumeroSitef.getText());
if (cmbEmpresasContaBancarias.getSelectedItem() != null){
if (cmbEmpresasContaBancarias.getSelectedItem() != null) {
ptovtaEmpresa.setEmpresaContaBancaria((EmpresaContaBancaria) cmbEmpresasContaBancarias.getSelectedItem().getValue());
}
lsPtovtaEmpresa.add(ptovtaEmpresa);
@ -2045,7 +2050,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void setLsBanco(List<InstiFinanceira> lsBanco) {
this.lsBanco = lsBanco;
}
}
public Combobox getCmbBanco() {
return cmbBanco;
@ -2532,7 +2537,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
this.txtRazonSocial = txtRazonSocial;
}
public String getLogFileSelected() {
return logFileSelected;
}
@ -2569,7 +2573,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
args.put("ptovtaComissaoList", ptovtaComissaoList);
openWindow("/gui/catalogos/editarPuntoVentaComissao.zul",
Labels.getLabel("editarPuntoVentaComissaoController.window.title", new String[]{ptovtaComissao.getEmpresaId().getNombempresa()}), args, MODAL);
Labels.getLabel("editarPuntoVentaComissaoController.window.title", new String[] { ptovtaComissao.getEmpresaId().getNombempresa() }), args, MODAL);
}
@ -2583,11 +2587,11 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
if (resp == Messagebox.YES) {
FechamentoParamptovta fpp = (FechamentoParamptovta) fechamentoParamptovtaList.getSelected();
if(puntoVenta!= null && puntoVenta.getPuntoventaId()!= null){
if (puntoVenta != null && puntoVenta.getPuntoventaId() != null) {
fechamentoParamptovtaService.borrar(fpp);
List<FechamentoParamptovta> params = fechamentoParamptovtaService.buscaParametrosPorPuntoventa(puntoVenta);
fechamentoParamptovtaList.setData(params);
}else{
} else {
fechamentoParamptovtaList.removeItem(fpp);
}
}
@ -2599,22 +2603,18 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void onClick$btnAdicionarFechamentoParamptovta(Event ev) {
txtDiasemtransito.getValue();
if (cmbEmpresaFechamentoParamptovta.getSelectedItem() != null &&
(radIntervalofechamentoDiario.isChecked() || radIntervalofechamentoSemanal.isChecked()
|| radIntervalofechamentoDecendial.isChecked()
|| radIntervalofechamentoQuinzenal.isChecked()
|| radIntervalofechamentoMensal.isChecked()
)
) {
|| radIntervalofechamentoMensal.isChecked())) {
Empresa empresa = (Empresa) cmbEmpresaFechamentoParamptovta.getSelectedItem().getValue();
FechamentoParamptovta fechamentoParamptovta = new FechamentoParamptovta();
fechamentoParamptovta.setEmpresa(empresa);
fechamentoParamptovta.setPuntoventa(puntoVenta);
Integer intervalofechamento = 0;
if (radIntervalofechamentoSemanal.isChecked()) {
intervalofechamento = Constantes.INTERVALO_FECHAMENTO_SEMANAL;
@ -2628,13 +2628,13 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
} else if (radIntervalofechamentoMensal.isChecked()) {
intervalofechamento = Constantes.INTERVALO_FECHAMENTO_MENSAL;
}else if (radIntervalofechamentoDiario.isChecked()) {
} else if (radIntervalofechamentoDiario.isChecked()) {
intervalofechamento = Constantes.INTERVALO_FECHAMENTO_DIARIO;
}
fechamentoParamptovta.setIntervalofechamento(intervalofechamento);
if(StringUtils.isNotBlank(txtDiasemtransito.getValue())) {
if (StringUtils.isNotBlank(txtDiasemtransito.getValue())) {
fechamentoParamptovta.setDiasemtransito(Integer.valueOf(txtDiasemtransito.getValue()));
}
@ -2645,11 +2645,11 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
boolean validado = validaFechamentoParamptovta(fechamentoParamptovta);
if (validado) {
if(puntoVenta!= null && puntoVenta.getPuntoventaId()!=null){
if (puntoVenta != null && puntoVenta.getPuntoventaId() != null) {
fechamentoParamptovtaService.suscribir(fechamentoParamptovta);
List<FechamentoParamptovta> params = fechamentoParamptovtaService.buscaParametrosPorPuntoventa(puntoVenta);
fechamentoParamptovtaList.setData(params);
}else{
} else {
fechamentoParamptovtaList.addItemNovo(fechamentoParamptovta);
}
resetDadosFechamentoParamptovta();
@ -2677,7 +2677,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
radIntervalofechamentoDecendial.setChecked(false);
radIntervalofechamentoQuinzenal.setChecked(false);
radIntervalofechamentoMensal.setChecked(false);
radIntervalofechamentoDiario.setChecked(false);
radIntervalofechamentoDiario.setChecked(false);
}
private boolean validaFechamentoParamptovta(FechamentoParamptovta fechamentoParamptovta) {
@ -2755,46 +2755,46 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void setBtnShowLog(Button btnShowLog) {
this.btnShowLog = btnShowLog;
}
public static void compactarArquivo(String arqSaida,String arqEntrada) throws IOException{
int cont;
byte[] dados = new byte[TAMANHO_BUFFER];
BufferedInputStream origem = null;
FileInputStream streamDeEntrada = null;
FileOutputStream destino = null;
ZipOutputStream saida = null;
ZipEntry entry = null;
try {
destino = new FileOutputStream(new File(arqSaida));
saida = new ZipOutputStream(new BufferedOutputStream(destino));
File file = new File(arqEntrada);
streamDeEntrada = new FileInputStream(file);
origem = new BufferedInputStream(streamDeEntrada, TAMANHO_BUFFER);
entry = new ZipEntry(file.getName());
saida.putNextEntry(entry);
while((cont = origem.read(dados, 0, TAMANHO_BUFFER)) != -1) {
saida.write(dados, 0, cont);
}
origem.close();
saida.close();
} catch(IOException e) {
throw new IOException(e.getMessage());
}
}
private void excluirArquivosZip(){
File pasta = new File(System.getProperty("jboss.server.log.dir"));
File[] arquivos = pasta.listFiles();
for(File arquivo : arquivos) {
if(arquivo.getName().endsWith("zip")) {
arquivo.delete();
}
public static void compactarArquivo(String arqSaida, String arqEntrada) throws IOException {
int cont;
byte[] dados = new byte[TAMANHO_BUFFER];
BufferedInputStream origem = null;
FileInputStream streamDeEntrada = null;
FileOutputStream destino = null;
ZipOutputStream saida = null;
ZipEntry entry = null;
try {
destino = new FileOutputStream(new File(arqSaida));
saida = new ZipOutputStream(new BufferedOutputStream(destino));
File file = new File(arqEntrada);
streamDeEntrada = new FileInputStream(file);
origem = new BufferedInputStream(streamDeEntrada, TAMANHO_BUFFER);
entry = new ZipEntry(file.getName());
saida.putNextEntry(entry);
while ((cont = origem.read(dados, 0, TAMANHO_BUFFER)) != -1) {
saida.write(dados, 0, cont);
}
origem.close();
saida.close();
} catch (IOException e) {
throw new IOException(e.getMessage());
}
}
private void excluirArquivosZip() {
File pasta = new File(System.getProperty("jboss.server.log.dir"));
File[] arquivos = pasta.listFiles();
for (File arquivo : arquivos) {
if (arquivo.getName().endsWith("zip")) {
arquivo.delete();
}
}
}
public void onClick$ckValidarTempoParaImpressao(Event event) {
if(ckValidarTempoParaImpressao.isChecked()) {
if (ckValidarTempoParaImpressao.isChecked()) {
txtTempoParaImpressao.setDisabled(Boolean.FALSE);
txtTempoParaImpressao.setValue(null);
} else {
@ -2802,7 +2802,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
txtTempoParaImpressao.setValue(null);
}
}
public Boolean isPermissaoEditarComissao() {
return UsuarioLogado.getUsuarioLogado().isPermisoClave(Constantes.CLAVE_EDITAR_COMISSAO);
}
@ -2845,5 +2845,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
public void setCkValidarTempoParaImpressao(Checkbox ckValidarTempoParaImpressao) {
this.ckValidarTempoParaImpressao = ckValidarTempoParaImpressao;
}
}
}

View File

@ -0,0 +1,15 @@
package com.rjconsultores.ventaboletos.web.utilerias;
import org.zkoss.util.resource.Labels;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Constraint;
public class ConstraintNoEmpty implements Constraint {
@Override
public void validate(Component component, Object value) throws WrongValueException {
if (value == null || value.toString().isEmpty()) {
throw new WrongValueException(component, Labels.getLabel("MSG.CONSTRAINT.CAMPOOBRIGATORIO"));
}
}
}

View File

@ -9,6 +9,7 @@ indexController.app.nome=Administracion de la Venta
# MSG Defaut:
MSG.CONSTRAINT.CAMPOOBRIGATORIO=Informe los campos obrigatorios o borre todos los dados de la pantalla!
MSG.CONSTRAINT.PORCENTAGEM = Los valores debem estar entre 0 y 100
MSG.CONSTRAINT.DECIMALBOX = Los valores debem estar entre 0 y 9999999
MSG.CONSTRAINT.CONSTRAINTNUMBERBD = El valor debe tener el formato de {0} dígitos mas {1} decimales
@ -979,7 +980,9 @@ busquedaPuntoVentaController.lhId.label = ID
busquedaPuntoVentaController.lhDesc.label = Descripción
# Editar o ponto da pantalla de venta
editarPuntoVentaController.window.title = Punto de venta ( Agencia )
editarPuntoVentaController.msg.cpfTitularVazio= Informe o cpf ou limpe todos os campos do titular!
editarPuntoVentaController.msg.naopodesersubordinadapossuisubordinadas = Este punto de venta no se puede subordinarse a otra, el ya tiene puntos de venta subordinados:
editarPuntoVentaController.msg.naopodesersubordinadaehsubordinada = Este punto de venta no puede ser subordinado a <1>. <1> ya es subordinado a <2>
editarPuntoVentaController.btnApagar.tooltiptext = Eliminar

View File

@ -11,6 +11,7 @@ indexController.app.nome=Administração da Venta
versao = ADM_20130830_1RC216
# MSG Defaut:
MSG.CONSTRAINT.CAMPOOBRIGATORIO=Preencha os campos obrigatórios ou limpe os dados tela!
MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100
MSG.CONSTRAINT.DECIMALBOX = Os valores devem estar entre 0 e 9999999
MSG.CONSTRAINT.CONSTRAINTNUMBERBD = O valor deve ter o formato de {0} dígitos mais {1} decimais.
@ -1017,6 +1018,7 @@ busquedaPuntoVentaController.lhDesc.label = Descrição
busquedaPuntoVentaController.lhNumero.label = Núm. Agência
# Editar o ponto da pantalla de Venda
editarPuntoVentaController.msg.cpfTitularVazio= Informe o cpf ou limpe todos os campos do titular!
editarPuntoVentaController.window.title = Ponto de Venda ( Agência )
editarPuntoVentaController.msg.naopodesersubordinadapossuisubordinadas = Essa agencia nao pode ser subordinada a outra, ela já possui agencias subordinadas:
editarPuntoVentaController.msg.naopodesersubordinadaehsubordinada = Essa agencia nao pode ser subordinada a <1>. <1> já está subordinada a <2>.

View File

@ -32,7 +32,7 @@
<tab
label="${c:l('editarPuntoVentaController.tab.label.endereco')}" />
<tab
label="${c:l('editarPuntoVentaController.tab.label.comissao')}" />
<tab
@ -77,7 +77,7 @@
</tabs>
<tabpanels>
<tabpanel height="465px" style="overflow:auto;" >
<tabpanel height="465px" style="overflow:auto;">
<grid fixedLayout="true">
<columns>
<column width="30%" />
@ -100,21 +100,25 @@
maxlength="10" constraint="no empty"
value="@{winEditarPuntoVenta$composer.puntoVenta.numPuntoVenta}" />
</row>
<!-- Integracion TOTVS -->
<row visible="@{winEditarPuntoVenta$composer.integracionTotvs}">
<row
visible="@{winEditarPuntoVenta$composer.integracionTotvs}">
<label
value="${c:l('editarPuntoVentaController.label.totvs')}" />
<radiogroup Id="indIntegracion" >
<radio id="radTotvsSi" disabled="true"
<radiogroup Id="indIntegracion">
<radio id="radTotvsSi"
disabled="true"
label="${c:l('editarPuntoVentaController.label.totvs.sim')}" />
<radio id="radTotvsNo" disabled="true"
<radio id="radTotvsNo"
disabled="true"
label="${c:l('editarPuntoVentaController.label.totvs.nao')}" />
<radio id="radTotvsErro" disabled="true"
<radio id="radTotvsErro"
disabled="true"
label="${c:l('editarPuntoVentaController.label.totvs.erro')}" />
</radiogroup>
</row>
<row>
<label
value="${c:l('editarPuntoVentaController.lblMaxCancelacion')}" />
@ -122,7 +126,7 @@
constraint="no empty"
value="@{winEditarPuntoVenta$composer.puntoVenta.tiempoCancelacion}" />
</row>
<row>
<!-- Parada -->
@ -196,7 +200,7 @@
<!-- Tel1 -->
<label
value="${c:l('editarPuntoVentaController.lbTelefonoUno.value')}" />
<textbox id="numtelefonouno"
<textbox id="numtelefonouno"
constraint="no zero" width="70%" maxlength="40"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
</row>
@ -296,13 +300,14 @@
<label
value="${c:l('editarPuntoVentaController.lbIE.value')}" />
<hbox>
<textbox id="txtNumIEPuntoVenta"
<textbox id="txtNumIEPuntoVenta"
width="100%" maxlength="20"
value="@{winEditarPuntoVenta$composer.puntoVenta.numIEPuntoVenta}"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
<checkbox id="ckIsento" />
<label value="${c:l('editarPuntoVentaController.label.isento')}" />
<label
value="${c:l('editarPuntoVentaController.label.isento')}" />
</hbox>
</row>
<row>
@ -317,12 +322,15 @@
<label
value="${c:l('editarPuntoVentaController.lbTempoMinimoParaImpressao.value')}" />
<hbox>
<checkbox id="ckValidarTempoParaImpressao" checked="@{winEditarPuntoVenta$composer.puntoVenta.validaTempoParaImpressao}" />
<timebox id="txtTempoParaImpressao" cols="14" format="HH:mm" mold="rounded"
value="@{winEditarPuntoVenta$composer.puntoVenta.tempoMinimoParaImpressao}" />
<checkbox
id="ckValidarTempoParaImpressao"
checked="@{winEditarPuntoVenta$composer.puntoVenta.validaTempoParaImpressao}" />
<timebox id="txtTempoParaImpressao"
cols="14" format="HH:mm" mold="rounded"
value="@{winEditarPuntoVenta$composer.puntoVenta.tempoMinimoParaImpressao}" />
</hbox>
</row>
</row>
<row>
<!-- Comentarios -->
<label
@ -342,7 +350,8 @@
<row>
<label
value="${c:l('editarPuntoVentaController.lbIndBloqueiaCancelamentoImpressaoPosterior.value')}" />
<checkbox id="ckIndBloqueiaCancelamentoImpressaoPosterior"
<checkbox
id="ckIndBloqueiaCancelamentoImpressaoPosterior"
checked="@{winEditarPuntoVenta$composer.puntoVenta.indBloqueiaCancelamentoImpressaoPosterior}" />
</row>
</rows>
@ -642,10 +651,8 @@
<label
value="${c:l('editarConfiguracionDiversosController.lbResponAluguel.value')}" />
<textbox id="txtResponAluguel"
width="70%" maxlength="80"
value="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.responAluguel}"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox" />
</row>
<row>
@ -679,37 +686,45 @@
<row>
<label
value="${c:l('editarConfiguracionDiversosController.lbInformatizada.value')}" />
<checkbox id="checkInformatizada" />
<checkbox id="checkInformatizada"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.informatizada}"/>
</row>
<row>
<label
value="${c:l('editarConfiguracionDiversosController.lbBilheteInfo.value')}" />
<checkbox id="checkBilheteInfo" />
<checkbox id="checkBilheteInfo"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.bilheteInfo}"/>
</row>
<row>
<label
value="${c:l('editarConfiguracionDiversosController.lbVendaInternet.value')}" />
<checkbox id="checkVendaInternet" />
<checkbox id="checkVendaInternet"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.vendaInternet}"/>
</row>
<row>
<label
value="${c:l('editarConfiguracionDiversosController.lbTeleEntrega.value')}" />
<checkbox id="checkTeleEntrega" />
<checkbox id="checkTeleEntrega"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.teleEntrega}"/>
</row>
<row>
<label
value="${c:l('editarConfiguracionDiversosController.lbDigitacao.value')}" />
<checkbox id="checkDigitacao" />
<checkbox id="checkDigitacao"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.digitacaoSeq}"/>
</row>
<row>
<label
value="${c:l('editarConfiguracionDiversosController.lbTrabalha.value')}" />
<hbox>
<checkbox id="checkBilhete"
<checkbox id="checkBilhete"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.trabalhaBilhete}"
label="${c:l('editarConfiguracionDiversosController.lbBilhete.value')}" />
<checkbox id="checkOfpsPropria"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.ofpsPropria}"
label="${c:l('editarConfiguracionDiversosController.lbOfpsPropria.value')}" />
<checkbox id="checkOfpsTerceiros"
checked="@{winEditarPuntoVenta$composer.puntoVenta.diversosId.ofpsTerceiros}"
label="${c:l('editarConfiguracionDiversosController.lbOfpsTerceiros.value')}" />
</hbox>
</row>