?? frmmonth.frm
字號:
VERSION 5.00
Object = "{3EE95895-7935-11D5-B692-0050BA6549E8}#28.0#0"; "FLATCOM.OCX"
Object = "{D959C709-8613-11D1-9840-002078110E7D}#1.0#0"; "AS97POPUP.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{B02F3647-766B-11CE-AF28-C3A2FBE76A13}#2.5#0"; "SS32X25.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form FrmMonth
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 4335
ClientLeft = 0
ClientTop = 0
ClientWidth = 6360
LinkTopic = "Form1"
MinButton = 0 'False
ScaleHeight = 4335
ScaleWidth = 6360
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin FPSpread.vaSpread vaSpread1
Bindings = "FrmMonth.frx":0000
Height = 2415
Left = 240
OleObjectBlob = "FrmMonth.frx":0014
TabIndex = 1
Top = 840
Width = 5895
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 360
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 2040
TabIndex = 0
Top = 480
Width = 975
_ExtentX = 1720
_ExtentY = 450
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CalendarBackColor= -2147483634
CustomFormat = "MM"
Format = 24576003
CurrentDate = 37615
End
Begin FlatCom.MoveBar MoveBar1
Align = 1 'Align Top
Height = 270
Left = 0
Top = 0
Width = 6360
_ExtentX = 11218
_ExtentY = 476
BackColor = 16744576
ForeColor = 8438015
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Minimize = 0 'False
Caption = "考勤月報輸出"
End
Begin VB.Data Data3
Caption = "Data3"
Connect = "Access"
DatabaseName = "C:\WINDOWS\Desktop\射頻卡考勤軟件\公司員工考勤庫.mdb"
DefaultCursorType= 0 '缺省游標
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 4080
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "考勤記錄月表"
Top = 960
Width = 1455
End
Begin VB.Data Data2
Caption = "Data2"
Connect = "Access"
DatabaseName = "C:\WINDOWS\Desktop\射頻卡考勤軟件\公司員工考勤庫.mdb"
DefaultCursorType= 0 '缺省游標
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 2160
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "考勤記錄表_1"
Top = 960
Width = 1455
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "C:\WINDOWS\Desktop\射頻卡考勤軟件\公司員工考勤庫.mdb"
DefaultCursorType= 0 '缺省游標
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "員工信息表"
Top = 960
Width = 1575
End
Begin as97Popup.asPopup asPopup2
Height = 495
Left = 360
Top = 3600
Width = 735
_ExtentX = 1296
_ExtentY = 873
CustomPicture = "FrmMonth.frx":022F
MouseOverPicture= "FrmMonth.frx":0F09
MouseDownPicture= "FrmMonth.frx":1BE3
Caption = ""
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
UseFrame = 0 'False
ScaleWidth = 49
ScaleMode = 0
ScaleHeight = 33
BackStyle = 0
End
Begin as97Popup.asPopup asPopup3
Height = 615
Left = 5280
Top = 3480
Width = 735
_ExtentX = 1296
_ExtentY = 1085
CustomPicture = "FrmMonth.frx":28BD
MouseOverPicture= "FrmMonth.frx":3597
MouseDownPicture= "FrmMonth.frx":38B1
Caption = ""
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
UseFrame = 0 'False
ScaleWidth = 49
ScaleMode = 0
BackStyle = 0
End
Begin as97Popup.asPopup asPopup1
Height = 495
Left = 2040
Top = 3600
Width = 615
_ExtentX = 1085
_ExtentY = 873
CustomPicture = "FrmMonth.frx":458B
MouseOverPicture= "FrmMonth.frx":5265
MouseDownPicture= "FrmMonth.frx":5F3F
Caption = ""
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
UseFrame = 0 'False
ScaleWidth = 41
ScaleMode = 0
ScaleHeight = 33
BackStyle = 0
End
Begin as97Popup.asPopup asPopup4
Height = 615
Left = 3600
ToolTipText = "校驗設備"
Top = 3480
Width = 735
_ExtentX = 1296
_ExtentY = 1085
CustomPicture = "FrmMonth.frx":6C19
MouseOverPicture= "FrmMonth.frx":74F3
MouseDownPicture= "FrmMonth.frx":7DCD
Caption = ""
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = 65535
BackColor = 14737632
MaskColor = 14737632
UseFrame = 0 'False
MouseOverColor = 16776960
MouseDownColor = 255
ScaleWidth = 49
ScaleMode = 0
BackStyle = 0
Object.ToolTipText = "校驗設備"
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "選擇月份:"
ForeColor = &H00FF8080&
Height = 255
Left = 1080
TabIndex = 2
Top = 480
Width = 975
End
Begin VB.Shape Shape1
Height = 375
Left = 4800
Top = 360
Width = 495
End
End
Attribute VB_Name = "FrmMonth"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub asPopup1_Click(Cancel As Boolean)
On Error GoTo printer_err
CommonDialog1.ShowPrinter
printer_err:
If err.Number = 28663 Then
MsgBox "請先安裝打印機驅動程序!", , "提示"
Exit Sub
End If
DataReport2.Show
DataReport2.Sections(2).Controls("Label1").Caption = "考勤月份:" & CStr(Month(DTPicker1.Value))
DataReport2.Sections(2).Controls("Label34").Caption = "打印日期:" & CStr(Date)
End Sub
Private Sub asPopup2_Click(Cancel As Boolean)
Dim SQL As String
Dim MyStr1 As String
MyStr1 = CStr(Format(DTPicker1.Value, "MM"))
'SQL = "SELECT * FROM 考勤記錄表_1 WHERE 日期 BETWEEN " & MyStr1 & " AND " & MyStr2
SQL = "SELECT 姓名, 員工_ID, 考勤時間 ,日期 , month(日期) as 月份 ,備注 FROM 考勤記錄表_1 WHERE year(日期)= " + Str(Year(Date)) & " and " & " month(日期) = " + MyStr1 + " "
Data2.DatabaseName = App.Path & "\公司員工考勤庫.mdb"
Data2.RecordSource = SQL
Data2.Refresh
'*****************************
Dim YGName, KQ As String
Dim KQDate, MyNum, i As Integer
Dim Mydate As Date
Data1.Recordset.MoveLast
MyNum = Data1.Recordset.RecordCount '獲得員工總數
Data1.Recordset.MoveFirst
For i = 1 To MyNum
YGName = Data1.Recordset("姓名")
Data3.Recordset.AddNew '增加一天考勤記錄
Data3.Recordset("姓名") = YGName
Data2.Recordset.FindFirst "姓名 ='" & YGName & "'" '員工第一次考勤
If Data2.Recordset.NoMatch = True Then
MsgBox "月份選擇錯誤,請仔細核對.", 0, "提示"
Exit Sub
End If
Mydate = Data2.Recordset("日期")
KQDate = Day(Mydate)
KQ = CStr(KQDate)
Data3.Recordset(KQ) = Data2.Recordset("備注")
Dim Check, Counter
Check = True: Counter = 0 ' 設置變量初始值。
Do While coumter < 100 '第二次及以后考勤
Data2.Recordset.FindNext "姓名 ='" & YGName & "'"
If Data2.Recordset.NoMatch = True Then
Check = False
Exit Do
End If
Mydate = Data2.Recordset("日期")
KQDate = Day(Mydate)
KQ = CStr(KQDate)
Data3.Recordset(KQ) = Data2.Recordset("備注")
Loop
Data3.Recordset.Update
Data1.Recordset.MoveNext
Next i
asPopup2.Enabled = False
MsgBox "關閉窗體重新打開,表格內數據可見。"
End Sub
Private Sub asPopup3_Click(Cancel As Boolean)
Unload Me
End Sub
Private Sub asPopup4_Click(Cancel As Boolean)
On err GoTo DEL_err
If Data3.Recordset.BOF Or Data3.Recordset.EOF Then
MsgBox "沒有記錄"
Exit Sub
End If
Dim MyNum As Integer
If Not Data3.Recordset.BOF Or Data3.Recordset.EOF Then
Data3.Recordset.MoveLast
MyNum = Data3.Recordset.RecordCount
Data3.Recordset.MoveFirst
For i = 1 To MyNum
Data3.Recordset.Delete
Data3.Recordset.MoveNext
Next i
Else
MsgBox "沒有記錄"
End If
DEL_err:
If err.Number = 3021 Then
MsgBox "沒有記錄"
End If
End Sub
Private Sub Form_Load()
Me.BackColor = &H80000018
Me.BorderStyle = 0
Shape1.BorderWidth = 8
Shape1.BorderColor = &HFF8080
MoveBar1.BackColor = &HFF8080
MoveBar1.Align = 1
DTPicker1.Value = Date
Data1.DatabaseName = App.Path & "\公司員工考勤庫.mdb"
Data1.Visible = False
Data2.DatabaseName = App.Path & "\公司員工考勤庫.mdb"
Data2.Visible = False
Data3.DatabaseName = App.Path & "\公司員工考勤庫.mdb"
Data3.Visible = False
End Sub
Private Sub Form_Resize()
Shape1.Top = 270
Shape1.Left = 0
Shape1.Height = Me.Height - 270
Shape1.Width = Me.Width
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -