📄 frmback.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmBack
Caption = "退 货"
ClientHeight = 8175
ClientLeft = 165
ClientTop = 555
ClientWidth = 11880
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmBack.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
ScaleHeight = 8175
ScaleWidth = 11880
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txtNum
Appearance = 0 'Flat
Height = 315
Left = 5040
TabIndex = 15
Text = "txtnum"
Top = 4440
Width = 1965
End
Begin VB.TextBox txtZ
Enabled = 0 'False
Height = 315
Left = 7620
TabIndex = 14
Top = 900
Width = 495
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 285
Left = 0
TabIndex = 4
Top = 7890
Width = 11880
_ExtentX = 20955
_ExtentY = 503
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 3
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 1411
MinWidth = 1411
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 17639
MinWidth = 17639
Text = "结款-Enter 整单作废-F4 删除指定商品-F5 更改商品数量-F8 重新输入单据号-F9 退出-F12"
TextSave = "结款-Enter 整单作废-F4 删除指定商品-F5 更改商品数量-F8 重新输入单据号-F9 退出-F12"
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Style = 2
TextSave = "NUM"
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox txtID
Height = 315
Left = 1380
TabIndex = 0
Top = 870
Width = 2385
End
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 5295
Left = 30
TabIndex = 5
Top = 1560
Width = 11805
_ExtentX = 20823
_ExtentY = 9340
_Version = 393216
Cols = 10
FixedCols = 0
RowHeightMin = 315
BackColorBkg = -2147483633
AllowBigSelection= 0 'False
SelectionMode = 1
Appearance = 0
FormatString = "序号|^ 商品编号|^ 商品名称|^ 规格|^ 生产企业|^ 单位|^ 单价|^ 折扣|^ 折扣后单价|^ 合计金额"
End
Begin VB.Label Label3
Caption = "整单折扣:"
Height = 210
Left = 6600
TabIndex = 13
Top = 960
Width = 1050
End
Begin VB.Label lbl
Height = 255
Left = 2280
TabIndex = 12
Top = 6930
Width = 9405
End
Begin VB.Label Label9
Caption = "退还金额:"
Height = 210
Index = 1
Left = 8610
TabIndex = 11
Top = 930
Width = 1050
End
Begin VB.Label Label4
Caption = "¥"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 9630
TabIndex = 10
Top = 900
Width = 255
End
Begin VB.Label lblSums
Caption = "0.00"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 9990
TabIndex = 9
Top = 900
Width = 1515
End
Begin VB.Label Label9
Caption = "合计金额:"
Height = 210
Index = 0
Left = 4200
TabIndex = 8
Top = 930
Width = 945
End
Begin VB.Label Label10
Caption = "¥"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 5220
TabIndex = 7
Top = 900
Width = 255
End
Begin VB.Label lblSum
Caption = "0.00"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 5580
TabIndex = 6
Top = 900
Width = 1515
End
Begin VB.Line Line6
BorderColor = &H00C0C0C0&
X1 = 30
X2 = 11940
Y1 = 7260
Y2 = 7260
End
Begin VB.Label lblUser
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 285
Left = 9810
TabIndex = 3
Top = 90
Width = 1815
End
Begin VB.Label Label2
Caption = "营业员"
Height = 210
Left = 9090
TabIndex = 2
Top = 150
Width = 630
End
Begin VB.Line Line5
BorderColor = &H00FFFFFF&
X1 = 0
X2 = 11880
Y1 = 450
Y2 = 450
End
Begin VB.Line Line4
BorderColor = &H00C0C0C0&
X1 = 11610
X2 = 11610
Y1 = 600
Y2 = 1380
End
Begin VB.Line Line3
BorderColor = &H00C0C0C0&
X1 = 270
X2 = 11610
Y1 = 1380
Y2 = 1380
End
Begin VB.Line Line2
BorderColor = &H00FFFFFF&
X1 = 240
X2 = 240
Y1 = 600
Y2 = 1380
End
Begin VB.Line Line1
BorderColor = &H00FFFFFF&
X1 = 240
X2 = 11640
Y1 = 600
Y2 = 600
End
Begin VB.Label Label1
Caption = "单据号"
Height = 210
Left = 630
TabIndex = 1
Top = 930
Width = 630
End
End
Attribute VB_Name = "frmBack"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Me.Left = 0
Me.Top = 0
txtNum.Visible = False
txtNum.Text = ""
txtNum.Width = 800 + 10
txtNum.Left = Grid.Left + 7700 + 10
lblUser.Caption = UserName
Call ReSet
Grid.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmBack = Nothing
End Sub
Private Sub Grid_KeyUp(KeyCode As Integer, Shift As Integer)
Dim I As Integer
Select Case KeyCode
Case vbKeyReturn
Dim K As Boolean
K = BackFoot(lblSum.Caption, lblsums.Caption)
If K = False Then Exit Sub
Dim Cmd As ADODB.Command
Dim SQL As String
Conn.BeginTrans
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
For I = 1 To Grid.Rows - 1
SQL = "insert into back_tmp values('" & txtID.Text & "','" & _
Grid.TextMatrix(I, 1) & "'," & Grid.TextMatrix(I, 7) & ")"
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute
Next
SQL = "execute backing '" & txtID.Text & "','" & Format(Date$, "yyyy-mm-dd") & "','" _
& Format(Time$, "hh:mm:ss") & "'," & lblSum.Caption & "," & lblsums.Caption & ",'" & UserName & "'"
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute
Conn.CommitTrans
Call ReSet
txtID.Text = ""
Case vbKeyF4
Grid.Clear
Grid.Rows = 1
Grid.FormatString = "序号|^ 商品编号|^ 商品名称|^ 规格|^ 生产企业|^ 单位|^ 单价|^ 数量|^ 折扣|^ 折后单价|^ 合计金额"
Grid.ColWidth(0) = 500
Grid.ColWidth(1) = 1600
Grid.ColWidth(2) = 1800
Grid.ColWidth(3) = 1000
Grid.ColWidth(4) = 1200
Grid.ColWidth(5) = 600
Grid.ColWidth(6) = 1000
Grid.ColWidth(7) = 800
Grid.ColWidth(8) = 600
Grid.ColWidth(9) = 1000
Grid.ColWidth(10) = 1600
lblsums.Caption = lblSum.Caption
Case vbKeyF5
lblsums.Caption = Format(CStr(Val(lblsums.Caption) + Val(Grid.TextMatrix(Grid.RowSel, 10))), ".00")
Grid.RemoveItem Grid.RowSel
Case vbKeyF8
If Grid.Rows = 1 Then Exit Sub
txtNum.Top = Grid.Top + Grid.RowHeight(Grid.RowSel) * Grid.RowSel + 5
txtNum.Visible = True
txtNum.SetFocus
txtNum.Text = Grid.TextMatrix(Grid.RowSel, 7)
txtNum.SelStart = 0
txtNum.SelLength = Len(txtNum.Text)
txtNum.Locked = False
Grid.Enabled = False
Case vbKeyF9
Call ReSet
Case vbKeyF12
Unload Me
End Select
End Sub
Private Sub txtID_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 35 And KeyAscii <> 8 Then KeyAscii = 0
End Sub
Private Sub txtID_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If txtID.Text = "" Then Exit Sub
Dim Rst As ADODB.Recordset
Dim SQL As String
Dim I As Integer
Dim J As Integer
SQL = "select * from sell_index where id='" & txtID.Text & "'"
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
Rst.Open SQL, Conn, adOpenDynamic, adLockReadOnly, adCmdText
If Rst.EOF Then MsgBox "查询不到此单据号。请查看单据号输入是否有误!", 64: Exit Sub
txtID.Enabled = False
lblSum.Caption = Format(Rst.Fields("sellsums"), "0.00")
txtZ.Text = Rst.Fields("zhekou")
SQL = "select yaopin_id,b.name,b.guige,b.changjia,a.unit,a.price,a.num,a.zhekou,a.sellprice,a.sellprice * a.num as sums " & _
" from sell_list as a,yaopin_list as b where a.id='" & txtID.Text & "' and a.yaopin_id=b.id"
Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
Rst.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
If Rst.EOF Then MsgBox "查询出错!": Exit Sub
For I = 1 To Rst.RecordCount
Grid.Rows = Grid.Rows + 1
Grid.TextMatrix(Grid.Rows - 1, 0) = CStr(I)
For J = 1 To 10
Grid.TextMatrix(Grid.Rows - 1, J) = Rst.Fields(J - 1)
Next
Rst.MoveNext
Next
Rst.Close
Set Rst = Nothing
Grid.Enabled = True
Grid.SetFocus
ElseIf KeyCode = vbKeyF12 Then
Unload Me
End If
End Sub
Private Sub txtNum_KeyPress(KeyAscii As Integer)
If (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 Then KeyAscii = 0
End Sub
Private Sub txtNum_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
Dim SumCash As Currency
Dim I As Integer
I = Val(Grid.TextMatrix(Grid.RowSel, 7)) - Val(txtNum.Text)
If I <= 0 Then Exit Sub
Grid.TextMatrix(Grid.RowSel, 7) = txtNum.Text
Grid.TextMatrix(Grid.RowSel, 10) = Format(CStr(Val(Grid.TextMatrix(Grid.RowSel, 9) * Val(txtNum.Text))), ".00")
lblsums.Caption = Format(CStr(Val(lblsums.Caption) + Val(Grid.TextMatrix(Grid.RowSel, 9)) * I), ".00")
txtNum.Visible = False
txtNum.Text = ""
Grid.Enabled = True
Grid.SetFocus
Case vbKeyEscape
txtNum.Visible = False
txtNum.Text = ""
Grid.Enabled = True
Grid.SetFocus
End Select
End Sub
Private Sub ReSet()
Grid.Clear
Grid.Rows = 1
Grid.FormatString = "序号|^ 商品编号|^ 商品名称|^ 规格|^ 生产企业|^ 单位|^ 单价|^ 数量|^ 折扣|^ 折后单价|^ 合计金额"
Grid.ColWidth(0) = 500
Grid.ColWidth(1) = 1600
Grid.ColWidth(2) = 1800
Grid.ColWidth(3) = 1000
Grid.ColWidth(4) = 1200
Grid.ColWidth(5) = 600
Grid.ColWidth(6) = 1000
Grid.ColWidth(7) = 800
Grid.ColWidth(8) = 600
Grid.ColWidth(9) = 1000
Grid.ColWidth(10) = 1600
lblSum.Caption = "0.00"
lblsums.Caption = "0.00"
txtID.Enabled = True
txtID.SelStart = 1
txtID.SelLength = Len(txtID.Text)
Grid.Enabled = False
'
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -