Se agrega funcionalidad de Pago a Crédito#AL-4549

master
Fernando Abimael Alvarez Uc 2024-08-01 14:34:00 -06:00
parent fd6c19626f
commit 4218de49c7
3 changed files with 49 additions and 30 deletions

View File

@ -1,6 +1,7 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.expressos; package com.rjconsultores.ventaboletos.web.gui.controladores.expressos;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -19,15 +20,19 @@ import org.zkoss.zul.Combobox;
import org.zkoss.zul.Comboitem; import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Paging; import org.zkoss.zul.Paging;
import com.rjconsultores.ventaboletos.entidad.Constante;
import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.FormaPago; import com.rjconsultores.ventaboletos.entidad.FormaPago;
import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; import com.rjconsultores.ventaboletos.entidad.GrupoCortesia;
import com.rjconsultores.ventaboletos.entidad.TipoCortesia; import com.rjconsultores.ventaboletos.entidad.TipoCortesia;
import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso;
import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.SolicitudExpresosService; import com.rjconsultores.ventaboletos.service.SolicitudExpresosService;
import com.rjconsultores.ventaboletos.service.TipoIdentificacionService; import com.rjconsultores.ventaboletos.service.TipoIdentificacionService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
import com.rjconsultores.ventaboletos.web.utilerias.MyDatebox; import com.rjconsultores.ventaboletos.web.utilerias.MyDatebox;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -36,6 +41,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchOb
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper; import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderExpresosPorCotizar; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderExpresosPorCotizar;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderHistoricoFormaPagoSelecao; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderHistoricoFormaPagoSelecao;
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
import com.trg.search.Filter; import com.trg.search.Filter;
@Controller("expressosPorCotizarController") @Controller("expressosPorCotizarController")
@ -50,6 +56,9 @@ public class ExpressosPorCotizarController extends MyGenericForwardComposer{
@Autowired @Autowired
private EmpresaService empresaService; private EmpresaService empresaService;
@Autowired
SolicitudExpresosService solicitudExpresosService;
private List<Empresa> lsEmpresa; private List<Empresa> lsEmpresa;
private Combobox cmbEmpresa; private Combobox cmbEmpresa;
private MyListbox expresosList; private MyListbox expresosList;
@ -61,33 +70,12 @@ public class ExpressosPorCotizarController extends MyGenericForwardComposer{
SolicitudExpreso expreso; SolicitudExpreso expreso;
@Autowired
SolicitudExpresosService solicitudExpresosService;
@Override @Override
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = empresaService.obtenerTodos(); lsEmpresa = empresaService.obtenerTodos();
super.doAfterCompose(comp); super.doAfterCompose(comp);
expresosList.setItemRenderer(new RenderExpresosPorCotizar(this, new EventListener() { expresosList.setItemRenderer(new RenderExpresosPorCotizar(this));
@Override
public void onEvent(Event arg0) throws Exception {
expreso = (SolicitudExpreso)arg0.getTarget().getAttribute("data");
//expreso.setStatusSolicitudExpresoId(); -- UPDATE ID SOLICITUD A CRÉDITO
solicitudExpresosService.actualizacion(expreso);
refreshLista();
}
}));
expresosList.addEventListener("onClick", new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
expreso = (SolicitudExpreso) expresosList.getSelected();
}
});
refreshLista(); refreshLista();
} }
@ -119,6 +107,10 @@ public class ExpressosPorCotizarController extends MyGenericForwardComposer{
plwTrayectosExpresos.init(buscarExpresos, expresosList, pagingExpresos); plwTrayectosExpresos.init(buscarExpresos, expresosList, pagingExpresos);
} }
public void onClick$btnRefresh(Event ev) {
refreshLista();
}
public List<Empresa> getLsEmpresa() { public List<Empresa> getLsEmpresa() {
return lsEmpresa; return lsEmpresa;
} }

View File

@ -1,5 +1,6 @@
package com.rjconsultores.ventaboletos.web.utilerias.render; package com.rjconsultores.ventaboletos.web.utilerias.render;
import java.util.Calendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -14,30 +15,34 @@ import org.zkoss.zul.ListitemRenderer;
import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Cliente; import com.rjconsultores.ventaboletos.entidad.Cliente;
import com.rjconsultores.ventaboletos.entidad.Constante;
import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso;
import com.rjconsultores.ventaboletos.entidad.TipoCortesia; import com.rjconsultores.ventaboletos.entidad.TipoCortesia;
import com.rjconsultores.ventaboletos.entidad.Usuario;
import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.service.SolicitudExpresosService; import com.rjconsultores.ventaboletos.service.SolicitudExpresosService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional.BusquedaConfRestricaoCanalVentaController; import com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional.BusquedaConfRestricaoCanalVentaController;
import com.rjconsultores.ventaboletos.web.gui.controladores.expressos.ExpressosPorCotizarController; import com.rjconsultores.ventaboletos.web.gui.controladores.expressos.ExpressosPorCotizarController;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria; import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
public class RenderExpresosPorCotizar implements ListitemRenderer { public class RenderExpresosPorCotizar implements ListitemRenderer {
private EventListener listenerGenerico;
private ExpressosPorCotizarController expresosControllerWindow; private ExpressosPorCotizarController expresosControllerWindow;
private SolicitudExpreso expreso; private SolicitudExpreso expreso;
private Usuario usuario;
@Autowired @Autowired
SolicitudExpresosService expresosService; SolicitudExpresosService expresosService;
public RenderExpresosPorCotizar(ExpressosPorCotizarController window, EventListener listenerGenerico) { public RenderExpresosPorCotizar(ExpressosPorCotizarController window) {
super(); super();
expresosControllerWindow = window; expresosControllerWindow = window;
this.listenerGenerico = listenerGenerico;
} }
@Override @Override
@ -128,12 +133,33 @@ public class RenderExpresosPorCotizar implements ListitemRenderer {
lc.appendChild(btnCotizar); break; lc.appendChild(btnCotizar); break;
case 2: case 2:
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
String pagoCreditoConstante = constanteService.buscarPorNomeConstante("FORMAPAGOCREDITO_ID").getValorconstante();
if(expresos.getFormaPagoId() == null || expresos.getFormaPagoId() != Integer.valueOf(pagoCreditoConstante)) {
Button btnPagoCredito = new Button("Pago Crédito"); Button btnPagoCredito = new Button("Pago Crédito");
btnPagoCredito.setAttribute("data", data); btnPagoCredito.setAttribute("data", data);
btnPagoCredito.addEventListener("onClick", listenerGenerico); btnPagoCredito.addEventListener("onClick", new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
Listitem listItem = (Listitem) event.getTarget().getParent().getParent();
SolicitudExpresosService solicitudExpresosService = (SolicitudExpresosService) AppContext.getApplicationContext().getBean("solicitudExpresosService");
expreso = (SolicitudExpreso)listItem.getAttribute("data");
usuario = UsuarioLogado.getUsuarioLogado();
expreso.setFormaPagoId(Integer.valueOf(pagoCreditoConstante));
expreso.setUsuarioAutorizaCredito(usuario.getUsuarioId());
expreso.setFechaHoraAutorizaCredito(Calendar.getInstance().getTime());
solicitudExpresosService.actualizacion(expreso);
}
});
lc.appendChild(btnPagoCredito); lc.appendChild(btnPagoCredito);
}
break; break;
//case 3: break; //case 3: break;

View File

@ -7456,6 +7456,7 @@ indexController.mniExpressosDocumentos.label = Documentos
expresosController.lbl.verDetalle = Ver Detalle expresosController.lbl.verDetalle = Ver Detalle
expresosController.lbl.asignarBus = Asignar Bus expresosController.lbl.asignarBus = Asignar Bus
expresosController.lbl.pagadoCredito = Pagado a Crédito
expresoController.MSG.errorArchivo = Archivo inválidoo o nulo expresoController.MSG.errorArchivo = Archivo inválidoo o nulo
cargaContratoController.MSG.errorExpresoNull = Seleccione Expreso a Asociar Contrato cargaContratoController.MSG.errorExpresoNull = Seleccione Expreso a Asociar Contrato