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

📄 default.asp

📁 进销存软件源代码
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!-- #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,1020,8,me)
if CStr(y)<>"0" then err.raise 10000,"MoveStock.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] =[vtl].[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, szWheredr,szWhereout
'szWhere 用于库存 szWheredr 用于调入 szWhereout 用于销售、调出和退货

szWhere=" [biStock].[ID]<>[biStock].[RootID]"
szWheredr =" [biStock].[ID]<>[biStock].[RootID]"


RptStock nothing, szFrom, szWhere, nothing
RptMoveStock nothing, nothing, szWheredr, nothing
RptStock nothing, nothing, szWhereout, 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 szWheredr, SQLWhereOR("[vt].[Organization]","sDetail_0_",siCount)
		SqlWhereAdd szWhereout, SQLWhereOR("[vt].[Stock]","sDetail_0_",siCount)		
	end if
end if

RptProduct1 nothing, szFrom, szWhereout, nothing
RptProduct1 nothing, nothing, szWheredr, 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 szWheredr, SQLWhereOR("[vtl].[ProductID]","pDetail_0_",piCount)
		SqlWhereAdd szWhereout, SQLWhereOR("[vtl].[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, szWheredr, nothing
		RptGoodsCode nothing, nothing, szWhereout, nothing
	else
		RptGoodsCode szSelect, szFrom, szWhere, szGroupBy
		RptGoodsCode nothing, nothing, szWheredr, nothing
		RptGoodsCode nothing, nothing, szWhereout, 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 szWheredr, SQLWhereOR("[biProduct].[ProductID]","cDetail_0_",ciCount)
		SqlWhereAdd szWhereout,  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
	szWheredr = szWheredr & searchstr
	szWhereout = szWhereout & 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(szWheredr)<>0 then szWheredr="AND " & szWheredr
if len(szWhereout)<>0 then szWhereout="AND " & szWhereout

if len(ssSelect)<>0 then ssSelect=ssSelect & ", "
if len(ssGroupBy)<>0 then ssGroupBy=" Group by "&ssGroupBy 

'条件: 采购入库 采购退货  销售入库 销售退货 调拨入库 调拨出库  期初
dim szqc,szdr,szxs,szth,szkc
dim szSQLqc,szSQLdr,szSQLxs,szSQLth,szSQLkc
dim szCgqcTj,szCgdrTj,szCgxsTj,szCgthTj,szSQLdc
dim szPd,szSQLpd
dim szPd1,szSQLpd1
dim szqc1,szSQLqc1

'入库单 4 经销部入库单 15   期初 18  采购退货单35  出库单 14 生产厂出库单 1 销售退货单 37  调拨单7

szCgqcTj = szCgqcTj & " and (BillType = 18 )"
szCgdrTj = szCgdrTj & " AND [AuditID]>0 AND ([vt].BillType = 46)"
szCgxsTj = szCgxsTj & " AND (BillType = 1)"
szCgthTj = szCgthTj & " AND (BillType = 52)"
szPd = szPd & " AND (BillType = 9)"

'期初录入数量
szSQLqc1 = "SELECT "& szSelect &" [vtl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],SUM([vtl].[Quantity]) as [FirstInQu],0 AS [drQu],0 AS [drAmount],0 AS [dcQu],0 AS [dcAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [xsQu],0 AS [xsAmount],0 AS [thQu],0 AS [thAmount],0 AS [kcQu],0 AS [kcAmount]" &_
	" FROM [bdFirstInStock] AS [vt],[bdFirstInStockList]	AS [vtl]  "& szFrom &_
	" WHERE vt.AuditID<>0 and [vt].[id]=[vtl].[id] AND  ( [vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') "  & szCgqcTj  &  szWhereout &_
	" GROUP BY "& szGroupBy &" [vtl].[ProductID]"
'盘点单
szSQLpd = "SELECT "& szSelect &" [vtl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 as [FirstInQu],0 AS [drQu],0 AS [drAmount],0 AS [dcQu],0 AS [dcAmount],SUM([vtl].[Quantity]) as [pdyQu],SUM([vtl].[Amount]) as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [xsQu],0 AS [xsAmount],0 AS [thQu],0 AS [thAmount],0 AS [kcQu],0 AS [kcAmount]" &_
	" FROM bdStockCheck as vt,bdStockCheckList as vtl "& szFrom &_
	" WHERE vt.AuditID<>0 and vtl.Quantity>0 and vt.id=vtl.id AND  ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') "  & szPd  &  szWhereout &_
	" GROUP BY "& szGroupBy &" [vtl].[ProductID]"
szSQLpd1 = "SELECT "& szSelect &" [vtl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 as [FirstInQu],0 AS [drQu],0 AS [drAmount],0 AS [dcQu],0 AS [dcAmount],0 as [pdyQu],0 as [pdyAmount],SUM(-[vtl].[Quantity]) AS [pdkQu],SUM([vtl].[Amount]) AS [pdkAmount],0 AS [xsQu],0 AS [xsAmount],0 AS [thQu],0 AS [thAmount],0 AS [kcQu],0 AS [kcAmount]" &_
	" FROM bdStockCheck as vt,bdStockCheckList as vtl "& szFrom &_
	" WHERE vt.AuditID<>0 and vtl.Quantity<0 and vt.id=vtl.id AND  ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') "  & szPd  &  szWhereout &_
	" GROUP BY "& szGroupBy &" [vtl].[ProductID]"
'调拨单
szSQLdr = "SELECT "& szSelect &" [vtl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 as [FirstInQu],SUM([vtl].[Quantity]) AS [drQu],SUM([vtl].[Amount]) AS [drAmount],0 AS [dcQu],0 AS [dcAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [xsQu],0 AS [xsAmount],0 AS [thQu],0 AS [thAmount],0 AS [kcQu],0 AS [kcAmount]" &_
	" FROM BdMoveStockJXB as vt,BdMoveStockJXBList as vtl "& szFrom &_
	" WHERE vt.AuditID<>0 and vt.id=vtl.id AND  ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') "  & szCgdrTj  &  szWheredr &_
	" GROUP BY "& szGroupBy &" [vtl].[ProductID]"
	
szSQLdc = "SELECT "& szSelect &" [vtl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 as [FirstInQu],0 AS [drQu],0 AS [drAmount],SUM([vtl].[Quantity]) AS [dcQu],SUM([vtl].[Amount]) AS [dcAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [xsQu],0 AS [xsAmount],0 AS [thQu],0 AS [thAmount],0 AS [kcQu],0 AS [kcAmount]" &_
	" FROM BdMoveStockJXB as vt,BdMoveStockJXBlist as vtl  "& szFrom &_
	" WHERE vt.AuditID<>0 and vt.id=vtl.id AND   ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') "  & szCgdrTj  &  szWhereout &_
	" GROUP BY "& szGroupBy &" [vtl].[ProductID]"
'销售单
szSQLxs = "SELECT "& szSelect &" [vtl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 as [FirstInQu],0 AS [drQu],0 AS [drAmount],0 AS [dcQu],0 AS [dcAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],SUM([vtl].[Quantity]) AS [xsQu],SUM([vtl].[Amount]) AS [xsAmount],0 AS [thQu],0 AS [thAmount],0 AS [kcQu],0 AS [kcAmount]" &_
	" FROM bdOutStock as vt,bdOutStocklist as vtl  "& szFrom &_
	" WHERE vt.AuditID<>0 and vt.id=vtl.id AND  ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') "  & szCgxsTj  &  szWhereout &_
	" GROUP BY "& szGroupBy &" [vtl].[ProductID]"
	
	
'销售退货单
szSQLth = "SELECT "& szSelect &" [vtl].[ProductID] AS [ProductID], 0 AS [FirstIn],0 AS [FirstAmount],0 as [FirstInQu],0 AS [drQu],0 AS [drAmount],0 AS [dcQu],0 AS [dcAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [xsQu],0 AS [xsAmount],SUM([vtl].[Quantity]) AS [thQu],SUM([vtl].[Amount]) AS [thAmount],0 AS [kcQu],0 AS [kcAmount]" &_
	" FROM BdSaleUnTread as vt,BdSaleUnTreadlist as vtl  "& szFrom &_
	" WHERE  vt.AuditID<>0 and vt.id=vtl.id AND ([vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"') "  & szCgthTj  &  szWhereout &_
	" GROUP BY "& szGroupBy &" [vtl].[ProductID]"

'期末数量
szSQLkc =  "SELECT "& szSelect &" [vt].[ProductID] AS [ProductID],0 AS [FirstIn],0 AS [FirstAmount],0 as [FirstInQu],0 AS [drQu],0 AS [drAmount],0 AS [dcQu],0 AS [dcAmount],0 as [pdyQu],0 as [pdyAmount],0 AS [pdkQu],0 AS [pdkAmount],0 AS [xsQu],0 AS [xsAmount],0 AS [thQu],0 AS [thAmount],SUM([vt].[Quantity]) AS [kcQu],SUM([vt].[Amount]) AS [kcAmount] " &_
	" FROM [resProductStock] AS [vt] "& szFrom &_
	" WHERE  vt.AuditID<>0 AND (([vt].[CreateDate]<='"& GetDateString(DateTo) &"' AND [vt].[UpdateDate]>'"& GetDateString(DateTo) &"') OR ([vt].[CreateDate]<='"& GetDateString(DateTo) &"'  and [vt].isdeleted=0))" & szWhere &_

⌨️ 快捷键说明

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