?? mdlappendmerchandise.bas
字號:
Attribute VB_Name = "mdlAppendMerchandise"
Option Explicit
'***********************************************************************
'* 過程名:AppendNewApply
'* 功 能:追加補貨申請
'* 參 數:ListView 列表控件
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Public Sub AppendNewApply(ByRef lvListViewCtl As ListView)
Dim appendMerApply As clsOpAppendMerchandise
Set appendMerApply = New clsOpAppendMerchandise
appendMerApply.AppendNewApply g_currentUser
UpdateListViewInApply lvListViewCtl
End Sub
'***********************************************************************
'* 過程名:EditApply
'* 功 能:編輯補貨申請/核準補貨
'* 參 數:ListView 列表控件
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Public Sub EditApply(ByRef lvListViewCtl As ListView)
'變量定義
Dim currentSelApplyId As String '當前選擇店ID
Dim currentSelApply As clsAppendMerchandise '當前選擇店
Dim opApply As clsOpAppendMerchandise '連鎖店操作對象
'取得當前選擇
If lvListViewCtl.SelectedItem Is Nothing Then
MsgBox "請選擇要編輯的補貨申請!", vbExclamation Or vbOKOnly, "警告"
Else
currentSelApplyId = Trim(lvListViewCtl.SelectedItem.Text)
Set currentSelApply = New clsAppendMerchandise
If currentSelApply.LoadById(CInt(currentSelApplyId)) = DbOpRecExist Then
Set opApply = New clsOpAppendMerchandise
opApply.EditApply currentSelApply, g_currentUser
lvListViewCtl.ListItems.Remove lvListViewCtl.SelectedItem.Index
UpdateListViewInApply lvListViewCtl
Else
MsgBox "讀取補貨申請信息失敗!", vbExclamation Or vbOKOnly, "警告"
End If
End If
End Sub
'***********************************************************************
'* 過程名:IniListViewInApply
'* 功 能:以補貨申請列表初始化ListView
'* 參 數:ListView 列表控件
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Public Sub IniListViewInApply(ByRef lvListViewCtl As ListView)
If g_listViewState = APPLYLIST Then
UpdateListViewInApply lvListViewCtl
Else
'變量定義
Dim applySet As clsAppendMerchandiseSet
Dim apply As clsAppendMerchandise
Dim curListItem As ListItem
'取得補貨申請集合
Set applySet = New clsAppendMerchandiseSet
If g_currentUser.shopId > 1 Then
applySet.LoadSetByShopId g_currentUser.shopId
End If
'清除現有顯示
lvListViewCtl.ColumnHeaders.Clear
lvListViewCtl.ListItems.Clear
'設定表頭
lvListViewCtl.ColumnHeaders.Add , "補貨申請ID", "補貨申請ID"
lvListViewCtl.ColumnHeaders.Add , "店名", "店名"
lvListViewCtl.ColumnHeaders.Add , "商品", "商品"
lvListViewCtl.ColumnHeaders.Add , "申請補貨數量", "申請補貨數量"
lvListViewCtl.ColumnHeaders.Add , "核準補貨數量", "核準補貨數量"
lvListViewCtl.ColumnHeaders.Add , "提交申請日期", "提交申請日期"
'明細顯示
For Each apply In applySet
Set curListItem = lvListViewCtl.ListItems.Add(, , CStr(apply.applyid))
curListItem.SubItems(1) = apply.shopName
curListItem.SubItems(2) = apply.merchandiseName
curListItem.SubItems(3) = CStr(apply.applyCount)
If apply.appendCount >= 0 Then
curListItem.SubItems(4) = CStr(apply.appendCount)
Else
curListItem.SubItems(4) = "待核準"
End If
curListItem.SubItems(5) = apply.applyDate
Next
End If
g_listViewState = APPLYLIST
End Sub
'***********************************************************************
'* 過程名:UpdateListViewInApply
'* 功 能:更補貨申請列表
'* 參 數:ListView 列表控件
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Public Sub UpdateListViewInApply(ByRef lvListViewCtl As ListView)
'變量定義
Dim applySet As clsAppendMerchandiseSet
Dim apply As clsAppendMerchandise
Dim curListItem As ListItem
Dim iLoop As Integer
'取得補貨申請集合
Set applySet = New clsAppendMerchandiseSet
If g_currentUser.shopId > 1 Then
applySet.LoadSetByShopId g_currentUser.shopId
End If
'明細更新
For Each apply In applySet
For iLoop = 1 To lvListViewCtl.ListItems.Count
If apply.applyid = lvListViewCtl.ListItems.Item(iLoop).Text Then
GoTo CHECKAGAIN
End If
Next
Set curListItem = lvListViewCtl.ListItems.Add(, , CStr(apply.applyid))
curListItem.SubItems(1) = apply.shopName
curListItem.SubItems(2) = apply.merchandiseName
curListItem.SubItems(3) = CStr(apply.applyCount)
If apply.appendCount >= 0 Then
curListItem.SubItems(4) = CStr(apply.appendCount)
Else
curListItem.SubItems(4) = "待核準"
End If
curListItem.SubItems(5) = apply.applyDate
CHECKAGAIN:
Next
End Sub
'***********************************************************************
'* 過程名:RemoveApply
'* 功 能:刪除補貨申請
'* 參 數:ListView 列表控件
'* 版 本:2006.01.04 顏志軍 初版
'***********************************************************************
Public Sub RemoveApply(ByRef lvListViewCtl As ListView)
'變量定義
Dim currentSelApplyId As String '當前選擇補貨申請ID
Dim currentSelApply As clsAppendMerchandise '當前選擇補貨申請
Dim opApply As clsOpAppendMerchandise '補貨申請操作對象
If Not lvListViewCtl.SelectedItem Is Nothing Then
currentSelApplyId = lvListViewCtl.SelectedItem.Text
If MsgBox("刪除ID為[" & currentSelApplyId & "]的補貨申請嗎?", vbQuestion Or _
vbYesNo, "詢問") = vbYes Then
Set currentSelApply = New clsAppendMerchandise
If currentSelApply.LoadById(CInt(currentSelApplyId)) = DbOpRecExist Then
Set opApply = New clsOpAppendMerchandise
If opApply.RemoveApply(currentSelApply, g_currentUser) Then
lvListViewCtl.ListItems.Remove lvListViewCtl.SelectedItem.Index
Exit Sub
End If
End If
MsgBox "刪除補貨申請失敗!", vbExclamation Or vbOKOnly, "警告"
End If
Else
MsgBox "請先選擇要刪除的補貨申請!", vbExclamation Or vbOKOnly, "警告"
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -