frmoutput.frm
资源名称:yf.rar [点击查看]
上传用户:laihaixin
上传日期:2013-01-26
资源大小:1169k
文件大小:37k
源码类别:
医药行业
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Begin VB.Form frmoutput
- BackColor = &H00404040&
- BorderStyle = 3 'Fixed Dialog
- Caption = "西药中成药调拨登记"
- ClientHeight = 3450
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 7590
- Icon = "frmoutput.frx":0000
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- Picture = "frmoutput.frx":030A
- ScaleHeight = 3450
- ScaleWidth = 7590
- ShowInTaskbar = 0 'False
- Begin VB.TextBox Text9
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 300
- Left = 3840
- TabIndex = 1
- Top = 90
- Width = 3615
- End
- Begin VB.ComboBox Combo1
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 300
- ItemData = "frmoutput.frx":59F9
- Left = 960
- List = "frmoutput.frx":5A03
- TabIndex = 0
- Top = 90
- Width = 1455
- End
- Begin VB.PictureBox Picture2
- Height = 1695
- Left = 120
- Picture = "frmoutput.frx":5A1D
- ScaleHeight = 1635
- ScaleWidth = 7275
- TabIndex = 17
- Top = 480
- Width = 7335
- Begin VB.TextBox Text8
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 2640
- Locked = -1 'True
- TabIndex = 41
- Top = 480
- Width = 1000
- End
- Begin VB.TextBox Text7
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 840
- TabIndex = 2
- Top = 480
- Width = 1000
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 6
- Left = 4320
- Locked = -1 'True
- TabIndex = 39
- Top = 840
- Width = 2685
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 10
- Left = 6000
- Locked = -1 'True
- TabIndex = 35
- Top = 1200
- Width = 400
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 9
- Left = 5280
- Locked = -1 'True
- TabIndex = 34
- Top = 1200
- Width = 400
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 8
- Left = 4320
- Locked = -1 'True
- TabIndex = 33
- Top = 1200
- Width = 600
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 7
- Left = 840
- Locked = -1 'True
- TabIndex = 32
- Top = 1200
- Width = 1000
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 5
- Left = 2640
- Locked = -1 'True
- TabIndex = 31
- Top = 840
- Width = 1000
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 4
- Left = 840
- Locked = -1 'True
- TabIndex = 30
- Top = 840
- Width = 1000
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 3
- Left = 6000
- Locked = -1 'True
- TabIndex = 29
- Top = 480
- Width = 1000
- End
- Begin VB.TextBox Text6
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Index = 2
- Left = 4320
- Locked = -1 'True
- TabIndex = 28
- Top = 480
- Width = 1000
- End
- Begin MSAdodcLib.Adodc Adodc5
- Height = 330
- Left = 6000
- Top = 50
- Visible = 0 'False
- Width = 1200
- _ExtentX = 2117
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = ""
- OLEDBString = ""
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = ""
- Caption = "Adodc5"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin MSAdodcLib.Adodc Adodc4
- Height = 330
- Left = 4680
- Top = 50
- Visible = 0 'False
- Width = 1200
- _ExtentX = 2117
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = ""
- OLEDBString = ""
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = ""
- Caption = "Adodc4"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin MSAdodcLib.Adodc Adodc3
- Height = 330
- Left = 3120
- Top = 50
- Visible = 0 'False
- Width = 1215
- _ExtentX = 2143
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = ""
- OLEDBString = ""
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = ""
- Caption = "Adodc3"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.Label Label10
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "日"
- Height = 180
- Left = 6435
- TabIndex = 38
- Top = 1245
- Width = 180
- End
- Begin VB.Label Label9
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "月"
- Height = 180
- Left = 5745
- TabIndex = 37
- Top = 1245
- Width = 180
- End
- Begin VB.Label Label8
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "年"
- Height = 180
- Left = 5025
- TabIndex = 36
- Top = 1245
- Width = 180
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "请输入调拨药品编号"
- ForeColor = &H00000000&
- Height = 180
- Index = 0
- Left = 240
- TabIndex = 27
- Top = 120
- Width = 1620
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "失效期"
- Height = 180
- Index = 9
- Left = 3720
- TabIndex = 26
- Top = 1245
- Width = 540
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "批 号"
- Height = 180
- Index = 8
- Left = 240
- TabIndex = 25
- Top = 1245
- Width = 540
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "产地"
- Height = 180
- Index = 7
- Left = 3880
- TabIndex = 24
- Top = 890
- Width = 360
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "零售价"
- Height = 180
- Index = 6
- Left = 2040
- TabIndex = 23
- Top = 890
- Width = 540
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "数 量"
- Height = 180
- Index = 5
- Left = 240
- TabIndex = 22
- Top = 885
- Width = 540
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "单位"
- Height = 180
- Index = 4
- Left = 5570
- TabIndex = 21
- Top = 525
- Width = 360
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "规格"
- Height = 180
- Index = 3
- Left = 3880
- TabIndex = 20
- Top = 530
- Width = 360
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "名 称"
- Height = 180
- Index = 2
- Left = 2040
- TabIndex = 19
- Top = 530
- Width = 540
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "编 号"
- Height = 180
- Index = 1
- Left = 240
- TabIndex = 18
- Top = 525
- Width = 540
- End
- End
- Begin VB.PictureBox Picture1
- Height = 600
- Left = 120
- Picture = "frmoutput.frx":B10C
- ScaleHeight = 540
- ScaleWidth = 7275
- TabIndex = 9
- Top = 2280
- Width = 7335
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 1000
- TabIndex = 3
- Top = 120
- Width = 800
- End
- Begin VB.TextBox Text2
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 3000
- MaxLength = 4
- TabIndex = 4
- Top = 120
- Width = 500
- End
- Begin VB.TextBox Text3
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 3840
- MaxLength = 2
- TabIndex = 5
- Top = 120
- Width = 400
- End
- Begin VB.TextBox Text4
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 4560
- MaxLength = 2
- TabIndex = 6
- Top = 120
- Width = 400
- End
- Begin VB.TextBox Text5
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 6240
- MaxLength = 10
- TabIndex = 7
- Top = 120
- Width = 800
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "调出数量"
- ForeColor = &H00000000&
- Height = 180
- Left = 240
- TabIndex = 16
- Top = 165
- Width = 720
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "调拨日期"
- ForeColor = &H00000000&
- Height = 180
- Left = 2160
- TabIndex = 15
- Top = 165
- Width = 720
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "调拨人"
- ForeColor = &H00000000&
- Height = 180
- Left = 5640
- TabIndex = 14
- Top = 165
- Width = 540
- End
- Begin VB.Label Label4
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "年"
- ForeColor = &H00000000&
- Height = 180
- Left = 3570
- TabIndex = 13
- Top = 165
- Width = 180
- End
- Begin VB.Label Label5
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "月"
- ForeColor = &H00000000&
- Height = 180
- Left = 4320
- TabIndex = 12
- Top = 165
- Width = 180
- End
- Begin VB.Label Label6
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "日"
- ForeColor = &H00000000&
- Height = 180
- Left = 5025
- TabIndex = 11
- Top = 165
- Width = 180
- End
- End
- Begin MSAdodcLib.Adodc Adodc2
- Height = 330
- Left = 3480
- Top = 3000
- Visible = 0 'False
- Width = 1200
- _ExtentX = 2117
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = ""
- OLEDBString = ""
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = ""
- Caption = "Adodc2"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.CommandButton Command3
- Caption = "关闭&(Q)"
- Height = 350
- Left = 6360
- TabIndex = 10
- Top = 3030
- Width = 1100
- End
- Begin VB.CommandButton Command1
- Caption = "登记&(N)"
- Height = 350
- Left = 4920
- TabIndex = 8
- Top = 3030
- Width = 1100
- End
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 2280
- Top = 3000
- Visible = 0 'False
- Width = 1215
- _ExtentX = 2143
- _ExtentY = 582
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:himshis.mdb;Persist Security Info=False"
- OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:himshis.mdb;Persist Security Info=False"
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = "select * from ypdb order by ID"
- Caption = "Adodc1"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin VB.Label result
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- ForeColor = &H00000000&
- Height = 180
- Left = 200
- TabIndex = 43
- Top = 3045
- Width = 90
- End
- Begin VB.Label Label12
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "调拨备注"
- ForeColor = &H00000000&
- Height = 180
- Left = 3000
- TabIndex = 42
- Top = 150
- Width = 720
- End
- Begin VB.Label Label11
- AutoSize = -1 'True
- 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