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

📄 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"><script src="/Client/ebComm.js"></script></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><%
dim szSQL,iListWidth,szSelect,szFrom,szWhere,szGroupBy
dim sc,pc,vc,cc,oc,msc,msiCount,childc,childiCount,siCount,piCount,viCount,ciCount,oiCount,s,p,datefrom,dateto,memo,memotext,eboRegiCount,BillType,billcheck,billtext
eboRegiCount=0
BillType=2

dim eBD, rsCheck, x, szTableName
Set eBD = Server.CreateObject("eB3KCommon.BillDocument")
x = eBD.bdGetDetailByType(Conn, CLng(BillType), rsCheck)
if CStr(x)="0" then err.raise 10000,"SaleReport",eBD.GetLastError()
szTableName=rsCheck("TableName")
set eBD = Nothing

sc=CLng(GetForm("stockCheck"))
pc=CLng(GetForm("productCheck"))
cc=CLng(GetForm("customCheck"))
oc=CLng(GetForm("operatorCheck"))
vc=CLng(GetForm("venderCheck"))
childc=CLng(GetForm("childCheck"))
msc=CLng(GetForm("mStockCheck"))
billcheck=Clng(GetForm("BillCheck"))
billtext=cstr(GetForm("SearchBill"))

siCount=CLng(GetForm("sDetail_rows"))
piCount=CLng(GetForm("pDetail_rows"))
ciCount=CLng(GetForm("cDetail_rows"))
oiCount=CLng(GetForm("oDetail_rows"))
viCount=CLng(GetForm("vDetail_rows"))
childiCount=CLng(GetForm("childDetail_rows"))
msiCount=CLng(GetForm("mSDetail_rows"))

datefrom=GetForm("DateFrom")
dateto=GetForm("DateTo")
if len(datefrom)>0 then datefrom = DateSerial(year(datefrom), month(datefrom), day(datefrom))
if len(dateto)=0 then
	dateto=now()
end if
dateto = DateSerial(year(dateto), month(dateto), day(dateto))
dateto = DateAdd("d", 1, dateto)



memo=CLng(GetForm("memoCheck"))
memotext=Cstr(GetForm("SearchMemo"))

dim SQLString
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

szFrom = " FROM ["&szTableName&"] AS [vt], ["&szTableName&"List] AS [vl], [biCorperation]"
szWhere = " WHERE [vt].[BillType]="& SQLInputParam(BillType) &" AND [vt].[ID]=[vl].[ID] AND (([vt].[AccountID]=" & AccountID &" AND [biCorperation].[ID]=" & AccountID &") OR ([vt].[AccountID]=[biCorperation].[ID] AND [biCorperation].[ParentID]="&AccountID&")) AND [vl].[Price]<[vl].[TaxPrice] AND [vt].[IsDeleted]=0"

if billcheck=1 then
    if len(billtext)=0 then 
       RptBill szSelect,szFrom,nothing,szGroupBy
    else
   	   RptBill szSelect,szFrom,szWhere,szGroupBy
   	end if 
end if

if childc=1 or childiCount>0 then
	if childc=0 then
		RptChild nothing, szFrom, szWhere, nothing
	else
		RptChild szSelect, szFrom, szWhere, szGroupBy
	end if
	if childiCount>0 then SqlWhereAdd szWhere, SQLWhereOR("[vt].[AccountID]","childDetail_0_",childiCount)
end if

if sc=1 or siCount>0 then
	if sc=0 then
		RptSaleStock nothing, szFrom, szWhere, nothing
	else
		RptSaleStock szSelect, szFrom, szWhere, szGroupBy
	end if
	if siCount>0 then SqlWhereAdd szWhere, SQLStock("[vl].[Bigint1]","sDetail_0_")
end if

if msc=1 or msiCount>0 then
	if msc=0 then
		if pc=0 then RptSalemStock nothing, szFrom, szWhere, nothing else RptSalemStock2 nothing, szFrom, szWhere, nothing
	else
		if pc=0 then RptSalemStock szSelect, szFrom, szWhere, szGroupBy else RptSalemStock2 szSelect, szFrom, szWhere, szGroupBy
	end if
	if msiCount>0 then SqlWhereAdd szWhere, SQLWhereOR("[biProductClass].[ID]","mSDetail_0_",msiCount)
end if

if cc=1 or ciCount>0 then
	if cc=0 then
		if BillType=29 then
			RptCustom nothing, szFrom, szWhere, nothing
		else
			RptCustom nothing, szFrom, szWhere, nothing
		end if
	else
		if BillType=29 then
			RptCustom szSelect, szFrom, szWhere, szGroupBy
		else 
			RptCustom szSelect, szFrom, szWhere, szGroupBy
		end if
	end if
	if ciCount>0 then SqlWhereAdd szWhere, SQLWhereOR("[vt].[Organization]","cDetail_0_",ciCount)
end if

if oc=1 or oiCount>0 then
	if oc=0 then
		RptOperator nothing, szFrom, szWhere, nothing
	else
		RptOperator szSelect, szFrom, szWhere, szGroupBy
	end if
	if oiCount>0 then SqlWhereAdd szWhere, SQLWhereOR("[vt].[Operator]","oDetail_0_",oiCount)
end if

if vc=1 or viCount>0 then
	if vc=0 then
		RptSaleVender nothing, szFrom, szWhere, nothing
	else
		RptSaleVender szSelect, szFrom, szWhere, szGroupBy
	end if
	if viCount>0 then SqlWhereAdd szWhere, SQLWhereOR("[res].[Vender]","vDetail_0_",viCount)
end if

if pc=1 or piCount>0 then
	if pc=0 then
		RptSale2Product nothing, szFrom, szWhere, nothing
	else
		RptSale2Product szSelect, szFrom, szWhere, szGroupBy
	end if
	if  piCount>0 then SqlWhereAdd szWhere, SQLWhereOR ("[vl].[ProductID]","pDetail_0_",piCount)
end if

SqlSelectAdd szSelect, "SUM([vl].[Quantity]) AS 数量,SUM([vl].[TaxAmount]) AS 原售价金额,SUM([vl].[Price]*[vl].[Quantity]) AS 新售价金额,SUM([vl].[TaxAmount]-[vl].[Price]*[vl].[Quantity]) AS 差价,0 AS 折让率,[vt].[CreateDate] AS 销售时间"
SqlGroupByAdd szGroupBy, "[vt].[CreateDate]"

if isDate(datefrom) then SqlWhereAdd szWhere, "[vt].[UpdateDate] >='"&GetDateString(datefrom)&"'"
if isDate(dateto) then SqlWhereAdd szWhere, "[vt].[UpdateDate] <'"&GetDateString(dateto)&"'"

if memo=1 then
	RptMemo szSelect, szFrom, szWhere, szGroupBy
end if


szSQL="SELECT DISTINCT " & szSelect & szFrom & szWhere
if len(szGroupBy)>0 then szSQL=szSQL & " GROUP BY " & szGroupBy

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 szSQL,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 = NothingResponse.Write "</script>" & VBCrLf
%>
<LINK REL=stylesheet HREF="/Client/All.css" TYPE="text/css"><script src="/Client/ebComm.js"></script><BODY>
<div id=sTitle align=center><font size=5><b><u>让 利 报 表</u></b></font></div>
<div id=sTime>查询时间:<%if len(datefrom)=0 then Response.Write "系统启用" else Response.Write FormatDateTime(datefrom,1)%>—<%=FormatDateTime(DateAdd("d",-1,dateto),1)%></div>
<div id=SelectArea></div>
<div id=PageCtrlArea></div>
<br><div>&nbsp;<input type=button value="预览" onClick=displayPrint(sTitle,sTime,16,1)> <input type=button value="打印" onClick=displayPrint(sTitle,sTime,16,0)></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 70;
			break;
		case '品名':
			return 160;
			break;
		case '规格':
			return 100;
			break;				
		default:
			return 80;
	}
}

function getGridNumeric(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 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;
		case '原售价金额':
			return 'right';
			break;
		case '新售价金额':
			return 'right';
			break;
		case '差价':
			return 'right';
		case '折让率':
			return 'right';
		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;
		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();
	if (gDetail.data.length!=0){
		for (var i=0;i<gDetail.data.length;i++){
			for (var j=0;j<gDetail.data[i].length;j++){
				if (gDetail.title[j+1].text=='折让率'){
					//if (gDetail.title[j-1].text=='单价') gDetail.data[i][j-2]=fixFloat(parseFloat(gDetail.data[i][j])/parseFloat(gDetail.data[i][j+1]),2);
					//gDetail.data[i][j+2]=fixFloat(parseFloat(gDetail.data[i][j])-parseFloat(gDetail.data[i][j-1]));
					gDetail.data[i][j]=fixFloat(100*(parseFloat(gDetail.data[i][j-1])/parseFloat(gDetail.data[i][j-3])),2)+'%';
				}
				if (gDetail.title[j].text=='单位'){
					var strTitle;
					strTile=gDetail.data[i][j-1];
					if(typeof(strTitle)=="undefined")gDetail.data[i][j-1]="";
				
				}
				if (gDetail.title[j].text=='原售价金额')
					gDetail.data[i][j-1]=fixFloat(gDetail.data[i][j-1],2);
				if (gDetail.title[j].text=='新售价金额')
					gDetail.data[i][j-1]=fixFloat(gDetail.data[i][j-1],2);
				if (gDetail.title[j].text=='差价')
					gDetail.data[i][j-1]=fixFloat(gDetail.data[i][j-1],2);
		
			}
		
		}
	}
	gDetail.calcTotal();
	gDetail.refreshAll(1,0);
	return gDetail
}


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

⌨️ 快捷键说明

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