home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Don Maslin Archive
/
maslin_archive.zip
/
AARDVARK_Tape_Backups
/
maslin_c_d_3oct95
/
ddrive
/
sydex
/
prgms
/
invntory.lbr
/
LEDGER.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1980-01-29
|
17KB
|
592 lines
******************* ledger.cmd *******************
CLEAR
DO WHILE t
CLEAR
ERASE
@ 1, 0 SAY "**************************************************"
@ 1,50 SAY "***"
@ 2,14 SAY "L E D G E R M E N U"
@ 3, 0 SAY "**************************************************"
@ 3,50 SAY "***"
@ 6, 8 SAY "Which would you like to do:"
@ 8,11 SAY "1. DISPLAY LEDGER CARD"
@ 10,11 SAY "2. CREDIT ACCOUNT"
@ 12,11 SAY "3. DEBIT ACCOUNT"
@ 14,11 SAY "4. EDIT LEDGER CARD"
@ 16,11 SAY "5. PRINT STATEMENTS"
@ 18,11 SAY "R. RETURN to MAIN MENU"
?
ACCEPT " Enter here " TO command
DO CASE
CASE !(command)= 'R'
RETURN
CASE command= '1'
SELECT PRIMARY
USE accounts INDEX accnt:no
SELECT secondary
USE ledger INDEX ledger
STORE t TO getcard
DO WHILE getcard
ERASE
?
? ' **** D I S P L A Y L E D G E R C A R D ****'
?
?
? "Enter '99' as the Account Number to"
? "return to Ledger Menu."
?
? 'Enter the Account NUMBER of the'
ACCEPT "LEDGER CARD you wish to see " TO number
IF number= '99'
STORE f TO getcard
LOOP
ELSE
SELECT PRIMARY
STORE !(number) TO number
FIND &number
IF #=0
? chr(07)
? ' *************NOT ON FILE!!*************'
LOOP
ENDIF #=0
ERASE
@ 1,00 SAY ' **** L E D G E R C A R D ****'
@ 2, 0 SAY "----------------ACCOUNT NO:"
@ 2,27 SAY accnt:no
@ 2,36 SAY "--------------------------------------------"
@ 3, 0 SAY "Name:"
@ 3, 5 SAY bill:nm
@ 3,39 SAY "Credit:"
@ 3,46 SAY credit
@ 4, 0 SAY "Addr:"
@ 4, 5 SAY bill:ad
@ 4,40 SAY "Terms:"
@ 4,46 SAY terms
@ 5, 5 SAY bill:cty
@ 5,23 SAY bill:st
@ 5,37 SAY "UPS zone:"
@ 5,46 SAY upszone
@ 6, 5 SAY bill:zp
@ 6,40 SAY "Buyer:"
@ 6,46 SAY buyer
@ 7, 0 SAY "Phone number:"
@ 7,13 SAY phone:no
@ 7,32 SAY "Special Instr:"
@ 7,46 SAY spl:inst
@ 8, 0 SAY "--------------------------------------------------"
@ 8,50 SAY "------------------------------"
@ 9, 2 SAY "DATE | DETAIL | DEBIT | CREDIT | BALANCE"
STORE balance TO mbal
SELECT secondary
FIND &number
IF #=0
?? chr(07)
@ 12,10 SAY " *****NO SALES TO DATE******"
?
ELSE
DO WHILE .not. eof .AND. accnt:no=number
? DATE,detail, ' ' ,debit,credit,rbalance
SKIP +1
ENDDO WHILE .not. eof .AND. accnt:no=number
ENDIF #=0
? ' ------------------------'
? ' BALANCE IS=$ ' ,mbal
? ' ------------------------'
? ' <return> to continue'
?
SET console OFF
WAIT
SET console ON
ENDIF number= '99'
ENDDO WHILE getcard
CASE command= '2'
SELECT PRIMARY
USE accounts INDEX accnt:no
SELECT secondary
USE ledger INDEX ledger
STORE t TO getcredits
DO WHILE getcredits
ERASE
? ' ***** C R E D I T I N G A C C O U N T S *****'
?
?
? "Enter '99' for Account Number to"
? "return to Ledger Menu."
?
?
? 'Enter the ACCOUNT NUMBER of the Account'
ACCEPT 'you wish to CREDIT ' TO number
IF number= '99'
STORE f TO getcredits
LOOP
ELSE
SELECT PRIMARY
STORE !(number) TO number
FIND &number
IF #=0
? chr(07)
? " **********NOT ON FILE!!***************"
LOOP
ENDIF #=0
IF *
?
? ' *** E R R O R ***'
?
? 'You cannot credit a record tagged for deletion.'
? 'Undelete (D) before atempting to credit'
?
?
? ' <return> to continue'
SET console OFF
WAIT
SET console ON
LOOP
ENDIF *
ERASE
@ 1, 5 SAY "*** C R E D I T I N G A C C O U N T S ***"
@ 3, 0 SAY "+-------------------------------------------------"
@ 3,50 SAY "-+"
@ 4, 0 SAY "| ACCOUNT NUMBER:"
@ 4,17 SAY accnt:no
@ 4,51 SAY "|"
@ 5, 0 SAY "|"
@ 5,51 SAY "|"
@ 6, 0 SAY "| Name:"
@ 6, 7 SAY bill:nm
@ 6,30 SAY "BALANCE:$"
@ 6,39 SAY balance
@ 6,51 SAY "|"
@ 7, 0 SAY "| Addr:"
@ 7, 7 SAY bill:ad
@ 7,51 SAY "|"
@ 8, 0 SAY "|"
@ 8, 7 SAY bill:cty
@ 8,23 SAY bill:st
@ 8,35 SAY "Credit:"
@ 8,42 SAY credit
@ 8,51 SAY "|"
@ 9, 0 SAY "|"
@ 9, 7 SAY bill:zp
@ 9,36 SAY "Terms:"
@ 9,42 SAY terms
@ 9,51 SAY "|"
@ 10, 0 SAY "|"
@ 10,35 SAY "Categ.:"
@ 10,42 SAY category
@ 10,51 SAY "|"
@ 11, 0 SAY "| UPS :"
@ 11, 7 SAY upszone
@ 11,33 SAY " Buyer:"
@ 11,42 SAY buyer
@ 11,51 SAY "|"
@ 12, 0 SAY "| Salesman:"
@ 12,42 SAY salesman
@ 12,51 SAY "|"
@ 13, 0 SAY "| Phone Number:"
@ 13,15 SAY phone:no
@ 13,51 SAY "|"
@ 14, 0 SAY "|"
@ 14,51 SAY "|"
@ 15, 0 SAY "| Special Instructions:"
@ 15,23 SAY spl:inst
@ 15,51 SAY "|"
@ 16, 0 SAY "|"
@ 16,51 SAY "|"
@ 17, 0 SAY "| FFL Number:"
@ 17,13 SAY ffl:no
@ 17,28 SAY "Expires(YYMM):"
@ 17,42 SAY expires
@ 17,51 SAY "|"
@ 18, 0 SAY "+-------------------------------------------------"
@ 18,50 SAY "-+"
INPUT "Correct Account, (Y/N) ?" TO GO
IF .not. GO
LOOP
ELSE
STORE ' ' TO mem:detail
STORE 000.00 TO mem:credit
STORE p.accnt:no TO number
@ 19,00
@ 20,00
@ 19, 2 SAY " DATE MM/DD/YY:"
@ 19,19 SAY DATE ()
@ 20, 2 SAY "AMOUNT TO CREDIT:"
@ 20,19 GET mem:credit
@ 21,12 SAY "DETAIL:"
@ 21,19 GET mem:detail PICTURE '!!!!!!!!!!!!!!!'
READ
SELECT PRIMARY
REPLACE balance WITH balance-mem:credit
STORE balance TO rbal
SELECT secondary
APPEND BLANK
REPLACE DATE WITH DATE (),credit WITH mem:credit,detail WITH mem:detail
REPLACE accnt:no WITH number,rbalance WITH rbal
ENDIF .not. GO
ENDIF number= '99'
ENDDO WHILE getcredits
CASE command= '3'
SELECT PRIMARY
USE accounts INDEX accnt:no
SELECT secondary
USE ledger INDEX ledger
STORE t TO getdebits
DO WHILE getdebits
ERASE
@ 2, 5 SAY "*** D E B I T I N G A C C O U N T S ***"
?
?
? "Enter '99' for Account Number to"
? "return to Ledger Menu."
?
? 'Enter the ACCOUNT NUMBER of the Account'
ACCEPT 'you wish to DEBIT ' TO number
IF number= '99'
STORE f TO getdebits
LOOP
ELSE
SELECT PRIMARY
STORE !(number) TO number
FIND &number
IF #=0
? chr(07)
? " **********NOT ON FILE!!***************"
LOOP
ENDIF #=0
IF *
?
? ' *** E R R O R ***'
?
? 'You cannot debit a record tagged for deletion.'
? 'Undelete (D) before atempting to debit'
?
?
? ' <return> to continue'
SET console OFF
WAIT
SET console ON
LOOP
ENDIF *
ERASE
@ 1, 6 SAY "*** D E B I T I N G A C C O U N T S ***"
@ 3, 0 SAY "+-------------------------------------------------"
@ 3,50 SAY "-+"
@ 4, 0 SAY "| ACCOUNT NUMBER:"
@ 4,17 SAY accnt:no
@ 4,51 SAY "|"
@ 5, 0 SAY "|"
@ 5,51 SAY "|"
@ 6, 0 SAY "| Name:"
@ 6, 7 SAY bill:nm
@ 6,30 SAY "BALANCE:$"
@ 6,39 SAY balance
@ 6,51 SAY "|"
@ 7, 0 SAY "| Addr:"
@ 7, 7 SAY bill:ad
@ 7,51 SAY "|"
@ 8, 0 SAY "|"
@ 8, 7 SAY bill:cty
@ 8,23 SAY bill:st
@ 8,35 SAY "Credit:"
@ 8,42 SAY credit
@ 8,51 SAY "|"
@ 9, 0 SAY "|"
@ 9, 7 SAY bill:zp
@ 9,36 SAY "Terms:"
@ 9,42 SAY terms
@ 9,51 SAY "|"
@ 10, 0 SAY "|"
@ 10,35 SAY "Categ.:"
@ 10,42 SAY category
@ 10,51 SAY "|"
@ 11, 0 SAY "| UPS :"
@ 11, 7 SAY upszone
@ 11,33 SAY " Buyer:"
@ 11,42 SAY buyer
@ 11,51 SAY "|"
@ 12, 0 SAY "| Salesman:"
@ 12,42 SAY salesman
@ 12,51 SAY "|"
@ 13, 0 SAY "| Phone Number:"
@ 13,15 SAY phone:no
@ 13,51 SAY "|"
@ 14, 0 SAY "|"
@ 14,51 SAY "|"
@ 15, 0 SAY "| Special Instructions:"
@ 15,23 SAY spl:inst
@ 15,51 SAY "|"
@ 16, 0 SAY "|"
@ 16,51 SAY "|"
@ 17, 0 SAY "| FFL Number:"
@ 17,13 SAY ffl:no
@ 17,28 SAY "Expires(YYMM):"
@ 17,42 SAY expires
@ 17,51 SAY "|"
@ 18, 0 SAY "+-------------------------------------------------"
@ 18,50 SAY "-+"
INPUT "Correct Account, (Y/N) ?" TO GO
IF .not. GO
LOOP
ELSE
STORE p.accnt:no TO number
STORE ' ' TO mem:detail
STORE 000.00 TO mem:debit
STORE DATE () TO mem:date
@ 19,00
@ 20,00
@ 21,0
@ 22,0
@ 19, 3 SAY " DATE MM/DD/YY:"
@ 19,19 GET mem:date PICTURE '99/99/99'
@ 20, 3 SAY "AMOUNT TO DEBIT:"
@ 20,19 GET mem:debit
@ 21,12 SAY "DETAIL:"
@ 21,19 GET mem:detail PICTURE '!!!!!!!!!!!!!!!'
READ
SELECT PRIMARY
REPLACE balance WITH balance+mem:debit
STORE balance TO rbal
SELECT seco
APPEND BLANK
REPLACE DATE WITH mem:date,debit WITH mem:debit,detail WITH mem:detail
REPLACE accnt:no WITH number,rbalance WITH rbal
ENDIF .not. GO
ENDIF number= '99'
ENDDO WHILE getdebits
CASE command= '4'
SELECT PRIMARY
USE accounts INDEX accnt:no
SELECT secondary
USE ledger INDEX ledger
STORE t TO legedit
DO WHILE legedit
STORE 00.00 TO mcred
STORE 00.00 TO mdeb
ERASE
?
? ' **** E D I T I N G L E D G E R C A R D S ****'
?
?
? "Enter '99' as Account Number to return "
? "to Ledger Menu."
?
? 'What is the number of the account whose'
ACCEPT "LEDGER CARD you wish to EDIT " TO number
IF number= '99'
STORE f TO legedit
LOOP
ELSE
@ 12,2 SAY "Enter amount of existing CREDIT: "
@ 12,36 GET mcred
@ 13,15 SAY "or"
@ 14,2 SAY "Enter amount of existing DEBIT: "
@ 14,36 GET mdeb
READ
IF mcred>0 .AND. mdeb>0
?? chr(07)
LOOP
ENDIF mcred>0 .AND. mdeb>0
SELECT secondary
STORE !(number) TO number
FIND &number
SKIP -1
LOCATE FOR accnt:no=number .AND. credit=mcred .AND. debit=mdeb next 150
IF eof .OR. (accnt:no<>number) .OR. (credit<>mcred) .OR. (debit<>mdeb)
? chr(07)
@ 17,0 SAY ' *********NO SUCH TRANSACTION TO DATE*********'
@ 19,0 SAY ' <return> to continue'
?
SET console OFF
WAIT
SET console ON
LOOP
ENDIF eof .OR. (accnt:no<>number) .OR. (credit
SELECT PRIMARY
FIND &number
IF *
?
? ' *** E R R O R ***'
?
? 'You cannot edit a record tagged for deletion.'
? 'Undelete (D) before atempting to debit'
?
?
? ' <return> to continue'
SET console OFF
WAIT
SET console ON
LOOP
ENDIF *
REPLACE p.balance WITH p.balance-s.debit+s.credit
SELECT secondary
ERASE
@ 1, 1 SAY "***** E D I T I N G L E D G E R C A R D S *****"
@ 3, 0 SAY "+-------------------------------------------------"
@ 3,50 SAY "-+"
@ 4,0 SAY "|"
@ 4,51 SAY "|"
@ 5,0 SAY "|"
@ 5,51 SAY "|"
@ 5,13 SAY "Account #:"
@ 5,23 SAY s.accnt:no
@ 6,0 SAY "|"
@ 6,51 SAY "|"
@ 7,0 SAY "|"
@ 7,18 SAY "Date:"
@ 7,23 GET s.DATE PICTURE '99/99/99'
@ 7,51 SAY "|"
@ 8,0 SAY "|"
@ 8,51 SAY "|"
@ 9,0 SAY "|"
@ 9,16 SAY "Credit:"
@ 9,23 GET s.credit
@ 9,51 SAY "|"
@ 10,0 SAY "|"
@ 10,51 SAY "|"
@ 11,0 SAY "|"
@ 11,17 SAY "Debit:"
@ 11,23 GET s.debit
@ 11,51 SAY "|"
@ 12,0 SAY "|"
@ 12,51 SAY "|"
@ 13,0 SAY "|"
@ 13,16 SAY "Detail:"
@ 13,23 GET s.detail PICTURE '!!!!!!!!!!!!!!!'
@ 13,51 SAY "|"
@ 14,0 SAY "|"
@ 14,51 SAY "|"
@ 15,0 SAY "|"
@ 15,51 SAY "|"
@ 16,0 SAY "|"
@ 16,51 SAY "|"
@ 17,0 SAY "|"
@ 17,51 SAY "|"
@ 18,0 SAY "|"
@ 18,51 SAY "|"
@ 19,0 SAY "|"
@ 19,51 SAY "|"
@ 20, 0 SAY "+-------------------------------------------------"
@ 20,50 SAY "-+"
READ
SELECT PRIMARY
REPLACE p.balance WITH p.balance+s.debit-s.credit
ENDIF number= '99'
ENDDO WHILE legedit
CASE command= '5'
SELECT PRIMARY
USE ledger INDEX ledger
SELECT secondary
USE accounts INDEX accounts
GO TOP
SET exact OFF
RELEASE ALL
ERASE
?
? ' ***** S T A T E M E N T S *****'
?
?
? 'Enter CATEGORY you wish to have statements'
ACCEPT 'printed for ' TO statecateg
ERASE
?
? ' ***** S T A T E M E N T S *****'
?
?
? 'Ready the PRINTER and press <return> -- or'
? "enter an 'A' ABORT and return to the ledger menu "
?
SET console OFF
WAIT TO GO
SET console ON
IF !(GO)<> 'A'
ERASE
@ 12,16 SAY "PRINTING"
SET console OFF
SET PRINT ON
SET FORM TO PRINT
DO WHILE .not. eof
SELECT seco
IF s.category=statecateg .AND. (.not. *)
IF s.terms= 'NET 30'
STORE "Net 30 Days from date of Invoice" TO mterms
ELSE
STORE s.terms TO mterms
ENDIF s.terms= 'NET 30'
STORE s.accnt:no TO maccount
@ 5,50 SAY chr(14)+ "STATEMENT"
@ 6,50 SAY "AS OF:"
@ 6,57 SAY DATE ()
@ 8, 4 SAY trim(s.bill:nm)
@ 9, 4 SAY trim(s.bill:ad)
@ 10, 4 SAY trim(s.bill:cty)
@ 10,20 SAY trim(s.bill:st)
@ 11, 4 SAY trim(s.bill:zp)
@ 13, 0 SAY "ACCOUNT NUMBER:"
@ 13,16 SAY s.accnt:no
@ 13,30 SAY "TERMS: &mterms"
@ 14, 0 SAY "+------------------+-------------------+----------"
@ 14,50 SAY "------+----------------------+"
@ 15, 0 SAY "| DATE | DETAIL | DEBIT "
@ 15,56 SAY "| CREDIT |"
@ 16, 0 SAY "+------------------+-------------------+----------"
@ 16,50 SAY "------+----------------------+"
SELECT PRIMARY
FIND &maccount
STORE 17 TO x
STORE "2" TO p
DO WHILE p.accnt:no=maccount .AND. (.not. eof)
@ x,8 SAY p.DATE
@ x,21 SAY p.detail
@ x,42 SAY p.debit
@ x,59 SAY p.credit
SELECT PRIMARY
SKIP +1
STORE x+1 TO x
IF x=55 .AND. (p.accnt:no=maccount)
EJECT
@ 5,50 SAY chr(14)+ "STATEMENT"
@ 6,50 SAY "AS OF:"
@ 6,57 SAY DATE ()
@ 8, 4 SAY trim(s.bill:nm)
@ 8,50 SAY chr(14)+ "PAGE &p"
@ 9, 4 SAY trim(s.bill:ad)
@ 10, 4 SAY trim(s.bill:cty)
@ 10,20 SAY trim(s.bill:st)
@ 11, 4 SAY trim(s.bill:zp)
@ 13, 0 SAY "ACCOUNT NUMBER:"
@ 13,16 SAY s.accnt:no
@ 13,30 SAY "TERMS: &mterms"
@ 14, 0 SAY "+------------------+-------------------+----------"
@ 14,50 SAY "------+----------------------+"
@ 15, 0 SAY "| DATE | DETAIL | CREDIT"
@ 15,56 SAY "| DEBIT |"
@ 16, 0 SAY "+------------------+-------------------+----------"
@ 16,50 SAY "------+----------------------+"
STORE 17 TO x
STORE "3" TO p
ENDIF x=55
ENDDO WHILE p.accnt:no=maccount .AND. (.not. e
SELECT seco
@ 57,55 SAY "+-----------------------+"
@ 58,55 SAY "| BALANCE:$"
@ 58,66 SAY s.balance
@ 58,79 SAY "|"
@ 59,55 SAY "+-----------------------+"
SKIP +1
EJECT
ELSE
SELECT seco
SKIP +1
ENDIF category=statecateg
ENDDO WHILE .not. eof
ENDIF !(GO)<> 'R'
SET PRINT OFF
SET console ON
SET FORMAT TO screen
SET exact ON
OTHERWISE
ERASE
? chr(07)
ENDCASE
ENDDO WHILE t