*****ADDNEW.CMD
*****Add new prospective clients and send letter
SELECT PRIMARY
USE NEWLEADS INDEX LAST
SELECT SECONDARY
USE AGENTS INDEX INITIALS

STORE T TO OS
DO WHILE OS
SELECT SECONDARY
ERASE
REMARK    Enter the initials of the agent assigned
STORE '   ' TO MAGENT
@ 5,15 GET MAGENT PICTURE '!!!'
READ

IF MAGENT = ' '
STORE F TO OS
SELECT PRIMARY
USE
SELECT SECONDARY
USE
RETURN
ENDIF

STORE TRIM(MAGENT) TO MAGENT
FIND &MAGENT

IF # = 0
TEXT
That agent is not on my list

But here is a list to choose from

Ndx   Agent
----  ------------------------------------------
ENDTEXT
DISP ALL OFF S.AGENT,TRIM(S.FIRST)+' 'S.LAST
WAIT
LOOP
ENDIF

@ 10,5 SAY S.AGENT
@ 11,5 SAY S.BUS:NAME
@ 12,5 SAY TRIM(S.TITLE)+' '+TRIM(S.FIRST)+' '+S.LAST
@ 13,5 SAY S.ADDR
@ 14,5 SAY TRIM(S.CITY)+', '+S.STATE
REMARK   Is this the correct one?
WAIT TO ok
IF !(ok) = 'N'
LOOP
ENDIF
ERASE
REMARK   Adding new blank record
SELECT PRIMARY
APPEND BLANK
REPLACE P.AGENT WITH MAGENT

* NEWLEAD.FMT
@  1,17 SAY "New Sales Lead Data"
@  4, 0 SAY "Agent assigned for service"
@  4,27 SAY agent
@  6, 6 SAY "Business Name "
@  6,20 GET bus:name
@  8, 0 SAY "Title (Mr. Ms. Dr.) "
@  8,20 GET title
@  9, 8 SAY "First Name  "
@  9,20 GET first
@ 10, 9 SAY "Last Name  "
@ 10,20 GET last
@ 11,11 SAY "Address  "
@ 11,20 GET addr
@ 12,14 SAY "City  "
@ 12,20 GET city
@ 13,13 SAY "State  "
@ 13,20 GET state
@ 14,15 SAY "Zip  "
@ 14,20 GET zip
@ 15, 6 SAY "Phone number  "
@ 15,20 GET phone
@ 18, 0 SAY "Do you wish to send the letter"
@ 18,31 GET send:ltr
READ
IF SEND:LTR
ERASE
* SET FORMT TO PRINT
* LETTER.FMT
@  0,21 SAY "ABC Company"
@  1,20 SAY "123 Anystreet"
@  2,18 SAY "Houston, Tx 77777"
@  5,40 SAY DATE()
@  8, 0 SAY P.BUS:NAME
@  9, 0 SAY TRIM(P.FIRST)+' '+P.LAST
@ 10, 0 SAY P.ADDR   
@ 11, 0 SAY TRIM(P.CITY)+', '+P.STATE+'   '+P.ZIP
@ 13, 0 SAY "Dear"           
@ 13, 6 SAY TRIM(P.TITLE)+' '+TRIM(P.LAST)+','
@ 15,15 SAY "Body of response letter"
@ 17, 0 SAY "Local area reprsentative:"
@ 18, 0 SAY S.BUS:NAME
@ 19, 0 SAY TRIM(S.FIRST)+' '+S.LAST
@ 20, 0 SAY S.ADDR
@ 21, 0 SAY TRIM(S.CITY)+', '+S.STATE+'   '+S.ZIP
@ 22, 0 SAY S.PHONE

WAIT
ERASE
*EJECT
* LETTER.FMT
@  0,21 SAY "ABC Company"
@  1,20 SAY "123 Anystreet"
@  2,18 SAY "Houston, Tx 77777"
@  5,40 SAY DATE()
@  8, 0 SAY S.BUS:NAME
@  9, 0 SAY TRIM(S.TITLE)+' '+TRIM(S.FIRST)+' '+S.LAST
@ 10, 0 SAY S.ADDR
@ 11, 0 SAY TRIM(S.CITY)+', '+S.STATE+'  '+S.ZIP
@ 13, 0 SAY "Dear"
@ 13, 6 SAY TRIM(S.FIRST)+','
@ 15,15 SAY "Body of letter to agent"
@ 18, 0 SAY P.BUS:NAME
@ 19, 0 SAY TRIM(P.TITLE)+' '+TRIM(P.FIRST)+' '+P.LAST
@ 20, 0 SAY P.ADDR
@ 21, 0 SAY TRIM(P.CITY)+', '+P.STATE+'  '+P.ZIP
@ 22, 0 SAY P.PHONE
*EJECT
*SET FORMAT TO SCREEN
WAIT
ENDIF
ENDDO
DDR
@ 21, 0 SAY TRIM(P.CITY)+', '+P.STATE+'  '+P.ZIP
@ 22, 0 SAY P.PHONE
*EJECT
*SET FORMAT TO SCREEN