Model控件ValueChanged:
Dim cpxh As String = e.Form.Controls("Dropbox2").value
If cpxh = "" Then
Tables("库存表").Filter = ""
e.Form.Controls("库存数量").Text ="未知"
Else
Tables("库存表").Filter=" [产品型号] = '" & cpxh & "'"
Dim r As Row = Tables("库存表").current
If r Is Nothing Then
e.Form.Controls("库存数量").Text = "未知"
Else
e.Form.Controls("库存数量").Text = r("实时库存_数量")
If r("实时库存_数量") = 0 Then
MessageBox.Show("Out of stock!", "Error")
End If
End If
End If
If cpxh = "" Then
Tables("销售主界面_Table3").Filter = ""
e.Form.Controls("未提数量").Text = "未知"
Else
Tables("销售主界面_Table3").Filter = " [产品型号] = '" & cpxh & "'"
Dim sum As Double = 0
If Tables("销售主界面_Table3").Current Is Nothing Then
e.Form.Controls("未提数量").Text = 0
Else
For Each r1 As Row In Tables("销售主界面_Table3").Rows
sum + = r1("未提数量")
Next
e.Form.Controls("未提数量").Text = sum
End If
End If
Dim dr As DataRow = DataTables("产品入库表").sqlfind("产品型号 = '" & cpxh & "'","日期 Desc")
Dim pbx As WinForm.PictureBox = e.Form.Controls("PictureBox1")
If dr Is Nothing Then
e.Form.Controls("产品类别").Text ="未知"
e.Form.Controls("产品规格").Text ="未知"
e.Form.Controls("单价成本").Text ="未知"
pbx.ImageFile = ""
ElseIf dr IsNot Nothing Then
e.Form.Controls("产品类别").Text =dr("产品类别")
e.Form.Controls("产品规格").text =dr("产品规格")
e.Form.Controls("textbox5").text =dr("销售单价")
e.Form.Controls("单价成本").Text =dr("单价成本")
pbx.ImageFile =ProjectPath & "Attachments\" & dr("备注")
End If
Quantiyi控件TextChanged:
If e.Form.Controls("NumericComboBox2").Text IsNot Nothing Then
e.Form.Controls("NumericComboBox1").Text = e.Form.Controls("NumericComboBox2").Text
End If
Quantiyi控件ValueChanged:
If e.Form.Controls("库存数量").Text <> "未知" Then
If e.Sender.Text = "" Then
MessageBox.Show("The quantity cannot be empty,please enter!(数量不能为空,请输入!)", "Error message(错误提示)")
ElseIf e.Form.Controls("库存数量").Text - e.Sender.Text < 0 Then
MessageBox.Show("The quantity of this product is not enough in stock!(该产品库存数量不足本次销售!)", "Error message(错误提示)")
'ElseIf e.Form.Controls("库存数量").Text - e.Form.Controls("未提数量").Text <= 0 Then
'MessageBox.Show("This product has not mention the number,and stock number of less than the sales!(该产品有未提数量,且库存数量不足本次销售!)", "Error message")
End If
End If
Price控件是自动获得数据
[此贴子已经被作者于2019/11/1 15:05:54编辑过]