📄 form14.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form14
BorderStyle = 4 'Fixed ToolWindow
Caption = "商品库存报表"
ClientHeight = 6045
ClientLeft = 45
ClientTop = 315
ClientWidth = 10245
LinkTopic = "Form14"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6045
ScaleWidth = 10245
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Caption = "输入查询条件"
Height = 825
Left = 0
TabIndex = 0
Top = 0
Width = 9480
Begin VB.CommandButton cmdPrint
Caption = "打印(&P)"
Height = 360
Left = 7050
TabIndex = 6
Top = 255
Width = 1155
End
Begin VB.CommandButton cmdSearch
Caption = "搜索(&S)"
Height = 360
Left = 5895
TabIndex = 5
Top = 240
Width = 1155
End
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 360
Left = 8265
TabIndex = 4
Top = 255
Width = 1155
End
Begin VB.CheckBox Check1
Caption = "全部库存"
Height = 255
Left = 120
TabIndex = 3
Top = 360
Width = 1335
End
Begin VB.CheckBox Check2
Caption = "按编号"
Height = 255
Left = 2400
TabIndex = 2
Top = 360
Width = 975
End
Begin VB.TextBox Text1
Height = 375
Left = 3360
TabIndex = 1
Top = 240
Width = 1695
End
End
Begin MSFlexGridLib.MSFlexGrid Grid1
Height = 4995
Left = 0
TabIndex = 7
Top = 960
Width = 9975
_ExtentX = 17595
_ExtentY = 8811
_Version = 393216
Cols = 8
FixedCols = 0
RowHeightMin = 350
BackColorFixed = 8438015
BackColorSel = 12640511
ForeColorSel = 0
BackColorBkg = 16777215
FocusRect = 0
HighLight = 2
FillStyle = 1
GridLinesFixed = 1
SelectionMode = 1
AllowUserResizing= 1
FormatString = " 编 号 | 名 称 | 单 价 | 数 量 | 合 计 | 售 价 | 入 库 日 期|"
End
End
Attribute VB_Name = "Form14"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'FIXIT: 使用 Option Explicit 可以避免隐式创建 Variant 类型的变量 FixIT90210ae-R383-H1984
Public dtre As String
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub Form_Load()
sAppPath = App.Path
'FIXIT: 用 "Right$" 函数替换 "Right" 函数 FixIT90210ae-R9757-R1B8ZE
If Right(App.Path, 1) = "\" Then
sAppPath = App.Path
Else
sAppPath = App.Path & "\"
End If
End Sub
Private Sub cmdPrint_Click()
If MsgBox("确认打印报表吗? ", vbInformation + vbYesNo, "hello") = vbNo Then Exit Sub
Dim myPage As PageSetting
myPage.sngPageHeight = 260
myPage.sngPageWidth = 190
myPage.sngPageTop = 15
myPage.sngPageLeft = 4
myPage.sngDirect = 1 '1纵向2横向
PrintPage myPage, "商品库存查询", "查询日期:" & Date, "华成酒店管理系统", "制作: ", Grid1, "0,1,2,3,4,5,6,7", 10, 1
End Sub
Private Sub cmdSearch_Click()
'如果为日期时
If Check1.Value = Checked Then
dtre = "Select * from spkc "
'住宿日期 = #" & dtpStart.Value & "# And
SearchIt
End If
If Check2.Value = Checked Then
dtre = "Select * from spkc Where 编号 = '" & Text1.Text & " '"
'住宿日期 = #" & dtpStart.Value & "# And
SearchIt
End If
End Sub
Private Sub SearchIt()
'检索数据
Dim db As Database
Dim EF As Recordset
Set db = OpenDatabase(ConData, False, False, Constr)
Set EF = db.OpenRecordset(dtre, dbOpenDynaset)
Dim curSumMoney As Currency
Dim curSumQuanty As Currency
Dim curSumMone As Currency
Dim curSumQuant As Currency
Dim curSumMon As Currency
Dim curSumQuan As Currency
Dim curSumMo As Currency
curSumMoney = 0
curSumQuanty = 0
curSumMone = 0
curSumQuant = 0
curSumMon = 0
curSumQuan = 0
curSumMo = 0
Grid1.Rows = 1
'列出记录
If Not (EF.BOF And EF.EOF) Then
Do While Not EF.EOF
Grid1.AddItem EF("编号") & vbTab & EF("名称") & vbTab & EF("单价") _
& vbTab & EF("数量") & vbTab & EF("合计") & vbTab & EF("售价") _
& vbTab & EF("入库日期")
curSumMoney = curSumMoney + EF("合计")
curSumQuanty = curSumQuanty + EF("数量")
EF.MoveNext
Loop
End If
'添加合计
Grid1.AddItem "" & vbTab & " 合 计 " & vbTab & "" _
& vbTab & "" & curSumQuanty & vbTab & "" _
& curSumMoney & ""
'Grid1.Row = Grid1.Rows - 1
' Dim X As Integer
' For X = 7 To 0 Step -1
' Grid1.Col = X
' Grid1.CellBackColor = &HE0E0D0
' Next
' Grid1.ColSel = 7
EF.Close
db.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -