MESSAGE "Writing deposit procedures to library..." PROC CLOSED Deposit_Table_Wait(M_Tbl, R, C, F_Num) USEVARS Autolib, Rpt_St PRIVATE Answer_Menu, Fld_Prompt, Old_Amt, New_Amt DYNARRAY Fld_Prompt[] PROC Ask_Deposit_Book() PRIVATE File_No, Id, Re, From_Date, To_Date, Button File_No = "" Id = "" Re = "" From_Date = "" To_Date = "" FORMKEY SHOWPULLDOWN ENDMENU CLEARSPEEDBAR PROMPT "Enter selection criteria. Press Search to find matches, Cancel to quit." MOUSE SHOW SHOWDIALOG "Deposit Book Selection Criteria" @4, 15 HEIGHT 15 WIDTH 50 @1, 6 ?? "File No(s)." ACCEPT @1,20 WIDTH 18 "A60" PICTURE "*!" TAG "" TO File_No @3, 6 ?? "Id(s)" ACCEPT @3,20 WIDTH 18 "A60" PICTURE "*!" TAG "" TO Id @5, 6 ?? "Regarding" ACCEPT @5,20 WIDTH 18 "A60" PICTURE "*!" TAG "" TO Re @7, 6 ?? "From Date" ACCEPT @7,20 WIDTH 11 "D" PICTURE "#[#]/##/##" TAG "" TO From_Date @9, 6 ?? "To Date" ACCEPT @9,20 WIDTH 11 "D" PICTURE "#[#]/##/##" TAG "" TO To_Date PUSHBUTTON @11,12 WIDTH 10 "~S~earch" OK DEFAULT VALUE "" TAG "OK" TO Button PUSHBUTTON @11,25 WIDTH 10 "~C~ancel" CANCEL VALUE "" TAG "Cancel" TO Button ENDDIALOG PROMPT "" RETURN if (RetVal = True) then MESSAGE "Searching..." ECHO SLOW {Ask} TYPEIN "PAYMENTS" ENTER CHECK if NOT ISBLANK(From_Date) then TYPEIN (">= " + STRVAL(From_Date)) endif if NOT ISBLANK(From_Date) And NOT ISBLANK(To_Date) then TYPEIN (", ") endif if NOT ISBLANK(To_Date) then TYPEIN ("<= " + STRVAL(To_Date)) endif [File_No] = File_No [Id] = Id [Regarding] = Regarding DO_IT! Subset_Table = PRIVDIR() + "SUBSET" RENAME TABLE() Subset_Table MOVETO ("Payments(Q)") CLEARIMAGE ; erase query image MOVETO Subset_Table if ISEMPTY(Subset_Table) then CLEARIMAGE No_Matches_Found() else ; copy form and display on screen COPYFORM "Payments" "2" Subset_Table "1" View_Answer_Table(Subset_Table, 4, 0) SLEEP 10000 ; Payments_Answer_Wait() endif endif FORMKEY MOUSE HIDE ENDPROC; Ask_Deposit_Book PROC Edit_Mode_Menu() MENUENABLE "Main\Mode" MENUDISABLE "Edit\Mode" MENUDISABLE "Reports" ENDPROC; Edit_Mode_Menu PROC Main_Mode_Menu() MENUENABLE "Edit\Mode" MENUENABLE "Reports" MENUDISABLE "Main\Mode" ENDPROC; Main_Mode_Menu PROC Edit_Mode() if (SYSMODE() = "Main") then COEDITKEY Edit_Mode_Menu() Arrive_Row() Arrive_Field() NEWWAITSPEC MESSAGE "MENUSELECT" TRIGGER "ARRIVEFIELD", "ARRIVEROW", "DEPARTROW" KEY -60, -66, -83, 43, 45 ; DO_IT Clear Delete + - ; F2 F8 DEL endif RETURN 1 ENDPROC; Edit_Mode PROC Main_Mode() if (HELPMODE() = "LookupHelp") then ; if in lookup help and pressed RETURN 0 ; F2 to select, do not exit wait loop endif if NOT ISVALID() then ; if 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, exit field view DO_IT! RETURN 1 endif DO_IT! ; return to main mode if (SYSMODE() = "Main") then ; record posted successfully Main_Mode_Menu() Arrive_Field() NEWWAITSPEC MESSAGE "MENUSELECT" TRIGGER "ARRIVEFIELD" KEY -66, -67 ; Clear Edit ; F8 F9 else ECHO NORMAL ; key violation exists DO_IT! endif RETURN 1 ENDPROC; Main_Mode PROC Arrive_Field() SPEEDBAR "~F10~ Menu":-68 PROMPT Fld_Prompt[FIELD()] RETURN 0 ENDPROC; Arrive_Field PROC Arrive_Row() RETURN 0 ENDPROC; Arrive_Row PROC Update_Balances() PRIVATE Prev_Bal, Rec_No, Row_No RETURN ECHO OFF Rec_No = RECNO() Row_No = ROWNO() if ATFIRST() then [Balance] = [Amount] else UP Prev_Bal = [Balance] DOWN [Balance] = Prev_Bal + [Amount] endif Prev_Bal = [Balance] WHILE NOT ATLAST() DOWN [Balance] = Prev_Bal + [Amount] Prev_Bal = [Balance] ENDWHILE MOVETO RECORD Rec_No FOR I FROM 1 TO Row_No - 1 UP ENDFOR MOVETO RECORD Rec_No ECHO NORMAL ENDPROC; Update_Balances PROC Post_It() RETURN if ISBLANK([Item_No]) then [Item_No] = 1 endif WHILE TRUE POSTRECORD NOPOST LEAVELOCKED if RetVal then QUITLOOP else [Item_No] = [Item_No] + 1 endif ENDWHILE if (Old_Amt <> [Amount]) then Update_Balances() endif ENDPROC; Post_It PROC Depart_Row() ; do not leave row if essential information is lacking RETURN 0 ; test for valid field data if NOT ISVALID() then Message_Box("Invalid Field Entry", "The data for this field is invalid.") RETURN 1 endif ; depart row if record is new & blank if RECORDSTATUS("New") AND NOT RECORDSTATUS("Modified") then RETURN 0 endif ; delete row if all fields are blank if ISBLANK([File_No]) AND ISBLANK([Date]) AND ISBLANK([Acnt_No]) AND ISBLANK([Amount]) AND ISBLANK([Billed]) then DEL RETURN 0 endif ; test for missing field entries if ISBLANK([Date]) then Message_Box("Incomplete Entry", "This record requires a date for the transaction.") MOVETO [Date] PROMPT Fld_Prompt[FIELD()] RETURN 1 endif if ISBLANK([File_No]) then Message_Box("Incomplete Entry", "This record requires a file number for the transaction.") MOVETO [File_No] PROMPT Fld_Prompt[FIELD()] RETURN 1 endif if ISBLANK([Acnt_No]) then Message_Box("Incomplete Entry", "This record requires an account number.") MOVETO [Acnt_No] PROMPT Fld_Prompt[FIELD()] RETURN 1 endif if ISBLANK([Amount]) then Message_Box("Incomplete Entry", "This record requires an amount.") MOVETO [Amount] PROMPT Fld_Prompt[FIELD()] RETURN 1 endif if ISBLANK([Billed]) then Message_Box("Incomplete Entry", "Please enter (Y/N) for billed.") MOVETO [Billed] PROMPT Fld_Prompt[FIELD()] RETURN 1 endif Post_It() ; post record & update balances if needed RETURN 0 ENDPROC; Depart_Row PROC Deposit_Table_Wait_Proc(TriggerType, EventInfo, CycleNumber) PRIVATE Key_Code, Menu_Pick, Temp_File_No, Temp_Date, Temp_Empl_Num if (TriggerType = "ARRIVEFIELD") then RETURN Arrive_Field() endif if (TriggerType = "DEPARTFIELD") then RETURN Depart_Field() endif if (TriggerType = "ARRIVEROW") then RETURN Arrive_Row() endif if (TriggerType = "DEPARTROW") then RETURN Depart_Row() endif if (EventInfo["TYPE"] = "MESSAGE") then Menu_Pick = EventInfo["MENUTAG"] SWITCH CASE (Menu_Pick = "Edit\Mode") : RETURN Edit_Mode() CASE (Menu_Pick = "Main\Mode") : if (Depart_Row() = 0) then if ISEMPTY(M_Tbl) then RETURN Clear_Table() else RETURN Main_Mode() endif else RETURN 1 endif CASE (Menu_Pick = "R_Summary") : ECHO OFF Print_Report("Payments", "1", "") Trust_Table_Menu() Arrive_Field() RETURN 1 CASE (Menu_Pick = "R_Detailed"): ECHO OFF Print_Report("Payments", "2", "") Trust_Table_Menu() Arrive_Field() RETURN 1 CASE (Menu_Pick = "R_Cancel") : RETURN 1 CASE (Menu_Pick = "Return\Yes") : if (SYSMODE() = "Main") then RETURN Clear_Table() else if (Depart_Row() = 0) then RETURN Clear_Table() else RETURN 1 endif endif CASE (Menu_Pick = "Return\No") : RETURN 1 OTHERWISE : SOUND 400 100 RETURN 1 ENDSWITCH endif if (EventInfo["TYPE"] = "KEY") then Key_Code = EventInfo["KEYCODE"] SWITCH ; F9 - COEDIT CASE (Key_Code = -67) : RETURN Edit_Mode() ; F2 - DO_IT! CASE (Key_Code = -60) : if (Depart_Row() = 0) then if ISEMPTY(M_Tbl) then RETURN Clear_Table() else RETURN Main_Mode() endif else RETURN 1 endif ; F8 - CLEAR CASE (Key_Code = -66) : if (SYSMODE() = "Main") then RETURN Clear_Table() else if (Depart_Row() = 0) then RETURN Clear_Table() else RETURN 1 endif endif ; DELETE CASE (Key_Code = -83) : if (Display_Delete_Box() = 1) then Update_Balances() endif RETURN 1 ; + to add one day to current date CASE (Key_Code = 43) : RETURN Change_Date(43) ; - to subtract one day from current date CASE (Key_Code = 45) : RETURN Change_Date(45) OTHERWISE : SOUND 400 100 RETURN 1 ENDSWITCH endif SOUND 400 100 RETURN 1 ENDPROC; Deposit_Table_Wait_Proc PROC Main_Mode_Wait() Arrive_Field() WAIT TABLE PROC "Deposit_Table_Wait_Proc" MESSAGE "MENUSELECT" TRIGGER "ARRIVEFIELD" KEY -66, -67 ; Clear Edit ; F8 F9 ENDWAIT ENDPROC; Main_Mode_Wait PROC Edit_Mode_Wait() Arrive_Row() Arrive_Field() WAIT TABLE PROC "Deposit_Table_Wait_Proc" MESSAGE "MENUSELECT" TRIGGER "ARRIVEFIELD", "ARRIVEROW", "DEPARTROW" KEY -60, -66, -83, 43, 45 ; DO_IT Clear Delete + - ; F2 F8 DEL ENDWAIT ENDPROC; Edit_Mode_Wait ; main body of procedure follows Fld_Prompt["Date"] = " Date of transaction" Fld_Prompt["File_No"] = " F1 to select file no. from file cabinet" Fld_Prompt["Empl_Num"] = " F1 to select employee for this transaction" Fld_Prompt["T_Code"] = " F1 to select code describing transaction" Fld_Prompt["Acnt_No"] = " Account number for this entry" Fld_Prompt["Amount"] = " Dollar amount of this transaction" Fld_Prompt["Billed"] = " Y if transaction has been billed, N if not" Fld_Prompt["Note"] = " Notation to help describe this entry" Answer_Menu = "Deposit_Answer_Menu" ECHO OFF VIEW M_Tbl Deposit_Table_Menu() WINDOW MOVE GETWINDOW() TO -100, -100 PICKFORM F_Num 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 ECHO NORMAL KEYENABLE -31 if (SYSMODE() = "Main") then Main_Mode_Wait() else Edit_Mode_Wait() endif KEYDISABLE -31 CLEARSPEEDBAR MESSAGE "" PROMPT "" ENDPROC WRITELIB Off_Lib Deposit_Table_Wait RELEASE PROCS ALL