Corrige ctprrp004 (Reporte Produccion Diaria)

- Titulo de ventana corregido (mostraba "screen")
- START REPORT se ejecuta con la primera fila; si la consulta no devuelve
  datos avisa "NO EXISTEN REGISTROS PARA ESTOS PARAMETROS" en vez de
  generar un reporte en blanco

Verificado con 01/01/2024 a 12/31/2024: detallado 166 paginas en pantalla,
resumen 57 paginas en PDF. En la BD de pruebas (.40.250) cttb00003 no tiene
produccion posterior a agosto de 2025, por eso rangos de 2026 salen vacios.
Excel no probado.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-15 15:49:06 -04:00
co-authored by Claude Sonnet 5.5
parent fc2fa7acac
commit 7d5a853351
+20 -11
View File
@@ -20,6 +20,7 @@ DEFINE HANDLER om.SaxDocumentHandler, -- return value from fgl_report_commitCurr
DEFINE selec5 STRING DEFINE selec5 STRING
DEFINE anos CHAR(4) DEFINE anos CHAR(4)
DEFINE jdx INTEGER DEFINE jdx INTEGER
DEFINE hay_filas SMALLINT
DEFINE fecha_inicio, fecha_corte, fecha1 DATE, reporte_tipo INT DEFINE fecha_inicio, fecha_corte, fecha1 DATE, reporte_tipo INT
MAIN MAIN
@@ -52,6 +53,7 @@ FUNCTION ctprrp004()
OPEN FORM ctfmrp004 FROM "ctfmrp004" OPEN FORM ctfmrp004 FROM "ctfmrp004"
DISPLAY FORM ctfmrp004 DISPLAY FORM ctfmrp004
CALL ui.Window.getCurrent().setText("Reporte Produccion Diaria")
CONSTRUCT criterio ON c.departamento, c.cod_prod FROM departamento, cod_prod CONSTRUCT criterio ON c.departamento, c.cod_prod FROM departamento, cod_prod
@@ -166,25 +168,28 @@ FUNCTION ctprrp004()
LET r_filename = 'ctprrp004.4rp' LET r_filename = 'ctprrp004.4rp'
IF fgl_report_loadCurrentSettings(r_filename) THEN
LET preview=1
CALL selectoutput() RETURNING r_output
CALL fgl_report_selectDevice(r_output) -- changing default
CALL fgl_report_selectPreview(preview) -- changing default
LET handler = fgl_report_commitCurrentSettings() -- commit changes
END IF
START REPORT reporte_detallado TO XML HANDLER HANDLER
LET fecha_actual = CURRENT YEAR TO FRACTION LET fecha_actual = CURRENT YEAR TO FRACTION
DISPLAY selec5 DISPLAY selec5
PREPARE comando4 FROM selec5 PREPARE comando4 FROM selec5
DECLARE busca4 CURSOR FOR comando4 DECLARE busca4 CURSOR FOR comando4
LET hay_filas = FALSE
FOREACH busca4 INTO prod_dia.* FOREACH busca4 INTO prod_dia.*
IF NOT hay_filas THEN
IF fgl_report_loadCurrentSettings(r_filename) THEN
LET preview=1
CALL selectoutput() RETURNING r_output
CALL fgl_report_selectDevice(r_output)
CALL fgl_report_selectPreview(preview)
LET handler = fgl_report_commitCurrentSettings()
END IF
START REPORT reporte_detallado TO XML HANDLER HANDLER
LET hay_filas = TRUE
END IF
IF reporte_tipo <> 1 THEN IF reporte_tipo <> 1 THEN
LET prod_dia.num_doc = 0 LET prod_dia.num_doc = 0
LET prod_dia.fecha = CURRENT LET prod_dia.fecha = CURRENT
@@ -194,7 +199,11 @@ FUNCTION ctprrp004()
prod_dia.*, fecha_inicio, fecha_corte, fecha_actual) prod_dia.*, fecha_inicio, fecha_corte, fecha_actual)
END FOREACH END FOREACH
FINISH REPORT reporte_detallado IF hay_filas THEN
FINISH REPORT reporte_detallado
ELSE
CALL fgl_winmessage("INFO", "NO EXISTEN REGISTROS PARA ESTOS PARAMETROS", "INFO")
END IF
IF abortar_reporte THEN IF abortar_reporte THEN
RETURN RETURN