Dim flashflag As Integer

Sub Form_Load ()

bedit1.text = "   -  -    "
idform.Move 0, 0, SCREEN.width, SCREEN.height

anibutton1(1).Move .1 * anibutton1(1).width, idform.height - 1.1 * anibutton1(0).height
anibutton2.Move (idform.width - anibutton2.width) / 2, idform.height - 1.1 * anibutton2.height
anibutton1(0).Move idform.width - 1.1 * anibutton1(0).width, idform.height - 1.1 * anibutton1(1).height
idform.Scale (0, 0)-(4, 6)
PANEL3D1.Move 0, 0, 4, 5.5
'command3d1(0).Move panel3d1.width \ 2 - command3d1(0).width, panel3d1.height \ 6
'command3d1(1).Move panel3d1.width \ 2 + command3d1(0).width, panel3d1.height \ 6
'command3d1(2).Move panel3d1.width \ 2 - command3d1(0).width, 4 * panel3d1.height \ 6
'command3d1(3).Move panel3d1.width \ 2 + command3d1(0).width, 4 * panel3d1.height \ 6
hedit1.Move bedit1.left, bedit1.top, bedit1.width * 1.07, bedit1.height
flashflag = 0
timer2.interval = 10
timer2.enabled = -1

timer1.interval = 679
timer1.enabled = -1
End Sub

Sub AniButton1_Click (INDEX As Integer)

If smartform(1) Then
Select Case INDEX
Case 1
        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"
        admit.Show

        idform.Hide
        timer1.enabled = 0
       
Case 0
assess1.Show
idform.Hide
timer1.enabled = 0

End Select

Else
formcheck "Identification Form"
End If
End Sub

Sub AniButton2_Click ()
If smartform(1) Then
menumode idform
timer1.enabled = 0

Else
formcheck "Identification Form"
End If
End Sub

Sub Command3D1_Click (INDEX As Integer)

Select Case INDEX
Case 1
a$ = bedit1.text
curpatID = validID(a$)

If curpatID Then
 If COMMAND3D1(1).CAPTION = "ENTER ID" Then COMMAND3D1(1).CAPTION = "KNOWN"
    newflag = 0
    ID$ = Left$(LTrim$(Str$(curpatID)), 4) + "body"
    inkID$ = Left$(LTrim$(Str$(curpatID)), 4) + "ink"
    If MsgBox("     Retrieve Patient Data?", 4, "IDENTIFICATION FORM") = 6 Then
       restoredata curpatID
       restored = -1
    Else
    restored = 0
    End If
    flashflag = 1
    timer1.interval = 679
    timer1.enabled = -1
    editswap bedit1, hedit1, 1
    bedit1.visible = 0
    hedit1.visible = -1
    hedit1.enabled = 0
    anibutton3(2).VALUE = 2
    temprecord.patid = curpatID
Else MsgBox "Please Enter A Valid Patient ID Number", 48, "Retrieve Patient Record"
End If

'******************************************
Case 0         'new patient
a$ = bedit1.text
        For n = 1 To Len(a$)
            If Mid$(a$, n, 1) <> "-" Then
            c$ = c$ + Mid$(a$, n, 1)
            End If
        Next
curpatID = Val(c$)
COMMAND3D1(0).CAPTION = "NEW ENTRY"
newflag = -1
ID$ = Left$(LTrim$(Str$(curpatID)), 4) + "body"
inkID$ = Left$(LTrim$(Str$(curpatID)), 4) + "ink"

    timer1.interval = 679
    flashflag = 0
    editswap bedit1, hedit1, 1
    bedit1.visible = 0
    hedit1.visible = -1
    hedit1.enabled = 0
    anibutton3(2).VALUE = 2
    temprecord.patid = curpatID
If timer1.enabled Then
    timer1.enabled = 0
    Else timer1.enabled = -1
    End If

End Select
End Sub

Sub Timer1_Timer ()

Select Case flashflag

Case 0
If anibutton3(flashflag).VALUE = 1 Then
    anibutton3(flashflag).VALUE = 2
Else
    
    anibutton3(flashflag).VALUE = 1
    End If

Case 1
If anibutton3(flashflag).VALUE = 1 Then
    anibutton3(flashflag).VALUE = 2
Else
    anibutton3(flashflag).VALUE = 1
    End If
    
End Select
End Sub

Sub BEdit1_Update ()
'bedit1.text = "###-##-####"
If bedit1.selstart = 10 Then
If Mid$(bedit1.text, 4, 1) <> "-" Or Mid$(bedit1.text, 7, 1) <> "-" Then
    For n = 1 To Len(bedit1.text)
        If n = 4 Or n = 7 Then
            a$ = a$ + "-"
            'a$ = a$ + Mid$(bedit1.text, n, 1)
        Else
            a$ = a$ + Mid$(bedit1.text, n, 1)
        End If
    Next n
    bedit1.text = a$
End If
bedit1.selstart = 11
End If

End Sub

Sub AniButton3_Click (INDEX As Integer)
If INDEX = 0 Then
timer1.enabled = 0
COMMAND3D1(0).CAPTION = "NEW PATIENT"
End If
If INDEX = 1 Then
timer1.enabled = 0
COMMAND3D1(1).CAPTION = "ENTER ID"
End If
If INDEX = 2 Then
Select Case anibutton3(2).VALUE
Case 2

editswap bedit1, hedit1, 1
    bedit1.visible = 0
    hedit1.visible = -1
    hedit1.enabled = 0

Case 1
editswap bedit1, hedit1, 2
    bedit1.visible = -1
    hedit1.visible = 0
    hedit1.enabled = -1

End Select
End If
End Sub

Sub Timer2_Timer ()
Load assess1
SCREEN.MOUSEPOINTER = 0
timer2.enabled = 0
End Sub

Sub Option3D1_Click (INDEX As Integer, VALUE As Integer)
Select Case INDEX
Case 1
'FEMME
temprecord.sex = -1
timer1.enabled = 0
ANIBUTTON4.VALUE = 3
Case 0
'HOMME
temprecord.sex = 1
timer1.enabled = 0
ANIBUTTON4.VALUE = 2
End Select
End Sub

Sub Check3D1_Click (VALUE As Integer)

If CHECK3D1.VALUE Then
    TYPECHECK = -1
    Else
    TYPECHECK = 0
End If

End Sub

