| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- Listing:
- 1 IMPLEMENTATION MODULE Items;
- 2 (*
- 3 Copyright (C) 1988,1989 Jensen & Partners International
- 4 *)
- 5
- 6 IMPORT Globals, Window, IO, Str, Misc, Btree;
- 7 FROM Globals IMPORT GetMenu, ItemIndex, ItemData;
- ***** ^ duplicate identifier
- 8
- 9 VAR
- 10 ItemWin, lastWin : Window.WinType;
- ***** ^ not supported yet
- 11 OnScreen : BOOLEAN;
- 12 EmptyItem, BlankItem : ItemRec;
- ***** ^ undeclared identifier
- 13 keyPressed : CHAR;
- 14
- 15 PROCEDURE PressAKey( txt : ARRAY OF CHAR);
- ***** ^ not supported yet
- 16 VAR
- 17 ch : CHAR;
- 18 BEGIN
- 19 Window.TextColor(Globals.PromptFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 20 Window.TextBackground(Globals.DisplayBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 21 Globals.WriteAt(9,1,txt);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 22 Window.GotoXY(30,9);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 23 ch := IO.RdKey();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 24 Window.GotoXY(1,9);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 25 Window.ClrEol();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 26 keyPressed := CAP(ch);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 27 END PressAKey;
- ***** ^ not supported yet
- 28
- 29
- 30 PROCEDURE MakeKey( keyA, myItemA : ADDRESS );
- ***** ^ undeclared identifier
- 31 VAR
- 32 key : POINTER TO Globals.FileKey;
- ***** ^ not supported yet
- 33 myItem : POINTER TO ItemRec;
- ***** ^ undeclared identifier
- 34 BEGIN
- 35 key := keyA;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 36 myItem := myItemA;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 37 Str.Copy(key^,myItem^.INum);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 38 END MakeKey;
- ***** ^ not supported yet
- 39
- 40 PROCEDURE Display( anItem : ItemRec );
- ***** ^ undeclared identifier
- 41 (*
- 42 This procedure displays the item record on the screen.
- 43 *)
- 44 VAR
- 45 S : ARRAY[0..10] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 46 ok : BOOLEAN;
- 47 BEGIN
- 48 Window.TextColor(Globals.DataFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 49 Window.TextBackground(Globals.DataBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 50 WITH anItem DO
- ***** ^ not supported yet
- 51 Globals.WriteAt(1,15,INum);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 52 Globals.WriteAt(2,15,Description);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 53 Globals.WriteAt(3,15,Mfgr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 54 Globals.WriteAt(3,55,PartNum);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 55 Globals.WriteAt(7,15,Supplier);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- 56 Window.GotoXY(15,5); IO.WrCard(QOHand,-10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 57 Window.GotoXY(55,5); IO.WrCard(QOOrder,-10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 58 Str.FixRealToStr(Cost,2,S,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 59 Globals.WriteAt(6,15," ");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 60 IF ok = FALSE THEN
- 61 Globals.WriteAt(6,15,"???");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 62 ELSE
- 63 Globals.WriteAt(6,15,S);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 64 END;
- 65 Str.FixRealToStr(Retail,2,S,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 66 Globals.WriteAt(6,55," ");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 67 IF ok = FALSE THEN
- 68 Globals.WriteAt(6,55,"???");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 69 ELSE
- 70 Globals.WriteAt(6,55,S);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 71 END;
- 72 END;
- ***** ^ not supported yet
- 73 END Display;
- ***** ^ not supported yet
- 74
- 75 PROCEDURE Clear( );
- 76 (*
- 77 This procedure clears the previous item information.
- 78 *)
- 79 BEGIN
- 80 Display(BlankItem);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 81 END Clear;
- ***** ^ not supported yet
- 82
- 83 PROCEDURE Template( );
- 84 (*
- 85 This procedure un-hides the item display window and displays
- 86 the field names.
- 87 *)
- 88 BEGIN
- 89 lastWin := Window.Used();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 90 Window.Use(ItemWin);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 91 Window.PutOnTop(ItemWin);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 92 Clear();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 93 OnScreen := TRUE;
- 94 END Template;
- ***** ^ not supported yet
- 95
- 96 PROCEDURE Input( VAR anItem : ItemRec; Clear : BOOLEAN );
- ***** ^ undeclared identifier
- 97 (*
- 98 This procedure inputs the item information from the user.
- 99 If Clear is TRUE, then the information is cleared before the
- 100 user enters new information. If Clear is FALSE, Display() is
- 101 called first to show the current information, and it is then
- 102 edited.
- 103 *)
- 104 VAR
- 105 ok,
- 106 Continue : BOOLEAN;
- 107 Field : CARDINAL;
- 108 ch : CHAR;
- 109 S : ARRAY[0..10] OF CHAR;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 110 BEGIN
- 111 IF Clear THEN
- 112 anItem := EmptyItem;
- ***** ^ not supported yet
- ***** ^ not supported yet
- 113 Display(BlankItem);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 114 END;
- 115 Display(anItem);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 116 Continue := TRUE;
- 117 Field := 1;
- 118 WITH anItem DO
- ***** ^ not supported yet
- 119 WHILE (Continue) DO
- 120 CASE Field OF
- 121 1: Window.GotoXY(15,1); Misc.InputStr(INum,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 122 | 2: Window.GotoXY(15,2); Misc.InputStr(Description,25);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 123 | 3: Window.GotoXY(15,3); Misc.InputStr(Mfgr,20);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 124 | 4: Window.GotoXY(55,3); Misc.InputStr(PartNum,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 125 | 5: Window.GotoXY(15,5);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 126 Str.CardToStr(LONGCARD(QOHand),S,10,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 127 Misc.InputStr(S,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 128 QOHand := CARDINAL(Str.StrToCard(S,10,ok));
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 129 | 6: Window.GotoXY(55,5);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 130 Str.CardToStr(LONGCARD(QOOrder),S,10,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 131 Misc.InputStr(S,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 132 QOOrder := CARDINAL(Str.StrToCard(S,10,ok));
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 133 | 7: Window.GotoXY(15,6);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 134 Str.FixRealToStr(Cost,2,S,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 135 Misc.InputStr(S,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 136 Cost := Str.StrToReal(S,ok);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 137 | 8: Window.GotoXY(55,6);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 138 Str.FixRealToStr(Retail,2,S,ok);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- 139 Misc.InputStr(S,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 140 Retail := Str.StrToReal(S,ok);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 141 | 9: Window.GotoXY(15,7); Misc.InputStr(Supplier,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 142 END; (* case *)
- 143 INC(Field);
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 144 IF Field >= 10 THEN
- 145 Window.TextColor(Globals.PromptFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 146 Window.TextBackground(Globals.DisplayBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 147 Globals.WriteAt(9,1,"Are these ok? ");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 148 Window.GotoXY(15,9);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 149 ch := IO.RdKey();
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 150 Globals.WriteAt(9,1," ");
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 151 IF CAP(ch) = 'Y' THEN
- ***** ^ undeclared identifier
- ***** ^ not supported yet
- 152 Continue := FALSE;
- 153 ELSE
- 154 Field := 1;
- 155 Window.TextColor(Globals.DataFore);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 156 Window.TextBackground(Globals.DataBack);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 157 END; (* if *)
- 158 END; (* if *)
- 159 END; (* while *)
- 160 END; (* with *)
- ***** ^ not supported yet
- 161 END Input;
- ***** ^ not supported yet
- 162
- 163 PROCEDURE Search( VAR anItem : ItemRec ) : BOOLEAN ;
- ***** ^ undeclared identifier
- 164 (*
- 165 The key fields from anItem are checked for data. If they
- 166 are filled, that information is used to search. Otherwise,
- 167 this procedure asks the user for search information, and then
- 168 searches for the given record. If it is found, it is copied to
- 169 anItem, and TRUE is returned. If it is not found, FALSE is
- 170 returned.
- 171 *)
- 172 VAR
- 173 searchStr : Globals.FileKey;
- ***** ^ not supported yet
- 174 ch : CHAR;
- 175 BEGIN
- 176 Clear();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 177 IF anItem.INum[0] > ' ' THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 178 Str.Copy(searchStr,anItem.INum);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 179 ELSE
- 180 Window.GotoXY(15,1);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 181 searchStr := "";
- ***** ^ not supported yet
- 182 Misc.InputStr(searchStr,10);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 183 END;
- 184 IF searchStr[0] <= ' ' THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- 185 Clear();
- ***** ^ not supported yet
- ***** ^ not supported yet
- 186 RETURN FALSE;
- 187 END;
- 188 Str.Caps(searchStr);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 189 (* WriteAt(sx, sy, "Searching..."); *)
- 190 IF Btree.Find(ItemIndex,searchStr,anItem) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 191 Display(anItem);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 192 (* WriteAt(sx, sy, " "); *)
- 193 ELSE
- 194 IF Btree.Search(ItemIndex,searchStr,anItem) THEN
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 195 Display(anItem);
- ***** ^ not supported yet
- ***** ^ not supported yet
- 196 REPEAT
- 197 GetMenu("N)ext P)revious or T)his One? ",
- ***** ^ not supported yet
- ***** ^ not supported yet
- 198 Globals.CharSet{'N','P','T'}, ch);
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- ***** ^ not supported yet
- 199 CASE ch OF
- 200 'N' : IF Btree.Next(ItemIndex,anItem) THEN
- 201 Clear();
- 202 Display(anItem);
- 203 ELSE
- 204 Globals.Beep();
- 205 END;
- 206 | 'P' : IF Btree.Prev(ItemIndex,anItem) THEN
- 207 Clear();
- 208 Display(anItem);
- 209 ELSE
- 210 Globals.Beep();
- 211 END;
- 212 | 'T' : ;
- 213 ELSE
- 214 Globals.Beep();
- 215 END;
- 216 UNTIL ch = 'T';
- 217 ELSE
- 218 Globals.WriteAt(8,1,"Failed Search!");
- 219 PressAKey("Press Any Key to Continue... ");
- 220 Window.TextColor(Globals.PromptFore);
- 221 Window.TextBackground(Globals.DisplayBack);
- 222 Globals.WriteAt(8,1," ");
- 223 RETURN FALSE;
- 224 END;
- 225 END;
- 226 PressAKey("E)dit, D)elete, or Q)uit? ");
- 227 IF keyPressed = 33C THEN
- 228 RETURN FALSE;
- 229 ELSIF keyPressed = 'E' THEN
- 230 Btree.Delete(ItemData);
- 231 Input(anItem,FALSE);
- 232 Btree.Add(ItemData,anItem,SIZE(anItem));
- 233 RETURN TRUE;
- 234 ELSIF keyPressed = 'D' THEN
- 235 Btree.Delete(ItemData);
- 236 RETURN FALSE;
- 237 ELSE
- 238 RETURN TRUE;
- 239 END;
- 240 END Search;
- 241
- 242 PROCEDURE Close( );
- 243 (*
- 244 This procedure removes the item display window from the screen.
- 245 *)
- 246 BEGIN
- 247 Window.Hide(ItemWin);
- 248 Window.Use(lastWin);
- 249 Window.PutOnTop(lastWin);
- 250 OnScreen := FALSE;
- 251 END Close;
- 252
- 253 BEGIN
- 254 ItemWin := Window.Open( Window.WinDef( 0, 4, 79, 14,
- 255 Window.White,Window.Black,TRUE,FALSE,TRUE,TRUE,
- 256 Window.SingleFrame,Window.White,Window.Black) );
- 257 Window.SetFrame(ItemWin,Window.SingleFrame,Globals.DisplayBorder,
- 258 Globals.DisplayBack);
- 259 Window.Use(ItemWin);
- 260 Window.TextColor(Globals.DisplayFore);
- 261 Window.TextBackground(Globals.DisplayBack);
- 262 Window.Clear();
- 263 Globals.WriteAt(1,1,"Item Number:");
- 264 Globals.WriteAt(2,1,"Description:");
- 265 Globals.WriteAt(3,1,"Manufacturer:");
- 266 Globals.WriteAt(3,40,"Part Number:");
- 267 Globals.WriteAt(5,1,"On Hand:");
- 268 Globals.WriteAt(5,40,"On Order:");
- 269 Globals.WriteAt(6,1,"Cost:");
- 270 Globals.WriteAt(6,40,"Retail:");
- 271 Globals.WriteAt(7,1,"Supplier:");
- 272
- 273 WITH BlankItem DO
- 274 Str.Copy(INum," ");
- 275 Str.Copy(Description," ");
- 276 Str.Copy(PartNum," ");
- 277 Str.Copy(Mfgr," ");
- 278 Str.Copy(Supplier," ");
- 279 QOHand := 0;
- 280 QOOrder := 0;
- 281 Cost := 0.0;
- 282 Retail := 0.0;
- 283 END;
- 284
- 285 WITH EmptyItem DO
- 286 INum := "";
- 287 Description := "";
- 288 PartNum := "";
- 289 Mfgr := "";
- 290 Supplier := "";
- 291 QOHand := 0;
- 292 QOOrder := 0;
- 293 Cost := 0.0;
- 294 Retail := 0.0;
- 295 END;
- 296
- 297 OnScreen := FALSE;
- 298 END Items.
- 327 errors
|