Dim pbx As WinForm.PictureBox
pbx = e.form.Controls("提示")
Dim sl As Double = val(e.Sender.text)
Dim kykc As Double = val(e.form.Controls("可用库存").text)
Dim dj As Double = val(e.form.Controls("单价").value)
If sl = Nothing Then
e.Form.Controls("出库数量").text = "0 "
pbx.Image = GetImage("Images\exclamation.gif")
e.Form.Controls("提示信息").text = "请输入出库数量,不能为空!"
e.Form.Controls("提示信息").ForeColor = Color.Red
e.Form.Controls("增加").Enabled = False
Return
End If
If sl = 0 Then
e.Form.Controls("出库数量").text = "0 "
pbx.Image = GetImage("Images\exclamation.gif")
e.Form.Controls("提示信息").text = "出库数量必须大于 0"
e.Form.Controls("提示信息").ForeColor = Color.Red
e.Form.Controls("增加").Enabled = False
Return
ElseIf sl > kykc Then
e.Form.Controls("出库数量").text = "0 "
pbx.Image = GetImage("Images\exclamation.gif")
e.Form.Controls("提示信息").text = "库存可用数量不足本次出库!"
e.Form.Controls("提示信息").ForeColor = Color.Red
e.Form.Controls("增加").Enabled = False
Return
else
e.Form.Controls("出库数量").text = sl
Dim dr As DataRow = DataTables("商品库存明细").Find("Item = '" &
e.Form.Controls("商品编号").text & "'")
If dr IsNot
Nothing Then
Dim wz As Integer = Tables("商品库存明细").FindRow(dr)
If wz >= 0 Then
Tables("商品库存明细").Position
= wz
End If
If dr("可用库存")
〉 sl Then
e.Form.Controls("单价").text =
dr("单价") & " 元"
e.Form.Controls("总价").text = Format(dr(“单价”)
* sl,"n") & " 元
If dr("生产日期") = Nothing Then
e.Form.Controls("生产日期").text
= "未知"
Else
e.Form.Controls("生产日期").text
= dr("生产日期")
End If
If dr("有效期至") = Nothing Then
e.Form.Controls("有效期至").text = "未知"
Else
e.Form.Controls("有效期至").text = dr("有效期至")
End If
e.Form.Controls("规格").text = dr("Pack Size")
e.Form.Controls("商品状态").text = dr("商品状态")
e.Form.Controls("库位").text = dr("库位")
End If
End If
End if
If dj = Nothing Then
pbx.Image = GetImage("Images\exclamation.gif")
e.Form.Controls("提示信息").text = "商品单价为空,请尽量完善!"
e.Form.Controls("提示信息").ForeColor = Color.Red
e.Form.Controls("增加").Enabled = True
Return
End If
If dj = 0 Then
pbx.Image = GetImage("Images\exclamation.gif")
e.Form.Controls("提示信息").text = "商品单价为 0 ,请尽量完善!"
e.Form.Controls("提示信息").ForeColor = Color.Red
e.Form.Controls("增加").Enabled = True
Return
End If
e.Form.Controls("增加").Enabled = True
pbx.Image = GetImage("Images\payment_card.png")
e.Form.Controls("提示信息").text = "金额小计: " & Format(dj * sl,"n") & " 元"
e.Form.Controls("提示信息").ForeColor = Color.black