📄 caoqi.frm
字号:
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:\hims\his.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\hims\his.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 Label11
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "调拨部门"
Height = 180
Left = 240
TabIndex = 42
Top = 300
Width = 720
End
Begin VB.Label Label12
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "调拨备注"
ForeColor = &H00000000&
Height = 180
Left = 3120
TabIndex = 41
Top = 300
Width = 720
End
Begin VB.Label result
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "选择调拨数据库"
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 40
Top = 3250
Width = 1260
End
End
Attribute VB_Name = "frmcaoqi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public jiage As Currency
Public shulian As Integer
Public drq3 As String
Public drq4 As String
Public Sub dbdj()
On Error GoTo err1
With Adodc1
.RecordSource = "select * from " & frmmain.datas & " where 编号='" & Text7.Text & "'"
.Refresh
If .Recordset.Fields("失效标记") = False Then
shuliang = Str(Text6(4).Text) - Str(Text1.Text)
.Recordset.Fields("数量") = shuliang
.Recordset.Fields("零售合计") = .Recordset.Fields("零售价") * shuliang
.Recordset.Fields("进价合计") = .Recordset.Fields("进价") * shuliang
.Recordset.Fields("差额") = .Recordset.Fields("零售合计") - .Recordset.Fields("进价合计")
.Recordset.Update
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("进价") = jiage
.Recordset.Fields("产地") = Text6(6).Text
.Recordset.Fields("批号") = Text6(7).Text
.Recordset.Fields("调拨部门") = Text10.Text
drq3 = Text6(8).Text & "-" & Text6(9).Text & "-" & Text6(10).Text
.Recordset.Fields("失效期") = CDate(rq3)
.Recordset.Fields("调拨人") = Text5.Text
drq4 = Text2.Text & "-" & Text3.Text & "-" & Text4.Text
.Recordset.Fields("调拨日期") = CDate(rq4)
.Recordset.Fields("备注") = Text9.Text
.Recordset.Update
End With
Else
MsgBox "该产品已经失效,不能调拨!"
End If
End With
Command1.Enabled = False
Exit Sub
err1:
MsgBox "当前数据库更新失败,药品或器械尚未出库!"
End Sub
Private Sub Combo1_Click()
If Combo1.Text = "器械材料库" Then
frmmain.datas = "qixie"
frmcaoqi.Caption = "器械材料调拨登记"
Text7.Enabled = True
With Adodc1
.RecordSource = "select * from " & frmmain.datas & " 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
End If
If Combo1.Text = "中草药库" Then
frmmain.datas = "caoyao"
frmcaoqi.Caption = "中草药调拨登记"
Text7.Enabled = True
With Adodc1
.RecordSource = "select * from " & frmmain.datas & " 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
End If
If Combo1.Text <> "器械材料库" And Combo1.Text <> "中草药库" Then
Command1.Enabled = False
Text7.Enabled = False
frmcaoqi.Caption = "其它库存品调拨"
End If
End Sub
Private Sub Command1_Click()
'过滤失效药品器械
On Error GoTo err2
If Text10.Text <> "" Then
If Str(Text1.Text) <= Str(Text6(4).Text) Then
Text9.Text = Text6(4).Text
If Text1.Text = 0 Or Text2.Text = "" Or Text5.Text = "" Then
MsgBox "调拨数量不能为零,调拨日期和调拨人必须填写!"
Else
Call dbdj
End If
Else
Text9.Text = Text1.Text & Text6(4).Text
MsgBox "调出量大于库存量!当前库存量为:" & Text6(4).Text & Text6(3).Text
Command1.Enabled = False
End If
Else
MsgBox "调拨部门必须填写!"
End If
Exit Sub
err2:
MsgBox "数据类型不匹配或库存数据出错!"
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error GoTo err3
frmcaoqi.Top = (frmmain.Height - frmcaoqi.Height) / 2 - 500
frmcaoqi.Left = (frmmain.Width - frmcaoqi.Width) / 2
Adodc1.ConnectionString = frmlogin.conn
Adodc2.ConnectionString = frmlogin.conn
Adodc4.ConnectionString = frmlogin.conn
Adodc5.ConnectionString = frmlogin.conn
Command1.Enabled = False
Text2.Text = Year(Date)
Text3.Text = Month(Date)
Text4.Text = Day(Date)
Text9.Text = "无"
Text1.Text = 0
Text7.Enabled = False
Exit Sub
err3:
MsgBox "数据库连接失败!"
End Sub
Private Sub Text10_Change()
On Error GoTo err4
Text5.Text = ""
With Adodc2
.RecordSource = "select 科室名称,代码 from kscode where 代码='" & Text10.Text & "'"
.Refresh
If .Recordset.AbsolutePosition <> adPosUnknown Then
Text10.Text = .Recordset.Fields("科室名称")
End If
End With
Exit Sub
err4:
MsgBox "数据库连接失败!"
End Sub
Private Sub Text7_Change()
'库存为零时不能调拨药品
On Error GoTo err4
With Adodc1
.RecordSource = "select * from " & frmmain.datas & " 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("数量")
jiage = .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
Label7(0).Caption = ""
If Text6(4).Text = 0 Then
MsgBox "该产品库存已空,不能调拨!"
Text1.Text = ""
Command1.Enabled = False
Else
Command1.Enabled = True
End If
Else
Label7(0).Caption = "提示:没有编号为“" & Text7.Text & "”的药品或器械或已失效!"
Command1.Enabled = False
Text8.Text = ""
For i = 2 To 10
Text6(i) = ""
Next
End If
End With
Exit Sub
err4:
MsgBox "原始数据有错或数据库连接失败!"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
End Sub
Private Sub Form_Activate()
frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmcaoqi.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 + -