Listing: 1 MODULE Club; 2 (* 3 Copyright (C) 1988,1989 Jensen & Partners International 4 *) 5 6 IMPORT Globals, Btree, Window, Client, Items, IO, FIO, Sales; 7 FROM Globals IMPORT ClientFile, ItemFile, ClientData, ItemData, ***** ^ duplicate identifier 8 ClientIndex, ItemIndex, 9 oldWin, TitleWin, DisplayWin, UpdateTitle, 10 StoreName; 11 12 VAR 13 aClient : Client.ClientRec; ***** ^ not supported yet 14 anItem : Items.ItemRec; ***** ^ not supported yet 15 ch, ch2, ch3 : CHAR; 16 GO, Found : BOOLEAN; 17 lines : CARDINAL; 18 19 PROCEDURE OpenClientFiles(); 20 BEGIN 21 IF NOT FIO.Exists("CLIENT.DAT") THEN (* create a new one *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 22 ClientFile := Btree.Open("CLIENT.DAT",2,Btree.FixSize,FALSE,FALSE,TRUE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 23 ClientData := Btree.OpenData(ClientFile,1,SIZE(Client.ClientRec),TRUE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 24 ClientIndex := Btree.OpenIndex(ClientFile,ClientData,2,Globals.Compare, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 25 Client.MakeKey,SIZE(Globals.FileKey), ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 26 TRUE,TRUE); ***** ^ not supported yet 27 Btree.Close(ClientFile); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 28 END; (* if *) 29 30 ClientFile := Btree.Open("CLIENT.DAT",2,Btree.FixSize,FALSE,FALSE,FALSE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 31 ClientData := Btree.OpenData(ClientFile,1,SIZE(Client.ClientRec),FALSE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 32 ClientIndex := Btree.OpenIndex(ClientFile,ClientData,2,Globals.Compare, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 33 Client.MakeKey,SIZE(Globals.FileKey),TRUE, ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 34 FALSE); ***** ^ not supported yet 35 END OpenClientFiles; ***** ^ not supported yet 36 37 38 PROCEDURE OpenItemFiles(); 39 BEGIN 40 IF NOT FIO.Exists("ITEMS.DAT") THEN (* create a new one *) ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 41 ItemFile := Btree.Open("ITEMS.DAT",2,Btree.FixSize,FALSE,FALSE,TRUE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 42 ItemData := Btree.OpenData(ItemFile,1,SIZE(Items.ItemRec),TRUE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 43 ItemIndex := Btree.OpenIndex(ItemFile,ItemData,2,Globals.Compare, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 44 Items.MakeKey,SIZE(Globals.FileKey),TRUE, ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 45 TRUE); ***** ^ not supported yet 46 Btree.Close(ItemFile); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 47 END; (* if *) 48 49 ItemFile := Btree.Open("ITEMS.DAT",2,Btree.FixSize,FALSE,FALSE,FALSE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 50 ItemData := Btree.OpenData(ItemFile,1,SIZE(Items.ItemRec),FALSE); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 51 ItemIndex := Btree.OpenIndex(ItemFile,ItemData,2,Globals.Compare, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 52 Items.MakeKey,SIZE(Globals.FileKey),TRUE, ***** ^ not supported yet ***** ^ not supported yet ***** ^ undeclared identifier ***** ^ not supported yet ***** ^ not supported yet 53 FALSE); ***** ^ not supported yet 54 END OpenItemFiles; ***** ^ not supported yet 55 56 57 PROCEDURE Help(); 58 CONST 59 HelpWinDef = Window.WinDef(10,7,70,17,Window.Blue,Window.LightGray, ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 60 FALSE, TRUE, TRUE, TRUE, Window.DoubleFrame, ***** ^ not supported yet ***** ^ not supported yet 61 Window.Black, Window.LightGray); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 62 VAR 63 helpWin : Window.WinType; ***** ^ not supported yet 64 ch : CHAR; 65 BEGIN 66 oldWin := Window.Used(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 67 helpWin := Window.Open(HelpWinDef); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 68 Window.Use(helpWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 69 Window.Clear(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 70 Window.SetTitle(helpWin,"Help Window", Window.CenterUpperTitle); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 71 Window.PutOnTop(helpWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 72 IO.WrLn(); IO.WrLn(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 73 IO.WrStr(" This is the help window. If you would like to"); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 74 IO.WrLn(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 75 IO.WrStr(" change the help, look in the Help() routine in"); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 76 IO.WrLn(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 77 IO.WrStr(" the main CLUB.MOD file."); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 78 IO.WrLn(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 79 IO.WrLn(); IO.WrLn(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 80 IO.WrStr(" Press any key to continue... "); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 81 Window.CursorOn(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 82 ch := IO.RdKey(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 83 Window.CursorOff(); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 84 Window.Close(helpWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 85 Window.Use(oldWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 86 Window.PutOnTop(oldWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 87 END Help; ***** ^ not supported yet 88 89 BEGIN (* main program *) 90 StoreName := "Btree Demonstration Store"; ***** ^ not supported yet ***** ^ not supported yet 91 Window.PutOnTop(TitleWin); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 92 UpdateTitle(TRUE); ***** ^ not supported yet ***** ^ not supported yet 93 OpenClientFiles(); ***** ^ not supported yet ***** ^ not supported yet 94 OpenItemFiles(); ***** ^ not supported yet ***** ^ not supported yet 95 96 REPEAT 97 Globals.GetMenu("Help Clients Inventory Sales Quit >>", ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 98 Globals.CharSet{'H','C','I','S','Q'}, ch ); ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet ***** ^ not supported yet 99 CASE ch OF 100 'H' : Help(); 101 | 'C' : Client.Template(); 102 REPEAT 103 Globals.GetMenu( "Add Find/edit/delete List Quit >>", 104 Globals.CharSet{'A','F','E','D','L','Q'}, ch2); 105 CASE ch2 OF 106 'A' : Client.Input(aClient,TRUE); 107 Btree.Add(ClientData,aClient, 108 SIZE(Client.ClientRec)); 109 | 'F', 'E', 'D' : aClient.CNum := ""; 110 Found := Client.Search(aClient); 111 | 'L' : oldWin := Window.Used(); 112 Window.Use(DisplayWin); 113 Window.Clear(); 114 Window.PutOnTop(DisplayWin); 115 lines := 0; (* max 17 *) 116 Btree.Reset(ClientData); 117 GO := TRUE; 118 WHILE Btree.Next(ClientIndex,aClient) AND GO DO 119 IO.WrStrAdj(aClient.CNum,-11); 120 IO.WrStrAdj(aClient.LName,-16); 121 IO.WrStrAdj(aClient.FName,-11); 122 IO.WrStrAdj(aClient.Phone,-16); 123 IO.WrLn(); 124 INC(lines); 125 IF lines > 16 THEN 126 IO.WrStr("Press to quit, any other key to continue: "); 127 ch3 := IO.RdKey(); 128 IF ch3 = 33C THEN 129 GO := FALSE; 130 END; (* if *) 131 Window.Clear(); 132 lines := 0; 133 END; (* if *) 134 END; (* while *) 135 Globals.WriteAt(18,1,"Press a key to finish "); 136 ch3 := IO.RdKey(); 137 Window.Hide(DisplayWin); 138 Window.Use(oldWin); 139 Window.PutOnTop(oldWin); 140 | 'Q' : Client.Close(); 141 END; (* case *) 142 UNTIL ch2 = 'Q'; 143 | 'I' : Items.Template(); 144 REPEAT 145 Globals.GetMenu( 146 "Add Find/edit/delete List Quit >>", 147 Globals.CharSet{'A','F','E','D','L','Q'}, ch2); 148 CASE ch2 OF 149 'A' : Items.Input(anItem,TRUE); 150 Btree.Add(ItemData,anItem,SIZE(Items.ItemRec)); 151 | 'F','E','D' : anItem.INum := ""; 152 Found := Items.Search(anItem); 153 | 'L' : oldWin := Window.Used(); 154 Window.Use(DisplayWin); 155 Window.Clear(); 156 Window.PutOnTop(DisplayWin); 157 lines := 0; (* max 17 *) 158 Btree.Reset(ItemData); 159 GO := TRUE; 160 WHILE Btree.Next(ItemIndex,anItem) AND GO DO 161 IO.WrStrAdj(anItem.INum,-11); 162 IO.WrStrAdj(anItem.Description,-26); 163 IO.WrStrAdj(anItem.Mfgr,-21); 164 IO.WrStrAdj(anItem.PartNum,-11); 165 IO.WrLn(); 166 INC(lines); 167 IF lines > 16 THEN 168 IO.WrStr("Press to quit, any other key to continue: "); 169 ch3 := IO.RdKey(); 170 IF ch3 = 33C THEN 171 GO := FALSE; 172 END; (* if *) 173 Window.Clear(); 174 lines := 0; 175 END; (* if *) 176 END; (* while *) 177 Globals.WriteAt(18,1,"Press a key to finish "); 178 ch3 := IO.RdKey(); 179 Window.Hide(DisplayWin); 180 Window.Use(oldWin); 181 Window.PutOnTop(oldWin); 182 | 'Q' : Items.Close(); 183 END; (* case *) 184 UNTIL ch2 = 'Q'; 185 | 'S' : (* run the sales floor *) 186 Sales.Template(); 187 REPEAT 188 Sales.Clear(); (* clear old transaction *) 189 Globals.GetMenu( 190 "A)nother sale, S)how summary, or Q)uit to Menu", 191 Globals.CharSet{'A','Q','S'},ch2); 192 CASE ch2 OF 193 'A' : Sales.Work(); 194 | 'S' : Sales.Summary(); 195 ELSE 196 Globals.Beep(); 197 END; (* case *) 198 UNTIL ch2 = 'Q'; 199 Sales.Close(); 200 ELSE 201 Globals.Beep(); 202 END; (* case *) 203 UNTIL ch = 'Q'; 204 Btree.Close(ClientFile); 205 Btree.Close(ItemFile); 206 Window.CursorOn; 207 END Club. 238 errors