private void Print(HttpContext context) { //获取需要打印的信息 string storageJxRecordID = context.Request.QueryString["ID"].ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append(@"select s.ID,s.WBID,s.storageJxRecordID,s.strGUID,s.serialNumber,s.BusinessName,CONVERT(NVARCHAR(100),dt_Trade,23) AS dt_Trade,d.strName as DepName, w.strName as WBName,t.strName as TypeName,st.strName as TimeName,s.Unit,s.Accountant_Name, v.strName as goodName,s.AccountNumber,CONVERT(nvarchar(100),StorageDate,23) as StorageDate, s.CurrentRate,s.Lixi,s.numWeight,s.numPrice from StorageJxCalculate as s left outer join WB as w on w.ID=s.WBID left outer join StorageType as t on t.ID=s.TypeID left outer join StorageTime as st on st.ID=s.TimeID left outer join StorageVariety as v on v.ID=s.VarietyID left outer join Depositor as d on d.AccountNumber=s.AccountNumber where 1=1 "); strSql.Append(" and s.storageJxRecordID=@storageJxRecordID "); SqlParameter[] parameters = { new SqlParameter("@storageJxRecordID", SqlDbType.Int, 4) }; parameters[0].Value = storageJxRecordID; DataTable dtLog = SQLHelper.ExecuteDataTable(strSql.ToString(), parameters); if (dtLog == null || dtLog.Rows.Count == 0) { context.Response.Write(""); return; } string strGUID = dtLog.Rows[0]["strGUID"].ToString(); string serialNumber = dtLog.Rows[0]["serialNumber"].ToString(); string WBName = dtLog.Rows[0]["WBName"].ToString(); string Dep_AN = dtLog.Rows[0]["AccountNumber"].ToString(); string Dep_Name = dtLog.Rows[0]["DepName"].ToString(); // string StorageDay = dtLog.Rows[0]["StorageDay"].ToString(); string BusinessName = dtLog.Rows[0]["BusinessName"].ToString(); string GoodName = dtLog.Rows[0]["goodName"].ToString(); string UnitName = dtLog.Rows[0]["Unit"].ToString(); string numWeight = dtLog.Rows[0]["numWeight"].ToString(); string numPrice = dtLog.Rows[0]["numPrice"].ToString(); string Lixi = dtLog.Rows[0]["Lixi"].ToString(); string Money_Total = dtLog.Rows[0]["Lixi"].ToString(); // string Money_Surplus = dtLog.Rows[0]["Money_Surplus"].ToString(); string Money_Reality = dtLog.Rows[0]["Lixi"].ToString(); string dt_Trade = dtLog.Rows[0]["dt_Trade"].ToString(); string StorageDate = dtLog.Rows[0]["StorageDate"].ToString(); string Accountant_Name = dtLog.Rows[0]["Accountant_Name"].ToString(); StringBuilder strReturn = new StringBuilder(); //标题 string CompanyName = common.GetCompanyInfo()["strName"].ToString(); strReturn.Append(" <table style='width: 640px; padding: 10px 0px;'>"); strReturn.Append(" <tr><td align='center' style='font-size: 18px; font-weight: bolder; text-align: center;'><span>" + CompanyName + " 利息结算凭证</span></td> </tr>"); strReturn.Append(" <tr><td align='center' style='font-size: 12px; text-align: center;'> <span>防伪码:" + strGUID + "</span> <span>编号:" + serialNumber + "</span> </td> </tr>"); strReturn.Append(" </table>"); //首行内容 strReturn.Append(" <table style='font-size: 14px; padding-bottom:5px;'><tr>"); strReturn.Append(" <td style='width: 200px;'> <span >网点名称:" + WBName + "</span> </td>"); strReturn.Append(" <td style='width: 240px;'> <span >储户姓名:" + Dep_Name + "</span> </td>"); strReturn.Append(" <td style='width: 200px;'> <span >日期:" + StorageDate + "</span> </td>"); strReturn.Append(" </tr> </table>"); //表格内容 strReturn.Append(" <table class='tabPrint' style='padding: 5px 0px; font-size: 14px;'>"); //添加表格样式 strReturn.Append(" <style>"); strReturn.Append(" table.tabPrint{ border-collapse: collapse; border: 1px solid #666; font-size: 14px;}"); strReturn.Append(" table.tabPrint thead td, table.set_border th{ font-weight: bold; background-color: White;}"); strReturn.Append(" table.tabPrint tr:nth-child(even){ background-color: #666;}"); strReturn.Append(" table.tabPrint td, table.border th{ border: 1px solid #666;}"); strReturn.Append(" </style>"); strReturn.Append(" <tr style='height: 20px;'>"); strReturn.Append(" <td style='width: 100px;'> <span>业务名称</span></td>"); strReturn.Append(" <td style='width: 100px;'> <span>储户账号</span></td>"); strReturn.Append(" <td style='width: 100px;'> <span>产品类型</span></td>"); strReturn.Append(" <td style='width: 80px;'> <span>重量</span></td>"); strReturn.Append(" <td style='width: 80px;'> <span>单价</span></td>"); strReturn.Append(" <td style='width: 90px;'> <span>应付利息</span></td>"); strReturn.Append(" <td style='width: 90px;'> <span>实付利息</span></td>"); strReturn.Append(" </tr>"); strReturn.Append(" <tr style='height: 20px;'>"); strReturn.Append(" <td > <span>" + BusinessName + "</span></td>"); strReturn.Append(" <td> <span>" + Dep_AN + "</span></td>"); strReturn.Append(" <td> <span>" + GoodName + "</span></td>"); strReturn.Append(" <td> <span>" + numWeight + "</span></td>"); strReturn.Append(" <td> <span>" + numPrice + "</span></td>"); strReturn.Append(" <td> <span>¥" + Money_Total + "</span></td>"); strReturn.Append(" <td> <span>¥" + Money_Reality + "</span></td>"); strReturn.Append(" </tr>"); string strMoney_Reality = Fun.ChangeToRMB(Money_Reality); strReturn.Append(" <tr style='height: 20px;'>"); strReturn.Append(" <td> <span>大写金额</span></td>"); strReturn.Append(" <td colspan='4'> <span>" + strMoney_Reality + "</span></td>"); strReturn.Append(" <td colspan='2'></td>");//<span>余款合计:¥</span> <span>" + Money_Surplus + "</span> strReturn.Append(" </tr>"); //第三行内容 strReturn.Append(" <table style='font-size: 14px; padding:5px 0px;'>"); strReturn.Append(" <tr style='height: 25px;'>"); strReturn.Append(" <td style='width:160px;'> <span>付款日期:" + dt_Trade + "</span></td>"); strReturn.Append(" <td style='width:160px;'> <span>计量单位:元、" + UnitName + "</span></td>"); strReturn.Append(" <td style='width:160px;'> <span>总部会计:" + Accountant_Name + "</span></td>"); strReturn.Append(" <td align='right' style='width:80px;'> <span>分行签名:</span></td><td> <div style='width:80px;height:25px; border-bottom:1px solid #333;'></div></td>"); strReturn.Append(" </tr>"); strReturn.Append(" </table>"); context.Response.Write(strReturn.ToString()); }