
Sub main ()
admit.Show
End Sub

Sub saveproc ()

screen.mousepointer = 11
SavePicture assess3.picture3.image, LTrim$(RTrim$(ID$)) + ".bmp"
screen.mousepointer = 0

	savedata

End Sub

Sub Endroutine ()
Unload admit
Unload assess1
Unload assess2
Unload assess3
Unload idform
Unload medhist
Unload mdiform
Unload summary
End    'redundant but...
End Sub

Sub dispose ()
exitsave.Show 1
If admit.picture1.tag = "new" Then
    admit.picture1.Cls
    admit.picture1.autoredraw = -1
    admit.picture1.Scale (0, 0)-(3, 4)
    admit.picture1.currentx = .8
    admit.picture1.currenty = 1.2
    admit.picture1.Print "CLICK"
    admit.picture1.currentx = 1
    admit.picture1.currenty = 2
    admit.picture1.Print " TO"
    admit.picture1.currentx = .8
    admit.picture1.currenty = 2.8
    admit.picture1.Print "BEGIN"
    clearoutine
    admit.Show
End If
End Sub

Sub savedata ()

getfields

On Error Resume Next
SavePicture summary.picture1.picture, LTrim$(RTrim$(inkID$)) + ".bmp"

Open "health.dat" For Random As #1 Len = Len(patrecord)
If recindex <> 0 Then
Put #1, recindex, patrecord
Else
Put #1, numrecs + 1, patrecord
End If

Close #1


End Sub

Sub highlight (foo As Form, group As Integer, myindex As Integer)

Select Case group

Case 3
    For n = 0 To group - 1
	
	If n <> myindex And foo.option3d1(n).forecolor = &H0& Then
	foo.option3d1(n).forecolor = &HFF0000
	End If
    Next n
   foo.option3d1(myindex).forecolor = &H0&

Case 6

    For n = 0 To group - 1
	
	If n <> myindex And foo.option3d4(n).forecolor = &H0& Then
	foo.option3d4(n).forecolor = &HFF0000
	End If
    Next n
    foo.option3d4(myindex).forecolor = &H0&

Case 5

    For n = 0 To group - 1
	
	If n <> myindex And foo.option3d10(n).forecolor = &H0& Then
	foo.option3d10(n).forecolor = &HFF0000
	If n = 4 Then foo.label5.forecolor = &HFF0000
	End If
    Next n

    foo.option3d10(myindex).forecolor = &H0&

End Select

End Sub

Sub editswap (thebedit As Control, thehedit As Control, process As Integer)
Select Case process
Case 1
    For n = 1 To Len(thebedit.text)
    a$ = a$ + Mid$(thebedit.text, n, 1) + Chr$(32)
    Next n
    thehedit.text = Chr$(32) + a$

Case 2
    For n = 1 To Len(thehedit.text)
	If Mid$(thehedit.text, n, 1) <> " " Then
	    a$ = a$ + Mid$(thehedit.text, n, 1)
	End If
    Next n
    thebedit.text = a$
End Select


End Sub

Sub menumode (fooey As Form)
menu.Show 1
Select Case menuchoice
Case "new"
admit.picture1.Cls
admit.picture1.autoredraw = -1
admit.picture1.Scale (0, 0)-(3, 4)
admit.picture1.currentx = .8
admit.picture1.currenty = 1.2
admit.picture1.Print "CLICK"
admit.picture1.currentx = 1
admit.picture1.currenty = 2
admit.picture1.Print " TO"
admit.picture1.currentx = .6
admit.picture1.currenty = 2.8
admit.picture1.Print "RETURN"
clearoutine
admit.Show
If admit.tag <> "cover" Then fooey.Hide
Case "one"
idform.Show
If fooey.tag <> "id" Then fooey.Hide
Case "two"
assess1.Show
If fooey.tag <> "admission" Then fooey.Hide
Case "three"
screen.mousepointer = 11
assess2.Show
If fooey.tag <> "diagnosis" Then fooey.Hide
screen.mousepointer = 0
Case "four"
screen.mousepointer = 11
medhist.Show
If fooey.tag <> "history" Then fooey.Hide
screen.mousepointer = 0
Case "five"
screen.mousepointer = 11
assess3.Show
If fooey.tag <> "physical" Then fooey.Hide
screen.mousepointer = 0
Case "six"
screen.mousepointer = 11
mdiform.Show
If fooey.tag <> "clinical" Then fooey.Hide
screen.mousepointer = 0
Case "seven"
screen.mousepointer = 11
summary.Show
If fooey.tag <> "summary" Then fooey.Hide
screen.mousepointer = 0
Case "eight"
'clear
dispose
Case "nine"
'save
dispose
Case "ten"
'exit
dispose
Case "eleven"
'cancel
End Select
End Sub

Sub clearoutine ()
screen.mousepointer = 11
LSet temprecord = clearrecord
    
   
    For n = 0 To 2
	assess1.option3d1(n).forecolor = &HFF0000
	Next n
    For n = 0 To 5
	assess1.option3d4(n).forecolor = &HFF0000
	Next n
    For n = 0 To 4
	assess1.option3d10(n).forecolor = &HFF0000
	Next n
	assess1.label5.forecolor = &HFF0000

assess1.bedit2.text = ""
assess1.hedit2.text = ""

idform.bedit1.text = ""
idform.hedit1.text = ""
    idform.bedit1.visible = -1
    idform.bedit1.text = "   -  -    "
    idform.hedit1.visible = 0
    idform.hedit1.enabled = -1
    idform.anibutton4.value = 1
    idform.anibutton3(2).value = 1
    idform.option3d1(0).value = 0
    idform.option3d1(1).value = 0
    idform.check3d1.value = 0

picloc = 0

assess1.option3d1(0).value = 0
assess1.option3d1(1).value = 0
assess1.option3d1(2).value = 0
assess1.option3d4(0).value = 0
assess1.option3d4(1).value = 0
assess1.option3d4(2).value = 0
assess1.option3d4(3).value = 0
assess1.option3d4(4).value = 0
assess1.option3d4(5).value = 0
assess1.option3d10(0).value = 0
assess1.option3d10(1).value = 0
assess1.option3d10(2).value = 0
assess1.option3d10(3).value = 0
assess1.option3d10(4).value = 0
assess1.check3d3(0).value = 0
assess1.check3d3(1).value = 0
assess1.check3d3(2).value = 0
assess1.check3d3(3).value = 0
assess1.check3d3(4).value = 0
assess1.check3d3(5).value = 0
assess1.check3d3(6).value = 0
assess1.check3d3(7).value = 0
assess1.check3d3(8).value = 0
assess1.check3d1.value = 0
assess1.check3d2.value = 0
assess2.bedit1(0).text = ""
assess2.bedit1(1).text = ""
assess2.bedit2(0).text = ""
assess2.bedit2(1).text = ""
assess2.hedit1(0).text = ""
assess2.hedit1(1).text = ""
assess2.hedit2(0).text = ""
assess2.hedit2(1).text = ""
assess2.hedit3.text = ""
medhist.check3d1(0).value = 0
medhist.check3d1(1).value = 0
medhist.check3d1(2).value = 0
medhist.check3d1(3).value = 0
medhist.check3d1(4).value = 0
medhist.check3d1(5).value = 0
medhist.check3d1(6).value = 0
medhist.check3d1(7).value = 0
medhist.check3d2(0).value = 0
medhist.check3d2(1).value = 0
medhist.check3d2(2).value = 0
medhist.check3d2(3).value = 0
medhist.check3d2(4).value = 0
medhist.check3d2(5).value = 0
medhist.check3d2(6).value = 0
medhist.check3d2(7).value = 0
medhist.check3d3(0).value = 0
medhist.check3d3(1).value = 0
medhist.check3d3(2).value = 0
medhist.check3d3(3).value = 0
medhist.check3d3(4).value = 0
medhist.check3d3(5).value = 0
medhist.check3d3(6).value = 0
medhist.check3d3(7).value = 0
medhist.check3d4(0).value = 0
medhist.check3d4(1).value = 0
medhist.check3d4(2).value = 0
medhist.check3d4(3).value = 0
medhist.check3d4(4).value = 0
medhist.check3d4(5).value = 0
medhist.check3d4(6).value = 0
medhist.check3d4(7).value = 0
Do While mdiform.list1(1).listcount
	mdiform.list1(1).RemoveItem 0
    Loop

Do While mdiform.list2(1).listcount
	mdiform.list2(1).RemoveItem 0
    Loop

Do While mdiform.list3(1).listcount
	mdiform.list3(1).RemoveItem 0
    Loop

Do While summary.list2.listcount
	summary.list2.RemoveItem 0
    Loop
screen.mousepointer = 0
End Sub

Sub bounce (picsrc As Form, picdest As Control)
picsrc.SCALEMODE = PIXEL
picdest.SCALEMODE = PIXEL
hDestDC% = picdest.hDC
X% = 0: Y% = 0
nWidth% = picdest.scalewidth
nHeight% = picdest.scaleheight
hSrcDC% = picsrc.hDC
xsrc% = 0: ysrc% = summary.hedit1.top
dwRop& = &HCC0020
SUC% = BitBlt(hDestDC%, X%, Y%, nWidth%, nHeight%, hSrcDC%, xsrc%, ysrc%, dwRop&)
picsrc.SCALEMODE = TWIPS
picdest.SCALEMODE = TWIPS

End Sub

Function validID (IDstring As String) As Long
validID = 0
For n = 1 To Len(IDstring)
    If Mid$(IDstring, n, 1) <> "-" Then
    c$ = c$ + Mid$(IDstring, n, 1)
    End If
Next
    IDstring = c$
    
    ' Look for a match
For i = 1 To 3   'uses constants for testing
    If Val(LTrim$(RTrim$(IDstring))) = patientID(i) Then
	validID = patientID(i)
	found = -1
	Exit For
    End If
Next i
If Not found Then
	Open "health.dat" For Random As #1 Len = Len(patrecord)
	numrecs = LOF(1) \ Len(patrecord)
	For n = 1 To numrecs
	Get #1, n, patrecord
	If Val(LTrim$(RTrim$(IDstring))) = patrecord.patid Then
		recindex = n
		Exit For
		End If
	Next n
	Close #1
	If Val(LTrim$(RTrim$(IDstring))) = patrecord.patid Then
	    validID = patrecord.patid
	    ID$ = Left$(LTrim$(Str$(cpID)), 4) + "body"
	    inkID$ = Left$(LTrim$(Str$(cpID)), 4) + "ink"
	    Else
	    recindex = 0
	    End If
End If
End Function

Sub restoredata (cpID As Long)

' set global string for load on demand
screen.mousepointer = 11
Open "health.dat" For Random As #1 Len = Len(patrecord)
numrecs = LOF(1) \ Len(patrecord)
	For n = 1 To numrecs
	Get #1, n, patrecord
		If cpID = patrecord.patid Then
		recindex = n
		Exit For
		End If
	Next n
Close #1

	If cpID = patrecord.patid Then
	fillfields
   On Error Resume Next   'kludge for now!!
	If Not newflag Then
	ID$ = Left$(LTrim$(Str$(cpID)), 4) + "body"
	inkID$ = Left$(LTrim$(Str$(cpID)), 4) + "ink"
	restorebody ID$
	summary.picture1.picture = LoadPicture(inkID$ + ".BMP")
	End If

	Else
	recindex = 0
	End If

screen.mousepointer = 0
End Sub

Sub restorebody (tid$)
Static oldID As String
Static test As Integer


    If LTrim$(RTrim$(tid$)) <> LTrim$(RTrim$(oldID)) Then
   
	    screen.mousepointer = 11
	    assess3.picture1.picture = LoadPicture(tid$ + ".bmp")
	    screen.mousepointer = 0
	     test = -1
	    End If
End Sub

Sub getfields ()

LSet patrecord = temprecord

patrecord.theoption.opt2 = assess1.option3d1(1).value
patrecord.theoption.opt3 = assess1.option3d1(2).value

patrecord.theoption.opt5 = assess1.option3d4(1).value
patrecord.theoption.opt6 = assess1.option3d4(2).value
patrecord.theoption.opt7 = assess1.option3d4(3).value
patrecord.theoption.opt8 = assess1.option3d4(4).value
patrecord.theoption.opt9 = assess1.option3d4(5).value

patrecord.theoption.opt11 = assess1.option3d10(1).value
patrecord.theoption.opt12 = assess1.option3d10(2).value
patrecord.theoption.opt13 = assess1.option3d10(3).value
patrecord.theoption.opt14 = assess1.option3d10(4).value
patrecord.chicks.chek1 = assess1.check3d3(0).value
patrecord.chicks.chek2 = assess1.check3d3(1).value
patrecord.chicks.chek3 = assess1.check3d3(2).value
patrecord.chicks.chek4 = assess1.check3d3(3).value
patrecord.chicks.chek5 = assess1.check3d3(4).value
patrecord.chicks.chek6 = assess1.check3d3(5).value
patrecord.chicks.chek7 = assess1.check3d3(6).value
patrecord.chicks.chek8 = assess1.check3d3(7).value
patrecord.chicks.chek9 = assess1.check3d3(8).value
patrecord.d1.shek1 = medhist.check3d1(0).value
patrecord.d1.shek2 = medhist.check3d1(1).value
patrecord.d1.shek3 = medhist.check3d1(2).value
patrecord.d1.shek4 = medhist.check3d1(3).value
patrecord.d1.shek5 = medhist.check3d1(4).value
patrecord.d1.shek6 = medhist.check3d1(5).value
patrecord.d1.shek7 = medhist.check3d1(6).value
patrecord.d1.shek8 = medhist.check3d1(7).value
patrecord.d2.shek1 = medhist.check3d2(0).value
patrecord.d2.shek2 = medhist.check3d2(1).value
patrecord.d2.shek3 = medhist.check3d2(2).value
patrecord.d2.shek4 = medhist.check3d2(3).value
patrecord.d2.shek5 = medhist.check3d2(4).value
patrecord.d2.shek6 = medhist.check3d2(5).value
patrecord.d2.shek7 = medhist.check3d2(6).value
patrecord.d2.shek8 = medhist.check3d2(7).value
patrecord.d3.shek1 = medhist.check3d3(0).value
patrecord.d3.shek2 = medhist.check3d3(1).value
patrecord.d3.shek3 = medhist.check3d3(2).value
patrecord.d3.shek4 = medhist.check3d3(3).value
patrecord.d3.shek5 = medhist.check3d3(4).value
patrecord.d3.shek6 = medhist.check3d3(5).value
patrecord.d3.shek7 = medhist.check3d3(6).value
patrecord.d3.shek8 = medhist.check3d3(7).value
patrecord.d4.shek1 = medhist.check3d4(0).value
patrecord.d4.shek2 = medhist.check3d4(1).value
patrecord.d4.shek3 = medhist.check3d4(2).value
patrecord.d4.shek4 = medhist.check3d4(3).value
patrecord.d4.shek5 = medhist.check3d4(4).value
patrecord.d4.shek6 = medhist.check3d4(5).value
patrecord.d4.shek7 = medhist.check3d4(6).value
patrecord.d4.shek8 = medhist.check3d4(7).value
'***********************************************************

'******************************************************************
num = 0

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd1 = mdiform.list1(1).list(0)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd2 = mdiform.list1(1).list(1)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd3 = mdiform.list1(1).list(2)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd4 = mdiform.list1(1).list(3)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd5 = mdiform.list1(1).list(4)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd6 = mdiform.list1(1).list(5)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd7 = mdiform.list1(1).list(6)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd8 = mdiform.list1(1).list(7)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd9 = mdiform.list1(1).list(8)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd10 = mdiform.list1(1).list(9)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd11 = mdiform.list1(1).list(10)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd12 = mdiform.list1(1).list(11)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd13 = mdiform.list1(1).list(12)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd14 = mdiform.list1(1).list(13)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd15 = mdiform.list1(1).list(14)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd16 = mdiform.list1(1).list(15)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd17 = mdiform.list1(1).list(16)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd18 = mdiform.list1(1).list(17)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd19 = mdiform.list1(1).list(18)
num = num + 1
End If

If mdiform.list1(1).listcount < num Then
patrecord.mdi1.fd20 = mdiform.list1(1).list(19)
num = num + 1
End If
patrecord.mdi1count = num
'*******************************************************************
num = 0
If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd1 = mdiform.list2(1).list(0)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd2 = mdiform.list2(1).list(1)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd3 = mdiform.list2(1).list(2)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd4 = mdiform.list2(1).list(3)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd5 = mdiform.list2(1).list(4)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd6 = mdiform.list2(1).list(5)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd7 = mdiform.list2(1).list(6)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd8 = mdiform.list2(1).list(7)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd9 = mdiform.list2(1).list(8)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd10 = mdiform.list2(1).list(9)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd11 = mdiform.list2(1).list(10)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd12 = mdiform.list2(1).list(11)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd13 = mdiform.list2(1).list(12)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd14 = mdiform.list2(1).list(13)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd15 = mdiform.list2(1).list(14)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd16 = mdiform.list2(1).list(15)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd17 = mdiform.list2(1).list(16)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd18 = mdiform.list2(1).list(17)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd19 = mdiform.list2(1).list(18)
num = num + 1
End If

If mdiform.list2(1).listcount < num Then
patrecord.mdi2.fd20 = mdiform.list2(1).list(19)
num = num + 1
End If
patrecord.mdi2count = num
'******************************************************************
num = 0
If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd1 = mdiform.list3(1).list(0)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd2 = mdiform.list3(1).list(1)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd3 = mdiform.list3(1).list(2)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd4 = mdiform.list3(1).list(3)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd5 = mdiform.list3(1).list(4)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd6 = mdiform.list3(1).list(5)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd7 = mdiform.list3(1).list(6)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd8 = mdiform.list3(1).list(7)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd9 = mdiform.list3(1).list(8)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd10 = mdiform.list3(1).list(9)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd11 = mdiform.list3(1).list(10)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd12 = mdiform.list3(1).list(11)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd13 = mdiform.list3(1).list(12)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd14 = mdiform.list3(1).list(13)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd15 = mdiform.list3(1).list(14)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd16 = mdiform.list3(1).list(15)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd17 = mdiform.list3(1).list(16)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd18 = mdiform.list3(1).list(17)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd19 = mdiform.list3(1).list(18)
num = num + 1
End If

If mdiform.list3(1).listcount < num Then
patrecord.mdi3.fd20 = mdiform.list3(1).list(19)
num = num + 1
End If
patrecord.mdi3count = num
'******************************************************************
num = 0
If summary.list2.listcount < num Then
patrecord.sum1.fd1 = summary.list2.list(0)
num = num + 1
Else
GoTo donesum
End If
If summary.list2.listcount < num Then
patrecord.sum1.fd2 = summary.list2.list(1)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd3 = summary.list2.list(2)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd4 = summary.list2.list(3)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd5 = summary.list2.list(4)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd6 = summary.list2.list(5)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd7 = summary.list2.list(6)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd8 = summary.list2.list(7)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd9 = summary.list2.list(8)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd10 = summary.list2.list(9)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd11 = summary.list2.list(10)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd12 = summary.list2.list(11)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd13 = summary.list2.list(12)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd14 = summary.list2.list(13)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd15 = summary.list2.list(14)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd16 = summary.list2.list(15)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd17 = summary.list2.list(16)
num = num + 1
Else
GoTo donesum
End If


If summary.list2.listcount < num Then
patrecord.sum1.fd18 = summary.list2.list(17)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd19 = summary.list2.list(18)
num = num + 1
Else
GoTo donesum
End If

If summary.list2.listcount < num Then
patrecord.sum1.fd20 = summary.list2.list(20)
num = num + 1
Else
GoTo donesum
End If
donesum:
patrecord.sumcount = num


End Sub

Sub fillfields ()
nofocuscalls = -1
assess1.bedit1.text = patrecord.dayt
assess1.bedit2.text = patrecord.tyme
assess1.option3d1(0).value = patrecord.theoption.opt1
assess1.option3d1(1).value = patrecord.theoption.opt2
assess1.option3d1(2).value = patrecord.theoption.opt3
assess1.option3d4(0).value = patrecord.theoption.opt4
assess1.option3d4(1).value = patrecord.theoption.opt5
assess1.option3d4(2).value = patrecord.theoption.opt6
assess1.option3d4(3).value = patrecord.theoption.opt7
assess1.option3d4(4).value = patrecord.theoption.opt8
assess1.option3d4(5).value = patrecord.theoption.opt9
assess1.option3d10(0).value = patrecord.theoption.opt10
assess1.option3d10(1).value = patrecord.theoption.opt11
assess1.option3d10(2).value = patrecord.theoption.opt11
assess1.option3d10(3).value = patrecord.theoption.opt13
assess1.option3d10(4).value = patrecord.theoption.opt14
assess1.check3d3(0).value = patrecord.chicks.chek1
assess1.check3d3(1).value = patrecord.chicks.chek2
assess1.check3d3(2).value = patrecord.chicks.chek3
assess1.check3d3(3).value = patrecord.chicks.chek4
assess1.check3d3(4).value = patrecord.chicks.chek5
assess1.check3d3(5).value = patrecord.chicks.chek6
assess1.check3d3(6).value = patrecord.chicks.chek7
assess1.check3d3(7).value = patrecord.chicks.chek8
assess1.check3d3(8).value = patrecord.chicks.chek9
assess1.check3d1.value = patrecord.chk1
assess1.check3d2.value = patrecord.chk2
assess2.bedit1(0).text = patrecord.name
assess2.bedit1(1).text = patrecord.relation
assess2.bedit2(0).text = patrecord.home
assess2.bedit2(1).text = patrecord.work
assess2.hedit1(0).text = patrecord.name
assess2.hedit1(1).text = patrecord.relation
assess2.hedit2(0).text = patrecord.home
assess2.hedit2(1).text = patrecord.work
assess2.hedit3.text = patrecord.hed1
medhist.check3d1(0).value = patrecord.d1.shek1
medhist.check3d1(1).value = patrecord.d1.shek2
medhist.check3d1(2).value = patrecord.d1.shek3
medhist.check3d1(3).value = patrecord.d1.shek4
medhist.check3d1(4).value = patrecord.d1.shek5
medhist.check3d1(5).value = patrecord.d1.shek6
medhist.check3d1(6).value = patrecord.d1.shek7
medhist.check3d1(7).value = patrecord.d1.shek8
medhist.check3d2(0).value = patrecord.d2.shek1
medhist.check3d2(1).value = patrecord.d2.shek2
medhist.check3d2(2).value = patrecord.d2.shek3
medhist.check3d2(3).value = patrecord.d2.shek4
medhist.check3d2(4).value = patrecord.d2.shek5
medhist.check3d2(5).value = patrecord.d2.shek6
medhist.check3d2(6).value = patrecord.d2.shek7
medhist.check3d2(7).value = patrecord.d2.shek8
medhist.check3d3(0).value = patrecord.d3.shek1
medhist.check3d3(1).value = patrecord.d3.shek2
medhist.check3d3(2).value = patrecord.d3.shek3
medhist.check3d3(3).value = patrecord.d3.shek4
medhist.check3d3(4).value = patrecord.d3.shek5
medhist.check3d3(5).value = patrecord.d3.shek6
medhist.check3d3(6).value = patrecord.d3.shek7
medhist.check3d3(7).value = patrecord.d3.shek8
medhist.check3d4(0).value = patrecord.d4.shek1
medhist.check3d4(1).value = patrecord.d4.shek2
medhist.check3d4(2).value = patrecord.d4.shek3
medhist.check3d4(3).value = patrecord.d4.shek4
medhist.check3d4(4).value = patrecord.d4.shek5
medhist.check3d4(5).value = patrecord.d4.shek6
medhist.check3d4(6).value = patrecord.d4.shek7
medhist.check3d4(7).value = patrecord.d4.shek8
'***********************************************************

'******************************************************************
num = 0
If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd1
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list(1).AddItem patrecord.mdi1.fd2
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd3
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd4
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd5
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd6
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd7
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd8
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd9
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd10
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd11
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd12
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd13
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd14
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd15
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd16
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd17
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd18
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd19
num = num + 1
Else
GoTo done1
End If

If num < patrecord.mdi1count Then
mdiform.list1(1).AddItem patrecord.mdi1.fd20
num = num + 1
Else
GoTo done1
End If

'***********************************************************
done1:
'***********************************************************
num = 0
If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd1
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd2
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd3
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd4
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd5
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd6
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd7
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd8
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd9
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd10
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd11
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd12
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd13
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd14
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd15
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd16
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd17
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd18
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd19
num = num + 1
Else
GoTo done2
End If

If num < patrecord.mdi2count Then
mdiform.list2(1).AddItem patrecord.mdi2.fd20
num = num + 1
Else
GoTo done2
End If

done2:
'*******************************************************************
num = 0

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd1
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd2
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd3
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd4
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd5
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd6
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd7
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd8
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd9
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd10
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd11
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd12
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd13
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd14
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd15
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd16
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd17
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd18
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd19
num = num + 1
Else
GoTo done3
End If

If num < patrecord.mdi3count Then
mdiform.list3(1).AddItem patrecord.mdi3.fd20
num = num + 1
Else
GoTo done3
End If

done3:
'******************************************************
num = 0

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd1
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd2
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd3
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd4
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd5
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd6
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd7
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd8
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd9
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd10
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd11
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd12
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd13
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd14
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd15
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd16
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd17
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd18
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd19
num = num + 1
Else
GoTo sumdone
End If

If num < patrecord.sumcount Then
summary.list2.AddItem patrecord.sum1.fd20
num = num + 1
Else
GoTo sumdone
End If

sumdone:
nofocuscalls = 0
End Sub

Sub formcheck (where$)
MsgBox "You Have Not Completed " + Chr$(13) + "The Necessary Entries " + Chr$(13) + "On The " + where$, 48, "SMARTFORM"
End Sub

Function smartform (which As Integer) As Integer
If TYPECHECK Then
Select Case which
	 Case 1
	 If temprecord.sex <> 0 And temprecord.patid <> 0 Then
	 ok.idf = -1
	 smartform = -1
	 End If
	 Case 2
	 If temprecord.dayt <> "" And temprecord.tyme <> "" And temprecord.theoption.opt1 And temprecord.theoption.opt4 And temprecord.theoption.opt10 And temprecord.chk1 And temprecord.chk2 Then
	 ok.ass1 = -1
	 smartform = -1
	 End If
	 Case 3
	 If LTrim$(temprecord.name) <> "" And LTrim$(temprecord.relation) <> "" And LTrim$(temprecord.home) <> "" And LTrim$(temprecord.work) <> "" And LTrim$(temprecord.hed1) <> "" Then
	 ok.ass2 = -1
	 smartform = -1
	 End If
	 Case 4
	 ok.medh = -1
	 smartform = -1
	 Case 5
	 If picloc Then
	 ok.ass3 = -1
	 smartform = -1
	 End If
	 Case 6
	 If mdiform.list1(1).listcount > 0 And mdiform.list2(1).listcount > 0 And mdiform.list3(1).listcount > 0 Then
	 ok.mdif = -1
	 smartform = -1
	 End If
	 Case 7
	 If summary.list2.listcount > 0 Then
	 ok.sumf = -1
	 smartform = -1
	 End If
	 End Select
	
Else
smartform = -1
End If
End Function

Function FINALCHECK () As Integer

FINALCHECK = -1

If Not ok.idf Then
MsgBox "The Identification Form Is Not Complete", 0, "FinalCheck"
FINALCHECK = 0
Exit Function
End If

If Not ok.ass1 Then
MsgBox "The Admission Form Is Not Complete", 0, "FinalCheck"
FINALCHECK = 0
Exit Function
End If

If Not ok.ass2 Then
MsgBox "The Diagnosis Form Is Not Complete", 0, "FinalCheck"
FINALCHECK = 0
Exit Function
End If

'If Not ok.medh Then
'MsgBox "The History Form Is Not Complete", 0, "FinalCheck"
'FINALCHECK = 0
'Exit Function
'End If

'If Not ok.ass3 Then
'MsgBox "The Physical Form Is Not Complete", 0, "FinalCheck"
'FINALCHECK = 0
'Exit Function
'End If

If Not ok.mdif Then
MsgBox "The Clinical Form Is Not Complete", 0, "FinalCheck"
FINALCHECK = 0
Exit Function
End If

If Not ok.sumf Then
MsgBox "The Summary Form Is Not Complete", 0, "FinalCheck"
FINALCHECK = 0
Exit Function
End If

End Function

Sub bounce2 (picsrc As Control, picdest As Control)
picsrc.SCALEMODE = PIXEL
picdest.SCALEMODE = PIXEL
hDestDC% = picdest.hDC
X% = 0: Y% = 0
nWidth% = picdest.scalewidth
nHeight% = picdest.scaleheight
hSrcDC% = picsrc.hDC
xsrc% = 0: ysrc% = 0
dwRop& = &HCC0020
SUC% = BitBlt(hDestDC%, X%, Y%, nWidth%, nHeight%, hSrcDC%, xsrc%, ysrc%, dwRop&)
picsrc.SCALEMODE = TWIPS
picdest.SCALEMODE = TWIPS

End Sub

