Se ajusta cálculo de valor de la cotización al actualizar trayectos. Fixes bug#AL-4550

master
Fernando Uc 2024-10-17 14:06:29 -06:00
parent c168e7530a
commit 3a535efa69
2 changed files with 23 additions and 2 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>br.com.rjconsultores</groupId> <groupId>br.com.rjconsultores</groupId>
<artifactId>ventaboletosadm</artifactId> <artifactId>ventaboletosadm</artifactId>
<version>1.159.0</version> <version>1.159.1</version>
<packaging>war</packaging> <packaging>war</packaging>
<properties> <properties>

View File

@ -1,5 +1,7 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.expressos; package com.rjconsultores.ventaboletos.web.gui.controladores.expressos;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; 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;
@ -11,6 +13,7 @@ import org.zkoss.zul.Window;
import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso;
import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos;
import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.LogAuditoriaService;
import com.rjconsultores.ventaboletos.service.SolicitudExpresosService;
import com.rjconsultores.ventaboletos.service.TrayectosExpresosService; import com.rjconsultores.ventaboletos.service.TrayectosExpresosService;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox; import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
@ -21,6 +24,9 @@ public class ModificarTrayectoExpresoController extends MyGenericForwardComposer
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Autowired
SolicitudExpresosService solicitudExpresosService;
@Autowired @Autowired
TrayectosExpresosService trayectosExpresosService; TrayectosExpresosService trayectosExpresosService;
@ -30,6 +36,8 @@ public class ModificarTrayectoExpresoController extends MyGenericForwardComposer
TrayectosExpresos trayecto; TrayectosExpresos trayecto;
TrayectosExpresos trayectoClone; TrayectosExpresos trayectoClone;
SolicitudExpreso expreso;
private Window winCotizarExpresso; private Window winCotizarExpresso;
private MyTextbox txtRuta; private MyTextbox txtRuta;
@ -40,11 +48,11 @@ public class ModificarTrayectoExpresoController extends MyGenericForwardComposer
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp); super.doAfterCompose(comp);
trayecto = (TrayectosExpresos) Executions.getCurrent().getArg().get("trayecto"); trayecto = (TrayectosExpresos) Executions.getCurrent().getArg().get("trayecto");
expreso = (SolicitudExpreso) Executions.getCurrent().getArg().get("expreso");
trayecto.clonar(); trayecto.clonar();
trayectoClone = trayecto.getCloneObject(); trayectoClone = trayecto.getCloneObject();
winCotizarExpresso = (Window) Executions.getCurrent().getArg().get("winCotizarExpresso"); winCotizarExpresso = (Window) Executions.getCurrent().getArg().get("winCotizarExpresso");
txtRuta.setValue(trayecto.getDescTrayecto()); txtRuta.setValue(trayecto.getDescTrayecto());
@ -66,6 +74,7 @@ public class ModificarTrayectoExpresoController extends MyGenericForwardComposer
Integer cantVechiculos = Integer.valueOf(txtCantidadVehiculos.getValue().toString()); Integer cantVechiculos = Integer.valueOf(txtCantidadVehiculos.getValue().toString());
Integer valorTrayecto = Integer.valueOf(txtValorTrayecto.getValue().toString()); Integer valorTrayecto = Integer.valueOf(txtValorTrayecto.getValue().toString());
Integer valorExpreso = 0;
trayecto.setCantVehiculos(cantVechiculos); trayecto.setCantVehiculos(cantVechiculos);
trayecto.setValorTrayecto(valorTrayecto); trayecto.setValorTrayecto(valorTrayecto);
@ -74,6 +83,18 @@ public class ModificarTrayectoExpresoController extends MyGenericForwardComposer
logAuditoriaService.auditar(trayectoClone, trayecto, null); logAuditoriaService.auditar(trayectoClone, trayecto, null);
List<TrayectosExpresos> trayectos = trayectosExpresosService.obtenerTrayectosPorServicioId(trayecto.getSolicitudExpresoId());
for(TrayectosExpresos trayecto : trayectos) {
if(trayecto.getValorTrayecto() != null) {
valorExpreso += trayecto.getValorTrayecto();
}
}
expreso.setValorCotizacion(valorExpreso);
solicitudExpresosService.actualizacion(expreso);
winCotizarExpresso.focus(); winCotizarExpresso.focus();
this.closeWindow(); this.closeWindow();