home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / SIMTEL / CPMUG / CPMUG090.ARK / GLTBAL.BAS < prev    next >
BASIC Source File  |  1984-04-29  |  6KB  |  204 lines

  1.      rem This is the General Ledger Trial Balance Printer
  2.  
  3. %INCLUDE ALL.BAS
  4.      dim n(2,12),k$(2,10),h(9),s(9),t(4,9)
  5.      RESTORE
  6. 1025 PRINT clear$:PRINT
  7.     A(9)=0
  8. 1050 Q$="G E N E R A L  L E D G E R  T R I A L  B A L A N C E"
  9. 3000 rem READ NAME FILE SUBROUTINE
  10. 3005 a5=t%(12)
  11. 3080 Z=24:Z9=1
  12. 3090 FOR Z0=1 TO 4
  13. 3100 K$(0,Z0)=MID$(N$,Z9,Z)
  14. 3110 Z9=Z9+Z
  15. 3120 NEXT Z0
  16. 3125 rem ROUTINE TO ELIMINATE TRAILING BLANKS
  17.      l8=1
  18. 3130 FOR I=1 TO 4
  19.      l9=len(K$(0,I))
  20. 3140 FOR Z=l9 to l8 STEP -1
  21. 3150 IF MID$(K$(0,I),Z,1)<>" " THEN 3170
  22. 3160 NEXT Z
  23. 3170 Z$=""
  24. 3180 FOR Z0=1 TO Z
  25. 3190 Z$=Z$+MID$(K$(0,I),Z0,1)
  26. 3200 NEXT Z0
  27. 3210 K$(0,I)="":K$(0,I)=Z$
  28. 3220 NEXT I
  29. 6000 rem PRINT TRIAL BALANCE
  30. 6005 PRINT clear$:PRINT
  31. 6010 PRINT "PRINTING TRIAL BALANCE"
  32. 6015 FOR Z=0 TO 9
  33. 6020 H(Z)=0:S(Z)=0:T(0,Z)=0:T(1,Z)=0:T(2,Z)=0:T(3,Z)=0:A(Z)=0
  34. 6025 NEXT Z
  35.      lprinter
  36.      open "b:gl" recl 138 as 1
  37.      open "b:glh" recl 150 as 2 
  38.      open "b:gls" recl 150 as 3
  39.      p9=0
  40. 6200 GOSUB 9600
  41. 6250 GOSUB 10000
  42. 6300 GOSUB 11000
  43. 6350 GOSUB 15000
  44. 6400 rem DO PARTIAL TOTALS OR TOTALS AND TEST
  45. 6402 IF N(2,2)=0 THEN GOSUB 16000
  46.     if n(2,2)=0 then gosub 30000
  47. 6403 IF N(2,2)=0 THEN FOR Z=1 TO 56-P9:print:NEXT Z:GOSUB 9800
  48. 6405 IF N(2,2)=0 THEN 20000
  49. 6410 GOSUB 13000
  50. 6415 IF P9>56 THEN GOSUB 9700
  51. 6420 IF S(1)< H(1) THEN 6300
  52. 6430 IF S(1)=H(1) THEN GOSUB 12000
  53. 6450 GOTO 6250
  54. 9600 rem PRINT PAGE HEADING SUBROUTINE
  55. 9605 P0=1
  56.     GOSUB 9610
  57.     RETURN
  58. 9610 print :P9=P9+1
  59. 9615 print:P9=P9+1
  60. 9616 print TAB((t%(1)-LEN(Q$))/2);Q$:P9=P9+1
  61. 9617 print:P9=P9+1
  62. 9620 FOR Z=2 TO 4
  63. 9625 print TAB((t%(1)-LEN(K$(0,Z)))/2);K$(0,Z):P9=P9+1
  64. 9630 NEXT Z
  65. 9635 print:P9=P9+1
  66. 9640 print TAB(t%(10));D$(1);TAB(t%(11));"PAGE #";P0:P9=P9+1
  67. 9645 print :P9=P9+1
  68. 9650 print:P9=P9+1
  69. 9652 print TAB(6);"ACCOUNT #";TAB(20);"DESCRIPTION"
  70. 9655 print TAB(6);"DEBIT";TAB(26);"CREDIT";tab(56);"ADJUSTMENT"
  71. 9660 P9=P9+2
  72. 9665 print :P9=P9+1
  73. 9670 RETURN
  74. 9700 rem REPORT CONTINUED SUBROUTINE
  75. 9705 print
  76. 9710 print "report continues on next page"
  77. 9715 print
  78. 9720 print chr$(12):P9=0
  79. 9725 P0=P0+1
  80.     GOSUB 9610
  81. 9740 RETURN
  82. 9800 rem END OF REPORT ROUTINE
  83. 9810 print
  84. 9820 print "end of report"
  85. 9830 print
  86. 9840 print chr$(12)
  87. 9850 RETURN
  88. 10000 rem GET HEADING LINE AND PRINT
  89. 10005 H(9)=H(9)+1
  90. 10006 if p9>56 then gosub 9700
  91.       read #2,h(9);n(2,1),n(2,2),h$,h(0),h(1),h(2),h(3),\
  92.            h(4),h(5),h(6),h(7)
  93. 10015 print TAB(t%(4));mid$(h$,3,28):P9=P9+1
  94. 10995 RETURN
  95. 11000 rem GET SUBHEADING LINE AND PRINT
  96. 11005 S(9)=S(9)+1
  97. 11006 if p9>56 then gosub 9700
  98.       read #3,s(9);n(2,1),n(2,2),s$,s(0),s(1),s(2),s(3),\
  99.            s(4),s(5),s(6),s(7)
  100. 11015 print TAB(t%(5));mid$(s$,3,28):P9=P9+1
  101. 11995 RETURN
  102. 12000 rem PRINT FINAL TOTAL
  103.     print
  104. 12200 IF T4>=0 THEN 12305
  105. 12205 Z=26
  106. 12210 print TAB(6);"TOTAL "+MID$(H$,3,20)
  107. 12212 print TAB(Z);:print using l$;t4;
  108. 12216 print tab(66);"**************"
  109. 12217 print:print
  110. 12220 P9=P9+5
  111. 12225 GOTO 12990
  112. 12305 Z=6
  113. 12310 print TAB(6);"TOTAL "+MID$(H$,3,20)
  114. 12312 print TAB(Z);:print using l$;t4;
  115. 12316 print tab(66);"**************"
  116. 12317 print:print
  117. 12320 P9=P9+5
  118. 12990    h(2)=T4
  119.       print #2,h(9);n(2,1),n(2,2),h$,h(0),h(1),h(2),h(3),\
  120.            h(4),h(5),h(6),h(7)
  121.     T4=0
  122. 12995 RETURN
  123. 13000 rem PRINT SUBTOTALS
  124.     print
  125. 13200 IF T3>=0 THEN 13305
  126. 13205 Z=26
  127. 13210 print TAB(6);"TOTAL "+MID$(S$,3,20)
  128. 13213 print TAB(Z);:print using l$;t3;
  129. 13216 print tab(61);"=============="
  130. 13217 print
  131. 13220 P9=P9+4
  132. 13225 GOTO 13990
  133. 13305 Z=6
  134. 13310 print TAB(6);"TOTAL "+MID$(S$,3,20)
  135. 13313 print TAB(Z);:print using l$;t3;
  136. 13316 print tab(61);"=============="
  137. 13317 print
  138. 13320 P9=P9+4
  139. 13990    s(2)=T3
  140.       print #3,s(9);n(2,1),n(2,2),s$,s(0),s(1),s(2),s(3),\
  141.            s(4),s(5),s(6),s(7)
  142.     T3=0
  143. 13995 RETURN
  144. 15000 rem GET ACCOUNTS IN SUBHEAD RANGE AND PRINT
  145. 15005 A(9)=A(9)+1
  146. 15006 IF P9>56 THEN GOSUB 9700
  147.       read #1,a(9);n(2,1),n(2,2),k$(1,3),n(2,4),n(2,5),n(2,6),\
  148.            n(2,7),n(2,8),n(2,9),n(2,10)
  149. 15105 IF N(2,2)=0 THEN 15995
  150.     if n(2,4)=0 then 15990
  151. 15200 IF N(2,4)>=0 THEN 15305
  152. 15205 Z=26
  153. 15210 print TAB(6);N(2,2);TAB(26);K$(1,3)
  154. 15215 print TAB(Z);:print using l$;n(2,4);
  155. 15216 print tab(56);"--------------"
  156. 15220 T2=T2+N(2,4):T3=T3+N(2,4):T4=T4+N(2,4):P9=P9+3
  157. 15225 GOTO 15990
  158. 15305 Z=6
  159. 15310 print TAB(6);N(2,2);TAB(26);K$(1,3)
  160. 15315 print TAB(Z);:print using l$;n(2,4);
  161. 15316 print tab(56);"--------------"
  162. 15320 T1=T1+N(2,4):T3=T3+N(2,4):T4=T4+N(2,4):P9=P9+3
  163. 15990 IF N(2,2)< S(1) THEN 15005
  164. 15995 RETURN
  165. 16000 print "TOTALS AND DIFFERENCE"
  166. 16055 print using l$;tab(6);t1;tab(26);t2;tab(46);t1+t2
  167. 16995 RETURN
  168. 20000 rem ROUTINE TO CLOSE FILES AND RETURN TO BIZMII
  169. 20010 close 1
  170. 20020 close 2
  171. 20030 close 3
  172.        console
  173. 20050 chain "master1"
  174.  
  175.  
  176.  
  177. 30000 print chr$(12)
  178.     s(9)=1:h(9)=1
  179.     print "Summary of Trial Balance Headings and Subheadings"
  180.     print
  181.     p9=2
  182. 30010      read #2,h(9);n(2,1),n(2,2),h$,h(0),h(1),h(2),h(3),\
  183.            h(4),h(5),h(6),h(7)
  184.     if n(2,2)=0 then return
  185.     print mid$(h$,3,28):print:p9=p9+2
  186. 30020      read #3,s(9);n(2,1),n(2,2),s$,s(0),s(1),s(2),s(3),\
  187.            s(4),s(5),s(6),s(7)
  188.     print tab(5);"Total ";mid$(s$,3,28);tab(56);
  189.         print using l$;s(2)
  190.         s(2)=0:p9=p9+1
  191.       print #3,s(9);n(2,1),n(2,2),s$,s(0),s(1),s(2),s(3),\
  192.            s(4),s(5),s(6),s(7)
  193.         s(9)=s(9)+1
  194.         if s(1)<h(1) then 30020
  195.         print
  196.     print tab(10);"Total ";mid$(h$,3,28);tab(66);
  197.         print using l$;h(2)
  198.     print:print
  199.         h(2)=0:p9=p9+4
  200.       print #2,h(9);n(2,1),n(2,2),h$,h(0),h(1),h(2),h(3),\
  201.            h(4),h(5),h(6),h(7)
  202.         h(9)=h(9)+1
  203.         goto 30010
  204.