Subject |
Re: Form to Form |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Mon, 12 Jun 2023 17:01:52 +0200 |
Newsgroups |
dbase.getting-started |
Attachment(s) |
arrows_ef.cc, gridMervyn1.wfm, EditPatMervyn1.wfm, patientMervyn.DBF, patientMervyn.DBT,
patientMervyn.MDX |
On 2023/06/11 17:36, Mervyn Bick wrote:
> More, perhaps later otherwise tomorrow.
The next exciting installment. :-)
Twelve programmers, a dozen approaches to a problem. The example
programs attached are just that, examples. They reflect my approach to
the problem. They are not written on tablets of stone and you don't have
to accept them. It will NOT upset me if you don't like my way of doing
things.
I don't like the idea of typing in a name and the clicking on a
pushbutton to see if there is a match. Firstly I dislike having to move
a hand from the keyboard to the mouse and secondly I'm all for instant
gratification. :-) If I've typed WATCHAMACALLIT I want to know the
moment I typed that first A that there's a problem. I don't want to
wait until I click the pushbutton. In the example form the A pops up a
message box which can be acknowledged by simply pressing the Enter key.
The deletes the offending A and places the cursor ready for another
character.
As each character is typed in, unless there is no match, the rowpointer
moves to the first record where the patient's lastname starts with the
characters entered. In the example table there are three entries for
Weasley. If you want Ronald's record I've changed the index expression
so that typing WEASLEYR and pressing Enter or TAB will open the edit
form. You could, of course, simply click on Ronald's record and then
click on the GO TO button but that means taking a hand off the keyboard.
As an alternative, I've provided a custom entryfield which, unlike a
standard entryfield, can trap the up and down arrow keys. Now a W in
the entryfield will find the first Weasley. Two down arrows and the
Enter (or TAB) key opens the Edit form for Ronald.
Although the attached .dbf and .mdx files have changed I have not
changed the names as overwriting the original files should not cause a
problem with the original test forms.
Mervyn.
| class arrows_EF(parentObj) of EntryField(parentObj) custom
/*
Filename: arrows_EF.cc
Date: 2017-03-21
Author: Mervyn Bick
Description:
A custom entryfield that detects up_arrow and down_arrow keypresses that
do not trigger the control's key or onKey events. When an up or down arrow is
detected the control will execute the function arrow_pressed. If a like-named
function is created on the form it will be executed.
This custom control will only work with dBASE Plus 8 and later as the
CALLBACK feature in not avaiable in earlier versions of dBASE.
*/
with (this)
onOpen := CLASS::onOpen
onGotFocus := CLASS::onGotFocus
onLostFocus := CLASS::onLostFocus
onClose = CLASS::onClose
endwith
function onOpen()
#include winuser.h
if type("GetWindowLongA") # "FP"
extern CLONG GetWindowLongA(CHANDLE, CINT) user32
endif
if type("SetWindowLongA") # "FP"
extern CLONG SetWindowLongA(CHANDLE, CINT, CLONG) user32
endif
if type("CallWindowProcA") # "FP"
extern CLONG CallWindowProcA(CPTR, CHANDLE, CUINT, CUINT, CUINT) user32
endif
this.oldproc = null
this.newproc = null
if type("this.oldproc") # "FP"
this.oldproc = GetWindowLongA(this.hwnd, GWL_WNDPROC)
CALLBACK CLONG wndproc(CHANDLE, CUINT, CUINT, CUINT) OBJECT this
endif
if type("this.newproc") # "FP"
this.newproc = GetCallAddress(class::wndproc)
endif
return
function onGotFocus
SetWindowLongA(this.hwnd, GWL_WNDPROC, this.newproc)
return
function onLostFocus
SetWindowLongA(this.hwnd, GWL_WNDPROC, this.oldproc)
return
function onClose
if type("this.oldproc") = "FP"
if this.oldproc <> null and not empty(this.oldproc)
SetWindowLongA(this.hwnd, GWL_WNDPROC, this.oldproc)
RELEASE CALLBACK wndproc OBJECT this
endif
endif
return
function arrow_pressed(wparam)
if type("this.parent.arrow_pressed") # 'FP'
if wparam = VK_UP or wparam = VK_DOWN
msgbox(wparam+' Up or down arrow pressed')
endif
else
this.parent.arrow_pressed(wparam)
endif
return
function wndproc(hwnd,umsg,wparam,lparam)
if umsg = WM_KEYDOWN
if wparam = VK_UP or wparam = VK_DOWN
class::arrow_pressed(wparam)
endif
endif
return CallWindowProcA(this.oldproc, hwnd, uMsg, wParam, lParam)
endclass
|
** END HEADER -- do not remove this line
//
// Generated on 2023-06-12
//
parameter bModal
local f
f = new gridMervyn1Form()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class gridMervyn1Form of FORM
set procedure to arrows_ef.cc additive
with (this)
onOpen = class::FORM_ONOPEN
metric = 6 // Pixels
height = 505.0
left = 21.0
top = -3.0
width = 926.0
text = "EDIT PATIENT DATA"
autoCenter = true
sizeable = false
moveable = false
maximize = false
minimize = false
endwith
this.DATABASE1 = new DATABASE(this)
with (this.DATABASE1)
left = 728.0
top = 11.0
width = 53.0
height = 37.0
databaseName = "MYTEST"
active = true
endwith
this.PATIENT1 = new QUERY(this)
with (this.PATIENT1)
left = 2.0
top = 8.0
width = 43.0
height = 37.0
database = form.database1
sql = "select * from patientmervyn"
active = true
endwith
this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 30.0
left = 65.0
top = 25.0
width = 356.0
fontSize = 14.0
fontBold = true
text = "Enter Patient ID or Patient Last Name"
endwith
this.ENTRYFIELD1 = new ARROWS_EF(this)
with (this.ENTRYFIELD1)
onKey = class::ENTRYFIELD1_ONKEY
height = 33.0
left = 64.0
top = 66.0
width = 248.0
function = "!"
fontSize = 14.0
value = ""
selectAll = false
endwith
this.GRID1 = new GRID(this)
with (this.GRID1)
dataLink = form.patient1.rowset
columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN1"])
dataLink = form.patient1.rowset.fields["pat_no"]
editorType = 1 // EntryField
width = 70.0
endwith
columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN2"])
dataLink = form.patient1.rowset.fields["lname"]
editorType = 1 // EntryField
width = 150.0
endwith
columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN3"])
dataLink = form.patient1.rowset.fields["fname"]
editorType = 1 // EntryField
width = 150.0
endwith
columns["COLUMN4"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN4"])
dataLink = form.patient1.rowset.fields["addr2"]
editorType = 1 // EntryField
width = 199.0
endwith
columns["COLUMN5"] = new GRIDCOLUMN(form.GRID1)
with (columns["COLUMN5"])
dataLink = form.patient1.rowset.fields["dob"]
editorType = 1 // EntryField
width = 120.0
endwith
with (columns["COLUMN1"].headingControl)
value = "Patient #"
endwith
with (columns["COLUMN2"].headingControl)
value = "Last Name"
endwith
with (columns["COLUMN3"].headingControl)
value = "First Name"
endwith
with (columns["COLUMN4"].headingControl)
value = "Address"
endwith
with (columns["COLUMN5"].headingControl)
value = "DOB"
endwith
headingHeight = 22.0
cellHeight = 22.0
rowSelect = true
allowRowSizing = false
allowColumnSizing = false
allowColumnMoving = false
allowEditing = false
allowAddRows = false
height = 297.0
left = 24.0
top = 126.0
width = 707.0
endwith
this.PBSEARCH = new PUSHBUTTON(this)
with (this.PBSEARCH)
onClick = class::PBSEARCH_ONCLICK
visible = false
height = 39.0
left = 750.0
top = 77.0
width = 107.0
text = "SEARCH"
fontSize = 12.0
fontBold = true
endwith
this.PBGOEDIT = new PUSHBUTTON(this)
with (this.PBGOEDIT)
onClick = class::PBGOEDIT_ONCLICK
height = 39.0
left = 750.0
top = 133.0
width = 107.0
text = "GO TO"
fontSize = 12.0
fontBold = true
endwith
this.PBQUIT = new PUSHBUTTON(this)
with (this.PBQUIT)
onClick = class::PBQUIT_ONCLICK
height = 39.0
left = 750.0
top = 214.0
width = 107.0
text = "QUIT"
fontSize = 12.0
fontBold = true
endwith
this.TEXT2 = new TEXT(this)
with (this.TEXT2)
height = 50.0
left = 334.0
top = 56.0
width = 378.0
text = "Once a partial name has been found the up and down arrows will navigate in the grid while the entryfield has focus. This does not apply when a Patient number is entered. "
endwith
this.TEXT3 = new TEXT(this)
with (this.TEXT3)
height = 33.0
left = 47.0
top = 446.0
width = 743.0
text = "If the user clicks on a record in the grid it will be necessary to click on the GO TO button to open the Edit form. If the record is selected by entering a value in the entryfield pressing the Enter key or the TAB key will open the Edit form."
endwith
this.rowset = this.patient1.rowset
function arrow_pressed(nKey)
if len(form.entryfield1.value) > 0 and form.patient1.rowset.indexname = 'upboth'
if nKey = 40 //VK_DOWN
form.patient1.rowset.next()
elseif nKey = 38 //VK_UP
form.patient1.rowset.next(-1)
endif
endif
return
function PBSEARCH_onclick()
if ISBLANK(form.ENTRYFIELD1.value)
// play sound filename chord.wav
msgbox("Can't search without an entry.","NOTE",0)
FORM.ENTRYFIELD1.setfocus()
else
// The index needs to be set when the first character is enetered in the entryfield
// The only place to do this is in the entryfield's onKey() event handler
// if isalpha(form.ENTRYFIELD1.value)
// form.patient1.rowset.indexName := "upboth"
// else
// form.patient1.rowset.indexName := "pat_no"
// endif
if not form.patient1.rowset.FINDKEY(form.ENTRYFIELD1.value)
form.ENTRYFIELD1.value=""
form.grid1.visible:= false
// play sound filename chord.wav
msgbox("This patient not found","ERROR",0)
form.ENTRYFIELD1.setfocus()
else
form.grid1.refresh()
form.PBGOEDIT.visible:= true
form.grid1.visible := true
form.grid1.setfocus() //? Why not back to the entryfield to try again?
endif
endif
return
function ENTRYFIELD1_onKey(nChar, nPosition,bShift,bControl)
local cVal
if len(this.value) <> 0 //Avoid error if entryfield is cleared
//If Enter or Tab press, execute the function pbedit_onClick
if nChar = 13 or nChar = 9
form.PBGoEdit_onClick()
endif
//Check first character and set appropriate index
if nPosition = 2 and not isAlpha(this.value)
form.PATIENT1.rowset.indexname = 'pat_no'
endif
if nPosition = 2 and isAlpha(this.value)
form.PATIENT1.rowset.indexname = 'upboth'
endif
//Change rowpointer
//findKey() requires a variable, not an object property,
//as its argument hence the use of cVal instead of this.value
if isAlpha(this.value)
cVal = trim(this.value)
else
cVal = this.value
endif
cFound = form.Patient1.rowset.findkey(cVal)
if not cFound and form.patient1.rowset.indexname = "upboth"
msgbox('No patient with name starting with the character(s) in the entryfield')+this.value
form.entryfield1.value = substr(this.value,1,len(this.value)-1)
//Remove character that findkey() couldn't find
form.patient1.requery()
form.patient1.rowset.findkey(form.entryfield1.value)
form.entryfield1.keyboard('{end}') //Move to end of entry ready for next character
endif
else
//Nothing in entry field so we don't know which index to use
form.patient1.rowset.indexname := '' //No index active
endif
return
function PBGOEDIT_onClick
private cpat_no,clname
store "" to cpat_no,clname
//patient1 is name of main program query
cpat_no = form.patient1.rowset.fields["pat_no"].value
// msgbox("cpat_no: "+cpat_no) //this shows correct pat_no
//query1 is name of editpatMervyn program query
form.editpatMervyn.query1.rowset.findkey(cpat_no)
// form.editpatMervyn.query1.requery() ******* This was the culprit that
// always caused the Edit form to open with Harry Potter's details!!!!
clname = form.editpatMervyn.query1.rowset.fields["lname"].value
// msgbox("clname: "+clname) // this shows Last Name of rowset.first()
//there is no change in rowset in "findkey(cpat_no)" above
form.editpatMervyn.mdi = false
form.editpatMervyn.readmodal()
//When control returms from edit form release index, clear entryfield and set focus ready for next entry
form.patient1.rowset.indexname = ''
form.entryfield1.value = ''
form.entryfield1.setfocus()
return
function PBQUIT_onClick()
form.patient1.active = false
local f
f = findinstance("editpatMervynForm")
do while not empty(f)
f.close()
f = findinstance("editpatMervynForm",f)
enddo
form.editpatMervyn = null
close databases
form.close()
return true
function form_onOpen()
set procedure to editpatMervyn1.wfm
form.editpatMervyn = new editpatMervyn1Form()
form.editpatMervyn.parent = form //Open path back to gridtest
//to editpatMervyn to facilitate requery().
return
endclass
| //set procedure to lookins1.wfm additive
//set procedure to lookins2.wfm additive
** END HEADER -- do not remove this line
//
// Generated on 2023-06-12
//
parameter bModal
local f
f = new EditPatMervyn1Form()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class EditPatMervyn1Form of FORM
with (this)
onOpen = class::FORM_ONOPEN
scaleFontSize = 12.0
metric = 6 // Pixels
height = 619.0
left = 0.0
top = 12.0
width = 920.0
text = ""
autoCenter = true
sizeable = false
moveable = false
sysMenu = false
maximize = false
minimize = false
endwith
this.DATABASE1 = new DATABASE(this)
with (this.DATABASE1)
left = 728.0
top = 11.0
width = 53.0
height = 37.0
databaseName = "MYTEST"
active = true
endwith
this.QUERY2INSCODE1 = new QUERY(this)
with (this.QUERY2INSCODE1)
left = 812.0
top = 11.0
width = 87.0
height = 37.0
database = form.database1
endwith
this.QUERY1 = new QUERY(this)
with (this.QUERY1)
left = 812.0
top = 11.0
width = 39.0
height = 37.0
database = form.database1
sql = "select * from patientmervyn"
active = true
endwith
with (this.QUERY1.rowset)
indexName = "PAT_NO"
endwith
this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 27.0
left = 56.0
top = 11.0
width = 203.0
fontSize = 15.0
fontBold = true
text = "EDIT PATIENT DATA"
endwith
this.TEXTPATNO = new TEXT(this)
with (this.TEXTPATNO)
height = 25.0
left = 329.0
top = 15.0
width = 80.0
fontSize = 12.0
text = "Patient ID:"
endwith
this.ENTRYFIELDPATNO = new ENTRYFIELD(this)
with (this.ENTRYFIELDPATNO)
when = {;return .f.}
dataLink = form.query1.rowset.fields["pat_no"]
height = 28.0
left = 406.0
top = 11.0
width = 65.0
fontSize = 14.0
endwith
this.TEXTLNAME = new TEXT(this)
with (this.TEXTLNAME)
height = 22.0
left = 21.0
top = 55.0
width = 84.0
fontSize = 12.0
text = "Last Name"
endwith
this.ENTRYFIELDLNAME = new ENTRYFIELD(this)
with (this.ENTRYFIELDLNAME)
dataLink = form.query1.rowset.fields["lname"]
height = 26.0
left = 105.0
top = 55.0
width = 190.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTTITLE = new TEXT(this)
with (this.TEXTTITLE)
height = 22.0
left = 322.0
top = 55.0
width = 35.0
fontSize = 12.0
text = "<p>Title</p><p></p>"
endwith
this.ENTRYFIELDTITLE = new ENTRYFIELD(this)
with (this.ENTRYFIELDTITLE)
dataLink = form.query1.rowset.fields["title"]
height = 26.0
left = 357.0
top = 55.0
width = 55.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTFNAME = new TEXT(this)
with (this.TEXTFNAME)
height = 22.0
left = 441.0
top = 55.0
width = 84.0
fontSize = 12.0
text = "First Name"
endwith
this.ENTRYFIELDFNAME = new ENTRYFIELD(this)
with (this.ENTRYFIELDFNAME)
dataLink = form.query1.rowset.fields["fname"]
height = 26.0
left = 529.0
top = 55.0
width = 238.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTMI = new TEXT(this)
with (this.TEXTMI)
height = 22.0
left = 784.0
top = 55.0
width = 28.0
fontSize = 12.0
text = "<p>MI</p><p></p>"
endwith
this.ENTRYFIELDMI = new ENTRYFIELD(this)
with (this.ENTRYFIELDMI)
dataLink = form.query1.rowset.fields["mi"]
height = 26.0
left = 815.0
top = 55.0
width = 25.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTADDR1 = new TEXT(this)
with (this.TEXTADDR1)
height = 22.0
left = 56.0
top = 89.0
width = 35.0
fontSize = 12.0
text = "C/O"
endwith
this.ENTRYFIELDADDR1 = new ENTRYFIELD(this)
with (this.ENTRYFIELDADDR1)
dataLink = form.query1.rowset.fields["addr1"]
height = 26.0
left = 105.0
top = 89.0
width = 217.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTADDR2 = new TEXT(this)
with (this.TEXTADDR2)
height = 22.0
left = 35.0
top = 127.0
width = 61.0
fontSize = 12.0
text = "Address"
endwith
this.ENTRYFIELDADDR2 = new ENTRYFIELD(this)
with (this.ENTRYFIELDADDR2)
dataLink = form.query1.rowset.fields["addr2"]
height = 26.0
left = 105.0
top = 122.0
width = 280.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTCITY = new TEXT(this)
with (this.TEXTCITY)
height = 22.0
left = 406.0
top = 127.0
width = 35.0
fontSize = 12.0
text = "City"
endwith
this.ENTRYFIELDCITY = new ENTRYFIELD(this)
with (this.ENTRYFIELDCITY)
dataLink = form.query1.rowset.fields["city"]
height = 26.0
left = 442.0
top = 122.0
width = 237.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTST = new TEXT(this)
with (this.TEXTST)
height = 22.0
left = 700.0
top = 127.0
width = 42.0
fontSize = 12.0
text = "State"
endwith
this.ENTRYFIELDST = new ENTRYFIELD(this)
with (this.ENTRYFIELDST)
dataLink = form.query1.rowset.fields["st"]
height = 26.0
left = 749.0
top = 122.0
width = 28.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTZIP = new TEXT(this)
with (this.TEXTZIP)
height = 22.0
left = 789.0
top = 127.0
width = 32.0
fontSize = 12.0
text = "Zip"
endwith
this.ENTRYFIELDZIP = new ENTRYFIELD(this)
with (this.ENTRYFIELDZIP)
dataLink = form.query1.rowset.fields["zip"]
height = 26.0
left = 819.0
top = 122.0
width = 55.0
picture = "99999"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTHPH = new TEXT(this)
with (this.TEXTHPH)
height = 16.0
left = 21.0
top = 155.0
width = 94.0
fontSize = 12.0
text = "Home Phone"
endwith
this.ENTRYFIELDHPHONE = new ENTRYFIELD(this)
with (this.ENTRYFIELDHPHONE)
dataLink = form.query1.rowset.fields["hphone"]
height = 22.0
left = 126.0
top = 155.0
width = 127.0
picture = "(999)999-9999"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTBPH = new TEXT(this)
with (this.TEXTBPH)
height = 22.0
left = 273.0
top = 155.0
width = 117.0
fontSize = 12.0
text = "Business Phone"
endwith
this.ENTRYFIELDBPH = new ENTRYFIELD(this)
with (this.ENTRYFIELDBPH)
dataLink = form.query1.rowset.fields["bphone"]
height = 22.0
left = 399.0
top = 155.0
width = 127.0
picture = "(999)999-9999"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTBEXT = new TEXT(this)
with (this.TEXTBEXT)
height = 22.0
left = 546.0
top = 155.0
width = 30.0
fontSize = 12.0
text = "Ext."
endwith
this.ENTRYFIELDBEXT = new ENTRYFIELD(this)
with (this.ENTRYFIELDBEXT)
dataLink = form.query1.rowset.fields["bext"]
height = 22.0
left = 581.0
top = 155.0
width = 47.0
picture = "!!!!!!!"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTCPH = new TEXT(this)
with (this.TEXTCPH)
height = 22.0
left = 28.0
top = 182.0
width = 84.0
fontSize = 12.0
text = "Cell Phone"
endwith
this.ENTRYFIELDCPH = new ENTRYFIELD(this)
with (this.ENTRYFIELDCPH)
dataLink = form.query1.rowset.fields["cphone"]
height = 26.0
left = 126.0
top = 182.0
width = 127.0
picture = "(999)999-9999"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTSEX = new TEXT(this)
with (this.TEXTSEX)
height = 24.0
left = 273.0
top = 190.0
width = 63.0
fontSize = 12.0
text = "Gender"
endwith
this.RADIOBUTTONMALE = new RADIOBUTTON(this)
with (this.RADIOBUTTONMALE)
dataLink = form.query1.rowset.fields["sex"]
height = 24.0
left = 336.0
top = 182.0
width = 66.0
text = "Male"
fontSize = 12.0
group = true
endwith
this.RADIOBUTTONFEMALE = new RADIOBUTTON(this)
with (this.RADIOBUTTONFEMALE)
dataLink = form.query1.rowset.fields["sex"]
height = 20.0
left = 336.0
top = 204.0
width = 72.0
text = "Female"
fontSize = 12.0
endwith
this.TEXTSSNO = new TEXT(this)
with (this.TEXTSSNO)
height = 24.0
left = 434.0
top = 182.0
width = 126.0
fontSize = 12.0
text = "Social Security #"
endwith
this.ENTRYFIELDSSNO = new ENTRYFIELD(this)
with (this.ENTRYFIELDSSNO)
dataLink = form.query1.rowset.fields["ssno"]
height = 26.0
left = 560.0
top = 182.0
width = 109.0
picture = "999-99-9999"
function = "R"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTMBI = new TEXT(this)
with (this.TEXTMBI)
height = 24.0
left = 686.0
top = 182.0
width = 35.0
fontSize = 12.0
text = "MBI"
endwith
this.ENTRYFIELDMBI = new ENTRYFIELD(this)
with (this.ENTRYFIELDMBI)
dataLink = form.query1.rowset.fields["mbi"]
height = 26.0
left = 728.0
top = 182.0
width = 132.0
picture = "9A!9-A!9-AA99"
function = "R!"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTBILLTO = new TEXT(this)
with (this.TEXTBILLTO)
height = 22.0
left = 21.0
top = 225.0
width = 108.0
fontSize = 12.0
text = "Send Bills To:"
endwith
this.RADIOBUTTONBILLTOPAT = new RADIOBUTTON(this)
with (this.RADIOBUTTONBILLTOPAT)
dataLink = form.query1.rowset.fields["bill_to"]
height = 22.0
left = 126.0
top = 216.0
width = 70.0
text = "Patient"
fontSize = 12.0
group = true
endwith
this.RADIOBUTTONBILLTOOTHER = new RADIOBUTTON(this)
with (this.RADIOBUTTONBILLTOOTHER)
dataLink = form.query1.rowset.fields["bill_to"]
height = 22.0
left = 127.0
top = 237.0
width = 70.0
text = "Other"
fontSize = 12.0
endwith
this.TEXTDOB = new TEXT(this)
with (this.TEXTDOB)
height = 22.0
left = 462.0
top = 220.0
width = 98.0
wrap = false
colorNormal = "BtnText"
alignVertical = 2 // Bottom
fontSize = 12.0
text = "Date of Birth"
endwith
this.ENTRYFIELDDOB = new ENTRYFIELD(this)
with (this.ENTRYFIELDDOB)
onGotFocus = {;keyboard "{Home}"}
onLostFocus = class::ENTRYFIELDDOB_ONLOSTFOCUS
valid = class::ENTRYFIELDDOB_VALID
dataLink = form.query1.rowset.fields["dob"]
height = 26.0
left = 560.0
top = 220.0
width = 100.0
picture = "99/99/9999"
function = "@D"
colorHighLight = "WindowText/0xffff80"
fontName = "Courier"
fontSize = 12.0
validRequired = true
validErrorMsg = "Invalid Date of Birth"
borderStyle = 7 // Client
endwith
this.TEXTSHOWAGE = new TEXT(this)
with (this.TEXTSHOWAGE)
height = 22.0
left = 686.0
top = 220.0
width = 38.0
fontSize = 12.0
text = "Age"
endwith
this.ENTRYFIELDSHOWAGE = new ENTRYFIELD(this)
with (this.ENTRYFIELDSHOWAGE)
when = {;return .f.}
height = 26.0
left = 728.0
top = 220.0
width = 41.0
fontName = "Courier"
fontSize = 12.0
value = " 67"
borderStyle = 7 // Client
endwith
this.RECTANGLE1 = new RECTANGLE(this)
with (this.RECTANGLE1)
left = 28.0
top = 264.0
width = 854.0
height = 195.0
text = ""
colorNormal = "BtnText/Silver"
borderStyle = 9 // Etched In
endwith
this.TEXTINS1ID = new TEXT(this)
with (this.TEXTINS1ID)
height = 22.0
left = 35.0
top = 276.0
width = 42.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 1"
endwith
this.ENTRYFIELDINS1ID = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS1ID)
onKey = class::ENTRYFIELDINS1ID_ONKEY
height = 26.0
left = 82.0
top = 275.0
width = 33.0
picture = "!!"
fontName = "Courier"
fontSize = 12.0
value = " "
maxLength = 2
endwith
this.ENTRYFIELDINS1NAME = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS1NAME)
when = {;return .f.}
height = 26.0
left = 126.0
top = 275.0
width = 370.0
fontName = "Courier"
fontSize = 12.0
value = ""
maxLength = 40
endwith
this.TEXTINS1NO = new TEXT(this)
with (this.TEXTINS1NO)
height = 22.0
left = 553.0
top = 276.0
width = 53.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 1 #"
endwith
this.ENTRYFIELDINS1NO = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS1NO)
dataLink = form.query1.rowset.fields["ins1no"]
height = 26.0
left = 610.0
top = 275.0
width = 235.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTINS1GRPNO = new TEXT(this)
with (this.TEXTINS1GRPNO)
height = 22.0
left = 35.0
top = 304.0
width = 84.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 1 Grp #"
endwith
this.ENTRYFIELDINS1GRPID = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS1GRPID)
dataLink = form.query1.rowset.fields["ins1_gr"]
height = 26.0
left = 126.0
top = 304.0
width = 190.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTINS1POL = new TEXT(this)
with (this.TEXTINS1POL)
height = 22.0
left = 369.0
top = 309.0
width = 132.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 1 Policy Holder"
endwith
this.RADIOBUTTONINS1PHPAT = new RADIOBUTTON(this)
with (this.RADIOBUTTONINS1PHPAT)
dataLink = form.query1.rowset.fields["ins1_ph"]
height = 24.0
left = 507.0
top = 302.0
width = 78.0
text = "P"
colorNormal = "BtnText/Silver"
fontSize = 12.0
group = true
endwith
this.RADIOBUTTONINS1PHOTHER = new RADIOBUTTON(this)
with (this.RADIOBUTTONINS1PHOTHER)
dataLink = form.query1.rowset.fields["ins1_ph"]
height = 20.0
left = 507.0
top = 323.0
width = 78.0
text = "O"
colorNormal = "BtnText/Silver"
fontSize = 12.0
endwith
this.TEXTINS1NOTES = new TEXT(this)
with (this.TEXTINS1NOTES)
height = 22.0
left = 560.0
top = 304.0
width = 84.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 1 Notes"
endwith
this.ENTRYFIELDINS1NOTES = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS1NOTES)
dataLink = form.query1.rowset.fields["ins1notes"]
height = 26.0
left = 653.0
top = 304.0
width = 192.0
function = "!"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTINS2ID = new TEXT(this)
with (this.TEXTINS2ID)
height = 22.0
left = 35.0
top = 346.0
width = 42.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 2 "
endwith
this.ENTRYFIELDINS2ID = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS2ID)
dataLink = form.query1.rowset.fields["ins2"]
height = 26.0
left = 82.0
top = 346.0
width = 33.0
picture = "!!"
fontName = "Courier"
fontSize = 12.0
endwith
this.ENTRYFIELDINS2NAME = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS2NAME)
when = {;return .f.}
height = 26.0
left = 126.0
top = 346.0
width = 370.0
fontName = "Courier"
fontSize = 12.0
value = ""
maxLength = 40
endwith
this.TEXTINS2NO = new TEXT(this)
with (this.TEXTINS2NO)
height = 22.0
left = 553.0
top = 346.0
width = 53.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 2 #"
endwith
this.ENTRYFIELDINS2NO = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS2NO)
dataLink = form.query1.rowset.fields["ins2no"]
height = 26.0
left = 610.0
top = 346.0
width = 235.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTINS2GRP = new TEXT(this)
with (this.TEXTINS2GRP)
height = 22.0
left = 35.0
top = 375.0
width = 84.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 2 Grp #"
endwith
this.ENTRYFIELDINS2GRPID = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS2GRPID)
dataLink = form.query1.rowset.fields["ins2_gr"]
height = 26.0
left = 126.0
top = 375.0
width = 190.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTINS2POL = new TEXT(this)
with (this.TEXTINS2POL)
height = 22.0
left = 369.0
top = 381.0
width = 133.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 2 Policy Holder"
endwith
this.RADIOBUTTONINS2PHPAT = new RADIOBUTTON(this)
with (this.RADIOBUTTONINS2PHPAT)
dataLink = form.query1.rowset.fields["ins2_ph"]
height = 20.0
left = 507.0
top = 374.0
width = 78.0
text = "P"
colorNormal = "BtnText/Silver"
fontSize = 12.0
group = true
endwith
this.RADIOBUTTONINS2PHOTHER = new RADIOBUTTON(this)
with (this.RADIOBUTTONINS2PHOTHER)
dataLink = form.query1.rowset.fields["ins2_ph"]
height = 20.0
left = 507.0
top = 394.0
width = 67.0
text = "O"
colorNormal = "BtnText/Silver"
fontSize = 12.0
endwith
this.TEXTINS2NOTES = new TEXT(this)
with (this.TEXTINS2NOTES)
height = 19.0
left = 560.0
top = 375.0
width = 84.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "Ins 2 Notes"
endwith
this.ENTRYFIELDINS2NOTES = new ENTRYFIELD(this)
with (this.ENTRYFIELDINS2NOTES)
dataLink = form.query1.rowset.fields["ins2notes"]
height = 26.0
left = 653.0
top = 375.0
width = 192.0
fontName = "Courier"
fontSize = 12.0
endwith
this.CHECKBOXSOF = new CHECKBOX(this)
with (this.CHECKBOXSOF)
dataLink = form.query1.rowset.fields["sof"]
height = 24.0
left = 91.0
top = 425.0
width = 140.0
text = "Signature on File"
colorNormal = "BtnText/Silver"
fontSize = 12.0
textLeft = true
endwith
this.TEXTSOFDATE = new TEXT(this)
with (this.TEXTSOFDATE)
height = 24.0
left = 289.0
top = 425.0
width = 77.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "SOF Date"
endwith
this.ENTRYFIELDSOFDATE = new ENTRYFIELD(this)
with (this.ENTRYFIELDSOFDATE)
dataLink = form.query1.rowset.fields["sof_date"]
height = 26.0
left = 372.0
top = 425.0
width = 97.0
picture = "99/99/9999"
function = "D"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTSOFVALDATE = new TEXT(this)
with (this.TEXTSOFVALDATE)
height = 22.0
left = 567.0
top = 425.0
width = 119.0
colorNormal = "BtnText/Silver"
fontSize = 12.0
text = "SOF Valid Date"
endwith
this.ENTRYFIELDSOFVALDATE = new ENTRYFIELD(this)
with (this.ENTRYFIELDSOFVALDATE)
dataLink = form.query1.rowset.fields["sof_valdat"]
height = 26.0
left = 686.0
top = 425.0
width = 97.0
picture = "99/99/9999"
function = "D"
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTFIRSTAPPT = new TEXT(this)
with (this.TEXTFIRSTAPPT)
height = 24.0
left = 47.0
top = 464.0
width = 86.0
fontSize = 12.0
text = "First Appt"
endwith
this.ENTRYFIELDFIRSTAPPT = new ENTRYFIELD(this)
with (this.ENTRYFIELDFIRSTAPPT)
dataLink = form.query1.rowset.fields["first_appt"]
height = 26.0
left = 140.0
top = 464.0
width = 100.0
picture = "99/99/9999"
function = "@D"
fontName = "Courier"
fontSize = 12.0
validRequired = true
endwith
this.TEXTLASTAPPT = new TEXT(this)
with (this.TEXTLASTAPPT)
height = 24.0
left = 266.0
top = 464.0
width = 77.0
fontSize = 12.0
text = "Last Appt"
endwith
this.ENTRYFIELDLASTAPPT = new ENTRYFIELD(this)
with (this.ENTRYFIELDLASTAPPT)
dataLink = form.query1.rowset.fields["last_appt"]
height = 24.0
left = 343.0
top = 464.0
width = 100.0
picture = "99/99/9999"
function = "D"
fontName = "Courier"
fontSize = 12.0
validRequired = true
endwith
this.TEXTREMDATE = new TEXT(this)
with (this.TEXTREMDATE)
height = 24.0
left = 46.0
top = 495.0
width = 115.0
fontSize = 12.0
text = "Reminder Date"
endwith
this.ENTRYFIELDREM_DATE = new ENTRYFIELD(this)
with (this.ENTRYFIELDREM_DATE)
onGotFocus = {;keyboard "{home}"+"{shift+end}"}
valid = class::ENTRYFIELDREM_DATE_VALID
dataLink = form.query1.rowset.fields["rem_date"]
height = 24.0
left = 175.0
top = 495.0
width = 62.0
picture = "99/99"
fontName = "Courier"
fontSize = 12.0
validRequired = true
validErrorMsg = "Invalid Entry"
borderStyle = 7 // Client
endwith
this.TEXTINTVL = new TEXT(this)
with (this.TEXTINTVL)
height = 20.0
left = 316.0
top = 495.0
width = 55.0
fontSize = 12.0
text = "Interval"
endwith
this.COMBOBOXINTVL = new COMBOBOX(this)
with (this.COMBOBOXINTVL)
dataLink = form.query1.rowset.fields["intvl"]
systemTheme = false
height = 24.0
left = 378.0
top = 495.0
width = 53.0
fontName = "Courier"
fontSize = 12.0
colorNormal = "Black/White"
dataSource = 'array {"1Y","2Y","3Y","4Y","2M","3M","4M","6M","9M","18M"," "}'
style = 1 // DropDown
dropDownHeight = 8.0
endwith
this.TEXTNEXTAPPT = new TEXT(this)
with (this.TEXTNEXTAPPT)
height = 24.0
left = 476.0
top = 495.0
width = 77.0
fontSize = 12.0
text = "Next Appt"
endwith
this.ENTRYFIELDNEXTAPPT = new ENTRYFIELD(this)
with (this.ENTRYFIELDNEXTAPPT)
dataLink = form.query1.rowset.fields["next_appt"]
height = 24.0
left = 567.0
top = 495.0
width = 97.0
picture = "99/99/9999"
function = "D"
fontName = "Courier"
fontSize = 12.0
validRequired = true
endwith
this.TEXTNOTES = new TEXT(this)
with (this.TEXTNOTES)
height = 24.0
left = 50.0
top = 531.0
width = 50.0
fontSize = 12.0
text = "Notes"
endwith
this.ENTRYFIELDNOTES = new ENTRYFIELD(this)
with (this.ENTRYFIELDNOTES)
dataLink = form.query1.rowset.fields["notes"]
height = 24.0
left = 105.0
top = 531.0
width = 195.0
fontName = "Courier"
fontSize = 12.0
endwith
this.TEXTPATNOTES = new TEXT(this)
with (this.TEXTPATNOTES)
height = 24.0
left = 53.0
top = 563.0
width = 104.0
fontSize = 12.0
text = "Patient Notes"
endwith
this.ENTRYFIELDPATNOTES = new ENTRYFIELD(this)
with (this.ENTRYFIELDPATNOTES)
dataLink = form.query1.rowset.fields["patmemo"]
height = 24.0
left = 165.0
top = 565.0
width = 54.0
fontName = "Courier"
fontSize = 12.0
endwith
this.RECTANGLE2 = new RECTANGLE(this)
with (this.RECTANGLE2)
left = 384.0
top = 530.0
width = 463.0
height = 55.0
text = ""
endwith
this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
height = 26.0
left = 418.0
top = 545.0
width = 107.0
text = "BILLING"
fontSize = 12.0
fontBold = true
endwith
this.PUSHBUTTONAPPEND = new PUSHBUTTON(this)
with (this.PUSHBUTTONAPPEND)
onClick = class::PUSHBUTTONAPPEND_ONCLICK
height = 26.0
left = 550.0
top = 545.0
width = 130.0
text = "BEGIN APPEND"
fontSize = 12.0
fontBold = true
endwith
this.PUSHBUTTONQUIT = new PUSHBUTTON(this)
with (this.PUSHBUTTONQUIT)
onClick = class::PUSHBUTTONQUIT_ONCLICK
height = 26.0
left = 716.0
top = 545.0
width = 107.0
text = "QUIT"
fontSize = 12.0
fontBold = true
endwith
this.rowset = this.query1.rowset
//this.rowset = this.query2.rowset
function PUSHBUTTONQUIT_onClick()
if msgbox("Abandon Changes?","NOTICE",36) ==6
form.rowset.abandon()
endif
form.close()
return
function PushbuttonAppend_onclick
//form.rowset.beginappend()
msgbox("Nothing here yet")
return
function form_onOpen()
// form.query1.rowset.FINDKEY(cpat_no)
// form.query1.requery()
return
//Do not change EFSHOWAGE
form.entryfieldshowage.value= ;
STR(FLOOR((VAL(DTOS(DATE()))-VAL(DTOS(form.query1.rowset.fields["dob"].value)))/10000),3)
return
function entryfieldins1ID_onRMD
form.lookins1=new LOOKUPFORM1()
form.lookins1.parent=FORM
form.lookins1.readmodal()
return
/* function ENTRYFIELDIns1ID_OLF
use c:\pat\data\ins_info in select()
form.entryfieldins1name.value = lookup( ins_info, form.entryfieldIns1ID.value, ins_info, Ins_info->ins_code )
//database = form.database1
//sql = "select ins_code, ins_name from ins_info where ins_code:= 'UH'"
//active = true
form.query2.rowset.indexname = "INS_CODE"
mlookup = form.query2.rowset.lookuprowset
//mins_name= substr((form.query2.rowset.fields["ins_name"].value),4)
mnamelookup = form.query2.rowset.fields["ins_name"].value
msgbox("mlookup is "+mlookup+ " mnamelookup is "+mnamelookup)
return
*/
function ENTRYFIELDREM_DATE_valid
do case
case val(substr(this.value,4,2))=0
lnyear=2000
case val(substr(this.value,4,2))>70
lnyear=1900+val(substr(this.value,4,2))
case val(substr(this.value,4,2))<69 .and. ;
val(substr(this.value,4,2))<>0
lnyear=2000+val(substr(this.value,4,2))
endcase
IF LEN(TRIM(this.value))<5 .and.this.value<>" / "
RETURN .F.
ENDIF
IF (SUBSTR(this.value,1,2)>SUBSTR(DTOC(DATE()),1,2) ;
.AND. SUBSTR(this.value,1,2)>="01" .AND. SUBSTR(this.value,1,2)<="12" ;
.AND. lnyear=year(date())) &&SAME YEAR/LATER MONTH
RETURN .T.
ELSE
IF (SUBSTR(this.value,1,2)>="01" .AND. SUBSTR(this.value,1,2)<="12" ;
.AND. lnyear>year(date()) .and. lnyear<=year(date())+4) &&NEXT YEAR
RETURN .T.
ELSE
IF this.value=" / " .OR. this.value=SPACE(5)
RETURN .T.
ENDIF
ENDIF
ENDIF
return .F.
function ENTRYFIELDINS1ID_OnKey(nChar, nPosition,bShift,bControl)
if len(trim(this.value)) >1 // Two characters entered
form.QUERY2Inscode1.params['ins_code'] = this.value //pass value in entryfield to query parameter
form.QUERY2Inscode1.requery() // fetch state name for the given stateID
//Test to see if a valid stateID was entered
if form.QUERY2Inscode1.rowset.count() = 1 //found the state
form.ENTRYFIELDINS1NAME.value = form.QUERY2Inscode1.rowset.fields['ins_name'].value
this.before.setfocus() //Move focus to next object in z-order
else // stateId not found
//form.ENTRYFIELDINS1NAME.value = 'Invalid INS Code'
msgbox("Invalid Insurance Code")
form.ENTRYFIELDINS1ID.value = '' //Empty entryfield
form.ENTRYFIELDINS1ID.setfocus() //Back to entryfield to try again
endif
endif
return
function ENTRYFIELDDOB_valid
if this.value=" / / "
form.entryfieldshowage.value=" "
return .t.
else
if this.value=CTOD(DTOC(this.value));
.and. this.value<=date()
form.entryfieldshowage.value= ;
STR(FLOOR((VAL(DTOS(DATE()))-VAL(DTOS(form.query1.rowset.fields["dob"].value)))/10000),3)
return .t.
endif
endif
//form.entryfieldshowage.value= ;
//STR(FLOOR((VAL(DTOS(DATE()))-VAL(DTOS(form.query1.rowset.fields["dob"].value)))/10000),3)
return .f.
Function ENTRYFIELDDOB_OnLostFocus
form.entryfieldshowage.value= ;
STR(FLOOR((VAL(DTOS(DATE()))-VAL(DTOS(form.query1.rowset.fields["dob"].value)))/10000),3)
return
/* FUNCTION Age( dob )
-------------------------------------------------------------
Programmer..: Martin Leon
Date........: 10/23/1991
Notes.......: Returns age of thing as of date() given its
birthdate.
Written for.: dBASE IV, 1.1
Rev. History: 10/23/1991 -- Original
08/10/1993 -- Ken Mayer, "stole" algorithm
from the routine AGE2. It's more efficient.
Fall, 1994 -- revised for dBASE 5.0 for
Windows. Jay Parsons, 72662,1302
11/02/1996 -- Tinkered with minimally to make
part of custom class. Ken Mayer
Calls.......: None
Usage.......: DateEx.Age(<dBirth>)
Example.....: ? "Joe is "+ltrim(str(dMyDate.Age(dBirth)))+;
" today ..."
Returns.....: Numeric value in years
Parameters..: dBirth = birthdate of thing to return age of.
-------------------------------------------------------------
RETURN ( floor( ( val( dtos( date() ) ) ;
- val( dtos( dBirth ) ) ) / 10000 ) )
*/
endclass
|
|