📄 tj.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form tj
BorderStyle = 1 'Fixed Single
Caption = "销售统计"
ClientHeight = 7695
ClientLeft = 45
ClientTop = 375
ClientWidth = 9510
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "tj.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7695
ScaleWidth = 9510
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text2
Height = 375
Left = 6360
TabIndex = 15
Text = "Text2"
Top = 6960
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 3000
TabIndex = 14
Text = "Text1"
Top = 6960
Width = 1695
End
Begin MSFlexGridLib.MSFlexGrid MSF1
Height = 4455
Left = 0
TabIndex = 10
Top = 2040
Width = 9495
_ExtentX = 16748
_ExtentY = 7858
_Version = 393216
BackColorBkg = 16777215
AllowUserResizing= 3
End
Begin VB.Frame Frame1
Caption = "统计条件"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2055
Left = 0
TabIndex = 0
Top = 0
Width = 9495
Begin VB.TextBox Text3
Height = 375
Left = 6240
TabIndex = 16
Text = "Text3"
Top = 360
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 7680
TabIndex = 12
Top = 1080
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 495
Left = 7680
TabIndex = 9
Top = 360
Width = 1335
End
Begin VB.ComboBox Combo2
Height = 360
Left = 1800
TabIndex = 8
Text = "Combo2"
Top = 1440
Width = 4935
End
Begin VB.ComboBox Combo1
Height = 360
Left = 1800
TabIndex = 7
Text = "Combo1"
Top = 960
Width = 4935
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 375
Left = 3960
TabIndex = 6
Top = 480
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 19726337
CurrentDate = 38348
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 1800
TabIndex = 4
Top = 480
Width = 1695
_ExtentX = 2990
_ExtentY = 661
_Version = 393216
Format = 19726337
CurrentDate = 38348
End
Begin VB.Label Label4
Caption = "至"
Height = 255
Left = 3600
TabIndex = 5
Top = 600
Width = 255
End
Begin VB.Label Label3
Caption = "产品名称:"
Height = 255
Left = 480
TabIndex = 3
Top = 1440
Width = 1215
End
Begin VB.Label Label2
Caption = "销售单位:"
Height = 255
Left = 480
TabIndex = 2
Top = 960
Width = 1215
End
Begin VB.Label Label1
Caption = "日期范围:"
Height = 255
Left = 480
TabIndex = 1
Top = 480
Width = 1335
End
End
Begin VB.Label Label6
Caption = "实际金额:"
Height = 255
Left = 5040
TabIndex = 13
Top = 7080
Width = 1215
End
Begin VB.Label Label5
Caption = "符合查询累计进货金额:"
Height = 495
Left = 1200
TabIndex = 11
Top = 6840
Width = 1575
End
End
Attribute VB_Name = "tj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim reslut As New ADODB.Recordset
Dim sql
Dim count, count2
count = 0
count2 = 0
MSF1.Clear
MSF1.FixedCols = 0
MSF1.ColAlignment(0) = 4
MSF1.Cols = 6
MSF1.Rows = 1
MSF1.Col = 0
MSF1.Row = 0
MSF1.Text = "日期"
MSF1.Col = 1
MSF1.Text = "产品名称"
MSF1.Col = 2
MSF1.Text = "面值(元)"
MSF1.Col = 3
MSF1.Text = "数量(张)"
MSF1.Col = 4
MSF1.Text = "折扣"
MSF1.Col = 5
MSF1.Text = "销售单位"
MSF1.ColWidth(0) = 1500
MSF1.ColWidth(1) = 4000
MSF1.ColWidth(2) = 1200
MSF1.ColWidth(3) = 1200
MSF1.ColWidth(4) = 1000
MSF1.ColWidth(5) = 3000
Text1.Text = ""
Text2.Text = ""
If Text3.Text = "" Then
If Combo1.Text = "" And Combo2.Text = "" Then
sql = "select * from 销售订单 where 订购日期>=#" & DTPicker1.Value & "# and 订购日期<=#" & DTPicker2.Value & "#"
End If
If Combo1.Text <> "" And Combo2.Text = "" Then
sql = "select * from 销售订单 where 销售商名称='" & Combo1.Text & "' and 订购日期>=#" & DTPicker1.Value & "# and 订购日期<=#" & DTPicker2.Value & "#"
End If
If Combo1.Text = "" And Combo2.Text <> "" Then
sql = "select * from 销售订单 where 产品名称='" & Combo2.Text & "' and 订购日期>=#" & DTPicker1.Value & "# and 订购日期<=#" & DTPicker2.Value & "#"
End If
If Combo1.Text <> "" And Combo2.Text <> "" Then
sql = "select * from 销售订单 where 销售商名称='" & Combo1.Text & "' and 产品名称='" & Combo2.Text & "' and 订购日期>=#" & DTPicker1.Value & "# and 订购日期<=#" & DTPicker2.Value & "#"
End If
Else
If Combo1.Text = "" And Combo2.Text = "" Then
sql = "select * from 销售订单 where 订购日期>=#" & DTPicker1.Value & "# and 起始序列号<='" & Text3.Text & "' and 终止序列号>='" & Text3.Text & "' and 订购日期<=#" & DTPicker2.Value & "#"
End If
If Combo1.Text <> "" And Combo2.Text = "" Then
sql = "select * from 销售订单 where 销售商名称='" & Combo1.Text & "' and 起始序列号<='" & Text3.Text & "' and 终止序列号>='" & Text3.Text & "' and 订购日期>=#" & DTPicker1.Value & "# and 订购日期<=#" & DTPicker2.Value & "#"
End If
If Combo1.Text = "" And Combo2.Text <> "" Then
sql = "select * from 销售订单 where 产品名称='" & Combo2.Text & "' and 起始序列号<='" & Text3.Text & "' and 终止序列号>='" & Text3.Text & "' and 订购日期>=#" & DTPicker1.Value & "# and 订购日期<=#" & DTPicker2.Value & "#"
End If
If Combo1.Text <> "" And Combo2.Text <> "" Then
sql = "select * from 销售订单 where 销售商名称='" & Combo1.Text & "' and 产品名称='" & Combo2.Text & "' and 起始序列号<='" & Text3.Text & "' and 终止序列号>='" & Text3.Text & "' and 订购日期>=#" & DTPicker1.Value & "# and 订购日期<=#" & DTPicker2.Value & "#"
End If
End If
reslut.Open sql, main.strcnn, adOpenKeyset, adLockOptimistic
If Not reslut.EOF Then
For i = 1 To reslut.RecordCount
MSF1.Rows = reslut.RecordCount + 1
MSF1.Col = 0
MSF1.Row = i
MSF1.Text = reslut.Fields("订购日期")
MSF1.Col = 1
MSF1.Text = reslut.Fields("产品名称")
MSF1.Col = 2
MSF1.Text = reslut.Fields("单价")
MSF1.Col = 3
MSF1.Text = reslut.Fields("数量")
MSF1.Col = 4
MSF1.Text = reslut.Fields("折扣")
MSF1.Col = 5
MSF1.Text = reslut.Fields("销售商名称")
count = count + Format(CSng(reslut.Fields("单价")) * CSng(reslut.Fields("数量")), "#######.00")
count2 = count2 + Format(CSng(reslut.Fields("单价")) * CSng(reslut.Fields("数量")) * CSng(reslut.Fields("折扣")), "#######.00")
reslut.MoveNext
Next i
Text1.Text = count
Text2.Text = count2
End If
reslut.Close
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim reslut As New ADODB.Recordset
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Combo1.Clear
Combo2.Clear
count1 = 0
reslut.Open "select * from 销售网点资料 order by 销售商ID", main.strcnn, adOpenKeyset, adLockOptimistic
If Not reslut.EOF Then
For i = 1 To reslut.RecordCount
Combo1.AddItem (reslut.Fields("销售商名称"))
reslut.MoveNext
Next i
End If
reslut.Close
reslut.Open "select * from 产品目录 order by 产品编号", main.strcnn, adOpenKeyset, adLockOptimistic
If Not reslut.EOF Then
For i = 1 To reslut.RecordCount
Combo2.AddItem (reslut.Fields("产品名称"))
reslut.MoveNext
Next i
End If
reslut.Close
MSF1.FixedCols = 0
MSF1.ColAlignment(0) = 4
MSF1.Cols = 6
MSF1.Rows = 1
MSF1.Col = 0
MSF1.Row = 0
MSF1.Text = "日期"
MSF1.Col = 1
MSF1.Text = "产品名称"
MSF1.Col = 2
MSF1.Text = "面值(元)"
MSF1.Col = 3
MSF1.Text = "数量(张)"
MSF1.Col = 4
MSF1.Text = "折扣"
MSF1.Col = 5
MSF1.Text = "销售单位"
MSF1.ColWidth(0) = 1500
MSF1.ColWidth(1) = 4000
MSF1.ColWidth(2) = 1200
MSF1.ColWidth(3) = 1200
MSF1.ColWidth(4) = 1000
MSF1.ColWidth(5) = 3000
DTPicker1.Value = Date
DTPicker2.Value = Date
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -