Files
delphi-database-v2/old-database/GENERATE.SC

262 lines
7.9 KiB
Scala
Executable File

MESSAGE "Generating Office Library..."
Off_Lib = "OFFICE"
CREATELIB Off_Lib SIZE 128
PROC Change_Date(Sign)
if (SYSMODE() = "CoEdit") AND (FIELDTYPE() = "D") then
if ISBLANK([]) then
[] = TODAY()
else if (Sign = 43) then
[] = [] + 1
else [] = [] - 1
endif
endif
else RETURN 0
endif
RETURN 1
ENDPROC
WRITELIB Off_Lib Change_Date
PROC Main_Table_Edit()
; allowing editing of current table image, do not break wait
if (SYSMODE() = "Main") then
COEDITKEY
MENUDISABLE "Edit\Mode"
MENUDISABLE "Ask"
MENUENABLE "Main\Mode"
endif
RETURN 1
ENDPROC
WRITELIB Off_Lib Main_Table_Edit
PROC Main_Table_End_Edit()
; exit edit mode, if possible, do not break out of wait cycle
if (HELPMODE() = "LookupHelp") then ; if user was in lookup help and pressed
RETURN 0 ; F2 to select, do not exit wait loop
endif
if NOT ISVALID() then ; if in coedit and field data is not valid,
MESSAGE "Error: The data for this field is not valid."
RETURN 1 ; do not exit wait
endif
if ISFIELDVIEW() then ; if in field view, do not exit wait loop
DO_IT!
RETURN 1
endif
DO_IT!
if (SYSMODE() = "Main") then ; record posted successfully
MENUDISABLE "Main\Mode"
MENUENABLE "Edit\Mode"
MENUENABLE "Ask"
else ECHO NORMAL ; key violation exists
DO_IT!
endif
RETURN 1
ENDPROC
WRITELIB Off_Lib Main_Table_End_Edit
PROC Main_Table_Clear()
; exit edit mode by calling main mode, clear workspace and exit wait
if (SYSMODE() = "CoEdit") then
Main_Table_End_Edit()
endif
if (SYSMODE() = "Main") then
ECHO OFF
CLEARALL
ECHO NORMAL
RETURN 2 ; back in main mode so exit wait
else RETURN 1 ; cannot get to main mode - wait continues
endif
ENDPROC
WRITELIB Off_Lib Main_Table_Clear
PROC Display_Memo(Tbl)
; move to proper table image, then memo field, enter field view and pop up
; memo window - if available, wait until F2 is pressed
if ISFIELDVIEW() then ; if in field view, do not exit wait loop
DO_IT!
endif
if NOT ISVALID() then ; if in coedit and field data is not valid,
RETURN 0 ; do not exit wait
endif
MOVETO Tbl
MOVETO FIELD "Memo"
SHOWPULLDOWN
ENDMENU
CLEARSPEEDBAR
if (Field() = "Memo") then
ECHO OFF
FIELDVIEW
WINDOW HANDLE CURRENT TO Memo_Win
DYNARRAY Atts[]
DYNARRAY Colors[]
Colors["1"] = 31
Atts["ORIGINROW"] = 13
Atts["ORIGINCOL"] = 0
Atts["CANMOVE"] = False
Atts["CANRESIZE"] = False
Atts["CANCLOSE"] = False
Atts["HEIGHT"] = 11
Atts["WIDTH"] = 80
Atts["HASSHADOW"] = FALSE
Atts["TITLE"] = " Memo "
WINDOW SETATTRIBUTES Memo_Win FROM Atts
WINDOW SETCOLORS Memo_Win FROM Colors
PROMPT " Press F2 when finished."
ECHO NORMAL
WAIT FIELD
UNTIL "F2"
DO_IT!
else MESSAGE "No memo field is available in this context."
endif
ENDPROC
WRITELIB Off_Lib Display_Memo
PROC Main_Table_Menu()
SHOWPULLDOWN
"Modify" : "Toggle between edit and main mode" : "Modify"
SUBMENU
"Edit Mode - F9" : "Allow data to be edited, deleted, etc." : "Edit\Mode",
"Main Mode - F2" : "Discontinue editing" : "Main\Mode"
ENDSUBMENU,
"Ask" : "Select data to report on" : "Ask",
"Close" : "Return to main menu when finished" : ""
SUBMENU
"No " : "Continue working with this table" : "Close\No",
"Yes - F8" : "Return to main menu" : "Close\Yes"
ENDSUBMENU
ENDMENU
if ISEMPTY(TABLE()) then
Main_Table_Edit()
else if (SYSMODE() = "Main") then
MENUDISABLE "Main\Mode"
else MENUDISABLE "Edit\Mode"
MENUDISABLE "Ask"
endif
endif
ENDPROC
WRITELIB Off_Lib Main_Table_Menu
PROC Main_Table_View(Tbl, R, C)
; place table on workspace in form view
ECHO OFF
VIEW Tbl
WINDOW MOVE GETWINDOW() TO -100, -100
Main_Table_Menu()
PICKFORM "1"
WINDOW HANDLE CURRENT TO Form_Win
DYNARRAY Win_Atts[]
Win_Atts["ORIGINROW"] = R
Win_Atts["ORIGINCOL"] = C
Win_Atts["CANMOVE"] = False
Win_Atts["CANRESIZE"] = False
Win_Atts["CANCLOSE"] = False
WINDOW SETATTRIBUTES Form_Win FROM Win_Atts
ENDPROC
WRITELIB Off_lib Main_Table_View
PROC View_Answer_Table(Tbl, R, C)
WINDOW MOVE GETWINDOW() TO -100, -100
PICKFORM "1"
WINDOW HANDLE CURRENT TO Form_Win
DYNARRAY Win_Atts[]
Win_Atts["TITLE"] = "RECORDS MATCHING SELECTION CRITERIA"
Win_Atts["ORIGINROW"] = R
Win_Atts["ORIGINCOL"] = C
Win_Atts["CANMOVE"] = False
Win_Atts["CANRESIZE"] = False
Win_Atts["CANCLOSE"] = False
WINDOW SETATTRIBUTES Form_Win FROM Win_Atts
ENDPROC
WRITELIB Off_Lib View_Answer_Table
PROC Answer_Table_Wait_Proc(TriggerType, EventInfo, CycleNumber)
PRIVATE Key_Code, Menu_Pick
if (TriggerType = "ARRIVEFIELD") then
PROMPT Fld_Prompt[FIELD()]
RETURN 1
endif
if (EventInfo["TYPE"] = "KEY") then ; check for hot keys
Key_Code = EventInfo["KEYCODE"]
SWITCH
; F9 - COEDIT
CASE (Key_Code = -67) : RETURN Edit_Mode()
; F2 - DO_IT!
CASE (Key_Code = -60) : if ISEMPTY(Subset_Table) then
RETURN Clear_Table()
else RETURN Main_Mode()
endif
; F8 - CLEAR
CASE (Key_Code = -66) : RETURN Clear_Table()
; DELETE
CASE (Key_Code = -83) : if (SYSMODE() = "CoEdit") then
RETURN Display_Delete_Box()
else RETURN 1
endif
; Alt-M - Memo
CASE (Key_Code = -50) : Display_Memo(Subset_Table)
EXECPROC Answer_Menu
RETURN 1
; Alt-B - Summarize Account Balances
CASE (Key_Code = -48) : Summarize_Accounts(Subset_Table, IMAGENO())
EXECPROC Answer_Menu
RETURN 1
CASE (Key_Code = 43) : RETURN Change_Date(43)
CASE (Key_Code = 45) : RETURN Change_Date(45)
OTHERWISE : SOUND 400 100 RETURN 1
ENDSWITCH
endif; if key was pressed
if (EventInfo["MESSAGE"] = "MENUSELECT") then ; now menu selections
Menu_Pick = EventInfo["MENUTAG"]
SWITCH
CASE (Menu_Pick = "Edit\Mode") : RETURN Edit_Mode()
CASE (Menu_Pick = "Main\Mode") : if ISEMPTY(Subset_Table) then
RETURN Clear_Table()
else RETURN Main_Mode()
endif
CASE (Menu_Pick = "Assemble") : if (SYSMODE() = "CoEdit") then
MESSAGE("You must exit edit mode.")
else Select_Forms()
endif
RETURN 1
CASE (Menu_Pick = "Return\Yes") : RETURN Clear_Table()
CASE (Menu_Pick = "Return\No") : RETURN 1
OTHERWISE : SOUND 400 100 RETURN 1
ENDSWITCH
endif
SOUND 400 100 RETURN 1
ENDPROC
WRITELIB Off_Lib Answer_Table_Wait_Proc
RELEASE PROCS ALL
PLAY "Setup"
PLAY "Rolodex"
PLAY "Filcabnt"
PLAY "Ledger"
PLAY "Utility"
PLAY "Pension"
PLAY "Qdro"
PLAY "Form_Mgr"
; do not PLAY procedures that are no longer used
;PLAY "Calendar"
;PLAY "Timecard"
;PLAY "Trust"
MESSAGE "All procedures successfully written to office library."
SLEEP 2000
MESSAGE ""