frmSetDate.frm
资源名称:考勤6.rar [点击查看]
上传用户:djzm888
上传日期:2013-02-15
资源大小:867k
文件大小:13k
源码类别:
其他数据库
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.1#0"; "COMCT232.OCX"
- Begin VB.Form frmSetDate
- BorderStyle = 3 'Fixed Dialog
- Caption = "设置考勤机时间"
- ClientHeight = 2550
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 4860
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Icon = "frmSetDate.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 2550
- ScaleWidth = 4860
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 '屏幕中心
- Begin VB.ComboBox cboPos
- Height = 330
- Left = 1755
- Style = 2 'Dropdown List
- TabIndex = 22
- Top = 180
- Width = 2745
- End
- Begin VB.CommandButton Command1
- Caption = "设置考勤机时间"
- Height = 450
- Index = 1
- Left = 2670
- TabIndex = 7
- Top = 1950
- Width = 1635
- End
- Begin VB.CommandButton Command1
- Caption = "获取考勤机时间"
- Height = 450
- Index = 0
- Left = 525
- TabIndex = 6
- Top = 1950
- Width = 1635
- End
- Begin ComCtl2.UpDown updDate
- Height = 345
- Index = 0
- Left = 1860
- TabIndex = 10
- TabStop = 0 'False
- Top = 713
- Width = 270
- _ExtentX = 476
- _ExtentY = 609
- _Version = 327681
- Value = 2000
- AutoBuddy = -1 'True
- BuddyControl = "txtDate(0)"
- BuddyDispid = 196610
- BuddyIndex = 0
- OrigLeft = 1770
- OrigTop = 338
- OrigRight = 2040
- OrigBottom = 653
- Max = 2099
- Min = 2000
- SyncBuddy = -1 'True
- BuddyProperty = 65547
- Enabled = -1 'True
- End
- Begin VB.TextBox txtDate
- Alignment = 2 'Center
- Height = 345
- Index = 0
- Left = 1305
- TabIndex = 0
- Top = 713
- Width = 555
- End
- Begin ComCtl2.UpDown updDate
- Height = 345
- Index = 1
- Left = 2970
- TabIndex = 12
- TabStop = 0 'False
- Top = 713
- Width = 270
- _ExtentX = 476
- _ExtentY = 609
- _Version = 327681
- Value = 1
- AutoBuddy = -1 'True
- BuddyControl = "txtDate(1)"
- BuddyDispid = 196610
- BuddyIndex = 1
- OrigLeft = 2970
- OrigTop = 338
- OrigRight = 3240
- OrigBottom = 653
- Max = 12
- Min = 1
- SyncBuddy = -1 'True
- BuddyProperty = 65547
- Enabled = -1 'True
- End
- Begin VB.TextBox txtDate
- Alignment = 2 'Center
- Height = 345
- Index = 1
- Left = 2520
- TabIndex = 1
- Top = 713
- Width = 465
- End
- Begin ComCtl2.UpDown updDate
- Height = 345
- Index = 2
- Left = 4020
- TabIndex = 14
- TabStop = 0 'False
- Top = 713
- Width = 270
- _ExtentX = 476
- _ExtentY = 609
- _Version = 327681
- Value = 1
- AutoBuddy = -1 'True
- BuddyControl = "txtDate(2)"
- BuddyDispid = 196610
- BuddyIndex = 2
- OrigLeft = 4110
- OrigTop = 345
- OrigRight = 4380
- OrigBottom = 660
- Max = 31
- Min = 1
- SyncBuddy = -1 'True
- BuddyProperty = 65547
- Enabled = -1 'True
- End
- Begin VB.TextBox txtDate
- Alignment = 2 'Center
- Height = 345
- Index = 2
- Left = 3570
- TabIndex = 2
- Top = 713
- Width = 465
- End
- Begin ComCtl2.UpDown updDate
- Height = 345
- Index = 3
- Left = 1860
- TabIndex = 16
- TabStop = 0 'False
- Top = 1260
- Width = 270
- _ExtentX = 476
- _ExtentY = 609
- _Version = 327681
- AutoBuddy = -1 'True
- BuddyControl = "txtDate(3)"
- BuddyDispid = 196610
- BuddyIndex = 3
- OrigLeft = 1770
- OrigTop = 1020
- OrigRight = 2040
- OrigBottom = 1335
- Max = 23
- SyncBuddy = -1 'True
- BuddyProperty = 65547
- Enabled = -1 'True
- End
- Begin ComCtl2.UpDown updDate
- Height = 345
- Index = 4
- Left = 2970
- TabIndex = 18
- TabStop = 0 'False
- Top = 1260
- Width = 270
- _ExtentX = 476
- _ExtentY = 609
- _Version = 327681
- AutoBuddy = -1 'True
- BuddyControl = "txtDate(4)"
- BuddyDispid = 196610
- BuddyIndex = 4
- OrigLeft = 2970
- OrigTop = 1020
- OrigRight = 3240
- OrigBottom = 1335
- Max = 59
- SyncBuddy = -1 'True
- BuddyProperty = 65547
- Enabled = -1 'True
- End
- Begin ComCtl2.UpDown updDate
- Height = 345
- Index = 5
- Left = 4020
- TabIndex = 20
- TabStop = 0 'False
- Top = 1245
- Width = 270
- _ExtentX = 476
- _ExtentY = 609
- _Version = 327681
- AutoBuddy = -1 'True
- BuddyControl = "txtDate(5)"
- BuddyDispid = 196610
- BuddyIndex = 5
- OrigLeft = 4110
- OrigTop = 1020
- OrigRight = 4380
- OrigBottom = 1335
- Max = 59
- SyncBuddy = -1 'True
- BuddyProperty = 65547
- Enabled = -1 'True
- End
- Begin VB.TextBox txtDate
- Alignment = 2 'Center
- Height = 345
- Index = 3
- Left = 1305
- TabIndex = 3
- Top = 1260
- Width = 555
- End
- Begin VB.TextBox txtDate
- Alignment = 2 'Center
- Height = 345
- Index = 4
- Left = 2520
- TabIndex = 4
- Top = 1260
- Width = 465
- End
- Begin VB.TextBox txtDate
- Alignment = 2 'Center
- Height = 345
- Index = 5
- Left = 3570
- TabIndex = 5
- Top = 1245
- Width = 465
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "请选择考勤机:"
- Height = 210
- Index = 8
- Left = 285
- TabIndex = 23
- Top = 240
- Width = 1365
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "秒"
- Height = 210
- Index = 7
- Left = 4380
- TabIndex = 21
- Top = 1320
- Width = 210
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "分"
- Height = 210
- Index = 6
- Left = 3315
- TabIndex = 19
- Top = 1320
- Width = 210
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "时"
- Height = 210
- Index = 5
- Left = 2235
- TabIndex = 17
- Top = 1320
- Width = 210
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "日"
- Height = 210
- Index = 4
- Left = 4380
- TabIndex = 15
- Top = 780
- Width = 210
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "月"
- Height = 210
- Index = 3
- Left = 3315
- TabIndex = 13
- Top = 780
- Width = 210
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "年"
- Height = 210
- Index = 2
- Left = 2235
- TabIndex = 11
- Top = 780
- Width = 210
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "当前时间:"
- Height = 210
- Index = 1
- Left = 270
- TabIndex = 9
- Top = 1320
- Width = 945
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "当前日期:"
- Height = 210
- Index = 0
- Left = 270
- TabIndex = 8
- Top = 780
- Width = 945
- End
- End
- Attribute VB_Name = "frmSetDate"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- '******txtDate
- Const mYear = 0
- Const mMonth = 1
- Const mDay = 2
- Const mHour = 3
- Const mMinute = 4
- Const mSecond = 5
- Const mMsg1 = "获取考勤机时间出错!"
- Const mMsg2 = "设置考勤机时间出错!"
- Const mMsg3 = "获取考勤机时间成功!"
- Dim mPosNumber As Integer
- Private Sub Command1_Click(Index As Integer)
- Dim strTime As String * 12
- Dim nRet As Integer
- Dim blnIsOpen As Boolean
- Dim intNumber As Integer
- getItemData cboPos, intNumber
- mPosNumber = intNumber
- If OpenComm(gCommPort) <> 0 Then
- MsgBox mstrOpenCommErr, vbInformation, gTitle
- GoTo GetSetErr
- End If
- blnIsOpen = True
- Select Case Index
- Case 0
- nRet = POS_GetTime(mPosNumber, strTime)
- If nRet <> 0 Then
- MsgBox mMsg1, vbInformation + vbOKOnly, gTitle
- GoTo GetSetErr
- Else
- txtDate(mYear) = Format("20" & Mid(strTime, 1, 2), "0000")
- txtDate(mMonth) = Format(Mid(strTime, 3, 2), "00")
- txtDate(mDay) = Format(Mid(strTime, 5, 2), "00")
- txtDate(mHour) = Format(Mid(strTime, 7, 2), "00")
- txtDate(mMinute) = Format(Mid(strTime, 9, 2), "00")
- txtDate(mSecond) = Format(Mid(strTime, 11, 2), "00")
- End If
- Case 1
- strTime = Format(Right(Trim(txtDate(mYear)), 2), "00") & _
- Format(txtDate(mMonth), "00") & _
- Format(txtDate(mDay), "00") & _
- Format(txtDate(mHour), "00") & _
- Format(txtDate(mMinute), "00") & _
- Format(txtDate(mSecond), "00")
- nRet = POS_SetTime(mPosNumber, strTime)
- If nRet <> 0 Then
- MsgBox mMsg2, vbInformation, gTitle
- GoTo GetSetErr
- Else
- MsgBox mMsg3, vbInformation, gTitle
- End If
- End Select
- CloseComm
- Exit Sub
- GetSetErr:
- If blnIsOpen Then
- CloseComm
- End If
- Exit Sub
- End Sub
- Private Sub Form_Load()
- GetPosToCbo cboPos
- txtDate(mYear) = Format(Year(Date), "0000")
- txtDate(mMonth) = Format(Month(Date), "00")
- txtDate(mDay) = Format(Day(Date), "00")
- txtDate(mHour) = Format(Hour(Time), "00")
- txtDate(mMinute) = Format(Minute(Time), "00")
- txtDate(mSecond) = Format(Second(Time), "00")
- End Sub
- Private Sub txtDate_GotFocus(Index As Integer)
- GotFocus txtDate(Index)
- End Sub
- Private Sub txtDate_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
- If KeyCode = 13 Then
- SendKeyTab KeyCode
- End If
- End Sub
- Private Sub txtDate_LostFocus(Index As Integer)
- If Index > 0 Then
- txtDate(Index) = Format(Trim(txtDate(Index)), "00")
- End If
- End Sub