$Form1 = GuiCreate('虹華加班簽核', 1100,600, -1, -1)
$ListView1 = GUICtrlCreateListView("日期|工號|姓名|部門|時間起|時間止|加班時數", 110, 3, 988,560)
;GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
_GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES,$LVS_EX_GRIDLINES))
GUICtrlSetBkColor($ListView1,0xFFBBFF)
GUICtrlSendMsg(-1, 0x101E, 0, 100) ;设置项目宽度
GUICtrlSendMsg(-1, 0x101E, 1, 100) ;设置项目宽度
GUICtrlSendMsg(-1, 0x101E, 2, 100) ;设置项目宽度
GUICtrlSendMsg(-1, 0x101E, 3, 100) ;设置项目宽度
GUICtrlSendMsg(-1, 0x101E, 4, 100) ;设置项目宽度
GUICtrlSendMsg(-1, 0x101E, 5, 100) ;设置项目宽度
GUICtrlSendMsg(-1, 0x101E, 6, 80) ;设置项目宽度
$Button1 = GUICtrlCreateButton('查詢', 30, 252, 60, 30)
$Button2 = GUICtrlCreateButton('簽核', 30, 292, 60, 30)
GUICtrlSetColor(-1,0xFF0000)
$Button3 = GUICtrlCreateButton("全選", 110, 565, 30, 30)
$Button4 = GUICtrlCreateButton("反選", 142, 565, 30, 30)
GuiSetState(@SW_SHOW)
; 顯示視窗
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$RS.open ("SELECT COUNT(*) FROM cqg_file Where cqg03=TODAY-1");
While (Not $RS.eof And Not $RS.bof);
$P=$RS.Fields(0).value
$RS.movenext;
WEnd;
$RS.close;
Dim $APP[$P][7]
$i=0
; $iTimer = TimerInit()
$RS.open ("SELECT cqg03,cqg02,cpf02,gem02,cqg08,cqg09,cqg10 FROM cqg_file,cpf_file,gem_file Where cqg03=TODAY-1 and cpf01=cqg02 and gem01=cqg15");
While (Not $RS.eof And Not $RS.bof);
$name3 = $RS.Fields(2).value
$dep = $RS.Fields(3).value
$date2 = $RS.Fields(0).value
;Local $c3 = StringLeft ( $str1,4 )&"/"&StringMid( $str1, 5,2 )&"/"&StringMid( $str1, 7,2 )&"-"&$time1
Local $c4 = StringLeft ( $date2,4 )&"-"&StringMid( $date2, 5,2 )&"-"&StringMid( $date2, 7,2 )
If @OSLang = '0804' Then
$name3 = _WinAPI_MultiByteToWideChar($name3, 950, $MB_COMPOSITE, False);转为繁体中文
$name3 = _WinAPI_WideCharToMultiByte($name3, 936);转为GBK繁体中文
$dep = _WinAPI_MultiByteToWideChar($dep, 950, $MB_COMPOSITE, False);转为繁体中文
$dep = _WinAPI_WideCharToMultiByte($dep, 936);转为GBK繁体中文
EndIf
; $APP[$i][0]=''
$APP[$i][0]=$c4
$APP[$i][1]=$RS.Fields(1).value
$APP[$i][2]=$name3
$APP[$i][3]=$dep
$APP[$i][4]=$RS.Fields(4).value
$APP[$i][5]=$RS.Fields(5).value
$APP[$i][6]=$RS.Fields(6).value
$i=$i+1
;GUICtrlSetState($SETDATA,$GUI_ENABLE)
$RS.movenext;
WEnd;
$RS.close;
_GUICtrlListView_AddArray($ListView1, $APP)
; MsgBox(4160, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")
Case $Button2
$check_box = MsgBox(4,"提示","是否將選中資料核准")
If $check_box = 6 Then
EndIf
Case $Button3
_GUICtrlListView_SetItemChecked($ListView1, -1)
Case $Button4
For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
If _GUICtrlListView_GetItemChecked($ListView1, $i) Then
_GUICtrlListView_SetItemChecked($ListView1, $i, False)
Else
_GUICtrlListView_SetItemChecked($ListView1, $i, True)
EndIf
Next
EndSwitch
WEnd
EndFunc