Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : SBBILL.ZIP
Filename : STATES.PRG

 
Output of file : STATES.PRG contained in archive : SBBILL.ZIP
* --- STATES.PRG
* routine to print one or all statements on 8 1/2 X 11 inch paper
* uses condensed print mode, requires CHR(15) and CHR(18) compatibility

* --- all or one?
clear
which = 'S'
@ 10,20 say 'Print ingle or ll Statements? ' get which picture '!'
read

if lastkey()=27
return
endif

* --- check the printer status if printing.
if where = 'P'
if ! isprinter()
@ 12,20 say 'Printer not ready. Fix and retry.'
?? chr(7)
inkey(4)
return
endif
endif

do case
case which='S'
do staone
case which='A'
do staall
endcase
return
* * * * * * * * *

* --- Print a single statement
PROCEDURE StaOne
do while .t.

clear

* --- get client to print
@ 1,0 say 'PRINT CLIENT STATEMENTS'
@ 3,0 say 'Enter Client Number: Press F2 for Client List, 0 to Exit'
set key -1 to listcli
clino = 0
@ 3,20 get clino picture '9999'
read

set key -1 to
if lastkey()=27 .or. empty(clino)
exit
endif

SELECT Client

* --- is this a valid client number?
if clino > reccount()
@ 5,0 say 'Invalid Client Number!'
@ 6,0 say ' Please enter again.'
?? chr(7)
inkey(4)
@ 5,0 clear to 6,79
loop
endif

* --- locate the client
GO clino

* --- is this a deleted client?
if deleted()
@ 5,0 say 'This Client has been Deleted.'
@ 6,0 say ' Please enter again.'
?? chr(7)
inkey(4)
@ 5,0 clear to 6,79
loop
endif

* --- display the client name, etc.
clear
? ' Client: ' + trim(first)+' '+trim(last)
? 'Balance: ' + ltrim(str(balance,10,2))
?

* --- find the clients account information
key = str(recno(),4)
select Account
seek key

* --- is anything found?
if eof()
? 'No Account Transactions Found.'
? 'Press to continue....'
?? chr(7)
inkey(120)
loop
endif

* --- print the statement
? 'Printing...'
do PrtState
enddo
* * * * * * * * * *

* --- procedure to print a statement for each balance over 0.00
PROCEDURE StaAll
clear

* --- search entire CLIENT.DBF for balances to print
select CLIENT
DO WHILE .not. eof()

* --- display the client being checked
? ' Client: ' + trim(title) + ' ' + trim(first)+' '+trim(last)
? 'Balance: ' + ltrim(str(balance,10,2))

* --- is there a balance due?
if balance > 0.00

* --- Yes, so go to the clients account
key = str(recno(),4)
select Account
seek key

* --- if nothing is found the index is bad or something is wrong
if eof()
?
? 'No Account Transactions Found. REBUILD INDEX and CHECK ACCOUNTS.'
? 'See the Maintenance Menu to execute these functions (in order).'
?
?? chr(7)
WAIT
exit
else
? 'Printing...'
do PrtState
endif
endif

* --- go to the next client and start over
select client
skip
?
ENDDO
return
* * * * * * * * * * * * * *


* --- procedure to actually print a statement
* note: calls TopState and BotState as subroutines
PROCEDURE PrtState

* --- print top of statement (office name, address, etc)
do topstate

set device to print
mrow = 29 && first 28 rows for topstate
mtotal = 0.00

* --- move through the patients account, checking each line and printing it
do while account->clientno=clino .and. .not. eof()
if .not. deleted()
* --- format the line with date and description
line = dtoc(account->date) + ' ' + account->des

* --- now, if its a charge show it, otherwise if its a payment, show it
* in either case, update the variable Mtotal
if empty(account->paid)
if ! empty(account->charge)
line = line + str(account->charge,9,2)
mtotal = account->charge + mtotal
endif
else
if ! empty(account->paid)
line = line + '('+str(account->paid,8,2)+')'
mtotal = mtotal - account->paid
endif
endif

* --- print the line and update the row counter
@ mrow,0 say line
mrow = mrow + 1
endif
skip

* --- if getting near the bottom of a page, go to a new page and continue
if mrow = 55 .and. .not. eof()
eject
do topstate
endif
enddo

* --- now print the total due
@ mrow,0 say space(68)+'-----------'
@ mrow+1,0 say space(9)+'Total Balance Due'+replicate('.',42)+str(mtotal,10,2)
mrow = mrow + 2
set device to screen

* --- now do the bottom part of the screen
do BotState
eject
return
* * * * * * * * * * * * * *


* --- procedure to print the top part of a statement
PROCEDURE TopState

set device to print
* --- print the office information at the top of the statement
@ 2,(80-len('statement of account'))/2 say 'STATEMENT of ACCOUNT'
@ 4,(80-len(trim(Oname)))/2 say Oname
@ 5,(80-len(trim(Oaddr)))/2 say Oaddr
@ 6,(80-len(trim(Ocity) + ' ' + Ozip))/2 say trim(Ocity) + ' ' + Ozip
@ 7,(80-len(trim(Ophone)))/2 say Ophone
@ 9,60 say 'ACCOUNT NO: ' + ltrim(str(client->clientno))
@ 10,60 say ' DATE: ' + dtoc(date())

* --- now print the client name and address
@ 12,8 say trim(client->title) + ' ' + trim(client->first) + ' ' + trim(client->last)
@ 13,8 say client->address
@ 14,8 say trim(client->city) + ' ' + client->zip

@ 17,60 say 'AMOUNT PAID ________'

* --- shift into condensed print mode, then back out of it
@ 18,0 say chr(15)
@ 20,32 say '* * PLEASE DETACH AND RETURN THIS TOP PORTION OF STATEMENT WITH YOUR PAYMENT * *'
@ 21,0 say chr(18) + replicate('-',80)

* --- print a header before the individual lines are printed
@ 23,0 say '+'
@ 23,1 say replicate('-',78)
@ 23,79 say '+'
@ 24,0 say '| ACCOUNT NO: ' + ltrim(str(client->clientno))
@ 24,58 say 'DATE: ' + dtoc(date())
@ 24,79 say '|'
@ 25,0 say '+'
@ 25,1 say replicate('-',78)
@ 25,79 say '+'
@ 26,0 say '| DATE | DESCRIPTION OF SERVICES PROVIDED | AMOUNT |'
@ 27,0 say '+'
@ 27,1 say replicate('-',78)
@ 27,79 say '+'
set device to screen
return
* * * * * * * * * *

* --- print the very bottom of a statement
PROCEDURE BotState

set device to print
@ 59,0 say '+'
@ 59,1 say replicate('-',78)
@ 59,79 say '+'
@ 60,0 say '|'

* --- check due date for overdue status and print a message accordingly
mage = date() - client->due
DO CASE
CASE mage < 30
@ 60,10 say 'YOUR ACCOUNT IS CURRENT. BALANCE DUE IS ' + ltrim(str(client->balance,10,2)) + ' DOLLARS.'
CASE mage >= 30 .and. mage < 60
@ 60,5 say 'YOUR ACCOUNT IS 30 DAYS PAST DUE. THE BALANCE IS ' + ltrim(str(client->balance,10,2)) + ' DOLLARS.'
CASE mage >= 60 .and. mage < 90
@ 60,5 say 'YOUR ACCOUNT IS 60 DAYS PAST DUE. THE BALANCE IS ' + ltrim(str(client->balance,10,2)) + ' DOLLARS.'
CASE mage >= 90 .and. mage < 60
@ 60,5 say 'YOUR ACCOUNT IS OVER 90 DAYS LATE! THE BALANCE IS ' + ltrim(str(client->balance,10,2)) + ' DOLLARS.'
ENDCASE

@ 60,79 say '|'
@ 61,0 say '+'
@ 61,1 say replicate('-',78)
@ 61,79 say '+'

@ 62,0 say chr(15)
md = trim(Oname) + ' '+trim(Oaddr)+' '+trim(Ocity) + ' '+Ozip+' '+Ophone
@ 63,(136-len(trim(md)))/2 say md
@ 64,0 SAY chr(18)
set device to screen
return
* eof




  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : SBBILL.ZIP
Filename : STATES.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/