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

📄 default.asp

📁 进销存软件源代码
💻 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>
<% 
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 SQLStock(szField,szServerSideName)
	dim i, szStockWhere,szSQL1,RootID,ParentID,ID,rsCheck
	i=0
	szSQL1="SELECT * FROM [biStock] WHERE  ID=" & GetForm(szServerSideName & i)
	rsCheck=Conn.Execute(szSQL1)
	ID=rsCheck("ID")
	RootID=rsCheck("RootID")
	ParentID=rsCheck("ParentID")
	set rsCheck = nothing
	if CStr(RootID) = CStr(ID) Then 
		SQLStock=szField &" IN (SELECT ID FROM [biStock] WHERE RootID="&ID&")"
	else
		SQLStock=szField &" IN (SELECT ID FROM [biStock] WHERE ParentID="&ID&" OR ID="&ID&")"
	end if
end function

dim sc, cc
sc=CLng(GetForm("StockCheck"))
cc=CLng(GetForm("ChildCheck"))

dim siCount, piCount, ciCount
siCount=CLng(GetForm("sDetail_rows"))
piCount=CLng(GetForm("pDetail_rows"))
ciCount=CLng(GetForm("childDetail_rows"))

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)

dim ssSelect, ssGroupBy
dim szSelect, szFrom, szWhere, szGroupBy, szWhereOther

dim szSQL1, szSQL2, szSQL3, szSQL4, szSQL5, ssSQL, szSQL,szSQL6

szWhere=" [res].[AccountID]="& AccountID
szWhereOther=" [res].[AccountID]="& AccountID
if sc=1 or siCount>0 then
	ssSelect=" [nv].[仓库] AS [仓库], "
	ssGroupBy=",  [nv].[仓库]"
	if sc=0 then 
		RptStock2 nothing, szFrom, szWhere, nothing
		'RptMoveStock nothing, nothing, szWhereOther, nothing
		else
		RptStock2 szSelect, szFrom, szWhere, szGroupBy
		'RptMoveStock nothing, nothing, szWhereOther, nothing		
	end if
	if siCount>0 then
		SqlWhereAdd szWhere, SQLStock("[res].[Stock]","sDetail_0_")
		'SqlWhereAdd szWhereOther, SQLStock("[vt].[Organization]","sDetail_0_")
	end if
end if

dim j
if cc=1 or ciCount>0 then
	ssSelect=ssSelect & " [nv].[子公司] AS [子公司], "
	ssGroupBy=ssGroupBy & ", [nv].[子公司]"
	if ciCount>0 then
		szWhere = szWhere & "AND (  [vt].[AccountID]="& AccountID
		szWhereOther = szWhereOther & "AND (  [vt].[AccountID]="& AccountID
		for j = 0 to ciCount-1
			szWhere = szWhere & " OR "
			szWhere = szWhere & "[vt].[AccountID]=" & GetForm("childDetail_0_"& j)
			szWhereOther = szWhereOther & " OR "
			szWhereOther = szWhereOther & "[vt].[AccountID]=" & GetForm("childDetail_0_"& j)
		next
		szWhere = szWhere & " )"
		szWhereOther = szWhereOther & " )"
	end if
	if cc=0 then
		RptChild nothing, szFrom, szWhere, nothing
		RptChild nothing, nothing, szWhereOther, nothing
	else
		RptChild szSelect, szFrom, szWhere, szGroupBy
		RptChild nothing, nothing, szWhereOther, nothing
	end if
end if

if piCount>0 then
	SqlWhereAdd szWhere, SQLWhereOR("[res].[ProductID]","pDetail_0_",piCount)
	SqlWhereAdd szWhereOther, SQLWhereOR("[res].[ProductID]","pDetail_0_",piCount)
end if

if len(szSelect)<>0 then szSelect=szSelect & ", "
if len(szFrom)<>0 then szFrom=", " & szFrom
if len(szWhere)<>0 then szWhere="AND " & szWhere
if len(szWhereOther)<>0 then szWhereOther="AND " & szWhereOther
if len(szGroupBy)<>0 then szGroupBy=szGroupBy & ", "

szSQL6="SELECT "& szSelect &" [bis].[Code] AS [Code], [bis].[Title] AS [PName], [bis].[Nvarchar1] AS [Spec], SUM([res].[Quantity]) AS [FirstIn],SUM([res].[InPrice]*[res].[Quantity]) AS [FirstAmount],0 AS [SUMIn],0 AS [InAmount], 0 AS [SUMOut],0 AS [OutAmount]" &_
	" FROM [resProductStock] AS [res],[biProduct] AS [bis]"& szFrom &_
	" WHERE [bis].[ID]=[res].[ProductID] AND [res].[CreateDate]<='"&GetDateString(datefrom)&"' AND ([res].[UpdateDate]>'"&GetDateString(datefrom)&"' OR [res].[IsDeleted]=0) "& szWhere &_
	" GROUP BY "& szGroupBy &" [bis].[Code], [bis].[Title], [bis].[Nvarchar1]"
	
szSQL1="SELECT "& szSelect &" [bis].[Code] AS [Code], [bis].[Title] AS [PName], [bis].[Nvarchar1] AS [Spec], 0 AS [FirstIn],0 AS [FirstAmount], (-SUM([res].[Quantity])) AS [SUMIn],(-SUM([res].[Quantity]*[res].[InPrice])) AS [InAmount], 0 AS [SUMOut],0 AS [OutAmount]" &_
	" FROM [resProductStock] AS [res], [biProduct] AS [bis]"& szFrom &_
	" WHERE [bis].[ID]=[res].[ProductID] AND [res].[UpdateDate] >='"&GetDateString(datefrom)&"' AND [res].[UpdateDate] <'"&GetDateString(dateto)&"' AND [res].[BillType] <> 38 AND ([res].[Quantity] < 0 OR [BillType]=2)"& szWhere &_
	" GROUP BY "& szGroupBy &" [bis].[Code], [bis].[Title], [bis].[Nvarchar1]"
	
szSQL2="SELECT "& szSelect &" [bis].[Code] AS [Code], [bis].[Title] AS [PName], [bis].[Nvarchar1] AS [Spec], 0 AS [FirstIn],0 AS [FirstAmount], 0 AS [SUMIn],0 AS [InAmount], SUM([res].[Quantity]) AS [SUMOut],SUM([res].[InPrice]*[res].[Quantity]) AS [OutAmount]" &_
	" FROM [resProductStock] AS [res], [biProduct] AS [bis]"& szFrom &_
	" WHERE [bis].[ID]=[res].[ProductID] AND [res].[CreateDate]<='"&GetDateString(dateto)&"' AND ([res].[UpdateDate]>'"&GetDateString(dateto)&"' OR [res].[IsDeleted]=0)"& szWhere &_
	" GROUP BY "& szGroupBy &" [bis].[Code], [bis].[Title], [bis].[Nvarchar1]"
	
'szSQL3="SELECT "& szSelect &" [bis].[Code] AS [Code], [bis].[Title] AS [PName], [bis].[Nvarchar1] AS [Spec], 0 AS [FirstIn],0 AS [FirstAmount], 0 AS [SUMIn],0 AS [InAmount], SUM([vl].[Quantity]) AS [SUMOut],SUM([vl].[Amount]) AS [OutAmount]" &_
'	" FROM [bdSaleVIP] AS [vt], [bdSaleVIPList] AS [vl], [biProduct] AS [bis]"& szFrom &_
'	" WHERE [vt].[ID]=[vl].[ID] AND [bis].[ID]=[vl].[ProductID] AND [vt].[BillType]=29 AND [vt].[IsDeleted]=0 AND [vt].[AuditID]<>0 AND [vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"'"& szWhere &_
'	" GROUP BY "& szGroupBy &" [bis].[Code], [bis].[Title], [bis].[Nvarchar1]"
	
'szSQL4="SELECT "& szSelect &" [bis].[Code] AS [Code], [bis].[Title] AS [PName], [bis].[Nvarchar1] AS [Spec], 0 AS [FirstIn],0 AS [FirstAmount], SUM([vl].[Quantity]) AS [SUMIn],SUM([vl].[TaxAmount]) AS [InAmount], 0 AS [SUMOut],0 AS [OutAmount]" &_
'	" FROM [BillDocument] AS [vt], [BillDocumentList] AS [vl], [biProduct] AS [bis]"& szFrom &_
'	" WHERE [vt].[ID]=[vl].[ID] AND [bis].[ID]=[vl].[ProductID] AND [vt].[BillType]=7 AND [vt].[IsDeleted]=0 AND [vt].[AuditID]<>0 AND [vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"'"& szWhere &_
'	" GROUP BY "& szGroupBy &" [bis].[Code], [bis].[Title], [bis].[Nvarchar1]"

'szSQL5="SELECT "& szSelect &" [bis].[Code] AS [Code], [bis].[Title] AS [PName], [bis].[Nvarchar1] AS [Spec], 0 AS [FirstIn],0 AS [FirstAmount], 0 AS [SUMIn],0 AS [InAmount], SUM([vl].[Quantity]) AS [SUMOut],SUM([vl].[Amount]) AS [OutAmount]" &_
'	" FROM [BillDocument] AS [vt], [BillDocumentList] AS [vl], [biProduct] AS [bis]"& szFrom &_
'	" WHERE [vt].[ID]=[vl].[ID] AND [bis].[ID]=[vl].[ProductID] AND [vt].[BillType]=7 AND [vt].[IsDeleted]=0 AND [vt].[AuditID]<>0 AND [vt].[UpdateDate]>='"& DateFrom &"' AND [vt].[UpdateDate]<'"& DateTo &"'"& szWhereOther &_
'	" GROUP BY "& szGroupBy &" [bis].[Code], [bis].[Title], [bis].[Nvarchar1]"

'if sc=1 or siCount>0 then
'	szSQL="( "& szSQL6 &" UNION "& szSQL1 &" UNION "& szSQL2 &" UNION "& szSQL3 &" UNION "& szSQL4 &" UNION "& szSQL5 &" )"
'else
	szSQL="( "& szSQL6 &" UNION "& szSQL1 &" UNION "& szSQL2 &" )"
'end if
	
ssSQL="SELECT "& ssSelect &" [nv].[Code] AS [产品编码], [nv].[PName] AS [产品名称], [nv].[Spec] AS [规格], SUM([nv].[FirstIn]) AS [期初库存],SUM([nv].[FirstAmount]) AS [期初金额], SUM([nv].[SUMOut])+SUM([nv].[SUMIn])-SUM([nv].[FirstIn]) AS [入库数量],SUM([nv].[OutAmount])+SUM([nv].[InAmount])-SUM([nv].[FirstAmount]) AS [入库金额], SUM([nv].[SUMIn]) AS [出库数量],SUM([nv].[InAmount]) As [出库金额],SUM([nv].[SUMOut]) AS [库存数量], SUM([nv].[OutAmount]) AS [金额]" &_
	" FROM "& szSQL &" AS [nv]" &_
	" GROUP BY [nv].[Code], [nv].[PName], [nv].[Spec] "& ssGroupBy


eboReg 1, "gridCols", "iCols", "", "cbLocalVariable"
eboReg 2, "gridTilte_", "szTitle", "", "cbLocalVariable"

dim iCols, szTitle, szValue

dim i,rs
Response.Write "<script>" & VBCrLf
Set rs = Server.CreateObject("ADODB.RecordSet")rs.open ssSQL,Conn,1,1
IData2d 0,1iCols=rs.Fields.Count
eboGet 1, nothing, nothingIData2d 1,2for i=0 to rs.Fields.Count-1
	szTitle=rs.Fields.Item(i).Name	eboGet 2, nothing, nothing
next
rawGet rs
Set rs = Nothing
Response.Write "</script>" & VBCrLf
%>
<LINK REL=stylesheet HREF="/Client/All.css" TYPE="text/css"><script src="/Client/ebComm.js"></script><BODY>
<tr><td><div id=sTitle align=center><font size=5><b><u>进 销 存 汇 总 表</u></b></font></div></td></tr>
<tr><td><div id=sTime>查询时间:<%if len(datefrom)=0 then Response.Write "系统启用" else Response.Write FormatDateTime(datefrom,1)%>—<%=FormatDateTime(DateAdd("d",-1,dateto),1)%></div></td></tr>
<tr><td><div id=SelectArea></div></td></tr>
</Table>
<div>&nbsp;<input type=button value="预览" onClick=displayPrint(sTitle,sTime,16,1) id=button1 name=button1> <input type=button value="打印" onClick=displayPrint(sTitle,sTime,16,0) id=button2 name=button2></div>
</BODY>
<script>
function ecbDetail(eo,szEvent,x,y){
	if (szEvent=='MOUSECLICK'){
	}
}

function getGridWidth(titleText){
	switch(titleText){
		case '子公司':
			return 100;
			break;
		case '产品名称':
			return 160;
			break;
		case '规格':
			return 100;
			break;				
		default:
			return 80;
	}
}

function getGridNumeric(titleText){
	switch(titleText){
		case '期初库存':
			return 1;
			break;
		case '期初金额':
			return;
			break;	
		case '入库数量':
			return 1;
			break;
		case '入库金额':
			return 1;
			break;
		case '出库数量':
			return 1;
			break;
		case '出库金额':
			return 1;
			break;		
		case '库存数量':
			return 1;
			break;
		case '金额':
			return 1;
			break;
		default:
			return 0;
	}
}

function getGridAlign(titleText){
	switch(titleText){
		case '期初库存':
			return 'right';
			break;
		case '期初金额':
			return 'right'
			break;	
		case '入库数量':
			return 'right';
			break;
		case '入库金额':
			return 'right';
			break;
		case '出库数量':
			return 'right';
			break;
		case '出库金额':
			return 'right';
			break;
		case '库存数量':
			return 'right';
			break;
		case '金额':
			return 'right';
			break;
		default:
			return '';
	}
}

function getGridTotal(titleText){
	switch(titleText){
		case '期初库存':
			return 1;
			break;
		case '期初金额':
			return 1;
			break;
		case '入库数量':
			return 1;
			break;
		case '入库金额':
			return 1;
			break;	
		case '出库数量':
			return 1;
			break;
		case '出库金额':
			return 1;
			break;				
		case '库存数量':
			return 1;
			break;
		case '金额':
			return 1;
			break;	
		default:
			return 0;
	}
}

function makeGrid(indata){
	var gridCols=parseInt(indata.item('gridCols'));
	var gDetail = new ZYDGRID(new ZYDGRIDFORIEBUG(),SelectArea,20,gridCols,'100%','',1,testUndefine,IRAWDataEnd(),ecbDetail);
	gDetail.title[0].text='№';
	for (var i=0;i<gridCols;i++){
		gDetail.title[i+1].text=indata.item('gridTilte_'+i);
		gDetail.title[i+1].width=getGridWidth(indata.item('gridTilte_'+i));
		gDetail.title[i+1].isNumeric=getGridNumeric(indata.item('gridTilte_'+i));
		gDetail.title[i+1].formAlign=getGridAlign(indata.item('gridTilte_'+i));
		gDetail.title[i+1].isTotal=getGridTotal(indata.item('gridTilte_'+i));
	}
	gDetail.calcTotal();
	gDetail.refreshAll();
	return gDetail
}

var gDetail=makeGrid(IDataEnd());
</script>
</HTML>

⌨️ 快捷键说明

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