📄 lingshoudan.frm
字号:
Combo4.Text = Trecordset2.Fields("guige")
Trecordset2.MoveNext
Loop
Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select distinct jixing from jinhuo where yaopinming='" & Trim(Combo3.Text) & "'"
.Open
End With
Do While Not Trecordset2.EOF
Combo5.Text = Trecordset2.Fields("jixing")
Combo5.AddItem Trecordset2.Fields("jixing")
Trecordset2.MoveNext
Loop
Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select distinct leixing from jinhuo where yaopinming='" & Trim(Combo3.Text) & "'"
.Open
End With
Do While Not Trecordset2.EOF
Combo6.Text = Trecordset2.Fields("leixing")
Combo6.AddItem Trecordset2.Fields("leixing")
Trecordset2.MoveNext
Loop
Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select distinct shengchanriqi from jinhuo where yaopinming='" & Trim(Combo3.Text) & "'"
.Open
End With
Do While Not Trecordset2.EOF
Combo7.Text = Trecordset2.Fields("shengchanriqi")
Combo7.AddItem Trecordset2.Fields("shengchanriqi")
Trecordset2.MoveNext
Loop
Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select distinct youxiaoqi from jinhuo where yaopinming='" & Trim(Combo3.Text) & "'"
.Open
End With
Do While Not Trecordset2.EOF
Combo8.Text = Trecordset2.Fields("youxiaoqi")
Combo8.AddItem Trecordset2.Fields("youxiaoqi")
Trecordset2.MoveNext
Loop
Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select distinct lingshoujia from yaopin where name='" & Trim(Combo3.Text) & "'"
.Open
End With
Trecordset2.MoveFirst
If IsNull(Trecordset2.Fields("lingshoujia")) Then
Text3.Text = 0
Else
Text3.Text = Trecordset2.Fields("lingshoujia")
End If
Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select distinct jiage from jinhuo where yaopinming='" & Trim(Combo3.Text) & "'"
.Open
End With
If Trecordset2.RecordCount > 0 Then
Trecordset2.MoveFirst
Label13.Caption = Trecordset2.Fields("jiage")
End If
Trecordset2.Close
Set Trecordset2 = Nothing
End Sub
Private Sub Command1_Click()
If Text3.Text = "" Or Text4.Text = "" Then
MsgBox "价格和数量不能为空!", vbOKOnly, "提示"
Exit Sub
End If
Text5.Text = Trim(Text3.Text) * Trim(Text4.Text)
End Sub
Private Sub Command2_Click()
Text7.Text = ""
Text1.Enabled = True
Text2.Enabled = True
'Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Combo1.Enabled = True
Combo2.Enabled = True
Combo3.Enabled = True
Combo4.Enabled = True
Combo5.Enabled = True
Combo6.Enabled = True
Combo7.Enabled = True
Combo8.Enabled = True
Command4.Enabled = True
Command2.Enabled = False
Text1.BackColor = &HFFFFFF
Text2.BackColor = &HFFFFFF
'Text3.BackColor = &HFFFFFF
Text4.BackColor = &HFFFFFF
Text5.BackColor = &HFFFFFF
Text6.BackColor = &HFFFFFF
Combo1.BackColor = &HFFFFFF
Combo2.BackColor = &HFFFFFF
Combo3.BackColor = &HFFFFFF
Combo4.BackColor = &HFFFFFF
Combo5.BackColor = &HFFFFFF
Combo6.BackColor = &HFFFFFF
Combo7.BackColor = &HFFFFFF
Combo8.BackColor = &HFFFFFF
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
' Do While Not Trecordset.EOF
Command1_Click
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Trecordset2.State = adStateOpen Then Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
' .Source = "Select * from kucun where yaopinming like '%" & Trim(Combo1.Text) & "%'"
.Source = "Select * from yaopin where name = '" & Trim(Combo3.Text) & "'"
.Open
End With
If Trecordset2.RecordCount > 0 Then
Trecordset2.MoveFirst
Text7.Text = Trecordset2.Fields("daima")
End If
If Trecordset2.State = adStateOpen Then Trecordset2.Close
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Trim(Text3.Text) = "" Then
MsgBox "价格不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Text4.Text) = "" Then
MsgBox "数量不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Combo1.Text) = "" Then
MsgBox "操作员不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Combo2.Text) = "" Then
MsgBox "往来单位不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Combo3.Text) = "" Then
MsgBox "药品名称不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Combo4.Text) = "" Then
MsgBox "包装规格不能为空!", vbOKOnly, "提示"
Exit Sub
End If
If Trim(Combo5.Text) = "" Then
MsgBox "药品剂型不能为空!", vbOKOnly, "提示"
Exit Sub
End If
'''''''''''''''''''''''''''''''''''保存到库存
With Trecordset5
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select * from kucun where yaopinming='" & Trim(Combo3.Text) & "'"
.Open
End With
If Trecordset5.RecordCount > 0 Then
Dim m As String
Dim n As String
Dim a As String
Dim b As String
m = Val(Trecordset5.Fields("shuliang"))
n = Val(Trim(Text4.Text))
If Val(n) > Val(m) Then
MsgBox "零售数量大于库存数量,库存药品不够!", vbOKOnly, "提示"
Trecordset5.Close
Exit Sub
End If
Trecordset5.Fields("shuliang") = Val(m) - Val(n)
Trecordset5.Fields("jine") = Val(Trecordset5.Fields("shuliang") * Trecordset5.Fields("jiage"))
Trecordset5.Update
Else
MsgBox "对不起,库中药品销售一空或者没有进此药品!", vbOKOnly, "提示"
Trecordset5.Close
Exit Sub
End If
Trecordset5.Close
'''''''''''''''''''''''''''''''''''''
With Trecordset4
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select * from lingshou "
.Open
End With
Dim m1 As String
Dim n1 As String
Dim c As String
c = Val(Trim(Text4.Text))
m1 = Val(Trim(Text3.Text))
Trecordset4.AddNew
Trecordset4.Fields("shijian") = Trim(Text1.Text)
Trecordset4.Fields("lingshouhao") = Trim(Text2.Text)
Trecordset4.Fields("caozuoyuan") = Trim(Combo1.Text)
Trecordset4.Fields("wanglaidanwei") = Trim(Combo2.Text)
Trecordset4.Fields("yaopinming") = Trim(Combo3.Text)
Trecordset4.Fields("guige") = Trim(Combo4.Text)
Trecordset4.Fields("jixing") = Trim(Combo5.Text)
Trecordset4.Fields("leixing") = Trim(Combo6.Text)
Trecordset4.Fields("shengchanriqi") = Trim(Combo7.Text)
Trecordset4.Fields("youxiaoqi") = Trim(Combo8.Text)
Trecordset4.Fields("jiage") = Val(Trim(Text3.Text))
Trecordset4.Fields("shuliang") = Val(Trim(Text4.Text))
Trecordset4.Fields("jine") = Val(Trim(Text5.Text))
Trecordset4.Fields("beizhu") = Trim(Text6.Text)
Trecordset4.Fields("lirun") = Val((Trim(Text3.Text) - Trim(Label13.Caption)) * c)
Trecordset4.Update
Trecordset4.Requery
MM = MM + 1
Trecordset4.Close
Set Trecordset4 = Nothing
Gridflex1
'''''''''''''''''''''''''''''''
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Combo1.Enabled = False
Combo2.Enabled = False
Combo3.Enabled = False
Combo4.Enabled = False
Combo5.Enabled = False
Combo6.Enabled = False
Combo7.Enabled = False
Combo8.Enabled = False
Command2.Enabled = True
Command4.Enabled = False
Text1.BackColor = &H80000004
Text2.BackColor = &H80000004
Text3.BackColor = &H80000004
Text4.BackColor = &H80000004
Text5.BackColor = &H80000004
Text6.BackColor = &H80000004
Combo1.BackColor = &H80000004
Combo2.BackColor = &H80000004
Combo3.BackColor = &H80000004
Combo4.BackColor = &H80000004
Combo5.BackColor = &H80000004
Combo6.BackColor = &H80000004
Combo7.BackColor = &H80000004
Combo8.BackColor = &H80000004
End Sub
Private Sub Command5_Click()
Load wanglaidanwei
wanglaidanwei.Show
End Sub
Private Sub Form_Load()
'set the window in the middle
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Initial '''''''''''''''''初始化进货单
MM = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MM = 0 Then
Else
If MsgBox("需要打印零售单吗?", vbYesNo + vbInformation, "提示") = vbYes Then
'************************************保存
LingShouhao = Trim(Text2.Text)
Load print_lingshou
print_lingshou.Show
End If
End If
End Sub
Private Sub MSFlexGrid1_Click()
lingshouID = Trim(MSFlexGrid1.TextMatrix(MSFlexGrid1.RowSel, 0))
Load lingshouModify
lingshouModify.Show
Unload lingshoudan
End Sub
Private Sub Text7_Change()
Combo3.Clear
If Trecordset2.State = adStateOpen Then Trecordset2.Close
With Trecordset2
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
' .Source = "Select * from kucun where yaopinming like '%" & Trim(Combo1.Text) & "%'"
.Source = "Select * from yaopin where daima like '%" & Trim(Text7.Text) & "%'"
.Open
End With
If Trecordset2.RecordCount > 0 Then
Do While Not Trecordset2.EOF
Combo3.AddItem Trecordset2.Fields("name")
Trecordset2.MoveNext
Loop
End If
If Trecordset2.RecordCount > 0 Then
Trecordset2.MoveFirst
Combo3.Text = Trecordset2.Fields("name")
End If
If Trecordset2.State = adStateOpen Then Trecordset2.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -