form3.frm
来自「VB 编写的"华成POS管理系统",代码全,没有进行测试,数据库全,有兴趣的朋友」· FRM 代码 · 共 241 行
FRM
241 行
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form3
BorderStyle = 4 'Fixed ToolWindow
Caption = "结帐打印"
ClientHeight = 2970
ClientLeft = 45
ClientTop = 390
ClientWidth = 4695
KeyPreview = -1 'True
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2970
ScaleWidth = 4695
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin MSCommLib.MSComm MSComm1
Left = 240
Top = 2640
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
End
Begin VB.Frame Frame1
Height = 2415
Left = 120
TabIndex = 1
Top = 120
Width = 4455
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 6
Top = 1560
Width = 2895
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 0
Top = 960
Width = 2895
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 5
Top = 360
Width = 2895
End
Begin VB.Label Label3
Caption = "找零:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 4
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "收款:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 3
Top = 1080
Width = 855
End
Begin VB.Label Label1
Caption = "应收:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 240
TabIndex = 2
Top = 480
Width = 975
End
End
Begin VB.Label Label4
Caption = "SPACE下一销售,F5打印单据"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1440
TabIndex = 7
Top = 2640
Width = 3015
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sums As Currency
Private Sub Form_Load()
sums = 0
Dim ef As New Recordset
ef.Open "select * from sale where saleno=" & ptno & "", cnMain, 1, 1
If Not (ef.BOF And ef.EOF) Then
Do While Not ef.EOF
sums = sums + ef!saleprice * ef!salenum
ef.MoveNext
Loop
End If
ef.Close
Text1.Text = sums
End Sub
Private Sub Text2_Change()
If Trim(Text2.Text) = "" Then
MsgBox "请输入金额!"
Else
Text3.Text = CCur(Trim(Text2.Text)) - CCur(Trim(Text1.Text))
'CHR(0x1B)+ CHR(0x70)+ CHR(0x0)+CHR(0x3C)+ CHR(0xFF),LPT1;0'钱柜打开命令
Open "LPT1" For Output As #1
Print #1, Chr(27) + "p" + Chr(0) + Chr(60) + Chr(255)
Close #1
End If
'Form1.txtfield(0).SetFocus
'Unload Me
End Sub
Private Sub Printit()
Dim k As Integer
Dim m As Integer
m = (lip - 1) * 20
'lip表格的行数,这是一个公共变量
Printer.Print " " + "POS销售单"
Printer.Print ""
Printer.Print "单号:" + Form1.Text1.Text + " " + "POS机:" + strposno
Printer.Print ""
Printer.Print "名称" + " " + "价格*数量"
Printer.Print "-------------------------------------"
'打印表格的主体部分
For k = 1 To lip - 1
Printer.Print Form1.Grid1.TextMatrix(k, 1) + " " + Form1.Grid1.TextMatrix(k, 2) + "*" + Form1.Grid1.TextMatrix(k, 3)
Next k
'表格主体部分打印结束
Printer.Print "--------------------------------------"
Printer.Print "应付:" + Text1.Text + " " + "付款:" + Text2.Text
Printer.Print "找零:" + Text3.Text
Printer.Print "服务电话:" + dh
Printer.EndDoc
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 32 '保存、打印
If Trim(Text2.Text) = "" Then
MsgBox "请输入金额!"
Else
read
Form1.Text1.Text = Trim(strsno) + 1
Form1.Grid1.Rows = 1
Form1.Txtfield(0).Text = ""
Form1.Label27.Caption = Text1.Text
Form1.Label28.Caption = Text2.Text
Form1.Label29.Caption = Text3.Text
Unload Me
End If
Case 116
Printit
End Select
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?