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

企业管理

开发平台:

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