📄 formlk.frm
字号:
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=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=hgrs;Data Source=SERVER"
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=hgrs;Data Source=SERVER"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adczg"
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.TextBox Texttimem
Height = 270
Left = 1920
TabIndex = 3
Text = "0"
Top = 480
Width = 855
End
Begin VB.TextBox Texttimeh
Height = 270
Left = 840
TabIndex = 2
Top = 480
Width = 780
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 4920
TabIndex = 13
Top = 5160
Width = 855
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 4560
TabIndex = 4
Top = 120
Width = 855
End
Begin VB.TextBox Textbmname
ForeColor = &H000000FF&
Height = 270
Left = 3480
TabIndex = 7
Top = 960
Width = 1695
End
Begin VB.TextBox Textzgname
ForeColor = &H000000FF&
Height = 270
Left = 2040
TabIndex = 6
TabStop = 0 'False
Top = 960
Width = 975
End
Begin VB.TextBox Textzgid
ForeColor = &H000000FF&
Height = 270
Left = 840
TabIndex = 5
Top = 960
Width = 735
End
Begin VB.TextBox Textdate1
Height = 270
Left = 840
TabIndex = 0
Top = 120
Width = 1575
End
Begin VB.TextBox Textdate2
Height = 270
Left = 2760
TabIndex = 1
Top = 120
Width = 1455
End
Begin VB.Label Label11
Caption = "合计"
Height = 255
Left = 360
TabIndex = 25
Top = 4440
Width = 495
End
Begin VB.Label Label10
Caption = "处理进度"
Height = 255
Left = 120
TabIndex = 22
Top = 4800
Width = 735
End
Begin VB.Label Label9
Caption = "日期"
Height = 255
Left = 5160
TabIndex = 21
Top = 960
Width = 375
End
Begin VB.Label Label8
Caption = "分"
Height = 255
Left = 2880
TabIndex = 16
Top = 480
Width = 255
End
Begin VB.Label Label7
Caption = "时"
Height = 255
Left = 1680
TabIndex = 15
Top = 480
Width = 255
End
Begin VB.Label Label6
Caption = "时间"
Height = 255
Left = 360
TabIndex = 14
Top = 480
Width = 375
End
Begin VB.Label Label3
Caption = "部门"
Height = 255
Left = 3120
TabIndex = 12
Top = 960
Width = 375
End
Begin VB.Label Label2
Caption = "姓名"
Height = 255
Left = 1680
TabIndex = 11
Top = 960
Width = 375
End
Begin VB.Label Label1
Caption = "工号"
Height = 255
Left = 360
TabIndex = 10
Top = 975
Width = 375
End
Begin VB.Label Label4
Caption = "日期"
Height = 255
Left = 360
TabIndex = 9
Top = 120
Width = 375
End
Begin VB.Label Label5
Caption = "--"
Height = 255
Left = 2520
TabIndex = 8
Top = 120
Width = 255
End
End
Attribute VB_Name = "Formlosskq"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim vzgid, vzgname, vbmid, vsum
Private Sub Adclosskq_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If Not Adclosskq.Recordset.EOF Then
If IsNull(Adclosskq.Recordset.Fields("zgid").Value) Then
Textzgid.Text = ""
Else
Textzgid.Text = Adclosskq.Recordset.Fields("zgid").Value
End If
If IsNull(Adclosskq.Recordset.Fields("zgname").Value) Then
Textzgname.Text = ""
Else
Textzgname.Text = Adclosskq.Recordset.Fields("zgname").Value
End If
If IsNull(Adclosskq.Recordset.Fields("bmid").Value) Then
Textbmname.Text = ""
Else
Textbmname.Text = Adclosskq.Recordset.Fields("bmid").Value
End If
If IsNull(Adclosskq.Recordset.Fields("kqdate").Value) Then
Textkqdate.Text = ""
Else
Textkqdate.Text = Adclosskq.Recordset.Fields("kqdate").Value
End If
End If
End Sub
Private Sub Command1_Click()
Dim vtimeh, vtimem, vbanlid, vcount, i
Dim vtime1, vtime2 As Integer
Dim vdate1, vdate2, vbmname
vdate1 = CDate(Textdate1.Text)
vdate2 = CDate(Textdate2.Text)
If Texttimeh.Text = "" Or Texttimem.Text = "" Then
MsgBox ("时间输入错误")
Else
vtimeh = Val(Texttimeh.Text)
vtimem = Val(Texttimem.Text)
vtime1 = vtimeh * 60 + vtimem - 120
vtime2 = vtimeh * 60 + vtimem + 15
If Not IsDate(Textdate1.Text) And Not IsDate(Textdate2.Text) Then
MsgBox ("日期输入错误")
Textdate1.SetFocus
Else
adczg.RecordSource = "select * from tzg where zgid<>''"
adczg.Refresh
If Not adczg.Recordset.EOF Then
vcount = adczg.Recordset.RecordCount
End If
PBar1.Max = vcount
PBar1.Min = 0
PBar1.Value = 0
i = 0
Do While Not adczg.Recordset.EOF
vbmname = ""
vzgid = adczg.Recordset.Fields("zgid").Value
vzgname = adczg.Recordset.Fields("zgname").Value
vbmid = adczg.Recordset.Fields("bmid").Value
Adcbm.RecordSource = "select * from tbm where bmid='" & vbmid & "'"
Adcbm.Refresh
If Not Adcbm.Recordset.EOF Then
vbmname = Adcbm.Recordset.Fields("bmname").Value
End If
vbanlid = adczg.Recordset.Fields("banlid").Value
vdate1 = CDate(Textdate1.Text)
vdate2 = CDate(Textdate2.Text)
Do While vdate1 <= vdate2
Adckq.RecordSource = "select * from kqrecord where kqdate='" & vdate1 & "' and kqtime>='" & vtime1 & "'and kqtime<='" & vtime2 & "'and zgid='" & vzgid & "'"
Adckq.Refresh
If Adckq.Recordset.EOF Then
Adclosskq.RecordSource = "select * from losskq where zgid='" & vzgid & "' and kqdate='" & vdate1 & "'"
Adclosskq.Refresh
If Adclosskq.Recordset.EOF Then
Adclosskq.Recordset.AddNew
Adclosskq.Recordset.Fields("zgid").Value = vzgid
Adclosskq.Recordset.Fields("zgname").Value = vzgname
Adclosskq.Recordset.Fields("bmid").Value = vbmname
Adclosskq.Recordset.Fields("banlid").Value = vbanlid
Adclosskq.Recordset.Fields("kqdate").Value = vdate1
Adclosskq.Recordset.Update
End If
End If
vdate1 = vdate1 + 1
Loop
i = i + 1
PBar1.Value = i
adczg.Recordset.MoveNext
Loop
MsgBox ("处理完成")
Adclosskq.RecordSource = "select * from losskq where zgid<>''order by zgid"
Adclosskq.Refresh
If Not Adclosskq.Recordset.EOF Then
vsum = Adclosskq.Recordset.RecordCount
Textcount.Text = vsum
End If
Adclosskq.Recordset.AddNew
Adclosskq.Recordset.Fields("zgid").Value = " 合计"
Adclosskq.Recordset.Fields("zgname").Value = vsum
Adclosskq.Recordset.Fields("bmid").Value = "人次"
Adclosskq.Recordset.Update
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
CRep1.Action = 0
End Sub
Private Sub Command4_Click()
CRep2.Action = 0
End Sub
Private Sub Command5_Click()
Adclosskq.RecordSource = "select * from losskq where zgid<>''"
Adclosskq.Refresh
Do While Not Adclosskq.Recordset.EOF
Adclosskq.Recordset.Delete
Adclosskq.Recordset.Update
Adclosskq.Recordset.MoveNext
If Adclosskq.Recordset.EOF Then
Exit Do
End If
Loop
End Sub
Private Sub Form_Load()
Adclosskq.RecordSource = "select * from losskq where zgid<>''order by zgid"
Adclosskq.Refresh
If Not Adclosskq.Recordset.EOF Then
vsum = Adclosskq.Recordset.RecordCount - 1
Textcount.Text = vsum
End If
End Sub
Private Sub Textbmid_Change()
End Sub
Private Sub Textdate1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Textdate2.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -