资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:65k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Begin VB.Form FK_FrmFkdcl
- BackColor = &H00E9F4FA&
- BorderStyle = 1 'Fixed Single
- Caption = "单据处理"
- ClientHeight = 6120
- ClientLeft = 675
- ClientTop = 720
- ClientWidth = 10185
- HelpContextID = 30401
- Icon = "付款处理_付款单处理.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6120
- ScaleWidth = 10185
- StartUpPosition = 1 '所有者中心
- Begin VB.ComboBox Combo_Fkdlx
- ForeColor = &H00000000&
- Height = 300
- Left = 6420
- Style = 2 'Dropdown List
- TabIndex = 10
- Top = 1020
- Width = 1485
- End
- Begin VB.CommandButton Ydcommand1
- Height = 300
- Index = 0
- Left = 7740
- Picture = "付款处理_付款单处理.frx":1042
- Style = 1 'Graphical
- TabIndex = 9
- Top = 1530
- Visible = 0 'False
- Width = 300
- End
- Begin MSComctlLib.Toolbar Tlb_Action
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 10185
- _ExtentX = 17965
- _ExtentY = 979
- ButtonWidth = 820
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Wrappable = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 22
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "打印"
- Key = "dy"
- Object.ToolTipText = "打印当前单据或Ctrl+P"
- ImageKey = "dy"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "预览"
- Key = "yl"
- ImageKey = "yl"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh0"
- Style = 3
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "新增"
- Key = "xz"
- Object.ToolTipText = "新增加一张单据或F5"
- ImageKey = "xz"
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "修改"
- Key = "xg"
- Object.ToolTipText = "修改当前单据或F3"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删除"
- Key = "sc"
- Object.ToolTipText = "删除当前单据"
- ImageKey = "sc"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh2"
- Style = 3
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存"
- Key = "bc"
- Object.ToolTipText = "保存单据或F6"
- ImageKey = "bc"
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "放弃"
- Key = "fq"
- Object.ToolTipText = "放弃此次操作"
- ImageKey = "fq"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh3"
- Style = 3
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "审核"
- Key = "shsh"
- ImageKey = "check"
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "核销"
- Key = "hx"
- ImageKey = "hx"
- EndProperty
- BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.Visible = 0 'False
- Caption = "弃审"
- Key = "shqs"
- ImageKey = "qs"
- EndProperty
- BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh4"
- Style = 3
- EndProperty
- BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "首张"
- Key = "first"
- ImageKey = "first"
- EndProperty
- BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "上张"
- Key = "prev"
- ImageKey = "prev"
- EndProperty
- BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "下张"
- Key = "next"
- ImageKey = "next"
- EndProperty
- BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "末张"
- Key = "last"
- ImageKey = "last"
- EndProperty
- BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh5"
- Style = 3
- EndProperty
- BeginProperty Button21 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button22 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- End
- Begin VB.Timer Timer1
- Interval = 1
- Left = 9690
- Top = 150
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 6570
- Top = 1440
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 38
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":13CC
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":1766
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":1B00
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":1E9A
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":2234
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":25CE
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":2968
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":2D02
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":309C
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":3436
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":37D0
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":3B6A
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":3F04
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":429E
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":4638
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":49D2
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":4D6C
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":5106
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":54A0
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":583A
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":5BD4
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":5F6E
- Key = "sc"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":6308
- Key = "sx"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":66A2
- Key = "cx"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":6A3C
- Key = "zd"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":6DD6
- Key = "dz"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":7170
- Key = "ph"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":750A
- Key = "fz"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":78A4
- Key = "dw"
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":7C3E
- Key = "hf"
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":7FD8
- Key = "pz"
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":8372
- Key = "check"
- EndProperty
- BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":870C
- Key = "qs"
- EndProperty
- BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":8AA6
- Key = "fullcheck"
- EndProperty
- BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":8E40
- Key = "qq"
- EndProperty
- BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":91DA
- Key = "bcw"
- EndProperty
- BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":9574
- Key = "ye"
- EndProperty
- BeginProperty ListImage38 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "付款处理_付款单处理.frx":990E
- Key = "hx"
- EndProperty
- EndProperty
- End
- Begin VB.TextBox LrText
- ForeColor = &H00000000&
- Height = 300
- Index = 0
- Left = 990
- TabIndex = 0
- Text = "0"
- Top = 1470
- Width = 1650
- End
- Begin VB.Label Label2
- BackStyle = 0 'Transparent
- Caption = "类型:"
- Height = 165
- Left = 5910
- TabIndex = 11
- Top = 1080
- Width = 465
- End
- Begin VB.Label Lab_Title
- AutoSize = -1 'True
- BackColor = &H80000018&
- BackStyle = 0 'Transparent
- Caption = "单据标题自动调整"
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 300
- Left = 2730
- TabIndex = 8
- Top = 750
- Width = 2520
- End
- Begin VB.Label Lab_BillId
- AutoSize = -1 'True
- BackColor = &H0080C0FF&
- Height = 270
- Left = 6570
- TabIndex = 7
- Top = 2190
- Visible = 0 'False
- Width = 1230
- End
- Begin VB.Label Lab_Djclzt
- BackColor = &H0000FFFF&
- Caption = "1"
- ForeColor = &H00808080&
- Height = 255
- Left = 7260
- TabIndex = 6
- Top = 1590
- Visible = 0 'False
- Width = 285
- End
- Begin VB.Label Lab_OperStatus
- BackColor = &H000080FF&
- Caption = "1"
- Height = 345
- Left = 7875
- TabIndex = 5
- Top = 2130
- Visible = 0 'False
- Width = 345
- End
- Begin VB.Label Lab_Bill
- Appearance = 0 'Flat
- BackColor = &H80000005&
- BackStyle = 0 'Transparent
- ForeColor = &H00000000&
- Height = 225
- Left = 9030
- TabIndex = 4
- Top = 6330
- Width = 735
- End
- Begin VB.Label Lab_Checker
- Appearance = 0 'Flat
- BackColor = &H80000005&
- BackStyle = 0 'Transparent
- ForeColor = &H00000000&
- Height = 225
- Left = 7170
- TabIndex = 3
- Top = 6360
- Width = 735
- End
- Begin VB.Label TsLabel
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "单据号:"
- Height = 180
- Index = 0
- Left = 210
- TabIndex = 2
- Top = 1530
- Width = 765
- End
- End
- Attribute VB_Name = "FK_FrmFkdcl"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '***********************************************************************************************************
- '* 模 块 名 称 :结算单处理
- '* 功 能 描 述 :此功能模块主要完成单据录入、修改、删除、预览打印等。
- '* 程序员姓名 :张建忠
- '* 最后修改人 :张建忠
- '* 最后修改时间:2001/12/27
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '*
- '* 1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
- '* TextValiLock=True TextValiLock=false
- '*
- '* 2.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) "1"-浏览 "2"-新增 "3"-修改
- '*
- '* 3.Lab_Djclzt 用此标签来标识单据处理状态(默认值为1) "1"-填制单据 "2"-查询单据列表 "3"-明细帐联查单据
- '*
- '* 4.原则:只要单据能够存盘(无论修改或新增)则其必须接受完整性及有效性规则检查
- '*
- '* 5.支持热键操作:打印:Ctrl+P 新增:F5 修改:F3 存盘:F6
- '***********************************************************************************************************
- '[以下为根据实际情况设置变量
- Dim Bln_BillChange As Boolean '标识单据是否发生改动
- Dim Rec_Query As New ADODB.Recordset '单据组查询结果动态集(保存当前单据组ID)
- Public Str_QueryCondi As String '单据组查询条件(接收单据列表传递查询条件)
- ']
- '以下为固定使用变量(单据)
- Dim BillCode As String '单据设计编码(索引号)
- Dim Var_Bill() As Variant '用来返回单据设计信息
- Dim ReportTitle As String '报表主标题
- Dim Tsxx As String '系统提示信息
- Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
- '以下为固定使用变量(文本框)
- Dim Textvar() As Variant '存储变体型文本框信息
- Dim Textboolean() As Boolean '存储布尔型文本框信息
- Dim Textint() As Integer '存储整型文本框信息
- Dim Textstr() As String '存储字符型文本框信息
- Dim Max_Text_Index As Integer '最大录入文本框索引值
- Dim TextGroupCode As String '文本框录入分组编码
- Dim TextValiLock As Boolean '文本框失去焦点是否进行有效性控制判断
- Dim TextValiJudgeLock() As Boolean '文本框录入有效性判断控制锁
- Dim TextChangeLock As Boolean '文本框内容变换控制锁
- Private Sub Form_KeyPress(KeyAscii As Integer) '控 制 焦 点 转 移
- Dim jdzygs As Integer
- jdzygs = 50
- Select Case KeyAscii
- Case vbKeyReturn
- If Kjjdzy(jdzygs) Then
- KeyAscii = 0
- End If
- Case 39 '屏蔽字符"'"
- KeyAscii = 0
- End Select
- End Sub
- Private Sub Form_Load() '窗 体 装 入
- '初始化各种锁值(Fixed)
- Changelock = False '网格行列改变控制锁
- Gdtlock = False '滚动条滚动控制
- Yxxpdlock = True '字段有效性判断锁
- Hyxxpdlock = True '行有效性判断锁
- Wbkbhlock = False '文本框内容改变锁
- '调入单据信息(需要修改BillCode)
- BillCode = "0304"
- Call Sub_ReadBillInfo(BillCode, Me, Var_Bill())
- Lab_Title = Var_Bill(2)
- Lab_Title.Move (Me.Width - Lab_Title.Width) / 2, 800
- '报表编码
- XtReportCode = Var_Bill(5)
- Load Dyymctbl
- '以下为文本框处理程序(Fixed)
- TextGroupCode = Var_Bill(3)
- Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr()) '读入文本框录入信息
- Call Wbkcsh
- '填充付款单类型列表
- Call FillCombo(Combo_Fkdlx, "Ap_Fkdlx", "", 0)
- '单据变动置为False(Fixed)
- Bln_BillChange = False
- '调入数据初始化模块(Fixed)
- Lab_Djclzt.Caption = Xtcdcs
- Call Sjcsh(Trim(Lab_Djclzt.Caption))
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- '是否保存已修改单据
- Dim YAnswer As Integer
- If Lab_OperStatus.Caption = "2" Or Lab_OperStatus.Caption = "3" Then
- Tsxx = "单据尚未保存,是否退出?"
- YAnswer = Xtxxts(Tsxx, 2, 2)
- If YAnswer <> 1 Then
- Cancel = 1
- Exit Sub
- End If
- End If
- '卸载打印页面窗体
- Unload Dyymctbl
- '判断单据是否发生变化,并返回相应标识
- If Bln_BillChange Then
- Xtfhcs = "1"
- Else
- Xtfhcs = "0"
- End If
- '用户退出时写上机日志
- Security_Log "Ap_PayBill", Xtczybm, 2, False
- End Sub
- Private Sub Sjcsh(Str_Pzclzt As String) '数据初始化模块(根据实际情况)
- Dim Sqlstr As String '查询单据列表条件
- '[>>根据实际情况初始化
- Select Case Str_Pzclzt
- Case "1" '填制单据
- '调入用户查询结果动态集
- Sqlstr = "SELECT CloseBillID From RP_CloseBill Where RPFlag='AP' And (BillItemCode = '90' OR BillItemCode = '91' OR BillItemCode = '92') And BillDate='" & Xtrq & "' ORDER BY CloseBillID"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- '新增单据
- Call Sub_AddBill
- Case "2" '查询单据(单据列表)
- '填充查询单据标识
- Lab_BillId.Caption = XT_BillID
- Str_QueryCondi = Xtcdcsfz
- Call Sub_ShowBill
- Call Sub_OperStatus("10")
- '调入用户查询结果动态集,并定位该单据
- Sqlstr = "SELECT CloseBillID From RP_CloseBill a " & Str_QueryCondi & " ORDER BY CloseBillID"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Rec_Query.Find "CloseBillID=" & 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("bc").Enabled = False '保存
- .Buttons("fq").Enabled = False '放弃
- .Buttons("shsh").Enabled = False '审核
- .Buttons("hx").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
- '填充明细联查单据标识
- Lab_BillId.Caption = XT_BillID
- Call Sub_ShowBill
- '设置操作状态为浏览
- Lab_OperStatus.Caption = "1"
- '录入文本框
- For Jsqte = Max_Text_Index To 0 Step -1
- LrText(Jsqte).Enabled = False
- Next Jsqte
- '置单据列表框为False
- Combo_Fkdlx.Enabled = False
- 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 '临时计数器
- '本张单据查询字符串
- Sqlstr = "Select * From Ap_V_CloseBill Where RPFlag='AP' And CloseBillID=" & Val(Lab_BillId.Caption)
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- If Not .EOF Then
- '[>>显示单据
- TextChangeLock = True '文本框加锁
- Dim Int_Modulus As Integer '金额系数(针对退款单)
- Select Case .Fields("BillItemCode")
- Case "90" '付款
- Int_Modulus = 1
- Combo_Fkdlx.ListIndex = 0
- Case "91" '预付款
- Int_Modulus = 1
- Combo_Fkdlx.ListIndex = 1
- Case "92" '退款单
- Combo_Fkdlx.ListIndex = 2
- Int_Modulus = -1
- End Select
- LrText(0).Text = Trim(.Fields("BillCode")) '单据编号
- LrText(1).Text = Format(.Fields("BillDate"), "yyyy-mm-dd") '单据日期
- LrText(2).Tag = Trim(.Fields("PSCode")) '供应商编码
- LrText(2).Text = Trim(.Fields("SupplierName") & "") '供应商名称
- LrText(3).Tag = Trim(.Fields("SScode") & "") '结算方式编码
- LrText(3).Text = Trim(.Fields("SSName") & "") '结算方式名称
- LrText(4).Text = Trim(.Fields("AccCode") & "") '结算科目
- LrText(5).Tag = Trim(.Fields("ForeignCurrCode") & "") '原币编码
- LrText(5).Text = Trim(.Fields("ForeignCurrName") & "") '原币名称
- LrText(6).Text = .Fields("AccRate") '记帐汇率
- LrText(7).Text = .Fields("Ybssje") * Int_Modulus '原币金额
- LrText(8).Text = Trim(.Fields("BankBillNo") & "") '银行票号
- LrText(9).Text = Trim(.Fields("BankCode") & "") '银行帐号
- LrText(10).Tag = Trim(.Fields("DeptCode") & "") '部门编码
- LrText(10).Text = Trim(.Fields("DeptName") & "") '部门名称
- LrText(11).Tag = Trim(.Fields("PersonCode") & "") '经办人编码
- LrText(11).Text = Trim(.Fields("PersonName") & "") '经办人名称
- LrText(12).Text = Trim(.Fields("Digest") & "") '摘要
- LrText(13).Text = Trim(.Fields("Maker") & "") '制单人
- LrText(14).Text = Trim(.Fields("Checker") & "") '审核人
- TextChangeLock = False '文本框解锁
- '<<]
- End If
- End With
- '设置审核弃审按钮状态 ****(如果通过应付明细帐进行明细查询时审核和核销按钮进行灰化处理)****
- If Xtcdcs <> "3" Then
- Call Sub_CheckStatus
- End If
- End Sub
- Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button) '用户点击工具条
- '屏蔽文本框,下拉组合框有效性判断
- Valilock = True
- '屏蔽网格失去焦点产生的有效性判断
- Changelock = True
- Select Case Button.Key
- Case "yl" '预 览
- BillTextPrint Lab_Title, LrText, TextGroupCode, XtReportCode, False
- Case "dy" '打 印
- Dim yhAnswer As Integer '打印提示
- '用户确认是否打印单据
- Tsxx = "请确认是否打印当前单据?"
- yhAnswer = Xtxxts(Tsxx, 2, 2)
- If yhAnswer = 2 Then
- Exit Sub
- End If
- BillTextPrint Lab_Title, LrText, TextGroupCode, XtReportCode, True
- Case "xz" '新 增
- Call Sub_AddBill
- Case "xg" '修 改
- Call Sub_EditBill
- Case "sc" '删 除
- Call Sub_DeleteBill
- Case "bc" '保 存
- Call Sub_SaveBill
- Case "fq" '放 弃
- Call Sub_AbandonBill
- Case "shsh" '审 核
- Call Sub_CheckBill
- Case "hx" '核 销
- Call Sub_CancelBill
- 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
- 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("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)
- '置单据列表框为False
- Combo_Fkdlx.Enabled = False
- Case "20" '新增单据((录入)新增一张单据 、(列表)新增一张单据)
- '工具条
- .Buttons("dy").Enabled = False '打印
- .Buttons("yl").Enabled = False '预览
- .Buttons("xz").Enabled = False '新增
- .Buttons("xg").Enabled = False '修改
- .Buttons("sc").Enabled = False '删除
- .Buttons("bc").Enabled = True '保存
- .Buttons("fq").Enabled = True '放弃
- .Buttons("shsh").Enabled = False '审核
- .Buttons("hx").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)
- '置单据列表框为True
- Combo_Fkdlx.Enabled = True
- Case "30" '修改((录入)调入修改功能、(列表)调入修改功能)
- '工具条
- .Buttons("dy").Enabled = False '打印
- .Buttons("yl").Enabled = False '预览
- .Buttons("xz").Enabled = False '新增
- .Buttons("xg").Enabled = False '修改
- .Buttons("sc").Enabled = False '删除
- .Buttons("bc").Enabled = True '保存
- .Buttons("fq").Enabled = True '放弃
- .Buttons("shsh").Enabled = False '审核
- .Buttons("hx").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)
- '置单据列表框为True
- Combo_Fkdlx.Enabled = True
- End Select
- End With
- End Sub
- Private Sub Sub_LrtextStatus(TextEnabled As Boolean) '设置录入文本框状态
- '录入文本框状态设置
- If TextEnabled Then
- For Jsqte = Max_Text_Index To 0 Step -1
- '判断文本框是否可编辑
- If Textboolean(Jsqte, 5) Then
- LrText(Jsqte).Enabled = True
- Else
- LrText(Jsqte).Enabled = False
- End If
- Next Jsqte
- Else
- For Jsqte = Max_Text_Index To 0 Step -1
- LrText(Jsqte).Enabled = False
- Next Jsqte
- End If
- End Sub
- Private Sub Sub_CheckStatus() '设置审核弃审按钮状态(亦可设置其他动作按钮状态)
- '根据当前单据状态来确定审核弃审按钮状态
- If Trim(LrText(13).Text) <> "" And Trim(LrText(14).Text) = "" Then
- Tlb_Action.Buttons("shsh").Enabled = True '审核
- Else
- Tlb_Action.Buttons("shsh").Enabled = False '审核
- End If
- If Trim(LrText(13).Text) <> "" And Trim(LrText(14).Text) <> "" Then
- Tlb_Action.Buttons("hx").Enabled = True '核销
- Else
- Tlb_Action.Buttons("hx").Enabled = False '核销
- End If
- End Sub
- Private Sub Sub_AddBill() '新增一张单据
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim Jsqte As Long '临时计数器
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ap_PayBill_Edit", Xtczybm, 1, True) Then
- Exit Sub
- End If
- '设置操作状态为新增(Fixed)
- Lab_OperStatus.Caption = "2"
- '设置工具条状态(Fixed)
- Call Sub_OperStatus("20")
- '清空VouchID(Fixed)
- Lab_BillId.Caption = ""
- '录入文本框清除内容
- For Jsqte = Max_Text_Index To 0 Step -1
- LrText(Jsqte).Tag = ""
- LrText(Jsqte).Text = ""
- Next Jsqte
- '[>>显示制单人,清空审核人,此处还可以设置录入默认值如自动生成单据号、默认单据录入日期注意加锁
- LrText(13).Text = Xtczy
- LrText(14).Text = ""
- '设置订单日期默认为系统业务日期,默认币别为本位币
- TextChangeLock = True
- LrText(1).Text = Xtrq
- LrText(5).Text = XtSCurrName
- LrText(5).Tag = XtSCurrCode
- LrText(6).Text = 1
- TextChangeLock = False
- '读取最新的单据编码
- LrText(0).Text = CreatBillCode(BillCode, False)
- '<<]
- '让第一个录入项得到焦点(Fixed)
- On Error Resume Next
- LrText(1).SetFocus
- End Sub
- Private Sub Sub_EditBill() '修改一张单据
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ap_PayBill_Edit", Xtczybm, 1, True) Then
- Exit Sub
- End If
- '非有效单据不予进行修改动作
- If Val(Lab_BillId.Caption) = 0 Then
- Exit Sub
- End If
- '判断当前单据是否允许修改
- If Not Fun_AllowEdit Then
- Exit Sub
- End If
- '设置操作状态为修改
- Lab_OperStatus.Caption = "3"
- '设置工具条状态
- Call Sub_OperStatus("30")
- '显示制单人
- LrText(13).Text = Xtczy
- End Sub
- Private Sub Sub_DeleteBill() '删除当前单据
- Dim YAnswer As Integer '确认是否删除当前单据
- Dim Jsqte As Long '临时使用计数器
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ap_PayBill_Edit", Xtczybm, 1, True) Then
- Exit Sub
- End If
- '非有效单据不予进行删除动作
- If Val(Lab_BillId.Caption) = 0 Then
- Exit Sub
- End If
- Tsxx = "请确认是否删除当前单据?"
- YAnswer = Xtxxts(Tsxx, 2, 2)
- If YAnswer = 1 Then
- '判断当前单据是否允许删除
- If Not Fun_AllowEdit Then
- Exit Sub
- End If
- '进行事务处理
- On Error GoTo Swcwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- '1.删除单据所有内容
- Cw_DataEnvi.DataConnect.Execute ("Delete RP_CloseBill Where CloseBillID=" & Val(Lab_BillId.Caption))
- Cw_DataEnvi.DataConnect.CommitTrans
- '标识单据发生改动
- Bln_BillChange = True
- '单据ID置0
- Lab_BillId.Caption = 0
- Else
- Exit Sub
- End If
- '删除单据后重置状态
- '1.显示下一张单据
- Call Sub_Next
- '2.如果无下一张单据则搜索上一张单据
- If Val(Lab_BillId.Caption) = 0 Then
- Call Sub_Prev
- End If
- '3.如无单据则置单据为空状态
- If Val(Lab_BillId.Caption) = 0 Then
- '清除录入文本框
- For Jsqte = Max_Text_Index To 0 Step -1
- LrText(Jsqte).Tag = ""
- LrText(Jsqte).Text = ""
- Next Jsqte
- '设置操作状态为浏览
- Lab_OperStatus = "1"
- Call Sub_OperStatus("10")
- End If
- Rec_Query.Requery
- Rec_Query.Find "CloseBillID=" & Val(Lab_BillId.Caption)
- Exit Sub
- Swcwcl: '单据删除时出现错误
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "单据删除过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- Private Sub Sub_AbandonBill() '放弃对当前单据的操作
- Dim Jsqte As Long '临时使用计数器
- '如果单据有效则重新显示当前单据,置单据为空状态
- If Not Rec_Query.EOF Then
- Lab_BillId.Caption = Rec_Query.Fields("CloseBillID")
- Call Sub_ShowBill
- Else
- '单据ID置为0
- Lab_BillId.Caption = 0
- '清除录入文本框
- For Jsqte = Max_Text_Index To 0 Step -1
- LrText(Jsqte).Tag = ""
- LrText(Jsqte).Text = ""
- Next Jsqte
- End If
- '设置操作状态为浏览
- Lab_OperStatus = "1"
- Call Sub_OperStatus("10")
- End Sub
- Private Function Sub_SaveBill() As Boolean '保 存 单 据
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim Rec_Bill As New ADODB.Recordset '单据表动态集
- Dim Jsqte As Integer '临时计数器
- Dim Int_Kjyear As Integer '会计年度
- Dim Int_Period As Integer '会计期间
- Dim Bln_ConVertFlag As Boolean '币种折算方式
- Dim Dbl_AccRate As Double '币种记帐汇率
- Dim Dbl_Bbje As Double '本币金额
- Dim Int_Modulus As Integer '金额系数(针对退款单)
- Sub_SaveBill = False
- '一.============先对单据内容进行有效性判断==============='
- '先进行字段不能为空或不能为零有效性判断(Fixed)
- For Jsqte = 0 To Max_Text_Index
- If Textint(Jsqte, 8) = 1 Then '字段不能为空
- If Len(Trim(LrText(Jsqte).Text)) = 0 Then
- Tsxx = Textstr(Jsqte, 7) & "不能为空!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Jsqte).SetFocus
- Exit Function
- End If
- Else
- If Textint(Jsqte, 8) = 2 Then '字段不能为零
- If Val(Trim(LrText(Jsqte).Text)) = 0 Then
- Tsxx = Textstr(Jsqte, 7) & "不能为零!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Jsqte).SetFocus
- Exit Function
- End If
- End If
- End If
- Next Jsqte
- '对需要进行事后判断的文本框录入内容进行有效性判断 (Fixed)
- For Jsqte = 0 To Max_Text_Index
- If Textint(Jsqte, 9) = 0 Or Textint(Jsqte, 9) = 2 Then
- If Not TextYxxpd(Jsqte) Then
- Exit Function
- End If
- End If
- Next Jsqte
- '[>>
- '可在此区域写入其他对单据表头内容的有效性判断,具体格式参照如下
- '1.判断单据日期是否有效,如有效同时记录会计年度和会计期间
- If Not Fun_GetPeriod(Trim(LrText(1).Text), Int_Kjyear, Int_Period) Then
- LrText(1).SetFocus
- Exit Function
- End If
- '2.如果用户选择币种为本位币则汇率必须为1,否则汇率不能为零
- If Trim(LrText(5).Tag) <> XtSCurrCode Then
- If Val(LrText(6).Text) = 0 Then
- Tsxx = "汇率不能为零!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(6).SetFocus
- Exit Function
- End If
- Else
- LrText(6).Text = 1
- End If
- '计算本币金额
- Call Sub_GetAccRate(LrText(5).Tag, Bln_ConVertFlag, Dbl_AccRate)
- If Bln_ConVertFlag Then
- Dbl_Bbje = Val(Format(Val(LrText(7).Text) / Val(LrText(6).Text), "##." + String(Xtjexsws, "0")))
- Else
- Dbl_Bbje = Val(Format(Val(LrText(7).Text) * Val(LrText(6).Text), "##." + String(Xtjexsws, "0")))
- End If
- '<<]
- '二.=============如果以上有效性检查均顺利通过,则执行存盘动作============'
- '对存盘进行事务处理(Fixed)
- On Error GoTo Swcwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- '判断单据状态以进行不同处理
- '1.先对单据主表进行处理
- If Trim(Lab_OperStatus) = "2" Then
- '新增单据
- '1.对于某些单据号自动生成的单据则可在此处自动生成
- LrText(0).Text = CreatBillCode(BillCode, True)
- '2.开始存盘
- '打开单据表动态集
- If Rec_Bill.State = 1 Then Rec_Bill.Close
- Rec_Bill.Open "Select * From RP_CloseBill Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_Bill
- .AddNew
- .Fields("RPFlag") = "AP" '应付帐标识
- .Fields("CloseBillId") = CreatBillID(BillCode) '单据ID
- Select Case Combo_Fkdlx.ListIndex '结算单类型
- Case 0 '付款
- Int_Modulus = 1
- .Fields("BillItemCode") = "90"
- Case 1 '预付款
- Int_Modulus = 1
- .Fields("BillItemCode") = "91"
- Case 2 '退款单
- Int_Modulus = -1
- .Fields("BillItemCode") = "92"
- End Select
- .Fields("BillCode") = Trim(LrText(0).Text) '单据号
- .Fields("BillDate") = CDate(LrText(1).Text) '单据日期
- .Fields("Kjyear") = Int_Kjyear '会计年度
- .Fields("Period") = Int_Period '会计期间
- .Fields("PSCode") = Trim(LrText(2).Tag) '供应商编码
- .Fields("SScode") = Trim(LrText(3).Tag) '结算方式
- .Fields("AccCode") = Trim(LrText(4).Text) '结算科目
- If Combo_Fkdlx.ListIndex = 1 Then
- .Fields("AccCodeArAp") = Fun_InputCodeSupplier(LrText(2).Tag, 1) '预付帐款科目
- Else
- .Fields("AccCodeArAp") = Fun_InputCodeSupplier(LrText(2).Tag, 0) '应付帐款科目
- End If
- .Fields("ForeignCurrCode") = Trim(LrText(5).Tag) '原币编码
- .Fields("AccRate") = Val(LrText(6).Text) '记帐汇率
- .Fields("YbSsJe") = Val(LrText(7).Text) * Int_Modulus '原币金额
- .Fields("BbSsje") = Dbl_Bbje * Int_Modulus '本币金额
- .Fields("BankBillNo") = Trim(LrText(8).Text) '银行票号
- .Fields("BankCode") = Trim(LrText(9).Tag) '银行帐号
- .Fields("DeptCode") = Trim(LrText(10).Tag) '部门
- .Fields("PersonCode") = Trim(LrText(11).Tag) '经办人
- .Fields("Digest") = Trim(LrText(12).Text) '摘要
- .Fields("Maker") = Trim(LrText(13).Text) '制单人
- .Update
- '系统读出单据ID写入Lab_BillID
- Lab_BillId.Caption = .Fields("CloseBillID")
- End With
- Else
- '修改单据
- '打开单据表动态集
- If Rec_Bill.State = 1 Then Rec_Bill.Close
- Rec_Bill.Open "Select * From RP_CloseBill Where CloseBillID=" & Val(Lab_BillId.Caption), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_Bill
- .Fields("BillDate") = CDate(LrText(1).Text) '单据日期
- .Fields("Kjyear") = Int_Kjyear '会计年度
- .Fields("Period") = Int_Period '会计期间
- Select Case Combo_Fkdlx.ListIndex '结算单类型
- Case 0 '付款
- Int_Modulus = 1
- .Fields("BillItemCode") = "90"
- Case 1 '预付款
- Int_Modulus = 1
- .Fields("BillItemCode") = "91"
- Case 2 '退款单
- Int_Modulus = -1
- .Fields("BillItemCode") = "92"
- End Select
- .Fields("PSCode") = Trim(LrText(2).Tag) '供应商编码
- .Fields("SScode") = Trim(LrText(3).Tag) '结算方式
- .Fields("AccCode") = Trim(LrText(4).Text) '结算科目
- If Combo_Fkdlx.ListIndex = 1 Then
- .Fields("AccCodeArAp") = Fun_InputCodeSupplier(LrText(2).Tag, 1) '预付帐款科目
- Else
- .Fields("AccCodeArAp") = Fun_InputCodeSupplier(LrText(2).Tag, 0) '应付帐款科目
- End If
- .Fields("ForeignCurrCode") = Trim(LrText(5).Tag) '原币编码
- .Fields("AccRate") = Val(LrText(6).Text) '记帐汇率
- .Fields("YbSsJe") = Val(LrText(7).Text) * Int_Modulus '原币金额
- .Fields("BbSsje") = Dbl_Bbje * Int_Modulus '本币金额
- .Fields("BankBillNo") = Trim(LrText(8).Text) '银行票号
- .Fields("BankCode") = Trim(LrText(9).Tag) '银行帐号
- .Fields("DeptCode") = Trim(LrText(10).Tag) '部门
- .Fields("PersonCode") = Trim(LrText(11).Tag) '经办人
- .Fields("Digest") = Trim(LrText(12).Text) '摘要
- .Fields("Maker") = Trim(LrText(13).Text) '制单人
- .Update
- End With
- End If
- Cw_DataEnvi.DataConnect.CommitTrans
- Sub_SaveBill = True
- Tsxx = "单据存盘完毕! 单据号:" & Trim(LrText(0).Text)
- Call Xtxxts(Tsxx, 0, 4)
- '标识单据发生改动
- Bln_BillChange = True
- '设置单据改变后的状态
- Lab_OperStatus = "1"
- Call Sub_OperStatus("10")
- Rec_Query.Requery
- Rec_Query.Find "CloseBillID=" & Val(Lab_BillId.Caption)
- Exit Function
- Swcwcl: '数据存盘时出现错误
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- End Function
- '选择首张,上张,下张,末张(此4个过程只需用您的单据ID字段名替换"CloseBillID"即可)
- Private Sub Sub_First() '首 张
- With Rec_Query
- If .RecordCount = 0 Then
- Exit Sub
- End If
- .MoveFirst
- Lab_BillId.Caption = .Fields("CloseBillID")
- Call Sub_ShowBill
- End With
- End Sub
- Private Sub Sub_Prev() '上 张
- With Rec_Query
- If .RecordCount = 0 Then
- Exit Sub
- End If
- If Not .BOF Then
- .MovePrevious
- End If
- If Not .BOF Then
- Lab_BillId.Caption = .Fields("CloseBillID")
- Else
- .MoveNext
- End If
- Call Sub_ShowBill
- End With
- End Sub
- Private Sub Sub_Next() '下 张
- With Rec_Query
- If .RecordCount = 0 Then
- Exit Sub
- End If
- If Not .EOF Then
- .MoveNext
- End If
- If Not .EOF Then
- Lab_BillId.Caption = .Fields("CloseBillID")
- Else
- .MovePrevious
- End If
- Call Sub_ShowBill
- End With
- End Sub
- Private Sub Sub_Last() '末 张
- With Rec_Query
- If .RecordCount = 0 Then
- Exit Sub
- End If
- .MoveLast
- Lab_BillId.Caption = .Fields("CloseBillID")
- Call Sub_ShowBill
- End With
- End Sub
- '[>>===================以下为根据实际业务需要自定义过程区域=============================<<]
- '审核,弃审
- Private Sub Sub_CheckBill() '审 核
- '[>>
- '此处可以写入禁止单据审核的理由
- '<<]
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ap_PayBill_Check", Xtczybm, 1, True) Then
- Exit Sub
- End If
- If Fun_CheckCloseBill(Val(Lab_BillId.Caption)) Then
- '写入系统操作员
- LrText(14).Text = Xtczy
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- '标识单据发生变化
- Bln_BillChange = True
- End If
- End Sub
- Private Function Fun_AllowEdit() As Boolean '判断当前单据是否允许编辑或删除
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Fun_AllowEdit = False
- Sqlstr = "Select Checker From RP_CloseBill Where CloseBillID=" & Val(Lab_BillId.Caption)
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- If Not .EOF Then
- If Trim(.Fields("Checker") & "") <> "" Then
- Tsxx = "该单据已审核确认,不能修改或删除!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- End If
- End With
- Fun_AllowEdit = True
- End Function
- Private Sub Combo_Fkdlx_Click() '点击收款单类型下拉框
- Select Case Combo_Fkdlx.ListIndex
- Case 0 '付款
- Lab_Title.ForeColor = &H0&
- Lab_Title.Caption = "付款单"
- Case 1 '预付款
- Lab_Title.ForeColor = &HFF0000
- Lab_Title.Caption = "预付款"
- Case 2 '退款单
- Lab_Title.ForeColor = &HFF&
- Lab_Title.Caption = "退款单"
- End Select
- End Sub
- Private Sub Sub_CancelBill() '单据核销
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ap_PayBill_Check", Xtczybm, 1, True) Then
- Exit Sub
- End If
- On Error Resume Next
- If Combo_Fkdlx.ListIndex = 1 Then
- HX_FrmHxCxtj.Combo_Jshxlx.ListIndex = 1 '预收冲应收
- Else
- HX_FrmHxCxtj.Combo_Jshxlx.ListIndex = 0 '到款结算
- End If
- HX_FrmHxCxtj.LrText(0).Tag = LrText(2).Tag '客户编码
- HX_FrmHxCxtj.LrText(0).Text = LrText(2).Text '客户名称
- HX_FrmHxCxtj.Imgebo_ForeignCurr.Text = LrText(5).Text
- HX_FrmHxgl.Timer1.Enabled = True
- HX_FrmHxgl.Show 1
- End Sub
- '[>>===================以上为根据实际业务需要自定义过程区域=============================<<]
- '*****************************以下为文本框录入处理程序(固定不变部分)*******************************'
- '************以下为文本框录入处理程序(固定不变部分)*************'
- Private Sub Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- Select Case Index
- Case 5
- Dim Bln_ConVertFlag As Boolean '币种折算方式
- Dim Dbl_AccRate As Double '币种记帐汇率
- Call Sub_GetAccRate(LrText(5).Tag, Bln_ConVertFlag, Dbl_AccRate) '取外币记帐汇率
- TextChangeLock = True
- If Dbl_AccRate <> 0 Then
- LrText(6).Text = Dbl_AccRate
- Else
- LrText(6).Text = ""
- End If
- TextChangeLock = False
- End Select
- ']以上为依据实际情况自定义部分
- End Sub
- Private Sub LrText_Change(Index As Integer)
- '屏蔽程序改变控制
- If TextChangeLock Then
- Exit Sub
- End If
- TextValiJudgeLock(Index) = False '打开有效性判断锁
- '限制字段录入长度
- TextChangeLock = True '加锁(防止执行Lrtext_Change)
- Call TextChangeLimit(LrText(Index), Textint(Index, 1)) '去掉无效字符
- Select Case Textint(Index, 1)
- Case 8, 11 '金额型
- Call Sjgskz(LrText(Index), Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9, 12 '数量型
- Call Sjgskz(LrText(Index), Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10 '单价型
- Call Sjgskz(LrText(Index), Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else '其他小数类型控制
- If Textint(Index, 6) <> 0 Or Textint(Index, 7) <> 0 Then
- Call Sjgskz(LrText(Index), Textint(Index, 6), Textint(Index, 7))
- End If
- End Select
- TextChangeLock = False '解锁
- End Sub
- Private Sub LrText_GotFocus(Index As Integer) '文本框得到焦点,显示相应信息
- Call TextShow(Index)
- CurTextIndex = Index
- LrText(Index).SelStart = Len(LrText(Index))
- End Sub
- Private Sub LrText_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) '字段按F2键提供帮助
- Select Case KeyCode
- Case vbKeyF2
- Call Text_Help(Index)
- End Select
- End Sub
- Private Sub LrText_KeyPress(Index As Integer, KeyAscii As Integer) '文本框录入事中控制
- Call InputFieldLimit(LrText(Index), Textint(Index, 1), KeyAscii)
- End Sub
- Private Sub LrText_LostFocus(Index As Integer) '文本框失去焦点
- '显示相应信息但不能进行有效性判断
- Call Wbklrwbcl(Index)
- End Sub
- Private Sub Ydcommand1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) '按钮提供帮助
- '文本框处于非录入状态时不允许调入帮助
- If Not LrText(Index).Enabled Then
- Exit Sub
- End If
- Call Text_Help(Index)
- End Sub
- Private Sub Text_Help(Index As Integer) '录入字段帮助
- If Not Textboolean(Index, 1) Then
- Exit Sub
- End If
- '调用帮助
- Call Drbmhelp(Textint(Index, 2), Textstr(Index, 4), Trim(LrText(Index).Text))
- '根据设置选择显示编码和名称,并进行存储
- If Len(Xtfhcs) <> 0 Then
- If Textint(Index, 3) = 1 Then
- LrText(Index).Text = Xtfhcsfz
- LrText(Index).Tag = Xtfhcs
- Else
- LrText(Index).Text = Xtfhcs
- LrText(Index).Tag = Xtfhcsfz
- End If
- End If
- LrText(Index).SetFocus
- End Sub
- Private Sub TextShow(Index As Integer) '文本框得到焦点,显示相应信息
- '填写文本框得到焦点,进行相应信息处理程序
- End Sub
- Private Sub Wbkcsh() '录入文本框初始化
- Dim Int_TabIndex As Integer 'Tab焦点计数器
- '单据录入中文本框焦点由0开始
- LrText(0).TabIndex = 0
- '最大录入文本框索引值
- Max_Text_Index = Textvar(1)
- ReDim TextValiJudgeLock(Max_Text_Index)
- For Jsqte = 0 To Max_Text_Index
- '判断此文本框录入索引号是否存在,如存在则对其进行初始化
- If Len(Trim(Textstr(Jsqte, 1))) <> 0 Then
- '自动装入录入文本框和其解释标签
- If Jsqte <> 0 Then
- Load LrText(Jsqte)
- Load tsLabel(Jsqte)
- '判断录入文本框是否显示
- If Textboolean(Jsqte, 4) Then
- LrText(Jsqte).Visible = True
- tsLabel(Jsqte).Visible = True
- End If
- '判断文本框是否可编辑
- If Textboolean(Jsqte, 5) Then
- LrText(Jsqte).Enabled = True
- Else
- LrText(Jsqte).Enabled = False
- End If
- '判断文本框是否提供帮助
- If Textboolean(Jsqte, 1) Then
- If Not Textboolean(Jsqte, 3) Then
- Load Ydcommand1(Jsqte)
- End If
- End If
- End If
- '初始化其内容
- TextChangeLock = True
- LrText(Jsqte).Text = ""
- LrText(Jsqte).Tag = ""
- If Textint(Jsqte, 5) <> 0 Then
- LrText(Jsqte).MaxLength = Textint(Jsqte, 5)
- End If
- TextChangeLock = False
- '设置文本框位置及大小,并设置相应标签内容及其位置
- LrText(Jsqte).Move Textint(Jsqte, 13), Textint(Jsqte, 12), Textint(Jsqte, 11), Textint(Jsqte, 10)
- tsLabel(Jsqte).Caption = Textstr(Jsqte, 7) & ":"
- tsLabel(Jsqte).Move Textint(Jsqte, 13) - tsLabel(Jsqte).Width - 20, Textint(Jsqte, 12) + (Textint(Jsqte, 10) - tsLabel(Jsqte).Height) / 2 - 30
- '判断文本框是否提供帮助
- If Textboolean(Jsqte, 1) Then
- Ydcommand1(Jsqte).Visible = True
- Ydcommand1(Jsqte).Move LrText(Jsqte).Left + LrText(Jsqte).Width, LrText(Jsqte).Top
- End If
- End If
- '将文本框有效性判断进行加锁,在文本框内容发生变化时将锁打开
- TextValiJudgeLock(Jsqte) = True
- Next Jsqte
- '设置文本框焦点转移顺序(前提文本焦点从0至Max_Text_Index)
- For Int_TabIndex = 0 To Max_Text_Index
- For Jsqte = 0 To Max_Text_Index
- If Textint(Jsqte, 14) = Int_TabIndex Then
- LrText(Jsqte).TabIndex = Int_TabIndex
- End If
- Next Jsqte
- Next Int_TabIndex
- End Sub
- Private Function TextYxxpd(Index As Integer) As Boolean '文本框有效性判断
- Dim Sqlstr As String
- Dim Findrec As ADODB.Recordset
- '文本框内容未曾改变不进行有效性判断
- If TextValiJudgeLock(Index) Then
- TextYxxpd = True
- Exit Function
- End If
- '文本框内容为空认为有效,并清空其Tag值
- If Trim(LrText(Index)) = "" Then
- LrText(Index).Tag = ""
- Call Wbklrwbcl(Index)
- TextValiJudgeLock(Index) = True
- TextYxxpd = True
- Exit Function
- End If
- '可在此加入不做有效性判断的理由
- Select Case Textint(Index, 4)
- Case 1 '编码型
- Sqlstr = Trim(Textstr(Index, 5))
- Sqlstr = Replace(Sqlstr, "@", "'" + Trim(LrText(Index).Text) + "'")
- Set Findrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Findrec.EOF Then
- Call Xtxxts(Trim(Textstr(Index, 6)), 0, 1)
- LrText(Index).SetFocus
- Exit Function
- Else
- Select Case Textint(Index, 3)
- Case 0
- If Len(Trim(Textstr(Index, 2))) <> 0 Then
- LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
- End If
- If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
- LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
- End If
- Case 1
- If Len(Trim(Textstr(Index, 3) & "")) <> 0 Then
- LrText(Index).Text = Trim(Findrec.Fields(Trim(Textstr(Index, 3))))
- End If
- If Len(Trim(Textstr(Index, 2))) <> 0 Then
- LrText(Index).Tag = Trim(Findrec.Fields(Trim(Textstr(Index, 2))))
- End If
- End Select
- End If
- Case 2 '日期型
- If IsDate(LrText(Index).Text) Then
- LrText(Index).Text = Format(LrText(Index).Text, "yyyy-mm-dd")
- If Val(Mid(LrText(Index), 1, 4)) < 1900 Then
- LrText(Index).Text = "1900" + Mid(LrText(Index), 5, 6)
- End If
- Else
- Tsxx = "非法公历日期!(格式:" + Format(Date, "yyyy-mm-dd") + ")"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Index).SetFocus
- Exit Function
- End If
- Case 3 '其他类型
- If Index = 4 Then
- Sqlstr = "Select Ccode,EndFlag,StopFlag From Cwzz_AccCode Where Ccode='" & Trim(LrText(Index).Text) & "'"
- Set Findrec = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With Findrec
- If .EOF Then
- Tsxx = "此科目不存在!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Index).SetFocus
- Exit Function
- End If
- If Not .Fields("EndFlag") Then
- Tsxx = "此科目非末级科目!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Index).SetFocus
- Exit Function
- End If
- If .Fields("StopFlag") Then
- Tsxx = "此科目已停用!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(Index).SetFocus
- Exit Function
- End If
- End With
- End If
- End Select
- '如果有效则加锁,用户不改变内容则不再进行有效性判断
- TextValiJudgeLock(Index) = True
- '调用文本框事后处理程序
- Call Wbklrwbcl(Index)
- '有效性判断通过则返回True
- TextYxxpd = True
- End Function