frederico 2017-11-28 16:43:19 +00:00
parent a47b96303c
commit 8819fbec65
1 changed files with 27 additions and 4 deletions

View File

@ -732,13 +732,19 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
}
}
public void onClick$btnAdicionarComissaoCategoria(Event ev) throws InterruptedException {
public void onClick$btnAdicionarComissaoCategoria(Event ev) throws InterruptedException {
try {
Categoria categoria = (Categoria) cmbCategorias.getSelectedItem().getValue();
if(categoria != null) {
for (ComEmpCategoria c : empresa.getComEmpCategorias()) {
if (c.getCategoria().getCategoriaId().equals(categoria.getCategoriaId())) {
return;
}
}
ComEmpCategoria comEmpCategoria = new ComEmpCategoria();
comEmpCategoria.setCategoria(categoria);
comEmpCategoria.setEmpresa(getEmpresa());
@ -746,6 +752,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
comEmpCategoria = empresaService.adicionarComissaoCategoria(comEmpCategoria);
comEmpCategoriaList.updateItem(comEmpCategoria);
empresa.getComEmpCategorias().add(comEmpCategoria);
Messagebox.show(Labels.getLabel("editarEmpresaController.msg.adicionarComissaoCategoria"),
Labels.getLabel("editarEmpresaController.window.title"),
@ -773,6 +780,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
ComEmpCategoria comEmpCategoria = (ComEmpCategoria) comEmpCategoriaList.getSelected();
empresaService.removerComissaoCategoria(comEmpCategoria);
comEmpCategoriaList.removeItem(comEmpCategoria);
empresa.getComEmpCategorias().remove(comEmpCategoria);
Messagebox.show(Labels.getLabel("editarEmpresaController.msg.removerComissaoCategoria"),
Labels.getLabel("editarEmpresaController.window.title"),
@ -795,6 +803,12 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
if(formapago != null) {
for(ComEmpFormapago f : empresa.getComEmpFormapagos()){
if(f.getFormaPago().getFormapagoId().equals(formapago.getFormapagoId())){
return;
}
}
ComEmpFormapago comEmpFormapago = new ComEmpFormapago();
comEmpFormapago.setFormaPago(formapago);
comEmpFormapago.setEmpresa(getEmpresa());
@ -802,6 +816,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
comEmpFormapago = empresaService.adicionarComissaoFormapago(comEmpFormapago);
comEmpFormapagoList.updateItem(comEmpFormapago);
empresa.getComEmpFormapagos().add(comEmpFormapago);
Messagebox.show(Labels.getLabel("editarEmpresaController.msg.adicionarComissaoFormapago"),
Labels.getLabel("editarEmpresaController.window.title"),
@ -829,6 +844,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
ComEmpFormapago comEmpFormapago = (ComEmpFormapago) comEmpFormapagoList.getSelected();
empresaService.removerComissaoFormapago(comEmpFormapago);
comEmpFormapagoList.removeItem(comEmpFormapago);
empresa.getComEmpFormapagos().remove(comEmpFormapago);
Messagebox.show(Labels.getLabel("editarEmpresaController.msg.removerComissaoFormapago"),
Labels.getLabel("editarEmpresaController.window.title"),
@ -856,6 +872,12 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
if(tipoEventoExtra != null) {
for(ComEmpTipoEventoExtra e : empresa.getComEmpTipoEventoExtras()){
if(e.getTipoEventoExtra().getTipoeventoextraId().equals(tipoEventoExtra.getTipoeventoextraId())){
return;
}
}
ComEmpTipoEventoExtra comEmpTipoEventoExtra = new ComEmpTipoEventoExtra();
comEmpTipoEventoExtra.setTipoEventoExtra(tipoEventoExtra);
comEmpTipoEventoExtra.setEmpresa(getEmpresa());
@ -863,6 +885,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
comEmpTipoEventoExtra = empresaService.adicionarComissaoTipoEventoExtra(comEmpTipoEventoExtra);
comEmpTipoEventoExtraList.updateItem(comEmpTipoEventoExtra);
empresa.getComEmpTipoEventoExtras().add(comEmpTipoEventoExtra);
Messagebox.show(Labels.getLabel("editarEmpresaController.msg.adicionarComissaoTipoEventoExtra"),
Labels.getLabel("editarEmpresaController.window.title"),
@ -888,6 +911,7 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
if (resp == Messagebox.YES) {
ComEmpTipoEventoExtra comEmpTipoEventoExtra = (ComEmpTipoEventoExtra) comEmpTipoEventoExtraList.getSelected();
empresa.getComEmpTipoEventoExtras().remove(comEmpTipoEventoExtra);
empresaService.removerComissaoTipoEventoExtra(comEmpTipoEventoExtra);
comEmpTipoEventoExtraList.removeItem(comEmpTipoEventoExtra);
@ -904,7 +928,6 @@ public class EditarEmpresaController extends MyGenericForwardComposer {
Messagebox.OK,Messagebox.ERROR);
}
}
public Combobox getCmbEstadoInscEstadual() {
return cmbEstadoInscEstadual;
}