本帖最后由 Netfox 于 2009-12-31 10:42 编辑
我把代码贴上来哈,呵呵,其实我也没有那么多数据,也只有几百条,但是速度也跟不上`。。``有点郁闷。``。主要就是下面这个函数,当我刷新列表的时候,要它能很快的响应。现在的列表项目才200左右,响应时间都比较慢。Func _Setlist($listnum, $From);
Local $i
$i = 0
GUICtrlSendMsg($listnum, $LVM_DELETEALLITEMS, 0, 0)
GUICtrlSendMsg($listnum, $LVN_ODCACHEHINT, 0, 0)
$hImage = _GUIImageList_Create(32, 32, 5, 3) ;图标显示大小
_Conndb()
$RS.Open("Select * From box order by ID asc")
GUISetState(@SW_LOCK, $From)
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$title = $RS.Fields(1).value
$icon = $RS.Fields(2).value
$chk = $RS.fields(4).value
_GUICtrlListView_BeginUpdate($listnum)
_GUICtrlListView_InsertItem($listnum, $title, -1, $i)
_GUICtrlListView_EndUpdate($listnum)
If $chk = True Then
_GUIImageList_AddIcon($hImage, $icon, 1, True)
Else
_GUIImageList_AddIcon($hImage, $icon, 0, True)
EndIf
$i += 1
$RS.movenext
WEnd
_GUICtrlListView_SetImageList($listnum, $hImage, 0)
; _GUICtrlListView_Arrange ($listnum)
_Closedb()
GUISetState(@SW_UNLOCK, $From)
EndFunc ;==>_Setlist
请看代码,代码比较乱。
以下是窗体#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=Lib\main.ico
#AutoIt3Wrapper_Outfile=ManMoney.exe
#AutoIt3Wrapper_Res_Comment=亮点科技
#AutoIt3Wrapper_Res_Description=溜冰场记时收费系统
#AutoIt3Wrapper_Res_Fileversion=9.12.28.0
#AutoIt3Wrapper_Res_LegalCopyright=亮点科技
#AutoIt3Wrapper_Res_Field=Tel|88709303
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <Date.au3>
#Include <Array.au3>
#include <ListBoxConstants.au3>
#include<func.au3>
#include <ProgressConstants.au3>
#include<GuiEvent.au3>
Global $db_path,$conn,$rs,$T="*"
Global $ListView1, $ListView2, $text,$showxf,$HideZD,$spab,$spab1,$ysp,$xsp,$hsp1,$hsp2
Global $HideTitle,$HideXF,$Hidexftime,$Outin_form,$L1,$L2,$L3,$fr5_in1,$fr5_in2,$fr5_in3,$ID
Global $Form1,$Login_from,$Setsys_from,$pass_from,$jb_from,$newForm,$HspForm
Global $login,$numInput,$passInput,$userInput,$outin,$Button,$adduser,$modpass,$deluser
Global $input1,$fr6_l1,$fr6_l3,$ListView3,$fr5_bt1,$fr5_bt2,$Guest,$ZL,$SS,$credit,$account,$Dispense,$Cancel
Global $fr6_bt1,$fr6_in1,$fr6_in2,$fr6_bt2,$fr6_bt3,$fr6_bt4,$Date1,$Date2,$bt2,$fr4_Button1,$jcf
Global $jgsj,$fyfd,$fr4_Button2,$fr4_Button3,$fr4_Button4,$fr4_Button5,$fr4_Button6,$fr4_Button7,$fr4_Button8,$zf,$Radio1,$Radio2,$Radio3,$Radio4,$spa,$spb,$spb1
Global $Username,$Q,$S,$Z,$Money,$Manager,$Occupy,$count,$content,$ZD,$YLBD,$regbuy,$Hide_xj,$fr6_l5,$Hide_count,$HIde_jbsj,$fr6_l6,$Hide_yk,$Date3,$Date4,$fr6_list1
Global $Item,$startteime,$losttime,$online,$offline,$NONEAACTIVECOLOR,$Dll_,$YLList,$fr6_l2,$yjinput,$GkBt1,$GkBt2,$bt1
Global $newb1,$newb2,$userlist1,$newuserinput1, $newuserinput2, $newpassinput1, $newpassinput2 ,$BZEdit
Global $rescombo,$resb,$dirtemp[1],$Combo1,$kryjs,$hideZL,$zero,$Showsph,$Hidesph,$Gkkt,$Progress1
Global $timer, $Secs, $Mins, $Hour, $Time,$Pause=False ,$jfconn,$jfrs
$db_path = "HpData.mdb"
Opt("GUIOnEventMode", 1);GUIOnEventMode 启用/取消 OnEvent 函数 0 = (默认)取消/1 = 启用.
Opt("GUICloseOnESC", 0)
HotKeySet("{F4}", "check")
_MyProExists()
;绘制系统登录窗口 start
$Login_from = GUICreate("系统登录", 505, 223, -1, -1)
GUISetIcon(@ScriptDir & "\Lib\Login.ico")
GUISetBkColor(0xD2D2FF)
GUICtrlCreatePic(@ScriptDir & "\Lib\Login.jpg", 40, 24, 137, 113, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlCreateLabel("用户编号:", 200, 80, 64, 17)
GUICtrlCreateLabel("登录密码:", 200, 120, 64, 17)
GUICtrlCreateLabel("用户姓名:", 200, 40, 64, 17)
$line = GUICtrlCreateLabel("", 16, 152, 465, 2)
GUICtrlSetBkColor(-1, 0x808080)
$regbuy = GUICtrlCreateButton("已注册", 176, 176, 80, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$login = GUICtrlCreateButton("登 录", 264, 176, 80, 25)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$outin = GUICtrlCreateButton("退 出", 352, 176, 80, 25)
$userInput = GUICtrlCreateInput("", 264, 40, 217, 24, BitOR($ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_BORDER), 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$numInput = GUICtrlCreateInput("888", 264, 80, 217, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER, $WS_BORDER), 0)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetState($numInput, $GUI_FOCUS)
$passInput = GUICtrlCreateInput("", 264, 120, 217, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL, $WS_BORDER), 0)
GUISwitch($Login_from)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($regbuy, "Gui")
GUICtrlSetOnEvent($login, "Gui")
GUICtrlSetOnEvent($outin, "Gui")
GUICtrlSetOnEvent($numInput, "GUI")
;绘制系统登录窗口 end
loaduser()
;绘制主窗口 start
Local $aParts[3] = [600, 850, -1]
Dim $Button[12]
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)
$Title = "已授权:" & Get_From_title() & "使用 - 溜冰场记时收费管理系统";把获取到的标题赋值给变量$Title,供主窗口调用
$Form1 = GUICreate($Title, 1017, 783, -1, -1) ;主窗口开始
GUISetIcon(@ScriptDir & "\Lib\Main.ico")
$Pic1 = GUICtrlCreatePic(@ScriptDir & "\Lib\Banner.jpg", 0, 0, 1016, 150, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUICtrlCreateGroup("", 224, 208, 1, 553)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$L1 = GUICtrlCreateListView(" 当前顾客信息", 8, 208, 209, 217, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSCROLL))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 209)
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\0.dll", 110)
_GUICtrlListView_SetImageList($L1, $hImage, 1)
$o = ""
For $i = 1 To 5
GUICtrlCreateListViewItem("", $L1)
Next
GUICtrlCreateListViewItem(" 点击手牌获取信息", $L1)
$L2 = GUICtrlCreateListView(" 手牌总状态", 8, 432, 209, 165, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSCROLL))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 209)
SetL2()
$L3 = GUICtrlCreateListView(" 注册授权信息", 8, 603, 209, 150, BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSCROLL))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 209)
Regbox()
$ListView1 = GUICtrlCreateListView("", 232, 208, 777, 361)
GUICtrlSetBkColor($ListView1, 0x4773ae)
GUICtrlSetStyle(-1, BitOR($LVS_NOCOLUMNHEADER, $LVS_ICON, $LVS_SORTASCENDING, $LVS_SINGLESEL));删除$LVS_SINGLESEL风格即可全选
$menu1 = GUICtrlCreateContextMenu($ListView1)
$KT = GUICtrlCreateMenuItem("顾客开台", $menu1)
$JZ = GUICtrlCreateMenuItem("顾客结账", $menu1)
$separator2 = GUICtrlCreateMenuItem("", $menu1, 2)
$modify = GUICtrlCreateMenuItem("手牌更换", $menu1)
GUICtrlCreateLabel("", 0, 192, 1024, 1, $SS_SUNKEN)
$Button[0] = GUICtrlCreateButton("进 场", 8, 160, 105, 25, 0)
$Button[1] = GUICtrlCreateButton("出 场", 120, 160, 105, 25, 0)
$Button[2] = GUICtrlCreateButton("刷新数据", 600, 576, 100, 25, 0)
$Button[3] = GUICtrlCreateButton("显示占用", 704, 576, 100, 25, 0)
$Button[4] = GUICtrlCreateButton("显示空闲", 808, 576, 100, 25, 0)
$Button[5] = GUICtrlCreateButton("显示全部", 912, 576, 100, 25, 0)
$ListView2 = GUICtrlCreateListView(" 手牌号 | 消费单号 | 进场时间 | 已用时间 | 消费金额 | 记帐人", 232, 608, 777, 145,$iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($ListView2, $iExListViewStyle)
$Input1 = GUICtrlCreateInput("", 336, 576, 137, 21)
GUICtrlCreateLabel("快速通道:", 264, 576, 68, 20, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Button[6] = GUICtrlCreateButton("检 索", 496, 576, 100, 25, 0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$Button[7] = GUICtrlCreateButton("交接班", 232, 160, 105, 25, 0)
$Button[8] = GUICtrlCreateButton("营业员口令修改", 456, 160, 105, 25, 0)
$Button[9] = GUICtrlCreateButton("营业报表", 568, 160, 105, 25, 0)
$Button[10] = GUICtrlCreateButton("系统设置", 680, 160, 105, 25, 0)
$Button[11] = GUICtrlCreateButton("数据备份", 344, 160, 105, 25)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1, -1, "", $SBARS_TOOLTIPS)
_GUICtrlStatusBar_SetMinHeight($StatusBar1, 20)
_GUICtrlStatusBar_SetParts($StatusBar1, $aParts)
;$aParts = _GUICtrlStatusBar_GetParts($StatusBar1)
_GUICtrlStatusBar_SetText($StatusBar1, @TAB & @TAB & "绍兴亮点电脑科技提供技术支持 电话:88709303 手机:13735269568" & " ", 0)
;AdlibEnable("date", 1000)
AdlibRegister("date", 1000)
_GUICtrlStatusBar_SetText($StatusBar1, @TAB & @TAB & "本班收银员:" & man("man") & " ", 2)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
For $i = 0 To 11
GUICtrlSetOnEvent($Button[$i], "Gui")
Next
GUICtrlSetOnEvent($KT, "Gui")
GUICtrlSetOnEvent($JZ, "Gui")
GUICtrlSetOnEvent($modify, "Gui")
GUICtrlSetOnEvent($ListView2, "Gui")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
;_Setlist($ListView1, $Form1)
;绘制主窗口 end
;绘制交接班窗口 start
$jb_from = GUICreate("换班登录", 639, 522, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetIcon(@ScriptDir & "\Lib\Main.ico")
$fr6_T1 = GUICtrlCreateTab(8, 8, 625, 505)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$fr6_ts1 = GUICtrlCreateTabItem("交班操作")
GUICtrlCreateLabel("前班结余:", 224, 104, 69, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("现金收入:", 224, 144, 69, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("抹零金额:", 224, 184, 69, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("", 44, 264, 556, 4, $SS_SUNKEN)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0x000080)
$fr6_l1 = GUICtrlCreateLabel("交接员:", 180, 56, 350, 20, $SS_CENTER)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x0000FF)
$fr6_l2 = GUICtrlCreateLabel("0.00", 312, 104, 250, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_l3 = GUICtrlCreateLabel("0.00", 312, 144, 250, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_l4 = GUICtrlCreateLabel("0.00", 312, 184, 250, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("营业额总额:", 211, 224, 82, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_l5 = GUICtrlCreateLabel("0.00", 312, 224, 250, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateLabel("上交营业款:", 211, 304, 82, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_in1 = GUICtrlCreateInput("", 312, 296, 129, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("交班后余款:", 211, 344, 82, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_l6 = GUICtrlCreateLabel("0.00.", 312, 344, 250, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateGroup("", 104, 408, 449, 81)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_bt1 = GUICtrlCreateButton("确认交班", 136, 440, 105, 25)
$fr6_bt2 = GUICtrlCreateButton("打印报表", 272, 440, 105, 25)
$fr6_bt3 = GUICtrlCreateButton("取 消", 400, 440, 105, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateLabel("接班员工ID:", 209, 384, 84, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_in2 = GUICtrlCreateInput("", 312, 376, 129, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$fr6_ts2 = GUICtrlCreateTabItem("历史交班记录")
GUICtrlCreateLabel("查询日期:", 24, 56, 64, 17)
$Date3 = GUICtrlCreateDate(_NowCalcDate(), 88, 48, 85, 22, $WS_TABSTOP)
GUICtrlCreateLabel("至", 184, 56, 16, 17)
$Date4 = GUICtrlCreateDate(_NowCalcDate(), 208, 48, 85, 22, $WS_TABSTOP)
$fr6_bt4 = GUICtrlCreateButton("查询", 456, 48, 79, 25)
$fr6_bt5 = GUICtrlCreateButton("打印", 544, 48, 79, 25)
$fr6_List1 = GUICtrlCreateListView(" 交班时间 |交班人员|接班人员|交接金额|本班收款总额|上交金额", 16, 80, 609, 425)
GUICtrlCreateTabItem("")
$HIde_qb = GUICtrlCreateInput("", 0, 0, 129, 24)
_hidekj()
$Hide_xj = GUICtrlCreateInput("", 1, 1, 129, 24)
_hidekj()
$Hide_count = GUICtrlCreateInput("", 2, 2, 129, 24)
_hidekj()
$Hide_yk = GUICtrlCreateInput("", 3, 3, 129, 24)
_hidekj()
$HIde_jbsj = GUICtrlCreateInput("", 4, 4, 129, 24)
_hidekj()
GUICtrlCreateTabItem("")
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($fr6_bt1, "Gui")
GUICtrlSetOnEvent($fr6_bt2, "Gui")
GUICtrlSetOnEvent($fr6_bt3, "Gui")
GUICtrlSetOnEvent($fr6_bt4, "Gui")
GUICtrlSetOnEvent($fr6_bt5, "Gui")
GUICtrlSetOnEvent($fr6_in1, "Gui")
GUICtrlSetOnEvent($fr6_in2, "Gui")
;绘制交接班窗口 end
;绘制收银窗口 start
$Outin_form = GUICreate("收银结账", 521, 293, -1,-1)
GUISetIcon(@ScriptDir & "\Lib\main.ico")
GUICtrlCreateGroup("收银付款区", 8, 8, 353, 273)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlCreateLabel("结账单号:", 24, 48, 64, 17)
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("消费金额:", 24, 80, 64, 17)
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("押金金额:", 24, 144, 64, 17)
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("找零金额:", 24, 176, 64, 17)
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("实收金额:", 24, 208, 64, 17)
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("备注信息:", 24, 240, 64, 17)
GUICtrlSetColor(-1, 0x000000)
GUICtrlCreateLabel("客人支付:", 24, 112, 64, 17)
GUICtrlSetColor(-1, 0x000000)
$HideXF = GUICtrlCreateInput("", 0, 0, 0, 0)
GUICtrlSetState(-1, $GUI_HIDE)
$HideZD = GUICtrlCreateInput("", 1, 1, 0, 0)
GUICtrlSetState(-1, $GUI_HIDE)
$HideTitle = GUICtrlCreateInput("", 2, 2, 0, 0)
GUICtrlSetState(-1, $GUI_HIDE)
$Hidexftime = GUICtrlCreateInput("", 3, 3, 0, 0)
GUICtrlSetState(-1, $GUI_HIDE)
$Hidezl = GUICtrlCreateInput("", 4, 4, 0, 0)
GUICtrlSetState(-1, $GUI_HIDE)
$kryjs = GUICtrlCreateInput("", 5, 5, 0, 0)
GUICtrlSetState(-1, $GUI_HIDE)
$Guest = GUICtrlCreateInput("", 88, 104, 145, 25, $ES_NUMBER)
$Combo1 = GUICtrlCreateCombo("", 304, 104, 49, 28)
GUICtrlSetData(-1, "9|8|7|6|5|4|3|2|1|0", "0")
GUICtrlCreateLabel("折扣率:", 240, 112, 64, 24)
$ZD = GUICtrlCreateLabel("", 88, 48, 250, 24)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Showxf = GUICtrlCreateLabel("", 88, 80, 250, 24)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$ZL = GUICtrlCreateLabel("0.00", 88, 176, 265, 28)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$SS = GUICtrlCreateInput("0.00", 88, 200, 265, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
GUICtrlSetState(-1, $GUI_DISABLE)
$Zero = GUICtrlCreateInput("", 88, 136, 100, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
GUICtrlSetState(-1, $GUI_DISABLE)
$content = GUICtrlCreateInput("", 88, 232, 265, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$account = GUICtrlCreateButton("立即结账", 376, 72, 129, 41)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$credit = GUICtrlCreateButton("退单", 376, 128, 129, 41)
$Dispense = GUICtrlCreateButton("免单", 376, 184, 129, 41)
$Cancel = GUICtrlCreateButton("取消", 376, 240, 129, 41)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($account, "Gui")
GUICtrlSetOnEvent($credit, "Gui")
GUICtrlSetOnEvent($Dispense, "Gui")
GUICtrlSetOnEvent($Cancel, "Gui")
GUICtrlSetOnEvent($Zero, "Gui")
GUICtrlSetOnEvent($Guest, "Gui")
GUICtrlSetOnEvent($Combo1, "Gui")
;绘制收银窗口 end
;绘制口令更改窗口 start
$pass_from = GUICreate("口令更改-本班收银员", 360, 184, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS),-1,$Form1)
GUISetIcon(@ScriptDir & "\Lib\Main.ico")
GUICtrlCreateLabel("原密码:", 24, 40, 52, 17)
$fr5_in1 = GUICtrlCreateInput("", 80, 32, 137, 21, $ES_PASSWORD)
$fr5_l1 = GUICtrlCreateLabel("", 2, 80, 356, 2, $SS_SUNKEN)
GUICtrlSetColor(-1, 0x808000)
GUICtrlSetColor(-1, 0x808000)
GUICtrlCreateLabel("新密码:", 24, 112, 52, 17)
GUICtrlCreateLabel("确 认:", 24, 144, 52, 17)
$fr5_in2 = GUICtrlCreateInput("", 80, 104, 137, 21, $ES_PASSWORD)
$fr5_in3 = GUICtrlCreateInput("", 80, 136, 137, 21, $ES_PASSWORD)
$fr5_bt1 = GUICtrlCreateButton("保 存", 240, 104, 97, 25)
$fr5_bt2 = GUICtrlCreateButton("退 出", 240, 136, 97, 25)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($fr5_bt1, "Gui")
GUICtrlSetOnEvent($fr5_bt2, "Gui")
;绘制口令设置窗口 end
;绘制系统设置窗口 start
Func Setsys()
$Setsys_from = GUICreate("系统设置", 545, 296, -1, -1,-1,-1,$Form1)
GUISetIcon(@ScriptDir & "\Lib\Set.ico")
GUISetFont(9, 400, 0, "MS Sans Serif")
$Tab1 = GUICtrlCreateTab(8, 8, 529, 281)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("计费设置")
GUICtrlCreateLabel("进场费:", 112, 79, 56, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
GUICtrlCreateLabel("最小计费时间(分钟):", 32, 119, 139, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
GUICtrlCreateLabel("费用封顶:", 96, 159, 69, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$jcf = GUICtrlCreateInput("", 176, 79, 321, 21)
$jgsj = GUICtrlCreateInput("", 176, 119, 321, 21)
$fyfd = GUICtrlCreateInput("", 176, 159, 321, 21)
GUICtrlCreateGroup("", 24, 199, 497, 73)
$fr4_Button1 = GUICtrlCreateButton("保 存", 296, 223, 97, 33)
$fr4_Button2 = GUICtrlCreateButton("退 出", 408, 223, 97, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet2 = GUICtrlCreateTabItem("手牌设置")
GUICtrlCreateGroup("批量新增", 192, 168, 257, 105)
GUICtrlCreateLabel("手牌范围:", 200, 200, 69, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$spb = GUICtrlCreateInput("", 272, 192, 169, 21)
GUICtrlCreateLabel("到:", 232, 224, 30, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$spb1 = GUICtrlCreateInput("", 272, 216, 169, 21)
GUICtrlCreateLabel("标记字符:", 200, 248, 69, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
$zf = GUICtrlCreateInput("", 272, 240, 49, 21)
$Radio1 = GUICtrlCreateRadio("置前", 328, 248, 57, 17)
$Radio2 = GUICtrlCreateRadio("置后", 392, 248, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ListView3 = GUICtrlCreateListView("", 16, 40, 513, 113)
GUICtrlSetStyle($ListView3, $LVS_ICON)
$fr4_Button3 = GUICtrlCreateButton("单个新增", 456, 184, 73, 25)
$fr4_Button4 = GUICtrlCreateButton("批量新增", 456, 216, 73, 25)
$fr4_Button5 = GUICtrlCreateButton("删 除", 456, 248, 73, 25)
GUICtrlCreateGroup("单个新增", 16, 168, 169, 105)
$spa = GUICtrlCreateInput("", 32, 224, 137, 21)
GUICtrlCreateLabel("手牌号码:", 32, 200, 69, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000080)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TabSheet3 = GUICtrlCreateTabItem("数据管理")
$Group3 = GUICtrlCreateGroup("数据备份", 24, 48, 497, 81, $BS_CENTER)
$fr4_Button6 = GUICtrlCreateButton("数据备份", 40, 72, 465, 41)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("数据恢复", 24, 144, 497, 81, $BS_CENTER)
$resLabel1 = GUICtrlCreateLabel("请选择要恢复数据的时间:", 40, 180, 150, 20)
$rescombo = GUICtrlCreateCombo("", 186, 176, 320, 25)
Setcombo()
GUICtrlCreateGroup("", -99, -99, 1, 1)
$fr4_Button7 = GUICtrlCreateButton("恢 复", 344, 240, 81, 25)
$fr4_Button8 = GUICtrlCreateButton("取 消", 440, 240, 81, 25)
$TabSheet4 = GUICtrlCreateTabItem("用户管理")
$userlist1 = GUICtrlCreateListView(" 用户编号 | 用户姓名 | 密码 ", 16, 40, 385, 241)
ShowUser()
$adduser = GUICtrlCreateButton("新增用户", 424, 176, 89, 25)
$modpass = GUICtrlCreateButton("修改密码", 424, 216, 89, 25)
$deluser = GUICtrlCreateButton("删除用户", 424, 256, 89, 25)
GUICtrlCreateTabItem("")
GUISwitch($Setsys_from)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($fr4_Button1, "Gui")
GUICtrlSetOnEvent($fr4_Button2, "Gui")
GUICtrlSetOnEvent($fr4_Button3, "Gui")
GUICtrlSetOnEvent($fr4_Button4, "Gui")
GUICtrlSetOnEvent($fr4_Button5, "Gui")
GUICtrlSetOnEvent($fr4_Button6, "Gui")
GUICtrlSetOnEvent($fr4_Button7, "Gui")
GUICtrlSetOnEvent($fr4_Button8, "Gui")
GUICtrlSetOnEvent($adduser, "Gui")
GUICtrlSetOnEvent($modpass, "Gui")
GUICtrlSetOnEvent($deluser, "Gui")
EndFunc ;==>Setsys
Func NewUser()
$newForm = GUICreate("新建用户", 312, 233, -1, -1)
$newuserinput1 = GUICtrlCreateInput("", 136, 32, 121, 21, $ES_NUMBER)
$newuserinput2 = GUICtrlCreateInput("", 136, 72, 121, 21)
$newpassinput1 = GUICtrlCreateInput("", 136, 112, 121, 21, $ES_PASSWORD)
$newpassinput2 = GUICtrlCreateInput("", 136, 152, 121, 21, $ES_PASSWORD)
$newb1 = GUICtrlCreateButton("确认", 40, 192, 75, 25, 0)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$newb2 = GUICtrlCreateButton("取消", 192, 192, 75, 25, 0)
$newchangeLabel1 = GUICtrlCreateLabel("用户编码:", 51, 32, 85, 24)
GUICtrlSetFont(-1, 12, 400, 0, "宋体")
$newchangeLabel2 = GUICtrlCreateLabel("用户姓名:", 51, 72, 85, 24)
GUICtrlSetFont(-1, 12, 400, 0, "宋体")
$newchangeLabel3 = GUICtrlCreateLabel("输入密码:", 51, 112, 85, 24)
GUICtrlSetFont(-1, 12, 400, 0, "宋体")
$newchangeLabel4 = GUICtrlCreateLabel("确认密码:", 51, 152, 85, 24)
GUICtrlSetFont(-1, 12, 400, 0, "宋体")
GUISwitch($newForm)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($newb1, "Gui")
GUICtrlSetOnEvent($newb2, "Gui")
EndFunc ;==>NewUser
;绘制系统设置窗口 end
$YLBD = GUICreate("营业明细报表", 815, 574, 270, 130)
GUICtrlCreateLabel("营业明细报表", 16, 26, 106, 24)
GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif")
$Date1 = GUICtrlCreateDate(_NowCalcDate(), 224, 24, 85, 22, $WS_TABSTOP)
$Date2 = GUICtrlCreateDate(_NowCalcDate(), 352, 24, 85, 22, $WS_TABSTOP)
$Group1 = GUICtrlCreateGroup("", 8, 72, 113, 489)
GUICtrlSetResizing(-1, $GUI_DOCKAUTO)
$Radio1 = GUICtrlCreateRadio("已结账单", 24, 104, 89, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio2 = GUICtrlCreateRadio("未结账单", 24, 136, 81, 25)
$Radio3 = GUICtrlCreateRadio("退单账单", 24, 168, 81, 25)
$Radio4 = GUICtrlCreateRadio("免费账单", 24, 200, 89, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Bt1 = GUICtrlCreateButton("确 定", 608, 16, 89, 33)
$Bt2 = GUICtrlCreateButton("退 出", 712, 16, 89, 33)
$Label2 = GUICtrlCreateLabel("查询日期:", 152, 30, 64, 17)
$Label3 = GUICtrlCreateLabel("至:", 320, 30, 28, 17)
$Label4 = GUICtrlCreateLabel("", 0, 64, 813, 3, $SS_SUNKEN)
$YlList = GUICtrlCreateListView(" 手牌号 | 账单号 | 消费日期 | 消费金额 | 实收金额 | 收款人 | 备注信息", 128, 80, 673, 481)
_GUICtrlListView_SetUnicodeFormat($YlList, False)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($Bt1, "Gui")
GUICtrlSetOnEvent($Bt2, "Gui")
$Gkkt = GUICreate("顾客开台", 514, 296, -1,-1)
$Tab1 = GUICtrlCreateTab(-1, -1, 520, 261)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("")
$Group1 = GUICtrlCreateGroup("入场开单", 8, 8, 498, 236)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$sph = GUICtrlCreateLabel("手牌号码:", 24, 48, 69, 17)
$Hidesph = GUICtrlCreateInput("hidesph", 224, 48, 97, 21)
GUICtrlSetState(-1, $GUI_HIDE)
$yj = GUICtrlCreateLabel("押金金额:", 24, 80, 69, 17)
$Showsph = GUICtrlCreateLabel("", 96, 48, 100, 17)
$yjinput = GUICtrlCreateInput("50.00", 104, 80, 217, 21)
$bz = GUICtrlCreateLabel("备注信息:", 24, 120, 69, 17)
$BZEdit = GUICtrlCreateEdit("", 104, 120, 385, 105, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, "")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$GkBt1 = GUICtrlCreateButton("确 定", 312, 264, 90, 25)
$GkBt2 = GUICtrlCreateButton("取 消", 416, 264, 90, 25)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($GkBt1, "Gui")
GUICtrlSetOnEvent($GkBt2, "Gui")
GUICtrlSetOnEvent($yjinput, "Gui")
Func HspForm()
$HspForm = GUICreate("更换手牌", 299, 137, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), "", $Form1)
GUICtrlCreateLabel("原手牌:", 56, 32, 52, 17)
$ysp = GUICtrlCreateInput("", 112, 24, 129, 21, $ES_READONLY)
GUICtrlCreateLabel("更换为:", 56, 64, 52, 17)
$xsp = GUICtrlCreateInput("", 112, 56, 129, 21)
$hsp1 = GUICtrlCreateButton("&确定", 96, 96, 65, 25)
GUICtrlSetState(-1, $GUI_DEFBUTTON)
$hsp2 = GUICtrlCreateButton("&取消", 176, 96, 65, 25)
GUISwitch($HspForm)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "Gui")
GUICtrlSetOnEvent($hsp1, "Gui")
GUICtrlSetOnEvent($hsp2, "Gui")
EndFunc ;==>HspForm
While 1
If $Pause = True Then ExitLoop
Autojf()
_ReduceMemory(@AutoItPID)
Sleep(18000)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
EndSwitch
WEnd
以下是包含进来的 FUNC.AU3Func jf()
_GUICtrlListView_DeleteAllItems($ListView2)
$mw = ".00"
$jfconn = ObjCreate("ADODB.Connection")
If @error Then
MsgBox(48, "程序遇到严重错误", "不能与数据库创建连接,数据库引挚被破坏。")
Exit
Else
$jfconn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Jet OLEDB:Database Password=adminxpdnhp;Data Source=" & $db_path)
EndIf
$jfRS = ObjCreate("ADODB.Recordset")
$jfRS.ActiveConnection = $jfconn
$sql = "Select * From Content where chk=0"
$jfRS.Open($sql)
While Not $jfRS.eof And Not $jfRS.bof
If @error = 1 Then ExitLoop
$item = $jfRS.Fields(1).value
$dh = $jfRS.Fields(4).value
$starttime = $jfRS.Fields(5).value
$losttime = _DateDiff("n", $starttime, _NowCalc())
;====================收费价格调整部分开始===========================
If $losttime < 60 Then $money = $Q & $mw
If $losttime > (65) And $losttime < (95) Then $money = 15 & $mw
If $losttime > (95) And $losttime < (125) Then $money = 20 & $mw
If $losttime > (125) And $losttime < (160) Then $money = 25 & $mw
If $losttime > (160) Then $money = 30 & $mw
$showtime = _Format_Time($losttime)
;dim $jshs
;$jshs=0
;if $losttime>=60 then $jshs += 1
;====================收费价格调整部分===============================
_GUICtrlListView_BeginUpdate($ListView2)
GUICtrlCreateListViewItem($item & "|" & $dh & "|" & $starttime & "|" & $showtime & "|" & $money & "|" & $manager, $ListView2)
_GUICtrlListView_EndUpdate($ListView2)
$jfconn.Execute("Update Content set xf='" & $money & "' where DH='" & $dh & "'")
$jfRS.movenext
WEnd
$jfRS.close()
$jfconn.close()
EndFunc ;==>jf
;==============================自动刷新计费函数=================================
;===========为了在循环时,手动刷新时生产错误,建立相同的数据库连接。============
Func autojf()
$autoconn = ObjCreate("ADODB.Connection")
If @error Then
MsgBox(48, "程序遇到严重错误", "不能与数据库创建连接,数据库引挚被破坏。")
Exit
Else
$autoconn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Jet OLEDB:Database Password=adminxpdnhp;Data Source=" & $db_path)
EndIf
$AutoRS = ObjCreate("ADODB.Recordset")
$AutoRS.ActiveConnection = $autoconn
$AutoRS.Open("Select * From sys")
$Q = $AutoRS.fields(1).value
$S = $AutoRS.fields(2).value
$Z = $AutoRS.fields(3).value
$AutoRS.close
_GUICtrlListView_DeleteAllItems($ListView2)
$mw = ".00"
;读取数据库,筛选没有结账的记录,计算出所用时间
;$hs = _GUICtrlListView_GetItemCount($ListView2) ;读取列表框总行数
;For $i = 0 To $hs
;$k = _GUICtrlListView_GetItemText($ListView2, $i, 1) ;获取$i行0列的值
;$j = _GUICtrlListView_GetItemText($ListView2, $i, 4) ;获取$i行3列的值
;Next
$sql = "Select * From Content where chk=0"
$AutoRS = ObjCreate("ADODB.Recordset")
$AutoRS.ActiveConnection = $autoconn
$AutoRS.Open($sql)
While Not $AutoRS.eof And Not $AutoRS.bof
If @error = 1 Then ExitLoop
$item = $AutoRS.Fields(1).value
$dh = $AutoRS.Fields(4).value
$starttime = $AutoRS.Fields(5).value
$losttime = _DateDiff("n", $starttime, _NowCalc())
$showtime = _Format_Time($losttime)
;====================收费价格调整部分开始===========================
If $losttime < 60 Then $money = $Q & $mw
If $losttime > (60 + $S) And $losttime < (90 + $S) Then $money = 15 & $mw
If $losttime > (90 + $S) And $losttime < (120 + $S) Then $money = 20 & $mw
If $losttime > (120 + $S) And $losttime < (155 + $S) Then $money = 25 & $mw
If $losttime > (155 + $S) Then $money = 30 & $mw
;====================收费价格调整部分===============================
_GUICtrlListView_BeginUpdate($ListView2)
GUICtrlCreateListViewItem($item & "|" & $dh & "|" & $starttime & "|" & $showtime & "|" & $money & "|" & $manager, $ListView2)
_GUICtrlListView_EndUpdate($ListView2)
$autoconn.Execute("Update Content set xf='" & $money & "' where DH='" & $dh & "'")
$AutoRS.movenext
WEnd
$AutoRS.close
$autoconn.close
EndFunc ;==>autojf
;=======================结帐处理函数======================================
Func Quit()
$index = _GUICtrlListView_GetSelectedIndices($ListView1)
If $index <> "" Then
$text = _GUICtrlListView_GetItemText($ListView1, Int($index))
_Conndb()
$sql = "Select * From box where title = " & "'" & $text & "'";根据点击的手牌号打开表.
$RS.Open($sql)
$dh = $RS.fields(3).value ;从表中获取该手牌的账单号
$chk = $RS.fields(4).value ;从表中获取该手牌的状态(即占用或者空闲状态).
_closedb()
If $chk = True Then ;True 或者 1 为占用状态,表示是已开出手牌可以结账.
_Conndb()
$sql = "Select * From Content where DH= " & "'" & $dh & "' and chk=False" ;chk表示该单号的手牌未结账.
$RS.Open($sql)
$kryj = $RS.Fields(10).value
$xf = $RS.Fields(11).value
$starttime = $RS.Fields(5).value
$xftime = _Format_Time(_DateDiff("n", $starttime, _NowCalc()))
_Closedb()
$tip = " (为负数,表示不用找钱.)"
GUICtrlSetColor($tip, 0xff0000)
GUICtrlSetState($account, $GUI_DEFBUTTON)
GUICtrlSetData($ZD, $dh);把得到的账单号快递给子窗口的标签,以便显示.
GUICtrlSetData($showxf, $xf) ;把读取出的消费金额传递给结账窗口的标签,以便显示
GUICtrlSetData($HideZD, $dh);把得到的账单号快递给子窗口的隐藏域,以便其它按钮获取此参数
GUICtrlSetData($HideTitle, $text);将选择的手牌号传递给子窗口.
GUICtrlSetData($HideXF, $xf) ;将获取到的消费传递给隐藏域.
GUICtrlSetData($Hidexftime, $xftime)
GUICtrlSetData($ZL, $kryj - $xf & ".00" & $tip)
GUICtrlSetData($kryjs, $kryj)
GUICtrlSetData($hideZL, $kryj - $xf & ".00")
GUICtrlSetData($ss, $xf)
GUICtrlSetData($zero, $kryj)
GUISwitch($Outin_form)
GUISetState(@SW_SHOW)
Else
MsgBox(64, "提示", "该手牌处于空闲状态,不能进行出场操作...")
EndIf
Else
MsgBox(64, "提示", "没有选择任何手牌,不能进行出场操作...")
EndIf
EndFunc ;==>Quit
;===============================设置列表框函数==========================
Func _Setlist($listnum, $From);
Local $i
$i = 0
GUICtrlSendMsg($listnum, $LVM_DELETEALLITEMS, 0, 0)
GUICtrlSendMsg($listnum, $LVN_ODCACHEHINT, 0, 0)
$hImage = _GUIImageList_Create(32, 32, 5, 3) ;图标显示大小
_Conndb()
$RS.Open("Select * From box order by ID asc")
GUISetState(@SW_LOCK, $From)
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$title = $RS.Fields(1).value
$icon = $RS.Fields(2).value
$chk = $RS.fields(4).value
_GUICtrlListView_BeginUpdate($listnum)
_GUICtrlListView_InsertItem($listnum, $title, -1, $i)
_GUICtrlListView_EndUpdate($listnum)
If $chk = True Then
_GUIImageList_AddIcon($hImage, $icon, 1, True)
Else
_GUIImageList_AddIcon($hImage, $icon, 0, True)
EndIf
$i += 1
$RS.movenext
WEnd
_GUICtrlListView_SetImageList($listnum, $hImage, 0)
; _GUICtrlListView_Arrange ($listnum)
_Closedb()
GUISetState(@SW_UNLOCK, $From)
EndFunc ;==>_Setlist
;=====================手牌状态显示函数=====================================
Func SetL2()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\0.dll", 110)
_GUICtrlListView_SetImageList($L2, $hImage, 1)
_GUICtrlListView_DeleteAllItems($L2)
GUICtrlCreateListViewItem(@CRLF & @CRLF, $L2)
GUICtrlCreateListViewItem("手牌总数:" & _line("count"), $L2)
GUICtrlCreateListViewItem(@CRLF & @CRLF, $L2)
GUICtrlCreateListViewItem("占用手牌:" & _line("online"), $L2)
GUICtrlCreateListViewItem(@CRLF & @CRLF, $L2)
GUICtrlCreateListViewItem("空闲手牌:" & _line("offline"), $L2)
EndFunc ;==>SetL2
;=====================注册信息框处理函数===================================
Func Regbox()
$GetTitel = Get_From_title()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\0.dll", 110)
_GUICtrlListView_SetImageList($L3, $hImage, 1)
GUICtrlCreateListViewItem(@CRLF & @CRLF, $L3)
$reg1 = GUICtrlCreateListViewItem("授权使用:" & $GetTitel, $L3)
GUICtrlSetColor($reg1, 0x400080)
GUICtrlCreateListViewItem(@CRLF & @CRLF, $L3)
GUICtrlCreateListViewItem("状态:已注册", $L3)
GUICtrlCreateListViewItem(@CRLF & @CRLF, $L3)
GUICtrlCreateListViewItem("亮点科技提供技术支持", $L3)
EndFunc ;==>Regbox
;=======================从数据库获取主窗口标题---显示客户Oeminfo========
Func Get_From_title() ;
_Conndb()
$RS.Open("Select * From Reg")
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$From_title = $RS.Fields(1).value
$RS.movenext
WEnd
_Closedb()
Return $From_title
EndFunc ;==>Get_From_title
Func Get_Date()
Return StringReplace(_NowCalcDate(), "/", "-")
EndFunc ;==>Get_Date
;===========================判断用户登录与否函数=======================
Func _Enter($user, $login)
Switch $login
Case 0
_Conndb()
$conn.Execute("update Manage set chk='0' where Num =" & $user)
_CloseDb()
Case 1
_Conndb()
$conn.Execute("update Manage set chk='1' where Num =" & $user)
_CloseDb()
EndSwitch
EndFunc ;==>_Enter
;==============================开场按钮及双击,单击动作================
Func _in($DBLCLK = "")
$index = _GUICtrlListView_GetSelectedIndices($ListView1)
If $index <> "" Then
$text = _GUICtrlListView_GetItemText($ListView1, Int($index))
_Conndb()
$sql = "Select * From box where title = " & "'" & $text & "'"
$RS.Open($sql)
$dh = $RS.fields(3).value
$chk = $RS.fields(4).value
_closedb()
If $chk = True Then ;表示此手牌开出,为占用状态,可结帐.
If $DBLCLK = "1" Then ;表示双击手牌.
Quit() ;双击占用手牌,执行结账函数.
Else
MsgBox(64, "提示", "该手牌处于占用状态.不能进行开场操作...")
EndIf
Else ;否则手牌未开,为空闲状态,跳出开牌窗口.
GUICtrlSetData($Showsph, $text)
GUICtrlSetColor($Showsph, 0xff0000)
GUICtrlSetFont($Showsph, 8, 800, 0, "MS Sans Serif")
GUICtrlSetData($Hidesph, $text)
GUISwitch($Gkkt)
GUISetState(@SW_SHOW)
EndIf
Else
MsgBox(64, "提示", "没有选择任何手牌,不能使用...")
EndIf
EndFunc ;==>_in
;==============================返回当前登录ID的用户姓名=================
Func Man($num)
Dim $manager, $numid
_Conndb()
$sql = "Select * From Manage"
$RS.Open($sql)
While Not $RS.bof And Not $RS.eof
If @error Then ExitLoop
$scan = $RS.Fields(4).value
If $scan = True Then
$numid = $RS.Fields(1).value
$manager = $RS.Fields(2).value
EndIf
$RS.movenext
WEnd
_Closedb()
If $num = "man" Then Return $manager
If $num = "num" Then Return $numid
EndFunc ;==>Man
Func _Getbc($u)
_Conndb()
$RS.Open("Select * from Manage where chk=True And Num=" & $u)
$getbc = $RS.Fields(5).value
Return $getbc
_closedb()
EndFunc ;==>_Getbc
;==========================计算总手牌,及占用,空闲的状态===============
Func _line($chkonline)
_Conndb()
$RS.Open("Select " & $T & " From box")
$count = 0
$online = 0
$offline = 0
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$chk = $RS.fields(4).value
If $chk = True Then
$online = $online + 1
Else
$offline = $offline + 1
EndIf
$count = $count + 1
$RS.movenext
WEnd
_Closedb()
Switch $chkonline
Case "count" ;返回总手牌数
Return $count
Case "online" ;返回占用手牌数
Return $online
Case "offline" ;返回空闲手牌数
Return $offline
EndSwitch
EndFunc ;==>_line
Func BC($u) ;创建班次
Return StringReplace(_NowCalcDate(), "/", "") & "-" & $u
EndFunc ;==>BC
;=======================以下是修改用户密码函数========================
Func _changpass($Uid)
$passa = GUICtrlRead($fr5_in1)
$passb = GUICtrlRead($fr5_in2)
$passc = GUICtrlRead($fr5_in3)
_Conndb()
$sql = "Select * From Manage where Num=" & $Uid
$RS.Open($sql)
$oldpass = $RS.fields(3).value
_Closedb()
Select
Case $oldpass = MD5_String($passa)
If Not ($passb = $passc) Then
MsgBox(48, "口令更改", "输入的新口令不一致,请检测。")
GUICtrlSetState($fr5_in2, $GUI_FOCUS)
ElseIf $passb = "" Or $passc = "" Then
MsgBox(48, "口令更改", "新口令不能为空,请重新输入。")
GUICtrlSetState($fr5_in2, $GUI_FOCUS)
Else
_Conndb()
$conn.Execute("update Manage set Pass = '" & MD5_String($passb) & "' where Num=" & $Uid)
_CloseDb()
MsgBox(48, "口令更改", "口令修改成功。")
GUIDelete($pass_from)
EndIf
Case Else
MsgBox(48, "口令更改", "原始口令输入有误。")
EndSelect
EndFunc ;==>_changpass
;======================= 以下为数据库建立连接与关闭连接函数 =============
Func _Conndb()
$conn = ObjCreate("ADODB.Connection")
If @error Then
MsgBox(48, "程序遇到严重错误", "不能与数据库创建连接,数据库引挚被破坏。")
Exit
Else
$conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Jet OLEDB:Database Password=adminxpdnhp;Data Source=" & $db_path)
$RS = ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $conn
EndIf
EndFunc ;==>_Conndb
Func _CloseDb()
$conn.Close
EndFunc ;==>_CloseDb
Func date()
_GUICtrlStatusBar_SetText($StatusBar1, @TAB & @TAB & "系统时间:" & _NowCalcDate() & " " & @HOUR & ":" & @MIN & ":" & @SEC & " ", 1)
EndFunc ;==>date
;==============================判断列表双击,单击函数========================
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $index, $text, $path
$hWndListView = $ListView1
If Not IsHWnd($ListView1) Then $hWndListView = GUICtrlGetHandle($ListView1);检查一个变量=GUI返回空间句柄
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam);创建一个数据结构,ilparam为变量
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"));返回数据结构
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom");返回数据结构
$iCode = DllStructGetData($tNMHDR, "Code");返回数据结构
Switch $hWndFrom;Switch...Case...EndSwitch ,hwndfrom为表达式
Case $hWndListView ;值
Switch $iCode; icode为表达式
Case $NM_DBLCLK ;值
_in("1")
Case $NM_CLICK ; The control has received the input focus
$index = _GUICtrlListView_GetSelectedIndices($ListView1);检索的选定项的索引
If $index <> "" Then
$text = _GUICtrlListView_GetItemText($ListView1, Int($index));返回一项或子项的文本
_Conndb()
$RS.Open("Select " & $T & " From box where title = " & "'" & $text & "'")
$ddh = $RS.fields(3).value
$chk = $RS.fields(4).value
_closedb()
If $chk = True Then
_Conndb()
$sql = "Select * From Content where chk=0 and DH=" & "'" & $ddh & "'"
$RS.Open($sql)
If Not $RS.BOF And Not $RS.EOF Then
$item = $RS.Fields(3).value
$starttime = $RS.Fields(5).value
$YJS = $RS.Fields(10).value
$money = $RS.Fields(11).value
$losttime = _DateDiff("n", $starttime, _NowCalc())
_Closedb()
$showtime = _Format_Time($losttime)
GUICtrlSendMsg($L1, $LVM_DELETEALLITEMS, 0, 0)
GUICtrlCreateListViewItem("", $L1)
$fontcolor = GUICtrlCreateListViewItem("手牌号:" & $text, $L1)
GUICtrlSetColor($fontcolor, 0xFF0000)
GUICtrlCreateListViewItem("", $L1)
GUICtrlCreateListViewItem("进场时间:" & $starttime, $L1)
GUICtrlCreateListViewItem("", $L1)
GUICtrlCreateListViewItem("已交押金:" & $YJS, $L1)
GUICtrlCreateListViewItem("", $L1)
GUICtrlCreateListViewItem("消费时间:" & $showtime, $L1)
GUICtrlCreateListViewItem("", $L1)
GUICtrlCreateListViewItem("消费费用:" & $money, $L1)
GUICtrlCreateListViewItem("", $L1)
EndIf
Else
GUICtrlSendMsg($L1, $LVM_DELETEALLITEMS, 0, 0)
$o = ""
For $i = 1 To 5
GUICtrlCreateListViewItem("", $L1)
Next
$spinfo = GUICtrlCreateListViewItem(" 无此手牌信息(未开台)", $L1)
GUICtrlSetColor($spinfo, 0x1f0fff)
EndIf
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Func _ReduceMemory($i_PID = -1) ;释放本程序占用的内存
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc ;==>_ReduceMemory
;==============================分钟换算成小时函数===============================
Func _Format_Time($Time)
Local $Return = "", $Min = 0, $Hour = 0
$Time = StringReplace($Time, " ", "")
If $Time < 60 Then
$Return = "0小时" & _Blen_Time($Time) & "分"
ElseIf $Time >= 60 Then
While 1
If $Time < 60 Then ExitLoop
$Hour += 1
$Time -= 60
WEnd
$Return = _Blen_Time($Hour) & "小时" & _Blen_Time($Time) & "分"
EndIf
Return $Return
EndFunc ;==>_Format_Time
Func _Blen_Time($String)
If StringLen($String) > 1 Then Return $String
Return "0" & $String
EndFunc ;==>_Blen_Time
Func _hidekj()
GUICtrlSetState(-1, $GUI_HIDE)
EndFunc ;==>_hidekj
Func _Exitsubfrom()
GUISetState(@SW_HIDE, @GUI_WinHandle)
_ReduceMemory(@AutoItPID)
EndFunc ;==>_Exitsubfrom
Func backup()
$Dataform = GUICreate("数据备份", 340, 67, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), -1, $Form1)
$Progress1 = GUICtrlCreateProgress(40, 24, 257, 17, $PBS_SMOOTH)
GUISetState(@SW_SHOW)
For $i = 0 To 100
Sleep(10)
GUICtrlSetData($Progress1, $i)
Next
GUIDelete($Dataform)
$time1 = _NowCalcDate()
$time2 = _NowTime()
$timearray1 = StringSplit($time1, "/")
$timearray2 = StringSplit($time2, ":")
$Time = $timearray1[1] & $timearray1[2] & $timearray1[3] & $timearray2[1] & $timearray2[2]
;MsgBox(0,0,$time)
FileCopy($db_path, @ScriptDir & "\Databak" & $Time & "" & $db_path, 8)
MsgBox(64, "提示", "数据库已被备份到Databak目录下的子目录" & $Time & "中.")
GUICtrlSetData($rescombo, "")
Setcombo()
EndFunc ;==>backup
Func Setcombo()
$resb = ""
$bdir = ""
$a = Seek(@ScriptDir & "\Databak")
$dirc = StringSplit($a, ";")
Dim $dirtemp[$dirc[0] + 1]
For $resi = 1 To $dirc[0]
;~ MsgBox(0,0,$dirc[$resi])
$dirtemp[$resi] = StringMid($dirc[$resi], 1, 4) & "年" & StringMid($dirc[$resi], 5, 2) & "月" & StringMid($dirc[$resi], 7, 2) & "日" & StringMid($dirc[$resi], 9, 2) & "时" & StringRight($dirc[$resi], 2) & "分"
If $resb = "" Then
$resb = $dirtemp[$resi]
Else
$resb = $resb & "|" & $dirtemp[$resi]
EndIf
Next
GUICtrlSetData($rescombo, $resb, $dirtemp[1])
EndFunc ;==>Setcombo
Func restore()
$resb = ""
$bdir = ""
$a = Seek(@ScriptDir & "\Databak")
$dirc = StringSplit($a, ";")
Dim $dirtemp[$dirc[0] + 1]
For $resi = 1 To $dirc[0]
$dirtemp[$resi] = StringMid($dirc[$resi], 1, 4) & "年" & StringMid($dirc[$resi], 5, 2) & "月" & StringMid($dirc[$resi], 7, 2) & "日" & StringMid($dirc[$resi], 9, 2) & "时" & StringRight($dirc[$resi], 2) & "分"
If $resb = "" Then
$resb = $dirtemp[$resi]
Else
$resb = $resb & "|" & $dirtemp[$resi]
EndIf
Next
If $resb = "年月日时分" Then
MsgBox(16, "提示", "没有备份数据文件可被恢复。")
ElseIf GUICtrlRead($rescombo) = "" Then
MsgBox(16, "错误", "没有备份数据文件可被恢复.")
Else
$Datarestore = GUICreate("数据恢复", 340, 67, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), -1, $Form1)
$Progress1 = GUICtrlCreateProgress(40, 24, 257, 17, $PBS_SMOOTH)
GUISetState(@SW_SHOW)
For $i = 0 To 100
Sleep(10)
GUICtrlSetData($Progress1, $i)
Next
GUIDelete($Datarestore)
$bdir &= StringMid(GUICtrlRead($rescombo), 1, 4) & StringMid(GUICtrlRead($rescombo), 6, 2) & StringMid(GUICtrlRead($rescombo), 9, 2) & StringMid(GUICtrlRead($rescombo), 12, 2) & StringMid(GUICtrlRead($rescombo), 15, 2)
FileCopy(@ScriptDir & "\Databak" & $bdir & "" & $db_path, @ScriptDir & "" & $db_path, 9)
MsgBox(64, "提示", "恢复成功。")
EndIf
EndFunc ;==>restore
Func Seek($Dir)
$total = ""
If StringRight($Dir, 1) <> "" Then $Dir = $Dir & "";
$search = FileFindFirstFile($Dir & "*.*")
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
If FileGetAttrib($Dir & $file) = "D" Then;
If $total = "" Then
$total = $file
Else
$total = $total & ";" & $file
EndIf
EndIf
WEnd
Return $total
FileClose($search)
EndFunc ;==>Seek
Func check()
GUICtrlSetState($Input1, $GUI_FOCUS)
EndFunc ;==>check
Func loaduser()
_Conndb()
$sql = "Select * From Manage"
$RS.Open($sql)
While Not $RS.bof And Not $RS.eof
If @error Then ExitLoop
$pd = $RS.fields(4).value
If $pd = True Then
GUICtrlSetData($numInput, $RS.fields(1).value)
GUICtrlSetData($userInput, $RS.fields(2).value)
EndIf
$RS.movenext
WEnd
_Closedb()
EndFunc ;==>loaduser
Func _exit()
GUISetState(@SW_HIDE) ;这里先将界面隐藏起来,因为要先关闭皮肤后才关闭软件,所以隐藏界面后关闭皮肤的话就不会看到没有皮肤的界面了。
DllCall($Dll_, "int", "USkinRemoveSkin") ;这里是关闭皮肤
DllCall($Dll_, "int", "USkinExit") ;这里是退出皮肤调用的DLL
DllClose($Dll_) ;关闭DLL文件调用
Exit ;退出脚本(关闭软件)
EndFunc ;==>_exit
|