📄 frm_thgl.frm
字号:
_Version = 393216
End
Begin VB.TextBox Text8
Height = 375
Left = 4320
TabIndex = 32
Top = 3120
Width = 1095
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 1680
Top = 3120
Width = 2895
_ExtentX = 5106
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=cggl"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=cggl"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from Table_kcb"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "frm_thgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_edit_Click()
Call main
c = MsgBox("确认要修改该信息吗?", 33, "采购管理系统")
If c = vbOK Then
Adodc1.Recordset.Delete
Text8.Text = "退货"
Set adoRs = adoCon.Execute("insert into Table_thb values(" & Text9 & "','" & Text1 & ",'" & Text2 & "','" & Text3 & "','" & Combo1 & "','" & DT1 & "','" & Combo3 & "','" & Text5 & "','" & Text6 & "','" & DT3 & "','" & Text7 & "','" & DT4 & "','" & Text4 & "','" & Text8 & "')")
MsgBox "数据修改成功!!", 64, "采购管理系统"
Cmd_edit.Enabled = False
Else
End If
Adodc1.RecordSource = "select * from Table_thb order by 单号"
Adodc1.Refresh
adoCon.Close
End Sub
Private Sub Cmd_exit_Click()
Unload Me
End Sub
Private Sub Cmd_refurbish_Click()
Unload Me
frm_cgclgl.Refresh
frm_cgclgl.Show
End Sub
Private Sub Cmd_save_Click()
Call main
If Text1.Text = "" Or Combo1.Text = "" Or Text6.Text = "" Or Val(Text6.Text) = 0 Then
MsgBox "退货单号或者退货数量或供应商编号不能为空值!!"
Text1.SetFocus
Else
Adodc1.RecordSource = "select * from Table_thb where 退货单号='" + Text9.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
c = MsgBox("确认要保存该信息吗?", 33, "采购管理系统")
If c = vbOK Then
Adodc2.RecordSource = "select * from Table_kcb where 单号='" + Text1.Text + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
If Val(Text6.Text) > Val(Adodc2.Recordset.Fields("数量")) Then
MsgBox "对不起,输入的退货数量非法,因为退货数量大于库存数量!!", 64, "采购管理系统"
ElseIf Val(Text6.Text) = Val(Adodc2.Recordset.Fields("数量")) Then
Set adoRs = adoCon.Execute("UPDATE Table_dhb SET 状态= '全部退货' where 单号='" + Text1.Text + "'")
Adodc2.Recordset.Delete
Text8.Text = "退货"
Set adoRs = adoCon.Execute("insert into Table_thb values(" & Text9 & ",'" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Combo1 & "','" & DT1 & "','" & Combo3 & "','" & Text5 & "','" & Text6 & "','" & DT3 & "','" & Text7 & "','" & DT4 & "','" & Text4 & "','" & Text8 & "')")
MsgBox "数据保存成功!!", 32, "采购管理系统"
Cmd_save.Enabled = False
Cmd_add.Enabled = True
ElseIf Val(Text6.Text) < Val(Adodc2.Recordset.Fields("数量")) Then
Dim number
number = Val(Adodc2.Recordset.Fields("数量")) - Val(Text6.Text)
Set adoRs = adoCon.Execute("UPDATE Table_kcb SET 数量= '" + Str(number) + "',状态= '部分退货' where 单号='" + Text1.Text + "'")
Set adoRs = adoCon.Execute("UPDATE Table_dhb SET 状态= '部分退货' where 单号='" + Text1.Text + "'")
Text8.Text = "退货"
Set adoRs = adoCon.Execute("insert into Table_thb values(" & Text9 & ",'" & Text1 & "','" & Text2 & "','" & Text3 & "','" & Combo1 & "','" & DT1 & "','" & Combo3 & "','" & Text5 & "','" & Text6 & "','" & DT3 & "','" & Text7 & "','" & DT4 & "','" & Text4 & "','" & Text8 & "')")
MsgBox "数据保存成功!!", 32, "采购管理系统"
Cmd_save.Enabled = False
Cmd_add.Enabled = True
Else
End If
Else
End If
Else
End If
Else
MsgBox "对不起,该信息已经保存过,不能够再进行保存", 64, "采购管理系统"
End If
End If
Adodc1.RecordSource = "select * from Table_thb order by 单号"
Adodc1.Refresh
adoCon.Close
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT1.SetFocus
Else
End If
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text7.SetFocus
Else
End If
End Sub
Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text5.SetFocus
Else
End If
End Sub
Private Sub DataGrid1_Click()
Adodc1.RecordSource = "select * from Table_thb where 退货单号='" + Text10.Text + "'"
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text9.Text = Adodc1.Recordset.Fields("退货单号")
Text1.Text = Adodc1.Recordset.Fields("单号")
Text2.Text = Adodc1.Recordset.Fields("货物名称")
Text3.Text = Adodc1.Recordset.Fields("批号")
Combo1.Text = Adodc1.Recordset.Fields("供应商名称")
Text5.Text = Adodc1.Recordset.Fields("单价")
Text6.Text = Adodc1.Recordset.Fields("数量")
Text7.Text = Adodc1.Recordset.Fields("货物备注")
Text4.Text = Adodc1.Recordset.Fields("退货原因")
DT1.Value = Adodc1.Recordset.Fields("收货日期")
DT3.Value = Adodc1.Recordset.Fields("到货日期")
DT4.Value = Adodc1.Recordset.Fields("退货日期")
Combo3.Text = Adodc1.Recordset.Fields("单位")
End If
End Sub
Private Sub DT2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo3.SetFocus
Else
End If
End Sub
Private Sub DT3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text7.SetFocus
Else
End If
End Sub
Private Sub Cmd_add_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text9.Text = ""
Combo1.Text = ""
Combo3.Text = ""
Cmd_save.Enabled = True
Cmd_add.Enabled = False
Dim temp1
temp1 = Format(Now, "yyyymmdd")
Adodc1.RecordSource = "select * from Table_thb where 退货单号 like '%" + temp1 + "%'order by 退货单号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text9.Text = Adodc1.Recordset.Fields("退货单号")
Text9.Text = Val(Adodc1.Recordset.Fields("退货单号")) + 1
Else
Text9.Text = Format(Now, "yyyymmdd")
Text9.Text = Text9.Text + "0000"
End If
Adodc1.RecordSource = "select * from Table_thb order by 退货单号"
Adodc1.Refresh
Text1.SetFocus
End Sub
Private Sub Cmd_cancel_Click()
Text1.Locked = False
Cmd_del.Enabled = False
Cmd_save.Enabled = False
Cmd_add.Enabled = True
Cmd_edit.Enabled = False
Call Cmd_add_Click
End Sub
Private Sub Cmd_del_Click()
Adodc1.RecordSource = "select * from Table_thb"
'Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
c = MsgBox("确认要删除该信息吗?", 17, "采购管理系统")
If c = vbOK Then
Adodc1.Recordset.Delete
Else
End If
Else
MsgBox "数据库中的信息为空,没有可删除的信息!!", 64, "采购管理系统"
End If
End Sub
Private Sub DT4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text4.SetFocus
Else
End If
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
DT4.Value = Date
frm_main.StatusBar1.Panels(1).Text = " 当前操作: " & Me.Caption
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
frm_thxx_temp.Show
frm_thxx_temp.DataGrid1.SetFocus
Else
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmd_save_Click
Else
End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT4.SetFocus
Else
End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text4.SetFocus
Else
End If
End Sub
Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Text9.Text = "" Then
frm_thxx_temp.Show
frm_thxx_temp.DataGrid1.SetFocus
Else
If Not IsNumeric(Text9.Text) Then
MsgBox "输入的退货编号必须为数字"
Else
Adodc1.RecordSource = "select * from Table_thb where 退货单号='" + Text9.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Cmd_del.Enabled = True
Cmd_save.Enabled = True
Cmd_edit.Enabled = True
Text1.Text = Adodc1.Recordset.Fields("单号")
Text2.Text = Adodc1.Recordset.Fields("货物名称")
Text3.Text = Adodc1.Recordset.Fields("批号")
Combo1.Text = Adodc1.Recordset.Fields("供应商名称")
Text5.Text = Adodc1.Recordset.Fields("单价")
Text6.Text = Adodc1.Recordset.Fields("数量")
Text7.Text = Adodc1.Recordset.Fields("货物备注")
Text4.Text = Adodc1.Recordset.Fields("退货原因")
DT1.Value = Adodc1.Recordset.Fields("收货日期")
DT3.Value = Adodc1.Recordset.Fields("到货日期")
DT4.Value = Adodc1.Recordset.Fields("退货日期")
Combo3.Text = Adodc1.Recordset.Fields("单位")
Else
MsgBox "没有该货物的退货信息!!", 64, "采购管理系统"
End If
End If
End If
Else
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.StatusBar1.Panels(1).Text = " 吉林省明日科技有限公司"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -