#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <Date.au3>
$Form1 = GUICreate("Form1", 700, 603)
GUICtrlCreateLabel("月份:", 24, 27, 40, 17)
$Combo1 = GUICtrlCreateCombo("", 64, 24, 50, 25)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|11|12", "12")
GUICtrlCreateLabel("需排除的日期,英文逗号隔开:", 130, 27, 180, 17)
$Input = GUICtrlCreateInput("", 300, 24, 250, 20)
$Button = GUICtrlCreateButton("生成", 580, 22, 100, 27)
$ListView1 = GUICtrlCreateListView("", 24, 56, 660, 534, $LVS_REPORT, $LVS_EX_GRIDLINES)
_GUICtrlListView_AddColumn($ListView1, "日期", 40, 2)
_GUICtrlListView_AddColumn($ListView1, "星期", 50, 2)
_GUICtrlListView_AddColumn($ListView1, "上班时间一", 100, 2)
_GUICtrlListView_AddColumn($ListView1, "上班时间二", 100, 2)
_GUICtrlListView_AddColumn($ListView1, "上班时间三", 100, 2)
_GUICtrlListView_AddColumn($ListView1, "上班时间四", 100, 2)
$1 = "星期一"
$2 = "星期二"
$3 = "星期三"
$4 = "星期四"
$5 = "星期五"
$6 = "星期六"
$7 = "星期日"
$32 = "名一"
$33 = "名二"
$34 = "名三"
$35 = "名四"
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
$Input_Txt = GUICtrlRead($Input)
If $Input_Txt = "" Then
Local $eee[1] = [0]
Else
Local $eee = StringSplit($Input_Txt, ",")
EndIf
$iMonth = GUICtrlRead($Combo1)
$DayNum = _DateDaysInMonth(@YEAR, $iMonth)
Local $Array[1][5]
For $i = 1 To $DayNum
$Week = _DateToDayOfWeek(@YEAR, $iMonth, $i)
_GUICtrlListView_AddItem($ListView1, $i)
_GUICtrlListView_AddSubItem($ListView1, $i-1, Eval($Week), 1)
If $Week <> 6 And $Week <> 7 And _ArraySearch($eee, $i, 1) = -1 Then
ReDim $Array[UBound($Array)+1][5]
$var = UBound($Array)-1
For $n = 1 To 4
For $Num = 32 To 35
If _ArraySearch($Array, $Num, $var, $var) = -1 And _ArraySearch($Array, $Num, Abs($var-3), $var, "", "", "", $n) = -1 Then
$Array[$var][$n] = $Num
_GUICtrlListView_AddSubItem($ListView1, $i-1, Eval($Array[$var][$n]), $n+1)
ExitLoop
EndIf
Next
Next
EndIf
Next
EndSwitch
WEnd