📄 frm_rndtimecard00.frm
字号:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "frm_Rndtimecard00.frx":0BE8
MousePointer = 99
XPStyle = -1 'True
End
Begin GButton.GurhanButton GurhanButton1
Height = 855
Index = 2
Left = 3840
TabIndex = 19
Top = 2805
Width = 1335
_ExtentX = 2355
_ExtentY = 1508
Caption = "下班 "
OriginalPicSizeW= 0
OriginalPicSizeH= 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "frm_Rndtimecard00.frx":0F02
MousePointer = 99
XPStyle = -1 'True
End
Begin GButton.GurhanButton GurhanButton1
Height = 855
Index = 3
Left = 3840
TabIndex = 20
Top = 3840
Width = 1335
_ExtentX = 2355
_ExtentY = 1508
Caption = "加班 "
OriginalPicSizeW= 0
OriginalPicSizeH= 0
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MouseIcon = "frm_Rndtimecard00.frx":121C
MousePointer = 99
XPStyle = -1 'True
End
End
Attribute VB_Name = "frm_Rndtimecard"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mDB As New mDB
'Dim strConn As String
'Dim strConn0 As String
Dim strSQL As String
Dim WithEvents adoprimaryRS As ADODB.Recordset
Attribute adoprimaryRS.VB_VarHelpID = -1
Dim strSQL2 As String
Dim WithEvents adoprimaryRS2 As ADODB.Recordset
Attribute adoprimaryRS2.VB_VarHelpID = -1
Dim strSQL3 As String
Dim WithEvents adoPrimaryRS3 As ADODB.Recordset
Attribute adoPrimaryRS3.VB_VarHelpID = -1
Dim strSQL4 As String
Dim WithEvents adoPrimaryRS4 As ADODB.Recordset
Attribute adoPrimaryRS4.VB_VarHelpID = -1
Dim mvList() As String
Dim db As ADODB.Connection
Private Sub Database_Refresh(xMode As Integer)
On Error Resume Next
Set db = New ADODB.Connection
db.CursorLocation = adUseClient
db.ConnectionString = strConnDR
db.Open '连接数据库
If xMode = 0 Then
Set adoprimaryRS = New ADODB.Recordset
adoprimaryRS.Open strSQL, db, adOpenStatic, adLockOptimistic
ElseIf xMode = 1 Then
Set adoprimaryRS2 = New ADODB.Recordset
adoprimaryRS2.Open strSQL2, db, adOpenStatic, adLockOptimistic
ElseIf xMode = 2 Then
Set adoPrimaryRS3 = New ADODB.Recordset
adoPrimaryRS3.Open strSQL3, db, adOpenStatic, adLockOptimistic
ElseIf xMode = 3 Then
Set adoPrimaryRS4 = New ADODB.Recordset
adoPrimaryRS4.Open strSQL4, db, adOpenStatic, adLockOptimistic
End If
End Sub
Private Sub DataCombo1_Click(Index As Integer, Area As Integer)
Select Case Index
Case 0
If DataCombo1(0).Text <> "" Then
'List1.AddItem DataCombo1(0).Text
judgeList List1, DataCombo1(0).Text
End If
End Select
End Sub
Private Sub Form_Load()
Screen.MousePointer = vbHourglass
'strConn = SQLcon
'strConn0 = SQLcon0
Set mDB = New mDB
mDB.InitDB_RY strConnDR
strSQL = "select dptid,dptname from depart where ify=1 order by dptname asc"
Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
'Debug.Print adoprimaryRS.RecordCount
With DataCombo1(0)
Set .RowSource = adoprimaryRS
.BoundColumn = "dptid"
.ListField = "dptname"
.Refresh
End With
With adoprimaryRS
.MoveFirst
Do Until .EOF
List1.AddItem .Fields("dptname").Value
.MoveNext
Loop
End With
strSQL = "select max(cdatetime) as maxdate from empcrdtm" '' order by begdate asc"
Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
DTPicker1(0).Value = Format(adoprimaryRS.Fields("maxdate").Value + 1, "yyyy-mm-dd") ''' Date
' DTPicker1(1).Value = Date
' Option1(0).Value = True
' SETIMER1(0).Text = "00:00:01"
' SETIMER1(1).Text = "23:59:59"
' strSQL = "select * from wktm2" '' order by begdate asc"
strSQL = "select * from wktm where wktmid=2"
Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
SETIMER1(0).Text = TimeSerial(Hour(adoprimaryRS("bgnwktm1").Value), Minute(adoprimaryRS("bgnwktm1").Value), 0) '''' "00:00:01"
SETIMER1(1).Text = TimeSerial(Hour(adoprimaryRS("bgntm1").Value), Minute(adoprimaryRS("bgntm1").Value), 0) '''' "00:00:01""23:59:59"
SETIMER1(2).Text = TimeSerial(Hour(adoprimaryRS("endtm1").Value), Minute(adoprimaryRS("endtm1").Value), 0) '''' "00:00:01""23:59:59"
SETIMER1(3).Text = TimeSerial(Hour(adoprimaryRS("endwktm1").Value), Minute(adoprimaryRS("endwktm1").Value), 0) '''' "00:00:01"
SETIMER1(4).Text = TimeSerial(Hour(adoprimaryRS("bgnwktm2").Value), Minute(adoprimaryRS("bgnwktm2").Value), 0) '''' "00:00:01"
SETIMER1(5).Text = TimeSerial(Hour(adoprimaryRS("bgntm2").Value), Minute(adoprimaryRS("bgntm2").Value), 0) '''' "00:00:01""23:59:59"
SETIMER1(6).Text = TimeSerial(Hour(adoprimaryRS("endtm2").Value), Minute(adoprimaryRS("endtm2").Value), 0) '''' "00:00:01""23:59:59"
SETIMER1(7).Text = TimeSerial(Hour(adoprimaryRS("endwktm2").Value), Minute(adoprimaryRS("endwktm2").Value), 0) '''' "00:00:01"
SETIMER1(8).Text = TimeSerial(Hour(adoprimaryRS("bgnwktm3").Value), Minute(adoprimaryRS("bgnwktm3").Value), 0) '''' "00:00:01"
SETIMER1(9).Text = TimeSerial(Hour(adoprimaryRS("bgntm3").Value), Minute(adoprimaryRS("bgntm3").Value), 0) '''' "00:00:01""23:59:59"
SETIMER1(10).Text = TimeSerial(Hour(adoprimaryRS("endtm3").Value), Minute(adoprimaryRS("endtm3").Value), 0) '''' "00:00:01""23:59:59"
SETIMER1(11).Text = TimeSerial(Hour(adoprimaryRS("endwktm3").Value), Minute(adoprimaryRS("endwktm3").Value), 0) '''' "00:00:01"
CenterForm Me
' Debug.Print DateDiff("n", SETIMER1(0).Text, SETIMER1(1).Text)
'''''''将人员表数据导入sqlserver数据库
''strSQL2 = "delete from emply2"
''Set adoPrimaryRS2 = mDB.adoprimaryRS(strSQL2)
''''''''''***********************************一定要是ACCESS等桌面数据库,绝对位置,单引号***********************************
'' Dim MD As New mDB
'' MD.InitDB
'' strSQL = "select * into emppp in 'e:\sjk\data\hisdata1.mdb' from emply2"
''' adoprimaryRS.Save emp.rst
''MD.MakeTables strSQL, "emppp"
''''
''strSQL = "select * from emppp"
''MD.CreateRS adoprimaryRS, strSQL
''''''''''**********************************************************************
''Debug.Print adoprimaryRS.RecordCount
''
''strSQL2 = "select * from emply2"
''Set adoPrimaryRS2 = mDB.adoprimaryRS(strSQL2)
''With adoprimaryRS
'' .MoveFirst
''Do Until .EOF
'' adoPrimaryRS2.AddNew
'' adoPrimaryRS2.Fields("ifin").Value = .Fields("ifin").Value
'' adoPrimaryRS2.Fields("partname").Value = .Fields("partname").Value
'' adoPrimaryRS2.Fields("emplyid").Value = "00" & .Fields("emplyid").Value
'' adoPrimaryRS2.Fields("emplyname").Value = .Fields("emplyname").Value
'' adoPrimaryRS2.Fields("indate").Value = .Fields("indate").Value
'' adoPrimaryRS2.Fields("outdate").Value = .Fields("outdate").Value
'' adoPrimaryRS2.Fields("gangwei").Value = .Fields("gangwei").Value
'' adoPrimaryRS2.Update
'' .MoveNext
''Loop
''End With
''Set MD = Nothing
'strSQL = "select dptname as 部门,emplyid as 工号,emplyname as 姓名,serial as 卡序列号 from depart,emply where depart.dptid=emply.dptid"
'
'Dim o As New ToExcel
''strSQL = "select * from emply where emplyid not in (select emplyid from emply2)"
'Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
'Debug.Print adoprimaryRS.RecordCount
'o.ToExcel adoprimaryRS, "不匹配", "不在新表中"
'
'strSQL = "select * from emply2 where emplyid not in (select emplyid from emply)"
'Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
'Debug.Print adoprimaryRS.RecordCount
'o.ToExcel adoprimaryRS, "不匹配", "不在表中"
'Set o = Nothing
'
strSQL = "select * from emply" ''''2 where emplyid not in (select emplyid from emply)"
Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
Debug.Print adoprimaryRS.RecordCount
'Dim m_sConnect As String
'm_sConnect = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=z:\data\hisdata1.mdb;Jet OLEDB:Database Password=notopen;" '''''用的是ODBC驱动程序
'
'strSQL = "select * into emplyww in """ & m_sConnect & """ from emply2 where outdate is null" ''''2 where emplyid not in (select emplyid from emply)"
'Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
'Database_Refresh 0
'Debug.Print strSQL
'
Screen.MousePointer = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub GurhanButton1_Click(Index As Integer)
Dim mancount As Integer
Dim i As Integer
ReDim mvList(List1.ListCount - 1)
'Dim strList As String
'strList = ""
For i = 0 To List1.ListCount - 1
mvList(i) = List1.List(i)
'strList = strList & "'" & List1.List(i) & "'" & ","
'Debug.Print mvList(i)
Next i
'strList = Left(strList, Len(strList) - 1)
Dim bgtm As Date
Dim t1 As Integer
Dim Maxid As Long
strSQL = "select max(crdtmid) as maxid from empcrdtm"
Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
If IsNull(adoprimaryRS.Fields("maxid").Value) Then
Maxid = 1
Else
Maxid = adoprimaryRS.Fields("maxid").Value
End If
strSQL = "select top 10 * from empcrdtm"
Set adoprimaryRS = mDB.adoprimaryRS(strSQL)
'bgtm = DTPicker1(0).Value & " " & SETIMER1(0).Text
't1 = DateDiff("n", SETIMER1(0).Text, SETIMER1(1).Text)
'Debug.Print bgtm
'Debug.Print t1
Select Case Index
Case 0
strSQL2 = "delete from emplytmp"
mDB.ExecuteSQL strSQL2
For i = 0 To List1.ListCount - 1
strSQL2 = "insert into emplytmp select emplyid,serial from emply,depart where depart.dptid=emply.dptid and emply.empcrdyn=1 and dptname ='" & List1.List(i) & "'"
Set adoprimaryRS2 = mDB.adoprimaryRS(strSQL2)
Next i
'GurhanButton1(0).BackColor = vbBlue
'GurhanButton1(0).BackColor = &H8000000F
'Dim mancount As Integer
strSQL2 = "select * from emplytmp"
Set adoprimaryRS2 = mDB.adoprimaryRS(strSQL2)
mancount = adoprimaryRS2.RecordCount
'strSQL2 = "select emplytmp.emplyid,emplytmp.serial from emplytmp,emply2 where emplytmp.emplyid=emply2.emplyid and indate<='" & DTPicker1(0).Value & "' amd ((outdate is null) or (outdate<'" & DTPicker1(0).Value & "'))"
strSQL2 = "delete from emplytp"
mDB.ExecuteSQL strSQL2
'strSQL2 = "insert into emplytp select emplytmp.emplyid,emplytmp.serial from emplytmp,emply2 where emplytmp.emplyid=emply2.emplyid and indate<='" & DTPicker1(0).Value & "' and outdate<='" & DTPicker1(0).Value & "'"
strSQL2 = "insert into emplytp select emplytmp.emplyid,emplytmp.serial,outdate from emplytmp,emply2 where emplytmp.emplyid=emply2.emplyid and indate<='" & DTPicker1(0).Value & "'"
mDB.ExecuteSQL strSQL2
'strSQL2 = "select emplytp.emplyid,serial from emplytp,emply2 where emplytp.emplyid=emply2.emplyid and ((outdate is null) or (outdate>'" & DTPicker1(0).Value & "'))"
strSQL2 = "select emplytp.emplyid,serial from emplytp where (outdate is null) or (outdate>'" & DTPicker1(0).Value & "')"
Debug.Print DTPicker1(0).Value
Debug.Print strSQL2
Set adoprimaryRS2 = mDB.adoprimaryRS(strSQL2)
If adoprimaryRS2.RecordCount = 0 Then
MsgBox "你所选择的部门无员工,请重新选择。谢谢。", vbOKOnly, "NewAsia"
Exit Sub
Else
MsgBox "共有" & mancount & "_" & adoprimaryRS2.RecordCount & "人参与考勤", vbOKOnly, "NewAsia"
End If
bgtm = DTPicker1(0).Value & " " & SETIMER1(0).Text
t1 = DateDiff("n", SETIMER1(0).Text, SETIMER1(1).Text)
adoprimaryRS2.MoveFirst
Do Until adoprimaryRS2.EOF
With adoprimaryRS
.AddNew
.Fields("crdtmid").Value = Maxid + 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -