📄 frmreport_d.frm
字号:
VERSION 5.00
Object = "{E11E7285-4386-40E5-A4D4-F55704D4D491}#1.0#0"; "sSuperGrid.ocx"
Begin VB.Form frmReport_D
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 6630
ClientLeft = 45
ClientTop = 450
ClientWidth = 9495
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6630
ScaleWidth = 9495
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin SSUPERGRIDLib.SSuperGrid grdInTime
Height = 2985
Left = 135
TabIndex = 7
Top = 3465
Width = 9195
_Version = 65536
_ExtentX = 16219
_ExtentY = 5265
_StockProps = 132
End
Begin SSUPERGRIDLib.SSuperGrid Grid
Height = 2310
Left = 135
TabIndex = 0
Top = 1125
Width = 9195
_Version = 65536
_ExtentX = 16219
_ExtentY = 4075
_StockProps = 132
End
Begin VB.Label lblAbsent
Caption = "分钟"
Height = 195
Left = 6885
TabIndex = 11
Top = 555
Width = 465
End
Begin VB.Label lblLate
Caption = "分钟"
Height = 195
Left = 6885
TabIndex = 10
Top = 855
Width = 375
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "旷工分界点:"
Height = 180
Left = 5670
TabIndex = 9
Top = 570
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "迟到早退分界点:"
Height = 180
Left = 5310
TabIndex = 8
Top = 870
Width = 1440
End
Begin VB.Label lblCardCount
AutoSize = -1 'True
Caption = "刷卡次数 :"
Height = 195
Left = 450
TabIndex = 6
Top = 855
Width = 945
End
Begin VB.Label lblClassID
AutoSize = -1 'True
Caption = "班次组合:"
Height = 195
Left = 2565
TabIndex = 5
Top = 855
Width = 900
End
Begin VB.Label lblWeekday
AutoSize = -1 'True
Caption = "星期:"
Height = 195
Left = 2565
TabIndex = 4
Top = 270
Width = 540
End
Begin VB.Label lblDate
AutoSize = -1 'True
Caption = "当前日期:"
Height = 195
Left = 450
TabIndex = 3
Top = 270
Width = 900
End
Begin VB.Label lblName
AutoSize = -1 'True
Caption = "会员名称:"
Height = 195
Left = 450
TabIndex = 2
Top = 555
Width = 900
End
Begin VB.Label lblCode
AutoSize = -1 'True
Caption = "会员卡号:"
Height = 180
Left = 2565
TabIndex = 1
Top = 555
Width = 900
End
End
Attribute VB_Name = "frmReport_D"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rstGrid As New ADODB.Recordset
Dim rstInTime As New ADODB.Recordset
Dim rstExec As New ADODB.Recordset
Private Sub Form_Load()
Me.Icon = MDI.Icon
Me.Caption = "明细查看"
rstGrid.Fields.Append "TimePos", adVarChar, 50
rstGrid.Fields.Append "OnTime", adVarChar, 20
rstGrid.Fields.Append "OffTime", adVarChar, 20
rstGrid.Fields.Append "InClass", adVarChar, 20
rstGrid.Fields.Append "State", adVarChar, 20
rstGrid.Open "", , adOpenStatic, adLockBatchOptimistic
Grid.AddHeader "序号", "Serial ", 40, -1, "Serial ", False, sSerial
Grid.AddHeader "时间段", "TimePos", 80, -1, "TimePos", False, sDefault
Grid.AddHeader "上班时间", "OnTime", 80, -1, "OnTime", False, sDefault
Grid.AddHeader "下班时间", "OffTime", 80, -1, "OffTime", False, sDefault
Grid.AddHeader "所属班次", "InClass", 80, -1, "InClass", False, sDefault
Grid.AddHeader "备注", "State", 80, -1, "State", False, sDefault
Grid.AllowAddNew = False
Grid.ColAutoResize = False
Grid.Reposition
Set Grid.DataSource = rstGrid
rstInTime.Fields.Append "刷卡记录", adVarChar, 20
rstInTime.Fields.Append "所属时段", adVarChar, 20
rstInTime.Fields.Append "迟到早退时间", adVarChar, 20
rstInTime.Fields.Append "状态", adVarChar, 20
rstInTime.Open "", , adOpenStatic, adLockBatchOptimistic
grdInTime.AddHeader "序号", "序号 ", 40, -1, "序号 ", False, sSerial
grdInTime.AddHeader "刷卡记录", "刷卡记录", 80, -1, "刷卡记录", False, sDefault
grdInTime.AddHeader "所属时段", "所属时段", 120, -1, "所属时段", False, sDefault
grdInTime.AddHeader "迟到早退时间", "迟到早退时间", 120, -1, "迟到早退时间", False, sDefault
grdInTime.AddHeader "状态", "状态", 80, -1, "状态", False, sDefault
grdInTime.DefSortCol = "刷卡记录"
grdInTime.Col("刷卡记录").SortDirection = sASC
grdInTime.ColAutoResize = False
grdInTime.AllowAddNew = False
grdInTime.Reposition
Set grdInTime.DataSource = rstInTime
End Sub
Public Sub ShowBill(sDate As String, sWeekday As String, sCode As String, sName As String, sLate As String, sAbsent As String)
On Error Resume Next
Dim i As Integer
Dim CardCount As Long
Dim sInDate As String
Dim sClassID As String
Dim lEmployeeID As Integer
GetEmployeeID sCode, lEmployeeID
sInDate = Mid(sDate, 1, 4) & Mid(sDate, 6, 2) & Mid(sDate, 9, 2)
GetSetClassID sCode, sInDate
CardCount = GetClassCount
Dim ClassIDCount As Long
Dim ClassIDIndex As Long
ClassIDCount = UBound(ClassIDInfo)
For ClassIDIndex = 1 To ClassIDCount
sClassID = sClassID & CStr(ClassIDInfo(ClassIDIndex).ClassID) & ","
Next
Dim lVacID As Long
Dim tmpClassCount As Long
Dim tmpClassIndex As Long
lVacID = GetEmployeeVac(sCode)
If CardCount <> 0 Then
tmpClassCount = UBound(tmpClassInfo)
For tmpClassIndex = 1 To tmpClassCount
rstGrid.AddNew
rstGrid.Fields("TimePos") = "时间段" & tmpClassIndex
rstGrid.Fields("OnTime") = GetTime(tmpClassInfo(tmpClassIndex).bTime)
rstGrid.Fields("OffTime") = GetTime(tmpClassInfo(tmpClassIndex).eTime)
rstGrid.Fields("InClass") = GetClassName(tmpClassInfo(tmpClassIndex).ClassID)
If tmpClassInfo(tmpClassIndex).AddClass = True Then
If GetYesNoLeave(lEmployeeID, tmpClassIndex * 2, sDate) = True Then
rstGrid.Fields("State") = "请假"
Else
rstGrid.Fields("State") = "加班"
End If
Else
If GetYesNoVac(lEmployeeID, tmpClassIndex * 2, lVacID, sDate) = True Then
rstGrid.Fields("State") = "休假"
Else
If GetYesNoLeave(lEmployeeID, tmpClassIndex * 2, sDate) = True Then
rstGrid.Fields("State") = "请假"
Else
rstGrid.Fields("State") = ""
End If
End If
End If
rstGrid.Update
Next
End If
Set Grid.DataSource = rstGrid
lblDate.Caption = "当前日期:" & sDate
lblWeekday.Caption = "星期" & sWeekday
lblCode.Caption = "员工卡号:" & sCode
lblName.Caption = "员工名称:" & sName
lblCardCount.Caption = "刷卡次数:" & CStr(CardCount)
lblLate.Caption = sLate
lblAbsent.Caption = sAbsent
sClassID = Left(sClassID, Len(sClassID) - 1)
If rstExec.State = 1 Then rstExec.Close
Set rstExec = Nothing
rstExec.CursorLocation = adUseClient
rstExec.Open "select ClassName from Class where ClassID in (" & sClassID & ")", con, adOpenStatic, adLockBatchOptimistic
sClassID = ""
If rstExec.RecordCount > 0 Then
rstExec.MoveFirst
While Not rstExec.EOF
sClassID = sClassID & rstExec.Fields("ClassName") & " "
rstExec.MoveNext
Wend
End If
lblClassID.Caption = "班次组合:" & sClassID
'===================================================================================
If rstExec.State = 1 Then rstExec.Close
Set rstExec = Nothing
rstExec.CursorLocation = adUseClient
rstExec.Open "select distinct InTime from InData where InDate='" & sInDate & "' and InCode ='" & sCode & "'", con, adOpenStatic, adLockBatchOptimistic
Dim sInTime As String
Dim lTimeState As Long
Dim lTimePos As Long
If rstExec.RecordCount > 0 Then
rstExec.MoveFirst
While Not rstExec.EOF
rstInTime.AddNew
' lTimePos = GetTimePos(rstExec.Fields("InTime"))
sInTime = Left(rstExec.Fields("InTime"), 2) & ":" & Right(rstExec.Fields("InTime"), 2)
lTimePos = FindVal(sInTime, CardCount)
rstInTime.Fields("刷卡记录") = sInTime
If lTimePos = 0 Then
rstInTime.Fields("所属时段") = ""
rstInTime.Fields("迟到早退时间") = ""
rstInTime.Fields("状态") = "无效"
Else
lTimeState = GetTimeState(rstExec.Fields("InTime"), lTimePos, Val(lblLate.Caption), Val(lblAbsent.Caption))
If lTimeState = 1 Then
If lTimePos Mod 2 = 1 Then
rstInTime.Fields("状态") = "迟到"
rstInTime.Fields("迟到早退时间") = "迟到" & CStr(g_LateTime) & "分钟"
ElseIf lTimePos Mod 2 = 0 Then
rstInTime.Fields("状态") = "早退"
rstInTime.Fields("迟到早退时间") = "早退" & CStr(Abs(g_LateTime)) & "分钟"
End If
ElseIf lTimeState = 2 Then
If lTimePos Mod 2 = 1 Then
rstInTime.Fields("状态") = "旷工"
rstInTime.Fields("迟到早退时间") = "迟到" & CStr(g_LateTime) & "分钟"
ElseIf lTimePos Mod 2 = 0 Then
rstInTime.Fields("状态") = "旷工"
rstInTime.Fields("迟到早退时间") = "早退" & CStr(Abs(g_LateTime)) & "分钟"
End If
End If
If lTimePos Mod 2 = 1 Then
lTimePos = (lTimePos + 1) / 2
rstInTime.Fields("所属时段") = "时间段" & CStr(lTimePos) & "<上班时间>"
ElseIf lTimePos Mod 2 = 0 Then
lTimePos = lTimePos / 2
rstInTime.Fields("所属时段") = "时间段" & CStr(lTimePos) & "<下班时间>"
End If
End If
' If g_LateTime >= 0 Then
' End If
rstInTime.Update
rstExec.MoveNext
Wend
End If
' grdInTime.Refresh
Set grdInTime.DataSource = rstInTime
End Sub
Private Function FindVal(sData As String, ByVal CardCount As Integer) As Long
' sData = Left(sData, 2) & ":" & Right(sData, 2)
FindVal = 0
If FindWindow("frmReport") = True Then
For i = 1 To CardCount
If Trim(frmReport.rstGrid.Fields("时间" & i)) = Trim(sData) Then
FindVal = i
Exit Function
End If
Next
End If
End Function
Private Function GetTime(ByVal sTime As String) As String
Dim a As Integer
Dim b As Integer
a = Int(Val(sTime) / 60)
b = Int(Val(sTime) Mod 60)
GetTime = Right("00" & a, 2) & ":" & Right("00" & b, 2)
End Function
Private Sub Form_Unload(Cancel As Integer)
If rstGrid.State = 1 Then rstGrid.Close
Set rstGrid = Nothing
If rstInTime.State = 1 Then rstInTime.Close
Set rstInTime = Nothing
If rstExec.State = 1 Then rstExec.Close
Set rstExec = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -