?? sprk.frm
字號:
Public dj, c As Integer
Public xgorbc As Boolean
Public bc As Boolean
Private Sub Combo1_Change()
'data1.Recordset.FindFirst
End Sub
Private Sub Combo1_Click()
Data1.Recordset.FindFirst "spbh = " & "'" & Combo1.Text & "'"
Text9.Text = Data1.Recordset("spmc")
Text3.Text = Data1.Recordset("dw")
Text10.Text = Data1.Recordset("ghs")
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Data1.Recordset.FindFirst "spbh = " & "'" & Combo1.Text & "'"
If Data1.Recordset.NoMatch = True Then
MsgBox "商品信息中沒有此商品編號。", vbInformation, "提示"
Exit Sub
End If
Text9.Text = Data1.Recordset("spmc")
Text3.Text = Data1.Recordset("dw")
Text10.Text = Data1.Recordset("ghs")
End If
End Sub
Private Sub Command1_Click()
If bc = False Then
MsgBox "請先將當(dāng)前記錄保存。", vbCritical, "警告"
Exit Sub
End If
Data2.Recordset.MoveLast
If (Val(Data2.Recordset("kmbh")) + 1) < 9 Then Text1.Text = "000000000" & (Val(Data2.Recordset("kmbh")) + 1)
If (Val(Data2.Recordset("kmbh")) + 1) > 9 And (Val(Data2.Recordset("kmbh")) + 1) < 100 Then
Text1.Text = "00000000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 99 And (Val(Data2.Recordset("kmbh")) + 1) < 1000 Then
Text1.Text = "0000000" + (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000 Then
Text1.Text = "000000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 9999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000 Then
Text1.Text = "00000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 99999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000 Then
Text1.Text = "0000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000 Then
Text1.Text = "000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 9999999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000000 Then
Text1.Text = "00" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 99999999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000000 Then
Text1.Text = "0" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 999999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000000# Then
Text1.Text = Val(Data2.Recordset("kmbh")) + 1
End If
Combo1.Text = "選擇商品"
Text2.Text = ""
Text9.Text = ""
Text3.Text = ""
Text10.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text8.Text = ""
Text7.Text = ""
'Text11.Text = ""
bc = False
End Sub
Private Sub Command2_Click()
If dj = 1 Then
Data2.Recordset.FindFirst "kmbh = " & "'" & MSFlexGrid.TextMatrix(c, 1) & "'"
Text1.Text = Data2.Recordset("kmbh")
Combo1.Text = Data2.Recordset("spbh")
Text4.Text = Data2.Recordset("jhdj")
Text2.Text = Data2.Recordset("sl")
Text5.Text = Data2.Recordset("je")
On Error Resume Next
Text7.Text = Data2.Recordset("gg")
Text6.Text = Data2.Recordset("kw")
Text8.Text = Data2.Recordset("bz")
DTPicker1.Value = Data2.Recordset("rkrq")
Data1.Recordset.FindFirst "spbh = " & "'" & MSFlexGrid.TextMatrix(c, 3) & "'"
Text9.Text = Data1.Recordset("spmc")
Text3.Text = Data1.Recordset("dw")
Text10.Text = Data1.Recordset("ghs")
dj = 0
xgorbc = True
Else
MsgBox "請先選擇好要修改的對象。", vbInformation, "提示"
Exit Sub
End If
End Sub
Private Sub Command3_Click()
If Text4.Text = "0" Then
MsgBox "單價不可能為 0 。", vbCritical, "警告"
Text4.SetFocus
Exit Sub
End If
If Text6.Text = "" Then
MsgBox "庫位不能為空.", vbCritical, "警告"
Text6.SetFocus
Exit Sub
End If
If Text7.Text = "" Then
MsgBox " 規(guī)格不能為空" & vbCrLf & vbCrLf & "若沒有規(guī)格請?zhí)?#039;無' .", vbCritical, "警告"
Text7.Text = "無"
Text7.SetFocus
Exit Sub
End If
If Len(Text8.Text) > 50 Then
MsgBox "備注不要多于25個字", vbCritical, "警告"
Text8.SetFocus
Exit Sub
End If
If xgorbc = False Then
Data2.Recordset.AddNew
Else
Data2.Recordset.Edit
End If
Data2.Recordset("kmbh") = Trim(Text1.Text)
Data2.Recordset("spbh") = Trim(Combo1.Text)
Data2.Recordset("jsren") = Label13.Caption
Data2.Recordset("jhdj") = Trim(Text4.Text)
Data2.Recordset("sl") = Trim(Text2.Text)
Data2.Recordset("je") = Trim(Text5.Text)
Data2.Recordset("gg") = Trim(Text7.Text)
Data2.Recordset("kw") = Trim(Text6.Text)
Data2.Recordset("bz") = Trim(Text8.Text)
Data2.Recordset("rkrq") = DTPicker1.Value
Data2.Recordset.Update
Data2.Refresh
Call Form_Activate
'將商品添加到倉庫
Data4.RecordSource = "select * from kczk where spbh = '" & Combo1.Text & "' and gg = '" & Text7.Text & "' "
Data4.Refresh
' Data4.Recordset.MoveLast
'aa = Data4.Recordset.RecordCount
If Data4.Recordset.EOF = True Then
'Data4.RecordSource = "select * from kczk "
Data4.Recordset.AddNew
' Data4.Recordset("bh") = Trim(Text1.Text)
Data4.Recordset("spbh") = Trim(Combo1.Text)
'Data4.Recordset("jhdj") = Trim(Text4.Text)
Data4.Recordset("kcsl") = Trim(Text2.Text)
Data4.Recordset("kw") = Trim(Text6.Text)
Data4.Recordset("bz") = Trim(Text8.Text)
' Data4.Recordset("rkrq") = DTPicker1.Value
Data4.Recordset.Update
Data4.Refresh
Else
Data4.Recordset.Edit
Data4.Recordset("kcsl") = Data4.Recordset("kcsl") + Val(Text2.Text)
Data4.Recordset.Update
Data4.Refresh
End If
'Unload Me
'zyxx.Show
bc = True
xgorbc = False
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
Data4.RecordSource = "select * from kczk where spbh = '" & Combo1.Text & "' and gg = '" & Text7.Text & "' "
Data4.Refresh
'Data2.Recordset("zk") = 90
End Sub
Private Sub Form_Activate()
'Data2.Recordset.Update
Dim incount As Integer
Dim jj, ll, je As Variant
Data2.Recordset.MoveLast
incount = Data2.Recordset.RecordCount
Data2.Recordset.MoveFirst
'Data2.Recordset.Edit
For i = 1 To incount
jj = Data2.Recordset("jhdj")
ll = Data2.Recordset("sl")
je = Data2.Recordset("je")
Data2.Recordset.Edit
sprk.Data2.Recordset("zk") = jj * ll - je
Data2.Recordset.Update
Data2.Recordset.MoveNext
Next
' Data2.Recordset.Update
Data2.Refresh
' 自動生成科目編號
Data2.Recordset.MoveFirst
Data2.Recordset.MoveLast
If (Val(Data2.Recordset("kmbh")) + 1) <= 9 Then Text1.Text = "000000000" & (Val(Data2.Recordset("kmbh")) + 1)
If (Val(Data2.Recordset("kmbh")) + 1) > 9 And (Val(Data2.Recordset("kmbh")) + 1) < 100 Then
Text1.Text = "00000000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 99 And (Val(Data2.Recordset("kmbh")) + 1) < 1000 Then
Text1.Text = "0000000" + (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000 Then
Text1.Text = "000000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 9999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000 Then
Text1.Text = "00000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 99999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000 Then
Text1.Text = "0000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000 Then
Text1.Text = "000" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 9999999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000000 Then
Text1.Text = "00" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 99999999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000000 Then
Text1.Text = "0" & (Val(Data2.Recordset("kmbh")) + 1)
End If
If (Val(Data2.Recordset("kmbh")) + 1) > 999999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000000# Then
Text1.Text = Val(Data2.Recordset("kmbh")) + 1
End If
'載入商品編號
Data1.Recordset.MoveLast
spbhcount = Data1.Recordset.RecordCount
Data1.Recordset.MoveFirst
For j = 1 To spbhcount
Combo1.AddItem Data1.Recordset("spbh")
Data1.Recordset.MoveNext
Next
Data1.Recordset.MoveFirst
'載入經(jīng)手人
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.ColWidth(7) = 1500
MSFlexGrid.TextMatrix(0, 1) = " 科目編號"
MSFlexGrid.TextMatrix(0, 2) = " 經(jīng)手人"
MSFlexGrid.TextMatrix(0, 3) = " 商品編號"
MSFlexGrid.TextMatrix(0, 4) = "入庫日期"
MSFlexGrid.TextMatrix(0, 5) = " 規(guī)格"
MSFlexGrid.TextMatrix(0, 6) = "進(jìn)貨單價"
MSFlexGrid.TextMatrix(0, 7) = "數(shù)量 "
MSFlexGrid.TextMatrix(0, 8) = "金額 "
MSFlexGrid.TextMatrix(0, 9) = "折扣 "
MSFlexGrid.TextMatrix(0, 10) = " 庫位"
MSFlexGrid.TextMatrix(0, 11) = "備注 "
xgorbc = False
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\db1.mdb"
Data1.RecordSource = "select * from spxx"
Data2.DatabaseName = App.Path & "\db1.mdb"
Data2.RecordSource = "select * from spzjrk"
Data3.DatabaseName = App.Path & "\db1.mdb"
Data3.RecordSource = "select * from zyzl"
Data4.DatabaseName = App.Path & "\db1.mdb"
Data4.RecordSource = "select * from kczk"
DTPicker1.Value = Date
Text9.Enabled = False
Text3.Enabled = False
Text10.Enabled = False
Label13.Enabled = False
Label13.Caption = dlm
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
Private Sub MSFlexGrid_Click()
dj = 1
c = sprk.MSFlexGrid.Row
End Sub
Private Sub Text5_Click()
Text5.Text = Val(Text4.Text) * Val(Text2.Text)
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -