apzl_leasing/WebContent/FormatDoc/IncludePOFooter.jsp
2018-06-03 22:26:41 +08:00

171 lines
7.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script type="text/javascript">
<%
if(sMethod.equals("2")){ //2:save
%>
alert("±£´æ³É¹¦£¡");
<%
}
if(sMethod.equals("2") || sMethod.equals("5")){ //2:save,5:autosave
%>
var objW;
if(typeof(window.opener)=='undefined')
objW=window.parent;
else
objW=window.opener.top;
objW.bEditHtmlChange = false;
<%
}
if(sMethod.equals("3")){
session.setAttribute(sPreviewContent,sReportInfo);
%>
var CurOpenStyle = "width=720,height=540,top=20,left=20,toolbar=no,scrollbars=yes,resizable=yes,status=yes,menubar=no,";
OpenPage("/Resources/CodeParts/Preview01.jsp?sid=<%=sPreviewContent%>","_blank02",CurOpenStyle);
<%
}
if(sMethod.equals("4")){ //4:export
ASResultSet rs = null;
String sSql99="",sSavePath="",sfSerialNo="",sSql1= "",sSql2="";
if(sFirstSection.equals("1")){
sSql99=" select SerialNo,SavePath from FORMATDOC_RECORD where ObjectType='"+sObjectType+"' and ObjectNo='"+sObjectNo+"'";
// "' and ObjectType='PutOutApply' ";
rs = Sqlca.getASResultSet(sSql99);
if(rs.next()){
sfSerialNo = rs.getString("SerialNo");
sSavePath = rs.getString("SavePath");
}
rs.getStatement().close();
if(sfSerialNo==null) sfSerialNo="";
if(sSavePath==null) sSavePath="";
}
//export to file
MD5 m = new MD5();
String sSerialNoNew=m.getMD5ofStr(sSerialNo);
//if dir not exists, make dirs
java.io.File dFile=null;
String sBasePath = CurConfig.getConfigure("WorkDocSavePath");
if(sBasePath == null || sBasePath.equals(""))
sBasePath=application.getRealPath("/FormatDoc/WorkDoc");
//add YYYY/MM dir to the file save path
String sToday = StringFunction.getToday();
String sFileSavePath=sBasePath+"/"+sToday.substring(0,4)+"/"+sToday.substring(5,7);
try {
dFile=new java.io.File(sFileSavePath);
if(!dFile.exists()) {
dFile.mkdirs();
}
}catch (Exception e) {
ARE.getLog().error(e.getMessage(),e);
throw e;
}
String sFileName = sFileSavePath+"/"+sSerialNoNew+".html";
if(sFirstSection.equals("1")){
if(sfSerialNo.equals("")){
sSql1 = "delete from FORMATDOC_RECORD where serialno='"+sSerialNo+"'";
sSql2=" insert into FORMATDOC_RECORD values('"+sSerialNo+"','"+sObjectType+"','"+sObjectNo+"','','"+sFileName+"','','','','','')";
}else if(!sfSerialNo.equals("") && !sSavePath.equals(sFileName)){
sSql2=" update FORMATDOC_RECORD set SavePath='"+sFileName+"' where ObjectType='"+sObjectType+"' and ObjectNo='"+sObjectNo+"' ";
}else sSql2="";
}
java.io.File file = new java.io.File(sFileName);
java.io.FileOutputStream fileOut = null;
StringBuffer sb = new StringBuffer();
if(sFirstSection.equals("1"))
fileOut = new java.io.FileOutputStream(file,false);
else
fileOut = new java.io.FileOutputStream(file,true);
if(sFirstSection.equals("1")){
sb.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\"><title>"+sSerialNo+".html</title>");
sb.append("<style>.table1 { border: solid; border-width: 1px 1px 2px 2px; border-color: #000000 black #000000 #000000} .td1 { border-color: #000000 #000000 black black; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 0px;font-size: 10pt; color: #000000} </style> ");
sb.append("<script type=\"text/javascript\">");
sb.append("function mykd() {if(event.keyCode==114 || event.keyCode==116 || event.keyCode==122 || (event.keyCode==78 && event.ctrlKey) ) { event.keyCode=0; event.returnValue=false; return false; } } ");
//½«ExportToWordº¯ÊýҲдÈëhtml
sb.append("function ExportToWord(){ var oWD = new ActiveXObject('word.Application'); oWD.Application.Visible = true; var oDC =oWD.Documents.Add('',0,1); var oRange =oDC.Range(0,1); var sel=parent.document.body.createTextRange(); oTblExport = parent.document.getElementById('reportContent'); if (oTblExport != null) { sel.moveToElementText(oTblExport); sel.execCommand('Copy'); parent.document.body.blur(); oRange.Paste(); } } ");
sb.append("</script>");
sb.append("<style> @media print { input[type='button'] {display:none }} </style>");
sb.append("<body style='word-break:break-all' > <div id=div1 style=\"display:none\" > <object ID='WebBrowser1' WIDTH=0 HEIGHT=0 border=1 style=\"display:none\" CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2' > </object> ");
sb.append("<input type=button value='´òÓ¡ÉèÖÃ' onclick=\"WebBrowser1.ExecWB(8,1)\"> <input type=button value='´òÓ¡Ô¤ÀÀ' onclick=\"WebBrowser1.ExecWB(7,1)\"> <input type=button value='´òÓ¡' onclick=\"WebBrowser1.ExecWB(6,1)\"> <input type=button value='Áí´æÎª' onclick=\"WebBrowser1.ExecWB(4,1)\"> <!--<input type=button value='µ¼³öµ½word' onclick=\"ExportToWord()\">--> <input type=button value='¹Ø±Õ' onclick=\"WebBrowser1.ExecWB(45,1)\"><p></div></body> ");
sb.append("<script type=\"text/javascript\"> if(window.dialogArguments==\"myprint10\") div1.style.cssText=\"display:none\"; else div1.style.cssText=\"display:block\"; ");
sb.append("try { document.body.onkeydown=mykd; } catch(e) {var a=1;} try { document.onkeydown=mykd; } catch(e) {var a=1;} try { document.oncontextmenu=Function(\"return false;\"); } catch(e) {var a=1;}</script>");
}
//½«±¨¸æÄÚÈÝǰÌí¼Ódiv±êÇ©
sb.append("<div id=reportContent style='margin-top:2%'>");
sb.append(sReportInfo);
sb.append("</div>");
//if(sFirstSection.equals("END")){
//±¨¸æÎ²Ò³Ìí¼Ódiv±êÇ©,Ŀǰһ°ã³öÕÊ֪ͨÊ鶼Ϊһҳ£¬ËùÒÔ×¢Ê͵ôÌõ¼þÅжÏ
//sb.append("</div>");
//}
fileOut.write(sb.toString().getBytes("GBK"));
fileOut.close();
if(sFirstSection.equals("1")){
if(!sSql1.equals("")){
Sqlca.executeSQL(sSql1);
}
if(!sSql2.equals("")){
Sqlca.executeSQL(sSql2);
}
}
%>
self.close();
<%
}
%>
</script>
<%/*~BEGIN~²»¿É±à¼­Çø~[Editable=false;CodeAreaID=Report01;Describe=Ö÷ÌåÒ³Ãæ;]~*/%>
<%
if(sMethod.equals("1")){ //1:display
%>
<%@include file="/Resources/CodeParts/Report01.jsp"%>
<%
}
%>
<%/*~END~*/%>
<script type="text/javascript">
<%
if(sMethod.equals("1")){ //1:display
%>
//±£´æ
function my_save(){
reportInfo.target = "mypost0";
reportInfo.Method.value = "2"; //1:display;2:save;3:preview;4:export
reportInfo.Rand.value = randomNumber();
reportInfo.submit();
}
//Ô¤ÀÀ
function my_preview(){
reportInfo.target = "mypost0";
reportInfo.Method.value = "3"; //1:display;2:save;3:preview;4:export
reportInfo.Rand.value = randomNumber();
reportInfo.submit();
}
//µ¼³ö
function my_export(){
reportInfo.target = "mypost0";
reportInfo.Method.value = "4"; //1:display;2:save;3:preview;4:export
reportInfo.Rand.value = randomNumber();
reportInfo.submit();
}
//×Ô¶¯±£´æ
function my_autosave(){
reportInfo.target = "mypost0";
reportInfo.Method.value = "5"; //1:display;2:save;3:preview;4:export;5:autosave
reportInfo.Rand.value = randomNumber();
reportInfo.submit();
}
if(bEditHtmlAutoSave) window.setInterval(my_autosave, 60000); //ÿ1·ÖÖÓ×Ô¶¯±£´æ
<%
}
%>
</script>