?? frmbackit.frm
字號:
txtDJ = Grid1X.TextMatrix(Grid1X.Row, 4)
txtUnit = Grid1X.TextMatrix(Grid1X.Row, 5)
txtType = Grid1X.TextMatrix(Grid1X.Row, 6)
txtJGF = 0
AddIt = False
End If
End Sub
Private Sub Grid1X_DblClick()
'雙擊將該值送給詳細項目
If Trim(Grid1X.Text) <> "" Then '有物品時
AddIt = True
cmbCode.Text = Grid1X.TextMatrix(Grid1X.Row, 1)
txtPingyin = Grid1X.TextMatrix(Grid1X.Row, 2)
txtName = Grid1X.TextMatrix(Grid1X.Row, 3)
txtSL = 1
txtDJ = Grid1X.TextMatrix(Grid1X.Row, 4)
txtUnit = Grid1X.TextMatrix(Grid1X.Row, 5)
txtType = Grid1X.TextMatrix(Grid1X.Row, 6)
txtJGF = 0
If cmdAdd.Enabled = True Then cmdAdd.Value = True
AddIt = False
End If
End Sub
Private Sub txtBXF_Change()
If txtBXF.Text = "" Then
txtBXF = 0
End If
End Sub
Private Sub Grid1X_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
'回車時
Call Grid1X_DblClick
End If
End Sub
Private Sub txtDH_Change()
If Trim(txtDH.Text) = sDNumber Then '單號相等時
cmdSave.Enabled = False
ElseIf Trim(txtDH.Text) <> "" Then
cmdSave.Enabled = True
End If
End Sub
Private Sub txtJGF_Change()
If txtJGF.Text = "" Then
txtJGF = 0
End If
End Sub
Private Sub txtPingyin_Change()
If AddIt = False Then
sGlobalType = ""
'Strip1.Tabs.Item("ALL").Selected = True
ConfigPingyin Trim(txtPingyin.Text)
End If
End Sub
Private Sub txtPingyin_LostFocus()
If AddIt = True Then Exit Sub
'檢測編碼是否正確
If Trim(txtPingyin) = "" Then Exit Sub
GetItem "Pingyin"
End Sub
Private Sub txtSl_Change()
If Trim(cmbCode.Text) <> "" And sSite <> "" And Val(txtSL) <> 0 Then
cmdAdd.Enabled = True
Else
cmdAdd.Enabled = False
End If
End Sub
Private Sub ConfigType()
On Error GoTo Err_init
Dim DB As Database
Dim Ef As Recordset, sEXE As String
Set DB = OpenDatabase(ConData, False, False, Constr)
' SQL語言刪除
sEXE = "Select Class From MenuType"
Set Ef = DB.OpenRecordset(sEXE, dbOpenDynaset)
If Ef.EOF And Ef.BOF Then
Strip1.SelectedItem.Key = "Null"
sGlobalType = ""
Else
Ef.MoveFirst
Dim X As Integer
X = 1
Do While Not Ef.EOF
Strip1.Tabs.Add X, Ef.Fields(0), Ef.Fields(0) & "&" & Chr(64 + X)
X = X + 1
Ef.MoveNext
Loop
sGlobalType = Strip1.SelectedItem.Key
End If
Ef.Close
DB.Close
Exit Sub
Err_init:
MsgBox "菜單類型錯誤,不能為數字 ? " & Err.Description, vbExclamation, "錯誤:By Yusilong."
End Sub
Private Sub Strip1_Click()
'選擇類別
sGlobalType = Strip1.SelectedItem.Key
If sGlobalType = "ALL" Then sGlobalType = ""
ConfigGridX ""
End Sub
Private Sub AddItItem()
'檢測一些項目
If Trim(cmbCode) = "" Then
MsgBox "請輸入物品編碼,否則不能錄入! ", vbInformation
cmbCode.SetFocus
Exit Sub
End If
If Trim(txtPingyin) = "" Then
MsgBox "請輸入物品拼音碼,否則不能錄入! ", vbInformation
txtPingyin.SetFocus
Exit Sub
End If
If Trim(txtName) = "" Then
MsgBox "請輸入物品名稱,否則不能錄入! ", vbInformation
txtName.SetFocus
Exit Sub
End If
If Val(txtSL) = 0 Then
MsgBox "請輸入物品數量,否則不能錄入! ", vbInformation
txtSL.SetFocus
Exit Sub
End If
If Trim(txtDJ) = "" Then
MsgBox "請輸入物品單價,如果沒有請輸入0! ", vbInformation
txtDJ.SetFocus
Exit Sub
End If
If Trim(txtJGF) = "" Then
MsgBox "請輸入物品加工費,如果沒有請輸入0! ", vbInformation
txtJGF.SetFocus
Exit Sub
End If
'添加
Dim DB As Database
Dim Ef As Recordset
Dim sTmp As String
DBEngine.BeginTrans '事務開始
'-------------------------------------------
Set DB = OpenDatabase(ConData, 0, 0, Constr)
Set Ef = DB.OpenRecordset("Select * From tmpTodayCust", dbOpenDynaset)
sTmp = "CID='" & Trim(cmbCode) & "'"
Ef.AddNew
Ef.Fields("Site") = sSite
Ef.Fields("Name") = Trim(txtName)
Ef.Fields("CID") = Trim(cmbCode)
Ef.Fields("Pingyin") = Trim(txtPingyin)
Ef.Fields("Unit") = Trim(txtUnit)
Ef.Fields("Price") = CCur(txtDJ)
Ef.Fields("Quanty") = -Val(txtSL)
Ef.Fields("JGF") = CCur(txtJGF)
Ef.Fields("Amo") = Round(Ef.Fields("Quanty") * Ef.Fields("Price"), 0) '不包括加工費 ,以后直接打折
Ef.Fields("Amos") = Round(Ef.Fields("JGF") + Ef.Fields("Amo")) '合計金額=加工費+總額
Ef.Fields("DType") = sDType '單類型
Ef.Fields("DNumber") = sDNumber '單號
Ef.Fields("Date") = Date
Ef.Update
Ef.Close
DB.Close '事務結束
'---------------------------------------------
DBEngine.CommitTrans
RefreshIt '刷新菜單列表
cmbCode.Text = "": txtName = "": txtPingyin = ""
txtSL = "": txtUnit = "": txtDJ = 0: txtJGF = 0
txtType = ""
If AddIt = False Then cmbCode.SetFocus
AddIt = False
End Sub
Private Sub RefreshIt()
ConfigGrid1 sSite
End Sub
Private Sub DelRecord(sWP As String, sFields As String, sTable As String)
On Error GoTo Err_init
Dim DB As Database
Dim sEXE As String
Set DB = OpenDatabase(ConData, False, False, Constr)
' SQL語言刪除
sEXE = "Delete * From " & sTable & " Where " & sFields & "=" & sWP
DBEngine.BeginTrans ' 進行事務操作
DB.Execute sEXE
DBEngine.CommitTrans
DB.Close
Exit Sub
Err_init:
MsgBox "記錄刪除錯誤! " & vbCrLf & vbCrLf & Err.Description, vbCritical
End Sub
Private Sub GetItem(sType As String)
On Error Resume Next
Dim DB As Database
Dim Ef As Recordset
Set DB = OpenDatabase(ConData, 0, 0, Constr)
Select Case sType
Case "ID"
Set Ef = DB.OpenRecordset("Select * From EatList Where 代碼='" & Trim(cmbCode) & "'", dbOpenDynaset)
If Ef.BOF And Ef.EOF Then '沒有該記錄時
MsgBox "請輸入正確的菜單編碼! ", vbExclamation
cmbCode.Text = ""
cmbCode.SetFocus
Else
'給出各個項的值
txtPingyin = Ef.Fields("Pingyin")
txtName = Ef.Fields("名稱")
txtSL = 1
txtDJ = Ef.Fields("單價")
txtUnit = Ef.Fields("單位")
txtType = Ef.Fields("MenuType")
'txtSL.SetFocus '修改數量
End If
Case Else
Set Ef = DB.OpenRecordset("Select * From EatList Where Pingyin='" & Trim(txtPingyin) & "'", dbOpenDynaset)
If Ef.BOF And Ef.EOF Then '沒有該記錄時
Ef.Close
DB.Close
MsgBox "請輸入正確的拼音碼! ", vbExclamation
txtPingyin.Text = ""
txtPingyin.SetFocus
Else
'給出各個項的值
cmbCode = Ef.Fields("代碼")
txtName = Ef.Fields("名稱")
txtSL = 1
txtDJ = Ef.Fields("單價")
txtUnit = Ef.Fields("單位")
txtType = Ef.Fields("MenuType")
'txtSL.SetFocus '修改數量
End If
End Select
Ef.Close
DB.Close
End Sub
Private Sub ConfigPingyin(sCode As String)
On Error GoTo Err_init
Grid1X.Visible = False
Grid1X.Clear
Grid1X.Cols = 7
Grid1X.FormatString = "^ .. |^ 編碼 |^ 拼音 |^ 菜名 |^ 單價 |^ 單位 |^ 類型"
Grid1X.ColWidth(0) = 300
Grid1X.ColWidth(1) = 1200
Grid1X.ColWidth(2) = 1200
Grid1X.ColWidth(3) = 1200
Grid1X.ColWidth(4) = 1000
Grid1X.ColWidth(5) = 600
Grid1X.ColWidth(6) = 1000
Dim sSQL As String
If sGlobalType = "" Then
If sCode <> "" Then
sSQL = "Select * From EatList Where (Pingyin Like '" & sCode & "*') Order By Pingyin"
Else
sSQL = "Select * From EatList Order By Pingyin"
End If
Else
If sCode <> "" Then
sSQL = "Select * From EatList Where (Pingyin Like '" & sCode & "*' And MenuType='" & sGlobalType & "') Order By Pingyin"
Else
sSQL = "Select * From EatList Where MenuType='" & sGlobalType & "' Order By Pingyin"
End If
End If
Dim DB As Database, Ef As Recordset, HH As Integer, DelNO As Long
Dim shiftStr As String, shiftStrL As String, shiftStrR As String, shiftNum As Integer, ili As Integer, tempStr As String, SureStr As String, Qy As Integer
Set DB = OpenDatabase(ConData, False, False, Constr)
Set Ef = DB.OpenRecordset(sSQL, dbOpenDynaset)
If Ef.EOF And Ef.BOF Then
DelNO = 0
Else
Do While Not Ef.EOF
DelNO = DelNO + 1
Ef.MoveNext
Loop
End If
Grid1X.Rows = DelNO + 1
If Grid1X.Rows < 28 Then
Grid1X.Rows = 28
End If
If DelNO > 0 Then
Ef.MoveFirst '返回第一
HH = 1
Do While Not Ef.EOF()
Grid1X.Row = HH
Grid1X.Col = 0
Grid1X.CellAlignment = 4
If Not IsNull(Ef.Fields("ID").Value) Then
Grid1X.Text = Ef.Fields("ID").Value
End If
Grid1X.Row = HH
Grid1X.Col = 1
Grid1X.CellAlignment = 1
If Not IsNull(Ef.Fields("代碼").Value) Then
Grid1X.Text = Ef.Fields("代碼").Value
End If
Grid1X.Row = HH
Grid1X.Col = 2
Grid1X.CellAlignment = 1
If Not IsNull(Ef.Fields("Pingyin").Value) Then
Grid1X.Text = Ef.Fields("Pingyin").Value
End If
Grid1X.Row = HH
Grid1X.Col = 3
Grid1X.CellAlignment = 1
If Not IsNull(Ef.Fields("名稱").Value) Then
Grid1X.Text = Ef.Fields("名稱").Value
End If
Grid1X.Row = HH
Grid1X.Col = 4
Grid1X.CellAlignment = 1
If Not IsNull(Ef.Fields("單價").Value) Then
Grid1X.Text = Ef.Fields("單價").Value
End If
Grid1X.Row = HH
Grid1X.Col = 5
Grid1X.CellAlignment = 1
If Not IsNull(Ef.Fields("單位").Value) Then
Grid1X.Text = Ef.Fields("單位").Value
End If
Grid1X.Row = HH
Grid1X.Col = 6
Grid1X.CellAlignment = 1
If Not IsNull(Ef.Fields("MenuType").Value) Then
Grid1X.Text = Ef.Fields("MenuType").Value
End If
Ef.MoveNext
HH = HH + 1
Loop
Ef.Close
DB.Close
End If
Grid1X.Col = 1
Grid1X.Row = 1
Grid1X.ColSel = 6
Grid1X.Visible = True
Exit Sub
Err_init:
MsgBox "網絡配置錯誤! " & vbCrLf & vbCrLf & Err.Description, vbCritical
End Sub
Private Sub SaveIt(sType As String)
Dim DB As Database
Dim sTmp As String
Dim cDCJE As Currency, cDCJGF '點菜金額
'保存退單記錄
DBEngine.BeginTrans
Set DB = OpenDatabase(ConData, 0, 0, Constr)
sTmp = "Insert Into TodayCust Select * From tmpTodayCust"
DB.Execute sTmp
sTmp = "Delete * From tmpTodayCust"
DB.Execute sTmp
DB.Close
DBEngine.CommitTrans
End Sub
Private Sub txtSL_LostFocus()
If txtSL.Text = "" Then
txtSL = 1
Exit Sub
End If
If Val(txtSL.Text) = "0" Then
txtSL = 1
Exit Sub
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -