📄 form5.frm
字号:
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 7680
TabIndex = 19
Top = 7125
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "结算方式:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 18
Top = 1815
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "供货商:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 17
Top = 1230
Width = 975
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "联系人:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 16
Top = 2340
Width = 975
End
Begin VB.Image Image1
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Height = 405
Left = 120
Picture = "Form5.frx":12A8
Top = 615
Width = 1380
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'作者:性灵工作室
'发布日期:2007/03/03
'描 述:简单小型超市采购系统
'网 站:http://www.Mndsoft.com/ (VB6源码博客)
'网 站:http://www.VbDnet.com/ (VB.NET源码博客,主要基于.NET2005)
'e-mail :Mndsoft@163.com
'e-mail :Mndsoft@126.com
'OICQ :88382850
' 如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************
Dim Classprint As New OpenRs '定义打印记录集
Dim intPage As Integer
Dim intPageCount As Integer
Dim intRecord As Integer
Private Sub Form_Load()
Set cg1 = cnn.Execute("select * from 供货商")
xcombox1.Clear
Do While Not cg1.EOF
xcombox1.AddItem cg1.Fields(0)
cg1.MoveNext
Loop
xcombox2.Clear
xcombox2.AddItem "现金"
xcombox2.AddItem "汇票"
xcombox2.AddItem "银行汇票"
xcombox2.AddItem "商业汇票"
Grid1.AllowUserResizing = True
Grid1.DisplayFocusRect = False
Grid1.ExtendLastCol = True
Grid1.Appearance = Flat
Grid1.FixedRowColStyle = Flat
Grid1.ScrollBarStyle = Flat
Grid1.DefaultFont.Name = "Tahoma"
Grid1.DefaultFont.Size = 8
Grid1.BackColorFixed = RGB(90, 158, 214)
Grid1.BackColorFixedSel = RGB(110, 180, 230)
Grid1.BackColorBkg = RGB(90, 158, 214)
Grid1.BackColorScrollBar = RGB(231, 235, 247)
Grid1.BackColor1 = RGB(231, 235, 247)
Grid1.BackColor2 = RGB(239, 243, 255)
Grid1.GridColor = RGB(148, 190, 231)
Grid1.Cols = 9
Grid1.Column(0).Width = 0
For i = 1 To 8
Grid1.Column(i).Width = 100
Next
Grid1.Column(4).Width = 50
Grid1.Column(5).Width = 50
Grid1.Column(8).Width = 30
Grid1.Column(1).CellType = cellComboBox
Grid1.Column(2).CellType = cellComboBox
Grid1.Column(3).CellType = cellComboBox
Grid1.Column(5).CellType = cellComboBox
Grid1.Column(8).CellType = cellCheckBox
If cg2.State = adStateOpen Then
cg2.Close
End If
cg2.Open "select * from 申购单明细", cnn, adOpenKeyset, adLockReadOnly, adCmdText
For i = 0 To 7
Grid1.Cell(0, i + 1).Text = cg2.Fields(i).Name
Next
Set cg3 = cnn.Execute("select distinct(商品类型) from 商品")
Grid1.ComboBox(1).Clear
Do While cg3.EOF = False
Grid1.ComboBox(1).AddItem cg3.Fields(0)
cg3.MoveNext
Loop
zdcsh '执行订单初始化
If cg1.State = adStateOpen Then
cg1.Close
End If
cg1.Open "select 申购单.*,采购订单.状态 from 采购订单,申购单 where 采购订单.采购单号=申购单.采购单号", cnn, adOpenStatic, adLockReadOnly, adCmdText
cg1.PageSize = 1
intPageCount = cg1.PageCount
If cg1.PageCount = 0 Then
intPageCount = 1
End If
intPage = cg1.PageCount
If cg1.RecordCount = 0 Then
Exit Sub
End If
cg1.AbsolutePage = intPage
clickpage
XPButton3.Caption = "上一订单(" & intPage - 1 & ")"
XPButton4.Caption = "下一订单(" & intPageCount - intPage & ")"
If intPage < intPageCount Then
XPButton4.Enabled = True
End If
If intPage <= 1 Then
XPButton3.Enabled = False
Else
XPButton3.Enabled = True
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Cancel = True
'Unload Me
End Sub
Private Sub Grid1_LeaveCell(ByVal Row As Long, ByVal Col As Long, NewRow As Long, NewCol As Long, Cancel As Boolean)
Set cg3 = cnn.Execute("select * from 商品")
Grid1.ComboBox(5).Clear
Do While cg3.EOF = False
Grid1.ComboBox(5).AddItem cg3.Fields(0)
cg3.MoveNext
Loop
End Sub
Private Sub clickpage()
xtext1.Text = cg1.Fields(0)
xtext2.Text = cg1.Fields(1)
xtext5(0).Text = cg1.Fields(2)
xcombox1.Text = cg1.Fields(3)
xtext5(1).Text = cg1.Fields(4)
xcombox2.Text = cg1.Fields(5)
xtext3.Text = cg1.Fields(6)
xcombox3.Text = cg1.Fields(7)
xtext4.Text = cg1.Fields(8)
xtext5(2).Text = cg1.Fields(9)
xtext8.Text = cg1.Fields(10)
If cg1.Fields(12) = "已审核" Then
Image1.Picture = LoadPicture(App.Path & "\images\shenhe-1.jpg")
XPButton6.Caption = "反审核"
ElseIf cg1.Fields(12) = "未审核" Then
Image1.Picture = LoadPicture(App.Path & "\images\shenhe-2.jpg")
XPButton6.Caption = "审核"
Else
XPButton6.Enabled = False
Image1.Picture = LoadPicture(App.Path & "\images\shenhe-2.jpg")
End If
Set cg2 = cnn.Execute("select * from 申购单明细 where 批号='" & xtext2.Text & "'")
Grid1.Rows = 1
i = 0
Do While Not cg2.EOF
i = i + 1
Grid1.Rows = Grid1.Rows + 1
For j = 0 To 7
Grid1.Cell(i, j + 1).Text = cg2.Fields(j)
Next
cg2.MoveNext
Loop
xtext1.Enabled = False
xtext2.Enabled = False
xtext5(0).Enabled = False
xcombox1.Enabled = False
xtext5(1).Enabled = False
xcombox2.Enabled = False
xtext3.Enabled = False
xcombox3.Enabled = False
xtext4.Enabled = False
xtext5(2).Enabled = False
xtext8.Enabled = False
Grid1.ReadOnly = True
End Sub
Private Sub zdcsh()
Dim dh As Integer
Dim strdh As String
Dim bdh As Boolean
bdh = False
dh = 1
Do While bdh = False
strdh = dh
Do While Len(strdh) < 6
strdh = "0" & strdh
Loop
xtext1.Text = Date & "-" & strdh
Set cg4 = cnn.Execute("select * from 采购订单 where 采购单号='" & xtext1.Text & "'")
If cg4.EOF = False Then
dh = dh + 1
Else
bdh = True
End If
cg4.Close
Loop
xtext2.Text = xtext1.Text
For dh = 0 To 2
xtext5(dh).Text = Date
Next
xtext8.Text = loginname
xcombox1.Text = ""
xcombox2.Text = ""
xcombox3.Text = ""
xtext3.Text = ""
xtext4.Text = ""
xtext1.Enabled = False
xtext2.Enabled = False
xtext5(0).Enabled = True
xcombox1.Enabled = True
xtext5(1).Enabled = True
xcombox2.Enabled = True
xtext3.Enabled = True
xcombox3.Enabled = True
xtext4.Enabled = True
xtext5(2).Enabled = False
xtext8.Enabled = False
Grid1.ReadOnly = False
End Sub
Private Sub Grid1_RowColChange(ByVal Row As Long, ByVal Col As Long)
If Row = 0 Then
Exit Sub
End If
If Grid1.Cell(Row, 1).Text <> "" Then
Set cg3 = cnn.Execute("select distinct(商品名称) from 商品 where 商品类型='" & Grid1.Cell(Row, 1).Text & "'")
Grid1.ComboBox(2).Clear
Do While Not cg3.EOF
Grid1.ComboBox(2).AddItem cg3.Fields(0)
cg3.MoveNext
Loop
End If
If Grid1.Cell(Row, 1).Text <> "" And Grid1.Cell(Row, 2).Text <> "" Then
Set cg3 = cnn.Execute("select distinct(商品型号) from 商品 where 商品类型='" & Grid1.Cell(Row, 1).Text & "' and 商品名称='" & Grid1.Cell(Row, 2).Text & "'")
Grid1.ComboBox(3).Clear
Do While Not cg3.EOF
Grid1.ComboBox(3).AddItem cg3.Fields(0)
cg3.MoveNext
Loop
End If
End Sub
Private Sub Timer1_Timer()
If xcombox1.Text <> "" Then
Set cg3 = cnn.Execute("select 联系人 from 供货商 where 供货商='" & xcombox1.Text & "'")
If cg3.EOF = True Then
Exit Sub
End If
xcombox3.Clear
xcombox3.AddItem cg3.Fields(0)
End If
End Sub
Private Sub xpbutton1_Click()
If system(4) = False Then
MsgBox "无此权限!"
Exit Sub
End If
If cg1.State = adStateOpen Then
cg1.Close
End If
cg1.Open "select * from 采购订单 where 采购单号='" & xtext1.Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Dim vyesno As String
vyesno = MsgBox("你确定要中止此单的执行吗?", vbQuestion + vbYesNo, "提示")
If vyesno = vbNo Then
Exit Sub
End If
If cg1.EOF = False Then
cg1.Fields(1) = "中止"
cg1.Update
Call Form_Load
MsgBox "该单已经中止!"
Image1.Picture = LoadPicture(App.Path & "\images\shenhe-1.jpg")
Else
MsgBox "无此单据!"
End If
End Sub
Private Sub XPButton2_Click()
If system(5) = False Then
MsgBox "无此权限!"
Exit Sub
End If
Set cg3 = cnn.Execute("select 采购单号 from 收货单 where 采购单号='" & xtext1.Text & "'")
If cg3.EOF = False Then
MsgBox "此前已经收货!", vbInformation, "提示"
Exit Sub
End If
Set cg3 = cnn.Execute("select 采购单号,状态 from 申购单 where 采购单号='" & xtext1.Text & "'")
If cg3.EOF = True Then
MsgBox "没有此单,请检查!", vbInformation, "提示"
Exit Sub
End If
If cg3.Fields(1) = "未审核" Then
MsgBox "此单未审核,无法生成订单!", vbInformation, "提示"
Exit Sub
Else
Set cg4 = cnn.Execute("insert into 收货单 values('" & cg3.Fields(0) & "','0')")
Unload Me
Form6.Show
End If
End Sub
Private Sub XPButton3_Click()
If intPage > 1 Then
intPage = intPage - 1
cg1.AbsolutePage = intPage
clickpage
cg1.MoveNext '读取下一记录
XPButton3.Caption = "上一订单(" & intPage - 1 & ")"
XPButton4.Caption = "下一订单(" & intPageCount - intPage & ")"
If intPage < intPageCount Then
XPButton4.Enabled = True
End If
If intPage <= 1 Then
XPButton3.Enabled = False
End If
End If
End Sub
Private Sub XPButton4_Click()
If intPage < intPageCount Then
intPage = intPage + 1
cg1.AbsolutePage = intPage
clickpage
cg1.MoveNext '读取下一记录
XPButton3.Caption = "上一订单(" & intPage - 1 & ")"
XPButton4.Caption = "下一订单(" & intPageCount - intPage & ")"
If intPage >= intPageCount Then
XPButton4.Enabled = False
End If
If intPage > 1 Then
XPButton3.Enabled = True
End If
End If
End Sub
Private Sub XPButton6_Click()
If system(3) = False Then
MsgBox "无此权限!"
Exit Sub
End If
If cg1.State = adStateOpen Then
cg1.Close
End If
cg1.Open "select * from 采购订单 where 采购单号='" & xtext1.Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
If XPButton6.Caption = "审核" Then
If cg1.EOF = False Then
cg1.Fields(1) = "已审核"
cg1.Update
Call Form_Load
MsgBox "审核完成!"
Image1.Picture = LoadPicture(App.Path & "\images\shenhe-1.jpg")
Else
MsgBox "无此订单,审核无效!"
Call Form_Load
End If
Else
If cg1.EOF = False Then
cg1.Fields(1) = "未审核"
cg1.Update
Call Form_Load
MsgBox "反审核完成!"
Image1.Picture = LoadPicture(App.Path & "\images\shenhe-2.jpg")
Else
MsgBox "无此订单,审核无效!"
Call Form_Load
End If
End If
End Sub
Private Sub XPButton7_Click()
sql = "select * from 申购单明细 where 批号='" & xtext1.Text & "'"
Unload Me
Classprint.rsDK1 sql
ClassReport.Show
Set ClassReport.DataSource = Classprint.rs1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -