frmclear.frm
资源名称:yf.rar [点击查看]
上传用户:laihaixin
上传日期:2013-01-26
资源大小:1169k
文件大小:10k
源码类别:
医药行业
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
- Begin VB.Form frmclear
- BackColor = &H00404040&
- BorderStyle = 3 'Fixed Dialog
- Caption = "清理过期报废库存品"
- ClientHeight = 4080
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 9975
- Icon = "frmclear.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- Picture = "frmclear.frx":030A
- ScaleHeight = 4080
- ScaleWidth = 9975
- ShowInTaskbar = 0 'False
- Begin VB.ComboBox Combo2
- Height = 300
- ItemData = "frmclear.frx":59F9
- Left = 1440
- List = "frmclear.frx":5A06
- TabIndex = 7
- Top = 3645
- Width = 1335
- End
- Begin VB.CommandButton Command4
- Caption = "全部清理&(A)"
- Height = 350
- Left = 3900
- TabIndex = 4
- Top = 3615
- Width = 1500
- End
- Begin VB.CommandButton Command3
- Caption = "关闭&(C)"
- Height = 350
- Left = 8520
- TabIndex = 3
- Top = 3615
- Width = 1200
- End
- Begin VB.CommandButton Command2
- Caption = "更新&(U)"
- Height = 350
- Left = 7080
- TabIndex = 2
- Top = 3615
- Width = 1200
- End
- Begin VB.CommandButton Command1
- Caption = "删除&(D)"
- Height = 350
- Left = 5640
- TabIndex = 1
- Top = 3615
- Width = 1200
- End
- Begin MSDataGridLib.DataGrid DataGrid1
- Height = 3135
- Left = 120
- TabIndex = 0
- Top = 360
- Width = 9710
- _ExtentX = 17119
- _ExtentY = 5530
- _Version = 393216
- AllowUpdate = 0 'False
- BackColor = 16777215
- DefColWidth = 53
- ForeColor = 16711680
- HeadLines = 1.5
- RowHeight = 15
- BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ColumnCount = 2
- BeginProperty Column00
- DataField = ""
- Caption = ""
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column01
- DataField = ""
- Caption = ""
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 2052
- SubFormatType = 0
- EndProperty
- EndProperty
- SplitCount = 1
- BeginProperty Split0
- BeginProperty Column00
- EndProperty
- BeginProperty Column01
- EndProperty
- EndProperty
- End
- Begin MSAdodcLib.Adodc Adodc1
- Height = 330
- Left = 5280
- Top = 0
- Visible = 0 'False
- Width = 1335
- _ExtentX = 2355
- _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.Label Label2
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "选择数据库"
- ForeColor = &H00000000&
- Height = 180
- Left = 480
- TabIndex = 6
- Top = 3705
- Width = 900
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- ForeColor = &H000000FF&
- Height = 180
- Left = 360
- TabIndex = 5
- Top = 90
- Width = 90
- End
- End
- Attribute VB_Name = "frmclear"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public Sub Guolu()
- On Error GoTo err0
- 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
- .RecordSource = "select * from " & frmmain.datas & " where 失效标记=true"
- .Refresh
- Label1.Caption = Combo2.Text & "中过期或报废共:" & .Recordset.RecordCount & " 种"
- DataGrid1.AllowUpdate = False
- Set DataGrid1.DataSource = Adodc1
- DataGrid1.Columns(0).Visible = False
- DataGrid1.Columns(17).Visible = False
- DataGrid1.Columns("进价").NumberFormat = "0.00"
- DataGrid1.Columns("进价合计").NumberFormat = "0.00"
- DataGrid1.Columns("零售价").NumberFormat = "0.00"
- DataGrid1.Columns("零售合计").NumberFormat = "0.00"
- DataGrid1.Columns("差额").NumberFormat = "0.00"
- DataGrid1.Columns(1).Width = 1000
- DataGrid1.Columns(2).Width = 1200
- DataGrid1.Columns(3).Width = 1200
- DataGrid1.Columns(4).Width = 600
- DataGrid1.Columns(5).Width = 600
- DataGrid1.Columns(6).Width = 600
- End With
- Exit Sub
- err0:
- MsgBox "数据库已空或连接失败!"
- End Sub
- Private Sub Combo2_Click()
- On Error GoTo wrong
- Select Case Combo2.Text
- Case "西药中成药库"
- frmmain.datas = "kcyp"
- frmclear.Caption = "清理过期或报废西药和中成药数据"
- Call Guolu
- Case "中草药库"
- frmmain.datas = "caoyao"
- frmclear.Caption = "清理失效或报废中草药数据"
- Call Guolu
- Case "器械材料库"
- frmmain.datas = "qixie"
- frmclear.Caption = "清理报废医疗器械和材料数据"
- Call Guolu
- Case Else
- frmclear.Caption = "清理过期报废库存品"
- End Select
- Exit Sub
- wrong:
- MsgBox "请检查网络连接是否正常!"
- End Sub
- Private Sub Command1_Click()
- On Error GoTo err1
- Dim respond As String
- With Adodc1
- respond = MsgBox("当前过期报废药品记录将被清理,继续吗?", 4, "特别警告")
- If respond = vbYes Then
- .RecordSource = "select * from " & frmmain.datas & " where 失效标记=true"
- .Refresh
- .Recordset.Fields("数量") = 0
- .Recordset.Fields("进价") = 0
- .Recordset.Fields("进价合计") = 0
- .Recordset.Fields("零售价") = 0
- .Recordset.Fields("零售合计") = 0
- .Recordset.Fields("差额") = 0
- .Recordset.MoveNext
- .Recordset.UpdateBatch
- If .Recordset.EOF Then .Recordset.MoveNext
- End If
- End With
- Exit Sub
- err1:
- MsgBox "数据库已空或选择了无效的数据!"
- End Sub
- Private Sub Command2_Click()
- On Error GoTo err3
- Adodc1.Recordset.UpdateBatch
- Exit Sub
- err3:
- MsgBox "数据库中没有记录或数据库无效!"
- End Sub
- Private Sub Command3_Click()
- Unload Me
- End Sub
- Private Sub Command4_Click()
- Dim respond As String
- On Error GoTo err4
- With Adodc1
- respond = MsgBox("本操作将清理所有过期报废药品记录,继续吗?", 4, "特别警告")
- If respond = vbYes Then
- .RecordSource = "select * from " & frmmain.datas & " where 失效标记=true"
- .Refresh
- .Recordset.MoveFirst
- For i = 0 To .Recordset.RecordCount - 1
- .Recordset.Fields("数量") = 0
- .Recordset.Fields("进价") = 0
- .Recordset.Fields("进价合计") = 0
- .Recordset.Fields("零售价") = 0
- .Recordset.Fields("零售合计") = 0
- .Recordset.Fields("差额") = 0
- .Recordset.MoveNext
- .Recordset.UpdateBatch
- Next
- End If
- End With
- Exit Sub
- err4:
- MsgBox "数据库已空或选择了无效的数据!"
- End Sub
- Private Sub Form_Load()
- On Error GoTo err2
- frmclear.Top = (frmmain.Height - frmclear.Height) / 2 - 500
- frmclear.Left = (frmmain.Width - frmclear.Width) / 2
- Adodc1.ConnectionString = frmlogin.conn
- Exit Sub
- err2:
- MsgBox "远程数据库连接失败,请检查网络连接!"
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
- End Sub
- Private Sub Form_Activate()
- frmmain.StatusBar1.Panels(2) = "活动窗口:" & frmclear.Caption
- End Sub