📄
字号:
Dim Str_RightEdit As String '单据编辑(新增、修改、删除)权限索引
Dim Str_RightCheck As String '单据审核(审核、弃审)权限索引
Dim Str_RightZf As String '单据审核(作废)权限索引
']
'以下为固定使用变量(单据)
Dim BillCode As String '单据设计编码(索引号)
Dim Var_Bill() As Variant '用来返回单据设计信息
Dim ReportTitle As String '报表主标题
Dim Tsxx As String '系统提示信息
'以下为固定使用变量(网格)
Dim Cxnrrec As New ADODB.Recordset '显示查询内容动态集
Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
Dim GridCode As String '显示网格网格代码
Dim GridInf() As Variant '整个网格设置信息
Dim Pmbcsjhs As Long '屏幕网格保持数据行数(大于等于1)
Dim Fzxwghs As Integer '辅助项网格行数(包括合计行)
Dim Sfxshjwg As Boolean '是否显示合计网格
Dim Qslz As Long '网格隐藏(非操作显示)列数
Dim Sjhgd As Double '网格数据行高度
Dim GridBoolean() As Boolean '网格列信息(布尔型)
Dim GridStr() As String '网格列信息(字符型)
Dim GridInt() As Integer '网格列信息(整型)
Dim Sfblbzkd As Boolean '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
Dim Dqlrwgh As Long '当前录入数据网格行
Dim Dqlrwgl As Long '当前录入数据网格列
Dim Dqlkwgh As Long '刚刚离开网格行(不一定为录入行)
Dim Dqlkwgl As Long '刚刚离开网格列
Dim Dqtoprow As Long '当前录入状态时最上端可视行
Dim Dqleftcol As Long '当前录入状态时最左端可视列
Dim Zdlrqnr As String '字段录入修改前内容(用来判断内容是否修改)
Dim Wbkbhlock As Boolean '文本框改变值锁
Dim changelock As Boolean '网格行列改变控制锁(用来区别用户改变.程序改变)
Dim Gdtlock As Boolean '滚动条滚动控制(用来区别用户改变.程序改变)
Dim Yxxpdlock As Boolean '字段有效性判断锁(内容不修改不需进行字段有效性判断)
Dim Hyxxpdlock As Boolean '行有效性判断锁(字段内容不修改不需进行行有效性判断)
Dim Valilock As Boolean '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
Dim Shsfts As Boolean '删除记录行是否提示
Dim Szzls As Integer '网格信息数组最大下标值(网格列数-1)
'以下为固定使用变量(文本框)
Dim Textvar() As Variant '存储变体型文本框信息
Dim Textboolean() As Boolean '存储布尔型文本框信息
Dim Textint() As Integer '存储整型文本框信息
Dim Textstr() As String '存储字符型文本框信息
Dim Max_Text_Index As Integer '最大录入文本框索引值
Dim TextGroupCode As String '文本框录入分组编码
Dim TextValiLock As Boolean '文本框失去焦点是否进行有效性控制判断
Dim TextValiJudgeLock() As Boolean '文本框录入有效性判断控制锁
Dim TextChangeLock As Boolean '文本框内容变换控制锁
Dim SourDatabase As String '专用发票路径
Private Sub Command1_Click()
Dim jsq As Long
Dim Dqh As Long
Dim RsTemp As New Recordset
Dim StrTemp As String
Xs_I_ChoiceConsign.Show 1
If Command1.Tag <> "1" Then Exit Sub
If vsFlexGrid1.Rows = vsFlexGrid1.FixedRows Then Exit Sub
TempInvoiceConsign = "1"
StrTemp = "select * from xs_v_Consignbill where ConsignCode='" & Trim(vsFlexGrid1.TextMatrix(vsFlexGrid1.FixedRows, 2)) & "'"
Set RsTemp = Cw_DataEnvi.DataConnect.Execute(StrTemp)
With RsTemp
LrText(3).Tag = Trim(.Fields("CusCode") & "") '客户编码
LrText(3).Text = Trim(.Fields("cusname") & "")
LrText(4).Text = Trim(.Fields("ConsignAddress") & "") '发货地址
LrText(5).Tag = Trim(.Fields("SellTypeCode") & "") '销售类型
LrText(5).Text = Trim(.Fields("SellTypename") & "")
LrText(6).Tag = Trim(.Fields("deptCode") & "") '部门编码
LrText(6).Text = Trim(.Fields("deptname") & "")
LrText(7).Tag = Trim(.Fields("personCode") & "") '销售员
LrText(7).Text = Trim(.Fields("personname") & "")
LrText(8).Text = Trim(.Fields("Bank") & "") '开户银行
LrText(9).Text = Trim(.Fields("BankAccount") & "") '银行帐号
LrText(10).Tag = Trim(.Fields("payCode") & "") '付款条件
LrText(10).Text = Trim(.Fields("payname") & "")
LrText(11).Tag = Trim(.Fields("foreigncurrcode") & "") '币种
LrText(11).Text = Trim(.Fields("foreigncurrname") & "")
LrText(12).Text = Trim(.Fields("exchrate") & "") '汇率
LrText(12).Tag = Trim(.Fields("ConVertFlag") & "")
LrText(13).Text = Trim(.Fields("TaxCode") & "") '税号
LrText(14).Text = Trim(.Fields("remark") & "") '备注
RsTemp.Close
End With
With WglrGrid
If GtempInvoiceHB = 1 Then
.Clear 1
.Rows = .FixedRows
For jsq = vsFlexGrid1.FixedRows To vsFlexGrid1.Rows - 1
If vsFlexGrid1.TextMatrix(jsq, 0) <> "*" Then Exit For
If vsFlexGrid1.TextMatrix(jsq, 1) <> "*" Then
.Rows = .Rows + 1
Dqh = .Rows - 1
StrTemp = "select * from xs_v_material where mnumber='" & Trim(vsFlexGrid1.TextMatrix(jsq - 1, 4)) & "'"
If RsTemp.State = 1 Then RsTemp.Close
Set RsTemp = Cw_DataEnvi.DataConnect.Execute(StrTemp)
.TextMatrix(Dqh, 0) = "*" '数据有效行标识(必填)
.TextMatrix(Dqh, Sydz("013", GridStr(), Szzls)) = Trim(RsTemp.Fields("mnumber") & "") '货物编码
.TextMatrix(Dqh, Sydz("001", GridStr(), Szzls)) = Trim(RsTemp.Fields("MName") & "") '货物名称
.TextMatrix(Dqh, Sydz("002", GridStr(), Szzls)) = Trim(RsTemp.Fields("Model") & "") '规格型号
.TextMatrix(Dqh, Sydz("003", GridStr(), Szzls)) = Trim(RsTemp.Fields("saleUnitName")) '单位
.TextMatrix(Dqh, Sydz("004", GridStr(), Szzls)) = Abs(vsFlexGrid1.TextMatrix(jsq, 10)) '开票数量
.TextMatrix(Dqh, Sydz("011", GridStr(), Szzls)) = Abs(vsFlexGrid1.TextMatrix(jsq, 11)) '含税单价
.TextMatrix(Dqh, Sydz("010", GridStr(), Szzls)) = Val(RsTemp.Fields("cess")) / 100 '税率
Call Sub_JoinCount(Dqh, Sydz("011", GridStr(), Szzls)) '含税单价
End If
Next
Else
.Clear 1
.Rows = .FixedRows
For jsq = vsFlexGrid1.FixedRows To vsFlexGrid1.Rows - 1
If vsFlexGrid1.TextMatrix(jsq, 0) <> "*" Then Exit For
If vsFlexGrid1.TextMatrix(jsq, 1) = "*" Then
.Rows = .Rows + 1
Dqh = .Rows - 1
StrTemp = "select * from xs_v_material where mnumber='" & Trim(vsFlexGrid1.TextMatrix(jsq, 4)) & "'"
If RsTemp.State = 1 Then RsTemp.Close
Set RsTemp = Cw_DataEnvi.DataConnect.Execute(StrTemp)
.TextMatrix(Dqh, 0) = "*" '数据有效行标识(必填)
.TextMatrix(Dqh, Sydz("013", GridStr(), Szzls)) = Trim(RsTemp.Fields("mnumber") & "") '货物编码
.TextMatrix(Dqh, Sydz("001", GridStr(), Szzls)) = Trim(RsTemp.Fields("MName") & "") '货物名称
.TextMatrix(Dqh, Sydz("002", GridStr(), Szzls)) = Trim(RsTemp.Fields("Model") & "") '规格型号
.TextMatrix(Dqh, Sydz("003", GridStr(), Szzls)) = Trim(RsTemp.Fields("saleUnitName")) '单位
.TextMatrix(Dqh, Sydz("004", GridStr(), Szzls)) = Abs(vsFlexGrid1.TextMatrix(jsq, 10)) '开票数量
.TextMatrix(Dqh, Sydz("011", GridStr(), Szzls)) = Abs(vsFlexGrid1.TextMatrix(jsq, 11)) '含税单价
.TextMatrix(Dqh, Sydz("010", GridStr(), Szzls)) = Val(RsTemp.Fields("cess")) / 100 '税率
Call Sub_JoinCount(Dqh, Sydz("011", GridStr(), Szzls)) '含税单价
End If
Next
End If
'重置网格
If .Rows < Pmbcsjhs + .FixedRows Then
.Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
End If
For jsq = .FixedRows To .Rows - 1
.RowHeight(jsq) = Sjhgd
Next jsq
changelock = True
.Select .FixedRows, Qslz
changelock = False
'----------
For jsq = Qslz To WglrGrid.Cols - 1
Call Sjhj(jsq)
Next jsq
End With
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) '控 制 焦 点 转 移
Dim jdzygs As Integer
jdzygs = 16 '在单据录入中,此焦点转移控制值一定小于等于文本框个数,否则网格回车键将不支持.
Select Case KeyAscii
Case vbKeyReturn
If Kjjdzy(jdzygs) Then
KeyAscii = 0
End If
Case 39 '屏蔽字符"'"
KeyAscii = 0
End Select
End Sub
Private Sub Form_Load() '窗 体 装 入
'初始化各种锁值(Fixed)
changelock = False '网格行列改变控制锁
Gdtlock = False '滚动条滚动控制
Yxxpdlock = True '字段有效性判断锁
Hyxxpdlock = True '行有效性判断锁
Wbkbhlock = False '文本框内容改变锁
GtempInvoiceType = "Xs_I_UseRedInvoice"
TempInvoiceConsign = "0"
'单据权限索引设置
Str_RightEdit = "Xs_I_UseRedInvoiceEdit"
Str_RightCheck = "Xs_I_UseRedInvoiceCheck"
Str_RightZf = "Xs_I_UseRedInvoiceZf"
'调入单据信息(需要修改BillCode)
BillCode = "1407"
Call Sub_ReadBillInfo(BillCode, Me, Var_Bill())
Lab_Title = Var_Bill(2)
Lab_Title.Move (Me.Width - Lab_Title.Width) / 2, 800
Lab_Title.ForeColor = &HFF&
'报表编码
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
'单据变动置为False(Fixed)
Bln_BillChange = False
'调入数据初始化模块(Fixed)
Lab_Djclzt.Caption = Xtcdcs
Call Sjcsh(Trim(Lab_Djclzt.Caption))
SourDatabase = Qcljnr '读取专用发票路径
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"
Else
Xtfhcs = "0"
End If
End Sub
Private Sub Sjcsh(Str_Pzclzt As String) '数据初始化模块(根据实际情况)
Dim Sqlstr As String '查询单据列表条件
'[>>根据实际情况初始化
Select Case Str_Pzclzt
Case "1" '填制单据
'调入用户查询结果动态集
Sqlstr = "SELECT InvoiceBillMainID From Xs_InvoiceBillMain Where InvoiceDate='" & Xtrq & "' and InvoiceType=1 and returnflag=1 ORDER BY InvoiceBillMainID"
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 InvoiceBillMainID From Xs_V_InvoiceBill " & Str_QueryCondi & " ORDER BY InvoiceBillMainID"
Set Rec_Query = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
Rec_Query.Find "InvoiceBillMainID=" & Val(Lab_BillId.Caption)
Case "3" '明细帐联查单据
'设置工具条显示
Lab_BillId.Caption = XT_BillID
With Tlb_Action
.Buttons("hd").Enabled = False '货单
.Buttons("zf").Enabled = False '作废
.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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -