⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 设备检修_月度检修计划编辑.frm

📁 新世纪ERP设备管理源代码
💻 FRM
📖 第 1 页 / 共 5 页
字号:
        Call Sub_ShowBill
        
        '设置操作状态为浏览
        Lab_OperStatus.Caption = "1"
        
        '录入文本框
        For jsqte = Max_Text_Index To 0 Step -1
            LrText(jsqte).Enabled = False
        Next jsqte
    End Select
    
    '<<]
    
End Sub

Private Sub Sub_ShowBill()                                          '根据当前单据ID显示整张单据内容
    
    '过程默认参数为当前窗体中单据ID:Lab_BillID
    Dim Sqlstr As String                           '临时使用字符串
    Dim RecTemp As New ADODB.Recordset             '临时使用动态集
    Dim jsqte As Long                              '临时计数器
    
    '禁止网格刷新动作,为加快网格显示速度(Fixed)
    WglrGrid.Redraw = False
    
    '本张单据查询字符串
    Sqlstr = "SELECT Dev_V_RepairPlan.* from Dev_V_RepairPlan " & _
    " Where RepairMainID='" & Val(Lab_BillId.Caption) & "' Order By Dev_V_RepairPlan.RepairSubID"
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
    
    With RecTemp
        WglrGrid.Rows = WglrGrid.FixedRows
        If .EOF Then
            WglrGrid.Redraw = True
            Exit Sub
        Else
            '[>>显示单据头
            TextChangeLock = True     '文本框加锁
            LrText(0).Text = Trim(.Fields("RepairMainCode"))                '计划单号
            LrText(1).Tag = Trim(.Fields("WorkShop") & "")                  '计划部门
            LrText(1).Text = Trim(.Fields("DeptName") & "")
            LrText(2).Text = Format(.Fields("PlanDate"), "yyyy-mm-dd")      '计划日期
            LrText(3).Text = Trim(.Fields("Maker") & "")                    '制表人
            LrText(4).Text = Trim(.Fields("Checker") & "")                  '审核人
            LrText(5).Text = Trim(.Fields("Authorizer") & "")               '批准人
            Combo1.Text = Trim(.Fields("RepairType"))                       '计划类型
            LrText(6).Text = Trim(.Fields("RepairType"))
            TextChangeLock = False    '文本框解锁
            '<<]
        End If
        jsqte = WglrGrid.FixedRows
        Do While Not .EOF
            WglrGrid.AddItem ""
            '[>>显示单据分录
            WglrGrid.TextMatrix(jsqte, 0) = "*"                                                                                     '数据有效行标识(必填)
            WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("DEVID") & "")                                 '设备编号
            WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("DName") & "")                                 '设备名称
            WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Model") & "")                                 '规格型号
            WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("RprPosition") & "")                           '维修部位
            If .Fields("CheckFile") = True Then
                WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = True                                                    '是否做方案
            Else
                WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = False
            End If
            WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Format(.Fields("PlanBeginDate"), "yyyy-mm-dd")              '计划开始日期
            WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Format(.Fields("PlanEndDate"), "yyyy-mm-dd")                '计划截至日期
            If .Fields("RealBeginDate") <> "" Then
                WglrGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Format(.Fields("RealBeginDate"), "yyyy-mm-dd")          '实际开始日期
            End If
            If .Fields("RealEndDate") <> "" Then
                WglrGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = Format(.Fields("RealEndDate"), "yyyy-mm-dd")            '实际结束日期
            End If
            WglrGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = Val(.Fields("PlanMoney"))                                   '计划资金
            If Not IsNull(.Fields("RealMoney")) Then
                WglrGrid.TextMatrix(jsqte, Sydz("011", GridStr(), Szzls)) = Val(.Fields("RealMoney"))                               '实用资金
            End If
            WglrGrid.TextMatrix(jsqte, Sydz("012", GridStr(), Szzls)) = Trim(.Fields("StateName") & "")                             '维修后状态
            WglrGrid.TextMatrix(jsqte, Sydz("013", GridStr(), Szzls)) = Trim(.Fields("Remark") & "")                                '备注
            '<<]
            
            WglrGrid.RowHeight(jsqte) = Sjhgd
            .MoveNext
            jsqte = jsqte + 1
        Loop
    End With
    
    
    '调整网格(Fixed)
    Call Sub_AdjustGrid
    
    '计算合计数据(Fixed)
    For jsqte = Qslz To WglrGrid.Cols - 1
        Call Sjhj(jsqte)
    Next jsqte
    
    '将网格刷新解禁(Fixed)
    WglrGrid.Redraw = True
    
    '设置审核弃审按钮状态
    Call Sub_CheckStatus
    Combo1.Enabled = False
End Sub
Private Sub Sub_AddShowBill()                                          '根据当前单据ID显示整张单据内容
    
    '过程默认参数为当前窗体中单据ID:Lab_BillID
    Dim Sqlstr As String                           '临时使用字符串
    Dim RecTemp As New ADODB.Recordset             '临时使用动态集
    Dim jsqte As Long                              '临时计数器
    
    '禁止网格刷新动作,为加快网格显示速度(Fixed)
    WglrGrid.Redraw = False
    Set RecTemp = Cw_DataEnvi.DataConnect.Execute("select * from dev_main where deptcode='" & Trim(LrText(1).Tag) & "' And ltrim(rtrim(convert(char(4),year(repairDate))))+ltrim(rtrim(convert(char(2),month(repairdate)))) ='" & Trim(Str(Year(Xtrq + 60))) + Trim(Str(Month(Xtrq + 60))) & "'")
 
    With RecTemp
        WglrGrid.Clear 1
        If .EOF Then
            WglrGrid.Redraw = True
            Exit Sub
        Else
        End If
        jsqte = WglrGrid.FixedRows
        Do While Not .EOF
            WglrGrid.AddItem ""
            WglrGrid.TextMatrix(jsqte, 0) = "*"                                                                             '数据有效行标识(必填)
            WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("DEVID") & "")                  '存货编码
            WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("DName") & "")                  '存货名称
            WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Model") & "")                 '存货规格
            WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Format(.Fields("RepairDate"), "yyyy-mm-dd")                 '存货规格
            WglrGrid.RowHeight(jsqte) = Sjhgd
            .MoveNext
            jsqte = jsqte + 1
        Loop
    End With
    
    
    '调整网格(Fixed)
    Call Sub_AdjustGrid
    
    '计算合计数据(Fixed)
'    For jsqte = Qslz To WglrGrid.Cols - 1
'        Call Sjhj(jsqte)
'    Next jsqte
    
    '将网格刷新解禁(Fixed)
    WglrGrid.Redraw = True
    
    '设置审核弃审按钮状态
    Call Sub_CheckStatus
    
End Sub

Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
    
    '屏蔽文本框,下拉组合框有效性判断
    Valilock = True
    
    '屏蔽网格失去焦点产生的有效性判断
    Changelock = True
    
    Select Case Button.Key
    Case "yl"                                            '预 览
        If Fun_Drfrmyxxpd Then
            BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, False
        End If
    Case "dy"                                            '打 印
        If Fun_Drfrmyxxpd Then
            Dim Yhanswer As Integer      '打印提示
            
            '用户确认是否打印单据
            Tsxx = "请确认是否打印当前单据?"
            Yhanswer = Xtxxts(Tsxx, 2, 2)
            If Yhanswer = 2 Then
                Exit Sub
            End If
            BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, True
        End If
    Case "xz"                                            '新 增
        Call Sub_AddBill
    Case "xg"                                            '修 改
        Call Sub_EditBill
    Case "sc"                                            '删 除
        Call Sub_DeleteBill
    Case "zh"                                            '增 行
        Call zjlrfl
    Case "sh"                                            '删 行
        Call Scdqfl
    Case "bc"                                            '保 存
        If Fun_Drfrmyxxpd Then
            Call Sub_SaveBill
        End If
    Case "fq"                                            '放 弃
        Call Sub_AbandonBill
    Case "shsh"                                          '审 核
        Call Sub_CheckBill
    Case "shqs"                                          '弃 审
        Call Sub_AbandonCheck
    Case "PZ"                                            '批准
        Call Sub_PZBill
    Case "first"                                         '首 张
        Call Sub_First
    Case "prev"                                          '上 张
        Call Sub_Prev
    Case "next"                                          '下 张
        Call Sub_Next
    Case "last"                                          '末 张
        Call Sub_Last
    Case "bz"                                            '帮 助
        Call F1bz
    Case "fh"                                            '退 出
        Unload Me
    End Select
    
    '解 锁
    Valilock = False
    Changelock = False
    TextChangeLock = False
    
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     '支持热键操作
    
    Select Case KeyCode
        Case vbKeyF5          '增加单据
            If Tlb_Action.Buttons("xz").Enabled And Tlb_Action.Buttons("xz").Visible Then
                Call Sub_AddBill
            End If
        Case vbKeyF3          '修改单据
            If Tlb_Action.Buttons("xg").Enabled And Tlb_Action.Buttons("xg").Visible Then
                Call Sub_EditBill
            End If
        Case vbKeyF6          '保存单据
            If Tlb_Action.Buttons("bc").Enabled And Tlb_Action.Buttons("bc").Visible Then
                If Fun_Drfrmyxxpd Then Call Sub_SaveBill
            End If
    End Select
    
End Sub

Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
    
    With Tlb_Action
        Select Case Str_Status
        Case "10"   '浏览((列表)调入单据处理时的进入状态、(列表)新增状态时放弃录入)
            '工具条
            .Buttons("dy").Enabled = True       '打印
            .Buttons("yl").Enabled = True       '预览
            .Buttons("xz").Enabled = True       '新增
            .Buttons("xg").Enabled = True       '修改
            .Buttons("sc").Enabled = True       '删除
            .Buttons("zh").Enabled = False      '增行
            .Buttons("sh").Enabled = False      '删行
            .Buttons("bc").Enabled = False      '保存
            .Buttons("fq").Enabled = False      '放弃
            .Buttons("first").Enabled = True    '首张
            .Buttons("prev").Enabled = True     '上张
            .Buttons("next").Enabled = True     '下张
            .Buttons("last").Enabled = True     '末张
            .Buttons("bz").Enabled = True       '帮助
            .Buttons("fh").Enabled = True       '退出
            
            '设置审核弃审按钮状态
            Call Sub_CheckStatus
            
            '设置文本框录入状态
            Call Sub_LrtextStatus(False)
        Case "20"   '新增单据((录入)新增一张单据 、(列表)新增一张单据)
            '工具条
            .Buttons("dy").Enabled = False      '打印
            .Buttons("yl").Enabled = False      '预览
            .Buttons("xz").Enabled = False      '新增
            .Buttons("xg").Enabled = False      '修改
            .Buttons("sc").Enabled = False      '删除
            .Buttons("zh").Enabled = True       '增行
            .Buttons("sh").Enabled = True       '删行
            .Buttons("bc").Enabled = True       '保存
            .Buttons("fq").Enabled = True       '放弃
            .Buttons("shsh").Enabled = False    '审核
            .Buttons("shqs").Enabled = False    '弃审
            .Buttons("PZ").Enabled = False      '批准
            .Buttons("first").Enabled = False   '首张
            .Buttons("prev").Enabled = False    '上张
            .Buttons("next").Enabled = False    '下张
            .Buttons("last").Enabled = False    '末张
            .Buttons("bz").Enabled = True       '帮助
            .Buttons("fh").Enabled = True       '退出
            
            '设置文本框录入状态
            Call Sub_LrtextStatus(True)
        Case "30"   '修改((录入)调入修改功能、(列表)调入修改功能)
            '工具条
            .Buttons("dy").Enabled = False      '打印
            .Buttons("yl").Enabled = False      '预览
            .Buttons("xz").Enabled = False      '新增
            .Buttons("xg").Enabled = False      '修改
            .Buttons("sc").Enabled = False      '删除
            .Buttons("zh").Enabled = True       '增行

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -