?? 單據查詢.frm
字號:
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "經辦人包含"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 195
Left = 180
TabIndex = 13
Top = 1680
Width = 1155
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "制單時間:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 195
Left = 180
TabIndex = 12
Top = 780
Width = 915
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 5835
Left = 180
TabIndex = 0
Top = 240
WhatsThisHelpID = 231
Width = 5835
_ExtentX = 10292
_ExtentY = 10292
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = -1 'True
HeadLines = 2
RowHeight = 14
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
MarqueeStyle = 3
RecordSelectors = 0 'False
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1560
Top = 0
WhatsThisHelpID = 231
Width = 2655
_ExtentX = 4683
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = ""
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "單據查詢"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Adodc1.ConnectionString = DataConnectString
Adodc1.Visible = False
制單時間.Year = Year(Date)
制單時間.Month = Month(Date)
制單時間.Day = Day(Date)
T制單時間.Text = "無限制"
T貨物數量.Text = "無限制"
T其它金額.Text = "無限制"
End Sub
Private Sub 打印_Click()
ShowPrintDlg Adodc1, "單據查詢"
End Sub
Private Sub 貨物名稱_DblClick()
On Error Resume Next
Dim sel As New 數據選擇
sel.Adodc1.ConnectionString = DataConnectString
sel.Adodc1.RecordSource = "select 編號,貨物名稱,貨物類別,貨物規格 from 貨物信息"
sel.title = "請選擇貨物名稱"
sel.Show vbModal
If sel.result2 <> "" Then 貨物名稱.Text = sel.result2
Unload sel
End Sub
Private Sub 經辦人_DblClick()
On Error Resume Next
Dim sel As New 數據選擇
sel.Adodc1.ConnectionString = DataConnectString
sel.Adodc1.RecordSource = "select 編號,姓名 from 職員信息"
sel.title = "請選擇經辦人"
sel.Show vbModal
If sel.result2 <> "" Then 經辦人.Text = sel.result2
Unload sel
End Sub
Private Sub 執行查詢_Click()
If 單據名稱.Text = "" Then MsgBox "請選擇單據名稱!": Exit Sub
Dim SQL As String
Dim 前綴 As String
Dim t As String
SQL = ""
On Error GoTo quit
t = Str(制單時間.Year) + "-" + Str(制單時間.Month) + "-" + Str(制單時間.Day)
If 單據名稱.Text = "入庫單" Then
SQL = "select 入庫單.編號,貨物信息.貨物名稱,貨物信息.貨物類別,貨物信息.貨物規格,職員信息.姓名 as 經辦人,入庫單.入庫時間,入庫單.入庫單價,貨物信息.計量單位,入庫單.入庫數量,(入庫單.入庫單價*入庫單.入庫數量) as 金額,供應商.供應商名稱 as 供應商,倉庫.倉庫名稱 as 存放倉庫,入庫單.定單狀況,入庫單.其它金額,入庫單.備注 from 入庫單,貨物信息,職員信息,供應商,倉庫 where 貨物信息.編號=入庫單.貨物編號 and 職員信息.編號=入庫單.經辦人編號 and 供應商.編號=入庫單.供應商編號 and 倉庫.編號=入庫單.倉庫編號"
前綴 = "入庫"
ElseIf 單據名稱.Text = "出庫單" Then
SQL = "select 出庫單.編號,貨物信息.貨物名稱,貨物信息.貨物類別,貨物信息.貨物規格,職員信息.姓名 as 經辦人,出庫單.出庫時間,出庫單.出庫單價,貨物信息.計量單位,出庫單.出庫數量,(出庫單.出庫單價*出庫單.出庫數量) as 金額,客戶.客戶名稱 as 客戶,倉庫.倉庫名稱 as 存放倉庫,出庫單.定單狀況,出庫單.其它金額,出庫單.備注 from 出庫單,貨物信息,職員信息,客戶,倉庫 where 貨物信息.編號=出庫單.貨物編號 and 職員信息.編號=出庫單.經辦人編號 and 客戶.編號=出庫單.經辦人編號 and 倉庫.編號=出庫單.倉庫編號"
前綴 = "出庫"
ElseIf 單據名稱.Text = "借入單" Then
SQL = "select 借入單.編號,貨物信息.貨物名稱,貨物信息.貨物類別,貨物信息.貨物規格,職員信息.姓名 as 經辦人,借入單.借入時間,貨物信息.計量單位,借入單.借入數量,供應商.供應商名稱 as 供應商,倉庫.倉庫名稱 as 存放倉庫,借入單.定單狀況,借入單.其它金額,借入單.備注 from 借入單,貨物信息,職員信息,供應商,倉庫 where 貨物信息.編號=借入單.貨物編號 and 職員信息.編號=借入單.經辦人編號 and 供應商.編號=借入單.供應商編號 and 倉庫.編號=借入單.倉庫編號"
前綴 = "借入"
ElseIf 單據名稱.Text = "借出單" Then
SQL = "select 借出單.編號,貨物信息.貨物名稱,貨物信息.貨物類別,貨物信息.貨物規格,職員信息.姓名 as 經辦人,借出單.借出時間,貨物信息.計量單位,借出單.借出數量,供應商.供應商名稱 as 供應商,倉庫.倉庫名稱 as 存放倉庫,借出單.定單狀況,借出單.其它金額,借出單.備注 from 借出單,貨物信息,職員信息,供應商,倉庫 where 貨物信息.編號=借出單.貨物編號 and 職員信息.編號=借出單.經辦人編號 and 供應商.編號=借出單.經辦人編號 and 倉庫.編號=借出單.倉庫編號"
前綴 = "借出"
ElseIf 單據名稱.Text = "調拔單" Then
SQL = "select 調拔單.編號,貨物信息.貨物名稱,貨物信息.貨物類別,貨物信息.貨物規格,職員信息.姓名 as 經辦人,調拔單.調拔時間,貨物信息.計量單位,調拔單.調拔數量,倉庫.倉庫名稱 as 原存放倉庫,(select 倉庫名稱 from 倉庫 where 編號=調拔單.目標倉庫編號) as 目標倉庫,調拔單.其它金額,調拔單.備注 from 調拔單,貨物信息,職員信息,倉庫 where 貨物信息.編號=調拔單.貨物編號 and 職員信息.編號=調拔單.經辦人編號 and 倉庫.編號=調拔單.原倉庫編號"
前綴 = "調拔"
ElseIf 單據名稱.Text = "報損單" Then
SQL = "select 報損單.編號,貨物信息.貨物名稱,貨物信息.貨物類別,貨物信息.貨物規格,職員信息.姓名 as 經辦人,報損單.報損時間,報損單.報損單價,貨物信息.計量單位,報損單.報損數量,(報損單.報損單價*報損單.報損數量) as 金額,倉庫.倉庫名稱 as 存放倉庫,報損單.其它金額,報損單.備注 from 報損單,貨物信息,職員信息,倉庫 where 貨物信息.編號=報損單.貨物編號 and 職員信息.編號=報損單.經辦人編號 and 倉庫.編號=報損單.倉庫編號"
前綴 = "報損"
End If
If SQL <> "" Then
If T制單時間.Text <> "無限制" Then
SQL = SQL + " and " + 前綴 + "時間" + T制單時間.Text + "#" + t + "#"
End If
If 經辦人.Text <> "" Then
SQL = SQL + " and 職員信息.姓名 like " + "'%" + 經辦人.Text + "%'"
End If
If 貨物名稱.Text <> "" Then
SQL = SQL + " and 貨物信息.貨物名稱 like " + "'%" + 貨物名稱.Text + "%'"
End If
If T貨物數量.Text <> "無限制" And 貨物數量.Text <> "" Then
SQL = SQL + " and " + 前綴 + "單." + 前綴 + "數量" + T貨物數量.Text + 貨物數量.Text
End If
If T其它金額.Text <> "無限制" And 其它金額.Text <> "" Then
SQL = SQL + " and 其它金額" + T其它金額.Text + 其它金額.Text
End If
If 單據備注.Text <> "" Then
SQL = SQL + " and " + 前綴 + "單.備注 like " + "'%" + 單據備注.Text + "%'"
End If
Adodc1.RecordSource = SQL
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh
Dim i As Integer
For i = 0 To DataGrid1.Columns.count - 1
DataGrid1.Columns(i).width = Len(DataGrid1.Columns(i).caption) * 200
Next
End If
quit:
End Sub
'此源碼由程序太平洋收集整理發布,任何人都可自由轉載,但需保留本站信息
'╭⌒╮┅~ ¤ 歡迎光臨程序太平洋╭⌒╮
'╭⌒╭⌒╮╭⌒╮~╭⌒╮ ︶ ,︶︶
',︶︶︶︶,''︶~~ ,''~︶︶ ,''
'╔ ╱◥███◣═╬╬╬╬╬╬╬╬╬╗
'╬ ︱田︱田 田 ︱ ╬
'╬ http://www.5ivb.net ╬
'╬ ╭○╮● ╬
'╬ /■\/■\ ╬
'╬ <| || 有希望,就有成功! ╬
'╬ ╬
'╚╬╬╬╬╬╬╬╬╬╬╗ ╔╬╬╬╬╝
'
'說明:
'專業提供VB、.NET、Delphi、ASP、PB源碼下載
'包括:程序源碼,控件,商業源碼,系統方案,開發工具,書籍教程,技術文檔
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -