📄 frmbasicstockinfo.frm
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.OCX"
Begin VB.Form frmBasicStockInfo
Caption = "库存信息"
ClientHeight = 4845
ClientLeft = 60
ClientTop = 345
ClientWidth = 8130
LinkTopic = "Form1"
ScaleHeight = 4845
ScaleWidth = 8130
Begin ActiveBar2LibraryCtl.ActiveBar2 ActiveBar21
Height = 4845
Left = 0
TabIndex = 0
Top = 0
Width = 8130
_LayoutVersion = 1
_ExtentX = 14340
_ExtentY = 8546
_DataPath = ""
Bands = "frmBasicStockInfo.frx":0000
Begin VB.Frame Frame1
Height = 4215
Left = 60
TabIndex = 1
Top = 540
Width = 7995
Begin VB.CommandButton ViewStock
Caption = "客戶&S"
Height = 315
Left = 6360
TabIndex = 19
Top = 3720
Width = 855
End
Begin VB.CommandButton ViewSupplier
Caption = "供應商&V"
Height = 315
Left = 4965
TabIndex = 18
Top = 3720
Width = 855
End
Begin VB.CommandButton ViewProduct
Caption = "產品&P"
Height = 315
Left = 3570
TabIndex = 17
Top = 3720
Width = 855
End
Begin VB.TextBox Finish
BackColor = &H00FFFFFF&
Height = 315
Left = 1320
MaxLength = 50
TabIndex = 16
Top = 1200
Width = 1995
End
Begin VB.TextBox tWidth
BackColor = &H00FFFFFF&
Height = 315
Left = 5700
MaxLength = 20
TabIndex = 15
Top = 1200
Width = 2115
End
Begin VB.TextBox UpdateOperator
BackColor = &H00FFFFFF&
Height = 315
Left = 1320
MaxLength = 20
TabIndex = 14
Top = 3240
Width = 1995
End
Begin VB.TextBox ProductCode
BackColor = &H00C0C0FF&
Height = 315
Left = 1320
MaxLength = 20
TabIndex = 13
Top = 300
Width = 1995
End
Begin VB.CommandButton cmdClose
Caption = "關閉 &C"
Height = 315
Left = 2175
TabIndex = 12
Top = 3720
Width = 855
End
Begin VB.CommandButton cmdOk
Caption = "確定 &A"
Height = 315
Left = 780
TabIndex = 11
Top = 3720
Width = 855
End
Begin VB.TextBox tColor
BackColor = &H00FFFFFF&
Height = 315
Left = 5700
MaxLength = 50
TabIndex = 10
Top = 780
Width = 2115
End
Begin VB.TextBox UpdateDate
BackColor = &H8000000F&
Enabled = 0 'False
Height = 315
Left = 5640
TabIndex = 9
Top = 3300
Width = 2115
End
Begin VB.TextBox YardAges
Height = 315
Left = 1320
TabIndex = 8
Top = 1680
Width = 1995
End
Begin VB.TextBox Remark1
Height = 315
Left = 1320
TabIndex = 7
Top = 2160
Width = 6435
End
Begin VB.TextBox Remark2
Height = 315
Left = 1320
TabIndex = 6
Top = 2700
Width = 6435
End
Begin VB.CommandButton ProductSelect
Caption = "選擇產品"
Height = 375
Left = 3540
TabIndex = 5
Top = 300
Width = 915
End
Begin VB.ComboBox Supplier
Height = 315
Left = 5700
TabIndex = 4
Text = "Combo1"
Top = 360
Width = 2055
End
Begin VB.ComboBox DyeWorks
Height = 315
Left = 1320
TabIndex = 3
Text = "Combo1"
Top = 780
Width = 1995
End
Begin VB.TextBox txtId
Height = 270
Left = -240
TabIndex = 2
Text = "Text1"
Top = 1680
Visible = 0 'False
Width = 255
End
Begin VB.Label Label3
Caption = "成品布號"
Height = 255
Index = 0
Left = 180
TabIndex = 30
Top = 420
Width = 1035
End
Begin VB.Label Label5
Caption = "供應商"
Height = 255
Left = 4560
TabIndex = 29
Top = 420
Width = 1035
End
Begin VB.Label Label7
Caption = "幅寬"
Height = 255
Left = 4560
TabIndex = 28
Top = 1260
Width = 1095
End
Begin VB.Label Label3
Caption = "整理"
Height = 255
Index = 1
Left = 180
TabIndex = 27
Top = 1260
Width = 1035
End
Begin VB.Label Label2
Caption = "顏色"
Height = 255
Index = 2
Left = 4560
TabIndex = 26
Top = 840
Width = 1035
End
Begin VB.Label Label8
Caption = "DyeWorks"
Height = 255
Left = 180
TabIndex = 25
Top = 840
Width = 1035
End
Begin VB.Label Label3
Caption = "填寫人"
Height = 255
Index = 3
Left = 180
TabIndex = 24
Top = 3300
Width = 1035
End
Begin VB.Label Label1
Caption = "填寫日期"
Height = 255
Left = 4500
TabIndex = 23
Top = 3300
Width = 1035
End
Begin VB.Label Label6
Caption = "YardAges"
Height = 255
Left = 180
TabIndex = 22
Top = 1680
Width = 1095
End
Begin VB.Label Label13
Caption = "備注1"
Height = 255
Left = 180
TabIndex = 21
Top = 2220
Width = 915
End
Begin VB.Label Label14
Caption = "備注2"
Height = 255
Left = 180
TabIndex = 20
Top = 2760
Width = 915
End
End
End
End
Attribute VB_Name = "frmBasicStockInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public newItem As Boolean 'true表示增加
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
Select Case Tool.Name
Case "cmdSave":
Save newItem
Case "cmdCancel":
Unload Me
End Select
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Save newItem
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
Initcbb Supplier, "Supplier", "tBasicFabricSuppliers"
Initcbb DyeWorks, "Supplier", "tBasicFabricSuppilers"
InitTitle
End Sub
Private Sub InitTitle()
Label3.item(0).Caption = "成品編號"
Label5.Caption = "供應商"
Label8.Caption = "Dyeworks"
Label2.item(2).Caption = "顏色"
Label3.item(1).Caption = "整理"
Label7.Caption = "幅寬"
Label6.Caption = "Yardages"
Label13.Caption = "備注1"
Label14.Caption = "備註2"
Label3.item(3).Caption = "填寫人"
Label1.Caption = "填寫日期"
End Sub
Public Sub InitInfo(strId As String)
If newItem = False Then
Dim rs As ADODB.Recordset
SystemExecuteStart Me
' On Error GoTo errLabel
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
Dim strSql As String
strSql = "select * from tBasicStock where id=" & strId
rs.Open strSql
If Not rs.EOF Then
productCode = NullValue(rs.Fields!productCode)
Supplier = NullValue(rs.Fields!Supplier)
DyeWorks = NullValue(rs.Fields!DyeWorks)
tColor = NullValue(rs.Fields!Color)
tWidth = NullValue(rs.Fields!Width)
YardAges = NullValue(rs.Fields!YardAges)
Finish = NullValue(rs.Fields!Finish)
Remark1 = NullValue(rs.Fields!Remark1)
Remark2 = NullValue(rs.Fields!Remark2)
UpdateOperator = NullValue(rs.Fields!UpdateOperator)
UpdateDate = NullValue(rs.Fields!UpdateDate)
txtId = NullValue(rs.Fields!ID)
End If
rs.Close
Set rs = Nothing
SystemExecuteEnd Me
End If
Exit Sub
errLabel:
SystemExecuteEnd Me
objDatabase.DatabaseError
End Sub
Private Sub Save(Optional blModi As Boolean)
Dim strSql As String
Dim rs As ADODB.Recordset
strSql = "select * from tBasicStock where id=" & txtId
On Error GoTo errHandle
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
If productCode.Text = "" Then
MsgBox "產品編號不能為空!", vbCritical, "提示"
Exit Sub
End If
If blModi Then
rs.Open "select * from tBasicStock"
If MsgBox("是否增加新的庫存信息?", vbQuestion + vbYesNo, "询问") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.AddNew '新建
rs.Fields!productCode = Trim$(productCode)
rs.Fields!Supplier = Trim$(Supplier)
rs.Fields!DyeWorks = Trim$(DyeWorks)
rs.Fields!Color = Trim$(tColor)
rs.Fields!Finish = Trim$(Finish)
rs.Fields!Width = Trim$(tWidth)
rs.Fields!YardAges = Trim$(YardAges)
rs.Fields!Remark1 = Trim$(Remark1)
rs.Fields!Remark2 = Trim$(Remark2)
rs.Fields!UpdateOperator = Trim$(UpdateOperator.Text)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "新建成功!", vbInformation, "恭喜'"
Else
rs.Open strSql
If rs.EOF Then '修改
MsgBox "没有可修改的信息!", vbExclamation, "修改"
rs.Close
Set rs = Nothing
productCode.SetFocus
Exit Sub
End If
If MsgBox("是否修改信息?", vbYesNo + vbQuestion, "修改") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.Fields!productCode = Trim$(productCode)
rs.Fields!Supplier = Trim$(Supplier)
rs.Fields!DyeWorks = Trim$(DyeWorks)
rs.Fields!Color = Trim$(tColor)
rs.Fields!Finish = Trim$(Finish)
rs.Fields!Width = Trim$(tWidth)
rs.Fields!YardAges = Trim$(YardAges)
rs.Fields!Remark1 = Trim$(Remark1)
rs.Fields!Remark2 = Trim$(Remark2)
rs.Fields!UpdateOperator = Trim$(UpdateOperator.Text)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "修改成功!", vbInformation, "恭喜"
End If
rs.Close
Set rs = Nothing
productCode.Enabled = True
frmBasicStock.FillMshf1 ("select * from tBasicStock")
Unload Me
Exit Sub
errHandle:
Set rs = Nothing
objDatabase.DatabaseError
End Sub
Private Sub ProductSelect_Click()
frmBasicProductionSelect.cType = "stock"
frmBasicProductionSelect.Show
End Sub
Private Sub ViewProduct_Click()
' viewFlag = False
frmBasicFabric.FillMshf1 ("select * from tBasicProduct where FabricCode='" & productCode & "'")
frmBasicFabric.Show
End Sub
Private Sub ViewStock_Click()
frmBasicClientOrder.FillMshf1 ("select * from tBasicClientOrder where ProductCode='" & productCode & "'")
frmBasicClientOrder.Show
End Sub
Private Sub ViewSupplier_Click()
frmBasicFabricSuppliers.FillMshf1 ("select * from tBasicFabricSuppliers where ProductCode='" & productCode & "'")
frmBasicFabricSuppliers.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -