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

📄

📁 VB开发的ERP系统
💻
📖 第 1 页 / 共 5 页
字号:
            '新增单据
            Call Sub_AddBill
        Case "2"   '查询单据(单据列表)
            '填充查询单据标识
            Lab_BillId.Caption = XT_BillID
            Str_QueryCondi = Xtcdcsfz
            Call Sub_ShowBill
            Call Sub_OperStatus("10")
      
            '调入用户查询结果动态集
            Sqlstr = "SELECT DISTINCT ContractMainId From Xs_V_Contract a " & Str_QueryCondi & " ORDER BY ContractMainId"
            Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
            Rec_Query.Find "ContractMainId=" & Val(Lab_BillId.Caption)
        Case "3"   '明细帐联查单据
            '设置工具条显示
            With Tlb_Action
                .Buttons("xz").Enabled = False             '新增
                .Buttons("xg").Enabled = False             '修改
                .Buttons("sc").Enabled = False             '删除
                .Buttons("fgh0").Enabled = False           '分隔行
                .Buttons("zh").Enabled = False             '增行
                .Buttons("sh").Enabled = False             '删行
                .Buttons("fgh1").Enabled = False           '分隔行
                .Buttons("bc").Enabled = False             '保存
                .Buttons("fq").Enabled = False             '放弃
                .Buttons("shsh").Enabled = False           '审核
                .Buttons("shqs").Enabled = False           '弃审
                .Buttons("fgh2").Enabled = False           '分隔行
                .Buttons("first").Enabled = False          '首张
                .Buttons("prev").Enabled = False           '上张
                .Buttons("next").Enabled = False           '下张
                .Buttons("last").Enabled = False           '末张
                .Buttons("fgh5").Enabled = False           '分割行
            End With
      
            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 * from Xs_V_Contract Where ContractMainId='" & Val(Lab_BillId.Caption) & "' Order By ContractSubId"
    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("ContractCode"))                                          '合同号
            
            If IsDate(.Fields("ContractDate")) Then
                LrText(1).Text = Format(.Fields("ContractDate"), "yyyy-mm-dd")                            '制单日期
            End If
            LrText(2).Tag = Trim(.Fields("QuotationMainID") & "")       '报价单ID号]
            LrText(2).Text = Trim(.Fields("QuotationCode") & "")        '报价单号]
            LrText(3).Tag = Trim(.Fields("CusCode") & "")               '客户编码
            LrText(3).Text = Trim(.Fields("CusName") & "")              '客户名称]
            LrText(4).Text = Trim(.Fields("SellTypename") & "")         '("销售类型")
            LrText(4).Tag = Trim(.Fields("selltypeCode") & "")          '("销售类型代码")
            LrText(5).Text = Trim(.Fields("deptName") & "")             '("部门名称")
            LrText(5).Tag = Trim(.Fields("deptCode") & "")              '("部门代码")
            LrText(6).Text = Trim(.Fields("Personname") & "")           '("销售员")
            LrText(6).Tag = Trim(.Fields("personcode") & "")            '("销售员代码")
            LrText(7).Text = Trim(.Fields("foreigncurrname") & "")      '("币别") & ""
            LrText(7).Tag = Trim(.Fields("foreigncurrcode") & "")       '("币别代码")
            LrText(8).Text = Trim(.Fields("exchrate") & "")             '("汇率") & ""
            LrText(8).Tag = Trim(.Fields("ConVertFlag") & "")
            LrText(9).Text = Trim(.Fields("ContractTypeName") & "")     '("合同类别") & ""
            LrText(9).Tag = Trim(.Fields("ContractTypeCode") & "")
            LrText(10).Text = Trim(.Fields("BuyerSigner") & "")         '("客户签约人")
            LrText(11).Text = Trim(.Fields("SellerSigner") & "")        '("公司签约人") & ""
            LrText(12).Text = Trim(.Fields("SignAddress") & "")         '("签约地址")
            LrText(13).Text = Trim(.Fields("consignaddress") & "")      '("发货地址")
            LrText(14).Text = Trim(.Fields("Payname") & "")             '("付款方式")
            LrText(14).Tag = Trim(.Fields("PayCode") & "")              '("付款方式代码")
            LrText(15).Text = Trim(.Fields("TransferWayName") & "")     '("发运方式")
            LrText(15).Tag = Trim(.Fields("TransferWayCode") & "")      '("发运方式代码")
            LrText(16).Text = Trim(.Fields("ernest") & "")              '("定金") & ""
            If IsDate(.Fields("FinishDate")) Then
                LrText(17).Text = Format(.Fields("FinishDate"), "yyyy-mm-dd")                            '制单日期
            End If
            LrText(18).Text = Trim(.Fields("Remark") & "")              '("备注")
            LrText(19).Text = Trim(.Fields("Maker") & "")               '("制单人") & ""
            LrText(20).Text = Trim(.Fields("Checker") & "")             '("审核人")
            LrText(21).Text = Trim(.Fields("Closer") & "")              '("关闭人")
            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("WareCode") & "")                  '存货编码
            WglrGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("MName") & "")                     '存货名称
            WglrGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Model") & "")                     '存货规格
            WglrGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("SaleUnitName") & "")              '存货单位
            WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("Quantity") & "")                  '存货数量
            WglrGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("TaxUnitPrice") & "")              '存货含税单价
            WglrGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("TaxMoney") & "")                  '存货税额
            WglrGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("TaxRate") & "")                   '存货税率
            WglrGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("WholeMoney") & "")                '存货总金额
            WglrGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = Trim(.Fields("UnitPrice") & "")                 '存货无税单价
            WglrGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = Trim(.Fields("ContractMoney") & "")             '存货无税金额
            If Year(Trim(.Fields("PrePareDate") & "")) = "1900" Then
                WglrGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = ""
            Else
                WglrGrid.TextMatrix(Jsqte, Sydz("012", GridStr(), Szzls)) = Format(.Fields("PrePareDate"), "yyyy-mm-dd")                '预发货日期
            End If
            WglrGrid.TextMatrix(Jsqte, Sydz("013", GridStr(), Szzls)) = Trim(.Fields("Remarksub") & "")                    '存货备注
            '<<]
                   
            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
    '设置打开关闭按钮状态
    Call Sub_OpenStatus
       
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 "dk"                                             '打 开
            Call Sub_OpenBill
        Case "gb"                                             '关 闭
            Call Sub_CloseBill
        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_OpenStatus
                '设置文本框录入状态
                Call Sub_LrtextStatus(False)
            Case "20"   '新增单据((录入)新增一张单据 、(列表)新增一张单据)
                '工具条
                .Buttons("dy").Enabled = False      '打印
                .Buttons("yl").Enabled = False      '预览
                .Buttons("xz").Enabled = False      '新增
                .Buttons("xg").Enabled = False      '修改

⌨️ 快捷键说明

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