fixes bug#6531
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@46510 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
eae2582f8e
commit
6b7b80a3d1
|
@ -22,9 +22,10 @@ import org.zkoss.zul.Textbox;
|
|||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.FormaPago;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.FiscalImpressoraService;
|
||||
import com.rjconsultores.ventaboletos.service.FormaPagoService;
|
||||
import com.rjconsultores.ventaboletos.service.impl.FiscalImpressoraServiceImpl.TipoFormaPagamento;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
|
@ -32,14 +33,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
|||
@Controller("editarFormapagoEmpresaController")
|
||||
@Scope("prototype")
|
||||
public class EditarFormapagoEmpresaController extends MyGenericForwardComposer {
|
||||
|
||||
public enum TipoFormaPagamento {
|
||||
TotalCartao,
|
||||
PtaAtendido,
|
||||
TrocaPassagem,
|
||||
Gratuidade,
|
||||
CUSTOM;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -117,35 +110,11 @@ public class EditarFormapagoEmpresaController extends MyGenericForwardComposer
|
|||
formapagoEmpresa.setTipoformapago(tipoFormapago);
|
||||
}
|
||||
|
||||
|
||||
formapagoEmpresa.setIndVinculado(radVinculado.isChecked());
|
||||
formapagoEmpresa.setDescricao(txtDescricao.getText());
|
||||
|
||||
formapagoEmpresa.setActivo(true);
|
||||
formapagoEmpresa.setFecmodif(Calendar.getInstance().getTime());
|
||||
formapagoEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
|
||||
if(!formapagoEmpresa.getTipoformapago().equals(TipoFormaPagamento.CUSTOM.name()) && formapagoEmpresaList.getListData().contains(formapagoEmpresa)){
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarFormapagoEmpresaController.MSG.erroTipoFormaPago"),
|
||||
Labels.getLabel("editarFormapagoEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
if(formapagoEmpresa.getFiscalformapagoempresaId() == null){
|
||||
fiscalImpressoraService.suscribirFormapagoEmpresa(formapagoEmpresa);
|
||||
formapagoEmpresaList.addItemNovo(formapagoEmpresa);
|
||||
} else {
|
||||
fiscalImpressoraService.actualizacionFormapagoEmpresa(formapagoEmpresa);
|
||||
formapagoEmpresaList.updateItem(formapagoEmpresa);
|
||||
}
|
||||
|
||||
|
||||
if(!validaFormaPagosTotalBusObrigatorios()){
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarFormapagoEmpresaController.MSG.formaPagosTotalBusObrigatorios"),
|
||||
Labels.getLabel("editarFormapagoEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
}
|
||||
fiscalImpressoraService.suscribirActualizarFormapagoEmpresa(formapagoEmpresa);
|
||||
formapagoEmpresaList.updateItem(formapagoEmpresa);
|
||||
|
||||
|
||||
Messagebox.show(
|
||||
|
@ -154,7 +123,11 @@ public class EditarFormapagoEmpresaController extends MyGenericForwardComposer
|
|||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
closeWindow();
|
||||
|
||||
}catch (BusinessException ex) {
|
||||
Messagebox.show(
|
||||
ex.getLocalizedMessage(),
|
||||
Labels.getLabel("editarTotnaofiscalEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
}catch (Exception ex) {
|
||||
log.error("editarFormapagoEmpresaController: " + ex);
|
||||
Messagebox.show(
|
||||
|
@ -165,39 +138,6 @@ public class EditarFormapagoEmpresaController extends MyGenericForwardComposer
|
|||
|
||||
}
|
||||
|
||||
private boolean validaFormaPagosTotalBusObrigatorios(){
|
||||
|
||||
boolean validado = false;
|
||||
|
||||
Empresa empresaCorrente = (Empresa) cmbEmpresa.getSelectedItem().getValue();
|
||||
|
||||
for(FormaPago formaPagoTotalBus : lsTipoformapagoTotalBus){
|
||||
|
||||
for(Object obj : formapagoEmpresaList.getListData()){
|
||||
|
||||
FiscalFormapagoEmpresa formapagoEmpresa = (FiscalFormapagoEmpresa)obj;
|
||||
|
||||
if(formapagoEmpresa.getEmpresa().equals(empresaCorrente)){
|
||||
|
||||
FormaPago formaPago = formapagoEmpresa.getFormaPago();
|
||||
|
||||
validado = (formaPago != null && formaPago.equals(formaPagoTotalBus));
|
||||
|
||||
if(validado){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!validado){
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return validado;
|
||||
}
|
||||
|
||||
public void onClick$btnApagar(Event ev) {
|
||||
try {
|
||||
int resp = Messagebox.show(
|
||||
|
@ -207,10 +147,7 @@ public class EditarFormapagoEmpresaController extends MyGenericForwardComposer
|
|||
|
||||
if (resp == Messagebox.YES) {
|
||||
|
||||
formapagoEmpresa.setActivo(false);
|
||||
formapagoEmpresa.setFecmodif(Calendar.getInstance().getTime());
|
||||
formapagoEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
fiscalImpressoraService.actualizacionFormapagoEmpresa(formapagoEmpresa);
|
||||
fiscalImpressoraService.borrarFormapagoEmpresa(formapagoEmpresa);
|
||||
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarFormapagoEmpresaController.MSG.borrarOK"),
|
||||
|
|
|
@ -24,8 +24,10 @@ import org.zkoss.zul.Textbox;
|
|||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.FiscalImpressoraService;
|
||||
import com.rjconsultores.ventaboletos.service.TipoEventoExtraService;
|
||||
import com.rjconsultores.ventaboletos.service.impl.FiscalImpressoraServiceImpl.TipoTotalizadorNaoFiscal;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
|
@ -34,28 +36,6 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
|||
@Scope("prototype")
|
||||
public class EditarTotnaofiscalEmpresaController extends MyGenericForwardComposer {
|
||||
|
||||
public enum TipoTotalizadorNaoFiscal {
|
||||
|
||||
CancImpPost(false),
|
||||
CartaoCredDeb(false),
|
||||
CanPassagem(false),
|
||||
VendaManual(false),
|
||||
ImpressaoPost(false),
|
||||
SeguroOpcional(true),
|
||||
CancSeguroOpcional(true),
|
||||
Multa(true),
|
||||
DiferencaMaior(true),
|
||||
DiferencaMenor(true),
|
||||
CUSTOM(true);
|
||||
|
||||
private final boolean temEE;
|
||||
private TipoTotalizadorNaoFiscal(boolean pTemEE) { temEE = pTemEE; }
|
||||
public boolean isTemEE() {
|
||||
return temEE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -148,37 +128,6 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
|
|||
}
|
||||
|
||||
totnaofiscalEmpresa.setDescricao(txtDescricao.getText());
|
||||
|
||||
|
||||
for (Object totalizador : totnaofiscalEmpresaList.getListData()) {
|
||||
if(!((FiscalTotnaofiscalEmpresa)totalizador).getFiscaltotnaofiscalId().equals(totnaofiscalEmpresa.getFiscaltotnaofiscalId())
|
||||
&& totnaofiscalEmpresa.getEmpresa().equals(((FiscalTotnaofiscalEmpresa)totalizador).getEmpresa())
|
||||
&& totnaofiscalEmpresa.getTipototalizador()!= TipoTotalizadorNaoFiscal.CUSTOM.name()
|
||||
&& totnaofiscalEmpresaList.getListData().contains(totnaofiscalEmpresa)
|
||||
&& ((FiscalTotnaofiscalEmpresa)totalizador).getTipototalizador().equals(totnaofiscalEmpresa.getTipototalizador())){
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarTotnaofiscalEmpresaController.MSG.erroTipoTotalizador"),
|
||||
Labels.getLabel("editarTotnaofiscalEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (Object totalizador : totnaofiscalEmpresaList.getListData()) {
|
||||
if(!((FiscalTotnaofiscalEmpresa)totalizador).getFiscaltotnaofiscalId().equals(totnaofiscalEmpresa.getFiscaltotnaofiscalId())
|
||||
&& totnaofiscalEmpresa.getEmpresa().equals(((FiscalTotnaofiscalEmpresa)totalizador).getEmpresa())
|
||||
&& totnaofiscalEmpresa.getTipoeventoextra()!= null
|
||||
&& !"".equals(totnaofiscalEmpresa.getTipoeventoextra().getDescTipoEvento().trim())
|
||||
&& ((FiscalTotnaofiscalEmpresa)totalizador).getTipoeventoextra()!= null
|
||||
&& totnaofiscalEmpresa.getTipoeventoextra().getDescTipoEvento().equals(((FiscalTotnaofiscalEmpresa)totalizador).getTipoeventoextra().getDescTipoEvento())){
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarTotnaofiscalEmpresaController.MSG.erroTipoEventoExtra"),
|
||||
Labels.getLabel("editarTotnaofiscalEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fiscalImpressoraService.suscribirActualizarTotnaofiscalEmpresa(totnaofiscalEmpresa);
|
||||
totnaofiscalEmpresaList.updateItem(totnaofiscalEmpresa);
|
||||
|
||||
|
@ -190,6 +139,12 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
|
|||
|
||||
closeWindow();
|
||||
|
||||
}catch (BusinessException ex) {
|
||||
Messagebox.show(
|
||||
ex.getLocalizedMessage(),
|
||||
Labels.getLabel("editarTotnaofiscalEmpresaController.window.title"),
|
||||
Messagebox.OK, Messagebox.ERROR);
|
||||
|
||||
}catch (Exception ex) {
|
||||
if (ex instanceof WrongValueException){
|
||||
throw ((WrongValueException)ex);
|
||||
|
|
Loading…
Reference in New Issue