📄 main_rcyw_xscx.frm
字号:
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column12
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
ColumnWidth = 1005.165
EndProperty
BeginProperty Column01
ColumnWidth = 1500.095
EndProperty
BeginProperty Column02
ColumnWidth = 1500.095
EndProperty
BeginProperty Column03
ColumnWidth = 794.835
EndProperty
BeginProperty Column04
ColumnWidth = 900.284
EndProperty
BeginProperty Column05
ColumnWidth = 1005.165
EndProperty
BeginProperty Column06
ColumnWidth = 494.929
EndProperty
BeginProperty Column07
ColumnWidth = 494.929
EndProperty
BeginProperty Column08
ColumnWidth = 794.835
EndProperty
BeginProperty Column09
ColumnWidth = 1365.165
EndProperty
BeginProperty Column10
ColumnWidth = 2085.166
EndProperty
BeginProperty Column11
ColumnWidth = 1365.165
EndProperty
BeginProperty Column12
ColumnWidth = 2085.166
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Height = 630
Left = 45
TabIndex = 0
Top = -15
Width = 5385
Begin VB.CheckBox Check1
Height = 225
Left = 135
TabIndex = 20
Top = 240
Width = 270
End
Begin MSComCtl2.DTPicker DTP1
Height = 285
Left = 1035
TabIndex = 12
Top = 240
Width = 1860
_ExtentX = 3281
_ExtentY = 503
_Version = 393216
Format = 74776577
CurrentDate = 37855
End
Begin MSComCtl2.DTPicker DTP2
Height = 285
Left = 3360
TabIndex = 14
Top = 240
Width = 1860
_ExtentX = 3281
_ExtentY = 503
_Version = 393216
Format = 74776577
CurrentDate = 37855
End
Begin VB.Label Label2
Caption = "日期从 至"
Height = 180
Left = 435
TabIndex = 13
Top = 300
Width = 2910
End
End
Begin VB.Frame Frame4
Height = 660
Left = 45
TabIndex = 15
Top = 495
Width = 5385
Begin VB.CheckBox Check2
Height = 225
Left = 135
TabIndex = 19
Top = 255
Width = 270
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "main_rcyw_xscx.frx":0CDF
Left = 1950
List = "main_rcyw_xscx.frx":0CE1
TabIndex = 18
Top = 210
Width = 780
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "main_rcyw_xscx.frx":0CE3
Left = 435
List = "main_rcyw_xscx.frx":0CE5
TabIndex = 17
Top = 210
Width = 1515
End
Begin VB.TextBox Text1
Height = 300
Left = 2730
TabIndex = 16
Top = 210
Width = 2505
End
End
Begin VB.Label je
BackStyle = 0 'Transparent
ForeColor = &H000000FF&
Height = 180
Left = 4920
TabIndex = 6
Top = 3660
Width = 1755
End
Begin VB.Label sl
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 180
Left = 2655
TabIndex = 5
Top = 3660
Width = 1080
End
Begin VB.Label pz
BackStyle = 0 'Transparent
ForeColor = &H0000FF00&
Height = 180
Left = 945
TabIndex = 4
Top = 3660
Width = 780
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "销售次数: 销售数量: 销售金额:"
ForeColor = &H00800000&
Height = 195
Left = 75
TabIndex = 3
Top = 3660
Width = 6765
End
End
Attribute VB_Name = "main_rcyw_xscx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Myval As String
Private Sub viewdata() '声明显示销售品种、销售数量、销售金额的过程
With Adodc2.Recordset
If .Fields(0) <> "" Then pz.Caption = .Fields(0) Else pz.Caption = "0"
If .Fields(1) <> "" Then sl.Caption = .Fields(1) Else sl.Caption = "0"
If .Fields(2) <> "" Then je.Caption = Format(.Fields(2), "0.00") Else je.Caption = "0.00"
'Format 函数返回 Variant (String),其中含有一个表达式,它是根据格式表达式中的指令来格式化的。
End With
End Sub
Private Sub Form_Load()
'自动识别路径
Adodc1.ConnectionString = "DSN=NBooks"
Adodc1.RecordSource = "select * from xsb"
Adodc1.Refresh
Adodc2.ConnectionString = "DSN=NBooks"
Adodc2.RecordSource = "select * from xsb"
Adodc2.Refresh
'添加字段列表
Combo1.AddItem ("书号")
Combo1.AddItem ("条形码")
Combo1.AddItem ("书名")
Combo1.AddItem ("作者")
Combo1.AddItem ("出版社")
Combo1.AddItem ("图书类别")
Combo1.AddItem ("票号")
Combo1.AddItem ("操作员")
Combo1.AddItem ("经手人")
Combo1.ListIndex = 0
'添加查询条件列表
Combo2.AddItem ("like")
Combo2.AddItem ("=")
Combo2.ListIndex = 0
'设置查询日期
DTP1.Value = Date - 10
DTP2.Value = Date
CmdFind_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub CmdFind_Click() '查询
Select Case Combo2.text
Case Is = "like"
If Check1.Value = 0 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from xsb where xsb." & Combo1.text & " like +'%'+'" + Text1.text + "'+ '%'order by 票号"
Adodc1.Refresh
Adodc2.RecordSource = "select count(*)as 品种,sum(销售数量)as 合计数量,sum(金额)as 合计金额 from xsb where xsb." & Combo1.text & " like +'" + Text1.text + "'+ '%'"
Adodc2.Refresh
Call viewdata
End If
If Check1.Value = 1 And Check2.Value = 0 Then
a = Left(DTP1.Value, 4) & Right(Left(DTP1.Value, 7), 2) & Right(DTP1.Value, 2)
B = Left(DTP2.Value, 4) & Right(Left(DTP2.Value, 7), 2) & Right(DTP2.Value, 2)
If Val(B) < Val(a) Then
MsgBox "请输入正确的日期!", , "图书综合管理系统"
Else
Adodc1.RecordSource = "Select * from xsb where 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "' order by 票号"
'Str 函数返回代表一数值的 Variant (String)。
Adodc1.Refresh
Adodc2.RecordSource = "select count(*)as 品种,sum(销售数量)as 合计数量,sum(金额)as 合计金额 from xsb where 日期 between '" + Str(DTP1.Value) + "'and '" + Str(DTP2.Value) + "'"
Adodc2.Refresh
Call viewdata
End If
End If
If Check1.Value = 1 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from xsb where xsb." & Combo1.text & " like +'%'+'" + Text1.text + "'+ '%'and 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "'order by 票号"
Adodc1.Refresh
Adodc2.RecordSource = "select count(*)as 品种,sum(销售数量)as 合计数量,sum(金额)as 合计金额 from xsb where xsb." & Combo1.text & " like +'" + Text1.text + "'+ '%'and 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "'"
Adodc2.Refresh
Call viewdata
End If
Case Is = "="
If Check1.Value = 0 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from xsb where xsb." & Combo1.text & "= '" + Text1.text + "'order by 票号"
Adodc1.Refresh
Adodc2.RecordSource = "select count(*)as 品种,sum(销售数量)as 合计数量,sum(金额)as 合计金额 from xsb where xsb." & Combo1.text & "='" + Text1.text + "'"
Adodc2.Refresh
Call viewdata
End If
If Check1.Value = 1 And Check2.Value = 0 Then
a = Left(DTP1.Value, 4) & Right(Left(DTP1.Value, 7), 2) & Right(DTP1.Value, 2)
B = Left(DTP2.Value, 4) & Right(Left(DTP2.Value, 7), 2) & Right(DTP2.Value, 2)
If Val(B) < Val(a) Then
MsgBox "请输入正确的日期!", , "图书综合管理系统"
Else
Adodc1.RecordSource = "Select * from xsb where 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "' order by 票号"
'Str 函数返回代表一数值的 Variant (String)。
Adodc1.Refresh
Adodc2.RecordSource = "select count(*)as 品种,sum(销售数量)as 合计数量,sum(金额)as 合计金额 from xsb where 日期 between '" + Str(DTP1.Value) + "'and '" + Str(DTP2.Value) + "'"
Adodc2.Refresh
Call viewdata
End If
End If
If Check1.Value = 1 And Check2.Value = 1 Then
Adodc1.RecordSource = "select * from xsb where xsb." & Combo1.text & " ='" + Text1.text + "'and 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "' order by 票号"
Adodc1.Refresh
Adodc2.RecordSource = "select count(*)as 品种,sum(销售数量)as 合计数量,sum(金额)as 合计金额 from xsb where xsb." & Combo1.text & "='" + Text1.text + "'and 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "'"
Adodc2.Refresh
Call viewdata
End If
End Select
End Sub
Private Sub CmdPrint_Click() '打印
Select Case Combo2.text
Case Is = "like"
If Check1.Value = 0 And Check2.Value = 1 Then
DataE1.rsCommand1.Open "select * from xsb where xsb." & Combo1.text & " like +'%'+'" + Text1.text + "'+ '%'order by 销售数量 desc"
End If
If Check1.Value = 1 And Check2.Value = 0 Then
DataE1.rsCommand1.Open "Select * from xsb where 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "' order by 销售数量 desc"
End If
If Check1.Value = 1 And Check2.Value = 1 Then
DataE1.rsCommand1.Open "select * from xsb where xsb." & Combo1.text & " like +'%'+'" + Text1.text + "'+ '%'and 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "' order by 销售数量 desc"
End If
Case Is = "="
If Check1.Value = 0 And Check2.Value = 1 Then
DataE1.rsCommand1.Open "select * from xsb where xsb." & Combo1.text & "= '" + Text1.text + "'order by 销售数量 desc", Cnn, adOpenKeyset, adLockOptimistic
End If
If Check1.Value = 1 And Check2.Value = 1 Then
DataE1.rsCommand1.Open "select * from xsb where xsb." & Combo1.text & " ='" + Text1.text + "'and 日期 between '" + Str(DTP1.Value) + "' and '" + Str(DTP2.Value) + "' order by 销售数量 desc"
End If
End Select
DR1_xscx.Show
End Sub
Private Sub CmdDelete_Click() '删除
Myval = MsgBox("是否真的删除该数据?", vbYesNo, "图书综合管理系统")
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
If Myval = vbYes Then
On Error Resume Next
Adodc1.Recordset.Delete '删除记录
Adodc1.Recordset.Update '更新数据表
End If
End Sub
Private Sub CmdEnd_Click() '退出
Unload Me
frm_main.Enabled = True
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then CmdFind.SetFocus '按回车键CmdFind获得焦点
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -