📄
字号:
Ydtext.Width = .CellWidth - Ydcommand.Width
Else
Ydtext.Width = .CellWidth - Wbkpy1
End If
Else
Ydtext.Width = .CellWidth - Wbkpy1
End If
Ydtext.Height = .CellHeight - Wbkpy1
If GridInt(.Col, 2) <> 0 Then
Ydtext.MaxLength = GridInt(.Col, 2)
Else
Ydtext.MaxLength = 3000
End If
Call Wbkcl
Ydtext.Visible = True
Ydtext.SetFocus
End If
Dqtoprow = .TopRow
Dqleftcol = .LeftCol
'重置锁值
Valilock = False
Wbkbhlock = False
End With
End Sub
Private Function Fun_AllowInput() As Boolean '当某种条件成立时禁止文本框激活使单据处于录入状态
'如果单据操作状态为浏览状态则不能显示录入载体(通用)
If Trim(Lab_OperStatus.Caption) = "1" Then
Exit Function
End If
'[>>
'此处可以填写禁止文本框激活使单据处于录入状态的理由
'<<]
Fun_AllowInput = True
End Function
Private Sub Cxxswbk() 'Formresize中重新显示文本框,列表框,帮助按钮(通用)
Dim Wbkpy As Integer, Wbkpy1 As Integer
Wbkpy = 30
Wbkpy1 = 15
With WglrGrid
If YdCombo.Visible Then
YdCombo.Left = .CellLeft + .Left + Wbkpy
YdCombo.Top = .CellTop + .Top + Wbkpy
YdCombo.Width = .CellWidth - Wbkpy1
End If
If Ydcommand.Visible Then
Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
End If
If Ydtext.Visible Then
If Ydcommand.Visible Then
If Sfblbzkd Then
Ydtext.Width = .CellWidth - Ydcommand.Width
Else
Ydtext.Width = .CellWidth - Wbkpy1
End If
Else
Ydtext.Width = .CellWidth - Wbkpy1
End If
Ydtext.Left = .CellLeft + .Left + Wbkpy
Ydtext.Top = .CellTop + .Top + Wbkpy
Ydtext.Height = .CellHeight - Wbkpy1
End If
End With
End Sub
Private Sub Lrsjhx() '文本框录入数据回写
With WglrGrid
If YdCombo.Visible Then
.Text = Trim(YdCombo.Text)
End If
If Ydtext.Visible Then
.Text = Trim(Ydtext.Text)
End If
'(如果字段录入内容发生变化,则打开有效性判断锁)
If Zdlrqnr <> Trim(.Text) Then
Yxxpdlock = False
Hyxxpdlock = False
End If
'隐藏文本框,帮助按钮,列表组合框
Call Ycwbk
End With
End Sub
Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer) '网格快捷键
'如果单据操作状态为浏览状态则不能显示录入载体
If Trim(Lab_OperStatus.Caption) = "1" Then
Exit Sub
End If
Select Case KeyCode
Case vbKeyF2 '按F2键参照
Call xswbk
Call Lrzdbz
End Select
End Sub
Private Sub WglrGrid_KeyPress(KeyAscii As Integer) '网格接受键盘录入
'当某种条件成立时禁止文本框激活使单据处于录入状态
If Not Fun_AllowInput Then
Exit Sub
End If
With WglrGrid
'屏 蔽 回 车 键
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
Rowjsq = .Row
Coljsq = .Col + 1
If Coljsq > .Cols - 1 Then
If Rowjsq < .Rows - 1 Then
Rowjsq = Rowjsq + 1
End If
Coljsq = Qslz
End If
Do While Rowjsq <= .Rows - 1
If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
Coljsq = Coljsq + 1
If Coljsq > .Cols - 1 Then
Rowjsq = Rowjsq + 1
Coljsq = Qslz
End If
Else
Exit Do
End If
Loop
If Rowjsq <= .Rows - 1 Then
.Select Rowjsq, Coljsq
End If
Exit Sub
End If
'接受用户录入
Select Case KeyAscii
Case 0 To 32 '用户输入KeyAscii为0-32的键 如空格
'显示录入载体
Call xswbk
Case Else
'防止非编辑字段SendKeys()出现死循环
If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
Exit Sub
End If
'如果此字段为列表框录入则调入相应列表框
If GridBoolean(.Col, 3) Then
'列表框录入
Call xswbk
Else
Ydtext.Text = ""
'录入限制
Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
If KeyAscii = 0 Then
Exit Sub
End If
Call xswbk
Ydtext.Text = ""
Valilock = True
SendKeys Chr(KeyAscii), True
DoEvents
Valilock = False
End If
End Select
End With
End Sub
Private Sub Qkwlzd(sjh As Long, Sjl As Long) '清空为零字段
If Not GridBoolean(Sjl, 5) Then
Exit Sub
End If
With WglrGrid
If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
.TextMatrix(sjh, Sjl) = ""
End If
End With
End Sub
Private Sub fhyxh() '返回录入数据有效行,同时让得到焦点网格可见
With WglrGrid
If .Row >= .FixedRows Then
Call Xldqh
End If
End With
End Sub
Private Sub Xldqh() '显露当前行
Dim Toprowte As Long
With WglrGrid
Toprowte = 0
Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
Toprowte = .TopRow
.TopRow = .TopRow + 1
Loop
Toprowte = 0
Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
Toprowte = .TopRow
If .TopRow > 1 Then
.TopRow = .TopRow - 1
End If
Loop
End With
End Sub
Private Sub Xldql() '显露当前列
Dim Leftcolte As Long
With WglrGrid
If .Col >= Qslz And .Col >= .FixedCols Then
If .LeftCol > .Col Then
.LeftCol = .Col
End If
Leftcolte = 0
Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
Leftcolte = .LeftCol
.LeftCol = .LeftCol + 1
Loop
End If
End With
End Sub
Private Sub WglrGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long) '网格列发生移动时自动交换网格索引信息
Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
End Sub
Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button) '表格格式设置(通用)
Select Case Button.Key
Case "bcgs" '保存表格格式
Call Bcwggs(WglrGrid, GridCode, GridStr())
Case "hfmrgs" '恢复默认格式
Call Hfmrgs(WglrGrid, GridCode, GridStr())
End Select
End Sub
Private Sub bbyl(bbylte As Boolean) '报表打印预览
Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
Bbxbtgs = 1 '报 表 小 标 题 行 数
Bbbwhgs = 0 '报 表 表 尾 行 数
ReDim Bbxbt(1 To Bbxbtgs)
ReDim bbxbtzzxs(1 To Bbxbtgs)
If Bbbwhgs <> 0 Then
ReDim Bbbwh(1 To Bbbwhgs)
ReDim Bbbwhzzxs(1 To Bbbwhgs)
End If
Bbzbt = ReportTitle
Bbxbt(1) = Fun_FormatOutPut("仓库:" + Trim(Lbl_TitleText(0)), 40)
bbxbtzzxs(1) = 0 '报表行组织形式(0-居左 1-居中 2-居右)
Call Scyxsjb(WglrGrid) '生成报表数据
Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
If Not bbylte Then
Unload DY_Tybbyldy
End If
End Sub
Private Sub Timer1_Timer() '在窗体激活后调入查询程序
Timer1.Enabled = False
'加快显示速度
WglrGrid.Redraw = False
'生成查询结果
Call Sub_Query
WglrGrid.Redraw = True
End Sub
Private Sub Sub_Adjust() '单价调整
Dim Rectemp As Recordset
Dim RecQuery As New ADODB.Recordset
Dim SqlStr As String
Dim Rowjsq As Long
On Error GoTo Cwcl
WglrGrid.SetFocus
If WglrGrid.Rows = WglrGrid.FixedRows Then Exit Sub
'修改产品入库单的单价
Cw_DataEnvi.DataConnect.BeginTrans
With WglrGrid
For Rowjsq = .FixedRows To .Rows - 1
SqlStr = "SELECT InOutMainId,InOutSubId FROM Chhs_V_InOut a " & Trim(Str_QueryCondi) & _
" and a.Mnumber='" & Trim(.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) & "'"
Set Rectemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
Do While Not Rectemp.EOF
If RecQuery.State = 1 Then RecQuery.Close
RecQuery.Open "select * from Gy_InOutSub where InOutMainId=" & Rectemp.Fields("InOutMainId") & " and InOutSubId=" & Rectemp.Fields("InOutSubId"), Cw_DataEnvi.DataConnect, adOpenDynamic, adLockBatchOptimistic
If Not RecQuery.EOF Then
RecQuery.Fields("Price") = Val(.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls)))
RecQuery.Fields("Emoney") = Format(Val(.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls))) * Val(RecQuery.Fields("FactReceiptQuan")), "#####." + String(Xtjexsws, "0"))
RecQuery.UpdateBatch
End If
Rectemp.MoveNext
Loop
Next Rowjsq
End With
Cw_DataEnvi.DataConnect.CommitTrans
Exit Sub
Cwcl:
Cw_DataEnvi.DataConnect.RollbackTrans
Tsxx = "调整过程中出现未知错误,程序自动恢复保存前状态!"
Call Xtxxts(Tsxx, 0, 1)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -