📄 form1.frm
字号:
jsql = "select * from 销售单据 order by 序号 desc"
sellnote
gridsave = False '允许保存
griddelete = True
gridedit = True
'Grid1.Range(0, 0, 0, Grid1.Cols - 1).ForeColor = RGB(255, 255, 255)
End Sub
Private Sub sellnote() '销售指令
xsjl '执行销售表格的处理
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open jsql, cnn, adOpenStatic, adLockReadOnly, adCmdText
qy1.PageSize = 10
nnum = qy1.PageCount
If qy1.PageCount = 0 Then
nnum = 1
End If
numpage = 1
Label1.Caption = "共" & nnum & "页 第" & numpage & "页"
Grid1.Rows = 11
jnumber = 7
Grid1.Cols = jnumber '必须+2,因为实际上为11行,但第一行是隐藏的
For i = 1 To jnumber - 2
Grid1.Cell(0, i).Text = qy1.Fields(i).Name
Next
Grid1.Rows = 1
Grid1.Rows = 11
If qy1.RecordCount = 0 Then
Exit Sub
End If
qy1.AbsolutePage = numpage
For i = 1 To 10 '设定读取行
For j = 1 To jnumber - 2 '设定读取列
If qy1.EOF = True Then
Exit Sub
End If
If qy1.Fields(j) = noNull Then '空值的处理
Grid1.Cell(i, j).Text = ""
Else
Grid1.Cell(i, j).Text = qy1.Fields(j)
End If
Next
If qy1.EOF = False Then
qy1.MoveNext '读取下一记录
Else
Exit Sub
End If
Next
End Sub
Private Sub xsjl()
Grid1.Visible = True
Grid2.Visible = True
Grid2.Top = 5730
Grid2.Width = 10125
Grid2.Left = 1875
Grid2.Height = 1920
Grid2.Cols = 10
Grid2.Rows = 1
Grid2.Rows = 6
'Grid2.ReadOnly = True
If qy1.State = adStateOpen Then '表状态
qy1.Close
End If
qy1.Open "select * from 销售记录", cnn, adOpenKeyset, adLockReadOnly, adCmdText
i = 9
Grid2.Cols = i + 1 '必须+1,因为实际上为11行,但第一行是隐藏的
For i = 0 To 8 '显示数据的字段名
Grid2.Cell(0, i + 1).Text = qy1.Fields(i).Name
Next
Grid2.Column(0).Width = 0
Grid2.Column(1).Width = 80
Grid2.Column(2).Width = 80
Grid2.Column(3).Width = 80
Grid2.Column(4).Width = 40
Grid2.Column(5).Width = 70
Grid2.Column(6).Width = 70
Grid2.Column(7).Width = 70
Grid2.Column(8).Width = 70
Grid2.Column(1).CellType = cellComboBox
Grid2.Column(2).CellType = cellComboBox
Grid2.Column(3).CellType = cellComboBox
Grid2.Column(5).CellType = cellComboBox
Grid2.Column(8).CellType = cellComboBox
Grid2.Column(9).CellType = cellCheckBox
Grid1.Column(0).Width = 0
Grid1.Column(1).Width = 120
Grid1.Column(2).Width = 100
Grid1.Column(3).Width = 80
Grid1.Column(4).Width = 100
Grid1.Column(5).Width = 120
Grid1.Column(5).Width = 100
Grid1.ReadOnly = True
End Sub
Private Sub asPopup3_Click(Cancel As Boolean)
XPFrame3.Visible = True
XPFrame3.Left = (Me.Width / 2) - (XPFrame3.Width / 2)
XPFrame3.Top = (Me.Height / 2) - (XPFrame3.Height / 2)
Set s1 = cnn.Execute("select * from 合作单位")
FCombo2.Clear
Do While s1.EOF = False
FCombo2.AddItem s1.Fields(0)
s1.MoveNext
Loop
End Sub
Private Sub asPopup4_Click(Cancel As Boolean)
Dim fo2 As CTranslucentForm
Set fo2 = New CTranslucentForm
fo2.hwnd = Form3.hwnd
fo2.Alpha = 85 / 100 * 255
Load Form3
Form3.Show 1
End Sub
Private Sub asPopup5_Click(Cancel As Boolean)
XPFrame2.Visible = True
XPFrame2.Left = (Me.Width / 2) - (XPFrame2.Width / 2)
XPFrame2.Top = (Me.Height / 2) - (XPFrame2.Height / 2)
Set s1 = cnn.Execute("select * from 合作单位")
FCombo1.Clear
Do While s1.EOF = False
FCombo1.AddItem s1.Fields(0)
s1.MoveNext
Loop
End Sub
Private Sub asPopup6_Click(Cancel As Boolean)
Dim fo2 As CTranslucentForm
Set fo2 = New CTranslucentForm
fo2.hwnd = Form4.hwnd
fo2.Alpha = 90 / 100 * 255
Me.WindowState = vbMinimized
Load Form4
Form4.Show 1
End Sub
Private Sub asPopup9_Click(Cancel As Boolean)
End
End Sub
Private Sub c1_Click(Index As Integer) '提交内容到函数执行,4为当前菜单(0-4),index是按钮数组名称
cmove 3, Index
End Sub
Private Sub cmove(s As Integer, i As Integer) '菜单智能移动函数代码
Dim j As Integer
Dim X, Y, z, x1, y1 As Integer
X = s
Y = s
z = s
x1 = s
j = 0
Do While s > 0
If je > i Then
Do While X > i
Do While Y >= X
j = j + 360
Y = Y - 1
Loop
c1(X).Top = Fre1.Height - j
X = X - 1
Loop
Else
'-----------------向上代码
For X = 0 To i
For Y = 0 To X
j = j + 360
Next
c1(X).Top = j - 360
j = 0
Next
End If
s = s - 1
For y1 = 0 To x1
If y1 = i Then
Fre2(y1).Visible = True
Fre2(y1).Top = c1(y1).Top + c1(y1).Height
If y1 <> z Then
Fre2(y1).Height = c1(y1 + 1).Top - Fre2(y1).Top
Else
Fre2(y1).Height = Fre1.Height - c1(y1).Top - c1(y1).Height
End If
Else
Fre2(y1).Visible = False
End If
Next
Loop
je = i
End Sub
Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
If gridsave = True Then
tjsave.Enabled = True
Else
tjsave.Enabled = False
End If
If gridedit = True Then
tjedit.Enabled = True
Else
tjedit.Enabled = False
End If
If griddelete = True Then
tjdelete.Enabled = True
Else
tjdelete.Enabled = False
End If
PopupMenu ZT
End If
End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long)
hang1 = Row
Set qy1save = cnn.Execute("select * from 销售记录 where 批号='" & Grid1.Cell(Row, 4).Text & "' order by 内部编号 asc")
Grid2.Rows = 1
i = 0
Do While Not qy1save.EOF
i = i + 1
Grid2.Rows = Grid2.Rows + 1
For j = 1 To Grid2.Cols - 1 '设定读取列
If qy1save.Fields(j - 1) = Null Then '空值的处理
Grid2.Cell(i, j).Text = ""
Else
Grid2.Cell(i, j).Text = qy1save.Fields(j - 1)
End If
Next
qy1save.MoveNext '读取下一记录
Loop
End Sub
Private Sub Grid1_Validate(Cancel As Boolean) '设定TAB键切换
Dim nActiveRow As Long, nActiveCol As Long
Const VK_TAB = 9
If GetKeyState(VK_TAB) < 0 Then
nActiveRow = Grid1.ActiveCell.Row
nActiveCol = Grid1.ActiveCell.Col
If nActiveCol < Grid1.Cols - 1 Then
Grid1.Range(nActiveRow, nActiveCol + 1, _
nActiveRow, nActiveCol + 1).Selected
End If
Cancel = True
End If
End Sub
Private Sub Form_Load()
Grid1.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
Grid2.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
Grid3.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
Me.Picture = LoadPicture(App.Path & "\images\bgmain.jpg")
XPFrame1.BackColor = RGB(79, 149, 163)
form1.BackColor = RGB(79, 149, 163)
If isadmin = False Then
asPopup1.Enabled = False
c1(2).Enabled = False248
XPButton4.Enabled = False
XPButton5.Enabled = False
XPButton6.Enabled = False
Image1.Enabled = fale
Image2(2).Enabled = False
Image3(2).Enabled = False
End If
With Grid1
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.DefaultFont.Name = "Tahoma"
.DefaultFont.SIZE = 8
.BackColorFixed = RGB(79, 149, 163)
.BackColorFixedSel = RGB(79, 149, 163) 'RGB(84, 201, 134)
.BackColorBkg = RGB(79, 149, 163)
.BackColorScrollBar = RGB(79, 149, 163)
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(181, 212, 255) 'RGB(239, 243, 255)
.GridColor = RGB(79, 149, 163)
.Column(0).Width = 0
End With
With Grid2
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.DefaultFont.Name = "Tahoma"
.DefaultFont.SIZE = 8
.BackColorFixed = RGB(79, 149, 163)
.BackColorFixedSel = RGB(79, 149, 163) ' RGB(84, 201, 134)
.BackColorBkg = RGB(79, 149, 163)
.BackColorScrollBar = RGB(79, 149, 163)
.BackColor1 = RGB(231, 235, 247)
.BackColor2 = RGB(181, 212, 255)
.GridColor = RGB(79, 149, 163)
.Column(0).Width = 0
End With
With Grid3
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.AllowUserResizing = True
.DisplayFocusRect = False
.ExtendLastCol = True
.Appearance = Flat
.FixedRowColStyle = Flat
.ScrollBarStyle = Flat
.DefaultFont.Name = "Tahoma"
.DefaultFont.SIZE = 8
.BackColorFixed = RGB(79, 149, 163)
.BackColorFixedSel = RGB(79, 149, 163) 'RGB(84, 201, 134)
.BackColorBkg = RGB(79, 149, 163)
.BackColorScrollBar = RGB(79, 149, 163)
.BackColor1 = RGB(181, 212, 255)
.BackColor2 = RGB(239, 243, 255)
.GridColor = RGB(79, 149, 163)
.Column(0).Width = 0
.Column(1).Width = 110
.Column(2).Width = 130
.Column(3).Width = 80
.Column(4).Width = 110
.Column(5).Width = 80
.Cell(0, 1).Text = "单号"
.Cell(0, 2).Text = "单位"
.Cell(0, 3).Text = "日期"
.Cell(0, 4).Text = "批号"
.Cell(0, 5).Text = "总金额"
.Cell(0, 6).Text = "制单人"
.Column(2).CellType = cellComboBox
.Column(3).CellType = cellCalendar
For i = 1 To 5
.Cell(1, i).ForeColor = RGB(0, 0, 0)
Next
.Column(1).Locked = True
.Column(4).Locked = True
.Column(5).Locked = True
.Column(6).Locked = True
End With
je = 3
Dim fr As Integer
Fre1.BackColor = RGB(168, 217, 189)
For fr = 0 To 3
Fre2(fr).Visible = False
Fre2(fr).BackColor = RGB(79, 149, 163) 'RGB(168, 217, 189)
Next
Grid2.Visible = False
Call c1_Click(0)
End Sub
Private Sub Grid2_LeaveCell(ByVal Row As Long, ByVal Col As Long, NewRow As Long, NewCol As Long, Cancel As Boolean)
Set qy3 = cnn.Execute("select * from 商品单位")
Grid2.ComboBox(5).Clear
Do While qy3.EOF = False
Grid2.ComboBox(5).AddItem qy3.Fields(0)
qy3.MoveNext
Loop
Set th = cnn.Execute("select * from 特殊事项")
Grid2.ComboBox(8).Clear
Do While th.EOF = False
Grid2.ComboBox(8).AddItem th.Fields(0)
th.MoveNext
Loop
Set s1 = cnn.Execute("select * from 商品类型")
Grid2.ComboBox(1).Clear
Do While s1.EOF = False
Grid2.ComboBox(1).AddItem s1.Fields(0)
s1.MoveNext
Loop
If Grid2.Cell(Row, 1).Text = "" Then
Exit Sub
End If
Set s2 = cnn.Execute("select * from 商品名称 where 商品类型='" & Grid2.Cell(Row, 1).Text & "'")
Grid2.ComboBox(2).Clear
Do While s2.EOF = False
Grid2.ComboBox(2).AddItem s2.Fields(1)
s2.MoveNext
Loop
If Grid2.Cell(Row, 2).Text = "" Then
Exit Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -