Files
MBS/PROYECTO/otrodir/dbadministrator/fglreport.4gl
T

121 lines
3.3 KiB
Plaintext

CONSTANT buff_size = 20
DEFINE buff ARRAY[buff_size] OF STRING
DEFINE
interrupted SMALLINT,
finished SMALLINT,
curr_page INTEGER,
page_count INTEGER,
offset INTEGER
FUNCTION fgl_report_start()
OPEN WINDOW fglreport WITH FORM "fglreport"
LET curr_page = 0
LET page_count = 0
LET offset = 0
LET interrupted = FALSE
LET finished = FALSE
END FUNCTION
FUNCTION fgl_report_show_page(thepage)
DEFINE thepage STRING
IF interrupted THEN RETURN END IF
CURRENT WINDOW IS fglreport
IF NOT finished THEN
LET page_count = page_count+1
LET buff[(page_count MOD buff_size)+1] = thepage
IF page_count>buff_size THEN
LET offset=offset+1
END IF
END IF
LET curr_page=page_count
IF curr_page<=0 THEN
RETURN -- can't happen
END IF
DISPLAY curr_page TO pgnum
LET thepage=buff[(curr_page MOD buff_size)+1]
DISPLAY BY NAME thepage
MENU
BEFORE MENU
CALL DIALOG.setActionActive("reportprevpage",(page_count>1))
CALL DIALOG.setActionActive("reportnextpage",(not finished))
ON ACTION reportnextpage
IF curr_page==page_count THEN
EXIT MENU
END IF
LET curr_page=curr_page+1
LET thepage=buff[(curr_page MOD buff_size)+1]
DISPLAY BY NAME thepage
DISPLAY curr_page TO pgnum
IF curr_page==page_count AND finished THEN
CALL DIALOG.setActionActive("reportnextpage",FALSE)
END IF
CALL DIALOG.setActionActive("reportprevpage",(page_count>1))
ON ACTION reportprevpage
IF curr_page>1 THEN
LET curr_page=curr_page-1
let thepage=buff[(curr_page MOD buff_size)+1]
DISPLAY curr_page TO pgnum
DISPLAY BY NAME thepage
IF curr_page=offset+1 THEN
CALL DIALOG.setActionActive("reportprevpage",FALSE)
END IF
CALL DIALOG.setActionActive("reportnextpage",(curr_page<page_count))
END IF
COMMAND KEY(INTERRUPT) "cancel"
LET int_flag = TRUE
LET interrupted = TRUE
EXIT MENU
ON ACTION CLOSE
LET int_flag = TRUE
LET interrupted = TRUE
EXIT MENU
END MENU
END FUNCTION
FUNCTION fgl_report_finish()
DEFINE strbuf STRING
LET finished = TRUE
IF NOT interrupted AND page_count > 0 THEN
-- CALL fgl_winmessage("Report Viewer", "End of report", "information")
CALL fgl_report_show_page(NULL)
END IF
CLOSE WINDOW fglreport
INITIALIZE buff to NULL
LET page_count=0
LET curr_page=0
LET offset=0
END FUNCTION
FUNCTION fgl_reportToClient_start()
DEFINE started INTEGER
LET interrupted=FALSE
CALL ui.Interface.frontCall("standard","fgl_report_start",[],[started])
IF NOT started THEN
LET interrupted=TRUE
LET int_flag=TRUE
END IF
END FUNCTION
FUNCTION fgl_reportToClient_show_page(thepage)
DEFINE thepage STRING
DEFINE rv INTEGER
IF interrupted THEN RETURN END IF
CALL ui.Interface.frontCall("standard","fgl_report_printpage",[thepage],[rv])
IF NOT rv THEN
LET interrupted=TRUE
LET int_flag=TRUE
END IF
END FUNCTION
FUNCTION fgl_reportToClient_finish()
DEFINE rv INTEGER
IF interrupted THEN RETURN END IF
CALL ui.Interface.frontCall("standard","fgl_report_finish",[],[rv])
IF NOT rv THEN
LET interrupted=TRUE
LET int_flag=TRUE
END IF
END FUNCTION