⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.asp

📁 进销存软件源代码
💻 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>
<%
Server.ScriptTimeout=100
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
	if TotalCount=0 then
		ExportToVoucher=0
	else
		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 if
end function

function SearchForUnAuditVoucher(SearchDate)
	dim eBD, rs, x, szTableName, szSQL
	
	SearchForUnAuditVoucher=0	Set eBD = Server.CreateObject("eB3KCommon.BillDocument")
	x = eBD.bdGetDetailByType(Conn, 8, rs)	if CStr(x)="0" then err.raise 10000,"AccCheck", eBD.GetLastError()
	szTableName=rs("TableName")
	Set eBD = Nothing
	szSQL="SELECT COUNT(*) AS rc FROM ["&szTableName&"] WHERE AccountID=" & AccountID & " AND IsDeleted=0 AND AuditID=0 AND BillType=8 AND BillDate<'" & GetDateString(SearchDate) & "'"	rs=Conn.Execute(szSQL)	if rs("rc")>0 then		SearchForUnAuditVoucher=1	end if	Set rs = Nothing
end function

function GetSqlVoucherForAccCheck(szType, DateFrom, DateTo)
	dim szSQL
	
	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].[AuditID]<>0 AND [vt].[IsDeleted]=0" & _
	"	AND [vt].[AccountID]="& AccountID & _
	"	AND [bist].[Title]='"&szType&"'"
	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]"
	GetSqlVoucherForAccCheck = szSQL
end function

dim x, eBI, szSQL, rsCheck, szTableName
dim DateFrom, DateTo, CvtTitleMemo, CvtListMemo
dim ZhiChuID, ShouRuID

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 & " AND [IsDeleted]=0"
rsCheck=Conn.Execute(szSQL)
if rsCheck("rc")>0 then
	szSQL="SELECT MAX([Date1]) AS [Date1] FROM [biAccCheck] WHERE [InfoType]="&biType&" AND [AccountID]="&AccountID & " AND [IsDeleted]=0"
	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

IData2d 1,10

dim SubjectID
szSQL="SELECT ID FROM [biSubject] WHERE [Code]=3131"
rsCheck=Conn.Execute(szSQL)
SubjectID=rsCheck("ID")
if len(SubjectID)=0 then err.raise 10000,"AccCheck.Export", "未建立“本年利润”科目!"
set rsCheck=nothing

CvtListMemo=""
CvtTitleMemo=""
szSQL = GetSqlVoucherForAccCheck("收入", DateFrom, DateTo)
ShouRuID = ExportToVoucher(szSQL, SubjectID, CvtTitleMemo, CvtListMemo)

CvtListMemo=""
CvtTitleMemo=""
szSQL = GetSqlVoucherForAccCheck("支出", DateFrom, DateTo)
ZhiChuID = ExportToVoucher(szSQL, SubjectID, CvtTitleMemo, CvtListMemo)

dim JieZhuanID
szSQL="SELECT ID FROM [biSubject] WHERE [Code]='2161'"
rsCheck=Conn.Execute(szSQL)
SubjectID=rsCheck("ID")
CvtListMemo=""
CvtTitleMemo=""
szSQL="SELECT [vl].[ProductID] AS [ID], [bis].[int1] AS [Mark], SUM([vl].[Currency1]-[vl].[Currency2]) AS [Amount], 0 AS [Quantity] " &_
      "From [bdVoucher] AS [vt],[bdVoucherList] AS [vl],[biSubject] AS [bis] " &_
      "Where [vt].[ID]=[vl].[ID] AND [vl].[ProductID]=[bis].[ID] AND [bis].[Code]='3131' AND [vt].[AccountID]=" & AccountID & " AND [vt].[IsDeleted]=0"
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]"
JieZhuanID=ExportToVoucher(szSQL,SubjectID,CvtTitleMemo,CvtListMemo)

eboReg 20,"NowTime","Date1","","cbLocalVariable"
eboReg 20,"ZhiChuID","bigint1","","cbLocalVariable"
eboReg 20,"ShouRuID","bigint2","","cbLocalVariable"
eboReg 20,"JieZhuanID","bigint3","","cbLocalVariable"
eboReg 20,"AccountID","AccountID","","cbLocalVariable"
eboReg 20,"Owner","Owner","","cbLocalVariable"

if SearchForUnAuditVoucher(DateTo)=1 then err.raise 10000,"AccCheck", "有未审核凭证!"

function biSave(biType, biTableName, rsBI)
	eboSet 20, rsBI, nothing
end function

x = eBI.biSave(0, CLng(biType), me)
if CStr(x)="0" then err.raise 10000,"AccCheck.Export", eBI.GetLastError()
set eBI = Nothing
%>
</BODY>
<script>
var data=new Array('<%=x%>');
IClient('data',data);
IClient('end','');
</script>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -