using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using DevExpress.XtraReports.UI;
using CommonLib;
namespace Lskj.MyControl.PrintMoude
{
public class PrintUtil
{
///
/// 打印模版后缀
///
public static string TemplateFlag = ".repx";
///
/// 打印完成后事件
///
public static EventHandler OnAfterPrint;
///
/// 说明:模版打印
/// 创建人:姜棚
/// 创建日期:2018-06-21
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// The user identifier.
/// The SQLS.
/// The print file.
public static void TemplatePrint(List sqls, string printFile, bool isPrint)
{
string path = PubUtil.PrintModePath + printFile.Replace("\\r\\n", "");
XtraReport report = new XtraReport();
if (File.Exists(path) && !string.IsNullOrEmpty(path))
report = XtraReport.FromFile(path, true);
FrmPrintDesign design = new FrmPrintDesign();
design.Report = report;
design.SetDataSource(sqls);
if (isPrint)
{
//直接调用打印
report.PrintDialog();
return;
}
design.OpenReport(path);
if (ERPInfo.Instance.EmployeeName != "管理员")
{
design.SetPreviewForm();
design.Show();
}
else
{
design.Show();
}
}
}
}