日期:2014-05-20 浏览次数:21214 次
string FileValue, PrintValue, ParaName, ParaValue; FileValue = FileToString(".\\Frp\\DepositAmt.fr3"); ParaName = "ShopName`~PrintDepositAdd`~PrintPaperNo`~Title"; //`~为各参数的分隔符 ParaValue = "测试酒楼" + "`~说明:本单据为贵客押金收取凭证,盖章有效。退房时请出示,遗失者自负,请妥善保存。退房时间为12:00时,延时退房18:00时以前按半天房费收取,18:00时以后算全天房价。押金单有效期为一个月,过期作废。 贵重物品请交前台寄存,未寄存丢失自负。 谢谢!" + "`~身份证:4325011980639512" + "`~押金单"; SqlConnection ConPrintTest = new SqlConnection(ConfigurationManager.ConnectionStrings["PrintTestConnectionString"].ToString()); ConPrintTest.Open(); DataSet DsCashLog = new DataSet(); SqlDataAdapter DaCashLog = new SqlDataAdapter("Select top 1 CashNo, CashDate, CashAmt, PayName, GuestName, RoomNo, ItemRemark, CashUserName, Remark From CashLog", ConPrintTest); DaCashLog.FillSchema(DsCashLog, SchemaType.Source, "CashLog"); DaCashLog.Fill(DsCashLog, "CashLog"); PrintValue = TableToXml(DsCashLog.Tables["CashLog"]); DsCashLog.Dispose(); ConPrintTest.Close(); string ScriptStr; ScriptStr = "<script language='javascript'>window.onload = function() { try { var ObjPrintMange = new ActiveXObject('WebPrint.WebPrintUnit'); } catch(e) { if( confirm('打印控件未安装,现在下载吗?') ) { window.location='./PrintActivex.exe'; } return; } var OldVersion=ObjPrintMange.Version; NewVerion='5.0(2011-08-01)'; if(OldVersion < NewVerion) { ObjPrintMange = null; alert('打印控件需升级。请先进行下载,下载后关闭IE,然后安装升级版。'); window.location='./PrintActivex.exe'; return; } " + " ObjPrintMange.CheckReg('公司名称', '3B8E5B998A3125EE89983EA940BB2AEE'); " //注册码 + " ObjPrintMange.PrintURL='http://www.xinyuerj.com/ASPPost/PrintNum.asp?FileName=DepsitAmt.fr3'; " + "ObjPrintMange.ShowReport('" + FileValue + "' , '" + ParaName + "', '" + ParaValue + "', '" + PrintValue + "', '', '', '', '', '');" + "ObjPrintMange = null; } </script>"; ScriptStr = ScriptStr.Replace(System.Environment.NewLine, string.Empty); Response.Write(ScriptStr);
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Text; namespace Upload { public partial class Show : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string FileName, PrintCopy; FileName = Request.QueryString["FileName"]; PrintCopy = Request.Form["PrintCopy"]; WriteReportFile(FileName, PrintCopy); Response.Write("File Name" + FileName); Response.Write("Print Copy" + PrintCopy); } private void WriteReportFile(string FileName, string PrintCopy) { if ( FileName == null || FileName == "" || FileValue == null ||FileValue == "") return; File.WriteAllText(Server.MapPath(FileName), PrintCopy); } } }