⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chffrm.frm

📁 医院管理系统已经在运行中
💻 FRM
📖 第 1 页 / 共 5 页
字号:
     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 + -