frmbill.frm

来自「Gestion de una pizza rapida y sencilla」· FRM 代码 · 共 511 行 · 第 1/2 页

FRM
511
字号
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   195
      Left            =   2520
      TabIndex        =   9
      Top             =   1080
      Width           =   405
   End
   Begin VB.Label Label2 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      Caption         =   "DATE"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   195
      Left            =   4200
      TabIndex        =   1
      Top             =   1080
      Width           =   510
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      Caption         =   "BILL NUMBER"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   195
      Left            =   360
      TabIndex        =   0
      Top             =   1080
      Width           =   1260
   End
End
Attribute VB_Name = "FRMBILL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DB As New ADODB.Connection
Dim RS As New ADODB.Recordset
Public KEY As Integer
Private Sub Combo1_Click()
TXTPIZZA.Text = Combo1.Text
RS.Open "PIZZA", DB, 1, 3
A = TXTPIZZA.Text
RS.Find ("PNAME='" & A & " ' ")
TXTUP.Text = RS.Fields("PRICE")
RS.Close
TXTQTY.SetFocus
End Sub

Private Sub Command1_Click()
If TXTPIZZA.Text = "" Then
MsgBox "enter your type of pizza", vbCritical
Combo1.SetFocus
Else
If TXTQTY.Text = "" Then
MsgBox "enter the quantity", vbInformation
TXTQTY.SetFocus
Else
If (KEY = 0) Then
KEY = 1
Else
KEY = KEY + 1
End If
fg1.Rows = KEY + 1
fg1.TextMatrix(KEY, 1) = TXTPIZZA.Text
fg1.TextMatrix(KEY, 2) = TXTQTY.Text
fg1.TextMatrix(KEY, 3) = TXTUP.Text
fg1.TextMatrix(KEY, 4) = TXTTP.Text
TXTPIZZA.Text = ""
TXTQTY.Text = ""
TXTUP.Text = ""
TXTTP.Text = ""
Combo1.Text = ""
Command2.Enabled = True
End If
End If
End Sub

Private Sub Command2_Click()
Dim TOT As Integer
For i = 1 To KEY
TOT = TOT + Val(fg1.TextMatrix(i, 4))
Next i
txtnp.Text = TOT
Command3.Enabled = True
End Sub

Private Sub Command3_Click()
On Error GoTo HAND
X% = MsgBox("CONFORM SAVE", vbYesNo + vbInformation, "EXCUSE ME")
If (X% = vbYes) Then
RS.Open "BILL", DB, 1, 3
For i = 1 To KEY
RS.AddNew
RS.Fields("BILLNO") = Label4.Caption
RS.Fields("PNAME") = fg1.TextMatrix(i, 1)
RS.Fields("PRICE") = fg1.TextMatrix(i, 3)
RS.Fields("TOTPRICE") = fg1.TextMatrix(i, 4)
RS.Update
Next i
RS.Close
RS.Open "BILLMAIN", DB, 1, 3
RS.AddNew
RS.Fields("BILLNO") = Label4.Caption
RS.Fields("DATE") = Label2.Caption
RS.Fields("NP") = txtnp.Text
RS.Update
RS.Close
Form2.LBNO.Caption = Label4.Caption
Form2.LNP.Caption = txtnp.Text
For i = 1 To KEY
Form2.LPIZZA(Form2.LPIZZA.UBound).Caption = fg1.TextMatrix(i, 1)
Form2.LUP(Form2.LUP.UBound).Caption = fg1.TextMatrix(i, 3)
Form2.LQTY(Form2.LQTY.UBound).Caption = fg1.TextMatrix(i, 2)
Form2.LTOT(Form2.LTOT.UBound).Caption = fg1.TextMatrix(i, 4)
If (Form2.LPIZZA.UBound = 0) Then

' Load Form2.LPIZZA(Form2.LPIZZA.UBound + 1)
' Load Form2.LUP(Form2.LUP.UBound + 1)
' Load Form2.LQTY(Form2.LQTY.UBound + 1)
' Load Form2.LTOT(Form2.LTOT.UBound + 1)
' Form2.Line3.Y2 = Form2.Line3.Y2 + 500
' Form2.Line4.Y2 = Form2.Line4.Y2 + 500
' Form2.Line5.Y2 = Form2.Line5.Y2 + 500
' Form2.Line6.Y2 = Form2.Line6.Y2 + 500
' Form2.Line7.Y2 = Form2.Line7.Y2 + 500
' Form2.Frame1.Top = Form2.Frame1.Top + 300
GoTo SA
 End If
 ' PIZZA NAME
Form2.LPIZZA(Form2.LPIZZA.UBound).Left = Form2.LPIZZA(Form2.LPIZZA.UBound - 1).Left
Form2.LPIZZA(Form2.LPIZZA.UBound).Top = Form2.LPIZZA(Form2.LPIZZA.UBound - 1).Top + 250
Form2.LPIZZA(Form2.LPIZZA.UBound).Visible = True
'UNIT PRICE
Form2.LUP(Form2.LUP.UBound).Left = Form2.LUP(Form2.LUP.UBound - 1).Left
Form2.LUP(Form2.LUP.UBound).Top = Form2.LUP(Form2.LUP.UBound - 1).Top + 250
Form2.LUP(Form2.LUP.UBound).Visible = True
'QUANTITY
Form2.LQTY(Form2.LQTY.UBound).Left = Form2.LQTY(Form2.LQTY.UBound - 1).Left
Form2.LQTY(Form2.LQTY.UBound).Top = Form2.LQTY(Form2.LQTY.UBound - 1).Top + 250
Form2.LQTY(Form2.LQTY.UBound).Visible = True
'TOTAL PRICE
Form2.LTOT(Form2.LTOT.UBound).Left = Form2.LTOT(Form2.LTOT.UBound - 1).Left
Form2.LTOT(Form2.LTOT.UBound).Top = Form2.LTOT(Form2.LTOT.UBound - 1).Top + 250
Form2.LTOT(Form2.LTOT.UBound).Visible = True
SA:
 Load Form2.LPIZZA(Form2.LPIZZA.UBound + 1)
 Load Form2.LUP(Form2.LUP.UBound + 1)
 Load Form2.LQTY(Form2.LQTY.UBound + 1)
 Load Form2.LTOT(Form2.LTOT.UBound + 1)
 Form2.Line3.Y2 = Form2.Line3.Y2 + 500
 Form2.Line4.Y2 = Form2.Line4.Y2 + 500
 Form2.Line5.Y2 = Form2.Line5.Y2 + 500
 Form2.Line6.Y2 = Form2.Line6.Y2 + 500
 Form2.Line7.Y2 = Form2.Line7.Y2 + 500
 Form2.Frame1.Top = Form2.Frame1.Top + 300
Next i
Form2.Show
MsgBox "RECORDE SAVED", vbInformation, "VENKY'S PIZZA HOUSE"
Else
MsgBox "SAVE ABORTED", vbCritical, "VENKY'S PIZZA HOUSE"
End If
Command4.Enabled = True
Exit Sub
HAND:
MsgBox Err.Description, vbCritical, "VENKY'S PIZZA HOUSE"
End Sub

Private Sub Command4_Click()
RS.Open "BILLMAIN", DB, 1, 3
TXTPIZZA.Text = ""
TXTQTY.Text = ""
TXTUP.Text = ""
TXTTP.Text = ""
txtnp.Text = ""
fg1.Clear
If (RS.RecordCount = 0) Then
Label4.Caption = 1
Else
RS.MoveLast
Label4.Caption = RS.Fields("BILLNO") + 1
End If
RS.Close
Command4.Enabled = False
Command1.Enabled = True
Command3.Enabled = False
Combo1.Enabled = True
TXTUP.Enabled = truw
TXTQTY.Enabled = True
TXTTP.Enabled = True
End Sub

Private Sub Command5_Click()
Unload Me
End Sub

Private Sub Form_Load()
KEY = 0
DB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\pizza.mdb;Persist Security Info=False"
RS.Open "PIZZA", DB, 1, 3
Label2.Caption = Date
While (RS.EOF = False)
Combo1.AddItem RS.Fields("PNAME")
RS.MoveNext
Wend
Combo1.Enabled = False
TXTUP.Enabled = False
TXTQTY.Enabled = False
TXTTP.Enabled = False
Command3.Enabled = False
RS.Close
End Sub

Private Sub Form_Unload(Cancel As Integer)

DB.Close
frmindex.Show
End Sub

Private Sub TXTQTY_LostFocus()
If (TXTQTY.Text = "") Or IsNumeric(TXTQTY.Text) = False Or TXTQTY.Text <= 0 Then
MsgBox " ENTER THE QUANTITY OR ENTER A NUMERIC TEXT or SHOULD NOT BE LESS THAN ZERO OR EQUAL TO ZERO", vbCritical, "VENKY'S PIZZA HOUSE"
TXTQTY.SetFocus
Else
TXTTP.Text = Val(TXTQTY.Text) * Val(TXTUP.Text)
Command1.Enabled = True
Command1.SetFocus
End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?