?? frmclear.frm
字號:
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
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -