?? frmcash.frm
字號:
End Sub
Private Sub txtSK_Change()
On Error Resume Next
If txtSK.Text = "" Then
txtSK.Text = "0"
txtSK.SelStart = 0
txtSK.SelLength = 1
End If
If txtSK.Text = "0" Then
txtSK.Text = "0"
txtSK.SelStart = 0
txtSK.SelLength = 1
End If
If txtSK.Text = "." Then
txtSK.Text = "0."
txtSK.SelStart = 2
txtSK.SelLength = 0
End If
'使用卡時,補上差額
If chkCard.Value = vbChecked Then
If CCur(ftRemain.Text) > CCur(txtFK.Text) Then
'卡內金額足夠時
txtZL.Text = "0": txtSK.Text = "0"
Else
txtZL.Text = Round(CCur(txtSK.Text) + CCur(ftRemain.Text) - CCur(txtFK.Text), 0)
End If
Else
txtZL.Text = Round(CCur(txtSK.Text) - CCur(txtFK.Text), 0)
End If
End Sub
Private Sub txtSK_DblClick()
txtSK.Text = txtFK.Text
txtSK.SelStart = 0
txtSK.SelLength = Len(txtSK.Text)
txtSK.SetFocus
End Sub
Private Sub ConfigPayMethod()
On Error GoTo GetPaymentERR
Dim DB As Connection, EF As Recordset, HH As Integer
Set DB = CreateObject("ADODB.Connection")
DB.Open Constr
Set EF = CreateObject("ADODB.Recordset")
EF.Open "Select * From PayType", DB, adOpenStatic, adLockReadOnly, adCmdText
cmbPayMethod.Clear
Do While Not EF.EOF()
If Not IsNull(EF.Fields(0)) Then
cmbPayMethod.AddItem EF.Fields(0).Value
End If
EF.MoveNext
Loop
EF.Close
Set EF = Nothing
DB.Close
Set DB = Nothing
If cmbPayMethod.ListCount > 0 Then
Dim sPos As Integer
sPos = GetSetting(App.EXEName, "Option", "PayMethod", 0)
If sPos > 0 Then
If sPos > cmbPayMethod.ListCount - 1 Then sPos = cmbPayMethod.ListCount - 1
cmbPayMethod.ListIndex = sPos
Else
cmbPayMethod.ListIndex = 0
End If
SaveSetting App.EXEName, "Option", "PayMethod", cmbPayMethod.ListIndex
End If
Exit Sub
GetPaymentERR:
MsgBox "給出付款方法錯誤:" & Err.Description, vbCritical
Exit Sub
End Sub
Private Sub GetJE(TmpDB As Connection)
On Error GoTo GetJEERR
Dim JeEf As Recordset
Dim sTMp As String
sTMp = "Select * From tmpSite Where Site='" & sPubSite & "'"
Set JeEf = CreateObject("ADODB.Recordset")
JeEf.Open sTMp, TmpDB, adOpenStatic, adLockOptimistic, adCmdText
If Not (JeEf.BOF And JeEf.EOF) Then
JeEf.Fields("SFAmo") = CCur(txtFK.Text)
JeEf.Fields("CheckOutMan") = UserText
JeEf.Fields("Discount") = cmbDZ.Text
If Trim(ftCID.Text) <> "" Then
JeEf.Fields("MID") = Trim(ftCID.Text)
End If
If chkArrearage.Value = vbChecked Then
JeEf.Fields("IsArrearage") = 1
Else
'正常時
JeEf.Fields("IsArrearage") = 0
End If
JeEf.Update
End If
JeEf.Close
Set JeEf = Nothing
Exit Sub
GetJEERR:
MsgBox "保存座位消費金額錯誤:" & Err.Description, vbCritical
Exit Sub
End Sub
'更新消費金額
Private Sub GetConsum(sType As String, sMID As String, curRate As Integer)
On Error GoTo Err_DC
Dim hDB As Connection
Dim hEf As Recordset
Dim tmpEF As Recordset
Dim sTMp As String
Dim cDCJE As Currency, cDCJGF '點菜金額
Me.MousePointer = 11
'更新座位號消費單
Set hDB = CreateObject("ADODB.Connection")
hDB.Open Constr
Set hEf = CreateObject("ADODB.Recordset")
hEf.Open "Select tmpsite.SFAmo,tmpsite.DCJE,tmpsite.RJCJE,tmpsite.LJCJE,tmpsite.JSJE," _
& "tmpsite.JSJGF,tmpsite.LJCJGF,tmpsite.DCJGF,tmpsite.Discount," _
& "tmpsite.BXF,tmpsite.JEAMO,SiteType.Class,SiteType.Price,SiteType.SupperPrice,SiteType.NightPrice " _
& " From tmpSite Inner Join SiteType On tmpsite.Site=SiteType.Class " _
& " Where tmpsite.Site='" & sPubSite & "'", hDB, adOpenStatic, adLockOptimistic, adCmdText
If hEf.BOF And hEf.EOF Then '沒有該記錄時
hEf.Close
Set hEf = Nothing
hDB.Close
Set hDB = Nothing
Me.MousePointer = 0
cJE = 0: cBXF = 0: cRate = 0
JSAmo = 0: JGAmo = 0: SFAmo = 0: FKAmo = 0
MsgBox "沒有消費記錄,不能匯總消費金額? " & vbCrLf _
& "或者其他操作已經結帳。 ", vbInformation
Exit Sub
Else
'1/給出客戶的打折率
'If sMID = "" Then
cDiscount = CInt(cmbDZ.Text)
' Else
'給出該客戶的打折率
' cDiscount = GetCustomerRate(sMID)
'End If
'2/給出tmpCust的100不打折的金額,應收等于實付,CDiscount=100,加工費不打折
'A/更新打折內容。
sTMp = "Update tmpCust Set YFAmo=Amo*" & (cDiscount) / 100 & " Where Site='" & sPubSite & "' And DType In(Select Class from MenuType Where Discount=1)"
hDB.Execute sTMp
'B/更新不打折內容
sTMp = "Update tmpCust Set YFAmo=Amo Where Site='" & sPubSite & "' And DType In(Select Class from MenuType Where Discount=0)"
hDB.Execute sTMp
'3/計算金額,不論菜單類型,匯總XX座位的消費金額 ------------------------------------------------------
sTMp = "Select Sum(YFAmo),Sum(JGF),Sum(Amos) From TmpCust Where Site='" & sPubSite & "'"
Set tmpEF = CreateObject("ADODB.Recordset")
tmpEF.Open sTMp, hDB, adOpenStatic, adLockOptimistic, adCmdText
If tmpEF.BOF And tmpEF.EOF Then
cDCJGF = 0: cDCJE = 0
JSAmo = 0
FKAmo = 0
Else
cDCJE = tmpEF.Fields(0)
cDCJGF = tmpEF.Fields(1) '點菜加工費
JSAmo = tmpEF(2) '消費金額
FKAmo = tmpEF(0) '實付金額
End If
tmpEF.Close
Set tmpEF = Nothing
'-------------------------------------------------------------------------------------------------
'4/更新當前座位的消費金額。
'給出當前時間,然后根據當前時間給出包廂費
Dim tmplHour As Integer
tmplHour = Hour(Time)
If tmplHour >= Lunch1 And tmplHour < Lunch2 Then '中午
cBXF = hEf("Price")
ElseIf tmplHour >= Supper1 And tmplHour < Supper2 Then '下午
cBXF = hEf("SupperPrice")
ElseIf tmplHour >= Night1 And tmplHour < NIght2 Then '晚上
cBXF = hEf("NightPrice")
Else
cBXF = hEf("Price")
End If
hEf.Fields("BXF") = cBXF '包廂費
hEf.Fields("DCJE") = JSAmo '點菜金額,已經打折的菜單
hEf.Fields("DCJGF") = cDCJGF '加工費
hEf.Fields("Discount") = cDiscount
JGAmo = cDCJGF '加工費
'給出金額,界面顯示
cJE = JSAmo + cDCJGF + cBXF
'應付加上包廂費
FKAmo = FKAmo + cBXF + cDCJGF
'金額=消費金額(加工費不打折)+包廂費+DCJGF
hEf.Fields("JEAmo") = Round((hEf.Fields("DCJE") + hEf.Fields("BXF") + hEf.Fields("DCJGF")), 0)
hEf.Update
End If
'5/顯示
hEf.Close
Set hEf = Nothing
hDB.Close
Set hDB = Nothing
Me.MousePointer = 0
Exit Sub
Err_DC:
Me.MousePointer = 0
MsgBox "合計消費金額錯誤: " & vbCrLf & vbCrLf & Err.Description, vbInformation
Exit Sub
End Sub
Private Function GetCustomerRate(stmpID As String) As Currency
On Error GoTo CustomerERR
Dim TmpDB As Connection
Dim tmpRs As Recordset
Dim sNews As String
Set TmpDB = CreateObject("ADODB.Connection")
Set tmpRs = CreateObject("ADODB.Recordset")
TmpDB.Open Constr
sNews = "Select tbdMember.DLevel,tbdLevel.DDiscount " _
& " from tbdMember Inner Join tbdLevel On tbdMember.Dlevel=tbdLevel.ID " _
& " Where tbdMember.ID='" & stmpID & "'"
tmpRs.Open sNews, TmpDB, adOpenStatic, adLockReadOnly, adCmdText
If Not (tmpRs.EOF And tmpRs.BOF) Then
GetCustomerRate = tmpRs("DDiscount")
Else
GetCustomerRate = 100
End If
tmpRs.Close
TmpDB.Close
Set tmpRs = Nothing
Set TmpDB = Nothing
Exit Function
CustomerERR:
MsgBox "對不起,給出會員的打折情況錯誤:" & Err.Description, vbCritical
GetCustomerRate = 100
End Function
Public Sub PrintSheet(nID As String)
On Error GoTo PrintErr
If nID = "" Then
MsgBox "消費單為空,不能打印? ", vbInformation
Exit Sub
End If
'打印格式
Dim bExit As Boolean
Dim sWaiter As String
sWaiter = GetWaiter(sPubSite) '給出營業員
Dim DB As Connection, EF As Recordset
Dim sBB As String
Set DB = CreateObject("ADODB.Connection")
DB.Open Constr
sBB = "Delete From prtCust"
DB.Execute sBB
' sBB = "INSERT Into prtCust SELECT DType AS DType, Name AS Name, Unit AS Unit, Price AS Price, Sum(Quanty) AS Quantys, Sum(JGF) AS JGFs, Sum(Amos) AS Amoss From tmpCust WHERE Site='" & sPubSite & "' GROUP BY DType, Name, Unit, Price"
' DB.Execute sBB
Set EF = CreateObject("ADODB.Recordset")
EF.Open "SELECT DType AS DType, Name AS Name, Unit AS Unit, Price AS Price, Sum(Quanty) AS Quantys, Sum(JGF) AS JGFs, Sum(Amos) AS Amoss From tmpCust WHERE Site='" & sPubSite & "' GROUP BY DType, Name, Unit, Price", DB, adOpenStatic, adLockReadOnly, adCmdText
' EF.Open "Select * From prtCust", DB, adOpenStatic, adLockReadOnly, adCmdText
Dim lPaperCountS As Integer, lPaperCount As Integer
Dim lCurrent As Integer
If EF.BOF And EF.EOF Then '沒有記錄時 退出
EF.Close
Set EF = Nothing
DB.Close
Set DB = Nothing
MsgBox "沒有消費記錄,不能打印。 ", vbExclamation
Exit Sub
Else
lPaperCount = 0
Do While Not EF.EOF
lPaperCount = lPaperCount + 1
EF.MoveNext
Loop
EF.MoveFirst
End If
'計算總頁數
lPaperCountS = lPaperCount / nPrintLine
If (lPaperCount Mod nPrintLine) <> 0 And (lPaperCount > nPrintLine) Then '正除時不加0
lPaperCountS = lPaperCountS + 1
End If
If lPaperCountS = 0 Then
lPaperCountS = lPaperCountS + 1
End If
Dim x As Integer
Dim sPN As String
Dim cDJ As String
Dim lSL As String
Dim cJE As String
Dim cDW As String
Dim H As Integer
Dim cJGF As String
Dim sType As String '類型
Dim sType1 As String '類型
'開始打印
Printer.ScaleMode = 6 'mm
For x = 1 To lPaperCountS
'打印單位名稱
Printer.FontSize = 24
Printer.FontName = "黑體"
Printer.FontBold = True
Printer.CurrentX = ((110 - (Printer.TextWidth(sUnit))) / 2) + 8
Printer.CurrentY = XTop + 8
'NoTitle為不打印標題,客戶可自行給出
'NoTitle=1 Or -1
If NoTitle = False Then
Printer.Print sUnit
End If
Printer.FontSize = 9
Printer.FontName = "黑體"
Printer.FontBold = True
Printer.CurrentX = 8 + XLeft
Printer.CurrentY = 26 + XTop
Printer.Print "單號:" & nID
If chkArrearage.Value = vbChecked Then
'打印掛帳
Printer.CurrentX = 42 + XLeft
Printer.CurrentY = 26 + XTop
Printer.Print "掛帳"
Else
Printer.CurrentX = 42 + XLeft
Printer.CurrentY = 26 + XTop
Printer.Print "結帳:" & cmbPayMethod.Text
End If
Printer.CurrentX = 75 + XLeft
Printer.CurrentY = 26 + XTop
Printer.Print "日期:" & Format(Date, "Long Date")
'桌號
Printer.CurrentX = 8 + XLeft
Printer.CurrentY = 32 + XTop
Printer.Print "桌號:" & sPubSite
'會員信息
If Trim(ftCID.Text) <> "" And Trim(ftCName.Text) <> "" Then
Printer.CurrentX = 42 + XLeft
Printer.CurrentY = 32 + XTop
Printer.Print "會員:" & ftCID.Text
Printer.CurrentX = 75 + XLeft
Printer.CurrentY = 32 + XTop
Printer.Print "姓名:" & ftCName.Text
End If
'打印菜單標題
Printer.CurrentX = 8 + XLeft
Printer.CurrentY = 40 + XTop
Printer.FontBold = False
Printer.Font = "宋體"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -