📄 frmacountbook.frm
字号:
mlngNowTotal(intCol) = 0
End If
Next intCol
End If
.AddItem "", AddRow + 1
If mintRemarkCol > 0 Then
.TextMatrix(AddRow + 1, mintRemarkCol) = strSum
.TextMatrix(AddRow + 1, mintMonthCol) = Format(mstrMonth, "00")
If mintAmountBanCol > 0 Then
.TextMatrix(AddRow + 1, mintAmountBanCol) = Format(.TextMatrix(AddRow, mintAmountBanCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
End If
If mintQuantityBanCol > 0 Then
.TextMatrix(AddRow + 1, mintQuantityBanCol) = .TextMatrix(AddRow, mintQuantityBanCol)
End If
If mintCurrencyBanCol > 0 Then
.TextMatrix(AddRow + 1, mintCurrencyBanCol) = .TextMatrix(AddRow, mintCurrencyBanCol)
If mstrCurName <> "" Then
.TextMatrix(AddRow + 1, mintCurrencyBanCol) = Format(.TextMatrix(AddRow + 1, mintCurrencyBanCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
End If
End If
If (mintAmountBanCol > -1 And mintDirectCol > -1) Or (mclsReportSet.ViewId = 681 And mintCurrencyBanCol > 0 And mintDirectCol > -1) Then
.TextMatrix(AddRow + 1, mintDirectCol) = .TextMatrix(AddRow, mintDirectCol)
End If
.RowData(AddRow + 1) = 2
For intCol = 3 To .Cols - 1
If mlngNowAll(intCol) <> "Err" And mlngNowAll(intCol) <> "" Then
'单价不用合计(委托加工商品帐的数量也不用合计)
strName = mclsReportSet.ColumnDesc(intCol + 1)
If InStr(strName, "单价") = 0 And InStr(strName, "对方科目") = 0 And _
Not (mclsReportSet.ViewId = 176 And InStr(strName, "数量") <> 0) Then
.TextMatrix(AddRow + 1, intCol) = IIf(mlngNowAll(intCol) <> 0, mlngNowAll(intCol), "")
If InStr(1, strName, "原币") = 0 And (InStr(1, strName, "本币") <> 0 Or InStr(1, strName, "借方金额") <> 0 Or InStr(1, strName, "贷方金额") <> 0 _
Or InStr(1, strName, "原值增加") <> 0 Or InStr(1, strName, "原值减少") <> 0 _
Or InStr(1, strName, "累计折旧增加") <> 0 Or InStr(1, strName, "累计折旧减少") <> 0) Then
.TextMatrix(AddRow + 1, intCol) = Format(.TextMatrix(AddRow + 1, intCol), gclsBase.GetFormat(gclsBase.NaturalCurDec))
End If
If InStr(1, strName, "原币") <> 0 And mstrCurName <> "" Then
.TextMatrix(AddRow + 1, intCol) = Format(.TextMatrix(AddRow + 1, intCol), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName)))
End If
If InStr(1, strName, "数量") <> 0 Then
.TextMatrix(AddRow + 1, intCol) = Format(.TextMatrix(AddRow + 1, intCol), strQuantityFormat)
End If
End If
End If
Next intCol
End If
.Redraw = True
End With
End Sub
'零值处理、余额计算、合计、累计
Private Sub ClearZero(Optional IsFirst As Boolean = True, Optional blnAll As Boolean = False)
Dim intRow As Integer, intCol As Integer
Dim intVisibleRow As Integer
Dim intCount As Integer, RowVisible As Boolean
Dim intLastRow As Integer, intNowRow As Integer, intOldLastRow As Integer
Dim bytQA As Byte
Dim intDirect As Integer, intAcntDirect As Integer
Dim intMakeDirect As Integer '发生方向
Dim strName As String
Dim dblOne As Double, dblTwo As Double
Dim strType As String, strMonth As String
Dim intYear As Integer, intMonth As Integer, intDay As Integer
Dim dblNature As Double, dblCurrency As Double, dblQuantity As Double
Dim intBookRows As Integer
Dim intEndRow As Integer
Dim strQuantityFormat As String
If mclsReportSet.ViewId = 598 Then
strQuantityFormat = "#0.00"
Else
strQuantityFormat = GetDec(2)
End If
intBookRows = ABook.MaxRows
With grdAcntBook
If mintMastDealRow <= .Rows - 1 Then
.Redraw = False
intRow = mintMastDealRow
intCount = mintMastDealRow
If mclsReportSet.ReportType = msgTotal Or blnAll Then
intEndRow = grdAcntBook.Rows - 1
Else
If mintNowPage <= 5 Then
intEndRow = mintMastDealRow + intBookRows * 5
Else
intEndRow = mintMastDealRow + intBookRows * mintNowPage
End If
End If
Do While intRow <= intEndRow
If (intRow + 1) / intBookRows = Int((intRow + 1) / intBookRows) And intRow <= .Rows - 1 Then
intOldLastRow = intRow
AddPeriodEnd intRow, , True
intRow = intRow + 1
AddPeriodEnd intRow, , , True
intRow = intRow + 1
End If
If intRow > .Rows - 1 Then
If Not mblnIsOver Then
If mclsReportSet.ReportType = msgDay Then
AddDayTotal
End If
AddPeriodEnd , True
mblnIsOver = True
End If
Exit Do
Else
intYear = Val(GetNoXString(grdAcntBook.TextMatrix(intRow, 0), 5, "/"))
strMonth = Val(GetNoXString(grdAcntBook.TextMatrix(intRow, 0), 6, "/"))
intDay = Val(.TextMatrix(intRow, mintDayCol))
'** IF 1 **
If strMonth <> "0" And .TextMatrix(intRow, mintMonthCol) <> "" And Not (Val(strMonth) = Val(mstrMonth) And strMonth <> "0" And Val(intDay) = Val(mstrDay) And (mintYear = intYear Or (intYear = 0 Or mintYear = 0))) Then
'日记帐
If mclsReportSet.ReportType = msgDay Then
AddDayTotal intRow
intRow = intRow + 1
End If
If Trim(strMonth) <> Trim(mstrMonth) Or mintYear <> intYear Then
If mintYear <> intYear Then
AddPeriodEnd intRow, True
Else
AddPeriodEnd intRow
End If
intRow = intRow + 2
End If
If .RowData(intRow) = 1 Or .RowData(intRow) = 2 Then
intRow = intRow + 1
End If
If intRow <= .Rows - 1 Then
mstrDay = .TextMatrix(intRow, mintDayCol)
End If
mstrMonth = strMonth
'** ELSE OF IF 1
Else
If Not (.RowData(intRow) = 1 Or .RowData(intRow) = 2) Then
RowVisible = .RowIsVisible(intRow)
If intOldLastRow <> 0 Then
intLastRow = intOldLastRow - 1
intOldLastRow = 0
Else
intLastRow = intRow - 1
End If
For intCol = 3 To .Cols - 1
strName = mclsReportSet.ColumnDesc(intCol + 1)
strType = UCase(mclsReportSet.ColumnFieldType(intCol + 1))
If (IsNumeric(.TextMatrix(intRow, intCol)) Or .TextMatrix(intRow, intCol) = "") _
And mlngDayTotal(intCol) <> "Err" And (strType = "INTEGER" Or strType = "DOUBLE" Or strType = "LONG" Or strType = "CURRENCY") And _
InStr(1, strName, "率") = 0 And strName <> "原币金额" And strName <> "保质期" _
And intCol <> mintAmountBanCol And intCol <> mintQuantityBanCol And intCol <> mintCurrencyBanCol Then
On Error Resume Next
'商品帐数量栏
If InStr(1, strName, "数量") <> 0 And mclsReportSet.ViewId <> 5 Then
dblOne = CDbl(.TextMatrix(intRow, intCol))
dblTwo = mlngDayTotal(intCol)
mlngDayTotal(intCol) = Sgn(dblOne) * CDbl(Int(Abs(dblOne)) * mdblFactor + (Abs(dblOne) - Int(Abs(dblOne))) * 10 ^ Len(Trim(str(mdblFactor - 1)))) _
+ Sgn(dblTwo) * CDbl(Int(Abs(dblTwo)) * mdblFactor + (Abs(dblTwo) - Int(Abs(dblTwo))) * 10 ^ Len(Trim(str(mdblFactor - 1))))
mlngDayTotal(intCol) = Sgn(mlngDayTotal(intCol)) * (Int(Abs(mlngDayTotal(intCol)) / mdblFactor) + (Abs(mlngDayTotal(intCol)) - Int(Abs(mlngDayTotal(intCol)) / mdblFactor) * mdblFactor) / 10 ^ Len(Trim(mdblFactor - 1)))
dblTwo = mlngDayAll(intCol)
mlngDayAll(intCol) = Sgn(dblOne) * CDbl(Int(Abs(dblOne)) * mdblFactor + (Abs(dblOne) - Int(Abs(dblOne))) * 10 ^ Len(Trim(str(mdblFactor - 1)))) _
+ Sgn(dblTwo) * CDbl(Int(Abs(dblTwo)) * mdblFactor + (Abs(dblTwo) - Int(Abs(dblTwo))) * 10 ^ Len(Trim(str(mdblFactor - 1))))
mlngDayAll(intCol) = Sgn(mlngDayAll(intCol)) * (Int(Abs(mlngDayAll(intCol)) / mdblFactor) + (Abs(mlngDayAll(intCol)) - Int(Abs(mlngDayAll(intCol)) / mdblFactor) * mdblFactor) / 10 ^ Len(Trim(mdblFactor - 1)))
dblTwo = mlngNowTotal(intCol)
mlngNowTotal(intCol) = Sgn(dblOne) * CDbl(Int(Abs(dblOne)) * mdblFactor + (Abs(dblOne) - Int(Abs(dblOne))) * 10 ^ Len(Trim(str(mdblFactor - 1)))) _
+ Sgn(dblTwo) * CDbl(Int(Abs(dblTwo)) * mdblFactor + (Abs(dblTwo) - Int(Abs(dblTwo))) * 10 ^ Len(Trim(str(mdblFactor - 1))))
mlngNowTotal(intCol) = Sgn(mlngNowTotal(intCol)) * (Int(Abs(mlngNowTotal(intCol)) / mdblFactor) + (Abs(mlngNowTotal(intCol)) - Int(Abs(mlngNowTotal(intCol)) / mdblFactor) * mdblFactor) / 10 ^ Len(Trim(mdblFactor - 1)))
dblTwo = mlngNowAll(intCol)
mlngNowAll(intCol) = Sgn(dblOne) * CDbl(Int(Abs(dblOne)) * mdblFactor + (Abs(dblOne) - Int(Abs(dblOne))) * 10 ^ Len(Trim(str(mdblFactor - 1)))) _
+ Sgn(dblTwo) * CDbl(Int(Abs(dblTwo)) * mdblFactor + (Abs(dblTwo) - Int(Abs(dblTwo))) * 10 ^ Len(Trim(str(mdblFactor - 1))))
mlngNowAll(intCol) = Sgn(mlngNowAll(intCol)) * (Int(Abs(mlngNowAll(intCol)) / mdblFactor) + (Abs(mlngNowAll(intCol)) - Int(Abs(mlngNowAll(intCol)) / mdblFactor) * mdblFactor) / 10 ^ Len(Trim(mdblFactor - 1)))
Else
mlngDayTotal(intCol) = CDbl(.TextMatrix(intRow, intCol)) + mlngDayTotal(intCol)
mlngDayAll(intCol) = CDbl(.TextMatrix(intRow, intCol)) + mlngDayAll(intCol)
mlngNowTotal(intCol) = CDbl(.TextMatrix(intRow, intCol)) + mlngNowTotal(intCol)
mlngNowAll(intCol) = CDbl(.TextMatrix(intRow, intCol)) + mlngNowAll(intCol)
End If
On Error GoTo 0
Else
mlngDayTotal(intCol) = "Err"
mlngDayAll(intCol) = "Err"
mlngNowTotal(intCol) = "Err"
mlngNowAll(intCol) = "Err"
End If
'清零
If Trim(.TextMatrix(intRow, intCol)) = "0" Then
.TextMatrix(intRow, intCol) = " "
End If
If intRow > 0 And (intCol = mintAmountBanCol Or intCol = mintQuantityBanCol Or intCol = mintCurrencyBanCol) Then
intNowRow = intRow
'?Do While .RowData(intLastRow) = 1 Or .RowData(intLastRow) = 2
'?intLastRow = intLastRow - 1
'?Loop
If mclsReportSet.ViewId = 5 Then
'余额处理
On Error Resume Next
'intDirect:上条分录的帐册方向*科目方向
If intNowRow > 0 Then
intDirect = IIf(.TextMatrix(intNowRow - 1, mintDirectCol) = "借", 1, -1)
Else
intDirect = IIf(.TextMatrix(intNowRow - 1, mintDirectCol) = "借", 1, -1)
End If
If intDirect = 0 Then
If mclsReportSet.Direct = 1 Or mclsReportSet.Direct = -1 Then
intDirect = mclsReportSet.Direct
Else
intDirect = IIf(.TextMatrix(intNowRow - 1, mintDirectCol) = "借", 1, -1)
End If
End If
'intAcntDirect:科目方向
intAcntDirect = CDbl(GetNoXString(grdAcntBook.TextMatrix(intNowRow, 0), 3, "/"))
intMakeDirect = CDbl(GetNoXString(grdAcntBook.TextMatrix(intNowRow, 0), 4, "/"))
If .TextMatrix(intLastRow, intCol) = "" Then
.TextMatrix(intLastRow, intCol) = "0"
End If
If .TextMatrix(intNowRow, intCol) = "" Then
.TextMatrix(intNowRow, intCol) = "0"
End If
If mclsReportSet.Direct = 1 Or mclsReportSet.Direct = -1 Then
.TextMatrix(intNowRow, intCol) = CDbl(.TextMatrix(intLastRow, intCol)) + CDbl(.TextMatrix(intNowRow, intCol)) * mclsReportSet.Direct
Else
If (mclsReportSet.Direct = 0 Or mblnVirtual) And intAcntDirect = -1 Then
If mblnVirtual Then
.TextMatrix(intNowRow, intCol) = intDirect * CDbl(.TextMatrix(intLastRow, intCol)) + intMakeDirect * CDbl(.TextMatrix(intNowRow, intCol))
Else
.TextMatrix(intNowRow, intCol) = intDirect * CDbl(.TextMatrix(intLastRow, intCol)) + CDbl(.TextMatrix(intNowRow, intCol))
End If
Else
If mclsReportSet.Direct = 0 Then
.TextMatrix(intNowRow, intCol) = intDirect * CDbl(.TextMatrix(intLastRow, intCol)) + CDbl(.TextMatrix(intNowRow, intCol)) * mintDirect
Else
.TextMatrix(intNowRow, intCol) = CDbl(.TextMatrix(intLastRow, intCol)) + CDbl(.TextMatrix(intNowRow, intCol)) * mintDirect
End If
End If
End If
Else
If Trim(.TextMatrix(intLastRow, intCol)) = "" Then
dblOne = 0
.TextMatrix(intLastRow, intCol) = "0"
Else
dblOne = CDbl(.TextMatrix(intLastRow, intCol))
End If
If Trim(.TextMatrix(intNowRow, intCol)) = "" Then
dblTwo = 0
.TextMatrix(intNowRow, intCol) = "0"
Else
dblTwo = CDbl(.TextMatrix(intNowRow, intCol))
End If
If InStr(1, strName, "数量") = 0 Then
.TextMatrix(intNowRow, intCol) = dblOne + dblTwo
Else
.TextMatrix(intNowRow, intCol) = Sgn(dblOne) * CDbl(Int(Abs(dblOne)) * mdblFactor + (Abs(dblOne) - Int(Abs(dblOne))) * 10 ^ Len(Trim(str(mdblFactor - 1)))) _
+ Sgn(dblTwo) * CDbl(Int(Abs(dblTwo)) * mdblFactor + (Abs(dblTwo) - Int(Abs(dblTwo))) * 10 ^ Len(Trim(str(mdblFactor - 1))))
.TextMatrix(intNowRow, intCol) = Sgn(.TextMatrix(intNowRow, intCol)) * (Int(Abs(.TextMatrix(intNowRow, intCol)) / mdblFactor) + (Abs(.TextMatrix(intNowRow, intCol)) - Int(Abs(.TextMatrix(intNowRow, intCol)) / mdblFactor) * mdblFactor) / 10 ^ Len(Trim(mdblFactor - 1)))
End If
End If
If intCol = mintAmountBanCol Then
bytQA = bytQA Or 1
End If
If intCol = mintQuantityBanCol Then
bytQA = bytQA Or 2
End If
'方向处理
If Trim(.TextMatrix(intNowRow, intCol)) <> "" Then
If intCol = mintAmountBanCol Then
SetDirect intNowRow, Format(CDbl(.TextMatrix(intNowRow, intCol)), gclsBase.GetFormat(gclsBase.NaturalCurDec)), intNowRow, intCol
End If
If intCol = mintCurrencyBanCol Then
SetDirect intNowRow, Format(CDbl(.TextMatrix(intNowRow, intCol)), gclsBase.GetFormat(gclsBase.GetCurrencyDec(mstrCurName))), intNowRow, intCol
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -