Skip to content

Commit

Permalink
Merge pull request #45 from Jrgil20/feature/R2_GananciasNetas
Browse files Browse the repository at this point in the history
Rename ganaciasNetas.sql to R2_ganaciasNetas.sql and add validation f…
  • Loading branch information
Jrgil20 authored Jan 11, 2025
2 parents 2ed7b22 + 849b183 commit f12f4f4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ganaciasNetas.sql → R2_ganaciasNetas.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ DECLARE
_ganancias_brutas NUMERIC;
_costos NUMERIC;
BEGIN

IF fecha_fin > CURRENT_DATE THEN
fecha_fin := CURRENT_DATE;
RAISE EXCEPTION 'se calcula las ganancias netas hasta el dia de hoy';
END IF;

IF fecha_inicio > CURRENT_DATE THEN
RAISE NOTICE 'No se puede calcular aun';
END IF;

SELECT COALESCE(SUM(montoTotal), 0)
INTO _ganancias_brutas
FROM FACTURA_FINAL
Expand Down

0 comments on commit f12f4f4

Please sign in to comment.