📄 customerinit.frm
字号:
VERSION 5.00
Begin VB.Form frmCustomerInit
Caption = "往来单位期初余额"
ClientHeight = 3990
ClientLeft = 60
ClientTop = 345
ClientWidth = 7605
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 3990
ScaleWidth = 7605
Begin VB.PictureBox picInit
Height = 2595
Left = 90
ScaleHeight = 2535
ScaleWidth = 4425
TabIndex = 8
Top = 510
Width = 4485
End
Begin VB.CommandButton cmdCustomerInit
Height = 375
Index = 3
Left = 2490
Style = 1 'Graphical
TabIndex = 7
Tag = "1012"
Top = 3480
UseMaskColor = -1 'True
Width = 1215
End
Begin VB.CommandButton cmdCustomerInit
Height = 300
Index = 2
Left = 7080
Style = 1 'Graphical
TabIndex = 4
Tag = "1017"
Top = 100
UseMaskColor = -1 'True
Width = 300
End
Begin VB.TextBox txtCustomerInit
Height = 300
Left = 4740
TabIndex = 3
Top = 120
Width = 2700
End
Begin VB.ComboBox cboCustomerInit
Height = 300
Left = 1290
Style = 2 'Dropdown List
TabIndex = 1
Top = 120
Width = 1635
End
Begin VB.CommandButton cmdCustomerInit
Caption = "试算平衡(&Q)"
Height = 375
Index = 1
Left = 1260
TabIndex = 6
Top = 3480
Width = 1215
End
Begin VB.CommandButton cmdCustomerInit
Caption = "筛选"
Height = 375
Index = 0
Left = 50
TabIndex = 5
Top = 3480
Width = 1215
End
Begin VB.Label lblCustomerInit
Caption = "查找内容(&C)"
Height = 255
Index = 2
Left = 3600
TabIndex = 2
Top = 150
Width = 1050
End
Begin VB.Label lblCustomerInit
Caption = "查找项目(&B)"
Height = 255
Index = 1
Left = 120
TabIndex = 0
Top = 150
Width = 1095
End
End
Attribute VB_Name = "frmCustomerInit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Compare Text
Private WithEvents mclsMainControl As MainControl '主控对象
Attribute mclsMainControl.VB_VarHelpID = -1
Private mblnClose As Boolean
Private mstrDec As String
Private mstrPrice As String
Private mintYear As Integer
Private mbytPeriod As Byte
Private mstrDate As String
Private mclsListSet As ListSet '列表设置对象
Private Const ViewId As Long = 114 '视图ID
Private mstrWhere As String
Private mstrHaveing As String
Private mintOldRow As Integer
Private mblnNotFind As Boolean
Private WithEvents mGrid As WINCTRLLib.DBTableCtrl
Attribute mGrid.VB_VarHelpID = -1
Private mrstData As rdoResultset
Private mlngLastPosition As Long '上次记录集位置
Private mblnLoad As Boolean
'得到会计年度及会计期间
Private Function GetYearPeriod()
mstrDec = IIf(gclsBase.NaturalCurDec = 0, "#,###,###,###", "#,###,###,##0." + String(gclsBase.NaturalCurDec, "0"))
mstrPrice = IIf(gclsBase.PriceDec = 0, "#,###,###,###", "#,###,###,##0." + String(gclsBase.PriceDec, "0"))
mintYear = gclsBase.BeginYear
mbytPeriod = gclsBase.BeginPeriod
mstrDate = Format(DateAdd("D", -1, gclsBase.BeginDate), "yyyy-mm-dd")
mblnClose = gclsBase.PeriodIsClosed(mintYear, mbytPeriod)
End Function
'得到往来期初
Private Sub GetList(Optional ByVal strWhere As String = "")
Dim strSql As String, strHaveing As String
If Not mrstData Is Nothing Then
On Error Resume Next
mrstData.Close
End If
mGrid.Clear
If strWhere = "" Then
strWhere = " And (strDate<'" & gclsBase.BeginDate & "' OR strDate Is Null Or ((Not strDate Is Null) And (dblUnVoucherDebit=0 And dblUnVoucherCredit=0))) "
Else
strWhere = " And (strDate<'" & gclsBase.BeginDate & "' OR strDate Is Null Or ((Not strDate Is Null) And (dblUnVoucherDebit=0 And dblUnVoucherCredit=0))) And (" & strWhere & ") "
End If
If mstrHaveing <> "" Then
strHaveing = " Having " & mstrHaveing
End If
If cboCustomerInit.ListIndex = 0 Then
strSql = "SELECT Customer.strCustomerCode AS 单位编码, Customer.strCustomerName AS 单位名称," & _
"Decode(Max(WrAcntDaily.lngCurrencyID)-" & gclsBase.NaturalCurId & "+Min(Account.blnIsMultCurrency)+Min(Account.blnIsAllCurrency),0,'',strCurrencyCode || ' ' || strCurrencyName) AS 币种," & _
"Decode(Sum(Decode(Account.lngAccountNatureID,3,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,3,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0')))) AS 原币应收期初余额," & _
"Decode(Sum(Decode(Account.lngAccountNatureID,4,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,4,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0')))) AS 原币应付期初余额," & _
"Decode(Sign(Sum(Decode(Account.lngAccountNatureID,3,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0))),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,3,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0)),'9,999,999,990.' || String1(" & gclsBase.NaturalCurDec & ", '0'))) AS 本币应收期初余额," & _
"Decode(Sign(Sum(Decode(Account.lngAccountNatureID,4,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0))),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,4,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0)),'9,999,999,990.' || String1(" & gclsBase.NaturalCurDec & ", '0'))) AS 本币应付期初余额," & _
"Currencys.lngCurrencyID," & _
"Customer.lngCustomerID" & _
" From Customer,Account,WrAcntDaily,Currencys" & _
" Where " & _
" Customer.lngCustomerID=WrAcntDaily.lngCustomerID(+)" & _
" And WrAcntDaily.lngAccountID=Account.lngAccountID(+)" & _
" And WrAcntDaily.lngCurrencyID=Currencys.lngCurrencyID(+)" & _
strWhere & _
" GROUP BY Customer.strCustomerCode,Customer.strCustomerName,Customer.lngCustomerID,Currencys.lngCurrencyID,Currencys.lngCurrencyID,strCurrencyCode, strCurrencyName " & strHaveing & " Order BY strCustomerCode, strCustomerName,Currencys.lngCurrencyID"
Else
strSql = "SELECT Customer.strCustomerCode AS 单位编码, Customer.strCustomerName AS 单位名称," & _
"Decode(Max(WrAcntDaily.lngCurrencyID)-" & gclsBase.NaturalCurId & "+Min(Account.blnIsMultCurrency)+Min(Account.blnIsAllCurrency),0,'',strCurrencyCode || ' ' || strCurrencyName) AS 币种," & _
"Decode(Sum(Decode(Account.lngAccountNatureID,3,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,3,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0')))) AS 原币应收期初余额," & _
"Decode(Sum(Decode(Account.lngAccountNatureID,4,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,4,Decode(Currencys.lngCurrencyID,-1,0,DeCode(Sign(Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit)),0,0,Account.intDirection*(dblCurrencyUnVoucherDebit-dblCurrencyUnVoucherCredit))),0)),Decode(Max(Currencys.bytCurrencyDec),0,'9,999,999,999','9,999,999,990.'|| String1(Max(bytCurrencyDec),'0')))) AS 原币应付期初余额," & _
"Decode(Sign(Sum(Decode(Account.lngAccountNatureID,3,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0))),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,3,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0)),'9,999,999,990.' || String1(" & gclsBase.NaturalCurDec & ", '0'))) AS 本币应收期初余额," & _
"Decode(Sign(Sum(Decode(Account.lngAccountNatureID,4,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0))),0,'',To_Char(Sum(Decode(Account.lngAccountNatureID,4,Decode(Sign(Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0,0,Account.intDirection*(dblUnVoucherDebit-dblUnVoucherCredit)),0)),'9,999,999,990.' || String1(" & gclsBase.NaturalCurDec & ", '0'))) AS 本币应付期初余额," & _
"Currencys.lngCurrencyID," & _
"Customer.lngCustomerID" & _
" From Customer,Account,WrAcntDaily,Currencys" & _
" Where " & _
" Customer.lngCustomerID=WrAcntDaily.lngCustomerID(+)" & _
" And WrAcntDaily.lngAccountID=Account.lngAccountID(+)" & _
" And WrAcntDaily.lngCurrencyID=Currencys.lngCurrencyID(+)" & _
strWhere & _
" GROUP BY Customer.strCustomerName,Customer.strCustomerCode,Customer.lngCustomerID,Currencys.lngCurrencyID,Currencys.lngCurrencyID,strCurrencyCode, strCurrencyName " & strHaveing & " Order BY strCustomerName, strCustomerCode,Currencys.lngCurrencyID"
End If
Set mrstData = gclsBase.BaseDB.OpenResultset(strSql, rdOpenStatic)
If Not mrstData.EOF Then
mrstData.MoveLast
End If
mGrid.RDORecordset = mrstData
mGrid.Rows = mrstData.RowCount + 1
mGrid.Cols = mrstData.rdoColumns.Count
SetFlexColWidth
End Sub
'设置FLEXGRID列宽
Private Sub SetFlexColWidth()
Dim intCount As Integer, intCol As Integer
Dim dblValue As Double
Dim intCols As Integer
Dim lngFlag As Long
Dim lngCount As Long
intCols = mrstData.rdoColumns.Count
With mGrid
.ClipCell = 1
.SetBorder 0, -1, 1 + 2
.SetColBorder 0, intCols, 1, 0, 2
.SelectionMode = 4
.FixedRows = 1
.ResizeCol = 1
.FixedCols = 0
.SetOption -1, -1, 0, -1, -1, -1, -1, -1
.FixedCols = 0
For intCount = 0 To 6
.ColWidth(intCount) = mclsListSet.ColumnWidth(intCount + 1) / Screen.TwipsPerPixelX
Next
'设置固定行颜色
For intCol = 0 To .Cols - 1
.SetCellPattern 0, intCol, 0, intCol, 0, RGB(192, 192, 192), -1, -1
.SetCellForeColor 0, 0, 0, intCols, RGB(0, 0, 0)
.ColName(intCol) = mrstData.rdoColumns(intCol).Name
.CellFormula(0, intCol) = mrstData.rdoColumns(intCol).Name
Next intCol
.ColWidth(7) = 0
.ColWidth(8) = 0
.SetColAlignment 3, 3, 3, 2, -1, -1, -1
.SetColAlignment 4, 4, 3, 2, -1, -1, -1
.SetColAlignment 5, 5, 3, 2, -1, -1, -1
.SetColAlignment 6, 6, 3, 2, -1, -1, -1
If .Rows > 1 Then
cmdCustomerInit(2).Enabled = True
Else
cmdCustomerInit(2).Enabled = False
End If
lngFlag = 0
For lngCount = 1 To 100
If .CellValue(lngCount, 8) <> lngFlag Then
lngFlag = .CellValue(lngCount, 8)
Else
.CellFormula(lngCount, 0) = " "
.CellFormula(lngCount, 1) = " "
End If
Next lngCount
.Row = 1
End With
End Sub
'保存FLEXGRID列宽
Private Sub SaveFlexColWidth()
Dim intCount As Integer
With mGrid
For intCount = 0 To .Cols - 3
If .ColWidth(intCount) > 0 Then
mclsListSet.ColumnWidth(intCount + 1) = .ColWidth(intCount) * Screen.TwipsPerPixelX
End If
Next
End With
End Sub
'再找
Private Sub FindAgain()
FindText txtCustomerInit.Text, True
End Sub
'重画Form
Private Sub RedrawForm()
On Error GoTo ErrHandle
'重画其余控件
txtCustomerInit.width = Me.ScaleWidth - txtCustomerInit.Left - ListFormBottom - cmdCustomerInit(2).width - 15
cmdCustomerInit(2).Left = txtCustomerInit.Left + txtCustomerInit.width
cmdCustomerInit(0).top = Me.ScaleHeight - cmdCustomerInit(0).Height - ListFormBottom
cmdCustomerInit(1).top = cmdCustomerInit(0).top
cmdCustomerInit(3).top = cmdCustomerInit(0).top
'重画MS FlexGrid 控件
With picInit
.width = Me.ScaleWidth - ListFormLeft - ListFormRight
.Height = Me.ScaleHeight - ListUpAreaHeight - ListDownAreaHeight
End With
Exit Sub
ErrHandle:
End Sub
Private Sub cboCustomerInit_Click()
If Not mblnLoad Then
Exit Sub
End If
GetList
mGrid_AfterRowChange mGrid.Row
End Sub
Private Sub cboCustomerInit_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then
Unload Me
End If
End Sub
Private Sub cmdCustomerInit_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 27 Then
Unload Me
End If
End Sub
Private Sub Form_Activate()
Dim vntMessage As Variant
For Each vntMessage In mclsMainControl.Messages
If vntMessage = Message.msgCustomerInit Then '接收到往来期初改变消息
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -