📄 frmsubmitsalerecday.frm
字号:
VERSION 5.00
Begin VB.Form frmSubmitSalerecday
BorderStyle = 1 'Fixed Single
Caption = "商品日报提交"
ClientHeight = 3195
ClientLeft = 45
ClientTop = 330
ClientWidth = 4140
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4140
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdCancle
Caption = "放弃"
Height = 375
Left = 2423
TabIndex = 11
Top = 2640
Width = 975
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 375
Left = 743
TabIndex = 10
Top = 2640
Width = 975
End
Begin VB.TextBox txtMerchandiseCount
Height = 270
Left = 1200
TabIndex = 9
Text = "txtMerchandiseCount"
Top = 1920
Width = 2655
End
Begin VB.TextBox txtSaledate
Height = 270
Left = 1200
TabIndex = 8
Text = "txtSaledate"
Top = 1509
Width = 2655
End
Begin VB.ComboBox cmbMerchandise
Height = 300
Left = 1200
Style = 2 'Dropdown List
TabIndex = 7
Top = 1071
Width = 2655
End
Begin VB.ComboBox cmbMerchandiseKind
Height = 300
Left = 1200
Style = 2 'Dropdown List
TabIndex = 6
Top = 633
Width = 2655
End
Begin VB.Label lblErrorInfo
Caption = "lblErrorInfo"
ForeColor = &H000000FF&
Height = 375
Left = 120
TabIndex = 12
Top = 2280
Width = 3735
End
Begin VB.Label lblShopName
BorderStyle = 1 'Fixed Single
Caption = "lblShopName"
Height = 255
Left = 1200
TabIndex = 5
Top = 240
Width = 2655
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "当日销售量"
Height = 180
Left = 120
TabIndex = 4
Top = 1965
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "销售日期"
Height = 180
Left = 120
TabIndex = 3
Top = 1554
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "商品名称"
Height = 180
Left = 120
TabIndex = 2
Top = 1131
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "商品类别"
Height = 180
Left = 120
TabIndex = 1
Top = 693
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "连锁店名"
Height = 180
Left = 120
TabIndex = 0
Top = 277
Width = 720
End
End
Attribute VB_Name = "frmSubmitSalerecday"
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_Salerecday As clsSalerecDay '当前商品日报
Private m_CurrentUser As clsOpuser '当前操作用户
'***********************************************************************
'* 过程名:IniComboxKind
'* 功 能:初始化商品类别下拉框
'* 参 数:
'* 版 本:2006.01.05 颜志军 初版
'***********************************************************************
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.05 颜志军 初版
'***********************************************************************
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.05 颜志军 初版
'***********************************************************************
Private Sub DspInfo()
'清空错误信息显示标签
lblErrorInfo.Caption = ""
'商品类别下拉框
IniComboxKind
'商品名称下拉框
IniComboxMerchandise
'显示店名
lblShopName.Caption = m_CurrentUser.shopName
'其它控件显示设定
If m_OpModiFlag Then '修改
txtMerchandiseCount.Text = CStr(m_Salerecday.merchandiseCount)
txtSaledate.Text = CStr(m_Salerecday.saledate)
cmbMerchandise.Text = m_Salerecday.merchandiseName
'显示对应商品类别
Dim curMerchandise As clsMerchandiseinfo
Set curMerchandise = New clsMerchandiseinfo
curMerchandise.LoadById m_Salerecday.merchandiseId
cmbMerchandiseKind.Text = curMerchandise.kindName
Else '新增
txtMerchandiseCount.Text = ""
txtSaledate.Text = CStr(Date)
End If
End Sub
'***********************************************************************
'* 函数名:CheckInput
'* 功 能:检查输入信息
'* 参 数:
'* 返回值:Boolean True 通过 False 未通过
'* 版 本:2006.01.04 颜志军 初版
'***********************************************************************
Private Function CheckInput() As Boolean
If IsEmpty(Trim(cmbMerchandise.Text)) Or Trim(cmbMerchandise.Text) = "" Then
lblErrorInfo.Caption = "必须选择商品!"
CheckInput = False
ElseIf IsEmpty(Trim(txtSaledate.Text)) Or Trim(txtSaledate.Text) = "" Then
lblErrorInfo.Caption = "必须输入销售日期!"
CheckInput = False
ElseIf IsEmpty(Trim(txtMerchandiseCount.Text)) Or Trim(txtMerchandiseCount.Text) = "" Then
lblErrorInfo.Caption = "必须输入当日销售量!"
CheckInput = False
Else
CheckInput = True
End If
End Function
'***********************************************************************
'* 函数名:UpdateObject
'* 功 能:更新设定信息到对象
'* 参 数:
'* 返回值:Boolean
'* 版 本:2006.01.05 颜志军 初版
'***********************************************************************
Private Function UpdateObject() As Boolean
'设定店ID
If Not m_OpModiFlag Then
m_Salerecday.shopId = m_CurrentUser.shopId
End If
'设定界面输入项
If CheckInput() Then
m_Salerecday.merchandiseId = cmbMerchandise.ItemData(cmbMerchandise.ListIndex)
m_Salerecday.saledate = CDate(Trim(txtSaledate.Text))
m_Salerecday.merchandiseCount = CInt(Trim(txtMerchandiseCount))
UpdateObject = True
Else
UpdateObject = False
End If
End Function
'***********************************************************************
'* 过程名:ShowDlg
'* 功 能:显示对话框
'* 参 数:
'* 版 本:2006.01.05 颜志军 初版
'***********************************************************************
Public Sub ShowDlg(ByRef curSalerecday As clsSalerecDay, _
ByVal opFlag As Boolean, _
ByVal currentUser As clsOpuser)
Set m_Salerecday = curSalerecday
Set m_CurrentUser = currentUser
m_OpModiFlag = opFlag
DspInfo
Me.Show vbModal
End Sub
'***********************************************************************
'* 过程名:cmbMerchandiseKind_Click
'* 功 能:商品类别选择框CLICK事件响应
'* 参 数:
'* 版 本:2006.01.05 颜志军 初版
'***********************************************************************
Private Sub cmbMerchandiseKind_Click()
IniComboxMerchandise
End Sub
'***********************************************************************
'* 过程名:cmdOK_CcmdCancle_Clicklick
'* 功 能:放弃按钮CLICK事件响应
'* 参 数:
'* 版 本:2006.01.05 颜志军 初版
'***********************************************************************
Private Sub cmdCancle_Click()
Unload Me
End Sub
'***********************************************************************
'* 过程名:cmdOK_Click
'* 功 能:确定按钮CLICK事件响应
'* 参 数:
'* 版 本:2006.01.05 颜志军 初版
'***********************************************************************
Private Sub cmdOK_Click()
'更新信息
If Not UpdateObject() Then
Exit Sub
End If
'变量定义
Dim DbOpResult As DbOpResult
If m_OpModiFlag Then '修改
DbOpResult = m_Salerecday.Update
Else '追加
DbOpResult = m_Salerecday.AppendNew
End If
'检查结果
Select Case DbOpResult
Case DbOpNG
lblErrorInfo = "数据库操作失败!"
Case DbOpRecNoExist
lblErrorInfo = "日报ID不存在!"
Case DbOpRecExist
lblErrorInfo = "日报已存在,请用修改操作修改数据!"
Case DbOpOk
Unload Me
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -