PDF-activereport

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Text;
using System.Drawing;
using System.Drawing.Printing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Security.Cryptography;
using DataDynamics.ActiveReports;
using ArExports = DataDynamics.ActiveReports.Export;
using DataDynamics.ActiveReports.Export.Pdf;
using System .IO ;
using  LackIS.components;

namespace LackIS
{
	/// <summary>
	/// LackDetialListPrint の概要の説明です。

	/// </summary>
	public class LackDetialListPrint : System.Web.UI.Page
	{
		#region 変量
		
		protected ArExports.Pdf.PdfExport pdf=new PdfExport();
		protected	ActiveReport rpt;
		
		//protected string name="欠品明細リスト印刷.PDF";
		#endregion
		private void Page_Load(object sender, System.EventArgs e)
		{
			
			
				PrintModule	rpt1=new PrintModule();
				rpt1.PageSettings.Margins.Left =0.2f;
				rpt1.PageSettings.Margins.Top=0.15f;
				rpt1.PageSettings.Margins.Right =0.15f;
				rpt1.PageSettings.Margins.Bottom=0.05f;
				rpt1.PageSettings .PaperKind =PaperKind .A4 ;//用紙タイプを設定する

				rpt1.PageSettings .Orientation =DataDynamics.ActiveReports .Document .PageOrientation.Landscape;
				rpt1.SubReport1.Report=LineItemcount;
				if(dt!=null)
				{
					if(dt.Rows .Count <=0)
					{
						Page.RegisterStartupScript("1","<script>alert('ご指定の抽出条件でデータがありません。')</script>");
				
					}

					else
					{
						Response.ContentType = "application/pdf";
						Response.AddHeader("content-disposition","attachment; filename=LackList.PDF");
						
						System.IO.MemoryStream memStream = new System.IO.MemoryStream();
						rpt1.DataSource = dt ;
						rpt1.TextBox3.Text=storenm;//店名
						rpt1.TextBox4.Text=datatype;//調査時間
						if(dt.Rows.Count%15==0)
							con=dt.Rows.Count/15;
						else
							con=dt.Rows.Count/15+1;
						int bb=dt.Rows.Count-dt.Rows.Count/15*15;
						if((bb+this.PdfList.Rows.Count)>14)
						{
							for(int i=0;i<14-bb;i++)
							{
								DataRow dtNew = dt.NewRow();
								dtNew[0]=0;
								dtNew[1]="";
								dtNew[2]="";
								dtNew[3]="";
								dtNew[4]="";
								dtNew[5]="";
								dtNew[6]="";
								//dtNew[7]=1000;
								//dtNew[8]=1000;
								//dtNew[9]=0;
								dt.Rows.Add(dtNew);
							}
						}
						rpt1.TextBox6.Text=this.con.ToString();
						rpt1.Run();
						pdf.Export(rpt1.Document, memStream);
						Response.BinaryWrite(memStream.ToArray());	
						Response.End();
					}
				}
				else
					Page.RegisterStartupScript("1","<script>logerror()</script>");
				
				
			
			}
			else//週別、月別
			{
				PrintModuleMW	rpt2=new PrintModuleMW();
				rpt2.PageSettings.Margins.Left =0.2f;
				rpt2.PageSettings.Margins.Top=0.15f;
				rpt2.PageSettings.Margins.Right =0.15f;
				rpt2.PageSettings.Margins.Bottom=0.1f;
				rpt2.PageSettings .PaperKind =PaperKind .A4 ;//用紙タイプを設定する 
				rpt2.PageSettings .Orientation =DataDynamics.ActiveReports .Document .PageOrientation.Landscape;
				rpt2.SubReport1.Report=LineItemcount;

				if(dt!=null)
				{
					if(dt.Rows .Count <=0)
					{
						Page.RegisterStartupScript("2","<script>alert('ご指定の抽出条件でデータがありません。')</script>");	
				
					}
					else
					{
						Response.ContentType = "application/pdf";
						Response.AddHeader("content-disposition","attachment; filename=LackList.PDF");
						System.IO.MemoryStream memStream = new System.IO.MemoryStream();
						if(dt.Rows.Count%15==0)
							con=dt.Rows.Count/15;
						else
							con=dt.Rows.Count/15+1;
						int bb=dt.Rows.Count-dt.Rows.Count/15*15;
						if((bb+this.PdfList.Rows.Count)>14)
						{
							for(int i=0;i<14-bb;i++)
							{
								DataRow dtNew = dt.NewRow();
								dtNew[0]=0;
								dtNew[1]="";
								dtNew[2]="";
								dtNew[3]="";
								dtNew[4]="";
								dtNew[5]="";
								dtNew[6]="";
								//dtNew[7]=1000;
								dtNew[8]=0;
								dt.Rows.Add(dtNew);
							}
						}
						rpt2.DataSource = dt ;
						rpt2.DataMember = dt.TableName;
						rpt2.TextBox3.Text=storenm;//店名
						rpt2.TextBox4.Text=datatype;//調査時間

						
						rpt2.TextBox6.Text=this.con.ToString();
						rpt2.Run();
						pdf.Export(rpt2.Document, memStream);
						Response.BinaryWrite(memStream.ToArray());	
						Response.End();
					}
				}
				else
					Page.RegisterStartupScript("1","<script>logerror()</script>");
				

				
			}
			#endregion

		}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值