📄 formpayout.frm
字号:
If Combo1.Text = "影碟销售" Then
MDIForm1.StatusBar1.Panels(1) = "影碟销售"
Adodc1.RecordSource = "影碟入库"
End If
Adodc2.Refresh
If Combo1.Text = "歌碟销售" Then
DataGrid3.Visible = True
DataGrid2.Visible = False
DataGrid1.Visible = True
DataGrid4.Visible = False
'Label3.Visible = True
'Label1.Visible = False
Adodc2.CommandType = adCmdTable
Adodc2.RecordSource = "销售情况表"
Adodc2.Refresh
Text2.DataField = "光碟名"
End If
If Combo1.Text = "影碟销售" Then
DataGrid2.Visible = True
DataGrid3.Visible = False
DataGrid4.Visible = True
DataGrid1.Visible = False
'Label3.Visible = False
'Label1.Visible = True
Adodc2.CommandType = adCmdTable
Adodc2.RecordSource = "影碟销售表"
Adodc2.Refresh
Text2.DataField = "影碟名"
End If
End Sub
Private Sub Combo1_Click()
Adodc1.CommandType = adCmdTable
If Combo1.Text = "歌碟销售" Then
Adodc1.RecordSource = "总表"
MDIForm1.StatusBar1.Panels(1) = "歌碟销售"
End If
If Combo1.Text = "影碟销售" Then
Adodc1.RecordSource = "影碟入库"
MDIForm1.StatusBar1.Panels(1) = "影碟销售"
End If
Adodc1.Refresh
If Combo1.Text = "歌碟销售" Then
DataGrid3.Visible = True
DataGrid2.Visible = False
DataGrid1.Visible = True
DataGrid4.Visible = False
'Label3.Visible = True
'Label1.Visible = False
Adodc2.CommandType = adCmdTable
Adodc2.RecordSource = "销售情况表"
Adodc2.Refresh
Text2.DataField = "光碟名"
End If
If Combo1.Text = "影碟销售" Then
DataGrid2.Visible = True
DataGrid3.Visible = False
DataGrid4.Visible = True
DataGrid1.Visible = False
'Label3.Visible = False
'Label1.Visible = True
Adodc2.CommandType = adCmdTable
Adodc2.RecordSource = "影碟销售表"
Adodc2.Refresh
Text2.DataField = "影碟名"
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Command1_Click()
If bool1 = True Then
bool1 = False
Text1.Enabled = True
Text4.Enabled = True
Adodc2.Recordset.AddNew
Adodc2.Recordset("售出时间") = DTPicker1.Value
'Adodc2.Recordset("出售数量") = 0
End If
Text1.SetFocus
MDIForm1.StatusBar1.Panels(1).Text = "出售光碟"
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "出售光碟"
End Sub
Private Sub Command2_Click()
todaysum.Show
'formpayout.Hide
'Set formpayout = Nothing
'Unload Me
End Sub
Private Sub Command2_GotFocus()
MDIForm1.StatusBar1.Panels(1) = "当日光碟销售情况统计"
End Sub
Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "当日光碟销售情况统计"
End Sub
Private Sub Command3_Click()
bool1 = True
'On Error GoTo errmsg
Dim str As Integer
'If Adodc2.Recordset.RecordCount <> 0 Then
str = MsgBox("确定是否删除", 33, "删除一个记录")
If str = 1 Then
Adodc2.Recordset.Delete
If Not Adodc2.Recordset.EOF And Not Adodc2.Recordset.BOF Then
Adodc2.Recordset.MoveNext
End If
End If
'Exit Sub
'errmsg:
'MsgBox Err.Description, vbExclamation, "影碟出售"
End Sub
Private Sub Command3_GotFocus()
MDIForm1.StatusBar1.Panels(1) = "删除一条所出售的商品记录"
End Sub
Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "删除一条所出售的商品记录"
End Sub
Private Sub Command4_Click()
MDIForm1.StatusBar1.Panels(1) = "清空当日销售数据"
On Error GoTo errmsg
Dim sql As String
Dim str As Integer
Dim i As Integer
str = MsgBox("真的要清空所有记录吗", 33, "清空记录")
If str = 1 Then
Adodc2.Recordset.MoveLast
While Not Adodc2.Recordset.EOF
Adodc2.Recordset.Delete
Adodc2.Recordset.MovePrevious
Wend
DataGrid1.Refresh
DataGrid4.Refresh
Else
Adodc2.Recordset.CancelUpdate
Adodc2.Recordset.MoveLast
End If
Exit Sub
errmsg: MsgBox Err.Description, vbExclamation, "入库错误"
End Sub
Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "清空当日销售数据"
End Sub
Private Sub Command5_Click()
falmsum1.Show
'formpayout.Hide
'Set formpayout = Nothing
End Sub
Private Sub Command5_GotFocus()
MDIForm1.StatusBar1.Panels(1) = "当日影碟销售情况统计"
End Sub
Private Sub Command6_Click()
vcdpandian.Show
'formpayout.Hide
'Set formpayout = Nothing
End Sub
Private Sub Command6_GotFocus()
MDIForm1.StatusBar1.Panels(1) = "光碟库存盘点"
End Sub
Private Sub Command6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "当日影碟销售情况统计"
End Sub
Private Sub Command7_Click()
falmpandian.Show
'formpayout.Hide
'Set formpayout = Nothing
End Sub
Private Sub Command7_GotFocus()
MDIForm1.StatusBar1.Panels(1) = "影碟库存盘点"
End Sub
Private Sub Command7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "影碟库存盘点"
End Sub
Private Sub Command8_Click()
salearray.Show
'formpayout.Hide
'Set formpayout = Nothing
End Sub
Private Sub Command8_GotFocus()
MDIForm1.StatusBar1.Panels(1) = "新歌快递"
End Sub
Private Sub Command8_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "新歌快递"
End Sub
Private Sub DataGrid1_Click()
MDIForm1.StatusBar1.Panels(1) = "选取一条记录"
End Sub
Private Sub DataGrid1_Error(ByVal DataError As Integer, Response As Integer)
MDIForm1.StatusBar1.Panels(1) = "选取一条记录"
If DataError = -2147467259 Then
Response = 0
End If
End Sub
Private Sub DataGrid1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "歌碟销售情况数据"
End Sub
Private Sub DataGrid2_Click()
MDIForm1.StatusBar1.Panels(1) = "选取一条记录"
End Sub
Private Sub DataGrid2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "影碟库存记录"
End Sub
Private Sub DataGrid3_Click()
MDIForm1.StatusBar1.Panels(1) = "选取一条记录"
End Sub
Private Sub DataGrid3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "歌碟库存记录"
End Sub
Private Sub DataGrid4_Click()
MDIForm1.StatusBar1.Panels(1) = "选取一条记录"
End Sub
Private Sub DataGrid4_Error(ByVal DataError As Integer, Response As Integer)
MDIForm1.StatusBar1.Panels(1) = "选取一条记录"
If DataError = -2147467259 Then
Response = 0
End If
End Sub
Private Sub DataGrid4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = "影碟销售情况数据"
End Sub
Private Sub Form_GotFocus()
bool1 = True
MDIForm1.Combo1.Text = "[销售情况信息]"
Text1.Enabled = False
Text4.Enabled = False
End Sub
Private Sub Form_Load()
bool1 = True
Text1.Enabled = False
Text4.Enabled = False
MDIForm1.Combo1.Text = "[销售情况信息]"
DTPicker1.Value = Date
Combo1.AddItem "歌碟销售"
Combo1.AddItem "影碟销售"
If Adodc2.Recordset.RecordCount <> 0 Then
Adodc2.Refresh
End If
If Combo1.Text = "歌碟销售" Then
MDIForm1.StatusBar1.Panels(1) = "歌碟销售"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "总表"
Adodc1.Refresh
DataGrid3.Visible = True
DataGrid2.Visible = False
DataGrid1.Visible = True
DataGrid4.Visible = False
'Label3.Visible = True
'Label1.Visible = False
Adodc2.CommandType = adCmdTable
Adodc2.RecordSource = "销售情况表"
Adodc2.Refresh
Text2.DataField = "光碟名"
End If
If Combo1.Text = "影碟销售" Then
MDIForm1.StatusBar1.Panels(1) = "影碟销售"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "影碟入库"
Adodc1.Refresh
DataGrid2.Visible = True
DataGrid3.Visible = False
DataGrid4.Visible = True
DataGrid1.Visible = False
'Label3.Visible = False
'Label1.Visible = True
Adodc2.CommandType = adCmdTable
Adodc2.RecordSource = "影碟销售表"
Adodc2.Refresh
Text2.DataField = "影碟名"
End If
'Adodc2.Recordset.AddNew
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
MDIForm1.StatusBar1.Panels(1) = ""
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Adodc2.Recordset.RecordCount <> 0 Then
If Text1.Text = "" Or Text4.Text = "" Then
Adodc2.Recordset.Delete
End If
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Text1.Text <> "" Then
If KeyAscii = 13 Then
Text4.SetFocus
End If
End If
End Sub
Private Sub Text1_LostFocus()
If Text1.Text <> "" Then
If Adodc2.Recordset.RecordCount <> 0 Then
Adodc2.Recordset("盘号") = Text1.Text
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveFirst
For i = 0 To Adodc1.Recordset.RecordCount - 1
Adodc1.Recordset.Find "盘号=" & Text1.Text & " "
Next
End If
End If
If Combo1.Text = "歌碟销售" Then
If Text1.Text <> "" Then
If Adodc1.Recordset.EOF = False Then
bool = True
Text2.Text = Adodc1.Recordset("专辑名")
Text3.Text = Adodc1.Recordset("价格")
Adodc2.Recordset("光碟名") = Text2.Text
Adodc2.Recordset("价格") = Text3.Text
Else
MDIForm1.StatusBar1.Panels(1) = "此碟不存在"
bool = False
MsgBox "此碟不存在", 64, "无此碟"
Adodc2.Recordset.Delete
bool1 = True
Command1.SetFocus
End If
End If
End If
End If
If Combo1.Text = "影碟销售" Then
If Text1.Text <> "" Then
If Adodc1.Recordset.EOF = False Then
bool = True
Text2.Text = Adodc1.Recordset("电影名")
Text3.Text = Adodc1.Recordset("价格")
Adodc2.Recordset("影碟名") = Text2.Text
Adodc2.Recordset("价格") = Text3.Text
Else
MDIForm1.StatusBar1.Panels(1) = "此碟不存在"
bool = False
MsgBox "此碟不存在", 64, "无此碟"
Adodc2.Recordset.Delete adAffectCurrent
bool1 = True
Command1.SetFocus
End If
End If
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text2_LostFocus()
If Adodc2.Recordset.RecordCount <> 0 Then
If Combo1.Text = "歌碟销售" Then
Adodc2.Recordset("光碟名") = Text2.Text
End If
If Combo1.Text = "影碟销售" Then
Adodc2.Recordset("影碟名") = Text2.Text
End If
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text3_LostFocus()
If Adodc2.Recordset.RecordCount <> 0 Then
Adodc2.Recordset("价格") = Val(Text3.Text)
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If Text4.Text <> "" Then
If KeyAscii = 13 Then
If Val(Text4.Text) <= 0 Then
MDIForm1.StatusBar1.Panels(1) = "输入错误"
Text4.Text = 0
MsgBox "输入错误", 64, "请重输"
Else
bool1 = True
Command1.SetFocus
End If
End If
End If
End Sub
Private Sub Text4_LostFocus()
Dim fb As Boolean
If Text4.Text <> "" Then
If Adodc2.Recordset.RecordCount <> 0 Then
If bool = True Then
If Adodc1.Recordset("数量") >= Val(Text4.Text) Then
Adodc1.Recordset("数量") = Adodc1.Recordset("数量") - Val(Text4.Text)
fb = True
Else
MsgBox "库存不足", 64, "库存不足"
fb = False
End If
If Adodc1.Recordset("数量") >= 0 And fb = True Then
Adodc1.Recordset.Update
Adodc2.Recordset("出售数量") = Val(Text4.Text)
Adodc2.Recordset("销售总价") = Adodc2.Recordset("价格") * Adodc2.Recordset("出售数量")
Adodc2.Recordset.Update
Else
MDIForm1.StatusBar1.Panels(1) = "本光碟已售完"
If Adodc1.Recordset("数量") <= 0 Then
Adodc1.Recordset("数量") = 0
MsgBox "本光碟已售完", 64, "已售完"
End If
'Adodc2.Recordset("出售数量") = Val(Text4.Text)
'Adodc2.Recordset("销售总价") = Adodc2.Recordset("价格") * Adodc2.Recordset("出售数量")
'Adodc2.Recordset("售出时间") = DTPicker1.Value
'Adodc2.Recordset.Update
Adodc2.Recordset.Delete
'Adodc2.Recordset.Update
'Adodc2.Refresh
'Adodc2.Recordset.MoveLast
'DataGrid1.Refresh
End If
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -