📄 frmbuycount.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form FrmbuyCount
BorderStyle = 3 'Fixed Dialog
Caption = "采购统计"
ClientHeight = 5880
ClientLeft = 45
ClientTop = 435
ClientWidth = 10545
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5880
ScaleWidth = 10545
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin MSComctlLib.StatusBar SBar
Align = 2 'Align Bottom
Height = 255
Left = 0
TabIndex = 7
Top = 5625
Width = 10545
_ExtentX = 18600
_ExtentY = 450
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 4304
MinWidth = 4304
EndProperty
EndProperty
End
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 615
Left = 120
Picture = "FrmBuyCount.frx":0000
ScaleHeight = 615
ScaleWidth = 10455
TabIndex = 0
Top = 600
Width = 10455
Begin VB.CommandButton Command1
Caption = "确 定"
Default = -1 'True
Height = 420
Left = 9480
TabIndex = 1
Top = 120
Width = 855
End
Begin MSComCtl2.DTPicker dtpend
Height = 300
Left = 6480
TabIndex = 2
Top = 120
Width = 1575
_ExtentX = 2778
_ExtentY = 529
_Version = 393216
Format = 30212097
CurrentDate = 37482
End
Begin MSComCtl2.DTPicker DTPstart
Height = 300
Left = 4080
TabIndex = 3
Top = 120
Width = 1575
_ExtentX = 2778
_ExtentY = 529
_Version = 393216
Format = 30212097
CurrentDate = 37482
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "日期:"
Height = 255
Left = 3000
TabIndex = 8
Top = 120
Width = 735
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "信息浏览"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0080C0FF&
Height = 300
Left = 120
TabIndex = 4
Top = 120
Width = 1275
End
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 555
Left = 0
TabIndex = 5
Top = 0
Width = 10545
_ExtentX = 18600
_ExtentY = 979
ButtonWidth = 979
ButtonHeight = 926
Appearance = 1
Style = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 3
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "筛 选"
Key = "sele"
ImageIndex = 4
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
Key = "print"
ImageIndex = 5
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退 出"
Key = "exit"
ImageIndex = 6
EndProperty
EndProperty
Begin MSComctlLib.ImageList ImageList1
Left = 7080
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 6
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBuyCount.frx":3F60
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBuyCount.frx":45DC
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBuyCount.frx":4C58
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBuyCount.frx":4D6C
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBuyCount.frx":53E8
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmBuyCount.frx":5A64
Key = ""
EndProperty
EndProperty
End
Begin MSComDlg.CommonDialog dlg
Left = 5400
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Begin MSDataGridLib.DataGrid dtgrd
Height = 4215
Left = 0
TabIndex = 6
Top = 1320
Width = 10455
_ExtentX = 18441
_ExtentY = 7435
_Version = 393216
AllowUpdate = 0 'False
BorderStyle = 0
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 7
BeginProperty Column00
DataField = "compname"
Caption = "公司名称"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "ename"
Caption = "元件名称"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "etype"
Caption = "型号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "price"
Caption = "单 价"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column04
DataField = "buyamount"
Caption = "数量"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column05
DataField = "buymoney"
Caption = "金额"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column06
DataField = "buydate"
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
EndProperty
BeginProperty Column01
EndProperty
BeginProperty Column02
EndProperty
BeginProperty Column03
EndProperty
BeginProperty Column04
EndProperty
BeginProperty Column05
EndProperty
BeginProperty Column06
EndProperty
EndProperty
End
End
Attribute VB_Name = "FrmbuyCount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim RsbuyF As New ADODB.Recordset
Dim TmpM As Single
Dim strSQL As String
Private Sub Command1_Click()
Call Qery
If RsbuyF.State Then
RsbuyF.Close
RsbuyF.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
Else
RsbuyF.Open strSQL, cn, adOpenKeyset, adLockBatchOptimistic
End If
Set dtgrd.DataSource = RsbuyF
SBar.Panels(1).Text = "记录数:" & RsbuyF.RecordCount
SBar.Panels(2).Text = "总金额:" & Format(CountMoney(RsbuyF), "######0.00") & "元"
End Sub
Private Function CountMoney(rs As ADODB.Recordset) As Single
TmpM = 0
Set rs = New ADODB.Recordset
Call Qery
rs.Open strSQL, cn, adOpenStatic
If Not (rs.BOF Or rs.EOF) Then
rs.MoveFirst
Do While Not rs.EOF
TmpM = TmpM + rs.Fields!buymoney
rs.MoveNext
Loop
End If
CountMoney = TmpM
'rs.Close
'Set rs = Nothing
End Function
Private Sub Form_Load()
dtpend.Value = Date
End Sub
Private Sub Form_Unload(Cancel As Integer)
If RsbuyF.State Then
RsbuyF.Close
End If
Set RsbuyF = Nothing
Set rs = Nothing
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Trim(Button.Key)
Case "exit"
Unload Me
Case "sele"
Call Command1_Click
Case "print"
If dtgrd.row = 0 Then
dlg.Orientation = 2
dlg.ShowPrinter
Set DRbuyCount.DataSource = RsbuyF
DRbuyCount.Title = "统计查询 总金额:" & Format(TmpM, "######0.00")
DRbuyCount.Show 1
End If
End Select
End Sub
Private Sub Qery()
strSQL = "SELECT companydepart.ID, companydepart.compname, EleStock.Ename, EleStock.Etype, buydetail.Price, buydetail.BuyAmount, buydetail.buymoney, buyinfo.BuyDate, buyinfo.PayDate"
strSQL = strSQL & " FROM EleStock INNER JOIN (companydepart INNER JOIN (buyinfo INNER JOIN buydetail ON buyinfo.id = buydetail.buyid) ON companydepart.ID = buyinfo.compId) ON EleStock.ID = buydetail.IdStock"
strSQL = strSQL & " where buyinfo.buyDate Between #" & DTPstart.Value & "# And #" & dtpend.Value & "#"
strSQL = strSQL & " GROUP BY companydepart.ID, companydepart.compname, EleStock.Ename, EleStock.Etype, buydetail.Price, buydetail.BuyAmount, buydetail.buymoney, buyinfo.BuyDate, buyinfo.PayDate"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -