<!-- #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"))
chkid=chk0(requestA("chkid"))

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")
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="应付结算单"

%>
<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 m1id>0 then
x00id=cdatx("gid",""&mxdat&"","where id="&xxid&"")
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"
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%"""

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
%>

<%
sql="select * from SZ_zd where ChannelID="&mxid&" and ShowOnForm=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")
'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%"""

Response.Write "<dl "&cla1s&"><span class=""sunbt"&bdys&""">"&bdTitle&"：</span>"&edx&""&edx1&"</dl>"
end if
shux="":edx1="":cla1s=""
rsc2.movenext
loop
Response.Write "</td></tr></table>"
end if
rsc2.close:set rsc2=nothing

'''''''''以上信息基本信息

if chkid>0 then bida=" and id="&chkid&" "
sqlz1="select * from SZ_mx where bid="&mxid&" "&bida&" and instr(bbal,'"&sid3&"')>0 order by mxpx desc,id asc"
set rsz1=conn.execute(sqlz1)
'Response.Write ""&sqlz1&"<br>"  
if not rsz1.bof then
do while not rsz1.eof
mxidz1=rsz1("id")
mxbiao1=rsz1("mxdat")

sql="select * from SZ_zd where ChannelID="&rsz1("id")&" and ShowOnForm=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,"
rsc2.movenext
loop
end if
rsc2.close:set rsc2=nothing

''''''''''''''''''''''''''''''''''''
sql3="select * from SZ_zd where ChannelID=226 and ShowOnForm=1 order by OrderID desc,id asc"
set rsc3=conn.execute(sql3)
if not rsc3.bof then
do while not rsc3.eof
zdid3=rsc3("id"):bd3Title=rsc3("Title"):bd3name=rsc3("FieldName"):zd4hz=rsc3("zdhz")
hzbt=hzbt&"<td>"&bd3Title&"</td>"
if instr(zd4hz,"ltj")>0  then 
zdtjs=zdtjs&"|"&bd3Title
hzbta=hzbta&"<td align=""center"">"&bd3Title&"</td>"
else
hzbta=hzbta&"<td></td>"
end if
hzhes=hzhes&""&zd4hz&"|"
if Instr(zd4hz,"sook")>0 then sozd=sozd&""&bd3name&"|"
hzsjx=hzsjx&""&bd3name&"|"
rsc3.movenext
loop
end if
rsc3.close:set rsc3=nothing
 
 
 
 
 
sql="select * from "&mxbiao1&" where gid="&xxid&" "  
if m2id>0 then sql=sql&" and g1id="&m2id&""
if len(mopx)>1 and (instr(mopx,"asc")>0 or instr(mopx,"desc")>0) then   sql=sql&" order by "&mopx&" id desc"  else  sql=sql&" order by id desc"  

'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>
<%
do while not rsxiao.eof
zdid=rsxiao("id")
%>
<div class="bdys<%=bdys%> ddyy">
<%
mxdat3=cdatx("mxdat","SZ_mx","where id="&chkid&"")
sql3="select * from SZ_zd where ChannelID="&chkid&" and ShowOnForm=1 order by OrderID desc,id asc"
set rsc3=conn.execute(sql3)
if not rsc3.bof then
'Response.Write "<table class=""toptable"" border=""1"" cellPadding=""4"" align=""center""><tr><td>"
do while not rsc3.eof
id3=chk0(rsc3("id"))
bd3Title=rsc3("Title"):bd3name=rsc3("FieldName"):zd3hz=rsc3("zdhz")
if Instr(zd3hz,"bbdyin")<=0 then
edx3=cdatx(""&bd3name&"",""&mxdat3&"","where id="&zdid&"")
if Instr(zd3hz,"stoh")>0 and IsNumeric(edx3) then edx31="("&int2chn(edx)&")"
if Instr(zd3hz,"bh1ang")>0 then cla3s="style=""float: left; width:100%"""
if Instr(zd3hz,"bh2ang")>0 then cla3s="style=""float: left; width:49%"""
if Instr(zd3hz,"bh3ang")>0 then cla3s="style=""float: left; width:33%"""
if Instr(zd3hz,"bh4ang")>0 then cla3s="style=""float: left; width:24%"""

Response.Write "<dl "&cla3s&"><span class=""sunbt"&bdys&""">"&bd3Title&"：</span>"&edx3&""&edx31&"</dl>"
end if
shux="":edx31="":cla3s=""
rsc3.movenext
loop
'Response.Write "</td></tr></table>"
end if
rsc3.close:set rsc3=nothing
%></div>


<%
sql5="select * from MX_FHQK where gid="&zdid&" "  
sql=sql&" order by id desc"  
'Response.Write ""&sql5&"<br>"  
set rsda =server.createobject("ADODB.RecordSet")	
rsda.open sql5,conn,1,3
if not rsda.eof then
%>
<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 rsda.eof
%>
<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=226 and FieldName='"&hzsj1(hh)&"'")
if instr(zdhz0,"ltj")>0  then 
zdhz1=cdatx("Title","SZ_zd","where ChannelID=226 and FieldName='"&hzsj1(hh)&"'")
tjsjc=tjsjc&"[#]"&zdhz1&"|"&CDbl(chk0(rsda(""&hzsj1(hh)&"")))&""
end if
'Response.Write ""&zdhz0&""
Response.Write "<td align=""center"">"

'if hzsj1(hh)="zdsh" then Response.Write ""&chksh(rsda(""&hzsj1(hh))&"")&"" else 
Response.Write ""&rsda(""&hzsj1(hh)&"")&""
Response.Write "</td>"
next%>
<%if instr(allsx,"bbnocz")>0 then%><%if instr(bbxian,"xssj")>0 then%><td align="center"><%=rsda("tjsj")%></td><%end if%>
<%end if%></tr>

<%
rsda.movenext
loop

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
%>
<tr><%=hzbta%></tr>
</table><br><br><br><br><br><br>

<%
end if
Response.Write "<br><hr><br>"
rsxiao.movenext
loop
end if%>

<%
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
%>

<span style="float: right">制表人：<%=nowuser%></span>

<!--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>