📄 add_backgoods.frm
字号:
bigunit.text = Trim(.Fields("bigunit")) '大单位
presetprice.text = Trim(.Fields("presetprice")) '预设进价
goodsname1.text = Trim(.Fields("goodsid")) '商品编号
Else
Exit Sub
End If
Dim retg As Boolean
retg = m_backgoodsDAO.judeg_backgoodsdetail(m_recordset, Trim(BackGoods.suppliername.text), Trim(s_recordset.Fields("goodsid")))
If retg Then
presetprice.text = Trim(m_recordset.Fields("单价"))
End If
End With
For j = 1 To BackGoods.MSHFlexGrid1.Rows - 1
If Trim(BackGoods.MSHFlexGrid1.TextMatrix(j, 1)) = Trim(s_recordset.Fields("goodsid")) Then
MainForm.g_msgText = "对不起该商品已经存在,请选择添加其他的商品!!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text1.text = ""
bigunit.text = ""
presetprice.text = 0
goodsname1.text = ""
'Exit Sub
End If
Next j
Text5.text = ""
Text6.text = ""
Text7.text = ""
Text3.text = "0"
'm_recordset.Close
s_recordset.Close
End Sub
Private Sub presetprice_Change()
If good_type2 = 1 Then
If Len(Trim(Text3.text)) <> 0 Then
Text5.text = CDbl(Trim(Text3.text) * CDbl(Trim(presetprice.text)))
End If
End If
If good_type2 = 0 Then
If Len(Trim(Text3.text)) <> 0 Then
Text5.text = CDbl(Trim(Text3.text) * CDbl(Trim(presetprice.text)))
End If
End If
End Sub
Private Sub save_cmd_Click()
If good_type2 = 1 Then ' 表示商品记录保存成功
good_name2 = Trim(goodsname1.text)
If Not Check Then ' 判断输入文本的内容
Exit Sub
End If
If BackGoods.currentrow11 > BackGoods.MSHFlexGrid1.Rows - 1 Then
BackGoods.MSHFlexGrid1.AddItem ""
End If
With BackGoods
.MSHFlexGrid1.TextMatrix(.currentrow11, 0) = ""
.MSHFlexGrid1.TextMatrix(.currentrow11, 1) = Trim(goodsname1.text) ' 商品编号
.MSHFlexGrid1.TextMatrix(.currentrow11, 2) = Trim(bigunit.text) ' 单位
.MSHFlexGrid1.TextMatrix(.currentrow11, 3) = Trim(Text3.text) ' 数量
.MSHFlexGrid1.TextMatrix(.currentrow11, 4) = CDbl(Trim(presetprice.text)) ' 单价
.MSHFlexGrid1.TextMatrix(.currentrow11, 5) = CDbl(Trim(Text5.text)) ' 金额
.MSHFlexGrid1.TextMatrix(.currentrow11, 6) = Trim(Text6.text) ' 完成数量
.MSHFlexGrid1.TextMatrix(.currentrow11, 7) = Trim(Text7.text)
.MSHFlexGrid1.TextMatrix(.currentrow11, 8) = Trim(Text1.text) ' 商品备注
.currentrow11 = .currentrow11 + 1
End With
End If
If good_type2 = 0 Then ' 修改商品
If Not Check Then ' 判断输入文本的内容
Exit Sub
End If
With BackGoods
.MSHFlexGrid1.TextMatrix(.back_goodsname, 0) = backgoodsdetailid
.MSHFlexGrid1.TextMatrix(.back_goodsname, 1) = Trim(goodsname1.text)
.MSHFlexGrid1.TextMatrix(.back_goodsname, 2) = Trim(bigunit.text) ' 单位
.MSHFlexGrid1.TextMatrix(.back_goodsname, 3) = Trim(Text3.text) ' 数量
.MSHFlexGrid1.TextMatrix(.back_goodsname, 4) = CDbl(Trim(presetprice.text)) ' 单价
.MSHFlexGrid1.TextMatrix(.back_goodsname, 5) = CDbl(Trim(Text5.text)) ' 金额
.MSHFlexGrid1.TextMatrix(.back_goodsname, 6) = Trim(Text6.text) ' 完成数量
.MSHFlexGrid1.TextMatrix(.back_goodsname, 7) = Trim(Text7.text)
.MSHFlexGrid1.TextMatrix(.back_goodsname, 8) = Trim(Text1.text) ' 商品备注
End With
End If
Unload Me
End Sub
Private Sub xgjl()
With BackGoods
backgoodsdetailid = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 0))
goodsname1.text = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 1))
'goodsname1.Tag = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 1))
bigunit.text = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 2))
'bigunit.Tag = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 2))
presetprice.text = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 4)))
'presetprice.Tag = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 4)))
Text5.text = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 5)))
'Text5.Tag = CDbl(Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 5)))
Text6.text = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 6))
'Text6.Tag = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 6))
Text7.text = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 7))
'Text7.Tag = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 7))
Text3.text = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 3))
'Text3.Tag = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 3))
Text1.text = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 8))
Text1.Tag = Trim(.MSHFlexGrid1.TextMatrix(.back_goodsname, 8))
End With
End Sub
Private Sub Text3_Change()
If Not IsNumeric(Text3.text) Then
MainForm.g_msgText = "你输入的数字格式有错误!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text3.text = ""
Text3.SetFocus
Exit Sub
End If
If good_type2 = 1 Then
If Len(Trim(Text3.text)) <> 0 Then
Text5.text = CDbl(Trim(Text3.text) * CDbl(Trim(presetprice.text)))
End If
End If
If good_type2 = 0 Then
If Len(Trim(Text3.text)) <> 0 Then
Text5.text = CDbl(Trim(Text3.text) * CDbl(Trim(presetprice.text)))
End If
End If
End Sub
Private Sub xz_cmd_Click()
If good_type2 = 1 Then ' 表示商品记录保存成功
If Not Check Then ' 判断输入文本的内容
Exit Sub
End If
If BackGoods.currentrow11 > BackGoods.MSHFlexGrid1.Rows - 1 Then
BackGoods.MSHFlexGrid1.AddItem ""
End If
With BackGoods
.MSHFlexGrid1.TextMatrix(.currentrow11, 0) = ""
.MSHFlexGrid1.TextMatrix(.currentrow11, 1) = Trim(goodsname1.text)
.MSHFlexGrid1.TextMatrix(.currentrow11, 2) = Trim(bigunit.text)
.MSHFlexGrid1.TextMatrix(.currentrow11, 3) = Trim(Text3.text)
.MSHFlexGrid1.TextMatrix(.currentrow11, 4) = CDbl(Trim(presetprice.text))
.MSHFlexGrid1.TextMatrix(.currentrow11, 5) = CDbl(Trim(Text5.text))
.MSHFlexGrid1.TextMatrix(.currentrow11, 6) = Trim(Text6.text)
.MSHFlexGrid1.TextMatrix(.currentrow11, 7) = Trim(Text7.text)
.MSHFlexGrid1.TextMatrix(.currentrow11, 8) = Trim(Text1.text)
.currentrow11 = .currentrow11 + 1
End With
Call clear
End If
End Sub
Private Sub clear() ' 初始化窗体
goodsname1.text = ""
bigunit.text = ""
Text3.text = 0
presetprice.text = 0
Text5.text = ""
Text6.text = ""
Text7.text = ""
Text1.text = ""
Text1.Tag = ""
End Sub
'*******************************************************
'* 功 能 描 述 :判断输入数据的合法性
'* 备 注:
'*******************************************************
Private Function Check() As Boolean
Check = True
If Len(Trim(goodsname1.text)) = 0 Then
MainForm.g_msgText = "商品名称不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Check = False
Exit Function
End If
If Len(Trim(bigunit.text)) = 0 Then
MainForm.g_msgText = "单位不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
bigunit.SetFocus
Check = False
Exit Function
End If
If Len(Trim(presetprice.text)) = 0 Then
MainForm.g_msgText = "单价不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
presetprice.SetFocus
Check = False
Exit Function
End If
If Len(Trim(Text6.text)) = 0 Then
MainForm.g_msgText = "完成数量不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text6.SetFocus
Check = False
Exit Function
End If
If Len(Trim(Text5.text)) = 0 Then
MainForm.g_msgText = "金额不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text5.SetFocus
Check = False
Exit Function
End If
If Len(Trim(Text3.text)) = 0 Then
MainForm.g_msgText = "数量不能为空!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text3.SetFocus
Check = False
Exit Function
End If
If Trim(Text3.text) = 0 Then ' 判断数量是否为空
MainForm.g_msgText = "数量不能为0!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text3.SetFocus
Check = False
Exit Function
End If
If Not IsNumeric(Text6.text) Then
MainForm.g_msgText = "完成数量,你输入的数字格式有错误!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text6.text = ""
Text6.SetFocus
Exit Function
End If
If Len(Trim(Text6.text)) > Len(Trim(Text3.text)) Then
MainForm.g_msgText = "完成数量不能比数量大!"
Call HMsgBox(MainForm.g_msgText, 0, 1)
Text6.SetFocus
Check = False
Exit Function
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -