?? chffrm.frm
字號:
Data1.Recordset.Fields("調劑") = Text6.Text
Else
Data1.Recordset.Fields("調劑") = ""
End If
If Text7.Text <> "" Then
Data1.Recordset.Fields("檢藥") = Text7.Text
Else
Data1.Recordset.Fields("檢藥") = ""
End If
Data1.Recordset.Fields("日期") = Label11.Caption
Data1.Recordset.Fields("收費") = "未"
Data1.Recordset.Fields("收費日期") = ""
Data1.Recordset.Fields("操作員") = czyxm
Data1.Recordset.Update
Command2.Enabled = False
Command4.Enabled = True
Frame3.Enabled = False
Exit Sub
er:
MsgBox "出現未知錯誤!請重新啟動后再試一次!" & Chr(13) & Chr(10) & "數據保存出現錯誤!請檢查網絡連接是否正常!或服務器共享不完全!", vbOKOnly + 16
End Sub
Private Sub Command3_Click()
List1.Clear
List2.Clear
List3.Clear
List4.Clear
If Text1.Text = "" Or Combo1.Text = "" Or Text2.Text = "" Then
MsgBox "您輸入的患者數據不完整!"
If Text1.Text = "" Then
Text1.SetFocus
Else
If Combo1.Text = "" Then
Combo1.SetFocus
Else
Text2.SetFocus
End If
End If
Exit Sub
Else
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = False
Command4.Enabled = False
Frame2.Enabled = False
Frame3.Enabled = True
Frame4.Enabled = True
Combo2.SetFocus
End If
End Sub
Private Sub Command4_Click()
On Error GoTo er
Printer.FontSize = 14
Printer.CurrentX = 1100
Printer.CurrentY = 1800
Printer.Print Combo2.Text
Printer.FontSize = 11
Printer.CurrentX = 1100
Printer.CurrentY = 3100
Printer.Print Label18.Caption & Label19.Caption
Printer.CurrentX = 1100
Printer.CurrentY = 2450
Printer.Print Text1.Text
Printer.CurrentX = 2800
Printer.CurrentY = 2450
Printer.Print Combo1.Text
Printer.CurrentX = 3900
Printer.CurrentY = 2450
Printer.Print Text2.Text
Printer.CurrentX = 4800
Printer.CurrentY = 2450
Printer.Print Text3.Text
h = 3800
l = 600
m = 0
While m <= List1.ListCount - 1
Printer.CurrentX = l
Printer.CurrentY = h
Printer.Print List1.List(m) & " : " & List3.List(m) & "*" & Val(List4.List(m)) & "=" & Val(List3.List(m)) * Val(List4.List(m)) & "元"
m = m + 1
h = h + 300
Wend
hh = 4200
ll = 5950
For k = 0 To 13
If Label17(k).Caption <> "" Then
Printer.CurrentX = ll
Printer.CurrentY = hh
If hh < 8750 Then
Printer.Print Label17(k).Caption
Else
Printer.CurrentX = 5200
Printer.Print " 其他 " & Label17(k).Caption
End If
End If
hh = hh + 350
Next k
Printer.CurrentX = 1000
Printer.CurrentY = 10200
Printer.Print Combo4.Text
Printer.CurrentX = 2600
Printer.CurrentY = 10200
Printer.Print Text6.Text
Printer.CurrentX = 4100
Printer.CurrentY = 10200
Printer.Print Text7.Text
y = Year(Now)
m = Month(Now)
d = Day(Now)
Printer.CurrentX = 5780
Printer.CurrentY = 10200
Printer.Print Label20.Caption
Printer.CurrentX = 3100
Printer.CurrentY = 10500
Printer.Print y
Printer.CurrentX = 4100
Printer.CurrentY = 10500
Printer.Print m
Printer.CurrentX = 5000
Printer.CurrentY = 10500
Printer.Print d
Printer.EndDoc
'打印代碼結束
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Text1.Text = ""
Combo1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo2.Text = ""
Text4.Text = ""
Combo3.Text = ""
Text5.Text = ""
Command1.SetFocus
List1.Clear
List2.Clear
List3.Clear
List4.Clear
Combo4.Text = ""
Text6.Text = ""
Text7.Text = ""
For k = 0 To 13
Label17(k).Caption = ""
Next k
Label20.Caption = ""
Frame2.Enabled = False
Frame3.Enabled = False
Frame4.Enabled = False
Exit Sub
er:
MsgBox "打印或打印機出現故障!"
End
End Sub
Private Sub Form_Activate()
Label11.Caption = Date
Label18.Caption = "處方編號:"
Label19.Left = Label18.Left + Label18.Width + 20
Label19.Caption = ""
Label20.Caption = ""
Label20.AutoSize = True
Label20.Top = Label10.Top - 20
Label20.Left = Label10.Left + Label10.Width + 20
Text1.Text = ""
Combo1.Text = ""
Text2.Text = ""
Text3.Text = ""
Combo2.Text = ""
Text4.Text = ""
Combo3.Text = ""
Text5.Text = ""
Command1.SetFocus
List1.Clear
List2.Clear
List3.Clear
List4.Clear
Combo4.Text = ""
Text6.Text = ""
Text7.Text = ""
Frame2.Enabled = False
Frame3.Enabled = False
Frame4.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
h = 0
While Adodc5.Recordset.EOF = False And h <= 13
Label16(h).Visible = True
Label16(h).Caption = Adodc5.Recordset.Fields(1)
Adodc5.Recordset.MoveNext
h = h + 1
Wend
List5.Visible = False
End Sub
Private Sub Form_Load()
mdbstr1 = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" + dbstr
Adodc1.ConnectionString = mdbstr1
Adodc1.RecordSource = "科別"
Adodc1.Refresh
Combo2.Clear
While Adodc1.Recordset.EOF = False
Combo2.AddItem Adodc1.Recordset.Fields(1)
Adodc1.Recordset.MoveNext
Wend
Adodc2.ConnectionString = mdbstr1
Adodc2.RecordSource = "醫師"
Adodc2.Refresh
While Adodc2.Recordset.EOF = False
Combo4.AddItem Adodc2.Recordset.Fields(1)
Adodc2.Recordset.MoveNext
Wend
Combo4.Clear
Adodc3.ConnectionString = mdbstr1
Adodc3.RecordSource = "藥品代碼"
Adodc3.Refresh
rc1 = 0
While Adodc3.Recordset.EOF = False
rc1 = rc1 + 1
Adodc3.Recordset.MoveNext
Wend
ReDim chfarr(rc1 + 1, 3) As String
k = 1
Adodc3.Refresh
While Adodc3.Recordset.EOF = False
chfarr(k, 1) = Adodc3.Recordset.Fields(0)
chfarr(k, 2) = Adodc3.Recordset.Fields(1)
chfarr(k, 3) = Adodc3.Recordset.Fields(2)
k = k + 1
Adodc3.Recordset.MoveNext
Wend
Adodc4.ConnectionString = mdbstr1
Adodc4.RecordSource = "藥品庫存"
Adodc4.Refresh
Adodc5.ConnectionString = mdbstr1
Adodc5.RecordSource = "處方類別"
Adodc5.Refresh
Data1.DatabaseName = dbstr
Data1.RecordSource = "門診處方"
Data1.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Command4.Enabled = True Then
fh = MsgBox("處方數據沒有打印!確認不打印退出嗎?", vbYesNo + 32)
If fh = 6 Then
Cancel = 0
Else
Cancel = 1
End If
End If
If Command2.Enabled = True And List1.ListCount > 0 Then
fh = MsgBox("藥品已經出庫,處方數據沒有保存,確認退出嗎?", vbYesNo + 32)
If fh = 6 Then
Cancel = 0
Else
Cancel = 1
Command2.SetFocus
End If
End If
End Sub
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
If List1.ListIndex >= 0 Then sel List1.ListIndex
End Sub
Private Sub List2_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
If List2.ListIndex >= 0 Then sel List2.ListIndex
End Sub
Private Sub List3_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
If List3.ListIndex >= 0 Then sel List3.ListIndex
End Sub
Private Sub List4_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)
If List4.ListIndex >= 0 Then sel List4.ListIndex
End Sub
Private Sub List5_DblClick()
Text4.Text = List5.List(List5.ListIndex)
List5.Visible = False
Text5.SetFocus
End Sub
Private Sub List5_KeyPress(KeyAscii As Integer)
If KeyAscii = 32 Or KeyAscii = 13 Then
Text4.Text = List5.List(List5.ListIndex)
Text5.SetFocus
List5.Visible = False
End If
If KeyAscii = 27 Then Text4.SetFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Combo1.SetFocus
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Text3.SetFocus
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Then
Else
KeyAscii = 0
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command3.SetFocus
End Sub
Private Sub Text4_Change()
'chfarr是代碼數組 1號元素是輸入碼, 2號元素是名稱
Ln = Len(Text4.Text)
List5.Clear
k = 1
While k <= rc1
If Left(chfarr(k, 1), Ln) = Trim(Text4.Text) Then List5.AddItem chfarr(k, 2)
k = k + 1
Wend
If List5.ListCount > 0 Then
List5.Visible = True
List5.Selected(0) = True
Else
List5.Visible = False
End If
End Sub
Private Sub Text4_GotFocus()
Text4.SelStart = 0
Text4.SelLength = Len(Text4.Text)
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then List5.SetFocus
If KeyCode = 32 Or KeyCode = 13 Then
Text4.Text = List5.List(List5.ListIndex)
Text5.SetFocus
List5.Visible = False
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 32 Then KeyAscii = 0
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
On Error GoTo er
If KeyAscii = 8 Then
Text4.SetFocus
Exit Sub
End If
If KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 13 Then
Else
KeyAscii = 0
Exit Sub
End If
If KeyAscii = 13 Then
If Combo4.Text = "" Then
MsgBox "主治醫師不能沒有吧?"
Combo4.SetFocus
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "數量未填寫,請填寫數量!!"
Text5.SetFocus
Exit Sub
End If
If Combo2.Text = "" Or Text4.Text = "" Then
MsgBox "輸入的數據不完整!請檢查數據的完整性"
Exit Sub
End If
I
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -