fixed bug #9091 - Criação de campos para cobrança da taxa de conveniencia na venda.
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@69955 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
54e4951096
commit
f5ab4011fd
|
@ -6,12 +6,10 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
|||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Connection;
|
||||
|
@ -136,7 +134,7 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
|||
import com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.FechamentoParamptovtaListItemRenderer;
|
||||
import com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.PuntoVendaHistoricoBloqueioListItemRenderer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintNoEmpty;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintPorcentagem;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintPorcentagemAllowNull;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
|
@ -166,7 +164,7 @@ import com.rjconsultores.wsag.GeradorTitulosAG;
|
|||
import com.rjconsultores.wsag.WSAGLog;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Rafius
|
||||
*/
|
||||
@Controller("editarPuntoVentaController")
|
||||
|
@ -175,7 +173,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static Logger log = Logger.getLogger(EditarPuntoVentaController.class);
|
||||
|
||||
|
||||
public static final String FUNCION_TIPO_BOLETO_BLOQUEADO = "COM.RJCONSULTORES.ADMINISTRACION.PUNTOVENTA.TIPOBOLETOBLOQUEADO";
|
||||
|
||||
@Autowired
|
||||
|
@ -220,7 +218,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private FechamentoParamptovtaService fechamentoParamptovtaService;
|
||||
@Autowired
|
||||
private CategoriaBloqueioImpPosteriorService categoriaBloqueioImpPosteriorService;
|
||||
|
||||
|
||||
private PuntoVenta puntoVenta;
|
||||
private Textbox txtCP;
|
||||
private MyListbox puntoVentaList;
|
||||
|
@ -241,7 +239,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private MyListbox ptovtaHistoricoList;
|
||||
private MyListbox categoriasBloqImpPosteriorList;
|
||||
private MyListbox empresaContaBancariaList;
|
||||
|
||||
|
||||
private List<Categoria> lsCategoriaBloquear;
|
||||
|
||||
private List<Empresa> lsEmpresasBloquear;
|
||||
|
@ -265,7 +263,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private List<PtovtaEstoque> lsEstoque;
|
||||
private List<PtovtaComissao> lsPtovtaComissao;
|
||||
private List<String> lsLogFiles;
|
||||
private List<HistoricoPuntoVenta> lsHistoricoPuntoVenda;
|
||||
private Radio radDatosTarjetaSi;
|
||||
private Radio radDatosTarjetaNo;
|
||||
private Radio radAprobacionAutorizado;
|
||||
|
@ -283,8 +280,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private Radio radTotvsNo;
|
||||
private Radio radTotvsErro;
|
||||
private Radio radTipoPagamentoBoleto;
|
||||
private Radio radTipoPagamentoDeposito;
|
||||
|
||||
private Button btnAdicionarEmpresaComissao;
|
||||
private MyComboboxPuntoVenta cmbPuntoVentaPadre;
|
||||
private Combobox cmbFormaPago;
|
||||
|
@ -381,7 +376,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private Checkbox ckIsento;
|
||||
private Checkbox checkSimulaIntegracion;
|
||||
private Checkbox checkTodosPuntosVenta;
|
||||
private Checkbox checkTodosPuntosVentaAG;
|
||||
private Checkbox checkDinheiro;
|
||||
private Checkbox checkCredito;
|
||||
private Checkbox checkDebito;
|
||||
|
@ -395,7 +389,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private Datebox fecIntegracion;
|
||||
private Datebox fecInicioAG;
|
||||
private Datebox fecFimAG;
|
||||
private Textbox logResult;
|
||||
private boolean integracionTotvs;
|
||||
private boolean integracionAG;
|
||||
private Timebox txtTempoParaImpressao;
|
||||
|
@ -413,16 +406,16 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private String statusAprobacionInicial = "";
|
||||
private Decimalbox txtTaxaConvenienciaPorc;
|
||||
private Doublebox txtMaximoTaxaConveniencia;
|
||||
private ConstraintPorcentagem ct;
|
||||
private ConstraintPorcentagemAllowNull ct;
|
||||
|
||||
private static final String EMAIL_PATTERN =
|
||||
private static final String EMAIL_PATTERN =
|
||||
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
|
||||
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
|
||||
|
||||
private static final Pattern pattern = Pattern.compile(EMAIL_PATTERN, Pattern.CASE_INSENSITIVE);
|
||||
|
||||
|
||||
private static final int TAMANHO_BUFFER = 4096; // 4kb
|
||||
|
||||
|
||||
PtovtaEmpresa ptovtaEmpresa;
|
||||
|
||||
@Autowired
|
||||
|
@ -456,7 +449,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
setCt(new ConstraintPorcentagem());
|
||||
setCt(new ConstraintPorcentagemAllowNull());
|
||||
lsCategoriaBloquear = categoriaService.obtenerTodasCategoriasVisibles();
|
||||
lsEmpresasBloquear = empresaService.obtenerTodos();
|
||||
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||
|
@ -474,11 +467,12 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
lsUsuarioBancario = usuarioBancarioService.obtenerTodos();
|
||||
lsLogFiles = getLogFiles();
|
||||
puntoVenta = (PuntoVenta) Executions.getCurrent().getArg().get("puntoVenta");
|
||||
|
||||
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
|
||||
getTxtTaxaConvenienciaPorc().setConstraint(getCt());
|
||||
cmbBanco.addEventListener("onAfterRender", new org.zkoss.zk.ui.event.EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
cmbBanco.setSelectedIndex(lsBanco.indexOf(puntoVenta.getAgenciaId().getInstiFinanceiraId()));
|
||||
}
|
||||
|
@ -494,7 +488,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
ptovtaCatIndList.setItemRenderer(new RenderPtovtaCatInd());
|
||||
ptovtaHistoricoList.setItemRenderer(new PuntoVendaHistoricoBloqueioListItemRenderer());
|
||||
categoriasBloqImpPosteriorList.setItemRenderer(new RenderCategoriaBloqueioVendaImpPosterior());
|
||||
|
||||
|
||||
ptovtaComissaoList.setItemRenderer(new RenderPtovtaComissao());
|
||||
ptovtaComissaoList.addEventListener("onDoubleClick", new EventListener() {
|
||||
@Override
|
||||
|
@ -567,7 +561,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
}
|
||||
|
||||
statusAprobacionInicial = radAprobacionAutorizado.isChecked() ? "A" : "L";
|
||||
|
||||
|
||||
if (puntoVenta.getPuntoventaId() != null) {
|
||||
if (puntoVenta.getAgenciaId() != null) {
|
||||
|
||||
|
@ -781,8 +775,8 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
if (puntoVenta.getLsPtovtaUsuarioBancario() == null) {
|
||||
puntoVenta.setLsPtovtaUsuarioBancario(new ArrayList<PtoVtaUsuarioBancario>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
lsPtovtaUsuarioBancario = puntoVenta.getLsPtovtaUsuarioBancario();
|
||||
ptovtaUsuarioBancarioList.setData(lsPtovtaUsuarioBancario);
|
||||
|
@ -794,7 +788,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
cmbParada.setText(puntoVenta.getParada().getDescparada());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
empresaContaBancariaList.setMultiple(true);
|
||||
empresaContaBancariaList.setData(new ArrayList<EmpresaContaBancaria>(0));
|
||||
|
||||
|
@ -833,63 +827,45 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClick$btnAddCategoriaBloqueioImpPosterior(Event event) {
|
||||
CategoriaBloqueioImpPosterior cat = new CategoriaBloqueioImpPosterior();
|
||||
cat.setCategoria((Categoria)cmbBloqVendaImpPosterior.getSelectedItem().getValue());
|
||||
cat.setPuntoventa(puntoVenta);
|
||||
|
||||
|
||||
puntoVenta.addCategoriaBloqImpPosterior(cat);
|
||||
|
||||
|
||||
categoriasBloqImpPosteriorList.setData(puntoVenta.getCategoriaBloqImpPosteriorList());
|
||||
}
|
||||
|
||||
|
||||
public void onClick$btnRemoveCategoriaBloqueioImpPosterior(Event event) {
|
||||
try{
|
||||
int resp = Messagebox.show(
|
||||
Labels.getLabel("editarPuntoVentaController.MSG.borrarCategoriaBloqueioImpPosterior"),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||
|
||||
|
||||
if (resp == Messagebox.YES) {
|
||||
CategoriaBloqueioImpPosterior cat = (CategoriaBloqueioImpPosterior)categoriasBloqImpPosteriorList.getSelected();
|
||||
|
||||
|
||||
puntoVenta.removeCategoriaBloqImpPosterior(cat);
|
||||
categoriaBloqueioImpPosteriorService.borrar(cat);
|
||||
|
||||
|
||||
categoriasBloqImpPosteriorList.setData(puntoVenta.getCategoriaBloqImpPosteriorList());
|
||||
}
|
||||
} catch (Exception e){
|
||||
log.error("", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClick$btnDownload(Event event) {
|
||||
downloadLogIntegracao(cmbLogFiles);
|
||||
}
|
||||
|
||||
|
||||
public void onClick$btnDownloadAG(Event event) {
|
||||
downloadLogIntegracao(cmbLogFilesAG);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public boolean validaFuncionTipoBoletoBloqueado() {
|
||||
List<String> listClavesPermisos = new ArrayList<String>();
|
||||
|
@ -990,7 +966,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
lsEmpresaContaBancarias = ptovtaBancoService.buscarContasBancariasPorIdEmpresa(empresa.getEmpresaId());
|
||||
|
||||
empresaContaBancariaList.setData(new ArrayList<EmpresaContaBancaria>(0));
|
||||
|
||||
|
||||
if (lsEmpresaContaBancarias != null && !lsEmpresaContaBancarias.isEmpty()) {
|
||||
empresaContaBancariaList.setData(lsEmpresaContaBancarias);
|
||||
// cmbEmpresasContaBancarias.setModel(new BindingListModelList(lsEmpresaContaBancarias, true));
|
||||
|
@ -1127,23 +1103,23 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClick$btnEnviaAG(Event ev) throws InterruptedException {
|
||||
Connection myConn = null;
|
||||
Connection myConn = null;
|
||||
Observer wsevents = new Observer() {
|
||||
|
||||
|
||||
@Override
|
||||
public void update(Observable o, Object arg) {
|
||||
logResultAG.setText(((WSAGLog)o).toString());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
WSAGLog wslog = WSAGLog.getInstance();
|
||||
wslog.clear();
|
||||
wslog.addObserver(wsevents);
|
||||
|
||||
|
||||
myConn = dataSource.getConnection();
|
||||
Date dateInicio = fecInicioAG.getValue();
|
||||
|
||||
|
@ -1154,9 +1130,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim);
|
||||
|
||||
gerador.send(checkAdiantamentoAG.isChecked(), checkBoletoAG.isChecked(), checkCartaoAG.isChecked(), checkDepositoAG.isChecked());
|
||||
|
||||
|
||||
gerador.mostraResultado();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Erro ao integrar", e);
|
||||
|
||||
|
@ -1182,9 +1158,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClick$btnGeraTitulosAG(Event ev) throws InterruptedException {
|
||||
Connection myConn = null;
|
||||
Connection myConn = null;
|
||||
try {
|
||||
myConn = dataSource.getConnection();
|
||||
Date dateInicio = fecInicioAG.getValue();
|
||||
|
@ -1196,7 +1172,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
log.info("puntoVentaId=" + puntoVenta.getPuntoventaId() + ";fecInicio=" + dateInicio + ";fecFin=" + dateFim);
|
||||
|
||||
gerador.execute(puntoVenta.getPuntoventaId(), checkAdiantamentoAG.isChecked(), checkBoletoAG.isChecked(), checkCartaoAG.isChecked(), checkDepositoAG.isChecked());
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Erro ao integrar", e);
|
||||
|
||||
|
@ -1392,10 +1368,11 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
txtAntecipRetem.getValue();
|
||||
txtAntecipPercentual.getValue();
|
||||
getTxtTaxaConvenienciaPorc().getValue();
|
||||
if(getTxtTaxaConvenienciaPorc().getValue().compareTo(BigDecimal.ZERO) == 1){
|
||||
if (getTxtTaxaConvenienciaPorc().getValue() != null &&
|
||||
getTxtTaxaConvenienciaPorc().getValue().compareTo(BigDecimal.ZERO) == 1) {
|
||||
txtMaximoTaxaConveniencia.setConstraint("no empty");
|
||||
txtMaximoTaxaConveniencia.getValue();
|
||||
}
|
||||
txtMaximoTaxaConveniencia.getValue();
|
||||
|
||||
cmbEmpresa.getValue();
|
||||
cmbParada.getValue();
|
||||
|
@ -1409,19 +1386,19 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
cmbBanco.getValue();
|
||||
cmbPessoa.getValue();
|
||||
cmbTipoConta.getValue();
|
||||
|
||||
|
||||
if(!validarEmail()){
|
||||
|
||||
|
||||
if(descCorreo.getText() == null || descCorreo.getText().trim().isEmpty()){
|
||||
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.emailObrigatorio"),
|
||||
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.emailObrigatorio"),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}else{
|
||||
Messagebox.show(Labels.getLabel("editarTipoPuntoVentaController.MSG.emailInvalido"),
|
||||
Messagebox.show(Labels.getLabel("editarTipoPuntoVentaController.MSG.emailInvalido"),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
|
||||
|
||||
descCorreo.focus();
|
||||
return;
|
||||
}
|
||||
|
@ -1461,7 +1438,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
if (cmbPuntoVentaPadre.getValue().isEmpty()) {
|
||||
puntoVenta.setPuntoVentaPadre(null);
|
||||
}
|
||||
|
||||
|
||||
List<PuntoVenta> lsPuntoVenta = puntoVentaService.buscaPuntoVenta(txtNumPtoVta.getValue());
|
||||
|
||||
if (!lsPuntoVenta.isEmpty()) {
|
||||
|
@ -1487,7 +1464,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.informarTempoMinimo.value"), Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
txtTempoParaImpressao.focus();
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1495,22 +1472,22 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
if (puntoVenta.getEmpresa() == null) {
|
||||
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"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
|
||||
|
||||
} else if (puntoVenta.getMoneda() == null) {
|
||||
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.OK, Messagebox.EXCLAMATION);
|
||||
*/
|
||||
} else if (lsFormaPagoDet.isEmpty()) {
|
||||
Messagebox.show(Labels.getLabel("editarPuntoVentaController.MSG.formaDePago"), Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
|
||||
|
||||
} else {
|
||||
if (cmbConexion.getValue().equals("")) {
|
||||
puntoVenta.setConexionBancaria(null);
|
||||
|
@ -1531,7 +1508,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
// Empresas para Venda
|
||||
List<PtovtaEmpresaContaBancaria> contasBancariasExcluidas = new ArrayList<PtovtaEmpresaContaBancaria>(0);
|
||||
|
||||
|
||||
for (PtovtaEmpresa emp : lsPtovtaEmpresa) {
|
||||
if (emp.getActivo()) {
|
||||
// Contas bancarias (Temporária)
|
||||
|
@ -1539,17 +1516,17 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
if (ecc.getEmpresaContaBancariaId() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Verificando os bancos adicionados/atualizados
|
||||
boolean existe = false;
|
||||
|
||||
|
||||
for (PtovtaEmpresaContaBancaria pto : emp.getLsPtovtaEmpresaContaBancaria()) {
|
||||
if (pto.getEmpresaContaBancaria() != null && pto.getEmpresaContaBancaria().getEmpresaContaBancariaId().equals(ecc.getEmpresaContaBancariaId())) {
|
||||
existe = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!existe) {
|
||||
PtovtaEmpresaContaBancaria pto = new PtovtaEmpresaContaBancaria();
|
||||
pto.setPtovtaEmpresa(emp);
|
||||
|
@ -1557,35 +1534,35 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
pto.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
pto.setFecmodif(new Date());
|
||||
pto.setActivo(true);
|
||||
|
||||
|
||||
emp.getLsPtovtaEmpresaContaBancaria().add(pto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Contas bancárias removidas
|
||||
List<PtovtaEmpresaContaBancaria> excluir = new ArrayList<PtovtaEmpresaContaBancaria>(0);
|
||||
|
||||
|
||||
for (PtovtaEmpresaContaBancaria pto : emp.getLsPtovtaEmpresaContaBancaria()) {
|
||||
boolean existe = false;
|
||||
|
||||
|
||||
for (EmpresaContaBancaria ecc : emp.getContasBancaria()) {
|
||||
if (pto.getEmpresaContaBancaria().getEmpresaContaBancariaId().equals(ecc.getEmpresaContaBancariaId())) {
|
||||
existe = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!existe) {
|
||||
excluir.add(pto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
emp.getLsPtovtaEmpresaContaBancaria().removeAll(excluir);
|
||||
|
||||
|
||||
contasBancariasExcluidas.addAll(excluir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
puntoVenta.setActivo(Boolean.TRUE);
|
||||
puntoVenta.setFecmodif(Calendar.getInstance().getTime());
|
||||
puntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
@ -1600,7 +1577,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
puntoVenta.setTempoMinimoParaImpressao(txtTempoParaImpressao.getValue());
|
||||
puntoVenta.setNodo(nodoService.obtenerId(1));
|
||||
puntoVenta.setDateAbertura(dateAbertura.getValue());
|
||||
|
||||
|
||||
if (dateFechamento.getValue() != null && dateFechamento.getValue().compareTo(dateAbertura.getValue()) < 0) {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarPuntoVentaController.DatFechMenorDataAbertura"),
|
||||
|
@ -1608,7 +1585,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
puntoVenta.setDateFechamento(dateFechamento.getValue());
|
||||
String getString = null;
|
||||
if (!txtNumFax.getValue().equals("")) {
|
||||
|
@ -1668,7 +1645,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
for (PtovtaEmpresaContaBancaria ecc : contasBancariasExcluidas) {
|
||||
ptovtaEmpresaContaBancariaService.borrarFisico(ecc);
|
||||
}
|
||||
|
||||
|
||||
List<PtoVtaUsuarioBancario> lsPto2 = new ArrayList<PtoVtaUsuarioBancario>();
|
||||
for (PtoVtaUsuarioBancario pto2 : lsPtovtaUsuarioBancario) {
|
||||
if (!pto2.getActivo()) {
|
||||
|
@ -1678,7 +1655,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
lsPto2.add(pto2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ApplicationProperties.getInstance().validaContaCorrenteEmpesaPtoVta()){
|
||||
if (!validaCadastroFechamentoContaCorrente()) {
|
||||
exibeMsgErroFechCtaCorrente();
|
||||
|
@ -1693,20 +1670,20 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
} else if (radAprobacionLatente.isChecked()) {
|
||||
puntoVenta.setStatusaprobacion("L");
|
||||
}
|
||||
|
||||
|
||||
if(!puntoVenta.getStatusaprobacion().equals(statusAprobacionInicial)){
|
||||
HistoricoPuntoVenta h = new HistoricoPuntoVenta();
|
||||
h.setPuntoVenta(puntoVenta);
|
||||
|
||||
|
||||
h.setIndBloqueio(!puntoVenta.getStatusaprobacion().equals("A"));
|
||||
h.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
h.setActivo(true);
|
||||
h.setFecmodif(new Date());
|
||||
h.setFecBloqueio(new Date());
|
||||
|
||||
|
||||
puntoVenta.getHistoricoPuntoVentaList().add(h);
|
||||
}
|
||||
|
||||
|
||||
if (puntoVenta.getIndIntegracion() == null) {
|
||||
puntoVenta.setIndIntegracion(TipoRetorno.PENDENTE.getValor());
|
||||
}
|
||||
|
@ -1718,9 +1695,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
puntoVentaService.actualizacion(puntoVenta);
|
||||
puntoVentaList.updateItem(puntoVenta);
|
||||
}
|
||||
|
||||
|
||||
gravaFechamentoCtaCorrente();
|
||||
|
||||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarPuntoVentaController.MSG.suscribirOK"),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
|
@ -1732,7 +1709,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
} catch (ValidacionCampoException ve) {
|
||||
log.error("editarPuntoVentaController: ", ve);
|
||||
|
||||
|
||||
Messagebox.show(
|
||||
ve.getMessage(),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
|
@ -1740,19 +1717,19 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
} catch (IntegracionException ex) {
|
||||
gravaFechamentoCtaCorrente();
|
||||
|
||||
|
||||
log.error("editarPuntoVentaController: ", ex);
|
||||
|
||||
|
||||
Messagebox.show(
|
||||
ex.getMessage(),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
|
||||
|
||||
closeWindow();
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
log.error("editarPuntoVentaController: ", ex);
|
||||
|
||||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("MSG.Error"),
|
||||
Labels.getLabel("editarPuntoVentaController.window.title"),
|
||||
|
@ -1762,10 +1739,10 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
|
||||
private boolean validarEmail() throws InterruptedException {
|
||||
|
||||
|
||||
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
|
||||
Constante constante = constanteService.buscarPorNomeConstante("TOTALBUS_EMAIL_OPCIONAL_PV");
|
||||
|
||||
|
||||
if(constante == null || constante.getValorconstante().equals("0")){
|
||||
if(descCorreo.getText() == null || descCorreo.getText().isEmpty()){
|
||||
return false;
|
||||
|
@ -1775,14 +1752,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(String email : descCorreo.getText().split(";")){
|
||||
Matcher matcher = pattern.matcher(email);
|
||||
if(!matcher.matches()){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1794,9 +1771,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
private void gravarCC(List<FechamentoParamptovta> paramsFechamento) {
|
||||
boolean encontrouEmpresaComFechamentoConfigurado = false;
|
||||
for (Object object : fechamentoParamptovtaList.getListData()) {
|
||||
for (Object object : fechamentoParamptovtaList.getListData()) {
|
||||
encontrouEmpresaComFechamentoConfigurado = false;
|
||||
FechamentoParamptovta fechamentoParamptovta = (FechamentoParamptovta) object;
|
||||
FechamentoParamptovta fechamentoParamptovta = (FechamentoParamptovta) object;
|
||||
//verifica se empresa já está configurada com fechamento de conta corrente
|
||||
for(FechamentoParamptovta paramFechamento : paramsFechamento){
|
||||
if(fechamentoParamptovta.getEmpresa().getEmpresaId() == paramFechamento.getEmpresa().getEmpresaId()){
|
||||
|
@ -1812,10 +1789,10 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
if(!encontrouEmpresaComFechamentoConfigurado){
|
||||
fechamentoParamptovta.setPuntoventa(puntoVenta);
|
||||
fechamentoParamptovtaService.suscribir(fechamentoParamptovta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void removerCC(List<FechamentoParamptovta> paramsFechamento) {
|
||||
boolean removerEmpresa = true;
|
||||
for(FechamentoParamptovta paramFechamento : paramsFechamento){
|
||||
|
@ -1829,9 +1806,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
}
|
||||
}
|
||||
//Remove do banco a empresa que não está na lista
|
||||
if(removerEmpresa){
|
||||
if(removerEmpresa){
|
||||
fechamentoParamptovtaService.borrar(paramFechamento);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1850,12 +1827,12 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
//Valida que todas empresas de Fechamento são empresa para venda.
|
||||
for (int i = 0; i < empresasVenda.size(); i++) {
|
||||
PtovtaEmpresa empresaVenda = (PtovtaEmpresa) empresasVenda.get(i);
|
||||
|
||||
|
||||
validado = false;
|
||||
|
||||
for (int j = 0; j < empresasFechamento.size(); j++) {
|
||||
|
||||
for (int j = 0; j < empresasFechamento.size(); j++) {
|
||||
FechamentoParamptovta fechamentoParamptovta = (FechamentoParamptovta) empresasFechamento.get(j);
|
||||
|
||||
|
||||
if (empresaVenda.getEmpresa().getEmpresaId().equals(fechamentoParamptovta.getEmpresa().getEmpresaId())) {
|
||||
validado=true;
|
||||
break;
|
||||
|
@ -2263,7 +2240,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
// if (cmbEmpresasContaBancarias.getSelectedItem() != null) {
|
||||
// ptovtaEmpresa.setEmpresaContaBancaria((EmpresaContaBancaria) cmbEmpresasContaBancarias.getSelectedItem().getValue());
|
||||
// }
|
||||
|
||||
|
||||
if (empresaContaBancariaList.getSelectedCount() > 0){
|
||||
ptovtaEmpresa.getContasBancaria().clear();
|
||||
|
||||
|
@ -2272,14 +2249,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
ptovtaEmpresa.getContasBancaria().add(ecb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ptovtaEmpresa.getPtovtaempresaId() == null){
|
||||
lsPtovtaEmpresa.add(ptovtaEmpresa);
|
||||
ptovtaEmpresaList.addItemNovo(ptovtaEmpresa);
|
||||
|
||||
|
||||
}else{
|
||||
int index = lsPtovtaEmpresa.indexOf(ptovtaEmpresa);
|
||||
|
||||
|
||||
if(index >= -1) {
|
||||
lsPtovtaEmpresa.set(index, ptovtaEmpresa);
|
||||
} else {
|
||||
|
@ -2288,9 +2265,9 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
ptovtaEmpresaList.updateItem(ptovtaEmpresa);
|
||||
}
|
||||
|
||||
|
||||
novoPtovtaEmpresa();
|
||||
|
||||
|
||||
} else {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarPuntoVentaController.MSG.Achou.PtovtaEmpresa"),
|
||||
|
@ -2326,11 +2303,11 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
log.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClick$btnNovoPtovtaEmpresa(Event ev) throws InterruptedException {
|
||||
novoPtovtaEmpresa();
|
||||
}
|
||||
|
||||
|
||||
private void novoPtovtaEmpresa() {
|
||||
cmbEmpresaPtoVta.setSelectedIndex(-1);
|
||||
// cmbEmpresasContaBancarias.setSelectedIndex(-1);
|
||||
|
@ -2346,14 +2323,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
private void editarPtovtaEmpresa(PtovtaEmpresa ptovtaEmpresa) {
|
||||
this.ptovtaEmpresa = new PtovtaEmpresa(ptovtaEmpresa.getPtovtaempresaId());
|
||||
this.ptovtaEmpresa.setLsPtovtaEmpresaContaBancaria(ptovtaEmpresa.getLsPtovtaEmpresaContaBancaria());
|
||||
|
||||
|
||||
cmbEmpresaPtoVta.setSelectedIndex(-1);
|
||||
// cmbEmpresasContaBancarias.setSelectedIndex(-1);
|
||||
|
||||
if(lsEmpresas != null) {
|
||||
cmbEmpresaPtoVta.setSelectedIndex(lsEmpresas.indexOf(ptovtaEmpresa.getEmpresa()));
|
||||
}
|
||||
|
||||
|
||||
if(lsEmpresaContaBancarias != null) {
|
||||
// cmbEmpresasContaBancarias.setSelectedIndex(lsEmpresaContaBancarias.indexOf(ptovtaEmpresa.getEmpresaContaBancaria()));
|
||||
}
|
||||
|
@ -2361,14 +2338,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
lsEmpresaContaBancarias = ptovtaBancoService.buscarContasBancariasPorIdEmpresa(ptovtaEmpresa.getEmpresa().getEmpresaId());
|
||||
|
||||
empresaContaBancariaList.setData(new ArrayList<EmpresaContaBancaria>(0));
|
||||
|
||||
|
||||
if (lsEmpresaContaBancarias != null && !lsEmpresaContaBancarias.isEmpty()) {
|
||||
empresaContaBancariaList.setData(lsEmpresaContaBancarias);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
empresaContaBancariaList.selectItems(ptovtaEmpresa.getContasBancaria());
|
||||
|
||||
|
||||
|
||||
|
||||
checkPtoVtaEmpresaIndTerceirizada.setChecked(ptovtaEmpresa.getIndTerceirizada());
|
||||
checkPtoVtaEmpresaIndBloqueada.setChecked(ptovtaEmpresa.getIndBloqueada());
|
||||
checkPtoVtaEmpresaIndMostrarCaja.setChecked(ptovtaEmpresa.getIndMostrarCaja());
|
||||
|
@ -2807,7 +2784,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
|
||||
/*
|
||||
* public Combobox getCmbNodo() { return cmbNodo; }
|
||||
*
|
||||
*
|
||||
* public void setCmbNodo(Combobox cmbNodo) { this.cmbNodo = cmbNodo; }
|
||||
*/
|
||||
|
||||
|
@ -3176,7 +3153,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
} else if (radIntervalofechamentoDiario.isChecked()) {
|
||||
intervalofechamento = Constantes.INTERVALO_FECHAMENTO_DIARIO;
|
||||
}
|
||||
|
||||
|
||||
if (radTipoPagamentoBoleto.isChecked()){
|
||||
fechamentoParamptovta.setTipopagamento("B");
|
||||
} else {
|
||||
|
@ -3212,7 +3189,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
radIntervalofechamentoMensal.setChecked(false);
|
||||
radIntervalofechamentoDiario.setChecked(false);
|
||||
radTipoPagamentoBoleto.setChecked(true);
|
||||
|
||||
|
||||
txtDiasemtransito.setValue("");
|
||||
}
|
||||
|
||||
|
@ -3291,7 +3268,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
}
|
||||
return integracionTotvs;
|
||||
}
|
||||
|
||||
|
||||
public boolean isIntegracionAG() {
|
||||
integracionAG = false;
|
||||
if (ApplicationProperties.getInstance().integracionTotvs()) {
|
||||
|
@ -3303,7 +3280,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
public void setIntegracionTotvs(boolean integracionTotvs) {
|
||||
this.integracionTotvs = integracionTotvs;
|
||||
}
|
||||
|
||||
|
||||
public void setIntegracionAG(boolean integracionAG) {
|
||||
this.integracionAG = integracionAG;
|
||||
}
|
||||
|
@ -3444,7 +3421,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
this.lsCategoriaBloquear = lsCategoriaBloquear;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the txtTaxaConvenienciaPorc
|
||||
*/
|
||||
|
@ -3476,15 +3453,15 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer {
|
|||
/**
|
||||
* @return the ct
|
||||
*/
|
||||
public ConstraintPorcentagem getCt() {
|
||||
public ConstraintPorcentagemAllowNull getCt() {
|
||||
return ct;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ct the ct to set
|
||||
*/
|
||||
public void setCt(ConstraintPorcentagem ct) {
|
||||
public void setCt(ConstraintPorcentagemAllowNull ct) {
|
||||
this.ct = ct;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.rjconsultores.ventaboletos.web.utilerias;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.zkoss.util.resource.Labels;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zul.Constraint;
|
||||
|
||||
/**
|
||||
* @author Thiago
|
||||
*
|
||||
*/
|
||||
public class ConstraintPorcentagemAllowNull implements Constraint {
|
||||
|
||||
@Override
|
||||
public void validate(Component comp, Object value) throws WrongValueException {
|
||||
if (value != null) {
|
||||
if (((BigDecimal) value).doubleValue() > 100) {
|
||||
throw new WrongValueException(comp,
|
||||
Labels.getLabel("MSG.CONSTRAINT.PORCENTAGEM"));
|
||||
} else if (((BigDecimal) value).doubleValue() < 0) {
|
||||
throw new WrongValueException(comp,
|
||||
Labels.getLabel("MSG.CONSTRAINT.PORCENTAGEM"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue