SALESREP.LST 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. Listing:
  2. 1 IMPLEMENTATION MODULE SalesReps;
  3. 2 (*
  4. 3 * ModBase
  5. 4 * Release 3.0
  6. 5 * (c) Copyright 1986 - 1991 PMI
  7. 6 * P.O. Box 8402
  8. 7 * Green Bay Wi 53308
  9. 8 * All Rights Reserved
  10. 9 * by Ed Ross
  11. 10 *)
  12. 11
  13. 12 FROM DBFInvoice IMPORT OpenInvoiceDBF,CloseInvoiceDBF,MoveInvoiceFromDBF,
  14. 13 InvoiceRec,InvoiceDBF;
  15. 14 FROM GenLists IMPORT NewList,GenList,ListLength,ListInsert,GetElmt,
  16. 15 DisposeList,GetElmtAdr,ListDelete,ListInsertAdr,SortList;
  17. 16 FROM ListUtils IMPORT TextFileToList,TextListToFile;
  18. 17 FROM StrConv IMPORT RealToStr,CardinalToStr;
  19. 18 FROM StrEdit IMPORT CAPstr,DeleteRightJustified,
  20. 19 CrunchBlanks,Center,Append;
  21. 20 FROM Customer IMPORT GetCustName,GetCustSalesRepCom,GetCustSalesRep;
  22. 21 FROM DBFCustomer IMPORT OpenCustomerDBF,FindCustomerByCin,CustomerRec,
  23. 22 MoveCustomerFromDBF;
  24. 23 FROM DBFInvoice IMPORT OpenInvoiceDBF;
  25. ***** ^ duplicate identifier
  26. ***** ^ duplicate identifier
  27. 24 FROM PMIGlobals IMPORT Config,PMIScreens,Today,TodayStr;
  28. 25 FROM DspFiles IMPORT OpenDisplayFile;
  29. 26 FROM DBUtils IMPORT GetDateRange;
  30. 27 FROM DBStuff IMPORT MakeKey;
  31. 28 FROM HandleIO IMPORT OpenFile,FileExists,CloseHandle;
  32. 29 FROM PrinterUtils IMPORT SetupDisplayLine,DisplayLine,RemoveDisplayLine,
  33. 30 AddPrintElemt,PrintDisplayLine,ClearDisplayLine;
  34. 31 FROM PosUtils IMPORT Equal;
  35. 32 FROM DateFunctions IMPORT Date,DateToStr,CompareDates,Comparison;
  36. 33 FROM ModBase3 IMPORT ReadDBRec,Deleted,NumberRecords;
  37. 34 FROM StringIO IMPORT WriteStr,WriteEol,PrintMessage;
  38. 35 FROM SYSTEM IMPORT ADDRESS,ADR;
  39. 36 FROM NumTypes IMPORT Real8;
  40. 37 FROM ScrnUtl2 IMPORT CloseDisplayFrame,GetEdField;
  41. 38 FROM VWindows IMPORT ClearPart, CurrentWindow, SetCursorHeight;
  42. 39 FROM ScrnTypes IMPORT DisplayFrame,InitDisplayFrame,AFrameName,DisplayFile;
  43. 40 FROM FramePainter IMPORT ShowDisplayFrame,RedrawField;
  44. 41 FROM ControlUtils IMPORT Control,AddEditorField;
  45. 42 FROM VEditor IMPORT AnEdControlRec,InitEdRec;
  46. 43 FROM LowLevel IMPORT Fill;
  47. 44 FROM M2Strings IMPORT CompareStr,Length,Assign;
  48. 45 VAR
  49. 46 MainList : GenList;
  50. 47 SalesRepList : GenList;
  51. 48 PrtHand : CARDINAL;
  52. 49 Environ : ARRAY[0..60] OF CHAR;
  53. ***** ^ not supported yet
  54. ***** ^ not supported yet
  55. 50
  56. 51 PROCEDURE SortBySalesRep(Inv1 : ADDRESS; Size1 : CARDINAL;
  57. 52 Inv2 : ADDRESS; Size2 : CARDINAL): INTEGER;
  58. 53 (* sort list of invoices by sales rep, by customer, by invdate*)
  59. 54 VAR
  60. 55 I1,I2 : POINTER TO InvoiceRec;
  61. ***** ^ not supported yet
  62. 56 Comp : Comparison;
  63. 57 BEGIN
  64. 58 I1 := Inv1;
  65. ***** ^ not supported yet
  66. ***** ^ not supported yet
  67. 59 I2 := Inv2;
  68. ***** ^ not supported yet
  69. ***** ^ not supported yet
  70. 60 RETURN CompareStr(I1^.SALESMAN,I2^.SALESMAN);
  71. ***** ^ not supported yet
  72. ***** ^ not supported yet
  73. ***** ^ not supported yet
  74. ***** ^ not supported yet
  75. ***** ^ not supported yet
  76. 61 END SortBySalesRep;
  77. ***** ^ not supported yet
  78. 62
  79. 63 PROCEDURE SortByInvNbr(Inv1 : ADDRESS; Size1 : CARDINAL;
  80. 64 Inv2 : ADDRESS; Size2 : CARDINAL): INTEGER;
  81. 65 (* sort list of invoices by sales rep, by customer, by invdate*)
  82. 66 VAR
  83. 67 I1,I2 : POINTER TO InvoiceRec;
  84. ***** ^ not supported yet
  85. 68 Comp : Comparison;
  86. 69 BEGIN
  87. 70 I1 := Inv1;
  88. ***** ^ not supported yet
  89. ***** ^ not supported yet
  90. 71 I2 := Inv2;
  91. ***** ^ not supported yet
  92. ***** ^ not supported yet
  93. 72 RETURN CompareStr(I1^.INVOICE,I2^.INVOICE);
  94. ***** ^ not supported yet
  95. ***** ^ not supported yet
  96. ***** ^ not supported yet
  97. ***** ^ not supported yet
  98. ***** ^ not supported yet
  99. 73 END SortByInvNbr;
  100. ***** ^ not supported yet
  101. 74
  102. 75
  103. 76 PROCEDURE SortByCustNbr(Inv1 : ADDRESS; Size1 : CARDINAL;
  104. 77 Inv2 : ADDRESS; Size2 : CARDINAL): INTEGER;
  105. 78 (* sort list of invoices by sales rep, by customer, by invdate*)
  106. 79 VAR
  107. 80 I1,I2 : POINTER TO InvoiceRec;
  108. ***** ^ not supported yet
  109. 81 Comp : Comparison;
  110. 82 BEGIN
  111. 83 I1 := Inv1;
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. 84 I2 := Inv2;
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. 85 RETURN CompareStr(I1^.CUSTID,I2^.CUSTID);
  118. ***** ^ not supported yet
  119. ***** ^ not supported yet
  120. ***** ^ not supported yet
  121. ***** ^ not supported yet
  122. ***** ^ not supported yet
  123. 86 END SortByCustNbr;
  124. ***** ^ not supported yet
  125. 87
  126. 88
  127. 89 PROCEDURE GetMainList();
  128. 90 (* read through the invoices and get those that are closed and within the
  129. 91 specified date range*)
  130. 92 VAR
  131. 93 BeginDate,EndDate : Date;
  132. 94 Invoice : InvoiceRec;
  133. 95 L,NumOfRecs : LONGINT;
  134. 96
  135. 97 BEGIN
  136. 98 BeginDate := Today;
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. 99 BeginDate.day := 1;
  140. ***** ^ not supported yet
  141. ***** ^ not supported yet
  142. 100 EndDate := Today;
  143. ***** ^ not supported yet
  144. ***** ^ not supported yet
  145. 101 GetDateRange(BeginDate,EndDate,PMIScreens);
  146. ***** ^ not supported yet
  147. ***** ^ not supported yet
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. 102 OpenInvoiceDBF(FALSE);
  151. ***** ^ not supported yet
  152. ***** ^ not supported yet
  153. 103 NewList(MainList);
  154. ***** ^ not supported yet
  155. ***** ^ not supported yet
  156. 104 NumOfRecs := NumberRecords(InvoiceDBF);
  157. ***** ^ not supported yet
  158. ***** ^ not supported yet
  159. 105 FOR L := 1 TO NumOfRecs DO
  160. 106 ReadDBRec(InvoiceDBF,L);
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. 107 IF NOT Deleted(InvoiceDBF)
  165. ***** ^ not supported yet
  166. ***** ^ not supported yet
  167. 108 THEN
  168. 109 MoveInvoiceFromDBF(Invoice);
  169. ***** ^ not supported yet
  170. ***** ^ not supported yet
  171. 110 CrunchBlanks(Invoice.SALESMAN);
  172. ***** ^ not supported yet
  173. ***** ^ not supported yet
  174. ***** ^ not supported yet
  175. 111 IF Length(Invoice.SALESMAN) > 1 (* only grab the ones with salesrep*)
  176. ***** ^ not supported yet
  177. ***** ^ not supported yet
  178. ***** ^ not supported yet
  179. 112 THEN
  180. 113 IF (CompareDates(Invoice.INVDATE,BeginDate) = DateGreater) AND
  181. ***** ^ not supported yet
  182. ***** ^ not supported yet
  183. ***** ^ not supported yet
  184. ***** ^ not supported yet
  185. ***** ^ undeclared identifier
  186. 114 (CompareDates(Invoice.INVDATE,EndDate) = DateLess)
  187. ***** ^ not supported yet
  188. ***** ^ not supported yet
  189. ***** ^ not supported yet
  190. ***** ^ not supported yet
  191. ***** ^ undeclared identifier
  192. 115 THEN
  193. 116 ListInsert(Invoice,2,MainList,1);
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. ***** ^ not supported yet
  197. ***** ^ not supported yet
  198. 117 END;
  199. 118 END;
  200. 119 END; (* if deleted *)
  201. 120 END; (* end of loop *)
  202. 121 SortList(MainList,SortBySalesRep);
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. ***** ^ not supported yet
  206. 122 END GetMainList;
  207. ***** ^ not supported yet
  208. 123
  209. 124
  210. 125 PROCEDURE MakeSubList(SalesRep: ARRAY OF CHAR);
  211. ***** ^ not supported yet
  212. 126 (* Return a list of invoices for this sales rep -
  213. 127 make the list from main list *)
  214. 128
  215. 129 VAR
  216. 130 N : CARDINAL;
  217. 131 Inv : POINTER TO InvoiceRec;
  218. ***** ^ not supported yet
  219. 132 Size,Code : CARDINAL;
  220. 133 SalesMan : ARRAY[0..10] OF CHAR;
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. 134 Cust : CustomerRec;
  224. 135 BEGIN
  225. 136 NewList(SalesRepList);
  226. ***** ^ not supported yet
  227. ***** ^ not supported yet
  228. 137 MakeKey(SalesRep);
  229. ***** ^ not supported yet
  230. ***** ^ not supported yet
  231. 138 FOR N := 1 TO ListLength(MainList) DO
  232. ***** ^ not supported yet
  233. ***** ^ not supported yet
  234. 139 GetElmtAdr(MainList,N,Inv,Size,Code);
  235. ***** ^ not supported yet
  236. ***** ^ not supported yet
  237. ***** ^ not supported yet
  238. ***** ^ not supported yet
  239. 140 MakeKey(Inv^.SALESMAN);
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. 141 MakeKey(Inv^.INVOICE);
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. ***** ^ not supported yet
  247. 142 IF Equal(SalesRep,Inv^.SALESMAN)
  248. ***** ^ not supported yet
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. 143 THEN
  253. 144 ListInsert(Inv^,2,SalesRepList,1); (* insert in sublist*)
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. ***** ^ not supported yet
  257. ***** ^ not supported yet
  258. 145 END;
  259. 146 END; (* end for *)
  260. 147 SortList(SalesRepList,SortByInvNbr);
  261. ***** ^ not supported yet
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. 148 END MakeSubList;
  265. ***** ^ not supported yet
  266. 149
  267. 150
  268. 151
  269. 152
  270. 153
  271. 154 PROCEDURE PrintHeader(SalesRep : ARRAY OF CHAR; Page : CARDINAL);
  272. ***** ^ not supported yet
  273. 155 VAR
  274. 156 Line : ARRAY[0..80] OF CHAR;
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. 157 Str: ARRAY[0..10] OF CHAR;
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. 158 BEGIN
  281. 159 WriteStr(PrtHand,12C);
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. 160 Line := 'Sales Commission Report';
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. 161 Center(Line,80);
  288. ***** ^ not supported yet
  289. ***** ^ not supported yet
  290. ***** ^ not supported yet
  291. 162 WriteEol(PrtHand,Line);
  292. ***** ^ not supported yet
  293. ***** ^ not supported yet
  294. 163 Assign( SalesRep,Line );
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. ***** ^ not supported yet
  298. 164 Center(Line,80);
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. 165 WriteEol(PrtHand,Line);
  303. ***** ^ not supported yet
  304. ***** ^ not supported yet
  305. 166 Assign( TodayStr,Line);
  306. ***** ^ not supported yet
  307. ***** ^ not supported yet
  308. ***** ^ not supported yet
  309. 167 Append(Line,' Page ');
  310. ***** ^ not supported yet
  311. ***** ^ not supported yet
  312. ***** ^ not supported yet
  313. 168 CardinalToStr(Page,4,Str);
  314. ***** ^ not supported yet
  315. ***** ^ not supported yet
  316. 169 Append(Line,Str);
  317. ***** ^ not supported yet
  318. ***** ^ not supported yet
  319. ***** ^ not supported yet
  320. 170 Center(Line,80);
  321. ***** ^ not supported yet
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. 171 WriteEol(PrtHand,Line);
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. 172 WriteEol(PrtHand,'');
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. 173 WriteEol(PrtHand,'');
  331. ***** ^ not supported yet
  332. ***** ^ not supported yet
  333. 174 WriteEol(PrtHand,'');
  334. ***** ^ not supported yet
  335. ***** ^ not supported yet
  336. 175 WriteEol(PrtHand,
  337. ***** ^ not supported yet
  338. 176 ' Cust Invoice Date Net Com % Commission');
  339. ***** ^ not supported yet
  340. 177 WriteEol(PrtHand,
  341. ***** ^ not supported yet
  342. 178 '----------------------------------------------------------------');
  343. ***** ^ not supported yet
  344. 179
  345. 180
  346. 181
  347. 182 END PrintHeader;
  348. ***** ^ not supported yet
  349. 183
  350. 184 PROCEDURE ReportSalesRep(SalesRep: ARRAY OF CHAR);
  351. ***** ^ not supported yet
  352. 185 VAR
  353. 186 CurrentCustNbr : ARRAY[0..15] OF CHAR;
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. 187 CurrentCustName ,
  357. 188 LastCust : ARRAY[0..60] OF CHAR;
  358. ***** ^ not supported yet
  359. ***** ^ not supported yet
  360. 189 Inv : POINTER TO InvoiceRec;
  361. ***** ^ not supported yet
  362. 190 J, Size,Code : CARDINAL;
  363. 191 CommPerCent : Real8;
  364. 192 CustomerTotal : Real8;
  365. 193 RepTotal : Real8;
  366. 194 LineNbr : CARDINAL;
  367. 195 Line : DisplayLine;
  368. 196 Page : CARDINAL;
  369. 197 B : BOOLEAN;
  370. 198 Commision : Real8;
  371. 199 Str : ARRAY[0..10] OF CHAR;
  372. ***** ^ not supported yet
  373. ***** ^ not supported yet
  374. 200 BEGIN
  375. 201 (* * * * * * * print output should look like this * * * * *** * * *
  376. 202 123456789012345678901234567890123456789012345678901234567890123456789012345
  377. 203 1 2 3 4 5 6 7
  378. 204 Customer Name Number Commission Rate xx.xx%
  379. 205 Cust Nbr Invoice Date Net Amount Comm % Commission
  380. 206 xxxxxxxxx xxxxxxxxxx xx-xx-xx xxxxxxx.xx xx.xx xxxxxx.xx
  381. 207 *)
  382. 208
  383. 209 MakeSubList(SalesRep); (* a list of all invoices sorted by client id*)
  384. ***** ^ not supported yet
  385. ***** ^ not supported yet
  386. 210 IF ListLength(SalesRepList) = 0
  387. ***** ^ not supported yet
  388. ***** ^ not supported yet
  389. 211 THEN DisposeList(SalesRepList);
  390. ***** ^ not supported yet
  391. ***** ^ not supported yet
  392. 212 RETURN;
  393. 213 END;
  394. 214 GetElmtAdr(SalesRepList,1,Inv,Size,Code);
  395. ***** ^ not supported yet
  396. ***** ^ not supported yet
  397. ***** ^ not supported yet
  398. ***** ^ not supported yet
  399. 215 RepTotal := 0.0;
  400. ***** ^ not supported yet
  401. 216 Page := 1;
  402. 217 LineNbr := 0;
  403. 218 PrintHeader(SalesRep,Page);
  404. ***** ^ not supported yet
  405. ***** ^ not supported yet
  406. ***** ^ not supported yet
  407. 219 CustomerTotal := 0.0;
  408. ***** ^ not supported yet
  409. 220 RepTotal := 0.0;
  410. ***** ^ not supported yet
  411. 221 SetupDisplayLine(Line,90);
  412. ***** ^ not supported yet
  413. ***** ^ not supported yet
  414. ***** ^ not supported yet
  415. 222 FOR J := 1 TO ListLength(SalesRepList) DO
  416. ***** ^ not supported yet
  417. ***** ^ not supported yet
  418. 223 INC(LineNbr);
  419. ***** ^ undeclared identifier
  420. ***** ^ not supported yet
  421. 224 IF LineNbr > 50
  422. 225 THEN
  423. 226 LineNbr := 1;
  424. 227 INC(Page);
  425. ***** ^ undeclared identifier
  426. ***** ^ not supported yet
  427. 228 PrintHeader(SalesRep,Page);
  428. ***** ^ not supported yet
  429. ***** ^ not supported yet
  430. ***** ^ not supported yet
  431. 229 END;
  432. 230
  433. 231 GetElmtAdr(SalesRepList,J,Inv,Size,Code);
  434. ***** ^ not supported yet
  435. ***** ^ not supported yet
  436. ***** ^ not supported yet
  437. ***** ^ not supported yet
  438. 232 AddPrintElemt(Line,Inv^.CUSTID,'S',2,8,'L');
  439. ***** ^ not supported yet
  440. ***** ^ not supported yet
  441. ***** ^ not supported yet
  442. ***** ^ not supported yet
  443. ***** ^ not supported yet
  444. 233 AddPrintElemt(Line,Inv^.INVOICE,'S',10,8,'L');
  445. ***** ^ not supported yet
  446. ***** ^ not supported yet
  447. ***** ^ not supported yet
  448. ***** ^ not supported yet
  449. ***** ^ not supported yet
  450. 234 AddPrintElemt(Line,Inv^.INVDATE,'D',20,8,'L');
  451. ***** ^ not supported yet
  452. ***** ^ not supported yet
  453. ***** ^ not supported yet
  454. ***** ^ not supported yet
  455. ***** ^ not supported yet
  456. 235 AddPrintElemt(Line,Inv^.INVNET,'R',30,10,'L');
  457. ***** ^ not supported yet
  458. ***** ^ not supported yet
  459. ***** ^ not supported yet
  460. ***** ^ not supported yet
  461. ***** ^ not supported yet
  462. 236 GetCustName(Inv^.CUSTID,CurrentCustName);
  463. ***** ^ not supported yet
  464. ***** ^ not supported yet
  465. ***** ^ not supported yet
  466. ***** ^ not supported yet
  467. 237 GetCustSalesRepCom(CommPerCent);
  468. ***** ^ not supported yet
  469. ***** ^ not supported yet
  470. 238 CommPerCent := CommPerCent / 100.0;
  471. ***** ^ not supported yet
  472. ***** ^ not supported yet
  473. 239 AddPrintElemt(Line,CommPerCent,'%',45,5,'L');
  474. ***** ^ not supported yet
  475. ***** ^ not supported yet
  476. ***** ^ not supported yet
  477. ***** ^ not supported yet
  478. 240 AddPrintElemt(Line,CommPerCent * Inv^.INVNET,'R',60,10,'L');
  479. ***** ^ not supported yet
  480. ***** ^ not supported yet
  481. ***** ^ not supported yet
  482. ***** ^ not supported yet
  483. ***** ^ not supported yet
  484. ***** ^ not supported yet
  485. 241 PrintDisplayLine(Line,PrtHand);
  486. ***** ^ not supported yet
  487. ***** ^ not supported yet
  488. ***** ^ not supported yet
  489. 242 ClearDisplayLine(Line);
  490. ***** ^ not supported yet
  491. ***** ^ not supported yet
  492. 243 RepTotal := RepTotal + (CommPerCent * Inv^.INVNET);
  493. ***** ^ not supported yet
  494. ***** ^ not supported yet
  495. ***** ^ not supported yet
  496. ***** ^ not supported yet
  497. ***** ^ not supported yet
  498. 244 END; (* end of sales rep invoice list *)
  499. 245 WriteEol(PrtHand,'');
  500. ***** ^ not supported yet
  501. ***** ^ not supported yet
  502. 246 WriteEol(PrtHand,'');
  503. ***** ^ not supported yet
  504. ***** ^ not supported yet
  505. 247 WriteStr(PrtHand,'Total commission for Sales Rep ');
  506. ***** ^ not supported yet
  507. ***** ^ not supported yet
  508. 248 WriteStr(PrtHand,SalesRep);
  509. ***** ^ not supported yet
  510. ***** ^ not supported yet
  511. 249 WriteStr(PrtHand,': $');
  512. ***** ^ not supported yet
  513. ***** ^ not supported yet
  514. 250 RealToStr(RepTotal,2,10,Str);
  515. ***** ^ not supported yet
  516. ***** ^ not supported yet
  517. ***** ^ not supported yet
  518. 251 WriteEol(PrtHand, Str);
  519. ***** ^ not supported yet
  520. ***** ^ not supported yet
  521. 252
  522. 253
  523. 254 (* write a list of the customers for the sales rep *)
  524. 255 SortList(SalesRepList,SortByCustNbr);
  525. ***** ^ not supported yet
  526. ***** ^ not supported yet
  527. ***** ^ not supported yet
  528. 256 WriteStr(PrtHand,12C);
  529. ***** ^ not supported yet
  530. ***** ^ not supported yet
  531. 257 WriteStr(PrtHand,' Customers for ');
  532. ***** ^ not supported yet
  533. ***** ^ not supported yet
  534. 258 WriteStr(PrtHand,SalesRep);
  535. ***** ^ not supported yet
  536. ***** ^ not supported yet
  537. 259 WriteEol(PrtHand,'');
  538. ***** ^ not supported yet
  539. ***** ^ not supported yet
  540. 260 LineNbr := 1;
  541. 261 LastCust := '';
  542. ***** ^ not supported yet
  543. ***** ^ incompatible assignment
  544. 262 FOR J := 1 TO ListLength(SalesRepList) DO
  545. ***** ^ not supported yet
  546. ***** ^ not supported yet
  547. 263 GetElmtAdr(SalesRepList,J,Inv,Size,Code);
  548. ***** ^ not supported yet
  549. ***** ^ not supported yet
  550. ***** ^ not supported yet
  551. ***** ^ not supported yet
  552. 264 GetCustName(Inv^.CUSTID,CurrentCustName);
  553. ***** ^ not supported yet
  554. ***** ^ not supported yet
  555. ***** ^ not supported yet
  556. ***** ^ not supported yet
  557. 265 IF NOT Equal(LastCust,CurrentCustName)
  558. ***** ^ not supported yet
  559. ***** ^ not supported yet
  560. ***** ^ not supported yet
  561. 266 THEN
  562. 267
  563. 268 WriteStr(PrtHand,Inv^.CUSTID);
  564. ***** ^ not supported yet
  565. ***** ^ not supported yet
  566. ***** ^ not supported yet
  567. 269 WriteStr(PrtHand,' ');
  568. ***** ^ not supported yet
  569. ***** ^ not supported yet
  570. 270 WriteEol(PrtHand,CurrentCustName);
  571. ***** ^ not supported yet
  572. ***** ^ not supported yet
  573. 271 LastCust := CurrentCustName;
  574. ***** ^ not supported yet
  575. ***** ^ not supported yet
  576. 272 END;
  577. 273 END;
  578. 274 RemoveDisplayLine(Line);
  579. ***** ^ not supported yet
  580. ***** ^ not supported yet
  581. 275
  582. 276 END ReportSalesRep;
  583. ***** ^ not supported yet
  584. 277
  585. 278 PROCEDURE ParseName(VAR Name : ARRAY OF CHAR; Str: ARRAY OF CHAR);
  586. ***** ^ not supported yet
  587. ***** ^ not supported yet
  588. 279 VAR
  589. 280 J : CARDINAL;
  590. 281 BEGIN
  591. 282 Fill(ADR(Name),SIZE(Name),0);
  592. ***** ^ not supported yet
  593. ***** ^ not supported yet
  594. ***** ^ not supported yet
  595. ***** ^ undeclared identifier
  596. ***** ^ not supported yet
  597. ***** ^ not supported yet
  598. 283 J := 0;
  599. 284 LOOP
  600. 285 IF J > Length(Str)
  601. ***** ^ not supported yet
  602. ***** ^ not supported yet
  603. 286 THEN EXIT;
  604. 287 END;
  605. 288 IF J > SIZE(Name)
  606. ***** ^ undeclared identifier
  607. ***** ^ not supported yet
  608. 289 THEN EXIT;
  609. 290 END;
  610. 291 IF Str[J] = ' '
  611. ***** ^ not supported yet
  612. ***** ^ not supported yet
  613. 292 THEN EXIT;
  614. 293 END;
  615. 294 Name[J] := Str[J];
  616. ***** ^ not supported yet
  617. ***** ^ not supported yet
  618. ***** ^ not supported yet
  619. ***** ^ not supported yet
  620. 295 INC(J);
  621. ***** ^ undeclared identifier
  622. ***** ^ not supported yet
  623. 296 END; (* end loop *)
  624. 297 CAPstr(Name);
  625. ***** ^ not supported yet
  626. ***** ^ not supported yet
  627. 298 END ParseName;
  628. ***** ^ not supported yet
  629. 299
  630. 300 PROCEDURE GetSalesReps();
  631. 301 (* read a list of the sales reps into the linked sales rep list *)
  632. 302 VAR J : CARDINAL;
  633. 303 Code : CARDINAL;
  634. 304 L : LONGINT;
  635. 305 TheList : GenList;
  636. 306 Str : ARRAY[0..80] OF CHAR;
  637. ***** ^ not supported yet
  638. ***** ^ not supported yet
  639. 307 SalesRep : ARRAY[0..15] OF CHAR;
  640. ***** ^ not supported yet
  641. ***** ^ not supported yet
  642. 308 EM : CARDINAL;
  643. 309 BEGIN
  644. 310
  645. 311 EM := OpenFile(PrtHand,Config.ReportPrt);
  646. ***** ^ not supported yet
  647. ***** ^ not supported yet
  648. ***** ^ not supported yet
  649. 312 SalesRep := 'SalesRep.txt'; (* temp till file open *)
  650. ***** ^ not supported yet
  651. ***** ^ not supported yet
  652. 313 NewList(TheList);
  653. ***** ^ not supported yet
  654. ***** ^ not supported yet
  655. 314 EM := TextFileToList(SalesRep,TheList);
  656. ***** ^ not supported yet
  657. ***** ^ not supported yet
  658. ***** ^ not supported yet
  659. 315 GetMainList();
  660. ***** ^ not supported yet
  661. ***** ^ not supported yet
  662. 316 FOR J := 1 TO ListLength(TheList) DO
  663. ***** ^ not supported yet
  664. ***** ^ not supported yet
  665. 317 GetElmt(TheList,J,Str,Code); (* get the string*)
  666. ***** ^ not supported yet
  667. ***** ^ not supported yet
  668. ***** ^ not supported yet
  669. ***** ^ not supported yet
  670. 318 ParseName(SalesRep,Str);
  671. ***** ^ not supported yet
  672. ***** ^ not supported yet
  673. ***** ^ not supported yet
  674. 319 ReportSalesRep(SalesRep);
  675. ***** ^ not supported yet
  676. ***** ^ not supported yet
  677. 320 END;
  678. 321 DisposeList(TheList);
  679. ***** ^ not supported yet
  680. ***** ^ not supported yet
  681. 322 EM := CloseHandle(PrtHand);
  682. ***** ^ not supported yet
  683. ***** ^ not supported yet
  684. 323 END GetSalesReps;
  685. ***** ^ not supported yet
  686. 324
  687. 325
  688. 326 PROCEDURE CreateEditSalesReps();
  689. 327 (* sales reps are stored in a simple text file, one sales rep per line
  690. 328 Any information after the reps invoice name is kept but ignored
  691. 329 in the processing *)
  692. 330 VAR
  693. 331 TheList : GenList;
  694. 332 DF : DisplayFrame;
  695. 333 FileHandle : CARDINAL;
  696. 334 EditorRec : AnEdControlRec;
  697. 335 Str : ARRAY[0..15] OF CHAR;
  698. ***** ^ not supported yet
  699. ***** ^ not supported yet
  700. 336 EM : CARDINAL;
  701. 337 BEGIN
  702. 338 NewList(TheList);
  703. ***** ^ not supported yet
  704. ***** ^ not supported yet
  705. 339 Str := 'SalesRep.Txt';
  706. ***** ^ not supported yet
  707. ***** ^ not supported yet
  708. 340 IF FileExists(Str)
  709. ***** ^ not supported yet
  710. ***** ^ not supported yet
  711. 341 THEN
  712. 342 EM := TextFileToList(Str,TheList);
  713. ***** ^ not supported yet
  714. ***** ^ not supported yet
  715. ***** ^ not supported yet
  716. 343 END;
  717. 344 InitEdRec(EditorRec);
  718. ***** ^ not supported yet
  719. ***** ^ not supported yet
  720. 345 InitDisplayFrame(DF,CurrentWindow);
  721. ***** ^ not supported yet
  722. ***** ^ not supported yet
  723. ***** ^ not supported yet
  724. 346 AddEditorField(DF,TheList,EditorRec);
  725. ***** ^ not supported yet
  726. ***** ^ not supported yet
  727. ***** ^ not supported yet
  728. ***** ^ not supported yet
  729. 347 Control(DF);
  730. ***** ^ not supported yet
  731. ***** ^ not supported yet
  732. 348 GetEdField(DF,'',TheList);
  733. ***** ^ not supported yet
  734. ***** ^ not supported yet
  735. ***** ^ not supported yet
  736. 349 EM := TextListToFile(TheList,Str);
  737. ***** ^ not supported yet
  738. ***** ^ not supported yet
  739. ***** ^ not supported yet
  740. 350
  741. 351 END CreateEditSalesReps;
  742. ***** ^ not supported yet
  743. 352 PROCEDURE ProduceCommissions();
  744. 353 BEGIN
  745. 354
  746. 355 OpenCustomerDBF(TRUE);
  747. ***** ^ not supported yet
  748. ***** ^ not supported yet
  749. 356 GetSalesReps();
  750. ***** ^ not supported yet
  751. ***** ^ not supported yet
  752. 357 END ProduceCommissions;
  753. ***** ^ not supported yet
  754. 358 END SalesReps.
  755. ***** ^ not supported yet
  756. 396 errors