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 }