📄 frm_计量器具台帐本月应检定.frm
字号:
_StyleDefs(22) = "Splits(0).InactiveStyle:id=16,.parent=5"
_StyleDefs(23) = "Splits(0).SelectedStyle:id=18,.parent=6"
_StyleDefs(24) = "Splits(0).EditorStyle:id=17,.parent=7"
_StyleDefs(25) = "Splits(0).HighlightRowStyle:id=19,.parent=8"
_StyleDefs(26) = "Splits(0).EvenRowStyle:id=20,.parent=9"
_StyleDefs(27) = "Splits(0).OddRowStyle:id=21,.parent=10"
_StyleDefs(28) = "Splits(0).RecordSelectorStyle:id=23,.parent=11"
_StyleDefs(29) = "Splits(0).FilterBarStyle:id=24,.parent=12"
_StyleDefs(30) = "Splits(0).Columns(0).Style:id=28,.parent=13"
_StyleDefs(31) = "Splits(0).Columns(0).HeadingStyle:id=25,.parent=14"
_StyleDefs(32) = "Splits(0).Columns(0).FooterStyle:id=26,.parent=15"
_StyleDefs(33) = "Splits(0).Columns(0).EditorStyle:id=27,.parent=17"
_StyleDefs(34) = "Splits(0).Columns(1).Style:id=32,.parent=13"
_StyleDefs(35) = "Splits(0).Columns(1).HeadingStyle:id=29,.parent=14"
_StyleDefs(36) = "Splits(0).Columns(1).FooterStyle:id=30,.parent=15"
_StyleDefs(37) = "Splits(0).Columns(1).EditorStyle:id=31,.parent=17"
_StyleDefs(38) = "Named:id=33:Normal"
_StyleDefs(39) = ":id=33,.parent=0"
_StyleDefs(40) = "Named:id=34:Heading"
_StyleDefs(41) = ":id=34,.parent=33,.valignment=2,.bgcolor=&H8000000F&,.fgcolor=&H80000012&"
_StyleDefs(42) = ":id=34,.wraptext=-1"
_StyleDefs(43) = "Named:id=35:Footing"
_StyleDefs(44) = ":id=35,.parent=33,.valignment=2,.bgcolor=&H8000000F&,.fgcolor=&H80000012&"
_StyleDefs(45) = "Named:id=36:Selected"
_StyleDefs(46) = ":id=36,.parent=33,.bgcolor=&H8000000D&,.fgcolor=&H8000000E&"
_StyleDefs(47) = "Named:id=37:Caption"
_StyleDefs(48) = ":id=37,.parent=34,.alignment=2"
_StyleDefs(49) = "Named:id=38:HighlightRow"
_StyleDefs(50) = ":id=38,.parent=33,.bgcolor=&H8000000D&,.fgcolor=&H8000000E&"
_StyleDefs(51) = "Named:id=39:EvenRow"
_StyleDefs(52) = ":id=39,.parent=33,.bgcolor=&HFFFF00&"
_StyleDefs(53) = "Named:id=40:OddRow"
_StyleDefs(54) = ":id=40,.parent=33"
_StyleDefs(55) = "Named:id=41:RecordSelector"
_StyleDefs(56) = ":id=41,.parent=34"
_StyleDefs(57) = "Named:id=42:FilterBar"
_StyleDefs(58) = ":id=42,.parent=33"
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H80000005&
Caption = "月"
ForeColor = &H00FF0000&
Height = 180
Left = 6750
TabIndex = 11
Top = 1095
Width = 180
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H80000005&
Caption = "年"
ForeColor = &H00FF0000&
Height = 180
Left = 6150
TabIndex = 10
Top = 1095
Width = 180
End
Begin VB.Label Ljl
AutoSize = -1 'True
BackColor = &H80000005&
Caption = "共查询到110条记录"
ForeColor = &H00008000&
Height = 180
Left = 7080
TabIndex = 2
Top = 1170
Width = 1530
End
Begin VB.Label Label22
AutoSize = -1 'True
BackColor = &H80000005&
Caption = "本 月 应 检 定 计 量 器 具 台 帐"
BeginProperty Font
Name = "华文行楷"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 450
Left = 2010
TabIndex = 1
Top = 240
Width = 5835
End
Begin VB.Line Line8
BorderColor = &H00000000&
X1 = -30
X2 = 8670
Y1 = 1380
Y2 = 1380
End
Begin VB.Line Line2
BorderColor = &H00E0E0E0&
X1 = -30
X2 = 5400
Y1 = 900
Y2 = 900
End
End
End
Attribute VB_Name = "Frm_计量器具台帐本月应检定"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim rsPri As New ADODB.Recordset
Dim rsls As New ADODB.Recordset
Dim Cx_Sql_Str As String
Public Cxmc As String
Private Function GetDwmc() As String
Dim rst As New ADODB.Recordset
If rst.State = 1 Then rst.Close
rst.CursorLocation = adUseClient
rst.Open "select * from dwxx", Conn
If rst.EOF = False Then
GetDwmc = Trim(rst!Dwmc)
Else
GetDwmc = ""
End If
End Function
Private Sub CmdBc_MouseHold()
If Frame1.Visible = True Then Exit Sub
End Sub
Private Sub CmdDc_Click()
On Error GoTo err1
If rs.State <> 1 Then Exit Sub
If rs.RecordCount < 1 Then Exit Sub
If Frame1.Visible = True Then Frame1.Visible = False
Dim sjkname As String
CommonDialog1.DialogTitle = "保存报表文件"
CommonDialog1.Filter = "*.xls"
CommonDialog1.ShowSave
sjkname = CommonDialog1.FileName
If Trim(sjkname) = "" Then Exit Sub
Frame2.Visible = True
RePorts.EtCell1.OpenDoc App.Path & "\report\tz.eT"
RePorts.EtCell1.SetAliasCell "dwmc", "单位名称:" + GetDwmc()
RePorts.EtCell1.SetAliasCell "zdrq", "检定月份: " & Text1 & "年" & Text2 & "月 制单日期:" + CStr(Date)
RePorts.EtCell1.SetAliasCell "bt", "本 月 应 检 定 计 量 器 具 台 帐"
rs.MoveFirst
For i = 0 To rs.Fields.Count - 5
If (i > 1) And (i < (rs.Fields.Count - 5)) Then RePorts.EtCell1.InsertCol 8
Next i
For i = 0 To rs.Fields.Count - 1
RePorts.EtCell1.SetCell 4, i + 2, rs.Fields(i).Name
Next i
i = 5
For j = 1 To rs.RecordCount - 1
RePorts.EtCell1.InsertRow i
Next j
rs.MoveFirst
Do While rs.EOF = False
For j = 0 To rs.Fields.Count - 1
RePorts.EtCell1.SetCell i, j + 2, rs.Fields(j)
Next j
i = i + 1
rs.MoveNext
Loop
rs.MoveFirst
If RePorts.EtCell1.SaveAs(sjkname & ".xls") Then
MsgBox "保存成功!", vbInformation, "报表保存"
Else
MsgBox "报表保存失败!", vbInformation, "报表保存"
End If
Unload RePorts
Frame2.Visible = False
Exit Sub
err1:
Unload RePorts
Frame2.Visible = False
MsgBox ERR.Description
Exit Sub
End Sub
Private Sub CmdLl_Click()
On Error GoTo ERR
Dim D1 As String
Dim D2 As String
Frame3.Visible = True
D1 = Format(Text1.Text, "0000") & "-" & Format(Text2.Text, "00") & "-" & "01"
If Format(Text2.Text, "00") = "12" Then
D2 = Format(CStr(CInt(Text1.Text) + 1), "0000") & "-01-01"
Else
D2 = Format(Text1.Text, "0000") & "-" & Format(CStr(CInt(Text2.Text) + 1), "00") & "-" & "01"
End If
If Frame1.Visible = True Then Frame1.Visible = False
Cx_Sql_Str = " select bh as 设备编号 , mc as 设备名称 , lb as 类别 , zb as 种别 , dj as 管理等级, zt as 设备状态, ggxh as 规格型号, clfw as 测量范围, fdz as 分度值, sccj as 生产厂家, ccbh as 出厂编号, sybm as 使用部门, syz as 使用者, qyrq as 启用日期 ,cstr([jdzq])+[Zqdw] AS 检定周期 ,jddw as 检定单位 from jlqjxx where bfrq>=#" & CStr(D1) & "# "
If rs.State = 1 Then rs.Close
rs.CursorLocation = adUseClient
rs.Open Cx_Sql_Str, Conn, adOpenDynamic, adLockBatchOptimistic
If rs.EOF = False Then
'rs.Fields.Append "应检定日期", adBoolean
rs.MoveFirst
Do While rs.EOF = False
If GetXcJdrq(rs!设备编号) > D2 Then rs.Delete
rs.MoveNext
Loop
End If
Set Grid.DataSource = Nothing
Ljl.Caption = "共查询到 " & rs.RecordCount & " 条记录"
Set Grid.DataSource = rs
Frame3.Visible = False
Exit Sub
ERR:
MsgBox ERR.Description, vbCritical, "提示"
Frame3.Visible = False
End Sub
Private Sub CmdPri_Click()
If Frame1.Visible = False Then Frame1.Visible = True
If rsls.State = 1 Then rsls.Close
Set GridPri.DataSource = Nothing
rsls.CursorLocation = adUseClient
rsls.Open "select * from pri where bm='基本信息'", Conn, adOpenDynamic, adLockBatchOptimistic
Set GridPri.DataSource = rsls
Frame1.Visible = True
End Sub
Private Sub Command1_Click()
'精简后的打印方式
On Error GoTo ERR
Frame1.Visible = False
If rsls.State <> 1 Then Exit Sub
rsls.Filter = "xd=1"
If rsls.RecordCount < 1 Then
rsls.Filter = ""
Exit Sub
End If
rsls.Filter = ""
If rs.State <> 1 Then Exit Sub
If rs.RecordCount < 1 Then Exit Sub
Dim jfhj As Double
Dim dfhj As Double
Dim f As Integer
jfhj = 0
dfhj = 0
RePorts.EtCell1.OpenDoc App.Path & "\report\tz.eT"
RePorts.EtCell1.SetAliasCell "dwmc", "单位名称:" + GetDwmc()
RePorts.EtCell1.SetAliasCell "zdrq", "检定月份: " & Text1 & "年" & Text2 & "月 制单日期:" + CStr(Date)
RePorts.EtCell1.SetAliasCell "bt", "本 月 应 检 定 计 量 器 具 台 帐"
rs.MoveFirst
For i = 0 To rs.Fields.Count - 5
If (i > 1) And (i < (rs.Fields.Count - 5)) Then RePorts.EtCell1.InsertCol 8
Next i
For i = 0 To rs.Fields.Count - 1
RePorts.EtCell1.SetCell 4, i + 2, rs.Fields(i).Name
rsls.Filter = "zdm='" & Trim(rs.Fields(i).Name) & "'"
If rsls.EOF = False Then
If rsls!xd = False Then RePorts.EtCell1.SetColWidth i + 2, 0
rsls.Filter = ""
Else
rsls.Filter = ""
End If
Next i
i = 5
For j = 1 To rs.RecordCount - 1
RePorts.EtCell1.InsertRow i
Next j
rs.MoveFirst
Do While rs.EOF = False
For j = 0 To rs.Fields.Count - 1
RePorts.EtCell1.SetCell i, j + 2, rs.Fields(j)
Next j
i = i + 1
rs.MoveNext
Loop
RePorts.Show
Exit Sub
ERR:
MsgBox ERR.Description
End Sub
Private Sub Command2_Click()
Frame1.Visible = False
End Sub
Private Sub Command3_Click()
gridA.AddItem ""
gridA.TextMatrix(gridA.Rows - 1, 1) = Trim(rscx!zdhy)
End Sub
Private Sub Command4_Click()
If gridA.Row > 0 Then gridA.RemoveItem gridA.Row
End Sub
Private Sub DTPqyrq_Change()
DTPjdrq.Value = DTPqyrq.Value
End Sub
Private Sub Form_Load()
Me.Top = 100
Me.Left = 50
Text1.Text = Format(CStr(Year(Date)), "0000")
cmdll.Caption = "查 询"
Ljl.Caption = ""
End Sub
Private Sub Grid_HeadClick(ByVal ColIndex As Integer)
'精简后的排序方式
Dim str As String
str = Grid.Columns.Item(ColIndex).Caption
If str = "" Then Exit Sub
rs.Sort = str
Set Grid.DataSource = rs
End Sub
Sub grid_ini()
gridA.ColComboList(2) = ">|>=|<|<=|=|<>|like|is"
gridA.ColComboList(4) = "AND|OR"
gridA.Rows = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -