home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
database
/
ledgers.lbr
/
LRSMO.CZD
/
LRSMO.CMD
Wrap
OS/2 REXX Batch file
|
1987-05-10
|
4KB
|
135 lines
NOTE * Program...: LRSMO.CMD
NOTE * Version...: 2.0
NOTE * Author....: Terry Hazen
NOTE * Date......: 12/06/85
NOTE * Notice....: Copyright (c) 1985, n/SYSTEMS
IF 'A'$rn2
SELECT PRIMARY
SET INDEX TO ndx1
SELECT SECONDARY
USE laccount
STORE 0 TO rincome
STORE 0 TO rexpense
STORE "a:number, ' ... ',a:name,' ',rtrans,' ',rctot" TO rfields
?
?
? rline1
?
? rline2
?
? '==================================================================='
? 'Account Description Transactions Amount'
? '==================================================================='
DO WHILE .NOT. EOF
STORE a:number + rmonth TO rfind
SELECT PRIMARY
FIND &rfind
IF # <> 0
STORE 0 TO rtrans
STORE 0 TO rctot
DO WHILE l:account = a:number .AND. $(l:date,3,3) = rmonth.AND. .NOT. EOF
IF 'I'$l:category
STORE rincome + l:amount TO rincome
ELSE
IF ('E'$l:category .OR. 'X'$l:category) .AND. l:type <> 'Mo'
STORE rexpense + l:amount TO rexpense
ENDI
ENDI
STORE rtrans + 1 TO rtrans
STORE rctot + l:amount TO rctot
SKIP
ENDD
DISPLAY OFF FIELDS &rfields
ENDI
GO TOP
SELECT SECONDARY
SKIP
ENDD
? '==================================================================='
? ' Total Income For The Month......................'+ STR(rincome,9,2)
? ' Total Expenditures For The Month................'+ STR(rexpense,9,2)
? '==================================================================='
STORE rincome - rexpense TO rnet
? ' TOTAL NET INCOME................................'+ STR(rnet,9,2)
IF rloop
STORE rincome + rit TO rit
STORE rexpense + ret TO ret
ENDI
IF 'AC'$rn2 .OR. 'E'$rperiod
? CHR(12)
ENDI
ENDI
IF 'C'$rn2
SELECT PRIMARY
SET INDEX TO ndx2
SELECT SECONDARY
USE lcat
STORE 'I' TO r1
STORE 'Income: ' TO r1d
STORE c:category TO r2
STORE c:desc TO r2d
STORE 0 TO rctot
STORE $(STR(0,80),1,30) TO rsp
STORE "r1+r2,'...',$(r1d+TRIM(r2d)+rsp,1,33), rtrans, ' ',rctot"TO rfields
?
?
? rline1
?
? rline2
?
? '==================================================================='
? 'Categories Transactions Amount'
? '==================================================================='
DO WHILE .NOT. EOF
STORE r1 TO rfind
STORE rmonth + rfind TO rdfind
SELECT PRIMARY
FIND &rdfind
IF # <> 0
STORE 0 TO rtrans
STORE 0 TO rctot
DO WHILE rfind$l:category .AND. $(l:date,3,3) = rmonth.AND. .NOT. EOF
IF r2$l:category
STORE rtrans + 1 TO rtrans
STORE rctot + l:amount TO rctot
ENDI
SKIP
ENDD
IF rctot <> 0
DISPLAY OFF FIELDS &rfields
ENDI
ENDI
SELECT SECONDARY
STORE T TO rnext
DO WHILE rnext .AND. .NOT. EOF
SKIP
IF c:category = 'E' .OR. c:category = 'I' .OR. c:category = 'O'.OR. c:category = 'X'
LOOP
ELSE
STORE c:category TO r2
STORE c:desc TO r2d
ENDI
STORE F TO rnext
ENDD
IF EOF .AND. r1 = 'I'
STORE 'E' TO r1
STORE 'Expense: ' TO r1d
?
GO TOP
STORE c:category TO r2
STORE c:desc TO r2d
ELSE
IF EOF .AND. r1 = 'E'
STORE 'X' TO r1
STORE 'Capital: ' TO r1d
?
GO TOP
STORE c:category TO r2
STORE c:desc TO r2d
ENDI
ENDI
ENDD
? '==================================================================='
ENDI
RETU STORE F TO rnext ENDDO IF EOF .AND. r1 = 'I'