?? frmckd.frm
字號:
End If
End Sub
Private Sub DataGrid1_Error(ByVal DataError As Integer, Response As Integer)
Response = 0
End Sub
Private Sub DataGrid1_OnAddNew()
If YJBM = "服務管理部" And EJBM = "物資組" Then
If pdbh = "" Then Exit Sub
jsbm = Combo1.Text
RQ = DTPicker1.Value
Adodc1.Recordset.Fields("憑單編號") = pdbh
Adodc1.Recordset.Fields("接收部門") = jsbm
Adodc1.Recordset.Fields("出庫日期") = RQ
Adodc1.Recordset.Fields("是否報廢") = 0
Adodc1.Recordset.Fields("是否退庫") = 0
Adodc1.Recordset.Fields("盤虧") = "0"
Adodc1.Recordset.Fields("處理狀態") = "已處理"
Else
'jsbm = Combo1.Text
RQ = DTPicker1.Value
Adodc1.Recordset.Fields("出庫日期") = RQ
'If pdbh2 = "0" Then Exit Sub
Adodc1.Recordset.Fields("憑單編號") = pdbh2
Adodc1.Recordset.Fields("接收部門") = jsbm
Adodc1.Recordset.Fields("處理狀態") = "待處理"
End If
'Adodc1.Recordset.Fields("領用類別") = Combo2.Text
End Sub
Private Sub Exit_Click()
Unload Me
End Sub
Private Sub Form_Load()
StrFLG = 0
If YJBM = "服務管理部" And EJBM = "物資組" Then
Sql = "select * from 出庫憑單表 where 處理狀態='待處理'"
Set rs = ConnWZ.Execute(Sql)
If Not rs.EOF Then
Command3.BackColor = &HFF00& ' RGB(0, 255, 0)
Command3.Enabled = True
End If
Sql = "select * from 商品目錄表"
Set rs = ConnWZ.Execute(Sql)
Do While Not rs.EOF
spmcc = rs("名稱")
sql1 = "select * from 入庫明細表 where 名稱='" & spmcc & "'"
Set RsKCCKCX = ConnWZ.Execute(sql1)
Do While Not RsKCCKCX.EOF
sll = sll + Val(RsKCCKCX("數量"))
RsKCCKCX.MoveNext
Loop
sql1 = "select * from 出庫明細表 where 名稱='" & spmcc & "'"
Set RsKCCKCX = ConnWZ.Execute(sql1)
Do While Not RsKCCKCX.EOF
sll = sll - Val(RsKCCKCX("數量"))
RsKCCKCX.MoveNext
Loop
zdccl = Val(rs("最低存儲"))
zgccl = Val(rs("最高存儲"))
If sll < zdccl Then
Result = MsgBox(Trim(spmcc) & "的數量為" & sll & "." & "該商品短缺!繼續查看嗎?", vbYesNo)
If Result = 7 Then
Exit Do
End If
End If
If sll > zgccl Then
Result = MsgBox(Trim(spmcc) & "的數量為" & sll & "." & "該商品積壓!繼續查看嗎?", vbYesNo)
If Result = 7 Then
Exit Do
End If
End If
rs.MoveNext
sll = 0
Loop
Sql = "select max(憑單編號) from 出庫憑單表"
Set Rsrkpd = ConnWZ.Execute(Sql)
If Rsrkpd.EOF Then Exit Sub
If IsNull(Rsrkpd(0)) = False Then
pdbh2 = Rsrkpd(0) + 1
Else
pdbh2 = 1
End If
pdbh = pdbh2
DTPicker1.Value = Date
Sql = "select * from 部門維護表"
Set rs = ConnWZ.Execute(Sql)
Do While Not rs.EOF
Combo1.AddItem rs("部門名稱")
rs.MoveNext
Loop
sqlyg = "select * from 員工表 where 二級部門='物資組'"
Set rsyg = ConnWZ.Execute(sqlyg)
Do While Not rsyg.EOF
ComboKJ.AddItem rsyg("員工姓名")
ComboBGY.AddItem rsyg("員工姓名")
rsyg.MoveNext
Loop
Else
Sql = "select max(憑單編號) from 出庫憑單表"
Set Rsrkpd = ConnWZ.Execute(Sql)
If Rsrkpd.EOF Then Exit Sub
If IsNull(Rsrkpd(0)) = False Then
pdbh2 = Rsrkpd(0) + 1
Else
pdbh2 = 1
End If
Frame8.Visible = False
DataGrid1.Columns("商品編號").Locked = True
DataGrid1.Columns("物資大類").Locked = True
DataGrid1.Columns("物資子類").Locked = True
DataGrid1.Columns("單位").Locked = True
DataGrid1.Columns("規格型號").Locked = True
DataGrid1.Columns("單價").Locked = True
DataGrid1.Columns("金額").Locked = True
DataGrid1.Columns("備注").Locked = True
ComboKJ.Locked = True
ComboBGY.Locked = True
Command3.Visible = False
DTPicker1.Value = Date
If YJBM = "總經理辦公室" Then
Combo1.Text = "總經理辦公室"
Label1 = "物品領用單"
sqlyg = "select * from 員工表 where 一級部門='總經理辦公室' and 崗位='部門經理'"
Set rsyg = ConnWZ.Execute(sqlyg)
Do While Not rsyg.EOF
ComboZG.AddItem rsyg("員工姓名")
rsyg.MoveNext
Loop
sqlyg = "select * from 員工表 where 一級部門='總經理辦公室'"
Set rsyg = ConnWZ.Execute(sqlyg)
Do While Not rsyg.EOF
JSRR.AddItem rsyg("員工姓名")
rsyg.MoveNext
Loop
End If
If YJBM = "動物部" Then
Combo1.Text = "動物部"
Label1 = "物品領用單"
End If
If YJBM = "通用公司" Then
Combo1.Text = "通用公司"
Label1 = "物品領用單"
End If
If YJBM = "人力資源部" Then
Combo1.Text = "人力資源部"
Label1 = "物品領用單"
sqlyg = "select * from 員工表 where 一級部門='人力資源部' and 崗位='部門經理'"
Set rsyg = ConnWZ.Execute(sqlyg)
Do While Not rsyg.EOF
ComboZG.AddItem rsyg("員工姓名")
rsyg.MoveNext
Loop
sqlyg = "select * from 員工表 where 一級部門='人力資源部'"
Set rsyg = ConnWZ.Execute(sqlyg)
Do While Not rsyg.EOF
JSRR.AddItem rsyg("員工姓名")
rsyg.MoveNext
Loop
End If
If YJBM = "商品部" Then
Combo1.Text = "商品部"
Label1 = "物品領用單"
End If
If YJBM = "水族部" Then
Combo1.Text = "水族部"
Label1 = "物品領用單"
End If
If YJBM = "設備工程部" Then
Combo1.Text = "設備工程部"
Label1 = "物品領用單"
End If
If YJBM = "公關策劃部" Then
Combo1.Text = "公關策劃部"
Label1 = "物品領用單"
End If
If YJBM = "計財部" Then
Combo1.Text = "計財部"
Label1 = "物品領用單"
End If
If YJBM = "服務管理部" And EJBM = "車管組" Then
Combo1.Text = "服務管理部"
Label1 = "物品領用單"
End If
If YJBM = "服務管理部" And EJBM = " 保安組" Then
Combo1.Text = "服務管理部"
Label1 = "物品領用單"
End If
If YJBM = "服務管理部" And EJBM = " 食堂組" Then
Combo1.Text = "服務管理部"
Label1 = "物品領用單"
End If
End If
End Sub
Private Sub List1_Click()
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
pdbh1 = List1.List(i)
Sql = "select * from 出庫憑單表 where 憑單編號=" & pdbh1 & ""
Set rs = ConnWZ.Execute(Sql)
XSBM = rs("接收部門")
End If
Next
End Sub
Private Sub List2_Click()
DataGrid1.Columns(10).Text = List2.Text
List2.Visible = False
End Sub
Private Sub ListView1_ItemCheck(ByVal Item As MSComctlLib.ListItem)
' For i = 1 To ListView1.ListItems.Count
' If ListView1.ListItems(i).Checked = True Then
' For j = i To ListView1.ListItems.Count
' If j = ListView1.ListItems.Count Then Exit Sub
' ListView1.ListItems(j + 1).Checked = False
' Next
' End If
' Next
End Sub
Private Sub pdbh_Change()
DataGrid1.Enabled = True
End Sub
Private Sub pdbh_LostFocus()
On Error Resume Next
'res = StrComp(Str(Val(pdbh)), Str(pdbh))
Str (pdbh)
If Err = 13 Then
MsgBox "憑單編號必須為數字!"
pdbh = ""
DataGrid1.Enabled = False
Else
Sql = "select * from 出庫憑單表"
Set RsCkpd = ConnWZ.Execute(Sql)
Do While Not RsCkpd.EOF
If pdbh = RsCkpd("憑單編號") Then
MsgBox "憑單編號已存在,請確定是否輸入錯誤!"
DataGrid1.Enabled = False
Exit Sub
Else
DataGrid1.Enabled = True
End If
RsCkpd.MoveNext
Loop
RsCkpd.Close
End If
End Sub
'Private Sub List1_Click()
' DataGrid1.Columns(3).Text = List1.Text
' List1.Visible = False
'End Sub
Private Sub Save_Click()
'Do While Not Rsrkpd.EOF
'If pdbh = Rsrkpd("憑單編號") Then
' MsgBox "憑單編號已存在,請確定是否輸入錯誤!"
' Exit Sub
'End If
' Rsrkpd.MoveNext
'Loop
'Rsrkpd.CLOSE
Result = MsgBox("您確實要保存嗎?", vbYesNo)
If Result = 6 Then
If YJBM = "服務管理部" And EJBM = "物資組" Then
If pdbh = "" Then
MsgBox "請您輸入憑單編號!"
Exit Sub
End If
jsbm = Combo1.Text
ZG = ComboZG.Text
BGY = ComboBGY.Text
kj = ComboKJ.Text
JSRR = JSRR.Text
pdbh = Val(pdbh)
RQ = DTPicker1.Value
Adodc1.Recordset.UpdateBatch
If StrFLG = 0 Then
Sql = "insert 出庫憑單表 (憑單編號,會計,保管員,處理狀態,接收部門,出庫日期,主管,經手人) values(" & pdbh & ",'" & ComboKJ & "','" & ComboBGY & "','已處理','" & Combo1 & "','" & DTPicker1 & "','" & ComboZG & "','" & JSRR & "' )"
Set Rsrkpd = ConnWZ.Execute(Sql)
Else
Sql = "update 出庫憑單表 set 會計='" & kj & "',保管員='" & BGY & "',處理狀態='已處理' where 憑單編號=" & pdbh & ""
Set Rsrkpd = ConnWZ.Execute(Sql)
Sql = "update 出庫明細表 set 接收部門='" & Combo1 & "',經手人='" & JSRR & "',處理狀態='已處理',盤虧='0',是否報廢=0,是否退庫=0 where 憑單編號=" & pdbh & ""
Set rs = ConnWZ.Execute(Sql)
End If
Sql = "select * from 出庫明細表 where 憑單編號=" & pdbh & ""
Set rs = ConnWZ.Execute(Sql)
Do While Not rs.EOF
RIQI = DTPicker1.Value
WUZZL = rs("物資子類")
MC = rs("名稱")
BH = rs("商品編號")
SHUL = rs("數量")
DANJ = rs("單價")
JINE = rs("金額")
jsbmm = rs("接收部門")
HJj = 0
sqlmxz = "select * from 物品明細帳 where 收入或支出='收入'"
Set Rsmxz = ConnWZ.Execute(sqlmxz)
Do While Not Rsmxz.EOF
jjee = Rsmxz("金額")
HJj = HJj + Val(jjee)
Rsmxz.MoveNext
Loop
sqlmxz = "select * from 物品明細帳 where 收入或支出='支出'"
Set Rsmxz = ConnWZ.Execute(sqlmxz)
Do While Not Rsmxz.EOF
jjee = Rsmxz("金額")
HJj = HJj - Val(jjee)
Rsmxz.MoveNext
Loop
HJj = HJj - JINE
Sql = "insert 物品明細帳(日期,名稱,商品編號,物資子類,數量,單價,金額,收入或支出,合計,去向) values('" & RIQI & "','" & MC & "','" & BH & "','" & WUZZL & "'," & SHUL & "," & DANJ & "," & JINE & ",'支出'," & HJj & ",'" & jsbmm & "')"
Set Rsrkpd = ConnWZ.Execute(Sql)
rs.MoveNext
Loop
WZGL.Enabled = True
Unload Me
Else
jsbm = Combo1.Text
ZG = ComboZG.Text
BGY = ComboBGY.Text
kj = ComboKJ.Text
JSRR = JSRR.Text
RQ = DTPicker1.Value
Adodc1.Recordset.UpdateBatch
Sql = "insert 出庫憑單表(憑單編號,接收部門,出庫日期,經手人,主管,會計,保管員,處理狀態) values(" & pdbh2 & ",'" & jsbm & "','" & RQ & "','" & JSRR & "','" & ZG & "','" & kj & "','" & BGY & "','待處理')"
Set Rsrkpd = ConnWZ.Execute(Sql)
Sql = "update 出庫明細表 set 經手人='" & JSRR & "' where 憑單編號=" & pdbh2 & ""
Set rs = ConnWZ.Execute(Sql)
If YJBM = "總經理辦公室" Then
XingZhengGL.Enabled = True
End If
If YJBM = "動物部" Then
Combo1.Text = "動物部"
End If
If YJBM = "通用公司" Then
Combo1.Text = "通用公司"
End If
If YJBM = "人力資源部" Then
RSGL.Enabled = True
End If
If YJBM = "商品部" Then
SPGL.Enabled = True
End If
If YJBM = "水族部" Then
SZBGL.Enabled = True
End If
If YJBM = "設備工程部" Then
SBGCGL.Enabled = True
End If
If YJBM = "公關策劃部" Then
SCGL.Enabled = True
End If
If YJBM = "計財部" Then
CWGL.Enabled = True
End If
If YJBM = "服務管理部" And EJBM = "車管組" Then
CLGL.Enabled = True
End If
If YJBM = "服務管理部" And EJBM = " 保安組" Then
BABFrm.Enabled = True
End If
If YJBM = "服務管理部" And EJBM = " 食堂組" Then
STGL.Enabled = True
End If
Unload Me
End If
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -