home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
database
/
ledgers.lbr
/
LREPORT.CZD
/
LREPORT.CMD
Wrap
OS/2 REXX Batch file
|
1987-05-10
|
8KB
|
300 lines
NOTE * Program...: LREPORT.CMD
NOTE * Version...: 2.0
NOTE * Author....: Terry Hazen
NOTE * Date......: 12/06/85
NOTE * Notice....: Copyright (c) 1985, n/SYSTEMS
STORE ' ' TO rname
STORE 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC' TO rdateck
STORE 'January February March April May June July August SeptemberOctober November December ' TO rtmonths
@ 18,00 SAY &setoend
@ 16,00 SAY '='
? &tstatline
DISPLAY FILES LIKE *.RPT
STORE ' ' TO rok
@ 22,00 SAY 'Existing report filenames are shown above. New '
@ $,$+1 SAY 'reports overwrite existing '
@ 23,00 SAY 'reports of the same name. '
@ $,$+1 SAY 'Hit any key to continue...' GET rok
READ
STORE ' ' TO rmenu
@ 18,00 SAY &setoend
@ 21,08 SAY 'C - List of Checks'
@ 21,31 SAY 'D - Detailed Report'
@ 21,54 SAY 'S - Summary Report'
DO WHILE .NOT. rmenu$'DSC'
@ 23,16 SAY 'Select Choice: ' GET rmenu PICTURE '!'
READ
@ 23,00
CLEAR GETS
DO CASE
CASE rmenu = 'D'
STORE 'This will be a Detailed Report' TO rtp
STORE 'D E T A I L E D R E P O R T' TO rline1
STORE $(STR(0,80),1,45) TO rline
STORE 'D' TO rtype
CASE rmenu = 'S'
STORE 'This will be a Summary Report' TO rtp
STORE 'S U M M A R Y R E P O R T' TO rline1
STORE $(STR(0,80),1,37) TO rline
STORE 'S' TO rtype
CASE rmenu = 'C'
STORE 'This will be a list of 'TO rtp
STORE 'Checks written' TO rby
STORE 'L I S T O F C H E C K S' TO rline1
STORE $(STR(0,80),1,45) TO rline
STORE 'CKS' TO rtype
STORE '-' TO rn2
OTHE
STORE ' ' TO rmenu
ENDC
ENDD
IF rtype # 'CKS'
STORE ' ' TO rmenu
@ 18,00 SAY &setoend
@ 19,00 SAY rtp + ':'
@ 21,08 SAY 'A - by Account'
@ 21,31 SAY 'B - by Account AND'
@ 21,54 SAY 'C - by Category'
@ 22,31 SAY ' Category'
DO WHILE .NOT. rmenu$'ABC'
@ 23,16 SAY 'Select Choice: ' GET rmenu PICTURE '!'
READ
@ 23,00
CLEAR GETS
DO CASE
CASE rmenu = 'A'
STORE ', by Account' TO rby
STORE 'A-' TO rn2
CASE rmenu = 'C'
STORE ', by Category' TO rby
STORE 'C-' TO rn2
CASE rmenu = 'B'
STORE ', by Account and Category' TO rby
STORE 'AC-' TO rn2
OTHE
STORE ' ' TO rmenu
ENDC
ENDD
ENDI
STORE ' ' TO rmenu
@ 18,00 SAY &setoend
@ 19,00 SAY rtp + rby + ':'
@ 21,08 SAY 'M - for the Month of...'
@ 21,54 SAY 'Y - for the Year-to-Date'
IF rtype = 'S'
@ 22,31 SAY 'E - for each Month-to-Date'
ENDI
DO WHILE .NOT. rmenu$'EMY'
@ 23,16 SAY 'Select Choice: ' GET rmenu PICTURE '!'
READ
@ 23,00
CLEAR GETS
DO CASE
CASE rmenu = 'M'
STORE ' ' TO rmonth
DO WHILE .NOT. rmonth$rdateck
@ 21,50 SAY &setoend
@ 21,31 GET rmonth PICTURE '!!!'
READ
CLEAR GETS
STORE !(rmonth) TO rmonth
ENDD
STORE ', for the month of ' + rmonth + '.' TO rper
STORE 'F O R T H E M O N T H O F ' TO rline2
STORE 'M' TO rperiod
STORE rmonth TO rn3
CASE rmenu = 'E'
IF rtype = 'S'
STORE ', for each Month-to-Date.' TO rper
STORE 'F O R T H E M O N T H O F ' TO reline2
STORE 'E' TO rperiod
STORE 'MTD' TO rn3
ELSE
STORE ' ' TO rmenu
LOOP
ENDI
CASE rmenu = 'Y'
STORE ', for the Year-to-Date.' TO rper
STORE 'F O R T H E Y E A R T O D A T E . . .'TO rline2
STORE 'Y' TO rperiod
STORE 'YTD' TO rn3
OTHE
STORE ' ' TO rmenu
ENDC
ENDD
@ 18,00 SAY &setoend
@ 19,00 SAY rtp + rby + rper
STORE mledger + rtype + rn2 + rn3 + '.RPT' TO rname
@ 20,00 SAY &setoend
@ 21,00 SAY 'This Report will be saved to Filename: ' + rname
STORE ' ' TO rok
@ 23,00 SAY "Enter 'C' to compile this report or <RET> to "
@ $,$+1 SAY 'return to the Main Menu...' GET rok PICTURE '!'
READ
IF rok # 'C'
STORE ' ' TO rname
ENDI
IF rname # ' '
@ 23,00
@ 23,00 SAY 'Compiling the report...'
?
DO CASE
CASE rperiod = 'Y'
STORE 'l:account' TO rindex1
STORE '$(l:category,1,1) + STR(#,3)' TO rindex2
SELECT PRIMARY
IF 'A'$rn2 .AND. rtype # 'CKS'
INDEX ON &rindex1 TO ndx1
ENDI
IF 'C'$rn2 .AND. rtype # 'CKS'
INDEX ON &rindex2 TO ndx2
ENDI
SET ALTERNATE TO &rname
SET ALTERNATE ON
? sdate + rline + mid
DO CASE
CASE rtype = 'S'
DO lrsytd
CASE rtype = 'D'
DO lrdytd
CASE rtype = 'CKS'
DO lrcytd
ENDC
CASE rperiod = 'E'
STORE $(sdate,3,3) TO rendmonth
STORE 'XXX' TO rmonth
STORE T TO rloop
IF rtype = 'S'
STORE 0 TO rit
STORE 0 TO ret
ENDI
STORE 'l:account + $(l:date,3,3)' TO rindex1
STORE '$(l:date,3,3) + $(l:category,1,1)' TO rindex2
SELECT PRIMARY
IF 'A'$rn2 .AND. rtype # 'CKS'
INDEX ON &rindex1 TO ndx1
ENDI
IF 'C'$rn2 .AND. rtype # 'CKS'
INDEX ON &rindex2 TO ndx2
ENDI
SET ALTERNATE TO &rname
SET ALTERNATE ON
? sdate + rline + mid
DO WHILE rloop
IF rmonth # 'XXX'
STORE $(rdateck,@(rmonth,rdateck)+3,3) TO rmonth
ELSE
STORE 'JAN' TO rmonth
ENDI
DO CASE
CASE rtype = 'S'
STORE @(rmonth,!(rtmonths)) to rstart
IF rstart > 0
STORE $(rtmonths,rstart,9) TO rcmonth
STORE !($(rcmonth,1,1)) + ' ' TO rdsmonth
STORE 2 TO r
DO WHILE r < 10
STORE rdsmonth + !($(rcmonth,r,1)) + ' 'TO rdsmonth
STORE r + 1 TO r
ENDD
RELEASE r
STORE TRIM(rcmonth) TO rcmonth
STORE TRIM(rdsmonth) TO rdsmonth
ENDI
STORE reline2 + rdsmonth + ' . . .' TO rline2
DO lrsmo
CASE rtype = 'D'
DO lrdmo
ENDC
IF rmonth$sdate
STORE F TO rloop
ENDI
ENDD
IF rtype = 'S'
?
?
? 'S U M M A R Y F O R T H E Y E A R T O D A T E . . .'
?
? '==================================================================='
? ' TOTAL INCOME FOR THE YEAR TO DATE...............'+ STR(rit,9,2)
? ' TOTAL EXPENDITURES FOR THE YEAR TO DATE.........'+ STR(ret,9,2)
? '==================================================================='
STORE rit - ret TO rnt
? ' TOTAL NET INCOME FOR THE YEAR TO DATE...........'+ STR(rnt,9,2)
CASE rperiod = 'M'
STORE F TO rloop
STORE @(rmonth,!(rtmonths)) to rstart
IF rstart > 0
STORE $(rtmonths,rstart,9) TO rcmonth
STORE !($(rcmonth,1,1)) + ' ' TO rdsmonth
STORE 2 TO r
DO WHILE r < 10
STORE rdsmonth + !($(rcmonth,r,1)) + ' ' TO rdsmonth
STORE r + 1 TO r
ENDD
RELEASE r
STORE TRIM(rcmonth) TO rcmonth
STORE TRIM(rdsmonth) TO rdsmonth
ENDI
STORE 'l:account + $(l:date,3,3)' TO rindex1
STORE '$(l:date,3,3) + $(l:category,1,1)' TO rindex2
STORE rline2 + rdsmonth + ' . . .' TO rline2
SELECT PRIMARY
IF 'A'$rn2 .AND. rtype # 'CKS'
INDEX ON &rindex1 TO ndx1
ENDI
IF 'C'$rn2 .AND. rtype # 'CKS'
INDEX ON &rindex2 TO ndx2
ENDI
SET ALTERNATE TO &rname
SET ALTERNATE ON
? sdate + rline + mid
DO CASE
CASE rtype = 'S'
DO lrsmo
CASE rtype = 'D'
DO lrdmo
CASE rtype = 'CKS'
DO lrcmo
ENDC
ENDC
ENDI
SET ALTERNATE OFF
SET ALTERNATE TO
?
?
STORE ' ' TO rok
@ 23,00 SAY 'Hit any key to return to the Main Menu...' GET rok
READ
SELECT SECONDARY
USE
SELECT PRIMARY
SET INDEX TO
IF FILE('NDX1.NDX')
DELETE FILE ndx1.ndx
ENDI
IF FILE('NDX2.NDX')
DELETE FILE ndx2.ndx
ENDI
RELEASE ALL LIKE r*
ERASE
? &srvideo + tline
? tline
? tline
@ 02,27 SAY &srvideo + 'L E D G E R'
@ $,$+1 SAY &srvideo + mledger
@ 04,00 SAY 'CkNo Tr Date Payee Memo '
@ $,$+1 SAY ' Acct Amount'
@ 05,00 SAY '===================================================='
@ $,$+1 SAY '============================'
@ 16,00 SAY '===================================================='
@ $,$+1 SAY '============================'
GO BOTTOM
SKIP -9
STORE # TO xrecord
@ 05,00 SAY '='
DISPLAY WHILE # <= xrecord + 10 OFF FIELDS &lfields
@ 16,00 SAY '='
? &tstatline
RETU IF FILE('NDX2.NDX') DELETE FILE ndx2.ndx ENDIF