📄 acccheck.asp
字号:
<!-- #include virtual="/eB3KTransaction.asp" -->
<!-- #include virtual="/Server/ebo.asp" -->
<!-- #include virtual="/Server/cblib.asp" -->
<!-- #include file="../Common.asp" -->
<HTML>
<script src="/client/Request.js"></script>
<script src="/client/IClient.js"></script>
<BODY>
<%
sysdefinedGet = EBO_GETTOSERVER
dim TotalCount, iCount, i
iCount = 0
TotalCount = 0
'eboReg
dim NowTime, BillMemo, debitAmount, creditAmount
'eboReg
eboReg 1,"NowTime","BillDate","","cbLocalVariable"
eboReg 1,"BillMemo","BillMemo","","cbLocalVariable"
eboReg 1,"debitAmount","Amount","","cbLocalVariable"
eboReg 1,"AccountID","AccountID","","cbLocalVariable"
eboReg 1,"Owner","Owner","","cbLocalVariable"
eboReg 1,"NULL","NULL","","cbRSBalanceCheck" '平衡检查
eboReg 2,"Detail_0_","BillListMemo","","cbRSListDirect"
eboReg 2,"Detail_1_","ProductID","","cbRSListSubjectCheck"
eboReg 2,"Detail_4_","Quantity","","cbRSListDirect"
eboReg 2,"Detail_5_","Currency3","","cbRSListCurrencyZero" '当前币种借方
eboReg 2,"Detail_6_","Currency4","","cbRSListCurrencyZero" '当前币种贷方
eboReg 2,"Detail_5_","Currency1","","cbRSListDebit" '本币借方并计算汇率
eboReg 2,"Detail_6_","Currency2","","cbRSListCredit" '本币贷方并计算汇率
eboReg 2,"Detail_10_","Int1","","cbRSListDirect" '借贷方
function cbRSBalanceCheck(fun, eboitem, rs, rsList)
if debitAmount<>creditAmount then Err.Raise 10000,"cbFunBalanceCheck","借贷方不平!"
end function
function cbRSListDebit(fun, eboitem, rs, rsList)
dim CurrencyString
cbRSListCurrencyZero fun, eboitem, rs, rsList
debitAmount=debitAmount+rsList(eboitem.FieldName)
end function
function cbRSListCredit(fun, eboitem, rs, rsList)
dim CurrencyString
cbRSListCurrencyZero fun, eboitem, rs, rsList
creditAmount=creditAmount+rsList(eboitem.FieldName)
end function
'*******************************************************
dim ID, Memo, Mark, Debit, Credit, Quantity
eboReg 10,"Detail_0_","Memo","","cbLocalVariable"
eboReg 10,"Detail_1_","ID","","cbLocalVariable"
eboReg 10,"Detail_4_","Quantity","","cbLocalVariable"
eboReg 10,"Detail_5_","Debit","","cbLocalVariable" '本币借方
eboReg 10,"Detail_6_","Credit","","cbLocalVariable" '本币贷方
eboReg 10,"Detail_10_","Mark","","cbLocalVariable" '借贷方
'End
function bdAuditTitle(bdType, szTableName, rsBD)
rsBD("Auditor") = Owner
bdAuditTitle=0
end function
function bdAuditList(bdType, szTableName, rsBD, rsBDList)
bdAuditList=-1
end function
function bdSaveTitle(bdType, bdTableName, rsBD)
eboSet 1, rsBD, nothing
end function
function bdSaveList(bdType, bdTableName, rsBD, rsBDList)
if iCount < TotalCount then
eboSet 2, rsBD, rsBDList
iCount = iCount + 1
bdSaveList = 0
else
bdSaveList = -1
end if
end function
function ExportToVoucher(szSQL, SubjectID, CvtTitleMemo, CvtListMemo)
dim rs, x, eBD, Amount
sysdefinedEBOMEM.RemoveAll
sysdefined2dCount = 0
debitAmount = 0
creditAmount = 0
TotalCount = 0
iCount = 0
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open szSQL, Conn, 1, 1
Do While Not rs.eof
ID=rs("ID")
Mark=rs("Mark")
if Mark=0 then
Debit=0
Credit=rs("Amount")
Mark=1
else
Debit=rs("Amount")
Credit=0
Mark=0
end if
Quantity=0-rs("Quantity")
Memo=CvtListMemo
Amount=Amount+rs("Amount")
eboGet 10, nothing, nothing
TotalCount=TotalCount+1
rs.movenext
Loop
rs.close
Set rs = Nothing
ID=SubjectID
Quantity=0
if Mark=0 then
Debit=0
Credit=Amount
Mark=1
else
Debit=Amount
Credit=0
Mark=0
end if
Memo=CvtListMemo
eboGet 10, nothing, nothing
TotalCount=TotalCount+1
BillMemo = CvtTitleMemo
Set eBD = Server.CreateObject("eB3KCommon.BillDocument")
x = eBD.bdSave(0, 8, me)
if CStr(x)="0" then err.raise 10000,"AccCheck.Export", eBD.GetLastError()
ExportToVoucher=x
x = eBD.bdAudit(x, 8, me)
if CStr(x)="0" then err.raise 10000,"AccCheck.Export", eBD.GetLastError()
set eBD = Nothing
end function
dim x, eBI, biType, szSQL, rsCheck, szTableName
dim DateFrom, DateTo, CvtTitleMemo, CvtListMemo
biType=17
eboReg 20,"NowTime","Date1","","cbLocalVariable"
eboReg 20,"AccountID","AccountID","","cbLocalVariable"
eboReg 20,"Owner","Owner","","cbLocalVariable"
function biSave(biType, biTableName, rsBI)
eboSet 20, rsBI, nothing
end function
if IsDate(Request("CheckDate")) then
NowTime = CDate(Request("CheckDate"))
NowTime = DateSerial(year(NowTime), month(NowTime), day(NowTime))
DateTo = DateAdd("d", 1, NowTime)
else
err.raise 10000,"AccCheck.Export", "时间错误!"
end if
Set eBI = Server.CreateObject("eB3KCommon.BaseInfo")
x = eBI.biGetDetailByType(Conn, CLng(biType), rsCheck)
if CStr(x)="0" then err.raise 10000,"AccCheck.Export", eBI.GetLastError()
szTableName = CStr(rsCheck("TableName"))
szSQL="SELECT COUNT(*) AS rc FROM [biAccCheck] WHERE [InfoType]="&biType&" AND [AccountID]="&AccountID
rsCheck=Conn.Execute(szSQL)
if rsCheck("rc")>0 then
szSQL="SELECT MAX([Date1]) AS [Date1] FROM [biAccCheck] WHERE [InfoType]="&biType&" AND [AccountID]="&AccountID
rsCheck=Conn.Execute(szSQL)
DateFrom=rsCheck("Date1")
DateFrom=DateSerial(year(DateFrom), month(DateFrom), day(DateFrom))
DateFrom=DateAdd("d", 1, DateFrom)
if (DateFrom>NowTime) then err.raise 10000,"AccCheck.Export", "已经结帐!"
else
DateFrom=null
end if
set rsCheck=nothing
x = eBI.biSave(0, CLng(biType), me)
if CStr(x)="0" then err.raise 10000,"AccCheck.Export", eBI.GetLastError()
set eBI = Nothing
IData2d 1,10
CvtListMemo=""
CvtTitleMemo=""
szSQL="SELECT DISTINCT [vl].[ProductID] AS [ID], [bis].[int1] AS [Mark], SUM(POWER(-1,[bis].[int1])*([vl].[Currency1]-[vl].[Currency2])) AS [Amount], SUM(POWER(-1,[vl].[int1])*[vl].[Quantity]) AS [Quantity]" & _
" FROM [bdVoucher] AS [vt], [bdVoucherList] AS [vl], [biSubject] AS [bis], [biSubjectType] AS [bist]" & _
" WHERE [vt].[ID]=[vl].[ID] AND [vl].[ProductID]=[bis].[ID]" & _
" AND [bis].[bigint1]=[bist].[ID]" & _
" AND [vt].[AccountID]="& AccountID & _
" AND [bist].[Title]='收入'"
if IsDate(DateFrom) then szSQL=szSQL&" AND [vt].[BillDate]>='"&GetDateString(DateFrom)&"'"
if IsDate(DateTo) then szSQL=szSQL&" AND [vt].[BillDate]<'"&GetDateString(DateTo)&"'"
szSQL=szSQL&" GROUP BY [vl].[ProductID], [bis].[int1]" & _
" ORDER BY [vl].[ProductID]"
ExportToVoucher szSQL, 499, CvtTitleMemo, CvtListMemo
CvtListMemo=""
CvtTitleMemo=""
szSQL="SELECT DISTINCT [vl].[ProductID] AS [ID], [bis].[int1] AS [Mark], SUM(POWER(-1,[bis].[int1])*([vl].[Currency1]-[vl].[Currency2])) AS [Amount], SUM(POWER(-1,[vl].[int1])*[vl].[Quantity]) AS [Quantity]" & _
" FROM [bdVoucher] AS [vt], [bdVoucherList] AS [vl], [biSubject] AS [bis], [biSubjectType] AS [bist]" & _
" WHERE [vt].[ID]=[vl].[ID] AND [vl].[ProductID]=[bis].[ID]" & _
" AND [bis].[bigint1]=[bist].[ID]" & _
" AND [bist].[Title]='支出'"
if IsDate(DateFrom) then szSQL=szSQL&" AND [vt].[BillDate]>='"&GetDateString(DateFrom)&"'"
if IsDate(DateTo) then szSQL=szSQL&" AND [vt].[BillDate]<'"&GetDateString(DateTo)&"'"
szSQL=szSQL&" GROUP BY [vl].[ProductID], [bis].[int1]" & _
" ORDER BY [vl].[ProductID]"
ExportToVoucher szSQL, 499, CvtTitleMemo, CvtListMemo
%>
</BODY>
<script>
var data=new Array('<%=x%>');
IClient('data',data);
IClient('end','');
</script>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -