www.pudn.com > 考勤管理系统源码(VB含串口接口程序).zip > frmAddS.frm
VERSION 5.00
Object = "{FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.1#0"; "COMCT232.OCX"
Begin VB.Form frmAddS
BorderStyle = 3 'Fixed Dialog
Caption = "新增班次"
ClientHeight = 4965
ClientLeft = 45
ClientTop = 330
ClientWidth = 9180
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmAddS.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4965
ScaleWidth = 9180
StartUpPosition = 1 '所有者中心
Begin VB.TextBox txtShift
Height = 330
Index = 0
Left = 2865
MaxLength = 1
TabIndex = 0
Top = 4125
Width = 540
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 13
Left = 1980
TabIndex = 74
Top = 3090
Width = 390
End
Begin VB.Frame Frame1
Height = 105
Index = 1
Left = 360
TabIndex = 73
Top = 3585
Width = 8445
End
Begin VB.Frame Frame1
Height = 105
Index = 0
Left = 360
TabIndex = 72
Top = 555
Width = 8445
End
Begin VB.CommandButton Command1
Caption = "返回(&R)"
Height = 450
Index = 1
Left = 7665
TabIndex = 71
Top = 4080
Width = 1170
End
Begin VB.CommandButton Command1
Caption = "保存(&S)"
Enabled = 0 'False
Height = 450
Index = 0
Left = 6300
TabIndex = 70
Top = 4095
Width = 1170
End
Begin VB.ComboBox cboMethod
Height = 330
Index = 3
Left = 7725
Style = 2 'Dropdown List
TabIndex = 69
Top = 3090
Width = 1110
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 7
Left = 6555
TabIndex = 68
Top = 3150
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 15
Left = 5325
TabIndex = 63
Top = 3090
Width = 390
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 14
Left = 4365
TabIndex = 62
Top = 3090
Width = 390
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 6
Left = 3300
TabIndex = 61
Top = 3150
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 12
Left = 1020
TabIndex = 56
Top = 3090
Width = 390
End
Begin VB.ComboBox cboMethod
Height = 330
Index = 2
Left = 7725
Style = 2 'Dropdown List
TabIndex = 54
Top = 2340
Width = 1110
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 5
Left = 6555
TabIndex = 53
Top = 2400
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 11
Left = 5325
TabIndex = 48
Top = 2340
Width = 390
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 10
Left = 4365
TabIndex = 47
Top = 2340
Width = 390
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 4
Left = 3300
TabIndex = 46
Top = 2400
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 9
Left = 1980
TabIndex = 41
Top = 2340
Width = 390
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 8
Left = 1020
TabIndex = 40
Top = 2340
Width = 390
End
Begin VB.ComboBox cboMethod
Height = 330
Index = 1
Left = 7725
Style = 2 'Dropdown List
TabIndex = 39
Top = 1605
Width = 1110
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 3
Left = 6555
TabIndex = 38
Top = 1665
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 7
Left = 5325
TabIndex = 33
Top = 1605
Width = 390
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 6
Left = 4365
TabIndex = 32
Top = 1605
Width = 390
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 2
Left = 3300
TabIndex = 31
Top = 1665
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 5
Left = 1980
TabIndex = 26
Top = 1605
Width = 390
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 4
Left = 1020
TabIndex = 25
Top = 1605
Width = 390
End
Begin VB.ComboBox cboMethod
Height = 330
Index = 0
Left = 7725
Style = 2 'Dropdown List
TabIndex = 24
Top = 855
Width = 1110
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 1
Left = 6555
TabIndex = 23
Top = 915
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 3
Left = 5325
TabIndex = 18
Top = 855
Width = 390
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 2
Left = 4365
TabIndex = 17
Top = 855
Width = 390
End
Begin VB.CheckBox chkDate
Caption = "考勤"
Height = 210
Index = 0
Left = 3300
TabIndex = 16
Top = 915
Width = 720
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 1
Left = 1980
TabIndex = 13
Top = 855
Width = 390
End
Begin VB.TextBox txtDate
Alignment = 2 'Center
Height = 330
Index = 0
Left = 1020
TabIndex = 12
Top = 855
Width = 390
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 0
Left = 1425
TabIndex = 10
TabStop = 0 'False
Top = 855
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 8
BuddyControl = "txtDate(0)"
BuddyDispid = 196610
BuddyIndex = 0
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 1
Left = 2370
TabIndex = 11
TabStop = 0 'False
Top = 855
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(1)"
BuddyDispid = 196610
BuddyIndex = 1
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 2
Left = 4755
TabIndex = 19
TabStop = 0 'False
Top = 855
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 11
BuddyControl = "txtDate(2)"
BuddyDispid = 196610
BuddyIndex = 2
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 3
Left = 5715
TabIndex = 20
TabStop = 0 'False
Top = 855
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 30
BuddyControl = "txtDate(3)"
BuddyDispid = 196610
BuddyIndex = 3
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 4
Left = 1425
TabIndex = 27
TabStop = 0 'False
Top = 1605
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 13
BuddyControl = "txtDate(4)"
BuddyDispid = 196610
BuddyIndex = 4
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 5
Left = 2370
TabIndex = 28
TabStop = 0 'False
Top = 1605
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(5)"
BuddyDispid = 196610
BuddyIndex = 5
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 6
Left = 4755
TabIndex = 34
TabStop = 0 'False
Top = 1605
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 17
BuddyControl = "txtDate(6)"
BuddyDispid = 196610
BuddyIndex = 6
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 7
Left = 5715
TabIndex = 35
TabStop = 0 'False
Top = 1605
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(7)"
BuddyDispid = 196610
BuddyIndex = 7
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 8
Left = 1425
TabIndex = 42
TabStop = 0 'False
Top = 2340
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 18
BuddyControl = "txtDate(8)"
BuddyDispid = 196610
BuddyIndex = 8
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 9
Left = 2370
TabIndex = 43
TabStop = 0 'False
Top = 2340
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(9)"
BuddyDispid = 196610
BuddyIndex = 9
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 10
Left = 4755
TabIndex = 49
TabStop = 0 'False
Top = 2340
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 23
BuddyControl = "txtDate(10)"
BuddyDispid = 196610
BuddyIndex = 10
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 11
Left = 5715
TabIndex = 50
TabStop = 0 'False
Top = 2340
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(11)"
BuddyDispid = 196610
BuddyIndex = 11
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 12
Left = 1425
TabIndex = 57
TabStop = 0 'False
Top = 3090
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(12)"
BuddyDispid = 196610
BuddyIndex = 12
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 13
Left = 2370
TabIndex = 58
TabStop = 0 'False
Top = 3090
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(13)"
BuddyDispid = 196610
BuddyIndex = 13
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 14
Left = 4755
TabIndex = 64
TabStop = 0 'False
Top = 3090
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
Value = 6
BuddyControl = "txtDate(14)"
BuddyDispid = 196610
BuddyIndex = 14
OrigLeft = 1305
OrigTop = 780
OrigRight = 1575
OrigBottom = 1050
Max = 23
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin ComCtl2.UpDown updDate
Height = 330
Index = 15
Left = 5715
TabIndex = 65
TabStop = 0 'False
Top = 3090
Width = 270
_ExtentX = 476
_ExtentY = 582
_Version = 327681
BuddyControl = "txtDate(15)"
BuddyDispid = 196610
BuddyIndex = 15
OrigLeft = 2190
OrigTop = 780
OrigRight = 2460
OrigBottom = 1050
Max = 59
SyncBuddy = -1 'True
Wrap = -1 'True
BuddyProperty = 65547
Enabled = -1 'True
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "班次名称:"
Height = 210
Index = 0
Left = 1845
TabIndex = 75
Top = 4185
Width = 945
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 25
Left = 5985
TabIndex = 67
Top = 3150
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 24
Left = 5070
TabIndex = 66
Top = 3150
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 23
Left = 2670
TabIndex = 60
Top = 3150
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 22
Left = 1740
TabIndex = 59
Top = 3150
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "D段"
ForeColor = &H00C00000&
Height = 210
Index = 9
Left = 375
TabIndex = 55
Top = 3150
Width = 315
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 21
Left = 5985
TabIndex = 52
Top = 2400
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 20
Left = 5070
TabIndex = 51
Top = 2400
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 19
Left = 2670
TabIndex = 45
Top = 2400
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 18
Left = 1740
TabIndex = 44
Top = 2400
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 17
Left = 5985
TabIndex = 37
Top = 1665
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 16
Left = 5070
TabIndex = 36
Top = 1665
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 15
Left = 2670
TabIndex = 30
Top = 1665
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 14
Left = 1740
TabIndex = 29
Top = 1665
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 13
Left = 5985
TabIndex = 22
Top = 915
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 12
Left = 5070
TabIndex = 21
Top = 915
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "时"
Height = 210
Index = 11
Left = 1740
TabIndex = 15
Top = 915
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "分"
Height = 210
Index = 10
Left = 2670
TabIndex = 14
Top = 915
Width = 210
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "C段"
ForeColor = &H00C00000&
Height = 210
Index = 8
Left = 375
TabIndex = 9
Top = 2400
Width = 315
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "B段"
ForeColor = &H00C00000&
Height = 210
Index = 7
Left = 375
TabIndex = 8
Top = 1665
Width = 315
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "A段"
ForeColor = &H00C00000&
Height = 210
Index = 6
Left = 375
TabIndex = 7
Top = 915
Width = 315
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "考勤方式"
ForeColor = &H00C00000&
Height = 210
Index = 5
Left = 7815
TabIndex = 6
Top = 285
Width = 840
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "考勤与否"
ForeColor = &H00C00000&
Height = 210
Index = 4
Left = 6420
TabIndex = 5
Top = 285
Width = 840
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "下班时间"
ForeColor = &H00C00000&
Height = 210
Index = 3
Left = 4755
TabIndex = 4
Top = 285
Width = 840
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "考勤与否"
ForeColor = &H00C00000&
Height = 210
Index = 2
Left = 3195
TabIndex = 3
Top = 285
Width = 840
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "上班时间"
ForeColor = &H00C00000&
Height = 210
Index = 1
Left = 1470
TabIndex = 2
Top = 285
Width = 840
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "段号"
ForeColor = &H00C00000&
Height = 210
Index = 0
Left = 375
TabIndex = 1
Top = 285
Width = 420
End
End
Attribute VB_Name = "frmAddS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const mStandard = "标准"
Const mAdd = "加班"
'Const mIntStandard = 0
'Const mIntAdd = 1
Const mMsg1 = "班次名称不能为空!请输入."
Const mMsg2 = "上班时间不能大于或等于下班时间"
Const mMsg3 = "时间段之间不能有交叉,请您仔细检查一下!"
Const mMsg4 = "该班次名称已经存在,请您换个名称!"
Const mMsg5 = "数据保存未成功,请您检查一下有关数据后再试!"
Const mMsg6 = "恭喜您,数据保存成功!"
Const mMsg7 = "上下班时间要求同时为空或同时不为空"
Const mMsg8 = "因该时间段没有要求考勤,所以不能选考勤方式."
Const mMsg9 = "班次不能超过30个,保存未成功."
Public mShiftID As Integer
Public mIsModify As Boolean
Private Sub cboMethod_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
SendKeyTab KeyCode
End If
End Sub
Private Sub cboMethod_LostFocus(Index As Integer)
Dim Int1 As Integer
Dim Int2 As Integer
Int1 = Index * 2
Int2 = Int1 + 1
If (chkDate(Int1).Value = 0) And (chkDate(Int2).Value = 0) Then
If Trim(cboMethod(Index).Text) <> Empty Then
MsgBox mMsg8, vbInformation, gTitle
cboMethod(Index).ListIndex = -1
End If
End If
End Sub
Private Sub chkDate_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
SendKeyTab KeyCode
End If
End Sub
Private Sub Command1_Click(Index As Integer)
With frmShift
.mIsToRefresh = False
Select Case Index
Case 0
If CheckData Then
SaveData
.mIsToRefresh = True
Unload Me
End If
Case 1
Unload Me
End Select
End With
End Sub
Private Function SaveData() As Boolean
Dim Rst As Recordset
Dim ShiftCount As Integer
Set Rst = gDataBase.OpenRecordset("Shift")
Rst.MoveLast
Rst.MoveFirst
ShiftCount = Rst.RecordCount
If ShiftCount > 30 Then
MsgBox mMsg9, vbInformation, gTitle
Rst.Close
Set Rst = Nothing
SaveData = False
Exit Function
End If
Rst.Close
Set Rst = Nothing
Dim ShiftName As String
Dim OneOn As String
Dim OneOnIsKq As Integer
Dim OneOff As String
Dim OneOffIsKq As Integer
Dim OneIsAdd As Integer
Dim TwoOn As String
Dim TwoOnIsKq As Integer
Dim TwoOff As String
Dim TwoOffIsKq As Integer
Dim TwoIsAdd As Integer
Dim ThreeOn As String
Dim ThreeOnIsKq As Integer
Dim ThreeOff As String
Dim ThreeOffIsKq As Integer
Dim ThreeIsAdd As Integer
Dim FourOn As String
Dim FourOnIsKq As Integer
Dim FourOff As String
Dim FourOffIsKq As Integer
Dim FourIsAdd As Integer
ShiftName = Trim(txtShift(0))
OneOn = IIf(Trim(txtDate(0)) = Empty, " ", _
Format(Val(Trim(txtDate(0))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(1)) = Empty), _
"0", Trim(txtDate(1)))), "00"))
OneOff = IIf(Trim(txtDate(2)) = Empty, " ", _
Format(Val(Trim(txtDate(2))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(3)) = Empty), _
"0", Trim(txtDate(3)))), "00"))
OneOnIsKq = IIf((chkDate(0).Value = 1), -1, 0)
OneOffIsKq = IIf((chkDate(1).Value = 1), -1, 0)
OneIsAdd = IIf((cboMethod(0).Text = mAdd), -1, 0)
TwoOn = IIf(Trim(txtDate(4)) = Empty, " ", _
Format(Val(Trim(txtDate(4))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(5)) = Empty), _
"0", Trim(txtDate(5)))), "00"))
TwoOff = IIf(Trim(txtDate(6)) = Empty, " ", _
Format(Val(Trim(txtDate(6))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(7)) = Empty), _
"0", Trim(txtDate(7)))), "00"))
TwoOnIsKq = IIf((chkDate(2).Value = 1), -1, 0)
TwoOffIsKq = IIf((chkDate(3).Value = 1), -1, 0)
TwoIsAdd = IIf((cboMethod(1).Text = mAdd), -1, 0)
ThreeOn = IIf(Trim(txtDate(8)) = Empty, " ", _
Format(Val(Trim(txtDate(8))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(9)) = Empty), _
"0", Trim(txtDate(9)))), "00"))
ThreeOff = IIf(Trim(txtDate(10)) = Empty, " ", _
Format(Val(Trim(txtDate(10))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(11)) = Empty), _
"0", Trim(txtDate(11)))), "00"))
ThreeOnIsKq = IIf((chkDate(4).Value = 1), -1, 0)
ThreeOffIsKq = IIf((chkDate(5).Value = 1), -1, 0)
ThreeIsAdd = IIf((cboMethod(2).Text = mAdd), -1, 0)
FourOn = IIf(Trim(txtDate(12)) = Empty, " ", _
Format(Val(Trim(txtDate(12))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(13)) = Empty), _
"0", Trim(txtDate(13)))), "00"))
FourOff = IIf(Trim(txtDate(14)) = Empty, " ", _
Format(Val(Trim(txtDate(14))), "00") & ":" _
& Format(Val(IIf((Trim(txtDate(15)) = Empty), _
"0", Trim(txtDate(15)))), "00"))
FourOnIsKq = IIf((chkDate(6).Value = 1), -1, 0)
FourOffIsKq = IIf((chkDate(7).Value = 1), -1, 0)
FourIsAdd = IIf((cboMethod(3).Text = mAdd), -1, 0)
Dim Sql As String
Dim ShiftID As Byte
If Not mIsModify Then
Sql = "select top 1 ID from Shift order by ID DESC"
Set Rst = gDataBase.OpenRecordset(Sql, dbOpenSnapshot)
If Rst.RecordCount > 0 Then
ShiftID = Trim(Rst!ID) + 1
Else
ShiftID = UBound(aInnerShift) + 1
End If
Rst.Close
Set Rst = Nothing
Sql = "Insert into Shift (ID,ShiftName," _
& "F_1On,F_1OnIsKq,F_1Off,F_1OffIsKq,F_1IsAdd," _
& "F_2On,F_2OnIsKq,F_2Off,F_2OffIsKq,F_2IsAdd," _
& "F_3On,F_3OnIsKq,F_3Off,F_3OffIsKq,F_3IsAdd," _
& "F_4On,F_4OnIsKq,F_4Off,F_4OffIsKq,F_4IsAdd)" _
& " values(" & ShiftID & ",'" & ShiftName & "','" _
& OneOn & "'," & OneOnIsKq & ",'" _
& OneOff & "'," & OneOffIsKq & "," & OneIsAdd & ",'" _
& TwoOn & "'," & TwoOnIsKq & ",'" & TwoOff & "'," _
& TwoOffIsKq & "," & TwoIsAdd & ",'" _
& ThreeOn & "'," & ThreeOnIsKq & ",'" _
& ThreeOff & "'," & ThreeOffIsKq & "," & ThreeIsAdd & ",'" _
& FourOn & "'," & FourOnIsKq & ",'" _
& FourOff & "'," & FourOffIsKq & "," & FourIsAdd & ")"
Else
'ShiftID = mShiftID
Sql = "Update Shift set ShiftName='" & ShiftName & "'" & _
",F_1On='" & OneOn & "',F_1OnIsKq=" & OneOnIsKq & _
",F_1Off='" & OneOff & "',F_1OffIsKq=" & OneOffIsKq & _
",F_1IsAdd=" & OneIsAdd & _
",F_2On='" & TwoOn & "',F_2OnIsKq=" & TwoOnIsKq & _
",F_2Off='" & TwoOff & "',F_2OffIsKq=" & TwoOffIsKq & _
",F_2IsAdd=" & TwoIsAdd & _
",F_3On='" & ThreeOn & "',F_3OnIsKq=" & ThreeOnIsKq & _
",F_3Off='" & ThreeOff & "',F_3OffIsKq=" & ThreeOffIsKq & _
",F_3IsAdd=" & ThreeIsAdd & _
",F_4On='" & FourOn & "',F_4OnIsKq=" & FourOnIsKq & _
",F_4Off='" & FourOff & "',F_4OffIsKq=" & FourOffIsKq & _
",F_4IsAdd=" & FourIsAdd & _
" where ID=" & mShiftID
End If
gDataBase.Execute Sql
If gDataBase.RecordsAffected = 0 Then
MsgBox mMsg5, vbInformation, gTitle
SaveData = False
Exit Function
End If
SaveData = True
MsgBox mMsg6, vbInformation, gTitle
End Function
Private Function CheckData() As Boolean
If Trim(txtShift(0)) = Empty Then
MsgBox mMsg1, vbInformation, gTitle
CheckData = False
txtShift(0).SetFocus
Exit Function
End If
Dim StartI As Integer
Dim I As Integer
Dim Str1 As String
Dim Str2 As String
Dim Str3 As String
Dim Str4 As String
For I = 0 To 3
StartI = I * 4
Str1 = Format(Trim(txtDate(StartI + 2)), "00")
Str2 = Format(Trim(txtDate(StartI + 3)), "00")
Str3 = Format(Trim(txtDate(StartI + 0)), "00")
Str4 = Format(Trim(txtDate(StartI + 1)), "00")
If ((Str1 & Str2 <> Empty) And (Str3 & Str4 = Empty)) _
Or ((Str1 & Str2 = Empty) And (Str3 & Str4 <> Empty)) Then
MsgBox mMsg7, vbInformation, gTitle
CheckData = False
txtDate(StartI).SetFocus
Exit Function
End If
If Str1 & Str2 < Str3 & Str4 Then
MsgBox mMsg2, vbInformation, gTitle
CheckData = False
txtDate(StartI).SetFocus
Exit Function
End If
Next
For I = 1 To 3
StartI = I * 4
If (Trim(txtDate(StartI + 0)) & Trim(txtDate(StartI + 1))) _
>= (Trim(txtDate(0)) & Trim(txtDate(1))) _
And (Trim(txtDate(StartI + 0)) & Trim(txtDate(StartI + 1))) _
<= (Trim(txtDate(2)) & Trim(txtDate(3))) Then
MsgBox mMsg3, vbInformation, gTitle
CheckData = False
txtDate(StartI).SetFocus
Exit Function
End If
Next
' For I = 0 To 3
'
' Next
If Not mIsModify Then
Dim Rst As Recordset
Set Rst = gDataBase.OpenRecordset("select * from Shift " _
& " Where ShiftName='" & Trim(txtShift(0)) & "'", dbOpenSnapshot)
If Rst.RecordCount > 0 Then
MsgBox mMsg4, vbInformation, gTitle
CheckData = False
Rst.Close
Set Rst = Nothing
Exit Function
End If
Rst.Close
Set Rst = Nothing
End If
CheckData = True
End Function
Private Sub Form_Load()
Dim I As Integer
For I = 0 To cboMethod.Count - 1
With cboMethod(I)
.Clear
.AddItem mStandard
' .ItemData(.NewIndex) = mIntStandard
.AddItem mAdd
' .ItemData(.NewIndex) = mIntAdd
' .ListIndex = 0
End With
Next
' For i = 0 To txtDate.Count - 1
' Select Case i Mod 4
' Case 0
' txtDate(i) = 8
' Case 1
' txtDate(i) = 0
' Case 2
' txtDate(i) = 11
' Case 3
' txtDate(i) = 30
' End Select
' Next
End Sub
Private Sub txtDate_Change(Index As Integer)
Dim I As Integer
Dim isToSave As Boolean
For I = 0 To txtDate.Count - 1
If Trim(txtDate(I)) <> Empty Then
isToSave = True
Exit For
End If
Next
Command1(0).Enabled = isToSave
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 Sub
Private Sub txtDate_LostFocus(Index As Integer)
Dim isToCheck As Boolean
isToCheck = True
If Val(txtDate(Index)) < 0 Then
txtDate(Index) = 0
isToCheck = False
End If
If isToCheck Then
Select Case (Index Mod 2)
Case 0
If Val(txtDate(Index)) > 23 Then txtDate(Index) = 23
Case 1
If Val(txtDate(Index)) > 59 Then txtDate(Index) = 59
End Select
End If
End Sub
Private Sub txtShift_GotFocus(Index As Integer)
GotFocus txtShift(Index)
End Sub
Private Sub txtShift_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
SendKeyTab KeyCode
End If
End Sub
'Private Sub updDate_DownClick(Index As Integer)
' txtDate(Index) = updDate(Index).Value
'End Sub
'
'Private Sub updDate_UpClick(Index As Integer)
' txtDate(Index) = updDate(Index).Value
'End Sub
Private Sub txtShift_KeyPress(Index As Integer, KeyAscii As Integer)
KeyAscii = KeyFilter(KeyAscii, False)
End Sub