📄 default.asp
字号:
<!-- #include virtual="/eB3KTransaction.asp" -->
<!-- #include virtual="/Server/ebo.asp" -->
<!-- #include virtual="/Server/cblib.asp" -->
<!-- #include file="../Common.asp" -->
<!-- #include virtual="/Server/SqlReport.asp" -->
<!-- #include virtual="/Server/ReportBD.asp" -->
<!-- #include virtual="/Server/rawdata.asp" -->
<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><LINK REL=stylesheet HREF="/Client/All.css" TYPE="text/css"><script src="/Client/ebComm.js"></script><title></title></HEAD>
<script src="/client/ebo.js"></script>
<script src="/client/Request.js"></script>
<script src="/client/IClient.js"></script>
<script src="/client/grid.js"></script>
<script src="/client/cblib.js"></script>
<script src="/client/print.js"></script>
<script src="/client/clipboard.js"></script>
<%
dim eBP,y
Set eBP = Server.CreateObject("NaFine.Privilege")
y=eBP.PrivilegeTest(0,Clng(1013),8,me)
if CStr(y)<>"0" then err.raise 10000,"InStock.Open", eBP.GetLastError()
dim defaultPrintRows
defaultPrintRows = 40
function GetPrintRows(iRows,defaultPrintRows)
if iRows > defaultPrintRows then
GetPrintRows = defaultPrintRows
else
GetPrintRows = iRows
end if
end function
dim siCount,sc, piCount,pc, ciCount,cc
siCount=CLng(GetForm("sDetail_rows"))
piCount=CLng(GetForm("pDetail_rows"))
ciCount=CLng(GetForm("cDetail_rows"))
sc=CLng(GetForm("stockCheck"))
pc=CLng(GetForm("productCheck"))
cc=CLng(GetForm("codeCheck"))
dim startNumber,endNumber,searchCode
startNumber=cint(GetForm("startNumber"))
endNumber=cint(GetForm("endNumber"))
searchCode=cstr(GetForm("searchCode"))
dim DateFrom,DateTo
DateFrom=GetForm("DateFrom")
DateTo=GetForm("DateTo")
if IsDate(DateFrom) then
DateFrom=DateSerial(year(datefrom), month(datefrom), day(datefrom))
else
err.Raise 10000, "StockStream", "请输入正确的起始日期!"
end if
if IsDate(DateTo) then
DateTo=DateSerial(year(DateTo), month(DateTo), day(DateTo))
else
DateTo=DateSerial(year(Now()), month(Now()), day(Now()))
end if
DateTo=DateADD("d",1,DateTo)
function SQLWhereOR(szField,szServerSideName,iTotalCount)
dim i, szWhere
szWhere = "("
for i = 0 to iTotalCount-1
if i > 0 then szWhere = szWhere & " OR "
szWhere = szWhere & szField & "=" & GetForm(szServerSideName & i)
next
szWhere = szWhere & ")"
SQLWhereOR=szWhere
end function
function RptProduct1(szSelect, szFrom, szWhere, szGroupBy)
SqlSelectAdd szSelect, "[biProduct].[Code] AS 产品编码, [biProduct].[Title] AS 产品名称"
SqlFromAdd szFrom, "[biProduct]"
SqlWhereAdd szWhere, "[biProduct].[ID] =[vl].[ProductID] "
SqlGroupByAdd szGroupBy, "[biProduct].[Code], [biProduct].[Title]"
end function
function RptProduct2(szSelect, szFrom, szWhere, szGroupBy)
SqlSelectAdd szSelect, "[biProduct].[Code] AS 产品编码, [biProduct].[Title] AS 产品名称"
SqlFromAdd szFrom, "[biProduct]"
SqlWhereAdd szWhere, "[biProduct].[ID] =[vt].[ProductID] "
SqlGroupByAdd szGroupBy, "[biProduct].[Code], [biProduct].[Title]"
end function
'========================================================
dim ssSelect, ssGroupBy, SzSQL
dim szSelect, szFrom, szWhere, szGroupBy, szWhereOther,szWhereOther1
if Clng(AccountID)=1 then
szWhere=" [vt].[AccountID]=[biStock].[AccountID] AND ([biStock].[AccountID]<>1 AND [biStock].[ID]=[biStock].[RootID])"
szWhereOther=" [vt].[AuditID]>0 AND [vt].[AccountID]=[biStock].[AccountID] AND (([biStock].[AccountID]<>1 AND [biStock].[ID]=[biStock].[RootID]) OR [biStock].[AccountID]=1)"
szWhereOther1=" [vt].[AuditID]>0 AND [vt].[AccountID]=[biStock].[AccountID] AND (([biStock].[AccountID]<>1 AND [biStock].[ID]=[biStock].[RootID]) OR [biStock].[AccountID]=1)"
else
szWhere=" [vt].[AccountID]="&AccountID & " AND [vt].[AccountID]=[biStock].[AccountID] AND ([biStock].[AccountID]<>1 AND [biStock].[ID]=[biStock].[RootID])"
szWhereOther=" [vt].[AuditID]>0 AND [vt].[AccountID]="&AccountID & " AND [vt].[AccountID]=[biStock].[AccountID] AND (([biStock].[AccountID]<>1 AND [biStock].[ID]=[biStock].[RootID]))"
szWhereOther1=" [vt].[AuditID]>0 AND [vt].[AccountID]="&AccountID & " AND [vt].[AccountID]=[biStock].[AccountID] AND (([biStock].[AccountID]<>1 AND [biStock].[ID]=[biStock].[RootID]))"
end if
RptStock nothing, szFrom, szWhere, nothing
RptStock nothing, nothing, szWhereOther1, nothing
RptMoveStock nothing, nothing, szWhereOther, nothing
if sc=1 or siCount>0 then
if sc=1 then
RptStock szSelect, nothing, nothing, szGroupBy
SqlSelectAdd ssSelect,"仓库"
SqlGroupByAdd ssGroupBy,"仓库"
end if
if siCount>0 then
SqlWhereAdd szWhere, SQLWhereOR("[vt].[Stock]","sDetail_0_",siCount)
SqlWhereAdd szWhereOther1, SQLWhereOR("[vt].[Stock]","sDetail_0_",siCount)
SqlWhereAdd szWhereOther, SQLWhereOR("[vt].[Organization]","sDetail_0_",siCount)
end if
end if
RptProduct1 nothing, szFrom, szWhereOther1, nothing
RptProduct1 nothing, nothing, szWhereOther, nothing
RptProduct2 nothing, nothing, szWhere, nothing
if pc=1 or piCount>0 then
if pc=1 then
RptProduct1 szSelect, nothing, nothing, szGroupBy
SqlSelectAdd ssSelect,"产品编码,产品名称"
SqlGroupByAdd ssGroupBy,"产品编码,产品名称"
end if
if piCount>0 then
SqlWhereAdd szWhere, SQLWhereOR("[vt].[ProductID]","pDetail_0_",piCount)
SqlWhereAdd szWhereOther1, SQLWhereOR("[vl].[ProductID]","pDetail_0_",piCount)
SqlWhereAdd szWhereOther, SQLWhereOR("[vl].[ProductID]","pDetail_0_",piCount)
end if
end if
if cc=1 or ciCount>0 then
if cc=0 then
RptGoodsCode nothing, szFrom, szWhere, nothing
RptGoodsCode nothing, nothing, szWhereOther1, nothing
RptGoodsCode nothing, nothing, szWhereOther, nothing
else
RptGoodsCode szSelect, szFrom, szWhere, szGroupBy
RptGoodsCode nothing, nothing, szWhereOther1, nothing
RptGoodsCode nothing, nothing, szWhereOther, nothing
SqlSelectAdd ssSelect,"货号"
SqlGroupByAdd ssGroupBy,"货号"
if pc=0 then
SqlSelectAdd szSelect,"biProduct.Title as 产品名称"
SqlGroupByAdd szGroupBy,"biProduct.Title"
SqlSelectAdd ssSelect,"产品名称"
SqlGroupByAdd ssGroupBy,"产品名称"
end if
end if
if ciCount>0 then
SqlWhereAdd szWhere, SQLWhereOR("[biProduct].[ProductID]","cDetail_0_",ciCount)
SqlWhereAdd szWhereOther1, SQLWhereOR("[biProduct].[ProductID]","cDetail_0_",ciCount)
SqlWhereAdd szWhereOther, SQLWhereOR("[biProduct].[ProductID]","cDetail_0_",ciCount)
end if
end if
'按产品编码搜索
dim startWildCard14,endStartCard14
dim startWildCard15,endStartCard15
dim endCount
if searchCode<>"" then
dim searchstr
While startNumber>1
startWildCard14=startWildCard14+"_"
startWildCard15=startWildCard15+"_"
startNumber=startNumber-1
wend
endCount=14-endNumber
while endCount>0
endStartCard14=endStartCard14+"_"
endCount=endCount-1
wend
endCount=15-endNumber
while endCount>0
endStartCard15=endStartCard15+"_"
endCount=endCount-1
wend
dim search14,search15
search14=startWildCard14 & searchCode & endStartCard14
search15=startWildCard15 & searchCode & endStartCard15
searchstr=" AND (([biProduct].[Code] Like '" & search14 & "' AND len([biProduct].[Code])=14) or ([biProduct].[Code] like '" & search15 & "' AND len([biProduct].[Code])=15))"
szWhere = szWhere & searchstr
szWhereOther1 = szWhereOther1 & searchstr
szWhereOther = szWhereOther & searchstr
end if
if len(szSelect)<>0 then szSelect=szSelect & ", "
if len(szFrom)<>0 then szFrom=", " & szFrom
if len(szGroupBy)<>0 then szGroupBy=szGroupBy & ", "
if len(szWhere)<>0 then szWhere="AND " & szWhere
if len(szWhereOther)<>0 then szWhereOther="AND " & szWhereOther
if len(szWhereOther1)<>0 then szWhereOther1="AND " & szWhereOther1
if len(ssSelect)<>0 then ssSelect=ssSelect & ", "
if len(ssGroupBy)<>0 then ssGroupBy=" Group by "&ssGroupBy
'条件: 采购入库 采购退货 销售入库 销售退货 调拨入库 调拨出库 期初
dim szqc,szph,szth,szdc,szdr,szdrsc,szscth,szzx,szzp,szkc
dim szSQLqc,szSQLph,szSQLth,szSQLdc,szSQLdr,szSQLdrsc,szSQLscth,szSQLzx,szSQLzp,szSQLkc
dim szCgqcTj,szCgphTj,szCgthTj,szCgdcTj,szCgdrTj,szCgdrscTj,szCgscthTj,szCgzxTj,szCgzpTj
dim szPd,szSQLpd
dim szPd1,szSQLpd1
dim szqc1,szSQLqc1
szCgphTj = szCgphTj & " AND (BillType = 45)"
szCgthTj = szCgthTj & " AND (BillType = 49)"
szCgdcTj = szCgdcTj & " AND (BillType = 44)"
szCgdrTj = szCgdrTj & " AND (BillType = 15)"
szCgdrscTj = szCgdrscTj & " AND (BillType = 46)"
szCgscthTj = szCgscthTj & " AND (BillType = 46)"
szCgzxTj = szCgzxTj & " AND (BillType = 40)"
szCgzpTj = szCgzpTj & " AND (BillType = 28)"
szPd = szPd & " AND (BillType = 9)"
szqc1 = szqc1 & " AND (BillType = 18)"
' 期初录入
szSQLqc1 = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],SUM([vl].[Quantity]) AS [FirstAmount],0 AS [phQu],0 AS [phAmount],0 AS [thQu],0 AS [thAmount], 0 AS [dcQu],0 AS [dcAmount],0 AS [drQu],0 AS [drAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [drscQu],0 AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [bdFirstInStock] AS [vt],[bdFirstInStockList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szqc1 & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
'盘点单
szSQLpd = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [phQu],0 AS [phAmount],0 AS [thQu],0 AS [thAmount], 0 AS [dcQu],0 AS [dcAmount],0 AS [drQu],0 AS [drAmount],sum(vl.Quantity) as [pdyQu],sum(vl.Amount) as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [drscQu],0 AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [bdStockCheck] AS [vt],[bdStockCheckList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vl].Quantity>0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szPd & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLpd1 = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [phQu],0 AS [phAmount],0 AS [thQu],0 AS [thAmount], 0 AS [dcQu],0 AS [dcAmount],0 AS [drQu],0 AS [drAmount],0 as [pdyQu],0 as [pdyAmount],sum(-vl.Quantity) AS [pdkQu],sum(vl.Amount) AS [pdkAmount],0 AS [drscQu],0 AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [bdStockCheck] AS [vt],[bdStockCheckList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vl].Quantity<0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szPd & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
'配货单
szSQLph = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],SUM([vl].[Quantity]) AS [phQu],SUM([vl].[Amount]) AS [phAmount],0 AS [thQu],0 AS [thAmount], 0 AS [dcQu],0 AS [dcAmount],0 AS [drQu],0 AS [drAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [drscQu],0 AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdMoveInStock] AS [vt],[BdMoveInStockList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgphTj & szWhereOther &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
'退货单
szSQLth = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [phQu],0 AS [phAmount],SUM([vl].[Quantity]) AS [thQu],SUM([vl].[Amount]) AS [thAmount], 0 AS [dcQu],0 AS [dcAmount],0 AS [drQu],0 AS [drAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [drscQu],0 AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdUnStockJXB] AS [vt],[BdUnStockJXBList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgthTj & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
'调拨调出单
szSQLdc = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [phQu],0 AS [phAmount],0 AS [thQu],0 AS [thAmount], SUM([vl].[Quantity]) AS [dcQu],SUM([vl].[Amount]) AS [dcAmount],0 AS [drQu],0 AS [drAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [drscQu],0 AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdOutStockJXB] AS [vt],[BdOutStockJXBList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgdcTj & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
'调拨入库单
szSQLdr = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [phQu],0 AS [phAmount],0 AS [thQu],0 AS [thAmount], 0 AS [dcQu],0 AS [dcAmount],SUM([vl].[Quantity]) AS [drQu],SUM([vl].[Amount]) AS [drAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [drscQu],0 AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdInStockJXB] AS [vt],[BdInStockJXBList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgdrTj & szWhereOther &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
'调拨单
szSQLdrsc = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [phQu],0 AS [phAmount],0 AS [thQu],0 AS [thAmount], 0 AS [dcQu],0 AS [dcAmount],0 AS [drQu],0 AS [drAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],SUM([vl].[Quantity]) AS [drscQu],SUM([vl].[Amount]) AS [drscAmount],0 AS [scthQu],0 AS [scthAmount],0 AS [zxQu],0 AS [zxAmount],0 AS [zpQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdMoveStockJXB] AS [vt],[BdMoveStockJXBList] AS [vl] "& szFrom &_
" WHERE vt.AuditID<>0 and [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgdrscTj & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -