📄 frmstock.frm
字号:
Top = 1620
Width = 255
End
End
Begin VB.Frame Frame1
Height = 8475
Left = 60
TabIndex = 1
Top = 540
Width = 15015
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHF1
Height = 8115
Left = 120
TabIndex = 19
Top = 240
Width = 14775
_ExtentX = 26061
_ExtentY = 14314
_Version = 393216
BackColorSel = 16761024
AllowBigSelection= 0 'False
SelectionMode = 1
AllowUserResizing= 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_NumberOfBands = 1
_Band(0).Cols = 2
End
End
End
End
Attribute VB_Name = "frmStock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim lngrow As Integer
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
Select Case Tool.Name
Case "cmdCancel":
Unload Me
Case "cmdFind"
fraFind.Visible = True
Case "cmdRefurbish":
FillMshf1 ("select * from tBusinessOrderSub")
Case "cmdExport":
Dim strFile As String
frmMain.CDFile.ShowOpen
strFile = frmMain.CDFile.FileName
If strFile = "" Then Exit Sub
ExportExcel MSHF1, strFile
End Select
End Sub
Private Function FormatQuery() As String
FormatQuery = "select * from tBusinessOrderSub"
If Trim$(txtOrderNo.Text) = "" Then
FormatQuery = FormatQuery & " where OrderNo<>''"
Else
FormatQuery = FormatQuery & " where OrderNo='" & txtOrderNo & "'"
End If
If Trim$(txtFabricNo) <> "" Then
FormatQuery = FormatQuery & " and FabricNo='" & txtFabricNo & "'"
End If
If chkFoundDate.Value = vbChecked Then
FormatQuery = FormatQuery & " and FoundDate >= '" & FormatDateStr(Founddate.Value, "long") & "'"
FormatQuery = FormatQuery & " and FoundDate <= '" & FormatDateStr(EndFounddate.Value, "long") & "'"
End If
If Trim$(txtFabricName) <> "" Then
FormatQuery = FormatQuery & " and FabricName" & objDatabase.FormatLikeSQL(txtFabricName)
End If
If Trim$(txtComposition) <> "" Then
FormatQuery = FormatQuery & " and Composition" & objDatabase.FormatLikeSQL(txtComposition)
End If
If Trim$(txtLayoutColor) <> "" Then
FormatQuery = FormatQuery & " and eLayoutColor" & objDatabase.FormatLikeSQL(txtLayoutColor)
End If
If Trim$(txtFactoryName) <> "" Then
FormatQuery = FormatQuery & " and FactoryName" & objDatabase.FormatLikeSQL(txtFactoryName)
End If
End Function
Private Sub cmdCancel_Click()
fraFind.Visible = False
End Sub
Private Sub CmdFabric_Click()
frmFabricSelect.Show vbModal
GetFabricInfo frmFabricSelect.FabricCode
End Sub
Private Sub GetFabricInfo(FabricNo As String)
Dim rs As ADODB.Recordset
On Error GoTo errLabel
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
rs.Open "select * from tBasicProduct where FabricCode=" & objDatabase.FormatSQL(FabricNo)
If Not rs.EOF Then
txtFabricNo = NullValue(rs.Fields!FabricCode)
txtFabricName = NullValue(rs.Fields!FabricName)
txtComposition = NullValue(rs.Fields!Composition)
End If
rs.Close
remClear:
Set rs = Nothing
Exit Sub
errLabel:
objDatabase.DatabaseError
GoTo remClear
End Sub
Private Sub CmdFind_Click()
FillMshf1 FormatQuery
fraFind.Visible = False
End Sub
Private Sub cmdFindAll_Click()
FillMshf1 ("select * from tBusinessOrderSub")
fraFind.Visible = False
End Sub
Private Sub Form_Load()
'设置窗口大小
FormInit Me, True
SetObjectWH Frame1
SetObjectWH MSHF1
FillMshf1 ("select * from tBusinessOrderSub")
Initcbb txtOrderNo, "OrderNo", "tBusinessOrderSub"
Initcbb txtLayoutColor, "eLayoutColor", "tBusinessOrderSub"
Initcbb txtFactoryName, "FactoryName", "tBasicFactory"
InitTitle
HookWheel Me.hwnd
End Sub
Private Sub InitTitle()
Label3.item(4).Caption = "加工單編號"
Label5.Caption = "布號"
Label11.Caption = "布名"
Label6.Caption = "顏色花型"
Label1.Caption = "組織"
Label2.Caption = "加工廠"
Label4.Caption = "日期"
Label13.Caption = "至"
Label12.Caption = "模糊查詢項"
cmdFindAll.Caption = "全部 &A"
cmdFind.Caption = "查詢 &F"
cmdCancel.Caption = "取消 &C"
Me.Caption = "存貨信息"
End Sub
Public Sub FillMshf1(ByVal strSql As String)
Dim rs As ADODB.Recordset
Dim lngrow As Long
Screen.MousePointer = vbHourglass
On Error GoTo errLabel
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
rs.Open strSql
With MSHF1
.Redraw = False
.Rows = 2
.Cols = 9
.Clear
'初始化
.WordWrap = False
.TextMatrix(0, 0) = "序號"
.ColWidth(0) = 500
.TextMatrix(0, 1) = "加工單號"
.ColWidth(1) = 1200
.TextMatrix(0, 2) = "布號"
.ColWidth(2) = 1200
.TextMatrix(0, 3) = "布名"
.ColWidth(3) = 1200
.TextMatrix(0, 4) = "組織"
.ColWidth(4) = 2000
.TextMatrix(0, 5) = "顏色花型"
.ColWidth(5) = 1500
.TextMatrix(0, 6) = "庫存數量"
.ColWidth(6) = 1200
.TextMatrix(0, 7) = "加工廠"
.ColWidth(7) = 2000
.TextMatrix(0, 8) = "日期"
.ColWidth(8) = 1200
'.....................................................
.Rows = rs.RecordCount + 2
On Error Resume Next
For lngrow = 2 To rs.RecordCount + 1
.TextMatrix(lngrow, 0) = lngrow - 1
.TextMatrix(lngrow, 1) = Trim$(NullValue(rs.Fields!OrderNo))
.TextMatrix(lngrow, 2) = Trim$(NullValue(rs.Fields!FabricNo))
.TextMatrix(lngrow, 3) = Trim$(NullValue(rs.Fields!FabricName))
.TextMatrix(lngrow, 4) = Trim$(NullValue(rs.Fields!Composition))
.TextMatrix(lngrow, 5) = Trim$(NullValue(rs.Fields!LayoutColor))
.TextMatrix(lngrow, 6) = Trim$(NullValue(rs.Fields!StockAmount))
.TextMatrix(lngrow, 7) = Trim$(NullValue(rs.Fields!FactoryName))
.TextMatrix(lngrow, 8) = Trim$(NullValue(rs.Fields!Founddate))
rs.MoveNext
Next
lngrow = 0
.TextMatrix(1, 0) = "总计"
.TextMatrix(1, 1) = .Rows - 2
SetItemBackColor MSHF1
.Redraw = True
End With
rs.Close
remClear:
Set rs = Nothing
Screen.MousePointer = vbDefault
Exit Sub
errLabel:
On Error Resume Next
MSHF1.Redraw = True
GoTo remClear
End Sub
Private Sub MSHF1_Click()
lngrow = Val(MSHF1.row)
If lngrow = 1 Then
MSHF1.Sort = 1
Else
MSHF1.row = lngrow
MSHF1.col = 0
MSHF1.ColSel = MSHF1.Cols - 1
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -