Reescrito modeo de TipoEgreso

Ademas los metodos que lo utilizaban para buscar en la base de datos
ahora comprueban contra TipoEgreso.EMPTY para evitar buscar cuando se
para un TipoEgreso.EMPTY
This commit is contained in:
Daniel Cortes
2019-03-07 19:00:22 -03:00
parent b2ff6dd7f7
commit 7e31885c8a
7 changed files with 87 additions and 84 deletions

View File

@@ -172,11 +172,11 @@ public class EstadoResultadoController extends BaseController {
private void fillGastosGenerales() {
TipoEgreso facturaGastosGenerales = DAOManager.getTipoEgresoDAO()
.findByNombre("Factura Gastos Generales").get(0);
.findByNombre("Factura Gastos Generales").orElse(TipoEgreso.EMPTY);
TipoEgreso gastoGeneralConBoleta = DAOManager.getTipoEgresoDAO()
.findByNombre("Gasto General Con Boleta").get(0);
.findByNombre("Gasto General Con Boleta").orElse(TipoEgreso.EMPTY);
TipoEgreso gastoGeneralSinRespaldo = DAOManager.getTipoEgresoDAO()
.findByNombre("Gasto General Sin Respaldo").get(0);
.findByNombre("Gasto General Sin Respaldo").orElse(TipoEgreso.EMPTY);
int cuentaCorrienteFactura = this.estadoResultado.getCuentaCorrienteFactura();
int cuentaCorrienteBoleta = this.estadoResultado.getCuentaCorrienteBoleta();
@@ -201,7 +201,7 @@ public class EstadoResultadoController extends BaseController {
}
private void fillGastosOperacionales() {
TipoEgreso tipoPagoPartime = DAOManager.getTipoEgresoDAO().findByNombre("Pago Partime").get(0);
TipoEgreso tipoPagoPartime = DAOManager.getTipoEgresoDAO().findByNombre("Pago Partime").orElse(TipoEgreso.EMPTY);
int costoVenta = this.estadoResultado.getCostoVenta();
int remuneraciones = this.estadoResultado.getRemuneraciones();