📄 formkhcrp.frm
字号:
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 = "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 Command2
Caption = "退出"
Height = 375
Left = 2160
TabIndex = 5
Top = 1560
Width = 615
End
Begin VB.CommandButton Command1
Caption = "打印"
Height = 375
Left = 1200
TabIndex = 4
Top = 1560
Width = 735
End
Begin VB.TextBox Text1
ForeColor = &H000000FF&
Height = 270
Left = 1560
TabIndex = 1
Top = 360
Width = 1335
End
Begin MSAdodcLib.Adodc Adcbm
Height = 330
Left = 4440
Top = 1560
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
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 = "tbm"
Caption = "Adcbm"
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 MSDataListLib.DataCombo DCombo1
Bindings = "Formkhcrp.frx":0000
DataSource = "Adcbm"
Height = 330
Left = 1560
TabIndex = 3
Top = 720
Width = 1335
_ExtentX = 2355
_ExtentY = 582
_Version = 393216
ListField = "bmname"
Text = ""
End
Begin VB.Label Label3
Caption = "--"
Height = 255
Left = 3000
TabIndex = 7
Top = 360
Width = 255
End
Begin VB.Label Label2
Caption = "部门"
Height = 255
Left = 600
TabIndex = 2
Top = 720
Width = 495
End
Begin VB.Label Label1
Caption = "工号"
Height = 255
Left = 600
TabIndex = 0
Top = 360
Width = 975
End
End
Attribute VB_Name = "Formkhrp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim vbmid, vbmname, vzgid, vjobid, vjobname
Dim vf1, vf2, vf3, vf4, vfc, m, vcm
Dim workdate, writedate
Adokhrp.RecordSource = "select * from khcrp"
Adokhrp.Refresh
Do While Not Adokhrp.Recordset.EOF
Adokhrp.Recordset.Delete
Adokhrp.Recordset.MoveNext
Loop
If (Text1.Text = "" Or Text2.Text = "") And DCombo1.Text = "" Then
MsgBox ("输入条件为空")
Else
vbmname = DCombo1.Text
Adodc1.RecordSource = "select * from tbm where bmname='" & vbmname & "' "
Adodc1.Refresh
If Not Adodc1.Recordset.EOF Then
vbmid = Adodc1.Recordset.Fields("bmid").Value
End If
Adozg.RecordSource = "select * from tzg where zgid>='" & Text1.Text & "'and zgid<='" & Text2.Text & "'or bmid='" & vbmid & "'order by zgid"
Adozg.Refresh
Do While Not Adozg.Recordset.EOF
vf1 = 0
vf2 = 0
vf3 = 0
vf4 = 0
vfc = 0
vd1 = ""
vd2 = ""
vd3 = ""
vd4 = ""
vzgid = Adozg.Recordset.Fields("zgid").Value
vzgname = Adozg.Recordset.Fields("zgname").Value
vbmid = Adozg.Recordset.Fields("bmid").Value
vjobid = Adozg.Recordset.Fields("jobid").Value
workdate = Adozg.Recordset.Fields("workdate").Value
writedate = Adozg.Recordset.Fields("writedate").Value
Ado2.RecordSource = "select * from tbm where bmid='" & vbmid & "'"
Ado2.Refresh
If Not Ado2.Recordset.EOF Then
vbmname = Ado2.Recordset.Fields("bmname").Value
End If
Ado2.RecordSource = "select * from tjob where jobid='" & vjobid & "'"
Ado2.Refresh
If Not Ado2.Recordset.EOF Then
vjobname = Ado2.Recordset.Fields("jobname").Value
End If
Adokh.RecordSource = "select * from khrecord where zgid='" & vzgid & "'"
Adokh.Refresh
If Not Adokh.Recordset.EOF Then
m = Adokh.Recordset.RecordCount
Else
m = 0
End If
Do While Not Adokh.Recordset.EOF
If Adokh.Recordset.Fields("jdname").Value = "第一季度" Then
vf1 = Adokh.Recordset.Fields("mcount").Value
vd1 = Adokh.Recordset.Fields("djname").Value
End If
If Adokh.Recordset.Fields("jdname").Value = "第二季度" Then
vf2 = Adokh.Recordset.Fields("mcount").Value
vd2 = Adokh.Recordset.Fields("djname").Value
End If
If Adokh.Recordset.Fields("jdname").Value = "第三季度" Then
vf3 = Adokh.Recordset.Fields("mcount").Value
vd3 = Adokh.Recordset.Fields("djname").Value
End If
If Adokh.Recordset.Fields("jdname").Value = "第四季度" Then
vf4 = Adokh.Recordset.Fields("mcount").Value
vd4 = Adokh.Recordset.Fields("djname").Value
End If
Adokh.Recordset.MoveNext
Loop
Adokhrp.RecordSource = "select * from khcrp where zgid='" & vzgid & "'"
Adokhrp.Refresh
If Adokhrp.Recordset.EOF Then
Adokhrp.Recordset.AddNew
Adokhrp.Recordset.Fields("zgid").Value = vzgid
Adokhrp.Recordset.Fields("zgname").Value = vzgname
Adokhrp.Recordset.Fields("bmname").Value = vbmname
Adokhrp.Recordset.Fields("jobname").Value = vjobname
Adokhrp.Recordset.Fields("workdate").Value = workdate
Adokhrp.Recordset.Fields("writedate").Value = writedate
If vf1 <> 0 Then
Adokhrp.Recordset.Fields("f1").Value = vf1
End If
Adokhrp.Recordset.Fields("d1").Value = vd1
If vf2 <> 0 Then
Adokhrp.Recordset.Fields("f2").Value = vf2
End If
Adokhrp.Recordset.Fields("d2").Value = vd2
If vf3 <> 0 Then
Adokhrp.Recordset.Fields("f3").Value = vf3
End If
Adokhrp.Recordset.Fields("d3").Value = vd3
If vf4 <> 0 Then
Adokhrp.Recordset.Fields("f4").Value = vf4
End If
Adokhrp.Recordset.Fields("d4").Value = vd4
vcm = vf1 + vf2 + vf3 + vf4
If vcm <> 0 Then
vfc = Round(vcm / m)
Adokhrp.Recordset.Fields("fc").Value = vfc
Ado2.RecordSource = "select * from djset where startm<='" & vfc & "' and endm>='" & vfc & "'"
Ado2.Refresh
If Not Ado2.Recordset.EOF Then
Adokhrp.Recordset.Fields("dc").Value = Ado2.Recordset.Fields("djname").Value
End If
End If
Adokhrp.Recordset.update
End If
Adozg.Recordset.MoveNext
Loop
CR1.Action = 0
Adokhrp.RecordSource = "select * from khcrp"
Adokhrp.Refresh
Do While Not Adokhrp.Recordset.EOF
Adokhrp.Recordset.Delete
Adokhrp.Recordset.MoveNext
Loop
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -