📄 pub_me_dt.bas
字号:
Attribute VB_Name = "pub_me_dt"
Option Explicit
'***********************************************************************
'* 功 能 : 给Combobox控件赋值
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.01
'* 修改日期 : 1999.03.04
'* 参数说明: tp_com : 控件的名称
'* tp_table : 所使用的表名
'* tp_fdname0 : 代码字段的字段名
'* tp_fdname1 : 名称字段的字段名
'***********************************************************************
Public Sub PUB_CMSC(tp_data As Database, tp_com As Control, tp_table As String, tp_fdname0 As String, tp_fdname1 As String)
Dim i As Integer
Dim tp_rec As Recordset
Dim tp_recordcount As Integer
tp_com.Clear
Set tp_rec = tp_data.OpenRecordset("select " & tp_fdname0 & "," & tp_fdname1 & " from " & tp_table & " order by " & tp_fdname0, 4, 0, 2)
If Not tp_rec.BOF Then
tp_rec.MoveLast
tp_recordcount = tp_rec.RecordCount
tp_rec.MoveFirst
For i = 0 To tp_recordcount - 1
tp_com.AddItem
tp_com.List(i, 0) = tp_rec.Fields(tp_fdname0)
tp_com.List(i, 1) = tp_rec.Fields(tp_fdname1)
tp_rec.MoveNext
Next i
End If
tp_rec.Close
End Sub
'***********************************************************************
'* 功 能 : 根据代码生成名称
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.06
'* 修改日期 : 1999.03.06
'* 参数说明: tp_dm : 代码字段控件名
'* tp_mc : 名称字段控件名
'***********************************************************************
Public Function PUB_GetCMName(tp_dm As Control, tp_cm As Control) As Boolean
Dim i As Integer
Dim tp_rt As Boolean
tp_rt = False
For i = 0 To tp_cm.ListCount - 1
If Trim(tp_cm.List(i, 0)) = Trim(tp_dm.Text) Then
tp_cm.Text = Trim(tp_cm.List(i, 1))
tp_rt = True
Exit For
End If
Next i
PUB_GetCMName = tp_rt
End Function
'************************************************************************************
'* 功 能 : 根据名称查找代码; 若该名称和代码为一组时, 则退出, 否则,按照名称查找代码
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.06
'* 修改日期 : 1999.03.06
'* 参数说明: tp_dm : 代码字段控件名
'* tp_mc : 名称字段控件名
'************************************************************************************
Public Function PUB_GetTXCode(tp_dm As Control, tp_cm As Control) As Boolean
Dim i As Integer
Dim tp_rt As Boolean
Dim tp_find As Boolean
tp_rt = False
tp_find = False
For i = 0 To tp_cm.ListCount - 1
If Trim(tp_cm.List(i, 1)) = Trim(tp_cm.Text) Then
tp_dm.Text = Trim(tp_cm.List(i, 0))
tp_rt = True
Exit For
End If
Next i
PUB_GetTXCode = tp_rt
End Function
'************************************************************************************
'* 功 能 : 给住客名称控件赋值
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.06
'* 修改日期 : 1999.03.06
'* 参数说明: tp_zkmc : 住客名称字段控件名
'************************************************************************************
Public Sub PUB_GetZKMC(tp_zkmc As Control)
Dim i As Integer
tp_zkmc.Clear
tp_zkmc.AddItem
i = 0
tp_zkmc.List(i, 0) = CInt(LoadResString(SYS_SKLX))
tp_zkmc.List(i, 1) = LoadResString(SYS_SKMC)
tp_zkmc.AddItem
i = i + 1
tp_zkmc.List(i, 0) = CInt(LoadResString(SYS_TDLX))
tp_zkmc.List(i, 1) = LoadResString(SYS_TDMC)
tp_zkmc.AddItem
i = i + 1
tp_zkmc.List(i, 0) = CInt(LoadResString(SYS_CBLX))
tp_zkmc.List(i, 1) = LoadResString(SYS_CBMC)
tp_zkmc.AddItem
i = i + 1
tp_zkmc.List(i, 0) = CInt(LoadResString(SYS_NBLX))
tp_zkmc.List(i, 1) = LoadResString(SYS_NBMC)
End Sub
'************************************************************************************
'* 功 能 : 给特殊服务控件赋值
'* 作 成 者 : 梁 卫
'* 生成日期 : 1999.03.10
'* 修改日期 : 1999.03.10
'* 参数说明: tp_zkmc : 特殊服务字段控件名
'************************************************************************************
Public Sub PUB_GetTSFW(tp_data As Database, tp_tsfw As Control)
Dim i As Integer
Dim temp_rec As Recordset
tp_tsfw.Clear
Set temp_rec = tp_data.OpenRecordset("SELECT * FROM YD_TSFW ORDER BY TSFW", 4, 0, 2)
If Not temp_rec.BOF Then
temp_rec.MoveLast
temp_rec.MoveFirst
Do While Not temp_rec.EOF
tp_tsfw.AddItem Trim(temp_rec.Fields("TSFW"))
temp_rec.MoveNext
Loop
End If
temp_rec.Close
End Sub
'**************************************************************************************************
'* 功 能 : 在字典表中, 代码字段失去焦点时的处理
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.08
'* 修改日期 : 1999.03.08
'**************************************************************************************************
Public Sub PUB_DMLostFocus(temp_dm As Control, temp_mc As Control, temp_frmmsg As Control, temp_msg As String)
Dim temp_rt As Boolean
temp_frmmsg.Visible = False
temp_frmmsg.Caption = ""
If Trim(temp_dm.Text) = "" Or Trim(temp_dm.Text) = "*" Then
temp_mc.Text = "*"
Else
temp_rt = PUB_GetCMName(temp_dm, temp_mc)
If temp_rt Then
Else
temp_frmmsg.Visible = True
temp_frmmsg.Caption = temp_msg
temp_dm.SetFocus
End If
End If
End Sub
'**************************************************************************************************
'* 功 能 : 在字典表中, 名称字段失去焦点时的处理
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.08
'* 修改日期 : 1999.03.08
'**************************************************************************************************
Public Function PUB_MCLostFocus(temp_dm As Control, temp_mc As Control, temp_frmmsg As Control, temp_msg As String) As Boolean
temp_frmmsg.Visible = False
temp_frmmsg.Caption = ""
PUB_MCLostFocus = True
If Trim(temp_mc.Text) = "" Or Trim(temp_mc.Text) = "*" Then
temp_dm.Text = "*"
Else
PUB_MCLostFocus = PUB_GetTXCode(temp_dm, temp_mc)
If PUB_MCLostFocus Then
Else
temp_frmmsg.Visible = True
temp_frmmsg.Caption = temp_msg
temp_dm.SetFocus
End If
End If
End Function
'**************************************************************************************************
'* 功 能 : 日期型字段校验
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.15
'* 修改日期 : 1999.03.15
'**************************************************************************************************
Public Function PUB_RQJY(temp_rq As Control, temp_msg As Control) As Boolean
PUB_RQJY = True
If temp_rq.Text = "____-__-__" Or temp_rq.Text = " - - " Then
Else
If Len(Trim(temp_rq)) = 10 Then
If IsDate(Trim(temp_rq)) Then
Else
PUB_RQJY = False
End If
Else
PUB_RQJY = False
End If
End If
If Not PUB_RQJY Then
temp_msg.Visible = True
temp_msg.Caption = "不适当的日期型"
temp_rq.SetFocus
End If
End Function
'**************************************************************************************************
'* 功 能 : 数字型字段校验
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.15
'* 修改日期 : 1999.03.15
'**************************************************************************************************
Public Function PUB_SZJY(temp_sz As Control, temp_msg As Control) As Boolean
temp_sz.Text = Trim(temp_sz.Text)
PUB_SZJY = True
If Trim(temp_sz) = "" Then
temp_sz.Text = 0
Else
If IsNumeric(temp_sz.Text) Then
If CDec(temp_sz.Text) >= 0 Then
Else
PUB_SZJY = False
End If
Else
PUB_SZJY = False
End If
End If
If Not PUB_SZJY Then
temp_msg.Visible = True
temp_msg.Caption = "不适当的数字"
temp_sz.SetFocus
End If
End Function
Public Sub ZW_GD(t_jsmc As String, t_fkmc As String, t_zh As String, t_dfzh As String, t_lsk As String, t_bz As String, t_zdh As String, t_zhk As String, t_gdk1 As String, t_zdj As Single, t_zxfe As Single, t_ye As Single, t_bzje As Single, t_zkl As Single, t_ld As Boolean, t_ld1 As Boolean, t_ren As Integer, t_gd_jsrq As Date, t_gd_jssj As String)
'*T_JSMC 结算方式名称
'*T_FKMC 付款方式名称
'*T_ZH 帐号
'*T_DFZH 对方帐号
'*T_LSK 临时帐号
'*T_BZ 备注
'*T_ZDH 帐单号
'*T_ZHK 帐首库名
'*T_GDK1 待归档的帐页库名
'*T_ZDJ 总定金
'*T_ZXFE 总消费额
'*T_YE 余额
'*T_BZJE 报帐金额
'*T_ZKL 折扣率
'*T_LD1 离店标志
'*T_REN 同房人数
'*GD_JSRQ
'*GD_JSSJ
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -