📄 qg_biangeng_xiangmuwenyuan.vb
字号:
'
'qg_biangeng_xiangmuwenyuan
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(432, 302)
Me.Controls.Add(Me.GroupBox4)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.ComboBox2)
Me.Controls.Add(Me.ComboBox1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.GroupBox1)
Me.MaximizeBox = False
Me.Name = "qg_biangeng_xiangmuwenyuan"
Me.Text = "请购变更申请"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox4.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim m As Integer
'新建
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Button2.Enabled = True
Button5.Enabled = False
Button3.Enabled = False
ComboBox1.Enabled = True
'得到所有已经审批通过的请购申请单号,读入ComboBox1中
Dim str As String
Dim mydataset As New DataSet
str = "select 请购单编号 from qinggou_zongbiao where 是否分离 = " + Chr(39) + "1" + Chr(39) + " and 是否变更 = " + Chr(39) + "0" + Chr(39)
Dim i, y As Integer
mydataset = GetDataFromDB(str)
y = mydataset.Tables(0).Rows.Count
If y = 0 Then
Exit Sub
End If
Dim sstr As String
ComboBox1.Items.Clear()
For i = 0 To y - 1
sstr = Trim(mydataset.Tables(0).Rows(i)("请购单编号"))
ComboBox1.Items.Add(sstr)
Next
mydataset.Dispose()
End Sub
'得到已经有的变更申请号
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
Button2.Enabled = False
Button5.Enabled = True
Button3.Enabled = True
ComboBox1.Enabled = False
Dim str As String
Dim mydataset As New DataSet
str = "select 变更单编号 from bg_qinggoudan where 流程 = " + Chr(39) + "0" + Chr(39)
Dim i, y As Integer
mydataset = GetDataFromDB(str)
y = mydataset.Tables(0).Rows.Count
If y = 0 Then
Exit Sub
End If
Dim sstr As String
For i = 0 To y - 1
sstr = mydataset.Tables(0).Rows(i)("变更单编号")
ComboBox2.Items.Add(sstr)
Next
Else
ComboBox2.Items.Clear()
ComboBox2.Text = "变更请购单编号"
End If
End Sub
'保存
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Me.ComboBox1.Text.Trim = "" Then
MsgBox("请选择申请单编号!", MsgBoxStyle.Information, "提示!")
Me.TextBox1.Text = Nothing
Exit Sub
End If
Dim mystr As String
Dim mystr1 As String = Me.TextBox1.Text.Trim
mystr = "select * from bg_qinggoudan where 变更单编号 =" + Chr(39) + mystr1 + Chr(39)
If panduan(mystr) = True Then
MsgBox("该变更单编号已经存在!", MsgBoxStyle.Information, "提示!")
Exit Sub
End If
Dim sqlstr As String
sqlstr = "INSERT INTO bg_qinggoudan " & _
"(变更单编号,变更原因,请求变更人,请求变更人录入时间) " & _
"VALUES ('" & Me.ComboBox1.Text.Trim & "','" & Me.TextBox1.Text.Trim & "','" & UserName.Trim & "','" & Now.Date & "')"
If UpdateData(sqlstr) = False Then
MsgBox("没有成功添加了该变更申请信息!", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "添加成功")
Exit Sub
Else
MsgBox("已经成功添加了该变更申请信息!", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "添加成功")
Button2.Enabled = False
RadioButton1.Checked = True
'’‘’‘’‘’‘’‘’‘’‘’
Dim ssqlstr As String
ssqlstr = "UPDATE qinggou_zongbiao SET 是否变更 =" + Chr(39) + "1" + Chr(39) + " where 请购单编号=" + Chr(39) + ComboBox1.Text.Trim + Chr(39)
If UpdateData(ssqlstr) = True Then
Else
MsgBox("没有把请购单流程改为1,请与管理员联系!", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "提交")
Exit Sub
End If
'’‘’‘’‘’‘’‘’‘’‘’‘
End If
End Sub
'删除
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If RadioButton1.Checked = False Then
MsgBox("请选择要删除的项的编号!", MsgBoxStyle.Information, "提示")
RadioButton1.Checked = True
Exit Sub
End If
If ComboBox2.Text.Trim = "变更请购单编号" Then
MsgBox("请选择要删除的项的编号!", MsgBoxStyle.Information, "提示")
RadioButton1.Checked = True
Exit Sub
End If
Dim sqlstr As String
sqlstr = "delete bg_qinggoudan where 变更单编号 = " + Chr(39) + ComboBox2.Text.Trim + Chr(39)
If MsgBox("确定要删除吗?", MsgBoxStyle.YesNo, "删除") = MsgBoxResult.No Then
Exit Sub
End If
If UpdateData(sqlstr) = True Then
MsgBox("已经成功删除该信息", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "删除")
'’‘’‘’‘’‘’‘’‘’‘’
Dim ssqlstr As String
ssqlstr = "UPDATE qinggou_zongbiao SET 是否变更 =" + Chr(39) + "0" + Chr(39) + " where 请购单编号=" + Chr(39) + ComboBox2.Text.Trim + Chr(39)
If UpdateData(ssqlstr) = True Then
Else
MsgBox("没有把请购单流程改为0,请与管理员联系!", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "提交")
Exit Sub
End If
'’‘’‘’‘’‘’‘’‘’‘’‘
Else
MsgBox("没有成功删除该信息", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "删除")
Exit Sub
End If
End Sub
'提交
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If RadioButton1.Checked = False Then
MsgBox("请选择要提交的项的编号!", MsgBoxStyle.Information, "提示")
RadioButton1.Checked = True
Exit Sub
End If
Dim sqlstr As String
sqlstr = "UPDATE bg_qinggoudan SET 流程 =" + Chr(39) + "1" + Chr(39) + " where 变更单编号=" + Chr(39) + ComboBox2.Text.Trim + Chr(39)
If UpdateData(sqlstr) = True Then
MsgBox("已经成功提交该信息", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "提交")
RadioButton1.Checked = False
Else
MsgBox("没有成功提交该信息,请与管理员联系!", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "提交")
Exit Sub
End If
End Sub
'得到变更单信息
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
Dim str As String
Dim mydataset As New DataSet
str = "select * from bg_qinggoudan where 变更单编号 = " + Chr(39) + ComboBox2.Text.Trim + Chr(39)
mydataset = GetDataFromDB(str)
ComboBox1.Text = mydataset.Tables(0).Rows(0)("变更单编号")
TextBox1.Text = mydataset.Tables(0).Rows(0)("变更原因")
mydataset.Dispose()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -