frminput.frm
资源名称:yf.rar [点击查看]
上传用户:laihaixin
上传日期:2013-01-26
资源大小:1169k
文件大小:33k
源码类别:
医药行业
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Begin VB.Form frminput
- BackColor = &H00404040&
- BorderStyle = 3 'Fixed Dialog
- Caption = "库存登记"
- ClientHeight = 4545
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 8610
- Icon = "frminput.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- Picture = "frminput.frx":030A
- ScaleHeight = 4545
- ScaleWidth = 8610
- ShowInTaskbar = 0 'False
- Begin VB.ComboBox Combo2
- Height = 300
- ItemData = "frminput.frx":59F9
- Left = 1200
- List = "frminput.frx":5A06
- TabIndex = 48
- Top = 4080
- Width = 1335
- End
- Begin MSAdodcLib.Adodc Adodc2
- Height = 330
- Left = 6000
- Top = 75
- 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 MSAdodcLib.Adodc Adodc3
- Height = 330
- Left = 7320
- Top = 75
- 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 MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 4680
- Top = 75
- 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 = "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.CommandButton Command4
- Caption = "关闭&(Q)"
- Height = 350
- Left = 7335
- TabIndex = 45
- Top = 4080
- Width = 1200
- End
- Begin VB.CommandButton Command3
- BackColor = &H00404040&
- Caption = "查看代码&(U)"
- Height = 350
- Left = 6000
- TabIndex = 44
- Top = 4080
- Width = 1200
- End
- Begin VB.CommandButton Command2
- BackColor = &H00C0C0C0&
- Caption = "增加库存量&(S)"
- Height = 350
- Left = 4380
- MaskColor = &H00808080&
- TabIndex = 43
- Top = 4080
- Width = 1500
- End
- Begin VB.CommandButton Command1
- Caption = "添加新品种&(A)"
- Height = 350
- Left = 2760
- TabIndex = 42
- Top = 4080
- Width = 1500
- End
- Begin VB.PictureBox Picture1
- BackColor = &H00404040&
- Height = 3495
- Left = 120
- Picture = "frminput.frx":5A2E
- ScaleHeight = 3435
- ScaleWidth = 8295
- TabIndex = 19
- Top = 480
- Width = 8355
- Begin VB.TextBox Text18
- ForeColor = &H000000FF&
- Height = 270
- Left = 3960
- TabIndex = 1
- Top = 170
- Width = 1200
- End
- Begin VB.TextBox Text17
- BackColor = &H00FFFFFF&
- ForeColor = &H00FF0000&
- Height = 1410
- Left = 1320
- TabIndex = 18
- Top = 1880
- Width = 6495
- End
- Begin VB.TextBox Text16
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 7200
- TabIndex = 17
- Top = 1540
- Width = 375
- End
- Begin VB.TextBox Text15
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 6480
- TabIndex = 16
- Top = 1540
- Width = 375
- End
- Begin VB.TextBox Text14
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 5520
- TabIndex = 15
- Top = 1540
- Width = 600
- End
- Begin VB.TextBox Text13
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 3000
- TabIndex = 14
- Top = 1540
- Width = 375
- End
- Begin VB.TextBox Text12
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 2280
- TabIndex = 13
- Top = 1540
- Width = 375
- End
- Begin VB.TextBox Text11
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 1320
- TabIndex = 12
- Top = 1540
- Width = 600
- End
- Begin VB.TextBox Text10
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 7200
- TabIndex = 11
- Top = 1220
- Width = 375
- End
- Begin VB.TextBox Text9
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 6480
- TabIndex = 10
- Top = 1220
- Width = 375
- End
- Begin VB.TextBox Text8
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 5520
- TabIndex = 9
- Top = 1220
- Width = 600
- End
- Begin VB.TextBox Text7
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 1320
- TabIndex = 8
- Top = 1220
- Width = 1200
- End
- Begin VB.TextBox Text6
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 3960
- TabIndex = 7
- Top = 880
- Width = 3855
- End
- Begin VB.TextBox Text5
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 1320
- TabIndex = 6
- Top = 880
- Width = 1200
- End
- Begin VB.TextBox Text4
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 6600
- TabIndex = 5
- Top = 520
- Width = 1200
- End
- Begin VB.TextBox Text3
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 3960
- TabIndex = 4
- Top = 520
- Width = 1200
- End
- Begin VB.ComboBox Combo1
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 300
- ItemData = "frminput.frx":B11D
- Left = 1320
- List = "frminput.frx":B13C
- TabIndex = 3
- Top = 520
- Width = 1200
- End
- Begin VB.TextBox Text2
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- ForeColor = &H000000FF&
- Height = 270
- Left = 6600
- TabIndex = 2
- Top = 170
- Width = 1200
- End
- Begin VB.TextBox Text1
- Alignment = 1 'Right Justify
- BackColor = &H00FFFFFF&
- BeginProperty DataFormat
- Type = 0
- Format = "00000"
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- ForeColor = &H000000FF&
- Height = 270
- Left = 1320
- MaxLength = 10
- TabIndex = 0
- Top = 170
- Width = 1200
- End
- Begin VB.Label Label22
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "日"
- ForeColor = &H00000000&
- Height = 180
- Left = 7650
- TabIndex = 41
- Top = 1605
- Width = 180
- End
- Begin VB.Label Label21
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "月"
- ForeColor = &H00000000&
- Height = 180
- Left = 6940
- TabIndex = 40
- Top = 1605
- Width = 180
- End
- Begin VB.Label Label20
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "年"
- ForeColor = &H00000000&
- Height = 180
- Left = 6220
- TabIndex = 39
- Top = 1605
- Width = 180
- End
- Begin VB.Label Label19
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "日"
- ForeColor = &H00000000&
- Height = 180
- Left = 7650
- TabIndex = 38
- Top = 1260
- Width = 180
- End
- Begin VB.Label Label18
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "月"
- ForeColor = &H00000000&
- Height = 180
- Left = 6940
- TabIndex = 37
- Top = 1260
- Width = 180
- End
- Begin VB.Label Label17
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "年"
- ForeColor = &H00000000&
- Height = 180
- Left = 6220
- TabIndex = 36
- Top = 1260
- Width = 180
- End
- Begin VB.Label Label16
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "日"
- ForeColor = &H00000000&
- Height = 180
- Left = 3400
- TabIndex = 35
- Top = 1600
- Width = 180
- End
- Begin VB.Label Label15
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "月"
- ForeColor = &H00000000&
- Height = 180
- Left = 2760
- TabIndex = 34
- Top = 1600
- Width = 180
- End
- Begin VB.Label Label14
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "年"
- ForeColor = &H00000000&
- Height = 180
- Left = 2020
- TabIndex = 33
- Top = 1600
- Width = 180
- End
- Begin VB.Label Label13
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "备 注"
- ForeColor = &H00000000&
- Height = 180
- Left = 480
- TabIndex = 32
- Top = 2400
- Width = 720
- End
- Begin VB.Label Label12
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "失 效 期"
- ForeColor = &H00000000&
- Height = 180
- Left = 4680
- TabIndex = 31
- Top = 1605
- Width = 720
- End
- Begin VB.Label Label11
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "出厂日期"
- ForeColor = &H00000000&
- Height = 180
- Left = 480
- TabIndex = 30
- Top = 1600
- Width = 720
- End
- Begin VB.Label Label10
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "采购日期"
- ForeColor = &H00000000&
- Height = 180
- Left = 4680
- TabIndex = 29
- Top = 1260
- Width = 720
- End
- Begin VB.Label Label9
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "批 号"
- ForeColor = &H00000000&
- Height = 180
- Left = 480
- TabIndex = 28
- Top = 1260
- Width = 720
- End
- Begin VB.Label Label8
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "产 地"
- ForeColor = &H00000000&
- Height = 180
- Left = 3120
- TabIndex = 27
- Top = 915
- Width = 720
- End
- Begin VB.Label Label7
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "零售价格"
- ForeColor = &H00000000&
- Height = 180
- Left = 480
- TabIndex = 26
- Top = 920
- Width = 720
- End
- Begin VB.Label Label6
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "进货价格"
- ForeColor = &H00000000&
- Height = 180
- Left = 5760
- TabIndex = 25
- Top = 585
- Width = 720
- End
- Begin VB.Label Label5
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "数 量"
- ForeColor = &H00000000&
- Height = 180
- Left = 3120
- TabIndex = 24
- Top = 585
- Width = 720
- End
- Begin VB.Label Label4
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "单 位"
- ForeColor = &H00000000&
- Height = 180
- Left = 480
- TabIndex = 23
- Top = 580
- Width = 720
- End
- Begin VB.Label Label3
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "规 格"
- ForeColor = &H00000000&
- Height = 180
- Left = 5760
- TabIndex = 22
- Top = 240
- Width = 720
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "名 称"
- ForeColor = &H00000000&
- Height = 180
- Left = 3120
- TabIndex = 21
- Top = 240
- Width = 720
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- BackColor = &H00404040&
- BackStyle = 0 'Transparent
- Caption = "编 号"
- ForeColor = &H00000000&
- Height = 180
- Left = 480
- TabIndex = 20
- Top = 240
- Width = 720
- End
- End
- Begin VB.Label Label25
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "选择数据库"
- Height = 180
- Left = 240
- TabIndex = 49
- Top = 4140
- Width = 900
- End
- Begin VB.Label Label24
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "动态提示:"
- ForeColor = &H00000000&
- Height = 180
- Left = 360
- TabIndex = 47
- Top = 120
- Width = 900
- End
- Begin VB.Label Label23
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- ForeColor = &H00000000&
- Height = 180
- Left = 1245
- TabIndex = 46
- Top = 120
- Width = 90
- End
- End
- Attribute VB_Name = "frminput"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public Sub Guolu()
- 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 Sub
- Private Sub combo2_Change()
- If Combo2.Text <> "西药中成药库" And Combo2.Text <> "中草药库" And Combo2.Text <> "器械材料库" Then
- Text1.Enabled = False
- Text18.Enabled = False
- End If
- End Sub
- Private Sub Combo2_Click()
- Select Case Combo2.Text
- Case "西药中成药库"
- frmmain.datas = "kcyp"
- frminput.Caption = "西药和中成药入库登记"
- frmmain.kcode = "ypcode"
- Call Guolu
- Text1.Enabled = True
- Text18.Enabled = True
- Case "中草药库"
- frmmain.datas = "caoyao"
- frminput.Caption = "中草药入库登记"
- frmmain.kcode = "cycode"
- Call Guolu
- Text1.Enabled = True
- Text18.Enabled = True
- Case "器械材料库"
- frmmain.datas = "qixie"
- frminput.Caption = "医疗器械和材料入库登记"
- frmmain.kcode = "qxcode"
- Call Guolu
- Text1.Enabled = True
- Text18.Enabled = True
- Case Else
- Text1.Enabled = False
- Text18.Enabled = False
- frminput.Caption = "库存登记"
- End Select
- End Sub
- Private Sub Command1_Click()
- Dim rq1 As String
- Dim rq2 As String
- Dim rq3 As String
- On Error GoTo err1
- With Adodc1
- .RecordSource = "select * from " & frmmain.datas & " order by ID"
- .Refresh
- .Recordset.AddNew
- .Recordset.Fields("编号") = Text1.Text
- .Recordset.Fields("名称") = Text18.Text
- .Recordset.Fields("规格") = Text2.Text
- .Recordset.Fields("单位") = Combo1.Text
- .Recordset.Fields("数量") = Text3.Text
- .Recordset.Fields("进价") = Text4.Text
- .Recordset.Fields("进价合计") = (Text3.Text) * (Text4.Text)
- .Recordset.Fields("零售价") = Text5.Text
- .Recordset.Fields("零售合计") = (Text3.Text) * (Text5.Text)
- .Recordset.Fields("产地") = Text6.Text
- .Recordset.Fields("差额") = (.Recordset.Fields("零售合计")) - (.Recordset.Fields("进价合计"))
- .Recordset.Fields("批号") = Text7.Text
- rq1 = Text8.Text & "-" & Text9.Text & "-" & Text10.Text
- .Recordset.Fields("采购日期") = CDate(rq1)
- rq2 = Text11.Text & "-" & Text12.Text & "-" & Text13.Text
- .Recordset.Fields("出厂日期") = CDate(rq2)
- rq3 = Text14.Text & "-" & Text15.Text & "-" & Text16.Text
- .Recordset.Fields("失效期") = CDate(rq3)
- .Recordset.Fields("备注") = Text17.Text
- .Recordset.UpdateBatch
- Command1.Enabled = False
- Text1.Enabled = True
- Text18.Enabled = True
- Label23.Caption = ""
- End With
- Exit Sub
- err1:
- MsgBox "登记项目填写不全或数据类型不匹配!"
- End Sub
- Private Sub Command2_Click()
- '库存过期药品必须清理后才能入库
- Dim rq1 As String
- Dim rq2 As String
- Dim rq3 As String
- On Error GoTo err2
- With Adodc1
- .RecordSource = "select * from " & frmmain.datas & " where 编号='" & Text1.Text & "'"
- .Refresh
- If .Recordset.Fields("失效标记") = False Then
- If .Recordset.AbsolutePosition <> adPosUnknown Then
- .Recordset.Fields("规格") = Text2.Text
- .Recordset.Fields("单位") = Combo1.Text
- .Recordset.Fields("数量") = Text3.Text
- .Recordset.Fields("进价") = Text4.Text
- .Recordset.Fields("进价合计") = (Text3.Text) * (Text4.Text)
- .Recordset.Fields("零售价") = Text5.Text
- .Recordset.Fields("零售合计") = (Text3.Text) * (Text5.Text)
- .Recordset.Fields("产地") = Text6.Text
- .Recordset.Fields("批号") = Text7.Text
- .Recordset.Fields("差额") = (.Recordset.Fields("零售合计")) - (.Recordset.Fields("进价合计"))
- rq1 = Text8.Text & "-" & Text9.Text & "-" & Text10.Text
- .Recordset.Fields("采购日期") = CDate(rq1)
- rq2 = Text11.Text & "-" & Text12.Text & "-" & Text13.Text
- .Recordset.Fields("出厂日期") = CDate(rq2)
- rq3 = Text14.Text & "-" & Text15.Text & "-" & Text16.Text
- .Recordset.Fields("失效期") = CDate(rq3)
- .Recordset.Fields("备注") = Text17.Text
- .Recordset.UpdateBatch
- End If
- Command2.Enabled = False
- Text1.Enabled = True
- Text18.Enabled = True
- Label23.Caption = ""
- Else
- MsgBox "该库存药品已经失效,须清理后才能入库!"
- End If
- End With
- Exit Sub
- err2:
- MsgBox "登记项目填写不全或数据类型不匹配!"
- End Sub
- Private Sub Command3_Click()
- frmcode.Show
- End Sub
- Private Sub Command4_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- On Error GoTo err4
- frminput.Top = (frmmain.Height - frminput.Height) / 2 - 500
- frminput.Left = (frmmain.Width - frminput.Width) / 2
- Adodc1.ConnectionString = frmlogin.conn
- Adodc2.ConnectionString = frmlogin.conn
- Adodc3.ConnectionString = frmlogin.conn
- Command1.Enabled = False
- Command2.Enabled = False
- Text2.Locked = True
- Text1.Enabled = False
- Text18.Enabled = False
- Text8.Text = "2000"
- Text9.Text = "01"
- Text10.Text = "01"
- Text11.Text = "2000"
- Text12.Text = "01"
- Text13.Text = "01"
- Text14.Text = "2000"
- Text15.Text = "01"
- Text16.Text = "01"
- Text17.Text = "请填写备注"
- Exit Sub
- err4:
- MsgBox "远程服务器连接失败!"
- End Sub
- Private Sub Text1_Change()
- On Error GoTo err3
- With Adodc2
- .RecordSource = "select * from " & frmmain.kcode & " where 编号='" & Text1.Text & "'"
- .Refresh
- If .Recordset.AbsolutePosition <> adPosUnknown Then
- Text2.Text = .Recordset.Fields(3)
- Text18.Text = .Recordset.Fields(2)
- Text18.Locked = True
- Label23.ForeColor = &HFF&
- Label23.Caption = "已经找到[" & Text1.Text & "]这个代码!"
- With Adodc1
- .RecordSource = "select * from " & frmmain.datas & " where 编号='" & Text1.Text & "'"
- .Refresh
- If .Recordset.AbsolutePosition <> adPosUnknown Then
- Command1.Enabled = False
- If .Recordset.Fields("数量") > 0 Then
- Command2.Enabled = False
- Combo1.Text = ""
- Text3.Text = ""
- Text4.Text = ""
- Text5.Text = ""
- Text6.Text = ""
- Text7.Text = ""
- Text17.Text = "请填写备注"
- MsgBox "该药品或器械库存结余,不能继续入库!"
- Text1.Locked = False
- Text18.Locked = False
- Text18.Text = ""
- Text1.Text = ""
- Else
- Label23.ForeColor = &HFF0000
- Label23.Caption = "库存[" & Text18.Text & "]已空,请增加库存量!"
- Combo1.Locked = True
- Command2.Enabled = True
- Text4.Locked = True
- Text5.Locked = True
- Text2.Text = .Recordset.Fields("规格")
- Combo1.Text = .Recordset.Fields("单位")
- Text3.Text = .Recordset.Fields("数量")
- Text4.Text = .Recordset.Fields("进价")
- Text5.Text = .Recordset.Fields("零售价")
- Text6.Text = .Recordset.Fields("产地")
- Text7.Text = .Recordset.Fields("批号")
- End If
- Else
- Label23.ForeColor = &HFF0000
- Label23.Caption = "库房中没有[" & Text18.Text & "],请添加新品种!"
- Command2.Enabled = False
- Command1.Enabled = True
- Combo1.Locked = False
- Text4.Locked = False
- Text5.Locked = False
- Combo1.Text = ""
- Text3.Text = ""
- Text4.Text = ""
- Text5.Text = ""
- Text6.Text = ""
- Text17.Text = "请填写备注"
- End If
- End With
- Else
- Command1.Enabled = False
- Command2.Enabled = False
- Label23.ForeColor = &H12&
- Label23.Caption = "代码库中没有[" & Text1.Text & "]这个代码,应先编制代码!"
- End If
- End With
- Exit Sub
- err3:
- MsgBox "输入了非法字符或数据项填写不完整!"
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
- End Sub
- Private Sub Form_Activate()
- frmmain.StatusBar1.Panels(2) = "活动窗口:" & frminput.Caption
- End Sub
- Private Sub Text3_GotFocus()
- Text3.SelStart = 0
- Text3.SelLength = Len(Text3.Text)
- End Sub
- Private Sub Text4_GotFocus()
- Text4.SelStart = 0
- Text4.SelLength = Len(Text4.Text)
- End Sub
- Private Sub Text5_GotFocus()
- Text5.SelStart = 0
- Text5.SelLength = Len(Text5.Text)
- End Sub
- Private Sub Text6_GotFocus()
- Text6.SelStart = 0
- Text6.SelLength = Len(Text6.Text)
- End Sub
- Private Sub Text7_GotFocus()
- Text7.SelStart = 0
- Text7.SelLength = Len(Text7.Text)
- End Sub
- Private Sub Text17_GotFocus()
- Text17.SelStart = 0
- Text17.SelLength = Len(Text17.Text)
- End Sub
- Private Sub Text1_GotFocus()
- Text1.SelStart = 0
- Text1.SelLength = Len(Text1.Text)
- End Sub
- Private Sub Text18_GotFocus()
- Text18.SelStart = 0
- Text18.SelLength = Len(Text18.Text)
- End Sub
- Private Sub Text6_Change()
- On Error GoTo err0
- With Adodc3
- .RecordSource = "select 名称,代码 from othercode where 代码='" & Text6.Text & "'"
- .Refresh
- If .Recordset.AbsolutePosition <> adPosUnknown Then
- Text6.Text = .Recordset.Fields("名称")
- End If
- End With
- Exit Sub
- err0:
- MsgBox "数据库连接失败!"
- End Sub
- Private Sub Text18_Change()
- On Error GoTo err5
- With Adodc2
- .RecordSource = "select * from " & frmmain.kcode & " where 代码='" & Text18.Text & "'"
- .Refresh
- If .Recordset.AbsolutePosition <> adPosUnknown Then
- Text1.Text = .Recordset.Fields(1)
- Text1.Locked = True
- Else
- Command1.Enabled = False
- End If
- End With
- Exit Sub
- err5:
- MsgBox "数据库连接失败!"
- End Sub