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

企业管理

开发平台:

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 KF_FrmPDD 
  5.    BackColor       =   &H00E9F4FA&
  6.    BorderStyle     =   1  'Fixed Single
  7.    Caption         =   "盘点单"
  8.    ClientHeight    =   6120
  9.    ClientLeft      =   510
  10.    ClientTop       =   1395
  11.    ClientWidth     =   11010
  12.    HelpContextID   =   1213008
  13.    Icon            =   "单据录入_盘点单.frx":0000
  14.    KeyPreview      =   -1  'True
  15.    LinkTopic       =   "Form4"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   6120
  19.    ScaleWidth      =   11010
  20.    Begin MSComctlLib.ProgressBar PB 
  21.       Height          =   195
  22.       Left            =   330
  23.       TabIndex        =   16
  24.       Top             =   5850
  25.       Visible         =   0   'False
  26.       Width           =   2325
  27.       _ExtentX        =   4101
  28.       _ExtentY        =   344
  29.       _Version        =   393216
  30.       Appearance      =   0
  31.       Scrolling       =   1
  32.    End
  33.    Begin VB.TextBox LrText 
  34.       ForeColor       =   &H00000000&
  35.       Height          =   300
  36.       Index           =   0
  37.       Left            =   1020
  38.       TabIndex        =   0
  39.       Text            =   "0"
  40.       Top             =   1500
  41.       Width           =   1650
  42.    End
  43.    Begin MSComctlLib.Toolbar Tlb_Action 
  44.       Align           =   1  'Align Top
  45.       Height          =   555
  46.       Left            =   0
  47.       TabIndex        =   5
  48.       Top             =   0
  49.       Width           =   11010
  50.       _ExtentX        =   19420
  51.       _ExtentY        =   979
  52.       ButtonWidth     =   820
  53.       ButtonHeight    =   926
  54.       AllowCustomize  =   0   'False
  55.       Wrappable       =   0   'False
  56.       Appearance      =   1
  57.       Style           =   1
  58.       ImageList       =   "ImageList1"
  59.       _Version        =   393216
  60.       BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  61.          NumButtons      =   24
  62.          BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  63.             Caption         =   "打印"
  64.             Key             =   "dy"
  65.             Object.ToolTipText     =   "打印当前单据或Ctrl+P"
  66.             ImageKey        =   "dy"
  67.          EndProperty
  68.          BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  69.             Caption         =   "预览"
  70.             Key             =   "yl"
  71.             ImageKey        =   "yl"
  72.          EndProperty
  73.          BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  74.             Key             =   "fgh0"
  75.             Style           =   3
  76.          EndProperty
  77.          BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  78.             Caption         =   "新增"
  79.             Key             =   "xz"
  80.             Object.ToolTipText     =   "新增加一张单据或F5"
  81.             ImageKey        =   "xz"
  82.          EndProperty
  83.          BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  84.             Caption         =   "修改"
  85.             Key             =   "xg"
  86.             Object.ToolTipText     =   "修改当前单据或F3"
  87.             ImageKey        =   "xg"
  88.          EndProperty
  89.          BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  90.             Caption         =   "删除"
  91.             Key             =   "sc"
  92.             Object.ToolTipText     =   "删除当前单据"
  93.             ImageKey        =   "sc"
  94.          EndProperty
  95.          BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  96.             Key             =   "fgh1"
  97.             Style           =   3
  98.          EndProperty
  99.          BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  100.             Caption         =   "增行"
  101.             Key             =   "zh"
  102.             Object.ToolTipText     =   "插入一行或Insert"
  103.             ImageKey        =   "zh"
  104.          EndProperty
  105.          BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  106.             Caption         =   "删行"
  107.             Key             =   "sh"
  108.             Object.ToolTipText     =   "删除当前记录行或Delete"
  109.             ImageKey        =   "sh"
  110.          EndProperty
  111.          BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  112.             Key             =   "fgh2"
  113.             Style           =   3
  114.          EndProperty
  115.          BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  116.             Caption         =   "保存"
  117.             Key             =   "bc"
  118.             Object.ToolTipText     =   "保存单据或F6"
  119.             ImageKey        =   "bc"
  120.          EndProperty
  121.          BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  122.             Caption         =   "放弃"
  123.             Key             =   "fq"
  124.             Object.ToolTipText     =   "放弃此次操作"
  125.             ImageKey        =   "fq"
  126.          EndProperty
  127.          BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  128.             Key             =   "fgh3"
  129.             Style           =   3
  130.          EndProperty
  131.          BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  132.             Caption         =   "盘库"
  133.             Key             =   "pk"
  134.             ImageKey        =   "pk"
  135.          EndProperty
  136.          BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  137.             Caption         =   "选择"
  138.             Key             =   "choice"
  139.             ImageKey        =   "choice"
  140.          EndProperty
  141.          BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  142.             Key             =   "fgh4"
  143.             Style           =   3
  144.          EndProperty
  145.          BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  146.             Caption         =   "制表"
  147.             Key             =   "zb"
  148.             ImageKey        =   "zb"
  149.          EndProperty
  150.          BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  151.             Caption         =   "激活"
  152.             Key             =   "jh"
  153.             ImageKey        =   "jh"
  154.          EndProperty
  155.          BeginProperty Button19 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  156.             Caption         =   "记帐"
  157.             Key             =   "jz"
  158.             ImageKey        =   "jz"
  159.          EndProperty
  160.          BeginProperty Button20 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  161.             Caption         =   "恢复"
  162.             Key             =   "re"
  163.             ImageKey        =   "re"
  164.          EndProperty
  165.          BeginProperty Button21 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  166.             Caption         =   "刷新"
  167.             Key             =   "sx"
  168.             ImageKey        =   "sx"
  169.          EndProperty
  170.          BeginProperty Button22 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  171.             Key             =   "fgh5"
  172.             Style           =   3
  173.          EndProperty
  174.          BeginProperty Button23 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  175.             Caption         =   "帮助"
  176.             Key             =   "bz"
  177.             ImageKey        =   "bz"
  178.          EndProperty
  179.          BeginProperty Button24 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  180.             Caption         =   "退出"
  181.             Key             =   "fh"
  182.             ImageKey        =   "tc"
  183.          EndProperty
  184.       EndProperty
  185.       BorderStyle     =   1
  186.    End
  187.    Begin VB.CommandButton Ydcommand 
  188.       Height          =   300
  189.       Left            =   10680
  190.       Picture         =   "单据录入_盘点单.frx":1042
  191.       Style           =   1  'Graphical
  192.       TabIndex        =   4
  193.       Top             =   990
  194.       Visible         =   0   'False
  195.       Width           =   300
  196.    End
  197.    Begin VB.TextBox Ydtext 
  198.       BackColor       =   &H80000018&
  199.       BorderStyle     =   0  'None
  200.       Height          =   330
  201.       Left            =   7710
  202.       MultiLine       =   -1  'True
  203.       TabIndex        =   2
  204.       Top             =   960
  205.       Visible         =   0   'False
  206.       Width           =   1185
  207.    End
  208.    Begin VB.Timer Timer1 
  209.       Interval        =   1
  210.       Left            =   9690
  211.       Top             =   150
  212.    End
  213.    Begin VB.CommandButton Ydcommand1 
  214.       Height          =   300
  215.       Left            =   10680
  216.       Picture         =   "单据录入_盘点单.frx":13CC
  217.       Style           =   1  'Graphical
  218.       TabIndex        =   9
  219.       Top             =   600
  220.       Visible         =   0   'False
  221.       Width           =   300
  222.    End
  223.    Begin VB.ComboBox YdCombo 
  224.       Height          =   300
  225.       Left            =   9000
  226.       Style           =   2  'Dropdown List
  227.       TabIndex        =   3
  228.       Top             =   960
  229.       Visible         =   0   'False
  230.       Width           =   1155
  231.    End
  232.    Begin MSComctlLib.ImageList ImageList1 
  233.       Left            =   10410
  234.       Top             =   1350
  235.       _ExtentX        =   1005
  236.       _ExtentY        =   1005
  237.       BackColor       =   -2147483643
  238.       ImageWidth      =   16
  239.       ImageHeight     =   16
  240.       MaskColor       =   12632256
  241.       _Version        =   393216
  242.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  243.          NumListImages   =   43
  244.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  245.             Picture         =   "单据录入_盘点单.frx":1756
  246.             Key             =   "sz"
  247.          EndProperty
  248.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  249.             Picture         =   "单据录入_盘点单.frx":1AF0
  250.             Key             =   "dy"
  251.          EndProperty
  252.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  253.             Picture         =   "单据录入_盘点单.frx":1E8A
  254.             Key             =   "yl"
  255.          EndProperty
  256.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  257.             Picture         =   "单据录入_盘点单.frx":2224
  258.             Key             =   "xg"
  259.          EndProperty
  260.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  261.             Picture         =   "单据录入_盘点单.frx":25BE
  262.             Key             =   "zh"
  263.          EndProperty
  264.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  265.             Picture         =   "单据录入_盘点单.frx":2958
  266.             Key             =   "sh"
  267.          EndProperty
  268.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  269.             Picture         =   "单据录入_盘点单.frx":2CF2
  270.             Key             =   "bc"
  271.          EndProperty
  272.          BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  273.             Picture         =   "单据录入_盘点单.frx":308C
  274.             Key             =   "fq"
  275.          EndProperty
  276.          BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  277.             Picture         =   "单据录入_盘点单.frx":3426
  278.             Key             =   "bz"
  279.          EndProperty
  280.          BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  281.             Picture         =   "单据录入_盘点单.frx":37C0
  282.             Key             =   "tc"
  283.          EndProperty
  284.          BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  285.             Picture         =   "单据录入_盘点单.frx":3B5A
  286.             Key             =   "bcgs"
  287.          EndProperty
  288.          BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  289.             Picture         =   "单据录入_盘点单.frx":3EF4
  290.             Key             =   "mrlk"
  291.          EndProperty
  292.          BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  293.             Picture         =   "单据录入_盘点单.frx":428E
  294.             Key             =   "xsxm"
  295.          EndProperty
  296.          BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  297.             Picture         =   "单据录入_盘点单.frx":4628
  298.             Key             =   "first"
  299.          EndProperty
  300.          BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  301.             Picture         =   "单据录入_盘点单.frx":49C2
  302.             Key             =   "prev"
  303.          EndProperty
  304.          BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  305.             Picture         =   "单据录入_盘点单.frx":4D5C
  306.             Key             =   "next"
  307.          EndProperty
  308.          BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  309.             Picture         =   "单据录入_盘点单.frx":50F6
  310.             Key             =   "last"
  311.          EndProperty
  312.          BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  313.             Picture         =   "单据录入_盘点单.frx":5490
  314.             Key             =   "xx"
  315.          EndProperty
  316.          BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  317.             Picture         =   "单据录入_盘点单.frx":582A
  318.             Key             =   "define"
  319.          EndProperty
  320.          BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  321.             Picture         =   "单据录入_盘点单.frx":5BC4
  322.             Key             =   "exec"
  323.          EndProperty
  324.          BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  325.             Picture         =   "单据录入_盘点单.frx":5F5E
  326.             Key             =   "xz"
  327.          EndProperty
  328.          BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  329.             Picture         =   "单据录入_盘点单.frx":62F8
  330.             Key             =   "sc"
  331.          EndProperty
  332.          BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  333.             Picture         =   "单据录入_盘点单.frx":6692
  334.             Key             =   "sx"
  335.          EndProperty
  336.          BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  337.             Picture         =   "单据录入_盘点单.frx":6A2C
  338.             Key             =   "cx"
  339.          EndProperty
  340.          BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  341.             Picture         =   "单据录入_盘点单.frx":6DC6
  342.             Key             =   "zd"
  343.          EndProperty
  344.          BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  345.             Picture         =   "单据录入_盘点单.frx":7160
  346.             Key             =   "dz"
  347.          EndProperty
  348.          BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  349.             Picture         =   "单据录入_盘点单.frx":74FA
  350.             Key             =   "ph"
  351.          EndProperty
  352.          BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  353.             Picture         =   "单据录入_盘点单.frx":7894
  354.             Key             =   "fz"
  355.          EndProperty
  356.          BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  357.             Picture         =   "单据录入_盘点单.frx":7C2E
  358.             Key             =   "dw"
  359.          EndProperty
  360.          BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  361.             Picture         =   "单据录入_盘点单.frx":7FC8
  362.             Key             =   "hf"
  363.          EndProperty
  364.          BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  365.             Picture         =   "单据录入_盘点单.frx":8362
  366.             Key             =   "pz"
  367.          EndProperty
  368.          BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  369.             Picture         =   "单据录入_盘点单.frx":86FC
  370.             Key             =   "check"
  371.          EndProperty
  372.          BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  373.             Picture         =   "单据录入_盘点单.frx":8A96
  374.             Key             =   "qs"
  375.          EndProperty
  376.          BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  377.             Picture         =   "单据录入_盘点单.frx":8E30
  378.             Key             =   "fullcheck"
  379.          EndProperty
  380.          BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  381.             Picture         =   "单据录入_盘点单.frx":91CA
  382.             Key             =   "qq"
  383.          EndProperty
  384.          BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  385.             Picture         =   "单据录入_盘点单.frx":9564
  386.             Key             =   "bcw"
  387.          EndProperty
  388.          BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  389.             Picture         =   "单据录入_盘点单.frx":98FE
  390.             Key             =   "ye"
  391.          EndProperty
  392.          BeginProperty ListImage38 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  393.             Picture         =   "单据录入_盘点单.frx":9C98
  394.             Key             =   "pk"
  395.          EndProperty
  396.          BeginProperty ListImage39 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  397.             Picture         =   "单据录入_盘点单.frx":A032
  398.             Key             =   "choice"
  399.          EndProperty
  400.          BeginProperty ListImage40 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  401.             Picture         =   "单据录入_盘点单.frx":A3CC
  402.             Key             =   "zb"
  403.          EndProperty
  404.          BeginProperty ListImage41 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  405.             Picture         =   "单据录入_盘点单.frx":A766
  406.             Key             =   "jh"
  407.          EndProperty
  408.          BeginProperty ListImage42 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  409.             Picture         =   "单据录入_盘点单.frx":AB00
  410.             Key             =   "jz"
  411.          EndProperty
  412.          BeginProperty ListImage43 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  413.             Picture         =   "单据录入_盘点单.frx":AE9A
  414.             Key             =   "re"
  415.          EndProperty
  416.       EndProperty
  417.    End
  418.    Begin VSFlex8Ctl.VSFlexGrid WglrGrid 
  419.       Height          =   3345
  420.       Left            =   120
  421.       TabIndex        =   1
  422.       Top             =   2280
  423.       Width           =   10680
  424.       _cx             =   5080
  425.       _cy             =   5080
  426.       Appearance      =   1
  427.       BorderStyle     =   1
  428.       Enabled         =   -1  'True
  429.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  430.          Name            =   "宋体"
  431.          Size            =   9
  432.          Charset         =   134
  433.          Weight          =   400
  434.          Underline       =   0   'False
  435.          Italic          =   0   'False
  436.          Strikethrough   =   0   'False
  437.       EndProperty
  438.       MousePointer    =   0
  439.       BackColor       =   16777215
  440.       ForeColor       =   -2147483640
  441.       BackColorFixed  =   12640511
  442.       ForeColorFixed  =   -2147483630
  443.       BackColorSel    =   -2147483643
  444.       ForeColorSel    =   -2147483640
  445.       BackColorBkg    =   16777215
  446.       BackColorAlternate=   16777215
  447.       GridColor       =   -2147483633
  448.       GridColorFixed  =   -2147483632
  449.       TreeColor       =   -2147483632
  450.       FloodColor      =   192
  451.       SheetBorder     =   -2147483642
  452.       FocusRect       =   1
  453.       HighLight       =   1
  454.       AllowSelection  =   0   'False
  455.       AllowBigSelection=   0   'False
  456.       AllowUserResizing=   0
  457.       SelectionMode   =   0
  458.       GridLines       =   1
  459.       GridLinesFixed  =   2
  460.       GridLineWidth   =   1
  461.       Rows            =   5000
  462.       Cols            =   10
  463.       FixedRows       =   1
  464.       FixedCols       =   0
  465.       RowHeightMin    =   0
  466.       RowHeightMax    =   0
  467.       ColWidthMin     =   0
  468.       ColWidthMax     =   0
  469.       ExtendLastCol   =   0   'False
  470.       FormatString    =   ""
  471.       ScrollTrack     =   0   'False
  472.       ScrollBars      =   3
  473.       ScrollTips      =   0   'False
  474.       MergeCells      =   0
  475.       MergeCompare    =   0
  476.       AutoResize      =   -1  'True
  477.       AutoSizeMode    =   0
  478.       AutoSearch      =   0
  479.       AutoSearchDelay =   2
  480.       MultiTotals     =   -1  'True
  481.       SubtotalPosition=   1
  482.       OutlineBar      =   0
  483.       OutlineCol      =   0
  484.       Ellipsis        =   0
  485.       ExplorerBar     =   0
  486.       PicturesOver    =   0   'False
  487.       FillStyle       =   0
  488.       RightToLeft     =   0   'False
  489.       PictureType     =   0
  490.       TabBehavior     =   0
  491.       OwnerDraw       =   0
  492.       Editable        =   0
  493.       ShowComboButton =   1
  494.       WordWrap        =   -1  'True
  495.       TextStyle       =   0
  496.       TextStyleFixed  =   0
  497.       OleDragMode     =   0
  498.       OleDropMode     =   0
  499.       DataMode        =   0
  500.       VirtualData     =   -1  'True
  501.       DataMember      =   ""
  502.       ComboSearch     =   3
  503.       AutoSizeMouse   =   -1  'True
  504.       FrozenRows      =   0
  505.       FrozenCols      =   0
  506.       AllowUserFreezing=   0
  507.       BackColorFrozen =   0
  508.       ForeColorFrozen =   0
  509.       WallPaperAlignment=   9
  510.       AccessibleName  =   ""
  511.       AccessibleDescription=   ""
  512.       AccessibleValue =   ""
  513.       AccessibleRole  =   24
  514.       Begin VSFlex8Ctl.VSFlexGrid HjGrid 
  515.          Height          =   885
  516.          Left            =   0
  517.          TabIndex        =   14
  518.          Top             =   2400
  519.          Width           =   7545
  520.          _cx             =   5080
  521.          _cy             =   5080
  522.          Appearance      =   1
  523.          BorderStyle     =   0
  524.          Enabled         =   -1  'True
  525.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  526.             Name            =   "宋体"
  527.             Size            =   9
  528.             Charset         =   134
  529.             Weight          =   400
  530.             Underline       =   0   'False
  531.             Italic          =   0   'False
  532.             Strikethrough   =   0   'False
  533.          EndProperty
  534.          MousePointer    =   0
  535.          BackColor       =   14671839
  536.          ForeColor       =   -2147483640
  537.          BackColorFixed  =   -2147483633
  538.          ForeColorFixed  =   -2147483630
  539.          BackColorSel    =   -2147483643
  540.          ForeColorSel    =   -2147483640
  541.          BackColorBkg    =   16777215
  542.          BackColorAlternate=   14671839
  543.          GridColor       =   -2147483633
  544.          GridColorFixed  =   -2147483632
  545.          TreeColor       =   -2147483632
  546.          FloodColor      =   192
  547.          SheetBorder     =   -2147483642
  548.          FocusRect       =   1
  549.          HighLight       =   1
  550.          AllowSelection  =   0   'False
  551.          AllowBigSelection=   0   'False
  552.          AllowUserResizing=   0
  553.          SelectionMode   =   0
  554.          GridLines       =   1
  555.          GridLinesFixed  =   2
  556.          GridLineWidth   =   1
  557.          Rows            =   5000
  558.          Cols            =   10
  559.          FixedRows       =   1
  560.          FixedCols       =   0
  561.          RowHeightMin    =   0
  562.          RowHeightMax    =   0
  563.          ColWidthMin     =   0
  564.          ColWidthMax     =   0
  565.          ExtendLastCol   =   0   'False
  566.          FormatString    =   ""
  567.          ScrollTrack     =   0   'False
  568.          ScrollBars      =   3
  569.          ScrollTips      =   0   'False
  570.          MergeCells      =   0
  571.          MergeCompare    =   0
  572.          AutoResize      =   -1  'True
  573.          AutoSizeMode    =   0
  574.          AutoSearch      =   0
  575.          AutoSearchDelay =   2
  576.          MultiTotals     =   -1  'True
  577.          SubtotalPosition=   1
  578.          OutlineBar      =   0
  579.          OutlineCol      =   0
  580.          Ellipsis        =   0
  581.          ExplorerBar     =   0
  582.          PicturesOver    =   0   'False
  583.          FillStyle       =   0
  584.          RightToLeft     =   0   'False
  585.          PictureType     =   0
  586.          TabBehavior     =   0
  587.          OwnerDraw       =   0
  588.          Editable        =   0
  589.          ShowComboButton =   1
  590.          WordWrap        =   -1  'True
  591.          TextStyle       =   0
  592.          TextStyleFixed  =   0
  593.          OleDragMode     =   0
  594.          OleDropMode     =   0
  595.          DataMode        =   0
  596.          VirtualData     =   -1  'True
  597.          DataMember      =   ""
  598.          ComboSearch     =   3
  599.          AutoSizeMouse   =   -1  'True
  600.          FrozenRows      =   0
  601.          FrozenCols      =   0
  602.          AllowUserFreezing=   0
  603.          BackColorFrozen =   0
  604.          ForeColorFrozen =   0
  605.          WallPaperAlignment=   9
  606.          AccessibleName  =   ""
  607.          AccessibleDescription=   ""
  608.          AccessibleValue =   ""
  609.          AccessibleRole  =   24
  610.       End
  611.    End
  612.    Begin VB.Label Label1 
  613.       AutoSize        =   -1  'True
  614.       BackStyle       =   0  'Transparent
  615.       Caption         =   "激活"
  616.       BeginProperty Font 
  617.          Name            =   "隶书"
  618.          Size            =   14.25
  619.          Charset         =   134
  620.          Weight          =   700
  621.          Underline       =   0   'False
  622.          Italic          =   0   'False
  623.          Strikethrough   =   0   'False
  624.       EndProperty
  625.       ForeColor       =   &H008080FF&
  626.       Height          =   285
  627.       Left            =   180
  628.       TabIndex        =   15
  629.       Top             =   720
  630.       Visible         =   0   'False
  631.       Width           =   630
  632.    End
  633.    Begin VB.Label Lab_Title 
  634.       AutoSize        =   -1  'True
  635.       BackColor       =   &H80000018&
  636.       BackStyle       =   0  'Transparent
  637.       Caption         =   "单据标题自动调整"
  638.       BeginProperty Font 
  639.          Name            =   "宋体"
  640.          Size            =   15
  641.          Charset         =   134
  642.          Weight          =   700
  643.          Underline       =   0   'False
  644.          Italic          =   0   'False
  645.          Strikethrough   =   0   'False
  646.       EndProperty
  647.       ForeColor       =   &H00000000&
  648.       Height          =   300
  649.       Left            =   4440
  650.       TabIndex        =   13
  651.       Top             =   840
  652.       Width           =   2520
  653.    End
  654.    Begin VB.Label Lab_BillId 
  655.       AutoSize        =   -1  'True
  656.       BackColor       =   &H0080C0FF&
  657.       Height          =   270
  658.       Left            =   7680
  659.       TabIndex        =   12
  660.       Top             =   600
  661.       Visible         =   0   'False
  662.       Width           =   2490
  663.    End
  664.    Begin VB.Label Lab_Djclzt 
  665.       BackColor       =   &H0000FFFF&
  666.       Caption         =   "1"
  667.       ForeColor       =   &H00808080&
  668.       Height          =   255
  669.       Left            =   10320
  670.       TabIndex        =   11
  671.       Top             =   600
  672.       Visible         =   0   'False
  673.       Width           =   285
  674.    End
  675.    Begin VB.Label Lab_OperStatus 
  676.       BackColor       =   &H000080FF&
  677.       Caption         =   "1"
  678.       Height          =   345
  679.       Left            =   10290
  680.       TabIndex        =   10
  681.       Top             =   960
  682.       Visible         =   0   'False
  683.       Width           =   345
  684.    End
  685.    Begin VB.Label Lab_Bill 
  686.       Appearance      =   0  'Flat
  687.       BackColor       =   &H80000005&
  688.       BackStyle       =   0  'Transparent
  689.       ForeColor       =   &H00000000&
  690.       Height          =   225
  691.       Left            =   9030
  692.       TabIndex        =   8
  693.       Top             =   6330
  694.       Width           =   735
  695.    End
  696.    Begin VB.Label Lab_Checker 
  697.       Appearance      =   0  'Flat
  698.       BackColor       =   &H80000005&
  699.       BackStyle       =   0  'Transparent
  700.       ForeColor       =   &H00000000&
  701.       Height          =   225
  702.       Left            =   7170
  703.       TabIndex        =   7
  704.       Top             =   6360
  705.       Width           =   735
  706.    End
  707.    Begin VB.Label TsLabel 
  708.       Alignment       =   1  'Right Justify
  709.       AutoSize        =   -1  'True
  710.       BackStyle       =   0  'Transparent
  711.       Caption         =   "单据号:"
  712.       Height          =   180
  713.       Index           =   0
  714.       Left            =   240
  715.       TabIndex        =   6
  716.       Top             =   1560
  717.       Width           =   765
  718.    End
  719. End
  720. Attribute VB_Name = "KF_FrmPDD"
  721. Attribute VB_GlobalNameSpace = False
  722. Attribute VB_Creatable = False
  723. Attribute VB_PredeclaredId = True
  724. Attribute VB_Exposed = False
  725. '***********************************************************************************************************
  726. '*    模 块 名 称 :盘点处理
  727. '*    功 能 描 述 :此功能模块主要完成单据录入、修改、删除、预览打印等。
  728. '*    程序员姓名  :张万成
  729. '*    最后修改人  :张万成
  730. '*    最后修改时间:2001/09/18
  731. '*    备        注:程序中所有依实际情况自定义部分均用[>>  <<]括起
  732. '*
  733. '*    1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
  734. '*                                    TextValiLock=True             TextValiLock=false
  735. '*
  736. '*    2.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) "1"-浏览 "2"-新增 "3"-修改
  737. '*
  738. '*    3.Lab_Djclzt 用此标签来标识单据处理状态(默认值为1) "1"-填制单据  "2"-查询单据列表  "3"-明细帐联查单据
  739. '*
  740. '*    4.原则:只要单据能够存盘(无论修改或新增)则其必须接受完整性及有效性规则检查
  741. '***********************************************************************************************************
  742.  
  743. '[以下为根据实际情况设置变量
  744. Dim Bln_BillChange As Boolean                   '标识单据是否发生改动
  745. Dim Rec_Query As New ADODB.Recordset            '单据组查询结果动态集(保存当前单据组ID)
  746. Public Str_QueryCondi As String                 '单据组查询条件(接收单据列表传递查询条件)
  747. Dim jsqr As Long
  748. Dim intFatherID() As Integer
  749. Dim intChildID() As Integer
  750. Dim IsQc() As Boolean
  751. Dim intCount As Integer
  752. ']
  753. '以下为固定使用变量(单据)
  754. Dim BillCode As String                          '单据设计编码(索引号)
  755. Dim Var_Bill() As Variant                       '用来返回单据设计信息
  756. Dim ReportTitle As String                       '报表主标题
  757. Dim Tsxx As String                              '系统提示信息
  758. '以下为固定使用变量(网格)
  759. Dim Cxnrrec As New ADODB.Recordset              '显示查询内容动态集
  760. Dim Dyymctbl As New DY_Dyymsz                   '打印页面窗体变量
  761. Dim GridCode As String                          '显示网格网格代码
  762. Dim GridInf() As Variant                        '整个网格设置信息
  763. Dim Pmbcsjhs As Long                            '屏幕网格保持数据行数(大于等于1)
  764. Dim Fzxwghs As Integer                          '辅助项网格行数(包括合计行)
  765. Dim Sfxshjwg As Boolean                         '是否显示合计网格
  766. Dim Qslz As Long                                '网格隐藏(非操作显示)列数
  767. Dim Sjhgd As Double                             '网格数据行高度
  768. Dim GridBoolean() As Boolean                    '网格列信息(布尔型)
  769. Dim GridStr()  As String                        '网格列信息(字符型)
  770. Dim GridInt() As Integer                        '网格列信息(整型)
  771. Dim Sfblbzkd As Boolean                         '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
  772. Dim Dqlrwgh As Long                             '当前录入数据网格行
  773. Dim Dqlrwgl As Long                             '当前录入数据网格列
  774. Dim Dqlkwgh As Long                             '刚刚离开网格行(不一定为录入行)
  775. Dim Dqlkwgl As Long                             '刚刚离开网格列
  776. Dim Dqtoprow As Long                            '当前录入状态时最上端可视行
  777. Dim Dqleftcol As Long                           '当前录入状态时最左端可视列
  778. Dim Zdlrqnr As String                           '字段录入修改前内容(用来判断内容是否修改)
  779. Dim Wbkbhlock As Boolean                        '文本框改变值锁
  780. Dim Changelock As Boolean                       '网格行列改变控制锁(用来区别用户改变.程序改变)
  781. Dim Gdtlock As Boolean                          '滚动条滚动控制(用来区别用户改变.程序改变)
  782. Dim Yxxpdlock As Boolean                        '字段有效性判断锁(内容不修改不需进行字段有效性判断)
  783. Dim Hyxxpdlock As Boolean                       '行有效性判断锁(字段内容不修改不需进行行有效性判断)
  784. Dim Valilock As Boolean                         '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
  785. Dim Shsfts As Boolean                           '删除记录行是否提示
  786. Dim Szzls As Integer                            '网格信息数组最大下标值(网格列数-1)
  787. '以下为固定使用变量(文本框)
  788. Dim Textvar() As Variant                        '存储变体型文本框信息
  789. Dim Textboolean() As Boolean                    '存储布尔型文本框信息
  790. Dim Textint() As Integer                        '存储整型文本框信息
  791. Dim Textstr() As String                         '存储字符型文本框信息
  792. Dim Max_Text_Index As Integer                   '最大录入文本框索引值
  793. Dim TextGroupCode As String                     '文本框录入分组编码
  794. Dim TextValiLock As Boolean                     '文本框失去焦点是否进行有效性控制判断
  795. Dim TextValiJudgeLock() As Boolean              '文本框录入有效性判断控制锁
  796. Dim TextChangeLock As Boolean                   '文本框内容变换控制锁
  797. Dim PriceMode As String
  798. Dim InID As Integer                             '入库单ID
  799. Dim OutID As Integer                            '出库单ID
  800. Dim Str_RightEdit As String                     '单据编辑(新增、修改、删除)权限索引
  801. Dim Str_RightCheck As String                    '单据审核(审核、弃审)权限索引
  802. Dim Str_RightChalk As String                    '单据记账(记帐、恢复)权限索引
  803.     
  804. Private Sub Form_KeyPress(KeyAscii As Integer)      '控 制 焦 点 转 移
  805.     
  806.     Dim jdzygs As Integer
  807.     jdzygs = 8                                       '在单据录入中,此焦点转移控制值一定小于等于文本框个数,否则网格回车键将不支持.
  808.     Select Case KeyAscii
  809.         Case vbKeyReturn
  810.             If Kjjdzy(jdzygs) Then
  811.                 KeyAscii = 0
  812.             End If
  813.         Case 39           '屏蔽字符"'"
  814.             KeyAscii = 0
  815.     End Select
  816. End Sub
  817. Private Sub Form_Load()                                                        '窗 体 装 入
  818.     '初始化各种锁值(Fixed)
  819.     Changelock = False             '网格行列改变控制锁
  820.     Gdtlock = False                '滚动条滚动控制
  821.     Yxxpdlock = True               '字段有效性判断锁
  822.     Hyxxpdlock = True              '行有效性判断锁
  823.     Wbkbhlock = False              '文本框内容改变锁
  824.     
  825.     '单据权限索引设置
  826.     Str_RightEdit = "Kf_PDD_edit"
  827.     Str_RightCheck = "Kf_PDD_check"
  828.     Str_RightChalk = "Kf_PDD_chalk"
  829.     '调入单据信息(需要修改BillCode)
  830.     BillCode = "1208"
  831.     Call Sub_ReadBillInfo(BillCode, Me, Var_Bill())
  832.     Lab_Title = Var_Bill(2)
  833.     Lab_Title.Move (Me.Width - Lab_Title.Width) / 2, 800
  834.     
  835.     '报表编码
  836.     XtReportCode = Var_Bill(5)
  837.     Load Dyymctbl
  838.   
  839.     '以下为文本框处理程序(Fixed)
  840.     TextGroupCode = Var_Bill(3)
  841.  
  842.     Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr())  '读入文本框录入信息
  843.     Call Wbkcsh
  844.   
  845.     '调入网格并记录一些网格信息(Fixed)
  846.     GridCode = Var_Bill(4)         '网格属性编码
  847.     Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
  848.       
  849.     Qslz = GridInf(1)
  850.     Sjhgd = GridInf(2)
  851.     Fzxwghs = GridInf(4)
  852.     Sfblbzkd = GridInf(5)
  853.     Shsfts = GridInf(6)
  854.     Sfxshjwg = GridInf(7)
  855.     Szzls = WglrGrid.Cols - 1
  856.     Pmbcsjhs = Int((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) / Sjhgd) - Fzxwghs - 1
  857.       
  858.     For jsqte = WglrGrid.FixedRows To WglrGrid.Rows - 1
  859.         WglrGrid.RowHeight(jsqte) = Sjhgd
  860.     Next jsqte
  861.     
  862.     '初始化合计网格(Fixed)
  863.     Call VisulGrid
  864.     Call Cshhjwg
  865.   
  866.     '单据变动置为False(Fixed)
  867.     Bln_BillChange = False
  868.     
  869.     '调入数据初始化模块(Fixed)
  870.     Lab_Djclzt.Caption = Xtcdcs
  871.     Call Sjcsh(Trim(Lab_Djclzt.Caption))
  872.    
  873. End Sub
  874. Private Sub Form_Unload(Cancel As Integer)           '窗体卸载
  875.     '是否保存已修改单据
  876.      Dim YAnswer As Integer
  877.      If Lab_OperStatus.Caption = "2" Or Lab_OperStatus.Caption = "3" Then
  878.          Tsxx = "单据尚未保存,是否退出?"
  879.          YAnswer = Xtxxts(Tsxx, 2, 2)
  880.          If YAnswer <> 1 Then
  881.              Cancel = 1
  882.              Exit Sub
  883.          End If
  884.      End If
  885.     '卸载打印页面窗体
  886.     Unload Dyymctbl
  887.  
  888.     '判断单据是否发生变化,并返回相应标识
  889.     If Bln_BillChange Then
  890.         Xtfhcs = "1"
  891.     Else
  892.         Xtfhcs = "0"
  893.     End If
  894.    
  895. End Sub
  896. Private Sub Sjcsh(Str_Pzclzt As String)              '数据初始化模块(根据实际情况)
  897.     
  898.     Dim Sqlstr As String       '查询单据列表条件
  899.     '[>>根据实际情况初始化
  900.     Select Case Str_Pzclzt
  901.         Case "1"   '填制单据
  902.             '调入用户查询结果动态集(默认显示用户当前操作业务日期的单据)
  903.             Sqlstr = "SELECT InventoryMainId From Kf_InventoryMain Where BillDate='" & Xtrq & "' ORDER BY InventoryMainId "
  904.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  905.       
  906.             '新增单据
  907.             Call Sub_AddBill
  908.         Case "2"   '查询单据(单据列表)
  909.         
  910.             '填充查询单据标识
  911.             Lab_BillId.Caption = XT_BillID
  912.             Str_QueryCondi = Xtcdcsfz
  913.                 
  914.             Call Sub_ShowBill
  915.             Call Sub_OperStatus("10")
  916.       
  917.             '调入用户查询结果动态集
  918.             Sqlstr = "SELECT DISTINCT InventoryMainId From KF_V_PDD a " & Str_QueryCondi & " ORDER BY InventoryMainId"
  919.             Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  920.             Rec_Query.Find "InventoryMainId=" & S2N(Lab_BillId.Caption)
  921.         Case "3"   '明细帐联查单据
  922.             '设置工具条显示
  923.             With Tlb_Action
  924.                 .Buttons("xz").Enabled = False             '新增
  925.                 .Buttons("xg").Enabled = False             '修改
  926.                 .Buttons("sc").Enabled = False             '删除
  927.                 .Buttons("fgh0").Enabled = False           '分隔行
  928.                 .Buttons("zh").Enabled = False             '增行
  929.                 .Buttons("sh").Enabled = False             '删行
  930.                 .Buttons("fgh1").Enabled = False           '分隔行
  931.                 .Buttons("bc").Enabled = False             '保存
  932.                 .Buttons("fq").Enabled = False             '放弃
  933.                 .Buttons("shsh").Enabled = False           '审核
  934.                 .Buttons("shqs").Enabled = False           '弃审
  935.                 .Buttons("fgh2").Enabled = False           '分隔行
  936.                 .Buttons("first").Enabled = False          '首张
  937.                 .Buttons("prev").Enabled = False           '上张
  938.                 .Buttons("next").Enabled = False           '下张
  939.                 .Buttons("last").Enabled = False           '末张
  940.                 .Buttons("fgh5").Enabled = False           '分割行
  941.             End With
  942.       
  943.             Call Sub_ShowBill
  944.       
  945.             '设置操作状态为浏览
  946.             Lab_OperStatus.Caption = "1"
  947.       
  948.             '录入文本框
  949.             For jsqte = Max_Text_Index To 0 Step -1
  950.             LrText(jsqte).Enabled = False
  951.         Next jsqte
  952.     End Select
  953.   
  954.     '<<]
  955.   
  956. End Sub
  957. Private Sub Sub_ShowBill()                                          '根据当前单据ID显示整张单据内容
  958.    
  959.     '过程默认参数为当前窗体中单据ID:Lab_BillID
  960.     Dim Sqlstr As String                           '临时使用字符串
  961.     Dim RecTemp As New ADODB.Recordset             '临时使用动态集
  962.     Dim jsqte As Long                              '临时计数器
  963.     '禁止网格刷新动作,为加快网格显示速度(Fixed)
  964.     WglrGrid.Redraw = False
  965.     '本张单据查询字符串
  966.     Sqlstr = "SELECT KF_V_PDD.* from KF_V_PDD  Where InventoryMainId=" & S2N(Lab_BillId.Caption) & " Order By KF_V_PDD.InventorySubId"
  967.     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  968.       
  969.     With RecTemp
  970.         WglrGrid.Rows = WglrGrid.FixedRows
  971.         If .EOF Then
  972.             WglrGrid.Redraw = True
  973.             Tlb_Action.Buttons("zb").Enabled = False
  974.             Tlb_Action.Buttons("jh").Enabled = False
  975.             Label1.Visible = False
  976.             Exit Sub
  977.         Else
  978.             '[>>显示单据头
  979.             TextChangeLock = True     '文本框加锁
  980.             
  981.             PriceMode = Trim(.Fields("PriceMode"))
  982.             
  983.             If .Fields("ishqgl") Then
  984.                 WglrGrid.ColHidden(Sydz("005", GridStr(), Szzls)) = False
  985.             Else
  986.                 WglrGrid.ColHidden(Sydz("005", GridStr(), Szzls)) = True
  987.             End If
  988.             PriceMode = Trim(.Fields("PriceMode"))
  989.             If Trim(.Fields("PriceMode")) = "计划价法" Then
  990.                 WglrGrid.ColHidden(Sydz("010", GridStr(), Szzls)) = False
  991.                 WglrGrid.ColHidden(Sydz("012", GridStr(), Szzls)) = False
  992.             Else
  993.                 WglrGrid.ColHidden(Sydz("010", GridStr(), Szzls)) = True
  994.                 WglrGrid.ColHidden(Sydz("012", GridStr(), Szzls)) = True
  995.             End If
  996.             If conForbid = 1 Then
  997.                 If Not IsNull(.Fields("FreezeFlag")) Then
  998.                     Label1.Visible = CBool(.Fields("FreezeFlag"))
  999.                     If Not CBool(.Fields("actstate")) Then
  1000.                         Tlb_Action.Buttons("jh").Enabled = Not CBool(.Fields("actstate"))
  1001.                     Else
  1002.                         Tlb_Action.Buttons("jh").Enabled = Not Label1.Visible
  1003.                     End If
  1004.                 End If
  1005.             Else
  1006.                 Label1.Visible = CBool(.Fields("actstate"))
  1007.                 Tlb_Action.Buttons("jh").Enabled = Not CBool(.Fields("actstate"))
  1008.             End If
  1009.             LrText(0).Text = Trim(.Fields("BillNum"))                                               '订单号
  1010.             
  1011.             If IsDate(.Fields("BillDate")) Then
  1012.                 LrText(2).Text = Format(.Fields("BillDate"), "yyyy-mm-dd")                          '制单日期
  1013.             End If
  1014.             
  1015.             LrText(3).Tag = Trim(.Fields("DeptCode") & "")                                          '客户编码
  1016.             LrText(3).Text = Trim(.Fields("DeptName") & "")                                         '客户名称
  1017.             LrText(1).Tag = Trim(.Fields("WhCode") & "")
  1018.             LrText(1).Text = Trim(.Fields("WhName") & "")                                           '备注
  1019.             LrText(4).Tag = Trim(.Fields("InClass") & "")
  1020.             LrText(4).Text = Trim(.Fields("InClassName") & "")                                      '入库类别
  1021.             LrText(5).Tag = Trim(.Fields("OutClass") & "")
  1022.             LrText(5).Text = Trim(.Fields("OutClassName") & "")                                     '出库类别
  1023.             LrText(6).Tag = Trim(.Fields("PersonCode") & "")
  1024.             LrText(6).Text = Trim(.Fields("PersonName") & "")                                       '人员
  1025.             LrText(7).Text = Trim(.Fields("remark") & "")
  1026.             LrText(9).Text = Trim(.Fields("maker") & "")                                             '制单人
  1027.             LrText(8).Text = Trim(.Fields("ChalkitupMan") & "")                                      '审核人
  1028.             TextChangeLock = False    '文本框解锁
  1029.             '<<]
  1030.         End If
  1031.         jsqte = WglrGrid.FixedRows
  1032.         Do While Not .EOF
  1033.             WglrGrid.AddItem ""
  1034.             '[>>显示单据分录
  1035.             WglrGrid.TextMatrix(jsqte, 0) = "*"
  1036.             WglrGrid.TextMatrix(jsqte, 2) = .Fields("ispcgl")
  1037.             WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("MNumber") & "")                   '物料编码
  1038.             WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("MName") & "")                     '物料名称
  1039.             WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Model") & "")                     '物料规格
  1040.             WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("PrimaryUnitName") & "")
  1041.  
  1042.             If Not IsNull(.Fields("MAreaName")) Then
  1043.                 WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = .Fields("MAreaName")                        '货区
  1044.                 WglrGrid.TextMatrix(jsqte, 1) = .Fields("MArea")
  1045.             End If
  1046.                 WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("batchnum") & "")              '批号
  1047.             If .Fields("AccQuan") <> 0 Then
  1048.                 WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = .Fields("AccQuan")                          '帐面数量
  1049.             End If
  1050.             If .Fields("QuanInve") <> 0 Then
  1051.                 WglrGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = .Fields("QuanInve")                         '盘点数量
  1052.             End If
  1053.             If S2N(.Fields("QuanInve")) - S2N(.Fields("AccQuan")) <> 0 Then
  1054.                 WglrGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = S2N(.Fields("QuanInve")) - S2N(.Fields("AccQuan"))      '盈亏数量
  1055.             End If
  1056.             If .Fields("price") <> 0 Then
  1057.                 WglrGrid.TextMatrix(jsqte, Sydz("011", GridStr(), Szzls)) = .Fields("price")                             '价格
  1058.             End If
  1059.             If .Fields("PlanPrice") <> 0 Then
  1060.                 WglrGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = .Fields("PlanPrice")                         '计划价格
  1061.             End If
  1062.             If .Fields("PlanMoney") <> 0 Then
  1063.                 WglrGrid.TextMatrix(jsqte, Sydz("012", GridStr(), Szzls)) = .Fields("PlanMoney")                         '计划金额
  1064.             End If
  1065.             If .Fields("EMoney") <> 0 Then
  1066.                 WglrGrid.TextMatrix(jsqte, Sydz("013", GridStr(), Szzls)) = .Fields("EMoney")                            '金额
  1067.             End If
  1068.                 WglrGrid.TextMatrix(jsqte, Sydz("014", GridStr(), Szzls)) = Trim(.Fields("Cause") & "")                  '原因
  1069.                    
  1070.             WglrGrid.RowHeight(jsqte) = Sjhgd
  1071.             .MoveNext
  1072.             jsqte = jsqte + 1
  1073.         Loop
  1074.     End With
  1075.        
  1076.             
  1077.     '调整网格(Fixed)
  1078.     Call Sub_AdjustGrid
  1079.       
  1080.      Call Cshhjwg
  1081.     '计算合计数据(Fixed)
  1082.     For jsqte = Qslz To WglrGrid.Cols - 1
  1083.         Call Sjhj(jsqte)
  1084.     Next jsqte
  1085.     
  1086.     '将网格刷新解禁(Fixed)
  1087.     WglrGrid.Redraw = True
  1088.               
  1089. End Sub
  1090. Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button)             '用户点击工具条
  1091.      
  1092.     '屏蔽文本框,下拉组合框有效性判断
  1093.     Valilock = True
  1094.     '屏蔽网格失去焦点产生的有效性判断
  1095.     Changelock = True
  1096.          
  1097.     Select Case Button.Key
  1098.         Case "yl"                                            '预 览
  1099.             If Fun_Drfrmyxxpd Then
  1100.                 If PriceMode = "计划价法" Then
  1101.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, False, "plan"
  1102.                 Else
  1103.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, False, "default"
  1104.                 End If
  1105.             End If
  1106.         Case "dy"                                            '打 印
  1107.             If Fun_Drfrmyxxpd Then
  1108.                 Dim Yhanswer As Integer      '打印提示
  1109.                 
  1110.                 '用户确认是否打印单据
  1111.                 Tsxx = "请确认是否打印当前单据?"
  1112.                 Yhanswer = Xtxxts(Tsxx, 2, 2)
  1113.                 If Yhanswer = 2 Then
  1114.                     Exit Sub
  1115.                 End If
  1116.                 If PriceMode = "计划价法" Then
  1117.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, True, "plan"
  1118.                 Else
  1119.                     BillGridPrint WglrGrid, LrText, GridStr(), Szzls, GridCode, TextGroupCode, XtReportCode, True, "default"
  1120.                 End If
  1121.             End If
  1122.         Case "xz"                                            '新 增
  1123.             Call Sub_AddBill
  1124.         Case "xg"                                            '修 改
  1125.             Call Sub_EditBill
  1126.         Case "sc"                                            '删 除
  1127.             Call Sub_DeleteBill
  1128.         Case "zh"                                            '增 行
  1129.             Call zjlrfl
  1130.         Case "sh"                                            '删 行
  1131.             Call Scdqfl
  1132.         Case "bc"                                            '保 存
  1133.             If Fun_Drfrmyxxpd Then
  1134.                 Call Sub_SaveBill
  1135.             End If
  1136.         Case "fq"                                            '放 弃
  1137.             Call Sub_AbandonBill
  1138.         Case "pk"                                            '盘库
  1139.             Call Sub_PK
  1140.         
  1141.         Case "zb"                                            '制表
  1142.             Call Sub_PDZB(True)
  1143.             If Fun_Drfrmyxxpd Then
  1144.                 Call bbyl(True)
  1145.             End If
  1146.             Call Sub_PDZB(False)
  1147.         Case "jh"                                            '激活
  1148.             Call Sub_JH
  1149.         Case "jz"                                            '记帐
  1150.             Call Sub_JZ
  1151.         Case "re"                                            '恢复
  1152.             Call REJZ
  1153.         Case "sx"                                          '下 张
  1154.             Call Sub_Sx
  1155.         Case "choice"                                          '末 张
  1156.             If LrText(1).Tag = "" Then
  1157.                 Tsxx = "请选择仓库!"
  1158.                 Call Xtxxts(Tsxx, 0, 1)
  1159.                 LrText(1).SetFocus
  1160.                 Exit Sub
  1161.             End If
  1162.             KF_FrmMateChoice.Show 1
  1163.             Call fillmate
  1164.         Case "bz"                                            '帮 助
  1165.             Call F1bz
  1166.         Case "fh"                                            '退 出
  1167.             Unload Me
  1168.     End Select
  1169.        
  1170.     '解 锁
  1171.     Valilock = False
  1172.     Changelock = False
  1173.     TextChangeLock = False
  1174.         
  1175. End Sub
  1176. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)     '支持热键操作
  1177.     
  1178.     Select Case KeyCode
  1179.         Case vbKeyF5          '增加单据
  1180.             If Tlb_Action.Buttons("xz").Enabled And Tlb_Action.Buttons("xz").Visible Then
  1181.                 Call Sub_AddBill
  1182.             End If
  1183.         Case vbKeyF3          '修改单据
  1184.             If Tlb_Action.Buttons("xg").Enabled And Tlb_Action.Buttons("xg").Visible Then
  1185.                 Call Sub_EditBill
  1186.             End If
  1187.         Case vbKeyF6          '保存单据
  1188.             If Tlb_Action.Buttons("bc").Enabled And Tlb_Action.Buttons("bc").Visible Then
  1189.                 If Fun_Drfrmyxxpd Then Call Sub_SaveBill
  1190.             End If
  1191.     End Select
  1192. End Sub
  1193. Private Sub Sub_OperStatus(Str_Status As String)                 '工具条依据不同状态所进行的变化
  1194.     
  1195.     With Tlb_Action
  1196.         Select Case Str_Status
  1197.             Case "10"   '浏览((列表)调入单据处理时的进入状态、(列表)新增状态时放弃录入)
  1198.                 '工具条
  1199.                 .Buttons("dy").Enabled = True       '打印
  1200.                 .Buttons("yl").Enabled = True       '预览
  1201.                 .Buttons("xz").Enabled = True       '新增
  1202.                 .Buttons("xg").Enabled = True       '修改
  1203.                 .Buttons("sc").Enabled = True       '删除
  1204.                 .Buttons("zh").Enabled = False      '增行
  1205.                 .Buttons("sh").Enabled = False      '删行
  1206.                 .Buttons("bc").Enabled = False      '保存
  1207.                 .Buttons("fq").Enabled = False      '放弃
  1208.                 .Buttons("pk").Enabled = False    '盘库
  1209.                 .Buttons("choice").Enabled = False    '选择
  1210.                 If S2N(Lab_BillId.Caption) <> 0 Then
  1211.                     .Buttons("zb").Enabled = True 'Not Label1.Visible
  1212.                     If LrText(8).Text = "" Then
  1213.                         .Buttons("jz").Enabled = Not .Buttons("jh").Enabled
  1214.                         If .Buttons("jh").Enabled Then
  1215.                             .Buttons("re").Enabled = Not .Buttons("jh").Enabled
  1216.                         Else
  1217.                             .Buttons("re").Enabled = Not .Buttons("jz").Enabled
  1218.                         End If
  1219.                     Else
  1220.                         .Buttons("jz").Enabled = False
  1221.                         .Buttons("re").Enabled = Not .Buttons("jz").Enabled
  1222.                     End If
  1223.                 Else
  1224.                     .Buttons("zb").Enabled = False
  1225.                     .Buttons("jh").Enabled = False
  1226.                     .Buttons("jz").Enabled = False
  1227.                 End If
  1228.                 If Not .Buttons("jz").Enabled Then
  1229.                     Label1.Visible = False
  1230.                 End If
  1231.                      '记帐
  1232.                     '恢复
  1233.                 .Buttons("sx").Enabled = False
  1234.                 .Buttons("bz").Enabled = True       '帮助
  1235.                 .Buttons("fh").Enabled = True       '退出
  1236.         
  1237.                 '设置审核弃审按钮状态
  1238.         
  1239.                 '设置文本框录入状态
  1240.                 Call Sub_LrtextStatus(False)
  1241.             Case "20"   '新增单据((录入)新增一张单据 、(列表)新增一张单据)
  1242.                 '工具条
  1243.                 .Buttons("dy").Enabled = False      '打印
  1244.                 .Buttons("yl").Enabled = False      '预览
  1245.                 .Buttons("xz").Enabled = False      '新增
  1246.                 .Buttons("xg").Enabled = False      '修改
  1247.                 .Buttons("sc").Enabled = False      '删除
  1248.                 .Buttons("zh").Enabled = True       '增行
  1249.                 .Buttons("sh").Enabled = True       '删行
  1250.                 .Buttons("bc").Enabled = True       '保存
  1251.                 .Buttons("fq").Enabled = True       '放弃
  1252.                 .Buttons("pk").Enabled = True    '盘库
  1253.                 .Buttons("choice").Enabled = True    '选择
  1254.                 .Buttons("zb").Enabled = False   '制表
  1255.                 .Buttons("jh").Enabled = False    '激活
  1256.                 .Buttons("jz").Enabled = False    '记帐
  1257.                 .Buttons("re").Enabled = False    '恢复
  1258.                 .Buttons("sx").Enabled = False
  1259.                 .Buttons("bz").Enabled = True       '帮助
  1260.                 .Buttons("fh").Enabled = True       '退出
  1261.                 
  1262.                 '设置文本框录入状态
  1263.                 Call Sub_LrtextStatus(True)
  1264.             Case "30"   '修改((录入)调入修改功能、(列表)调入修改功能)
  1265.                 '工具条
  1266.                 .Buttons("dy").Enabled = False      '打印
  1267.                 .Buttons("yl").Enabled = False      '预览
  1268.                 .Buttons("xz").Enabled = False      '新增
  1269.                 .Buttons("xg").Enabled = False      '修改
  1270.                 .Buttons("sc").Enabled = False      '删除
  1271.                 .Buttons("zh").Enabled = True       '增行
  1272.                 .Buttons("sh").Enabled = True       '删行
  1273.                 .Buttons("bc").Enabled = True       '保存
  1274.                 .Buttons("fq").Enabled = True       '放弃
  1275.                 .Buttons("pk").Enabled = True    '盘库
  1276.                 .Buttons("choice").Enabled = True    '选择
  1277.                 .Buttons("zb").Enabled = False   '制表
  1278.                 .Buttons("jh").Enabled = False    '激活
  1279.                 .Buttons("jz").Enabled = False    '记帐
  1280.                 .Buttons("re").Enabled = False    '恢复
  1281.                 .Buttons("sx").Enabled = False
  1282.                 .Buttons("bz").Enabled = True       '帮助
  1283.                 .Buttons("fh").Enabled = True       '退出
  1284.                 
  1285.                 '设置文本框录入状态
  1286.                 Call Sub_LrtextStatus(True)
  1287.         End Select
  1288.     End With
  1289. End Sub
  1290. Private Sub Sub_LrtextStatus(TextEnabled As Boolean)                            '设置录入文本框状态
  1291.     '录入文本框状态设置
  1292.     If TextEnabled Then
  1293.         For jsqte = Max_Text_Index To 0 Step -1
  1294.             '判断文本框是否可编辑
  1295.             If Textboolean(jsqte, 5) Then
  1296.                 LrText(jsqte).Enabled = True
  1297.             Else
  1298.                 LrText(jsqte).Enabled = False
  1299.             End If
  1300.         Next jsqte
  1301.     Else
  1302.         For jsqte = Max_Text_Index To 0 Step -1
  1303.             LrText(jsqte).Enabled = False
  1304.         Next jsqte
  1305.     End If
  1306. End Sub
  1307. Private Sub Wbkcl()                                                 '文本框录入之前处理(根据实际情况)
  1308.     
  1309.     Dim xswbrr As String
  1310.     With WglrGrid
  1311.         Zdlrqnr = Trim(.Text)
  1312.         xswbrr = Trim(.Text)
  1313.         If GridBoolean(.Col, 3) Then   '列表框录入
  1314.             '填充列表框程序
  1315.             Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
  1316.         Else
  1317.             Wbkbhlock = True
  1318.        
  1319.             '====以下为用户自定义
  1320.             Ydtext.Text = xswbrr
  1321.             '====以上为用户自定义
  1322.          
  1323.             Wbkbhlock = False
  1324.             Ydtext.SelStart = Len(Ydtext.Text)
  1325.         End If
  1326.     End With
  1327. End Sub
  1328. Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) As Boolean       '录入数据字段有效性判断,同时进行字段录入事后处理
  1329.  
  1330.     '函数参数:Dqpdwgh, Dqpdwgl 当前要判断网格单元所处行列值
  1331.     Dim Str_JudgeText As String                 '临时有效性判断字段内容
  1332.     Dim Coljsq As Long                          '临时列计数器
  1333.     Dim RecTemp As New ADODB.Recordset          '临时使用动态集
  1334.     Dim Sqlstr As String                        '临时使用查询字符串
  1335.     With WglrGrid
  1336.         '非录入状态或非数据行则其有效性为合法
  1337.         If Yxxpdlock Or .Row < .FixedRows Then
  1338.             sjzdyxxpd = True
  1339.             Exit Function
  1340.         End If
  1341.         
  1342.         '取得当前要判断字段内容
  1343.         Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
  1344.         jsqr = Dqpdwgh
  1345.         '根据不同字段进行相应的处理(依据其逻辑编号)
  1346.         Select Case GridStr(Dqpdwgl, 1)
  1347.             '[>>以下为自定义部分
  1348.             Case "001"                   '物料编码
  1349.                If Not Trim(Str_JudgeText) = "" Then
  1350.                     '1.放置字段有效性判断
  1351.                 Sqlstr = "SELECT MNumber,MName,Model,PrimaryUnit,PrimaryUnitName,Ispcgl,Isbzqgl,planprice From Gy_Material Where stopflag=0 and MNumber='" & Trim(Str_JudgeText) & "' Or MName='" & Trim(Str_JudgeText) & "'"
  1352.                     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1353.                     If RecTemp.EOF Then
  1354.                         Tsxx = "此物料编码不存在!"
  1355.                         GoTo Lrcwcl
  1356.                     Else
  1357.                         '2.放置字段事后处理程序
  1358.                         .TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = Trim(RecTemp.Fields("MNumber") & "")      '显示物料编码
  1359.                         .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = Trim(RecTemp.Fields("MName") & "")        '显示物料名称
  1360.                         .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = Trim(RecTemp.Fields("Model") & "")        '显示物料规格型号
  1361.                         .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = Trim(RecTemp.Fields("PrimaryUnitName") & "")
  1362.                         .TextMatrix(Dqpdwgh, 2) = RecTemp.Fields("Ispcgl")
  1363.                         .TextMatrix(Dqpdwgh, 3) = RecTemp.Fields("Isbzqgl")
  1364.                         
  1365.                         If PriceMode = "计划价法" And S2N(RecTemp.Fields("PlanPrice")) <> 0 Then
  1366.                             .TextMatrix(Dqpdwgh, Sydz("010", GridStr(), Szzls)) = S2N(RecTemp.Fields("PlanPrice"))
  1367.                         End If
  1368.                         
  1369.                         If NowQuan(Trim(LrText(1).Tag), Trim(.TextMatrix(Dqpdwgh, 1)), Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)))) <> 0 Then
  1370.                             .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = NowQuan(Trim(LrText(1).Tag), Trim(.TextMatrix(Dqpdwgh, 1)), Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))))
  1371.                         End If
  1372.                     End If
  1373.                     '根据公式计算结果
  1374.                         Call Sub_JoinCount(Dqpdwgh, Sydz("008", GridStr(), Szzls))
  1375.                         Call Sub_JoinCount(Dqpdwgh, Sydz("011", GridStr(), Szzls))
  1376.                         Call Sub_JoinCount(Dqpdwgh, Sydz("013", GridStr(), Szzls))
  1377.                 Else
  1378.                     '3.清空相关字段
  1379.                     .TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = ""                                             '物料名称
  1380.                     .TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = ""                                             '物料规格型号
  1381.                     .TextMatrix(Dqpdwgh, Sydz("004", GridStr(), Szzls)) = ""
  1382.                     .TextMatrix(Dqpdwgh, Sydz("010", GridStr(), Szzls)) = ""
  1383.                 End If
  1384.     
  1385.             Case "005"      '货区
  1386.                 '1.放置字段有效性判断
  1387.                 '2.放置字段事后处理程序
  1388.                 If Not Trim(Str_JudgeText) = "" Then
  1389.                   Sqlstr = "SELECT MArea,MAreaName From KF_Marea Where (MArea='" & Trim(Str_JudgeText) & "' Or MAreaName='" & Trim(Str_JudgeText) & "') and whcode='" & Trim(LrText(1).Tag) & "' and endflag=1"
  1390.                     Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
  1391.                         If RecTemp.EOF Then
  1392.                             Tsxx = "此货区不存在或不属于本仓库或不是末级货区!"
  1393.                             GoTo Lrcwcl
  1394.                         End If
  1395.                         .TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls)) = Trim(RecTemp.Fields("MAreaName") & "")
  1396.                         .TextMatrix(Dqpdwgh, 1) = Trim(RecTemp.Fields("MArea") & "")
  1397.                 End If
  1398.                 '从现存量中提取数据
  1399.                 If NowQuan(Trim(LrText(1).Tag), Trim(.TextMatrix(Dqpdwgh, 1)), Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)))) <> 0 Then
  1400.                     .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = NowQuan(Trim(LrText(1).Tag), Trim(.TextMatrix(Dqpdwgh, 1)), Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))))
  1401.                 End If
  1402.             Case "006"      '批次
  1403.                  If Trim(.TextMatrix(Dqpdwgh, 0)) = "*" Then
  1404.                      If Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))) = "" Then
  1405.                         Tsxx = "请先输入物料!"
  1406.                         Dqpdwgl = Sydz("001", GridStr(), Szzls)
  1407.                         GoTo Lrcwcl
  1408.                      End If
  1409.                     '先输入货区
  1410.                     If conArea = 1 Then
  1411.                         If Not .ColHidden(Sydz("005", GridStr(), Szzls)) Then
  1412.                             If Trim(.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) = "" Then
  1413.                                 Tsxx = "请先输入货区!"
  1414.                                 Dqpdwgl = Sydz("005", GridStr(), Szzls)
  1415.                                 GoTo Lrcwcl
  1416.                             End If
  1417.                         End If
  1418.                     End If
  1419.                     '从现存量中提取数据
  1420.                     If NowQuan(Trim(LrText(1).Tag), Trim(.TextMatrix(Dqpdwgh, 1)), Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)))) <> 0 Then
  1421.                         .TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = NowQuan(Trim(LrText(1).Tag), Trim(.TextMatrix(Dqpdwgh, 1)), Trim(.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), Trim(.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))))
  1422.                     End If
  1423.                     If S2N(WglrGrid.TextMatrix(jsq, Sydz("008", GridStr(), Szzls)) & "") - S2N(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) & "") <> 0 Then
  1424.                         WglrGrid.TextMatrix(jsq, Sydz("009", GridStr(), Szzls)) = S2N(WglrGrid.TextMatrix(jsq, Sydz("008", GridStr(), Szzls)) & "") - S2N(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) & "")
  1425.                     End If
  1426.                     '高储和低储判断
  1427.                   End If
  1428.             Case "007"
  1429.                 '1.放置字段有效性判断
  1430.             Case "008"      '盘点数量
  1431.                 If S2N(.TextMatrix(Dqpdwgh, Sydz("013", GridStr(), Szzls))) < 0 Then
  1432.                     If S2N(Str_JudgeText) > 0 Then
  1433.                         Tsxx = "金额为负值,数量不允许为正值!"
  1434.                         Dqpdwgl = Sydz("008", GridStr(), Szzls)
  1435.                         GoTo Lrcwcl
  1436.                     End If
  1437.                 ElseIf S2N(.TextMatrix(Dqpdwgh, Sydz("013", GridStr(), Szzls))) > 0 Then
  1438.                     If S2N(Str_JudgeText) < 0 Then
  1439.                         Tsxx = "金额为正值,数量不允许为负值!"
  1440.                         Dqpdwgl = Sydz("008", GridStr(), Szzls)
  1441.                         GoTo Lrcwcl
  1442.                     End If
  1443.                 End If
  1444.                 If Trim(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))) <> "" Then
  1445.                     .TextMatrix(Dqpdwgh, Sydz("009", GridStr(), Szzls)) = S2N(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))) - S2N(.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)))
  1446.                 End If
  1447.                 Call Sub_JoinCount(Dqpdwgh, Sydz("008", GridStr(), Szzls))
  1448.             Case "011"      '单价
  1449.                 '1.放置字段有效性判断
  1450.                 
  1451.                 '2.放置字段事后处理程序
  1452.                 Call Sub_JoinCount(Dqpdwgh, Sydz("011", GridStr(), Szzls))
  1453.             Case "013"      '金额
  1454.                 '1.放置字段有效性判断
  1455.                 If S2N(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))) < 0 Then
  1456.                     If S2N(Str_JudgeText) > 0 Then
  1457.                         Tsxx = "数量为负值,金额不允许为正值!"
  1458.                         Dqpdwgl = Sydz("013", GridStr(), Szzls)
  1459.                         GoTo Lrcwcl
  1460.                     End If
  1461.                 ElseIf S2N(.TextMatrix(Dqpdwgh, Sydz("008", GridStr(), Szzls))) > 0 Then
  1462.                     If S2N(Str_JudgeText) < 0 Then
  1463.                         Tsxx = "数量为正值,金额不允许为负值!"
  1464.                         Dqpdwgl = Sydz("013", GridStr(), Szzls)
  1465.                         GoTo Lrcwcl
  1466.                     End If
  1467.                 End If
  1468.                 '2.放置字段事后处理程序
  1469.                 Call Sub_JoinCount(Dqpdwgh, Sydz("013", GridStr(), Szzls))
  1470.                 
  1471.             
  1472.                 '<<以上为自定义部分]
  1473.         End Select
  1474.         
  1475.         '字段录入正确后为零字段清空(Fixed)
  1476.         Call Qkwlzd(Dqpdwgh, Dqpdwgl)
  1477.      
  1478.         '字段录入正确后进行数据合计(Fixed)
  1479.         For Coljsq = Qslz To .Cols - 1
  1480.             Call Sjhj(Coljsq)
  1481.         Next Coljsq
  1482.      
  1483.         '字段有效性判断通过,将字段有效性判断加锁直至再次改变(Fixed)
  1484.         sjzdyxxpd = True
  1485.         Yxxpdlock = True
  1486.         Exit Function
  1487.     End With
  1488.   
  1489. Lrcwcl:    '录入错误处理
  1490.     With WglrGrid
  1491.   
  1492.         '给出错误提示信息
  1493.         Call Xtxxts(Tsxx, 0, 1)
  1494.           
  1495.         '返回网格错误位置(ChangeLock避免再次引发RowColChange有效性判断),装入录入载体
  1496.         Changelock = True
  1497.         .Select Dqpdwgh, Dqpdwgl
  1498.         Changelock = False
  1499.         Call xswbk
  1500.           
  1501.         '函数返回False
  1502.         sjzdyxxpd = False
  1503.         Exit Function
  1504.     End With
  1505. End Function
  1506. Private Sub Sub_JoinCount(Lng_CountRow As Long, Lng_CountCol As Long)       '当网格列值发生改变时,处理网格列之间的关联计算(可选)
  1507.   
  1508.   '过程参数:Lng_CountRow,Lng_CountCol 网格改变内容所处行列值
  1509.    
  1510.     With WglrGrid
  1511.         Select Case GridStr(Lng_CountCol, 1)         '判断网格列对应逻辑编号
  1512.                
  1513.             '[>>以下为自定义部分
  1514.             Case "008"      '数量
  1515.                 '金额/盈亏数量=单价
  1516.                 If S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) <> 0 Then
  1517.                     If S2N(.TextMatrix(Lng_CountRow, Sydz("013", GridStr(), Szzls))) / S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) <> 0 Then
  1518.                         .TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls)) = Format(S2N(.TextMatrix(Lng_CountRow, Sydz("013", GridStr(), Szzls))) / S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))), "###0." + String(Xtdjxsws, "0"))
  1519.                     Else
  1520.                         .TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls)) = ""
  1521.                     End If
  1522.                 End If
  1523.                 '盈亏数量*计划单价=计划金额
  1524.                 If S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) * S2N(.TextMatrix(Lng_CountRow, Sydz("010", GridStr(), Szzls))) <> 0 Then
  1525.                     .TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls)) = Format(S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) * S2N(.TextMatrix(Lng_CountRow, Sydz("010", GridStr(), Szzls))), "###0." + String(Xtjexsws, "0"))
  1526.                 Else
  1527.                     .TextMatrix(Lng_CountRow, Sydz("012", GridStr(), Szzls)) = ""
  1528.                 End If
  1529.                 
  1530.             Case "011"      '单价
  1531.                 '数量*单价=金额
  1532.                 If S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) * S2N(.TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls))) <> 0 Then
  1533.                     .TextMatrix(Lng_CountRow, Sydz("013", GridStr(), Szzls)) = Format(S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) * S2N(.TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls))), "###0." + String(Xtjexsws, "0"))
  1534.                 Else
  1535.                     .TextMatrix(Lng_CountRow, Sydz("013", GridStr(), Szzls)) = ""
  1536.                 End If
  1537.                 
  1538.             Case "013"      '金额
  1539.                 If S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) <> 0 Then
  1540.                     If S2N(.TextMatrix(Lng_CountRow, Sydz("013", GridStr(), Szzls))) / S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))) <> 0 Then
  1541.                         .TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls)) = Format(S2N(.TextMatrix(Lng_CountRow, Sydz("013", GridStr(), Szzls))) / S2N(.TextMatrix(Lng_CountRow, Sydz("009", GridStr(), Szzls))), "###0." + String(Xtdjxsws, "0"))
  1542.                     End If
  1543.                 Else
  1544.                     .TextMatrix(Lng_CountRow, Sydz("013", GridStr(), Szzls)) = ""
  1545.                     .TextMatrix(Lng_CountRow, Sydz("011", GridStr(), Szzls)) = ""
  1546.                 End If
  1547.             '<<以上为自定义部分]
  1548.         End Select
  1549.     End With
  1550. End Sub
  1551. Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean                     '录入数据行有效性判断,同时进行行处理
  1552.  
  1553.     '函数参数:Yxxpdh 要进行有效性判断的网格数据行的行值
  1554.     Dim Lrywlz As Long                            '录入有误网格列值
  1555.     Dim RecTemp As New ADODB.Recordset            '临时使用动态集
  1556.     
  1557.     With WglrGrid
  1558.         If Yxxpdh > (.Rows - 1) Then Exit Function
  1559.         '判断行为空(行中所有可编辑列数据均为空或为零)和无效数据行则清除当前行
  1560.         If .TextMatrix(Yxxpdh, 0) <> "*" Then
  1561.             Sjhzyxxpd = True
  1562.             Exit Function
  1563.         Else
  1564.             If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
  1565.                 '当要判断行处于网格末行时才允许删行,否则要进行有效性判断
  1566.                 If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
  1567.                     Changelock = True
  1568.                     .RemoveItem Yxxpdh
  1569.                     If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
  1570.                         .AddItem ""
  1571.                         .RowHeight(.Rows - 1) = Sjhgd
  1572.                     End If
  1573.                     Changelock = False
  1574.                     Sjhzyxxpd = True
  1575.                     Exit Function
  1576.                 End If
  1577.             End If
  1578.         End If
  1579.   
  1580.         '行没有发生变化则不进行有效性判断
  1581.         If Hyxxpdlock Then
  1582.             Sjhzyxxpd = True
  1583.             Exit Function
  1584.         End If
  1585.   
  1586.         '[>>以下为自定义部分
  1587.     
  1588.         '1.放置行有效性判断程序
  1589.            
  1590.         '1.1首先进行单个不能为空或不能为零判断(Fixed)
  1591.         For jsqte = Qslz To .Cols - 1
  1592.             
  1593.             '字段不能为空
  1594.          If Not .ColHidden(jsqte) Then
  1595.             If GridInt(jsqte, 5) = 1 Then
  1596.                 If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  1597.                     Tsxx = GridStr(jsqte, 2)
  1598.                     Lrywlz = jsqte
  1599.                     Exit For
  1600.                 End If
  1601.             End If
  1602.             
  1603.          End If
  1604.             '字段不能为零
  1605.             If GridInt(jsqte, 5) = 2 Then
  1606.                 If S2N(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
  1607.                     Tsxx = GridStr(jsqte, 2)
  1608.                     Lrywlz = jsqte
  1609.                     Exit For
  1610.                 End If
  1611.             End If
  1612.             If conBatch = 1 Then
  1613.                 If CBool(.TextMatrix(Yxxpdh, 2)) Then
  1614.                     If Trim(.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls))) = "" Then
  1615.                         Tsxx = "此物料是批次管理,批号不能为空!"
  1616.                         Lrywlz = Sydz("006", GridStr(), Szzls)
  1617.                         
  1618.                         GoTo Lrcwcl
  1619.                     End If
  1620.                 End If
  1621.             End If
  1622.         Next jsqte
  1623.         
  1624.         '1.2进行其他有效性判断,编写格式同1.1
  1625.             
  1626.         '2.放置行处理程序(当数据行通过有效性判断)
  1627.         '以上为自定义部分<<]
  1628.     End With    'WglrGrid
  1629.     '如果此行通过行有效性判断则加锁,直至此行数据再次发生变化
  1630.     Sjhzyxxpd = True
  1631.     Hyxxpdlock = True
  1632.     Exit Function
  1633. Lrcwcl:      '录入错误处理
  1634.     With WglrGrid
  1635.   
  1636.         '给出错误提示信息
  1637.         Call Xtxxts(Tsxx, 0, 1)
  1638.       
  1639.         '返回网格错误位置 (ChangeLock避免再次引发RowColChange有效性判断), 装入录入载体
  1640.         Changelock = True
  1641.         .Select Yxxpdh, Lrywlz
  1642.         Changelock = False
  1643.         Call xswbk
  1644.     
  1645.         '函数返回False
  1646.         Sjhzyxxpd = False
  1647.         Exit Function
  1648.     End With
  1649. End Function
  1650. Private Sub Sub_AddBill()                                                '新增一张单据
  1651.     
  1652.     Dim RecTemp As New ADODB.Recordset            '临时使用动态集
  1653.     Dim jsqte As Long                             '临时计数器
  1654.     
  1655.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1656.      If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1657.         Exit Sub
  1658.      End If
  1659.     '设置操作状态为新增(Fixed)
  1660.     Lab_OperStatus.Caption = "2"
  1661.        Label1.Visible = False
  1662.     '设置工具条状态(Fixed)
  1663.     Call Sub_OperStatus("20")
  1664.    
  1665.     '清空VouchID(Fixed)
  1666.     Lab_BillId.Caption = ""
  1667.       
  1668.     '录入文本框清除内容
  1669.     For jsqte = Max_Text_Index To 0 Step -1
  1670.         LrText(jsqte).Tag = ""
  1671.         LrText(jsqte).Text = ""
  1672.     Next jsqte
  1673.    
  1674.     '[>>显示制单人,清空审核人,此处还可以设置录入默认值如自动生成单据号、默认单据录入日期注意加锁
  1675.     LrText(9).Text = Xtczy
  1676.     '读取最新的单据编码
  1677.     LrText(0).Text = CreatBillCode(BillCode, False)
  1678.        
  1679.     '设置订单日期默认为系统业务日期
  1680.     TextChangeLock = True
  1681.     LrText(2).Text = Format(Xtrq, "yyyy-mm-dd")
  1682.     TextChangeLock = False
  1683.    
  1684.     '<<]
  1685.    
  1686.     '重置网格(Fixed)
  1687.     With WglrGrid
  1688.         .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1689.         For jsqte = .FixedRows To .Rows - 1
  1690.             .RowHeight(jsqte) = Sjhgd
  1691.         Next jsqte
  1692.         WglrGrid.Clear 1
  1693.         Changelock = True
  1694.         .Select .FixedRows, Qslz
  1695.         Changelock = False
  1696.     End With
  1697.    
  1698.     '计算合计数据(清零)(Fixed)
  1699.     For jsqte = Qslz To WglrGrid.Cols - 1
  1700.         Call Sjhj(jsqte)
  1701.     Next jsqte
  1702.     
  1703.     '让第一个录入项得到焦点(Fixed)
  1704.     On Error Resume Next
  1705.     LrText(1).SetFocus
  1706.    Call VisulGrid
  1707. End Sub
  1708. Private Sub Sub_EditBill()                                                '修改一张单据
  1709.    
  1710.     Dim RecTemp As New ADODB.Recordset     '临时使用动态集
  1711.     
  1712.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1713.      If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1714.         Exit Sub
  1715.      End If
  1716.     '非有效单据不予进行修改动作
  1717.     If S2N(Lab_BillId.Caption) = 0 Then
  1718.         Exit Sub
  1719.     End If
  1720.    
  1721.     '判断当前单据是否允许修改
  1722.     If Not Fun_AllowEdit Then
  1723.         Exit Sub
  1724.     End If
  1725.    
  1726.     '设置操作状态为修改
  1727.     Lab_OperStatus.Caption = "3"
  1728.    
  1729.     '设置工具条状态
  1730.     Call Sub_OperStatus("30")
  1731.     
  1732.     LrText(1).Enabled = False       '仓库不能修改
  1733.     
  1734.     '显示制单人
  1735.     LrText(9).Text = Xtczy
  1736.     Tlb_Action.Buttons("sx").Enabled = True
  1737. End Sub
  1738. Private Sub Sub_DeleteBill()                                               '删除当前单据
  1739.     Dim YAnswer As Integer               '确认是否删除当前单据
  1740.     Dim jsqte As Long                    '临时使用计数器
  1741.     
  1742.     '判断用户是否有此功能执行权限,如有则写上机日志(进入)
  1743.      If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
  1744.         Exit Sub
  1745.      End If
  1746.     '非有效单据不予进行删除动作
  1747.     If S2N(Lab_BillId.Caption) = 0 Then
  1748.         Exit Sub
  1749.     End If
  1750.    
  1751.     Tsxx = "请确认是否删除当前单据?"
  1752.     YAnswer = Xtxxts(Tsxx, 2, 2)
  1753.    
  1754.     If YAnswer = 1 Then
  1755.    
  1756.         '判断当前单据是否允许删除
  1757.         If Not Fun_AllowEdit Then
  1758.             Exit Sub
  1759.         End If
  1760.       
  1761.         '进行事务处理
  1762.         On Error GoTo Swcwcl
  1763.         Cw_DataEnvi.DataConnect.BeginTrans
  1764.    
  1765.         '1.删除单据所有内容
  1766.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutsub Where inoutMainID=" & S2N(InID))
  1767.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutmain Where inoutMainID=" & S2N(InID))
  1768.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutsub Where inoutMainID=" & S2N(OutID))
  1769.         Cw_DataEnvi.DataConnect.Execute ("Delete gy_inoutmain Where inoutMainID=" & S2N(OutID))
  1770.         Cw_DataEnvi.DataConnect.Execute ("Delete Kf_InventorySub Where InventoryMainId=" & S2N(Lab_BillId.Caption))
  1771.         Cw_DataEnvi.DataConnect.Execute ("Delete Kf_InventoryMain Where InventoryMainId=" & S2N(Lab_BillId.Caption))
  1772.         Cw_DataEnvi.DataConnect.Execute ("update gy_warehouse set freezeflag=0 where whcode='" & Trim(LrText(1).Tag) & "'")
  1773.         Cw_DataEnvi.DataConnect.Execute ("update kf_inventorymain set actstate=0,investate='N' where inventorymainid=" & S2N(Lab_BillId.Caption))
  1774.         Cw_DataEnvi.DataConnect.CommitTrans
  1775.       
  1776.         '标识单据发生改动
  1777.         Bln_BillChange = True
  1778.   
  1779.         '单据ID置0
  1780.         Lab_BillId.Caption = 0
  1781.     Else
  1782.         Exit Sub
  1783.     End If
  1784.     
  1785.    '删除单据后重置状态
  1786.         
  1787.     '1.显示下一张单据
  1788.     Call Sub_next
  1789.         
  1790.     '2.如果无下一张单据则搜索上一张单据
  1791.     If S2N(Lab_BillId.Caption) = 0 Then
  1792.         Call Sub_Prev
  1793.     End If
  1794.         
  1795.     '3.如无单据则置单据为空状态
  1796.     If S2N(Lab_BillId.Caption) = 0 Then
  1797.         '清除录入文本框
  1798.         For jsqte = Max_Text_Index To 0 Step -1
  1799.             LrText(jsqte).Tag = ""
  1800.             LrText(jsqte).Text = ""
  1801.         Next jsqte
  1802.     
  1803.         '重置网格(Fixed)
  1804.         With WglrGrid
  1805.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1806.             For jsqte = .FixedRows To .Rows - 1
  1807.                 .RowHeight(jsqte) = Sjhgd
  1808.             Next jsqte
  1809.             WglrGrid.Clear 1
  1810.             Changelock = True
  1811.             .Select .FixedRows, Qslz
  1812.             Changelock = False
  1813.         End With
  1814.     
  1815.         '计算合计数据(清零)(Fixed)
  1816.         For jsqte = Qslz To WglrGrid.Cols - 1
  1817.             Call Sjhj(jsqte)
  1818.         Next jsqte
  1819.     
  1820.         '设置操作状态为浏览
  1821.         Lab_OperStatus = "1"
  1822.         Call Sub_OperStatus("10")
  1823.     End If
  1824.     
  1825.     Rec_Query.Requery
  1826.     Rec_Query.Find "InventoryMainId=" & S2N(Lab_BillId.Caption)
  1827.     Call VisulGrid
  1828.     Exit Sub
  1829.    
  1830. Swcwcl:          '单据删除时出现错误
  1831.     Cw_DataEnvi.DataConnect.RollbackTrans
  1832.     Tsxx = "单据删除过程中出现未知错误,程序自动恢复保存前状态!"
  1833.     Call Xtxxts(Tsxx, 0, 1)
  1834.     Exit Sub
  1835. End Sub
  1836. Private Sub Sub_AbandonBill()                                              '放弃对当前单据的操作
  1837.  
  1838.     Dim jsqte As Long                    '临时使用计数器
  1839.   
  1840.     '先关闭录入载体(Fixed)
  1841.     Changelock = True
  1842.     Valilock = True
  1843.     Call Ycwbk
  1844.     Changelock = False
  1845.     Valilock = False
  1846.     '如果单据有效则重新显示当前单据,置单据为空状态
  1847.     If Not Rec_Query.EOF Then
  1848.         Lab_BillId.Caption = Rec_Query.Fields("InventoryMainId")
  1849.         Call Sub_ShowBill
  1850.     Else
  1851.         '单据ID置为0
  1852.         Lab_BillId.Caption = 0
  1853.      
  1854.         '清除录入文本框
  1855.         For jsqte = Max_Text_Index To 0 Step -1
  1856.             LrText(jsqte).Tag = ""
  1857.             LrText(jsqte).Text = ""
  1858.         Next jsqte
  1859.         '重置网格(Fixed)
  1860.         With WglrGrid
  1861.             .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
  1862.             For jsqte = .FixedRows To .Rows - 1
  1863.                 .RowHeight(jsqte) = Sjhgd
  1864.             Next jsqte
  1865.             WglrGrid.Clear 1
  1866.             Changelock = True
  1867.             .Select .FixedRows, Qslz
  1868.             Changelock = False
  1869.         End With
  1870.         '计算合计数据(清零)(Fixed)
  1871.         For jsqte = Qslz To WglrGrid.Cols - 1
  1872.             Call Sjhj(jsqte)
  1873.         Next jsqte
  1874.     End If
  1875.     
  1876.     '设置操作状态为浏览
  1877.     Lab_OperStatus = "1"
  1878.     Call Sub_OperStatus("10")
  1879. End Sub
  1880. Private Function Sub_SaveBill() As Boolean                                   '保 存 单 据
  1881.   
  1882.     Dim RecTemp As New ADODB.Recordset                    '临时使用动态集
  1883.     Dim Rec_VouchMain As New ADODB.Recordset              '单据主表动态集
  1884.     Dim Rec_VouchSub As New ADODB.Recordset               '单据子表动态集
  1885.     Dim Rowjsq As Long                                    '网格行计数器
  1886.     Dim Coljsq As Long                                    '网格列计数器
  1887.     Dim jsqte As Integer                                  '临时计数器
  1888.     Dim Lng_RowCount As Long                              '有效数据行计数器
  1889.     Dim Lrywlz As Long                                    '录入有误列值
  1890.     Dim Int_Year As Integer
  1891.     Dim Int_Period As Integer
  1892.     
  1893.     Sub_SaveBill = False
  1894.   
  1895.     '一.============先对单据内容进行有效性判断==============='
  1896.   
  1897.     '先进行字段不能为空或不能为零有效性判断(Fixed)
  1898.     For jsqte = 0 To Max_Text_Index
  1899.         If Textint(jsqte, 8) = 1 Then     '字段不能为空
  1900.             If Len(Trim(LrText(jsqte).Text)) = 0 Then
  1901.                 Tsxx = Textstr(jsqte, 7) & "不能为空!"
  1902.                 Call Xtxxts(Tsxx, 0, 1)
  1903.                 LrText(jsqte).SetFocus
  1904.                 Exit Function
  1905.             End If
  1906.         Else
  1907.             If Textint(jsqte, 8) = 2 Then   '字段不能为零
  1908.                 If S2N(Trim(LrText(jsqte).Text)) = 0 Then
  1909.                     Tsxx = Textstr(jsqte, 7) & "不能为零!"
  1910.                     Call Xtxxts(Tsxx, 0, 1)
  1911.                     LrText(jsqte).SetFocus
  1912.                     Exit Function
  1913.                 End If
  1914.             End If
  1915.         End If
  1916.     Next jsqte
  1917.     
  1918.     '对需要进行事后判断的文本框录入内容进行有效性判断 (Fixed)
  1919.     For jsqte = 0 To Max_Text_Index
  1920.         If Textint(jsqte, 9) = 0 Or Textint(jsqte, 9) = 2 Then
  1921.             If Not TextYxxpd(jsqte) Then
  1922.                 Call TextShow(jsqte)
  1923.                 Exit Function
  1924.             End If
  1925.         End If
  1926.     Next jsqte
  1927.   
  1928.     '[>>
  1929.   
  1930.     '可在此区域写入其他对单据表头内容的有效性判断.
  1931.     
  1932.     '[判断用户所选会计期间是否有效(非结帐月份),且制单日期必须和所选会计期间一致
  1933.     If CheckBillDate(LrText(2), Int_Year, Int_Period) = True Then Exit Function
  1934.     Dim strSQLTemp As String
  1935.     Dim adoRec As New ADODB.Recordset
  1936.     Dim strSQL As String
  1937.     Dim adoRecTemp As New ADODB.Recordset
  1938.     
  1939.     strSQLTemp = "SELECT MAX(Period) AS MaxPeriod FROM GY_kjrlb WHERE kfjzbz=1 and kjyear in (select max(kjyear) from gy_kjrlb)"
  1940.     Set adoRec = Cw_DataEnvi.DataConnect.Execute(strSQLTemp)
  1941.     With adoRec
  1942.         If Not .EOF Then
  1943.             If Not IsNull(.Fields("MaxPeriod")) Then
  1944.                 If .Fields("MaxPeriod") = 12 Then
  1945.                     TempPeriod = 0
  1946.                 Else
  1947.                     TempPeriod = .Fields("MaxPeriod")
  1948.                 End If
  1949.             Else
  1950.                 TempPeriod = 0
  1951.             End If
  1952.         End If
  1953.     End With
  1954.     adoRec.Close
  1955.     Set adoRec = Nothing
  1956.     
  1957.     strSQL = "SELECT * FROM GY_WareHouse WHERE WhCode='" & Trim(LrText(1).Tag) & "'"
  1958.     Set adoRecTemp = Cw_DataEnvi.DataConnect.Execute(strSQL)
  1959.     With adoRecTemp
  1960.         If Not .EOF Then
  1961.             If Month(CDate(LrText(2).Text)) = TempPeriod + 1 Then
  1962.                 If .Fields("EndDealFlagWh") Then
  1963.                     Tsxx = "本仓库在所选会计期间已经结帐,不能再填制单据!"
  1964.                     Call Xtxxts(Tsxx, 0, 4)
  1965.                     Exit Function
  1966.                 End If
  1967.             End If
  1968.         End If
  1969.     End With
  1970.     adoRecTemp.Close
  1971.     
  1972.     '<<]
  1973.   
  1974.     '[>>下面将对所有有效数据行进行有效性判断
  1975.   
  1976.     Lng_RowCount = 0
  1977.   
  1978.     With WglrGrid
  1979.         For Rowjsq = .FixedRows To .Rows - 1
  1980.             '带*号者为有效数据行(Fixed)
  1981.             If .TextMatrix(Rowjsq, 0) <> "*" Then
  1982.                 Exit For
  1983.             Else
  1984.                 Lng_RowCount = Lng_RowCount + 1
  1985.             End If
  1986.             
  1987.             '1.首先进行为空或为零判断(Fixed)
  1988.             
  1989.             For jsqte = Qslz To .Cols - 1
  1990.             
  1991.                 '字段不能为空
  1992.                 If Not .ColHidden(jsqte) Then
  1993.                     If GridInt(jsqte, 5) = 1 Then
  1994.                         If Len(Trim(.TextMatrix(Rowjsq, jsqte))) = 0 Then
  1995.                             Tsxx = GridStr(jsqte, 2)
  1996.                             Lrywlz = jsqte
  1997.                             GoTo Lrcwcl
  1998.                             Exit For
  1999.                         End If
  2000.                     End If
  2001.                 End If
  2002.                 '字段不能为零
  2003.                 If GridInt(jsqte, 5) = 2 Then
  2004.                     If S2N(Trim(.TextMatrix(Rowjsq, jsqte))) = 0 Then
  2005.                         Tsxx = GridStr(jsqte, 2)
  2006.                         Lrywlz = jsqte
  2007.                         GoTo Lrcwcl
  2008.                         Exit For
  2009.                     End If
  2010.                 End If
  2011.             Next jsqte
  2012.                        
  2013.             '2.判断物料编码是否存在(Define)
  2014.            
  2015.         Next Rowjsq
  2016.      
  2017.         '单据分录行数不能为零(Fixed)
  2018.         If Lng_RowCount = 0 Then
  2019.             Tsxx = "单据分录行数不能为零!"
  2020.             Call Xtxxts(Tsxx, 0, 1)
  2021.             Exit Function
  2022.         End If
  2023.         
  2024.         '[>>
  2025.         '此处可以定义整张单据不能通过有效性检查的理由
  2026.         '<<]
  2027.     End With  '网格
  2028.    
  2029.    
  2030.     '二.=============如果以上有效性检查均顺利通过,则执行存盘动作============'
  2031.    
  2032.     '对存盘进行事务处理(Fixed)
  2033.     On Error GoTo Swcwcl
  2034.     Cw_DataEnvi.DataConnect.BeginTrans
  2035.     
  2036.     '判断单据状态以进行不同处理
  2037.     
  2038.     '1.先对单据主表进行处理
  2039.     If Trim(Lab_OperStatus) = "2" Then
  2040.     
  2041.         '新增单据