gleimar 2015-07-30 14:25:12 +00:00
parent 536a901258
commit 2541194067
6 changed files with 79 additions and 34 deletions

View File

@ -22,6 +22,7 @@ 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.service.FiscalImpressoraService;
import com.rjconsultores.ventaboletos.service.FormaPagoService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -305,4 +306,28 @@ public class EditarFormapagoEmpresaController extends MyGenericForwardComposer
this.btnApagar = btnApagar;
}
public boolean desabilitaComboFormaPago(){
if ( (formapagoEmpresa.getTipoformapago() != null) && (formapagoEmpresa.getTipoformapago().equals(TipoFormaPagamento.CUSTOM.toString())) ){
return false;
}
return true;
}
public void onChange$cmbTipoformapago(Event ev) {
Comboitem ciTipoformapago = cmbTipoformapago.getSelectedItem();
if (ciTipoformapago != null) {
String tipoFormaPago = (String) ciTipoformapago.getValue();
formapagoEmpresa.setFormaPago(null);
if (tipoFormaPago.equals(TipoFormaPagamento.CUSTOM.toString())){
cmbTipoformapagoTotalBus.setDisabled(false);
}else{
cmbTipoformapagoTotalBus.setDisabled(true);
}
}
}
}

View File

@ -1,7 +1,6 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.impressaofiscal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@ -14,6 +13,7 @@ import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Button;
import org.zkoss.zul.Checkbox;
@ -36,17 +36,24 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
public enum TipoTotalizadorNaoFiscal {
CancImpPost,
CartaoCredDeb,
CanPassagem,
VendaManual,
ImpressaoPost,
SeguroOpcional,
CancSeguroOpcional,
Multa,
DiferencaMaior,
DiferencaMenor,
CUSTOM;
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;
}
}
/**
@ -110,9 +117,14 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
totnaofiscalEmpresa = (FiscalTotnaofiscalEmpresa) Executions.getCurrent().getArg().get("totnaofiscalEmpresa");
totnaofiscalEmpresaList = (MyListbox) Executions.getCurrent().getArg().get("totnaofiscalEmpresaList");
if (totnaofiscalEmpresa.getFiscaltotnaofiscalId() == null)
if (totnaofiscalEmpresa.getFiscaltotnaofiscalId() == null){
btnApagar.setVisible(Boolean.FALSE);
}else{
TipoTotalizadorNaoFiscal tipoTotalizadorNaoFiscal = TipoTotalizadorNaoFiscal.valueOf(totnaofiscalEmpresa.getTipototalizador());
cmbTipoEventoExtra.setDisabled(!tipoTotalizadorNaoFiscal.isTemEE());
}
}
public void onClick$btnSalvar(Event ev) throws InterruptedException {
@ -137,9 +149,7 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
totnaofiscalEmpresa.setDescricao(txtDescricao.getText());
totnaofiscalEmpresa.setActivo(true);
totnaofiscalEmpresa.setFecmodif(Calendar.getInstance().getTime());
totnaofiscalEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
for (Object totalizador : totnaofiscalEmpresaList.getListData()) {
if(!((FiscalTotnaofiscalEmpresa)totalizador).getFiscaltotnaofiscalId().equals(totnaofiscalEmpresa.getFiscaltotnaofiscalId())
&& totnaofiscalEmpresa.getEmpresa().equals(((FiscalTotnaofiscalEmpresa)totalizador).getEmpresa())
@ -169,13 +179,9 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
}
}
if(totnaofiscalEmpresa.getFiscaltotnaofiscalId() == null){
fiscalImpressoraService.suscribirTotnaofiscalEmpresa(totnaofiscalEmpresa);
totnaofiscalEmpresaList.addItemNovo(totnaofiscalEmpresa);
} else {
fiscalImpressoraService.actualizacionTotnaofiscalEmpresa(totnaofiscalEmpresa);
totnaofiscalEmpresaList.updateItem(totnaofiscalEmpresa);
}
fiscalImpressoraService.suscribirActualizarTotnaofiscalEmpresa(totnaofiscalEmpresa);
totnaofiscalEmpresaList.updateItem(totnaofiscalEmpresa);
Messagebox.show(
Labels.getLabel("editarTotnaofiscalEmpresaController.MSG.suscribirOK"),
@ -185,6 +191,10 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
closeWindow();
}catch (Exception ex) {
if (ex instanceof WrongValueException){
throw ((WrongValueException)ex);
}
log.error("editarTotnaofiscalEmpresaController: " + ex);
Messagebox.show(
Labels.getLabel("MSG.Error"),
@ -203,10 +213,8 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
if (resp == Messagebox.YES) {
totnaofiscalEmpresa.setActivo(false);
totnaofiscalEmpresa.setFecmodif(Calendar.getInstance().getTime());
totnaofiscalEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
fiscalImpressoraService.actualizacionTotnaofiscalEmpresa(totnaofiscalEmpresa);
fiscalImpressoraService.borrarTotnaofiscalEmpresa(totnaofiscalEmpresa);
Messagebox.show(
Labels.getLabel("editarTotnaofiscalEmpresaController.MSG.borrarOK"),
@ -310,4 +318,16 @@ public class EditarTotnaofiscalEmpresaController extends MyGenericForwardCompose
this.chkImportarImp = chkImportarImp;
}
public void onChange$cmbTipototalizador(Event ev) {
Comboitem selectedItem = cmbTipototalizador.getSelectedItem();
if (selectedItem != null){
String tipoTotalizador = (String) selectedItem.getValue();
TipoTotalizadorNaoFiscal tipoTotalizadorNaoFiscal = TipoTotalizadorNaoFiscal.valueOf(tipoTotalizador);
totnaofiscalEmpresa.setTipoeventoextra(null);
cmbTipoEventoExtra.setDisabled(!tipoTotalizadorNaoFiscal.isTemEE());
}
}
}

View File

@ -51,7 +51,7 @@
label="${c:l('lb.id')}" sort="auto(fiscalFormapagoId)"/>
<listheader image="/gui/img/create_doc.gif"
label="${c:l('busquedaFormapagoEmpresaController.empresa.label')}" sort="auto(empresa)"/>
label="${c:l('busquedaFormapagoEmpresaController.empresa.label')}" sort="auto(empresa.nombempresa)"/>
<listheader image="/gui/img/create_doc.gif"
label="${c:l('busquedaFormapagoEmpresaController.tipoformapago.label')}" sort="auto(tipoformapago)"/>
@ -60,7 +60,7 @@
label="${c:l('busquedaFormapagoEmpresaController.descricao.label')}" sort="auto(descricao)"/>
<listheader image="/gui/img/create_doc.gif"
label="${c:l('busquedaFormapagoEmpresaController.formapagototalbus.label')}" sort="auto(formaPago)"/>
label="${c:l('busquedaFormapagoEmpresaController.formapagototalbus.label')}" sort="auto(formaPago.descpago)"/>
</listhead>
</listbox>

View File

@ -52,7 +52,7 @@
label="${c:l('lb.id')}" sort="auto(fiscalrelgerencialId)"/>
<listheader image="/gui/img/create_doc.gif" align="right"
label="${c:l('busquedaRelgerencialEmpresaController.empresa.label')}" sort="auto(empresa)"/>
label="${c:l('busquedaRelgerencialEmpresaController.empresa.label')}" sort="auto(empresa.nombempresa)"/>
<listheader image="/gui/img/create_doc.gif" align="right"
label="${c:l('busquedaRelgerencialEmpresaController.tiporelgerencial.label')}" sort="auto(tiporelgerencial)"/>

View File

@ -52,7 +52,7 @@
label="${c:l('lb.id')}" sort="auto(fiscaltotnaofiscalId)"/>
<listheader image="/gui/img/create_doc.gif"
label="${c:l('busquedaTotnaofiscalEmpresaController.empresa.label')}" sort="auto(empresa)"/>
label="${c:l('busquedaTotnaofiscalEmpresaController.empresa.label')}" sort="auto(empresa.nombempresa)"/>
<listheader image="/gui/img/create_doc.gif"
label="${c:l('busquedaTotnaofiscalEmpresaController.tipototalizador.label')}" sort="auto(tipototalizador)"/>
@ -61,7 +61,7 @@
label="${c:l('busquedaTotnaofiscalEmpresaController.descricao.label')}" sort="auto(descricao)"/>
<listheader image="/gui/img/create_doc.gif"
label="${c:l('busquedaTotnaofiscalEmpresaController.tipoeventoextra.label')}" sort="auto(tipoeventoextra)"/>
label="${c:l('busquedaTotnaofiscalEmpresaController.tipoeventoextra.label')}" sort="auto(tipoeventoextra.descTipoEvento)"/>
</listhead>
</listbox>

View File

@ -60,7 +60,7 @@
<row>
<label value="${c:l('busquedaFormapagoEmpresaController.formapagototalbus.label')}"/>
<combobox id="cmbTipoformapagoTotalBus" use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true" width="70%"
mold="rounded" buttonVisible="true" width="70%" disabled="@{winEditarFormapagoEmpresa$composer.desabilitaComboFormaPago}"
model="@{winEditarFormapagoEmpresa$composer.lsTipoformapagoTotalBus}"
selectedItem="@{winEditarFormapagoEmpresa$composer.formapagoEmpresa.formaPago}"/>
</row>