📄 frmrestourant.frm
字号:
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 7
Left = 5760
TabIndex = 14
Top = 3120
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Price"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 6
Left = 4800
TabIndex = 13
Top = 3120
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Item No."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 5
Left = 480
TabIndex = 12
Top = 3120
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Total"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 4
Left = 360
TabIndex = 10
Top = 2280
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Qty."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 3
Left = 360
TabIndex = 9
Top = 1800
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Price"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 3480
TabIndex = 8
Top = 1800
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Item Name"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 3480
TabIndex = 7
Top = 1320
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Item No."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 360
TabIndex = 6
Top = 1320
Width = 975
End
End
Attribute VB_Name = "FrmRestourant"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MyDb As Database, MyRs As Recordset ' for items dealing
Dim MyDb2 As Database, MyRs2 As Recordset ' for item menu
Dim MyDb3 As Database, MyRs3 As Recordset ' for sales record
Dim FS, SL
Const Reading = 1, Writing = 2
Private Sub Command1_Click()
Set MyDb3 = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\RESTO\RESTO.MDB")
Set MyRs3 = MyDb3.OpenRecordset("RESTO", dbOpenDynaset)
If Option1.Value = True Then
MyRs3.AddNew
MyRs3!ITEMNO = Text1.Text
MyRs3!ITEMNAME = Text2.Text
MyRs3!Rate = Text4.Text
MyRs3!QTY = Text3.Text
MyRs3!AM0UNT = Text5.Text
MyRs3!BILLNO = Text22.Text
MyRs3!Month = Format(Date, "MM")
MyRs3!Date = Format(Date, "DD")
MyRs3!Year = Format(Date, "YY")
MyRs3!PRINT = "NOTDONE"
MyRs3!PRINTDUPLICATE = "NOTDONE"
MyRs3.Update
ElseIf Option2.Value = True Then
MyRs3.AddNew
MyRs3!CUSTOMERNO = Text9.Text
MyRs3!CUSTOMERNAME = Text11.Text
MyRs3!ROOMNO = Text10.Text
MyRs3!ADDRESS = Text13.Text
MyRs3!ITEMNO = Text1.Text
MyRs3!ITEMNAME = Text2.Text
MyRs3!Rate = Text4.Text
MyRs3!QTY = Text3.Text
MyRs3!AM0UNT = Text5.Text
MyRs3!BILLNO = Text22.Text
MyRs3!Month = Format(Date, "MM")
MyRs3!Date = Format(Date, "DD")
MyRs3!Year = Format(Date, "YY")
MyRs3!PRINT = "NOTDONE"
MyRs3!PRINTDUPLICATE = "NOTDONE"
MyRs3.Update
MyRs.AddNew
MyRs!SL = Text9.Text
MyRs!Name = Text11.Text
MyRs!ADDRESS = Text13.Text
MyRs!ARRIVAL = Text17.Text
MyRs!ROOMNO = Text10.Text
MyRs!restitem = Text2.Text
MyRs!itemprice = Text4.Text
MyRs!RESTDATE = Format(Date, "DD/MM/YY")
MyRs!RESTTIME = Time
MyRs.Update
End If
StockCal
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command2_Click()
quest = MsgBox("You are about to close. Do you want to keep the same no of bill. If no then the bill no will be change.", vbYesNo + vbInformation)
If quest = vbYes Then
Unload Me
Exit Sub
Else
Open "D:\HOTEL\BILLNO.TXT" For Output As #1
Print #1, Text22.Text
Close #1
Unload Me
End If
End Sub
Private Sub Command3_Click()
Open "D:\HOTEL\BILLNO.TXT" For Output As #1
Print #1, Text22.Text
Close #1
FrmPrintRest.Text4.Text = Text22.Text
FrmPrintRest.Show
Unload Me
End Sub
Private Sub Command4_Click()
List6_DblClick
End Sub
Private Sub Form_Load()
Me.Left = MDIForm1.Left + 1000
Me.Top = MDIForm1.Top + 1000
Me.Width = 6960
On Error Resume Next
Set MyDb2 = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\ITEMS\ITEMS.MDB")
Set MyRs2 = MyDb2.OpenRecordset("ITEMS", dbOpenDynaset)
Do While Not MyRs2.EOF
List7.AddItem MyRs2!ITEMNO
List8.AddItem MyRs2!ITEMNAME
List9.AddItem MyRs2!Rate
MyRs2.MoveNext
Loop
MyDb2.Close
Set FS = CreateObject("Scripting.FileSystemObject")
Set SL = FS.OpenTextFile("D:\HOTEL\BILLNO.TXT", Reading)
Text22.Text = SL.READALL
SL.Close
Text22.Text = Val(Text22.Text) + 1
SQL = "select * from CUSTOMER where ID='" & "YES" & "'"
Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\CUSTOMER\CUSTOMER.MDB")
Set MyRs = MyDb.OpenRecordset(SQL, dbOpenDynaset)
If MyRs.RecordCount <= 0 Then
Exit Sub
Else
Do While Not MyRs.EOF
List6.AddItem MyRs!SL
MyRs.MoveNext
Loop
End If
MyDb.Close
End Sub
Private Sub List6_DblClick()
On Error Resume Next
Text9.Text = ""
Text13.Text = ""
Text11.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text10.Text = ""
SQL = "select * from CUSTOMER where SL='" & List6.Text & "'"
Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\CUSTOMER\CUSTOMER.MDB")
Set MyRs = MyDb.OpenRecordset(SQL, dbOpenDynaset)
Text9.Text = MyRs!SL
Text13.Text = MyRs!ADDRESS
Text11.Text = MyRs!Name
Text14.Text = MyRs!TEL
Text15.Text = MyRs!EMAIL
Text16.Text = MyRs!REGDATE
Text17.Text = MyRs!ARRIVAL
Text18.Text = MyRs!TYPEOFROOM
Text19.Text = MyRs!NOOFDAYS
Text10.Text = MyRs!ROOMNO
Frame1.Visible = False
Me.Width = 6960
Text1.SetFocus
End Sub
Private Sub List7_Click()
SQL = "select * from ITEMS where ITEMNO='" & List7.Text & "'"
Set MyDb2 = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\ITEMS\ITEMS.MDB")
Set MyRs2 = MyDb2.OpenRecordset(SQL, dbOpenDynaset)
If MyRs2!closingstock <= 0 Then
MsgBox "This Stock is Empty."
Exit Sub
End If
Text1.Text = MyRs2!ITEMNO
Text2.Text = MyRs2!ITEMNAME
Text4.Text = MyRs2!Rate
List8.ListIndex = List7.ListIndex
List9.ListIndex = List7.ListIndex
End Sub
Private Sub StockCal()
MyRs2.Edit
MyRs2!closingstock = Val(MyRs2!closingstock) - Val(Text3.Text)
MyRs2.Update
MyRs2.Edit
MyRs2!sold = Val(MyRs2!openingstock) - Val(MyRs2!closingstock)
MyRs2.Update
End Sub
Private Sub List7_DblClick()
Text3.SetFocus
End Sub
Private Sub List7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Option2_Click()
If Option2.Value = True Then
Frame1.Visible = True
Me.Width = 11700
Me.Left = MDIForm1.Width / 2 - 4860
Me.Top = MDIForm1.Height / 2 - 4150
List6.SetFocus
'Frame2.Visible = False
End If
End Sub
Private Sub Text1_Change()
'On Error Resume Next
'Frame2.Visible = True
'List7.SetFocus
'List7.ListIndex = 0
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
List7.SetFocus
'Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text23_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Command1_Click
If Text8.Text = "" Then
Text8.Text = Text5.Text
Else
Text8.Text = Val(Text8.Text) + Val(Text5.Text)
End If
List1.AddItem Text1.Text
List2.AddItem Text2.Text
List3.AddItem Text3.Text
List4.AddItem Text4.Text
List5.AddItem Text5.Text
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text1.SetFocus
End If
End Sub
Private Sub Text3_Change()
Text5.Text = Val(Text4.Text) * Val(Text3.Text)
If MyRs2!closingstock <= Val(Text3.Text) Then
MsgBox "Present stock = " & MyRs2!closingstock
Exit Sub
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text23.SetFocus
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text5.SetFocus
End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text23.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -