📄 frmygxs.frm
字号:
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 = 975
Left = 480
TabIndex = 0
Top = 120
Width = 10935
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 9000
TabIndex = 6
Top = 240
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6960
TabIndex = 5
Top = 240
Width = 1455
End
Begin MSComCtl2.DTPicker DTPickertj
Height = 255
Left = 4320
TabIndex = 4
Top = 360
Width = 1815
_ExtentX = 3201
_ExtentY = 450
_Version = 393216
Format = 21233665
CurrentDate = 38521
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1560
TabIndex = 2
Text = "Combo1"
Top = 360
Width = 1335
End
Begin VB.Label Label2
Caption = "选择月份:"
Height = 255
Left = 3360
TabIndex = 3
Top = 360
Width = 975
End
Begin VB.Label Label1
Caption = "选择员工:"
Height = 255
Left = 360
TabIndex = 1
Top = 360
Width = 975
End
End
End
Attribute VB_Name = "frmygxs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2006/12/06
'描 述: 纯净水进销存管理系统 Ver 2.0
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Private Sub Command1_Click()
Dim sqlYGSale As String
Dim sqlsalefz As String
Dim startdate As String
Dim enddate As String
startdate = Year(DTPickertj.Value) & "/" & Month(DTPickertj.Value) & "/01" & " 00:00:01"
enddate = Year(DTPickertj.Value) & "/" & Month(DTPickertj.Value) & "/" & monthdays() & " 23:59:59"
Adodcygsale.ConnectionString = ConnStr
'销售表.销售编号,销售表.商品编号,销售表.销售方式,销售表.售价,销售表.数量,销售表.结账方式,销售表.数额,销售表.员工编号,销售表.日期,销售表.备注
'销售表.员工编号=员工表.员工编号 and 商品表.商品编号=销售表.商品编号 and 客户表.用户编号=销售表.用户编号 and 员工表.姓名='" & Trim(Combo1.Text) & "'
sqlYGSale = "select * from 销售表"
sqlYGSale = sqlYGSale & " where 销售表.员工编号='" & ygid(Trim(Combo1.Text)) & "' and 销售表.日期 Between #" & startdate & "# and #" & enddate & "#"
Adodcygsale.CommandType = adCmdText
Adodcygsale.RecordSource = sqlYGSale
Adodcygsale.Refresh
'求汇总数据
sqlsalefz = "select 销售表.员工编号,员工表.姓名 as 员工姓名,sum(销售表.数量) as 销售总量 from 销售表,员工表 "
sqlsalefz = sqlsalefz & " where 员工表.员工编号=销售表.员工编号 and 销售表.员工编号='" & ygid(Trim(Combo1.Text)) & "' and 销售表.日期 Between #" & startdate & "# and #" & enddate & "#" & "group by 销售表.员工编号,员工表.姓名"
Adodcsalefz.ConnectionString = ConnStr
Adodcsalefz.CommandType = adCmdText
Adodcsalefz.RecordSource = sqlsalefz
Adodcsalefz.Refresh
End Sub
Private Sub Command2_Click()
Unload Me
Set frmygxs = Nothing
End Sub
Private Sub Form_Load()
Call loadYG(Combo1)
DTPickertj.Value = Now()
Call Command1_Click
End Sub
Private Sub loadYG(combo As ComboBox) '加载员工名称的过程
On Error GoTo errorhandle
Dim rsyg As ADODB.Recordset
Dim sqlyg As String
sqlyg = "select 姓名 from 员工表"
Set rsyg = ExeSQL(sqlyg)
combo.Clear
Do While Not rsyg.EOF
combo.AddItem (rsyg.Fields(0))
rsyg.MoveNext
Loop
combo.ListIndex = 0
rsyg.Close
Set rsyg = Nothing
Exit Sub
errorhandle:
If Err.Number = 380 Then
Resume Next
End If
End Sub
Public Function monthdays() As String '计算该月的天数
Select Case Month(DTPickertj.Value)
Case 1
monthdays = 31
Case 2
Dim yeartj As Integer
yeartj = Year(DTPickertj.Value)
If yeartj Mod 4 = 0 And yeartj Mod 100 <> 4 Or yeartj Mod 400 = 0 Then
monthdays = 29
Else
monthdays = 28
End If
Case 3
monthdays = 31
Case 4
monthdays = 30
Case 5
monthdays = 31
Case 6
monthdays = 30
Case 7
monthdays = 31
Case 8
monthdays = 31
Case 9
monthdays = 30
Case 10
monthdays = 31
Case 11
monthdays = 30
Case 12
monthdays = 31
End Select
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -