Dim wl, gq, xz, day As Long
Private Sub Command1_Click()
Dim aAs Long, day1, day2 As String
b = True
Text1.Text = ""
day1 = Text3.Text
day2 = Text4.Text
If day1 = "" Then Exit Sub
If day2 = "" Or Combo1.Text = "" Then MsgBox "请设定工作日": Exit Sub
a = DateDiff("d", day2, day1)
If a > 150 Then MsgBox "时间过长,请耐心等待"
If Combo1.Text = "夜班" Then
day2 = DateAdd("d", 1, day2)
ElseIf Combo1.Text = "休息1" Then
day2 = DateAdd("d", 2, day2)
ElseIf Combo1.Text = "休息2" Then
day2 = DateAdd("d", 3, day2)
End If
For i = 0 To a
Text1.Text = Text1.Text & DateAdd("D", i, Text4.Text)
a = DateDiff("d", Text4.Text, DateAdd("D", i, day2))
'a = DateDiff("d", Text4.Text, day)
a = a Mod 4
Select Case a
Case 0:Text1.Text = Text1.Text & ":早班" & vbCrLf
Case 1: Text1.Text = Text1.Text & ":夜班" & vbCrLf
Case Else: Text1.Text = Text1.Text & ":休息" & vbCrLf
End Select
Next i
End Sub
Private Sub Command2_Click()
Dim a As Long, day As String
day = Text2.Text
If Text4.Text = "" Or Combo1.Text = "" Then MsgBox "请设定工作日": Exit Sub
a = DateDiff("d", Text4.Text, day)
If Combo1.Text = "夜班" Then
a = a + 1
ElseIf Combo1.Text = "休息1" Then
a = a + 2
ElseIf Combo1.Text = "休息2" Then
a = a + 3
End If
a = a Mod 4
Select Case a
Case 0: Command2.Caption = "早班"
Case 1: Command2.Caption = "夜班"
Case Else: Command2.Caption = "休息"
End Select
End Sub
Private Sub Form_Load()
Dim a As String
Text1.Locked = True
Text4.Text = Date
Text3.Text = Date
Text2.Text = Date
Text1.Text = ""
Command1.Caption = "查询(&H)"
Command2.Caption = "查询(&H)"
Combo1.Text = "早班"
If Dir(App.Path & "\peizhi.ini") = "" Then
Open App.Path & "\peizhi.ini" For Output As #1: Close 1
Else
Open App.Path & "\peizhi.ini" For Input As #2
Do While Not EOF(2)
Line Input #2, a
If InStr(a, "[sylc]=") > 0 Then Text3.Text = Replace(a, "[sylc]=", "")
If InStr(a, "[gzr]=") > 0 Then Text4.Text = Replace(a, "[gzr]=", "")
If InStr(a, "[gzlc]=") > 0 Then Combo1.Text = Replace(a, "[gzlc]=", "")
Loop
End If
Close 2
Call Command1_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim a As String
If Text3.Text = "" Or Text4.Text = "" Then Exit Sub
a = "[sylc]=" & Text3.Text & vbCrLf & "[gzr]=" & Text4.Text & vbCrLf & "[gzlc]=" & Combo1.Text _
Open App.Path & "\peizhi.ini" For Output As #1
Print #1, a
Close 1
End Sub
Private Sub Text2_GotFocus()
Command2.Caption = "查询(&H)"
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call Command2_Click
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call Command1_Click
End Sub
谁能帮帮忙啊
|