VERSION 5.00
Begin VB.Form frmInquireIZC2
BorderStyle = 3 'Fixed Dialog
Caption = "转仓信息查询——按转入"
ClientHeight = 2580
ClientLeft = 45
ClientTop = 330
ClientWidth = 5610
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2580
ScaleWidth = 5610
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.CheckBox chkDate
Caption = "按时间:"
Height = 252
Left = 120
TabIndex = 19
Top = 720
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 288
Index = 0
Left = 1440
Style = 2 'Dropdown List
TabIndex = 10
Top = 120
Width = 3852
End
Begin VB.Frame Frame1
Height = 1212
Index = 0
Left = 1320
TabIndex = 4
Top = 600
Width = 3972
Begin VB.ComboBox cboDay
Height = 288
Index = 1
Left = 3048
Style = 2 'Dropdown List
TabIndex = 15
Top = 720
Width = 612
End
Begin VB.ComboBox cboMonth
Height = 288
Index = 1
Left = 2136
Style = 2 'Dropdown List
TabIndex = 14
Top = 720
Width = 645
End
Begin VB.ComboBox cboYear
Height = 288
Index = 1
Left = 960
Style = 2 'Dropdown List
TabIndex = 13
Top = 720
Width = 765
End
Begin VB.ComboBox cboDay
Height = 288
Index = 0
Left = 3000
Style = 2 'Dropdown List
TabIndex = 8
Top = 240
Width = 612
End
Begin VB.ComboBox cboMonth
Height = 288
Index = 0
Left = 2088
Style = 2 'Dropdown List
TabIndex = 1
Top = 240
Width = 645
End
Begin VB.ComboBox cboYear
Height = 288
Index = 0
Left = 912
Style = 2 'Dropdown List
TabIndex = 0
Top = 240
Width = 765
End
Begin VB.Label Label1
Caption = "日"
Height = 216
Index = 0
Left = 3720
TabIndex = 18
Top = 720
Width = 240
End
Begin VB.Label Label1
Caption = "年"
Height = 216
Index = 3
Left = 1800
TabIndex = 17
Top = 720
Width = 240
End
Begin VB.Label Label1
Caption = "月"
Height = 216
Index = 4
Left = 2808
TabIndex = 16
Top = 720
Width = 240
End
Begin VB.Label lblitem
Caption = "终止时间:"
Height = 252
Index = 3
Left = 240
TabIndex = 12
Top = 720
Width = 1092
End
Begin VB.Label lblitem
Caption = "起始时间:"
Height = 252
Index = 1
Left = 240
TabIndex = 11
Top = 240
Width = 1092
End
Begin VB.Label Label1
Caption = "日"
Height = 216
Index = 7
Left = 3720
TabIndex = 7
Top = 240
Width = 240
End
Begin VB.Label Label1
Caption = "年"
Height = 216
Index = 1
Left = 1752
TabIndex = 6
Top = 240
Width = 240
End
Begin VB.Label Label1
Caption = "月"
Height = 216
Index = 2
Left = 2760
TabIndex = 5
Top = 240
Width = 240
End
End
Begin VB.CommandButton cmdOk
Caption = "确定 (&O)"
Default = -1 'True
Height = 375
Left = 1680
TabIndex = 2
Top = 2040
Width = 1215
End
Begin VB.CommandButton cmdExit
Caption = "取消 (&X)"
Height = 375
Left = 3120
TabIndex = 3
Top = 2040
Width = 1215
End
Begin VB.Label lblitem
Caption = "转入仓库名称:"
Height = 255
Index = 2
Left = 120
TabIndex = 9
Top = 120
Width = 1215
End
End
Attribute VB_Name = "frmInquireIZC2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'用于传递查询块
Private Sub chkItem_Click(Index As Integer)
If Index = 2 Then
cboYear(0).SetFocus
Else
txtItem(Index).SetFocus
End If
End Sub
Private Sub cmdExit_Click()
Me.Hide
End Sub
Private Sub cmdOK_Click()
Dim dBeginDate As String
Dim dEndDate As String
Dim sQSql As String
sQSql = "select zc.zc_no,zc.zc_date,zc.o_ckdm,ck1.mc,zc.i_ckdm,ck2.mc,zc.wzdm,dm_wz.mc,zc.qihao,zc.sl,zc.total_je,zc.ywman,zc.bz from zc inner join dm_ck ck2 on zc.o_ckdm = ck2.dm inner join dm_ck ck1 on zc.i_ckdm = ck1.dm inner join dm_wz on zc.wzdm = dm_wz.dm where ck1.mc = '" & Trim(Combo1(0)) & "'"
If chkDate.Value = vbChecked Then
dBeginDate = Format(CDate(cboYear(0) & "-" & cboMonth(0) & "-" & cboDay(0)), "yyyy-mm-dd")
dEndDate = Format(CDate(cboYear(1) & "-" & cboMonth(1) & "-" & cboDay(1)), "yyyy-mm-dd")
sQSql = sQSql & " and zc.zc_date >= '" & dBeginDate & " '"
sQSql = sQSql & " and zc.zc_date End If
If Trim(sQSql) = "" Then
MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
frmInquireIZC.txtSQL = sQSql
Me.Hide
frmInquireIZC.Show 0
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Dim sSql As String
Dim txtSQL As String
Dim MsgText As String
Dim mrc As ADODB.Recordset
txtSQL = "select distinct dm_ck.mc from zc inner join dm_ck on zc.i_ckdm = dm_ck.dm"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
With mrc
Do While Not .EOF
Combo1(0).AddItem .Fields(0)
.MoveNext
Loop
End With
Combo1(0).ListIndex = 0
Else
cmdOk.Enabled = False
End If
mrc.Close
txtSQL = "select distinct datepart(yy,zc_date) from zc"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With mrc
Do While Not .EOF
cboYear(0).AddItem .Fields(0)
cboYear(1).AddItem .Fields(0)
.MoveNext
Loop
End With
cboYear(0).ListIndex = 0
cboYear(1).ListIndex = 0
For j = 1 To 12
cboMonth(0).AddItem j
cboMonth(1).AddItem j
Next j
cboMonth(0).Text = Month(Now())
cboMonth(1).Text = Month(Now())
For j = 1 To 31
cboDay(0).AddItem j
cboDay(1).AddItem j
Next j
cboDay(0).Text = Day(Now())
cboDay(1).Text = Day(Now())
Else
cmdOk.Enabled = False
End If
mrc.Close
End Sub
Private Sub txtItem_GotFocus(Index As Integer)
txtItem(Index).SelStart = 0
txtItem(Index).SelLength = Len(txtItem(Index))
End Sub