PAYMENTS.LST 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. Listing:
  2. 1 IMPLEMENTATION MODULE Payments;
  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 ModBase3 IMPORT UpdateDBFile,WriteDBRec,DeleteRecord,ReadDBRec,
  14. 13 AppendBlank;
  15. 14 FROM PMIGlobals IMPORT NormalTitle,OpenReportDevice,CloseReportDevice;
  16. 15 FROM DateFunctions IMPORT Date,DaysSince1900,DateToStr;
  17. 16 FROM ScrnUtl2 IMPORT CloseDisplayFrame;
  18. 17 FROM Customer IMPORT GetCurrCustName;
  19. 18 FROM DBStuff IMPORT FindAll,ReadAllRecs,ConditionType;
  20. 19 FROM ScrnUtl1 IMPORT GetFieldRec,PutFieldRec,FieldNum,FieldListTotal;
  21. 20 FROM FramePainter IMPORT ShowDisplayFrame;
  22. 21 FROM DBUtils IMPORT PrintFrame;
  23. 22 FROM NumTypes IMPORT Real8;
  24. 23 FROM StrEdit IMPORT CrunchBlanks,OverWrite,Append;
  25. 24 FROM M2Strings IMPORT CompareStr,Assign;
  26. 25 FROM PosUtils IMPORT Equal;
  27. 26 FROM StrConv IMPORT RealToStr;
  28. 27 FROM SmartScreen IMPORT ClearScreen;
  29. 28 FROM VStorage IMPORT DosAlloc;
  30. 29 FROM VWindows IMPORT ClearPart, CurrentWindow, SetCursorHeight;
  31. 30 FROM ScrnTypes IMPORT DisplayFrame,InputFieldRecord,InitDisplayFrame,
  32. 31 AFrameName,DispCode;
  33. 32 FROM InputManager IMPORT ControlFrame;
  34. 33 FROM FrameManager IMPORT EraseFrame;
  35. 34 FROM Prompts IMPORT Prompt,PromptStr,PromptYN;
  36. 35 FROM SYSTEM IMPORT ADR,SIZE,ADDRESS;
  37. 36 FROM ControlUtils IMPORT ControlSeparately, LoadFrameList,Control,
  38. 37 AddStrField,AddMenuItem;
  39. 38 FROM DspFiles IMPORT OpenDisplayFile,ReadDisplayFrame;
  40. 39 FROM HandleIO IMPORT FileExists;
  41. 40 FROM LowLevel IMPORT Fill;
  42. 41 FROM GenLists IMPORT GenList, NewList,ListLength,SortList,
  43. 42 GetElmt,GetElmtAdr,DisposeList,NilList;
  44. 43 FROM DBFPayments IMPORT PaymentsDBF, OpenPaymentsDBF,CustidIdx,
  45. 44 ClosePaymentsDBF,PaymentsRec,MovePaymentsToDBF,MovePaymentsFromDBF;
  46. 45
  47. 46
  48. 47
  49. 48 PROCEDURE MakePayment(InvoiceNbr : ARRAY OF CHAR;
  50. ***** ^ not supported yet
  51. 49 Pmtdate : Date;
  52. 50 PmtAmt : Real8;
  53. 51 CheckNbr : ARRAY OF CHAR;
  54. ***** ^ not supported yet
  55. 52 CustID : ARRAY OF CHAR);
  56. ***** ^ not supported yet
  57. 53 VAR
  58. 54 Payment :PaymentsRec;
  59. 55 BEGIN
  60. 56 IF PmtAmt < 0.01 (* don't add zero payments *)
  61. ***** ^ not supported yet
  62. 57 THEN RETURN;
  63. 58 END;
  64. 59 WITH Payment DO
  65. ***** ^ not supported yet
  66. 60 Assign( InvoiceNbr,INVOICE );
  67. ***** ^ not supported yet
  68. ***** ^ not supported yet
  69. ***** ^ undeclared identifier
  70. 61 PMTDATE := Pmtdate;
  71. ***** ^ undeclared identifier
  72. ***** ^ not supported yet
  73. 62 PMTAMT := PmtAmt;
  74. ***** ^ undeclared identifier
  75. ***** ^ not supported yet
  76. 63 Assign(CheckNbr,CHECKNB );
  77. ***** ^ not supported yet
  78. ***** ^ not supported yet
  79. ***** ^ undeclared identifier
  80. 64 Assign( CustID,CUSTID);
  81. ***** ^ not supported yet
  82. ***** ^ not supported yet
  83. ***** ^ undeclared identifier
  84. 65 END;
  85. ***** ^ not supported yet
  86. 66 AppendBlank(PaymentsDBF);
  87. ***** ^ not supported yet
  88. ***** ^ not supported yet
  89. 67 MovePaymentsToDBF(Payment);
  90. ***** ^ not supported yet
  91. ***** ^ undeclared identifier
  92. 68 WriteDBRec(PaymentsDBF);
  93. ***** ^ not supported yet
  94. ***** ^ not supported yet
  95. 69
  96. 70 END MakePayment;
  97. ***** ^ not supported yet
  98. 71
  99. 72 PROCEDURE ReadARec(VAR AddressOfRec : ADDRESS; VAR SizeOfRec : CARDINAL);
  100. 73 VAR
  101. 74 P : POINTER TO PaymentsRec;
  102. ***** ^ not supported yet
  103. 75 BEGIN
  104. 76 SizeOfRec := SIZE(P^);
  105. ***** ^ not supported yet
  106. ***** ^ not supported yet
  107. 77 DosAlloc(P,SizeOfRec);
  108. ***** ^ not supported yet
  109. ***** ^ not supported yet
  110. ***** ^ not supported yet
  111. 78 MovePaymentsFromDBF(P^);
  112. ***** ^ not supported yet
  113. ***** ^ not supported yet
  114. 79 AddressOfRec := P;
  115. ***** ^ not supported yet
  116. ***** ^ not supported yet
  117. 80 END ReadARec;
  118. ***** ^ not supported yet
  119. 81
  120. 82 PROCEDURE SortByDate(P1 : ADDRESS; C1 :CARDINAL;
  121. 83 P2 : ADDRESS; C2 : CARDINAL): INTEGER;
  122. 84
  123. 85 (* sort by invoice then payment date within invoice *)
  124. 86 VAR
  125. 87 Pymt1,Pymt2 : POINTER TO PaymentsRec;
  126. ***** ^ not supported yet
  127. 88 Days1,Days2 : CARDINAL;
  128. 89 BEGIN
  129. 90 Pymt1 := P1;
  130. ***** ^ not supported yet
  131. ***** ^ not supported yet
  132. 91 Pymt2 := P2;
  133. ***** ^ not supported yet
  134. ***** ^ not supported yet
  135. 92 IF Equal(Pymt1^.INVOICE,Pymt2^.INVOICE)
  136. ***** ^ not supported yet
  137. ***** ^ not supported yet
  138. ***** ^ not supported yet
  139. ***** ^ not supported yet
  140. ***** ^ not supported yet
  141. 93 THEN
  142. 94 Days1 := DaysSince1900(Pymt1^.PMTDATE);
  143. ***** ^ not supported yet
  144. ***** ^ not supported yet
  145. ***** ^ not supported yet
  146. 95 Days2 := DaysSince1900(Pymt2^.PMTDATE);
  147. ***** ^ not supported yet
  148. ***** ^ not supported yet
  149. ***** ^ not supported yet
  150. 96 IF Days1 < Days2
  151. 97 THEN RETURN -1
  152. 98 ELSIF
  153. 99 Days1 > Days2
  154. 100 THEN RETURN 1
  155. 101 ELSE RETURN 0
  156. 102 END;
  157. 103 ELSE
  158. 104 RETURN CompareStr(Pymt1^.INVOICE,Pymt2^.INVOICE);
  159. ***** ^ not supported yet
  160. ***** ^ not supported yet
  161. ***** ^ not supported yet
  162. ***** ^ not supported yet
  163. ***** ^ not supported yet
  164. 105 END;
  165. 106
  166. 107 END SortByDate;
  167. ***** ^ not supported yet
  168. 108 PROCEDURE ShowPaymentHist(CustID : ARRAY OF CHAR);
  169. ***** ^ not supported yet
  170. 109 VAR Payment : POINTER TO PaymentsRec;
  171. ***** ^ not supported yet
  172. 110 Lst : GenList;
  173. 111 Cnt : CARDINAL;
  174. 112 Handle : CARDINAL;
  175. 113 Size, Code : CARDINAL;
  176. 114 DF : DisplayFrame;
  177. 115 B : BOOLEAN;
  178. 116 Str : ARRAY[0..10] OF CHAR;
  179. ***** ^ not supported yet
  180. ***** ^ not supported yet
  181. 117 Title1 : ARRAY[0..80] OF CHAR;
  182. ***** ^ not supported yet
  183. ***** ^ not supported yet
  184. 118 FieldRec : InputFieldRecord;
  185. 119 Line : ARRAY[0..65] OF CHAR;
  186. ***** ^ not supported yet
  187. ***** ^ not supported yet
  188. 120 CONST
  189. 121 Title = ' Invoice Pymt Date Amount Check Number ';
  190. ***** ^ not supported yet
  191. 122
  192. 123 BEGIN
  193. 124 OpenPaymentsDBF(TRUE);
  194. ***** ^ not supported yet
  195. ***** ^ not supported yet
  196. 125 CrunchBlanks(CustID);
  197. ***** ^ not supported yet
  198. ***** ^ not supported yet
  199. 126 NilList(Lst);
  200. ***** ^ not supported yet
  201. ***** ^ not supported yet
  202. 127 FindAll(CustidIdx,CustID,EQ,Lst);
  203. ***** ^ not supported yet
  204. ***** ^ not supported yet
  205. ***** ^ not supported yet
  206. ***** ^ undeclared identifier
  207. ***** ^ not supported yet
  208. 128 ReadAllRecs(PaymentsDBF,ReadARec,Lst);
  209. ***** ^ not supported yet
  210. ***** ^ not supported yet
  211. ***** ^ not supported yet
  212. ***** ^ not supported yet
  213. 129 ClosePaymentsDBF();
  214. ***** ^ not supported yet
  215. ***** ^ not supported yet
  216. 130 IF ListLength(Lst) = 0 (* some tanks are outstanding *)
  217. ***** ^ not supported yet
  218. ***** ^ not supported yet
  219. 131 THEN
  220. 132 DisposeList(Lst);
  221. ***** ^ not supported yet
  222. ***** ^ not supported yet
  223. 133 Prompt('No payment history');
  224. ***** ^ not supported yet
  225. ***** ^ not supported yet
  226. 134 RETURN;
  227. 135 END;
  228. 136
  229. 137 SortList(Lst,SortByDate);
  230. ***** ^ not supported yet
  231. ***** ^ not supported yet
  232. ***** ^ not supported yet
  233. 138
  234. 139 (* 1 2 3 4
  235. 140 01234567890123456789012345678901234567890123456780
  236. 141 Invoice Date Amount Check Number Date
  237. 142 *)
  238. 143
  239. 144 InitDisplayFrame(DF,CurrentWindow);
  240. ***** ^ not supported yet
  241. ***** ^ not supported yet
  242. ***** ^ not supported yet
  243. 145 AddStrField(DF,2,2,Title,55);
  244. ***** ^ not supported yet
  245. ***** ^ not supported yet
  246. ***** ^ not supported yet
  247. ***** ^ not supported yet
  248. 146 GetFieldRec(DF,1,FieldRec);
  249. ***** ^ not supported yet
  250. ***** ^ not supported yet
  251. ***** ^ not supported yet
  252. 147 FieldRec.typ := DispCode; (* headline = display code *)
  253. ***** ^ not supported yet
  254. ***** ^ not supported yet
  255. ***** ^ not supported yet
  256. 148 PutFieldRec(FieldRec,DF,1);
  257. ***** ^ not supported yet
  258. ***** ^ not supported yet
  259. ***** ^ not supported yet
  260. ***** ^ not supported yet
  261. 149 DF^.headline := 2;
  262. ***** ^ not supported yet
  263. ***** ^ not supported yet
  264. 150
  265. 151
  266. 152 FOR Cnt := 1 TO ListLength(Lst) DO
  267. ***** ^ not supported yet
  268. ***** ^ not supported yet
  269. 153 GetElmtAdr(Lst,Cnt,Payment,Size,Code);
  270. ***** ^ not supported yet
  271. ***** ^ not supported yet
  272. ***** ^ not supported yet
  273. ***** ^ not supported yet
  274. 154 Fill(ADR(Line),SIZE(Line),' ');
  275. ***** ^ not supported yet
  276. ***** ^ not supported yet
  277. ***** ^ not supported yet
  278. ***** ^ not supported yet
  279. ***** ^ not supported yet
  280. ***** ^ not supported yet
  281. 155 OverWrite(Payment^.INVOICE,Line,1);
  282. ***** ^ not supported yet
  283. ***** ^ not supported yet
  284. ***** ^ not supported yet
  285. ***** ^ not supported yet
  286. ***** ^ not supported yet
  287. 156 DateToStr(Payment^.PMTDATE,Str,B);
  288. ***** ^ not supported yet
  289. ***** ^ not supported yet
  290. ***** ^ not supported yet
  291. ***** ^ not supported yet
  292. ***** ^ not supported yet
  293. 157 OverWrite(Str,Line,12);
  294. ***** ^ not supported yet
  295. ***** ^ not supported yet
  296. ***** ^ not supported yet
  297. ***** ^ not supported yet
  298. 158 RealToStr(Payment^.PMTAMT,2,8,Str);
  299. ***** ^ not supported yet
  300. ***** ^ not supported yet
  301. ***** ^ not supported yet
  302. ***** ^ not supported yet
  303. 159 OverWrite(Str,Line,22);
  304. ***** ^ not supported yet
  305. ***** ^ not supported yet
  306. ***** ^ not supported yet
  307. ***** ^ not supported yet
  308. 160 OverWrite(Payment^.CHECKNB,Line,33);
  309. ***** ^ not supported yet
  310. ***** ^ not supported yet
  311. ***** ^ not supported yet
  312. ***** ^ not supported yet
  313. ***** ^ not supported yet
  314. 161 AddMenuItem(DF,2,Cnt+2,Line,70,0,' ');
  315. ***** ^ not supported yet
  316. ***** ^ not supported yet
  317. ***** ^ not supported yet
  318. ***** ^ not supported yet
  319. 162 END;
  320. 163 ShowDisplayFrame(DF,1,13,80,24);
  321. ***** ^ not supported yet
  322. ***** ^ not supported yet
  323. ***** ^ not supported yet
  324. 164 Control(DF);
  325. ***** ^ not supported yet
  326. ***** ^ not supported yet
  327. 165 IF PromptYN(' Print the report ',DF)
  328. ***** ^ not supported yet
  329. ***** ^ not supported yet
  330. ***** ^ not supported yet
  331. 166 THEN
  332. 167 GetCurrCustName(Title1);
  333. ***** ^ not supported yet
  334. ***** ^ not supported yet
  335. 168 Append(Title1,' - Payments ');
  336. ***** ^ not supported yet
  337. ***** ^ not supported yet
  338. ***** ^ not supported yet
  339. 169 NormalTitle(Title1);
  340. ***** ^ not supported yet
  341. ***** ^ not supported yet
  342. 170 Handle := OpenReportDevice();
  343. ***** ^ not supported yet
  344. ***** ^ not supported yet
  345. 171 PrintFrame(DF,Handle);
  346. ***** ^ not supported yet
  347. ***** ^ not supported yet
  348. ***** ^ not supported yet
  349. 172 CloseReportDevice(Handle);
  350. ***** ^ not supported yet
  351. ***** ^ not supported yet
  352. 173 END;
  353. 174 CloseDisplayFrame(DF);
  354. ***** ^ not supported yet
  355. ***** ^ not supported yet
  356. 175
  357. 176
  358. 177 END ShowPaymentHist;
  359. ***** ^ not supported yet
  360. 178
  361. 179
  362. 180 PROCEDURE ManagePaymentFile();
  363. 181 END ManagePaymentFile;
  364. ***** ^ not supported yet
  365. 182
  366. 183
  367. 184 END Payments.
  368. ***** ^ not supported yet
  369. 183 errors