dim Custom,Operator,IoType,szErrorOut,Zero,check,IoType2,Amount,TaxAmount,FactAmount
Custom = 1
IoType = 8
IoType2 = 5
szErrorOut=""
Zero=0
check=2
eboReg 1,"ID","ParentID","","cbRSDirect"
eboReg 1,"ID","RootID","","cbRSDirect"
eboReg 1,"Zero","IsDeleted","","cbLocalVariable"
eboReg 1,"Stock","Stock","","cbRSDirect"
eboReg 1,"StockOp", "bigint1", "", "cbRSDirect"
eboReg 1,"IoType2","Int1","","cbLocalVariable"
eboReg 1,"Date", "BillDate", "", "cbRSDateCheck"
eboReg 1,"Owner", "Owner", "", "cbLocalVariable"
eboReg 1,"AccountID","AccountID","","cbLocalVariable"
eboReg 1, "Amount", "Amount", "", "cbLocalVariable"
eboReg 1, "TaxAmount", "TaxAmount", "", "cbLocalVariable"
eboReg 1, "FactAmount", "Currency1", "", "cbLocalVariable"
eboReg 2,"DetailIn_0_","ProductID","","cbRSListDirect"
eboReg 2,"DetailIn_6_","Quantity","","cbRSListDirect"
eboReg 2,"DetailIn_7_","TaxPrice","","cbRSListDirect"
eboReg 2,"DetailIn_11_","BillListMemo","","cbRSListDirect"
eboReg 11,"ID","ParentID","","cbRSDirect"
eboReg 11,"ID","RootID","","cbRSDirect"
eboReg 11,"Zero","IsDeleted","","cbLocalVariable"
eboReg 11,"Stock","Stock","","cbRSDirect"
eboReg 11,"StockOp","bigint1","","cbRSDirect"
eboReg 11,"Date", "BillDate", "", "cbRSDateCheck"
eboReg 11,"Owner", "Owner", "", "cbLocalVariable"
eboReg 11,"AccountID","AccountID","","cbLocalVariable"
eboReg 11,"Custom","Organization","","cbLocalVariable"
eboReg 11,"IoType","int1","","cbLocalVariable"
eboReg 11, "Amount", "Amount", "", "cbLocalVariable"
eboReg 11, "TaxAmount", "TaxAmount", "", "cbLocalVariable"
eboReg 11, "FactAmount", "Currency1", "", "cbLocalVariable"
eboReg 12,"DetailOut_0_","ProductID","","cbRSListDirect"
eboReg 12,"DetailOut_6_","Quantity","","cbRSListDirect"
eboReg 12,"DetailOut_7_","TaxPrice","","cbRSListDirect"
'eboReg 12,"Stock","bigint1","","cbRSToListDirect"
eboReg 12,"DetailOut_11_","BillListMemo","","cbRSListDirect"
'End
function cbRSToListDirect(fun, eboitem, rs, rsList) '单据条目-保存字符串
Select Case fun
Case EBO_GET
cbRSListDirect=rsList(eboitem.FieldName)
Case EBO_SET
rsList(eboitem.FieldName)=GetForm(eboitem.ServerSideName)
End Select
end function
dim cTotalAmount, inCount,outCount,iCount,TotalCount
cTotalAmount = 0
inCount = CInt(GetForm("DetailIn_rows"))
outCount= CInt(GetForm("DetailOut_rows"))
iCount = 0
TotalCount=0
'***********************************************************************************
function bdAuditTitle(bdType, szTableName, rsBD)
if billtype=15 or billtype=1 then
rsBD("Cost") = cTotalAmount
rsBD("Auditor") = Owner
bdAuditTitle=0
else
rsBD("Cost") = cTotalAmount
rsBD("Auditor") = Owner
bdAuditTitle=0
end if
end function
function bdAuditList(bdType, szTableName, rsBD, rsBDList)
if billtype=15 then
rsBDList("AuditCost")=rsBDList("TaxPrice")
rsBDList("AuditQuantity")=rsBDList("Quantity")
rsBDList("AuditAmount")=rsBDList("AuditCost")*rsBDList("AuditQuantity")
InStock rsBD("Stock"),rsBD, rsBDList
cTotalAmount=cTotalAmount+rsBDList("Amount")
bdAuditList=0
elseif billtype=1 then
rsBDList("AuditQuantity")=0
rsBDList("AuditAmount")=0
rsBDList("AuditCost")=0
if rsBDList("Quantity")0 then
StockCheckOutStock rsBD("Stock"), rsBD, rsBDList
UniqueIn rsBD, rsBDList
end if
cTotalAmount=cTotalAmount+rsBDList("AuditAmount")
bdAuditList=0
else
cTotalAmount=cTotalAmount+CCur(rsBDList("Amount"))
bdAuditList=0
end if
end function
dim eboGroup
function bdSaveTitle(bdType, bdTableName, rsBD)
IData2d 0,eboGroup
eboSet eboGroup, rsBD, nothing
end function
function bdSaveList(bdType, bdTableName, rsBD, rsBDList)
dim ID,szSQL,rsCheck,szSQL2,szSQL2Count
if iCount < TotalCount then
eboSet eboGroup+1, rsBD, rsBDList
if bdType=1 then
rsBDList("Quantity")=(-1)*rsBDList("Quantity")
ID=rsBDList("ProductID")
szSQL = "SELECT [Currency1] AS TaxInPrice, [Currency2] AS TaxPrice,[Currency7] AS TaxRate FROM [biProduct] WHERE (AccountID=(SELECT RootID FROM [biCorperation] WHERE [ID]=" & AccountID & ") OR AccountID=" & AccountID & ") AND InfoType=2 AND [ID]="&ID&""
rsCheck=Conn.Execute(szSQL)
rsBDList("Currency2")=rsCheck("TaxInPrice")
'rsBDList("TaxPrice")=rsCheck("TaxPrice")
rsBDList("TaxRate")=rsCheck("TaxRate")
rsBDList("Currency1")=rsCheck("TaxInPrice")/(1+rsCheck("TaxRate"))
rsBDList("Amount")=rsBDList("Currency1")*rsBDList("Quantity")
rsBDList("Currency3")=rsCheck("TaxInPrice")*rsBDList("Quantity")
rsBDList("TaxAmount")=rsBDList("TaxPrice")*rsBDList("Quantity")
set rsCheck=nothing
rsBDList("Currency4")=rsBDList("TaxAmount")-rsBDList("Amount")
rsBDList("Amount")=fixFloat(rsBDList("Amount"))
rsBDList("Currency4")=fixFloat(rsBDList("Currency4"))
Amount=Amount+fixFloat(rsBDList("Amount"))
TaxAmount=TaxAmount+fixFloat(rsBDList("TaxPrice"))
FactAmount=FactAmount+fixFloat(rsBDList("Currency4"))
end if
if bdType=15 then
ID=rsBDList("ProductID")
szSQL = "SELECT [Currency1] AS TaxInPrice, [Currency2] AS TaxPrice,[Currency7] AS TaxRate FROM [biProduct] WHERE (AccountID=(SELECT RootID FROM [biCorperation] WHERE [ID]=" & AccountID & ") OR AccountID=" & AccountID & ") AND InfoType=2 AND [ID]="&ID&""
rsCheck=Conn.Execute(szSQL)
rsBDList("Currency2")=rsCheck("TaxInPrice")
'rsBDList("TaxPrice")=rsCheck("TaxPrice")
rsBDList("TaxRate")=rsCheck("TaxRate")
rsBDList("Currency1")=rsCheck("TaxInPrice")/(1+rsCheck("TaxRate"))
rsBDList("Amount")=rsBDList("Currency1")*rsBDList("Quantity")
rsBDList("Currency3")=rsCheck("TaxInPrice")*rsBDList("Quantity")
rsBDList("TaxAmount")=rsBDList("TaxPrice")*rsBDList("Quantity")
set rsCheck=nothing
szSQL2Count="SELECT Count(*) AS rc FROM [resProductStock] WHERE (AccountID=(SELECT RootID FROM [biCorperation] WHERE [ID]=" & AccountID & ") OR AccountID=" & AccountID & ") AND [ProductID]="&ID&""
rsCheck=Conn.Execute(szSQL2Count)
if rsCheck("rc")=0 then err.Raise 10000,"StockCheck",resProductToTitle(rsBDList("ProductID")) &"从未入库,没有供应商!"
set rsCheck=nothing
szSQL2="SELECT TOP 1 [Vender] FROM [resProductStock] WHERE (AccountID=(SELECT RootID FROM [biCorperation] WHERE [ID]=" & AccountID & ") OR AccountID=" & AccountID & ") AND [ProductID]="&ID&" ORDER BY [ID] DESC"
rsCheck=Conn.Execute(szSQL2)
rsBD("Organization")=rsCheck("Vender")
set rsCheck=nothing
rsBDList("Currency4")=rsBDList("TaxAmount")-rsBDList("Amount")
rsBDList("Amount")=fixFloat(rsBDList("Amount"))
rsBDList("Currency4")=fixFloat(rsBDList("Currency4"))
Amount=Amount+fixFloat(rsBDList("Amount"))
TaxAmount=TaxAmount+fixFloat(rsBDList("TaxPrice"))
FactAmount=FactAmount+fixFloat(rsBDList("Currency4"))
end if
iCount = iCount + 1
bdSaveList = 0
else
bdSaveList = -1
end if
end function
function resProductToTitle(ID)
dim rs,szSQL
szSQL="SELECT Title FROM [biProduct] WHERE ID="& ID
rs=Conn.Execute(szSQL)
resProductToTitle=rs("Title")
set rs=nothing
end function
'***********************************************************************************
dim x,bdid,eBD,szSQl,billtype,inID,outID,AuditInID,AuditOutID
bdid=0
x=0
inID=0
outID=0
AuditInID=0
AuditOutID=0
billtype=0
if IsNumeric(GetForm("ID")) then
bdid=GetForm("ID")
Set eBD = Server.CreateObject("eB3KCommon.BillDocument")
x = eBD.bdAudit(bdid, CLng(bdType), me)
if CStr(x)="0" then err.raise 10000,"StockCheck.Audit", eBD.GetLastError()
if inCount>0 then'盘赢
billtype=15
TotalCount=inCount
end if
eboGroup=1
if billtype0 then
IData2d 1,eboGroup+1
inID = eBD.bdSave(0, CLng(billtype), me)
AuditInID=inID
if CStr(inID)="0" then err.raise 10000,"StockCheck.Audit", eBD.GetLastError()
x = eBD.bdAudit(AuditInID, CLng(bdType), me)
if CStr(AuditInID)="0" then err.raise 10000,"StockCheck.Audit", eBD.GetLastError()
end if
billtype=0
iCount=0
if outCount>0 then'盘亏
billtype=1
TotalCount=outCount
end if
eboGroup=11
if billtype0 then
IData2d 1,eboGroup+1
outID = eBD.bdSave(0, CLng(billtype), me)
AuditOutID = outID
if CStr(outID)="0" then err.raise 10000,"StockCheck.Audit", eBD.GetLastError()
x = eBD.bdAudit(AuditOutID, CLng(bdType), me)
if CStr(AuditOutID)="0" then err.raise 10000,"StockCheck.Audit", eBD.GetLastError()
end if
set eBD = Nothing
end if
%>
var data=new Array;
data[0]=;
data[1]=;
data[2]=;
IClient('data',data);
IClient('end','');