+
资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:54k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form Xs_M_Return
- Caption = "回款核销管理"
- ClientHeight = 7725
- ClientLeft = 315
- ClientTop = 390
- ClientWidth = 11880
- HelpContextID = 5001
- Icon = "回款核销管理.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 7725
- ScaleWidth = 11880
- WindowState = 2 'Maximized
- Begin VB.TextBox Ydtext
- BackColor = &H80000018&
- BorderStyle = 0 'None
- Height = 285
- Left = 3060
- MultiLine = -1 'True
- TabIndex = 7
- Top = 120
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox Custom
- Height = 285
- Left = 3780
- TabIndex = 6
- Top = 120
- Visible = 0 'False
- Width = 585
- End
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 525
- Index = 0
- Left = 5460
- TabIndex = 2
- Top = 0
- Visible = 0 'False
- Width = 2595
- _ExtentX = 4577
- _ExtentY = 926
- ButtonWidth = 1455
- ButtonHeight = 926
- Appearance = 1
- Style = 1
- ImageList = "ImageList2"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 3
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存格式"
- Key = "bcgs"
- ImageKey = "bcgs"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "默认列宽"
- Key = "hfmrgs"
- ImageKey = "mrlk"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "显示项目"
- Key = "szxsxm"
- ImageKey = "xsxm"
- EndProperty
- EndProperty
- End
- Begin VB.Timer Timer1
- Enabled = 0 'False
- Interval = 1
- Left = 8400
- Top = 120
- End
- Begin VSFlex8Ctl.VSFlexGrid CxbbGrid
- Height = 3465
- Left = 90
- TabIndex = 0
- Top = 600
- Width = 11805
- _cx = 5080
- _cy = 5080
- Appearance = 1
- BorderStyle = 1
- Enabled = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- MousePointer = 0
- BackColor = 16777215
- ForeColor = -2147483640
- BackColorFixed = 13826538
- ForeColorFixed = -2147483630
- BackColorSel = -2147483635
- ForeColorSel = -2147483640
- BackColorBkg = -2147483636
- BackColorAlternate= 16777215
- GridColor = -2147483633
- GridColorFixed = -2147483632
- TreeColor = -2147483632
- FloodColor = 192
- SheetBorder = -2147483642
- FocusRect = 1
- HighLight = 1
- AllowSelection = -1 'True
- AllowBigSelection= -1 'True
- AllowUserResizing= 0
- SelectionMode = 0
- GridLines = 1
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 50
- Cols = 10
- FixedRows = 1
- FixedCols = 1
- RowHeightMin = 0
- RowHeightMax = 0
- ColWidthMin = 0
- ColWidthMax = 0
- ExtendLastCol = 0 'False
- FormatString = ""
- ScrollTrack = 0 'False
- ScrollBars = 3
- ScrollTips = 0 'False
- MergeCells = 0
- MergeCompare = 0
- AutoResize = -1 'True
- AutoSizeMode = 0
- AutoSearch = 0
- AutoSearchDelay = 2
- MultiTotals = -1 'True
- SubtotalPosition= 1
- OutlineBar = 0
- OutlineCol = 0
- Ellipsis = 0
- ExplorerBar = 0
- PicturesOver = 0 'False
- FillStyle = 0
- RightToLeft = 0 'False
- PictureType = 0
- TabBehavior = 0
- OwnerDraw = 0
- Editable = 0
- ShowComboButton = 1
- WordWrap = -1 'True
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- DataMember = ""
- ComboSearch = 3
- AutoSizeMouse = -1 'True
- FrozenRows = 0
- FrozenCols = 0
- AllowUserFreezing= 0
- BackColorFrozen = 0
- ForeColorFrozen = 0
- WallPaperAlignment= 9
- AccessibleName = ""
- AccessibleDescription= ""
- AccessibleValue = ""
- AccessibleRole = 24
- Begin VB.Label Lab_Color
- Appearance = 0 'Flat
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- ForeColor = &H80000008&
- Height = 285
- Index = 3
- Left = 270
- TabIndex = 5
- Top = 180
- Visible = 0 'False
- Width = 285
- End
- End
- Begin MSComctlLib.Toolbar SzToolbar
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 11880
- _ExtentX = 20955
- _ExtentY = 979
- ButtonWidth = 820
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList2"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 7
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "全选"
- Key = "qbxz"
- ImageKey = "qx1"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "全消"
- Key = "qbqx"
- ImageKey = "qx"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "核销"
- Key = "hx"
- ImageKey = "hx"
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 525
- Index = 1
- Left = 9000
- TabIndex = 4
- Top = 0
- Visible = 0 'False
- Width = 2595
- _ExtentX = 4577
- _ExtentY = 926
- ButtonWidth = 1455
- ButtonHeight = 926
- Appearance = 1
- Style = 1
- ImageList = "ImageList2"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 3
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存格式"
- Key = "bcgs"
- ImageKey = "bcgs"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "默认列宽"
- Key = "hfmrgs"
- ImageKey = "mrlk"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "显示项目"
- Key = "szxsxm"
- ImageKey = "xsxm"
- EndProperty
- EndProperty
- Begin MSComctlLib.ImageList ImageList2
- Left = 600
- Top = 720
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 46
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":1042
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":13DC
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":1776
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":1B10
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":1EAA
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":2244
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":25DE
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":2978
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":2D12
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":30AC
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":3446
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":37E0
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":3B7A
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":3F14
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":42AE
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":4648
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":49E2
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":4D7C
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":5116
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":54B0
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":584A
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":5BE4
- Key = "sc"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":5F7E
- Key = "sx"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":6318
- Key = "cx"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":66B2
- Key = "zd"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":6A4C
- Key = "dz"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":6DE6
- Key = "ph"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":7180
- Key = "fz"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":751A
- Key = "dw"
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":78B4
- Key = "hf"
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":7C4E
- Key = "pz"
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":7FE8
- Key = "check"
- EndProperty
- BeginProperty ListImage33 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":8382
- Key = "qs"
- EndProperty
- BeginProperty ListImage34 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":871C
- Key = "fullcheck"
- EndProperty
- BeginProperty ListImage35 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":8AB6
- Key = "qq"
- EndProperty
- BeginProperty ListImage36 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":8E50
- Key = "bcw"
- EndProperty
- BeginProperty ListImage37 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":91EA
- Key = "ye"
- EndProperty
- BeginProperty ListImage38 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":9584
- Key = ""
- EndProperty
- BeginProperty ListImage39 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":991E
- Key = "frist"
- EndProperty
- BeginProperty ListImage40 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":9CB8
- Key = "dj"
- EndProperty
- BeginProperty ListImage41 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":A052
- Key = "xj"
- EndProperty
- BeginProperty ListImage42 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":A3EC
- Key = "qx"
- EndProperty
- BeginProperty ListImage43 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":A786
- Key = "qx1"
- EndProperty
- BeginProperty ListImage44 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":AB20
- Key = "gz"
- EndProperty
- BeginProperty ListImage45 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":AEBA
- Key = "js"
- EndProperty
- BeginProperty ListImage46 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "回款核销管理.frx":B254
- Key = "hx"
- EndProperty
- EndProperty
- End
- End
- End
- Begin VSFlex8Ctl.VSFlexGrid CxbbGrid1
- Height = 3495
- Left = 90
- TabIndex = 3
- Top = 4110
- Width = 11805
- _cx = 5080
- _cy = 5080
- Appearance = 1
- BorderStyle = 1
- Enabled = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- MousePointer = 0
- BackColor = 16777215
- ForeColor = -2147483640
- BackColorFixed = 13826538
- ForeColorFixed = -2147483630
- BackColorSel = -2147483635
- ForeColorSel = -2147483640
- BackColorBkg = -2147483636
- BackColorAlternate= 16777215
- GridColor = -2147483633
- GridColorFixed = -2147483632
- TreeColor = -2147483632
- FloodColor = 192
- SheetBorder = -2147483642
- FocusRect = 1
- HighLight = 1
- AllowSelection = -1 'True
- AllowBigSelection= -1 'True
- AllowUserResizing= 0
- SelectionMode = 0
- GridLines = 1
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 50
- Cols = 10
- FixedRows = 1
- FixedCols = 1
- RowHeightMin = 0
- RowHeightMax = 0
- ColWidthMin = 0
- ColWidthMax = 0
- ExtendLastCol = 0 'False
- FormatString = ""
- ScrollTrack = 0 'False
- ScrollBars = 3
- ScrollTips = 0 'False
- MergeCells = 0
- MergeCompare = 0
- AutoResize = -1 'True
- AutoSizeMode = 0
- AutoSearch = 0
- AutoSearchDelay = 2
- MultiTotals = -1 'True
- SubtotalPosition= 1
- OutlineBar = 0
- OutlineCol = 0
- Ellipsis = 0
- ExplorerBar = 0
- PicturesOver = 0 'False
- FillStyle = 0
- RightToLeft = 0 'False
- PictureType = 0
- TabBehavior = 0
- OwnerDraw = 0
- Editable = 0
- ShowComboButton = 1
- WordWrap = -1 'True
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- DataMember = ""
- ComboSearch = 3
- AutoSizeMouse = -1 'True
- FrozenRows = 0
- FrozenCols = 0
- AllowUserFreezing= 0
- BackColorFrozen = 0
- ForeColorFrozen = 0
- WallPaperAlignment= 9
- AccessibleName = ""
- AccessibleDescription= ""
- AccessibleValue = ""
- AccessibleRole = 24
- End
- End
- Attribute VB_Name = "Xs_M_Return"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '***************************************************************************************************
- '* 模 块 名 称 :核销管理
- '* 功 能 描 述 :包括回款间,回款与货单间,货单间的三种核销方式
- '* 程序员姓名 :王长兴
- '* 最后修改人 :王长兴
- '* 最后修改时间:2001/12/28
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '***************************************************************************************************
- Dim ReportTitle As String '报表主标题
- Dim Str_QueryCondi As String '用户录入查询条件
- Dim Tsxx As String '系统提示信息
- Dim Bln_Foreign As Boolean '按原币核销标识
- Dim Int_Hxlx As Integer '核销类型
- Dim Str_CusCode As String '往来客户编码
- Dim Str_SupplierCode As String '往来供应商编码
- Public Cusname As String '客户名称
- '以下为固定使用变量
- Dim GridCode As String '显示网格网格代码
- Dim GridInf() As Variant '整个网格设置信息
- Dim Qslz As Long '网格隐藏(非操作显示)列数
- Dim Sjhgd As Double '网格数据行高度
- Dim GridBoolean() As Boolean '网格列信息(布尔型)
- Dim GridStr() As String '网格列信息(字符型)
- Dim GridInt() As Integer '网格列信息(整型)
- Dim Szzls As Integer '数组总列数(网格列数-1)
- '以下为固定使用变量(网格1)
- Dim GridCode1 As String '显示网格网格代码
- Dim GridInf1() As Variant '整个网格设置信息
- Dim Qslz1 As Long '网格隐藏(非操作显示)列数
- Dim Sjhgd1 As Double '网格数据行高度
- Dim GridBoolean1() As Boolean '网格列信息(布尔型)
- Dim GridStr1() As String '网格列信息(字符型)
- Dim GridInt1() As Integer '网格列信息(整型)
- Dim Szzls1 As Integer '数组总列数(网格列数-1)
- Private Sub Form_Load() '窗体装入
- '调 入 网 格1
- GridCode = "Xs_M_ReturnConsign"
- Call BzWgcsh(CxbbGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
- Qslz = GridInf(1)
- Sjhgd = GridInf(2)
- Szzls = CxbbGrid.Cols - 1
- '调 入 网 格 2
- GridCode1 = "Xs_M_ReturnMoneyHX"
- Call BzWgcsh(CxbbGrid1, GridCode1, GridInf1(), GridBoolean1(), GridInt1(), GridStr1())
- Qslz1 = GridInf1(1)
- Sjhgd1 = GridInf1(2)
- Szzls1 = CxbbGrid1.Cols - 1
- '对网格进行特殊设置
- CxbbGrid.Editable = True
- CxbbGrid1.Editable = True
- Timer1.Enabled = True
- With Xs_M_ReturnMoneyList.CxbbGrid
- Custom.Tag = Trim(.TextMatrix(.Row, 1)) '客户编码
- Custom.Text = Trim(.TextMatrix(.Row, Sydz("005", GridStr(), Szzls))) '部门名称
- End With
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- '卸载条件窗体
- Unload Me
- End Sub
- Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "qbxz" '全 选
- Call Sub_SelectAll
- Case "qbqx" '全 消
- Call Sub_AbandonAll
- Case "hx" '手工核销
- Call Sub_SaveData
- Case "sx" '刷 新
- Call Timer1_Timer
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- Unload Me
- End Select
- End Sub
- Private Sub Timer1_Timer()
- Timer1.Enabled = False
- Xt_Wait.Show
- Xt_Wait.Refresh
- '加快显示速度
- CxbbGrid.Redraw = False
- Call Sub_Query1 '发货单
- Call Sub_Query2 '回款
- CxbbGrid.Redraw = True
- Xt_Wait.Hide
- End Sub
- Private Sub Sub_Query1() '生成查询结果(发货单)
- Dim Rec_Query As New ADODB.Recordset '查询结果动态集
- Dim Sqlstr As String '查询字符串
- Dim Coljsq As Long '网格列计数器
- Dim Jsqte As Integer '临时动态计数器
- '以下为自定义部分[
- Str_QueryCondi = " where (billtype=1 or consignflag=1 and (kdflag=0 or receiveflag=1)) and checker <>'' and settleallflag=0 and Cuscode='" & Xs_M_ReturnMoneyList.CustomCode & "'"
- '生成应收款查询结果
- Sqlstr = "SELECT * From xs_v_consignbill " & Str_QueryCondi & " ORDER BY makedate,consignbillmainid,consignbillsubid"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With Rec_Query
- CxbbGrid.Rows = CxbbGrid.FixedRows
- CxbbGrid.Rows = CxbbGrid.FixedRows + .RecordCount + 1
- Jsqte = CxbbGrid.FixedRows
- Do While Not .EOF
- If Jsqte >= CxbbGrid.Rows Then
- CxbbGrid.AddItem ""
- End If
- CxbbGrid.TextMatrix(Jsqte, 0) = Trim(.Fields("consignbillmainid")) '发货单或退货单ID
- CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Jsqte - CxbbGrid.FixedRows + 1 '行值
- CxbbGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = False '选中
- CxbbGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Format(.Fields("MakeDate"), "yyyy-mm-dd") '单据日期
- CxbbGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("consigncode") & "") '单据号
- CxbbGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("whname") & "") '货物名称
- CxbbGrid.TextMatrix(Jsqte, 1) = Trim(.Fields("warecode") & "") '货物编码
- CxbbGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Val(.Fields("capitalwhole") & "") '金额
- CxbbGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Val(.Fields("capitalwhole") & "") - Val(.Fields("capreturnmoney") & "") '未核销金额
- CxbbGrid.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = "" '本次核销金额
- CxbbGrid.TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = False '是否销尽
- CxbbGrid.RowHeight(Jsqte) = Sjhgd
- Jsqte = Jsqte + 1
- .MoveNext
- Loop
- CxbbGrid.RowHeight(Jsqte) = Sjhgd
- CxbbGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = "合计"
- End With
- ']以上为用户自定义部分
- End Sub
- Private Sub Sub_Query2() '生成查询结果(回款)
- Dim Rec_Query As New ADODB.Recordset '查询结果动态集
- Dim Sqlstr As String '查询字符串
- Dim Coljsq As Long '网格列计数器
- Dim Jsqte As Integer '临时动态计数器
- '以下为自定义部分[
- Str_QueryCondi = " where checker <>'' and capitalremainmoney<>0 and Cuscode='" & Xs_M_ReturnMoneyList.CustomCode & "'"
- '生成应收款查询结果
- Sqlstr = "SELECT * From Xs_V_ReturnMoney " & Str_QueryCondi & " ORDER BY makerdate,ReturnMoneyId"
- Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With Rec_Query
- CxbbGrid1.Rows = CxbbGrid1.FixedRows
- CxbbGrid1.Rows = CxbbGrid1.FixedRows + .RecordCount + 1
- Jsqte = CxbbGrid1.FixedRows
- Do While Not .EOF
- If Jsqte >= CxbbGrid1.Rows Then
- CxbbGrid1.AddItem ""
- End If
- CxbbGrid1.TextMatrix(Jsqte, 0) = Trim(.Fields("ReturnMoneyId")) '发货单或退货单ID
- CxbbGrid1.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Jsqte - CxbbGrid1.FixedRows + 1 '行值
- CxbbGrid1.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = False '选中
- CxbbGrid1.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Format(.Fields("MakerDate"), "yyyy-mm-dd") '单据日期
- CxbbGrid1.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("ReturnMoneyCode") & "") '单据号
- CxbbGrid1.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Val(.Fields("CapitalReturnMoney") & "") '金额
- CxbbGrid1.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Val(.Fields("CapitalRemainMoney") & "") '未核销金额
- CxbbGrid1.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = "" '本次核销金额
- CxbbGrid1.RowHeight(Jsqte) = Sjhgd
- Jsqte = Jsqte + 1
- .MoveNext
- Loop
- CxbbGrid1.RowHeight(Jsqte) = Sjhgd
- CxbbGrid1.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = "合计"
- End With
- ']以上为用户自定义部分
- End Sub
- '输入本次核销金额(网格1)
- Private Sub CxbbGrid_BeforeEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
- With CxbbGrid
- If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Or .Row = .Rows - 1 Then
- Cancel = True
- End If
- If GridInt(.Col, 2) <> 0 Then
- CxbbGrid.EditMaxLength = GridInt(.Col, 2)
- Else
- CxbbGrid.EditMaxLength = 3000
- End If
- End With
- End Sub
- Private Sub CxbbGrid_KeyPressEdit(ByVal Row As Long, ByVal Col As Long, KeyAscii As Integer)
- With CxbbGrid
- If Col = Sydz("008", GridStr(), Szzls) And CxbbGrid.Cell(flexcpBackColor, Row, Col) <> Ydtext.BackColor Then
- .TextMatrix(.Rows - 1, Col) = Val(.TextMatrix(.Rows - 1, Col)) - Val(.TextMatrix(.Row, Col))
- .CellBackColor = Ydtext.BackColor
- .EditText = ""
- End If
- End With
- Call Sub_Lrxszxz(CxbbGrid, KeyAscii)
- End Sub
- Private Sub CxbbGrid_ChangeEdit()
- With CxbbGrid
- Select Case GridInt(.Col, 1)
- Case 8
- Call Sub_Sjgskz(CxbbGrid, Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9
- Call Sub_Sjgskz(CxbbGrid, Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10
- Call Sub_Sjgskz(CxbbGrid, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else
- If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
- Call Sub_Sjgskz(CxbbGrid, GridInt(.Col, 3), GridInt(.Col, 4))
- End If
- End Select
- End With
- End Sub
- Private Sub CxbbGrid_AfterEdit(ByVal Row As Long, ByVal Col As Long) '事后判断用户录入有效性
- With CxbbGrid
- Select Case Col
- Case Sydz("008", GridStr(), Szzls)
- .CellBackColor = &H0
- If Not Trim(.EditText) = "" Then
- If Not IsNumeric(Trim(.TextMatrix(Row, Col))) Then
- Tsxx = "数据格式有误!"
- Call Xtxxts(Tsxx, 0, 4)
- .TextMatrix(Row, Col) = ""
- Exit Sub
- End If
- End If
- If Val(.TextMatrix(Row, Sydz("007", GridStr(), Szzls))) < 0 Then
- .TextMatrix(Row, Col) = -Abs(Val(.TextMatrix(Row, Col)))
- Else
- .TextMatrix(Row, Col) = Abs(Val(.TextMatrix(Row, Col)))
- End If
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = True
- If Abs(.TextMatrix(Row, Col)) >= Abs(.TextMatrix(Row, Sydz("007", GridStr(), Szzls))) Then
- .TextMatrix(Row, Col) = Val(.TextMatrix(Row, Sydz("007", GridStr(), Szzls)))
- .TextMatrix(Row, Sydz("009", GridStr(), Szzls)) = True
- Else
- .TextMatrix(Row, Sydz("009", GridStr(), Szzls)) = False
- End If
- If Val(.TextMatrix(Row, Col)) = 0 Then
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = False
- .TextMatrix(Row, Sydz("009", GridStr(), Szzls)) = False
- .TextMatrix(Row, Sydz("008", GridStr(), Szzls)) = ""
- End If
- .TextMatrix(.Rows - 1, Col) = Val(.TextMatrix(.Rows - 1, Col)) + Val(.TextMatrix(Row, Col))
- Case Sydz("002", GridStr(), Szzls)
- If Val(.TextMatrix(Row, Sydz("008", GridStr(), Szzls))) = 0 Then
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = False
- Else
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = True
- End If
- .TextMatrix(.Rows - 1, Sydz("002", GridStr(), Szzls)) = False
- Case Sydz("009", GridStr(), Szzls)
- .TextMatrix(.Rows - 1, Sydz("009", GridStr(), Szzls)) = False
- End Select
- End With
- End Sub
- '输入本次核销金额(网格2)
- Private Sub CxbbGrid1_BeforeEdit(ByVal Row As Long, ByVal Col As Long, Cancel As Boolean)
- With CxbbGrid1
- If Not GridBoolean1(.Col, 1) Or .Row < .FixedRows Or .Row = .Rows - 1 Then
- Cancel = True
- End If
- If GridInt1(.Col, 2) <> 0 Then
- CxbbGrid1.EditMaxLength = GridInt1(.Col, 2)
- Else
- CxbbGrid1.EditMaxLength = 3000
- End If
- End With
- End Sub
- Private Sub CxbbGrid1_KeyPressEdit(ByVal Row As Long, ByVal Col As Long, KeyAscii As Integer)
- With CxbbGrid1
- If Col = Sydz("007", GridStr(), Szzls) And .Cell(flexcpBackColor, Row, Col) <> Ydtext.BackColor Then
- .TextMatrix(.Rows - 1, Col) = Val(.TextMatrix(.Rows - 1, Col)) - Val(.TextMatrix(.Row, Col))
- .CellBackColor = Ydtext.BackColor
- .EditText = ""
- End If
- End With
- Call Sub_Lrxszxz(CxbbGrid1, KeyAscii)
- End Sub
- Private Sub CxbbGrid1_ChangeEdit()
- With CxbbGrid1
- Select Case GridInt1(.Col, 1)
- Case 8
- Call Sub_Sjgskz(CxbbGrid1, Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9
- Call Sub_Sjgskz(CxbbGrid1, Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10
- Call Sub_Sjgskz(CxbbGrid1, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else
- If GridInt1(.Col, 3) <> 0 Or GridInt1(.Col, 4) <> 0 Then
- Call Sub_Sjgskz(CxbbGrid1, GridInt1(.Col, 3), GridInt1(.Col, 4))
- End If
- End Select
- End With
- End Sub
- Private Sub CxbbGrid1_AfterEdit(ByVal Row As Long, ByVal Col As Long) '事后判断用户录入有效性
- With CxbbGrid1
- Select Case Col
- Case Sydz("007", GridStr(), Szzls)
- .CellBackColor = &H0
- If Not Trim(.EditText) = "" Then
- If Not IsNumeric(Trim(.TextMatrix(Row, Col))) Then
- Tsxx = "数据格式有误!"
- Call Xtxxts(Tsxx, 0, 4)
- .TextMatrix(Row, Col) = ""
- Exit Sub
- End If
- End If
- If Val(.TextMatrix(Row, Sydz("006", GridStr(), Szzls))) < 0 Then
- .TextMatrix(Row, Col) = -Abs(Val(.TextMatrix(Row, Col)))
- Else
- .TextMatrix(Row, Col) = Abs(Val(.TextMatrix(Row, Col)))
- End If
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = True
- If Abs(.TextMatrix(Row, Col)) >= Abs(.TextMatrix(Row, Sydz("006", GridStr(), Szzls))) Then
- .TextMatrix(Row, Col) = Val(.TextMatrix(Row, Sydz("006", GridStr(), Szzls)))
- End If
- If Val(.TextMatrix(Row, Col)) = 0 Then
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = False
- .TextMatrix(Row, Sydz("007", GridStr(), Szzls)) = ""
- End If
- .TextMatrix(.Rows - 1, Col) = Val(.TextMatrix(.Rows - 1, Col)) + Val(.TextMatrix(Row, Col))
- Case Sydz("002", GridStr(), Szzls)
- If Val(.TextMatrix(Row, Sydz("007", GridStr(), Szzls))) = 0 Then
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = False
- Else
- .TextMatrix(Row, Sydz("002", GridStr(), Szzls)) = True
- End If
- .TextMatrix(.Rows - 1, Sydz("002", GridStr(), Szzls)) = False
- End Select
- End With
- End Sub
- '公用数值控制函数
- Private Sub Sub_Lrxszxz(WglrGrid As VSFlexGrid, lrzfasc As Integer) '网格录入带有小数位及正负号数值字段
- If Not ((Chr(lrzfasc) >= "0" And Chr(lrzfasc) <= "9") Or (Chr(lrzfasc) = "." And InStr(1, WglrGrid.EditText, ".") = 0) Or lrzfasc = vbKeyBack Or (Chr(lrzfasc) = "-" And WglrGrid.EditSelStart = 0)) Then
- lrzfasc = 0
- End If
- End Sub
- Private Sub Sub_Sjgskz(WglrGrid As VSFlexGrid, zsws As Integer, xsws As Integer) '保证数值录入字段录入格式
- '输入参数:sjwb 录入的值 zsws 数值录入限制整数位数 xsws 数值录入限制小数位数
- Dim bccrd%
- Dim Ws, Zswstr, Xswstr As String
- Dim B_fu As Boolean
- Dim sjzws As Integer
- Dim Sjwb As String
- Sjwb = WglrGrid.EditText
- bccrd = WglrGrid.EditSelStart
- B_fu = False
- Ws = InStr(1, Sjwb, "-")
- If Ws > 0 Then Sjwb = Mid(Sjwb, Ws)
- If Left(Sjwb, 1) = "-" Then
- B_fu = True
- zsws = zsws - 1
- Zswstr = Mid(Sjwb, 2)
- Else
- Zswstr = Mid(Sjwb, 1)
- End If
- Ws = InStr(1, Zswstr, ".") '整数位数+1
- If Ws > 0 Then
- If zsws > Ws - 1 Then
- Zswstr = Mid(Zswstr, 1, Ws - 1) + Mid(Zswstr, Ws, xsws + 1)
- Else
- Zswstr = Mid(Zswstr, 1, zsws) + Mid(Zswstr, Ws, xsws + 1)
- Ws = InStr(1, Zswstr, ".") '整数位数+1
- End If
- Ws = Len(Zswstr) - Ws '小数位数
- If Left(Zswstr, 1) = "." Then
- bccrd = bccrd + 1
- Zswstr = "0" & Zswstr
- End If
- If Ws < xsws Then
- Zswstr = Format(Zswstr, "#0." + String(Ws, "0"))
- Else
- Zswstr = Format(Zswstr, "#0." + String(xsws, "0"))
- End If
- Else
- Zswstr = Mid(Zswstr, 1, zsws)
- Zswstr = Format(Zswstr)
- End If
- If B_fu Then Zswstr = "-" & Zswstr
- WglrGrid.EditText = Zswstr
- WglrGrid.EditSelStart = bccrd
- End Sub
- '以下为网格选中操作
- Private Sub CxbbGrid_DblClick()
- With CxbbGrid
- If .Row = .Rows - 1 Then Exit Sub
- If .Col = Sydz("009", GridStr(), Szzls) Then
- If .TextMatrix(.Row, Sydz("009", GridStr(), Szzls)) Then
- .TextMatrix(.Row, Sydz("009", GridStr(), Szzls)) = False
- Else
- .TextMatrix(.Row, Sydz("009", GridStr(), Szzls)) = True
- End If
- Exit Sub
- End If
- If .Col <> Sydz("008", GridStr(), Szzls) Then
- If Not Trim(.TextMatrix(.Row, Sydz("002", GridStr(), Szzls))) And Abs(Val(.TextMatrix(.Row, Sydz("007", GridStr(), Szzls)))) > 0 Then
- .TextMatrix(.Row, Sydz("002", GridStr(), Szzls)) = True
- .TextMatrix(.Row, Sydz("009", GridStr(), Szzls)) = True
- .TextMatrix(.Row, Sydz("008", GridStr(), Szzls)) = Val(.TextMatrix(.Row, Sydz("007", GridStr(), Szzls)))
- .TextMatrix(.Rows - 1, Sydz("008", GridStr(), Szzls)) = Val(.TextMatrix(.Rows - 1, Sydz("008", GridStr(), Szzls))) + Val(.TextMatrix(.Row, Sydz("008", GridStr(), Szzls)))
- Else
- .TextMatrix(.Rows - 1, Sydz("008", GridStr(), Szzls)) = Val(.TextMatrix(.Rows - 1, Sydz("008", GridStr(), Szzls))) - Val(.TextMatrix(.Row, Sydz("008", GridStr(), Szzls)))
- .TextMatrix(.Row, Sydz("002", GridStr(), Szzls)) = False
- .TextMatrix(.Row, Sydz("009", GridStr(), Szzls)) = False
- .TextMatrix(.Row, Sydz("008", GridStr(), Szzls)) = ""
- End If
- Else
- .EditCell
- .CellBackColor = Ydtext.BackColor
- .EditText = "" & .EditText
- .EditSelStart = Len(Trim(.EditText))
- .TextMatrix(.Rows - 1, Sydz("008", GridStr(), Szzls)) = Val(.TextMatrix(.Rows - 1, Sydz("008", GridStr(), Szzls))) - Val(.TextMatrix(.Row, Sydz("008", GridStr(), Szzls)))
- End If
- End With
- End Sub
- Private Sub CxbbGrid1_DblClick()
- With CxbbGrid1
- If .Row = .Rows - 1 Then Exit Sub
- If .Col <> Sydz("007", GridStr(), Szzls) Then
- If Not Trim(.TextMatrix(.Row, Sydz("002", GridStr(), Szzls))) And Abs(Val(.TextMatrix(.Row, Sydz("006", GridStr(), Szzls)))) > 0 Then
- .TextMatrix(.Row, Sydz("002", GridStr(), Szzls)) = True
- .TextMatrix(.Row, Sydz("007", GridStr(), Szzls)) = Val(.TextMatrix(.Row, Sydz("006", GridStr(), Szzls)))
- .TextMatrix(.Rows - 1, Sydz("007", GridStr(), Szzls)) = Val(.TextMatrix(.Rows - 1, Sydz("007", GridStr(), Szzls))) + Val(.TextMatrix(.Row, Sydz("007", GridStr(), Szzls)))
- Else
- .TextMatrix(.Rows - 1, Sydz("007", GridStr(), Szzls)) = Val(.TextMatrix(.Rows - 1, Sydz("007", GridStr(), Szzls))) - Val(.TextMatrix(.Row, Sydz("007", GridStr(), Szzls)))
- .TextMatrix(.Row, Sydz("002", GridStr(), Szzls)) = False
- .TextMatrix(.Row, Sydz("007", GridStr(), Szzls)) = ""
- End If
- Else
- .EditCell
- .CellBackColor = Ydtext.BackColor
- .EditText = "" & .EditText
- .EditSelStart = Len(Trim(.EditText))
- .TextMatrix(.Rows - 1, Sydz("007", GridStr(), Szzls)) = Val(.TextMatrix(.Rows - 1, Sydz("007", GridStr(), Szzls))) - Val(.TextMatrix(.Row, Sydz("007", GridStr(), Szzls)))
- End If
- End With
- End Sub
- Private Sub Sub_SelectAll() '全选
- Dim SumTemp As Double
- With CxbbGrid
- SumTemp = 0
- For Jsqte = .FixedRows To .Rows - 2
- If Val(.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls))) <> 0 Then
- .TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = True
- .TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = True
- .TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = .TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls))
- SumTemp = SumTemp + Val(.TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)))
- End If
- Next Jsqte
- .TextMatrix(.Rows - 1, Sydz("008", GridStr(), Szzls)) = SumTemp
- End With
- With CxbbGrid1
- SumTemp = 0
- For Jsqte = .FixedRows To .Rows - 2
- If Val(.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls))) <> 0 Then
- CxbbGrid1.TextMatrix(Jsqte, Sydz("002", GridStr1(), Szzls1)) = True
- .TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = .TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls))
- SumTemp = SumTemp + Val(.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)))
- End If
- Next Jsqte
- .TextMatrix(.Rows - 1, Sydz("007", GridStr(), Szzls)) = SumTemp
- End With
- End Sub
- Private Sub Sub_AbandonAll() '全消
- With CxbbGrid
- For Jsqte = .FixedRows To .Rows - 1
- .TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = False
- .TextMatrix(Jsqte, Sydz("009", GridStr(), Szzls)) = False
- .TextMatrix(Jsqte, Sydz("008", GridStr(), Szzls)) = ""
- Next Jsqte
- End With
- With CxbbGrid1
- For Jsqte = .FixedRows To .Rows - 1
- .TextMatrix(Jsqte, Sydz("002", GridStr1(), Szzls1)) = False
- .TextMatrix(Jsqte, Sydz("007", GridStr1(), Szzls1)) = ""
- Next Jsqte
- End With
- End Sub
- Private Sub Sub_SaveData() '核销存盘
- Dim Jsq As Long
- Dim strTemp As String
- Dim RsTemp As New ADODB.Recordset
- Dim BlTemp As Boolean
- Dim RecTemp As New ADODB.Recordset
- Dim TempId As Double
- Dim ExchRate As Long
- Dim ConvertFlag As Boolean
- Dim CreateCode As String
- BlTemp = False
- With CxbbGrid
- For Jsq = .FixedRows To .Rows - 2
- If Trim(.TextMatrix(Jsq, Sydz("002", GridStr(), Szzls))) Or Trim(.TextMatrix(Jsq, Sydz("009", GridStr(), Szzls))) Then
- BlTemp = True
- End If
- Next
- End With
- With CxbbGrid1
- For Jsq = .FixedRows To .Rows - 2
- If .TextMatrix(Jsq, Sydz("002", GridStr(), Szzls)) Then
- BlTemp = True
- End If
- Next
- End With
- If Not BlTemp Then
- Tsxx = "请选定核销数据!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End If
- If Val(CxbbGrid.TextMatrix(CxbbGrid.Rows - 1, Sydz("008", GridStr(), Szzls))) <> Val(CxbbGrid1.TextMatrix(CxbbGrid1.Rows - 1, Sydz("007", GridStr(), Szzls))) Then
- Tsxx = "货单金额与回款金额不符!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End If
- On Error GoTo Swcwcl
- Cw_DataEnvi.DataConnect.BeginTrans
- CreateCode = CreatBillCode(1409, True)
- strTemp = "select * from Xs_MoneyWare where 1=2"
- RsTemp.Open strTemp, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With RsTemp
- For Jsq = CxbbGrid.FixedRows To CxbbGrid.Rows - 2
- If Trim(CxbbGrid.TextMatrix(Jsq, Sydz("002", GridStr(), Szzls))) Or Trim(CxbbGrid.TextMatrix(Jsq, Sydz("009", GridStr(), Szzls))) Then
- TempId = Val(CxbbGrid.TextMatrix(Jsq, 0)) '单据Id
- '回写核销关系表
- .AddNew
- .Fields("MoneyWareCode") = CreateCode '标识为同次核销
- .Fields("kjyear") = Xtyear
- .Fields("period") = Xtmm
- .Fields("billtype") = 1
- .Fields("billid") = TempId
- .Fields("MoneyWareSubId") = Val(CxbbGrid.TextMatrix(Jsq, Sydz("001", GridStr(), Szzls)))
- .Fields("billcode") = CxbbGrid.TextMatrix(Jsq, Sydz("004", GridStr(), Szzls)) '单据号
- .Fields("cuscode") = Custom.Tag
- .Fields("warecode") = CxbbGrid.TextMatrix(Jsq, 1)
- .Fields("CapitalUsedMoney") = Val(CxbbGrid.TextMatrix(Jsq, Sydz("008", GridStr(), Szzls)))
- .Fields("verifier") = Xtczy
- .Fields("verifierdate") = Format(Xtrq, "yyyy-mm-dd")
- .Update
- '回填发货单
- Sqlstr = "select * from xs_consignbillmain where ConsignBillMainID='" & TempId & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- ExchRate = Trim(RecTemp.Fields("exchrate")) '汇率
- ConvertFlag = Trim(RecTemp.Fields("convertflag")) '折算方式
- RecTemp.Close
- Sqlstr = "select * from Xs_ConsignBillsub where ConsignBillMainID='" & TempId & "' and warecode='" & Trim(CxbbGrid.TextMatrix(Jsq, 1)) & "'"
- RecTemp.Open Sqlstr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- RecTemp.Fields("CapReturnMoney") = RecTemp.Fields("capreturnmoney") + .Fields("CapitalUsedMoney")
- If ConvertFlag Then
- RecTemp.Fields("returnmoney") = RecTemp.Fields("returnmoney") + Format(.Fields("CapitalUsedMoney") * ExchRate, "###0." + String(Xtjexsws, "0"))
- Else
- RecTemp.Fields("returnmoney") = RecTemp.Fields("returnmoney") + Format(.Fields("CapitalUsedMoney") / ExchRate, "###0." + String(Xtjexsws, "0"))
- End If
- If CxbbGrid.TextMatrix(Jsq, Sydz("009", GridStr(), Szzls)) Then
- RecTemp.Fields("settleallflag") = 1
- End If
- RecTemp.Update
- RecTemp.Close
- End If
- Next
- For Jsq = CxbbGrid1.FixedRows To CxbbGrid1.Rows - 2
- If Trim(CxbbGrid1.TextMatrix(Jsq, Sydz("002", GridStr(), Szzls))) Then
- TempId = Val(CxbbGrid1.TextMatrix(Jsq, 0)) '单据Id
- '回写核销关系表
- .AddNew
- .Fields("MoneyWareCode") = CreateCode '标识为同次核销
- .Fields("kjyear") = Xtyear
- .Fields("period") = Xtmm
- .Fields("billtype") = 0
- .Fields("billid") = TempId
- .Fields("MoneyWareSubId") = Val(CxbbGrid1.TextMatrix(Jsq, Sydz("001", GridStr(), Szzls)))
- .Fields("billcode") = CxbbGrid1.TextMatrix(Jsq, Sydz("004", GridStr(), Szzls)) '单据号
- .Fields("cuscode") = Custom.Tag
- .Fields("CapitalUsedMoney") = Val(CxbbGrid1.TextMatrix(Jsq, Sydz("007", GridStr(), Szzls)))
- .Fields("verifier") = Xtczy
- .Fields("verifierdate") = Format(Xtrq, "yyyy-mm-dd")
- .Update
- '回填回款表
- Sqlstr = "Update Xs_ReturnMoney set CapitalRemainMoney=CapitalRemainMoney-(" & Val(.Fields("CapitalUsedMoney")) & ") Where ReturnMoneyID='" & TempId & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- End If
- Next
- End With
- Cw_DataEnvi.DataConnect.CommitTrans
- SzToolbar.Buttons("qbxz").Enabled = False '全选
- SzToolbar.Buttons("qbqx").Enabled = False '全消
- SzToolbar.Buttons("hx").Enabled = False '核销(存盘)
- Tsxx = "单据核销完毕! "
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- Swcwcl: '数据存盘时出现错误
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "核销过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Sub
- End Sub
- '==============================将来删除============================
- Private Sub GsToolbar_ButtonClick(Index As Integer, ByVal Button As MSComctlLib.Button)
- If Index = 1 Then
- Select Case Button.Key
- Case "bcgs" '保存表格格式
- Call Bcwggs(CxbbGrid1, GridCode1, GridStr())
- Case "hfmrgs" '恢复默认格式
- Call Hfmrgs(CxbbGrid1, GridCode1, GridStr())
- Case "szxsxm" '设置显示项目
- Call Szxsxm(CxbbGrid1, GridCode1)
- End Select
- Else
- Select Case Button.Key
- Case "bcgs" '保存表格格式
- Call Bcwggs(CxbbGrid, GridCode, GridStr())
- Case "hfmrgs" '恢复默认格式
- Call Hfmrgs(CxbbGrid, GridCode, GridStr())
- Case "szxsxm" '设置显示项目
- Call Szxsxm(CxbbGrid, GridCode)
- End Select
- End If
- End Sub