?? frmappendmerchandise.frm
字號:
VERSION 5.00
Begin VB.Form frmAppendMerchandise
BorderStyle = 1 'Fixed Single
Caption = "補貨信息"
ClientHeight = 3075
ClientLeft = 45
ClientTop = 330
ClientWidth = 4050
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3075
ScaleWidth = 4050
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancle
Caption = "放棄"
Height = 375
Left = 2378
TabIndex = 11
Top = 2520
Width = 735
End
Begin VB.CommandButton cmdApply
Caption = "申請"
Height = 375
Left = 938
TabIndex = 10
Top = 2520
Width = 735
End
Begin VB.TextBox txtAppendCount
Height = 300
Left = 1440
TabIndex = 9
Text = "Text1"
Top = 1680
Width = 2415
End
Begin VB.TextBox txtApplyCount
Height = 300
Left = 1440
TabIndex = 7
Text = "txtApplyCount"
Top = 1290
Width = 2415
End
Begin VB.ComboBox cmbMerchandise
Height = 300
Left = 1440
Style = 2 'Dropdown List
TabIndex = 6
Top = 900
Width = 2415
End
Begin VB.ComboBox cmbMerchandiseKind
Height = 300
Left = 1440
Style = 2 'Dropdown List
TabIndex = 5
Top = 510
Width = 2415
End
Begin VB.ComboBox cmbShopName
Height = 300
Left = 1440
Style = 2 'Dropdown List
TabIndex = 4
Top = 120
Width = 2415
End
Begin VB.Label lblErrorInfo
Caption = "lblErrorInfo"
ForeColor = &H000000FF&
Height = 255
Left = 120
TabIndex = 12
Top = 2040
Width = 3735
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "實際補貨數量"
Height = 180
Left = 120
TabIndex = 8
Top = 1740
Width = 1080
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "申請補貨數量"
Height = 180
Left = 120
TabIndex = 3
Top = 1350
Width = 1080
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "商 品 名 稱"
Height = 180
Left = 120
TabIndex = 2
Top = 960
Width = 990
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "商 品 類 別"
Height = 180
Left = 120
TabIndex = 1
Top = 570
Width = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "申請補貨店名"
Height = 180
Left = 120
TabIndex = 0
Top = 180
Width = 1080
End
End
Attribute VB_Name = "frmAppendMerchandise"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private m_OpModiFlag As Boolean '修改操作標志
Private m_Apply As clsAppendMerchandise '當前商品
Private m_CurrentUser As clsOpuser '當前操作用戶
'***********************************************************************
'* 過程名:IniComboxShop
'* 功 能:初始化連鎖店下拉框
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub IniComboxShop()
'變量定義
Dim shopList As clsMembershopSet '連鎖店集合
Dim singleShop As clsMembershop '連鎖店
Dim index As Integer '索引
Dim curIndex As Integer '當前顯示項
'生成類別集合
Set shopList = New clsMembershopSet
'初始化COMBOX列表
index = 0
curIndex = 0
For Each singleShop In shopList
If singleShop.shopId > 1 Then
cmbShopName.AddItem singleShop.shopName, index
cmbShopName.ItemData(index) = singleShop.shopId
If m_CurrentUser.shopId = singleShop.shopId Then
curIndex = index
End If
index = index + 1
End If
Next
'初始化顯示項
If cmbShopName.ListCount > 0 Then
cmbShopName.ListIndex = curIndex
End If
End Sub
'***********************************************************************
'* 過程名:IniComboxKind
'* 功 能:初始化商品類別下拉框
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub IniComboxKind()
'變量定義
Dim kindList As clsMerchandisekindSet '商品類別集合
Dim singleKind As clsMerchandisekind '商品類別
Dim index As Integer '索引
'生成類別集合
Set kindList = New clsMerchandisekindSet
'初始化COMBOX列表
index = 0
For Each singleKind In kindList
cmbMerchandiseKind.AddItem singleKind.kindName, index
cmbMerchandiseKind.ItemData(index) = singleKind.kindId
index = index + 1
Next
'初始化顯示項
If cmbMerchandiseKind.ListCount > 0 Then
cmbMerchandiseKind.ListIndex = 0
End If
End Sub
'***********************************************************************
'* 過程名:IniComboxMerchandise
'* 功 能:初始化商品名稱下拉框
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub IniComboxMerchandise()
'變量定義
Dim merchandiseList As clsMerchandiseinfoSet '商品集合
Dim merchandise As clsMerchandiseinfo '商品
Dim merchandiseKind As Integer '商品類別
Dim index As Integer '索引
'生成商品集合
Set merchandiseList = New clsMerchandiseinfoSet
If cmbMerchandiseKind.ListIndex >= 0 Then
merchandiseKind = cmbMerchandiseKind.ItemData(cmbMerchandiseKind.ListIndex)
merchandiseList.LoadSetByKindId merchandiseKind
End If
'清除原有項
cmbMerchandise.Clear
'初始化COMBOX列表
index = 0
For Each merchandise In merchandiseList
cmbMerchandise.AddItem merchandise.merchandiseName, index
cmbMerchandise.ItemData(index) = merchandise.merchandiseId
index = index + 1
Next
'初始化顯示項
If cmbMerchandise.ListCount > 0 Then
cmbMerchandise.ListIndex = 0
End If
End Sub
'***********************************************************************
'* 過程名:DspInfo
'* 功 能:顯示補貨信息
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub DspInfo()
'清空錯誤信息顯示標簽
lblErrorInfo.Caption = ""
'連鎖店下拉框
IniComboxShop
'商品類別下拉框
IniComboxKind
'商品名稱下拉框
IniComboxMerchandise
'其它控件顯示設定
If m_OpModiFlag Then '修改
txtApplyCount.Text = m_Apply.applyCount
If m_CurrentUser.userRank < 4 Then
If m_Apply.appendCount >= 0 Then
txtAppendCount.Text = m_Apply.appendCount
Else
txtAppendCount.Text = m_Apply.applyCount
End If
ElseIf m_CurrentUser.userRank = 4 Then
If m_Apply.appendCount >= 0 Then
txtAppendCount.Text = m_Apply.appendCount
Else
txtAppendCount.Text = ""
End If
End If
Else '新增
txtApplyCount.Text = ""
txtAppendCount.Text = ""
End If
'控件可用狀態控制
SetCtlSate
End Sub
'***********************************************************************
'* 過程名:SetCtlSate
'* 功 能:設定控件狀態
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub SetCtlSate()
If m_CurrentUser.userRank = 4 Then '店操作員
cmbShopName.Enabled = False
txtAppendCount.Enabled = False
cmdApply.Caption = "申請"
Else
cmdApply.Caption = "核準"
cmbShopName.Enabled = False
cmbMerchandiseKind.Enabled = False
cmbMerchandise.Enabled = False
txtApplyCount.Enabled = False
End If
'已核準申請,不可修改
If m_OpModiFlag And m_Apply.appendCount >= 0 Then
cmbMerchandiseKind.Enabled = False
cmbMerchandise.Enabled = False
txtApplyCount.Enabled = False
txtAppendCount.Enabled = False
cmdApply.Enabled = False
End If
End Sub
'***********************************************************************
'* 函數名:CheckInput
'* 功 能:檢查輸入信息
'* 參 數:
'* 返回值:Boolean True 通過 False 未通過
'* 版 本:2006.01.03 顏志軍 初版
'***********************************************************************
Private Function CheckInput() As Boolean
If m_CurrentUser.userRank = 4 Then
If IsEmpty(Trim(txtApplyCount.Text)) Or Trim(txtApplyCount.Text) = "" Then
lblErrorInfo.Caption = "必須輸入補貨數量!"
CheckInput = False
ElseIf IsEmpty(Trim(cmbMerchandise.Text)) Or Trim(cmbMerchandise.Text) = "" Then
lblErrorInfo.Caption = "必須選擇商品!"
CheckInput = False
Else
CheckInput = True
End If
Else
If IsEmpty(Trim(txtAppendCount.Text)) Or Trim(txtAppendCount.Text) = "" _
Then
lblErrorInfo.Caption = "必須輸入核準補貨數量!"
CheckInput = False
Else
CheckInput = True
End If
End If
End Function
'***********************************************************************
'* 函數名:UpdateObject
'* 功 能:更新設定信息到對象
'* 參 數:
'* 返回值:Boolean
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Function UpdateObject() As Boolean
m_Apply.shopId = m_CurrentUser.shopId
If CheckInput() Then
m_Apply.merchandiseId = cmbMerchandise.ItemData(cmbMerchandise.ListIndex)
m_Apply.applyCount = CInt(Trim(txtApplyCount.Text))
If m_CurrentUser.userRank < 4 Then
m_Apply.appendCount = CInt(Trim(txtAppendCount.Text))
End If
UpdateObject = True
Else
UpdateObject = False
End If
End Function
'***********************************************************************
'* 過程名:ShowDlg
'* 功 能:顯示對話框
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Public Sub ShowDlg(ByRef curApply As clsAppendMerchandise, _
ByVal opFlag As Boolean, _
ByVal currentUser As clsOpuser)
Set m_Apply = curApply
Set m_CurrentUser = currentUser
m_OpModiFlag = opFlag
DspInfo
Me.Show vbModal
End Sub
'***********************************************************************
'* 過程名:cmbMerchandiseKind_Click
'* 功 能:商品類別選擇框CLICK事件響應
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub cmbMerchandiseKind_Click()
IniComboxMerchandise
End Sub
'***********************************************************************
'* 過程名:cmdApply_Click
'* 功 能:cmdApply按鈕CLICK事件響應
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub cmdApply_Click()
'更新信息
If Not UpdateObject() Then
Exit Sub
End If
'變量定義
Dim DbOpResult As DbOpResult
If m_CurrentUser.userRank = 4 Then '店操作員,申請操作
If m_OpModiFlag Then '修改
DbOpResult = m_Apply.Update
Else '追加
DbOpResult = m_Apply.AppendNew
End If
Else '核準操作
DbOpResult = m_Apply.UpdateAllow
End If
'檢查結果
Select Case DbOpResult
Case DbOpNG
lblErrorInfo = "數據庫操作失敗!"
Case DbOpRecNoExist
lblErrorInfo = "補貨ID不存在!"
Case DbOpOk
Unload Me
End Select
End Sub
'***********************************************************************
'* 過程名:cmdCancle_Click
'* 功 能:cmdCancle按鈕CLICK事件響應
'* 參 數:
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Private Sub cmdCancle_Click()
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -