valdevir 2016-11-10 13:36:02 +00:00
parent 756ce27ab4
commit 630da56865
1 changed files with 14 additions and 17 deletions

View File

@ -6,7 +6,6 @@ import java.util.Map;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope; import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels; import org.zkoss.util.resource.Labels;
@ -17,8 +16,8 @@ import org.zkoss.zul.Textbox;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MaskUtil; import com.rjconsultores.ventaboletos.web.utilerias.MaskUtil;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxPuntoVenta;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -26,15 +25,12 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@Scope("prototype") @Scope("prototype")
@Controller("busquedaConferenciaComissaoController") @Controller("busquedaConferenciaComissaoController")
public class BusquedaConferenciaComissaoController extends MyGenericForwardComposer { public class BusquedaConferenciaComissaoController extends MyGenericForwardComposer {
private static Logger log = Logger.getLogger(BusquedaConferenciaComissaoController.class); private static Logger log = Logger.getLogger(BusquedaConferenciaComissaoController.class);
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// private static final Logger log = LoggerFactory.getLogger(BusquedaConferenciaComissaoController.class); // private static final Logger log = LoggerFactory.getLogger(BusquedaConferenciaComissaoController.class);
@Autowired
private EmpresaService empresaService;
private Textbox txtCompetencia; private Textbox txtCompetencia;
private MyComboboxPuntoVenta cmbPuntoVenta; private MyComboboxPuntoVenta cmbPuntoVenta;
private PuntoVenta puntoVenta; private PuntoVenta puntoVenta;
@ -45,7 +41,8 @@ public class BusquedaConferenciaComissaoController extends MyGenericForwardCompo
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp); super.doAfterCompose(comp);
aplicarMascara(); aplicarMascara();
lsEmpresas = empresaService.obtenerTodos(); // lsEmpresas = empresaService.obtenerTodos();
lsEmpresas = UsuarioLogado.getUsuarioLogado().getEmpresa();
txtCompetencia.focus(); txtCompetencia.focus();
} }
@ -53,30 +50,30 @@ public class BusquedaConferenciaComissaoController extends MyGenericForwardCompo
txtCompetencia.getValue(); txtCompetencia.getValue();
cmbPuntoVenta.getValue(); cmbPuntoVenta.getValue();
try { try {
if(verificarCampos()) { if (verificarCampos()) {
Map<String, Object> args = new HashMap<String, Object>(); Map<String, Object> args = new HashMap<String, Object>();
args.put("competencia", txtCompetencia.getValue()); args.put("competencia", txtCompetencia.getValue());
args.put("empresa", empresa); args.put("empresa", empresa);
if(StringUtils.isNotBlank(cmbPuntoVenta.getValue())) { if (StringUtils.isNotBlank(cmbPuntoVenta.getValue())) {
args.put("puntoVenta", puntoVenta); args.put("puntoVenta", puntoVenta);
} }
openWindow("/gui/comissao/conferenciaComissao.zul", openWindow("/gui/comissao/conferenciaComissao.zul",
Labels.getLabel("conferenciaComissaoController.window.title"), args, MODAL); Labels.getLabel("conferenciaComissaoController.window.title"), args, MODAL);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} }
private boolean verificarCampos() throws Exception { private boolean verificarCampos() throws Exception {
if(!DateUtil.isCompetenciaValida(txtCompetencia.getValue())) { if (!DateUtil.isCompetenciaValida(txtCompetencia.getValue())) {
Messagebox.show(Labels.getLabel("MSG.Error.invalida.competencia"), Messagebox.show(Labels.getLabel("MSG.Error.invalida.competencia"),
Labels.getLabel("conferenciaComissaoController.window.title"), Labels.getLabel("conferenciaComissaoController.window.title"),
Messagebox.OK, Messagebox.ERROR); Messagebox.OK, Messagebox.ERROR);
return false; return false;
} }
return true; return true;