📄 frmbeddisplay.frm
字号:
End If
rsBed.Close
rsWard.MoveNext
i = i + 1
Wend
rsWard.Close
Set factory = OrgTree.Nodes.add(, , "bed", "Room Managment", otFactory, otFactory2)
rsWard.Open "SELECT [Room_ID], [Room_Type] FROM [Room_Details]", cnPatients, adOpenDynamic, adLockPessimistic
rsWard.MoveFirst
While Not rsWard.EOF
i = i + 1
name = rsWard!Room_Type
ID = rsWard(0)
Set group = OrgTree.Nodes.add(factory, tvwChild, i & name & "", "" & name & "", otGroup, otGroup2)
Debug.Print ID
rsBed.Open "select Bed_ID from bed_Details where room_ward_id= '" & ID & "'", cnPatients, adOpenDynamic, adLockPessimistic
If rsBed.RecordCount > 0 Then
rsBed.MoveFirst
While Not rsBed.EOF
Debug.Print rsBed(0)
name = rsBed(0)
Set person = OrgTree.Nodes.add(group, tvwChild, "hf " & name & "", "" & name & "", otPerson, otPerson2)
rsBed.MoveNext
Wend
End If
rsBed.Close
rsWard.MoveNext
Wend
rsWard.Close
'Framesettings.Visible = False
'cmdsettingshow.Visible = True
'cmdsettinghide.Visible = False
End Sub
Private Sub mnuclose_Click(Index As Integer)
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call Functions.EnableMenu
End Sub
Private Sub OrgTree_NodeClick(ByVal Node As MSComctlLib.Node)
Dim icol As Integer
Dim getadmid As String
Dim avil As Boolean
Dim rec As Integer
Dim X As Integer
Dim clicked As String
Dim q As Boolean
Dim a As Collection
clicked = Node.Text
If clicked = "" Then
q = False
Else
q = True
End If
MSFlexGrid1.clear
Set rslist = New ADODB.Recordset
If clicked = "Ward Managment" Then
rslist.Open "select * from ward_details", cnPatients, adOpenDynamic, adLockPessimistic
rec = rslist.RecordCount
If rslist.EOF = False Then
With MSFlexGrid1
.clear
.Rows = 1
.Cols = rslist.Fields.Count
While Not rslist.EOF
.Rows = .Rows + 1
.Row = .Rows - 1
For icol = 0 To rslist.Fields.Count - 1
.Col = icol
.Text = rslist(icol) & ""
Next
rslist.MoveNext
Wend
.TextMatrix(0, 0) = "Ward ID"
.TextMatrix(0, 1) = "Ward name"
.TextMatrix(0, 2) = "Ward Rate"
.TextMatrix(0, 3) = "Ward Desc"
.FixedRows = 1
.RowHeight(0) = .RowHeight(1) * 1.5
.ColWidth(1) = .ColWidth(0) * 2.5
.ColWidth(2) = .ColWidth(0) * 1.75
.ColWidth(3) = .ColWidth(0) * 1.5
End With
rslist.Close
End If
ElseIf clicked = "Room Managment" Then
rslist.Open "select * from Room_Details", cnPatients, adOpenDynamic, adLockPessimistic
If rslist.EOF = False Then
With MSFlexGrid1
.clear
.Rows = 1
.Cols = rslist.Fields.Count
While Not rslist.EOF
.Rows = .Rows + 1
.Row = .Rows - 1
For icol = 0 To rslist.Fields.Count - 1
.Col = icol
.Text = rslist(icol) & ""
Next
rslist.MoveNext
Wend
.TextMatrix(0, 0) = "Room ID"
.TextMatrix(0, 1) = "Room Type"
.TextMatrix(0, 2) = "Room Rate"
.TextMatrix(0, 3) = "Room Description"
.FixedRows = 1
.RowHeight(0) = .RowHeight(1) * 1.5
.ColWidth(1) = .ColWidth(0) * 2.5
.ColWidth(2) = .ColWidth(0) * 1.75
.ColWidth(3) = .ColWidth(0) * 1.5
End With
rslist.Close
End If
Else
rslist.Open "SELECT [Ward_ID], [Ward_Name] FROM [Ward_Details] where [Ward_Name]='" & clicked & "'", cnPatients, adOpenDynamic, adLockPessimistic
If rslist.RecordCount > 0 Then
getid = rslist(0)
End If
If rslist.RecordCount = 0 Then
rsBed.Open "SELECT [Room_ID], [Room_Type] FROM [Room_Details] where [Room_Type]='" & clicked & "'", cnPatients, adOpenDynamic, adLockPessimistic
If rsBed.RecordCount > 0 Then
getid = rsBed(0)
End If
rsBed.Close
rslist.Close
End If
rsBed.Open "SELECT [Bed_ID], [Room_Ward_ID], [Available], [Admission_ID], [Bed_Desc] FROM [Bed_Details] where [Room_Ward_ID]='" & getid & "'", cnPatients, adOpenDynamic, adLockOptimistic
rec = rsBed.RecordCount
If rsBed.EOF = False Then
With MSFlexGrid1
.clear
.Rows = 1
.Cols = rsBed.Fields.Count
While Not rsBed.EOF
.Rows = .Rows + 1
.Row = .Rows - 1
For icol = 0 To rsBed.Fields.Count - 1
.Col = icol
.Text = rsBed(icol) & ""
Next
rsBed.MoveNext
Wend
.TextMatrix(0, 0) = "Bed ID"
.TextMatrix(0, 1) = "Room Ward ID"
.TextMatrix(0, 2) = "Availability"
.TextMatrix(0, 3) = "Admission ID"
.TextMatrix(0, 4) = "Bed Discription"
.FixedRows = 1
.RowHeight(0) = .RowHeight(1) * 1.5
.ColWidth(1) = .ColWidth(0) * 2.5
.ColWidth(2) = .ColWidth(0) * 1.75
.ColWidth(3) = .ColWidth(0) * 1.5
.ColWidth(4) = .ColWidth(0) * 1.5
End With
End If
rsBed.Close
rsPatientDe.Open "SELECT [Bed_ID], [Room_Ward_ID], [Available], [Admission_ID], [Bed_Desc] FROM [Bed_Details] where [Bed_ID]='" & clicked & "'", cnPatients, adOpenDynamic, adLockOptimistic
If rsPatientDe.RecordCount = 1 Then
'getadmid = rsPatientDe(3)
avil = rsPatientDe(2)
If avil = False Then
getadmid = rsPatientDe(3)
Debug.Print getadmid
End If
End If
rsPatientDe.Close
rsdata.Open "SELECT [Admission_ID], [Patient_ID], [Guardian_ID], [Ref_Doctor], [Admission_Date], [Admission_Time] FROM [Admission_Details] where [Admission_ID]='" & getadmid & "'", cnPatients, adOpenDynamic, adLockOptimistic
rec = rsdata.RecordCount
If rsdata.EOF = False Then
With MSFlexGrid1
.clear
.Rows = 1
.Cols = rsdata.Fields.Count
While Not rsdata.EOF
.Rows = .Rows + 1
.Row = .Rows - 1
For icol = 0 To rsdata.Fields.Count - 1
.Col = icol
.Text = rsdata(icol) & ""
Next
rsdata.MoveNext
Wend
.TextMatrix(0, 0) = "Admission ID"
.TextMatrix(0, 1) = "Patient ID"
.TextMatrix(0, 2) = "Guardian ID"
.TextMatrix(0, 3) = "Ref Doctor"
.TextMatrix(0, 4) = "Admission Date"
.TextMatrix(0, 5) = "Admission Time"
.FixedRows = 1
.RowHeight(0) = .RowHeight(1) * 1.5
.ColWidth(1) = .ColWidth(0) * 2.5
.ColWidth(2) = .ColWidth(0) * 1.75
.ColWidth(3) = .ColWidth(0) * 1.5
.ColWidth(4) = .ColWidth(0) * 1.5
.ColWidth(5) = .ColWidth(0) * 1.5
End With
End If
rsdata.Close
End If
Functions.SizeColumns MSFlexGrid1, Me
Functions.SizeColumnHeaders MSFlexGrid1, Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -