<!-- #include file="../conn.asp" -->
<!-- #include file="../const.asp" -->
<%
Response.Buffer = True 
Response.ExpiresAbsolute = Now() - 1 
Response.Expires = 0 

call chksunzom()
if instr(quanxs,"m"&mxid&"x")<=0 and nowuserid<>1 then call sunzomqx()

mxid=requestA("mxid")
xxid=requestA("xxid")
m1id=chk0(requestA("m1id"))
m2id=chk0(requestA("m2id"))

x1id=chk0(requestA("x1id"))
cdid=chk0(requestA("cdid"))

if chk0(x1id)>0 then x00id=x1id else  x00id=xxid
if chk0(m1id)>0 then m00id=m1id else  m00id=mxid

sid=chk0(requestA("sid"))
sids=split(""&sid&"|0|0|0|0|0|","|")
sid0=chk0(sids(0)):sid1=chk0(sids(1)):sid2=chk0(sids(2)):sid3=chk0(sids(3)):sid4=chk0(sids(4)):sid5=chk0(sids(5))
if len(sid2)<3 then sid2="h0ui"

chk=requestA("chk")
cid=chk0(requestA("cid"))
gid=chk0(requestA("gid"))


sql="select * from sz_mx where id="&mxid&""  
set rs1 =server.createobject("ADODB.RecordSet")	
rs1.open sql,conn,1,3
if not rs1.eof then
mxname=rs1("mxname"):mxml=rs1("mxml"):mxdat=rs1("mxdat"):xmname=rs1("xmname"):mxdw=rs1("mxdw"):mxms=rs1("mxms"):mxzt=rs1("mxzt"):bdys=chk0(rs1("bdys")):bid=chk0(rs1("bid")):bzd=rs1("bzd"):bbal=rs1("bbal"):mxlx=rs1("mxlx")
if bdys=10 then bdys=3
end if
rs1.close:set rs1=nothing
if bid>0 then 
mxdat0=cdatx("mxdat","SZ_mx","where id="&bid&"")
gxname=cdatx("mxname","SZ_mx","where id="&bid&"")
'if instr(bbal,"bao")>0 then 
'if gid=0 then Response.Write "<script language='javascript'>alert('请选择关联["&gxname&"]，点击["&xmname&"]再提交!');window.location.href='hz.asp?id="&bid&"';</script>":Response.end
'end if
end if
sExport=requestA("export")
If sExport = "excel" Then
	Response.ContentType = "application/vnd.ms-excel"
	Response.AddHeader "Content-Disposition", "attachment; filename="&mxname&".xls"
End If
If sExport = "word" Then
	Response.ContentType = "application/vnd.ms-word"
	Response.AddHeader "Content-Disposition:", "attachment; filename="&mxname&".doc"
End If
If sExport = "csv" Then
	Response.ContentType = "application/csv"
	Response.AddHeader "Content-Disposition:", "attachment; filename="&mxname&".csv"
End If
if cdid=202 then mxname="应收结算单"
if cdid=204 then mxname="应付结算单"
if cdid=160 then mxname="业务汇总跟踪"
if cdid=180 then mxname="船舶预报及在港信息"

%>
<html>
<head>
<title><%=mxname%> -详情</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/sunzom.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../inc/jquery.js"></script>
<script type="text/javascript" src="../xheditor.js"></script>
<meta http-equiv="pragma" content="no-cache">
<META http-equiv="Cache-Control" CONTENT="no-cache, must-revalidate">
<META http-equiv="expires" CONTENT="0">
<style media="print" type="text/css"> .NoPrint{DISPLAY:none}</style>
<script language=javascript>
function doPrint() { 
bdhtml=window.document.body.innerHTML; 
sprnstr="<!--startprint-->"; 
eprnstr="<!--endprint-->"; 
prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); 
window.document.body.innerHTML=prnhtml; 
window.print(); 
window.document.body.innerHTML=bdhtml;
}
function killErrors() {return true;}
window.onerror = killErrors;
</script>

</HEAD>
<BODY>
<div class="bdys<%=bdys%> ddyy">
<!--startprint-->

<h2 align="center"><%=gsname%><%=mxname%></h2><!--class="NoPrint"-->

<%
'Response.Write (""&x00id&"") :Response.end
if bid>0 and mxlx<>1 and bdname<>"" and mxdat0<>"" then
x00id=cdatx("gid",""&mxdat&"","where id="&xxid&"")
'Response.Write ""&bdname&","&mxdat0&",where id="&x00id&""
if chadat(""&bdname&"",""&mxdat0&"","where id="&x00id&"")=1 then
sql="select * from SZ_zd where ChannelID="&bid&" and Instr('"&bzd&"',FieldName)>0 and ShowOnForm=1 order by OrderID desc,id asc"  '  and ShowOnUserForm<>1
set rsb2=conn.execute(sql)
if not rsb2.bof then
Response.Write "<table class=""toptable"" border=""1"" cellPadding=""4"" align=""center""><tr><td>"
do while not rsb2.eof
id2=chk0(rsb2("id"))
bdTitle=rsb2("Title"):bdname=rsb2("FieldName"):zdhz=rsb2("zdhz")
edx=cdatx(""&bdname&"",""&mxdat0&"","where id="&x00id&"")
if Instr(zdhz,"stoh")>0 and IsNumeric(edx) then edx1="("&int2chn(edx)&")"
if Instr(zdhz,"bh1ang")>0 then cla2s="style=""float: left; width:100%"""
if Instr(zdhz,"bh2ang")>0 then cla2s="style=""float: left; width:49%"""
if Instr(zdhz,"bh3ang")>0 then cla2s="style=""float: left; width:33%"""
if Instr(zdhz,"bh4ang")>0 then cla2s="style=""float: left; width:24%"""
if left(edx,8)="/upload/" then edx="<a target=""_blank"" href="""&edx&""" title=""点击查看，右击目标另存为下载"">"&edx&"</a>"
Response.Write "<dl "&cla2s&"><span class=""sunbt"&bdys&""">"&bdTitle&"：</span>"&edx&"</dl>"
cla2s=""
rsb2.movenext
loop

'Response.Write "<div><hr width=""960px"" style=""border-bottom: 1px dashed #000000""></div>"
Response.Write "</td></tr></table>"

end if
rsb2.close:set rsb2=nothing
end if
end if
%>

<%
if cdid=204 and mxid<>40 then 
Response.Write "<div align=""center""><h3>应付费用</h3></div>"
sql="select * from SZ_zd where ChannelID="&mxid&" and ShowOnForm=1  and ShowOnUserForm<>1 order by OrderID desc,id asc"  'and zdbbxs=1 
set rsc2=conn.execute(sql)
if not rsc2.bof then
Response.Write "<table class=""toptable"" border=""1"" cellPadding=""4"" align=""center"">"
do while not rsc2.eof
id2=chk0(rsc2("id"))
bdTitle=rsc2("Title"):bdname=rsc2("FieldName"):zdhz=rsc2("zdhz"):zdfz=rsc2("fuzhi")
'bdmoren=rsc2("DefaultValue"):bdTips=rsc2("Tips"):bdlx=rsc2("FieldType"):bdbjqlx=rsc2("EditorType"):bdscok=rsc2("AllowFileExt"):bdscdx=rsc2("MaxFileSize"):bdOptions=rsc2("Options"):bdShowUnit=rsc2("ShowUnit"):bdUnitOptions=rsc2("UnitOptions"):bdbt=rsc2("MustFillTF"):bdWidth=rsc2("Width"):bdMaxLength=rsc2("MaxLength"):bdHeight=rsc2("Height"):zdkd=chk0(rsc2("zdkd"))
if Instr(zdhz,"bbdyin")<=0 then
edx=cdatx(""&bdname&"",""&mxdat&"","where id="&xxid&"")
if Instr(zdhz,"stoh")>0 and IsNumeric(edx) then edx1="("&int2chn(edx)&")"
if Instr(zdhz,"bh1ang")>0 then cla1s="style=""float: left; width:100%"""
if Instr(zdhz,"bh2ang")>0 then cla1s="style=""float: left; width:49%"""
if Instr(zdhz,"bh3ang")>0 then cla1s="style=""float: left; width:33%"""
if Instr(zdhz,"bh4ang")>0 then cla1s="style=""float: left; width:24%"""
if left(edx,8)="/upload/" then edx="<a target=""_blank"" href="""&edx&""" title=""点击查看，右击目标另存为下载"">"&edx&"</a>"
'Response.Write "<dl "&cla1s&"><span class=""sunbt"&bdys&""">"&bdTitle&"：</span>"&edx&""&edx1&"</dl>"
zom1=zom1&"<td>"&bdTitle&"</td>"
zom3=zom3&"<td>"&chk0(zdfz)&"</td>"
zom2=zom2&"<td>"&edx&""&edx1&"</td>"

if bdTitle="合计" then yfjin=edx
end if
shux="":edx1="":cla1s=""
rsc2.movenext
loop
Response.Write "<tr><td>项目</td>"&zom1&"</tr><tr><td>单价</td>"&zom3&"</tr><tr><td>合计</td>"&zom2&"</tr></table>"

Response.Write "</table>"
end if
rsc2.close:set rsc2=nothing

else
sql="select * from SZ_zd where ChannelID="&mxid&" and ShowOnForm=1 and ShowOnUserForm<>1 order by OrderID desc,id asc"  'and zdbbxs=1 
set rsc2=conn.execute(sql)
if not rsc2.bof then
Response.Write "<table class=""toptable"" border=""1"" cellPadding=""4"" align=""center""><tr><td>"
do while not rsc2.eof
id2=chk0(rsc2("id"))
bdTitle=rsc2("Title"):bdname=rsc2("FieldName"):zdhz=rsc2("zdhz"):bgse=rsc2("bgse")
'bdmoren=rsc2("DefaultValue"):bdTips=rsc2("Tips"):bdlx=rsc2("FieldType"):bdbjqlx=rsc2("EditorType"):bdscok=rsc2("AllowFileExt"):bdscdx=rsc2("MaxFileSize"):bdOptions=rsc2("Options"):bdShowUnit=rsc2("ShowUnit"):bdUnitOptions=rsc2("UnitOptions"):bdbt=rsc2("MustFillTF"):bdWidth=rsc2("Width"):bdMaxLength=rsc2("MaxLength"):bdHeight=rsc2("Height"):zdkd=chk0(rsc2("zdkd"))
if Instr(zdhz,"bbdyin")<=0 then
edx=cdatx(""&bdname&"",""&mxdat&"","where id="&xxid&"")
if Instr(zdhz,"stoh")>0 and IsNumeric(edx) then edx1="("&int2chn(edx)&")"
if Instr(zdhz,"bh1ang")>0 then cla1s="style=""float: left; width:100%"""
if Instr(zdhz,"bh2ang")>0 then cla1s="style=""float: left; width:49%"""
if Instr(zdhz,"bh3ang")>0 then cla1s="style=""float: left; width:33%"""
if Instr(zdhz,"bh4ang")>0 then cla1s="style=""float: left; width:24%"""
if left(edx,8)="/upload/" then edx="<a target=""_blank"" href="""&edx&""" title=""点击查看，右击目标另存为下载"">"&edx&"</a>"
Response.Write "<dl "&cla1s&" "
'if len(bgse)=6 then Response.Write " style=""background-color: #"&bgse&""" "
if instr(zdhz,"lanhang")>0 then Response.Write " style=""float: left; width:100%;background-color: #"&bgse&""" "
Response.Write "><span class=""sunbt"&bdys&""">"&bdTitle&"：</span>"&edx&""&edx1&"</dl>"
if bdTitle="合计" then yfjin=edx
end if
shux="":edx1="":cla1s=""
rsc2.movenext
loop
Response.Write "</td></tr></table>"
end if
rsc2.close:set rsc2=nothing
end if
%>
<%
'if mxid=m2id then
'sqlz1="select * from SZ_mx where id=223 order by mxpx desc,id asc"
'else
if m1id>0 then bida=" or bid="&m1id&" "
sqlz1="select * from SZ_mx where bid="&mxid&" "&bida&" and instr(bbal,'"&sid3&"')>0 order by mxpx desc,id asc"
'sqlz1="select * from SZ_mx where bid="&m00id&" and instr(bbal,'"&sid3&"')>0 order by mxpx desc,id asc"
'end if
set rsz1=conn.execute(sqlz1)

'Response.Write ""&sqlz1&"<br>"  

if not rsz1.bof then
do while not rsz1.eof
'mxidz1=rsz1("id"):mxbiao=rsz1("mxdat")
mxbiao1=rsz1("mxdat")
sql="select * from SZ_zd where ChannelID="&rsz1("id")&" and ShowOnForm=1  and ShowOnUserForm<>1 order by OrderID desc,id asc"
set rsc2=conn.execute(sql)

if not rsc2.bof then
do while not rsc2.eof
zdid3=rsc2("id"):bdTitle=rsc2("Title"):bdname=rsc2("FieldName"):zdhz=rsc2("zdhz")

if instr(zdhz,"pai1xu")>0 then mopx=mopx&""&bdname&" desc,"
if instr(zdhz,"pai2xu")>0 then mopx=mopx&""&bdname&" asc,"

hzbt=hzbt&"<td>"&bdTitle&"</td>"

if instr(zdhz,"ltj")>0  then 
zdtjs=zdtjs&"|"&bdTitle
hzbta=hzbta&"<td align=""center"">"&bdTitle&"</td>"
else
hzbta=hzbta&"<td></td>"
end if


hzhes=hzhes&""&zdhz&"|"
if Instr(zdhz,"sook")>0 then sozd=sozd&""&bdname&"|"
hzsjx=hzsjx&""&bdname&"|"
rsc2.movenext
loop
end if
rsc2.close:set rsc2=nothing
%>

<%
sql="select * from "&mxbiao1&" where gid="&xxid&" "  
'if gid>0 then sql=sql&" and gid="&gid&""
if m2id>0 then sql=sql&" and g1id="&m2id&""
  
'if request.Cookies("sunzom_id")=1 then
'elseif soxs=1 then
'sql=sql&" and Instr('"&nowxs&"',zduser)>0 "
'else
'sql=sql&" and zduser='"&nowuser&"' "
'end if
if nowstartdate<>"" then sql=sql&" and tjsj-#"&nowstartdate&"#>=0"
if nowenddate<>"" then sql=sql&" and tjsj-#"&nowenddate&"#<=0"
  
if nowkeyword<>"" then
soxx1=split(sozd,"|")
for ss=0 to Cntshu(sozd,"|")-1
soxxs=soxxs&" "&soxx1(ss)&" like '%"&nowkeyword&"%' or"
next  
if soxxs<>"" then soxxs1=" and ("&left(soxxs,len(soxxs)-2)&") "
sql=sql&soxxs1
end if 
  
if len(mopx)>1 and (instr(mopx,"asc")>0 or instr(mopx,"desc")>0) then  
sql=sql&" order by "&mopx&" tjsj asc,id desc"  
else
sql=sql&" order by id desc"  
end if 
mopx=""
'Response.Write ""&sql&"<br>"  
  
set rsxiao =server.createobject("ADODB.RecordSet")	
rsxiao.open sql,conn,1,3
if not rsxiao.eof then

%></div>

<div style="width: 100%"><h3 align="center"><%=rsz1("xmname")%></h3></div>

<table align="center" cellpadding="4" class="toptable" border="1">
<tr align="center">    
<%if instr(bbxian,"xsid")>0 then%><td>ID</td><%end if%>
<%=hzbt%>
<%if instr(bbxian,"xssj")>0 then%><td>日期</td><%end if%>
<%if instr(allsx,"bbnocz")>0 then%><%if instr(quanxs,"smxc")>0 then%><%end if%><%end if%>
</tr>
<%
do while not rsxiao.eof
zdid=rsxiao("id")
%>
<tr>
<%if instr(bbxian,"xsid")>0 then%><td align="center"><%=zdid%></td><%end if%>
<%
hzsj1=split(hzsjx,"|")
for hh=0 to Cntshu(hzsjx,"|")-1

zdhz0=cdatx("zdhz","SZ_zd","where ChannelID="&rsz1("id")&" and FieldName='"&hzsj1(hh)&"'")
if instr(zdhz0,"ltj")>0  then 
zdhz1=cdatx("Title","SZ_zd","where ChannelID="&rsz1("id")&" and FieldName='"&hzsj1(hh)&"'")
tjsjc=tjsjc&"[#]"&zdhz1&"|"&CDbl(chk0(rsxiao(""&hzsj1(hh)&"")))&""
end if
'Response.Write ""&zdhz1&""
'if chk0(rsxiao(""&hzsj1(hh)&""))<>"0" then
Response.Write "<td align=""center"">"
if hzsj1(hh)="zdsh" then Response.Write ""&chksh(rsxiao(""&hzsj1(hh))&"")&"" else Response.Write ""&rsxiao(""&hzsj1(hh)&"")&""
Response.Write "</td>"
'end if
next%>
<%if instr(allsx,"bbnocz")>0 then%><%if instr(bbxian,"xssj")>0 then%><td align="center"><%=rsxiao("tjsj")%></td><%end if%>
<%end if%></tr>
<%
'end if
rsxiao.movenext
loop
end if%>

<%
zzdd=split(zdtjs,"|")
for zz=1 to Cntshu(zdtjs,"|")
if zz>1 then hhe0=0
ttss=split(tjsjc,"[#]")
for tt=1 to Cntshu(tjsjc,"[#]")
if zzdd(zz)=split(ttss(tt),"|")(0) then 
hhe0=hhe0+CDbl(split(ttss(tt),"|")(1))
end if
hhe1=hhe0
next
if chk0(hhe1)=0 then hhe1=""
if instr(hzbta,">"&zzdd(zz)&"")>0 then hzbta=replace(hzbta,">"&zzdd(zz)&"",">"&hhe1&"")

'hhee=hhee&""&zzdd(zz)&"：<b>"&FormatNumber(hhe1,2,-2)&"</b>，"
next
if right(hhee,1)="，" then hhee=left(hhee,len(hhee)-1):hhee="["&rsz1("xmname")&"]合计"&hhee
if instr(rsz1("xmname"),"应收")>0 then ysjin=hhe1
if instr(rsz1("xmname"),"实收")>0 then ssjin=hhe1
if instr(rsz1("xmname"),"实付")>0 then sfjin=sfjin+hhe1
%>
<tr><%=hzbta%></tr>
</table>
<%
hzbta="":zdhz0="":zdhz1="":hzsjx="":hzsj1="":zdtjs="":tjsjc="":hzbt="":hhee="":hhe1=0:hhe0=0:mxname1="":mxbiao1="":xxid=requestA("xxid")
rsz1.movenext
loop
end if
rsz1.close:set rsz1=nothing
%>
<%
'if chk0(ysjin)<>0 and  chk0(ssjin)<>0 then
if cdid=202 then
%>
<div style="width: 100%"><h3 align="center">未收金额</h3></div>
<table align="center" cellpadding="4" class="toptable" border="1">
<tr align="center"><td>应收合计</td><td>实收合计</td><td>未收合计</td></tr>
<tr align="center"><td><%=FormatNumber(chk0(ysjin),2,-2)%></td><td><%=FormatNumber(chk0(ssjin),2,-2)%></td><td><b><%=FormatNumber((chk0(ysjin)-chk0(ssjin)),2,-2)%></b></td></tr>
</table>
<hr><span style="float: right">制表人：<%=nowuser%></span><b><%=gszhang%></b>
<%
'Response.Write "<h3>"&FormatNumber(ysjin,2,-2)&"-"&FormatNumber(ssjin,2,-2)&"=未收金额："&FormatNumber((ysjin-ssjin),2,-2)&"</h3>"
end if
%>

<%
'if chk0(yfjin)<>0 and  chk0(sfjin)<>0 then
if cdid=204 then
%>
<div style="width: 100%"><h3 align="center">未付金额</h3></div>
<table align="center" cellpadding="4" class="toptable" border="1">
<tr align="center"><td>应付合计</td><td>实付合计</td><td>未付合计</td></tr>
<tr align="center"><td><%=FormatNumber(chk0(yfjin),2,-2)%></td><td><%=FormatNumber(chk0(sfjin),2,-2)%></td><td><b><%=FormatNumber((chk0(yfjin)-chk0(sfjin)),2,-2)%></b></td></tr>
</table>
<hr><span style="float: right">制表人：<%=nowuser%></span>
<%
'Response.Write "<h3>"&FormatNumber(chk0(yfjin),2,-2)&"-"&FormatNumber(chk0(sfjin),2,-2)&"=未收金额："&FormatNumber((yfjin-sfjin),2,-2)&"</h3>"
end if
%>


<!--endprint--><br><br><p align="center"><%=dayin%>  &nbsp;&nbsp;<a title="数据导出为Excel" href="baoA.asp?mxid=<%=mxid%>&m1id=<%=m1id%>&xxid=<%=xxid%>&sid=<%=sid%>&export=excel"><img src="../images/exportxls.gif" width="16" height="16" border="0" class="NoPrint"></a>
&nbsp;&nbsp;<a  title="数据导出为WORD" href="baoA.asp?mxid=<%=mxid%>&m1id=<%=m1id%>&xxid=<%=xxid%>&sid=<%=sid%>&export=word"><img src="../images/exportdoc.gif" width="16" height="16" border="0" class="NoPrint"></a>
&nbsp;&nbsp;<a  title="数据导出为CSV" href="baoA.asp?mxid=<%=mxid%>&m1id=<%=m1id%>&xxid=<%=xxid%>&sid=<%=sid%>&export=csv"><img src="../images/exportcsv.gif" width="16" height="16" border="0" class="NoPrint"></a></p>
</body>
</html>