|
楼主 |
发表于 2016-11-14 19:53
|
显示全部楼层
Private Sub Command14_Click()
On Error GoTo Err_Command14_Click
Dim stDocName As String
stDocName = ChrW(-28709) & ChrW(20986) & ChrW(23384)
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command14_Click:
Exit Sub
Err_Command14_Click:
MsgBox Err.Description
Resume Exit_Command14_Click
End Sub
Private Sub Command15_Click()
On Error GoTo Err_Command15_Click
Dim stDocName As String
stDocName = ChrW(21333) & ChrW(25454) & ChrW(21495) & ChrW(32) & ChrW(26597) & ChrW(-29726)
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command15_Click:
Exit Sub
Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click
End Sub
Private Sub Command16_Click()
On Error GoTo Err_Command16_Click
Dim stDocName As String
stDocName = ChrW(-28709) & ChrW(20986) & ChrW(23384)
DoCmd.OpenReport stDocName, acPreview
Exit_Command16_Click:
Exit Sub
Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click
End Sub
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = ChrW(21333) & ChrW(25454) & ChrW(21495)
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command17_Click:
Exit Sub
Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click
End Sub
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Dim stDocName As String
stDocName = ChrW(26356) & ChrW(26032) & ChrW(26126) & ChrW(32454)
DoCmd.RunMacro stDocName
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
Dim stDocName As String
stDocName = ChrW(29289) & ChrW(26009) & ChrW(-30616)
DoCmd.RunMacro stDocName
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click
End Sub
Private Sub 每月进出汇总表_Click()
On Error GoTo Err_每月进出汇总表_Click
Dim stDocName As String
stDocName = ChrW(-28709) & ChrW(20986) & ChrW(23384) & ChrW(26597) & ChrW(-29726)
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_每月进出汇总表_Click:
Exit Sub
Err_每月进出汇总表_Click:
MsgBox Err.Description
Resume Exit_每月进出汇总表_Click
End Sub
Private Sub Command22_Click()
On Error GoTo Err_Command22_Click
Dim stDocName As String
stDocName = ChrW(-28709) & ChrW(20986) & ChrW(23384) & ChrW(26597) & ChrW(-29726)
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command22_Click:
Exit Sub
Err_Command22_Click:
MsgBox Err.Description
Resume Exit_Command22_Click
End Sub
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
Dim stDocName As String
stDocName = ChrW(25353) & ChrW(26376) & ChrW(27719) & ChrW(24635) & ChrW(26597) & ChrW(-29726)
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub
Private Sub Command24_Click()
On Error GoTo Err_Command24_Click
Dim stDocName As String
stDocName = ChrW(26356) & ChrW(26032) & ChrW(26126) & ChrW(32454)
DoCmd.RunMacro stDocName
Exit_Command24_Click:
Exit Sub
Err_Command24_Click:
MsgBox Err.Description
Resume Exit_Command24_Click
End Sub
Private Sub Command25_Click()
On Error GoTo Err_Command25_Click
Dim stDocName As String
stDocName = ChrW(25353) & ChrW(26085) & ChrW(27719) & ChrW(24635) & ChrW(-28709) & ChrW(20986) & ChrW(23384)
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command25_Click:
Exit Sub
Err_Command25_Click:
MsgBox Err.Description
Resume Exit_Command25_Click
End Sub
Private Sub Command26_Click()
On Error GoTo Err_Command26_Click
Dim stDocName As String
stDocName = ChrW(26126) & ChrW(32454) & ChrW(-30616)
DoCmd.OpenReport stDocName, acPreview
Exit_Command26_Click:
Exit Sub
Err_Command26_Click:
MsgBox Err.Description
Resume Exit_Command26_Click
End Sub
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim stDocName As String
stDocName = ChrW(26356) & ChrW(26032) & ChrW(26126) & ChrW(32454)
DoCmd.RunMacro stDocName
Exit_Command27_Click:
Exit Sub
Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click
End Sub
Private Sub Command29_Click()
On Error GoTo Err_Command29_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = ChrW(-28709) & ChrW(20986) & ChrW(20179) & ChrW(31383) & ChrW(20307)
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command29_Click:
Exit Sub
Err_Command29_Click:
MsgBox Err.Description
Resume Exit_Command29_Click
End Sub
Private Sub Command30_Click()
On Error GoTo Err_Command30_Click
Dim stDocName As String
stDocName = ChrW(49) & ChrW(20837) & ChrW(24211) & ChrW(21333)
DoCmd.OpenReport stDocName, acPreview
Exit_Command30_Click:
Exit Sub
Err_Command30_Click:
MsgBox Err.Description
Resume Exit_Command30_Click
End Sub
Private Sub Command31_Click()
On Error GoTo Err_Command31_Click
Dim stDocName As String
stDocName = ChrW(50) & ChrW(20986) & ChrW(24211) & ChrW(21333)
DoCmd.OpenReport stDocName, acPreview
Exit_Command31_Click:
Exit Sub
Err_Command31_Click:
MsgBox Err.Description
Resume Exit_Command31_Click
End Sub
Private Sub Command32_Click()
On Error GoTo Err_Command32_Click
Dim stDocName As String
stDocName = ChrW(51) & ChrW(-28709) & ChrW(20986) & ChrW(23384)
DoCmd.OpenReport stDocName, acPreview
Exit_Command32_Click:
Exit Sub
Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click
End Sub
Private Sub Command33_Click()
On Error GoTo Err_Command33_Click
Dim stDocName As String
' stDocName = ChrW(29983) & ChrW(25104) & ChrW(26126) & ChrW(32454) & ChrW(-30616) & ChrW(-248) & ChrW(27714) & ChrW(21161) & ChrW(-30616) & ChrW(-247)
' DoCmd.OpenQuery stDocName, acNormal, acEdit
Dim rss01 As New ADODB.Recordset, rss02 As New ADODB.Recordset
Dim x001(5) As String, x002(5) As Double
x001(0) = "Select 商品 from 明细表 Where 商品 is not null group by 商品 "
rss01.Open x001(0), CurrentProject.Connection, adOpenStatic, adLockReadOnly
If rss01.EOF = False Then
rss01.MoveFirst
Do Until rss01.EOF = True
x001(1) = rss01("商品")
x001(0) = "SELECT 明细表.入库数量, 明细表.入库金额, 明细表.出库数量, 明细表.结余数量, 明细表.结余金额 "
x001(0) = x001(0) & Chr(10) & "FROM 单据号 INNER JOIN 明细表 ON 单据号.单据号 = 明细表.单据号 "
x001(0) = x001(0) & Chr(10) & "WHERE 明细表.商品 = '" & x001(1) & "' "
x001(0) = x001(0) & Chr(10) & "ORDER BY 单据号.日期, IIf(Nz(明细表.入库数量)>0,0,1), 单据号.单据号, 明细表.ID;"
rss02.Open x001(0), CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rss02.EOF = False Then
rss02.MoveFirst
x002(1) = 0 '记录数量
x002(2) = 0
x002(3) = 0
x002(4) = 0
Do Until rss02.EOF = True
If Nz(rss02("入库数量")) <> 0 Then
'表名当前为入库记录,最好的方式,是要有一个字段来标识,当前记录是入库还是出库类的
x002(1) = x002(1) + Nz(rss02("入库数量")) '当前结存量
x002(2) = x002(2) + Round(Nz(rss02("入库金额")), 2) '当前结存金额
rss02("结余数量") = x002(1)
rss02("结余金额") = x002(2)
Else
'此处为出库类的处理
x002(4) = x002(1) - Nz(rss02("出库数量"))
x002(3) = IIf(x002(4) = 0, x002(2), Round(Nz(rss02("出库数量")) * x002(2) / x002(1), 2)) '出库金额
x002(1) = x002(1) - Nz(rss02("出库数量")) '当前结存量
rss02("入库金额") = x002(3)
x002(2) = x002(2) - x002(3)
rss02("结余数量") = x002(1)
rss02("结余金额") = x002(2)
End If
rss02.Update
rss02.MoveNext
Loop
End If
rss02.Close
rss01.MoveNext
Loop
End If
rss01.Close
DoCmd.OpenQuery "出入库明细", acViewNormal
Exit_Command33_Click:
Set rss01 = Nothing
Set rss02 = Nothing
Erase x001
Erase x002
Exit Sub |
|