📄 frmstoreinedit.frm
字号:
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 2040
Width = 4455
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "邮政编码"
Height = 180
Left = 3240
TabIndex = 15
Top = 1215
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "通信地址"
Height = 180
Left = 240
TabIndex = 14
Top = 1215
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户单位"
Height = 180
Left = 240
TabIndex = 13
Top = 360
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "客户类别"
Height = 180
Left = 240
TabIndex = 12
Top = 780
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系人"
Height = 180
Left = 3240
TabIndex = 11
Top = 780
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "联系电话"
Height = 180
Left = 240
TabIndex = 10
Top = 1635
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "传真电话"
Height = 180
Left = 3240
TabIndex = 9
Top = 1635
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "描述信息"
Height = 180
Left = 240
TabIndex = 8
Top = 2070
Width = 720
End
End
End
Attribute VB_Name = "FrmStoreinEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public OriId As Long
'客户信息
Public OriClt As String
Public OriCltType As Integer
'产品信息
Public OriType1, OriType2 As String
Public OriPro As String
'仓库信息
Public OriStore As String
Private Sub Fill_Clt()
If ComboClt.Text = "" Then
txtContact = ""
txtAddr = ""
txtCode = ""
txtPhone = ""
txtFax = ""
txtDescribe = ""
Else
MyClt.GetInfo (MyClt.GetId(ComboClt.Text))
txtContact = MyClt.Contact
txtAddr = MyClt.Address
txtCode = MyClt.Postcode
txtPhone = MyClt.Phone
txtFax = MyClt.Fax
txtDescribe = MyClt.Describe
End If
End Sub
Private Sub Fill_Pro()
If ComboPro.Text = "" Then
txtStyle = ""
txtUnit = ""
txtPrice = ""
txtMin = ""
txtMax = ""
txtValid = ""
txtAlarm = ""
Else
MyPro.GetInfo (MyPro.GetId(ComboPro.Text))
txtStyle = MyPro.ProStyle
txtUnit = MyPro.ProUnit
txtPrice = MyPro.ProPrice
txtMin = MyPro.ProLow
txtMax = MyPro.ProHigh
txtValid = MyPro.Valid
txtAlarm = MyPro.AlarmDays
End If
End Sub
Private Function Check() As Boolean
If Trim(ComboClt.Text) = "" Then
MsgBox "请选择客户单位"
Check = False
Exit Function
End If
If Trim(ComboPro.Text) = "" Then
MsgBox "请选择产品名称"
Check = False
Exit Function
End If
If txtNum = "" Then
MsgBox "请输入产品数量"
txtNum.SetFocus
Check = False
Exit Function
End If
If ComboCreateDate.Text = "" Then
MsgBox "请输入生产日期"
Check = False
Exit Function
End If
If ComboStore.Text = "" Then
MsgBox "请选择存储的仓库"
Check = False
Exit Function
End If
Check = True
End Function
Private Sub Cmd_OK_Click()
Dim TmpId As Long
If Check = False Then
Exit Sub
End If
With MyStorein
.StoreinType = ComboStoreinType.Text
.ProId = MyPro.GetId(ComboPro.Text)
.CreateDate = ComboCreateDate.Text
.ProPrice = Val(txtPrice1)
.ProNum = Val(txtNum)
.ClientId = MyClt.GetId(ComboClt.Text)
.StoreId = MyStore.GetId(ComboStore.Text)
.EmpName = CurUser.EmpName
.OptDate = Format(Now, "yyyy-mm-dd")
.Insert
'将产品保存到仓库中,把入库的数据赋值到MyProInStore
MyProInStore.ProNum = .ProNum
MyProInStore.ProId = .ProId
MyProInStore.ProPrice = .ProPrice
MyProInStore.ClientId = .ClientId
MyProInStore.CreateDate = .CreateDate
MyProInStore.StoreId = .StoreId
If MyProInStore.In_DB(.ProId, .ProPrice, .CreateDate, .StoreId) = False Then
MyProInStore.Insert
Else
TmpId = MyProInStore.GetId(.ProId, .ProPrice, .CreateDate, .StoreId)
MyProInStore.UpdateDiff (TmpId)
End If
MsgBox "完成入库操作"
End With
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub ComboClt_Click()
Fill_Clt
End Sub
Private Sub ComboCreateDate_GotFocus()
'将焦点设置为下一个控件,否则将反复执行此过程
ComboStore.SetFocus
If ComboCreateDate.Text <> "" Then
FrmDateSel.OriDate = ComboCreateDate.Text
End If
'设置FrmDateSel窗体的位置
FrmDateSel.Left = Me.Left + ComboCreateDate.Left + 350
FrmDateSel.Top = Me.Top + ComboCreateDate.Top + ComboCreateDate.Height + 450
FrmDateSel.Show 1
'将选择的日期显示到ComboBirth控件中
ComboCreateDate.Text = FrmDateSel.OriDate
End Sub
Private Sub ComboPro_Click()
Fill_Pro
End Sub
Private Sub ComboStoreinType_Click()
If ComboStoreinType.ListIndex = 0 Or ComboStoreinType.ListIndex = 2 Then
txtPrice1.Enabled = True
Else
txtPrice1 = 0
txtPrice1.Enabled = False
End If
End Sub
Private Sub ComboType_Click()
'装入客户数据
MyClt.Load_Client (ComboType.ListIndex + 1)
ComboClt.Clear
i = 0
Do While Arr_Client(i) <> ""
ComboClt.AddItem Arr_Client(i)
i = i + 1
Loop
If ComboClt.ListCount > 0 Then
ComboClt.ListIndex = 0
End If
Fill_Clt
End Sub
Private Sub ComboType1_Click()
'装入二级类目
TmpType = MyProType.GetId(ComboType1.Text)
MyProType.Load_by_Upper (TmpType)
ComboType2.Clear
i = 0
Do While Arr_ProType(i) <> ""
ComboType2.AddItem Arr_ProType(i)
i = i + 1
Loop
If ComboType2.ListCount > 0 Then
ComboType2.ListIndex = 0
End If
'装入产品名称
TmpType = MyProType.GetId(ComboType2.Text)
MyPro.Load_by_Type (TmpType)
i = 0
Do While Arr_Product(i) <> ""
ComboPro.AddItem Arr_Product(i)
i = i + 1
Loop
If ComboPro.ListCount > 0 Then
ComboPro.ListIndex = 0
End If
Fill_Pro
End Sub
Private Sub ComboType2_Click()
'装入产品名称
TmpType = MyProType.GetId(ComboType2.Text)
MyPro.Load_by_Type (TmpType)
i = 0
Do While Arr_Product(i) <> ""
ComboPro.AddItem Arr_Product(i)
i = i + 1
Loop
If ComboPro.ListCount > 0 Then
ComboPro.ListIndex = 0
End If
Fill_Pro
End Sub
Private Sub Form_Load()
Dim TmpType As Long
Dim i As Integer
If Modify = True Then
OriId = FrmStoreinMan.Adodc1.Recordset.Fields(0)
If InCombo(Trim(FrmStoreinMan.Adodc1.Recordset.Fields(2)), ComboStoreinType) = True Then
ComboStoreinType.Text = Trim(FrmStoreinMan.Adodc1.Recordset.Fields(2))
End If
'读取产品名称和类目
OriPro = Trim(FrmStoreinMan.Adodc1.Recordset.Fields(3))
MyPro.GetInfo (MyPro.GetId(Trim(FrmStoreinMan.Adodc1.Recordset.Fields(3))))
OriType2 = MyProType.GetName(MyPro.TypeId)
MyProType.GetInfo (MyPro.TypeId)
OriType1 = MyProType.GetName(MyProType.UpperId)
ComboPro.Enabled = False
ComboType1.Enabled = False
ComboType2.Enabled = False
ComboCreateDate.Text = Trim(FrmStoreinMan.Adodc1.Recordset.Fields(5))
txtPrice1 = FrmStoreinMan.Adodc1.Recordset.Fields(6)
txtNum = FrmStoreinMan.Adodc1.Recordset.Fields(7)
OriClt = Trim(FrmStoreinMan.Adodc1.Recordset.Fields(8))
MyClt.GetInfo (MyClt.GetId(Trim(FrmStoreinMan.Adodc1.Recordset.Fields(8))))
OriCltType = MyClt.ClientType
ComboClt.Enabled = False
ComboType.Enabled = False
txtPrice1.Enabled = False
ComboStoreinType.Enabled = False
ComboCreateDate.Enabled = False
OriStore = Trim(FrmStoreinMan.Adodc1.Recordset.Fields(9))
lblEmpName = Trim(FrmStoreinMan.Adodc1.Recordset.Fields(10))
lblOptDate = Trim(FrmStoreinMan.Adodc1.Recordset.Fields(11))
ComboStore.Enabled = False
End If
'装入客户数据
ComboType.ListIndex = OriCltType - 1
MyClt.Load_Client (OriCltType)
i = 0
ComboClt.Clear
Do While Arr_Client(i) <> ""
ComboClt.AddItem Arr_Client(i)
i = i + 1
Loop
If Modify = False Then
If ComboClt.ListCount > 0 Then
ComboClt.ListIndex = 0
End If
Else
If InCombo(OriClt, ComboClt) = True Then
ComboClt.Text = OriClt
End If
End If
Fill_Clt
'装入产品信息
'装入一级类目
MyProType.Load_by_Upper (0)
i = 0
ComboType1.Clear
Do While Arr_ProType(i) <> ""
ComboType1.AddItem Arr_ProType(i)
i = i + 1
Loop
If OriType1 = "" Then
If ComboType1.ListCount > 0 Then
ComboType1.ListIndex = 0
End If
Else
If InCombo(OriType1, ComboType1) = True Then
ComboType1.Text = OriType1
End If
End If
'装入二级类目
TmpType = MyProType.GetId(ComboType1.Text)
MyProType.Load_by_Upper (TmpType)
ComboType2.Clear
i = 0
Do While Arr_ProType(i) <> ""
ComboType2.AddItem Arr_ProType(i)
i = i + 1
Loop
If OriType2 = "" Then
If ComboType2.ListCount > 0 Then
ComboType2.ListIndex = 0
End If
Else
If InCombo(OriType2, ComboType2) = True Then
ComboType2.Text = OriType2
End If
End If
'装入产品名称
TmpType = MyProType.GetId(ComboType2.Text)
MyPro.Load_by_Type (TmpType)
i = 0
ComboPro.Clear
Do While Arr_Product(i) <> ""
ComboPro.AddItem Arr_Product(i)
i = i + 1
Loop
If OriPro = "" Then
If ComboPro.ListCount > 0 Then
ComboPro.ListIndex = 0
End If
Else
If InCombo(OriPro, ComboPro) = True Then
ComboPro.Text = OriPro
End If
End If
Fill_Pro
'入库信息
ComboType.ListIndex = 0
MyStore.Load_Store
i = 0
ComboStore.Clear
Do While Arr_Store(i) <> ""
ComboStore.AddItem Arr_Store(i)
i = i + 1
Loop
If OriStore = "" Then
If ComboStore.ListCount > 0 Then
ComboStore.ListIndex = 0
End If
Else
If InCombo(OriStore, ComboStore) = True Then
ComboStore.Text = OriStore
End If
End If
End Sub
Private Sub txtNum_Change()
txtAmount = Val(txtPrice1) * Val(txtNum)
End Sub
Private Sub txtNum_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Int(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtPos_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPrice1_Change()
txtAmount = Val(txtPrice1) * Val(txtNum)
End Sub
Private Sub txtPrice1_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -