📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "POS机收银系统"
ClientHeight = 6555
ClientLeft = 60
ClientTop = 450
ClientWidth = 10470
LinkTopic = "Form1"
ScaleHeight = 6555
ScaleWidth = 10470
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Height = 3255
Left = 5520
ScaleHeight = 3195
ScaleWidth = 4515
TabIndex = 11
Top = 2400
Width = 4575
End
Begin VB.CommandButton Command1
Caption = "合计"
Height = 375
Left = 960
TabIndex = 10
Top = 3240
Width = 1095
End
Begin VB.TextBox Text3
Height = 375
Left = 2640
TabIndex = 7
Top = 4200
Width = 2055
End
Begin VB.TextBox Text2
Height = 375
Left = 2640
TabIndex = 3
Top = 1560
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 2640
TabIndex = 2
Top = 720
Width = 2055
End
Begin VB.Label Label7
Caption = "小票"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 615
Left = 7200
TabIndex = 13
Top = 1920
Width = 1095
End
Begin VB.Label Label6
Height = 375
Left = 2640
TabIndex = 12
Top = 3120
Width = 2055
End
Begin VB.Label Label5
Height = 375
Left = 2640
TabIndex = 9
Top = 5040
Width = 2055
End
Begin VB.Label Label3
Caption = "找零"
Height = 375
Index = 2
Left = 1080
TabIndex = 8
Top = 5040
Width = 1095
End
Begin VB.Label Label3
Caption = "实收金额"
Height = 375
Index = 1
Left = 1080
TabIndex = 6
Top = 4200
Width = 1095
End
Begin VB.Label Label4
Height = 375
Left = 2640
TabIndex = 5
Top = 2520
Width = 2055
End
Begin VB.Label Label3
Caption = "金额"
Height = 375
Index = 0
Left = 1080
TabIndex = 4
Top = 2520
Width = 1095
End
Begin VB.Label Label2
Caption = "数量"
Height = 375
Left = 1080
TabIndex = 1
Top = 1680
Width = 1095
End
Begin VB.Label Label1
Caption = "单价"
Height = 375
Left = 1080
TabIndex = 0
Top = 840
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'操作程序使用说明
'单价、数量、实收金额的值只响应数字输入,当输入非法时,弹出对话框提示重新输入
'输入的过程中,通过使用回车键完成相应的文本框之间的跳换
'单价、数量的文本框可重复使用,相应的数据记录在右面的“小票”框内
'单品输入完成后,按下“合计”按钮进行付款项的操作
Option Explicit
Public a As Double, b As Double, c As Double, c1 As Double, d As Double, e As Double '在文本框输入完数据后,用“回车”键完成相应文本框的跳换
Private Sub Command1_Click()
Label6.Caption = c1
Text3.SetFocus
Picture1.AutoRedraw = True
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.Print "合计"; Label6.Caption & Chr(13);
End Sub
Private Sub Form_Activate()
Text1.SetFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case IsNumeric(Text1.Text) '判断输入的是否为数字
Case True
a = Text1.Text
Text2.SetFocus
Case Else
Text1.Text = ""
MsgBox "请输入数字"
Text1.SetFocus
End Select
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case IsNumeric(Text2.Text) '判断输入的是否为数字
Case True
b = Text2.Text
c = a * b
c1 = c1 + c '计算应付款项
Label4.Caption = c
Picture1.AutoRedraw = True
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.Print "商品", Text1.Text, Text2.Text, Label4.Caption
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Case Else
Text2.Text = ""
MsgBox "请输入数字"
Text2.SetFocus
End Select
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case IsNumeric(Text3.Text) '判断输入的是否为数字
Case True
d = Text3.Text
e = d - c1
If (e < 0) Then
Text3.Text = ""
MsgBox "金额不足!"
Text3.SetFocus
End If
Label5.Caption = e
'Picture1.AutoRedraw = True
Picture1.ForeColor = RGB(255, 0, 0)
Picture1.Print "找零"; Label5.Caption & Chr(13);
Case Else
Text3.Text = ""
MsgBox "请输入正确的金额!"
Text3.SetFocus
End Select
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -