📄 frmjxtj.frm
字号:
VERSION 5.00
Object = "{74848F95-A02A-4286-AF0C-A3C755E4A5B3}#1.0#0"; "actskn43.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "Msdatgrd.ocx"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomct2.ocx"
Begin VB.Form frmJXTJ
Caption = "进销统计"
ClientHeight = 4785
ClientLeft = 60
ClientTop = 345
ClientWidth = 5925
LinkTopic = "Form1"
ScaleHeight = 4785
ScaleWidth = 5925
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame2
Caption = "--进货数量--"
Height = 3735
Left = 120
TabIndex = 7
Top = 960
Width = 5655
Begin MSDataGridLib.DataGrid DataGrid1
Height = 3375
Left = 120
TabIndex = 8
Top = 240
Width = 5400
_ExtentX = 9525
_ExtentY = 5953
_Version = 393216
HeadLines = 1
RowHeight = 15
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 = 2
BeginProperty Column00
DataField = ""
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 = ""
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
EndProperty
End
End
Begin VB.Frame Frame1
Caption = "--选择起止期限再点击确定--"
Height = 735
Left = 120
TabIndex = 0
Top = 120
Width = 5655
Begin VB.CommandButton Command2
Caption = "退出"
Height = 255
Left = 4920
TabIndex = 4
Top = 280
Width = 615
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 255
Left = 4200
TabIndex = 3
Top = 280
Width = 615
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel2
Height = 255
Left = 2160
OleObjectBlob = "frmJXTJ.frx":0000
TabIndex = 5
Top = 285
Width = 255
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1
Height = 255
Left = 240
OleObjectBlob = "frmJXTJ.frx":0062
TabIndex = 6
Top = 285
Width = 255
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 255
Left = 2400
TabIndex = 2
Top = 285
Width = 1575
_ExtentX = 2778
_ExtentY = 450
_Version = 393216
Format = 25362433
CurrentDate = 38987
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 480
TabIndex = 1
Top = 285
Width = 1575
_ExtentX = 2778
_ExtentY = 450
_Version = 393216
Format = 25362433
CurrentDate = 38987
End
End
End
Attribute VB_Name = "frmJXTJ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public olddate As Date
Public newdate As Date
Private Sub Command1_Click()
If DTPicker1.Value > DTPicker2.Value Then
MsgBox "开始日期错误"
Else
olddate = DTPicker1.Value
newdate = DTPicker2.Value
Frame2.Caption = DTPicker1.Value & "至" & DTPicker2.Value & "各商品进货数量"
'按照物品库存表查询
Dim rdst As New ADODB.Recordset '按商品列表进行
Dim rdst2 As New ADODB.Recordset
Dim rdst3 As New ADODB.Recordset
Dim rdst4 As New ADODB.Recordset
rdst3.Open "update JXTJ set 销售数量='0',进货数量 ='0'", g_conn
Set rdst3 = Nothing
rdst.Open "select * from productsList", g_conn
Do While Not rdst.EOF
rdst2.Open "select * from JXTJ where 商品代码= '" & rdst!商品代码 & "'", g_conn
If rdst2.EOF = True Then
rdst3.Open "insert into JXTj values('" & rdst!商品代码 & "','" & rdst!商品名称 & "','" & jhsl(rdst!商品代码) & "','" & xssl(rdst!商品代码) & "')", g_conn
Set rdst3 = Nothing
Else
rdst3.Open "update JXtj set 进货数量= '" & jhsl(rdst!商品代码) & "',销售数量='" & xssl(rdst!商品代码) & "' where 商品代码 = '" & rdst!商品代码 & "'", g_conn
Set rdst3 = Nothing
End If
'Debug.Print rdst!商品代码 & xssl(rdst!商品代码)
Set rdst2 = Nothing
rdst.MoveNext
Loop
End If
Set rdst = Nothing
rdst.CursorLocation = adUseClient
rdst.Open "select * from JXTJ where 销售数量 <>'0' or 进货数量<>'0'", g_conn
Set DataGrid1.DataSource = rdst
DataGrid1.ReBind
DataGrid1.Refresh
DataGrid1.Width = 5400
DataGrid1.Columns.Item(0).Width = 1000
DataGrid1.Columns.Item(1).Width = 1550
DataGrid1.Columns.Item(2).Width = 1250
DataGrid1.Columns.Item(3).Width = 1250
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
If olddate = "0:00:00" Then
DTPicker2.Value = Date
DTPicker1.Value = Date - 7
Else
DTPicker2.Value = newdate
DTPicker1.Value = olddate
End If
Frame2.Caption = DTPicker1.Value & "至" & DTPicker2.Value & "各商品进销数量"
Dim rdst As New ADODB.Recordset
rdst.CursorLocation = adUseClient
rdst.Open "select * from JXTJ where 销售数量 <>'0' or 进货数量<>'0'", g_conn
Set DataGrid1.DataSource = rdst
DataGrid1.ReBind
DataGrid1.Refresh
DataGrid1.Width = 5400
DataGrid1.Columns.Item(0).Width = 1000
DataGrid1.Columns.Item(1).Width = 1550
DataGrid1.Columns.Item(2).Width = 1250
DataGrid1.Columns.Item(3).Width = 1250
Call Command1_Click
End Sub
Function xssl(dm As String) As Integer
Dim i As Integer
i = 0
Dim rdst As New ADODB.Recordset
rdst.Open "select * from sells where 商品代码='" & dm & " '", g_conn
Do While Not rdst.EOF
If CDate(rdst!销售日期) <= DTPicker2.Value And CDate(rdst!销售日期) >= DTPicker1.Value Then
i = i + Val(rdst!数量)
End If
rdst.MoveNext
Loop
xssl = i
End Function
Function jhsl(dm As String) As Integer
Dim i As Integer
i = 0
Dim rdst As New ADODB.Recordset
rdst.Open "select * from BuyGoods where 商品代码='" & dm & " '", g_conn
Do While Not rdst.EOF
If CDate(rdst!进货日期) <= DTPicker2.Value And CDate(rdst!进货日期) >= DTPicker1.Value Then
i = i + Val(rdst!数量)
End If
rdst.MoveNext
Loop
jhsl = i
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -