?? 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 + -