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

企业管理

开发平台:

Visual Basic

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