📄 frmlistclass.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form FrmListClass
Caption = "班次显示"
ClientHeight = 5475
ClientLeft = 60
ClientTop = 345
ClientWidth = 6915
Icon = "FrmListClass.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5475
ScaleWidth = 6915
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "8"
BeginProperty Font
Name = "Marlett"
Size = 12
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3600
TabIndex = 3
Top = 240
Width = 615
End
Begin VB.CommandButton Command2
Caption = "7"
BeginProperty Font
Name = "Marlett"
Size = 12
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 2
Top = 240
Width = 735
End
Begin VB.CommandButton Command1
Caption = "3"
BeginProperty Font
Name = "Marlett"
Size = 12
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2280
TabIndex = 1
Top = 240
Width = 615
End
Begin MSComctlLib.ListView ListView1
Height = 4335
Left = 240
TabIndex = 0
Top = 840
Width = 6440
_ExtentX = 11351
_ExtentY = 7646
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 8
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "姓名"
Object.Width = 1411
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "星期天"
Object.Width = 1411
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "星期一"
Object.Width = 1411
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "星期二"
Object.Width = 1411
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 4
Text = "星期三"
Object.Width = 1411
EndProperty
BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 5
Text = "星期四"
Object.Width = 1411
EndProperty
BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 6
Text = "星期五"
Object.Width = 1411
EndProperty
BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 7
Text = "星期六"
Object.Width = 1411
EndProperty
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Label2"
Height = 180
Left = 4680
TabIndex = 5
Top = 360
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Left = 480
TabIndex = 4
Top = 360
Width = 540
End
End
Attribute VB_Name = "FrmListClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Basic_DB, Setup_DB As Database
Dim Basic_RS, Setup_RS As Recordset
Dim T_Type, T_Rest, T_x As Integer
Private Sub Command1_Click()
Label1.Caption = CDate(Label1.Caption) - 7
Label2.Caption = CDate(Label1.Caption) - 7
ListData
End Sub
Private Sub Command2_Click()
Label1.Caption = Date - Weekday(Now) + 1
Label2.Caption = Date - Weekday(Now) + 8
ListData
End Sub
Private Sub Command3_Click()
Label1.Caption = CDate(Label1.Caption) + 7
Label2.Caption = CDate(Label1.Caption) + 7
ListData
End Sub
Private Sub Form_Load()
Set Basic_DB = OpenDatabase(App.Path + "\Basic.mdb")
Set Basic_RS = Basic_DB.OpenRecordset("基本信息")
Basic_RS.MoveFirst
Set Setup_DB = OpenDatabase(App.Path + "\setup.mdb")
Set Setup_RS = Setup_DB.OpenRecordset("参数设定")
T_Type = Setup_RS.Fields(0)
Setup_RS.MoveFirst
If Setup_RS.Fields(14) = "-" Then
Setup_RS.Edit
Setup_RS.Fields(14) = Date
Setup_RS.Fields(15) = "1"
T_Rest = 1
Setup_RS.Update
Else
If Setup_RS.Fields(14) = Data Then
T_Rest = Setup_RS.Fields(15)
Else
T_Rest = (CInt(Setup_RS.Fields(15)) + DateDiff("y", CDate(Setup_RS.Fields(14)), Now)) Mod 4
Setup_RS.Edit
Setup_RS.Fields(14) = Date
Setup_RS.Fields(15) = CStr(T_Rest)
Setup_RS.Update
End If
End If
Label1.Caption = Date - Weekday(Now)
Label2.Caption = Date - Weekday(Now) + 7
ListData
End Sub
Private Sub Form_Unload(Cancel As Integer)
FrmMain.Show
End Sub
Private Sub ListData()
Basic_RS.MoveFirst
ListView1.ListItems.Clear
If T_Type = 1 Then
Do While Basic_RS.EOF = False
Set titem = ListView1.ListItems.Add(, , Basic_RS.Fields(2))
titem.SubItems(1) = "休息"
titem.SubItems(2) = "工作"
titem.SubItems(3) = "工作"
titem.SubItems(4) = "工作"
titem.SubItems(5) = "工作"
titem.SubItems(6) = "工作"
titem.SubItems(7) = "休息"
Basic_RS.MoveNext
Loop
Else
Dim Tword(4) As String
Tword(1) = "早班": Tword(2) = "中班": Tword(3) = "晚班": Tword(4) = "休息"
Do While Basic_RS.EOF = False
Set titem = ListView1.ListItems.Add(, , Basic_RS.Fields(2))
For X = 1 To 7
titem.SubItems(X) = Tword((T_Rest + (DateDiff("y", CDate(Label1.Caption) + X - 1, Now) Mod 4) + 8 + CInt(Basic_RS.Fields(13))) Mod 4 + 1)
Next X
Basic_RS.MoveNext
Loop
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -