{ "header": { "version": 1, "type": "record" }, "body": { "record1": { "<1>": "declare function msg, send_event, admin_user, center_window, post_event\r\ndeclare function rowexists, fieldcount\r\ndeclare subroutine end_dialog\r\n$insert msg_equates\r\n$insert rpt_cfg_equ\r\n$insert rlist_equates\r\n$insert logical\r\n$insert exports_equ\r\n\r\nReportID = .report_id->Text\r\n\r\nif ReportID = '' then\r\n Void = post_event( @window:'.REPORT_ID', 'GOTFOCUS' )\r\n Return 0\r\nend\r\n\r\n*Get the last report ID so can restore if new selection fails.\r\nReportIDLast = .report_id_last->text\r\n\r\nLockSwt = 1\r\n*If this one has already been loaded then do not try to lock it again!\r\nif ReportID = ReportIDLast Then LockSwt = 0\r\n\r\narrayinfo = ''\r\n\r\nif Admin_user( @user4 ) then \r\n open 'CONFIG' to ConfigTable else\r\n\t Void = msg( '', 'Unable to open CONFIG table' )\r\n\t end_dialog( @window, '' )\r\n\t return 0\r\n end\r\n LockErr = 0\r\n LockID = ReportID\r\n If LockSwt Then GoSub LockRecord\r\n If LockErr Then\r\n Ans = msg('', 'CAN NOT LOCK CONFIG RECORD ':ReportID:'... ABORTING!' )\r\n return 0\r\n end\r\n\r\n *At this point the record should be locked. \r\n *Now read it in for loading to the form.\r\n read ReportRecord from ConfigTable,ReportID Then\r\n GoSub LoadRecord\r\n *OK, Record has been loaded to screen. \r\n * Now take care to Unlock the last Report ID (if there was one).\r\n if ReportIDLast Then\r\n *Had edited a previous report ID. Must Unlock it.\r\n LockErr = 0\r\n LockId = ReportIDLast\r\n If LockSwt Then GoSub UnlockRecord\r\n If LockErr Then\r\n *Bad Bongos!\r\n Ans = msg('', 'CAN NOT UNLOCK PREVIOUS ID ':ReportIDLast:'.|WILL IGNORE IT!' )\r\n return 0\r\n End\r\n End\r\n *SO, the last report ID is done so the current ReportID will also be the last reportID\r\n .report_id_last->text = ReportID\r\n *Now, send the focus to the table name field.\r\n Void = send_event( @window:'.TABLE_NAME', 'LOSTFOCUS' )\r\n end else\r\n ReportRecord = ''\r\n *Report Record for the ID could not be read or was empty. Reset...\r\n GoSub ReturnAns\r\n end\r\nend else\r\n .report_id->Text = ''\r\n Message = 'You do not have the proper security to enter...' \r\n Message = 'H'\r\n Void = msg( '', Message )\r\n Void = send_event( @window, 'CLOSE' )\r\nend\r\n\r\nRETURN 0\r\n\r\n*===========================================\r\nLockRecord:\r\n*===========================================\r\nLockErr = 1\r\nLock ConfigTable, LockID Then LockErr = 0\r\nReturn\r\n\r\n*===========================================\r\nUnlockRecord:\r\n*===========================================\r\nLockErr = 1\r\nunlock ConfigTable, LockID Then LockErr = 0\r\nReturn\r\n\r\n*===========================================\r\nLoadRecord:\r\n*===========================================\r\n*Report Record for the ID has been read and can now be loaded into the screen.\r\n.Table_Name->text = ReportRecord\r\n.Width->text = ReportRecord\r\n.Title->text = ReportRecord\r\n.Title_2->Text = ReportRecord\r\n.Title_3->Text = ReportRecord\r\n.Title_4->Text = ReportRecord\t\t \r\n.Title_Font_Type->text = ReportRecord\r\n.Title_Font_Size->text = ReportRecord\r\n.Title_Font_Bold->check = ReportRecord\r\n.Title_Font_Italic->check = ReportRecord\r\n.Title_Font_Underline->check = ReportRecord\r\n.Col_Hed_Font_Type->text = ReportRecord\r\n.Col_Hed_Font_Size->text = ReportRecord\r\n.Col_Hed_Font_Bold->check = ReportRecord\r\n.Col_Hed_Font_Italic->check = ReportRecord\r\n.Col_Hed_Font_Underline->check = ReportRecord\r\n.Def_Col_Font_Type->text = ReportRecord\r\n.Def_Col_Font_Size->text = ReportRecord\r\n.Def_Col_Font_Bold->check = ReportRecord\r\n.Def_Col_Font_Italic->check = ReportRecord\r\n.Def_Col_Font_Underline->check = ReportRecord\r\n\r\n.Def_Font_Type->Text = ReportRecord\r\n.Def_Font_Size->text = ReportRecord\r\n.Def_Font_Bold->check = ReportRecord\r\n.Def_Font_Italic->check = ReportRecord\r\n.Def_Font_Underline->check = ReportRecord\r\n\r\n\r\n.OrderBy->text = ReportRecord\r\n.Landscape_Chk->Check = ReportRecord\r\n.Grid_Chk->Check = ReportRecord\r\n.No_Page_Chk->Check = ReportRecord\r\n.Dbl_Spc_Chk->Check = ReportRecord\r\n.Id_Supp_Chk->Check = ReportRecord\r\n.Det_Supp_Chk->Check = ReportRecord\r\n.Col_Hdr_Supp->Check = ReportRecord\r\n.Hdr_Supp->Check = ReportRecord\r\n.Slist_Script->text = ReportRecord\r\n.With_Statement->text = ReportRecord\r\n.Footer->text = ReportRecord\r\n.PageNumber->Check = ReportRecord\r\n.Report_Procedure->text = ReportRecord\r\n\r\narrayinfo< 1> = ReportRecord\r\narrayinfo< 2> = ReportRecord\r\narrayinfo< 3> = ReportRecord\r\narrayinfo< 4> = ReportRecord\r\narrayinfo< 5> = ReportRecord\r\narrayinfo< 6> = ReportRecord\r\narrayinfo< 7> = ReportRecord\r\narrayinfo< 8> = ReportRecord\r\narrayinfo< 9> = ReportRecord\r\narrayinfo<10> = ReportRecord\r\narrayinfo<11> = ReportRecord\r\narrayinfo<12> = ReportRecord\r\n.COLUMN_INFO->array = arrayinfo\r\n\r\nReturn\r\n\r\n*===========================================\r\nReturnAns:\r\n*===========================================\r\nTmpStructure = ''\r\nMsg001 = 'REPORT ID ':ReportID:' IS NOT FOUND IN TABLE CONFIG!|'\r\nMsg001 = 'DO YOU WANT TO CREATE IT?'\r\nTmpStructure = Msg001\r\nTmpStructure = 'BNYC'\r\nTmpStructure = 'A'\r\nTmpStructure = '!'\r\nTmpStructure = ReportID:' NOT FOUND IN CONFIG'\r\nAns = msg('', TmpStructure )\r\nIf Ans = 0 Or Ans = Char(27) Then\r\n Ans = msg('', \"RECORD EDIT CANCELED!\" )\r\n LockErr = 0\r\n LockID = ReportID\r\n GoSub UnlockRecord\r\n If LockErr Then\r\n Ans = msg('', 'CAN NOT UNLOCK NEW ':ReportID:'!|WILL IGNORE.' )\r\n End \r\n .report_id->text = ReportIDLast\r\n Void = post_event( @window:'.REPORT_ID', 'GOTFOCUS' )\r\n \r\nEnd Else\r\n *OK, want to create new one. If got last ID, Unlock it.\r\n If ReportIDLast Then\r\n LockId = ReportIDLast\r\n GoSub UnlockRecord\r\n If LockErr Then\r\n *OK, got error when trying to unlocked the last one. \r\n Ans = msg('', 'CAN NOT UNLOCK LAST REPORT ID: ':ReportIDLast:'!' )\r\n End\r\n Msg001 = 'DO YOU WANT TO START WITH AN EMPTY FORM?'\r\n TmpStructure = Msg001\r\n TmpStructure = 'BNYC'\r\n TmpStructure = 'A'\r\n TmpStructure = '!'\r\n TmpStructure = ReportID:'NEW CONFIG RECORD'\r\n Ans = msg('', TmpStructure )\r\n If Ans = 1 Then\r\n GoSub ClearRecord \r\n End\r\n End\r\nEnd\r\nReturn\r\n\r\n*=======================================\r\nClearRecord: \r\n*=======================================\r\n.Table_Name->text = ''\r\n.Width->text = ''\r\n.Title->text = ''\r\n.Title_2->Text = ''\r\n.Title_3->Text = ''\r\n.Title_4->Text = ''\t \r\n.Title_Font_Type->text = '' \r\n.Title_Font_Size->text = ''\r\n.Title_Font_Bold->check = ''\r\n.Title_Font_Italic->check = ''\r\n.Title_Font_Underline->check = ''\r\n.Col_Hed_Font_Type->text = ''\r\n.Col_Hed_Font_Size->text = ''\r\n.Col_Hed_Font_Bold->check = ''\r\n.Col_Hed_Font_Italic->check = ''\r\n.Col_Hed_Font_Underline->check = ''\r\n.Def_Col_Font_Type->text = ''\r\n.Def_Col_Font_Size->text = ''\r\n.Def_Col_Font_Bold->check = ''\r\n.Def_Col_Font_Italic->check = ''\r\n.Def_Col_Font_Underline->check = ''\r\n.OrderBy->text = ''\r\n.Landscape_Chk->Check = ''\r\n.Grid_Chk->Check = ''\r\n.No_Page_Chk->Check = ''\r\n.Dbl_Spc_Chk->Check = ''\r\n.Id_Supp_Chk->Check = ''\r\n.Det_Supp_Chk->Check = ''\r\n.Col_Hdr_Supp->Check = ''\r\n.Hdr_Supp->Check = ''\r\n.Slist_Script->text = ''\r\n.With_Statement->text = ''\r\n.Footer->text = ''\r\n.PageNumber->Check = ''\r\n.Report_Procedure->text = ''\r\n\r\narrayinfo< 1> = ''\r\narrayinfo< 2> = ''\r\narrayinfo< 3> = ''\r\narrayinfo< 4> = ''\r\narrayinfo< 5> = ''\r\narrayinfo< 6> = ''\r\narrayinfo< 7> = ''\r\narrayinfo< 8> = ''\r\narrayinfo< 9> = ''\r\narrayinfo<10> = ''\r\narrayinfo<11> = ''\r\narrayinfo<12> = ''\r\n.COLUMN_INFO->array = arrayinfo\r\n\r\nReturn\r\n" } } }