📄
字号:
Call Sjcsh(Trim(Lab_Pzclzt.Caption))
'填充会计期间列表框(年度默认为用户选择年度)
Int_Year = Val(Mid(Combo_Kjqj.Text, 1, 4))
Int_Period = Val(Mid(Combo_Kjqj.Text, 6, 2))
End Sub
Private Sub Sjcsh(Str_Pzclzt As String) '数据初始化模块(根据实际情况)
Dim SqlStr As String '查询凭证列表条件
'[>>根据实际情况初始化
Select Case Str_Pzclzt
Case "1" '编辑凭证
'日期默认值为用户选择日期
LrText(1).Text = Format(Xtrq, "yyyy-mm-dd")
'设置操作状态为浏览
Select Case lbl_Tag.Caption
Case "0"
Lab_OperStatus = "2" '新增状态
Call Sub_OperStatus("30")
Call Sub_ShowBill(1)
Case "1"
Lab_OperStatus = "2" '新增状态
Call Sub_OperStatus("30")
Call sub_HBShow
Case "2"
Lab_OperStatus = "1" '浏览状态
Call Sub_OperStatus("11")
Call Sub_ShowPz
Case "3"
Lab_OperStatus = "2" '浏览状态
Call Sub_OperStatus("30")
Call Sub_ShowPz
End Select
End Select
'<<]
'重 置 网 格
Call Sub_AdjustGrid
End Sub
Private Sub Sub_ShowBill(arry As Integer) '根据当前单据号显示整张单据内容
Dim count As Long '临时计数器
'[>>显示单据头
TextChangeLock = True
LrText(0) = vouchz '凭证类别
LrText(1) = Format(Trim(CL_MakeVoucherSub.vsFlex_PzMain.TextMatrix(arry, 1)), "yyyy-mm-dd") '制单日期
LrText(2) = Trim(CL_MakeVoucherSub.vsFlex_PzMain.TextMatrix(arry, 2)) '随单据
Lab_Bill = Xtczy '制单人
TextChangeLock = False
WglrGrid.Rows = WglrGrid.FixedRows
'[>>显示单据分录
With CL_MakeVoucherSub.vsFlex_PzChild
For count = .FixedRows To .Rows - 1
If Trim(.TextMatrix(count, 0)) = Trim(CL_MakeVoucherSub.vsFlex_PzMain.TextMatrix(arry, 0)) And Val(.TextMatrix(count, 28)) = Val(CL_MakeVoucherSub.vsFlex_PzMain.TextMatrix(arry, 5)) Then
If Val(.TextMatrix(count, 4)) = Val(.TextMatrix(count, 5)) Then
Else
WglrGrid.AddItem ""
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 0) = "*" '行标识
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 1) = Trim(.TextMatrix(count, 7)) '结算方式
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 2) = Trim(.TextMatrix(count, 8))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 3) = Trim(.TextMatrix(count, 9)) '票号
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 4) = Trim(.TextMatrix(count, 10)) '发生日期
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 5) = Trim(.TextMatrix(count, 11)) '数量
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 6) = Trim(.TextMatrix(count, 12)) '单价
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 10) = Trim(.TextMatrix(count, 13)) '外币金额
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 11) = Trim(.TextMatrix(count, 14)) '汇率
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 12) = Trim(.TextMatrix(count, 15)) '部门
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 13) = Trim(.TextMatrix(count, 16))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 14) = Trim(.TextMatrix(count, 17)) '客户
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 15) = Trim(.TextMatrix(count, 18))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 16) = Trim(.TextMatrix(count, 19)) '个人
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 17) = Trim(.TextMatrix(count, 20))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 20) = Trim(.TextMatrix(count, 21)) '项目
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 21) = Trim(.TextMatrix(count, 22))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 22) = Trim(.TextMatrix(count, 23)) '项目数量
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 23) = Trim(.TextMatrix(count, 24))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 25) = Trim(.TextMatrix(count, 25)) '供应商
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 26) = Trim(.TextMatrix(count, 26))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 24) = Trim(.TextMatrix(count, 27)) '经办人
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 27) = Trim(.TextMatrix(count, 6)) '科目标志
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("001", GridStr(), Szzls)) = Trim(.TextMatrix(count, 1)) '摘 要
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("002", GridStr(), Szzls)) = Trim(.TextMatrix(count, 2)) '科目编码
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("003", GridStr(), Szzls)) = Trim(.TextMatrix(count, 3)) '科目名称
If Val(.TextMatrix(count, 4)) > Val(.TextMatrix(count, 5)) Then
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("004", GridStr(), Szzls)) = Val(.TextMatrix(count, 4)) - Val(.TextMatrix(count, 5)) '借方金额
Else
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("005", GridStr(), Szzls)) = Val(.TextMatrix(count, 5)) - Val(.TextMatrix(count, 4)) '贷方金额
End If
End If
End If
Next count
End With
'计算凭证号
Call Sub_JsVouchNo
'调整网格
Call Sub_AdjustGrid
'显示备注信息
Call Sub_ShowMemo(WglrGrid.Row)
'计算合计数据
For count = Qslz To WglrGrid.Cols - 1
Call Sjhj(count)
Next count
'
If CL_MakeVoucherSub.vsFlex_PzMain.TextMatrix(currrecord, 3) = "1" Then
Lab_Succeed.Visible = True
Lab_OperStatus = "1"
Call Sub_OperStatus("11")
Else
Lab_Succeed.Visible = False
Lab_OperStatus = "2"
Call Sub_OperStatus("30")
End If
End Sub
Private Sub sub_HBShow()
Dim count As Long '临时计数器
'[>>显示单据头
TextChangeLock = True
LrText(0) = vouchz '凭证类别
LrText(1) = Format(Xtrq, "yyyy-mm-dd") '制单日期
LrText(2) = Trim(CL_MakeVoucherSub.vsFlex_PzMain.Rows - 1) '随单据
Lab_Bill = Xtczy '制单人
TextChangeLock = False
WglrGrid.Rows = WglrGrid.FixedRows
'[>>显示单据分录
With CL_MakeVoucherSub.vsFlex_PzChild
For count = .FixedRows To .Rows - 1
If Val(.TextMatrix(count, 4)) = Val(.TextMatrix(count, 5)) Then
Else
WglrGrid.AddItem ""
WglrGrid.RowHeight(count) = Sjhgd
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 0) = "*" '行标识
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 1) = Trim(.TextMatrix(count, 7)) '结算方式
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 2) = Trim(.TextMatrix(count, 8))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 3) = Trim(.TextMatrix(count, 9)) '票号
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 4) = Trim(.TextMatrix(count, 10)) '发生日期
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 5) = Trim(.TextMatrix(count, 11)) '数量
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 6) = Trim(.TextMatrix(count, 12)) '单价
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 10) = Trim(.TextMatrix(count, 13)) '外币金额
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 11) = Trim(.TextMatrix(count, 14)) '汇率
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 12) = Trim(.TextMatrix(count, 15)) '部门
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 13) = Trim(.TextMatrix(count, 16))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 14) = Trim(.TextMatrix(count, 17)) '客户
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 15) = Trim(.TextMatrix(count, 18))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 16) = Trim(.TextMatrix(count, 19)) '个人
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 17) = Trim(.TextMatrix(count, 20))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 20) = Trim(.TextMatrix(count, 21)) '项目
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 21) = Trim(.TextMatrix(count, 22))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 22) = Trim(.TextMatrix(count, 23)) '项目数量
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 23) = Trim(.TextMatrix(count, 24))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 25) = Trim(.TextMatrix(count, 25)) '供应商
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 26) = Trim(.TextMatrix(count, 26))
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 24) = Trim(.TextMatrix(count, 27)) '经办人
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, 27) = Trim(.TextMatrix(count, 6)) '科目标志
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("001", GridStr(), Szzls)) = Trim(.TextMatrix(count, 1)) '摘 要
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("002", GridStr(), Szzls)) = Trim(.TextMatrix(count, 2)) '科目编码
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("003", GridStr(), Szzls)) = Trim(.TextMatrix(count, 3)) '科目名称
If Val(.TextMatrix(count, 4)) > Val(.TextMatrix(count, 5)) Then
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("004", GridStr(), Szzls)) = Val(.TextMatrix(count, 4)) - Val(.TextMatrix(count, 5)) '借方金额
Else
WglrGrid.TextMatrix(WglrGrid.Rows - WglrGrid.FixedRows, Sydz("005", GridStr(), Szzls)) = Val(.TextMatrix(count, 5)) - Val(.TextMatrix(count, 4)) '贷方金额
End If
End If
Next count
End With
'计算凭证号
Call Sub_JsVouchNo
'调整网格
Call Sub_AdjustGrid
'显示备注信息
Call Sub_ShowMemo(WglrGrid.Row)
'计算合计数据
For count = Qslz To WglrGrid.Cols - 1
Call Sjhj(count)
Next count
'
If CL_MakeVoucherSub.vsFlex_PzMain.TextMatrix(currrecord, 3) = "1" Then
Lab_Succeed.Visible = True
Lab_OperStatus = "1"
Call Sub_OperStatus("11")
Else
Lab_Succeed.Visible = False
Lab_OperStatus = "2"
Call Sub_OperStatus("30")
End If
End Sub
Private Sub Sub_ShowPz()
Dim Jsqte As Long '临时计数器
Dim SqlStr As String
Dim Rectemp As ADODB.Recordset
SqlStr = "select * from chhs_v_vouch where VouchId='" & Val(Trim(Lab_VouchId.Caption)) & "' Order by SerialID"
Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
With Rectemp
WglrGrid.Clear 1
If .EOF Then
Exit Sub
Else
WglrGrid.Rows = .RecordCount + WglrGrid.FixedRows
'[>>显示单据头
TextChangeLock = True
LrText(0).Text = Trim(.Fields("VouchClassCode")) '凭证类别
If Lab_Succeed.Caption = "已生成" Then
LrText(3).Text = Mid(Trim(Str(10000 + .Fields("VouchNo"))), 2, 4) '凭证号
End If
If IsDate(.Fields("DDate")) Then
LrText(1).Text = Format(.Fields("Ddate"), "yyyy-mm-dd") '制单日期
End If
LrText(2).Text = Trim(Str(.Fields("Doc"))) '附单据数
Lab_Bill.Caption = Trim(.Fields("Bill") & "") '制单人
Lab_Checker.Caption = "" '审核人
Lab_Book.Caption = "" '记帐人
Lab_Error.Visible = False '标错
TextChangeLock = False
'<<]
End If
Jsqte = WglrGrid.FixedRows
Do While Not .EOF
If Jsqte >= WglrGrid.Rows Then
WglrGrid.AddItem ""
End If
'[>>显示单据分录
WglrGrid.TextMatrix(Jsqte, 0) = "*" '行标识
WglrGrid.TextMatrix(Jsqte, 1) = "" '结算方式编码
WglrGrid.TextMatrix(Jsqte, 2) = "" '结算方式名称
WglrGrid.TextMatrix(Jsqte, 3) = "" '票号
If IsDate(.Fields("BillDate") & "") Then
WglrGrid.TextMatrix(Jsqte, 4) = Format(.Fields("BillDate"), "yyyy-mm-dd") '发生日期
End If
If .Fields("Jfsl") <> 0 Then
WglrGrid.TextMatrix(Jsqte, 5) = Trim(Str(.Fields("Jfsl"))) '数量
End If
If .Fields("Dfsl") <> 0 Then
WglrGrid.TextMatrix(Jsqte, 5) = Trim(Str(.Fields("Dfsl"))) '数量
End If
WglrGrid.TextMatrix(Jsqte, 7) = "" '计量单位
'币种为外币时填充网格
If Trim(.Fields("ForeignCurrCode") & "") <> XtSCurrCode Then
WglrGrid.TextMatrix(Jsqte, 8) = Trim(.Fields("ForeignCurrCode") & "") '原币编码
WglrGrid.TextMatrix(Jsqte, 9) = Trim(.Fields("ForeignCurrName") & "") '原币名称
If .Fields("Wbjfje") <> 0 Then
WglrGrid.TextMatrix(Jsqte, 10) = Trim(Str(.Fields("Wbjfje"))) '原币金额
End If
If .Fields("Wbdfje") <> 0 Then
WglrGrid.TextMatrix(Jsqte, 10) = Trim(Str(.Fields("Wbdfje"))) '原币金额
End If
If .Fields("AccRate") <> 0 Then
WglrGrid.TextMatrix(Jsqte, 11) = Trim(Str(.Fields("AccRate"))) '记帐汇率
End If
End If
WglrGrid.TextMatrix(Jsqte, 12) = Trim(.Fields("DeptCode") & "") '部门编码
WglrGrid.TextMatrix(Jsqte, 13) = Trim(.Fields("DeptName") & "") '部门名称
WglrGrid.TextMatrix(Jsqte, 14) = Trim(.Fields("CusCode") & "") '客户编码
WglrGrid.TextMatrix(Jsqte, 15) = Trim(.Fields("CusName") & "") '客户名称
WglrGrid.TextMatrix(Jsqte, 25) = Trim(.Fields("SupplierCode") & "") '供应商编码
WglrGrid.TextMatrix(Jsqte, 26) = Trim(.Fields("SupplierName") & "") '供应商名称
WglrGrid.TextMatrix(Jsqte, 16) = Trim(.Fields("PersonCode") & "") '职员编码
WglrGrid.TextMatrix(Jsqte, 17) = Trim(.Fields("PersonName") & "") '职员名称
WglrGrid.TextMatrix(Jsqte, 18) = Trim(.Fields("ItemClassCode") & "") '项目类别编码
WglrGrid.TextMatrix(Jsqte, 19) = Trim(.Fields("ItemClassName") & "") '项目类别名称
WglrGrid.TextMatrix(Jsqte, 20) = Trim(.Fields("ItemCode") & "") '项目编码
WglrGrid.TextMatrix(Jsqte, 21) = Trim(.Fields("ItemName") & "") '项目名称
If Val(Trim(.Fields("ItemJfsl") & "")) <> 0 Then
WglrGrid.TextMatrix(Jsqte, 22) = Trim(Str(.Fields("ItemJfsl"))) '项目数量
End If
If Val(Trim(.Fields("ItemDfsl") & "")) <> 0 Then
WglrGrid.TextMatrix(Jsqte, 22) = Trim(Str(.Fields("ItemDfsl"))) '项目数量
End If
WglrGrid.TextMatrix(Jsqte, 24) = Trim(.Fields("TranPerson")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -