📄 form1.frm
字号:
Dim dbstring, sqlstring As String
dbstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath & "wupin.mdb"
ado.Open dbstring
sqlstring = "select sum(金额) as jine from wupin where 单据号=" & "'" & str_biaodan & "'"
Set rs = ado.Execute(sqlstring, 1, 1)
If Not IsNull(rs("jine").Value) Then
Label6.Caption = "¥:" + CStr(rs("jine").Value)
Else
Label6.Caption = "¥:" + "0.00"
End If
'打印前首先统计总和避免出错
'**************************************************************************
ReDim arr_bh(5)
ReDim arr_mc(5)
ReDim arr_gg(5)
ReDim arr_dw(5)
ReDim arr_sl(5)
ReDim arr_dj(5)
ReDim arr_je(5)
ReDim arr_bz(5)
If Adodc1.Recordset.EOF And Adodc1.Recordset.BOF Then
Exit Sub
End If
Adodc1.Recordset.MoveFirst
If Not IsNull(Adodc1.Recordset("使用单位").Value) Then
ActiveReport1.bgbm1.Caption = Adodc1.Recordset("使用单位").Value
End If
If Not IsNull(Adodc1.Recordset("保管部门").Value) Then
ActiveReport1.sydw1.Caption = Adodc1.Recordset("保管部门").Value
End If
If Not IsNull(Adodc1.Recordset("部门主管").Value) Then
ActiveReport1.bmzg1.Caption = Adodc1.Recordset("部门主管").Value
End If
If Not IsNull(Adodc1.Recordset("制单").Value) Then
ActiveReport1.zd1.Caption = Adodc1.Recordset("制单").Value
End If
For i = 0 To Adodc1.Recordset.RecordCount - 1
If Not IsNull(Adodc1.Recordset("编号").Value) Then
arr_bh(i) = Adodc1.Recordset("编号").Value
End If
If Not IsNull(Adodc1.Recordset("名称").Value) Then
arr_mc(i) = Adodc1.Recordset("名称").Value
End If
If Not IsNull(Adodc1.Recordset("规格").Value) Then
arr_gg(i) = Adodc1.Recordset("规格").Value
End If
If Not IsNull(Adodc1.Recordset("单位").Value) Then
arr_dw(i) = Adodc1.Recordset("单位").Value
End If
If Not IsNull(Adodc1.Recordset("数量").Value) Then
arr_sl(i) = Adodc1.Recordset("数量").Value
End If
If Not IsNull(Adodc1.Recordset("单价").Value) Then
arr_dj(i) = Adodc1.Recordset("单价").Value
End If
If Not IsNull(Adodc1.Recordset("金额").Value) Then
arr_je(i) = Adodc1.Recordset("金额").Value
End If
If Not IsNull(Adodc1.Recordset("备注").Value) Then
arr_bz(i) = Adodc1.Recordset("备注").Value
End If
Adodc1.Recordset.MoveNext
Next i
ActiveReport1.bh11.Caption = arr_bh(0)
ActiveReport1.bh12.Caption = arr_bh(1)
ActiveReport1.bh13.Caption = arr_bh(2)
ActiveReport1.bh14.Caption = arr_bh(3)
ActiveReport1.bh15.Caption = arr_bh(4)
ActiveReport1.mc11.Caption = arr_mc(0)
ActiveReport1.mc12.Caption = arr_mc(1)
ActiveReport1.mc13.Caption = arr_mc(2)
ActiveReport1.mc14.Caption = arr_mc(3)
ActiveReport1.mc15.Caption = arr_mc(4)
ActiveReport1.gg11.Caption = arr_gg(0)
ActiveReport1.gg12.Caption = arr_gg(1)
ActiveReport1.gg13.Caption = arr_gg(2)
ActiveReport1.gg14.Caption = arr_gg(3)
ActiveReport1.gg15.Caption = arr_gg(4)
ActiveReport1.dw11.Caption = arr_dw(0)
ActiveReport1.dw12.Caption = arr_dw(1)
ActiveReport1.dw13.Caption = arr_dw(2)
ActiveReport1.dw14.Caption = arr_dw(3)
ActiveReport1.dw15.Caption = arr_dw(4)
ActiveReport1.sl11.Caption = arr_sl(0)
ActiveReport1.sl12.Caption = arr_sl(1)
ActiveReport1.sl13.Caption = arr_sl(2)
ActiveReport1.sl14.Caption = arr_sl(3)
ActiveReport1.sl15.Caption = arr_sl(4)
ActiveReport1.dj11.Caption = arr_dj(0)
ActiveReport1.dj12.Caption = arr_dj(1)
ActiveReport1.dj13.Caption = arr_dj(2)
ActiveReport1.dj14.Caption = arr_dj(3)
ActiveReport1.dj15.Caption = arr_dj(4)
ActiveReport1.je11.Caption = arr_je(0)
ActiveReport1.je12.Caption = arr_je(1)
ActiveReport1.je13.Caption = arr_je(2)
ActiveReport1.je14.Caption = arr_je(3)
ActiveReport1.je15.Caption = arr_je(4)
ActiveReport1.bz11.Caption = arr_bz(0)
ActiveReport1.bz12.Caption = arr_bz(1)
ActiveReport1.bz13.Caption = arr_bz(2)
ActiveReport1.bz14.Caption = arr_bz(3)
ActiveReport1.bz15.Caption = arr_bz(4)
ActiveReport1.Label5.Caption = Me.Label7.Caption
ActiveReport1.Label6.Caption = Me.Label8.Caption
'********************************************
'统计金额
Dim tem_bl, tem_jieguo As Double
tem_bl = 0
tem_jieguo = 0
For tem_bl = 0 To Adodc1.Recordset.RecordCount - 1
tem_jieguo = tem_jieguo + arr_je(tem_bl)
Next
ActiveReport1.hj1.Caption = "¥:" + CStr(tem_jieguo)
ActiveReport1.Caption = "山东科技大学物品管理系统"
ActiveReport1.Show vbModal
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
If newdan_flag = True Then
MsgBox "当前为新单!"
Exit Sub
End If
'///如果当前的记录个数大于0则提示是否打印后再开新单据
If Adodc1.Recordset.RecordCount > 0 Then
b = MsgBox("需要打印当前验收单吗?", vbYesNo, "提示")
If b = vbYes Then
Call Command3_Click
End If
End If
'////
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo1.Text = CStr(Year(Date))
Dim tem_danju As String
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select max(mid(单据号,5,4)) as tem_danju from wupin where mid(单据号,1,4)='" & Combo1.Text & "'"
Adodc2.Refresh
If Not IsNull(Adodc2.Recordset("tem_danju").Value) Then
s = CStr(Val(Adodc2.Recordset("tem_danju").Value) + 1)
For i = 0 To 3 - Len(s)
t = t + "0"
Next i
s = t + s
Label8.Caption = "(" + Combo1.Text + ")" + "第" + s + "号"
str_biaodan = Combo1.Text + s
Else
Label8.Caption = "(" + Combo1.Text + ")" + "第" + "0001" + "号"
str_biaodan = Combo1.Text + "0001"
End If
'MsgBox str_biaodan
Adodc1.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from wupin where 单据号=" & "'" & str_biaodan & "'"
Adodc1.Refresh
Adodc2.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select sum(金额) as jine from wupin where 单据号=" & "'" & str_biaodan & "'"
Adodc2.Refresh
If Not IsNull(Adodc2.Recordset.Fields("jine").Value) Then
Label6.Caption = "¥:" + CStr(Adodc2.Recordset.Fields("jine").Value)
Else
Label6.Caption = "¥:" + "0.00"
End If
Combo1.Enabled = True '打开combo
newdan_flag = True '新开单据
Command1.Enabled = True
End Sub
Private Sub Command6_Click()
Form9.Show
End Sub
Private Sub Command7_Click()
If Text1.Text = "" Then
a = MsgBox("使用单位不能为空!", vbOKOnly, "提示")
Exit Sub
End If
If Text7.Text = "" Then
a = MsgBox("编号不能为空!", vbOKOnly, "提示")
Exit Sub
End If
If Text8.Text = "" Then
a = MsgBox("名称不能为空!", vbOKOnly, "提示")
Exit Sub
End If
Adodc1.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from wupin where 单据号=" & "'" & str_biaodan & "'"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("使用单位").Value = Text1.Text
If Text2.Text <> "" Then
Adodc1.Recordset.Fields("保管部门").Value = Text2.Text
End If
If Text3.Text <> "" Then
Adodc1.Recordset.Fields("部门主管").Value = Text3.Text
End If
If Text4.Text <> "" Then
Adodc1.Recordset.Fields("验收人").Value = Text4.Text
End If
If Text5.Text <> "" Then
Adodc1.Recordset.Fields("经手人").Value = Text5.Text
End If
If Text6.Text <> "" Then
Adodc1.Recordset.Fields("制单").Value = Text6.Text
End If
Adodc1.Recordset.Fields("编号").Value = Text7.Text
Adodc1.Recordset.Fields("名称").Value = Text8.Text
If Text9.Text <> "" Then
Adodc1.Recordset.Fields("规格").Value = Text9.Text
End If
If Text10.Text <> "" Then
Adodc1.Recordset.Fields("单位").Value = Text10.Text
End If
Adodc1.Recordset.Fields("时间").Value = Date
Adodc1.Recordset.Fields("数量").Value = Val(Text11.Text)
Adodc1.Recordset.Fields("单价").Value = Val(Text12.Text)
Adodc1.Recordset.Fields("金额").Value = Val(Text11.Text) * Val(Text12.Text)
If Text13.Text <> "" Then
Adodc1.Recordset.Fields("备注").Value = Text13.Text
End If
Adodc1.Recordset.Fields("单据号").Value = str_biaodan
Adodc1.Recordset.Update
Adodc1.Recordset.Requery
Dim ado As ADODB.Connection
Set ado = New ADODB.Connection
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim dbstring, sqlstring As String
dbstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath & "wupin.mdb"
ado.Open dbstring
sqlstring = "select sum(金额) as jine from wupin where 单据号=" & "'" & str_biaodan & "'"
Set rs = ado.Execute(sqlstring, 1, 1)
'*********************************************
'左边验收单显示刷新
save_flag = True
'********************************************
'//如果新开单据则刷新左边显示单据栏
If newdan_flag = True Then
Adodc3.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & curpath + "wupin.mdb;Persist Security Info=False"
Adodc3.CommandType = adCmdText
Adodc3.RecordSource = "select distinct(单据号) as 验收单 from wupin order by 单据号 desc"
Adodc3.Refresh
Adodc3.Recordset.Requery
If Adodc3.Recordset.EOF And Adodc3.Recordset.BOF Then
Else
List1.Clear '先将list 控件内容清空
Adodc3.Recordset.MoveFirst
Do Until Adodc3.Recordset.EOF
List1.AddItem Adodc3.Recordset.Fields("验收单").Value
Adodc3.Recordset.MoveNext
Loop
End If
newdan_flag = False
End If
'// 刷左边新单显示栏
If Not IsNull(rs("jine").Value) Then
Label6.Caption = "¥:" + CStr(rs("jine").Value)
Else
Label6.Caption = "¥:" + "0.00"
End If
Command1.Enabled = True
Command7.Enabled = False '保存功能开启
Command8.Enabled = False '返回功能开启
Command2.Enabled = True '删除功能屏蔽
Command3.Enabled = True '打印功能屏蔽
Command5.Enabled = True '入库功能屏蔽
DataGrid1.Enabled = True '打开
List1.Enabled = True
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
End Sub
Private Sub Command8_Click()
Command1.Enabled = True
Command7.Enabled = False '保存功能开启
Command8.Enabled = False '返回功能开启
Command2.Enabled = True '删除功能屏蔽
Command3.Enabled = True '打印功能屏蔽
Command5.Enabled = True '入库功能屏蔽
DataGrid1.Enabled = True '表格功能打开
List1.Enabled = True
If newdan_flag = True Then
Combo1.Enabled = True
End If
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -