📄 frmmain.frm
字号:
DataField = "单位"
Caption = "单位"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
DataField = "单价"
Caption = "单价"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column06
DataField = "合价"
Caption = "合价"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
Object.Visible = 0 'False
ColumnWidth = 1094.74
EndProperty
BeginProperty Column01
ColumnWidth = 1184.882
EndProperty
BeginProperty Column02
ColumnWidth = 2910.047
EndProperty
BeginProperty Column03
ColumnWidth = 1154.835
EndProperty
BeginProperty Column04
ColumnWidth = 1289.764
EndProperty
BeginProperty Column05
ColumnWidth = 1560.189
EndProperty
BeginProperty Column06
ColumnWidth = 1874.835
EndProperty
EndProperty
End
Begin VB.Label Label3
BorderStyle = 1 'Fixed Single
Height = 375
Left = 4200
TabIndex = 9
Top = 360
Width = 6495
End
Begin VB.Label Label2
Caption = "数量:"
Height = 375
Left = 360
TabIndex = 4
Top = 1080
Width = 855
End
Begin VB.Label Label1
Caption = "编码:"
Height = 375
Left = 360
TabIndex = 3
Top = 360
Width = 855
End
Begin VB.Menu Basedo
Caption = "基本操作(&B)"
Begin VB.Menu UserM
Caption = "用户管理(&U)"
End
Begin VB.Menu DockM
Caption = "仓库管理(&D)"
End
Begin VB.Menu SaleM
Caption = "销售管理(&S)"
End
Begin VB.Menu EmpolyM
Caption = "员工管理(&E)"
End
End
Begin VB.Menu myHelp
Caption = "帮助(&H)"
Begin VB.Menu myAbout
Caption = "关于(&A)"
End
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Num As Double
Private Sub Command1_Click()
With Adodc1.Recordset
.AddNew
.Fields(1) = Text1.Text
.Fields(2) = Adodc2.Recordset.Fields(2)
.Fields(3) = Text2.Text
.Fields(4) = Adodc2.Recordset.Fields(4)
.Fields(5) = Adodc2.Recordset.Fields(3)
.Fields(6) = Format(Val(Adodc2.Recordset.Fields(3)) * Val(Text2.Text), "fixed")
If Not .EOF Then .MoveNext
.Requery
End With
With Adodc2.Recordset
.Fields(5) = Num - Val(Text2.Text)
.Update
End With
Text1.Text = ""
Text2.Text = ""
Label3.Caption = ""
Text1.SetFocus
End Sub
Private Sub Command2_Click()
With Adodc2
.CommandType = adCmdText
.ConnectionString = getDbStr
If Not Adodc1.Recordset.EOF Then
tmp = Adodc1.Recordset.Fields(1).Value
Else
tmp = ""
End If
If tmp = "" Then
tmp = " "
Else
tmp = Adodc1.Recordset.Fields(1).Value
End If
.RecordSource = "select * from 仓库表 where 编号='" & tmp & "'"
.Refresh
If Not .Recordset.EOF Then
.Recordset.Fields(5) = Val(.Recordset.Fields(5)) + Val(Adodc1.Recordset.Fields(3).Value)
.Recordset.Update
End If
End With
With Adodc1.Recordset
If Not .EOF Then
.Delete
.MoveNext
.Requery
End If
End With
End Sub
Private Sub Command3_Click()
frmDockB.Show 0, Me
End Sub
Private Sub Command4_Click()
Command4.Enabled = False
With Adodc1.Recordset
If Not .EOF Then
Do Until .EOF
With Adodc3.Recordset
.AddNew
.Fields(1) = Now
.Fields(2) = Adodc1.Recordset.Fields(1).Value
.Fields(3) = Adodc1.Recordset.Fields(2).Value
.Fields(4) = Adodc1.Recordset.Fields(5).Value
.Fields(5) = Adodc1.Recordset.Fields(4).Value
.Fields(6) = Adodc1.Recordset.Fields(3).Value
.Fields(7) = Adodc1.Recordset.Fields(6).Value
.Fields(8) = getManager
If Not .EOF Then .MoveNext
.Requery
End With
If Not .EOF Then .MoveNext
Loop
If .RecordCount > 0 Then .MoveFirst
Do Until .EOF
.Delete
.MoveNext
Loop
MsgBox "入库成功!", vbInformation, "成功"
End If
End With
Command4.Enabled = True
End Sub
Private Sub Command5_Click()
Unload Me
End Sub
Private Sub DockM_Click()
frmDock.Show 1, Me
End Sub
Private Sub EmpolyM_Click()
frmEmp.Show 1, Me
End Sub
Private Sub Form_Activate()
Text1.SetFocus
End Sub
Private Sub Form_Load()
Call ResizeInit(Me)
With Adodc1
.CommandType = adCmdText
.ConnectionString = getDbStr
.RecordSource = "select * from 临时表"
.Refresh
End With
With Adodc1.Recordset
Do Until .EOF
.Delete
.MoveNext
Loop
End With
With Adodc3
.CommandType = adCmdText
.ConnectionString = getDbStr
.RecordSource = "select * from 销售表"
.Refresh
End With
If getManager = "系统管理员" Then
Basedo.Enabled = True
Else
Basedo.Enabled = False
End If
StatusBar1.SimpleText = "新时代超市管理系统1.0" & " " & "制作人:季洪彬" & " 您的登录时间:" & Now & " 操作员:" & getManager
'Unload frmSplash
End Sub
Private Sub Form_Resize()
Call ResizeForm(Me)
End Sub
Private Sub myAbout_Click()
frmAbout.Show 1, Me
End Sub
Private Sub SaleM_Click()
frmSale.Show 1, Me
End Sub
Private Sub Text1_Change()
Call delErr(Text1)
With Adodc2
.CommandType = adCmdText
.ConnectionString = getDbStr
tmp = Text1.Text
If tmp = "" Then
tmp = " "
Else
tmp = Text1.Text
End If
.RecordSource = "select * from 仓库表 where 编号='" & tmp & "'"
.Refresh
End With
If Not Adodc2.Recordset.EOF Then
Num = Val(Adodc2.Recordset.Fields(5).Value)
Label3.Caption = "名称:" & Adodc2.Recordset.Fields(2).Value & " 库存数量:" & Num & _
Adodc2.Recordset.Fields(4).Value
Else
Label3.Caption = "无库存"
End If
End Sub
Private Sub Text2_Change()
Call chkTxt(Text2)
If IsNumeric(Text2.Text) And Val(Text2.Text) > 0 And Val(Text2.Text) <= Num Then
Command1.Enabled = True
Else
Command1.Enabled = False
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 And Command1.Enabled = True Then
Command1_Click
Text1.SetFocus
End If
End Sub
Private Sub UserM_Click()
frmUser.Show 1, Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -