Next Chapter 48 Operation
Operation
Dim rst As New ADODB.Recordset
Dim VData As VoucherDataType
Dim ADDMode As Boolean
Private Sub chameleonButton1_Click()
On Error GoTo ErHand
Unload Me
ErHand:
ErrHandler "chameleonButton1_Click() [Close]"
End Sub
Private Sub chameleonButton4_Click()
On Error GoTo ErHand
Operationdetail.Show
ErHand:
ErrHandler "chameleonButton4_Click() [Edit]"
End Sub
Private Sub chameleonButton2_Click()
On Error GoTo ErHand
chameleonButton5.Enabled = True
chameleonButton6.Enabled = False
chameleonButton3.Enabled = False
chameleonButton4.Enabled = True
Frame2.Enabled = True
Text1.Locked = True
'Text1 = ""
'Text2 = ""
Text4 = "'"
DTPicker1 = Time
TxtDoctorIncharge = ""
DTPicker2 = Date
DTPicker3 = Time
Combo3 = ""
Text10 = ""
Text9 = ""
Text3 = ""
Text8 = ""
Text7 = ""
Text5 = ""
Text6 = ""
Set rst = New ADODB.Recordset
rst.Open "select max(optno) from optnote", Conn, adOpenDynamic, adLockOptimistic
Text4.Text = IIf(IsNull(rst.Fields(0)) = True, 1, rst.Fields(0) + 1)
rst.Close
ErHand:
ErrHandler "chameleonButton2_Click() [New Button]"
End Sub
Private Sub chameleonButton3_Click()
On Error GoTo ErHand
Dim i As Integer
If Text1.Text = "" Then Exit Sub
If Text4.Text = "" Then Exit Sub
i = MsgBox("Are You Sure to Delete Operation Note Number [ " & Text4.Text & " ] Of Patient [ " & Text2.Text & " ]", vbYesNo + vbExclamation, App.Title)
If i = vbNo Then Exit Sub
Conn.Execute " Delete from optnote where refno= " & Val(Text1.Text) & " And OptNo=" & Text4.Text
Conn.Execute " Delete from Voucher Where VType='ON' And Narr='ON Ane No : " & Text4.Text & "'"
Conn.Execute " Delete from Voucher Where VType='ON' And Narr='ON Doc No : " & Text4.Text & "'"
Conn.Execute " Delete from Voucher Where VType='ON' And Narr='ON No : " & Text4.Text & "'"
MsgBox "Operation Note Of [ " & Text2.Text & " ]" & vbCrLf & " On Date [" & Format(DTPicker2, "dd-MMM-yyyy") & "]" & vbCrLf & " Is Deleted Successfully.........", vbExclamation + vbYesNo
Call chameleonButton2_Click
ErHand:
ErrHandler "chameleonButton3_Click() [Delete Button]"
End Sub
Private Sub chameleonButton5_Click()
On Error GoTo ErHand
ADDMode = False
If Text5 = "" Then Text5 = 0
If Text6 = "" Then Text6 = 0
Dim RstSave As New ADODB.Recordset
RstSave.Open "Select * from OptNote Where refno=" & Text1.Text & " And DateOfSur='" & Format(DTPicker2, "dd-MMM-yyyy") & "'", Conn, adOpenDynamic, adLockBatchOptimistic
If RstSave.EOF Then
Set rst = New ADODB.Recordset
rst.Open "select max(OptNo) from OptNote", Conn, adOpenDynamic, adLockOptimistic
Text4 = IIf(IsNull(rst.Fields(0)) = False, rst.Fields(0) + 1, 1)
rst.Close
RstSave.AddNew
ADDMode = True
Else
i = MsgBox("You Are Going To Update Operation Note Of [ " & Me.Text2 & " ]" & vbCrLf & " On Date [" & Format(DTPicker2, "dd-MMM-yyyy") & "]" & vbCrLf & " Do You Want To Continue", vbExclamation + vbYesNo)
If i = vbNo Then Exit Sub
End If
VData = GetVoucherData("ON Doc No : " & Text4.Text)
VData.AcCode = IIf(TxtDoctorIncharge.Tag = "", VData.AcCode, TxtDoctorIncharge.Tag)
VData.ACContra = "000039"
VData.DrAmt = 0
VData.CrAmt = Val(Text5.Text)
VData.Narration1 = "ON Doc No : " & Text4.Text
VData.Narration2 = "ON No : " & Text4.Text
VData.vDate = DTPicker2
VData.VType = "ON"
Call InsertToAccount(ADDMode, VData)
VData = GetVoucherData("ON Ane No : " & Text4.Text)
VData.AcCode = IIf(Combo3.Tag = "", VData.AcCode, Combo3.Tag)
VData.ACContra = "000039"
VData.DrAmt = 0
VData.CrAmt = Val(Text6.Text)
VData.Narration1 = "ON Ane No : " & Text4.Text
VData.Narration2 = "ON No : " & Text4.Text
VData.vDate = DTPicker2
VData.VType = "ON"
Call InsertToAccount(ADDMode, VData)
RstSave.Fields("optno") = Text4.Text & ""
RstSave.Fields("RefNo") = Text1.Text & ""
RstSave.Fields("Name") = Text2.Text & ""
RstSave.Fields("Surgeon") = TxtDoctorIncharge.Text & ""
RstSave.Fields("DateOfSur") = DTPicker2 & ""
RstSave.Fields("Assis1") = Text10.Text & ""
RstSave.Fields("Assis2") = Text9.Text & ""
RstSave.Fields("Anes") = Combo3.Text & ""
RstSave.Fields("Sthr") = DTPicker3 & ""
RstSave.Fields("Cohr") = DTPicker1 & ""
RstSave.Fields("Finding") = Text3.Text & ""
RstSave.Fields("Pro") = Text8.Text & ""
RstSave.Fields("OutCome") = Text7.Text & ""
RstSave.Fields("DrAmount") = Val(Text5.Text) & ""
RstSave.Fields("AnAmount") = Val(Text6.Text) & ""
RstSave.UpdateBatch
Set RstSave = Nothing
Call chameleonButton2_Click
ErHand:
ErrHandler "Operation.SaveButton_Click()"
End Sub
Private Sub chameleonButton6_Click()
On Error GoTo ErHand
DataEnvironment1.Recordsets.Item("command3").Close
DataEnvironment1.Recordsets.Item("command3").Open "select * from optnote where refno = " & Text1 & "", Conn, adOpenDynamic, adLockOptimistic
OperationReport.Sections(1).Controls.Item("label57").Caption = hos_name
OperationReport.Sections(1).Controls.Item("label58").Caption = hos_add
OperationReport.Show
ErHand:
ErrHandler "chameleonButton6_Click() [Print]"
End Sub
Private Sub chameleonButton7_Click()
On Error GoTo ErHand
Operationdetail.Show
ErHand:
ErrHandler "chameleonButton7_Click() [Edit]"
End Sub
Private Sub Form_Load()
On Error GoTo ErHand
Me.Top = (MDIForm1.ScaleHeight - Me.Height) / 2
Me.Left = (MDIForm1.ScaleWidth - Me.Width) / 2
Call chameleonButton2_Click
Me.Text1 = Admission.txtRegNo.Text
Me.Text2 = Admission.TxtPatient.Text
Set rst = New ADODB.Recordset
rst.Open "select * from optnote where refno = " & Val(Admission.txtRegNo.Text) & "", Conn, adOpenDynamic, adLockOptimistic
If Not rst.EOF = True Then
EDITREF = rst.Fields("OptNO")
Call opt
End If
With DocSrch
.DBConnectString = ConnectString
.SQLString = "SELECT AccountNo,Title + space(1) + FName + space(1) + MName + space(1) + LName FROM DocMast"
.PopulateList
Set .BoundTextBox = TxtDoctorIncharge
End With
With AneSrch
.DBConnectString = ConnectString
.SQLString = "SELECT AccountNo,Title + space(1) + FName + space(1) + MName + space(1) + LName FROM anaes"
.PopulateList
Set .BoundTextBox = Me.Combo3
End With
ErHand:
ErrHandler "Operation.Form_Load()"
End Sub
Public Function opt()
On Error GoTo ErHand
If Text1.Text = "" Then MsgBox " Patient Registration Number Should Not Be Empty ", vbExclamation, App.Title: Text1.SetFocus: Exit Function
If EDITREF = "" Then MsgBox " OpetationNote Number Should Not Be Empty ", vbExclamation, App.Title: Exit Function
Set rst = New ADODB.Recordset
rst.Open "select * from optnote where Optno = " & EDITREF & " And RefNo=" & Text1.Text, Conn, adOpenDynamic, adLockOptimistic
If rst.EOF = True Then MsgBox ("This Operation Note Is Not Related With This Patient"): Exit Function
Text1 = rst!refno & ""
Text2 = rst!Name & ""
Text4 = rst!optno & ""
TxtDoctorIncharge = rst!Surgeon & ""
DTPicker2 = rst!dateofsur & ""
DTPicker3 = rst!sthr & ""
DTPicker1 = rst!cohr & ""
Combo3 = rst!anes & ""
Text10 = rst!assis1 & ""
Text9 = rst!assis2 & ""
Text3 = rst!finding & ""
Text8 = rst!pro & ""
Text7 = rst!outcome & ""
Text5 = rst!DRAmount & ""
Text6 = rst!anamount & ""
chameleonButton4.Enabled = False
chameleonButton5.Enabled = True
chameleonButton6.Enabled = True
chameleonButton3.Enabled = True
rst.Close
ErHand:
ErrHandler "Operation.OPT()"
End Function
Private Sub Text1_LostFocus()
On Error GoTo ErHand
Set rst = New ADODB.Recordset
Text2 = ""
rst.Open "select * from hospital where registration = " & Val(Text1) & "", Conn, adOpenDynamic, adLockOptimistic
If rst.EOF = False Then
Text2 = rst!Title & "" + " " + rst!first_name & "" + " " + rst!middle_name & "" + " " + rst!last_name & ""
End If
rst.Close
ErHand:
ErrHandler "Operation.Text1_LostFocus()"
End Sub
Private Sub TxtDoctorIncharge_GotFocus()
On Error GoTo ErHand
DocSrch.SearchValue TxtDoctorIncharge.Text
DocSrch.PopulateList
ErHand:
ErrHandler "Operation.TxtDoctorIncharge_GotFocus()"
End Sub
Private Sub Combo3_GotFocus()
On Error GoTo ErHand
AneSrch.SearchValue Combo3.Text
AneSrch.PopulateList
ErHand:
ErrHandler "Operation.Combo3_GotFocus()"
End Sub
Next Chapter 49 Profit And Loss Form
Sponsored Links