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

企业管理

开发平台:

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