?? 復件 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(1012),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
'szWhereOther用于退貨單,szWhereOther1 用于其他,szWhere用于庫存
szWhere=" [vt].[AccountID]=[biStock].[AccountID] AND [biStock].[AccountID]=1"
szWhereOther=" [vt].[AccountID]=[biStock].[AccountID] AND [biStock].[AccountID]=1 AND [vt].[AuditID]>0 "
szWhereOther1=" [vt].[AccountID]=[biStock].[AccountID] AND [biStock].[AccountID]=1 AND [vt].[AuditID]>0 "
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,szscrk,szth,szph,szzx,szjmsph,szjmshr,szjmshc,szkc
dim szSQLqc,szSQLscrk,szSQLth,szSQLph,szSQLzx,szSQLjmsph,szSQLjmshr,szSQLjmshc,szSQLkc
dim szCgqcTj,szCgscrkTj,szCgthTj,szCgphTj,szCgzxTj,szCgjmsphTj,szCgjmshrTj,szCgjmshcTj
dim szZgs,szSQLzgs
dim szZgs1,szSQLzgs1
'入庫單 4 經銷部入庫單 15 期初 18 采購退貨單35 出庫單 14 生產廠出庫單 1 銷售退貨單 37 調撥單7
'4 經銷部入庫單 入庫
'50 退貨單 入庫
'54 加盟商換入 入庫
'55 加盟商換出 出庫
'53 加盟商配貨 出庫
'配貨單 出庫
szCgscrkTj = szCgscrkTj & " AND ( BillType = 4)"
szCgthTj = szCgthTj & " AND (BillType = 50)"
szCgphTj = szCgphTj & " AND (BillType = 43)"
szCgzxTj = szCgzxTj & " AND (BillType = 40)"
szZgs = szZgs & " AND (BillType = 71)"
szCgjmsphTj = szCgjmsphTj & " AND (BillType = 53)"
szCgjmshrTj = szCgjmshrTj & " AND (BillType = 54)"
szCgjmshcTj = szCgjmshcTj & " AND (BillType = 55)"
szSQLscrk = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],SUM([vl].[Quantity]) AS [scrkQu],SUM([vl].[Amount]) AS [scrkAmount],0 AS [thQu],0 AS [thAmount], 0 AS [phQu],0 AS [phAmount], 0 AS [zgsQu],0 AS [zgsQuAmount], 0 AS [zgsQu1],0 AS [zgsQuAmount1],0 AS [zxQu],0 AS [zxAmount],0 AS [jmsphQu],0 AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdInStock] AS [vt],[BdInStockList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ( [vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgscrkTj & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLth = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [scrkQu],0 AS [scrkAmount],SUM([vl].[Quantity]) AS [thQu],SUM([vl].[Amount]) AS [thAmount], 0 AS [phQu],0 AS [phAmount], 0 AS [zgsQu],0 AS [zgsQuAmount], 0 AS [zgsQu1],0 AS [zgsQuAmount1],0 AS [zxQu],0 AS [zxAmount],0 AS [jmsphQu],0 AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdUnStock] AS [vt],[BdUnStockList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgthTj & szWhereOther &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLph = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [scrkQu],0 AS [scrkAmount],0 AS [thQu],0 AS [thAmount], SUM([vl].[Quantity]) AS [phQu],SUM([vl].[Amount]) AS [phAmount], 0 AS [zgsQu],0 AS [zgsQuAmount], 0 AS [zgsQu1],0 AS [zgsQuAmount1],0 AS [zxQu],0 AS [zxAmount],0 AS [jmsphQu],0 AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdMoveOutStock] AS [vt],[BdMoveOutStockList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szCgphTj & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLzgs = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [scrkQu],0 AS [scrkAmount],0 AS [thQu],0 AS [thAmount], 0 AS [phQu],0 AS [phAmount], SUM([vl].[Quantity]) AS [zgsQu],SUM([vl].[Amount]) AS [zgsQuAmount], 0 AS [zgsQu1],0 AS [zgsQuAmount1],0 AS [zxQu],0 AS [zxAmount],0 AS [jmsphQu],0 AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [bdAllMoveStock] AS [vt],[bdAllMoveStockList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szZgs & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLzgs1 = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [scrkQu],0 AS [scrkAmount],0 AS [thQu],0 AS [thAmount], 0 AS [phQu],0 AS [phAmount], 0 AS [zgsQu],0 AS [zgsQuAmount], SUM([vl].[Quantity]) AS [zgsQu1],SUM([vl].[Amount]) AS [zgsQuAmount1],0 AS [zxQu],0 AS [zxAmount],0 AS [jmsphQu],0 AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [bdAllMoveStock] AS [vt],[bdAllMoveStockList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') " & szZgs & szWhereOther &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLzx = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [scrkQu],0 AS [scrkAmount],0 AS [thQu],0 AS [thAmount], 0 AS [phQu],0 AS [phAmount], 0 AS [zgsQu],0 AS [zgsQuAmount], 0 AS [zgsQu1],0 AS [zgsQuAmount1],SUM([vl].[Quantity]) AS [zxQu],SUM([vl].[Amount]) AS [zxAmount],0 AS [jmsphQu],0 AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdDirectSale] AS [vt],[BdDirectSaleList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') AND [vt].[AccountID]=1 " & szCgzxTj & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLjmsph = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [scrkQu],0 AS [scrkAmount],0 AS [thQu],0 AS [thAmount], 0 AS [phQu],0 AS [phAmount], 0 AS [zgsQu],0 AS [zgsQuAmount], 0 AS [zgsQu1],0 AS [zgsQuAmount1],0 AS [zxQu],0 AS [zxAmount],SUM([vl].[Quantity]) AS [jmsphQu],0 AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdLeagueFixGoods] AS [vt],[BdLeagueFixGoodsList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') AND [vt].[AccountID]=1 " & szCgjmsphTj & szWhereOther1 &_
" GROUP BY "& szGroupBy &" [vl].[ProductID]"
szSQLjmshr = "SELECT "& szSelect &" [vl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 AS [scrkQu],0 AS [scrkAmount],0 AS [thQu],0 AS [thAmount], 0 AS [phQu],0 AS [phAmount], 0 AS [zgsQu],0 AS [zgsQuAmount], 0 AS [zgsQu1],0 AS [zgsQuAmount1],0 AS [zxQu],0 AS [zxAmount],0 AS [jmsphQu],SUM([vl].[Quantity]) AS [jmshrQu],0 AS [jmshcQu],0 AS [kcQu],0 AS [kcAmount]" &_
" FROM [BdLeagueInGoods] AS [vt],[BdLeagueInGoodsList] AS [vl] "& szFrom &_
" WHERE [vt].[id]=[vl].[id] AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') AND [vt].[AccountID]=1 " & szCgjmshrTj & szWhereOther1 &_
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -