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

企业管理

开发平台:

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