CLUB.LST 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. Listing:
  2. 1 MODULE Club;
  3. 2 (*
  4. 3 Copyright (C) 1988,1989 Jensen & Partners International
  5. 4 *)
  6. 5
  7. 6 IMPORT Globals, Btree, Window, Client, Items, IO, FIO, Sales;
  8. 7 FROM Globals IMPORT ClientFile, ItemFile, ClientData, ItemData,
  9. ***** ^ duplicate identifier
  10. 8 ClientIndex, ItemIndex,
  11. 9 oldWin, TitleWin, DisplayWin, UpdateTitle,
  12. 10 StoreName;
  13. 11
  14. 12 VAR
  15. 13 aClient : Client.ClientRec;
  16. ***** ^ not supported yet
  17. 14 anItem : Items.ItemRec;
  18. ***** ^ not supported yet
  19. 15 ch, ch2, ch3 : CHAR;
  20. 16 GO, Found : BOOLEAN;
  21. 17 lines : CARDINAL;
  22. 18
  23. 19 PROCEDURE OpenClientFiles();
  24. 20 BEGIN
  25. 21 IF NOT FIO.Exists("CLIENT.DAT") THEN (* create a new one *)
  26. ***** ^ not supported yet
  27. ***** ^ not supported yet
  28. ***** ^ not supported yet
  29. 22 ClientFile := Btree.Open("CLIENT.DAT",2,Btree.FixSize,FALSE,FALSE,TRUE);
  30. ***** ^ not supported yet
  31. ***** ^ not supported yet
  32. ***** ^ not supported yet
  33. ***** ^ not supported yet
  34. ***** ^ not supported yet
  35. ***** ^ not supported yet
  36. ***** ^ not supported yet
  37. 23 ClientData := Btree.OpenData(ClientFile,1,SIZE(Client.ClientRec),TRUE);
  38. ***** ^ not supported yet
  39. ***** ^ not supported yet
  40. ***** ^ not supported yet
  41. ***** ^ not supported yet
  42. ***** ^ undeclared identifier
  43. ***** ^ not supported yet
  44. ***** ^ not supported yet
  45. ***** ^ not supported yet
  46. 24 ClientIndex := Btree.OpenIndex(ClientFile,ClientData,2,Globals.Compare,
  47. ***** ^ not supported yet
  48. ***** ^ not supported yet
  49. ***** ^ not supported yet
  50. ***** ^ not supported yet
  51. ***** ^ not supported yet
  52. ***** ^ not supported yet
  53. ***** ^ not supported yet
  54. 25 Client.MakeKey,SIZE(Globals.FileKey),
  55. ***** ^ not supported yet
  56. ***** ^ not supported yet
  57. ***** ^ undeclared identifier
  58. ***** ^ not supported yet
  59. ***** ^ not supported yet
  60. 26 TRUE,TRUE);
  61. ***** ^ not supported yet
  62. 27 Btree.Close(ClientFile);
  63. ***** ^ not supported yet
  64. ***** ^ not supported yet
  65. ***** ^ not supported yet
  66. 28 END; (* if *)
  67. 29
  68. 30 ClientFile := Btree.Open("CLIENT.DAT",2,Btree.FixSize,FALSE,FALSE,FALSE);
  69. ***** ^ not supported yet
  70. ***** ^ not supported yet
  71. ***** ^ not supported yet
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 31 ClientData := Btree.OpenData(ClientFile,1,SIZE(Client.ClientRec),FALSE);
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. ***** ^ not supported yet
  80. ***** ^ not supported yet
  81. ***** ^ undeclared identifier
  82. ***** ^ not supported yet
  83. ***** ^ not supported yet
  84. ***** ^ not supported yet
  85. 32 ClientIndex := Btree.OpenIndex(ClientFile,ClientData,2,Globals.Compare,
  86. ***** ^ not supported yet
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. ***** ^ not supported yet
  91. ***** ^ not supported yet
  92. ***** ^ not supported yet
  93. 33 Client.MakeKey,SIZE(Globals.FileKey),TRUE,
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. ***** ^ undeclared identifier
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. 34 FALSE);
  100. ***** ^ not supported yet
  101. 35 END OpenClientFiles;
  102. ***** ^ not supported yet
  103. 36
  104. 37
  105. 38 PROCEDURE OpenItemFiles();
  106. 39 BEGIN
  107. 40 IF NOT FIO.Exists("ITEMS.DAT") THEN (* create a new one *)
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. 41 ItemFile := Btree.Open("ITEMS.DAT",2,Btree.FixSize,FALSE,FALSE,TRUE);
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. ***** ^ not supported yet
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. ***** ^ not supported yet
  118. ***** ^ not supported yet
  119. 42 ItemData := Btree.OpenData(ItemFile,1,SIZE(Items.ItemRec),TRUE);
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. ***** ^ not supported yet
  124. ***** ^ undeclared identifier
  125. ***** ^ not supported yet
  126. ***** ^ not supported yet
  127. ***** ^ not supported yet
  128. 43 ItemIndex := Btree.OpenIndex(ItemFile,ItemData,2,Globals.Compare,
  129. ***** ^ not supported yet
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. ***** ^ not supported yet
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. ***** ^ not supported yet
  136. 44 Items.MakeKey,SIZE(Globals.FileKey),TRUE,
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ undeclared identifier
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. 45 TRUE);
  143. ***** ^ not supported yet
  144. 46 Btree.Close(ItemFile);
  145. ***** ^ not supported yet
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. 47 END; (* if *)
  149. 48
  150. 49 ItemFile := Btree.Open("ITEMS.DAT",2,Btree.FixSize,FALSE,FALSE,FALSE);
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. ***** ^ not supported yet
  154. ***** ^ not supported yet
  155. ***** ^ not supported yet
  156. ***** ^ not supported yet
  157. ***** ^ not supported yet
  158. 50 ItemData := Btree.OpenData(ItemFile,1,SIZE(Items.ItemRec),FALSE);
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. ***** ^ undeclared identifier
  164. ***** ^ not supported yet
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 51 ItemIndex := Btree.OpenIndex(ItemFile,ItemData,2,Globals.Compare,
  168. ***** ^ not supported yet
  169. ***** ^ not supported yet
  170. ***** ^ not supported yet
  171. ***** ^ not supported yet
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. 52 Items.MakeKey,SIZE(Globals.FileKey),TRUE,
  176. ***** ^ not supported yet
  177. ***** ^ not supported yet
  178. ***** ^ undeclared identifier
  179. ***** ^ not supported yet
  180. ***** ^ not supported yet
  181. 53 FALSE);
  182. ***** ^ not supported yet
  183. 54 END OpenItemFiles;
  184. ***** ^ not supported yet
  185. 55
  186. 56
  187. 57 PROCEDURE Help();
  188. 58 CONST
  189. 59 HelpWinDef = Window.WinDef(10,7,70,17,Window.Blue,Window.LightGray,
  190. ***** ^ not supported yet
  191. ***** ^ not supported yet
  192. ***** ^ not supported yet
  193. ***** ^ not supported yet
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. 60 FALSE, TRUE, TRUE, TRUE, Window.DoubleFrame,
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 61 Window.Black, Window.LightGray);
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. ***** ^ not supported yet
  203. ***** ^ not supported yet
  204. 62 VAR
  205. 63 helpWin : Window.WinType;
  206. ***** ^ not supported yet
  207. 64 ch : CHAR;
  208. 65 BEGIN
  209. 66 oldWin := Window.Used();
  210. ***** ^ not supported yet
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. ***** ^ not supported yet
  214. 67 helpWin := Window.Open(HelpWinDef);
  215. ***** ^ not supported yet
  216. ***** ^ not supported yet
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. 68 Window.Use(helpWin);
  220. ***** ^ not supported yet
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. 69 Window.Clear();
  224. ***** ^ not supported yet
  225. ***** ^ not supported yet
  226. ***** ^ not supported yet
  227. 70 Window.SetTitle(helpWin,"Help Window", Window.CenterUpperTitle);
  228. ***** ^ not supported yet
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. 71 Window.PutOnTop(helpWin);
  235. ***** ^ not supported yet
  236. ***** ^ not supported yet
  237. ***** ^ not supported yet
  238. 72 IO.WrLn(); IO.WrLn();
  239. ***** ^ not supported yet
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. ***** ^ not supported yet
  244. ***** ^ not supported yet
  245. 73 IO.WrStr(" This is the help window. If you would like to");
  246. ***** ^ not supported yet
  247. ***** ^ not supported yet
  248. ***** ^ not supported yet
  249. 74 IO.WrLn();
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. ***** ^ not supported yet
  253. 75 IO.WrStr(" change the help, look in the Help() routine in");
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. ***** ^ not supported yet
  257. 76 IO.WrLn();
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. 77 IO.WrStr(" the main CLUB.MOD file.");
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. ***** ^ not supported yet
  265. 78 IO.WrLn();
  266. ***** ^ not supported yet
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. 79 IO.WrLn(); IO.WrLn();
  270. ***** ^ not supported yet
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. ***** ^ not supported yet
  275. ***** ^ not supported yet
  276. 80 IO.WrStr(" Press any key to continue... ");
  277. ***** ^ not supported yet
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. 81 Window.CursorOn();
  281. ***** ^ not supported yet
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. 82 ch := IO.RdKey();
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. ***** ^ not supported yet
  288. 83 Window.CursorOff();
  289. ***** ^ not supported yet
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. 84 Window.Close(helpWin);
  293. ***** ^ not supported yet
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. 85 Window.Use(oldWin);
  297. ***** ^ not supported yet
  298. ***** ^ not supported yet
  299. ***** ^ not supported yet
  300. 86 Window.PutOnTop(oldWin);
  301. ***** ^ not supported yet
  302. ***** ^ not supported yet
  303. ***** ^ not supported yet
  304. 87 END Help;
  305. ***** ^ not supported yet
  306. 88
  307. 89 BEGIN (* main program *)
  308. 90 StoreName := "Btree Demonstration Store";
  309. ***** ^ not supported yet
  310. ***** ^ not supported yet
  311. 91 Window.PutOnTop(TitleWin);
  312. ***** ^ not supported yet
  313. ***** ^ not supported yet
  314. ***** ^ not supported yet
  315. 92 UpdateTitle(TRUE);
  316. ***** ^ not supported yet
  317. ***** ^ not supported yet
  318. 93 OpenClientFiles();
  319. ***** ^ not supported yet
  320. ***** ^ not supported yet
  321. 94 OpenItemFiles();
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. 95
  325. 96 REPEAT
  326. 97 Globals.GetMenu("Help Clients Inventory Sales Quit >>",
  327. ***** ^ not supported yet
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. 98 Globals.CharSet{'H','C','I','S','Q'}, ch );
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. ***** ^ not supported yet
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. ***** ^ not supported yet
  337. ***** ^ not supported yet
  338. 99 CASE ch OF
  339. 100 'H' : Help();
  340. 101 | 'C' : Client.Template();
  341. 102 REPEAT
  342. 103 Globals.GetMenu( "Add Find/edit/delete List Quit >>",
  343. 104 Globals.CharSet{'A','F','E','D','L','Q'}, ch2);
  344. 105 CASE ch2 OF
  345. 106 'A' : Client.Input(aClient,TRUE);
  346. 107 Btree.Add(ClientData,aClient,
  347. 108 SIZE(Client.ClientRec));
  348. 109 | 'F', 'E', 'D' : aClient.CNum := "";
  349. 110 Found := Client.Search(aClient);
  350. 111 | 'L' : oldWin := Window.Used();
  351. 112 Window.Use(DisplayWin);
  352. 113 Window.Clear();
  353. 114 Window.PutOnTop(DisplayWin);
  354. 115 lines := 0; (* max 17 *)
  355. 116 Btree.Reset(ClientData);
  356. 117 GO := TRUE;
  357. 118 WHILE Btree.Next(ClientIndex,aClient) AND GO DO
  358. 119 IO.WrStrAdj(aClient.CNum,-11);
  359. 120 IO.WrStrAdj(aClient.LName,-16);
  360. 121 IO.WrStrAdj(aClient.FName,-11);
  361. 122 IO.WrStrAdj(aClient.Phone,-16);
  362. 123 IO.WrLn();
  363. 124 INC(lines);
  364. 125 IF lines > 16 THEN
  365. 126 IO.WrStr("Press <ESC> to quit, any other key to continue: ");
  366. 127 ch3 := IO.RdKey();
  367. 128 IF ch3 = 33C THEN
  368. 129 GO := FALSE;
  369. 130 END; (* if *)
  370. 131 Window.Clear();
  371. 132 lines := 0;
  372. 133 END; (* if *)
  373. 134 END; (* while *)
  374. 135 Globals.WriteAt(18,1,"Press a key to finish ");
  375. 136 ch3 := IO.RdKey();
  376. 137 Window.Hide(DisplayWin);
  377. 138 Window.Use(oldWin);
  378. 139 Window.PutOnTop(oldWin);
  379. 140 | 'Q' : Client.Close();
  380. 141 END; (* case *)
  381. 142 UNTIL ch2 = 'Q';
  382. 143 | 'I' : Items.Template();
  383. 144 REPEAT
  384. 145 Globals.GetMenu(
  385. 146 "Add Find/edit/delete List Quit >>",
  386. 147 Globals.CharSet{'A','F','E','D','L','Q'}, ch2);
  387. 148 CASE ch2 OF
  388. 149 'A' : Items.Input(anItem,TRUE);
  389. 150 Btree.Add(ItemData,anItem,SIZE(Items.ItemRec));
  390. 151 | 'F','E','D' : anItem.INum := "";
  391. 152 Found := Items.Search(anItem);
  392. 153 | 'L' : oldWin := Window.Used();
  393. 154 Window.Use(DisplayWin);
  394. 155 Window.Clear();
  395. 156 Window.PutOnTop(DisplayWin);
  396. 157 lines := 0; (* max 17 *)
  397. 158 Btree.Reset(ItemData);
  398. 159 GO := TRUE;
  399. 160 WHILE Btree.Next(ItemIndex,anItem) AND GO DO
  400. 161 IO.WrStrAdj(anItem.INum,-11);
  401. 162 IO.WrStrAdj(anItem.Description,-26);
  402. 163 IO.WrStrAdj(anItem.Mfgr,-21);
  403. 164 IO.WrStrAdj(anItem.PartNum,-11);
  404. 165 IO.WrLn();
  405. 166 INC(lines);
  406. 167 IF lines > 16 THEN
  407. 168 IO.WrStr("Press <ESC> to quit, any other key to continue: ");
  408. 169 ch3 := IO.RdKey();
  409. 170 IF ch3 = 33C THEN
  410. 171 GO := FALSE;
  411. 172 END; (* if *)
  412. 173 Window.Clear();
  413. 174 lines := 0;
  414. 175 END; (* if *)
  415. 176 END; (* while *)
  416. 177 Globals.WriteAt(18,1,"Press a key to finish ");
  417. 178 ch3 := IO.RdKey();
  418. 179 Window.Hide(DisplayWin);
  419. 180 Window.Use(oldWin);
  420. 181 Window.PutOnTop(oldWin);
  421. 182 | 'Q' : Items.Close();
  422. 183 END; (* case *)
  423. 184 UNTIL ch2 = 'Q';
  424. 185 | 'S' : (* run the sales floor *)
  425. 186 Sales.Template();
  426. 187 REPEAT
  427. 188 Sales.Clear(); (* clear old transaction *)
  428. 189 Globals.GetMenu(
  429. 190 "A)nother sale, S)how summary, or Q)uit to Menu",
  430. 191 Globals.CharSet{'A','Q','S'},ch2);
  431. 192 CASE ch2 OF
  432. 193 'A' : Sales.Work();
  433. 194 | 'S' : Sales.Summary();
  434. 195 ELSE
  435. 196 Globals.Beep();
  436. 197 END; (* case *)
  437. 198 UNTIL ch2 = 'Q';
  438. 199 Sales.Close();
  439. 200 ELSE
  440. 201 Globals.Beep();
  441. 202 END; (* case *)
  442. 203 UNTIL ch = 'Q';
  443. 204 Btree.Close(ClientFile);
  444. 205 Btree.Close(ItemFile);
  445. 206 Window.CursorOn;
  446. 207 END Club.
  447. 238 errors