<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
|
<%Session.CodePage=65001%>
|
<!--#include virtual="/inc/chkadmin.gds"-->
|
<!--#include virtual="/inc/function.gds"-->
|
<%
|
if isDepartment("0505")=0 then
|
Response.Redirect "/"
|
Response.End()
|
end If
|
|
searchTXT=SafeRequest(Request("searchTXT"))
|
|
Set rs = Server.CreateObject("ADODB.Recordset")
|
'默认显示字段
|
If OrdState="" Then OrdState=0
|
If OrdClassList="" Then OrdClassList="0"
|
If OrdClassList="0" Then
|
OrdClassName="未审核"
|
ElseIf OrdClassList="1" Then
|
OrdClassName="已审核"
|
Else
|
OrdClassName="全部"
|
End if
|
|
'各种返回信息
|
SystemMessageType=trim(Request("SystemMessageType"))
|
SMT=trim(Request("SMT"))
|
if SystemMessageType<>"" then
|
if SMT="1" then
|
SystemMessageTXT="请选择需要操作的车辆"
|
elseif SMT="2" then
|
SystemMessageTXT="单据状态错误或重复提交"
|
elseif SMT="3" then
|
SystemMessageTXT="加油记录提交完成!!"
|
elseif SMT="4" then
|
SystemMessageTXT="请选择需要修改的加油记录!!"
|
elseif SMT="5" then
|
SystemMessageTXT="删除完成!!"
|
elseif SMT="6" then
|
SystemMessageTXT="请选择需要删除的加油记录!!"
|
end if
|
end if
|
|
|
If OrdState<>"0" then
|
OrdListName = ServiceOrdStateA(OrdState)&"记录"
|
Else
|
OrdListName = "加油记录"
|
End If
|
|
|
OrdDateType=SafeRequest(Request("OrdDateType"))
|
OrdDateStart=SafeRequest(Request("OrdDateStart"))
|
OrdDateEnd=SafeRequest(Request("OrdDateEnd"))
|
If OrdDateType="" Then
|
OrdDateType=4
|
OrdDateTop=" top 20 "
|
End If
|
If OrdDateType="0" then
|
If OrdDateStart="" And OrdDateEnd="" Then
|
OrdDateStart=Date()
|
OrdDateEnd=Date()&" 00:00"
|
ElseIf OrdDateStart<>"" And OrdDateEnd="" Then
|
OrdDateEnd=OrdDateStart
|
ElseIf OrdDateStart="" And OrdDateEnd<>"" Then
|
OrdDateStart=OrdDateEnd
|
End If
|
If Cdate(OrdDateStart)>Cdate(OrdDateEnd) Then
|
OrdDateStart1=OrdDateStart
|
OrdDateStart=OrdDateEnd
|
OrdDateEnd=OrdDateStart1
|
End if
|
If OrdDateStart=OrdDateEnd Then
|
OrdDateStart=FORMATDATETIME(OrdDateStart,vbShortDate)
|
OrdDateTypeName=OrdDateStart
|
OrdDateTypeName1=OrdDateTypeName
|
OrdDateEnd=FORMATDATETIME(OrdDateEnd,vbShortDate)
|
Else
|
OrdDateTypeName=OrdDateStart&" 至 "&OrdDateEnd
|
OrdDateTypeName1="时间段"
|
End If
|
SqlOrdDateType="between '"&OrdDateStart&"' and '"&OrdDateEnd&" 23:59:59'"
|
|
Else
|
sql="select vID,vtext,vOrder2 from dictionary where vType>=1 and vtitle='OrdDateType' and vID="&OrdDateType
|
rs.open Sql,objConn,1,1
|
If not rs.Eof Then
|
OrdDateTypeName = rs("vtext")
|
OrdDateTypeName1=OrdDateTypeName
|
SqlOrdDateType = rs("vOrder2")
|
Else
|
OrdDateType=4
|
OrdDateTypeName="本月"
|
OrdDateTypeName1=OrdDateTypeName
|
SqlOrdDateType="between DATEADD(mm,DATEDIFF(mm,0,getdate()),0) and dateadd(ms,-3,DATEADD(mm,DATEDIFF(m,0,getdate())+1,0))"
|
End If
|
rs.close()
|
End If
|
'时间段列表
|
sql="select vID,vtext from dictionary where vType>=1 and vtitle='OrdDateType' order by vOrder"
|
rs.open Sql,objConn,1,1
|
do while not rs.Eof
|
OrdDateTypes = OrdDateTypes & rs("vID") &","& rs("vtext") & "|"
|
rs.movenext
|
Loop
|
rs.close()
|
OrdDateTypes = left(OrdDateTypes,len(OrdDateTypes)-1)
|
OrdDateTypesPS = SPLIT(OrdDateTypes,"|")
|
|
|
page_URL="&searchTXT="&searchTXT&""
|
|
TitleTXT=OrdListName
|
response.buffer = true
|
response.addheader "content-disposition","attachment;filename="&TitleTXT&"导出"&DTimeID()&".csv;"
|
response.contenttype = "application/octet-stream"
|
Response.BinaryWrite ChrB(&HEF) & ChrB(&HBB) & ChrB(&HBF)
|
|
acc1=request("page")
|
if acc1=empty then acc1=clng(1)
|
QuantityInt = 20
|
acc2=0
|
acc3=0
|
|
if searchTXT<>"" Then
|
searchSql=" and (CarLicense like '%"&searchTXT&"%' or GasStation like '%"&searchTXT&"%' or GasRemarks like '%"&searchTXT&"%') "
|
else
|
searchSql=""
|
end If
|
|
sql="select *,GasOldMileage=(select top 1 GasMileage from CarGas as b where a.GasCarID=b.GasCarID and a.GasDate>b.GasDate and b.GasState>=0 order by b.GasDate desc) from CarGas as a,CarData where CarID=GasCarID and GasState>=0 and GasDate "&SqlOrdDateType&searchSql&" order by id desc"
|
'Response.Write sql
|
rs.open sql,objConn,1,1
|
if not rs.eof then
|
rs.pagesize=QuantityInt
|
rs.absolutepage=acc1
|
acc2=rs.pagecount
|
acc3=rs.recordcount
|
else
|
SystemMessageType=2
|
SystemMessageTXT="数据库中相关无数据!"
|
end If
|
|
response.write "单据编号,加油日期,车牌,上次加油里程,当前里程,里程差值,加油量,单价,总额,类型,加油站,支付方式,备注,操作人" & vbcrlf
|
i=1
|
do while not rs.Eof
|
CarGasID = rs("id") '加油记录号
|
GasCarID = rs("GasCarID") '车辆ID
|
GasDate = rs("GasDate") '加油时间
|
CarLicense = rs("CarLicense") '车牌
|
GasMileage = rs("GasMileage") '当前里程
|
GasOldMileage = rs("GasOldMileage") '上次加油里程
|
GasVolume = rs("GasVolume") '加油量
|
GasPrice = rs("GasPrice") '单价
|
GasSumPrice = rs("GasSumPrice") '总金额
|
GasType = rs("GasType") '加油类型
|
GasStation = rs("GasStation") '加油站
|
GasPayment = rs("GasPayment") '支付方式
|
GasRemarks = rs("GasRemarks") '备注
|
|
OAID = rs("OAID")
|
OATime = rs("OATime")
|
GasState = rs("GasState")
|
|
GasRemarks = Replace(GasRemarks,CHR(10),"")
|
GasRemarks = Replace(GasRemarks,CHR(13),"<BR>")
|
If GasOldMileage<>"" Then
|
GasOldMileageTXT = GasOldMileage&"公里"
|
Else
|
GasOldMileageTXT = "--"
|
End If
|
If GasMileage<>"" Then
|
GasMileageTXT = GasMileage&"公里"
|
Else
|
GasMileageTXT = "--"
|
End If
|
If GasOldMileage<>"" And GasMileage<>"" Then
|
GasMileageDiffTXT=(GasMileage-GasOldMileage)&"公里"
|
Else
|
GasMileageDiffTXT = "--"
|
End If
|
If GasVolume<>"0" Then
|
GasVolumeTXT = GasVolume&"升"
|
Else
|
GasVolumeTXT = "--"
|
End If
|
If GasPrice<>"0" Then
|
GasPriceTXT = GasPrice&"元"
|
Else
|
GasPriceTXT = "--"
|
End If
|
If GasSumPrice<>"0" Then
|
GasSumPriceTXT = GasSumPrice&"元"
|
Else
|
GasSumPriceTXT = "--"
|
End If
|
i=i+1
|
|
response.write "CG"&Right("000000"&CarGasID,6) & ","
|
response.write FORMATDATETIME(GasDate,vbShortDate) & ","
|
response.write CarLicense & ","
|
response.write GasOldMileageTXT & ","
|
response.write GasMileageTXT & ","
|
response.write GasMileageDiffTXT & ","
|
response.write GasVolumeTXT & ","
|
response.write GasPriceTXT & ","
|
response.write GasSumPriceTXT & ","
|
response.write GasType & ","
|
response.write GasStation & ","
|
response.write GasPayment & ","
|
response.write GasRemarks & ","
|
response.write OAUser(OAID,"UserName") & ","
|
response.write(vbcrlf)
|
rs.movenext
|
loop
|
rs.close()
|
%>
|