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

📄 frmoutput.frm

📁 医药卫生综合管理系统的一部分.是药品库房管理系统.
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      BackStyle       =   0  'Transparent
      Caption         =   "调拨部门"
      Height          =   180
      Left            =   120
      TabIndex        =   40
      Top             =   150
      Width           =   720
   End
End
Attribute VB_Name = "frmoutput"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public jg As Currency
Public shu1 As Integer
Public shuliang As Integer
Public Sub zybdb()
On Error GoTo err1
With Adodc3
    .RecordSource = "select * from zybyf where 编号='" & Text7.Text & "'"
    .Refresh
    .Recordset.Fields("编号") = Text7.Text
    .Recordset.Fields("名称") = Text8.Text
    .Recordset.Fields("规格") = Text6(2).Text
    .Recordset.Fields("单位") = Text6(3).Text
    .Recordset.Fields("数量") = .Recordset.Fields("数量") + Text1.Text
    .Recordset.Fields("零售价") = Text6(5).Text
    .Recordset.Fields("零售合计") = .Recordset.Fields("数量") * Text6(5)
    .Recordset.Fields("产地") = Text6(6).Text
    .Recordset.Fields("批号") = Text6(7).Text
    rq1 = Text6(8).Text & "-" & Text6(9).Text & "-" & Text6(10).Text
    .Recordset.Fields("失效期") = CDate(rq1)
    .Recordset.Fields("调拨人") = Text5.Text
    rq2 = Text2.Text & "-" & Text3.Text & "-" & Text4.Text
    .Recordset.Fields("调入日期") = CDate(rq2)
    .Recordset.Update
End With
Exit Sub
err1:
MsgBox "当前数据库不能更新或数据库连接失败!"
End Sub
Public Sub mzdb()
On Error GoTo err2
With Adodc2
    .RecordSource = "select * from yaofang where 编号='" & Text7.Text & "'"
    .Refresh
    .Recordset.Fields("编号") = Text7.Text
    .Recordset.Fields("名称") = Text8.Text
    .Recordset.Fields("规格") = Text6(2).Text
    .Recordset.Fields("单位") = Text6(3).Text
    .Recordset.Fields("数量") = .Recordset.Fields("数量") + Text1.Text
    .Recordset.Fields("零售价") = Text6(5).Text
    .Recordset.Fields("零售合计") = .Recordset.Fields("数量") * Text6(5)
    .Recordset.Fields("产地") = Text6(6).Text
    .Recordset.Fields("批号") = Text6(7).Text
    rq1 = Text6(8).Text & "-" & Text6(9).Text & "-" & Text6(10).Text
    .Recordset.Fields("失效期") = CDate(rq1)
    .Recordset.Fields("调拨人") = Text5.Text
    rq2 = Text2.Text & "-" & Text3.Text & "-" & Text4.Text
    .Recordset.Fields("调入日期") = CDate(rq2)
    .Recordset.Update
End With
Exit Sub
err2:
MsgBox "当前数据库不能更新或数据库连接失败!"
End Sub
Public Sub dyyp()
On Error GoTo err3
With Adodc4
.RecordSource = "select * from ypdb order by ID"
.Refresh
.Recordset.AddNew
.Recordset.Fields("编号") = Text7.Text
.Recordset.Fields("名称") = Text8.Text
.Recordset.Fields("规格") = Text6(2).Text
.Recordset.Fields("单位") = Text6(3).Text
.Recordset.Fields("数量") = Text1.Text
.Recordset.Fields("零售价") = Text6(5).Text
.Recordset.Fields("进价") = jg
.Recordset.Fields("产地") = Text6(6).Text
.Recordset.Fields("批号") = Text6(7).Text
.Recordset.Fields("调拨部门") = Combo1.Text
rq3 = Text6(8).Text & "-" & Text6(9).Text & "-" & Text6(10).Text
.Recordset.Fields("失效期") = CDate(rq3)
.Recordset.Fields("调拨人") = Text5.Text
rq4 = Text2.Text & "-" & Text3.Text & "-" & Text4.Text
.Recordset.Fields("调拨日期") = CDate(rq4)
.Recordset.Fields("备注") = Text9.Text
.Recordset.Update
End With
With Adodc1
.RecordSource = "select * from kcyp where 编号='" & Text7.Text & "'"
.Refresh
shu1 = Text6(4) - Text1.Text
.Recordset.Fields("数量") = shu1
.Recordset.Fields("零售合计") = .Recordset.Fields("零售价") * shu1
.Recordset.Fields("进价合计") = .Recordset.Fields("进价") * shu1
.Recordset.Fields("差额") = .Recordset.Fields("零售合计") - .Recordset.Fields("进价合计")
.Recordset.Update
End With
Command1.Enabled = False
Exit Sub
err3:
MsgBox "当前数据库不能更新或数据库连接失败!"
End Sub

Private Sub Combo1_Click()
Text7.Enabled = True
Text5.Text = ""
End Sub

Private Sub Command1_Click()
Dim rq1 As String
Dim rq2 As String
Dim rq3 As String
Dim rq4 As String
On Error GoTo err4
If Text1.Text <= shuliang Then
    If Text1.Text = 0 Or Text2.Text = "" Or Text5.Text = "" Or Combo1.Text = "" Then
        MsgBox "调拨数量不能为零,调拨日期和调拨人必须填写!"
    Else
        If Combo1.Text = "门诊药房" Then
          With Adodc2
         .RecordSource = "select * from yaofang where 编号='" & Text7.Text & "'"
         .Refresh
            If .Recordset.AbsolutePosition <> adPosUnknown Then
                 If .Recordset.Fields("数量") = 0 Then
                     Call mzdb
                     Call dyyp
                 Else
                     If .Recordset.Fields("失效标记") = True Then
                         MsgBox "门诊药房中该药品已经失效,清除后才能调拨!"
                     Else
                         If Trim(.Recordset.Fields("规格")) <> Trim(CStr(Text6(2).Text)) Or CCur(.Recordset.Fields("零售价")) <> CCur(Text6(5).Text) Then
                             MsgBox "调出药品的规格或零售价与药房中的不一致!"
                         Else
                             Call mzdb
                             Call dyyp
                         End If
                     End If
                  End If
            Else
                 .Recordset.AddNew
                 .Recordset.Fields("编号") = Text7.Text
                 .Recordset.Fields("名称") = Text8.Text
                 .Recordset.Fields("规格") = Text6(2).Text
                 .Recordset.Fields("单位") = Text6(3).Text
                 .Recordset.Fields("数量") = Text1.Text
                 .Recordset.Fields("零售价") = Text6(5).Text
                 .Recordset.Fields("零售合计") = Text1.Text * Text6(5)
                 .Recordset.Fields("产地") = Text6(6).Text
                 .Recordset.Fields("批号") = Text6(7).Text
                 rq1 = Text6(8).Text & "-" & Text6(9).Text & "-" & Text6(10).Text
                 .Recordset.Fields("失效期") = CDate(rq1)
                 .Recordset.Fields("调拨人") = Text5.Text
                 rq2 = Text2.Text & "-" & Text3.Text & "-" & Text4.Text
                 .Recordset.Fields("调入日期") = CDate(rq2)
                 .Recordset.UpdateBatch
                 Call dyyp
            End If
          End With
        End If
        '住院部药房
        If Combo1.Text = "住院部药房" Then
          With Adodc3
         .RecordSource = "select * from zybyf where 编号='" & Text7.Text & "'"
         .Refresh
             If .Recordset.AbsolutePosition <> adPosUnknown Then
                 If .Recordset.Fields("数量") = 0 Then
                     Call zybdb
                     Call dyyp
                 Else
                     If .Recordset.Fields("失效标记") = True Then
                         MsgBox "门诊药房中该药品已经失效,清除后才能调拨!"
                     Else
                         If Trim(.Recordset.Fields("规格")) <> Trim(CStr(Text6(2).Text)) Or CCur(.Recordset.Fields("零售价")) <> CCur(Text6(5).Text) Then
                             MsgBox "调出药品的规格或零售价与药房中的不一致!"
                         Else
                             Call zybdb
                             Call dyyp
                         End If
                     End If
                  End If
              Else
                 .Recordset.AddNew
                 .Recordset.Fields("编号") = Text7.Text
                 .Recordset.Fields("名称") = Text8.Text
                 .Recordset.Fields("规格") = Text6(2).Text
                 .Recordset.Fields("单位") = Text6(3).Text
                 .Recordset.Fields("数量") = Text1.Text
                 .Recordset.Fields("零售价") = Text6(5).Text
                 .Recordset.Fields("零售合计") = Text1.Text * Text6(5)
                 .Recordset.Fields("产地") = Text6(6).Text
                 .Recordset.Fields("批号") = Text6(7).Text
                 rq1 = Text6(8).Text & "-" & Text6(9).Text & "-" & Text6(10).Text
                 .Recordset.Fields("失效期") = CDate(rq1)
                 .Recordset.Fields("调拨人") = Text5.Text
                 rq2 = Text2.Text & "-" & Text3.Text & "-" & Text4.Text
                 .Recordset.Fields("调入日期") = CDate(rq2)
                 .Recordset.UpdateBatch
                 Call dyyp
             End If
           End With
        End If
        If Combo1.Text <> "" And Combo1.Text <> "门诊药房" And Combo1.Text <> "住院部药房" Then
          Call dyyp
        End If
    End If
    Text1.Text = 0
    Text7.Text = ""
    result.Caption = "提示:调拨登记成功!"
Else
    MsgBox "调出药品大于库存量!当前药品库存量为:" & Text6(4).Text & Text6(3).Text
    result.Caption = "提示:调拨登记失败!"
    'Command1.Enabled = False
End If
Exit Sub
err4:
MsgBox "数据类型不匹配或库存数据出错!"
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Form_Load()
On Error GoTo err5
frmoutput.Top = (frmmain.Height - frmoutput.Height) / 2 - 500
frmoutput.Left = (frmmain.Width - frmoutput.Width) / 2
Adodc1.ConnectionString = frmlogin.conn
Adodc2.ConnectionString = frmlogin.conn
Adodc3.ConnectionString = frmlogin.conn
Adodc4.ConnectionString = frmlogin.conn
Adodc5.ConnectionString = frmlogin.conn
Command1.Enabled = False
Text7.Enabled = False
Text2.Text = Year(Date)
Text3.Text = Month(Date)
Text4.Text = Day(Date)
With Adodc1
.RecordSource = "select * from kcyp where 失效标记=false"
.Refresh
For i = 0 To .Recordset.RecordCount
If Not .Recordset.EOF Then
    If .Recordset.Fields("失效期") <= Date Then
        .Recordset.Fields("失效标记") = True
        .Recordset.Update
    Else
        .Recordset.Fields("失效标记") = False
        .Recordset.Update
    End If
.Recordset.MoveNext
End If
Next
End With
With Adodc2
.RecordSource = "select * from yaofang where 失效标记=false"
.Refresh
For i = 0 To .Recordset.RecordCount
If Not .Recordset.EOF Then
    If .Recordset.Fields("失效期") <= Date Then
        .Recordset.Fields("失效标记") = True
        .Recordset.Update
    Else
        .Recordset.Fields("失效标记") = False
        .Recordset.Update
    End If
.Recordset.MoveNext
End If
Next
End With
With Adodc3
.RecordSource = "select * from zybyf where 失效标记=false"
.Refresh
For i = 0 To .Recordset.RecordCount
If Not .Recordset.EOF Then
    If .Recordset.Fields("失效期") <= Date Then
        .Recordset.Fields("失效标记") = True
        .Recordset.Update
    Else
        .Recordset.Fields("失效标记") = False
        .Recordset.Update
    End If
.Recordset.MoveNext
End If
Next
End With
Text9.Text = "无"
Text1.Text = 0
Exit Sub
err5:
MsgBox "数据库连接失败!"
End Sub

Private Sub Text7_Change()
'库存为零时不能调拨药品
On Error GoTo err6
With Adodc1
.RecordSource = "select * from kcyp where 编号='" & Text7.Text & "' and 失效标记=false"
.Refresh
If .Recordset.AbsolutePosition <> adPosUnknown Then
Text8.Text = .Recordset.Fields("名称")
Text6(2).Text = .Recordset.Fields("规格")
Text6(3).Text = .Recordset.Fields("单位")
Text6(4).Text = .Recordset.Fields("数量")
jg = .Recordset.Fields("进价")
Text6(5).Text = .Recordset.Fields("零售价")
Text6(6).Text = .Recordset.Fields("产地")
Text6(7).Text = .Recordset.Fields("批号")
Text6(8).Text = Year(.Recordset.Fields("失效期"))
Text6(9).Text = Month(.Recordset.Fields("失效期"))
Text6(10).Text = Day(.Recordset.Fields("失效期"))
Command1.Enabled = True
result.Caption = ""
If Text6(4).Text = 0 Then
MsgBox "该药品库存已空,不能调拨!"
Text1.Text = ""
Command1.Enabled = False
Else
shuliang = Text6(4).Text
Command1.Enabled = True
End If
Else
result.Caption = "提示:没有编号为“" & Text7.Text & "”的药品或该药已失效!"
Command1.Enabled = False
Text8.Text = ""
For i = 2 To 10
Text6(i) = ""
Next
End If
End With
Exit Sub
err6:
MsgBox "数据库连接失败!"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
End Sub
Private Sub Form_Activate()
frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmoutput.Caption
End Sub
Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub
Private Sub Text7_GotFocus()
Text7.SelStart = 0
Text7.SelLength = Len(Text7.Text)
End Sub
Private Sub Text5_Change()
On Error GoTo err0
With Adodc5
.RecordSource = "select 姓名,代码 from dotcode where 代码='" & Text5.Text & "'"
.Refresh
If .Recordset.AbsolutePosition <> adPosUnknown Then
Text5.Text = .Recordset.Fields("姓名")
End If
End With
Exit Sub
err0:
MsgBox "数据库连接失败!"
End Sub

⌨️ 快捷键说明

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