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

xxid=requestA("xxid")
k1ey=requestA("key1")
k2ey=requestA("key2")
x1id=chk0(requestA("x1id"))
cdid=chk0(requestA("cdid"))
chk=requestA("chk")

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"

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


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=259 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"-->
<%
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&"><p>"&bdTitle&"：</p><b>"&edx&""&edx1&"</b></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
%>

<%
aa=0
sql="select * from MX_YWGL where ZD_YJZYGS like '%"&k1ey&"%' order by tjsj desc,id asc"
set rsc2=conn.execute(sql)
if not rsc2.bof then
Response.Write "<table class=""toptable"" border=""1"" cellPadding=""4"" align=""center"">"
Response.Write "<tr><td><b>序号</td><td><b>船名/航次</td><td><b>提单数</b></td><td><b>应付基数</b></td><td><b>单价合计</b></td><td><b>应付小计</b></td>  <td><b>已付小计</b></td> <td><b>未付小计</b></td></tr>"
do while not rsc2.eof
d1=chk0(conn.execute("select sum(ZD_HJ) from MX_GKZYGS1 where gid="&rsc2("id")&"")(0)):did1=chk0(cdatx("id","MX_GKZYGS1","where gid="&rsc2("id")&"")):e1=chk0(conn.execute("select sum(ZD_JEY) from MX_SFFY where gid="&did1&" and g1id=208")(0))
d2=chk0(conn.execute("select sum(ZD_HJ) from MX_CGS3 where gid="&rsc2("id")&"")(0)):did2=chk0(cdatx("id","MX_CGS3","where gid="&rsc2("id")&"")):e2=chk0(conn.execute("select sum(ZD_JEY) from MX_SFFY where gid="&did2&" and g1id=209")(0))
d3=chk0(conn.execute("select sum(ZD_HJ) from MX_TYGS2 where gid="&rsc2("id")&"")(0)):did3=chk0(cdatx("id","MX_TYGS2","where gid="&rsc2("id")&"")):e3=chk0(conn.execute("select sum(ZD_JEY) from MX_SFFY where gid="&did3&" and g1id=210")(0))
d4=chk0(conn.execute("select sum(ZD_HJ) from MX_FJGS2 where gid="&rsc2("id")&"")(0)):did4=chk0(cdatx("id","MX_FJGS2","where gid="&rsc2("id")&"")):e4=chk0(conn.execute("select sum(ZD_JEY) from MX_SFFY where gid="&did4&" and g1id=211")(0))
d5=chk0(conn.execute("select sum(ZD_HJ) from MX_DBGS2 where gid="&rsc2("id")&"")(0)):did5=chk0(cdatx("id","MX_DBGS2","where gid="&rsc2("id")&"")):e5=chk0(conn.execute("select sum(ZD_JEY) from MX_SFFY where gid="&did5&" and g1id=212")(0))
d6=chk0(conn.execute("select sum(ZD_HJ) from MX_ZC1 where gid="&rsc2("id")&"")(0)):did6=chk0(cdatx("id","MX_ZC1","where gid="&rsc2("id")&"")):e6=chk0(conn.execute("select sum(ZD_JEY) from MX_SFFY where gid="&did6&" and g1id=213")(0))
d7=chk0(conn.execute("select sum(ZD_HJ) from MX_JD2 where gid="&rsc2("id")&"")(0)):did7=chk0(cdatx("id","MX_JD2","where gid="&rsc2("id")&"")):e7=chk0(conn.execute("select sum(ZD_JEY) from MX_SFFY where gid="&did7&" and g1id=214")(0))
a1=d1+d2+d3+d4+d5+d6+d7
b1=e1+e2+e3+e4+e5+e6+e7
aa1=aa1+a1+0
bb1=bb1+b1+0
cc1=aa1-bb1+0
aa=aa+1
'Response.Write "<tr><td><b>"&aa&"</b></td><td><b>"&rsc2("ZD_CM")&"/"&rsc2("ZD_CMHC")&"</b></td><td>"&rsc2("ZD_TSS")&"</td><td>"&rsc2("ZD_TSS")&"</td><td>"&FormatNumber(chk0(clng(a1)/clng(rsc2("ZD_TSS"))),2)&"</td>"
Response.Write "<tr><td><b>"&aa&"</b></td><td><b>"&rsc2("ZD_CM")&"/"&rsc2("ZD_CMHC")&"</b></td><td>"&rsc2("ZD_TSS")&"</td><td>"&rsc2("ZD_TSS")&"</td><td>"
if chk0(a1)>0 or chk0(rsc2("ZD_TSS"))>0 then Response.Write ""&FormatNumber(a1/rsc2("ZD_TSS"),2)&""
Response.Write "</td>"

Response.Write "<td>"&a1&"</td><td>"&b1&"</td><td>"&FormatNumber(a1-b1,2)&"</td>"
Response.Write "</tr>"
rsc2.movenext
a1=0:b1=0
loop
Response.Write "<tr><td><b>合    计</b></td><td></td><td></td><td></td><td></td><td>"&aa1&"</td><td>"&bb1&"</td><td><h3>"&FormatNumber(cc1,2,-2)&"</h3></td></tr>"
Response.Write "</table>"
end if
rsc2.close:set rsc2=nothing
%>

<%
'Response.Write "<h3>"&FormatNumber(chk0(yfjin),2,-2)&"-"&FormatNumber(chk0(sfjin),2,-2)&"=未收金额："&FormatNumber((yfjin-sfjin),2,-2)&"</h3>"
%>
<hr><span style="float: right">制表人：<%=nowuser%></span><b><%'=gszhang%></b>


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