上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:57k
源码类别:

企业管理

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
  3. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
  4. Begin VB.Form Oper_Bqgzllr 
  5.    BorderStyle     =   3  'Fixed Dialog
  6.    Caption         =   "本期工作量录入"
  7.    ClientHeight    =   6990
  8.    ClientLeft      =   45
  9.    ClientTop       =   330
  10.    ClientWidth     =   10860
  11.    HelpContextID   =   504001
  12.    Icon            =   "本期工作量录入.frx":0000
  13.    KeyPreview      =   -1  'True
  14.    LinkTopic       =   "Form1"
  15.    LockControls    =   -1  'True
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   6990
  19.    ScaleWidth      =   10860
  20.    ShowInTaskbar   =   0   'False
  21.    StartUpPosition =   2  '屏幕中心
  22.    Begin VB.CommandButton Ydcommand 
  23.       Height          =   300
  24.       Left            =   10530
  25.       Picture         =   "本期工作量录入.frx":1042
  26.       Style           =   1  'Graphical
  27.       TabIndex        =   5
  28.       Top             =   1830
  29.       Visible         =   0   'False
  30.       Width           =   300
  31.    End
  32.    Begin VB.Timer Timer1 
  33.       Interval        =   1
  34.       Left            =   10020
  35.       Top             =   1410
  36.    End
  37.    Begin VB.ComboBox YdCombo 
  38.       Height          =   300
  39.       Left            =   8790
  40.       Style           =   2  'Dropdown List
  41.       TabIndex        =   4
  42.       Top             =   1830
  43.       Visible         =   0   'False
  44.       Width           =   1695
  45.    End
  46.    Begin VB.TextBox Ydtext 
  47.       BackColor       =   &H00C0FFFF&
  48.       BorderStyle     =   0  'None
  49.       Height          =   300
  50.       Left            =   8790
  51.       MultiLine       =   -1  'True
  52.       TabIndex        =   3
  53.       Top             =   1440
  54.       Visible         =   0   'False
  55.       Width           =   1185
  56.    End
  57.    Begin VB.PictureBox Pic_Title 
  58.       BackColor       =   &H00FFFFFF&
  59.       Height          =   765
  60.       Left            =   60
  61.       Picture         =   "本期工作量录入.frx":13CC
  62.       ScaleHeight     =   705
  63.       ScaleWidth      =   10725
  64.       TabIndex        =   1
  65.       Top             =   570
  66.       Width           =   10785
  67.       Begin VB.Label tsLabel 
  68.          AutoSize        =   -1  'True
  69.          BackColor       =   &H80000018&
  70.          BackStyle       =   0  'Transparent
  71.          Caption         =   "本期工作量录入"
  72.          BeginProperty Font 
  73.             Name            =   "宋体"
  74.             Size            =   12
  75.             Charset         =   134
  76.             Weight          =   700
  77.             Underline       =   0   'False
  78.             Italic          =   0   'False
  79.             Strikethrough   =   0   'False
  80.          EndProperty
  81.          ForeColor       =   &H00000000&
  82.          Height          =   240
  83.          Index           =   4
  84.          Left            =   540
  85.          TabIndex        =   2
  86.          Top             =   240
  87.          Width           =   1785
  88.       End
  89.    End
  90.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  91.       Height          =   5505
  92.       Left            =   60
  93.       TabIndex        =   0
  94.       Top             =   1380
  95.       Width           =   8625
  96.       _cx             =   5080
  97.       _cy             =   5080
  98.       Appearance      =   1
  99.       BorderStyle     =   1
  100.       Enabled         =   -1  'True
  101.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  102.          Name            =   "宋体"
  103.          Size            =   9
  104.          Charset         =   134
  105.          Weight          =   400
  106.          Underline       =   0   'False
  107.          Italic          =   0   'False
  108.          Strikethrough   =   0   'False
  109.       EndProperty
  110.       MousePointer    =   0
  111.       BackColor       =   16777215
  112.       ForeColor       =   -2147483640
  113.       BackColorFixed  =   12632256
  114.       ForeColorFixed  =   -2147483630
  115.       BackColorSel    =   -2147483635
  116.       ForeColorSel    =   -2147483634
  117.       BackColorBkg    =   -2147483636
  118.       BackColorAlternate=   16777215
  119.       GridColor       =   -2147483633
  120.       GridColorFixed  =   -2147483632
  121.       TreeColor       =   -2147483632
  122.       FloodColor      =   192
  123.       SheetBorder     =   -2147483642
  124.       FocusRect       =   1
  125.       HighLight       =   1
  126.       AllowSelection  =   -1  'True
  127.       AllowBigSelection=   -1  'True
  128.       AllowUserResizing=   0
  129.       SelectionMode   =   0
  130.       GridLines       =   1
  131.       GridLinesFixed  =   2
  132.       GridLineWidth   =   1
  133.       Rows            =   50
  134.       Cols            =   10
  135.       FixedRows       =   1
  136.       FixedCols       =   1
  137.       RowHeightMin    =   0
  138.       RowHeightMax    =   0
  139.       ColWidthMin     =   0
  140.       ColWidthMax     =   0
  141.       ExtendLastCol   =   0   'False
  142.       FormatString    =   ""
  143.       ScrollTrack     =   0   'False
  144.       ScrollBars      =   3
  145.       ScrollTips      =   0   'False
  146.       MergeCells      =   0
  147.       MergeCompare    =   0
  148.       AutoResize      =   -1  'True
  149.       AutoSizeMode    =   0
  150.       AutoSearch      =   0
  151.       AutoSearchDelay =   2
  152.       MultiTotals     =   -1  'True
  153.       SubtotalPosition=   1
  154.       OutlineBar      =   0
  155.       OutlineCol      =   0
  156.       Ellipsis        =   0
  157.       ExplorerBar     =   0
  158.       PicturesOver    =   0   'False
  159.       FillStyle       =   0
  160.       RightToLeft     =   0   'False
  161.       PictureType     =   0
  162.       TabBehavior     =   0
  163.       OwnerDraw       =   0
  164.       Editable        =   0
  165.       ShowComboButton =   1
  166.       WordWrap        =   0   'False
  167.       TextStyle       =   0
  168.       TextStyleFixed  =   0
  169.       OleDragMode     =   0
  170.       OleDropMode     =   0
  171.       DataMode        =   0
  172.       VirtualData     =   -1  'True
  173.       DataMember      =   ""
  174.       ComboSearch     =   3
  175.       AutoSizeMouse   =   -1  'True
  176.       FrozenRows      =   0
  177.       FrozenCols      =   0
  178.       AllowUserFreezing=   0
  179.       BackColorFrozen =   0
  180.       ForeColorFrozen =   0
  181.       WallPaperAlignment=   9
  182.       AccessibleName  =   ""
  183.       AccessibleDescription=   ""
  184.       AccessibleValue =   ""
  185.       AccessibleRole  =   24
  186.       Begin MSComctlLib.ImageList ImageList1 
  187.          Left            =   9120
  188.          Top             =   780
  189.          _ExtentX        =   1005
  190.          _ExtentY        =   1005
  191.          BackColor       =   -2147483643
  192.          ImageWidth      =   16
  193.          ImageHeight     =   16
  194.          MaskColor       =   12632256
  195.          _Version        =   393216
  196.          BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  197.             NumListImages   =   29
  198.             BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  199.                Picture         =   "本期工作量录入.frx":1E30C
  200.                Key             =   "sz"
  201.             EndProperty
  202.             BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  203.                Picture         =   "本期工作量录入.frx":1E6A6
  204.                Key             =   "dy"
  205.             EndProperty
  206.             BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  207.                Picture         =   "本期工作量录入.frx":1EA40
  208.                Key             =   "yl"
  209.             EndProperty
  210.             BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  211.                Picture         =   "本期工作量录入.frx":1EDDA
  212.                Key             =   "xg"
  213.             EndProperty
  214.             BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  215.                Picture         =   "本期工作量录入.frx":1F174
  216.                Key             =   "zh"
  217.             EndProperty
  218.             BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  219.                Picture         =   "本期工作量录入.frx":1F50E
  220.                Key             =   "sh"
  221.             EndProperty
  222.             BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  223.                Picture         =   "本期工作量录入.frx":1F8A8
  224.                Key             =   "bc"
  225.             EndProperty
  226.             BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  227.                Picture         =   "本期工作量录入.frx":1FC42
  228.                Key             =   "fq"
  229.             EndProperty
  230.             BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  231.                Picture         =   "本期工作量录入.frx":1FFDC
  232.                Key             =   "bz"
  233.             EndProperty
  234.             BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  235.                Picture         =   "本期工作量录入.frx":20376
  236.                Key             =   "tc"
  237.             EndProperty
  238.             BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  239.                Picture         =   "本期工作量录入.frx":20710
  240.                Key             =   "bcgs"
  241.             EndProperty
  242.             BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  243.                Picture         =   "本期工作量录入.frx":20AAA
  244.                Key             =   "mrlk"
  245.             EndProperty
  246.             BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  247.                Picture         =   "本期工作量录入.frx":20E44
  248.                Key             =   "xsxm"
  249.             EndProperty
  250.             BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  251.                Picture         =   "本期工作量录入.frx":211DE
  252.                Key             =   "first"
  253.             EndProperty
  254.             BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  255.                Picture         =   "本期工作量录入.frx":21578
  256.                Key             =   "prev"
  257.             EndProperty
  258.             BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  259.                Picture         =   "本期工作量录入.frx":21912
  260.                Key             =   "next"
  261.             EndProperty
  262.             BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  263.                Picture         =   "本期工作量录入.frx":21CAC
  264.                Key             =   "last"
  265.             EndProperty
  266.             BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  267.                Picture         =   "本期工作量录入.frx":22046
  268.                Key             =   "xx"
  269.             EndProperty
  270.             BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  271.                Picture         =   "本期工作量录入.frx":223E0
  272.                Key             =   "define"
  273.             EndProperty
  274.             BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  275.                Picture         =   "本期工作量录入.frx":2277A
  276.                Key             =   "exec"
  277.             EndProperty
  278.             BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  279.                Picture         =   "本期工作量录入.frx":22B14
  280.                Key             =   "xz"
  281.             EndProperty
  282.             BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  283.                Picture         =   "本期工作量录入.frx":22EAE
  284.                Key             =   "sc"
  285.             EndProperty
  286.             BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  287.                Picture         =   "本期工作量录入.frx":23248
  288.                Key             =   "sx"
  289.             EndProperty
  290.             BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  291.                Picture         =   "本期工作量录入.frx":235E2
  292.                Key             =   "cx"
  293.             EndProperty
  294.             BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  295.                Picture         =   "本期工作量录入.frx":2397C
  296.                Key             =   "zd"
  297.             EndProperty
  298.             BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  299.                Picture         =   "本期工作量录入.frx":23D16
  300.                Key             =   "dz"
  301.             EndProperty
  302.             BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  303.                Picture         =   "本期工作量录入.frx":240B0
  304.                Key             =   "ph"
  305.             EndProperty
  306.             BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  307.                Picture         =   "本期工作量录入.frx":2444A
  308.                Key             =   "fz"
  309.             EndProperty
  310.             BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  311.                Picture         =   "本期工作量录入.frx":247E4
  312.                Key             =   "dw"
  313.             EndProperty
  314.          EndProperty
  315.       End
  316.    End
  317.    Begin MSComctlLib.Toolbar Tlb_Action 
  318.       Align           =   1  'Align Top
  319.       Height          =   555
  320.       Left            =   0
  321.       TabIndex        =   6
  322.       Top             =   0
  323.       Width           =   10860
  324.       _ExtentX        =   19156
  325.       _ExtentY        =   979
  326.       ButtonWidth     =   820
  327.       ButtonHeight    =   926
  328.       AllowCustomize  =   0   'False
  329.       Wrappable       =   0   'False
  330.       Appearance      =   1
  331.       Style           =   1
  332.       ImageList       =   "ImageList1"
  333.       _Version        =   393216
  334.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  335.          NumButtons      =   6
  336.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  337.             Caption         =   "设置"
  338.             Key             =   "ymsz"
  339.             Object.ToolTipText     =   "打印页面设置"
  340.             ImageKey        =   "sz"
  341.          EndProperty
  342.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  343.             Caption         =   "打印"
  344.             Key             =   "dy"
  345.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  346.             ImageKey        =   "dy"
  347.          EndProperty
  348.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  349.             Caption         =   "预览"
  350.             Key             =   "yl"
  351.             ImageKey        =   "yl"
  352.          EndProperty
  353.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  354.             Style           =   3
  355.          EndProperty
  356.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  357.             Caption         =   "帮助"
  358.             Key             =   "bz"
  359.             ImageKey        =   "bz"
  360.          EndProperty
  361.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  362.             Caption         =   "退出"
  363.             Key             =   "fh"
  364.             ImageKey        =   "tc"
  365.          EndProperty
  366.       EndProperty
  367.       BorderStyle     =   1
  368.       Begin MSComctlLib.Toolbar GsToolbar 
  369.          Height          =   525
  370.          Left            =   9120
  371.          TabIndex        =   7
  372.          Top             =   0
  373.          Width           =   1695
  374.          _ExtentX        =   2990
  375.          _ExtentY        =   926
  376.          ButtonWidth     =   1455
  377.          ButtonHeight    =   926
  378.          AllowCustomize  =   0   'False
  379.          Appearance      =   1
  380.          Style           =   1
  381.          ImageList       =   "ImageList1"
  382.          _Version        =   393216
  383.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  384.             NumButtons      =   2
  385.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  386.                Caption         =   "保存格式"
  387.                Key             =   "bcgs"
  388.                ImageKey        =   "bcgs"
  389.             EndProperty
  390.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  391.                Caption         =   "默认列宽"
  392.                Key             =   "hfmrgs"
  393.                ImageKey        =   "mrlk"
  394.             EndProperty
  395.          EndProperty
  396.       End
  397.    End
  398.    Begin VB.Label Lab_OperStatus 
  399.       BackColor       =   &H000080FF&
  400.       Caption         =   "1"
  401.       Height          =   345
  402.       Left            =   10500
  403.       TabIndex        =   8
  404.       Top             =   1440
  405.       Visible         =   0   'False
  406.       Width           =   345
  407.    End
  408. End
  409. Attribute VB_Name = "Oper_Bqgzllr"
  410. Attribute VB_GlobalNameSpace = False
  411. Attribute VB_Creatable = False
  412. Attribute VB_PredeclaredId = True
  413. Attribute VB_Exposed = False
  414. '**************************************************************************************
  415. '*    模 块 名 称 :本期工作量录入
  416. '*    功 能 描 述 :
  417. '*    程序员姓名  :徐衍民
  418. '*    最后修改人  :徐衍民
  419. '*    最后修改时间:2001/12/04
  420. '*    备        注:
  421. '***************************************************************************************
  422. '其它固定使用变量
  423. Dim Tsxx As String                              '系统信息提示(Fixed)
  424. Dim ReportTitle As String                       '报表主标题(Fixed)
  425. Dim job_temp As Double                          '工作量表数据集变量
  426. Dim Str_RightEdit As String                     '编辑(新增、修改、删除)权限索引
  427.    
  428. '以下为固定使用变量(网格)
  429. Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  430. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  431. Dim GridCode As String                          '显示网格网格代码
  432. Dim GridInf() As Variant                        '整个网格设置信息
  433. Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  434. Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  435. Dim Sfxshjwg As Boolean                         '是否显示合计网格
  436. Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  437. Dim Sjhgd As Double                             '网格数据行高度
  438. Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  439. Dim GridStr()  As String                        '网格列信息(字符型)
  440. Dim GridInt() As Integer                        '网格列信息(整型)
  441. Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  442. Dim Dqlrwgh As Long                             '当前录入数据网格行
  443. Dim Dqlrwgl As Long                             '当前录入数据网格列
  444. Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  445. Dim Dqlkwgl As Long                             '刚刚离开网格列
  446. Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  447. Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  448. Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  449. Dim Wbkbhlock As Boolean                        '文本框改变值锁
  450. Dim Changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  451. Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  452. Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  453. Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  454. Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  455. Dim Shsfts As Boolean                           '删除记录行是否提示
  456. Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  457. Private Sub Form_KeyPress(KeyAscii As Integer)      '限制录入字符"'"
  458.     Select Case KeyAscii
  459.         Case 39           '屏蔽字符"'"
  460.             KeyAscii = 0
  461.     End Select
  462.     
  463. End Sub
  464. Private Sub Form_Load()                              '窗 体 装 入
  465.   
  466.     '初始化各种锁值(Fixed)
  467.     Changelock = False             '网格行列改变控制锁
  468.     Gdtlock = False                '滚动条滚动控制
  469.     Yxxpdlock = True               '字段有效性判断锁
  470.     Hyxxpdlock = True              '行有效性判断锁
  471.     Wbkbhlock = False              '文本框内容改变锁
  472.      
  473.     '报表主标题及报表编码(Fixed)
  474.     ReportTitle = "本期工作量录入"
  475.     XtReportCode = "Gdzc_bqgzllr"
  476.     Load Dyymctbl
  477.     
  478.     '调 入 网 格(Fixed)
  479.     GridCode = "Gdzc_bqgzllr"      '网格属性编码
  480.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  481.     
  482.     Qslz = GridInf(1)
  483.     Sjhgd = GridInf(2)
  484.     Pmbcsjhs = GridInf(3)
  485.     Fzxwghs = GridInf(4)
  486.     Sfblbzkd = GridInf(5)
  487.     Shsfts = GridInf(6)
  488.     Sfxshjwg = GridInf(7)
  489.     Szzls = WglrGrid.Cols - 1
  490.     
  491.     '设置标题栏宽度、网格宽度高度(Fixed)
  492.     Pic_Title.Move 50, Pic_Title.Top, Me.Width - 150, Pic_Title.Height
  493.     WglrGrid.Move 50, Pic_Title.Top + Pic_Title.Height, Me.Width - 150
  494.     WglrGrid.Height = Me.Height - WglrGrid.Top - 380
  495.       
  496.     '生成查询结果
  497.     Call Sub_Query
  498.     
  499.     '设置状态为修改状态
  500.     Lab_OperStatus = "2"
  501.     
  502.     WglrGrid.SelectionMode = flexSelectionFree
  503.     
  504.     Str_RightEdit = "Gdzc_Activities_Edit"
  505.  
  506. End Sub
  507. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  508.     
  509.     If Not Fun_Drfrmyxxpd Then
  510.         Cancel = True
  511.         Exit Sub
  512.     End If
  513.     
  514.     '卸载打印页面窗体
  515.     Unload Dyymctbl
  516. End Sub
  517. Private Sub Sub_Query()                              '生成查询结果
  518.     Dim Sqlstr As String                           '临时使用字符串
  519.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  520.     Dim Jsqte As Long                              '临时计数器
  521.     
  522.     '禁止网格刷新动作,为加快网格显示速度(Fixed)
  523.     WglrGrid.Redraw = False
  524.         
  525.     '本张单据查询字符串
  526.     Sqlstr = "SELECT Gdzc_JobQuantity.CardCode, Gy_Department.DeptName," _
  527.         & "Gdzc_Sort.FASortName,Gdzc_Card.FAName, Gdzc_Card.SpecificationMode," _
  528.         & "Gdzc_Card.WriteDate,Gdzc_Card.Activities AS Job_Activities, Gdzc_JobQuantity.ActivitiesCurrently," _
  529.         & "Gdzc_Card.AcitvitiesSum FROM Gdzc_Card RIGHT OUTER JOIN Gdzc_JobQuantity ON " _
  530.         & "Gdzc_Card.CardCode = Gdzc_JobQuantity.CardCode LEFT OUTER JOIN Gdzc_Sort ON " _
  531.         & "Gdzc_Card.FASortCode = Gdzc_Sort.FASortCode LEFT OUTER JOIN Gy_Department ON " _
  532.         & "Gdzc_Card.DeptCode = Gy_Department.DeptCode"
  533.     Sqlstr = Sqlstr & " where Gdzc_Card.AcitvitiesSum<Gdzc_Card.Activities and Gdzc_JobQuantity.Year=" & Xtyear & " and Gdzc_JobQuantity.Period=" & Xtmm & " order by Gdzc_JobQuantity.CardCode"
  534.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  535.     
  536.     With RecTemp
  537.         WglrGrid.Rows = WglrGrid.FixedRows
  538.         If .EOF Then
  539.             WglrGrid.Redraw = True
  540.             Exit Sub
  541.         End If
  542.         Jsqte = WglrGrid.FixedRows
  543.         Do While Not .EOF
  544.             job_temp = .Fields("ActivitiesCurrently")
  545.             WglrGrid.AddItem ""
  546.             WglrGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("CardCode") & "")              '卡片编号
  547.             WglrGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("DeptName") & "")              '所属部门
  548.             WglrGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("FASortName") & "")            '资产类别
  549.             WglrGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("FAName") & "")                '资产名称
  550.             WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("SpecificationMode") & "")     '规格型号
  551.             WglrGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("WriteDate") & "")             '录入日期
  552.             WglrGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("Job_Activities") & "")        '工作总量
  553.             WglrGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("ActivitiesCurrently") & "")   '本期工作量
  554.             WglrGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("AcitvitiesSum") & "")         '累计工作总量
  555.             WglrGrid.TextMatrix(Jsqte, Sydz("010", GridStr(), Szzls)) = Trim(.Fields("AcitvitiesSum") & "")         '累计工作总量
  556.             WglrGrid.TextMatrix(Jsqte, Sydz("011", GridStr(), Szzls)) = Trim(.Fields("ActivitiesCurrently") & "")   '本期工作量
  557.             WglrGrid.RowHeight(Jsqte) = Sjhgd
  558.             .MoveNext
  559.             Jsqte = Jsqte + 1
  560.         Loop
  561.     End With
  562.     
  563.     '将网格刷新解禁(Fixed)
  564.     WglrGrid.Redraw = True
  565.     
  566.     '清空为零单元格
  567.     Call Txt_Clear
  568.        
  569. End Sub
  570. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  571.      
  572.     '屏蔽文本框,下拉组合框有效性判断
  573.     Valilock = True
  574.     
  575.     '屏蔽网格失去焦点产生的有效性判断
  576.     Changelock = True
  577.     
  578.     Select Case Button.Key
  579.         Case "ymsz"                                          '页面设置
  580.             Dyymctbl.Show 1
  581.         Case "yl"                                            '预 览
  582.             If Fun_Drfrmyxxpd Then
  583.                 Call bbyl(True)
  584.             End If
  585.         Case "dy"                                            '打 印
  586.             If Fun_Drfrmyxxpd Then
  587.                 Call bbyl(False)
  588.             End If
  589.         Case "bz"                                            '帮 助
  590.             Call F1bz
  591.         Case "fh"                                            '退 出
  592.             Unload Me
  593.     End Select
  594.     
  595.     '解 锁
  596.     Valilock = False
  597.     Changelock = False
  598.         
  599. End Sub
  600. Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)        '支持热键操作
  601.   
  602.     If Shift = 2 Then
  603.         Select Case UCase(Chr(KeyCode))
  604.             Case "P"                   'Ctrl+P 打印
  605.                 If Tlb_Action.Buttons("dy").Enabled Then
  606.                     Call bbyl(False)
  607.                 End If
  608.         End Select
  609.     End If
  610. End Sub
  611. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  612.  
  613.     Dim xswbrr As String
  614.     
  615.     With WglrGrid
  616.         Zdlrqnr = Trim(.Text)
  617.         xswbrr = Trim(.Text)
  618.         If GridBoolean(.Col, 3) Then   '列表框录入
  619.             '填充列表框程序
  620.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  621.         Else
  622.             Wbkbhlock = True
  623.             '====以下为用户自定义
  624.             Ydtext.Text = xswbrr
  625.             '====以上为用户自定义
  626.             Wbkbhlock = False
  627.             Ydtext.SelStart = Len(Ydtext.Text)
  628.         End If
  629.     End With
  630.     
  631. End Sub
  632. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long)        '录入数据字段有效性判断,同时进行字段录入事后处理
  633.     
  634.     Dim Str_JudgeText As String            '临时有效性判断字段内容
  635.     Dim Coljsq As Long                     '临时列计数器
  636.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  637.     Dim Dbl_Qcye As Double                 '临时期初余额
  638.  
  639.     With WglrGrid
  640.         '非录入状态有效性为合法
  641.         If Yxxpdlock Or .Row < .FixedRows Then
  642.             sjzdyxxpd = True
  643.             Exit Function
  644.         End If
  645.  
  646.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  647.         Select Case GridStr(Dqpdwgl, 1)
  648.             '以下为自定义部分[
  649.             '1.放置字段有效性判断程序
  650.             'Case "004"
  651.             '2.放置字段事后处理程序
  652.             '以上为自定义部分]
  653.         End Select
  654.      
  655.         '字段录入正确后为零字段清空
  656.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  657.     
  658.         sjzdyxxpd = True
  659.         Yxxpdlock = True
  660.         Exit Function
  661.     End With
  662. Lrcwcl:    '录入错误处理
  663.     With WglrGrid
  664.         Call Xtxxts(Tsxx, 0, 1)
  665.         Changelock = True
  666.         .Select Dqpdwgh, Dqpdwgl
  667.         Changelock = False
  668.         Call xswbk
  669.         sjzdyxxpd = False
  670.         Exit Function
  671.     End With
  672.     
  673. End Function
  674. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                  '录入数据行有效性判断,同时进行行处理
  675.  
  676.     Dim Lrywlz As Long                     '录入错误列值(Fixed)
  677.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  678.     Dim Sqlstr As String                   '临时查询字符串
  679.     Dim Str_Ccode As String                '临时索引编码
  680.     Dim Rs_Temp As ADODB.Recordset
  681.     With WglrGrid
  682.         '行没有发生变化则不进行有效性判断
  683.         If Hyxxpdlock Then
  684.             Sjhzyxxpd = True
  685.             Exit Function
  686.         End If
  687.     
  688.         '以下为自定义部分[
  689.         '1.1首先进行单个不能为空或不能为零判断(Fixed)
  690.         For Jsqte = Qslz To .Cols - 1
  691.             '字段不能为空
  692.             If GridInt(Jsqte, 5) = 1 Then
  693.                 If Len(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0 Then
  694.                     Tsxx = GridStr(Jsqte, 2)
  695.                     Lrywlz = Jsqte
  696.                     GoTo Lrcwcl
  697.                     Exit For
  698.                 End If
  699.             End If
  700.             
  701.             '字段不能为零
  702.             If GridInt(Jsqte, 5) = 2 Then
  703.                 If Val(Trim(.TextMatrix(Yxxpdh, Jsqte))) = 0 Then
  704.                     Tsxx = GridStr(Jsqte, 2)
  705.                     Lrywlz = Jsqte
  706.                     GoTo Lrcwcl
  707.                     Exit For
  708.                 End If
  709.             End If
  710.         Next Jsqte
  711.     
  712.     
  713.         '1.2进行其他有效性判断,编写格式同1.1
  714.                 
  715.         '2.放置行处理程序(当数据行通过有效性判断)
  716.            
  717.         Str_Ccode = Trim(.TextMatrix(Yxxpdh, Sydz("001", GridStr(), Szzls)))
  718.         
  719.         '累计工作量不能大于工作总量
  720.         If Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("009", GridStr(), Szzls))) > Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls))) Then
  721.             Tsxx = "本期工作量不能大于剩余工作量!"
  722.             Call Xtxxts(Tsxx, 0, 1)
  723.             WglrGrid.TextMatrix(Yxxpdh, Sydz("008", GridStr(), Szzls)) = ""
  724.             Exit Function
  725.         End If
  726.         
  727.         '取得工作量单位
  728.         Set Rs_Temp = New ADODB.Recordset
  729.         Rs_Temp.Open "select * from Gdzc_JobQuantity where CardCode='" & Str_Ccode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  730.         If Not Rs_Temp.EOF Then
  731.             Rs_Temp.MoveLast
  732.             Sqlstr = Rs_Temp!AcivitiesUnit
  733.         End If
  734.         Rs_Temp.Close
  735.         Set Rs_Temp = Nothing
  736.            
  737.         On Error GoTo Swcwcl
  738.     
  739.         Cw_DataEnvi.DataConnect.BeginTrans
  740.     
  741.         With RecTemp
  742.             '修改资产卡片表
  743.             If .State = 1 Then .Close
  744.             .Open "SELECT * FROM Gdzc_card WHERE CardCode='" & Str_Ccode & "'", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  745.              
  746.             If Not RecTemp.EOF Then
  747.                 .Fields("AcitvitiesSum") = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("009", GridStr(), Szzls)))   '累计工作量
  748.                 .Update
  749.             End If
  750.             
  751.             '追加工作量表
  752.             If .State = 1 Then .Close
  753.             .Open "select * from Gdzc_JobQuantity where cardcode='" & Str_Ccode & "' and Year=" & Xtyear & " and Period=" & Xtmm, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
  754.             If Not .EOF Then
  755.                 !AcivitiesUnit = Trim(Sqlstr)
  756.                 !ActivitiesCurrently = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("008", GridStr(), Szzls)))
  757.                 !AcivitiesAEnd = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))
  758.                 .Update
  759.             Else
  760.                 .AddNew
  761.                 !CardCode = Str_Ccode
  762.                 !Year = Xtyear
  763.                 !Period = Xtmm
  764.                 !AcivitiesUnit = Trim(Sqlstr)
  765.                 !ActivitiesCurrently = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("008", GridStr(), Szzls)))
  766.                 !AcivitiesAEnd = Val(WglrGrid.TextMatrix(Yxxpdh, Sydz("007", GridStr(), Szzls)))
  767.                 .Update
  768.             End If
  769.             .Close
  770.             
  771.         End With
  772.          
  773.         Cw_DataEnvi.DataConnect.CommitTrans
  774.          
  775.     End With
  776.     '以上为自定义部分]
  777.     
  778.     Sjhzyxxpd = True
  779.     Hyxxpdlock = True
  780.     Exit Function
  781. Swcwcl:
  782.     Cw_DataEnvi.DataConnect.RollbackTrans
  783.     Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
  784.     Call Xtxxts(Tsxx, 0, 1)
  785.     Exit Function
  786. Lrcwcl:      '录入错误处理
  787.     With WglrGrid
  788.         Call Xtxxts(Tsxx, 0, 1)
  789.         Changelock = True
  790.         .Select Yxxpdh, Lrywlz
  791.         Changelock = False
  792.         Call xswbk
  793.         Sjhzyxxpd = False
  794.         Exit Function
  795.     End With
  796.     
  797. End Function
  798. '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改(程序动作部分)======================='
  799. Private Sub Lrzdbz()                                                      '录入字段帮助
  800.   
  801.     If Not ydcommand.Visible Then
  802.         Exit Sub
  803.     End If
  804.    
  805.     With WglrGrid
  806.      
  807.         Valilock = True
  808.     
  809.         '处理通用部分
  810.         Changelock = True        '调入另外窗体必须加锁
  811.         Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
  812.         Changelock = False
  813.         
  814.         If Len(Xtfhcs) <> 0 Then
  815.             If GridInt(.Col, 7) = 0 Then
  816.                 Ydtext.Text = Xtfhcs
  817.             Else
  818.                 Ydtext.Text = Xtfhcsfz
  819.             End If
  820.         End If
  821.         
  822.         Valilock = False
  823.   
  824.         If Ydtext.Visible Then
  825.             Ydtext.SetFocus
  826.         End If
  827.     End With
  828.     
  829. End Sub
  830. Private Sub Form_Resize()                                                '窗体大小发生变化时,重新显示文本框
  831.     Call Cxxswbk
  832. End Sub
  833. Private Function Fun_Drfrmyxxpd() As Boolean                             '调入其它窗体或功能产生的有效性判断(包括数据回写)
  834.   
  835.     Fun_Drfrmyxxpd = True
  836.     
  837.     With WglrGrid
  838.    
  839.         '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
  840.   
  841.         If Ydtext.Visible Or YdCombo.Visible Then
  842.             Call Lrsjhx
  843.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  844.                 Fun_Drfrmyxxpd = False
  845.                 Exit Function
  846.             End If
  847.         End If
  848.    
  849.         '进行行有效性判断
  850.         If Not Sjhzyxxpd(.Row) Then
  851.             Fun_Drfrmyxxpd = False
  852.             Exit Function
  853.         End If
  854.     End With
  855.   
  856. End Function
  857. Private Sub WglrGrid_EnterCell()                                          '显示当前数据行相关信息
  858.     With WglrGrid
  859.         If .Row >= .FixedRows Then
  860.             '[>>
  861.                 '此处可以填写显示与此网格行相关信息
  862.             '<<]
  863.         End If
  864.     End With
  865.    
  866. End Sub
  867. Private Sub WglrGrid_GotFocus()                                           '网格得到焦点
  868.     '网格得到焦点,如果当前选择行为非数据行
  869.     '则调整当前焦点至有效数据行
  870.     With WglrGrid
  871.         If .Row < .FixedRows And .Rows > .FixedRows Then
  872.             Changelock = True
  873.             .Select .FixedRows, .Col
  874.             Changelock = False
  875.         End If
  876.         If .Col < Qslz Then
  877.             Changelock = True
  878.             .Select .Row, Qslz
  879.             Changelock = False
  880.         End If
  881.     End With
  882. End Sub
  883. Private Sub WglrGrid_LostFocus()                                          '录入网格失去焦点
  884.     '用以屏蔽调用其它窗体时发生网格失去焦点事件
  885.     If Changelock Then
  886.         Exit Sub
  887.     End If
  888.     '引发网格RowcolChange事件
  889.     With WglrGrid
  890.         If Not (Ydtext.Visible Or YdCombo.Visible) Then
  891.             .Select 0, 0
  892.         End If
  893.     End With
  894. End Sub
  895. Private Sub WglrGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)                                             '限制用户在录入过程中滚动鼠标
  896.     If Gdtlock Then
  897.         Exit Sub
  898.     End If
  899.  
  900.     With WglrGrid
  901.         If Ydtext.Visible Or YdCombo.Visible Then
  902.             Gdtlock = True
  903.             .TopRow = Dqtoprow
  904.             .LeftCol = Dqleftcol
  905.             Gdtlock = False
  906.             Exit Sub
  907.         End If
  908.     End With
  909.     
  910. End Sub
  911. Private Sub WglrGrid_LeaveCell()                                    '离开单元格
  912.     If Changelock Then
  913.         Exit Sub
  914.     End If
  915.     '记录刚刚离开网格单元的行列值
  916.     Dqlkwgh = WglrGrid.Row
  917.     Dqlkwgl = WglrGrid.Col
  918.     '判断是否需要录入数据回写
  919.     If Not (Ydtext.Visible Or YdCombo.Visible) Then
  920.         Exit Sub
  921.     End If
  922.     
  923.     Call Lrsjhx
  924.     
  925. End Sub
  926. Private Sub WglrGrid_RowColChange()                                '网格录入行列发生变化时,进行有效性判断
  927.    
  928.     Valilock = True       '屏蔽文本框失去焦点进行有效性判断
  929.     
  930.     With WglrGrid
  931.         If Changelock Then
  932.             Exit Sub
  933.         End If
  934.         If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  935.             Exit Sub
  936.         End If
  937.         If .Row <> Dqlkwgh Then
  938.             If Not Sjhzyxxpd(Dqlkwgh) Then
  939.                 Exit Sub
  940.             End If
  941.         End If
  942.     End With
  943.    
  944.     Call fhyxh
  945.     Call Xldql
  946.    
  947. End Sub
  948. Private Sub WglrGrid_DblClick()                                    '鼠标双击网格显示文本框
  949.   
  950.     With WglrGrid
  951.         Call xswbk
  952.     End With
  953.     
  954. End Sub
  955. Private Sub Ycwbk()                                                '隐藏文本框,帮助按钮,列表组合框
  956.     
  957.     Valilock = True
  958.     Ydtext.Visible = False
  959.     YdCombo.Visible = False
  960.     ydcommand.Visible = False
  961.     
  962. End Sub
  963. Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer)        '列表框移动
  964.     
  965.     With WglrGrid
  966.         Select Case KeyCode
  967.             Case vbKeyEscape                'ESC 键放弃录入
  968.                 Valilock = True
  969.                 .SetFocus
  970.                 Call Ycwbk
  971.                 Valilock = False
  972.                 
  973.             Case vbKeyReturn                '回 车 键 =13
  974.                 KeyCode = 0
  975.                 .SetFocus
  976.                 Call Lrsjhx
  977.                 Rowjsq = .Row
  978.                 Coljsq = .Col + 1
  979.                 If Coljsq > .Cols - 1 Then
  980.                     If Rowjsq < .Rows - 1 Then
  981.                         Rowjsq = Rowjsq + 1
  982.                     End If
  983.                     Coljsq = Qslz
  984.                 End If
  985.                 Do While Rowjsq <= .Rows - 1
  986.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  987.                         Coljsq = Coljsq + 1
  988.                         If Coljsq > .Cols - 1 Then
  989.                             Rowjsq = Rowjsq + 1
  990.                             Coljsq = Qslz
  991.                         End If
  992.                     Else
  993.                         Exit Do
  994.                     End If
  995.                 Loop
  996.                 .Select Rowjsq, Coljsq
  997.                 
  998.             Case vbKeyLeft                  '左 箭 头 =37
  999.                 If .Col - 1 = Qslz Then
  1000.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1001.                         GoTo jzzx
  1002.                     End If
  1003.                 End If
  1004.                 If .Col > Qslz Then
  1005.                     KeyCode = 0
  1006.                     .SetFocus
  1007.                     Call Lrsjhx
  1008.                     Coljsq = .Col - 1
  1009.                     Do While Coljsq > Qslz
  1010.                         If Coljsq - 1 = Qslz Then
  1011.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1012.                                 GoTo jzzx
  1013.                             End If
  1014.                         End If
  1015.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1016.                             Coljsq = Coljsq - 1
  1017.                         Else
  1018.                             Exit Do
  1019.                         End If
  1020.                     Loop
  1021.                     .Select .Row, Coljsq
  1022.                 End If
  1023.             Case vbKeyRight                 '右 箭 头 =39
  1024.                 KeyCode = 0
  1025.                 .SetFocus
  1026.                 Call Lrsjhx
  1027.                 Rowjsq = .Row
  1028.                 Coljsq = .Col + 1
  1029.                 If Coljsq > .Cols - 1 Then
  1030.                     If Rowjsq < .Rows - 1 Then
  1031.                         Rowjsq = Rowjsq + 1
  1032.                     End If
  1033.                     Coljsq = Qslz
  1034.                 End If
  1035.                 Do While Rowjsq <= .Rows - 1
  1036.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1037.                         Coljsq = Coljsq + 1
  1038.                         If Coljsq > .Cols - 1 Then
  1039.                             Rowjsq = Rowjsq + 1
  1040.                             Coljsq = Qslz
  1041.                         End If
  1042.                     Else
  1043.                         Exit Do
  1044.                     End If
  1045.                 Loop
  1046.                 .Select Rowjsq, Coljsq
  1047.         Case Else
  1048.     End Select
  1049.    
  1050. jzzx:
  1051.    
  1052.     End With
  1053.     
  1054. End Sub
  1055. Private Sub YdCombo_LostFocus()                    '列表框失去焦点
  1056.     
  1057.     With WglrGrid                                    '因为选中网格会先发生Rowcolchange事件置Valiock
  1058.         If Not Valilock Then                           '为TRUE
  1059.             Call Lrsjhx
  1060.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1061.                 Exit Sub
  1062.             End If
  1063.         End If
  1064.     End With
  1065.     
  1066. End Sub
  1067. Private Sub ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  1068.     Call Lrzdbz
  1069. End Sub
  1070. Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
  1071.    
  1072.     Dim Rowjsq As Long, Coljsq As Long
  1073.    
  1074.     With WglrGrid
  1075.         Select Case KeyCode
  1076.             Case vbKeyF2
  1077.                 Call Lrzdbz
  1078.             Case vbKeyEscape                'ESC 键放弃录入
  1079.                 Valilock = True
  1080.                 Call Ycwbk
  1081.                 .SetFocus
  1082.             Case vbKeyReturn                '回 车 键 =13
  1083.                 KeyCode = 0
  1084.                 .SetFocus
  1085.                 Call Lrsjhx
  1086.                 Rowjsq = .Row
  1087.                 Coljsq = .Col + 1
  1088.                 If Coljsq > .Cols - 1 Then
  1089.                     If Rowjsq < .Rows - 1 Then
  1090.                         Rowjsq = Rowjsq + 1
  1091.                     End If
  1092.                     Coljsq = Qslz
  1093.                 End If
  1094.                 Do While Rowjsq <= .Rows - 1
  1095.                     If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1096.                         Coljsq = Coljsq + 1
  1097.                         If Coljsq > .Cols - 1 Then
  1098.                             Rowjsq = Rowjsq + 1
  1099.                             Coljsq = Qslz
  1100.                         End If
  1101.                     Else
  1102.                         Exit Do
  1103.                     End If
  1104.                 Loop
  1105.                 If Rowjsq <= .Rows - 1 Then
  1106.                     .Select Rowjsq, Coljsq
  1107.                 End If
  1108.                 
  1109.             Case vbKeyUp                    '上 箭 头 =38
  1110.                 KeyCode = 0
  1111.                 .SetFocus
  1112.                 Call Lrsjhx
  1113.                 If .Row > .FixedRows Then
  1114.                     .Row = .Row - 1
  1115.                 End If
  1116.                 
  1117.             Case vbKeyDown                  '下 箭 头 =40
  1118.                 KeyCode = 0
  1119.                 .SetFocus
  1120.                 Call Lrsjhx
  1121.                 If .Row < .Rows - 1 Then
  1122.                     .Row = .Row + 1
  1123.                 End If
  1124.             Case vbKeyLeft                  '左 箭 头 =37
  1125.                 If .Col - 1 = Qslz Then
  1126.                     If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1127.                         GoTo jzzx
  1128.                     End If
  1129.                 End If
  1130.                 If Ydtext.SelStart = 0 And .Col > Qslz Then
  1131.                     KeyCode = 0
  1132.                     .SetFocus
  1133.                     Call Lrsjhx
  1134.                     Coljsq = .Col - 1
  1135.                     Do While Coljsq > Qslz
  1136.                         If Coljsq - 1 = Qslz Then
  1137.                             If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
  1138.                                 GoTo jzzx
  1139.                             End If
  1140.                         End If
  1141.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1142.                             Coljsq = Coljsq - 1
  1143.                         Else
  1144.                             Exit Do
  1145.                         End If
  1146.                     Loop
  1147.                     .Select .Row, Coljsq
  1148.                 End If
  1149. jzzx:
  1150.            
  1151.            
  1152.             Case vbKeyRight                 '右 箭 头 =39
  1153.                 wblong = Len(Ydtext.Text)
  1154.                 If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
  1155.                     KeyCode = 0
  1156.                     .SetFocus
  1157.                     Call Lrsjhx
  1158.                     Rowjsq = .Row
  1159.                     Coljsq = .Col + 1
  1160.                     If Coljsq > .Cols - 1 Then
  1161.                         If Rowjsq < .Rows - 1 Then
  1162.                             Rowjsq = Rowjsq + 1
  1163.                         End If
  1164.                         Coljsq = Qslz
  1165.                     End If
  1166.                     Do While Rowjsq <= .Rows - 1
  1167.                         If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1168.                             Coljsq = Coljsq + 1
  1169.                             If Coljsq > .Cols - 1 Then
  1170.                                 Rowjsq = Rowjsq + 1
  1171.                                 Coljsq = Qslz
  1172.                             End If
  1173.                         Else
  1174.                             Exit Do
  1175.                         End If
  1176.                     Loop
  1177.                     .Select Rowjsq, Coljsq
  1178.                 End If
  1179.             Case Else
  1180.         End Select
  1181.     End With
  1182.     
  1183. End Sub
  1184. Private Sub ydtext_KeyPress(KeyAscii As Integer)         '录入字符事中控制
  1185.     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1186. End Sub
  1187. Private Sub ydtext_Change()                              '录入事中变化处理
  1188.     '防止程序改变但不进行处理
  1189.     If Wbkbhlock Then
  1190.          Exit Sub
  1191.     End If
  1192.     With WglrGrid
  1193.         
  1194.         '限制字段录入长度
  1195.         Wbkbhlock = True
  1196.         
  1197.         Select Case GridInt(.Col, 1)
  1198.             Case 8, 11   '金额型
  1199.                 Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
  1200.             Case 9, 12   '数量型
  1201.                 Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
  1202.             Case 10      '单价型
  1203.                 Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
  1204.             Case Else    '其他类型
  1205.                 If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
  1206.                     Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
  1207.                 End If
  1208.         End Select
  1209.         
  1210.         .TextMatrix(.Row, 8) = Val(Ydtext.Text) + Val(.TextMatrix(.Row, 9)) - Val(job_temp)
  1211.         If Val(.TextMatrix(.Row, 8)) > Val(.TextMatrix(.Row, 6)) Then
  1212.             Tsxx = "累计工作量大于工作总量时,请先做“工作总量调整”资产变动!"
  1213.             Call Xtxxts(Tsxx, 0, 4)
  1214.             Ydtext.Text = ""
  1215.             Exit Sub
  1216.         End If
  1217.         Wbkbhlock = False
  1218.     End With
  1219.     
  1220. End Sub
  1221. Private Sub ydtext_LostFocus()            '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
  1222.   
  1223.     With WglrGrid
  1224.         If Not Valilock Then
  1225.             Call Lrsjhx
  1226.             If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
  1227.                 Exit Sub
  1228.             End If
  1229.             If Not Sjhzyxxpd(Dqlrwgh) Then
  1230.                 Exit Sub
  1231.             End If
  1232.         End If
  1233.     End With
  1234.   
  1235. End Sub
  1236. Private Sub xswbk()                       '在当前选中单元显示文本框,列表框,帮助按钮(通用)
  1237.     
  1238.     Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
  1239.     
  1240.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  1241.     If Not Fun_AllowInput Then
  1242.         Exit Sub
  1243.     End If
  1244.     
  1245.     '显示文本框前返回有效行列(解决滚动条问题)
  1246.     Call Xldqh
  1247.     Call Xldql
  1248.     
  1249.     '隐藏文本框,帮助按钮,列表组合框
  1250.     Call Ycwbk
  1251.     
  1252.     With WglrGrid
  1253.         Dqlrwgh = .Row
  1254.         Dqlrwgl = .Col
  1255.         If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1256.             Exit Sub
  1257.         End If
  1258.         
  1259.         Wbkpy = 30
  1260.         Wbkpy1 = 15
  1261.         
  1262.         On Error Resume Next
  1263.         
  1264.         If GridBoolean(.Col, 3) Then
  1265.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1266.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1267.             YdCombo.Width = .CellWidth - Wbkpy1
  1268.             Call Wbkcl
  1269.             YdCombo.Visible = True
  1270.             YdCombo.SetFocus
  1271.             ydcommand.Visible = False
  1272.             Ydtext.Visible = False
  1273.         Else
  1274.             If GridBoolean(.Col, 2) Then
  1275.                 ydcommand.Left = .Left + .CellLeft + .CellWidth - ydcommand.Width + Wbkpy
  1276.                 ydcommand.Top = .Top + .CellTop + .CellHeight - ydcommand.Height + Wbkpy
  1277.                 ydcommand.Visible = True
  1278.             Else
  1279.                 ydcommand.Visible = False
  1280.             End If
  1281.             
  1282.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1283.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1284.             If ydcommand.Visible Then
  1285.                 If Sfblbzkd Then
  1286.                     Ydtext.Width = .CellWidth - ydcommand.Width
  1287.                 Else
  1288.                     Ydtext.Width = .CellWidth - Wbkpy1
  1289.                 End If
  1290.             Else
  1291.                 Ydtext.Width = .CellWidth - Wbkpy1
  1292.             End If
  1293.             Ydtext.Height = .CellHeight - Wbkpy1
  1294.             
  1295.             If GridInt(.Col, 2) <> 0 Then
  1296.                 Ydtext.MaxLength = GridInt(.Col, 2)
  1297.             Else
  1298.                 Ydtext.MaxLength = 3000
  1299.             End If
  1300.             
  1301.             Call Wbkcl
  1302.             
  1303.             Ydtext.Visible = True
  1304.             Ydtext.SetFocus
  1305.         End If
  1306.         Dqtoprow = .TopRow
  1307.         Dqleftcol = .LeftCol
  1308.         
  1309.         '重置锁值
  1310.         Valilock = False
  1311.         Wbkbhlock = False
  1312.     End With
  1313.     
  1314. End Sub
  1315. Private Function Fun_AllowInput() As Boolean                           '当某种条件成立时禁止文本框激活使单据处于录入状态
  1316.    
  1317.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1318.     If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1319.         Exit Function
  1320.     End If
  1321.     
  1322.     '非当前期间不可以输入
  1323.     Dim rstemp As ADODB.Recordset
  1324.     
  1325.     Set rstemp = Cw_DataEnvi.DataConnect.Execute("select top 1 * from gy_kjrlb where gdzcjzbz='0'")
  1326.     If Not rstemp.EOF Then
  1327.         If Val(rstemp!KjYear) <> Val(Xtyear) Or Val(rstemp!Period) <> Val(Xtmm) Then
  1328.             Tsxx = "非当前会计期间不能进行录入工作量!"
  1329.             Call Xtxxts(Tsxx, 0, 1)
  1330.             Exit Function
  1331.         End If
  1332.     End If
  1333.     rstemp.Close
  1334.     Set rstemp = Nothing
  1335.     
  1336.     '如果单据操作状态为浏览状态则不能显示录入载体(通用)
  1337.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1338.         Exit Function
  1339.     End If
  1340.    
  1341.     '[>>
  1342.     
  1343.         '此处可以填写禁止文本框激活使单据处于录入状态的理由
  1344.    
  1345.     '<<]
  1346.    
  1347.     Fun_AllowInput = True
  1348.     
  1349. End Function
  1350. Private Sub Cxxswbk()                                                  'Formresize中重新显示文本框,列表框,帮助按钮(通用)
  1351.                    
  1352.     Dim Wbkpy As Integer, Wbkpy1 As Integer
  1353.     
  1354.     Wbkpy = 30
  1355.     Wbkpy1 = 15
  1356.     
  1357.     With WglrGrid
  1358.         If YdCombo.Visible Then
  1359.             YdCombo.Left = .CellLeft + .Left + Wbkpy
  1360.             YdCombo.Top = .CellTop + .Top + Wbkpy
  1361.             YdCombo.Width = .CellWidth - Wbkpy1
  1362.         End If
  1363.         If ydcommand.Visible Then
  1364.             ydcommand.Left = .Left + .CellLeft + .CellWidth - ydcommand.Width + Wbkpy
  1365.             ydcommand.Top = .Top + .CellTop + .CellHeight - ydcommand.Height + Wbkpy
  1366.         End If
  1367.         If Ydtext.Visible Then
  1368.             If ydcommand.Visible Then
  1369.                 If Sfblbzkd Then
  1370.                     Ydtext.Width = .CellWidth - ydcommand.Width
  1371.                 Else
  1372.                     Ydtext.Width = .CellWidth - Wbkpy1
  1373.                 End If
  1374.             Else
  1375.                 Ydtext.Width = .CellWidth - Wbkpy1
  1376.             End If
  1377.       
  1378.             Ydtext.Left = .CellLeft + .Left + Wbkpy
  1379.             Ydtext.Top = .CellTop + .Top + Wbkpy
  1380.             Ydtext.Height = .CellHeight - Wbkpy1
  1381.         End If
  1382.     End With
  1383. End Sub
  1384. Private Sub Lrsjhx()                                                             '文本框录入数据回写
  1385.   
  1386.     With WglrGrid
  1387.         If YdCombo.Visible Then
  1388.             .Text = Trim(YdCombo.Text)
  1389.         End If
  1390.         If Ydtext.Visible Then
  1391.             .Text = Trim(Ydtext.Text)
  1392.         End If
  1393.    
  1394.         '(如果字段录入内容发生变化,则打开有效性判断锁)
  1395.         If Zdlrqnr <> Trim(.Text) Then
  1396.             Yxxpdlock = False
  1397.             Hyxxpdlock = False
  1398.         End If
  1399.    
  1400.         '隐藏文本框,帮助按钮,列表组合框
  1401.         Call Ycwbk
  1402.    
  1403.     End With
  1404.     
  1405. End Sub
  1406. Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer)              '网格快捷键
  1407.   
  1408.     '如果单据操作状态为浏览状态则不能显示录入载体
  1409.     If Trim(Lab_OperStatus.Caption) = "1" Then
  1410.         Exit Sub
  1411.     End If
  1412.     Select Case KeyCode
  1413.         Case vbKeyF2                   '按F2键参照
  1414.             Call xswbk
  1415.             Call Lrzdbz
  1416.     End Select
  1417. End Sub
  1418. Private Sub WglrGrid_KeyPress(KeyAscii As Integer)                              '网格接受键盘录入
  1419.     '当某种条件成立时禁止文本框激活使单据处于录入状态
  1420.     If Not Fun_AllowInput Then
  1421.         Exit Sub
  1422.     End If
  1423.   
  1424.     With WglrGrid
  1425.   
  1426.         '屏 蔽 回 车 键
  1427.         If KeyAscii = vbKeyReturn Then
  1428.             KeyAscii = 0
  1429.             Rowjsq = .Row
  1430.             Coljsq = .Col + 1
  1431.             If Coljsq > .Cols - 1 Then
  1432.                 If Rowjsq < .Rows - 1 Then
  1433.                     Rowjsq = Rowjsq + 1
  1434.                 End If
  1435.                 Coljsq = Qslz
  1436.             End If
  1437.             Do While Rowjsq <= .Rows - 1
  1438.                 If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
  1439.                     Coljsq = Coljsq + 1
  1440.                     If Coljsq > .Cols - 1 Then
  1441.                         Rowjsq = Rowjsq + 1
  1442.                         Coljsq = Qslz
  1443.                     End If
  1444.                 Else
  1445.                     Exit Do
  1446.                 End If
  1447.             Loop
  1448.           
  1449.             If Rowjsq <= .Rows - 1 Then
  1450.                 .Select Rowjsq, Coljsq
  1451.             End If
  1452.        
  1453.             Exit Sub
  1454.        
  1455.         End If
  1456.      
  1457.         '接受用户录入
  1458.         Select Case KeyAscii
  1459.             Case 0 To 32             '用户输入KeyAscii为0-32的键 如空格
  1460.                 '显示录入载体
  1461.                 Call xswbk
  1462.             Case Else
  1463.                 
  1464.                 '防止非编辑字段SendKeys()出现死循环
  1465.                 If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
  1466.                     Exit Sub
  1467.                 End If
  1468.                 
  1469.                 '如果此字段为列表框录入则调入相应列表框
  1470.                 If GridBoolean(.Col, 3) Then
  1471.                    '列表框录入
  1472.                     Call xswbk
  1473.                 Else
  1474.                     Ydtext.Text = ""
  1475.             
  1476.                     '录入限制
  1477.                     Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
  1478.                     If KeyAscii = 0 Then
  1479.                         Exit Sub
  1480.                     End If
  1481.                     Call xswbk
  1482.                     Ydtext.Text = ""
  1483.                     Valilock = True
  1484.                     SendKeys Chr(KeyAscii), True
  1485.                     DoEvents
  1486.                     Valilock = False
  1487.                 End If
  1488.         End Select
  1489.     End With
  1490. End Sub
  1491. Private Sub Qkwlzd(sjh As Long, Sjl As Long)                            '清空为零字段
  1492.     
  1493.     If Not GridBoolean(Sjl, 5) Then
  1494.         Exit Sub
  1495.     End If
  1496.     
  1497.     With WglrGrid
  1498.         If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
  1499.             .TextMatrix(sjh, Sjl) = ""
  1500.         End If
  1501.     End With
  1502. End Sub
  1503. Private Sub fhyxh()                                                     '返回录入数据有效行,同时让得到焦点网格可见
  1504.     
  1505.     With WglrGrid
  1506.         If .Row >= .FixedRows Then
  1507.             Call Xldqh
  1508.         End If
  1509.     End With
  1510. End Sub
  1511. Private Sub Xldqh()                                                      '显露当前行
  1512.     
  1513.     Dim Toprowte As Long
  1514.     With WglrGrid
  1515.         Toprowte = 0
  1516.         Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
  1517.             Toprowte = .TopRow
  1518.             .TopRow = .TopRow + 1
  1519.         Loop
  1520.         Toprowte = 0
  1521.         Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
  1522.             Toprowte = .TopRow
  1523.             If .TopRow > 1 Then
  1524.                 .TopRow = .TopRow - 1
  1525.             End If
  1526.         Loop
  1527.     End With
  1528. End Sub
  1529. Private Sub Xldql()                                                                  '显露当前列
  1530.     
  1531.     Dim Leftcolte As Long
  1532.     With WglrGrid
  1533.         If .Col >= Qslz And .Col >= .FixedCols Then
  1534.             If .LeftCol > .Col Then
  1535.                 .LeftCol = .Col
  1536.             End If
  1537.             Leftcolte = 0
  1538.             Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
  1539.                 Leftcolte = .LeftCol
  1540.                 .LeftCol = .LeftCol + 1
  1541.             Loop
  1542.         End If
  1543.     End With
  1544. End Sub
  1545. Private Sub WglrGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)           '网格列发生移动时自动交换网格索引信息
  1546.     Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
  1547. End Sub
  1548. Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)   '表格格式设置(通用)
  1549.     
  1550.     Select Case Button.Key
  1551.         Case "bcgs"                                       '保存表格格式
  1552.             Call Bcwggs(WglrGrid, GridCode, GridStr())
  1553.         Case "hfmrgs"                                     '恢复默认格式
  1554.             Call Hfmrgs(WglrGrid, GridCode, GridStr())
  1555.     End Select
  1556. End Sub
  1557. Private Sub bbyl(bbylte As Boolean)                    '报表打印预览
  1558.     
  1559.     Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
  1560.     Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
  1561.     Bbxbtgs = 1                                          '报 表 小 标 题 行 数
  1562.     Bbbwhgs = 0                                          '报 表 表 尾 行 数
  1563.     ReDim Bbxbt(1 To Bbxbtgs)
  1564.     ReDim bbxbtzzxs(1 To Bbxbtgs)
  1565.     If Bbbwhgs <> 0 Then
  1566.         ReDim Bbbwh(1 To Bbbwhgs)
  1567.         ReDim Bbbwhzzxs(1 To Bbbwhgs)
  1568.     End If
  1569.     Bbzbt = ReportTitle
  1570.     Call Scyxsjb(WglrGrid)                               '生成报表数据
  1571.     Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
  1572.     If Not bbylte Then
  1573.         Unload DY_Tybbyldy
  1574.     End If
  1575. End Sub
  1576. '****************************************************
  1577. '[>>以下为自定义过程或函数
  1578. '为零时清空单元格
  1579. Function Txt_Clear()
  1580.     
  1581.     Dim Row_Integer, Col_Integer As Integer         '行数和列数变量
  1582.     
  1583.     For Row_Integer = WglrGrid.FixedRows To WglrGrid.Rows - 1
  1584.         For Col_Integer = 6 To WglrGrid.Cols - 1
  1585.             If Format(Val(WglrGrid.TextMatrix(Row_Integer, Col_Integer)), "0.00") = 0# Then
  1586.                 WglrGrid.TextMatrix(Row_Integer, Col_Integer) = ""
  1587.             End If
  1588.         Next Col_Integer
  1589.     Next Row_Integer
  1590.     
  1591. End Function
  1592. '<<]
  1593. '****************************************************