?? modfocus.bas
字號:
sDel = "Update SiteType Set SiteStatus=1 Where Class In (Select Class From tbdBook Where ExpireDate='" & Date & "' And DatePart=" & tmpDatePart & " And Class='" & stmpSiteID & "')"
Else
sDel = "Update SiteType Set SiteStatus=1 Where Class In (Select Class From tbdBook Where ExpireDate=#" & Date & "# And DatePart=" & tmpDatePart & " And Class='" & stmpSiteID & "')"
End If
CDB.Execute sDel
CDB.CommitTrans
CDB.Close
Set CDB = Nothing
CancelMaintenans = True
Exit Function
CancelERR:
CancelMaintenans = False
MsgBox "恢復座位狀態錯誤?" & Err.Description, vbCritical
End Function
'檢查會員是否存在
Public Function CheckCustomer(stmpID As String) As Boolean
On Error GoTo GetERR
Dim CDB As Connection
Dim CRs As Recordset
Set CDB = CreateObject("ADODB.Connection")
Set CRs = CreateObject("ADODB.Recordset")
CDB.Open Constr
CRs.Open "Select * from tbdMember Where ID='" & stmpID & "'", CDB, adOpenStatic, adLockReadOnly, adCmdText
If Not (CRs.EOF And CRs.BOF) Then
CheckCustomer = True
Else
CheckCustomer = False
End If
CRs.Close
CDB.Close
Set CRs = Nothing
Set CDB = Nothing
Exit Function
GetERR:
MsgBox "不能校對會員編號:" & Err.Description, vbCritical
CheckCustomer = False
End Function
'檢查會員是否存在
Public Function CheckCustomerRate(stmpID As String) As Boolean
On Error GoTo GetERR
sGuestID = "": sGuestName = "": cGuestRemain = 0
Dim CDB As Connection
Dim CRs As Recordset
Set CDB = CreateObject("ADODB.Connection")
Set CRs = CreateObject("ADODB.Recordset")
CDB.Open Constr
CRs.Open "Select tbdMember.DLevel,tbdMember.Consume,tbdMember.Name,tbdLevel.DDiscount " _
& "from tbdMember Inner Join tbdLevel On tbdMember.DLevel=tbdLevel.ID " _
& " Where tbdMember.ID='" & stmpID & "'", CDB, adOpenStatic, adLockReadOnly, adCmdText
If Not (CRs.EOF And CRs.BOF) Then
CheckCustomerRate = True
cRate = CRs("DDiscount")
sGuestID = stmpID: sGuestName = CRs("Name")
cGuestRemain = CRs("Consume")
Else
CheckCustomerRate = False
cRate = 100
End If
CRs.Close
CDB.Close
Set CRs = Nothing
Set CDB = Nothing
Exit Function
GetERR:
MsgBox "不能校對會員編號:" & Err.Description, vbCritical
CheckCustomerRate = False
cRate = 100
End Function
'檢查菜單是否存在
Public Function CheckMenuCat(stmpID As String) As Boolean
On Error GoTo GetERR
Dim CDB As Connection
Dim CRs As Recordset
Set CDB = CreateObject("ADODB.Connection")
Set CRs = CreateObject("ADODB.Recordset")
CDB.Open Constr
CRs.Open "Select * from tbdMenuCat Where MenuID='" & stmpID & "'", CDB, adOpenStatic, adLockReadOnly, adCmdText
If Not (CRs.EOF And CRs.BOF) Then
CheckMenuCat = True
Else
CheckMenuCat = False
End If
CRs.Close
CDB.Close
Set CRs = Nothing
Set CDB = Nothing
Exit Function
GetERR:
MsgBox "不能校對菜單編號:" & Err.Description, vbCritical
CheckMenuCat = False
End Function
'檢查座位是否被預訂
Public Function CheckSiteIde(stmpID As String) As Boolean
On Error GoTo GetERR
Dim CDB As Connection
Dim CRs As Recordset
Set CDB = CreateObject("ADODB.Connection")
Set CRs = CreateObject("ADODB.Recordset")
CDB.Open Constr
CRs.Open "Select * from SiteType Where SiteStatus=0 And Class='" & stmpID & "'", CDB, adOpenStatic, adLockReadOnly, adCmdText
If Not (CRs.EOF And CRs.BOF) Then
CheckSiteIde = True
Else
CheckSiteIde = False
End If
CRs.Close
CDB.Close
Set CRs = Nothing
Set CDB = Nothing
Exit Function
GetERR:
MsgBox "不能檢查座位狀態:" & Err.Description, vbCritical
CheckSiteIde = False
End Function
Public Sub GetTypeList(sTable As String, tmpList As Object)
On Error GoTo GetERR
tmpList.Clear
Dim utDB As Connection
Dim utRS As Recordset
Set utDB = CreateObject("ADODB.Connection")
Set utRS = CreateObject("ADODB.Recordset")
utDB.Open Constr
utRS.Open sTable, utDB, adOpenStatic, adLockReadOnly, adCmdTable
If Not (utRS.EOF And utRS.BOF) Then
Do While Not utRS.EOF
tmpList.AddItem utRS("Class")
utRS.MoveNext
Loop
End If
utRS.Close
utDB.Close
Set utRS = Nothing
Set utDB = Nothing
If tmpList.ListCount > 0 Then
tmpList.ListIndex = 0
End If
Exit Sub
GetERR:
MsgBox "給出錯誤:" & Err.Description, vbCritical
End Sub
Public Sub GetEmployList(tmpList As Object)
On Error GoTo GetERR
tmpList.Clear
Dim utDB As Connection
Dim utRS As Recordset
Set utDB = CreateObject("ADODB.Connection")
Set utRS = CreateObject("ADODB.Recordset")
utDB.Open Constr
utRS.Open "tbdGuest", utDB, adOpenStatic, adLockReadOnly, adCmdTable
If Not (utRS.EOF And utRS.BOF) Then
Do While Not utRS.EOF
tmpList.AddItem utRS("DName")
utRS.MoveNext
Loop
End If
utRS.Close
utDB.Close
Set utRS = Nothing
Set utDB = Nothing
'If tmpList.ListCount > 0 Then
' tmpList.ListIndex = 0
'End If
Exit Sub
GetERR:
MsgBox "給出操作員錯誤:" & Err.Description, vbCritical
End Sub
Public Sub GetMenuTypeList(sTable As String, tmpList As Object)
On Error GoTo GetERR
tmpList.Clear
Dim utDB As Connection
Dim utRS As Recordset
Dim lLen As Integer
Set utDB = CreateObject("ADODB.Connection")
Set utRS = CreateObject("ADODB.Recordset")
utDB.Open Constr
utRS.Open sTable, utDB, adOpenStatic, adLockReadOnly, adCmdTable
If Not (utRS.EOF And utRS.BOF) Then
Do While Not utRS.EOF
lLen = LenB(StrConv(utRS("Class"), vbFromUnicode))
If utRS("Discount") = 0 Then
tmpList.AddItem utRS("Class") & Space(30 - lLen) & "禁止打折"
Else
tmpList.AddItem utRS("Class") & Space(30 - lLen) & "統一打折"
End If
utRS.MoveNext
Loop
End If
utRS.Close
utDB.Close
Set utRS = Nothing
Set utDB = Nothing
If tmpList.ListCount > 0 Then
tmpList.ListIndex = 0
End If
Exit Sub
GetERR:
MsgBox "給出錯誤:" & Err.Description, vbCritical
End Sub
'刪除類型
Public Function DeleteType(sName As String, sTable As String) As Boolean
On Error GoTo GetERR
Dim utDB As Connection
Set utDB = CreateObject("ADODB.Connection")
utDB.Open Constr
utDB.Execute "Delete From " & sTable & " Where Class='" & sName & "'"
utDB.Close
Set utDB = Nothing
DeleteType = True
Exit Function
GetERR:
DeleteType = False
MsgBox "刪除錯誤:" & Err.Description, vbCritical
End Function
'刪除餐桌類型
Public Function DeleteSiteType(sName As String, sTable As String) As Boolean
On Error GoTo GetERR
Dim utDB As Connection
Set utDB = CreateObject("ADODB.Connection")
utDB.Open Constr
Dim usRs As Recordset
Set usRs = CreateObject("ADODB.Recordset")
usRs.Open "Select * from SiteType Where Class='" & sName & "'", utDB, adOpenStatic, adLockReadOnly, adCmdText
If usRs.EOF And usRs.BOF Then
usRs.Close
utDB.Close
Set usRs = Nothing
Set utDB = Nothing
DeleteSiteType = True
Exit Function
Else
If usRs("SiteStatus") > 0 Then
usRs.Close
utDB.Close
Set usRs = Nothing
Set utDB = Nothing
DeleteSiteType = False
MsgBox "很抱歉,該餐桌已經預訂或上臺,暫不能刪除? ", vbInformation
Exit Function
End If
End If
usRs.Close
utDB.Execute "Delete From " & sTable & " Where Class='" & sName & "'"
utDB.Close
Set usRs = Nothing
Set utDB = Nothing
DeleteSiteType = True
Exit Function
GetERR:
DeleteSiteType = False
MsgBox "刪除錯誤:" & Err.Description, vbCritical
End Function
'刪除類型
Public Function DeleteMenuType(sName As String, sTable As String) As Boolean
On Error GoTo GetERR
If InStr(1, sName, " ", vbTextCompare) > 0 Then
sName = Left(sName, InStr(1, sName, " ", vbTextCompare) - 1)
End If
Dim utDB As Connection
Set utDB = CreateObject("ADODB.Connection")
utDB.Open Constr
utDB.Execute "Delete From " & sTable & " Where Class='" & sName & "'"
utDB.Close
Set utDB = Nothing
DeleteMenuType = True
Exit Function
GetERR:
DeleteMenuType = False
MsgBox "刪除錯誤:" & Err.Description, vbCritical
End Function
'刪除類型
Public Function DeleteMenuCat(sName As String, sTable As String) As Boolean
On Error GoTo GetERR
Dim utDB As Connection
Set utDB = CreateObject("ADODB.Connection")
utDB.Open Constr
utDB.BeginTrans
'刪除酒席
utDB.Execute "Delete From tbdMenuCat Where MenuID='" & sName & "'"
'刪除酒席列表
utDB.Execute "Delete From tbdMenuCatDetail Where MenuID='" & sName & "'"
utDB.CommitTrans
utDB.Close
Set utDB = Nothing
DeleteMenuCat = True
Exit Function
GetERR:
DeleteMenuCat = False
MsgBox "刪除錯誤:" & Err.Description, vbCritical
End Function
'刪除類型
Public Function DeleteMenuCatDetail(sName As String, sIDs As String, sTable As String) As Boolean
On Error GoTo GetERR
Dim utDB As Connection
Set utDB = CreateObject("ADODB.Connection")
utDB.Open Constr
'刪除酒席列表,酒席為sIDs,sName為菜單編號
utDB.Execute "Delete From tbdMenuCatDetail Where MenuID='" & sIDs & "' And MenuName='" & sName & "'"
utDB.Close
Set utDB = Nothing
DeleteMenuCatDetail = True
Exit Function
GetERR:
DeleteMenuCatDetail = False
MsgBox "刪除錯誤:" & Err.Description, vbCritical
End Function
'給出菜的名稱
Public Function GetProName(sIDs As String) As String
On Error GoTo GetERR
Dim utDB As Connection
Dim utRS As Recordset
Set utDB = CreateObject("ADODB.Connection")
Set utRS = CreateObject("ADODB.Recordset")
utDB.Open Constr
utRS.Open "Select * from EatList Where MID='" & sIDs & "'", utDB, adOpenStatic, adLockReadOnly, adCmdText
If utRS.EOF And utRS.BOF Then
GetProName = ""
Else
GetProName = utRS("MName")
End If
utRS.Close
utDB.Close
Set utRS = Nothing
Set utDB = Nothing
Exit Function
GetERR:
GetProName = ""
MsgBox "給出產品名稱錯誤:" & Err.Description, vbCritical
End Function
Public Function GetCode(sWP As String, sFields As String, sTable As String) As Boolean
On Error GoTo Err_init
Dim tDB As Connection
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -