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

📄 frmcfdj.frm

📁 医药卫生综合管理系统的一部分,是门诊药房管理系统.
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label Label14 
      AutoSize        =   -1  'True
      BackColor       =   &H00404040&
      BackStyle       =   0  'Transparent
      ForeColor       =   &H00000000&
      Height          =   180
      Left            =   360
      TabIndex        =   0
      Top             =   2865
      Width           =   90
   End
End
Attribute VB_Name = "frmcfdj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo err2
If Text2.Text <> 0 Then
riqi = Trim(Text4.Text) & "-" & Trim(Text6.Text) & "-" & Trim(Text7.Text)
    With Adodc3
        .RecordSource = "select * from chufang where 处方医师='" & Trim(Text1.Text) & "' and  处方日期 like " & "'" & CDate(riqi) & "'"
        .Refresh
    If .Recordset.AbsolutePosition <> adPosUnknown Then
        .Recordset.Fields("处方金额") = .Recordset.Fields("处方金额") + CCur(Text2.Text)
        .Recordset.UpdateBatch
        MsgBox "处方登记成功!"
        Text1.SetFocus
        Text1.Text = ""
        Text2.Text = 0
        Text3.Text = ""
        Text4.Text = Year(Date)
        Text6.Text = Month(Date)
        Text7.Text = Day(Date)
     Else
        .Recordset.AddNew
        .Recordset.Fields("处方医师") = Trim(Text1.Text)
        .Recordset.Fields("科室类别") = Text3.Text
        .Recordset.Fields("处方金额") = CCur(Text2.Text)
        .Recordset.Fields("操作员") = Text5.Text
        .Recordset.Fields("处方日期") = CDate(riqi)
        .Recordset.UpdateBatch
        MsgBox "处方登记成功!"
        Text1.SetFocus
        Text1.Text = ""
        Text2.Text = 0
        Text3.Text = ""
        Text4.Text = Year(Date)
        Text6.Text = Month(Date)
        Text7.Text = Day(Date)
    End If
    End With
Else
    MsgBox "医生姓名必须填写,合计金额不能为零!"
End If
Exit Sub
err2:
MsgBox "数据类型不匹配!"
End Sub

Private Sub Command3_Click()
Command4.Enabled = False
Text8.Enabled = True
Text9.Enabled = True
Text1.Text = ""
Text2.Text = 0
Text3.Text = ""
Text4.Text = Year(Date)
Text6.Text = Month(Date)
Text7.Text = Day(Date)
End Sub

Private Sub Command2_Click()
frmprv.Show
End Sub

Private Sub Command4_Click()
Dim shuliang As Long
Dim lsj As Currency
On Error GoTo err1
With Adodc4
If Text8.Text <> "" And Text9.Text <> "" And Text10.Text <> 0 Then
.RecordSource = "select * from yaofang where 编号='" & Text8.Text & "' and 名称='" & Text9.Text & "'"
.Refresh
    If .Recordset.Fields("失效标记") = True Then
        MsgBox "该药品已经失效,不能销售!"
    Else
        shuliang = .Recordset.Fields("数量")
        If .Recordset.AbsolutePosition <> adPosUnknown Then
            If shuliang >= Text10.Text Then
                .Recordset.Fields("数量") = shuliang - Text10.Text
                lsj = .Recordset.Fields("零售价")
                .Recordset.Fields("零售合计") = .Recordset.Fields("数量") * .Recordset.Fields("零售价")
                .Recordset.Update
                 Label14.Caption = "目前“" & Text9.Text & "”药房剩余量:" & Adodc4.Recordset.Fields("数量")
                With Adodc6
                .RecordSource = "select * from ypxs order by ID"
                .Refresh
                .Recordset.AddNew
                .Recordset.Fields("编号") = Text8.Text
                .Recordset.Fields("名称") = Text9.Text
                .Recordset.Fields("规格") = Text13.Text
                .Recordset.Fields("数量") = Text10.Text
                .Recordset.Fields("销售额") = CCur(Text10.Text) * lsj
                .Recordset.Fields("销售日期") = Date
                .Recordset.Fields("操作员") = frmlogin.username
                .Recordset.Update
                End With
                Text8.Text = ""
                Text9.Text = ""
                Text10.Text = 0
                Command4.Enabled = False
                Command5.Enabled = True
                Command5.SetFocus
            Else
                MsgBox "售出药品数量超出药房存储量!"
                Text10.Text = 0
                Label14.Caption = "目前“" & Text9.Text & "”药房剩余量:" & Adodc4.Recordset.Fields("数量")
            End If
        Else
            MsgBox "药房中没有此药品。"
            Text10.Text = 0
            Command5.Enabled = False
        End If
    End If
Else
    MsgBox "药品编号和药品名称必须填写,欲售数量不能为零!"
    Command5.Enabled = False
End If
End With
Text8.Enabled = False
Text9.Enabled = False
Exit Sub
err1:
MsgBox "数据类型不匹配!"
Command5.Enabled = False
End Sub

Private Sub Command5_Click()
Text8.Enabled = True
Text9.Enabled = True
Command4.Enabled = True
Command5.Enabled = False
Command4.Caption = "保存&(S)"
End Sub

Private Sub Command6_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim riqi As String
Dim i As Integer
On Error GoTo err6
frmcfdj.Top = (frmmain.Height - frmcfdj.Height) / 2 - 500
frmcfdj.Left = (frmmain.Width - frmcfdj.Width) / 2
Text2.Text = 0
Text5.Text = frmlogin.username
Text10.Text = 0
Text12.Text = Year(Date) & "年" & Month(Date) & "月" & Day(Date) & "日"
Adodc1.ConnectionString = frmlogin.conn
Adodc2.ConnectionString = frmlogin.conn
Adodc3.ConnectionString = frmlogin.conn
Adodc4.ConnectionString = frmlogin.conn
Adodc5.ConnectionString = frmlogin.conn
Adodc6.ConnectionString = frmlogin.conn
With Adodc4
.RecordSource = "select * from zybyf order by ID"
.Refresh
For i = 0 To .Recordset.RecordCount - 1
If .Recordset.Fields("失效期") <= Date Then
.Recordset.Fields("失效标记") = True
Else
.Recordset.Fields("失效标记") = False
End If
.Recordset.MoveNext
Next
End With
Text4.Text = Year(Date)
Text6.Text = Month(Date)
Text7.Text = Day(Date)
Command5.Enabled = False
Command1.Enabled = False
Command4.Enabled = False
Exit Sub
err6:
MsgBox "数据库连接失败!"
End Sub

Private Sub Text1_Change()
On Error GoTo err3
With Adodc1
.RecordSource = "select * from dotcode where 代码 = '" & Text1.Text & "'"
.Refresh
If .Recordset.AbsolutePosition <> adPosUnknown Then
Text3.Text = .Recordset.Fields("科室")
Text1.Text = .Recordset.Fields("姓名")
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End With
Exit Sub
err3:
MsgBox "数据类型不匹配!请检查输入数据。"
End Sub

Private Sub Text10_Change()
If Not IsNumeric(Text10.Text) Then
MsgBox "您输入了非法数据,必须输入“0-9”数字。"
Text10.SetFocus
Text10.Text = 0
End If
End Sub

Private Sub Text2_Change()
If Not IsNumeric(Text2.Text) Or Text2.Text Like "." Then
MsgBox "您输入了非法数据,必须输入“0-9”数字。"
Text2.SetFocus
Text2.Text = 0
End If
End Sub

Private Sub Text3_Change()
With Adodc2
.RecordSource = "select * from kscode where 代码 = '" & Text3.Text & "'"
.Refresh
If .Recordset.AbsolutePosition <> adPosUnknown Then
Text3.Text = .Recordset.Fields("科室名称")
End If
End With
End Sub

Private Sub Text4_Change()
If Not IsNumeric(Text4.Text) Then
MsgBox "您输入了非法数据,必须输入“0-9”数字。"
Text4.SetFocus
End If
End Sub

Private Sub Text6_Change()
If Not IsNumeric(Text6.Text) Then
MsgBox "您输入了非法数据,必须输入“0-9”数字。"
Text6.SetFocus
End If
End Sub

Private Sub Text7_Change()
If Not IsNumeric(Text7.Text) Then
MsgBox "您输入了非法数据,必须输入“0-9”数字。"
Text7.SetFocus
End If
End Sub

Private Sub Text8_Change()
On Error GoTo err4
With Adodc4
.RecordSource = "select * from yaofang where 编号 = '" & Text8.Text & "'"
.Refresh
If .Recordset.AbsolutePosition <> adPosUnknown Then
    Text9.Text = .Recordset.Fields("名称")
    Text13.Text = .Recordset.Fields("规格")
    Text11.Text = .Recordset.Fields("零售价")
    Command4.Enabled = True
    Text9.Enabled = False
    Text8.Enabled = False
    Label14.Caption = "目前“" & Text9.Text & "”药房剩余量:" & Adodc4.Recordset.Fields("数量")
Else
    Text8.Enabled = True
    Text9.Enabled = True
    Command4.Enabled = False
    Label14.Caption = "药房中没有编号为“" & Text8.Text & "”的药品。"
    Text9.Text = ""
    End If
End With
Exit Sub
err4:
MsgBox "数据类型不匹配!请检查输入数据。"
End Sub

Private Sub Text9_Change()
On Error GoTo err5
With Adodc5
.RecordSource = "select * from ypcode where 代码 = '" & Text9.Text & "'"
.Refresh
If .Recordset.AbsolutePosition <> adPosUnknown Then
    Text9.Text = .Recordset.Fields("药品名称")
    Text9.Enabled = False
    With Adodc4
    .RecordSource = "select * from yaofang where 名称 = '" & Text9.Text & "'"
    .Refresh
        If .Recordset.AbsolutePosition <> adPosUnknown Then
                Text8.Text = .Recordset.Fields("编号")
                Text13.Text = .Recordset.Fields("规格")
                Text11.Text = .Recordset.Fields("零售价")
                Text8.Enabled = False
                Command4.Enabled = True
        Else
            Label14.Caption = "药房中没有“" & Text9.Text & "”。"
            Text8.Enabled = True
            Text8.Text = ""
            Command4.Enabled = False
        End If
    End With
End If
End With
Exit Sub
err5:
MsgBox "数据类型不匹配!请检查输入数据。"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
End Sub
Private Sub Form_Activate()
frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmcfdj.Caption
End Sub
Private Sub Text10_GotFocus()
Text10.SelStart = 0
Text10.SelLength = Len(Text10.Text)
End Sub
Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -