📄 spdhd1.frm
字号:
'****************************************************
Msg = "当前商品需要存入货单中吗?" ' 定义信息。
Style = vbYesNo + vbInformation + vbDefaultButton2 ' 定义按钮。
Title = "提示" ' 定义标题。
Ctxt = 1000 ' 定义标题
' 上下文。
' 显示信息。
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' 用户按下“是”。
Combo1.Text = shang
MyString = "Yes" ' 完成某操作。
Call Command3_Click
'czrygl.Data1.Recordset.MoveNext
'On Error GoTo endthis
'zyxx.Data1.Recordset.Delete
'zyxx.Data1.Refresh
'zyxx.Hide
'Call Form_Activate
'zyxx.Show
Else ' 用户按下“否”。
MyString = "No" ' 完成某操作。
End If
'****************************************************
End If
Data1.Recordset.FindFirst "spmc = " & "'" & Combo1.Text & "'"
Text9.Text = Data1.Recordset("spbh")
Text3.Text = Data1.Recordset("dw")
Text10.Text = Data1.Recordset("ghs")
bc = False
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Data1.Recordset.FindFirst "spmc = " & "'" & Combo1.Text & "'"
If Data1.Recordset.NoMatch = True Then
MsgBox "商品信息库中没有此商品,请先录入。", vbInformation, " 提示"
Exit Sub
End If
Text9.Text = Data1.Recordset("spbh")
Text3.Text = Data1.Recordset("dw")
Text10.Text = Data1.Recordset("ghs")
End If
End Sub
Private Sub Command1_Click()
If bc = False Then
MsgBox "请先将当前记录保存。", vbCritical, "警告"
Exit Sub
End If
Data2.Recordset.MoveLast
If (Val(Data2.Recordset("ddbh")) + 1) < 9 Then Text1.Text = "00000000" & (Val(Data2.Recordset("ddbh")) + 1)
If (Val(Data2.Recordset("ddbh")) + 1) >= 9 And (Val(Data2.Recordset("ddbh")) + 1) < 100 Then
Text1.Text = "0000000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) >= 99 And (Val(Data2.Recordset("ddbh")) + 1) < 1000 Then
Text1.Text = "000000" + (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) >= 999 And (Val(Data2.Recordset("ddbh")) + 1) < 10000 Then
Text1.Text = "00000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) >= 9999 And (Val(Data2.Recordset("ddbh")) + 1) < 100000 Then
Text1.Text = "0000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) >= 99999 And (Val(Data2.Recordset("ddbh")) + 1) < 1000000 Then
Text1.Text = "000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) >= 999999 And (Val(Data2.Recordset("ddbh")) + 1) < 10000000 Then
Text1.Text = "00" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) >= 9999999 And (Val(Data2.Recordset("ddbh")) + 1) < 100000000 Then
Text1.Text = "0" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) >= 99999999 And (Val(Data2.Recordset("ddbh")) + 1) < 1000000000 Then
Text1.Text = (Val(Data2.Recordset("ddbh")) + 1)
End If
' If (Val(Data2.Recordset("ddbh")) + 1) >= 999999999 And (Val(Data2.Recordset("ddbh")) + 1) < 10000000000# Then
' Text1.Text = Val(Data2.Recordset("ddbh")) + 1
' End If
Combo1.Text = ""
Text9.Text = ""
Text3.Text = ""
Text10.Text = ""
Text5.Text = ""
Text6.Text = ""
Text8.Text = ""
Text7.Text = ""
Text15.Text = ""
Text16.Text = ""
Text18.Text = ""
Combo3.Text = ""
Text17.Text = ""
Text19.Text = ""
Text14.Text = ""
bc = False
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Command1.ToolTipText = "添加订货单"
End Sub
Private Sub Command3_Click()
If Text16.Text = "0" Then
MsgBox " 应付帐款不能为空" & vbCrLf & vbCrLf & "请仔细察看填写的数据。", vbCritical, "警告"
Text16.SetFocus
Exit Sub
End If
If Text17.Text = "" Then
MsgBox " 规格不能为空" & vbCrLf & vbCrLf & "若没有规格请填'无' .", vbCritical, "警告"
Text17.Text = "无"
Text17.SetFocus
Exit Sub
End If
If Len(Text18.Text) > 50 Then
MsgBox "备注不要多于25个字", vbCritical, "警告"
Text18.SetFocus
Exit Sub
End If
'订单保存
Data2.Recordset.FindFirst "ddbh = " & "'" & Text1.Text & "'"
If Data2.Recordset.NoMatch = True Then
If xgorbc = False Then
Data2.Recordset.AddNew
Else
Data2.Recordset.Edit
End If
Data2.Recordset("ddbh") = Trim(Text1.Text)
Data2.Recordset("dingjin") = Val(Combo3.Text)
Data2.Recordset("jsr") = Label3.Caption
Data2.Recordset("ljje") = Val(Text16.Text) - Val(Text19.Text)
Data2.Recordset("lrrq") = Text2.Text
Data2.Recordset("dhrq") = DTPicker2.Value
Data2.Recordset.Update
Data2.Refresh
Else
Data2.Recordset.Edit
Data2.Recordset("ljje") = Data2.Recordset("ljje") + (Val(Text16.Text) - Val(Text19.Text))
Data2.Recordset.Update
Data2.Refresh
MSFlexGrid.TextMatrix(0, 1) = " 订单编号"
MSFlexGrid.TextMatrix(0, 2) = " 经手人"
MSFlexGrid.TextMatrix(0, 5) = " 定金"
MSFlexGrid.TextMatrix(0, 3) = "录入日期"
MSFlexGrid.TextMatrix(0, 4) = "到货日期"
MSFlexGrid.TextMatrix(0, 6) = " 累计金额"
MSFlexGrid.TextMatrix(0, 7) = "供货商"
MSFlexGrid.TextMatrix(0, 7) = "是否入库"
'Exit Sub
End If
'商品保存
Data4.Recordset.AddNew
Data4.Recordset("dhdbh") = Text1.Text
Data4.Recordset("spbh") = Combo1.Text
Data4.Recordset("gg") = Text17.Text
Data4.Recordset("sl") = Val(Text14.Text)
Data4.Recordset("bz") = Text18.Text
Data4.Recordset("yfje") = Val(Text16.Text)
Data4.Recordset("zk") = Text19.Text
Data4.Recordset("dj") = Val(Text15.Text)
Data4.Recordset.Update
Data4.Refresh
'Unload Me
'zyxx.Show
MSFlexGrid.TextMatrix(0, 1) = " 订单编号"
MSFlexGrid.TextMatrix(0, 2) = " 经手人"
MSFlexGrid.TextMatrix(0, 5) = " 定金"
MSFlexGrid.TextMatrix(0, 3) = "录入日期"
MSFlexGrid.TextMatrix(0, 4) = "到货日期"
MSFlexGrid.TextMatrix(0, 6) = " 累计金额"
MSFlexGrid.TextMatrix(0, 7) = "是否入库"
bc = True
xgorbc = False
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Dim incount As Integer
Dim jj, ll, je As Variant
Data2.Recordset.MoveLast
incount = Data2.Recordset.RecordCount
Data2.Recordset.MoveFirst
For i = 0 To 200
Combo3.AddItem i * 100
Next
Data2.Refresh
' 自动生成科目编号
Data2.Recordset.MoveFirst
Data2.Recordset.MoveLast
If (Val(Data2.Recordset("ddbh")) + 1) <= 9 Then Text1.Text = "00000000" & (Val(Data2.Recordset("ddbh")) + 1)
If (Val(Data2.Recordset("ddbh")) + 1) > 9 And (Val(Data2.Recordset("ddbh")) + 1) < 100 Then
Text1.Text = "0000000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) > 99 And (Val(Data2.Recordset("ddbh")) + 1) < 1000 Then
Text1.Text = "000000" + (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) > 999 And (Val(Data2.Recordset("ddbh")) + 1) < 10000 Then
Text1.Text = "00000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) > 9999 And (Val(Data2.Recordset("ddbh")) + 1) < 100000 Then
Text1.Text = "0000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) > 99999 And (Val(Data2.Recordset("ddbh")) + 1) < 1000000 Then
Text1.Text = "000" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) > 999999 And (Val(Data2.Recordset("ddbh")) + 1) < 10000000 Then
Text1.Text = "00" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) > 9999999 And (Val(Data2.Recordset("ddbh")) + 1) < 100000000 Then
Text1.Text = "0" & (Val(Data2.Recordset("ddbh")) + 1)
End If
If (Val(Data2.Recordset("ddbh")) + 1) > 99999999 And (Val(Data2.Recordset("ddbh")) + 1) < 1000000000 Then
Text1.Text = Val(Data2.Recordset("ddbh")) + 1
End If
'载入商品编号
Data1.Recordset.MoveLast
spbhcount = Data1.Recordset.RecordCount
Data1.Recordset.MoveFirst
For j = 1 To spbhcount
Combo1.AddItem Data1.Recordset("spmc")
Data1.Recordset.MoveNext
Next
Data1.Recordset.MoveFirst
'载入经手人
Data3.Recordset.MoveLast
zycount = Data3.Recordset.RecordCount
Data3.Recordset.MoveFirst
Data3.Recordset.MoveNext
Data3.Recordset.MoveFirst
MSFlexGrid.ColWidth(0) = 200
MSFlexGrid.ColWidth(1) = 1500
MSFlexGrid.ColWidth(2) = 1200
MSFlexGrid.ColWidth(3) = 1300
MSFlexGrid.TextMatrix(0, 1) = " 订单编号"
MSFlexGrid.TextMatrix(0, 2) = " 经手人"
MSFlexGrid.TextMatrix(0, 5) = " 定金"
MSFlexGrid.TextMatrix(0, 3) = "录入日期"
MSFlexGrid.TextMatrix(0, 4) = "到货日期"
MSFlexGrid.TextMatrix(0, 6) = " 累计金额"
MSFlexGrid.TextMatrix(0, 7) = "是否入库"
xgorbc = False
End Sub
Private Sub Form_Load()
DTPicker2.Value = Date
Text2.Text = Date
Data1.DatabaseName = App.Path & "\db1.mdb"
Data1.RecordSource = "select * from spxx"
Data2.DatabaseName = App.Path & "\db1.mdb"
Data2.RecordSource = "select * from spdhd"
Data3.DatabaseName = App.Path & "\db1.mdb"
Data3.RecordSource = "select * from zyzl"
Data4.DatabaseName = App.Path & "\db1.mdb"
Data4.RecordSource = "select * from dhdsp"
Label3.Caption = dlm
End Sub
Private Sub Label3_Click()
Call jinggao
End Sub
Private Sub MSFlexGrid_Click()
dj = 1
c = spdhd1.MSFlexGrid.Row
End Sub
Private Sub Text14_Change()
shang = Combo1.Text
End Sub
Private Sub Text15_GotFocus()
shang = Combo1.Text
End Sub
Private Sub Text16_Click()
Text16.Text = Val(Text15.Text) * Val(Text14.Text)
End Sub
Private Sub Text17_GotFocus()
shang = Combo1.Text
End Sub
Private Sub Text2_Click()
Call jinggao
End Sub
Sub jinggao()
MsgBox "不能修改! ", vbInformation, "提示"
Text17.SetFocus
End Sub
Private Sub Text3_Click()
Call jinggao
End Sub
Private Sub Text9_Click()
Call jinggao
End Sub
Private Sub Text10_Click()
Call jinggao
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -