📄 ct_zck.frm
字号:
Private Sub Form_Load()
Dim temp_ft As Boolean
temp_ft = True
frm_msg.Visible = False
frm_msg.Caption = ""
lb_title = "早餐卡" + CS_zck_id + "登记"
m_dfzh.Text = Trim(Rt_zh)
Select Case CS_zck_id
Case "回收", "发放"
fm_dfzh.Visible = True
fm_dfzh.Enabled = True
gd1.Enabled = False
CMD_FUNC.Enabled = False
End Select
ct_zck.KeyPreview = True
Set t_rec = PUB_data.OpenRecordset("SELECT * FROM DT_ZCKBZ ORDER BY ZCK_BZ", 4, 0, 2)
If Not t_rec.BOF Then
t_rec.MoveLast
t_rec.MoveFirst
End If
LOCAL_data.Execute "DELETE FROM DT_ZCK"
Set zck_rec = LOCAL_data.OpenRecordset("SELECT * FROM DT_ZCK ORDER BY ZCK_BZ", 2, 0, 2)
If Not zck_rec.BOF Then
zck_rec.MoveLast
End If
'把早餐卡标准记录插入临时表中
Do While Not t_rec.EOF
zck_rec.AddNew
zck_rec.Fields("ZCK_BZ") = t_rec.Fields("ZCK_BZ")
zck_rec.Fields("FSSL") = 0
zck_rec.Fields("FSBZ") = "*"
zck_rec.Update
t_rec.MoveNext
Loop
t_fields = Array("ZCK_BZ", "FSSL", "FSBZ") '设置显示字段
t_fdxs = Array(0, 0, 0) '设置显示字段
t_bt = ">标准 |> 发放数量 |<发放备注 " '设置显示表头格式
t_fdcounts = 3
Call flex_refresh
tPkjTextSet zck_rec, 0 '把当前字段清空
tPkjEnabledFT "", False
t_rec.Requery
If Not t_rec.BOF Then
t_rec.MoveLast
t_rec.MoveFirst
Else
frm_msg.Visible = True
frm_msg.Caption = "早餐卡标准没有初始化, 请与机房联系!!"
End If
t_rec.Close
If Trim(Rt_zh) = "" Then
Else
m_dfzh.Locked = True
End If
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.16
'* 修改日期 : 1999.03.16
'**************************************************************************************************
Private Sub gd1_GotFocus()
If gd1.Rows - 1 <> 0 Then
Set t_rec = LOCAL_data.OpenRecordset("SELECT * FROM DT_ZCK WHERE ZCK_BZ=" & gd1.TextArray(gd1.Row * t_fdcounts), 4, 0, 2)
If Not t_rec.BOF Then
t_rec.MoveLast
tPkjTextSet t_rec, 1 '按记录集给字段赋值
Else
tPkjTextSet t_rec, 0 '把字段清空
End If
t_rec.Close
Else
tPkjTextSet t_rec, 0 '把字段清空
End If
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.16
'* 修改日期 : 1999.03.16
'**************************************************************************************************
Private Sub gd1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim temp_ft As Boolean
frm_msg.Visible = False
frm_msg.Caption = ""
temp_ft = True
If KeyCode = vbKeyReturn Then
If gd1.Rows - 1 <> 0 Then
Set t_rec = LOCAL_data.OpenRecordset("SELECT * FROM DT_ZCK WHERE ZCK_BZ=" & gd1.TextArray(gd1.Row * t_fdcounts), 4, 0, 2)
If Not t_rec.BOF Then
t_rec.MoveLast
gd1.Enabled = False
'编辑字段初始化
tPkjTextSet t_rec, 1
Call button_refresh(False)
tPkjEnabledFT CS_zck_id, True
m_fssl.SetFocus
Else
temp_ft = False
End If
t_rec.Close
Else
temp_ft = False
End If
End If
If Not temp_ft Then
frm_msg.Visible = True
frm_msg.Caption = "没有可编辑的记录"
End If
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.16
'* 修改日期 : 1999.03.16
'**************************************************************************************************
Private Sub gd1_RowColChange()
gd1_GotFocus
End Sub
Private Sub m_dfzh_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If gd1.Enabled Then
gd1.SetFocus
Else
CMD_EXIT.SetFocus
End If
End If
End Sub
'**************************************************************************************************
'* 功 能 : 判断对方帐号的合法性
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.16
'* 修改日期 : 1999.03.16
'**************************************************************************************************
Private Sub m_dfzh_LostFocus()
Dim temp_ft As Boolean
Dim temp_tbname As String '表名
Dim temp_gdtbname As String '归档表名
Dim temp_gdqz As String '归档前缀
Dim temp_tb As Recordset
Dim temp_gd1 As Recordset
Dim temp_gd2 As Recordset
Dim temp_mfzc As Boolean
Dim temp_YN As Boolean
frm_msg.Visible = False
frm_msg.Caption = ""
temp_ft = True
If Trim(m_dfzh.Text) = "" Then
CMD_EXIT.SetFocus
Exit Sub
End If
If Len(Trim(m_dfzh.Text)) < 4 Then
frm_msg.Visible = True
frm_msg.Caption = "帐号不能为空"
m_dfzh.SetFocus
Exit Sub
End If
If InStr(1, SYS_SK, Left(m_dfzh.Text, 1)) Or InStr(1, SYS_TD, Left(m_dfzh.Text, 1)) Then
If InStr(1, SYS_SK, Left(m_dfzh.Text, 1)) Then
temp_tbname = "DT_KRQD"
temp_gdqz = "KR"
Else
temp_tbname = "DT_TDQD"
temp_gdqz = "TD"
End If
Else
frm_msg.Visible = True
frm_msg.Caption = "不适当的帐号"
m_dfzh.SetFocus
Exit Sub
End If
temp_YN = True
'判断该帐号是否为在店客人或在店团队客人
Set temp_tb = PUB_data.OpenRecordset("SELECT * FROM " & temp_tbname & " WHERE TRIM(ZH)='" & Trim(m_dfzh.Text) & "'", 4, 0, 2)
If Not temp_tb.BOF Then '在店
temp_tb.MoveLast
temp_mfzc = temp_tb.Fields("MFZC_FT")
temp_YN = t_tools.pub_zhpd(PUB_data, SYS_GWDM, LoadResString(SYS_GW_ZW), SYS_TZYSK, SYS_SK, SYS_TD, temp_tbname, m_dfzh.Text)
If Not temp_YN Then
frm_msg.Visible = True
frm_msg.Caption = "帐号输入错误"
m_dfzh.SetFocus
Exit Sub
Else
If Not temp_mfzc Then
MsgBox "该客人没有免费早餐卡, 请与前台联系!!", vbOKOnly, "免费早餐卡" + CS_zck_id
End If
End If
Else '不在店
'** 客人离店, 可能跨月, 要判断两次
temp_gdtbname = temp_gdqz + Trim(Str(year(Date)))
Set temp_gd1 = PUB_data.OpenRecordset("SELECT * FROM " & temp_gdtbname & " WHERE TRIM(ZH) = '" & Trim(m_dfzh.Text) & "' AND LDRQ>=DATE-1", 4, 0, 2)
If Not temp_gd1.BOF Then
temp_gd1.MoveLast
temp_mfzc = temp_gd1.Fields("MFZC_FT")
Else
temp_gdtbname = temp_gdqz + Trim(Str(year(Date - 1)))
Set temp_gd2 = PUB_data.OpenRecordset("SELECT * FROM " & temp_gdtbname & " WHERE TRIM(ZH) = '" & Trim(m_dfzh.Text) & "' AND LDRQ>=DATE-1", 4, 0, 2)
If Not temp_gd2.BOF Then
temp_gd2.MoveLast
temp_mfzc = temp_gd2.Fields("MFZC_FT")
Else
frm_msg.Visible = True
frm_msg.Caption = "帐号没有找到!"
m_dfzh.SetFocus
Exit Sub
End If
temp_gd2.Close
End If
temp_gd1.Close
temp_YN = t_tools.pub_zhpd(PUB_data, SYS_GWDM, LoadResString(SYS_GW_ZW), SYS_TZYSK, SYS_SK, SYS_TD, temp_tbname, m_dfzh.Text)
If Not temp_YN Then
frm_msg.Visible = True
frm_msg.Caption = "帐号输入错误!"
m_dfzh.SetFocus
Exit Sub
Else
If Not temp_mfzc Then
frm_msg.Visible = True
frm_msg.Caption = "该客人已经办理离店手续, 但该客人没有免费早餐卡, 请与前台联系!!"
Else
frm_msg.Visible = True
frm_msg.Caption = "该客人已经办理离店手续...."
End If
End If
End If
temp_tb.Close
Rt_zh = m_dfzh.Text '给 帐号 赋返回值
m_dfzh.Enabled = False
gd1.Enabled = True
CMD_FUNC.Enabled = True
gd1.SetFocus
End Sub
Private Sub m_fsbz_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn, vbKeyDown
cmd_ok(0).SetFocus
Case vbKeyUp
m_fssl.SetFocus
End Select
End Sub
Private Sub m_fssl_GotFocus()
If Trim(m_fssl.Text) <> "" Then
m_fssl.Text = Format(m_fssl.Text)
End If
End Sub
Private Sub m_fssl_LostFocus()
Dim temp_ft As Boolean
'数据合法性校验
temp_ft = True
If Trim(m_fssl.Text) = "" Then
m_fssl.Text = 0
Else
If IsNumeric(m_fssl.Text) Then
m_fssl.Text = Int(Trim(m_fssl.Text))
Else
temp_ft = False
End If
End If
If Not temp_ft Then
frm_msg.Visible = True
frm_msg.Caption = "不适当的数字"
m_fssl.SetFocus
Else
m_fssl.Text = Format(m_fssl.Text, "#,##0")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -