?? locat_in.frm
字號:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form frmlocat_in
Caption = "物品出入庫查詢"
ClientHeight = 7170
ClientLeft = 60
ClientTop = 345
ClientWidth = 10800
Icon = "locat_in.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 7170
ScaleWidth = 10800
WindowState = 2 'Maximized
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "退 出"
Height = 480
Left = 1710
TabIndex = 20
Top = 885
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "刷 新"
Height = 480
Left = 360
TabIndex = 17
Top = 885
Width = 1215
End
Begin VB.Frame Frame2
Caption = "日期"
Height = 1065
Left = 7365
TabIndex = 12
Top = 405
Width = 2325
Begin MSComCtl2.DTPicker DTPicker2
Height = 330
Left = 825
TabIndex = 16
Top = 645
Width = 1335
_ExtentX = 2355
_ExtentY = 582
_Version = 393216
CustomFormat = "yyyy-MM-dd"
Format = 64225283
CurrentDate = 37916
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 285
Left = 810
TabIndex = 14
Top = 240
Width = 1320
_ExtentX = 2328
_ExtentY = 503
_Version = 393216
CustomFormat = "yyyy-MM-dd"
Format = 64225283
CurrentDate = 37916
End
Begin VB.Label Label3
Caption = "結束時間"
Height = 225
Left = 90
TabIndex = 15
Top = 720
Width = 795
End
Begin VB.Label Label2
Caption = "開始時間"
Height = 180
Left = 60
TabIndex = 13
Top = 285
Width = 780
End
End
Begin VB.CheckBox Check2
Caption = "是否"
Height = 225
Left = 6660
TabIndex = 11
Top = 420
Width = 660
End
Begin VB.CheckBox Check1
Caption = "是否"
Height = 240
Left = 2790
TabIndex = 10
Top = 345
Width = 660
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1
Height = 4650
Left = 435
TabIndex = 9
Top = 1545
Width = 9735
_ExtentX = 17171
_ExtentY = 8202
_Version = 393216
FixedCols = 0
RowHeightMin = 370
FocusRect = 0
SelectionMode = 1
AllowUserResizing= 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_NumberOfBands = 1
_Band(0).Cols = 2
End
Begin VB.Frame Frame1
Caption = "選擇物品"
Height = 1080
Left = 3465
TabIndex = 2
Top = 360
Width = 3030
Begin VB.TextBox Text1
Height = 300
Index = 2
Left = 1200
TabIndex = 8
Top = 1110
Width = 1665
End
Begin VB.TextBox Text1
Height = 300
Index = 1
Left = 1200
TabIndex = 7
Top = 660
Width = 1665
End
Begin VB.TextBox Text1
Height = 300
Index = 0
Left = 1200
TabIndex = 6
Top = 255
Width = 1665
End
Begin VB.OptionButton Option1
Caption = "拼音編碼"
Height = 240
Index = 2
Left = 135
TabIndex = 5
Top = 1140
Width = 1035
End
Begin VB.OptionButton Option1
Caption = "物品名稱"
Height = 240
Index = 1
Left = 135
TabIndex = 4
Top = 705
Width = 1110
End
Begin VB.OptionButton Option1
Caption = "物品編碼"
Height = 240
Index = 0
Left = 150
TabIndex = 3
Top = 300
Width = 1110
End
End
Begin VB.ComboBox Combtype
Height = 300
Left = 945
TabIndex = 1
Top = 330
Width = 1620
End
Begin VB.Label Label7
BorderStyle = 1 'Fixed Single
Height = 330
Left = 5160
TabIndex = 22
Top = 6360
Width = 1065
End
Begin VB.Label Label6
Caption = "合計數量: "
Height = 180
Left = 4320
TabIndex = 21
Top = 6435
Width = 1035
End
Begin VB.Label Label5
BorderStyle = 1 'Fixed Single
Height = 330
Left = 7485
TabIndex = 19
Top = 6360
Width = 1260
End
Begin VB.Label Label4
Caption = "合計金額:"
Height = 255
Left = 6570
TabIndex = 18
Top = 6398
Width = 915
End
Begin VB.Label Label1
Caption = "類型"
Height = 240
Left = 555
TabIndex = 0
Top = 390
Width = 420
End
End
Attribute VB_Name = "frmlocat_in"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public ind As Integer
Private Sub Combtype_Click()
Call Command1_Click
End Sub
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim TxtSQL As String
Dim msgtext As String
If Trim(Combtype.text) = "出庫單" Then
TxtSQL = " select b.ps_id,a.p_id,a.p_name,format(a.qty,'0.00'),a.unit,a.unit_price,a.price,format(b.ps_date,'yyyy-MM-dd') "
TxtSQL = TxtSQL & " from psout_detail as a,psout_head as b "
' TxtSQL = TxtSQL & " where trim(b.sale_type)='" & Trim(Combtype.text) & "'"
TxtSQL = TxtSQL & " where a.order_id=b.ps_id"
If Check1 = 1 Then
Select Case ind
Case 0
TxtSQL = TxtSQL & " and trim(a.p_id)='" & Trim(Text1(ind).text) & "'"
Case 1
TxtSQL = TxtSQL & " and trim(a.p_name)='" & Trim(Text1(ind).text) & "'"
End Select
End If
If Check2 = 1 Then
TxtSQL = TxtSQL & " and format(b.ps_date,'yyyy-MM-dd')>='" & Format(Me.DTPicker1.Value, "yyyy-MM-dd") & "'"
TxtSQL = TxtSQL & " and format(b.ps_date,'yyyy-MM-dd')<='" & Format(Me.DTPicker2.Value, "yyyy-MM-dd") & "'"
End If
TxtSQL = TxtSQL & " order by b.ps_date,b.ps_id,a.p_id "
Else
TxtSQL = " select c.ps_id,a.p_id,a.p_name,format(a.qty,'0.00'),a.unit,a.unit_price,a.price,format(c.ps_date,'yyyy-MM-dd')"
TxtSQL = TxtSQL & " from order_detail_b as a,ps_head_b as c "
TxtSQL = TxtSQL & " where trim(c.ps_type)='" & Trim(Combtype.text) & "'"
TxtSQL = TxtSQL & " and a.order_id=c.ps_id"
If Check1 = 1 Then
Select Case ind
Case 0
TxtSQL = TxtSQL & " and trim(a.p_id)='" & Trim(Text1(ind).text) & "'"
TxtSQL = TxtSQL & " and trim(a.p_name)='" & Trim(Text1(ind).text) & "'"
End Select
End If
If Check2 = 1 Then
TxtSQL = TxtSQL & " and format(c.ps_date,'yyyy-MM-dd')>='" & Format(Me.DTPicker1.Value, "yyyy-MM-dd") & "'"
TxtSQL = TxtSQL & " and format(c.ps_date,'yyyy-MM-dd')<='" & Format(Me.DTPicker2.Value, "yyyy-MM-dd") & "'"
End If
TxtSQL = TxtSQL & " order by c.ps_date,c.ps_id,a.p_id "
End If
Set mrc = New ADODB.Recordset
mrc.Open TxtSQL, DEjxc.Conjxc, adOpenDynamic, adLockOptimistic
Set MSHFlexGrid1.DataSource = mrc
loadgrid
total
End Sub
Sub total()
Dim i As Integer
Dim mun As Double
Dim je As Double
If MSHFlexGrid1.rows < 2 And MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0) = "" Then Exit Sub
mun = 0
je = 0
For i = 1 To MSHFlexGrid1.rows - 1
MSHFlexGrid1.row = i
MSHFlexGrid1.col = 3
mun = mun + Val(MSHFlexGrid1.text)
MSHFlexGrid1.col = 6
je = je + Val(MSHFlexGrid1.text)
Next
Label7.Caption = Format(mun, "0.00")
Label5.Caption = Format(je, "0.00")
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
intNumWindows = OpenWindow(intNumWindows)
Call SetFormStu(Me, frmMain)
DTPicker1.Value = Now
DTPicker2.Value = Now
loadcomb
loadgrid
Call Command1_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
intNumWindows = Closewindow(intNumWindows)
End Sub
Sub loadcomb()
Combtype.AddItem "采購入庫"
Combtype.AddItem "盤盈入庫"
Combtype.AddItem "退庫單"
Combtype.AddItem "報損單"
Combtype.AddItem "出庫單"
Combtype.ListIndex = 0
End Sub
Private Sub loadgrid()
Dim i As Integer
With MSHFlexGrid1
.Cols = 8
If .rows < 2 Then
.rows = 2
End If
.TextMatrix(0, 0) = "單號"
.TextMatrix(0, 1) = "物品編號"
.TextMatrix(0, 2) = "物品名稱"
' .TextMatrix(0, 3) = "規格型號"
' .TextMatrix(0, 3) = "類別"
.TextMatrix(0, 3) = "數量"
.TextMatrix(0, 4) = "單位"
.TextMatrix(0, 5) = "單價"
.TextMatrix(0, 6) = "金額"
' .TextMatrix(0, 8) = "有效期"
.TextMatrix(0, 7) = "日期"
'設置各列的對齊方
For i = 0 To 7
.ColAlignment(i) = 1
Next i
'表頭項居中
.FillStyle = flexFillRepeat
.col = 0
.row = 0
.RowSel = 1
.ColSel = .Cols - 1
'.CellAlignment = 4
'設置單元大小
.colWidth(0) = 850
.colWidth(1) = 900
' .colWidth(2) = 2000
.colWidth(2) = 2500
' .colWidth(3) = 500
.colWidth(3) = 600
.colWidth(4) = 600
.colWidth(5) = 800
.colWidth(6) = 800
.colWidth(7) = 1200
' .colWidth(9) = 1000
.row = 1
End With
End Sub
Private Sub MSHFlexGrid1_DblClick()
' If MSHFlexGrid1.rows < 2 Then Exit Sub
' If Trim(Combtype.text) = "采購入庫" Then
' If MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0) <> "" Then
' FrmPsEdit.yesno1 = False
' FrmPsEdit.yesno2 = True
' FrmPsEdit.Show
' End If
' End If
' If Trim(Combtype.text) = "盤盈入庫" Then
' If MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0) <> "" Then
' FrmPsEdit.yesno1 = False
' FrmPsEdit.yesno2 = True
' FrmPsEdit.Show
' End If
' End If
'' If Trim(Combtype.text) = "退庫單" Then
'' If MSHFlexGrid1.TextMatrix(MSHFlexGrid1.row, 0) <> "" Then
'' frmsale_r.yesno1 = False
'' frmsale_r.Show
'' End If
'' End If
End Sub
Private Sub Option1_Click(Index As Integer)
ind = Index
Text1(Index).SetFocus
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Command1.SetFocus
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -