You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.0 KiB
C#

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TradeModel;
namespace TradeManage.PrintTemplate
{
public partial class GoodBatchPrint : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<GoodWarePrint> gwplist = new List<GoodWarePrint>();
if (Session["GoodWarePrint2"] != null)
gwplist = (List<GoodWarePrint>)Session["GoodWarePrint2"];
if (gwplist == null || gwplist.Count == 0)
return;
// GoodWarePrint gwp = new GoodWarePrint();
// gwp.Descript="黑色";
// gwp.GoodBatch = "423395-1234578-001";
// gwp.GoodNo = "C009-001";
// gwp.WareNo = "仓库";
// gwplist.Add(gwp);
//;
CrystalReportSource1.ReportDocument.SetDataSource(gwplist);
CrystalReportSource1.DataBind();
//ReportDocument rptSales = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
//rptSales.FileName = Server.MapPath("GoodBatch.rpt");
//rptSales.SetDataSource(gwplist);
//PrintDocument prtdoc = new PrintDocument();
//string strDefaultPrinter = prtdoc.PrinterSettings.PrinterName;
//// then print, this is the important thing here
//rptSales.PrintOptions.PrinterName = strDefaultPrinter;
//rptSales.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize;
//rptSales.PrintOptions.PaperSource = CrystalDecisions.Shared.PaperSource.Auto;
////parameters here depending on your situation.
//rptSales.ExportToHttpResponse(
// ExportFormatType.PortableDocFormat, Response, false, "");
}
}
}