?? default.asp
字號:
<!-- #include virtual="/eB3KTransaction.asp" -->
<!-- #include virtual="/Server/ebo.asp" -->
<!-- #include virtual="/Server/cblib.asp" -->
<!-- #include virtual="/Server/SqlReport.asp" -->
<!-- #include virtual="/Server/rawdata.asp" -->
<!-- #include virtual="/Server/common.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/IServer.js"></script>
<script src="/client/grid.js"></script>
<script src="/client/cbLib.js"></script>
<script src="/client/print.js"></script>
<%
'dim eBP,y
'Set eBP = Server.CreateObject("NaFine.Privilege")
'y=eBP.PrivilegeTest(0,16,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 szSQL,szSelect,szFrom,szWhere,szGroupBy,szTableName
szTableName="resProductStock"
dim sc,pc,cc,childc,siCount,piCount,ciCount,serachdate, sRadio
sc=Clng(GetForm("stockCheck"))
pc=Clng(GetForm("productCheck"))
cc=Clng(GetForm("codeCheck"))
siCount=CLng(GetForm("sDetail_rows"))
piCount=Clng(GetForm("pDetail_rows"))
ciCount=Clng(GetForm("cDetail_rows"))
serachdate=GetForm("Date")
dim searchCode,startNumber,endNumber
searchCode = GetForm("searchCode")
startNumber=cint(GetForm("startNumber"))
endNumber=cint(GetForm("endNumber"))
if IsDate(serachdate) then
serachdate = DateSerial(year(serachdate), month(serachdate), day(serachdate))
serachdate = DateAdd("d", 1, serachdate)
end if
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 RptStock(szSelect, szFrom, szWhere, szGroupBy)
SqlSelectAdd szSelect, "[biStock].[Title] AS 倉庫"
SqlSelectAdd szFrom, "biStock"
SqlWhereAdd szWhere, "[biStock].[ID]=[res].[Stock] and [res].[AccountID]=[biStock].[AccountID]"
SqlGroupByAdd szGroupBy, "[biStock].[Title]"
end function
function RptCode(szSelect, szFrom, szWhere, szGroupBy)
SqlSelectAdd szSelect, "[biGoodsCode].[Title] AS 貨號"
SqlSelectAdd szFrom, "biGoodsCode"
SqlWhereAdd szWhere, "[biGoodsCode].[ID]=[biProduct].[ProductID]"
SqlGroupByAdd szGroupBy, "[biGoodsCode].[Title]"
end function
function RptProduct(szSelect, szFrom, szWhere, szGroupBy)
SqlSelectAdd szSelect, "[biProduct].[Code] AS 編號, [biProduct].[Title] AS 品名"
SqlSelectAdd szFrom, "biProduct"
SqlWhereAdd szWhere, "[biProduct].[ID]=[res].[ProductID]"
SqlGroupByAdd szGroupBy, "[biProduct].[Code], [biProduct].[Title]"
end function
'========================================================
szFrom = "FROM ["&szTableName&"] AS [res]"
szWhere=" WHERE [res].[AccountID]=" & Session("AccountID") ' AND (([biStock].[AccountID]<>1 AND [biStock].[ID]=[biStock].[RootID]) OR [biStock].[AccountID]=1)
if sc=1 or siCount>0 then
if sc=0 then
RptStock nothing, szFrom, szWhere, nothing
else
RptStock szSelect, szFrom, szWhere, szGroupBy
end if
if siCount>0 then
SqlWhereAdd szWhere, SQLWhereOR("[res].[Stock]","sDetail_0_",siCount)
end if
end if
RptProduct nothing, szFrom, szWhere, nothing
if pc=1 or piCount>0 then
if pc=1 then
RptProduct szSelect, nothing, nothing, szGroupBy
end if
if piCount>0 then
SqlWhereAdd szWhere, SQLWhereOR("[res].[ProductID]","pDetail_0_",piCount)
end if
end if
if cc=1 or ciCount>0 then
if cc=0 then
RptCode nothing, szFrom, szWhere, nothing
else
RptCode szSelect, szFrom, szWhere, szGroupBy
if pc=0 then
SqlSelectAdd szSelect,"biProduct.Title as 品名"
SqlGroupByAdd szGroupBy,"biProduct.Title"
end if
end if
if ciCount>0 then
SqlWhereAdd szWhere, SQLWhereOR("[biProduct].[ProductID]","cDetail_0_",ciCount)
end if
end if
dim startWildCard14,endStartCard14
dim startWildCard15,endStartCard15
dim endCount
if searchCode<>"" then
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
szWhere = szWhere & " AND (([biProduct].[Code] Like '" & search14 & "' AND len([biProduct].[Code])=14) or ([biProduct].[Code] like '" & search15 & "' AND len([biProduct].[Code])=15))"
end if
SqlSelectAdd szSelect, "Sum([res].[Quantity]) AS [數量],Sum([res].[Amount]) AS [金額]"
if isDate(serachdate) then
SqlWhereAdd szWhere, " (([res].[CreateDate]<='"& GetDateString(serachdate) &"' AND [res].[UpdateDate]>'"& GetDateString(serachdate) &"') OR ([res].[CreateDate]<='"& GetDateString(serachdate) &"' AND [res].[IsDeleted]=0 ))"
else
SqlWhereAdd szWhere, "[res].[IsDeleted]=0"
end if
szSQL="SELECT DISTINCT " & szSelect & szFrom & szWhere
if len(szGroupBy)>0 then szSQL=szSQL & " GROUP BY " & szGroupBy
eboReg 1, "gridCols", "iCols", "", "cbLocalVariable"
eboReg 1, "gridRows", "iRows", "", "cbLocalVariable"
eboReg 2, "gridTilte_", "szTitle", "", "cbLocalVariable"
dim iCols,iRows,szTitle, szValue
dim i,rs
Response.Write "<script>" & VBCrLf
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.open szSQL,Conn,1,1
IData2d 0,1
iCols=rs.Fields.Count
iRows=rs.RecordCount
defaultPrintRows=GetPrintRows(iRows,defaultPrintRows)
eboGet 1, nothing, nothing
IData2d 1,2
for 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>
<Table>
<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(serachdate)=0 then Response.Write "現在" else Response.Write FormatDateTime(DateAdd("d",-1,serachdate),1)%></div></td></tr>
<tr><td><div id=SelectArea></div></td></tr>
</Table>
<div> <input type=button value="預覽" onClick=displayPrint(sTitle,sTime,<%=defaultPrintRows%>,1)> <input type=button value="打印" onClick=displayPrint(sTitle,sTime,<%=defaultPrintRows%>,0)></div>
</BODY>
<script>
function ecbDetail(eo,szEvent,x,y){
if (szEvent=='MOUSECLICK'){
}
}
function getGridWidth(titleText){
switch(titleText){
case '編號':
return 170;
break;
case '倉庫':
return 70;
break;
case '品名':
return 130;
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;
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;
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;
default:
return 0;
}
}
function makeGrid(indata){
var gridCols=parseInt(indata.item('gridCols'));
var gDetail = new ZYDGRID(new ZYDGRIDFORIEBUG(),SelectArea,40,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].text=='成本'){
gDetail.data[i][j-2]=fixFloat(parseFloat(gDetail.data[i][j])/parseFloat(gDetail.data[i][j+1]),2);
gDetail.data[i][j-1]=fixFloat(parseFloat(gDetail.data[i][j+1])*parseFloat(gDetail.data[i][j-1]));
gDetail.data[i][j+2]=fixFloat(parseFloat(gDetail.data[i][j])-parseFloat(gDetail.data[i][j-1]));
if (parseFloat(gDetail.data[i][j])!=0) gDetail.data[i][j+3]=fixFloat(100*(parseFloat(gDetail.data[i][j+2])/parseFloat(gDetail.data[i][j])),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 + -