b
资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:63k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form FrmJljy_StoDemotion
- BackColor = &H00E9F4FA&
- BorderStyle = 1 'Fixed Single
- Caption = "降等使用报告单"
- ClientHeight = 6120
- ClientLeft = 675
- ClientTop = 720
- ClientWidth = 8220
- Icon = "b进料检验管理_降等使用报告单录入.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6120
- ScaleWidth = 8220
- StartUpPosition = 1 '所有者中心
- Begin VB.ComboBox Cbo_Result
- Height = 300
- Left = 3120
- Style = 2 'Dropdown List
- TabIndex = 10
- Top = 1440
- Width = 1485
- End
- Begin VB.CommandButton Ydcommand1
- Height = 300
- Index = 0
- Left = 7710
- Style = 1 'Graphical
- TabIndex = 8
- Top = 660
- Visible = 0 'False
- Width = 300
- End
- Begin VB.Timer Timer1
- Interval = 1
- Left = 9690
- Top = 150
- End
- Begin VB.TextBox LrText
- ForeColor = &H00000000&
- Height = 300
- Index = 0
- Left = 990
- MultiLine = -1 'True
- TabIndex = 0
- Text = "b进料检验管理_降等使用报告单录入.frx":1042
- Top = 1470
- Width = 1650
- End
- Begin MSComctlLib.Toolbar Tlb_Action
- Align = 1 'Align Top
- Height = 570
- Left = 0
- TabIndex = 9
- Top = 0
- Width = 8220
- _ExtentX = 14499
- _ExtentY = 1005
- ButtonWidth = 820
- ButtonHeight = 953
- AllowCustomize = 0 'False
- Wrappable = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 20
- 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}
- Enabled = 0 'False
- Object.Visible = 0 'False
- 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}
- Caption = "弃审"
- Key = "shqs"
- ImageKey = "qs"
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh4"
- Style = 3
- EndProperty
- BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "首张"
- Key = "first"
- ImageKey = "first"
- EndProperty
- BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "上张"
- Key = "prev"
- ImageKey = "prev"
- EndProperty
- BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "下张"
- Key = "next"
- ImageKey = "next"
- EndProperty
- BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "末张"
- Key = "last"
- ImageKey = "last"
- EndProperty
- BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh5"
- Style = 3
- EndProperty
- BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.ImageList ImageList1
- Left = 0
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 37
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":1044
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":13DE
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":1778
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":1B12
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":1EAC
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":2246
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":25E0
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":297A
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":2D14
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":30AE
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":3448
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":37E2
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":3B7C
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":3F16
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":42B0
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":464A
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":49E4
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":4D7E
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":5118
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":54B2
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":584C
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":5BE6
- Key = "sc"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":5F80
- Key = "sx"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":631A
- Key = "cx"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":66B4
- Key = "zd"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":6A4E
- Key = "dz"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":6DE8
- Key = "ph"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":7182
- Key = "fz"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":751C
- Key = "dw"
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":78B6
- Key = "hf"
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":7C50
- Key = "pz"
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":7FEA
- Key = "check"
- EndProperty
- BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":8384
- Key = "qs"
- EndProperty
- BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":871E
- Key = "fullcheck"
- EndProperty
- BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":8AB8
- Key = "qq"
- EndProperty
- BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":8E52
- Key = "bcw"
- EndProperty
- BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "b进料检验管理_降等使用报告单录入.frx":91EC
- Key = "ye"
- EndProperty
- EndProperty
- End
- 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 = 7
- Top = 750
- Width = 2520
- End
- Begin VB.Label Lab_BillId
- AutoSize = -1 'True
- BackColor = &H0080C0FF&
- Height = 270
- Left = 6390
- TabIndex = 6
- Top = 1320
- 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 = 7710
- TabIndex = 4
- Top = 1260
- 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 = 180
- Index = 0
- Left = 210
- TabIndex = 1
- Top = 1530
- Width = 765
- End
- End
- Attribute VB_Name = "FrmJljy_StoDemotion"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '***********************************************************************************************************
- '* 模 块 名 称 :降等使用报告单
- '* 功 能 描 述 :此功能模块主要完成单据录入、修改、删除、预览打印等。
- '* 程序员姓名 :张晶石
- '* 最后修改人 :
- '* 最后修改时间:2002/02/24
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '*
- '* 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 IsXz As Boolean '新增单据时调showbill的状态,控制显示制单人、审核人
- Dim Str_RightEdit As String '单据编辑(新增、修改、删除)权限索引
- Dim Str_RightCheck 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 = 20
- 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 = "1509"
- 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
- '单据权限索引设置
- Str_RightEdit = "Qc_StoDemotion_Edit"
- Str_RightCheck = "Qc_StoDemotion_Check"
- '以下为文本框处理程序(Fixed)
- TextGroupCode = Var_Bill(3)
- Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr()) '读入文本框录入信息
- Call Wbkcsh
- '单据变动置为False(Fixed)
- Bln_BillChange = False
- '调入数据初始化模块(Fixed)
- Cbo_Result.Move LrText(14).Left, LrText(14).Top, LrText(14).Width
- Cbo_Result.Clear
- Cbo_Result.AddItem "是"
- Cbo_Result.AddItem "否"
- Cbo_Result.ListIndex = 1
- IsXz = False
- 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
- End Sub
- Private Sub Sjcsh(Str_Pzclzt As String) '数据初始化模块(根据实际情况)
- Dim Sqlstr As String '查询单据列表条件
- '[>>根据实际情况初始化
- Select Case Str_Pzclzt
- Case "1" '填制单据
- '调入用户查询结果动态集
- Lab_BillId.Caption = XT_BillID
- Sqlstr = "SELECT * From QC_V_StockDemotion where StockCheckMainChecker<>''"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- '新增单据
- Call Sub_AddBill
- Lab_BillId.Caption = XT_BillID
- IsXz = False
- Call Sub_ShowBill
- Rec_Query.Find "StockCheckMainID=" & Val(Lab_BillId.Caption)
- Case "2" '查询单据(单据列表)
- '填充查询单据标识
- Lab_BillId.Caption = XT_BillID
- Str_QueryCondi = Xtcdcsfz
- IsXz = True
- Call Sub_ShowBill
- Call Sub_OperStatus("10")
- '调入用户查询结果动态集
- Sqlstr = "SELECT * From QC_V_StockDemotion " & Str_QueryCondi & " and StoDemotionID is not NULL "
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Rec_Query.Find "StockCheckMainID=" & 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 '临时计数器
- If Val(Lab_Djclzt.Caption) = 1 Then
- Sqlstr = "SELECT * FROM QC_V_StockDemotion Where StockCheckMainID=" & Val(Lab_BillId.Caption)
- Set Rectemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With Rectemp
- If Not .EOF Then
- '[>>显示单据
- TextChangeLock = True '文本框加锁
- LrText(0).Text = Trim(.Fields("mnumber") & "") '物料编码
- LrText(1).Text = Trim(.Fields("mName") & "") '物料名称
- LrText(2).Text = Trim(.Fields("Model") & "") '规格型号
- LrText(3).Text = Trim(.Fields("PurUnitName") & "") '计量单位
- LrText(4).Text = Trim(.Fields("SupplierName") & "") '供应商名称
- LrText(5).Text = Trim(.Fields("Quantity") & "") '数量
- LrText(6).Text = Format(Trim(.Fields("PurReciptDate") & ""), "yyyy-mm-dd") '进料日期
- LrText(7).Text = Trim(.Fields("AreaName") & "") '产地名称
- LrText(8).Text = Format(Trim(.Fields("stoCheckDate") & ""), "yyyy-mm-dd") '检验日期
- LrText(9).Text = Trim(.Fields("gradename") & "") '质量等级
- LrText(10).Text = Trim(.Fields("cgsy") & "") '采购质量和事由
- LrText(11).Text = Trim(.Fields("zgyj") & "") '总工程师意见
- LrText(12).Text = Trim(.Fields("zgzl") & "") '主管领导指令
- LrText(13).Text = Trim(.Fields("sccyj") & "") '生产技术处使用意见
- LrText(17).Text = Trim(.Fields("stockchecknum") & "") '单据号
- If IsXz = True Then
- LrText(15).Text = Trim(.Fields("Maker") & "") '制单人
- LrText(16).Text = Trim(.Fields("Checker") & "") '审核人
- End If
- Cbo_Result.Clear '
- Cbo_Result.AddItem "是"
- Cbo_Result.AddItem "否"
- If .Fields("ifuse") = 1 Then
- Cbo_Result.ListIndex = 0
- Else
- Cbo_Result.ListIndex = 1
- End If
- TextChangeLock = False '文本框解锁
- '<<]
- End If
- End With
- Else
- '本张单据查询字符串
- Sqlstr = "SELECT * FROM QC_V_StockDemotion Where StockCheckMainID=" & Val(Lab_BillId.Caption)
- Set Rectemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With Rectemp
- If Not .EOF Then
- '[>>显示单据
- TextChangeLock = True '文本框加锁
- LrText(0).Text = Trim(.Fields("mnumber") & "") '物料编码
- LrText(1).Text = Trim(.Fields("mName") & "") '物料名称
- LrText(2).Text = Trim(.Fields("Model") & "") '规格型号
- LrText(3).Text = Trim(.Fields("PurUnitName") & "") '计量单位
- LrText(4).Text = Trim(.Fields("SupplierName") & "") '供应商名称
- LrText(5).Text = Trim(.Fields("Quantity") & "") '数量
- LrText(6).Text = Format(Trim(.Fields("PurReciptDate") & ""), "yyyy-mm-dd") '进料日期
- LrText(7).Text = Trim(.Fields("AreaName") & "") '产地名称
- LrText(8).Text = Format(Trim(.Fields("stoCheckDate") & ""), "yyyy-mm-dd") '检验日期
- LrText(9).Text = Trim(.Fields("gradename") & "") '质量等级
- LrText(10).Text = Trim(.Fields("cgsy") & "") '采购质量和事由
- LrText(11).Text = Trim(.Fields("zgyj") & "") '总工程师意见
- LrText(12).Text = Trim(.Fields("zgzl") & "") '主管领导指令
- LrText(13).Text = Trim(.Fields("sccyj") & "") '生产技术处使用意见
- LrText(15).Text = Trim(.Fields("Maker") & "") '制单人
- LrText(16).Text = Trim(.Fields("Checker") & "") '审核人
- LrText(17).Text = Trim(.Fields("stockchecknum") & "") '单据号
- Cbo_Result.Clear '质量等级
- Cbo_Result.AddItem "是"
- Cbo_Result.AddItem "否"
- If Trim(.Fields("ifuse") & "") = "1" Then
- Cbo_Result.ListIndex = 0
- LrText(14).Text = "是"
- Else
- Cbo_Result.ListIndex = 1
- LrText(14).Text = "否"
- End If
- TextChangeLock = False '文本框解锁
- '<<]
- End If
- End With
- '设置审核弃审按钮状态
- 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 "shqs" '弃 审
- Call Sub_AbandonCheck
- 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)
- 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("shqs").Enabled = False '弃审
- .Buttons("first").Enabled = False '首张
- .Buttons("prev").Enabled = False '上张
- .Buttons("next").Enabled = False '下张
- .Buttons("last").Enabled = False '末张
- .Buttons("bz").Enabled = True '帮助
- .Buttons("fh").Enabled = True '退出
- '设置文本框录入状态
- Call Sub_LrtextStatus(True)
- Case "30" '修改((录入)调入修改功能、(列表)调入修改功能)
- '工具条
- .Buttons("dy").Enabled = False '打印
- .Buttons("yl").Enabled = False '预览
- .Buttons("xz").Enabled = False '新增
- .Buttons("xg").Enabled = False '修改
- .Buttons("sc").Enabled = False '删除
- .Buttons("bc").Enabled = True '保存
- .Buttons("fq").Enabled = True '放弃
- .Buttons("shsh").Enabled = False '审核
- .Buttons("shqs").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)
- 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
- Me.Cbo_Result.Enabled = True
- Else
- For Jsqte = Max_Text_Index To 0 Step -1
- LrText(Jsqte).Enabled = False
- Next Jsqte
- Me.Cbo_Result.Enabled = False
- End If
- End Sub
- Private Sub Sub_CheckStatus() '设置审核弃审按钮状态(亦可设置其他动作按钮状态)
- '根据当前单据状态来确定审核弃审按钮状态
- If Trim(LrText(16).Text) <> "" And Trim(LrText(17).Text) = "" Then
- Tlb_Action.Buttons("shsh").Enabled = True '审核
- Else
- Tlb_Action.Buttons("shsh").Enabled = False '审核
- End If
- If Trim(LrText(16).Text) <> "" And Trim(LrText(17).Text) <> "" Then
- Tlb_Action.Buttons("shqs").Enabled = True '弃审
- Else
- Tlb_Action.Buttons("shqs").Enabled = False '弃审
- End If
- End Sub
- Private Sub Sub_AddBill() '新增一张单据
- Dim Rectemp As New ADODB.Recordset '临时使用动态集
- Dim Jsqte As Long '临时计数器
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, 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(15).Text = Xtczy
- LrText(16).Text = ""
- '<<]
- '让第一个录入项得到焦点(Fixed)
- On Error Resume Next
- LrText(10).SetFocus
- End Sub
- Private Sub Sub_EditBill() '修改一张单据
- Dim Rectemp As New ADODB.Recordset '临时使用动态集
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, 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(15).Text = Xtczy
- '让第一个录入项得到焦点
- On Error Resume Next
- LrText(10).SetFocus
- End Sub
- Private Sub Sub_DeleteBill() '删除当前单据
- Dim YAnswer As Integer '确认是否删除当前单据
- Dim Jsqte As Long '临时使用计数器
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, 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 QC_StoDemotion Where StockCheckMainID=" & 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 "StockCheckMainID=" & 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("StockCheckMainID")
- '[<<以下为自定义部分
- If Trim(Rec_Query.Fields("StoDemotionID") & "") = "" Then
- Lab_Djclzt.Caption = 1
- XT_BillID = Rec_Query.Fields("StockCheckMainID")
- Call Sjcsh(Trim(Lab_Djclzt.Caption))
- IsXz = False
- Call Sub_ShowBill
- Else
- IsXz = True
- Call Sub_ShowBill
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Tlb_Action.Buttons("xg").Enabled = True '修改
- Tlb_Action.Buttons("sc").Enabled = True '删除
- End If
- '>>]以上为自定义部分
- 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")
- If Trim(Rec_Query.Fields("StoDemotionID") & "") = "" Then
- Tlb_Action.Buttons("xg").Enabled = False '修改
- Tlb_Action.Buttons("sc").Enabled = False '删除
- Tlb_Action.Buttons("shsh").Enabled = False '审核
- Tlb_Action.Buttons("shqs").Enabled = False '弃审
- End If
- 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 '临时计数器
- 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
- '[>>
- '可在此区域写入其他对单据表头内容的有效性判断,具体格式参照如下
- '<<]
- '二.=============如果以上有效性检查均顺利通过,则执行存盘动作============'
- '对存盘进行事务处理(Fixed)
- On Error GoTo Swcwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- '判断单据状态以进行不同处理
- '1.先对单据主表进行处理
- If Trim(Lab_OperStatus) = "2" Then
- '新增单据
- '1.开始存盘
- '打开单据表动态集
- If Rec_Bill.State = 1 Then Rec_Bill.Close
- Rec_Bill.Open "Select * From QC_StoDemotion Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_Bill
- .AddNew
- .Fields("StoDemotionID") = CreatBillID(BillCode) '降等报告单单据ID
- .Fields("StockCheckMainID") = Val(Lab_BillId.Caption) '进料检验单单据ID
- .Fields("cgsy") = Trim(LrText(10).Text) '采购质量和事由
- .Fields("zgyj") = Trim(LrText(11).Text) '总工意见
- .Fields("zgzl") = Trim(LrText(12).Text) '主管指令
- .Fields("sccyj") = Trim(LrText(13).Text) '生产处意见
- If Cbo_Result.ListIndex = 0 Then
- .Fields("ifuse") = 1
- Else
- .Fields("ifuse") = 0
- End If
- .Fields("maker") = Xtczy '制单人
- .Fields("Checker") = "" '审核人置空
- .Update
- '系统读出单据ID写入Lab_BillID
- Lab_BillId.Caption = .Fields("StockCheckMainID")
- End With
- Else
- '修改单据
- '打开单据表动态集
- If Rec_Bill.State = 1 Then Rec_Bill.Close
- Rec_Bill.Open "Select * From QC_StoDemotion Where StockCheckMainID=" & Val(Lab_BillId.Caption), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_Bill
- .Fields("cgsy") = Trim(LrText(10).Text) '采购质量和事由
- .Fields("zgyj") = Trim(LrText(11).Text) '总工意见
- .Fields("zgzl") = Trim(LrText(12).Text) '主管指令
- .Fields("sccyj") = Trim(LrText(13).Text) '生产处意见
- If Cbo_Result.ListIndex = 0 Then
- .Fields("ifuse") = 1
- Else
- .Fields("ifuse") = 0
- End If
- .Fields("maker") = Xtczy '制单人
- .Fields("Checker") = "" '审核人置空
- .Update
- End With
- End If
- Cw_DataEnvi.DataConnect.CommitTrans
- Sub_SaveBill = True
- Tsxx = "单据存盘完毕!"
- Call Xtxxts(Tsxx, 0, 4)
- '标识单据发生改动
- Bln_BillChange = True
- '设置单据改变后的状态
- Lab_OperStatus = "1"
- Call Sub_OperStatus("10")
- Rec_Query.Requery
- Rec_Query.Find "StockCheckMainID=" & Val(Lab_BillId.Caption)
- Exit Function
- Swcwcl: '数据存盘时出现错误
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- End Function
- '选择首张,上张,下张,末张(此4个过程只需用您的单据ID字段名替换"StockCheckMainID"即可)
- Private Sub Sub_First() '首 张
- With Rec_Query
- If .RecordCount = 0 Then
- Exit Sub
- End If
- .MoveFirst
- Lab_BillId.Caption = .Fields("StockCheckMainID")
- '[<<以下为自定义部分
- If Trim(.Fields("StoDemotionID") & "") = "" Then
- Lab_Djclzt.Caption = 1
- XT_BillID = .Fields("StockCheckMainID")
- Call Sjcsh(Trim(Lab_Djclzt.Caption))
- IsXz = False
- Call Sub_ShowBill
- Else
- IsXz = True
- Call Sub_ShowBill
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Tlb_Action.Buttons("xg").Enabled = True '修改
- Tlb_Action.Buttons("sc").Enabled = True '删除
- End If
- '>>]以上为自定义部分
- 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("StockCheckMainID")
- Else
- .MoveNext
- End If
- '[<<以下为自定义部分
- If Trim(.Fields("StoDemotionID") & "") = "" Then
- Lab_Djclzt.Caption = 1
- XT_BillID = .Fields("StockCheckMainID")
- Call Sjcsh(Trim(Lab_Djclzt.Caption))
- IsXz = False
- Call Sub_ShowBill
- Else
- IsXz = True
- Call Sub_ShowBill
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Tlb_Action.Buttons("xg").Enabled = True '修改
- Tlb_Action.Buttons("sc").Enabled = True '删除
- End If
- '>>]以上为自定义部分
- 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("StockCheckMainID")
- Else
- .MovePrevious
- End If
- '[<<以下为自定义部分
- If Trim(.Fields("StoDemotionID") & "") = "" Then
- Lab_Djclzt.Caption = 1
- XT_BillID = .Fields("StockCheckMainID")
- Call Sjcsh(Trim(Lab_Djclzt.Caption))
- IsXz = False
- Call Sub_ShowBill
- Else
- IsXz = True
- Call Sub_ShowBill
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Tlb_Action.Buttons("xg").Enabled = True '修改
- Tlb_Action.Buttons("sc").Enabled = True '删除
- End If
- '>>]以上为自定义部分
- End With
- End Sub
- Private Sub Sub_Last() '末 张
- With Rec_Query
- If .RecordCount = 0 Then
- Exit Sub
- End If
- .MoveLast
- Lab_BillId.Caption = .Fields("StockCheckMainID")
- '[<<以下为自定义部分
- If Trim(.Fields("StoDemotionID") & "") = "" Then
- Lab_Djclzt.Caption = 1
- XT_BillID = .Fields("StockCheckMainID")
- Call Sjcsh(Trim(Lab_Djclzt.Caption))
- IsXz = False
- Call Sub_ShowBill
- Else
- IsXz = True
- Call Sub_ShowBill
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- Tlb_Action.Buttons("xg").Enabled = True '修改
- Tlb_Action.Buttons("sc").Enabled = True '删除
- End If
- '>>]以上为自定义部分
- End With
- End Sub
- '[>>===================以下为根据实际业务需要自定义过程区域=============================<<]
- '审核,弃审
- Private Sub Sub_CheckBill() '审 核
- '[>>
- '此处可以写入禁止单据审核的理由
- '<<]
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightCheck, Xtczybm, 1, True) Then
- Exit Sub
- End If
- '将单据写入审核标识
- Cw_DataEnvi.DataConnect.Execute ("Update QC_StoDemotion Set Checker='" & Xtczy & "' Where StockCheckMainID=" & Val(Lab_BillId.Caption))
- '写入系统操作员
- LrText(16).Text = Xtczy
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- '标识单据发生变化
- Bln_BillChange = True
- End Sub
- Private Sub Sub_AbandonCheck() '弃 审
- '[>>
- '此处可以写入禁止单据弃审的理由
- '<<]
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightCheck, Xtczybm, 1, True) Then
- Exit Sub
- End If
- '将单据清除审核标识
- Cw_DataEnvi.DataConnect.Execute ("Update QC_StoDemotion Set Checker='' Where StockCheckMainID=" & Val(Lab_BillId.Caption))
- '清空单据审核人
- LrText(16).Text = ""
- '设置审核弃审按钮状态
- Call Sub_CheckStatus
- '标识单据发生变化
- Bln_BillChange = True
- End Sub
- Private Function Fun_AllowEdit() As Boolean '判断当前单据是否允许编辑或删除
- Dim Rectemp As New ADODB.Recordset '临时使用动态集
- Fun_AllowEdit = False
- Sqlstr = "Select Checker From QC_V_StockDemotion Where StockCheckMainID=" & 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 Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- ']以上为依据实际情况自定义部分
- 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) '文本框失去焦点
- '显示相应信息但不能进行有效性判断
- 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)
- '[<<
- If Jsqte = 10 Or Jsqte = 11 Or Jsqte = 12 Or Jsqte = 13 Then '使高度增加2倍
- LrText(Jsqte).Height = LrText(Jsqte).Height * 2
- End If
- '>>]
- 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