˪-i㦥
资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:71k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Begin VB.Form Note_FrmNoteIn
- BackColor = &H00E9F4FA&
- BorderStyle = 1 'Fixed Single
- Caption = "应收票据"
- ClientHeight = 6675
- ClientLeft = 675
- ClientTop = 720
- ClientWidth = 10725
- Icon = "应收票据_收票.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6675
- ScaleWidth = 10725
- StartUpPosition = 1 '所有者中心
- Begin VB.Frame Frame1
- BackColor = &H00E9F4FA&
- Height = 435
- Left = 5205
- TabIndex = 9
- Top = 1430
- Width = 3225
- Begin VB.OptionButton OptReceNoteType
- BackColor = &H00E9F4FA&
- Caption = "银行承兑汇票"
- Height = 255
- Index = 1
- Left = 150
- TabIndex = 11
- Top = 150
- Value = -1 'True
- Width = 1455
- End
- Begin VB.OptionButton OptReceNoteType
- BackColor = &H00E9F4FA&
- Caption = "商业承兑汇票"
- Height = 255
- Index = 0
- Left = 1710
- TabIndex = 10
- Top = 150
- Width = 1455
- End
- End
- Begin VB.CommandButton Ydcommand1
- Height = 300
- Index = 0
- Left = 7590
- Picture = "应收票据_收票.frx":1042
- Style = 1 'Graphical
- TabIndex = 8
- Top = 660
- Visible = 0 'False
- Width = 300
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 9090
- Top = 330
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 39
- 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 = "shsh"
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":7FD8
- Key = "shqs"
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":8372
- Key = "quanxuan"
- EndProperty
- BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":870C
- Key = "quanqi"
- EndProperty
- BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":8AA6
- Key = "Endorse"
- EndProperty
- BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":8E40
- Key = "Cancel"
- EndProperty
- BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":91DA
- Key = "Discount"
- EndProperty
- BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":9574
- Key = "Encash"
- EndProperty
- BeginProperty ListImage38 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":990E
- Key = "TurnOut"
- EndProperty
- BeginProperty ListImage39 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "应收票据_收票.frx":9CA8
- Key = "Voucher"
- EndProperty
- EndProperty
- End
- Begin VB.Timer Timer1
- Interval = 1
- Left = 9690
- Top = 150
- End
- Begin VB.TextBox LrText
- ForeColor = &H00000000&
- Height = 300
- Index = 0
- Left = 1560
- TabIndex = 0
- Text = "0"
- Top = 1470
- Width = 1650
- End
- Begin MSComctlLib.Toolbar Tlb_Action
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 12
- Top = 0
- Width = 10725
- _ExtentX = 18918
- _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 = 21
- 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"
- ImageKey = "xz"
- 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 = "shsh"
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh4"
- Style = 3
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "兑现"
- Key = "Encash"
- ImageKey = "Encash"
- EndProperty
- BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "背书"
- Key = "Endorse"
- ImageKey = "Endorse"
- EndProperty
- BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "转出"
- Key = "TurnOut"
- ImageKey = "TurnOut"
- EndProperty
- BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "贴现"
- Key = "Discount"
- ImageKey = "Discount"
- EndProperty
- BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.Visible = 0 'False
- Caption = "凭证"
- Key = "Voucher"
- ImageKey = "Voucher"
- EndProperty
- BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.Visible = 0 'False
- Style = 3
- EndProperty
- BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button21 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- End
- Begin VB.Label Lab_Start
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Lab_Start"
- ForeColor = &H00000000&
- Height = 195
- Left = 690
- TabIndex = 14
- Top = 630
- Visible = 0 'False
- Width = 690
- End
- Begin VB.Label Lab_NoteStatus
- BackColor = &H80000018&
- Caption = "Lab_NoteStatus"
- Height = 315
- Left = 2070
- TabIndex = 13
- Top = 600
- Visible = 0 'False
- Width = 1035
- 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 = 3360
- TabIndex = 7
- Top = 750
- Width = 2520
- End
- Begin VB.Label Lab_BillId
- AutoSize = -1 'True
- BackColor = &H0080C0FF&
- Height = 270
- Left = 8070
- TabIndex = 6
- Top = 690
- Visible = 0 'False
- Width = 1230
- End
- Begin VB.Label Lab_Djclzt
- BackColor = &H0000FFFF&
- Caption = "1"
- ForeColor = &H00808080&
- Height = 255
- Left = 7170
- TabIndex = 5
- Top = 660
- Visible = 0 'False
- Width = 285
- End
- Begin VB.Label Lab_OperStatus
- BackColor = &H000080FF&
- Caption = "1"
- Height = 345
- Left = 9390
- TabIndex = 4
- Top = 690
- 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 = 3
- 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 = 2
- Top = 6360
- Width = 735
- End
- Begin VB.Label TsLabel
- Alignment = 1 'Right Justify
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "单据号:"
- Height = 195
- Index = 0
- Left = 780
- TabIndex = 1
- Top = 1500
- Width = 585
- End
- End
- Attribute VB_Name = "Note_FrmNoteIn"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '***********************************************************************************************************
- '* 模 块 名 称 :应收票据收票处理和期初票据处理
- '* 功 能 描 述 :此功能模块主要完成单据录入、修改、删除、预览打印等。
- '* 程序员姓名 :姜冬梅
- '* 最后修改人 :姜冬梅
- '* 最后修改时间:2001/12/16
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '*
- '* 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
- '* XT_Control窗体中的通过 TranPara = "期初" 来区别日常与期初
- '***********************************************************************************************************
- '[以下为根据实际情况设置变量
- Dim Bln_BillChange As Boolean '标识单据是否发生改动
- Dim Rec_Query As New ADODB.Recordset '单据组查询结果动态集(保存当前单据组ID)
- Public Str_QueryCondi As String '单据组查询条件(接收单据列表传递查询条件)
- Dim Bln_ConVertFlag As Boolean '币种折算方式
- Dim Dbl_AccRate As Double '币种记帐汇率
- Dim Dbl_Bbje As Double '本币金额
- ']
- '以下为固定使用变量(单据)
- 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 = "0201"
- 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
- '单据变动置为False(Fixed)
- Bln_BillChange = False
- If TranPara = "期初" Then
- Lab_Start.Caption = "期初" '期初应收票据
- Me.HelpContextID = 20202 '期初帮助
- Else
- Lab_Start.Caption = "" '非期初应收票据
- Me.HelpContextID = 20403 '帮助
- End If
- '调入数据初始化模块(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
- '重新返回单据标识(是否期初应收票据)
- TranPara = ""
- '判断单据是否发生变化,并返回相应标识
- If Bln_BillChange Then
- Xtfhcs = "1"
- Else
- Xtfhcs = "0"
- End If
- '用户退出时写上机日志
- Security_Log "Ar_Note", Xtczybm, 2, False
- End Sub
- Private Sub Sjcsh(Str_Pzclzt As String) '数据初始化模块(根据实际情况)
- Dim Sqlstr As String '查询单据列表条件
- Dim RecTemp As New ADODB.Recordset
- '[>>根据实际情况初始化
- Select Case Str_Pzclzt
- Case "1" '填制单据
- '调入用户查询结果动态集
- Sqlstr = "SELECT * From RP_Note Where RPFlag='AR' And BillDate='" & Xtrq & "' ORDER BY NoteID"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- '新增单据
- Call Sub_AddBill
- Case "2" '查询单据(单据列表)
- '填充查询单据标识
- Lab_BillId.Caption = XT_BillID
- '添
- Sqlstr = "SELECT Fstatus From RP_Note Where NoteId='" & Lab_BillId.Caption & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Lab_NoteStatus = RecTemp.Fields("Fstatus")
- Str_QueryCondi = Xtcdcsfz
- Call Sub_ShowBill
- Call Sub_OperStatus("10")
- '调入用户查询结果动态集,并定位该单据
- Sqlstr = "SELECT * From Rp_Note a " & Str_QueryCondi & " ORDER BY NoteID"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Rec_Query.Find "NoteID=" & 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("fgh2").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 '临时计数器
- '本张单据查询字符串
- Sqlstr = "SELECT * From Ar_v_Note Where NoteID='" & Val(Lab_BillId.Caption) & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- If Not .EOF Then
- '[>>显示单据
- TextChangeLock = True '文本框加锁
- If .Fields("BillItemCode") = "01" Then
- OptReceNoteType(0).Value = True
- Else
- OptReceNoteType(1).Value = True
- End If
- LrText(0).Text = Trim(.Fields("NoteCode")) '结算单据号
- If IsDate(.Fields("BillDate")) Then
- LrText(1).Text = Format(.Fields("BillDate"), "yyyy-mm-dd") '收票日期
- End If
- LrText(2).Tag = Trim(.Fields("PsCode")) '客户编码
- LrText(2).Text = Trim(.Fields("CusName") & "") '客户名称
- If IsDate(.Fields("SignDate")) Then
- LrText(3).Text = Format(.Fields("SignDate"), "yyyy-mm-dd") '签发日期
- End If
- If IsDate(.Fields("ExpireDate")) Then
- LrText(4).Text = Format(.Fields("ExpireDate"), "yyyy-mm-dd") '到期日期
- End If
- LrText(5).Text = Trim(.Fields("Payer") & "") '付款人
- LrText(6).Text = Trim(.Fields("ForeignCurrName") & "") '
- LrText(6).Tag = Trim(.Fields("ForeignCurrCode") & "") '
- LrText(7).Text = Trim(.Fields("YbSsJe") & "") '
- LrText(8).Text = Trim(.Fields("AccRate") & "") '
- LrText(9).Text = Trim(.Fields("BbSsJe") & "") '
- LrText(10).Text = Trim(.Fields("YbInterest") & "")
- LrText(11).Tag = Trim(.Fields("DeptCode") & "") '
- LrText(11).Text = Trim(.Fields("DeptName") & "") '
- LrText(12).Tag = Trim(.Fields("PersonCode") & "") '
- LrText(12).Text = Trim(.Fields("PersonName") & "") '
- LrText(13).Text = Trim(.Fields("Digest") & "") '备注
- LrText(14).Text = Trim(.Fields("Maker") & "") '制单人
- LrText(15).Text = Trim(.Fields("Checker") & "") '审核人
- TextChangeLock = False '文本框解锁
- Call Sub_GetAccRate(LrText(6).Tag, Bln_ConVertFlag, Dbl_AccRate) '取外币记帐汇率方式
- '<<]
- End If
- End With
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Call Sub_CheckNoteStatus
- End Sub
- Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button) '用户点击工具条
- '屏蔽文本框,下拉组合框有效性判断
- Valilock = True
- '屏蔽网格失去焦点产生的有效性判断
- changelock = True
- Select Case Button.Key
- Case "yl" '预 览
- BillTextPrint Lab_Bill, LrText, TextGroupCode, "Ar_Note", False
- Case "dy" '打 印
- Dim yhAnswer As Integer '打印提示
- '用户确认是否打印单据
- Tsxx = "请确认是否打印当前单据?"
- yhAnswer = Xtxxts(Tsxx, 2, 2)
- If yhAnswer = 2 Then
- Exit Sub
- End If
- BillTextPrint Lab_Bill, LrText, TextGroupCode, "Ar_Note", 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 "Discount" '贴现
- Call Sub_NoteDiscount
- Case "Encash" '兑现
- Call Sub_NoteEncash
- Case "Endorse" '背书
- Call Sub_NoteEndorse
- Case "TurnOut" '转出
- Call Sub_NoteTurnOut
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- Unload Me
- Case "Voucher" '凭证
- Call Voucher
- 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("bz").Enabled = True '帮助
- .Buttons("fh").Enabled = True '退出
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- '设置单据处理状态
- Call Sub_CheckNoteStatus
- '设置文本框录入状态
- 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("bc").Enabled = True '保存
- .Buttons("fq").Enabled = True '放弃
- .Buttons("shsh").Enabled = False '审核
- .Buttons("Voucher").Enabled = False '凭证
- .Buttons("Encash").Enabled = False '兑现
- .Buttons("Discount").Enabled = False '贴现
- .Buttons("Endorse").Enabled = False '背书
- .Buttons("TurnOut").Enabled = False '转出
- '设置文本框录入状态
- 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("bc").Enabled = True '保存
- .Buttons("fq").Enabled = True '放弃
- .Buttons("shsh").Enabled = False '审核
- .Buttons("bz").Enabled = True '帮助
- .Buttons("fh").Enabled = True '退出
- .Buttons("Voucher").Enabled = False '凭证
- .Buttons("Encash").Enabled = False '兑现
- .Buttons("Discount").Enabled = False '贴现
- .Buttons("Endorse").Enabled = False '背书
- .Buttons("TurnOut").Enabled = False '转出
- '设置文本框录入状态
- Call Sub_LrtextStatus(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
- '自定义
- Frame1.Enabled = True
- '自定义
- Else
- For jsqte = Max_Text_Index To 0 Step -1
- LrText(jsqte).Enabled = False
- Next jsqte
- '自定义
- Frame1.Enabled = False
- '自定义
- End If
- End Sub
- Private Sub Sub_CheckStatus() '设置审核弃审按钮状态(亦可设置其他动作按钮状态)
- '根据当前单据状态来确定审核弃审按钮状态
- If Trim(LrText(14).Text) <> "" And Trim(LrText(15).Text) = "" Then '单据未审核
- Tlb_Action.Buttons("shsh").Enabled = True '审核
- End If
- If Trim(LrText(14).Text) <> "" And Trim(LrText(15).Text) <> "" Then '单据已审核
- Tlb_Action.Buttons("shsh").Enabled = False '审核
- End If
- End Sub
- Private Sub Sub_AddBill() '新增一张单据
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim jsqte As Long '临时计数器
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ar_Note_Edit", Xtczybm, 1, True) Then
- Exit Sub
- End If
- '设置操作状态为新增(Fixed)
- Lab_OperStatus.Caption = "2"
- '设置工具条状态(Fixed)
- Call Sub_OperStatus("20")
- '清空VouchID(Fixed)
- Lab_BillId.Caption = ""
- '添
- Lab_NoteStatus.Caption = "" '记录票据状态
- '录入文本框清除内容
- For jsqte = Max_Text_Index To 0 Step -1
- LrText(jsqte).Tag = ""
- LrText(jsqte).Text = ""
- Next jsqte
- '[>>显示制单人,清空审核人,此处还可以设置录入默认值如自动生成单据号、默认单据录入日期注意加锁
- LrText(14).Text = Xtczy
- LrText(15).Text = ""
- '设置订单日期默认为系统业务日期
- TextChangeLock = True
- LrText(1).Text = Xtrq
- LrText(6).Text = XtSCurrName '币别名称
- LrText(6).Tag = XtSCurrCode '币别编码
- Call Sub_GetAccRate(LrText(6).Tag, Bln_ConVertFlag, Dbl_AccRate)
- LrText(8).Text = Dbl_AccRate
- 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("Ar_Note_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(14).Text = Xtczy
- End Sub
- Private Sub Sub_DeleteBill() '删除当前单据
- Dim YAnswer As Integer '确认是否删除当前单据
- Dim jsqte As Long '临时使用计数器
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ar_Note_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_Note Where NoteID=" & Val(Lab_BillId.Caption))
- Cw_DataEnvi.DataConnect.CommitTrans
- '标识单据发生改动
- Bln_BillChange = True
- '单据ID置0
- Lab_BillId.Caption = 0
- Lab_NoteStatus.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 "NoteID=" & Val(Lab_BillId.Caption)
- Exit Sub
- Swcwcl: '单据删除时出现错误
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "单据删除过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- Private Sub Sub_Prev() '上 张
- With Rec_Query
- If .RecordCount = 0 Then
- Exit Sub
- End If
- .MovePrevious
- If Not .BOF Then
- Lab_BillId.Caption = .Fields("NoteID")
- '添
- Lab_NoteStatus.Caption = Trim(.Fields("Fstatus"))
- 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
- .MoveNext
- If Not .EOF Then
- Lab_BillId.Caption = .Fields("NoteID")
- '添
- Lab_NoteStatus.Caption = Trim(.Fields("Fstatus"))
- Else
- .MovePrevious
- End If
- Call Sub_ShowBill
- End With
- End Sub
- Private Sub Sub_AbandonBill() '放弃对当前单据的操作
- Dim jsqte As Long '临时使用计数器
- '如果单据有效则重新显示当前单据,置单据为空状态
- If Not Rec_Query.EOF Then
- Lab_BillId.Caption = Rec_Query.Fields("NoteID")
- '添
- Lab_NoteStatus.Caption = Trim(Rec_Query.Fields("Fstatus"))
- Call Sub_ShowBill
- Else
- '单据ID置为0
- Lab_BillId.Caption = 0
- '添
- Lab_NoteStatus.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 '会计期间
- 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(6).Tag) <> XtSCurrCode Then
- If Val(LrText(8).Text) = 0 Then
- Tsxx = "汇率不能为零!"
- Call Xtxxts(Tsxx, 0, 1)
- LrText(8).SetFocus
- Exit Function
- End If
- Else
- LrText(8).Text = 1
- End If
- If Bln_ConVertFlag Then
- LrText(9).Text = Val(Format(Val(LrText(7).Text) / Val(LrText(8).Text), "##." + String(Xtjexsws, "0")))
- Else
- LrText(9).Text = Val(Format(Val(LrText(7).Text) * Val(LrText(8).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_Note Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_Bill
- .AddNew
- .Fields("NoteId") = CreatBillID(BillCode) '单据ID
- .Fields("NoteCode") = Trim(LrText(0).Text) '单据号
- .Fields("BillDate") = CDate(LrText(1).Text) '单据日期
- .Fields("PsCode") = Trim(LrText(2).Tag) '客户编码
- .Fields("SignDate") = CDate(LrText(3).Text) '签发日期
- .Fields("ExpireDate") = CDate(LrText(4).Text) '到期日期
- .Fields("Payer") = Trim(LrText(5).Text) '付款人
- .Fields("ForeignCurrCode") = Trim(LrText(6).Tag) '原币编码
- .Fields("YbSsJe") = Val(Val(LrText(7).Text)) '票面金额
- .Fields("AccRate") = Val(Trim(LrText(8).Text)) '记帐汇率
- .Fields("BbSsJe") = Val(Trim(LrText(9).Text)) '本币金额
- .Fields("YbInterest") = Val(Trim(LrText(10).Text)) '票面原币利息
- If Bln_ConVertFlag Then
- .Fields("BbInterest") = Val(Format(Val(LrText(10).Text) / Val(LrText(8).Text), "##." + String(Xtjexsws, "0")))
- Else
- .Fields("BbInterest") = Val(Format(Val(LrText(10).Text) * Val(LrText(8).Text), "##." + String(Xtjexsws, "0")))
- End If
- .Fields("DeptCode") = Trim(LrText(11).Tag) '部门
- .Fields("PersonCode") = Trim(LrText(12).Tag) '经办人
- .Fields("Digest") = Trim(LrText(13).Text) '备注
- .Fields("Maker") = Trim(LrText(14).Text) '制单人
- .Fields("Checker") = "" '审核人置空
- If Trim(Lab_Start.Caption) = "期初" Then
- .Fields("IfBuildVouch") = True '应收票据已生成凭证
- .Fields("StartFlag") = 1 '期初录入
- .Fields("KjYear") = Int_Kjyear '当前年度
- .Fields("Period") = 1 '第一会计期间
- Else
- .Fields("IfBuildVouch") = False
- .Fields("StartFlag") = 0 '非期初录入
- .Fields("KjYear") = Int_Kjyear
- .Fields("Period") = Int_Period
- End If
- .Fields("Fstatus") = 9 '=9表示收票状态
- '系统名
- .Fields("RPFlag") = "Ar"
- '单据类型
- If OptReceNoteType(1).Value = True Then
- .Fields("BillItemCode") = "01" '商业承兑汇票类型
- Else
- .Fields("BillItemCode") = "02" '银行承兑汇票类型
- End If
- '应收帐款科目
- .Fields("AccCodeArAp") = Fun_InputCodeCustomer(LrText(2).Tag, 0)
- '应收票据科目
- If OptReceNoteType(1).Enabled = True Then
- .Fields("AccCode") = Fun_GetInputCode("AR_CommNoteAccCode") '商业承兑汇票科目
- Else
- .Fields("AccCode") = Fun_GetInputCode("AR_BankNoteAccCode") '银行承兑汇票科目
- End If
- .Fields("AccCodeInterest") = Fun_GetInputCode("AR_NoteIntAccCode") '票据利息科目
- .Update
- '系统读出单据ID写入Lab_BillID
- Lab_BillId.Caption = .Fields("NoteID")
- '添
- Lab_NoteStatus.Caption = .Fields("Fstatus")
- End With
- Else
- '修改单据
- '打开单据表动态集
- If Rec_Bill.State = 1 Then Rec_Bill.Close
- Rec_Bill.Open "Select * From Rp_Note Where NoteID=" & Val(Lab_BillId.Caption), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_Bill
- .Fields("NoteCode") = Trim(LrText(0).Text) '单据号
- .Fields("BillDate") = CDate(LrText(1).Text) '单据日期
- .Fields("PsCode") = Trim(LrText(2).Tag) '客户编码
- .Fields("SignDate") = CDate(LrText(3).Text) '签发日期
- .Fields("ExpireDate") = CDate(LrText(4).Text) '到期日期
- .Fields("Payer") = Trim(LrText(5).Text) '付款人
- .Fields("ForeignCurrCode") = Trim(LrText(6).Tag) '原币编码
- .Fields("YbSsJe") = Val(Val(LrText(7).Text)) '票面金额
- .Fields("AccRate") = Val(Trim(LrText(8).Text)) '记帐汇率
- .Fields("BbSsJe") = Val(Trim(LrText(9).Text)) '本币金额
- .Fields("YbInterest") = Val(Trim(LrText(10).Text)) '票面原币利息
- If Bln_ConVertFlag Then
- .Fields("BbInterest") = Val(Format(Val(LrText(10).Text) / Val(LrText(8).Text), "##." + String(Xtjexsws, "0")))
- Else
- .Fields("BbInterest") = Val(Format(Val(LrText(10).Text) * Val(LrText(8).Text), "##." + String(Xtjexsws, "0")))
- End If
- .Fields("DeptCode") = Trim(LrText(11).Tag) '部门
- .Fields("PersonCode") = Trim(LrText(12).Tag) '经办人
- .Fields("Digest") = Trim(LrText(13).Text) '备注
- .Fields("Maker") = Trim(LrText(14).Text) '制单人
- .Fields("Checker") = "" '审核人置空
- If Lab_Start.Caption = "期初" Then
- .Fields("StartFlag") = 1 '期初录入
- .Fields("KjYear") = Int_Kjyear '当前年度
- .Fields("Period") = 1 '第一会计期间
- Else
- .Fields("StartFlag") = 0 '非期初录入
- .Fields("KjYear") = Int_Kjyear
- .Fields("Period") = Int_Period
- End If
- .Fields("Fstatus") = 9 '=9表示收票状态
- '系统名
- .Fields("RPFlag") = "Ar"
- '单据类型
- If OptReceNoteType(1).Value = True Then
- .Fields("BillItemCode") = "01" '商业承兑汇票类型
- Else
- .Fields("BillItemCode") = "02" '银行承兑汇票类型
- End If
- '应收帐款科目
- .Fields("AccCodeArAp") = Fun_InputCodeCustomer(LrText(2).Tag, 0)
- '应收票据科目
- If OptReceNoteType(1).Enabled = True Then
- .Fields("AccCode") = Fun_GetInputCode("AR_CommNoteAccCode") '商业承兑汇票科目
- Else
- .Fields("AccCode") = Fun_GetInputCode("AR_BankNoteAccCode") '银行承兑汇票科目
- End If
- .Fields("AccCodeInterest") = Fun_GetInputCode("AR_NoteIntAccCode") '票据利息科目
- .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 "NoteID=" & Val(Lab_BillId.Caption)
- Exit Function
- Swcwcl: '数据存盘时出现错误
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- End Function
- '[>>===================以下为根据实际业务需要自定义过程区域=============================<<]
- '审核,弃审
- Private Sub Sub_CheckBill() '审 核
- Dim RecTemp As New ADODB.Recordset
- '[>>
- '此处可以写入禁止单据审核的理由
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log("Ar_Note_Check", Xtczybm, 1, True) Then
- Exit Sub
- End If
- If Trim(Lab_Start.Caption) = "期初" Then '期初应收票据不必登记应收帐
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute("Select Checker From RP_Note Where NoteID='" & Val(Lab_BillId.Caption) & "'")
- If Not RecTemp.EOF Then
- If Trim(RecTemp.Fields("Checker") & "") <> "" Then
- Tsxx = "该单据已审核,不需再次审核!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- Else
- '将单据写入审核标识
- Cw_DataEnvi.DataConnect.Execute ("Update Rp_Note Set Checker='" & Xtczy & "' Where NoteID=" & Val(Lab_BillId.Caption))
- '写入系统操作员
- LrText(15).Text = Xtczy
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Call Sub_CheckNoteStatus
- '标识单据发生变化
- Bln_BillChange = True
- End If
- End If
- Else
- '加记帐过程的过程
- If Fun_CheckNote(Val(Lab_BillId.Caption)) = True Then '审核过帐
- '将单据写入审核标识
- Cw_DataEnvi.DataConnect.Execute ("Update Rp_Note Set Checker='" & Xtczy & "' Where NoteID=" & Val(Lab_BillId.Caption))
- '写入系统操作员
- LrText(15).Text = Xtczy
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Call Sub_CheckNoteStatus
- '标识单据发生变化
- Bln_BillChange = True
- End If
- End If
- End Sub
- Private Function Fun_AllowEdit() As Boolean '判断当前单据是否允许编辑或删除
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Fun_AllowEdit = False
- Sqlstr = "Select Checker,FStatus From Rp_Note Where NoteID=" & 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
- '添
- If Val(Trim(.Fields("FStatus") & "")) <> 9 Then
- Tsxx = "该票据已经变动,不能修改或删除!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- End If
- End With
- Fun_AllowEdit = True
- End Function
- '[>>===================以上为根据实际业务需要自定义过程区域=============================<<]
- '*****************************以下为文本框录入处理程序(固定不变部分)*******************************'
- '************以下为文本框录入处理程序(固定不变部分)*************'
- Private Sub Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- Select Case Index
- Case 6, 7, 8
- TextChangeLock = True
- If Index = 6 Then '币别
- If Trim(LrText(6).Tag) = XtSCurrCode Then
- LrText(8).Text = 1
- Else
- Call Sub_GetAccRate(LrText(6).Tag, Bln_ConVertFlag, Dbl_AccRate) '取外币记帐汇率
- If Dbl_AccRate <> 0 Then
- LrText(8).Text = Dbl_AccRate
- Else
- LrText(8).Text = ""
- End If
- End If
- End If
- If Bln_ConVertFlag Then
- If Val(LrText(8).Text) <> 0 Then
- Dbl_Bbje = Val(Format(Val(LrText(7).Text) / Val(LrText(8).Text), "##." + String(Xtjexsws, "0")))
- Else
- Dbl_Bbje = 0
- End If
- Else
- Dbl_Bbje = Val(Format(Val(LrText(7).Text) * Val(LrText(8).Text), "##." + String(Xtjexsws, "0")))
- End If
- LrText(9).Text = Dbl_Bbje
- 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)
- 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 '其他类型
- End Select
- '如果有效则加锁,用户不改变内容则不再进行有效性判断
- TextValiJudgeLock(Index) = True
- '调用文本框事后处理程序
- Call Wbklrwbcl(Index)
- '有效性判断通过则返回True
- TextYxxpd = True
- End Function
- Private Function NoteCheck() As Boolean
- NoteCheck = False
- '非有效单据不予进行操作
- If Val(Lab_BillId.Caption) = 0 Then
- Exit Function
- End If
- '单据发生变动,不允许进行操作
- If Val(Lab_NoteStatus.Caption) <> 9 Then
- Tsxx = "该单据已经发生变动,不能执行此操作!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Function
- End If
- If LrText(15).Text = "" Then
- Tsxx = "该单据没有审核,不能执行此操作!"
- Call Xtxxts(Tsxx, 0, 4)
- NoteCheck = False
- Exit Function
- End If
- NoteCheck = True
- End Function
- Private Sub Sub_NoteDiscount() '贴现,'要求票状为收票状态,且单据已审核
- If NoteCheck = True Then
- XT_BillID = Lab_BillId.Caption
- Note_FrmNoteDiscount.Show 1, Me
- If Xtfhcs = "1" Then '贴现成功'在应收票据中写贴现标志
- Cw_DataEnvi.DataConnect.Execute ("Update RP_Note set Fstatus=3 where NoteID='" & XT_BillID & "'")
- Lab_NoteStatus = "3"
- End If
- End If
- End Sub
- Private Sub Sub_NoteEncash() '兑现,'要求票状为收票状态,且单据已审核
- If NoteCheck = True Then
- XT_BillID = Lab_BillId.Caption
- Note_FrmNoteEncash.Show 1, Me
- If Xtfhcs = "1" Then '兑现成功'在应收票据中写贴现标志
- Cw_DataEnvi.DataConnect.Execute ("Update RP_Note set Fstatus=4 where NoteID='" & XT_BillID & "'")
- Lab_NoteStatus = "4"
- End If
- End If
- End Sub
- Private Sub Sub_NoteEndorse() '背书,'要求票状为收票状态,且单据已审核
- If NoteCheck = True Then
- XT_BillID = Lab_BillId.Caption
- Note_FrmNoteEndorse.Show 1, Me
- If Xtfhcs = "1" Then '背书成功'在应收票据中写贴现标志
- Cw_DataEnvi.DataConnect.Execute ("Update RP_Note set Fstatus=1 where NoteID='" & XT_BillID & "'")
- Lab_NoteStatus = "1"
- End If
- End If
- End Sub
- Private Sub Sub_NoteTurnOut() '转出,'要求票状为收票状态,且单据已审核
- If NoteCheck = True Then
- XT_BillID = Lab_BillId.Caption
- Note_FrmNoteTurnOut.Show 1, Me
- If Xtfhcs = "1" Then '转出成功'在应收票据中写转出标志
- Cw_DataEnvi.DataConnect.Execute ("Update RP_Note set Fstatus=2 where NoteID='" & XT_BillID & "'")
- Lab_NoteStatus = "2"
- End If
- End If
- End Sub
- Private Sub Sub_CheckNoteStatus() '根据票据状态,显示单据处理按钮
- Dim RecTemp As New ADODB.Recordset
- XT_BillID = Lab_BillId.Caption
- Sqlstr = "Select Fstatus,VouchId From Rp_Note Where NoteID='" & XT_BillID & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If RecTemp.EOF = True Then
- Exit Sub
- End If
- Select Case RecTemp.Fields("Fstatus")
- Case 9 '收票
- If LrText(15).Text = "" Then
- Tlb_Action.Buttons("Encash").Enabled = False '兑现
- Tlb_Action.Buttons("Endorse").Enabled = False '背书
- Tlb_Action.Buttons("TurnOut").Enabled = False '转出
- Tlb_Action.Buttons("Discount").Enabled = False '贴现
- Else
- Tlb_Action.Buttons("Encash").Enabled = True '兑现
- Tlb_Action.Buttons("Endorse").Enabled = True '背书
- Tlb_Action.Buttons("TurnOut").Enabled = True '转出
- Tlb_Action.Buttons("Discount").Enabled = True '贴现
- End If
- Case 1, 2, 3, 4
- Tlb_Action.Buttons("Encash").Enabled = False '兑现
- Tlb_Action.Buttons("Endorse").Enabled = False '背书
- Tlb_Action.Buttons("TurnOut").Enabled = False '转出
- Tlb_Action.Buttons("Discount").Enabled = False '贴现
- End Select
- If Val(Trim(RecTemp.Fields("VouchId") & "")) = 0 Then
- If LrText(15).Text = "" Then
- Tlb_Action.Buttons("Voucher").Enabled = False '不需要凭证处理
- Else
- Tlb_Action.Buttons("Voucher").Enabled = True '可以生成凭证
- End If
- Else
- Tlb_Action.Buttons("Voucher").Enabled = False '已经凭证处理
- End If
- End Sub
- Private Sub Voucher()
- If Trim(Lab_Start.Caption) = "期初" Then
- Tsxx = "期初票据不能制作凭证!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End If
- If Val(Lab_NoteStatus) <> 9 Then
- Tsxx = "票据已发生变动,不能制作凭证!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End If
- End Sub