📄 frmquerystore.frm
字号:
VERSION 5.00
Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#2.0#0"; "THREED20.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Object = "{4A4AA691-3E6F-11D2-822F-00104B9E07A1}#3.0#0"; "ssdw3bo.ocx"
Begin VB.Form frmQueryStore
BorderStyle = 3 'Fixed Dialog
Caption = "配送中心库存查询"
ClientHeight = 6405
ClientLeft = 45
ClientTop = 330
ClientWidth = 9645
Icon = "frmQueryStore.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6405
ScaleWidth = 9645
ShowInTaskbar = 0 'False
Begin ComctlLib.StatusBar AD
Align = 2 'Align Bottom
Height = 435
Left = 0
TabIndex = 9
Top = 5970
Width = 9645
_ExtentX = 17013
_ExtentY = 767
SimpleText = ""
_Version = 327682
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 3
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
AutoSize = 2
TextSave = ""
Key = "MSG"
Object.Tag = ""
EndProperty
BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7}
TextSave = ""
Key = ""
Object.Tag = ""
EndProperty
BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7}
AutoSize = 1
Object.Width = 11827
TextSave = ""
Key = ""
Object.Tag = ""
EndProperty
EndProperty
End
Begin VB.Frame Frame1
Caption = "条件"
Height = 825
Left = 90
TabIndex = 4
Top = 675
Width = 9375
Begin VB.OptionButton optTotal
Caption = "汇总"
Height = 270
Left = 7530
TabIndex = 11
Top = 330
Width = 1305
End
Begin VB.OptionButton optDet
Caption = "明细"
Height = 300
Left = 6375
TabIndex = 10
Top = 330
Value = -1 'True
Width = 1170
End
Begin VB.TextBox txtSname
Height = 285
Left = 4110
TabIndex = 1
Top = 270
Width = 1620
End
Begin VB.TextBox txtIncode
Height = 285
Left = 1185
TabIndex = 0
Top = 338
Width = 1620
End
Begin VB.Label Label6
AutoSize = -1 'True
Height = 180
Left = 6915
TabIndex = 7
Top = 855
Width = 90
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "品 名"
Height = 180
Left = 3360
TabIndex = 6
Top = 315
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "商品编码"
Height = 180
Left = 390
TabIndex = 5
Top = 390
Width = 720
End
End
Begin VB.PictureBox Picture1
Align = 1 'Align Top
Appearance = 0 'Flat
BackColor = &H80000004&
ForeColor = &H80000008&
Height = 612
Left = 0
ScaleHeight = 585
ScaleWidth = 9615
TabIndex = 2
Top = 0
Width = 9645
Begin MSComDlg.CommonDialog dlgPrinter
Left = 5376
Top = 72
_ExtentX = 688
_ExtentY = 688
_Version = 393216
End
Begin Threed.SSCommand SSCommand1
Height = 570
Left = 1290
TabIndex = 13
TabStop = 0 'False
Top = 15
Width = 1170
_ExtentX = 2064
_ExtentY = 1005
_Version = 131073
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "打印[&P]"
ButtonStyle = 3
PictureAlignment= 6
End
Begin Threed.SSCommand cmdQuery
Height = 570
Left = 30
TabIndex = 8
TabStop = 0 'False
Top = -15
Width = 1170
_ExtentX = 2064
_ExtentY = 1005
_Version = 131073
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "刷新[&R]"
ButtonStyle = 3
PictureAlignment= 6
End
Begin Threed.SSCommand cmdExit
Height = 570
Left = 2445
TabIndex = 3
TabStop = 0 'False
Top = 0
Width = 1170
_ExtentX = 2064
_ExtentY = 1005
_Version = 131073
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "退出[&X]"
ButtonStyle = 3
PictureAlignment= 6
End
End
Begin SSDataWidgets_B_OLEDB.SSOleDBGrid grdR
Align = 2 'Align Bottom
Height = 4380
Left = 0
TabIndex = 12
Top = 1590
Width = 9645
_Version = 196617
ForeColorEven = 0
BackColorOdd = 16777215
RowHeight = 450
Columns(0).Width= 3200
Columns(0).DataType= 8
Columns(0).FieldLen= 4096
_ExtentX = 17013
_ExtentY = 7726
_StockProps = 79
Caption = "配送中心库存查询"
End
End
Attribute VB_Name = "frmQueryStore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Rs As New ADODB.Recordset '用于只打开单记录集时
Private Function GenerateQuerySQLDet() As String
Dim strTemp As String
sSQL = "select 商品编码,品名,颜色,尺寸,单位,数量,含税进价金额 as 金额 from 配送中心库存"
If txtIncode.Text <> "" Then
strTemp = strTemp & " 商品编码 " & _
AnalyseCondition(txtIncode.Text, True) & " AND "
End If
If txtSname.Text <> "" Then
strTemp = strTemp & " 品名 " & _
AnalyseCondition(txtSname.Text, True) & " AND "
End If
If strTemp <> "" Then sSQL = sSQL & " WHERE " & Mid(strTemp, 1, Len(strTemp) - 4)
sSQL = sSQL & " ORDER BY 商品编码"
GenerateQuerySQLDet = sSQL
End Function
Private Function GenerateQuerySQLTotal() As String
Dim strTemp As String
sSQL = "select 商品编码,品名,单位,sum(数量) as 数量,sum(含税进价金额) as 金额 from 配送中心库存"
If txtIncode.Text <> "" Then
strTemp = strTemp & " 商品编码 " & _
AnalyseCondition(txtIncode.Text, True) & " AND "
End If
If txtSname.Text <> "" Then
strTemp = strTemp & " 品名 " & _
AnalyseCondition(txtSname.Text, True) & " AND "
End If
If strTemp <> "" Then sSQL = sSQL & " WHERE " & Mid(strTemp, 1, Len(strTemp) - 4)
sSQL = sSQL & " group by 商品编码,品名,单位 ORDER BY 商品编码"
GenerateQuerySQLTotal = sSQL
End Function
Private Sub cmdExit_Click()
Set Rs = Nothing
Set RsTemp = Nothing
Unload Me
End Sub
Private Sub cmdQuery_Click()
On Error Resume Next
If optDet.Value Then
sSQL = GenerateQuerySQLDet()
Else
sSQL = GenerateQuerySQLTotal()
End If
Set Rs = Nothing
Rs.Open sSQL, Conn, adOpenStatic, adLockReadOnly
If Rs.EOF Then
MsgBox "无匹配记录!", vbInformation, "提示窗口"
Exit Sub
End If
Set grdR.DataSource = Nothing
grdR.Refresh
Set grdR.DataSource = Rs
grdR.Refresh
AD.Panels("MSG").Text = "查询结果数量为:" & Rs.RecordCount
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then SendKeys "{TAB}"
End Sub
Private Sub txtPrd_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Call cmdQuery_Click
End If
End Sub
Private Sub Form_Load()
Call SetFormToCenter(Me)
End Sub
Private Sub SSTab1_DblClick()
End Sub
Private Sub SSCommand1_Click()
grdR.PrintData ssPrintAllRows, True, True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -