📄
字号:
str_SqlInvoiceType = " and ( PeriodStarFlag = 0 and InvoiceSort=1 and InvoiceKind=0) "
Case 5
str_SqlInvoiceType = " and ( PeriodStarFlag = 0 and InvoiceSort=0 and InvoiceKind=1) "
Case 6
str_SqlInvoiceType = " and ( PeriodStarFlag = 0 and InvoiceSort=1 and InvoiceKind=1) "
End Select
Lab_Title.Move (Me.Width - Lab_Title.Width) / 2, 800
'报表编码
XtReportCode = Var_Bill(5)
Load Dyymctbl
'以下为文本框处理程序(Fixed)
TextGroupCode = Var_Bill(3)
Call Drwbkxx(TextGroupCode, Textvar(), Textboolean(), Textint(), Textstr()) '读入文本框录入信息
Call Wbkcsh
'调入网格并记录一些网格信息(Fixed)
GridCode = Var_Bill(4) '网格属性编码
Call BzWgcsh(WglrGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
Qslz = GridInf(1)
Sjhgd = GridInf(2)
Fzxwghs = GridInf(4)
Sfblbzkd = GridInf(5)
Shsfts = GridInf(6)
Sfxshjwg = GridInf(7)
Szzls = WglrGrid.Cols - 1
Pmbcsjhs = Int((WglrGrid.Height - WglrGrid.FixedRows * WglrGrid.RowHeight(0)) / Sjhgd) - Fzxwghs - 1
For jsqte = WglrGrid.FixedRows To WglrGrid.Rows - 1
WglrGrid.RowHeight(jsqte) = Sjhgd
Next jsqte
'初始化合计网格(Fixed)
Call Cshhjwg
'初始化Chk_Xf位置
Chk_Xf.Top = LrText(1).Top - 500
Chk_Xf.Left = LrText(1).Left
'单据变动置为False(Fixed)
Bln_BillChange = False
'调入数据初始化模块(Fixed)
Lab_Djclzt.Caption = Xtcdcs
Call Sjcsh(Trim(Lab_Djclzt.Caption))
End Sub
Private Sub Form_Unload(Cancel As Integer) '窗体卸载
'是否保存已修改单据
Dim YAnswer As Integer
If Lab_OperStatus.Caption = "2" Or Lab_OperStatus.Caption = "3" Then
Tsxx = "单据尚未保存,是否退出?"
YAnswer = Xtxxts(Tsxx, 2, 2)
If YAnswer <> 1 Then
Cancel = 1
Exit Sub
End If
End If
'卸载打印页面窗体
Unload Dyymctbl
'判断单据是否发生变化,并返回相应标识
If Bln_BillChange Then
Xtfhcs = "1"
Int_BillTitle = 0
Else
Xtfhcs = "0"
Int_BillTitle = 0
End If
End Sub
Private Sub Sjcsh(Str_Pzclzt As String) '数据初始化模块(根据实际情况)
Dim Sqlstr As String '查询单据列表条件
'[>>根据实际情况初始化
Select Case Str_Pzclzt
Case "1" '填制单据
'调入用户查询结果动态集(默认显示用户当前操作业务日期的单据)
Sqlstr = "SELECT InvoiceMainID FROM Cg_InvoiceMain where InvoiceDate=convert(datetime,'" & Xtrq & "') " & str_SqlInvoiceType & " ORDER BY InvoiceMainID "
Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
'新增单据
Call Sub_AddBill
Case "2" '查询单据(单据列表)
'填充查询单据标识
Lab_BillId.Caption = XT_BillID
Str_QueryCondi = Xtcdcsfz
Call Sub_ShowBill
Call Sub_OperStatus("10")
'调入用户查询结果动态集
Sqlstr = "SELECT DISTINCT InvoiceMainID From Cg_V_InvoiceBill a " & Str_QueryCondi & " ORDER BY InvoiceMainID"
Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
Rec_Query.Find "InvoiceMainID=" & S2N(Lab_BillId.Caption)
Case "3" '明细帐联查单据
'设置工具条显示
With Tlb_Action
.Buttons("xz").Enabled = False '新增
.Buttons("xg").Enabled = False '修改
.Buttons("sc").Enabled = False '删除
.Buttons("fgh0").Enabled = False '分隔行
.Buttons("zh").Enabled = False '增行
.Buttons("sh").Enabled = False '删行
.Buttons("fgh1").Enabled = False '分隔行
.Buttons("bc").Enabled = False '保存
.Buttons("fq").Enabled = False '放弃
.Buttons("shsh").Enabled = False '审核
.Buttons("shqs").Enabled = False '弃审
.Buttons("fgh2").Enabled = False '分隔行
.Buttons("first").Enabled = False '首张
.Buttons("prev").Enabled = False '上张
.Buttons("next").Enabled = False '下张
.Buttons("last").Enabled = False '末张
.Buttons("fgh5").Enabled = False '分割行
End With
Call Sub_ShowBill
'设置操作状态为浏览
Lab_OperStatus.Caption = "1"
'录入文本框
For jsqte = Max_Text_Index To 0 Step -1
LrText(jsqte).Enabled = False
Next jsqte
End Select
'<<]
End Sub
Private Sub Sub_ShowBill() '根据当前单据ID显示整张单据内容
'过程默认参数为当前窗体中单据ID:Lab_BillID
Dim Sqlstr As String '临时使用字符串
Dim RecTemp As New ADODB.Recordset '临时使用动态集
Dim jsqte As Long '临时计数器
'禁止网格刷新动作,为加快网格显示速度(Fixed)
WglrGrid.Redraw = False
'本张单据查询字符串
Sqlstr = "SELECT * from Cg_V_InvoiceBill where InvoiceMainID='" & S2N(Lab_BillId.Caption) & "' Order By Cg_V_InvoiceBill.InvoiceSubID"
Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
With RecTemp
WglrGrid.Rows = WglrGrid.FixedRows
If .EOF Then
WglrGrid.Redraw = True
Exit Sub
Else
'根据发票类型进行改变
If RecTemp.Fields("PeriodStarFlag") = 1 And RecTemp.Fields("InvoiceSort") = 0 And RecTemp.Fields("InvoiceKind") = 0 Then
Me.InvoiceType = 1
Int_BillTitle = 1
'帮助文件ID
Me.HelpContextID = "1102001"
ElseIf RecTemp.Fields("PeriodStarFlag") = 1 And RecTemp.Fields("InvoiceSort") = 1 And RecTemp.Fields("InvoiceKind") = 0 Then
Me.InvoiceType = 2
Int_BillTitle = 1
'帮助文件ID
Me.HelpContextID = "1102003"
ElseIf RecTemp.Fields("PeriodStarFlag") = 0 And RecTemp.Fields("InvoiceSort") = 0 And RecTemp.Fields("InvoiceKind") = 0 Then
Me.InvoiceType = 3
Int_BillTitle = 0
'帮助文件ID
Me.HelpContextID = "1107001"
ElseIf RecTemp.Fields("PeriodStarFlag") = 0 And RecTemp.Fields("InvoiceSort") = 1 And RecTemp.Fields("InvoiceKind") = 0 Then
Me.InvoiceType = 4
Int_BillTitle = 0
'帮助文件ID
Me.HelpContextID = "1107004"
ElseIf RecTemp.Fields("PeriodStarFlag") = 0 And RecTemp.Fields("InvoiceSort") = 0 And RecTemp.Fields("InvoiceKind") = 1 Then
Me.InvoiceType = 5
Int_BillTitle = 2
'帮助文件ID
Me.HelpContextID = "1107002"
ElseIf RecTemp.Fields("PeriodStarFlag") = 0 And RecTemp.Fields("InvoiceSort") = 1 And RecTemp.Fields("InvoiceKind") = 1 Then
Me.InvoiceType = 6
Int_BillTitle = 2
'帮助文件ID
Me.HelpContextID = "1107005"
End If
Select Case Me.InvoiceType '发票类型
Case 1, 2
Lab_Title = "(期初)" & Trim(Var_Bill(2))
Case 3, 4
Lab_Title = Trim(Var_Bill(2))
Lab_Title.ForeColor = &H0&
Case 5, 6
Lab_Title = Trim(Var_Bill(2)) & "(红字)"
Lab_Title.ForeColor = &HFF&
End Select
'[>>显示单据头
TextChangeLock = True '文本框加锁
LrText(1).Text = Trim("" & .Fields("InvoiceNum")) '单据号
LrText(0).Text = Format(.Fields("InvoiceDate"), "yyyy-mm-dd") '发票日期
LrText(2).Text = Trim("" & .Fields("InvoiceNumZs")) '原发票号
LrText(3).Tag = Trim("" & .Fields("InvoiceCode")) '发票类型编码
LrText(3).Text = Trim("" & .Fields("InvoiceName")) '发票类型名称
LrText(4).Tag = Trim("" & .Fields("OrderFormMainID")) '订单ID
LrText(4).Text = Trim("" & .Fields("OrderFormNum")) '订单号
LrText(5).Tag = Trim("" & .Fields("SupplierCode")) '供应商编码
LrText(5).Text = Trim("" & .Fields("SupplierName")) '供应商名称
LrText(6).Tag = Trim("" & .Fields("PurTypeCode")) '采购类型编码
LrText(6).Text = Trim("" & .Fields("PurTypeName")) '采购类型名称
LrText(7).Tag = Trim("" & .Fields("DeptCode")) '部门编码
LrText(7).Text = Trim("" & .Fields("DeptName")) '部门名称
LrText(8).Tag = Trim("" & .Fields("PersonCode")) '业务员编码
LrText(8).Text = Trim("" & .Fields("PersonName")) '业务员
LrText(9).Tag = Trim("" & .Fields("SSCode")) '结算方式编码
LrText(9).Text = Trim("" & .Fields("SSName")) '结算方式名称
LrText(10).Tag = Trim("" & .Fields("PayCode")) '付款条件编码
LrText(10).Text = Trim("" & .Fields("Payname")) '付款条件名称
LrText(11).Tag = Trim("" & .Fields("TransferWayCode")) '运输方式编码
LrText(11).Text = Trim("" & .Fields("TransferWayName")) '运输方式名称
LrText(12).Tag = Trim("" & .Fields("ForeignCurrCode")) '货币编码
LrText(12).Text = Trim("" & .Fields("ForeignCurrName")) '货币名称
LrText(13).Text = Format(S2N("" & .Fields("AccRate")), "###0." + String(4, "0")) '汇率
LrText(13).Tag = IIf(IsNull(.Fields("ConVertFlag")), 0, .Fields("ConVertFlag")) '外币的乘与除 1为乘,0为除
LrText(14).Tag = Trim("" & .Fields("ChargeDept")) '费用单位编码
LrText(14).Text = Trim("" & .Fields("ChargeDeptName")) '费用单位名称
LrText(15).Text = Trim("" & .Fields("Remark")) '备注
LrText(16).Text = Trim("" & .Fields("Maker")) '制单人
LrText(17).Text = Trim("" & .Fields("Checker")) '审核人
LrText(18).Text = IIf(IsNull(.Fields("BanlanceDate")) Or Trim("" & .Fields("BanlanceDate")) = "", "", Format(.Fields("BanlanceDate"), "yyyy-mm-dd")) '结算日期
TextChangeLock = False '文本框解锁
If .Fields("InvoiceFlag") Then '现付标志
Chk_Xf.Value = 0
Else
Chk_Xf.Value = 1
End If
'<<]
End If
jsqte = WglrGrid.FixedRows
WglrGrid.Clear 1
Do While Not .EOF
WglrGrid.AddItem ""
'[>>显示单据分录
WglrGrid.TextMatrix(jsqte, 0) = "*" '数据有效行标识(必填)
WglrGrid.TextMatrix(jsqte, 3) = IIf(.Fields("IsCharge") = True, 1, 0) '是否费用
WglrGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("MNumber") & "") '物料编码
WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("MName") & "") '物料名称
WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Model") & "") '规格型号
WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("PurUnitName") & "") '计量单位
Select Case Me.InvoiceType '发票类型
Case 1, 3 '蓝字普通发票
WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = IIf(IsNull(.Fields("Quantity")) Or .Fields("Quantity") = 0, "", .Fields("Quantity").Value) '数量
WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = IIf(IsNull(.Fields("PriceYb")) Or .Fields("PriceYb") = 0, "", .Fields("PriceYb").Value) '单价(原币)
WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = IIf(IsNull(.Fields("MoneyYb")) Or .Fields("MoneyYb") = 0, "", .Fields("MoneyYb").Value) '金额(原币)
Case 2, 4 '蓝字专用发票
WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = IIf(IsNull(.Fields("TaxRate")) Or .Fields("TaxRate") = 0, "", .Fields("TaxRate").Value) '税率
WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = IIf(IsNull(.Fields("Quantity")) Or .Fields("Quantity") = 0, "", .Fields("Quantity").Value) '数量
WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = IIf(IsNull(.Fields("PriceYb")) Or .Fields("PriceYb") = 0, "", .Fields("PriceYb").Value) '单价(原币)
WglrGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = IIf(IsNull(.Fields("MoneyYb")) Or .Fields("MoneyYb") = 0, "", .Fields("MoneyYb").Value) '金额(原币)
WglrGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = IIf(IsNull(.Fields("TaxMoneyYb")) Or .Fields("TaxMoneyYb") = 0, "", .Fields("TaxMoneyYb").Value) '税额(原币)
WglrGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = IIf(IsNull(.Fields("TotalMoneyYb")) Or .Fields("TotalMoneyYb") = 0, "", .Fields("TotalMoneyYb").Value) '价税合计(原币)
Case 5 '红字普通发票
WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = IIf(IsNull(.Fields("Quantity")) Or .Fields("Quantity") = 0, "", (-1) * .Fields("Quantity").Value) '数量
WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = IIf(IsNull(.Fields("PriceYb")) Or .Fields("PriceYb") = 0, "", .Fields("PriceYb").Value) '单价(原币)
WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = IIf(IsNull(.Fields("MoneyYb")) Or .Fields("MoneyYb") = 0, "", (-1) * .Fields("MoneyYb").Value) '金额(原币)
Case 6 '红字专用发票
WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = IIf(IsNull(.Fields("TaxRate")) Or .Fields("TaxRate") = 0, "", .Fields("TaxRate").Value) '税率
WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = IIf(IsNull(.Fields("Quantity")) Or .Fields("Quantity") = 0, "", (-1) * .Fields("Quantity").Value) '数量
WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = IIf(IsNull(.Fields("PriceYb")) Or .Fields("PriceYb") = 0, "", .Fields("PriceYb").Value) '单价(原币)
WglrGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = IIf(IsNull(.Fields("MoneyYb")) Or .Fields("MoneyYb") = 0, "", (-1) * .Fields("MoneyYb").Value) '金额(原币)
WglrGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = IIf(IsNull(.Fields("TaxMoneyYb")) Or .Fields("TaxMoneyYb") = 0, "", (-1) * .Fields("TaxMoneyYb").Value) '税额(原币)
WglrGrid.TextMatrix(jsqte, Sydz("010", GridStr(), Szzls)) = IIf(IsNull(.Fields("TotalMoneyYb")) Or .Fields("TotalMoneyYb") = 0, "", (-1) * .Fields("TotalMoneyYb").Value) '价税合计(原币)
End Select
'<<]
WglrGrid.RowHeight(jsqte) = Sjhgd
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -