📄 ct_yhqcx.frm
字号:
Dim t_tbname As String
Dim t_bt As String '存储列表显示的表头
Dim t_fields As Variant '存储列表显示的字段名
Dim t_fdxs As Variant '表示显示列是否由代码转换成文字
Dim t_fdcounts As Integer '表示列表所显示的字段的个数
'**************************************************************************************************
'* 功 能 : 明细列表的显示
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub tPxs_YHQCX()
Dim temp_yhq As Recordset
Dim temp_yhqHJ As Recordset
Dim temp_rq_s As Date
Dim temp_rq_e As Date
Dim temp_day As Integer
If Trim(m_month.Text) = "" Then
temp_rq_s = Format(DateSerial(CInt(m_year.Text), 1, 1), "yyyy-mm-dd")
temp_rq_e = Format(DateSerial(CInt(m_year.Text), 12, 31), "yyyy-mm-dd")
ElseIf Trim(m_day.Text) = "" Then
temp_rq_s = Format(DateSerial(CInt(m_year.Text), CInt(m_month.Text), 1), "yyyy-mm-dd")
temp_day = DateSerial(CInt(m_year.Text), CInt(m_month.Text) + 1, 1) - DateSerial(CInt(m_year.Text), CInt(m_month.Text), 1)
temp_rq_e = Format(DateSerial(CInt(m_year.Text), CInt(m_month.Text), temp_day), "yyyy-mm-dd")
Else
temp_rq_s = Format(DateSerial(CInt(m_year.Text), CInt(m_month.Text), CInt(m_day.Text)), "yyyy-mm-dd")
temp_rq_e = Format(DateSerial(CInt(m_year.Text), CInt(m_month.Text), CInt(m_day.Text)), "yyyy-mm-dd")
End If
Set temp_yhqHJ = PUB_data.OpenRecordset("SELECT SUM(LYSL) AS SM_LYSL, SUM(FFSL) AS SM_FFSL, SUM(HSSL) AS SM_HSSL,SUM(LYSL-FFSL) AS SM_YS FROM CT_YHQ WHERE GWDM='" & Trim(SYS_GWDM) & "' AND FSRQ BETWEEN #" & temp_rq_s & "# AND #" & temp_rq_e & "#", 4, 0, 2)
If Not temp_yhqHJ.BOF Then
temp_yhqHJ.MoveLast
lb_lysl.Caption = IIf(IsNull(temp_yhqHJ.Fields("SM_LYSL")), 0, temp_yhqHJ.Fields("SM_LYSL"))
lb_ffsl.Caption = IIf(IsNull(temp_yhqHJ.Fields("SM_FFSL")), 0, temp_yhqHJ.Fields("SM_FFSL"))
lb_hssl.Caption = IIf(IsNull(temp_yhqHJ.Fields("SM_HSSL")), 0, temp_yhqHJ.Fields("SM_HSSL"))
lb_ys.Caption = lb_lysl.Caption - lb_ffsl.Caption
Else
lb_lysl.Caption = 0
lb_ffsl.Caption = 0
lb_hssl.Caption = 0
End If
temp_yhqHJ.Close
lb_gwmc.Caption = Trim(SYS_GWMC)
Set temp_yhq = PUB_data.OpenRecordset("SELECT FSRQ, GWDM, GWMC, SUM(LYSL) AS SM_LYSL, SUM(FFSL) AS SM_FFSL, SUM(HSSL) AS SM_HSSL,SUM(LYSL-FFSL) AS SM_YS FROM CT_YHQ WHERE GWDM='" & Trim(SYS_GWDM) & "' AND FSRQ BETWEEN #" & temp_rq_s & "# AND #" & temp_rq_e & "# GROUP BY GWDM,GWMC,FSRQ ORDER BY FSRQ", 4, 0, 2)
If Not temp_yhq.BOF Then
temp_yhq.MoveLast
End If
Call Flex_full(gd1, t_bt, temp_yhq, t_fields, t_fdcounts - 1, t_fdxs)
lb_jls.Caption = gd1.Rows - 1
temp_yhq.Close
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub CMD_EXIT_Click()
Unload Me
End Sub
Private Sub Form_Activate()
m_year.SetFocus
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
frm_msg.Caption = ""
frm_msg.Visible = False
If KeyCode = vbKeyEscape Then
Call CMD_EXIT_Click
End If
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub Form_Load()
ct_yhqcx.KeyPreview = True
frm_msg.Visible = True
frm_msg.Caption = ""
m_year.Text = year(Date)
m_month.Text = month(Date)
m_day.Text = day(Date)
'明细显示字段设置
t_fields = Array("FSRQ", "GWMC", "SM_LYSL", "SM_FFSL", "SM_HSSL", "SM_YS") '设置显示字段
t_fdxs = Array(0, 0, 0, 0, 0, 0) '设置显示字段
t_bt = "^日 期 |^部 门 |>领用数量 |>发放数量 |>回收数量 |>余 数 " '设置显示表头格式
t_fdcounts = 6
Call tPxs_YHQCX
End Sub
Private Sub gd1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
CMD_EXIT.SetFocus
End If
End Sub
Private Sub m_day_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
gd1.SetFocus
End If
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub m_year_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
m_month.SetFocus
End If
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub m_year_LostFocus()
Dim temp_ft As Boolean
frm_msg.Visible = False
frm_msg.Caption = ""
temp_ft = PUB_SZJY(m_year, frm_msg)
If temp_ft Then
If CInt(m_year.Text) >= year(LoadResString(SYS_START)) And CInt(m_year.Text) <= year(Date) Then
Else
frm_msg.Visible = True
frm_msg.Caption = "年份范围应在 " & year(LoadResString(SYS_START)) & " 至 " & year(Date) & " 之间"
m_year.Text = year(Date)
End If
End If
Call tPxs_YHQCX
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub m_month_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
m_day.SetFocus
End If
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub m_month_LostFocus()
Dim temp_ft As Boolean
frm_msg.Visible = False
frm_msg.Caption = ""
If Trim(m_month.Text) = "" Then
Else
temp_ft = PUB_SZJY(m_month, frm_msg)
If temp_ft Then
If m_year.Text <> year(Date) Then
If CInt(m_month.Text) >= 1 And CInt(m_month.Text) <= 12 Then
Else
frm_msg.Visible = True
frm_msg.Caption = "月份范围应在 1 至 12 之间"
m_month.Text = month(Date)
End If
Else
If CInt(m_month.Text) >= 1 And CInt(m_month.Text) <= month(Date) Then
Else
frm_msg.Visible = True
frm_msg.Caption = "月份范围应在 1 至 " & month(Date) & " 之间"
m_month.Text = month(Date)
End If
End If
End If
End If
Call tPxs_YHQCX
End Sub
'**************************************************************************************************
'* 功 能 :
'* 作 者 : 梁卫
'* 作成日期 : 1999.03.18
'* 修改日期 : 1999.03.18
'**************************************************************************************************
Private Sub m_day_LostFocus()
Dim temp_ft As Boolean
frm_msg.Visible = False
frm_msg.Caption = ""
If Trim(m_year.Text) = "" Then
frm_msg.Visible = True
frm_msg.Caption = "请先输入年份"
m_year.SetFocus
Else
If Trim(m_month.Text) = "" Then
frm_msg.Visible = True
frm_msg.Caption = "请先输入月份"
m_month.SetFocus
Else
If Trim(m_day.Text) = "" Then
Else
temp_ft = PUB_SZJY(m_day, frm_msg)
If temp_ft Then
If CInt(m_day.Text) > 0 Then
If m_year.Text <> year(Date) Then
If CInt(m_day.Text) >= 1 And CInt(m_day.Text) <= 12 Then
Else
frm_msg.Visible = True
frm_msg.Caption = "日期范围应在 1 至 12 之间"
m_day.Text = day(Date)
End If
Else
If CInt(m_day.Text) >= 1 And CInt(m_day.Text) <= month(Date) Then
Else
frm_msg.Visible = True
frm_msg.Caption = "日期范围应在 1 至 " & day(Date) & " 之间"
m_day.Text = day(Date)
End If
End If
Else
m_day.Text = 1
End If
End If
End If
Call tPxs_YHQCX
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -