📄 main_xsyw_xsyc.frm
字号:
VERSION 5.00
Begin VB.Form main_xsyw_xsyc
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 3975
ClientLeft = 45
ClientTop = 330
ClientWidth = 5970
Icon = "main_xsyw_xsyc.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3975
ScaleWidth = 5970
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdQY
Caption = "…"
Height = 300
Left = 5355
TabIndex = 17
Top = 2160
Width = 390
End
Begin VB.TextBox Text1
Height = 330
Index = 4
Left = 1305
TabIndex = 15
Top = 2985
Width = 4005
End
Begin VB.TextBox Text1
Height = 330
Index = 3
Left = 1305
TabIndex = 13
Top = 2565
Width = 4005
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 390
Left = 3180
TabIndex = 10
Top = 3480
Width = 1650
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 390
Left = 1305
TabIndex = 9
Top = 3480
Width = 1650
End
Begin VB.TextBox Text1
Height = 330
Index = 2
Left = 1305
TabIndex = 8
Top = 2145
Width = 4455
End
Begin VB.CommandButton cmdCP
Caption = "…"
Height = 300
Left = 5355
TabIndex = 6
Top = 1740
Width = 390
End
Begin VB.TextBox Text1
Height = 330
Index = 1
Left = 1305
TabIndex = 5
Top = 1725
Width = 4455
End
Begin VB.TextBox Text1
Height = 330
Index = 0
Left = 2220
TabIndex = 3
Top = 1230
Width = 2490
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2220
TabIndex = 2
Text = "Combo1"
Top = 885
Width = 2490
End
Begin VB.Label Label9
Caption = "%"
Height = 225
Left = 4740
TabIndex = 18
Top = 1305
Width = 225
End
Begin VB.Label Label8
Caption = "销售区域:"
Height = 240
Left = 390
TabIndex = 16
Top = 2205
Width = 930
End
Begin VB.Label Label7
Caption = "预测销售量:"
Height = 240
Left = 210
TabIndex = 14
Top = 2670
Width = 1110
End
Begin VB.Label Label3
Caption = "元"
Height = 225
Left = 5385
TabIndex = 12
Top = 3045
Width = 225
End
Begin VB.Label Label6
Caption = "固定增长率:"
Height = 165
Left = 1095
TabIndex = 11
Top = 1290
Width = 1095
End
Begin VB.Label Label5
Caption = "预测销售额:"
Height = 240
Left = 210
TabIndex = 7
Top = 3075
Width = 1110
End
Begin VB.Label Label4
Caption = "预测产品:"
Height = 240
Left = 390
TabIndex = 4
Top = 1800
Width = 930
End
Begin VB.Label Label2
Caption = "说明:本功能将预测明年的销售额。 预测前请首先录入上一年的销售额"
Height = 390
Left = 210
TabIndex = 1
Top = 135
Width = 5025
End
Begin VB.Label Label1
Caption = "请选择要预测的年份:"
Height = 195
Left = 390
TabIndex = 0
Top = 945
Width = 1830
End
End
Attribute VB_Name = "main_xsyw_xsyc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Private Sub Form_Activate()
If IntLoadDataTree = 2 Then
Command1.SetFocus
ElseIf intCP = 2 Then Text1(2).SetFocus
Else
Combo1.SetFocus
End If
End Sub
Private Sub Form_Load()
Me.Caption = text
For i = 2000 To 3010
Combo1.AddItem i
Next i
Combo1.ListIndex = 1
End Sub
Private Sub Text1_KeyDown(index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn And index < 4 Then Text1(index + 1).SetFocus
If KeyCode = vbKeyReturn And index = 1 Then cmdCP.SetFocus
If KeyCode = vbKeyReturn And index = 2 Then cmdQY.SetFocus
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text1(0).SetFocus
End Sub
Private Sub cmdCP_Click()
intCP = 2
Load main_cpxx
main_cpxx.Show 1
End Sub
Private Sub cmdQY_Click()
IntLoadDataTree = 2
Load main_datatree
main_datatree.Show 1
End Sub
Private Sub Command1_Click()
'(预测)明年的销售额=上一年的销售额×固定增长率
rs1.Open "select 品名规格,left(所在月份,4),sum(月销量)as 销售总量,sum(月销售额) as 销售总额 from 销售表 where left(所在月份,4)=" & Combo1 - 1 & "and 品名规格='" + Text1(1) + "'and 所在区域='" + Text1(2) + "'group by 品名规格,left(所在月份,4)", Cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
Text1(3) = Round(rs1.Fields(2) * (Val(Text1(0)) / 100), 0)
Text1(4) = Round(rs1.Fields(3) * (Val(Text1(0)) / 100), 2)
Cnn.Execute ("insert into 预测表(品名规格,销售区域,预测销量,预测销售额,预测年份,录入日期) values('" + Text1(1) + "','" + Text1(2) + "'," + Text1(3) + "," + Text1(4) + ",'" + Combo1 + "','" + Str(Date) + "')")
Else
MsgBox "没有预测数据!"
End If
rs1.Close
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -