📄
字号:
'差异结转单
If Trim(.TextMatrix(PzCount, 6)) = "5" Then
Call EvaluPz(InoutMainIdValue)
End If
Next PzCount
End With
CL_PzFrm.lbl_Tag = 0
End If
Dim Same As Boolean
'合并生成凭证
If CL_MakeVoucher.PzType = 1 Then
With WglrGrid
'向vsflex_pzmain中加入记录,物料科目、对方科目、差异科目都相同合并
For count = .FixedRows To .Rows - .FixedRows
WuLiaoCodeValue = Trim(.TextMatrix(count, Sydz("007", GridStr(), Szzls)))
ChaYiCodeValue = Trim(.TextMatrix(count, Sydz("008", GridStr(), Szzls)))
DuifangCodeValue = Trim(.TextMatrix(count, Sydz("009", GridStr(), Szzls)))
For countrow = vsFlex_PzMain.FixedRows To vsFlex_PzMain.Rows - vsFlex_PzMain.FixedRows
WuLiaoCodeValue1 = Trim(vsFlex_PzMain.TextMatrix(countrow, 0))
ChaYiCodeValue1 = Trim(vsFlex_PzMain.TextMatrix(countrow, 1))
DuifangCodeValue1 = Trim(vsFlex_PzMain.TextMatrix(countrow, 2))
If WuLiaoCodeValue = WuLiaoCodeValue1 And ChaYiCodeValue = ChaYiCodeValue1 And DuifangCodeValue = DuifangCodeValue1 Then
Same = True
Exit For
End If
Same = False
Next countrow
If Not Same Then
vsFlex_PzMain.AddItem ""
vsFlex_PzMain.TextMatrix(countrow, 0) = WuLiaoCodeValue
vsFlex_PzMain.TextMatrix(countrow, 1) = ChaYiCodeValue
vsFlex_PzMain.TextMatrix(countrow, 2) = DuifangCodeValue
vsFlex_PzMain.TextMatrix(countrow, 4) = Trim(.TextMatrix(count, Sydz("011", GridStr(), Szzls)))
End If
Next count
'根据物料科目、对方科目、差异科目计算借方、贷方金额
For countrow = vsFlex_PzMain.FixedRows To vsFlex_PzMain.Rows - vsFlex_PzMain.FixedRows
WuLiaoCodeValue1 = Trim(vsFlex_PzMain.TextMatrix(countrow, 0))
ChaYiCodeValue1 = Trim(vsFlex_PzMain.TextMatrix(countrow, 1))
DuifangCodeValue1 = Trim(vsFlex_PzMain.TextMatrix(countrow, 2))
Note = Trim(.TextMatrix(countrow, Sydz("010", GridStr(), Szzls)))
WuLiaoMoney = 0
DuiFangMoney = 0
JieFangMoney = 0
DaiFangMoney = 0
For count = .FixedRows To .Rows - .FixedRows
WuLiaoCodeValue = Trim(.TextMatrix(count, Sydz("007", GridStr(), Szzls)))
ChaYiCodeValue = Trim(.TextMatrix(count, Sydz("008", GridStr(), Szzls)))
DuifangCodeValue = Trim(.TextMatrix(count, Sydz("009", GridStr(), Szzls)))
If WuLiaoCodeValue = WuLiaoCodeValue1 And ChaYiCodeValue = ChaYiCodeValue1 And DuifangCodeValue = DuifangCodeValue1 Then
WuliaoNameValue = Trim(.TextMatrix(count, Sydz("004", GridStr(), Szzls)))
ChaYiNameValue = Trim(.TextMatrix(count, Sydz("005", GridStr(), Szzls)))
DuifangNameValue = Trim(.TextMatrix(count, Sydz("006", GridStr(), Szzls)))
Select Case WglrGrid.TextMatrix(count, 6)
Case "3", "5"
If Trim(WglrGrid.TextMatrix(count, 4)) = "1303" Then
JieFangMoney = JieFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("013", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
DaiFangMoney = DaiFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("015", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
Else
JieFangMoney = JieFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("016", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
DaiFangMoney = DaiFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("017", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
End If
If JieFangMoney <> 0 Then
DuiFangMoney = JieFangMoney
Else
DuiFangMoney = DaiFangMoney
End If
Case Else
If Trim(.TextMatrix(count, Sydz("011", GridStr(), Szzls))) And Trim(.TextMatrix(count, 5)) = "计划价法" Then
WuLiaoMoney = WuLiaoMoney + Format(WglrGrid.TextMatrix(count, Sydz("013", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
DuiFangMoney = DuiFangMoney + Format(Val(WglrGrid.TextMatrix(count, Sydz("013", GridStr(), Szzls))) + Val(WglrGrid.TextMatrix(count, Sydz("016", GridStr(), Szzls))) - Val(WglrGrid.TextMatrix(count, Sydz("017", GridStr(), Szzls))), "#####." + String(Xtjexsws, "0"))
Else
WuLiaoMoney = WuLiaoMoney + Format(WglrGrid.TextMatrix(count, Sydz("013", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
DuiFangMoney = DuiFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("013", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
End If
If Not Trim(.TextMatrix(count, Sydz("011", GridStr(), Szzls))) Then
WuLiaoMoney = WuLiaoMoney + Format(WglrGrid.TextMatrix(count, Sydz("015", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
DuiFangMoney = DuiFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("015", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
End If
JieFangMoney = JieFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("016", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
DaiFangMoney = DaiFangMoney + Format(WglrGrid.TextMatrix(count, Sydz("017", GridStr(), Szzls)), "#####." + String(Xtjexsws, "0"))
End Select
End If
Next count
If WuLiaoCodeValue1 <> "" Then
vsFlex_PzChild.AddItem ""
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 1) = Note
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 2) = WuLiaoCodeValue1
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 3) = WuliaoNameValue
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 6) = "1"
If Trim(vsFlex_PzMain.TextMatrix(countrow, 4)) Then
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 4) = WuLiaoMoney
Else
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 5) = WuLiaoMoney
End If
End If
If DuifangCodeValue1 <> "" Then
vsFlex_PzChild.AddItem ""
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 1) = Note
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 2) = DuifangCodeValue1
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 3) = DuifangNameValue
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 6) = "2"
If Trim(vsFlex_PzMain.TextMatrix(countrow, 4)) Then
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 5) = DuiFangMoney
Else
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 4) = DuiFangMoney
End If
End If
If ChaYiCodeValue1 <> "" Then
vsFlex_PzChild.AddItem ""
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 1) = Note
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 2) = ChaYiCodeValue1
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 3) = ChaYiNameValue
If Val(JieFangMoney) <> 0 Then
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 4) = JieFangMoney
End If
If Val(DaiFangMoney) <> 0 Then
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 5) = DaiFangMoney
End If
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 6) = "3"
End If
Next countrow
End With
CL_PzFrm.lbl_Tag = 1
End If
Me.Hide
CL_PzFrm.LoadMassage = 0
CL_PzFrm.Show 1
End Sub
Private Sub InOutMakePz(InoutMainIdValue As Integer, InoutSubIdValue As Integer)
Dim count As Integer '循环变量
Dim Note As String '摘要
Dim WuLiaoCodeValue As String '存货科目代码
Dim WuliaoNameValue As String '存货科目名称
Dim ISinout As Boolean '收发记录标志
Dim Money As Double '金额
Dim countrow As Integer '循环变量
Dim IsPzInoutMainID As Boolean
Dim DuifangCodeValue As String '对方科目编码
Dim DuifangNameValue As String '对方科目名称
With WglrGrid
'计算物料科目的借贷金额
For count = .FixedRows To .Rows - 1
If Trim(.TextMatrix(count, 0)) = InoutMainIdValue And Trim(.TextMatrix(count, 1)) = InoutSubIdValue Then
Note = Trim(.TextMatrix(count, Sydz("010", GridStr(), Szzls)))
WuLiaoCodeValue = Trim(.TextMatrix(count, Sydz("007", GridStr(), Szzls)))
WuliaoNameValue = Trim(.TextMatrix(count, Sydz("004", GridStr(), Szzls)))
ISinout = Trim(.TextMatrix(count, Sydz("011", GridStr(), Szzls)))
If ISinout Then
Money = Val(WglrGrid.TextMatrix(count, Sydz("013", GridStr(), Szzls)))
Else
Money = Val(WglrGrid.TextMatrix(count, Sydz("015", GridStr(), Szzls)))
End If
For countrow = vsFlex_PzChild.FixedRows To vsFlex_PzChild.Rows - 1
If Trim(vsFlex_PzChild.TextMatrix(countrow, 0)) = InoutMainIdValue And Trim(vsFlex_PzChild.TextMatrix(countrow, 28)) = InoutSubIdValue Then
If Trim(vsFlex_PzChild.TextMatrix(countrow, 2)) = WuLiaoCodeValue And Trim(vsFlex_PzChild.TextMatrix(countrow, 6)) = "1" Then
IsPzInoutMainID = True
If ISinout Then
vsFlex_PzChild.TextMatrix(countrow, 4) = Val(vsFlex_PzChild.TextMatrix(countrow, 4)) + Money
Else
vsFlex_PzChild.TextMatrix(countrow, 5) = Val(vsFlex_PzChild.TextMatrix(countrow, 5)) + Money
End If
Exit For
Else
IsPzInoutMainID = False
End If
Else
IsPzInoutMainID = False
End If
Next countrow
If IsPzInoutMainID = False Then
vsFlex_PzChild.AddItem ""
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 0) = InoutMainIdValue
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 1) = Note
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 2) = WuLiaoCodeValue
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 3) = WuliaoNameValue
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 6) = "1"
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 28) = InoutSubIdValue
If ISinout Then
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 4) = Money
Else
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 5) = Money
End If
End If
End If
Next count
'计算对方科目的借贷金额
For count = .FixedRows To .Rows - 1
If Trim(.TextMatrix(count, 0)) = InoutMainIdValue And Trim(.TextMatrix(count, 1)) = InoutSubIdValue Then
Note = Trim(.TextMatrix(count, Sydz("010", GridStr(), Szzls)))
DuifangCodeValue = Trim(.TextMatrix(count, Sydz("009", GridStr(), Szzls)))
DuifangNameValue = Trim(.TextMatrix(count, Sydz("006", GridStr(), Szzls)))
ISinout = Trim(.TextMatrix(count, Sydz("011", GridStr(), Szzls)))
If ISinout Then
Money = Trim(WglrGrid.TextMatrix(count, Sydz("013", GridStr(), Szzls)))
Else
Money = Trim(WglrGrid.TextMatrix(count, Sydz("015", GridStr(), Szzls)))
End If
For countrow = vsFlex_PzChild.FixedRows To vsFlex_PzChild.Rows - 1
If Trim(vsFlex_PzChild.TextMatrix(countrow, 0)) = InoutMainIdValue And Trim(vsFlex_PzChild.TextMatrix(countrow, 28)) = InoutSubIdValue Then
If Trim(vsFlex_PzChild.TextMatrix(countrow, 2)) = DuifangCodeValue And Trim(vsFlex_PzChild.TextMatrix(countrow, 6)) = "2" Then
IsPzInoutMainID = True
If ISinout Then
vsFlex_PzChild.TextMatrix(countrow, 5) = Val(vsFlex_PzChild.TextMatrix(countrow, 5)) + Money
Else
vsFlex_PzChild.TextMatrix(countrow, 4) = Val(vsFlex_PzChild.TextMatrix(countrow, 4)) + Money
End If
Exit For
Else
IsPzInoutMainID = False
End If
Else
IsPzInoutMainID = False
End If
Next countrow
If IsPzInoutMainID = False Then
vsFlex_PzChild.AddItem ""
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 0) = InoutMainIdValue
vsFlex_PzChild.TextMatrix(vsFlex_PzChild.Rows - 1, 1) = Note
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -