Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : HOMFIN.ZIP
Filename : ACCOUNTS.CMD

 
Output of file : ACCOUNTS.CMD contained in archive : HOMFIN.ZIP

** ACCOUNTS **
* Copyright 1987 John R. Yandrasitz / 168 Brooklea Rd / Rosemont PA 19010
* Handles opening and closing of Accounts 1 and 2 (ac1, ac2)
* With their associated variables
* Assumes SECONDARY database is ACCTS indexed on ACODE and is selected
* No checking on a close, an open of a non-existent account returns
* variable acin as " "
* Account to open in acopen (to close in acls) - as ac1 or ac2
* Clears these variables if successful
* JRY 01/07/86

SET EXACT ON

* If we want to exchange accounts, check to see if new one exists
IF acopen # " "
FIND &acin
IF # = 0
STORE " " TO acin
RETURN
ENDIF
ENDIF

** CLOSE ACCOUNTS FIRST
IF acls # " "
STORE &acls TO mfind
FIND &mfind
STORE acls + 'bal' TO var
REPLACE ABAL WITH &var, LDATE WITH today

* Only ABAL and LDATE need updating on close of ac2, CNUM on ac1
IF acls='ac1'
REPLACE CNUM WITH STR(aclnum,4)
STORE 0 TO aclnum
STORE " " TO mnum
ENDIF

STORE " " TO &acls
STORE 0.00 TO &var
STORE acls + 'nam' TO var
STORE " " TO &var
STORE " " TO acls
RELEASE var, mfind
ENDIF

** Now open accounts if needed

IF acopen # " "
FIND &acin

* Get ACODE, ANAME, ABAL for either ac1 or ac2
STORE ACODE TO &acopen
STORE acopen + 'nam' TO var
STORE ANAME TO &var
STORE acopen + 'bal' TO var
STORE ABAL TO &var

IF acopen="ac1"
STORE VAL(CNUM) TO aclnum
IF $(ATYPE,1,2) = 'CS'
STORE T TO acan
ELSE
STORE F TO acan
ENDIF
ENDIF
STORE " " TO acopen
RELEASE var
ENDIF

SET EXACT OFF
RETURN