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

企业管理

开发平台:

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