📄 frmyzlxiugai.frm
字号:
VERSION 5.00
Begin VB.Form frmYZLXiugai
Caption = "修改"
ClientHeight = 5625
ClientLeft = 5175
ClientTop = 5130
ClientWidth = 9360
LinkTopic = "Form1"
ScaleHeight = 5625
ScaleWidth = 9360
Begin VB.TextBox txtNum
Height = 375
Left = 6000
MaxLength = 6
TabIndex = 12
Top = 4365
Width = 1455
End
Begin VB.Frame Frame1
Caption = "商品详情"
Height = 2415
Left = 720
TabIndex = 2
Top = 480
Width = 7815
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "销售单价:"
Height = 180
Left = 4440
TabIndex = 10
Top = 1600
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "销售单位:"
Height = 180
Left = 360
TabIndex = 9
Top = 1600
Width = 900
End
Begin VB.Label lable
AutoSize = -1 'True
Caption = "商品规格:"
Height = 180
Left = 4440
TabIndex = 8
Top = 640
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "商品名:"
Height = 180
Left = 360
TabIndex = 7
Top = 640
Width = 720
End
Begin VB.Label lblGoodsname
BeginProperty Font
Name = "黑体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 1440
TabIndex = 6
Top = 480
Width = 2175
End
Begin VB.Label lblSpec
BeginProperty Font
Name = "黑体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 615
Left = 5520
TabIndex = 5
Top = 480
Width = 1935
End
Begin VB.Label lblUnit
BeginProperty Font
Name = "黑体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 1440
TabIndex = 4
Top = 1440
Width = 2055
End
Begin VB.Label lblOutprice
BeginProperty Font
Name = "黑体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 5520
TabIndex = 3
Top = 1440
Width = 2055
End
End
Begin VB.TextBox txtId
Height = 375
Left = 2160
MaxLength = 7
TabIndex = 1
Top = 4365
Width = 1455
End
Begin VB.Label lbl
Height = 255
Left = 4200
TabIndex = 15
Top = 3360
Width = 735
End
Begin VB.Label lblNum
BeginProperty Font
Name = "Trebuchet MS"
Size = 26.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 615
Left = 2280
TabIndex = 14
Top = 3105
Width = 1575
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "购买数量:"
Height = 180
Left = 1080
TabIndex = 13
Top = 3360
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "数量:"
Height = 180
Left = 5280
TabIndex = 11
Top = 4485
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "商品号:"
Height = 180
Left = 1200
TabIndex = 0
Top = 4485
Width = 720
End
End
Attribute VB_Name = "frmYZLXiugai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lName As String
Dim lSpec As String
Dim lUnit As String
Dim lPrice As Single '单品售价
Dim lNum As Integer
Dim lOutprice As Single '销售详情单中此单品的总价
Private Function KPress(Kascii As Integer) As Integer
If ((Kascii > 47 And Kascii < 58) Or Kascii = 8 Or Kascii = 13) Then
KPress = Kascii
Exit Function
Else
Kascii = 0
End If
KPress = Kascii
End Function
Private Sub txtID_KeyPress(KeyAscii As Integer)
Dim strsql As String
KeyAscii = KPress(KeyAscii)
If KeyAscii = 13 Then
If txtId.Text = "" Then
MsgBox "请先输入要修改的商品号!", vbExclamation
txtId.SetFocus
Exit Sub
End If
Dim strsql As String
strsql = "select goodsid,num,outprice from t_sdetail where goodsid='g" & Trim(txtId.Text) & "' and saleid='" & Trim(frmYZLSale.txtSaleID.Text) & "'"
Dblink.executeSQL (strsql)
If Dblink.rs.RecordCount = 0 Then
MsgBox "销售清单中无此商品,请核对后重新输入!", vbExclamation
txtId.SetFocus
txtId.SelStart = 0
txtId.SelLength = 10
Exit Sub
Else
lOutprice = Dblink.rs.Fields(2).Value
lNum = Dblink.rs.Fields(1).Value
lblNum.Caption = lNum
strsql = "select goodsname,spec,unit from t_goods where goodsid='g" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql)
lName = Dblink.rs.Fields(0).Value
lSpec = Dblink.rs.Fields(1).Value
lUnit = Dblink.rs.Fields(2).Value
lblGoodsname.Caption = lName
lblSpec.Caption = lSpec
lblUnit.Caption = lUnit
lbl.Caption = lUnit
strsql = "select outprice from t_price where goodsid='g" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql)
lPrice = Dblink.rs.Fields(0).Value
lblOutprice.Caption = lPrice
txtNum.SetFocus
End If
End If
End Sub
Private Sub txtNum_KeyPress(KeyAscii As Integer)
Dim strsql As String
Dim x As Integer
KeyAscii = KPress(KeyAscii)
If KeyAscii = 13 Then
x = Val(txtNum.Text)
Select Case x
Case 0
Dim resPonse
resPonse = MsgBox("要删除此销售清单中的此单品吗?", vbOKCancel + vbQuestion, "删除定单")
If resPonse = 1 Then '确定删除
strsql = "delete t_sdetail where saleid='" & Trim(frmYZLSale.txtSaleID.Text) & "' and goodsid='g" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql)
strsql = "update t_market set num=num+" & Val(lblNum.Caption) & " where goodsid='g" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql) '修改相应库存
Call YZLRefMSHFlexGrid(frmYZLSale, "select goodsid '商品号',goodsname '商品名称',unit '销售单位',num '购买数量',outprice '单品总价' from t_sdetail where saleid='" & Trim(frmYZLSale.txtSaleID.Text) & "'")
frmYZLSale.lblSum.Caption = Val(frmYZLSale.lblSum.Caption) - lOutprice
Unload Me
Else
txtNum.SetFocus
txtNum.SelStart = 0
txtNum.SelLength = 7
Exit Sub
End If
Case Is > lNum
MsgBox "修改后数字大于购买数字,请重新输入!", vbExclamation
txtNum.SetFocus
txtNum.SelStart = 0
txtNum.SelLength = 7
Exit Sub
Case Else
strsql = "update t_sdetail set num=" & x & ",outprice=" & x & "*" & lPrice & " where saleid='" & Trim(frmYZLSale.txtSaleID.Text) & "' and goodsid='g" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql)
strsql = "update t_market set num=num+" & Val(lblNum.Caption) & "-" & Val(txtNum.Text) & " where goodsid='g" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql)
Call YZLRefMSHFlexGrid(frmYZLSale, "select goodsid '商品号',goodsname '商品名称',unit '销售单位',num '购买数量',outprice '单品总价' from t_sdetail where saleid='" & Trim(frmYZLSale.txtSaleID.Text) & "'")
frmYZLSale.lblSum.Caption = Val(frmYZLSale.lblSum.Caption) - (lNum - x) * lPrice
Unload Me
End Select
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -