📄 frmyzlamendg.frm
字号:
VERSION 5.00
Begin VB.Form frmYZLAmendG
Caption = "修改单品资料"
ClientHeight = 4290
ClientLeft = 1980
ClientTop = 3390
ClientWidth = 10605
LinkTopic = "Form3"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 4290
ScaleWidth = 10605
Begin VB.CommandButton cmdDel
Caption = "删除此单品"
Height = 375
Left = 4920
TabIndex = 19
Top = 3480
Width = 1335
End
Begin VB.TextBox txtNum
Height = 375
Left = 6840
TabIndex = 16
Top = 2520
Width = 1575
End
Begin VB.CommandButton cmdOK
Caption = "确 定 修 改"
Height = 375
Left = 2880
TabIndex = 15
Top = 3480
Width = 1335
End
Begin VB.CommandButton cmdBack
Caption = "取 消"
Height = 375
Left = 6960
TabIndex = 14
Top = 3480
Width = 1335
End
Begin VB.TextBox txtInprice
Height = 375
Left = 2880
TabIndex = 13
Top = 2520
Width = 1575
End
Begin VB.Frame Frame1
Caption = "商品资料"
Height = 1815
Left = 480
TabIndex = 0
Top = 360
Width = 9615
Begin VB.TextBox txtId
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 6
Top = 360
Width = 1575
End
Begin VB.TextBox txtSpec
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 5
Top = 1080
Width = 1575
End
Begin VB.TextBox txtName
Enabled = 0 'False
Height = 375
Left = 4680
TabIndex = 4
Top = 360
Width = 1575
End
Begin VB.TextBox txtStock
Enabled = 0 'False
Height = 375
Left = 7680
TabIndex = 3
Top = 1080
Width = 1575
End
Begin VB.TextBox txtUnit
Enabled = 0 'False
Height = 375
Left = 4680
TabIndex = 2
Top = 1080
Width = 1575
End
Begin VB.TextBox txtUPC
Enabled = 0 'False
Height = 375
Left = 7680
TabIndex = 1
Top = 360
Width = 1575
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "商品号:"
Height = 180
Left = 240
TabIndex = 12
Top = 480
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "商品规格:"
Height = 180
Left = 240
TabIndex = 11
Top = 1200
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "商品名称:"
Height = 180
Left = 3480
TabIndex = 10
Top = 480
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "现有库存:"
Height = 180
Left = 6720
TabIndex = 9
Top = 1200
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "销售单位:"
Height = 180
Left = 3480
TabIndex = 8
Top = 1200
Width = 900
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "国际码:"
Height = 180
Left = 6720
TabIndex = 7
Top = 480
Width = 720
End
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "进货数量:"
Height = 180
Left = 5640
TabIndex = 18
Top = 2640
Width = 900
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "进货单价:"
Height = 180
Left = 1920
TabIndex = 17
Top = 2640
Width = 900
End
End
Attribute VB_Name = "frmYZLAmendG"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdBack_Click()
Call YZLRefMSHFlexGrid(frmYZLOrdD, "select goodsid '商品号',goodsname '商品名称',upc '国际码',spec '商品规格',unit '销售单位',num '进货数量',inprice '进货单价' from t_orderdetail where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'")
Unload Me
End Sub
Private Sub cmdDel_Click()
Dim he As Single
Dim strsql As String
Dim resPonse
resPonse = MsgBox("确定删除定单中此商品?", vbOKCancel + vbQuestion, "删除单品")
If resPonse = 1 Then '确定删除
strsql = "delete t_orderdetail where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "' and goodsid='" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql)
strsql = "select sum(num*inprice) from t_orderdetail where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'"
Dblink.executeSQL (strsql)
he = Round(Dblink.rs.Fields(0).Value, 2)
strsql = "update t_order set allmoney=" & he & " where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'"
Dblink.executeSQL (strsql)
strsql = "select allmoney from t_order where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'"
Dblink.executeSQL (strsql)
frmYZLOrdD.txtAllmoney.Text = Dblink.rs.Fields(0).Value
Call YZLRefMSHFlexGrid(frmYZLOrdD, "select goodsid '商品号',goodsname '商品名称',upc '国际码',spec '商品规格',unit '销售单位',num '进货数量',inprice '进货单价' from t_orderdetail where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'")
Unload Me
End If
End Sub
Private Sub cmdOk_Click()
If txtId.Text = "" Then
MsgBox "请先选择要添加的商品!", vbInformation
cmbBrand.SetFocus
Exit Sub
End If
If txtInprice.Text = "" Then
MsgBox "请输入此商品的进价!", vbInformation
txtInprice.SetFocus
Exit Sub
End If
If txtNum.Text = "" Then
MsgBox "请输入此商品的进货数量!", vbInformation
txtNum.SetFocus
Exit Sub
End If
Dim strsql As String
Dim he As Single
strsql = "update t_orderdetail set inprice=" & Trim(txtInprice.Text) & ",num=" & Trim(txtNum.Text) & " where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "' and goodsid='" & Trim(txtId.Text) & "'"
Dblink.executeSQL (strsql)
strsql = "select sum(num*inprice) from t_orderdetail where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'"
Dblink.executeSQL (strsql)
he = Round(Dblink.rs.Fields(0).Value, 2)
strsql = "update t_order set allmoney=" & he & " where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'"
Dblink.executeSQL (strsql)
strsql = "select allmoney from t_order where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'"
Dblink.executeSQL (strsql)
frmYZLOrdD.txtAllmoney.Text = Dblink.rs.Fields(0).Value
Call YZLRefMSHFlexGrid(frmYZLOrdD, "select goodsid '商品号',goodsname '商品名称',upc '国际码',spec '商品规格',unit '销售单位',num '进货数量',inprice '进货单价' from t_orderdetail where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "'")
Unload Me
End Sub
Private Sub Form_Load()
Dim strsql As String
strsql = "select goodsid,goodsname,upc,spec,unit,store from t_goods where goodsid='" & Trim(frmYZLOrdD.Text1) & "'"
Dblink.executeSQL (strsql)
txtId.DataField = Dblink.rs.Fields(0).name
Set txtId.DataSource = Dblink.rs
txtName.DataField = Dblink.rs.Fields(1).name
Set txtName.DataSource = Dblink.rs
txtSpec.DataField = Dblink.rs.Fields(3).name
Set txtSpec.DataSource = Dblink.rs
txtUnit.DataField = Dblink.rs.Fields(4).name
Set txtUnit.DataSource = Dblink.rs
txtStock.DataField = Dblink.rs.Fields(5).name
Set txtStock.DataSource = Dblink.rs
txtUPC.DataField = Dblink.rs.Fields(2).name
Set txtUPC.DataSource = Dblink.rs
strsql = "select inprice,num from t_orderdetail where orderid='" & Trim(frmYZLOrdD.txtOrderid.Text) & "' and goodsid='" & Trim(frmYZLOrdD.Text1.Text) & "'"
Dblink.executeSQL (strsql)
txtInprice.Text = Dblink.rs.Fields(0).Value
txtNum.Text = Dblink.rs.Fields(1).Value
Set txtNum.DataSource = Dblink.rs
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call cmdBack_Click
End Sub
Private Sub txtInprice_KeyPress(KeyAscii As Integer) '进价文本框中只能输入数字、小数点和退格
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8 Or KeyAscii = 46) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtNum_KeyPress(KeyAscii As Integer) '进货数量文本框中只能输入数字和退格
If ((KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8) Then
Exit Sub
Else
KeyAscii = 0
End If
End Sub
Private Sub txtInprice_LostFocus()
If Val(txtInprice.Text) > 20000 Then
MsgBox "请检查进价是否正确", vbInformation
txtInprice.SetFocus
Exit Sub
End If
End Sub
Private Sub txtNum_LostFocus()
If Val(txtNum.Text) > 300000 Then
MsgBox "进货单品数量不能超过30万!", vbInformation
txtNum.SetFocus
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -